@voicenter-team/events-sdk 0.0.96 → 0.0.100

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,20 +1,19 @@
1
- "use strict";var Hr=Object.defineProperty;var $r=(t,e,r)=>e in t?Hr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var J=(t,e,r)=>($r(t,typeof e!="symbol"?e+"":e,r),r);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Vr=require("ws");function Kr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var lr={exports:{}},fr={exports:{}};(function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e={rotl:function(r,n){return r<<n|r>>>32-n},rotr:function(r,n){return r<<32-n|r>>>n},endian:function(r){if(r.constructor==Number)return e.rotl(r,8)&16711935|e.rotl(r,24)&4278255360;for(var n=0;n<r.length;n++)r[n]=e.endian(r[n]);return r},randomBytes:function(r){for(var n=[];r>0;r--)n.push(Math.floor(Math.random()*256));return n},bytesToWords:function(r){for(var n=[],o=0,c=0;o<r.length;o++,c+=8)n[c>>>5]|=r[o]<<24-c%32;return n},wordsToBytes:function(r){for(var n=[],o=0;o<r.length*32;o+=8)n.push(r[o>>>5]>>>24-o%32&255);return n},bytesToHex:function(r){for(var n=[],o=0;o<r.length;o++)n.push((r[o]>>>4).toString(16)),n.push((r[o]&15).toString(16));return n.join("")},hexToBytes:function(r){for(var n=[],o=0;o<r.length;o+=2)n.push(parseInt(r.substr(o,2),16));return n},bytesToBase64:function(r){for(var n=[],o=0;o<r.length;o+=3)for(var c=r[o]<<16|r[o+1]<<8|r[o+2],l=0;l<4;l++)o*8+l*6<=r.length*8?n.push(t.charAt(c>>>6*(3-l)&63)):n.push("=");return n.join("")},base64ToBytes:function(r){r=r.replace(/[^A-Z0-9+\/]/ig,"");for(var n=[],o=0,c=0;o<r.length;c=++o%4)c!=0&&n.push((t.indexOf(r.charAt(o-1))&Math.pow(2,-2*c+8)-1)<<c*2|t.indexOf(r.charAt(o))>>>6-c*2);return n}};fr.exports=e})();var Yr=fr.exports,kt={utf8:{stringToBytes:function(t){return kt.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(kt.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var e=[],r=0;r<t.length;r++)e.push(t.charCodeAt(r)&255);return e},bytesToString:function(t){for(var e=[],r=0;r<t.length;r++)e.push(String.fromCharCode(t[r]));return e.join("")}}},Yt=kt;/*!
1
+ "use strict";var Be=Object.defineProperty;var De=(a,t,e)=>t in a?Be(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var V=(a,t,e)=>(De(a,typeof t!="symbol"?t+"":t,e),e);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const je=require("ws"),q=require("@voicenter-team/socketio-storage-logger");function Pe(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var Te={exports:{}},be={exports:{}};(function(){var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t={rotl:function(e,s){return e<<s|e>>>32-s},rotr:function(e,s){return e<<32-s|e>>>s},endian:function(e){if(e.constructor==Number)return t.rotl(e,8)&16711935|t.rotl(e,24)&4278255360;for(var s=0;s<e.length;s++)e[s]=t.endian(e[s]);return e},randomBytes:function(e){for(var s=[];e>0;e--)s.push(Math.floor(Math.random()*256));return s},bytesToWords:function(e){for(var s=[],o=0,h=0;o<e.length;o++,h+=8)s[h>>>5]|=e[o]<<24-h%32;return s},wordsToBytes:function(e){for(var s=[],o=0;o<e.length*32;o+=8)s.push(e[o>>>5]>>>24-o%32&255);return s},bytesToHex:function(e){for(var s=[],o=0;o<e.length;o++)s.push((e[o]>>>4).toString(16)),s.push((e[o]&15).toString(16));return s.join("")},hexToBytes:function(e){for(var s=[],o=0;o<e.length;o+=2)s.push(parseInt(e.substr(o,2),16));return s},bytesToBase64:function(e){for(var s=[],o=0;o<e.length;o+=3)for(var h=e[o]<<16|e[o+1]<<8|e[o+2],f=0;f<4;f++)o*8+f*6<=e.length*8?s.push(a.charAt(h>>>6*(3-f)&63)):s.push("=");return s.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/ig,"");for(var s=[],o=0,h=0;o<e.length;h=++o%4)h!=0&&s.push((a.indexOf(e.charAt(o-1))&Math.pow(2,-2*h+8)-1)<<h*2|a.indexOf(e.charAt(o))>>>6-h*2);return s}};be.exports=t})();var Fe=be.exports,ye={utf8:{stringToBytes:function(a){return ye.bin.stringToBytes(unescape(encodeURIComponent(a)))},bytesToString:function(a){return decodeURIComponent(escape(ye.bin.bytesToString(a)))}},bin:{stringToBytes:function(a){for(var t=[],e=0;e<a.length;e++)t.push(a.charCodeAt(e)&255);return t},bytesToString:function(a){for(var t=[],e=0;e<a.length;e++)t.push(String.fromCharCode(a[e]));return t.join("")}}},we=ye;/*!
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 Qr=function(t){return t!=null&&(dr(t)||Zr(t)||!!t._isBuffer)};function dr(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Zr(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&dr(t.slice(0,0))}(function(){var t=Yr,e=Yt.utf8,r=Qr,n=Yt.bin,o=function(c,l){c.constructor==String?l&&l.encoding==="binary"?c=n.stringToBytes(c):c=e.stringToBytes(c):r(c)?c=Array.prototype.slice.call(c,0):!Array.isArray(c)&&c.constructor!==Uint8Array&&(c=c.toString());for(var p=t.bytesToWords(c),f=c.length*8,i=1732584193,u=-271733879,h=-1732584194,a=271733878,s=0;s<p.length;s++)p[s]=(p[s]<<8|p[s]>>>24)&16711935|(p[s]<<24|p[s]>>>8)&4278255360;p[f>>>5]|=128<<f%32,p[(f+64>>>9<<4)+14]=f;for(var d=o._ff,y=o._gg,m=o._hh,v=o._ii,s=0;s<p.length;s+=16){var T=i,R=u,b=h,S=a;i=d(i,u,h,a,p[s+0],7,-680876936),a=d(a,i,u,h,p[s+1],12,-389564586),h=d(h,a,i,u,p[s+2],17,606105819),u=d(u,h,a,i,p[s+3],22,-1044525330),i=d(i,u,h,a,p[s+4],7,-176418897),a=d(a,i,u,h,p[s+5],12,1200080426),h=d(h,a,i,u,p[s+6],17,-1473231341),u=d(u,h,a,i,p[s+7],22,-45705983),i=d(i,u,h,a,p[s+8],7,1770035416),a=d(a,i,u,h,p[s+9],12,-1958414417),h=d(h,a,i,u,p[s+10],17,-42063),u=d(u,h,a,i,p[s+11],22,-1990404162),i=d(i,u,h,a,p[s+12],7,1804603682),a=d(a,i,u,h,p[s+13],12,-40341101),h=d(h,a,i,u,p[s+14],17,-1502002290),u=d(u,h,a,i,p[s+15],22,1236535329),i=y(i,u,h,a,p[s+1],5,-165796510),a=y(a,i,u,h,p[s+6],9,-1069501632),h=y(h,a,i,u,p[s+11],14,643717713),u=y(u,h,a,i,p[s+0],20,-373897302),i=y(i,u,h,a,p[s+5],5,-701558691),a=y(a,i,u,h,p[s+10],9,38016083),h=y(h,a,i,u,p[s+15],14,-660478335),u=y(u,h,a,i,p[s+4],20,-405537848),i=y(i,u,h,a,p[s+9],5,568446438),a=y(a,i,u,h,p[s+14],9,-1019803690),h=y(h,a,i,u,p[s+3],14,-187363961),u=y(u,h,a,i,p[s+8],20,1163531501),i=y(i,u,h,a,p[s+13],5,-1444681467),a=y(a,i,u,h,p[s+2],9,-51403784),h=y(h,a,i,u,p[s+7],14,1735328473),u=y(u,h,a,i,p[s+12],20,-1926607734),i=m(i,u,h,a,p[s+5],4,-378558),a=m(a,i,u,h,p[s+8],11,-2022574463),h=m(h,a,i,u,p[s+11],16,1839030562),u=m(u,h,a,i,p[s+14],23,-35309556),i=m(i,u,h,a,p[s+1],4,-1530992060),a=m(a,i,u,h,p[s+4],11,1272893353),h=m(h,a,i,u,p[s+7],16,-155497632),u=m(u,h,a,i,p[s+10],23,-1094730640),i=m(i,u,h,a,p[s+13],4,681279174),a=m(a,i,u,h,p[s+0],11,-358537222),h=m(h,a,i,u,p[s+3],16,-722521979),u=m(u,h,a,i,p[s+6],23,76029189),i=m(i,u,h,a,p[s+9],4,-640364487),a=m(a,i,u,h,p[s+12],11,-421815835),h=m(h,a,i,u,p[s+15],16,530742520),u=m(u,h,a,i,p[s+2],23,-995338651),i=v(i,u,h,a,p[s+0],6,-198630844),a=v(a,i,u,h,p[s+7],10,1126891415),h=v(h,a,i,u,p[s+14],15,-1416354905),u=v(u,h,a,i,p[s+5],21,-57434055),i=v(i,u,h,a,p[s+12],6,1700485571),a=v(a,i,u,h,p[s+3],10,-1894986606),h=v(h,a,i,u,p[s+10],15,-1051523),u=v(u,h,a,i,p[s+1],21,-2054922799),i=v(i,u,h,a,p[s+8],6,1873313359),a=v(a,i,u,h,p[s+15],10,-30611744),h=v(h,a,i,u,p[s+6],15,-1560198380),u=v(u,h,a,i,p[s+13],21,1309151649),i=v(i,u,h,a,p[s+4],6,-145523070),a=v(a,i,u,h,p[s+11],10,-1120210379),h=v(h,a,i,u,p[s+2],15,718787259),u=v(u,h,a,i,p[s+9],21,-343485551),i=i+T>>>0,u=u+R>>>0,h=h+b>>>0,a=a+S>>>0}return t.endian([i,u,h,a])};o._ff=function(c,l,p,f,i,u,h){var a=c+(l&p|~l&f)+(i>>>0)+h;return(a<<u|a>>>32-u)+l},o._gg=function(c,l,p,f,i,u,h){var a=c+(l&f|p&~f)+(i>>>0)+h;return(a<<u|a>>>32-u)+l},o._hh=function(c,l,p,f,i,u,h){var a=c+(l^p^f)+(i>>>0)+h;return(a<<u|a>>>32-u)+l},o._ii=function(c,l,p,f,i,u,h){var a=c+(p^(l|~f))+(i>>>0)+h;return(a<<u|a>>>32-u)+l},o._blocksize=16,o._digestsize=16,lr.exports=function(c,l){if(c==null)throw new Error("Illegal argument "+c);var p=t.wordsToBytes(o(c,l));return l&&l.asBytes?p:l&&l.asString?n.bytesToString(p):t.bytesToHex(p)}})();var en=lr.exports;const tn=Kr(en);var fe=(t=>(t.BOOTSTRAP="bootstrap",t.DEBUG_EXTENSIONS="debugExtensions",t.DEBUG_QUEUE="debugQueue",t.DEBUG_DIALER="debugDialer",t.FULL="full",t))(fe||{}),ue=(t=>(t.MAIN="main",t.NEXT="next",t))(ue||{}),ie=(t=>(t.USER="User",t.TOKEN="Token",t))(ie||{});class Le{static async getSessionStorageDataByKey(e,r=!0){if(typeof chrome<"u"&&typeof chrome.storage<"u"){const n=await chrome.storage.session.get(e);if(n[e])return r?JSON.parse(n[e]):n[e]}if(typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.getItem=="function"){const n=window.sessionStorage.getItem(e);if(n)return r?JSON.parse(n):n}}static async updateSessionStorageKey(e,r){typeof chrome<"u"&&typeof chrome.storage<"u"&&await chrome.storage.session.set({[e]:JSON.stringify(r)}),typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.setItem=="function"&&window.sessionStorage.setItem(e,JSON.stringify(r))}static clearSessionStorage(){typeof chrome<"u"&&typeof chrome.storage<"u"&&chrome.storage.session.clear(),typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.clear=="function"&&window.sessionStorage.clear()}}class rn{constructor(e){J(this,"delay",1e3);J(this,"lastLoginTimestamp");J(this,"token");J(this,"refreshToken");J(this,"tokenExpiry");J(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 r=await this.checkLoginStatus(this.storageKey);return r||(Le.clearSessionStorage(),await this.userLoginFunction(e,this.storageKey,this.eventsSdkClass.options.loginType))}updateLastLoginTimestamp(){this.lastLoginTimestamp=new Date().getTime()}async checkLoginStatus(e){const r=await Le.getSessionStorageDataByKey(e);if(r)return r}async userLoginFunction(e,r,n){let o,c,l;return this.eventsSdkClass.options.isNewStack?(o=await this.externalLogin(this.eventsSdkClass.options.loginUrl,e,n),c=await this.getSettings(o.Data.AccessToken),l={...o.Data,...c}):(o=await this.externalLogin(this.eventsSdkClass.options.loginUrl,e,n),l={...o.Data.Socket}),await Le.updateSessionStorageKey(r,l),l}onLoginResponse(e){if(!this.eventsSdkClass.options.isNewStack&&this.eventsSdkClass.options.servers&&(this.eventsSdkClass.servers=[...this.eventsSdkClass.options.servers],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((r,n)=>r.Priority>n.Priority?r:n)),this.eventsSdkClass.options.isNewStack&&this.eventsSdkClass.options.servers&&(this.eventsSdkClass.servers=[...this.eventsSdkClass.options.servers],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((r,n)=>r.Priority>n.Priority?r:n)),e.MonitorList&&e.MonitorList.length&&(this.eventsSdkClass.servers=[...e.MonitorList],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((r,n)=>r.Priority>n.Priority?r:n)),!this.eventsSdkClass.options.isNewStack&&!this.eventsSdkClass.servers.length&&e.URLList&&(this.eventsSdkClass.URLList=e.URLList),!this.eventsSdkClass.options.isNewStack&&!this.eventsSdkClass.URLList.length&&!this.eventsSdkClass.servers.length)throw new Error("Socket servers not defined");if(this.eventsSdkClass.options.isNewStack&&!this.eventsSdkClass.servers.length)throw new Error("Socket servers not defined");this.eventsSdkClass.server&&this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${this.eventsSdkClass.server.Version}`),!this.eventsSdkClass.server&&this.eventsSdkClass.URLList.length&&this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${e.Version}`),e.IdentityCode&&(this.token=e.IdentityCode,this.eventsSdkClass.connect(ue.MAIN)),e.Token&&(this.token=e.Token,this.eventsSdkClass.connect(ue.MAIN)),e.RefreshToken&&e.IdentityCodeExpiry&&this.eventsSdkClass.options.loginType===ie.USER&&(this.refreshToken=e.RefreshToken,this.tokenExpiry=e.IdentityCodeExpiry,this.handleTokenExpiry()),e.RefreshToken&&e.TokenExpiry&&this.normalizeLoginType(this.eventsSdkClass.options.loginType)===ie.USER&&(this.refreshToken=e.RefreshToken,this.tokenExpiry=e.TokenExpiry,this.handleTokenExpiry())}handleTokenExpiry(){if(!this.eventsSdkClass.options.refreshTokenUrl)throw new Error("refreshTokenUrl not provided");let e;if(this.tokenExpiry)e=new Date(this.tokenExpiry);else return;const r=e.getTime()-new Date().getTime()-5e3,n=Math.min(r,2147483647);setTimeout(async()=>{if(this.refreshToken){this.eventsSdkClass.socketIoClass.closeAllConnections();let o,c;if(this.eventsSdkClass.options.isNewStack){const l=await this.externalRefreshToken(this.eventsSdkClass.options.refreshTokenUrl,this.refreshToken);o=await this.getSettings(l.Data.AccessToken),c={...l.Data,...o}}else c={...(await this.externalRefreshToken(this.eventsSdkClass.options.refreshTokenUrl,this.refreshToken)).Data.Socket};this.onLoginResponse(c),await Le.updateSessionStorageKey(this.storageKey,c)}},n)}async externalLogin(e,{password:r,token:n,email:o},c){if(!e)throw new Error("loginUrl not provided");let l;this.eventsSdkClass.options.isNewStack?c===ie.TOKEN?l=JSON.stringify({identityType:ie.TOKEN,token:n}):l=JSON.stringify({identityType:ie.USER,username:o,password:r}):this.eventsSdkClass.options.loginType===ie.TOKEN?(l=JSON.stringify({token:n}),e=`${e}/${ie.TOKEN}`):(l=JSON.stringify({email:o,pin:r}),e=`${e}/${ie.USER}`);let p;try{const f=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:l});if(!f.ok&&f.status===400)throw p=400,new Error("Bad body request. Login type or isNewStack values not correct or not provided");if(!f.ok&&f.status===401)throw p=401,new Error("Unauthorized. Invalid token provided");if(!f.ok&&f.status===403)throw p=403,new Error("Forbidden. Identity token not provided or not valid");const i=await f.json();if(i.error)throw new Error(i.error);return i}catch(f){throw this.eventsSdkClass.loggerClass.loginError(c,p,n,o),f}}async getSettings(e){try{if(!this.eventsSdkClass.options.getSettingsUrl)throw new Error("getSettingsUrl not provided");const r=await fetch(this.eventsSdkClass.options.getSettingsUrl,{headers:{Authorization:`Bearer ${e}`}});if(!r.ok&&r.status===401)throw new Error("Unauthorized. Access token not provided or not valid");return r.json()}catch(r){throw this.eventsSdkClass.loggerClass.getSettingsError(e,r),r}}async externalRefreshToken(e,r){try{return(await fetch(e,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}})).json()}catch(n){throw this.eventsSdkClass.loggerClass.refreshTokenError(r,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 on(){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=Vr,typeof self.navigator>"u"&&(self.navigator={userAgent:"node"})),function t(e,r,n){function o(p,f){if(!r[p]){if(!e[p]){var i=typeof require=="function"&&require;if(!f&&i)return i(p,!0);if(c)return c(p,!0);throw new Error("Cannot find module '"+p+"'")}var u=r[p]={exports:{}};e[p][0].call(u.exports,function(h){var a=e[p][1][h];return o(a||h)},u,u.exports,t,e,r,n)}return r[p].exports}for(var c=typeof require=="function"&&require,l=0;l<n.length;l++)o(n[l]);return o}({1:[function(t,e){e.exports=t("./lib/")},{"./lib/":2}],2:[function(t,e,r){function n(i,u){typeof i=="object"&&(u=i,i=void 0),u=u||{};var h,a=o(i),s=a.source,d=a.id;return u.forceNew||u["force new connection"]||u.multiplex===!1?(p("ignoring socket cache for %s",s),h=l(s,u)):(f[d]||(p("new io instance for %s",s),f[d]=l(s,u)),h=f[d]),h.socket(a.path)}var o=t("./url"),c=t("socket.io-parser"),l=t("./manager"),p=t("debug")("socket.io-client");e.exports=r=n;var f=r.managers={};r.protocol=c.protocol,r.connect=n,r.Manager=t("./manager"),r.Socket=t("./socket")},{"./manager":3,"./socket":5,"./url":6,debug:10,"socket.io-parser":44}],3:[function(t,e){function r(a,s){return this instanceof r?(a&&typeof a=="object"&&(s=a,a=void 0),s=s||{},s.path=s.path||"/socket.io",this.nsps={},this.subs=[],this.opts=s,this.reconnection(s.reconnection!==!1),this.reconnectionAttempts(s.reconnectionAttempts||1/0),this.reconnectionDelay(s.reconnectionDelay||1e3),this.reconnectionDelayMax(s.reconnectionDelayMax||5e3),this.randomizationFactor(s.randomizationFactor||.5),this.backoff=new h({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(s.timeout==null?2e4:s.timeout),this.readyState="closed",this.uri=a,this.connected=[],this.encoding=!1,this.packetBuffer=[],this.encoder=new l.Encoder,this.decoder=new l.Decoder,this.autoConnect=s.autoConnect!==!1,void(this.autoConnect&&this.open())):new r(a,s)}var n=(t("./url"),t("engine.io-client")),o=t("./socket"),c=t("component-emitter"),l=t("socket.io-parser"),p=t("./on"),f=t("component-bind"),i=(t("object-component"),t("debug")("socket.io-client:manager")),u=t("indexof"),h=t("backo2");e.exports=r,r.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var a in this.nsps)this.nsps[a].emit.apply(this.nsps[a],arguments)},r.prototype.updateSocketIds=function(){for(var a in this.nsps)this.nsps[a].id=this.engine.id},c(r.prototype),r.prototype.reconnection=function(a){return arguments.length?(this._reconnection=!!a,this):this._reconnection},r.prototype.reconnectionAttempts=function(a){return arguments.length?(this._reconnectionAttempts=a,this):this._reconnectionAttempts},r.prototype.reconnectionDelay=function(a){return arguments.length?(this._reconnectionDelay=a,this.backoff&&this.backoff.setMin(a),this):this._reconnectionDelay},r.prototype.randomizationFactor=function(a){return arguments.length?(this._randomizationFactor=a,this.backoff&&this.backoff.setJitter(a),this):this._randomizationFactor},r.prototype.reconnectionDelayMax=function(a){return arguments.length?(this._reconnectionDelayMax=a,this.backoff&&this.backoff.setMax(a),this):this._reconnectionDelayMax},r.prototype.timeout=function(a){return arguments.length?(this._timeout=a,this):this._timeout},r.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()},r.prototype.open=r.prototype.connect=function(a){if(i("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;i("opening %s",this.uri),this.engine=n(this.uri,this.opts);var s=this.engine,d=this;this.readyState="opening",this.skipReconnect=!1;var y=p(s,"open",function(){d.onopen(),a&&a()}),m=p(s,"error",function(R){if(i("connect_error"),d.cleanup(),d.readyState="closed",d.emitAll("connect_error",R),a){var b=new Error("Connection error");b.data=R,a(b)}else d.maybeReconnectOnOpen()});if(this._timeout!==!1){var v=this._timeout;i("connect attempt will timeout after %d",v);var T=setTimeout(function(){i("connect attempt timed out after %d",v),y.destroy(),s.close(),s.emit("error","timeout"),d.emitAll("connect_timeout",v)},v);this.subs.push({destroy:function(){clearTimeout(T)}})}return this.subs.push(y),this.subs.push(m),this},r.prototype.onopen=function(){i("open"),this.cleanup(),this.readyState="open",this.emit("open");var a=this.engine;this.subs.push(p(a,"data",f(this,"ondata"))),this.subs.push(p(this.decoder,"decoded",f(this,"ondecoded"))),this.subs.push(p(a,"error",f(this,"onerror"))),this.subs.push(p(a,"close",f(this,"onclose")))},r.prototype.ondata=function(a){this.decoder.add(a)},r.prototype.ondecoded=function(a){this.emit("packet",a)},r.prototype.onerror=function(a){i("error",a),this.emitAll("error",a)},r.prototype.socket=function(a){var s=this.nsps[a];if(!s){s=new o(this,a),this.nsps[a]=s;var d=this;s.on("connect",function(){s.id=d.engine.id,~u(d.connected,s)||d.connected.push(s)})}return s},r.prototype.destroy=function(a){var s=u(this.connected,a);~s&&this.connected.splice(s,1),this.connected.length||this.close()},r.prototype.packet=function(a){i("writing packet %j",a);var s=this;s.encoding?s.packetBuffer.push(a):(s.encoding=!0,this.encoder.encode(a,function(d){for(var y=0;y<d.length;y++)s.engine.write(d[y]);s.encoding=!1,s.processPacketQueue()}))},r.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var a=this.packetBuffer.shift();this.packet(a)}},r.prototype.cleanup=function(){for(var a;a=this.subs.shift();)a.destroy();this.packetBuffer=[],this.encoding=!1,this.decoder.destroy()},r.prototype.close=r.prototype.disconnect=function(){this.skipReconnect=!0,this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},r.prototype.onclose=function(a){i("close"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",a),this._reconnection&&!this.skipReconnect&&this.reconnect()},r.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var a=this;if(this.backoff.attempts>=this._reconnectionAttempts)i("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var s=this.backoff.duration();i("will wait %dms before reconnect attempt",s),this.reconnecting=!0;var d=setTimeout(function(){a.skipReconnect||(i("attempting reconnect"),a.emitAll("reconnect_attempt",a.backoff.attempts),a.emitAll("reconnecting",a.backoff.attempts),a.skipReconnect||a.open(function(y){y?(i("reconnect attempt error"),a.reconnecting=!1,a.reconnect(),a.emitAll("reconnect_error",y.data)):(i("reconnect success"),a.onreconnect())}))},s);this.subs.push({destroy:function(){clearTimeout(d)}})}},r.prototype.onreconnect=function(){var a=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",a)}},{"./on":4,"./socket":5,"./url":6,backo2:7,"component-bind":8,"component-emitter":9,debug:10,"engine.io-client":11,indexof:40,"object-component":41,"socket.io-parser":44}],4:[function(t,e){function r(n,o,c){return n.on(o,c),{destroy:function(){n.removeListener(o,c)}}}e.exports=r},{}],5:[function(t,e,r){function n(s,d){this.io=s,this.nsp=d,this.json=this,this.ids=0,this.acks={},this.io.autoConnect&&this.open(),this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0}var o=t("socket.io-parser"),c=t("component-emitter"),l=t("to-array"),p=t("./on"),f=t("component-bind"),i=t("debug")("socket.io-client:socket"),u=t("has-binary");e.exports=n;var h={connect:1,connect_error:1,connect_timeout:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1},a=c.prototype.emit;c(n.prototype),n.prototype.subEvents=function(){if(!this.subs){var s=this.io;this.subs=[p(s,"open",f(this,"onopen")),p(s,"packet",f(this,"onpacket")),p(s,"close",f(this,"onclose"))]}},n.prototype.open=n.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),this.io.readyState=="open"&&this.onopen(),this)},n.prototype.send=function(){var s=l(arguments);return s.unshift("message"),this.emit.apply(this,s),this},n.prototype.emit=function(s){if(h.hasOwnProperty(s))return a.apply(this,arguments),this;var d=l(arguments),y=o.EVENT;u(d)&&(y=o.BINARY_EVENT);var m={type:y,data:d};return typeof d[d.length-1]=="function"&&(i("emitting packet with ack id %d",this.ids),this.acks[this.ids]=d.pop(),m.id=this.ids++),this.connected?this.packet(m):this.sendBuffer.push(m),this},n.prototype.packet=function(s){s.nsp=this.nsp,this.io.packet(s)},n.prototype.onopen=function(){i("transport is open - connecting"),this.nsp!="/"&&this.packet({type:o.CONNECT})},n.prototype.onclose=function(s){i("close (%s)",s),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",s)},n.prototype.onpacket=function(s){if(s.nsp==this.nsp)switch(s.type){case o.CONNECT:this.onconnect();break;case o.EVENT:this.onevent(s);break;case o.BINARY_EVENT:this.onevent(s);break;case o.ACK:this.onack(s);break;case o.BINARY_ACK:this.onack(s);break;case o.DISCONNECT:this.ondisconnect();break;case o.ERROR:this.emit("error",s.data)}},n.prototype.onevent=function(s){var d=s.data||[];i("emitting event %j",d),s.id!=null&&(i("attaching ack callback to event"),d.push(this.ack(s.id))),this.connected?a.apply(this,d):this.receiveBuffer.push(d)},n.prototype.ack=function(s){var d=this,y=!1;return function(){if(!y){y=!0;var m=l(arguments);i("sending ack %j",m);var v=u(m)?o.BINARY_ACK:o.ACK;d.packet({type:v,id:s,data:m})}}},n.prototype.onack=function(s){i("calling ack %s with %j",s.id,s.data);var d=this.acks[s.id];d.apply(this,s.data),delete this.acks[s.id]},n.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},n.prototype.emitBuffered=function(){var s;for(s=0;s<this.receiveBuffer.length;s++)a.apply(this,this.receiveBuffer[s]);for(this.receiveBuffer=[],s=0;s<this.sendBuffer.length;s++)this.packet(this.sendBuffer[s]);this.sendBuffer=[]},n.prototype.ondisconnect=function(){i("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},n.prototype.destroy=function(){if(this.subs){for(var s=0;s<this.subs.length;s++)this.subs[s].destroy();this.subs=null}this.io.destroy(this)},n.prototype.close=n.prototype.disconnect=function(){return this.connected&&(i("performing disconnect (%s)",this.nsp),this.packet({type:o.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}},{"./on":4,"component-bind":8,"component-emitter":9,debug:10,"has-binary":36,"socket.io-parser":44,"to-array":48}],6:[function(t,e){(function(r){function n(l,i){var f=l,i=i||r.location;return l==null&&(l=i.protocol+"//"+i.host),typeof l=="string"&&(l.charAt(0)=="/"&&(l=l.charAt(1)=="/"?i.protocol+l:i.hostname+l),/^(https?|wss?):\/\//.test(l)||(c("protocol-less url %s",l),l=typeof i<"u"?i.protocol+"//"+l:"https://"+l),c("parse %s",l),f=o(l)),f.port||(/^(http|ws)$/.test(f.protocol)?f.port="80":/^(http|ws)s$/.test(f.protocol)&&(f.port="443")),f.path=f.path||"/",f.id=f.protocol+"://"+f.host+":"+f.port,f.href=f.protocol+"://"+f.host+(i&&i.port==f.port?"":":"+f.port),f}var o=t("parseuri"),c=t("debug")("socket.io-client:url");e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{debug:10,parseuri:42}],7:[function(t,e){function r(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}e.exports=r,r.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var o=Math.random(),c=Math.floor(o*this.jitter*n);n=1&Math.floor(10*o)?n+c:n-c}return 0|Math.min(n,this.max)},r.prototype.reset=function(){this.attempts=0},r.prototype.setMin=function(n){this.ms=n},r.prototype.setMax=function(n){this.max=n},r.prototype.setJitter=function(n){this.jitter=n}},{}],8:[function(t,e){var r=[].slice;e.exports=function(n,o){if(typeof o=="string"&&(o=n[o]),typeof o!="function")throw new Error("bind() requires a function");var c=r.call(arguments,2);return function(){return o.apply(n,c.concat(r.call(arguments)))}}},{}],9:[function(t,e){function r(o){return o?n(o):void 0}function n(o){for(var c in r.prototype)o[c]=r.prototype[c];return o}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(o,c){return this._callbacks=this._callbacks||{},(this._callbacks[o]=this._callbacks[o]||[]).push(c),this},r.prototype.once=function(o,c){function l(){p.off(o,l),c.apply(this,arguments)}var p=this;return this._callbacks=this._callbacks||{},l.fn=c,this.on(o,l),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(o,c){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var l=this._callbacks[o];if(!l)return this;if(arguments.length==1)return delete this._callbacks[o],this;for(var p,f=0;f<l.length;f++)if(p=l[f],p===c||p.fn===c){l.splice(f,1);break}return this},r.prototype.emit=function(o){this._callbacks=this._callbacks||{};var c=[].slice.call(arguments,1),l=this._callbacks[o];if(l){l=l.slice(0);for(var p=0,f=l.length;f>p;++p)l[p].apply(this,c)}return this},r.prototype.listeners=function(o){return this._callbacks=this._callbacks||{},this._callbacks[o]||[]},r.prototype.hasListeners=function(o){return!!this.listeners(o).length}},{}],10:[function(t,e){function r(o){return r.enabled(o)?function(c){c=n(c);var l=new Date,p=l-(r[o]||l);r[o]=l,c=o+" "+c+" +"+r.humanize(p),window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}:function(){}}function n(o){return o instanceof Error?o.stack||o.message:o}e.exports=r,r.names=[],r.skips=[],r.enable=function(o){try{localStorage.debug=o}catch{}for(var c=(o||"").split(/[\s,]+/),l=c.length,p=0;l>p;p++)o=c[p].replace("*",".*?"),o[0]==="-"?r.skips.push(new RegExp("^"+o.substr(1)+"$")):r.names.push(new RegExp("^"+o+"$"))},r.disable=function(){r.enable("")},r.humanize=function(o){var c=1e3,l=6e4,p=60*l;return o>=p?(o/p).toFixed(1)+"h":o>=l?(o/l).toFixed(1)+"m":o>=c?(o/c|0)+"s":o+"ms"},r.enabled=function(o){for(var c=0,l=r.skips.length;l>c;c++)if(r.skips[c].test(o))return!1;for(var c=0,l=r.names.length;l>c;c++)if(r.names[c].test(o))return!0;return!1};try{window.localStorage&&r.enable(localStorage.debug)}catch{}},{}],11:[function(t,e){e.exports=t("./lib/")},{"./lib/":12}],12:[function(t,e){e.exports=t("./socket"),e.exports.parser=t("engine.io-parser")},{"./socket":13,"engine.io-parser":25}],13:[function(t,e){(function(r){function n(s,d){if(!(this instanceof n))return new n(s,d);if(d=d||{},s&&typeof s=="object"&&(d=s,s=null),s&&(s=u(s),d.host=s.host,d.secure=s.protocol=="https"||s.protocol=="wss",d.port=s.port,s.query&&(d.query=s.query)),this.secure=d.secure!=null?d.secure:r.location&&location.protocol=="https:",d.host){var y=d.host.split(":");d.hostname=y.shift(),y.length?d.port=y.pop():d.port||(d.port=this.secure?"443":"80")}this.agent=d.agent||!1,this.hostname=d.hostname||(r.location?location.hostname:"localhost"),this.port=d.port||(r.location&&location.port?location.port:this.secure?443:80),this.query=d.query||{},typeof this.query=="string"&&(this.query=a.decode(this.query)),this.upgrade=d.upgrade!==!1,this.path=(d.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!d.forceJSONP,this.jsonp=d.jsonp!==!1,this.forceBase64=!!d.forceBase64,this.enablesXDR=!!d.enablesXDR,this.timestampParam=d.timestampParam||"t",this.timestampRequests=d.timestampRequests,this.transports=d.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.callbackBuffer=[],this.policyPort=d.policyPort||843,this.rememberUpgrade=d.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=d.onlyBinaryUpgrades,this.pfx=d.pfx||null,this.key=d.key||null,this.passphrase=d.passphrase||null,this.cert=d.cert||null,this.ca=d.ca||null,this.ciphers=d.ciphers||null,this.rejectUnauthorized=d.rejectUnauthorized||null,this.open()}function o(s){var d={};for(var y in s)s.hasOwnProperty(y)&&(d[y]=s[y]);return d}var c=t("./transports"),l=t("component-emitter"),p=t("debug")("engine.io-client:socket"),f=t("indexof"),i=t("engine.io-parser"),u=t("parseuri"),h=t("parsejson"),a=t("parseqs");e.exports=n,n.priorWebsocketSuccess=!1,l(n.prototype),n.protocol=i.protocol,n.Socket=n,n.Transport=t("./transport"),n.transports=t("./transports"),n.parser=t("engine.io-parser"),n.prototype.createTransport=function(s){p('creating transport "%s"',s);var d=o(this.query);d.EIO=i.protocol,d.transport=s,this.id&&(d.sid=this.id);var y=new c[s]({agent:this.agent,hostname:this.hostname,port:this.port,secure:this.secure,path:this.path,query:d,forceJSONP:this.forceJSONP,jsonp:this.jsonp,forceBase64:this.forceBase64,enablesXDR:this.enablesXDR,timestampRequests:this.timestampRequests,timestampParam:this.timestampParam,policyPort:this.policyPort,socket:this,pfx:this.pfx,key:this.key,passphrase:this.passphrase,cert:this.cert,ca:this.ca,ciphers:this.ciphers,rejectUnauthorized:this.rejectUnauthorized});return y},n.prototype.open=function(){var d;if(this.rememberUpgrade&&n.priorWebsocketSuccess&&this.transports.indexOf("websocket")!=-1)d="websocket";else{if(this.transports.length==0){var s=this;return void setTimeout(function(){s.emit("error","No transports available")},0)}d=this.transports[0]}this.readyState="opening";var d;try{d=this.createTransport(d)}catch{return this.transports.shift(),void this.open()}d.open(),this.setTransport(d)},n.prototype.setTransport=function(s){p("setting transport %s",s.name);var d=this;this.transport&&(p("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=s,s.on("drain",function(){d.onDrain()}).on("packet",function(y){d.onPacket(y)}).on("error",function(y){d.onError(y)}).on("close",function(){d.onClose("transport close")})},n.prototype.probe=function(s){function d(){if(w.onlyBinaryUpgrades){var E=!this.supportsBinary&&w.transport.supportsBinary;g=g||E}g||(p('probe transport "%s" opened',s),S.send([{type:"ping",data:"probe"}]),S.once("packet",function(C){if(!g)if(C.type=="pong"&&C.data=="probe"){if(p('probe transport "%s" pong',s),w.upgrading=!0,w.emit("upgrading",S),!S)return;n.priorWebsocketSuccess=S.name=="websocket",p('pausing current transport "%s"',w.transport.name),w.transport.pause(function(){g||w.readyState!="closed"&&(p("changing transport and sending upgrade packet"),b(),w.setTransport(S),S.send([{type:"upgrade"}]),w.emit("upgrade",S),S=null,w.upgrading=!1,w.flush())})}else{p('probe transport "%s" failed',s);var k=new Error("probe error");k.transport=S.name,w.emit("upgradeError",k)}}))}function y(){g||(g=!0,b(),S.close(),S=null)}function m(E){var C=new Error("probe error: "+E);C.transport=S.name,y(),p('probe transport "%s" failed because of error: %s',s,E),w.emit("upgradeError",C)}function v(){m("transport closed")}function T(){m("socket closed")}function R(E){S&&E.name!=S.name&&(p('"%s" works - aborting "%s"',E.name,S.name),y())}function b(){S.removeListener("open",d),S.removeListener("error",m),S.removeListener("close",v),w.removeListener("close",T),w.removeListener("upgrading",R)}p('probing transport "%s"',s);var S=this.createTransport(s,{probe:1}),g=!1,w=this;n.priorWebsocketSuccess=!1,S.once("open",d),S.once("error",m),S.once("close",v),this.once("close",T),this.once("upgrading",R),S.open()},n.prototype.onOpen=function(){if(p("socket open"),this.readyState="open",n.priorWebsocketSuccess=this.transport.name=="websocket",this.emit("open"),this.flush(),this.readyState=="open"&&this.upgrade&&this.transport.pause){p("starting upgrade probes");for(var s=0,d=this.upgrades.length;d>s;s++)this.probe(this.upgrades[s])}},n.prototype.onPacket=function(s){if(this.readyState=="opening"||this.readyState=="open")switch(p('socket receive: type "%s", data "%s"',s.type,s.data),this.emit("packet",s),this.emit("heartbeat"),s.type){case"open":this.onHandshake(h(s.data));break;case"pong":this.setPing();break;case"error":var d=new Error("server error");d.code=s.data,this.emit("error",d);break;case"message":this.emit("data",s.data),this.emit("message",s.data)}else p('packet received with socket readyState "%s"',this.readyState)},n.prototype.onHandshake=function(s){this.emit("handshake",s),this.id=s.sid,this.transport.query.sid=s.sid,this.upgrades=this.filterUpgrades(s.upgrades),this.pingInterval=s.pingInterval,this.pingTimeout=s.pingTimeout,this.onOpen(),this.readyState!="closed"&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},n.prototype.onHeartbeat=function(s){clearTimeout(this.pingTimeoutTimer);var d=this;d.pingTimeoutTimer=setTimeout(function(){d.readyState!="closed"&&d.onClose("ping timeout")},s||d.pingInterval+d.pingTimeout)},n.prototype.setPing=function(){var s=this;clearTimeout(s.pingIntervalTimer),s.pingIntervalTimer=setTimeout(function(){p("writing ping packet - expecting pong within %sms",s.pingTimeout),s.ping(),s.onHeartbeat(s.pingTimeout)},s.pingInterval)},n.prototype.ping=function(){this.sendPacket("ping")},n.prototype.onDrain=function(){for(var s=0;s<this.prevBufferLen;s++)this.callbackBuffer[s]&&this.callbackBuffer[s]();this.writeBuffer.splice(0,this.prevBufferLen),this.callbackBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length==0?this.emit("drain"):this.flush()},n.prototype.flush=function(){this.readyState!="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(p("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},n.prototype.write=n.prototype.send=function(s,d){return this.sendPacket("message",s,d),this},n.prototype.sendPacket=function(s,d,y){if(this.readyState!="closing"&&this.readyState!="closed"){var m={type:s,data:d};this.emit("packetCreate",m),this.writeBuffer.push(m),this.callbackBuffer.push(y),this.flush()}},n.prototype.close=function(){function s(){m.onClose("forced close"),p("socket closing - telling transport to close"),m.transport.close()}function d(){m.removeListener("upgrade",d),m.removeListener("upgradeError",d),s()}function y(){m.once("upgrade",d),m.once("upgradeError",d)}if(this.readyState=="opening"||this.readyState=="open"){this.readyState="closing";var m=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?y():s()}):this.upgrading?y():s()}return this},n.prototype.onError=function(s){p("socket error %j",s),n.priorWebsocketSuccess=!1,this.emit("error",s),this.onClose("transport error",s)},n.prototype.onClose=function(s,d){if(this.readyState=="opening"||this.readyState=="open"||this.readyState=="closing"){p('socket close with reason: "%s"',s);var y=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),setTimeout(function(){y.writeBuffer=[],y.callbackBuffer=[],y.prevBufferLen=0},0),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",s,d)}},n.prototype.filterUpgrades=function(s){for(var d=[],y=0,m=s.length;m>y;y++)~f(this.transports,s[y])&&d.push(s[y]);return d}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./transport":14,"./transports":15,"component-emitter":9,debug:22,"engine.io-parser":25,indexof:40,parsejson:32,parseqs:33,parseuri:34}],14:[function(t,e){function r(c){this.path=c.path,this.hostname=c.hostname,this.port=c.port,this.secure=c.secure,this.query=c.query,this.timestampParam=c.timestampParam,this.timestampRequests=c.timestampRequests,this.readyState="",this.agent=c.agent||!1,this.socket=c.socket,this.enablesXDR=c.enablesXDR,this.pfx=c.pfx,this.key=c.key,this.passphrase=c.passphrase,this.cert=c.cert,this.ca=c.ca,this.ciphers=c.ciphers,this.rejectUnauthorized=c.rejectUnauthorized}var n=t("engine.io-parser"),o=t("component-emitter");e.exports=r,o(r.prototype),r.timestamps=0,r.prototype.onError=function(c,l){var p=new Error(c);return p.type="TransportError",p.description=l,this.emit("error",p),this},r.prototype.open=function(){return(this.readyState=="closed"||this.readyState=="")&&(this.readyState="opening",this.doOpen()),this},r.prototype.close=function(){return(this.readyState=="opening"||this.readyState=="open")&&(this.doClose(),this.onClose()),this},r.prototype.send=function(c){if(this.readyState!="open")throw new Error("Transport not open");this.write(c)},r.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},r.prototype.onData=function(c){var l=n.decodePacket(c,this.socket.binaryType);this.onPacket(l)},r.prototype.onPacket=function(c){this.emit("packet",c)},r.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},{"component-emitter":9,"engine.io-parser":25}],15:[function(t,e,r){(function(n){function o(i){var u,h=!1,a=!1,s=i.jsonp!==!1;if(n.location){var d=location.protocol=="https:",y=location.port;y||(y=d?443:80),h=i.hostname!=location.hostname||y!=i.port,a=i.secure!=d}if(i.xdomain=h,i.xscheme=a,u=new c(i),"open"in u&&!i.forceJSONP)return new l(i);if(!s)throw new Error("JSONP disabled");return new p(i)}var c=t("xmlhttprequest"),l=t("./polling-xhr"),p=t("./polling-jsonp"),f=t("./websocket");r.polling=o,r.websocket=f}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling-jsonp":16,"./polling-xhr":17,"./websocket":19,xmlhttprequest:20}],16:[function(t,e){(function(r){function n(){}function o(u){c.call(this,u),this.query=this.query||{},p||(r.___eio||(r.___eio=[]),p=r.___eio),this.index=p.length;var h=this;p.push(function(a){h.onData(a)}),this.query.j=this.index,r.document&&r.addEventListener&&r.addEventListener("beforeunload",function(){h.script&&(h.script.onerror=n)},!1)}var c=t("./polling"),l=t("component-inherit");e.exports=o;var p,f=/\n/g,i=/\\n/g;l(o,c),o.prototype.supportsBinary=!1,o.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),c.prototype.doClose.call(this)},o.prototype.doPoll=function(){var u=this,h=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),h.async=!0,h.src=this.uri(),h.onerror=function(d){u.onError("jsonp poll error",d)};var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(h,a),this.script=h;var s=typeof navigator<"u"&&/gecko/i.test(navigator.userAgent);s&&setTimeout(function(){var d=document.createElement("iframe");document.body.appendChild(d),document.body.removeChild(d)},100)},o.prototype.doWrite=function(u,h){function a(){s(),h()}function s(){if(d.iframe)try{d.form.removeChild(d.iframe)}catch(b){d.onError("jsonp polling iframe removal error",b)}try{var R='<iframe src="javascript:0" name="'+d.iframeId+'">';y=document.createElement(R)}catch{y=document.createElement("iframe"),y.name=d.iframeId,y.src="javascript:0"}y.id=d.iframeId,d.form.appendChild(y),d.iframe=y}var d=this;if(!this.form){var y,m=document.createElement("form"),v=document.createElement("textarea"),T=this.iframeId="eio_iframe_"+this.index;m.className="socketio",m.style.position="absolute",m.style.top="-1000px",m.style.left="-1000px",m.target=T,m.method="POST",m.setAttribute("accept-charset","utf-8"),v.name="d",m.appendChild(v),document.body.appendChild(m),this.form=m,this.area=v}this.form.action=this.uri(),s(),u=u.replace(i,`\\
7
- `),this.area.value=u.replace(f,"\\n");try{this.form.submit()}catch{}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){d.iframe.readyState=="complete"&&a()}:this.iframe.onload=a}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling":18,"component-inherit":21}],17:[function(t,e){(function(r){function n(){}function o(a){if(f.call(this,a),r.location){var s=location.protocol=="https:",d=location.port;d||(d=s?443:80),this.xd=a.hostname!=r.location.hostname||d!=a.port,this.xs=a.secure!=s}}function c(a){this.method=a.method||"GET",this.uri=a.uri,this.xd=!!a.xd,this.xs=!!a.xs,this.async=a.async!==!1,this.data=a.data!=null?a.data:null,this.agent=a.agent,this.isBinary=a.isBinary,this.supportsBinary=a.supportsBinary,this.enablesXDR=a.enablesXDR,this.pfx=a.pfx,this.key=a.key,this.passphrase=a.passphrase,this.cert=a.cert,this.ca=a.ca,this.ciphers=a.ciphers,this.rejectUnauthorized=a.rejectUnauthorized,this.create()}function l(){for(var a in c.requests)c.requests.hasOwnProperty(a)&&c.requests[a].abort()}var p=t("xmlhttprequest"),f=t("./polling"),i=t("component-emitter"),u=t("component-inherit"),h=t("debug")("engine.io-client:polling-xhr");e.exports=o,e.exports.Request=c,u(o,f),o.prototype.supportsBinary=!0,o.prototype.request=function(a){return a=a||{},a.uri=this.uri(),a.xd=this.xd,a.xs=this.xs,a.agent=this.agent||!1,a.supportsBinary=this.supportsBinary,a.enablesXDR=this.enablesXDR,a.pfx=this.pfx,a.key=this.key,a.passphrase=this.passphrase,a.cert=this.cert,a.ca=this.ca,a.ciphers=this.ciphers,a.rejectUnauthorized=this.rejectUnauthorized,new c(a)},o.prototype.doWrite=function(a,s){var d=typeof a!="string"&&a!==void 0,y=this.request({method:"POST",data:a,isBinary:d}),m=this;y.on("success",s),y.on("error",function(v){m.onError("xhr post error",v)}),this.sendXhr=y},o.prototype.doPoll=function(){h("xhr poll");var a=this.request(),s=this;a.on("data",function(d){s.onData(d)}),a.on("error",function(d){s.onError("xhr poll error",d)}),this.pollXhr=a},i(c.prototype),c.prototype.create=function(){var a={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};a.pfx=this.pfx,a.key=this.key,a.passphrase=this.passphrase,a.cert=this.cert,a.ca=this.ca,a.ciphers=this.ciphers,a.rejectUnauthorized=this.rejectUnauthorized;var s=this.xhr=new p(a),d=this;try{if(h("xhr open %s: %s",this.method,this.uri),s.open(this.method,this.uri,this.async),this.supportsBinary&&(s.responseType="arraybuffer"),this.method=="POST")try{this.isBinary?s.setRequestHeader("Content-type","application/octet-stream"):s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}"withCredentials"in s&&(s.withCredentials=!0),this.hasXDR()?(s.onload=function(){d.onLoad()},s.onerror=function(){d.onError(s.responseText)}):s.onreadystatechange=function(){s.readyState==4&&(s.status==200||s.status==1223?d.onLoad():setTimeout(function(){d.onError(s.status)},0))},h("xhr data %s",this.data),s.send(this.data)}catch(y){return void setTimeout(function(){d.onError(y)},0)}r.document&&(this.index=c.requestsCount++,c.requests[this.index]=this)},c.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},c.prototype.onData=function(a){this.emit("data",a),this.onSuccess()},c.prototype.onError=function(a){this.emit("error",a),this.cleanup(!0)},c.prototype.cleanup=function(a){if(typeof this.xhr<"u"&&this.xhr!==null){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=n:this.xhr.onreadystatechange=n,a)try{this.xhr.abort()}catch{}r.document&&delete c.requests[this.index],this.xhr=null}},c.prototype.onLoad=function(){var a;try{var s;try{s=this.xhr.getResponseHeader("Content-Type").split(";")[0]}catch{}a=s==="application/octet-stream"?this.xhr.response:this.supportsBinary?"ok":this.xhr.responseText}catch(d){this.onError(d)}a!=null&&this.onData(a)},c.prototype.hasXDR=function(){return typeof r.XDomainRequest<"u"&&!this.xs&&this.enablesXDR},c.prototype.abort=function(){this.cleanup()},r.document&&(c.requestsCount=0,c.requests={},r.attachEvent?r.attachEvent("onunload",l):r.addEventListener&&r.addEventListener("beforeunload",l,!1))}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling":18,"component-emitter":9,"component-inherit":21,debug:22,xmlhttprequest:20}],18:[function(t,e){function r(i){var u=i&&i.forceBase64;(!f||u)&&(this.supportsBinary=!1),n.call(this,i)}var n=t("../transport"),o=t("parseqs"),c=t("engine.io-parser"),l=t("component-inherit"),p=t("debug")("engine.io-client:polling");e.exports=r;var f=function(){var i=t("xmlhttprequest"),u=new i({xdomain:!1});return u.responseType!=null}();l(r,n),r.prototype.name="polling",r.prototype.doOpen=function(){this.poll()},r.prototype.pause=function(i){function u(){p("paused"),h.readyState="paused",i()}var h=this;if(this.readyState="pausing",this.polling||!this.writable){var a=0;this.polling&&(p("we are currently polling - waiting to pause"),a++,this.once("pollComplete",function(){p("pre-pause polling complete"),--a||u()})),this.writable||(p("we are currently writing - waiting to pause"),a++,this.once("drain",function(){p("pre-pause writing complete"),--a||u()}))}else u()},r.prototype.poll=function(){p("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},r.prototype.onData=function(i){var u=this;p("polling got data %s",i);var h=function(a){return u.readyState=="opening"&&u.onOpen(),a.type=="close"?(u.onClose(),!1):void u.onPacket(a)};c.decodePayload(i,this.socket.binaryType,h),this.readyState!="closed"&&(this.polling=!1,this.emit("pollComplete"),this.readyState=="open"?this.poll():p('ignoring poll - transport state "%s"',this.readyState))},r.prototype.doClose=function(){function i(){p("writing close packet"),u.write([{type:"close"}])}var u=this;this.readyState=="open"?(p("transport open - closing"),i()):(p("transport not open - deferring close"),this.once("open",i))},r.prototype.write=function(i){var h=this;this.writable=!1;var u=function(){h.writable=!0,h.emit("drain")},h=this;c.encodePayload(i,this.supportsBinary,function(a){h.doWrite(a,u)})},r.prototype.uri=function(){var i=this.query||{},u=this.secure?"https":"http",h="";return this.timestampRequests!==!1&&(i[this.timestampParam]=+new Date+"-"+n.timestamps++),this.supportsBinary||i.sid||(i.b64=1),i=o.encode(i),this.port&&(u=="https"&&this.port!=443||u=="http"&&this.port!=80)&&(h=":"+this.port),i.length&&(i="?"+i),u+"://"+this.hostname+h+this.path+i}},{"../transport":14,"component-inherit":21,debug:22,"engine.io-parser":25,parseqs:33,xmlhttprequest:20}],19:[function(t,e){function r(i){var u=i&&i.forceBase64;u&&(this.supportsBinary=!1),n.call(this,i)}var n=t("../transport"),o=t("engine.io-parser"),c=t("parseqs"),l=t("component-inherit"),p=t("debug")("engine.io-client:websocket"),f=t("ws");e.exports=r,l(r,n),r.prototype.name="websocket",r.prototype.supportsBinary=!0,r.prototype.doOpen=function(){if(this.check()){var i=this.uri(),u=void 0,h={agent:this.agent};h.pfx=this.pfx,h.key=this.key,h.passphrase=this.passphrase,h.cert=this.cert,h.ca=this.ca,h.ciphers=this.ciphers,h.rejectUnauthorized=this.rejectUnauthorized,this.ws=new f(i,u,h),this.ws.binaryType===void 0&&(this.supportsBinary=!1),this.ws.binaryType="arraybuffer",this.addEventListeners()}},r.prototype.addEventListeners=function(){var i=this;this.ws.onopen=function(){i.onOpen()},this.ws.onclose=function(){i.onClose()},this.ws.onmessage=function(u){i.onData(u.data)},this.ws.onerror=function(u){i.onError("websocket error",u)}},typeof navigator<"u"&&/iPad|iPhone|iPod/i.test(navigator.userAgent)&&(r.prototype.onData=function(i){var u=this;setTimeout(function(){n.prototype.onData.call(u,i)},0)}),r.prototype.write=function(i){function u(){h.writable=!0,h.emit("drain")}var h=this;this.writable=!1;for(var a=0,s=i.length;s>a;a++)o.encodePacket(i[a],this.supportsBinary,function(d){try{h.ws.send(d)}catch{p("websocket closed before onclose event")}});setTimeout(u,0)},r.prototype.onClose=function(){n.prototype.onClose.call(this)},r.prototype.doClose=function(){typeof this.ws<"u"&&this.ws.close()},r.prototype.uri=function(){var i=this.query||{},u=this.secure?"wss":"ws",h="";return this.port&&(u=="wss"&&this.port!=443||u=="ws"&&this.port!=80)&&(h=":"+this.port),this.timestampRequests&&(i[this.timestampParam]=+new Date),this.supportsBinary||(i.b64=1),i=c.encode(i),i.length&&(i="?"+i),u+"://"+this.hostname+h+this.path+i},r.prototype.check=function(){return!(!f||"__initialize"in f&&this.name===r.prototype.name)}},{"../transport":14,"component-inherit":21,debug:22,"engine.io-parser":25,parseqs:33,ws:35}],20:[function(t,e){var r=t("has-cors");e.exports=function(n){var o=n.xdomain,c=n.xscheme,l=n.enablesXDR;try{if(typeof XMLHttpRequest<"u"&&(!o||r))return new XMLHttpRequest}catch{}try{if(typeof XDomainRequest<"u"&&!c&&l)return new XDomainRequest}catch{}if(!o)try{return new ActiveXObject("Microsoft.XMLHTTP")}catch{}}},{"has-cors":38}],21:[function(t,e){e.exports=function(r,n){var o=function(){};o.prototype=n.prototype,r.prototype=new o,r.prototype.constructor=r}},{}],22:[function(t,e,r){function n(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function o(){var f=arguments,i=this.useColors;if(f[0]=(i?"%c":"")+this.namespace+(i?" %c":" ")+f[0]+(i?"%c ":" ")+"+"+r.humanize(this.diff),!i)return f;var u="color: "+this.color;f=[f[0],u,"color: inherit"].concat(Array.prototype.slice.call(f,1));var h=0,a=0;return f[0].replace(/%[a-z%]/g,function(s){s!=="%%"&&(h++,s==="%c"&&(a=h))}),f.splice(a,0,u),f}function c(){return typeof console=="object"&&typeof console.log=="function"&&Function.prototype.apply.call(console.log,console,arguments)}function l(f){try{f==null?localStorage.removeItem("debug"):localStorage.debug=f}catch{}}function p(){var f;try{f=localStorage.debug}catch{}return f}r=e.exports=t("./debug"),r.log=c,r.formatArgs=o,r.save=l,r.load=p,r.useColors=n,r.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],r.formatters.j=function(f){return JSON.stringify(f)},r.enable(p())},{"./debug":23}],23:[function(t,e,r){function n(){return r.colors[u++%r.colors.length]}function o(h){function a(){}function s(){var y=s,m=+new Date,v=m-(i||m);y.diff=v,y.prev=i,y.curr=m,i=m,y.useColors==null&&(y.useColors=r.useColors()),y.color==null&&y.useColors&&(y.color=n());var T=Array.prototype.slice.call(arguments);T[0]=r.coerce(T[0]),typeof T[0]!="string"&&(T=["%o"].concat(T));var R=0;T[0]=T[0].replace(/%([a-z%])/g,function(S,g){if(S==="%%")return S;R++;var w=r.formatters[g];if(typeof w=="function"){var E=T[R];S=w.call(y,E),T.splice(R,1),R--}return S}),typeof r.formatArgs=="function"&&(T=r.formatArgs.apply(y,T));var b=s.log||r.log||console.log.bind(console);b.apply(y,T)}a.enabled=!1,s.enabled=!0;var d=r.enabled(h)?s:a;return d.namespace=h,d}function c(h){r.save(h);for(var a=(h||"").split(/[\s,]+/),s=a.length,d=0;s>d;d++)a[d]&&(h=a[d].replace(/\*/g,".*?"),h[0]==="-"?r.skips.push(new RegExp("^"+h.substr(1)+"$")):r.names.push(new RegExp("^"+h+"$")))}function l(){r.enable("")}function p(h){var a,s;for(a=0,s=r.skips.length;s>a;a++)if(r.skips[a].test(h))return!1;for(a=0,s=r.names.length;s>a;a++)if(r.names[a].test(h))return!0;return!1}function f(h){return h instanceof Error?h.stack||h.message:h}r=e.exports=o,r.coerce=f,r.disable=l,r.enable=c,r.enabled=p,r.humanize=t("ms"),r.names=[],r.skips=[],r.formatters={};var i,u=0},{ms:24}],24:[function(t,e){function r(h){var a=/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(h);if(a){var s=parseFloat(a[1]),d=(a[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"y":return s*u;case"days":case"day":case"d":return s*i;case"hours":case"hour":case"h":return s*f;case"minutes":case"minute":case"m":return s*p;case"seconds":case"second":case"s":return s*l;case"ms":return s}}}function n(h){return h>=i?Math.round(h/i)+"d":h>=f?Math.round(h/f)+"h":h>=p?Math.round(h/p)+"m":h>=l?Math.round(h/l)+"s":h+"ms"}function o(h){return c(h,i,"day")||c(h,f,"hour")||c(h,p,"minute")||c(h,l,"second")||h+" ms"}function c(h,a,s){return a>h?void 0:1.5*a>h?Math.floor(h/a)+" "+s:Math.ceil(h/a)+" "+s+"s"}var l=1e3,p=60*l,f=60*p,i=24*f,u=365.25*i;e.exports=function(h,a){return a=a||{},typeof h=="string"?r(h):a.long?o(h):n(h)}},{}],25:[function(t,e,r){(function(n){function o(g,w){var E="b"+r.packets[g.type]+g.data.data;return w(E)}function c(g,w,E){if(!w)return r.encodeBase64Packet(g,E);var C=g.data,k=new Uint8Array(C),N=new Uint8Array(1+C.byteLength);N[0]=T[g.type];for(var x=0;x<k.length;x++)N[x+1]=k[x];return E(N.buffer)}function l(g,w,E){if(!w)return r.encodeBase64Packet(g,E);var C=new FileReader;return C.onload=function(){g.data=C.result,r.encodePacket(g,w,!0,E)},C.readAsArrayBuffer(g.data)}function p(g,w,E){if(!w)return r.encodeBase64Packet(g,E);if(v)return l(g,w,E);var C=new Uint8Array(1);C[0]=T[g.type];var k=new S([C.buffer,g.data]);return E(k)}function f(g,w,E){for(var C=new Array(g.length),k=s(g.length,E),N=function(L,A,z){w(A,function(M,K){C[L]=K,z(M,C)})},x=0;x<g.length;x++)N(x,g[x],k)}var i=t("./keys"),u=t("has-binary"),h=t("arraybuffer.slice"),a=t("base64-arraybuffer"),s=t("after"),d=t("utf8"),y=navigator.userAgent.match(/Android/i),m=/PhantomJS/i.test(navigator.userAgent),v=y||m;r.protocol=3;var T=r.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},R=i(T),b={type:"error",data:"parser error"},S=t("blob");r.encodePacket=function(g,w,E,C){typeof w=="function"&&(C=w,w=!1),typeof E=="function"&&(C=E,E=null);var k=g.data===void 0?void 0:g.data.buffer||g.data;if(n.ArrayBuffer&&k instanceof ArrayBuffer)return c(g,w,C);if(S&&k instanceof n.Blob)return p(g,w,C);if(k&&k.base64)return o(g,C);var N=T[g.type];return g.data!==void 0&&(N+=E?d.encode(String(g.data)):String(g.data)),C(""+N)},r.encodeBase64Packet=function(g,w){var E="b"+r.packets[g.type];if(S&&g.data instanceof S){var C=new FileReader;return C.onload=function(){var A=C.result.split(",")[1];w(E+A)},C.readAsDataURL(g.data)}var k;try{k=String.fromCharCode.apply(null,new Uint8Array(g.data))}catch{for(var N=new Uint8Array(g.data),x=new Array(N.length),L=0;L<N.length;L++)x[L]=N[L];k=String.fromCharCode.apply(null,x)}return E+=n.btoa(k),w(E)},r.decodePacket=function(g,w,E){if(typeof g=="string"||g===void 0){if(g.charAt(0)=="b")return r.decodeBase64Packet(g.substr(1),w);if(E)try{g=d.decode(g)}catch{return b}var k=g.charAt(0);return Number(k)==k&&R[k]?g.length>1?{type:R[k],data:g.substring(1)}:{type:R[k]}:b}var C=new Uint8Array(g),k=C[0],N=h(g,1);return S&&w==="blob"&&(N=new S([N])),{type:R[k],data:N}},r.decodeBase64Packet=function(g,w){var E=R[g.charAt(0)];if(!n.ArrayBuffer)return{type:E,data:{base64:!0,data:g.substr(1)}};var C=a.decode(g.substr(1));return w==="blob"&&S&&(C=new S([C])),{type:E,data:C}},r.encodePayload=function(g,w,E){function C(x){return x.length+":"+x}function k(x,L){r.encodePacket(x,N?w:!1,!0,function(A){L(null,C(A))})}typeof w=="function"&&(E=w,w=null);var N=u(g);return w&&N?S&&!v?r.encodePayloadAsBlob(g,E):r.encodePayloadAsArrayBuffer(g,E):g.length?void f(g,k,function(x,L){return E(L.join(""))}):E("0:")},r.decodePayload=function(g,w,E){if(typeof g!="string")return r.decodePayloadAsBinary(g,w,E);typeof w=="function"&&(E=w,w=null);var C;if(g=="")return E(b,0,1);for(var k,N,x="",L=0,A=g.length;A>L;L++){var z=g.charAt(L);if(z!=":")x+=z;else{if(x==""||x!=(k=Number(x))||(N=g.substr(L+1,k),x!=N.length))return E(b,0,1);if(N.length){if(C=r.decodePacket(N,w,!0),b.type==C.type&&b.data==C.data)return E(b,0,1);var M=E(C,L+k,A);if(M===!1)return}L+=k,x=""}}return x!=""?E(b,0,1):void 0},r.encodePayloadAsArrayBuffer=function(g,w){function E(C,k){r.encodePacket(C,!0,!0,function(N){return k(null,N)})}return g.length?void f(g,E,function(C,k){var N=k.reduce(function(A,z){var M;return M=typeof z=="string"?z.length:z.byteLength,A+M.toString().length+M+2},0),x=new Uint8Array(N),L=0;return k.forEach(function(A){var z=typeof A=="string",M=A;if(z){for(var K=new Uint8Array(A.length),X=0;X<A.length;X++)K[X]=A.charCodeAt(X);M=K.buffer}x[L++]=z?0:1;for(var te=M.byteLength.toString(),X=0;X<te.length;X++)x[L++]=parseInt(te[X]);x[L++]=255;for(var K=new Uint8Array(M),X=0;X<K.length;X++)x[L++]=K[X]}),w(x.buffer)}):w(new ArrayBuffer(0))},r.encodePayloadAsBlob=function(g,w){function E(C,k){r.encodePacket(C,!0,!0,function(N){var x=new Uint8Array(1);if(x[0]=1,typeof N=="string"){for(var L=new Uint8Array(N.length),A=0;A<N.length;A++)L[A]=N.charCodeAt(A);N=L.buffer,x[0]=0}for(var z=N instanceof ArrayBuffer?N.byteLength:N.size,M=z.toString(),K=new Uint8Array(M.length+1),A=0;A<M.length;A++)K[A]=parseInt(M[A]);if(K[M.length]=255,S){var X=new S([x.buffer,K.buffer,N]);k(null,X)}})}f(g,E,function(C,k){return w(new S(k))})},r.decodePayloadAsBinary=function(g,w,E){typeof w=="function"&&(E=w,w=null);for(var C=g,k=[],N=!1;C.byteLength>0;){for(var x=new Uint8Array(C),L=x[0]===0,A="",z=1;x[z]!=255;z++){if(A.length>310){N=!0;break}A+=x[z]}if(N)return E(b,0,1);C=h(C,2+A.length),A=parseInt(A);var M=h(C,0,A);if(L)try{M=String.fromCharCode.apply(null,new Uint8Array(M))}catch{var K=new Uint8Array(M);M="";for(var z=0;z<K.length;z++)M+=String.fromCharCode(K[z])}k.push(M),C=h(C,A)}var X=k.length;k.forEach(function(te,Oe){E(r.decodePacket(te,w,!0),Oe,X)})}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./keys":26,after:27,"arraybuffer.slice":28,"base64-arraybuffer":29,blob:30,"has-binary":36,utf8:31}],26:[function(t,e){e.exports=Object.keys||function(r){var n=[],o=Object.prototype.hasOwnProperty;for(var c in r)o.call(r,c)&&n.push(c);return n}},{}],27:[function(t,e){function r(o,c,l){function p(i,u){if(p.count<=0)throw new Error("after called too many times");--p.count,i?(f=!0,c(i),c=l):p.count!==0||f||c(null,u)}var f=!1;return l=l||n,p.count=o,o===0?c():p}function n(){}e.exports=r},{}],28:[function(t,e){e.exports=function(r,n,o){var c=r.byteLength;if(n=n||0,o=o||c,r.slice)return r.slice(n,o);if(0>n&&(n+=c),0>o&&(o+=c),o>c&&(o=c),n>=c||n>=o||c===0)return new ArrayBuffer(0);for(var l=new Uint8Array(r),p=new Uint8Array(o-n),f=n,i=0;o>f;f++,i++)p[i]=l[f];return p.buffer}},{}],29:[function(t,e,r){(function(n){r.encode=function(o){var c,l=new Uint8Array(o),p=l.length,f="";for(c=0;p>c;c+=3)f+=n[l[c]>>2],f+=n[(3&l[c])<<4|l[c+1]>>4],f+=n[(15&l[c+1])<<2|l[c+2]>>6],f+=n[63&l[c+2]];return p%3===2?f=f.substring(0,f.length-1)+"=":p%3===1&&(f=f.substring(0,f.length-2)+"=="),f},r.decode=function(o){var c,l,p,f,i,u=.75*o.length,h=o.length,a=0;o[o.length-1]==="="&&(u--,o[o.length-2]==="="&&u--);var s=new ArrayBuffer(u),d=new Uint8Array(s);for(c=0;h>c;c+=4)l=n.indexOf(o[c]),p=n.indexOf(o[c+1]),f=n.indexOf(o[c+2]),i=n.indexOf(o[c+3]),d[a++]=l<<2|p>>4,d[a++]=(15&p)<<4|f>>2,d[a++]=(3&f)<<6|63&i;return s}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],30:[function(t,e){(function(r){function n(u){for(var h=0;h<u.length;h++){var a=u[h];if(a.buffer instanceof ArrayBuffer){var s=a.buffer;if(a.byteLength!==s.byteLength){var d=new Uint8Array(a.byteLength);d.set(new Uint8Array(s,a.byteOffset,a.byteLength)),s=d.buffer}u[h]=s}}}function o(u,h){h=h||{};var a=new l;n(u);for(var s=0;s<u.length;s++)a.append(u[s]);return h.type?a.getBlob(h.type):a.getBlob()}function c(u,h){return n(u),new Blob(u,h||{})}var l=r.BlobBuilder||r.WebKitBlobBuilder||r.MSBlobBuilder||r.MozBlobBuilder,p=function(){try{var u=new Blob(["hi"]);return u.size===2}catch{return!1}}(),f=p&&function(){try{var u=new Blob([new Uint8Array([1,2])]);return u.size===2}catch{return!1}}(),i=l&&l.prototype.append&&l.prototype.getBlob;e.exports=function(){return p?f?r.Blob:c:i?o:void 0}()}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],31:[function(t,e,r){(function(n){(function(o){function c(C){for(var k,N,x=[],L=0,A=C.length;A>L;)k=C.charCodeAt(L++),k>=55296&&56319>=k&&A>L?(N=C.charCodeAt(L++),(64512&N)==56320?x.push(((1023&k)<<10)+(1023&N)+65536):(x.push(k),L--)):x.push(k);return x}function l(C){for(var k,N=C.length,x=-1,L="";++x<N;)k=C[x],k>65535&&(k-=65536,L+=b(k>>>10&1023|55296),k=56320|1023&k),L+=b(k);return L}function p(C){if(C>=55296&&57343>=C)throw Error("Lone surrogate U+"+C.toString(16).toUpperCase()+" is not a scalar value")}function f(C,k){return b(C>>k&63|128)}function i(C){if(!(4294967168&C))return b(C);var k="";return 4294965248&C?4294901760&C?!(4292870144&C)&&(k=b(C>>18&7|240),k+=f(C,12),k+=f(C,6)):(p(C),k=b(C>>12&15|224),k+=f(C,6)):k=b(C>>6&31|192),k+=b(63&C|128)}function u(C){for(var k,N=c(C),x=N.length,L=-1,A="";++L<x;)k=N[L],A+=i(k);return A}function h(){if(R>=T)throw Error("Invalid byte index");var C=255&v[R];if(R++,(192&C)==128)return 63&C;throw Error("Invalid continuation byte")}function a(){var C,k,N,x,L;if(R>T)throw Error("Invalid byte index");if(R==T)return!1;if(C=255&v[R],R++,(128&C)==0)return C;if((224&C)==192){var k=h();if(L=(31&C)<<6|k,L>=128)return L;throw Error("Invalid continuation byte")}if((240&C)==224){if(k=h(),N=h(),L=(15&C)<<12|k<<6|N,L>=2048)return p(L),L;throw Error("Invalid continuation byte")}if((248&C)==240&&(k=h(),N=h(),x=h(),L=(15&C)<<18|k<<12|N<<6|x,L>=65536&&1114111>=L))return L;throw Error("Invalid UTF-8 detected")}function s(C){v=c(C),T=v.length,R=0;for(var k,N=[];(k=a())!==!1;)N.push(k);return l(N)}var d=typeof r=="object"&&r,y=typeof e=="object"&&e&&e.exports==d&&e,m=typeof n=="object"&&n;(m.global===m||m.window===m)&&(o=m);var v,T,R,b=String.fromCharCode,S={version:"2.0.0",encode:u,decode:s};if(d&&!d.nodeType)if(y)y.exports=S;else{var g={},w=g.hasOwnProperty;for(var E in S)w.call(S,E)&&(d[E]=S[E])}else o.utf8=S})(this)}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],32:[function(t,e){(function(r){var n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,c=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,l=/(?:^|:|,)(?:\s*\[)+/g,p=/^\s+/,f=/\s+$/;e.exports=function(i){return typeof i=="string"&&i?(i=i.replace(p,"").replace(f,""),r.JSON&&JSON.parse?JSON.parse(i):n.test(i.replace(o,"@").replace(c,"]").replace(l,""))?new Function("return "+i)():void 0):null}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],33:[function(t,e,r){r.encode=function(n){var o="";for(var c in n)n.hasOwnProperty(c)&&(o.length&&(o+="&"),o+=encodeURIComponent(c)+"="+encodeURIComponent(n[c]));return o},r.decode=function(n){for(var o={},c=n.split("&"),l=0,p=c.length;p>l;l++){var f=c[l].split("=");o[decodeURIComponent(f[0])]=decodeURIComponent(f[1])}return o}},{}],34:[function(t,e){var r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function(o){var c=o,l=o.indexOf("["),p=o.indexOf("]");l!=-1&&p!=-1&&(o=o.substring(0,l)+o.substring(l,p).replace(/:/g,";")+o.substring(p,o.length));for(var f=r.exec(o||""),i={},u=14;u--;)i[n[u]]=f[u]||"";return l!=-1&&p!=-1&&(i.source=c,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i}},{}],35:[function(t,e){function r(c,l){return l?new o(c,l):new o(c)}var n=function(){return self}(),o=n.WebSocket||n.MozWebSocket;e.exports=o?r:null,o&&(r.prototype=o.prototype)},{}],36:[function(t,e){(function(r){function n(c){function l(p){if(!p)return!1;if(r.Buffer&&r.Buffer.isBuffer(p)||r.ArrayBuffer&&p instanceof ArrayBuffer||r.Blob&&p instanceof Blob||r.File&&p instanceof File)return!0;if(o(p)){for(var f=0;f<p.length;f++)if(l(p[f]))return!0}else if(p&&typeof p=="object"){p.toJSON&&(p=p.toJSON());for(var i in p)if(Object.prototype.hasOwnProperty.call(p,i)&&l(p[i]))return!0}return!1}return l(c)}var o=t("isarray");e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{isarray:37}],37:[function(t,e){e.exports=Array.isArray||function(r){return Object.prototype.toString.call(r)=="[object Array]"}},{}],38:[function(t,e){var r=t("global");try{e.exports="XMLHttpRequest"in r&&"withCredentials"in new r.XMLHttpRequest}catch{e.exports=!1}},{global:39}],39:[function(t,e){e.exports=function(){return this}()},{}],40:[function(t,e){var r=[].indexOf;e.exports=function(n,o){if(r)return n.indexOf(o);for(var c=0;c<n.length;++c)if(n[c]===o)return c;return-1}},{}],41:[function(t,e,r){var n=Object.prototype.hasOwnProperty;r.keys=Object.keys||function(o){var c=[];for(var l in o)n.call(o,l)&&c.push(l);return c},r.values=function(o){var c=[];for(var l in o)n.call(o,l)&&c.push(o[l]);return c},r.merge=function(o,c){for(var l in c)n.call(c,l)&&(o[l]=c[l]);return o},r.length=function(o){return r.keys(o).length},r.isEmpty=function(o){return r.length(o)==0}},{}],42:[function(t,e){var r=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function(o){for(var c=r.exec(o||""),l={},p=14;p--;)l[n[p]]=c[p]||"";return l}},{}],43:[function(t,e,r){(function(n){var o=t("isarray"),c=t("./is-buffer");r.deconstructPacket=function(l){function p(h){if(!h)return h;if(c(h)){var a={_placeholder:!0,num:f.length};return f.push(h),a}if(o(h)){for(var s=new Array(h.length),d=0;d<h.length;d++)s[d]=p(h[d]);return s}if(typeof h=="object"&&!(h instanceof Date)){var s={};for(var y in h)s[y]=p(h[y]);return s}return h}var f=[],i=l.data,u=l;return u.data=p(i),u.attachments=f.length,{packet:u,buffers:f}},r.reconstructPacket=function(l,p){function f(i){if(i&&i._placeholder){var u=p[i.num];return u}if(o(i)){for(var h=0;h<i.length;h++)i[h]=f(i[h]);return i}if(i&&typeof i=="object"){for(var a in i)i[a]=f(i[a]);return i}return i}return l.data=f(l.data),l.attachments=void 0,l},r.removeBlobs=function(l,p){function f(h,a,s){if(!h)return h;if(n.Blob&&h instanceof Blob||n.File&&h instanceof File){i++;var d=new FileReader;d.onload=function(){s?s[a]=this.result:u=this.result,--i||p(u)},d.readAsArrayBuffer(h)}else if(o(h))for(var y=0;y<h.length;y++)f(h[y],y,h);else if(h&&typeof h=="object"&&!c(h))for(var m in h)f(h[m],m,h)}var i=0,u=l;f(u),i||p(u)}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./is-buffer":45,isarray:46}],44:[function(t,e,r){function n(){}function o(y){var m="",v=!1;return m+=y.type,(r.BINARY_EVENT==y.type||r.BINARY_ACK==y.type)&&(m+=y.attachments,m+="-"),y.nsp&&y.nsp!="/"&&(v=!0,m+=y.nsp),y.id!=null&&(v&&(m+=",",v=!1),m+=y.id),y.data!=null&&(v&&(m+=","),m+=h.stringify(y.data)),u("encoded %j as %s",y,m),m}function c(y,m){function v(T){var R=s.deconstructPacket(T),b=o(R.packet),S=R.buffers;S.unshift(b),m(S)}s.removeBlobs(y,v)}function l(){this.reconstructor=null}function p(y){var m={},v=0;if(m.type=Number(y.charAt(0)),r.types[m.type]==null)return i();if(r.BINARY_EVENT==m.type||r.BINARY_ACK==m.type){for(var T="";y.charAt(++v)!="-"&&(T+=y.charAt(v),v!=y.length););if(T!=Number(T)||y.charAt(v)!="-")throw new Error("Illegal attachments");m.attachments=Number(T)}if(y.charAt(v+1)=="/")for(m.nsp="";++v;){var R=y.charAt(v);if(R==","||(m.nsp+=R,v==y.length))break}else m.nsp="/";var b=y.charAt(v+1);if(b!==""&&Number(b)==b){for(m.id="";++v;){var R=y.charAt(v);if(R==null||Number(R)!=R){--v;break}if(m.id+=y.charAt(v),v==y.length)break}m.id=Number(m.id)}if(y.charAt(++v))try{m.data=h.parse(y.substr(v))}catch{return i()}return u("decoded %s as %j",y,m),m}function f(y){this.reconPack=y,this.buffers=[]}function i(){return{type:r.ERROR,data:"parser error"}}var u=t("debug")("socket.io-parser"),h=t("json3"),a=(t("isarray"),t("component-emitter")),s=t("./binary"),d=t("./is-buffer");r.protocol=4,r.types=["CONNECT","DISCONNECT","EVENT","BINARY_EVENT","ACK","BINARY_ACK","ERROR"],r.CONNECT=0,r.DISCONNECT=1,r.EVENT=2,r.ACK=3,r.ERROR=4,r.BINARY_EVENT=5,r.BINARY_ACK=6,r.Encoder=n,r.Decoder=l,n.prototype.encode=function(y,m){if(u("encoding packet %j",y),r.BINARY_EVENT==y.type||r.BINARY_ACK==y.type)c(y,m);else{var v=o(y);m([v])}},a(l.prototype),l.prototype.add=function(y){var m;if(typeof y=="string")m=p(y),r.BINARY_EVENT==m.type||r.BINARY_ACK==m.type?(this.reconstructor=new f(m),this.reconstructor.reconPack.attachments===0&&this.emit("decoded",m)):this.emit("decoded",m);else{if(!d(y)&&!y.base64)throw new Error("Unknown type: "+y);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");m=this.reconstructor.takeBinaryData(y),m&&(this.reconstructor=null,this.emit("decoded",m))}},l.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},f.prototype.takeBinaryData=function(y){if(this.buffers.push(y),this.buffers.length==this.reconPack.attachments){var m=s.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),m}return null},f.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},{"./binary":43,"./is-buffer":45,"component-emitter":9,debug:10,isarray:46,json3:47}],45:[function(t,e){(function(r){function n(o){return r.Buffer&&r.Buffer.isBuffer(o)||r.ArrayBuffer&&o instanceof ArrayBuffer}e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],46:[function(t,e){e.exports=t(37)},{}],47:[function(t,e,r){(function(n){function o(I){if(o[I]!==p)return o[I];var F;if(I=="bug-string-char-index")F=!1;else if(I=="json")F=o("json-stringify")&&o("json-parse");else{var B,P='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if(I=="json-stringify"){var O=u.stringify,U=typeof O=="function"&&h;if(U){(B=function(){return 1}).toJSON=B;try{U=O(0)==="0"&&O(new Number)==="0"&&O(new String)=='""'&&O(f)===p&&O(p)===p&&O()===p&&O(B)==="1"&&O([B])=="[1]"&&O([p])=="[null]"&&O(null)=="null"&&O([p,f,null])=="[null,null,null]"&&O({a:[B,!0,!1,null,`\0\b
8
- \f\r `]})==P&&O(null,B)==="1"&&O([1,2],null,1)==`[
6
+ */var Me=function(a){return a!=null&&(Ae(a)||qe(a)||!!a._isBuffer)};function Ae(a){return!!a.constructor&&typeof a.constructor.isBuffer=="function"&&a.constructor.isBuffer(a)}function qe(a){return typeof a.readFloatLE=="function"&&typeof a.slice=="function"&&Ae(a.slice(0,0))}(function(){var a=Fe,t=we.utf8,e=Me,s=we.bin,o=function(h,f){h.constructor==String?f&&f.encoding==="binary"?h=s.stringToBytes(h):h=t.stringToBytes(h):e(h)?h=Array.prototype.slice.call(h,0):!Array.isArray(h)&&h.constructor!==Uint8Array&&(h=h.toString());for(var l=a.bytesToWords(h),d=h.length*8,i=1732584193,u=-271733879,c=-1732584194,r=271733878,n=0;n<l.length;n++)l[n]=(l[n]<<8|l[n]>>>24)&16711935|(l[n]<<24|l[n]>>>8)&4278255360;l[d>>>5]|=128<<d%32,l[(d+64>>>9<<4)+14]=d;for(var p=o._ff,g=o._gg,y=o._hh,T=o._ii,n=0;n<l.length;n+=16){var P=i,U=u,M=c,_=r;i=p(i,u,c,r,l[n+0],7,-680876936),r=p(r,i,u,c,l[n+1],12,-389564586),c=p(c,r,i,u,l[n+2],17,606105819),u=p(u,c,r,i,l[n+3],22,-1044525330),i=p(i,u,c,r,l[n+4],7,-176418897),r=p(r,i,u,c,l[n+5],12,1200080426),c=p(c,r,i,u,l[n+6],17,-1473231341),u=p(u,c,r,i,l[n+7],22,-45705983),i=p(i,u,c,r,l[n+8],7,1770035416),r=p(r,i,u,c,l[n+9],12,-1958414417),c=p(c,r,i,u,l[n+10],17,-42063),u=p(u,c,r,i,l[n+11],22,-1990404162),i=p(i,u,c,r,l[n+12],7,1804603682),r=p(r,i,u,c,l[n+13],12,-40341101),c=p(c,r,i,u,l[n+14],17,-1502002290),u=p(u,c,r,i,l[n+15],22,1236535329),i=g(i,u,c,r,l[n+1],5,-165796510),r=g(r,i,u,c,l[n+6],9,-1069501632),c=g(c,r,i,u,l[n+11],14,643717713),u=g(u,c,r,i,l[n+0],20,-373897302),i=g(i,u,c,r,l[n+5],5,-701558691),r=g(r,i,u,c,l[n+10],9,38016083),c=g(c,r,i,u,l[n+15],14,-660478335),u=g(u,c,r,i,l[n+4],20,-405537848),i=g(i,u,c,r,l[n+9],5,568446438),r=g(r,i,u,c,l[n+14],9,-1019803690),c=g(c,r,i,u,l[n+3],14,-187363961),u=g(u,c,r,i,l[n+8],20,1163531501),i=g(i,u,c,r,l[n+13],5,-1444681467),r=g(r,i,u,c,l[n+2],9,-51403784),c=g(c,r,i,u,l[n+7],14,1735328473),u=g(u,c,r,i,l[n+12],20,-1926607734),i=y(i,u,c,r,l[n+5],4,-378558),r=y(r,i,u,c,l[n+8],11,-2022574463),c=y(c,r,i,u,l[n+11],16,1839030562),u=y(u,c,r,i,l[n+14],23,-35309556),i=y(i,u,c,r,l[n+1],4,-1530992060),r=y(r,i,u,c,l[n+4],11,1272893353),c=y(c,r,i,u,l[n+7],16,-155497632),u=y(u,c,r,i,l[n+10],23,-1094730640),i=y(i,u,c,r,l[n+13],4,681279174),r=y(r,i,u,c,l[n+0],11,-358537222),c=y(c,r,i,u,l[n+3],16,-722521979),u=y(u,c,r,i,l[n+6],23,76029189),i=y(i,u,c,r,l[n+9],4,-640364487),r=y(r,i,u,c,l[n+12],11,-421815835),c=y(c,r,i,u,l[n+15],16,530742520),u=y(u,c,r,i,l[n+2],23,-995338651),i=T(i,u,c,r,l[n+0],6,-198630844),r=T(r,i,u,c,l[n+7],10,1126891415),c=T(c,r,i,u,l[n+14],15,-1416354905),u=T(u,c,r,i,l[n+5],21,-57434055),i=T(i,u,c,r,l[n+12],6,1700485571),r=T(r,i,u,c,l[n+3],10,-1894986606),c=T(c,r,i,u,l[n+10],15,-1051523),u=T(u,c,r,i,l[n+1],21,-2054922799),i=T(i,u,c,r,l[n+8],6,1873313359),r=T(r,i,u,c,l[n+15],10,-30611744),c=T(c,r,i,u,l[n+6],15,-1560198380),u=T(u,c,r,i,l[n+13],21,1309151649),i=T(i,u,c,r,l[n+4],6,-145523070),r=T(r,i,u,c,l[n+11],10,-1120210379),c=T(c,r,i,u,l[n+2],15,718787259),u=T(u,c,r,i,l[n+9],21,-343485551),i=i+P>>>0,u=u+U>>>0,c=c+M>>>0,r=r+_>>>0}return a.endian([i,u,c,r])};o._ff=function(h,f,l,d,i,u,c){var r=h+(f&l|~f&d)+(i>>>0)+c;return(r<<u|r>>>32-u)+f},o._gg=function(h,f,l,d,i,u,c){var r=h+(f&d|l&~d)+(i>>>0)+c;return(r<<u|r>>>32-u)+f},o._hh=function(h,f,l,d,i,u,c){var r=h+(f^l^d)+(i>>>0)+c;return(r<<u|r>>>32-u)+f},o._ii=function(h,f,l,d,i,u,c){var r=h+(l^(f|~d))+(i>>>0)+c;return(r<<u|r>>>32-u)+f},o._blocksize=16,o._digestsize=16,Te.exports=function(h,f){if(h==null)throw new Error("Illegal argument "+h);var l=a.wordsToBytes(o(h,f));return f&&f.asBytes?l:f&&f.asString?s.bytesToString(l):a.bytesToHex(l)}})();var Xe=Te.exports;const Ve=Pe(Xe);var ee=(a=>(a.BOOTSTRAP="bootstrap",a.DEBUG_EXTENSIONS="debugExtensions",a.DEBUG_QUEUE="debugQueue",a.DEBUG_DIALER="debugDialer",a.FULL="full",a))(ee||{}),Q=(a=>(a.MAIN="main",a.NEXT="next",a))(Q||{}),Y=(a=>(a.USER="User",a.TOKEN="Token",a))(Y||{});class oe{static async getSessionStorageDataByKey(t,e=!0){if(typeof chrome<"u"&&typeof chrome.storage<"u"){const s=await chrome.storage.session.get(t);if(s[t])return e?JSON.parse(s[t]):s[t]}if(typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.getItem=="function"){const s=window.sessionStorage.getItem(t);if(s)return e?JSON.parse(s):s}}static async updateSessionStorageKey(t,e){typeof chrome<"u"&&typeof chrome.storage<"u"&&await chrome.storage.session.set({[t]:JSON.stringify(e)}),typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.setItem=="function"&&window.sessionStorage.setItem(t,JSON.stringify(e))}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 Ke{constructor(t){V(this,"delay",1e3);V(this,"lastLoginTimestamp");V(this,"token");V(this,"refreshToken");V(this,"tokenExpiry");V(this,"storageKey");this.eventsSdkClass=t,this.eventsSdkClass=t,this.storageKey=""}async login(){const t={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=Ve(JSON.stringify({...this.eventsSdkClass.options,loggerSocketConnection:null},this.eventsSdkClass.getCircularReplacer())),this.lastLoginTimestamp&&this.lastLoginTimestamp+this.delay>new Date().getTime())return;this.updateLastLoginTimestamp();const e=await this.checkLoginStatus(this.storageKey);return e||(oe.clearSessionStorage(),await this.userLoginFunction(t,this.storageKey,this.eventsSdkClass.options.loginType))}updateLastLoginTimestamp(){this.lastLoginTimestamp=new Date().getTime()}async checkLoginStatus(t){const e=await oe.getSessionStorageDataByKey(t);if(e)return e}async userLoginFunction(t,e,s){let o,h,f;return this.eventsSdkClass.options.isNewStack?(o=await this.externalLogin(this.eventsSdkClass.options.loginUrl,t,s),h=await this.getSettings(o.Data.AccessToken),f={...o.Data,...h}):(o=await this.externalLogin(this.eventsSdkClass.options.loginUrl,t,s),f={...o.Data.Socket}),await oe.updateSessionStorageKey(e,f),f}onLoginResponse(t){if(!this.eventsSdkClass.options.isNewStack&&this.eventsSdkClass.options.servers&&(this.eventsSdkClass.servers=[...this.eventsSdkClass.options.servers],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((e,s)=>e.Priority>s.Priority?e:s)),this.eventsSdkClass.options.isNewStack&&this.eventsSdkClass.options.servers&&(this.eventsSdkClass.servers=[...this.eventsSdkClass.options.servers],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((e,s)=>e.Priority>s.Priority?e:s)),t.MonitorList&&t.MonitorList.length&&!this.eventsSdkClass.options.servers&&(this.eventsSdkClass.servers=[...t.MonitorList],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((e,s)=>e.Priority>s.Priority?e:s)),!this.eventsSdkClass.options.isNewStack&&!this.eventsSdkClass.servers.length&&t.URLList&&(this.eventsSdkClass.URLList=t.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=${t.Version}`),t.IdentityCode&&(this.token=t.IdentityCode,this.eventsSdkClass.connect(Q.MAIN)),t.Token&&(this.token=t.Token,this.eventsSdkClass.connect(Q.MAIN)),t.RefreshToken&&t.IdentityCodeExpiry&&this.eventsSdkClass.options.loginType===Y.USER&&(this.refreshToken=t.RefreshToken,this.tokenExpiry=t.IdentityCodeExpiry,this.handleTokenExpiry()),t.RefreshToken&&t.TokenExpiry&&this.normalizeLoginType(this.eventsSdkClass.options.loginType)===Y.USER&&(this.refreshToken=t.RefreshToken,this.tokenExpiry=t.TokenExpiry,this.handleTokenExpiry())}handleTokenExpiry(){if(!this.eventsSdkClass.options.refreshTokenUrl)throw new Error("refreshTokenUrl not provided");let t;if(this.tokenExpiry)t=new Date(this.tokenExpiry);else return;const e=t.getTime()-new Date().getTime()-5e3,s=Math.min(e,2147483647);setTimeout(async()=>{if(this.refreshToken){this.eventsSdkClass.socketIoClass.closeAllConnections();let o,h;if(this.eventsSdkClass.options.isNewStack){const f=await this.externalRefreshToken(this.eventsSdkClass.options.refreshTokenUrl,this.refreshToken);o=await this.getSettings(f.Data.AccessToken),h={...f.Data,...o}}else h={...(await this.externalRefreshToken(this.eventsSdkClass.options.refreshTokenUrl,this.refreshToken)).Data.Socket};this.onLoginResponse(h),await oe.updateSessionStorageKey(this.storageKey,h)}},s)}async externalLogin(t,{password:e,token:s,email:o},h){if(!t)throw new Error("loginUrl not provided");let f;this.eventsSdkClass.options.isNewStack?h===Y.TOKEN?f=JSON.stringify({identityType:Y.TOKEN,token:s}):f=JSON.stringify({identityType:Y.USER,username:o,password:e}):this.eventsSdkClass.options.loginType===Y.TOKEN?(f=JSON.stringify({token:s}),t=`${t}/${Y.TOKEN}`):(f=JSON.stringify({email:o,pin:e}),t=`${t}/${Y.USER}`);let l;try{const d=await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:f});if(!d.ok&&d.status===400)throw l=400,new Error("Bad body request. Login type or isNewStack values not correct or not provided");if(!d.ok&&d.status===401)throw l=401,new Error("Unauthorized. Invalid token provided");if(!d.ok&&d.status===403)throw l=403,new Error("Forbidden. Identity token not provided or not valid");const i=await d.json();if(i.error)throw new Error(i.error);return i}catch(d){throw this.eventsSdkClass.loggerClass.loginError(h,l,s,o),d}}async getSettings(t){try{if(!this.eventsSdkClass.options.getSettingsUrl)throw new Error("getSettingsUrl not provided");const e=await fetch(this.eventsSdkClass.options.getSettingsUrl,{headers:{Authorization:`Bearer ${t}`}});if(!e.ok&&e.status===401)throw new Error("Unauthorized. Access token not provided or not valid");return e.json()}catch(e){throw this.eventsSdkClass.loggerClass.getSettingsError(t,e),e}}async externalRefreshToken(t,e){try{return(await fetch(t,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${e}`}})).json()}catch(s){throw this.eventsSdkClass.loggerClass.refreshTokenError(e,t,s),s}}normalizeLoginType(t){return t.charAt(0).toUpperCase()+t.slice(1).toLowerCase()}}const $e={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 Ge(){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=je,typeof self.navigator>"u"&&(self.navigator={userAgent:"node"})),function a(t,e,s){function o(l,d){if(!e[l]){if(!t[l]){var i=typeof require=="function"&&require;if(!d&&i)return i(l,!0);if(h)return h(l,!0);throw new Error("Cannot find module '"+l+"'")}var u=e[l]={exports:{}};t[l][0].call(u.exports,function(c){var r=t[l][1][c];return o(r||c)},u,u.exports,a,t,e,s)}return e[l].exports}for(var h=typeof require=="function"&&require,f=0;f<s.length;f++)o(s[f]);return o}({1:[function(a,t){t.exports=a("./lib/")},{"./lib/":2}],2:[function(a,t,e){function s(i,u){typeof i=="object"&&(u=i,i=void 0),u=u||{};var c,r=o(i),n=r.source,p=r.id;return u.forceNew||u["force new connection"]||u.multiplex===!1?(l("ignoring socket cache for %s",n),c=f(n,u)):(d[p]||(l("new io instance for %s",n),d[p]=f(n,u)),c=d[p]),c.socket(r.path)}var o=a("./url"),h=a("socket.io-parser"),f=a("./manager"),l=a("debug")("socket.io-client");t.exports=e=s;var d=e.managers={};e.protocol=h.protocol,e.connect=s,e.Manager=a("./manager"),e.Socket=a("./socket")},{"./manager":3,"./socket":5,"./url":6,debug:10,"socket.io-parser":44}],3:[function(a,t){function e(r,n){return this instanceof e?(r&&typeof r=="object"&&(n=r,r=void 0),n=n||{},n.path=n.path||"/socket.io",this.nsps={},this.subs=[],this.opts=n,this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor(n.randomizationFactor||.5),this.backoff=new c({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this.readyState="closed",this.uri=r,this.connected=[],this.encoding=!1,this.packetBuffer=[],this.encoder=new f.Encoder,this.decoder=new f.Decoder,this.autoConnect=n.autoConnect!==!1,void(this.autoConnect&&this.open())):new e(r,n)}var s=(a("./url"),a("engine.io-client")),o=a("./socket"),h=a("component-emitter"),f=a("socket.io-parser"),l=a("./on"),d=a("component-bind"),i=(a("object-component"),a("debug")("socket.io-client:manager")),u=a("indexof"),c=a("backo2");t.exports=e,e.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var r in this.nsps)this.nsps[r].emit.apply(this.nsps[r],arguments)},e.prototype.updateSocketIds=function(){for(var r in this.nsps)this.nsps[r].id=this.engine.id},h(e.prototype),e.prototype.reconnection=function(r){return arguments.length?(this._reconnection=!!r,this):this._reconnection},e.prototype.reconnectionAttempts=function(r){return arguments.length?(this._reconnectionAttempts=r,this):this._reconnectionAttempts},e.prototype.reconnectionDelay=function(r){return arguments.length?(this._reconnectionDelay=r,this.backoff&&this.backoff.setMin(r),this):this._reconnectionDelay},e.prototype.randomizationFactor=function(r){return arguments.length?(this._randomizationFactor=r,this.backoff&&this.backoff.setJitter(r),this):this._randomizationFactor},e.prototype.reconnectionDelayMax=function(r){return arguments.length?(this._reconnectionDelayMax=r,this.backoff&&this.backoff.setMax(r),this):this._reconnectionDelayMax},e.prototype.timeout=function(r){return arguments.length?(this._timeout=r,this):this._timeout},e.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()},e.prototype.open=e.prototype.connect=function(r){if(i("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;i("opening %s",this.uri),this.engine=s(this.uri,this.opts);var n=this.engine,p=this;this.readyState="opening",this.skipReconnect=!1;var g=l(n,"open",function(){p.onopen(),r&&r()}),y=l(n,"error",function(U){if(i("connect_error"),p.cleanup(),p.readyState="closed",p.emitAll("connect_error",U),r){var M=new Error("Connection error");M.data=U,r(M)}else p.maybeReconnectOnOpen()});if(this._timeout!==!1){var T=this._timeout;i("connect attempt will timeout after %d",T);var P=setTimeout(function(){i("connect attempt timed out after %d",T),g.destroy(),n.close(),n.emit("error","timeout"),p.emitAll("connect_timeout",T)},T);this.subs.push({destroy:function(){clearTimeout(P)}})}return this.subs.push(g),this.subs.push(y),this},e.prototype.onopen=function(){i("open"),this.cleanup(),this.readyState="open",this.emit("open");var r=this.engine;this.subs.push(l(r,"data",d(this,"ondata"))),this.subs.push(l(this.decoder,"decoded",d(this,"ondecoded"))),this.subs.push(l(r,"error",d(this,"onerror"))),this.subs.push(l(r,"close",d(this,"onclose")))},e.prototype.ondata=function(r){this.decoder.add(r)},e.prototype.ondecoded=function(r){this.emit("packet",r)},e.prototype.onerror=function(r){i("error",r),this.emitAll("error",r)},e.prototype.socket=function(r){var n=this.nsps[r];if(!n){n=new o(this,r),this.nsps[r]=n;var p=this;n.on("connect",function(){n.id=p.engine.id,~u(p.connected,n)||p.connected.push(n)})}return n},e.prototype.destroy=function(r){var n=u(this.connected,r);~n&&this.connected.splice(n,1),this.connected.length||this.close()},e.prototype.packet=function(r){i("writing packet %j",r);var n=this;n.encoding?n.packetBuffer.push(r):(n.encoding=!0,this.encoder.encode(r,function(p){for(var g=0;g<p.length;g++)n.engine.write(p[g]);n.encoding=!1,n.processPacketQueue()}))},e.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var r=this.packetBuffer.shift();this.packet(r)}},e.prototype.cleanup=function(){for(var r;r=this.subs.shift();)r.destroy();this.packetBuffer=[],this.encoding=!1,this.decoder.destroy()},e.prototype.close=e.prototype.disconnect=function(){this.skipReconnect=!0,this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},e.prototype.onclose=function(r){i("close"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",r),this._reconnection&&!this.skipReconnect&&this.reconnect()},e.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var r=this;if(this.backoff.attempts>=this._reconnectionAttempts)i("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var n=this.backoff.duration();i("will wait %dms before reconnect attempt",n),this.reconnecting=!0;var p=setTimeout(function(){r.skipReconnect||(i("attempting reconnect"),r.emitAll("reconnect_attempt",r.backoff.attempts),r.emitAll("reconnecting",r.backoff.attempts),r.skipReconnect||r.open(function(g){g?(i("reconnect attempt error"),r.reconnecting=!1,r.reconnect(),r.emitAll("reconnect_error",g.data)):(i("reconnect success"),r.onreconnect())}))},n);this.subs.push({destroy:function(){clearTimeout(p)}})}},e.prototype.onreconnect=function(){var r=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",r)}},{"./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(a,t){function e(s,o,h){return s.on(o,h),{destroy:function(){s.removeListener(o,h)}}}t.exports=e},{}],5:[function(a,t,e){function s(n,p){this.io=n,this.nsp=p,this.json=this,this.ids=0,this.acks={},this.io.autoConnect&&this.open(),this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0}var o=a("socket.io-parser"),h=a("component-emitter"),f=a("to-array"),l=a("./on"),d=a("component-bind"),i=a("debug")("socket.io-client:socket"),u=a("has-binary");t.exports=s;var c={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},r=h.prototype.emit;h(s.prototype),s.prototype.subEvents=function(){if(!this.subs){var n=this.io;this.subs=[l(n,"open",d(this,"onopen")),l(n,"packet",d(this,"onpacket")),l(n,"close",d(this,"onclose"))]}},s.prototype.open=s.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),this.io.readyState=="open"&&this.onopen(),this)},s.prototype.send=function(){var n=f(arguments);return n.unshift("message"),this.emit.apply(this,n),this},s.prototype.emit=function(n){if(c.hasOwnProperty(n))return r.apply(this,arguments),this;var p=f(arguments),g=o.EVENT;u(p)&&(g=o.BINARY_EVENT);var y={type:g,data:p};return typeof p[p.length-1]=="function"&&(i("emitting packet with ack id %d",this.ids),this.acks[this.ids]=p.pop(),y.id=this.ids++),this.connected?this.packet(y):this.sendBuffer.push(y),this},s.prototype.packet=function(n){n.nsp=this.nsp,this.io.packet(n)},s.prototype.onopen=function(){i("transport is open - connecting"),this.nsp!="/"&&this.packet({type:o.CONNECT})},s.prototype.onclose=function(n){i("close (%s)",n),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",n)},s.prototype.onpacket=function(n){if(n.nsp==this.nsp)switch(n.type){case o.CONNECT:this.onconnect();break;case o.EVENT:this.onevent(n);break;case o.BINARY_EVENT:this.onevent(n);break;case o.ACK:this.onack(n);break;case o.BINARY_ACK:this.onack(n);break;case o.DISCONNECT:this.ondisconnect();break;case o.ERROR:this.emit("error",n.data)}},s.prototype.onevent=function(n){var p=n.data||[];i("emitting event %j",p),n.id!=null&&(i("attaching ack callback to event"),p.push(this.ack(n.id))),this.connected?r.apply(this,p):this.receiveBuffer.push(p)},s.prototype.ack=function(n){var p=this,g=!1;return function(){if(!g){g=!0;var y=f(arguments);i("sending ack %j",y);var T=u(y)?o.BINARY_ACK:o.ACK;p.packet({type:T,id:n,data:y})}}},s.prototype.onack=function(n){i("calling ack %s with %j",n.id,n.data);var p=this.acks[n.id];p.apply(this,n.data),delete this.acks[n.id]},s.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},s.prototype.emitBuffered=function(){var n;for(n=0;n<this.receiveBuffer.length;n++)r.apply(this,this.receiveBuffer[n]);for(this.receiveBuffer=[],n=0;n<this.sendBuffer.length;n++)this.packet(this.sendBuffer[n]);this.sendBuffer=[]},s.prototype.ondisconnect=function(){i("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},s.prototype.destroy=function(){if(this.subs){for(var n=0;n<this.subs.length;n++)this.subs[n].destroy();this.subs=null}this.io.destroy(this)},s.prototype.close=s.prototype.disconnect=function(){return this.connected&&(i("performing disconnect (%s)",this.nsp),this.packet({type:o.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}},{"./on":4,"component-bind":8,"component-emitter":9,debug:10,"has-binary":36,"socket.io-parser":44,"to-array":48}],6:[function(a,t){(function(e){function s(f,i){var d=f,i=i||e.location;return f==null&&(f=i.protocol+"//"+i.host),typeof f=="string"&&(f.charAt(0)=="/"&&(f=f.charAt(1)=="/"?i.protocol+f:i.hostname+f),/^(https?|wss?):\/\//.test(f)||(h("protocol-less url %s",f),f=typeof i<"u"?i.protocol+"//"+f:"https://"+f),h("parse %s",f),d=o(f)),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+(i&&i.port==d.port?"":":"+d.port),d}var o=a("parseuri"),h=a("debug")("socket.io-client:url");t.exports=s}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{debug:10,parseuri:42}],7:[function(a,t){function e(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}t.exports=e,e.prototype.duration=function(){var s=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var o=Math.random(),h=Math.floor(o*this.jitter*s);s=1&Math.floor(10*o)?s+h:s-h}return 0|Math.min(s,this.max)},e.prototype.reset=function(){this.attempts=0},e.prototype.setMin=function(s){this.ms=s},e.prototype.setMax=function(s){this.max=s},e.prototype.setJitter=function(s){this.jitter=s}},{}],8:[function(a,t){var e=[].slice;t.exports=function(s,o){if(typeof o=="string"&&(o=s[o]),typeof o!="function")throw new Error("bind() requires a function");var h=e.call(arguments,2);return function(){return o.apply(s,h.concat(e.call(arguments)))}}},{}],9:[function(a,t){function e(o){return o?s(o):void 0}function s(o){for(var h in e.prototype)o[h]=e.prototype[h];return o}t.exports=e,e.prototype.on=e.prototype.addEventListener=function(o,h){return this._callbacks=this._callbacks||{},(this._callbacks[o]=this._callbacks[o]||[]).push(h),this},e.prototype.once=function(o,h){function f(){l.off(o,f),h.apply(this,arguments)}var l=this;return this._callbacks=this._callbacks||{},f.fn=h,this.on(o,f),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(o,h){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var f=this._callbacks[o];if(!f)return this;if(arguments.length==1)return delete this._callbacks[o],this;for(var l,d=0;d<f.length;d++)if(l=f[d],l===h||l.fn===h){f.splice(d,1);break}return this},e.prototype.emit=function(o){this._callbacks=this._callbacks||{};var h=[].slice.call(arguments,1),f=this._callbacks[o];if(f){f=f.slice(0);for(var l=0,d=f.length;d>l;++l)f[l].apply(this,h)}return this},e.prototype.listeners=function(o){return this._callbacks=this._callbacks||{},this._callbacks[o]||[]},e.prototype.hasListeners=function(o){return!!this.listeners(o).length}},{}],10:[function(a,t){function e(o){return e.enabled(o)?function(h){h=s(h);var f=new Date,l=f-(e[o]||f);e[o]=f,h=o+" "+h+" +"+e.humanize(l),window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}:function(){}}function s(o){return o instanceof Error?o.stack||o.message:o}t.exports=e,e.names=[],e.skips=[],e.enable=function(o){try{localStorage.debug=o}catch{}for(var h=(o||"").split(/[\s,]+/),f=h.length,l=0;f>l;l++)o=h[l].replace("*",".*?"),o[0]==="-"?e.skips.push(new RegExp("^"+o.substr(1)+"$")):e.names.push(new RegExp("^"+o+"$"))},e.disable=function(){e.enable("")},e.humanize=function(o){var h=1e3,f=6e4,l=60*f;return o>=l?(o/l).toFixed(1)+"h":o>=f?(o/f).toFixed(1)+"m":o>=h?(o/h|0)+"s":o+"ms"},e.enabled=function(o){for(var h=0,f=e.skips.length;f>h;h++)if(e.skips[h].test(o))return!1;for(var h=0,f=e.names.length;f>h;h++)if(e.names[h].test(o))return!0;return!1};try{window.localStorage&&e.enable(localStorage.debug)}catch{}},{}],11:[function(a,t){t.exports=a("./lib/")},{"./lib/":12}],12:[function(a,t){t.exports=a("./socket"),t.exports.parser=a("engine.io-parser")},{"./socket":13,"engine.io-parser":25}],13:[function(a,t){(function(e){function s(n,p){if(!(this instanceof s))return new s(n,p);if(p=p||{},n&&typeof n=="object"&&(p=n,n=null),n&&(n=u(n),p.host=n.host,p.secure=n.protocol=="https"||n.protocol=="wss",p.port=n.port,n.query&&(p.query=n.query)),this.secure=p.secure!=null?p.secure:e.location&&location.protocol=="https:",p.host){var g=p.host.split(":");p.hostname=g.shift(),g.length?p.port=g.pop():p.port||(p.port=this.secure?"443":"80")}this.agent=p.agent||!1,this.hostname=p.hostname||(e.location?location.hostname:"localhost"),this.port=p.port||(e.location&&location.port?location.port:this.secure?443:80),this.query=p.query||{},typeof this.query=="string"&&(this.query=r.decode(this.query)),this.upgrade=p.upgrade!==!1,this.path=(p.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!p.forceJSONP,this.jsonp=p.jsonp!==!1,this.forceBase64=!!p.forceBase64,this.enablesXDR=!!p.enablesXDR,this.timestampParam=p.timestampParam||"t",this.timestampRequests=p.timestampRequests,this.transports=p.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.callbackBuffer=[],this.policyPort=p.policyPort||843,this.rememberUpgrade=p.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=p.onlyBinaryUpgrades,this.pfx=p.pfx||null,this.key=p.key||null,this.passphrase=p.passphrase||null,this.cert=p.cert||null,this.ca=p.ca||null,this.ciphers=p.ciphers||null,this.rejectUnauthorized=p.rejectUnauthorized||null,this.open()}function o(n){var p={};for(var g in n)n.hasOwnProperty(g)&&(p[g]=n[g]);return p}var h=a("./transports"),f=a("component-emitter"),l=a("debug")("engine.io-client:socket"),d=a("indexof"),i=a("engine.io-parser"),u=a("parseuri"),c=a("parsejson"),r=a("parseqs");t.exports=s,s.priorWebsocketSuccess=!1,f(s.prototype),s.protocol=i.protocol,s.Socket=s,s.Transport=a("./transport"),s.transports=a("./transports"),s.parser=a("engine.io-parser"),s.prototype.createTransport=function(n){l('creating transport "%s"',n);var p=o(this.query);p.EIO=i.protocol,p.transport=n,this.id&&(p.sid=this.id);var g=new h[n]({agent:this.agent,hostname:this.hostname,port:this.port,secure:this.secure,path:this.path,query:p,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},s.prototype.open=function(){var p;if(this.rememberUpgrade&&s.priorWebsocketSuccess&&this.transports.indexOf("websocket")!=-1)p="websocket";else{if(this.transports.length==0){var n=this;return void setTimeout(function(){n.emit("error","No transports available")},0)}p=this.transports[0]}this.readyState="opening";var p;try{p=this.createTransport(p)}catch{return this.transports.shift(),void this.open()}p.open(),this.setTransport(p)},s.prototype.setTransport=function(n){l("setting transport %s",n.name);var p=this;this.transport&&(l("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=n,n.on("drain",function(){p.onDrain()}).on("packet",function(g){p.onPacket(g)}).on("error",function(g){p.onError(g)}).on("close",function(){p.onClose("transport close")})},s.prototype.probe=function(n){function p(){if(b.onlyBinaryUpgrades){var A=!this.supportsBinary&&b.transport.supportsBinary;C=C||A}C||(l('probe transport "%s" opened',n),_.send([{type:"ping",data:"probe"}]),_.once("packet",function(v){if(!C)if(v.type=="pong"&&v.data=="probe"){if(l('probe transport "%s" pong',n),b.upgrading=!0,b.emit("upgrading",_),!_)return;s.priorWebsocketSuccess=_.name=="websocket",l('pausing current transport "%s"',b.transport.name),b.transport.pause(function(){C||b.readyState!="closed"&&(l("changing transport and sending upgrade packet"),M(),b.setTransport(_),_.send([{type:"upgrade"}]),b.emit("upgrade",_),_=null,b.upgrading=!1,b.flush())})}else{l('probe transport "%s" failed',n);var m=new Error("probe error");m.transport=_.name,b.emit("upgradeError",m)}}))}function g(){C||(C=!0,M(),_.close(),_=null)}function y(A){var v=new Error("probe error: "+A);v.transport=_.name,g(),l('probe transport "%s" failed because of error: %s',n,A),b.emit("upgradeError",v)}function T(){y("transport closed")}function P(){y("socket closed")}function U(A){_&&A.name!=_.name&&(l('"%s" works - aborting "%s"',A.name,_.name),g())}function M(){_.removeListener("open",p),_.removeListener("error",y),_.removeListener("close",T),b.removeListener("close",P),b.removeListener("upgrading",U)}l('probing transport "%s"',n);var _=this.createTransport(n,{probe:1}),C=!1,b=this;s.priorWebsocketSuccess=!1,_.once("open",p),_.once("error",y),_.once("close",T),this.once("close",P),this.once("upgrading",U),_.open()},s.prototype.onOpen=function(){if(l("socket open"),this.readyState="open",s.priorWebsocketSuccess=this.transport.name=="websocket",this.emit("open"),this.flush(),this.readyState=="open"&&this.upgrade&&this.transport.pause){l("starting upgrade probes");for(var n=0,p=this.upgrades.length;p>n;n++)this.probe(this.upgrades[n])}},s.prototype.onPacket=function(n){if(this.readyState=="opening"||this.readyState=="open")switch(l('socket receive: type "%s", data "%s"',n.type,n.data),this.emit("packet",n),this.emit("heartbeat"),n.type){case"open":this.onHandshake(c(n.data));break;case"pong":this.setPing();break;case"error":var p=new Error("server error");p.code=n.data,this.emit("error",p);break;case"message":this.emit("data",n.data),this.emit("message",n.data)}else l('packet received with socket readyState "%s"',this.readyState)},s.prototype.onHandshake=function(n){this.emit("handshake",n),this.id=n.sid,this.transport.query.sid=n.sid,this.upgrades=this.filterUpgrades(n.upgrades),this.pingInterval=n.pingInterval,this.pingTimeout=n.pingTimeout,this.onOpen(),this.readyState!="closed"&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},s.prototype.onHeartbeat=function(n){clearTimeout(this.pingTimeoutTimer);var p=this;p.pingTimeoutTimer=setTimeout(function(){p.readyState!="closed"&&p.onClose("ping timeout")},n||p.pingInterval+p.pingTimeout)},s.prototype.setPing=function(){var n=this;clearTimeout(n.pingIntervalTimer),n.pingIntervalTimer=setTimeout(function(){l("writing ping packet - expecting pong within %sms",n.pingTimeout),n.ping(),n.onHeartbeat(n.pingTimeout)},n.pingInterval)},s.prototype.ping=function(){this.sendPacket("ping")},s.prototype.onDrain=function(){for(var n=0;n<this.prevBufferLen;n++)this.callbackBuffer[n]&&this.callbackBuffer[n]();this.writeBuffer.splice(0,this.prevBufferLen),this.callbackBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length==0?this.emit("drain"):this.flush()},s.prototype.flush=function(){this.readyState!="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(l("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},s.prototype.write=s.prototype.send=function(n,p){return this.sendPacket("message",n,p),this},s.prototype.sendPacket=function(n,p,g){if(this.readyState!="closing"&&this.readyState!="closed"){var y={type:n,data:p};this.emit("packetCreate",y),this.writeBuffer.push(y),this.callbackBuffer.push(g),this.flush()}},s.prototype.close=function(){function n(){y.onClose("forced close"),l("socket closing - telling transport to close"),y.transport.close()}function p(){y.removeListener("upgrade",p),y.removeListener("upgradeError",p),n()}function g(){y.once("upgrade",p),y.once("upgradeError",p)}if(this.readyState=="opening"||this.readyState=="open"){this.readyState="closing";var y=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?g():n()}):this.upgrading?g():n()}return this},s.prototype.onError=function(n){l("socket error %j",n),s.priorWebsocketSuccess=!1,this.emit("error",n),this.onClose("transport error",n)},s.prototype.onClose=function(n,p){if(this.readyState=="opening"||this.readyState=="open"||this.readyState=="closing"){l('socket close with reason: "%s"',n);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",n,p)}},s.prototype.filterUpgrades=function(n){for(var p=[],g=0,y=n.length;y>g;g++)~d(this.transports,n[g])&&p.push(n[g]);return p}}).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(a,t){function e(h){this.path=h.path,this.hostname=h.hostname,this.port=h.port,this.secure=h.secure,this.query=h.query,this.timestampParam=h.timestampParam,this.timestampRequests=h.timestampRequests,this.readyState="",this.agent=h.agent||!1,this.socket=h.socket,this.enablesXDR=h.enablesXDR,this.pfx=h.pfx,this.key=h.key,this.passphrase=h.passphrase,this.cert=h.cert,this.ca=h.ca,this.ciphers=h.ciphers,this.rejectUnauthorized=h.rejectUnauthorized}var s=a("engine.io-parser"),o=a("component-emitter");t.exports=e,o(e.prototype),e.timestamps=0,e.prototype.onError=function(h,f){var l=new Error(h);return l.type="TransportError",l.description=f,this.emit("error",l),this},e.prototype.open=function(){return(this.readyState=="closed"||this.readyState=="")&&(this.readyState="opening",this.doOpen()),this},e.prototype.close=function(){return(this.readyState=="opening"||this.readyState=="open")&&(this.doClose(),this.onClose()),this},e.prototype.send=function(h){if(this.readyState!="open")throw new Error("Transport not open");this.write(h)},e.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},e.prototype.onData=function(h){var f=s.decodePacket(h,this.socket.binaryType);this.onPacket(f)},e.prototype.onPacket=function(h){this.emit("packet",h)},e.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},{"component-emitter":9,"engine.io-parser":25}],15:[function(a,t,e){(function(s){function o(i){var u,c=!1,r=!1,n=i.jsonp!==!1;if(s.location){var p=location.protocol=="https:",g=location.port;g||(g=p?443:80),c=i.hostname!=location.hostname||g!=i.port,r=i.secure!=p}if(i.xdomain=c,i.xscheme=r,u=new h(i),"open"in u&&!i.forceJSONP)return new f(i);if(!n)throw new Error("JSONP disabled");return new l(i)}var h=a("xmlhttprequest"),f=a("./polling-xhr"),l=a("./polling-jsonp"),d=a("./websocket");e.polling=o,e.websocket=d}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling-jsonp":16,"./polling-xhr":17,"./websocket":19,xmlhttprequest:20}],16:[function(a,t){(function(e){function s(){}function o(u){h.call(this,u),this.query=this.query||{},l||(e.___eio||(e.___eio=[]),l=e.___eio),this.index=l.length;var c=this;l.push(function(r){c.onData(r)}),this.query.j=this.index,e.document&&e.addEventListener&&e.addEventListener("beforeunload",function(){c.script&&(c.script.onerror=s)},!1)}var h=a("./polling"),f=a("component-inherit");t.exports=o;var l,d=/\n/g,i=/\\n/g;f(o,h),o.prototype.supportsBinary=!1,o.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),h.prototype.doClose.call(this)},o.prototype.doPoll=function(){var u=this,c=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),c.async=!0,c.src=this.uri(),c.onerror=function(p){u.onError("jsonp poll error",p)};var r=document.getElementsByTagName("script")[0];r.parentNode.insertBefore(c,r),this.script=c;var n=typeof navigator<"u"&&/gecko/i.test(navigator.userAgent);n&&setTimeout(function(){var p=document.createElement("iframe");document.body.appendChild(p),document.body.removeChild(p)},100)},o.prototype.doWrite=function(u,c){function r(){n(),c()}function n(){if(p.iframe)try{p.form.removeChild(p.iframe)}catch(M){p.onError("jsonp polling iframe removal error",M)}try{var U='<iframe src="javascript:0" name="'+p.iframeId+'">';g=document.createElement(U)}catch{g=document.createElement("iframe"),g.name=p.iframeId,g.src="javascript:0"}g.id=p.iframeId,p.form.appendChild(g),p.iframe=g}var p=this;if(!this.form){var g,y=document.createElement("form"),T=document.createElement("textarea"),P=this.iframeId="eio_iframe_"+this.index;y.className="socketio",y.style.position="absolute",y.style.top="-1000px",y.style.left="-1000px",y.target=P,y.method="POST",y.setAttribute("accept-charset","utf-8"),T.name="d",y.appendChild(T),document.body.appendChild(y),this.form=y,this.area=T}this.form.action=this.uri(),n(),u=u.replace(i,`\\
7
+ `),this.area.value=u.replace(d,"\\n");try{this.form.submit()}catch{}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){p.iframe.readyState=="complete"&&r()}:this.iframe.onload=r}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling":18,"component-inherit":21}],17:[function(a,t){(function(e){function s(){}function o(r){if(d.call(this,r),e.location){var n=location.protocol=="https:",p=location.port;p||(p=n?443:80),this.xd=r.hostname!=e.location.hostname||p!=r.port,this.xs=r.secure!=n}}function h(r){this.method=r.method||"GET",this.uri=r.uri,this.xd=!!r.xd,this.xs=!!r.xs,this.async=r.async!==!1,this.data=r.data!=null?r.data:null,this.agent=r.agent,this.isBinary=r.isBinary,this.supportsBinary=r.supportsBinary,this.enablesXDR=r.enablesXDR,this.pfx=r.pfx,this.key=r.key,this.passphrase=r.passphrase,this.cert=r.cert,this.ca=r.ca,this.ciphers=r.ciphers,this.rejectUnauthorized=r.rejectUnauthorized,this.create()}function f(){for(var r in h.requests)h.requests.hasOwnProperty(r)&&h.requests[r].abort()}var l=a("xmlhttprequest"),d=a("./polling"),i=a("component-emitter"),u=a("component-inherit"),c=a("debug")("engine.io-client:polling-xhr");t.exports=o,t.exports.Request=h,u(o,d),o.prototype.supportsBinary=!0,o.prototype.request=function(r){return r=r||{},r.uri=this.uri(),r.xd=this.xd,r.xs=this.xs,r.agent=this.agent||!1,r.supportsBinary=this.supportsBinary,r.enablesXDR=this.enablesXDR,r.pfx=this.pfx,r.key=this.key,r.passphrase=this.passphrase,r.cert=this.cert,r.ca=this.ca,r.ciphers=this.ciphers,r.rejectUnauthorized=this.rejectUnauthorized,new h(r)},o.prototype.doWrite=function(r,n){var p=typeof r!="string"&&r!==void 0,g=this.request({method:"POST",data:r,isBinary:p}),y=this;g.on("success",n),g.on("error",function(T){y.onError("xhr post error",T)}),this.sendXhr=g},o.prototype.doPoll=function(){c("xhr poll");var r=this.request(),n=this;r.on("data",function(p){n.onData(p)}),r.on("error",function(p){n.onError("xhr poll error",p)}),this.pollXhr=r},i(h.prototype),h.prototype.create=function(){var r={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};r.pfx=this.pfx,r.key=this.key,r.passphrase=this.passphrase,r.cert=this.cert,r.ca=this.ca,r.ciphers=this.ciphers,r.rejectUnauthorized=this.rejectUnauthorized;var n=this.xhr=new l(r),p=this;try{if(c("xhr open %s: %s",this.method,this.uri),n.open(this.method,this.uri,this.async),this.supportsBinary&&(n.responseType="arraybuffer"),this.method=="POST")try{this.isBinary?n.setRequestHeader("Content-type","application/octet-stream"):n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}"withCredentials"in n&&(n.withCredentials=!0),this.hasXDR()?(n.onload=function(){p.onLoad()},n.onerror=function(){p.onError(n.responseText)}):n.onreadystatechange=function(){n.readyState==4&&(n.status==200||n.status==1223?p.onLoad():setTimeout(function(){p.onError(n.status)},0))},c("xhr data %s",this.data),n.send(this.data)}catch(g){return void setTimeout(function(){p.onError(g)},0)}e.document&&(this.index=h.requestsCount++,h.requests[this.index]=this)},h.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},h.prototype.onData=function(r){this.emit("data",r),this.onSuccess()},h.prototype.onError=function(r){this.emit("error",r),this.cleanup(!0)},h.prototype.cleanup=function(r){if(typeof this.xhr<"u"&&this.xhr!==null){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=s:this.xhr.onreadystatechange=s,r)try{this.xhr.abort()}catch{}e.document&&delete h.requests[this.index],this.xhr=null}},h.prototype.onLoad=function(){var r;try{var n;try{n=this.xhr.getResponseHeader("Content-Type").split(";")[0]}catch{}r=n==="application/octet-stream"?this.xhr.response:this.supportsBinary?"ok":this.xhr.responseText}catch(p){this.onError(p)}r!=null&&this.onData(r)},h.prototype.hasXDR=function(){return typeof e.XDomainRequest<"u"&&!this.xs&&this.enablesXDR},h.prototype.abort=function(){this.cleanup()},e.document&&(h.requestsCount=0,h.requests={},e.attachEvent?e.attachEvent("onunload",f):e.addEventListener&&e.addEventListener("beforeunload",f,!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(a,t){function e(i){var u=i&&i.forceBase64;(!d||u)&&(this.supportsBinary=!1),s.call(this,i)}var s=a("../transport"),o=a("parseqs"),h=a("engine.io-parser"),f=a("component-inherit"),l=a("debug")("engine.io-client:polling");t.exports=e;var d=function(){var i=a("xmlhttprequest"),u=new i({xdomain:!1});return u.responseType!=null}();f(e,s),e.prototype.name="polling",e.prototype.doOpen=function(){this.poll()},e.prototype.pause=function(i){function u(){l("paused"),c.readyState="paused",i()}var c=this;if(this.readyState="pausing",this.polling||!this.writable){var r=0;this.polling&&(l("we are currently polling - waiting to pause"),r++,this.once("pollComplete",function(){l("pre-pause polling complete"),--r||u()})),this.writable||(l("we are currently writing - waiting to pause"),r++,this.once("drain",function(){l("pre-pause writing complete"),--r||u()}))}else u()},e.prototype.poll=function(){l("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},e.prototype.onData=function(i){var u=this;l("polling got data %s",i);var c=function(r){return u.readyState=="opening"&&u.onOpen(),r.type=="close"?(u.onClose(),!1):void u.onPacket(r)};h.decodePayload(i,this.socket.binaryType,c),this.readyState!="closed"&&(this.polling=!1,this.emit("pollComplete"),this.readyState=="open"?this.poll():l('ignoring poll - transport state "%s"',this.readyState))},e.prototype.doClose=function(){function i(){l("writing close packet"),u.write([{type:"close"}])}var u=this;this.readyState=="open"?(l("transport open - closing"),i()):(l("transport not open - deferring close"),this.once("open",i))},e.prototype.write=function(i){var c=this;this.writable=!1;var u=function(){c.writable=!0,c.emit("drain")},c=this;h.encodePayload(i,this.supportsBinary,function(r){c.doWrite(r,u)})},e.prototype.uri=function(){var i=this.query||{},u=this.secure?"https":"http",c="";return this.timestampRequests!==!1&&(i[this.timestampParam]=+new Date+"-"+s.timestamps++),this.supportsBinary||i.sid||(i.b64=1),i=o.encode(i),this.port&&(u=="https"&&this.port!=443||u=="http"&&this.port!=80)&&(c=":"+this.port),i.length&&(i="?"+i),u+"://"+this.hostname+c+this.path+i}},{"../transport":14,"component-inherit":21,debug:22,"engine.io-parser":25,parseqs:33,xmlhttprequest:20}],19:[function(a,t){function e(i){var u=i&&i.forceBase64;u&&(this.supportsBinary=!1),s.call(this,i)}var s=a("../transport"),o=a("engine.io-parser"),h=a("parseqs"),f=a("component-inherit"),l=a("debug")("engine.io-client:websocket"),d=a("ws");t.exports=e,f(e,s),e.prototype.name="websocket",e.prototype.supportsBinary=!0,e.prototype.doOpen=function(){if(this.check()){var i=this.uri(),u=void 0,c={agent:this.agent};c.pfx=this.pfx,c.key=this.key,c.passphrase=this.passphrase,c.cert=this.cert,c.ca=this.ca,c.ciphers=this.ciphers,c.rejectUnauthorized=this.rejectUnauthorized,this.ws=new d(i,u,c),this.ws.binaryType===void 0&&(this.supportsBinary=!1),this.ws.binaryType="arraybuffer",this.addEventListeners()}},e.prototype.addEventListeners=function(){var i=this;this.ws.onopen=function(){i.onOpen()},this.ws.onclose=function(){i.onClose()},this.ws.onmessage=function(u){i.onData(u.data)},this.ws.onerror=function(u){i.onError("websocket error",u)}},typeof navigator<"u"&&/iPad|iPhone|iPod/i.test(navigator.userAgent)&&(e.prototype.onData=function(i){var u=this;setTimeout(function(){s.prototype.onData.call(u,i)},0)}),e.prototype.write=function(i){function u(){c.writable=!0,c.emit("drain")}var c=this;this.writable=!1;for(var r=0,n=i.length;n>r;r++)o.encodePacket(i[r],this.supportsBinary,function(p){try{c.ws.send(p)}catch{l("websocket closed before onclose event")}});setTimeout(u,0)},e.prototype.onClose=function(){s.prototype.onClose.call(this)},e.prototype.doClose=function(){typeof this.ws<"u"&&this.ws.close()},e.prototype.uri=function(){var i=this.query||{},u=this.secure?"wss":"ws",c="";return this.port&&(u=="wss"&&this.port!=443||u=="ws"&&this.port!=80)&&(c=":"+this.port),this.timestampRequests&&(i[this.timestampParam]=+new Date),this.supportsBinary||(i.b64=1),i=h.encode(i),i.length&&(i="?"+i),u+"://"+this.hostname+c+this.path+i},e.prototype.check=function(){return!(!d||"__initialize"in d&&this.name===e.prototype.name)}},{"../transport":14,"component-inherit":21,debug:22,"engine.io-parser":25,parseqs:33,ws:35}],20:[function(a,t){var e=a("has-cors");t.exports=function(s){var o=s.xdomain,h=s.xscheme,f=s.enablesXDR;try{if(typeof XMLHttpRequest<"u"&&(!o||e))return new XMLHttpRequest}catch{}try{if(typeof XDomainRequest<"u"&&!h&&f)return new XDomainRequest}catch{}if(!o)try{return new ActiveXObject("Microsoft.XMLHTTP")}catch{}}},{"has-cors":38}],21:[function(a,t){t.exports=function(e,s){var o=function(){};o.prototype=s.prototype,e.prototype=new o,e.prototype.constructor=e}},{}],22:[function(a,t,e){function s(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function o(){var d=arguments,i=this.useColors;if(d[0]=(i?"%c":"")+this.namespace+(i?" %c":" ")+d[0]+(i?"%c ":" ")+"+"+e.humanize(this.diff),!i)return d;var u="color: "+this.color;d=[d[0],u,"color: inherit"].concat(Array.prototype.slice.call(d,1));var c=0,r=0;return d[0].replace(/%[a-z%]/g,function(n){n!=="%%"&&(c++,n==="%c"&&(r=c))}),d.splice(r,0,u),d}function h(){return typeof console=="object"&&typeof console.log=="function"&&Function.prototype.apply.call(console.log,console,arguments)}function f(d){try{d==null?localStorage.removeItem("debug"):localStorage.debug=d}catch{}}function l(){var d;try{d=localStorage.debug}catch{}return d}e=t.exports=a("./debug"),e.log=h,e.formatArgs=o,e.save=f,e.load=l,e.useColors=s,e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(d){return JSON.stringify(d)},e.enable(l())},{"./debug":23}],23:[function(a,t,e){function s(){return e.colors[u++%e.colors.length]}function o(c){function r(){}function n(){var g=n,y=+new Date,T=y-(i||y);g.diff=T,g.prev=i,g.curr=y,i=y,g.useColors==null&&(g.useColors=e.useColors()),g.color==null&&g.useColors&&(g.color=s());var P=Array.prototype.slice.call(arguments);P[0]=e.coerce(P[0]),typeof P[0]!="string"&&(P=["%o"].concat(P));var U=0;P[0]=P[0].replace(/%([a-z%])/g,function(_,C){if(_==="%%")return _;U++;var b=e.formatters[C];if(typeof b=="function"){var A=P[U];_=b.call(g,A),P.splice(U,1),U--}return _}),typeof e.formatArgs=="function"&&(P=e.formatArgs.apply(g,P));var M=n.log||e.log||console.log.bind(console);M.apply(g,P)}r.enabled=!1,n.enabled=!0;var p=e.enabled(c)?n:r;return p.namespace=c,p}function h(c){e.save(c);for(var r=(c||"").split(/[\s,]+/),n=r.length,p=0;n>p;p++)r[p]&&(c=r[p].replace(/\*/g,".*?"),c[0]==="-"?e.skips.push(new RegExp("^"+c.substr(1)+"$")):e.names.push(new RegExp("^"+c+"$")))}function f(){e.enable("")}function l(c){var r,n;for(r=0,n=e.skips.length;n>r;r++)if(e.skips[r].test(c))return!1;for(r=0,n=e.names.length;n>r;r++)if(e.names[r].test(c))return!0;return!1}function d(c){return c instanceof Error?c.stack||c.message:c}e=t.exports=o,e.coerce=d,e.disable=f,e.enable=h,e.enabled=l,e.humanize=a("ms"),e.names=[],e.skips=[],e.formatters={};var i,u=0},{ms:24}],24:[function(a,t){function e(c){var r=/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(c);if(r){var n=parseFloat(r[1]),p=(r[2]||"ms").toLowerCase();switch(p){case"years":case"year":case"y":return n*u;case"days":case"day":case"d":return n*i;case"hours":case"hour":case"h":return n*d;case"minutes":case"minute":case"m":return n*l;case"seconds":case"second":case"s":return n*f;case"ms":return n}}}function s(c){return c>=i?Math.round(c/i)+"d":c>=d?Math.round(c/d)+"h":c>=l?Math.round(c/l)+"m":c>=f?Math.round(c/f)+"s":c+"ms"}function o(c){return h(c,i,"day")||h(c,d,"hour")||h(c,l,"minute")||h(c,f,"second")||c+" ms"}function h(c,r,n){return r>c?void 0:1.5*r>c?Math.floor(c/r)+" "+n:Math.ceil(c/r)+" "+n+"s"}var f=1e3,l=60*f,d=60*l,i=24*d,u=365.25*i;t.exports=function(c,r){return r=r||{},typeof c=="string"?e(c):r.long?o(c):s(c)}},{}],25:[function(a,t,e){(function(s){function o(C,b){var A="b"+e.packets[C.type]+C.data.data;return b(A)}function h(C,b,A){if(!b)return e.encodeBase64Packet(C,A);var v=C.data,m=new Uint8Array(v),L=new Uint8Array(1+v.byteLength);L[0]=P[C.type];for(var I=0;I<m.length;I++)L[I+1]=m[I];return A(L.buffer)}function f(C,b,A){if(!b)return e.encodeBase64Packet(C,A);var v=new FileReader;return v.onload=function(){C.data=v.result,e.encodePacket(C,b,!0,A)},v.readAsArrayBuffer(C.data)}function l(C,b,A){if(!b)return e.encodeBase64Packet(C,A);if(T)return f(C,b,A);var v=new Uint8Array(1);v[0]=P[C.type];var m=new _([v.buffer,C.data]);return A(m)}function d(C,b,A){for(var v=new Array(C.length),m=n(C.length,A),L=function(R,S,K){b(S,function($,z){v[R]=z,K($,v)})},I=0;I<C.length;I++)L(I,C[I],m)}var i=a("./keys"),u=a("has-binary"),c=a("arraybuffer.slice"),r=a("base64-arraybuffer"),n=a("after"),p=a("utf8"),g=navigator.userAgent.match(/Android/i),y=/PhantomJS/i.test(navigator.userAgent),T=g||y;e.protocol=3;var P=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},U=i(P),M={type:"error",data:"parser error"},_=a("blob");e.encodePacket=function(C,b,A,v){typeof b=="function"&&(v=b,b=!1),typeof A=="function"&&(v=A,A=null);var m=C.data===void 0?void 0:C.data.buffer||C.data;if(s.ArrayBuffer&&m instanceof ArrayBuffer)return h(C,b,v);if(_&&m instanceof s.Blob)return l(C,b,v);if(m&&m.base64)return o(C,v);var L=P[C.type];return C.data!==void 0&&(L+=A?p.encode(String(C.data)):String(C.data)),v(""+L)},e.encodeBase64Packet=function(C,b){var A="b"+e.packets[C.type];if(_&&C.data instanceof _){var v=new FileReader;return v.onload=function(){var S=v.result.split(",")[1];b(A+S)},v.readAsDataURL(C.data)}var m;try{m=String.fromCharCode.apply(null,new Uint8Array(C.data))}catch{for(var L=new Uint8Array(C.data),I=new Array(L.length),R=0;R<L.length;R++)I[R]=L[R];m=String.fromCharCode.apply(null,I)}return A+=s.btoa(m),b(A)},e.decodePacket=function(C,b,A){if(typeof C=="string"||C===void 0){if(C.charAt(0)=="b")return e.decodeBase64Packet(C.substr(1),b);if(A)try{C=p.decode(C)}catch{return M}var m=C.charAt(0);return Number(m)==m&&U[m]?C.length>1?{type:U[m],data:C.substring(1)}:{type:U[m]}:M}var v=new Uint8Array(C),m=v[0],L=c(C,1);return _&&b==="blob"&&(L=new _([L])),{type:U[m],data:L}},e.decodeBase64Packet=function(C,b){var A=U[C.charAt(0)];if(!s.ArrayBuffer)return{type:A,data:{base64:!0,data:C.substr(1)}};var v=r.decode(C.substr(1));return b==="blob"&&_&&(v=new _([v])),{type:A,data:v}},e.encodePayload=function(C,b,A){function v(I){return I.length+":"+I}function m(I,R){e.encodePacket(I,L?b:!1,!0,function(S){R(null,v(S))})}typeof b=="function"&&(A=b,b=null);var L=u(C);return b&&L?_&&!T?e.encodePayloadAsBlob(C,A):e.encodePayloadAsArrayBuffer(C,A):C.length?void d(C,m,function(I,R){return A(R.join(""))}):A("0:")},e.decodePayload=function(C,b,A){if(typeof C!="string")return e.decodePayloadAsBinary(C,b,A);typeof b=="function"&&(A=b,b=null);var v;if(C=="")return A(M,0,1);for(var m,L,I="",R=0,S=C.length;S>R;R++){var K=C.charAt(R);if(K!=":")I+=K;else{if(I==""||I!=(m=Number(I))||(L=C.substr(R+1,m),I!=L.length))return A(M,0,1);if(L.length){if(v=e.decodePacket(L,b,!0),M.type==v.type&&M.data==v.data)return A(M,0,1);var $=A(v,R+m,S);if($===!1)return}R+=m,I=""}}return I!=""?A(M,0,1):void 0},e.encodePayloadAsArrayBuffer=function(C,b){function A(v,m){e.encodePacket(v,!0,!0,function(L){return m(null,L)})}return C.length?void d(C,A,function(v,m){var L=m.reduce(function(S,K){var $;return $=typeof K=="string"?K.length:K.byteLength,S+$.toString().length+$+2},0),I=new Uint8Array(L),R=0;return m.forEach(function(S){var K=typeof S=="string",$=S;if(K){for(var z=new Uint8Array(S.length),X=0;X<S.length;X++)z[X]=S.charCodeAt(X);$=z.buffer}I[R++]=K?0:1;for(var J=$.byteLength.toString(),X=0;X<J.length;X++)I[R++]=parseInt(J[X]);I[R++]=255;for(var z=new Uint8Array($),X=0;X<z.length;X++)I[R++]=z[X]}),b(I.buffer)}):b(new ArrayBuffer(0))},e.encodePayloadAsBlob=function(C,b){function A(v,m){e.encodePacket(v,!0,!0,function(L){var I=new Uint8Array(1);if(I[0]=1,typeof L=="string"){for(var R=new Uint8Array(L.length),S=0;S<L.length;S++)R[S]=L.charCodeAt(S);L=R.buffer,I[0]=0}for(var K=L instanceof ArrayBuffer?L.byteLength:L.size,$=K.toString(),z=new Uint8Array($.length+1),S=0;S<$.length;S++)z[S]=parseInt($[S]);if(z[$.length]=255,_){var X=new _([I.buffer,z.buffer,L]);m(null,X)}})}d(C,A,function(v,m){return b(new _(m))})},e.decodePayloadAsBinary=function(C,b,A){typeof b=="function"&&(A=b,b=null);for(var v=C,m=[],L=!1;v.byteLength>0;){for(var I=new Uint8Array(v),R=I[0]===0,S="",K=1;I[K]!=255;K++){if(S.length>310){L=!0;break}S+=I[K]}if(L)return A(M,0,1);v=c(v,2+S.length),S=parseInt(S);var $=c(v,0,S);if(R)try{$=String.fromCharCode.apply(null,new Uint8Array($))}catch{var z=new Uint8Array($);$="";for(var K=0;K<z.length;K++)$+=String.fromCharCode(z[K])}m.push($),v=c(v,S)}var X=m.length;m.forEach(function(J,ne){A(e.decodePacket(J,b,!0),ne,X)})}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./keys":26,after:27,"arraybuffer.slice":28,"base64-arraybuffer":29,blob:30,"has-binary":36,utf8:31}],26:[function(a,t){t.exports=Object.keys||function(e){var s=[],o=Object.prototype.hasOwnProperty;for(var h in e)o.call(e,h)&&s.push(h);return s}},{}],27:[function(a,t){function e(o,h,f){function l(i,u){if(l.count<=0)throw new Error("after called too many times");--l.count,i?(d=!0,h(i),h=f):l.count!==0||d||h(null,u)}var d=!1;return f=f||s,l.count=o,o===0?h():l}function s(){}t.exports=e},{}],28:[function(a,t){t.exports=function(e,s,o){var h=e.byteLength;if(s=s||0,o=o||h,e.slice)return e.slice(s,o);if(0>s&&(s+=h),0>o&&(o+=h),o>h&&(o=h),s>=h||s>=o||h===0)return new ArrayBuffer(0);for(var f=new Uint8Array(e),l=new Uint8Array(o-s),d=s,i=0;o>d;d++,i++)l[i]=f[d];return l.buffer}},{}],29:[function(a,t,e){(function(s){e.encode=function(o){var h,f=new Uint8Array(o),l=f.length,d="";for(h=0;l>h;h+=3)d+=s[f[h]>>2],d+=s[(3&f[h])<<4|f[h+1]>>4],d+=s[(15&f[h+1])<<2|f[h+2]>>6],d+=s[63&f[h+2]];return l%3===2?d=d.substring(0,d.length-1)+"=":l%3===1&&(d=d.substring(0,d.length-2)+"=="),d},e.decode=function(o){var h,f,l,d,i,u=.75*o.length,c=o.length,r=0;o[o.length-1]==="="&&(u--,o[o.length-2]==="="&&u--);var n=new ArrayBuffer(u),p=new Uint8Array(n);for(h=0;c>h;h+=4)f=s.indexOf(o[h]),l=s.indexOf(o[h+1]),d=s.indexOf(o[h+2]),i=s.indexOf(o[h+3]),p[r++]=f<<2|l>>4,p[r++]=(15&l)<<4|d>>2,p[r++]=(3&d)<<6|63&i;return n}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],30:[function(a,t){(function(e){function s(u){for(var c=0;c<u.length;c++){var r=u[c];if(r.buffer instanceof ArrayBuffer){var n=r.buffer;if(r.byteLength!==n.byteLength){var p=new Uint8Array(r.byteLength);p.set(new Uint8Array(n,r.byteOffset,r.byteLength)),n=p.buffer}u[c]=n}}}function o(u,c){c=c||{};var r=new f;s(u);for(var n=0;n<u.length;n++)r.append(u[n]);return c.type?r.getBlob(c.type):r.getBlob()}function h(u,c){return s(u),new Blob(u,c||{})}var f=e.BlobBuilder||e.WebKitBlobBuilder||e.MSBlobBuilder||e.MozBlobBuilder,l=function(){try{var u=new Blob(["hi"]);return u.size===2}catch{return!1}}(),d=l&&function(){try{var u=new Blob([new Uint8Array([1,2])]);return u.size===2}catch{return!1}}(),i=f&&f.prototype.append&&f.prototype.getBlob;t.exports=function(){return l?d?e.Blob:h:i?o:void 0}()}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],31:[function(a,t,e){(function(s){(function(o){function h(v){for(var m,L,I=[],R=0,S=v.length;S>R;)m=v.charCodeAt(R++),m>=55296&&56319>=m&&S>R?(L=v.charCodeAt(R++),(64512&L)==56320?I.push(((1023&m)<<10)+(1023&L)+65536):(I.push(m),R--)):I.push(m);return I}function f(v){for(var m,L=v.length,I=-1,R="";++I<L;)m=v[I],m>65535&&(m-=65536,R+=M(m>>>10&1023|55296),m=56320|1023&m),R+=M(m);return R}function l(v){if(v>=55296&&57343>=v)throw Error("Lone surrogate U+"+v.toString(16).toUpperCase()+" is not a scalar value")}function d(v,m){return M(v>>m&63|128)}function i(v){if(!(4294967168&v))return M(v);var m="";return 4294965248&v?4294901760&v?!(4292870144&v)&&(m=M(v>>18&7|240),m+=d(v,12),m+=d(v,6)):(l(v),m=M(v>>12&15|224),m+=d(v,6)):m=M(v>>6&31|192),m+=M(63&v|128)}function u(v){for(var m,L=h(v),I=L.length,R=-1,S="";++R<I;)m=L[R],S+=i(m);return S}function c(){if(U>=P)throw Error("Invalid byte index");var v=255&T[U];if(U++,(192&v)==128)return 63&v;throw Error("Invalid continuation byte")}function r(){var v,m,L,I,R;if(U>P)throw Error("Invalid byte index");if(U==P)return!1;if(v=255&T[U],U++,(128&v)==0)return v;if((224&v)==192){var m=c();if(R=(31&v)<<6|m,R>=128)return R;throw Error("Invalid continuation byte")}if((240&v)==224){if(m=c(),L=c(),R=(15&v)<<12|m<<6|L,R>=2048)return l(R),R;throw Error("Invalid continuation byte")}if((248&v)==240&&(m=c(),L=c(),I=c(),R=(15&v)<<18|m<<12|L<<6|I,R>=65536&&1114111>=R))return R;throw Error("Invalid UTF-8 detected")}function n(v){T=h(v),P=T.length,U=0;for(var m,L=[];(m=r())!==!1;)L.push(m);return f(L)}var p=typeof e=="object"&&e,g=typeof t=="object"&&t&&t.exports==p&&t,y=typeof s=="object"&&s;(y.global===y||y.window===y)&&(o=y);var T,P,U,M=String.fromCharCode,_={version:"2.0.0",encode:u,decode:n};if(p&&!p.nodeType)if(g)g.exports=_;else{var C={},b=C.hasOwnProperty;for(var A in _)b.call(_,A)&&(p[A]=_[A])}else o.utf8=_})(this)}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],32:[function(a,t){(function(e){var s=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,h=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,f=/(?:^|:|,)(?:\s*\[)+/g,l=/^\s+/,d=/\s+$/;t.exports=function(i){return typeof i=="string"&&i?(i=i.replace(l,"").replace(d,""),e.JSON&&JSON.parse?JSON.parse(i):s.test(i.replace(o,"@").replace(h,"]").replace(f,""))?new Function("return "+i)():void 0):null}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],33:[function(a,t,e){e.encode=function(s){var o="";for(var h in s)s.hasOwnProperty(h)&&(o.length&&(o+="&"),o+=encodeURIComponent(h)+"="+encodeURIComponent(s[h]));return o},e.decode=function(s){for(var o={},h=s.split("&"),f=0,l=h.length;l>f;f++){var d=h[f].split("=");o[decodeURIComponent(d[0])]=decodeURIComponent(d[1])}return o}},{}],34:[function(a,t){var e=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,s=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(o){var h=o,f=o.indexOf("["),l=o.indexOf("]");f!=-1&&l!=-1&&(o=o.substring(0,f)+o.substring(f,l).replace(/:/g,";")+o.substring(l,o.length));for(var d=e.exec(o||""),i={},u=14;u--;)i[s[u]]=d[u]||"";return f!=-1&&l!=-1&&(i.source=h,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i}},{}],35:[function(a,t){function e(h,f){return f?new o(h,f):new o(h)}var s=function(){return self}(),o=s.WebSocket||s.MozWebSocket;t.exports=o?e:null,o&&(e.prototype=o.prototype)},{}],36:[function(a,t){(function(e){function s(h){function f(l){if(!l)return!1;if(e.Buffer&&e.Buffer.isBuffer(l)||e.ArrayBuffer&&l instanceof ArrayBuffer||e.Blob&&l instanceof Blob||e.File&&l instanceof File)return!0;if(o(l)){for(var d=0;d<l.length;d++)if(f(l[d]))return!0}else if(l&&typeof l=="object"){l.toJSON&&(l=l.toJSON());for(var i in l)if(Object.prototype.hasOwnProperty.call(l,i)&&f(l[i]))return!0}return!1}return f(h)}var o=a("isarray");t.exports=s}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{isarray:37}],37:[function(a,t){t.exports=Array.isArray||function(e){return Object.prototype.toString.call(e)=="[object Array]"}},{}],38:[function(a,t){var e=a("global");try{t.exports="XMLHttpRequest"in e&&"withCredentials"in new e.XMLHttpRequest}catch{t.exports=!1}},{global:39}],39:[function(a,t){t.exports=function(){return this}()},{}],40:[function(a,t){var e=[].indexOf;t.exports=function(s,o){if(e)return s.indexOf(o);for(var h=0;h<s.length;++h)if(s[h]===o)return h;return-1}},{}],41:[function(a,t,e){var s=Object.prototype.hasOwnProperty;e.keys=Object.keys||function(o){var h=[];for(var f in o)s.call(o,f)&&h.push(f);return h},e.values=function(o){var h=[];for(var f in o)s.call(o,f)&&h.push(o[f]);return h},e.merge=function(o,h){for(var f in h)s.call(h,f)&&(o[f]=h[f]);return o},e.length=function(o){return e.keys(o).length},e.isEmpty=function(o){return e.length(o)==0}},{}],42:[function(a,t){var e=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,s=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];t.exports=function(o){for(var h=e.exec(o||""),f={},l=14;l--;)f[s[l]]=h[l]||"";return f}},{}],43:[function(a,t,e){(function(s){var o=a("isarray"),h=a("./is-buffer");e.deconstructPacket=function(f){function l(c){if(!c)return c;if(h(c)){var r={_placeholder:!0,num:d.length};return d.push(c),r}if(o(c)){for(var n=new Array(c.length),p=0;p<c.length;p++)n[p]=l(c[p]);return n}if(typeof c=="object"&&!(c instanceof Date)){var n={};for(var g in c)n[g]=l(c[g]);return n}return c}var d=[],i=f.data,u=f;return u.data=l(i),u.attachments=d.length,{packet:u,buffers:d}},e.reconstructPacket=function(f,l){function d(i){if(i&&i._placeholder){var u=l[i.num];return u}if(o(i)){for(var c=0;c<i.length;c++)i[c]=d(i[c]);return i}if(i&&typeof i=="object"){for(var r in i)i[r]=d(i[r]);return i}return i}return f.data=d(f.data),f.attachments=void 0,f},e.removeBlobs=function(f,l){function d(c,r,n){if(!c)return c;if(s.Blob&&c instanceof Blob||s.File&&c instanceof File){i++;var p=new FileReader;p.onload=function(){n?n[r]=this.result:u=this.result,--i||l(u)},p.readAsArrayBuffer(c)}else if(o(c))for(var g=0;g<c.length;g++)d(c[g],g,c);else if(c&&typeof c=="object"&&!h(c))for(var y in c)d(c[y],y,c)}var i=0,u=f;d(u),i||l(u)}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./is-buffer":45,isarray:46}],44:[function(a,t,e){function s(){}function o(g){var y="",T=!1;return y+=g.type,(e.BINARY_EVENT==g.type||e.BINARY_ACK==g.type)&&(y+=g.attachments,y+="-"),g.nsp&&g.nsp!="/"&&(T=!0,y+=g.nsp),g.id!=null&&(T&&(y+=",",T=!1),y+=g.id),g.data!=null&&(T&&(y+=","),y+=c.stringify(g.data)),u("encoded %j as %s",g,y),y}function h(g,y){function T(P){var U=n.deconstructPacket(P),M=o(U.packet),_=U.buffers;_.unshift(M),y(_)}n.removeBlobs(g,T)}function f(){this.reconstructor=null}function l(g){var y={},T=0;if(y.type=Number(g.charAt(0)),e.types[y.type]==null)return i();if(e.BINARY_EVENT==y.type||e.BINARY_ACK==y.type){for(var P="";g.charAt(++T)!="-"&&(P+=g.charAt(T),T!=g.length););if(P!=Number(P)||g.charAt(T)!="-")throw new Error("Illegal attachments");y.attachments=Number(P)}if(g.charAt(T+1)=="/")for(y.nsp="";++T;){var U=g.charAt(T);if(U==","||(y.nsp+=U,T==g.length))break}else y.nsp="/";var M=g.charAt(T+1);if(M!==""&&Number(M)==M){for(y.id="";++T;){var U=g.charAt(T);if(U==null||Number(U)!=U){--T;break}if(y.id+=g.charAt(T),T==g.length)break}y.id=Number(y.id)}if(g.charAt(++T))try{y.data=c.parse(g.substr(T))}catch{return i()}return u("decoded %s as %j",g,y),y}function d(g){this.reconPack=g,this.buffers=[]}function i(){return{type:e.ERROR,data:"parser error"}}var u=a("debug")("socket.io-parser"),c=a("json3"),r=(a("isarray"),a("component-emitter")),n=a("./binary"),p=a("./is-buffer");e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","BINARY_EVENT","ACK","BINARY_ACK","ERROR"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=s,e.Decoder=f,s.prototype.encode=function(g,y){if(u("encoding packet %j",g),e.BINARY_EVENT==g.type||e.BINARY_ACK==g.type)h(g,y);else{var T=o(g);y([T])}},r(f.prototype),f.prototype.add=function(g){var y;if(typeof g=="string")y=l(g),e.BINARY_EVENT==y.type||e.BINARY_ACK==y.type?(this.reconstructor=new d(y),this.reconstructor.reconPack.attachments===0&&this.emit("decoded",y)):this.emit("decoded",y);else{if(!p(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))}},f.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=n.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(a,t){(function(e){function s(o){return e.Buffer&&e.Buffer.isBuffer(o)||e.ArrayBuffer&&o instanceof ArrayBuffer}t.exports=s}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],46:[function(a,t){t.exports=a(37)},{}],47:[function(a,t,e){(function(s){function o(E){if(o[E]!==l)return o[E];var O;if(E=="bug-string-char-index")O=!1;else if(E=="json")O=o("json-stringify")&&o("json-parse");else{var w,D='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if(E=="json-stringify"){var k=u.stringify,x=typeof k=="function"&&c;if(x){(w=function(){return 1}).toJSON=w;try{x=k(0)==="0"&&k(new Number)==="0"&&k(new String)=='""'&&k(d)===l&&k(l)===l&&k()===l&&k(w)==="1"&&k([w])=="[1]"&&k([l])=="[null]"&&k(null)=="null"&&k([l,d,null])=="[null,null,null]"&&k({a:[w,!0,!1,null,`\0\b
8
+ \f\r `]})==D&&k(null,w)==="1"&&k([1,2],null,1)==`[
9
9
  1,
10
10
  2
11
- ]`&&O(new Date(-864e13))=='"-271821-04-20T00:00:00.000Z"'&&O(new Date(864e13))=='"+275760-09-13T00:00:00.000Z"'&&O(new Date(-621987552e5))=='"-000001-01-01T00:00:00.000Z"'&&O(new Date(-1))=='"1969-12-31T23:59:59.999Z"'}catch{U=!1}}F=U}if(I=="json-parse"){var D=u.parse;if(typeof D=="function")try{if(D("0")===0&&!D(!1)){B=D(P);var _=B.a.length==5&&B.a[0]===1;if(_){try{_=!D('" "')}catch{}if(_)try{_=D("01")!==1}catch{}if(_)try{_=D("1.")!==1}catch{}}}}catch{_=!1}F=_}}return o[I]=!!F}var c,l,p,f={}.toString,i=typeof JSON=="object"&&JSON,u=typeof r=="object"&&r&&!r.nodeType&&r;u&&i?(u.stringify=i.stringify,u.parse=i.parse):u=n.JSON=i||{};var h=new Date(-0xc782b5b800cec);try{h=h.getUTCFullYear()==-109252&&h.getUTCMonth()===0&&h.getUTCDate()===1&&h.getUTCHours()==10&&h.getUTCMinutes()==37&&h.getUTCSeconds()==6&&h.getUTCMilliseconds()==708}catch{}if(!o("json")){var a="[object Function]",s="[object Date]",d="[object Number]",y="[object String]",m="[object Array]",v="[object Boolean]",T=o("bug-string-char-index");if(!h)var R=Math.floor,b=[0,31,59,90,120,151,181,212,243,273,304,334],S=function(I,F){return b[F]+365*(I-1970)+R((I-1969+(F=+(F>1)))/4)-R((I-1901+F)/100)+R((I-1601+F)/400)};(c={}.hasOwnProperty)||(c=function(I){var F,B={};return(B.__proto__=null,B.__proto__={toString:1},B).toString!=f?c=function(P){var O=this.__proto__,U=P in(this.__proto__=null,this);return this.__proto__=O,U}:(F=B.constructor,c=function(P){var O=(this.constructor||F).prototype;return P in this&&!(P in O&&this[P]===O[P])}),B=null,c.call(this,I)});var g={boolean:1,number:1,string:1,undefined:1},w=function(I,F){var B=typeof I[F];return B=="object"?!!I[F]:!g[B]};if(l=function(I,F){var B,P,O,U=0;(B=function(){this.valueOf=0}).prototype.valueOf=0,P=new B;for(O in P)c.call(P,O)&&U++;return B=P=null,U?l=U==2?function(D,_){var q,V={},ne=f.call(D)==a;for(q in D)ne&&q=="prototype"||c.call(V,q)||!(V[q]=1)||!c.call(D,q)||_(q)}:function(D,_){var q,V,ne=f.call(D)==a;for(q in D)ne&&q=="prototype"||!c.call(D,q)||(V=q==="constructor")||_(q);(V||c.call(D,q="constructor"))&&_(q)}:(P=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],l=function(D,_){var q,V,ne=f.call(D)==a,oe=!ne&&typeof D.constructor!="function"&&w(D,"hasOwnProperty")?D.hasOwnProperty:c;for(q in D)ne&&q=="prototype"||!oe.call(D,q)||_(q);for(V=P.length;q=P[--V];oe.call(D,q)&&_(q));}),l(I,F)},!o("json-stringify")){var E={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},C="000000",k=function(I,F){return(C+(F||0)).slice(-I)},N="\\u00",x=function(I){var F,B='"',P=0,O=I.length,U=O>10&&T;for(U&&(F=I.split(""));O>P;P++){var D=I.charCodeAt(P);switch(D){case 8:case 9:case 10:case 12:case 13:case 34:case 92:B+=E[D];break;default:if(32>D){B+=N+k(2,D.toString(16));break}B+=U?F[P]:T?I.charAt(P):I[P]}}return B+'"'},L=function(I,F,B,P,O,U,D){var _,q,V,ne,oe,xe,ct,ht,ut,pt,le,lt,We,Re,ft,dt;try{_=F[I]}catch{}if(typeof _=="object"&&_)if(q=f.call(_),q!=s||c.call(_,"toJSON"))typeof _.toJSON=="function"&&(q!=d&&q!=y&&q!=m||c.call(_,"toJSON"))&&(_=_.toJSON(I));else if(_>-1/0&&1/0>_){if(S){for(oe=R(_/864e5),V=R(oe/365.2425)+1970-1;S(V+1,0)<=oe;V++);for(ne=R((oe-S(V,0))/30.42);S(V,ne+1)<=oe;ne++);oe=1+oe-S(V,ne),xe=(_%864e5+864e5)%864e5,ct=R(xe/36e5)%24,ht=R(xe/6e4)%60,ut=R(xe/1e3)%60,pt=xe%1e3}else V=_.getUTCFullYear(),ne=_.getUTCMonth(),oe=_.getUTCDate(),ct=_.getUTCHours(),ht=_.getUTCMinutes(),ut=_.getUTCSeconds(),pt=_.getUTCMilliseconds();_=(0>=V||V>=1e4?(0>V?"-":"+")+k(6,0>V?-V:V):k(4,V))+"-"+k(2,ne+1)+"-"+k(2,oe)+"T"+k(2,ct)+":"+k(2,ht)+":"+k(2,ut)+"."+k(3,pt)+"Z"}else _=null;if(B&&(_=B.call(F,I,_)),_===null)return"null";if(q=f.call(_),q==v)return""+_;if(q==d)return _>-1/0&&1/0>_?""+_:"null";if(q==y)return x(""+_);if(typeof _=="object"){for(Re=D.length;Re--;)if(D[Re]===_)throw TypeError();if(D.push(_),le=[],ft=U,U+=O,q==m){for(We=0,Re=_.length;Re>We;We++)lt=L(We,_,B,P,O,U,D),le.push(lt===p?"null":lt);dt=le.length?O?`[
12
- `+U+le.join(`,
13
- `+U)+`
14
- `+ft+"]":"["+le.join(",")+"]":"[]"}else l(P||_,function(yt){var Kt=L(yt,_,B,P,O,U,D);Kt!==p&&le.push(x(yt)+":"+(O?" ":"")+Kt)}),dt=le.length?O?`{
15
- `+U+le.join(`,
16
- `+U)+`
17
- `+ft+"}":"{"+le.join(",")+"}":"{}";return D.pop(),dt}};u.stringify=function(I,F,B){var P,O,U,D;if(typeof F=="function"||typeof F=="object"&&F){if((D=f.call(F))==a)O=F;else if(D==m){U={};for(var _,q=0,V=F.length;V>q;_=F[q++],D=f.call(_),(D==y||D==d)&&(U[_]=1));}}if(B)if((D=f.call(B))==d){if((B-=B%1)>0)for(P="",B>10&&(B=10);P.length<B;P+=" ");}else D==y&&(P=B.length<=10?B:B.slice(0,10));return L("",(_={},_[""]=I,_),O,U,P,"",[])}}if(!o("json-parse")){var A,z,M=String.fromCharCode,K={92:"\\",34:'"',47:"/",98:"\b",116:" ",110:`
18
- `,102:"\f",114:"\r"},X=function(){throw A=z=null,SyntaxError()},te=function(){for(var I,F,B,P,O,U=z,D=U.length;D>A;)switch(O=U.charCodeAt(A)){case 9:case 10:case 13:case 32:A++;break;case 123:case 125:case 91:case 93:case 58:case 44:return I=T?U.charAt(A):U[A],A++,I;case 34:for(I="@",A++;D>A;)if(O=U.charCodeAt(A),32>O)X();else if(O==92)switch(O=U.charCodeAt(++A)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:I+=K[O],A++;break;case 117:for(F=++A,B=A+4;B>A;A++)O=U.charCodeAt(A),O>=48&&57>=O||O>=97&&102>=O||O>=65&&70>=O||X();I+=M("0x"+U.slice(F,A));break;default:X()}else{if(O==34)break;for(O=U.charCodeAt(A),F=A;O>=32&&O!=92&&O!=34;)O=U.charCodeAt(++A);I+=U.slice(F,A)}if(U.charCodeAt(A)==34)return A++,I;X();default:if(F=A,O==45&&(P=!0,O=U.charCodeAt(++A)),O>=48&&57>=O){for(O==48&&(O=U.charCodeAt(A+1),O>=48&&57>=O)&&X(),P=!1;D>A&&(O=U.charCodeAt(A),O>=48&&57>=O);A++);if(U.charCodeAt(A)==46){for(B=++A;D>B&&(O=U.charCodeAt(B),O>=48&&57>=O);B++);B==A&&X(),A=B}if(O=U.charCodeAt(A),O==101||O==69){for(O=U.charCodeAt(++A),(O==43||O==45)&&A++,B=A;D>B&&(O=U.charCodeAt(B),O>=48&&57>=O);B++);B==A&&X(),A=B}return+U.slice(F,A)}if(P&&X(),U.slice(A,A+4)=="true")return A+=4,!0;if(U.slice(A,A+5)=="false")return A+=5,!1;if(U.slice(A,A+4)=="null")return A+=4,null;X()}return"$"},Oe=function(I){var F,B;if(I=="$"&&X(),typeof I=="string"){if((T?I.charAt(0):I[0])=="@")return I.slice(1);if(I=="["){for(F=[];I=te(),I!="]";B||(B=!0))B&&(I==","?(I=te(),I=="]"&&X()):X()),I==","&&X(),F.push(Oe(I));return F}if(I=="{"){for(F={};I=te(),I!="}";B||(B=!0))B&&(I==","?(I=te(),I=="}"&&X()):X()),(I==","||typeof I!="string"||(T?I.charAt(0):I[0])!="@"||te()!=":")&&X(),F[I.slice(1)]=Oe(te());return F}X()}return I},$t=function(I,F,B){var P=Vt(I,F,B);P===p?delete I[F]:I[F]=P},Vt=function(I,F,B){var P,O=I[F];if(typeof O=="object"&&O)if(f.call(O)==m)for(P=O.length;P--;)$t(O,P,B);else l(O,function(U){$t(O,U,B)});return B.call(I,F,O)};u.parse=function(I,F){var B,P;return A=0,z=""+I,B=Oe(te()),te()!="$"&&X(),A=z=null,F&&f.call(F)==a?Vt((P={},P[""]=B,P),"",F):B}}}})(this)},{}],48:[function(t,e){function r(n,o){var c=[];o=o||0;for(var l=o||0;l<n.length;l++)c[l-o]=n[l];return c}e.exports=r},{}]},{},[1])(1)}const sn=Object.freeze(Object.defineProperty({__proto__:null,default:on},Symbol.toStringTag,{value:"Module"})),an=Object.assign({"./v1_3_7.js":sn}),cn=/v\d+_\d+_\d+/;function hn(t){return typeof t=="function"}const wt=Object.entries(an).reduce((t,e)=>{var o;const r=e[1].default,n=(o=e[0].match(cn))==null?void 0:o[0];return hn(r)&&n&&(t[n]=r()),t},{}),yr=t=>{if(t in wt)return wt[t];throw new Error(`Socket version ${t} not found`)},un=(t,...e)=>yr(t)(...e),pn={...wt,getSocketVersion:yr,makeSocketVersion:un};var gr=(t=>(t.RINGING="Ringing",t.TALKING="Talking",t.DIALING="Dialing",t.HOLD="Hold",t))(gr||{}),mr=(t=>(t.INCOMING="Incoming",t.OUTGOING="Outgoing",t))(mr||{}),de=(t=>(t.CONNECTED="connected",t.DISCONNECTED="disconnected",t.TRYING_TO_CONNECT="tryingToConnect",t))(de||{}),vr=(t=>(t.AUTOMATIC="Automatic",t.IVR="IVR",t))(vr||{}),Cr=(t=>(t.INCOMINC="Incoming",t.OUTGOING="Outgoing",t.SPY="Spy",t.CLICK2CALL="Click2Call",t))(Cr||{}),br=(t=>(t.RESPONSE_FROM_API_VALID="RESPONSE_FROM_API_VALID",t.RESPONSE_FROM_API_INVALID="RESPONSE_FROM_API_INVALID",t))(br||{}),j=(t=>(t.ALL_DIALER_STATUS="AllDialersStatus",t.ALL_EXTENSION_STATUS="AllExtensionsStatus",t.ALL_USERS_STATUS="AllUsersStatus",t.CONNECT="connect",t.DISCONNECT="disconnect",t.CONNECT_ERROR_EVENT="connect_error",t.EXTENSION_EVENT="ExtensionEvent",t.KEEP_ALIVE="keepalive",t.KEEP_ALIVE_RESPONSE="keepaliveResponse",t.LOGIN_STATUS="loginStatus",t.LOGIN_SUCCESS="loginSuccess",t.QUEUE_EVENT="QueueEvent",t.ONLINE_STATUS_EVENT="onlineStatusEvent",t.DIALER_EVENT="DialerEvent",t.EXTENSIONS_UPDATED="ExtensionsUpdated",t))(j||{}),Ft=(t=>(t.NEWCALL="NEWCALL",t.ANSWER="ANSWER",t.HOLD="HOLD",t.UNHOLD="UNHOLD",t.HANGUP="HANGUP",t.USER_STATUS_UPDATE="userStatusUpdate",t))(Ft||{}),kr=(t=>(t.NORMAL_HANGUP="Normal hangup",t.USER_BUSY="User busy",t.CALL_REJECTED="Call Rejected",t.UNALLOCATED_NUMBER="Unallocated (unassigned) number",t.UNKNOWN="Unknown",t.NO_USER_RESPONDING="No user responding",t.USER_ALERTING="User alerting, no answer",t.ANSWERED_ELSEWHERE="Answered elsewhere",t))(kr||{}),wr=(t=>(t.ANSWER="ANSWER",t.ABANDONED="ABANDONED",t.EXIT="EXIT",t.JOIN="JOIN",t))(wr||{});class Ge{static mapExtensionEvent(e){var l,p;const r=e.reason;let n,o;e.data.currentCall&&(o=this.mapExtensionCall(e,e.data.currentCall));const c=this.mapExtensionData(e,e.data);return r===Ft.HANGUP?n={...e,reason:r,data:{...c,currentCall:o?{...o,duration:o.callAnswered_UTC_CLIENT?Date.now()-o.callAnswered_UTC_CLIENT:0}:void 0,calls:(l=e.data.calls)==null?void 0:l.map(f=>{const i=this.mapExtensionCall(e,f);return{...i,duration:i.callAnswered_UTC_CLIENT?Date.now()-i.callAnswered_UTC_CLIENT:0}})}}:n={...e,data:{...c,currentCall:o,calls:(p=e.data.calls)==null?void 0:p.map(f=>this.mapExtensionCall(e,f))},reason:r},n}static mapAllExtensionStatus(e){return{...e,extensions:e.extensions.map(r=>{var n;return{...this.mapExtensionData(e,r),currentCall:r.currentCall?this.mapExtensionCall(e,r.currentCall):void 0,calls:(n=r.calls)==null?void 0:n.map(o=>this.mapExtensionCall(e,o))}})}}static mapExtensionData(e,r){return this.configureUTCForObject(r,[{key:"lastAnsweredCallEventEpoch",format:"sec"},{key:"lastCallEventEpoch",format:"sec"},{key:"lastHangupCallEpoch",format:"sec"},{key:"representativeUpdated",format:"ms"}],e.servertime,e.servertimeoffset)}static mapExtensionCall(e,r){return this.configureUTCForObject(r,[{key:"callAnswered",format:"sec"},{key:"callStarted",format:"sec"}],e.servertime,e.servertimeoffset)}static mapQueueCall(e,r){return this.configureUTCForObject(r,[{key:"JoinTimeStamp",format:"sec"},{key:"VHJoinTimeStamp",format:"sec"}],e.servertime,e.servertimeoffset)}static mapLoginStatusEvent(e){return{...e,queues:e.queues.map(r=>({...r,Calls:r.Calls.map(n=>this.mapQueueCall(e,n))}))}}static mapQueueEvent(e){return{...e,data:{...e.data,Calls:e.data.Calls.map(r=>this.mapQueueCall(e,r))}}}static assignProperty(e,r,n){e[r]=n}static configureUTCForObject(e,r,n,o){const c=(n-o*60)*1e3,l=Date.now()-c,p={};return r.forEach(f=>{const i=e[f.key],u=f.key;if(i!==0&&typeof i=="number"&&!isNaN(i)){let h=i;f.format==="ms"&&(h=Math.floor(h/1e3));const a=(h-o*60)*1e3;this.assignProperty(p,`${u}_UTC`,a),this.assignProperty(p,`${u}_UTC_CLIENT`,a+l)}else this.assignProperty(p,`${u}_UTC`,0),this.assignProperty(p,`${u}_UTC_CLIENT`,0)}),{...e,...p}}}var Ut=(t=>(t.UPDATE_MONITORED_EXTENSIONS="updateMonitoredExtensions",t.KEEP_ALIVE="keepalive",t))(Ut||{});class ln{constructor(e){J(this,"io");J(this,"ioFunction");J(this,"lastEventTimestamp",new Date().getTime());J(this,"doReconnect",!0);J(this,"keepAliveInterval");J(this,"keepReconnectInterval");J(this,"keepReconnectTimeout");J(this,"connected",!1);J(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(ue.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(ue.NEXT)},5e3)}))}getSocketIoFunction(e){const r=e.split("v="),n="v".concat(r[r.length-1]).replaceAll(".","_");this.ioFunction=pn.getSocketVersion(n)}initSocketConnection(){const e=this.eventsSdkClass.authClass.token,r=this.eventsSdkClass.options.protocol,n=this.eventsSdkClass.server;try{const o=n?n.Domain:this.eventsSdkClass.URL,c=n?`${r}://${o}`:this.eventsSdkClass.URL,l={reconnection:!1,upgrade:!1,transports:["websocket"],forceNew:!0,query:{token:e},timeout:this.eventsSdkClass.options.timeout};if(this.ioFunction&&c)this.io=this.ioFunction(c,l),this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT,{attemptToConnect:c,connectionStatus:de.TRYING_TO_CONNECT}),this.eventsSdkClass.loggerClass.sdkAttemptToConnect(o);else throw new Error("Socket server url no defined")}catch(o){this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(o)}}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(Ut.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(),Le.clearSessionStorage()}initSocketEvents(){this.io&&this.io.on(j.LOGIN_SUCCESS,e=>this.onLoginSuccessEvent(e,j.LOGIN_SUCCESS)).on(j.QUEUE_EVENT,e=>this.onQueueEvent(e,j.QUEUE_EVENT)).on(j.EXTENSION_EVENT,e=>this.onExtensionEvent(e,j.EXTENSION_EVENT)).on(j.DIALER_EVENT,e=>this.onDialerEvent(e,j.DIALER_EVENT)).on(j.LOGIN_STATUS,e=>this.onLoginStatusEvent(e,j.LOGIN_STATUS)).on(j.ALL_EXTENSION_STATUS,e=>this.onAllExtensionStatus(e,j.ALL_EXTENSION_STATUS)).on(j.ALL_DIALER_STATUS,e=>this.onAllDialerStatus(e,j.ALL_DIALER_STATUS)).on(j.KEEP_ALIVE_RESPONSE,e=>this.onKeepAliveResponse(e)).on(j.EXTENSIONS_UPDATED,e=>this.onExtensionsUpdatedEvent(e,j.EXTENSIONS_UPDATED)).on(j.CONNECT,()=>this.onConnect()).on(j.DISCONNECT,e=>this.onDisconnect(e)).on(j.CONNECT_ERROR_EVENT,e=>this.onConnectError(e))}onLoginSuccessEvent(e,r){this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,e)}onQueueEvent(e,r){this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,Ge.mapQueueEvent(e))}onExtensionEvent(e,r){const n=Ge.mapExtensionEvent(e);n&&(this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,n))}onDialerEvent(e,r){this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,e)}onLoginStatusEvent(e,r){this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,Ge.mapLoginStatusEvent(e))}onAllExtensionStatus(e,r){const n=Ge.mapAllExtensionStatus(e);this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,n)}onAllDialerStatus(e,r){this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,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,r){this.eventsSdkClass.loggerClass.eventLog(r,e),this.eventsSdkClass.eventEmitterClass.emit(r,e)}onConnect(){this.connected=!0,this.keepReconnectInterval&&clearInterval(this.keepReconnectInterval),this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT,{connectionStatus:de.CONNECTED}),this.eventsSdkClass.loggerClass.start().then(()=>{this.eventsSdkClass.loggerClass.sdkConnectionSuccess()})}onDisconnect(e){this.connected=!1,this.doReconnect&&(this.closeAllConnections(),this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT,{connectionStatus:this.doReconnect?de.TRYING_TO_CONNECT:de.DISCONNECTED}),this.eventsSdkClass.loggerClass.sdkDisconnect([e]),this.keepReconnectTimeout=setTimeout(()=>{this.reconnectionTime=this.reconnectionTime+20,this.reconnectionTime>120&&(this.reconnectionTime=20),this.eventsSdkClass.connect(ue.NEXT)},this.reconnectionTime*1e3))}onConnectError(e){this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT,{connectionStatus:this.doReconnect?de.TRYING_TO_CONNECT:de.DISCONNECTED}),this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(e),this.keepReconnectTimeout=setTimeout(()=>{this.reconnectionTime=this.reconnectionTime+20,this.reconnectionTime>60&&(this.reconnectionTime=20),this.eventsSdkClass.connect(ue.NEXT)},this.reconnectionTime*1e3)}}var fn=Object.defineProperty,dn=(t,e,r)=>e in t?fn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,$=(t,e,r)=>(dn(t,typeof e!="symbol"?e+"":e,r),r);function yn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function gn(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var r=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(n){var o=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:function(){return t[n]}})}),r}var St={exports:{}},mn=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,vn=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],Sr=function(t){var e=t,r=t.indexOf("["),n=t.indexOf("]");r!=-1&&n!=-1&&(t=t.substring(0,r)+t.substring(r,n).replace(/:/g,";")+t.substring(n,t.length));for(var o=mn.exec(t||""),c={},l=14;l--;)c[vn[l]]=o[l]||"";return r!=-1&&n!=-1&&(c.source=e,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=Cn(c,c.path),c.queryKey=bn(c,c.query),c};function Cn(t,e){var r=/\/{2,9}/g,n=e.replace(r,"/").split("/");return(e.substr(0,1)=="/"||e.length===0)&&n.splice(0,1),e.substr(e.length-1,1)=="/"&&n.splice(n.length-1,1),n}function bn(t,e){var r={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,o,c){o&&(r[o]=c)}),r}var Et={exports:{}},At={exports:{}},Ie=1e3,Be=Ie*60,_e=Be*60,Fe=_e*24,kn=Fe*365.25,wn=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return Sn(t);if(r==="number"&&isNaN(t)===!1)return e.long?An(t):En(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function Sn(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*kn;case"days":case"day":case"d":return r*Fe;case"hours":case"hour":case"hrs":case"hr":case"h":return r*_e;case"minutes":case"minute":case"mins":case"min":case"m":return r*Be;case"seconds":case"second":case"secs":case"sec":case"s":return r*Ie;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function En(t){return t>=Fe?Math.round(t/Fe)+"d":t>=_e?Math.round(t/_e)+"h":t>=Be?Math.round(t/Be)+"m":t>=Ie?Math.round(t/Ie)+"s":t+"ms"}function An(t){return Je(t,Fe,"day")||Je(t,_e,"hour")||Je(t,Be,"minute")||Je(t,Ie,"second")||t+" ms"}function Je(t,e,r){if(!(t<e))return t<e*1.5?Math.floor(t/e)+" "+r:Math.ceil(t/e)+" "+r+"s"}(function(t,e){e=t.exports=n.debug=n.default=n,e.coerce=f,e.disable=l,e.enable=c,e.enabled=p,e.humanize=wn,e.instances=[],e.names=[],e.skips=[],e.formatters={};function r(i){var u=0,h;for(h in i)u=(u<<5)-u+i.charCodeAt(h),u|=0;return e.colors[Math.abs(u)%e.colors.length]}function n(i){var u;function h(){if(h.enabled){var a=h,s=+new Date,d=s-(u||s);a.diff=d,a.prev=u,a.curr=s,u=s;for(var y=new Array(arguments.length),m=0;m<y.length;m++)y[m]=arguments[m];y[0]=e.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");var v=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,function(R,b){if(R==="%%")return R;v++;var S=e.formatters[b];if(typeof S=="function"){var g=y[v];R=S.call(a,g),y.splice(v,1),v--}return R}),e.formatArgs.call(a,y);var T=h.log||e.log||console.log.bind(console);T.apply(a,y)}}return h.namespace=i,h.enabled=e.enabled(i),h.useColors=e.useColors(),h.color=r(i),h.destroy=o,typeof e.init=="function"&&e.init(h),e.instances.push(h),h}function o(){var i=e.instances.indexOf(this);return i!==-1?(e.instances.splice(i,1),!0):!1}function c(i){e.save(i),e.names=[],e.skips=[];var u,h=(typeof i=="string"?i:"").split(/[\s,]+/),a=h.length;for(u=0;u<a;u++)h[u]&&(i=h[u].replace(/\*/g,".*?"),i[0]==="-"?e.skips.push(new RegExp("^"+i.substr(1)+"$")):e.names.push(new RegExp("^"+i+"$")));for(u=0;u<e.instances.length;u++){var s=e.instances[u];s.enabled=e.enabled(s.namespace)}}function l(){e.enable("")}function p(i){if(i[i.length-1]==="*")return!0;var u,h;for(u=0,h=e.skips.length;u<h;u++)if(e.skips[u].test(i))return!1;for(u=0,h=e.names.length;u<h;u++)if(e.names[u].test(i))return!0;return!1}function f(i){return i instanceof Error?i.stack||i.message:i}})(At,At.exports);var Tn=At.exports;(function(t,e){e=t.exports=Tn,e.log=o,e.formatArgs=n,e.save=c,e.load=l,e.useColors=r,e.storage=typeof chrome<"u"&&typeof chrome.storage<"u"?chrome.storage.local:p(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&window.process.type==="renderer"?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}e.formatters.j=function(f){try{return JSON.stringify(f)}catch(i){return"[UnexpectedJSONParseError]: "+i.message}};function n(f){var i=this.useColors;if(f[0]=(i?"%c":"")+this.namespace+(i?" %c":" ")+f[0]+(i?"%c ":" ")+"+"+e.humanize(this.diff),!!i){var u="color: "+this.color;f.splice(1,0,u,"color: inherit");var h=0,a=0;f[0].replace(/%[a-zA-Z%]/g,function(s){s!=="%%"&&(h++,s==="%c"&&(a=h))}),f.splice(a,0,u)}}function o(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function c(f){try{f==null?e.storage.removeItem("debug"):e.storage.debug=f}catch{}}function l(){var f;try{f=e.storage.debug}catch{}return!f&&typeof process<"u"&&"env"in process&&(f=process.env.DEBUG),f}e.enable(l());function p(){try{return window.localStorage}catch{}}})(Et,Et.exports);var rt=Et.exports,Nn=Sr,Qt=rt("socket.io-client:url"),On=xn;function xn(t,e){var r=t;e=e||typeof location<"u"&&location,t==null&&(t=e.protocol+"//"+e.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=e.protocol+t:t=e.host+t),/^(https?|wss?):\/\//.test(t)||(Qt("protocol-less url %s",t),typeof e<"u"?t=e.protocol+"//"+t:t="https://"+t),Qt("parse %s",t),r=Nn(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";var n=r.host.indexOf(":")!==-1,o=n?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port,r.href=r.protocol+"://"+o+(e&&e.port===r.port?"":":"+r.port),r}var nt={},Tt={exports:{}},Nt={exports:{}},Ue=1e3,De=Ue*60,Pe=De*60,je=Pe*24,Rn=je*365.25,Ln=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return In(t);if(r==="number"&&isNaN(t)===!1)return e.long?_n(t):Bn(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function In(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Rn;case"days":case"day":case"d":return r*je;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Pe;case"minutes":case"minute":case"mins":case"min":case"m":return r*De;case"seconds":case"second":case"secs":case"sec":case"s":return r*Ue;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Bn(t){return t>=je?Math.round(t/je)+"d":t>=Pe?Math.round(t/Pe)+"h":t>=De?Math.round(t/De)+"m":t>=Ue?Math.round(t/Ue)+"s":t+"ms"}function _n(t){return He(t,je,"day")||He(t,Pe,"hour")||He(t,De,"minute")||He(t,Ue,"second")||t+" ms"}function He(t,e,r){if(!(t<e))return t<e*1.5?Math.floor(t/e)+" "+r:Math.ceil(t/e)+" "+r+"s"}(function(t,e){e=t.exports=n.debug=n.default=n,e.coerce=f,e.disable=l,e.enable=c,e.enabled=p,e.humanize=Ln,e.instances=[],e.names=[],e.skips=[],e.formatters={};function r(i){var u=0,h;for(h in i)u=(u<<5)-u+i.charCodeAt(h),u|=0;return e.colors[Math.abs(u)%e.colors.length]}function n(i){var u;function h(){if(h.enabled){var a=h,s=+new Date,d=s-(u||s);a.diff=d,a.prev=u,a.curr=s,u=s;for(var y=new Array(arguments.length),m=0;m<y.length;m++)y[m]=arguments[m];y[0]=e.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");var v=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,function(R,b){if(R==="%%")return R;v++;var S=e.formatters[b];if(typeof S=="function"){var g=y[v];R=S.call(a,g),y.splice(v,1),v--}return R}),e.formatArgs.call(a,y);var T=h.log||e.log||console.log.bind(console);T.apply(a,y)}}return h.namespace=i,h.enabled=e.enabled(i),h.useColors=e.useColors(),h.color=r(i),h.destroy=o,typeof e.init=="function"&&e.init(h),e.instances.push(h),h}function o(){var i=e.instances.indexOf(this);return i!==-1?(e.instances.splice(i,1),!0):!1}function c(i){e.save(i),e.names=[],e.skips=[];var u,h=(typeof i=="string"?i:"").split(/[\s,]+/),a=h.length;for(u=0;u<a;u++)h[u]&&(i=h[u].replace(/\*/g,".*?"),i[0]==="-"?e.skips.push(new RegExp("^"+i.substr(1)+"$")):e.names.push(new RegExp("^"+i+"$")));for(u=0;u<e.instances.length;u++){var s=e.instances[u];s.enabled=e.enabled(s.namespace)}}function l(){e.enable("")}function p(i){if(i[i.length-1]==="*")return!0;var u,h;for(u=0,h=e.skips.length;u<h;u++)if(e.skips[u].test(i))return!1;for(u=0,h=e.names.length;u<h;u++)if(e.names[u].test(i))return!0;return!1}function f(i){return i instanceof Error?i.stack||i.message:i}})(Nt,Nt.exports);var Fn=Nt.exports;(function(t,e){e=t.exports=Fn,e.log=o,e.formatArgs=n,e.save=c,e.load=l,e.useColors=r,e.storage=typeof chrome<"u"&&typeof chrome.storage<"u"?chrome.storage.local:p(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&window.process.type==="renderer"?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}e.formatters.j=function(f){try{return JSON.stringify(f)}catch(i){return"[UnexpectedJSONParseError]: "+i.message}};function n(f){var i=this.useColors;if(f[0]=(i?"%c":"")+this.namespace+(i?" %c":" ")+f[0]+(i?"%c ":" ")+"+"+e.humanize(this.diff),!!i){var u="color: "+this.color;f.splice(1,0,u,"color: inherit");var h=0,a=0;f[0].replace(/%[a-zA-Z%]/g,function(s){s!=="%%"&&(h++,s==="%c"&&(a=h))}),f.splice(a,0,u)}}function o(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function c(f){try{f==null?e.storage.removeItem("debug"):e.storage.debug=f}catch{}}function l(){var f;try{f=e.storage.debug}catch{}return!f&&typeof process<"u"&&"env"in process&&(f=process.env.DEBUG),f}e.enable(l());function p(){try{return window.localStorage}catch{}}})(Tt,Tt.exports);var Un=Tt.exports,Er={exports:{}};(function(t){t.exports=e;function e(n){if(n)return r(n)}function r(n){for(var o in e.prototype)n[o]=e.prototype[o];return n}e.prototype.on=e.prototype.addEventListener=function(n,o){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(o),this},e.prototype.once=function(n,o){function c(){this.off(n,c),o.apply(this,arguments)}return c.fn=o,this.on(n,c),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(n,o){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var c=this._callbacks["$"+n];if(!c)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var l,p=0;p<c.length;p++)if(l=c[p],l===o||l.fn===o){c.splice(p,1);break}return c.length===0&&delete this._callbacks["$"+n],this},e.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var o=new Array(arguments.length-1),c=this._callbacks["$"+n],l=1;l<arguments.length;l++)o[l-1]=arguments[l];if(c){c=c.slice(0);for(var l=0,p=c.length;l<p;++l)c[l].apply(this,o)}return this},e.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]},e.prototype.hasListeners=function(n){return!!this.listeners(n).length}})(Er);var Se=Er.exports,ot={},Dn={}.toString,Dt=Array.isArray||function(t){return Dn.call(t)=="[object Array]"},Ar=qn,Pn=typeof Buffer=="function"&&typeof Buffer.isBuffer=="function",jn=typeof ArrayBuffer=="function",Mn=function(t){return typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer};function qn(t){return Pn&&Buffer.isBuffer(t)||jn&&(t instanceof ArrayBuffer||Mn(t))}var Pt=Dt,Tr=Ar,Nr=Object.prototype.toString,zn=typeof Blob=="function"||typeof Blob<"u"&&Nr.call(Blob)==="[object BlobConstructor]",Xn=typeof File=="function"||typeof File<"u"&&Nr.call(File)==="[object FileConstructor]";ot.deconstructPacket=function(t){var e=[],r=t.data,n=t;return n.data=Ot(r,e),n.attachments=e.length,{packet:n,buffers:e}};function Ot(t,e){if(!t)return t;if(Tr(t)){var r={_placeholder:!0,num:e.length};return e.push(t),r}else if(Pt(t)){for(var n=new Array(t.length),o=0;o<t.length;o++)n[o]=Ot(t[o],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){var n={};for(var c in t)n[c]=Ot(t[c],e);return n}return t}ot.reconstructPacket=function(t,e){return t.data=xt(t.data,e),t.attachments=void 0,t};function xt(t,e){if(!t)return t;if(t&&t._placeholder===!0){var r=typeof t.num=="number"&&t.num>=0&&t.num<e.length;if(r)return e[t.num];throw new Error("illegal attachments")}else if(Pt(t))for(var n=0;n<t.length;n++)t[n]=xt(t[n],e);else if(typeof t=="object")for(var o in t)t[o]=xt(t[o],e);return t}ot.removeBlobs=function(t,e){function r(c,l,p){if(!c)return c;if(zn&&c instanceof Blob||Xn&&c instanceof File){n++;var f=new FileReader;f.onload=function(){p?p[l]=this.result:o=this.result,--n||e(o)},f.readAsArrayBuffer(c)}else if(Pt(c))for(var i=0;i<c.length;i++)r(c[i],i,c);else if(typeof c=="object"&&!Tr(c))for(var u in c)r(c[u],u,c)}var n=0,o=t;r(o),n||e(o)};(function(t){var e=Un("socket.io-parser"),r=Se,n=ot,o=Dt,c=Ar;t.protocol=4,t.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],t.CONNECT=0,t.DISCONNECT=1,t.EVENT=2,t.ACK=3,t.ERROR=4,t.BINARY_EVENT=5,t.BINARY_ACK=6,t.Encoder=l,t.Decoder=h;function l(){}var p=t.ERROR+'"encode error"';l.prototype.encode=function(v,T){if(e("encoding packet %j",v),t.BINARY_EVENT===v.type||t.BINARY_ACK===v.type)u(v,T);else{var R=f(v);T([R])}};function f(v){var T=""+v.type;if((t.BINARY_EVENT===v.type||t.BINARY_ACK===v.type)&&(T+=v.attachments+"-"),v.nsp&&v.nsp!=="/"&&(T+=v.nsp+","),v.id!=null&&(T+=v.id),v.data!=null){var R=i(v.data);if(R!==!1)T+=R;else return p}return e("encoded %j as %s",v,T),T}function i(v){try{return JSON.stringify(v)}catch{return!1}}function u(v,T){function R(b){var S=n.deconstructPacket(b),g=f(S.packet),w=S.buffers;w.unshift(g),T(w)}n.removeBlobs(v,R)}function h(){this.reconstructor=null}r(h.prototype),h.prototype.add=function(v){var T;if(typeof v=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");T=s(v),t.BINARY_EVENT===T.type||t.BINARY_ACK===T.type?(this.reconstructor=new y(T),this.reconstructor.reconPack.attachments===0&&this.emit("decoded",T)):this.emit("decoded",T)}else if(c(v)||v.base64)if(this.reconstructor)T=this.reconstructor.takeBinaryData(v),T&&(this.reconstructor=null,this.emit("decoded",T));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+v)};function a(v,T){switch(v){case 0:return typeof T=="object";case 1:return T===void 0;case 4:return typeof T=="string"||typeof T=="object";case 2:case 5:return o(T)&&(typeof T[0]=="string"||typeof T[0]=="number");case 3:case 6:return o(T)}}function s(v){var T=0,R={type:Number(v.charAt(0))};if(t.types[R.type]==null)return m("unknown packet type "+R.type);if(t.BINARY_EVENT===R.type||t.BINARY_ACK===R.type){for(var b=T+1;v.charAt(++T)!=="-"&&T!=v.length;);var S=v.substring(b,T);if(S!=Number(S)||v.charAt(T)!=="-")throw new Error("Illegal attachments");R.attachments=Number(S)}if(v.charAt(T+1)==="/"){for(var b=T+1;++T;){var g=v.charAt(T);if(g===","||T===v.length)break}R.nsp=v.substring(b,T)}else R.nsp="/";var w=v.charAt(T+1);if(w!==""&&Number(w)==w){for(var b=T+1;++T;){var g=v.charAt(T);if(g==null||Number(g)!=g){--T;break}if(T===v.length)break}R.id=Number(v.substring(b,T+1))}if(v.charAt(++T)){var E=d(v.substr(T));if(a(R.type,E))R.data=E;else throw new Error("invalid payload")}return e("decoded %s as %j",v,R),R}function d(v){try{return JSON.parse(v)}catch{return!1}}h.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()};function y(v){this.reconPack=v,this.buffers=[]}y.prototype.takeBinaryData=function(v){if(this.buffers.push(v),this.buffers.length===this.reconPack.attachments){var T=n.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),T}return null},y.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]};function m(v){return{type:t.ERROR,data:"parser error: "+v}}})(nt);var jt={exports:{}},st={},Rt={exports:{}};try{Rt.exports=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{Rt.exports=!1}var Wn=Rt.exports,Mt=function(){return typeof self<"u"?self:typeof window<"u"?window:Function("return this")()}(),Gn=Wn,Jn=Mt,qt=function(t){var e=t.xdomain,r=t.xscheme,n=t.enablesXDR;try{if(typeof XMLHttpRequest<"u"&&(!e||Gn))return new XMLHttpRequest}catch{}try{if(typeof XDomainRequest<"u"&&!r&&n)return new XDomainRequest}catch{}if(!e)try{return new Jn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}},zt={exports:{}},Ce={},Hn=Object.keys||function(t){var e=[],r=Object.prototype.hasOwnProperty;for(var n in t)r.call(t,n)&&e.push(n);return e},$n=Dt,Or=Object.prototype.toString,Vn=typeof Blob=="function"||typeof Blob<"u"&&Or.call(Blob)==="[object BlobConstructor]",Kn=typeof File=="function"||typeof File<"u"&&Or.call(File)==="[object FileConstructor]",xr=Ye;function Ye(t){if(!t||typeof t!="object")return!1;if($n(t)){for(var e=0,r=t.length;e<r;e++)if(Ye(t[e]))return!0;return!1}if(typeof Buffer=="function"&&Buffer.isBuffer&&Buffer.isBuffer(t)||typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Vn&&t instanceof Blob||Kn&&t instanceof File)return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Ye(t.toJSON(),!0);for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&Ye(t[n]))return!0;return!1}var Yn=function(t,e,r){var n=t.byteLength;if(e=e||0,r=r||n,t.slice)return t.slice(e,r);if(e<0&&(e+=n),r<0&&(r+=n),r>n&&(r=n),e>=n||e>=r||n===0)return new ArrayBuffer(0);for(var o=new Uint8Array(t),c=new Uint8Array(r-e),l=e,p=0;l<r;l++,p++)c[p]=o[l];return c.buffer},Qn=Zn;function Zn(t,e,r){var n=!1;return r=r||eo,o.count=t,t===0?e():o;function o(c,l){if(o.count<=0)throw new Error("after called too many times");--o.count,c?(n=!0,e(c),e=r):o.count===0&&!n&&e(null,l)}}function eo(){}/*! https://mths.be/utf8js v2.1.2 by @mathias */var ge=String.fromCharCode;function Rr(t){for(var e=[],r=0,n=t.length,o,c;r<n;)o=t.charCodeAt(r++),o>=55296&&o<=56319&&r<n?(c=t.charCodeAt(r++),(c&64512)==56320?e.push(((o&1023)<<10)+(c&1023)+65536):(e.push(o),r--)):e.push(o);return e}function to(t){for(var e=t.length,r=-1,n,o="";++r<e;)n=t[r],n>65535&&(n-=65536,o+=ge(n>>>10&1023|55296),n=56320|n&1023),o+=ge(n);return o}function Lr(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function gt(t,e){return ge(t>>e&63|128)}function ro(t,e){if(!(t&4294967168))return ge(t);var r="";return t&4294965248?t&4294901760?t&4292870144||(r=ge(t>>18&7|240),r+=gt(t,12),r+=gt(t,6)):(Lr(t,e)||(t=65533),r=ge(t>>12&15|224),r+=gt(t,6)):r=ge(t>>6&31|192),r+=ge(t&63|128),r}function no(t,e){e=e||{};for(var r=e.strict!==!1,n=Rr(t),o=n.length,c=-1,l,p="";++c<o;)l=n[c],p+=ro(l,r);return p}function be(){if(me>=Ze)throw Error("Invalid byte index");var t=Qe[me]&255;if(me++,(t&192)==128)return t&63;throw Error("Invalid continuation byte")}function oo(t){var e,r,n,o,c;if(me>Ze)throw Error("Invalid byte index");if(me==Ze)return!1;if(e=Qe[me]&255,me++,!(e&128))return e;if((e&224)==192){if(r=be(),c=(e&31)<<6|r,c>=128)return c;throw Error("Invalid continuation byte")}if((e&240)==224){if(r=be(),n=be(),c=(e&15)<<12|r<<6|n,c>=2048)return Lr(c,t)?c:65533;throw Error("Invalid continuation byte")}if((e&248)==240&&(r=be(),n=be(),o=be(),c=(e&7)<<18|r<<12|n<<6|o,c>=65536&&c<=1114111))return c;throw Error("Invalid UTF-8 detected")}var Qe,Ze,me;function so(t,e){e=e||{};var r=e.strict!==!1;Qe=Rr(t),Ze=Qe.length,me=0;for(var n=[],o;(o=oo(r))!==!1;)n.push(o);return to(n)}var io={version:"2.1.2",encode:no,decode:so},mt={},Zt;function ao(){return Zt||(Zt=1,function(t){mt.encode=function(e){var r=new Uint8Array(e),n,o=r.length,c="";for(n=0;n<o;n+=3)c+=t[r[n]>>2],c+=t[(r[n]&3)<<4|r[n+1]>>4],c+=t[(r[n+1]&15)<<2|r[n+2]>>6],c+=t[r[n+2]&63];return o%3===2?c=c.substring(0,c.length-1)+"=":o%3===1&&(c=c.substring(0,c.length-2)+"=="),c},mt.decode=function(e){var r=e.length*.75,n=e.length,o,c=0,l,p,f,i;e[e.length-1]==="="&&(r--,e[e.length-2]==="="&&r--);var u=new ArrayBuffer(r),h=new Uint8Array(u);for(o=0;o<n;o+=4)l=t.indexOf(e[o]),p=t.indexOf(e[o+1]),f=t.indexOf(e[o+2]),i=t.indexOf(e[o+3]),h[c++]=l<<2|p>>4,h[c++]=(p&15)<<4|f>>2,h[c++]=(f&3)<<6|i&63;return u}}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")),mt}var vt,er;function co(){if(er)return vt;er=1;var t=typeof t<"u"?t:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:typeof MSBlobBuilder<"u"?MSBlobBuilder:typeof MozBlobBuilder<"u"?MozBlobBuilder:!1,e=function(){try{var p=new Blob(["hi"]);return p.size===2}catch{return!1}}(),r=e&&function(){try{var p=new Blob([new Uint8Array([1,2])]);return p.size===2}catch{return!1}}(),n=t&&t.prototype.append&&t.prototype.getBlob;function o(p){return p.map(function(f){if(f.buffer instanceof ArrayBuffer){var i=f.buffer;if(f.byteLength!==i.byteLength){var u=new Uint8Array(f.byteLength);u.set(new Uint8Array(i,f.byteOffset,f.byteLength)),i=u.buffer}return i}return f})}function c(p,f){f=f||{};var i=new t;return o(p).forEach(function(u){i.append(u)}),f.type?i.getBlob(f.type):i.getBlob()}function l(p,f){return new Blob(o(p),f||{})}return typeof Blob<"u"&&(c.prototype=Blob.prototype,l.prototype=Blob.prototype),vt=function(){return e?r?Blob:l:n?c:void 0}(),vt}(function(t){var e=Hn,r=xr,n=Yn,o=Qn,c=io,l;typeof ArrayBuffer<"u"&&(l=ao());var p=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),f=typeof navigator<"u"&&/PhantomJS/i.test(navigator.userAgent),i=p||f;t.protocol=3;var u=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},h=e(u),a={type:"error",data:"parser error"},s=co();t.encodePacket=function(b,S,g,w){typeof S=="function"&&(w=S,S=!1),typeof g=="function"&&(w=g,g=null);var E=b.data===void 0?void 0:b.data.buffer||b.data;if(typeof ArrayBuffer<"u"&&E instanceof ArrayBuffer)return y(b,S,w);if(typeof s<"u"&&E instanceof s)return v(b,S,w);if(E&&E.base64)return d(b,w);var C=u[b.type];return b.data!==void 0&&(C+=g?c.encode(String(b.data),{strict:!1}):String(b.data)),w(""+C)};function d(b,S){var g="b"+t.packets[b.type]+b.data.data;return S(g)}function y(b,S,g){if(!S)return t.encodeBase64Packet(b,g);var w=b.data,E=new Uint8Array(w),C=new Uint8Array(1+w.byteLength);C[0]=u[b.type];for(var k=0;k<E.length;k++)C[k+1]=E[k];return g(C.buffer)}function m(b,S,g){if(!S)return t.encodeBase64Packet(b,g);var w=new FileReader;return w.onload=function(){t.encodePacket({type:b.type,data:w.result},S,!0,g)},w.readAsArrayBuffer(b.data)}function v(b,S,g){if(!S)return t.encodeBase64Packet(b,g);if(i)return m(b,S,g);var w=new Uint8Array(1);w[0]=u[b.type];var E=new s([w.buffer,b.data]);return g(E)}t.encodeBase64Packet=function(b,S){var g="b"+t.packets[b.type];if(typeof s<"u"&&b.data instanceof s){var w=new FileReader;return w.onload=function(){var x=w.result.split(",")[1];S(g+x)},w.readAsDataURL(b.data)}var E;try{E=String.fromCharCode.apply(null,new Uint8Array(b.data))}catch{for(var C=new Uint8Array(b.data),k=new Array(C.length),N=0;N<C.length;N++)k[N]=C[N];E=String.fromCharCode.apply(null,k)}return g+=btoa(E),S(g)},t.decodePacket=function(b,S,g){if(b===void 0)return a;if(typeof b=="string"){if(b.charAt(0)==="b")return t.decodeBase64Packet(b.substr(1),S);if(g&&(b=T(b),b===!1))return a;var E=b.charAt(0);return Number(E)!=E||!h[E]?a:b.length>1?{type:h[E],data:b.substring(1)}:{type:h[E]}}var w=new Uint8Array(b),E=w[0],C=n(b,1);return s&&S==="blob"&&(C=new s([C])),{type:h[E],data:C}};function T(b){try{b=c.decode(b,{strict:!1})}catch{return!1}return b}t.decodeBase64Packet=function(b,S){var g=h[b.charAt(0)];if(!l)return{type:g,data:{base64:!0,data:b.substr(1)}};var w=l.decode(b.substr(1));return S==="blob"&&s&&(w=new s([w])),{type:g,data:w}},t.encodePayload=function(b,S,g){typeof S=="function"&&(g=S,S=null);var w=r(b);if(S&&w)return s&&!i?t.encodePayloadAsBlob(b,g):t.encodePayloadAsArrayBuffer(b,g);if(!b.length)return g("0:");function E(k){return k.length+":"+k}function C(k,N){t.encodePacket(k,w?S:!1,!1,function(x){N(null,E(x))})}R(b,C,function(k,N){return g(N.join(""))})};function R(b,S,g){for(var w=new Array(b.length),E=o(b.length,g),C=function(N,x,L){S(x,function(A,z){w[N]=z,L(A,w)})},k=0;k<b.length;k++)C(k,b[k],E)}t.decodePayload=function(b,S,g){if(typeof b!="string")return t.decodePayloadAsBinary(b,S,g);typeof S=="function"&&(g=S,S=null);var w;if(b==="")return g(a,0,1);for(var E="",C,k,N=0,x=b.length;N<x;N++){var L=b.charAt(N);if(L!==":"){E+=L;continue}if(E===""||E!=(C=Number(E))||(k=b.substr(N+1,C),E!=k.length))return g(a,0,1);if(k.length){if(w=t.decodePacket(k,S,!1),a.type===w.type&&a.data===w.data)return g(a,0,1);var A=g(w,N+C,x);if(A===!1)return}N+=C,E=""}if(E!=="")return g(a,0,1)},t.encodePayloadAsArrayBuffer=function(b,S){if(!b.length)return S(new ArrayBuffer(0));function g(w,E){t.encodePacket(w,!0,!0,function(C){return E(null,C)})}R(b,g,function(w,E){var C=E.reduce(function(x,L){var A;return typeof L=="string"?A=L.length:A=L.byteLength,x+A.toString().length+A+2},0),k=new Uint8Array(C),N=0;return E.forEach(function(x){var L=typeof x=="string",A=x;if(L){for(var z=new Uint8Array(x.length),M=0;M<x.length;M++)z[M]=x.charCodeAt(M);A=z.buffer}L?k[N++]=0:k[N++]=1;for(var K=A.byteLength.toString(),M=0;M<K.length;M++)k[N++]=parseInt(K[M]);k[N++]=255;for(var z=new Uint8Array(A),M=0;M<z.length;M++)k[N++]=z[M]}),S(k.buffer)})},t.encodePayloadAsBlob=function(b,S){function g(w,E){t.encodePacket(w,!0,!0,function(C){var k=new Uint8Array(1);if(k[0]=1,typeof C=="string"){for(var N=new Uint8Array(C.length),x=0;x<C.length;x++)N[x]=C.charCodeAt(x);C=N.buffer,k[0]=0}for(var L=C instanceof ArrayBuffer?C.byteLength:C.size,A=L.toString(),z=new Uint8Array(A.length+1),x=0;x<A.length;x++)z[x]=parseInt(A[x]);if(z[A.length]=255,s){var M=new s([k.buffer,z.buffer,C]);E(null,M)}})}R(b,g,function(w,E){return S(new s(E))})},t.decodePayloadAsBinary=function(b,S,g){typeof S=="function"&&(g=S,S=null);for(var w=b,E=[];w.byteLength>0;){for(var C=new Uint8Array(w),k=C[0]===0,N="",x=1;C[x]!==255;x++){if(N.length>310)return g(a,0,1);N+=C[x]}w=n(w,2+N.length),N=parseInt(N);var L=n(w,0,N);if(k)try{L=String.fromCharCode.apply(null,new Uint8Array(L))}catch{var A=new Uint8Array(L);L="";for(var x=0;x<A.length;x++)L+=String.fromCharCode(A[x])}E.push(L),w=n(w,N)}var z=E.length;E.forEach(function(M,K){g(t.decodePacket(M,S,!0),K,z)})}})(Ce);var Ct,tr;function Xt(){if(tr)return Ct;tr=1;var t=Ce,e=Se;Ct=r;function r(n){this.path=n.path,this.hostname=n.hostname,this.port=n.port,this.secure=n.secure,this.query=n.query,this.timestampParam=n.timestampParam,this.timestampRequests=n.timestampRequests,this.readyState="",this.agent=n.agent||!1,this.socket=n.socket,this.enablesXDR=n.enablesXDR,this.withCredentials=n.withCredentials,this.pfx=n.pfx,this.key=n.key,this.passphrase=n.passphrase,this.cert=n.cert,this.ca=n.ca,this.ciphers=n.ciphers,this.rejectUnauthorized=n.rejectUnauthorized,this.forceNode=n.forceNode,this.isReactNative=n.isReactNative,this.extraHeaders=n.extraHeaders,this.localAddress=n.localAddress}return e(r.prototype),r.prototype.onError=function(n,o){var c=new Error(n);return c.type="TransportError",c.description=o,this.emit("error",c),this},r.prototype.open=function(){return(this.readyState==="closed"||this.readyState==="")&&(this.readyState="opening",this.doOpen()),this},r.prototype.close=function(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this},r.prototype.send=function(n){if(this.readyState==="open")this.write(n);else throw new Error("Transport not open")},r.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},r.prototype.onData=function(n){var o=t.decodePacket(n,this.socket.binaryType);this.onPacket(o)},r.prototype.onPacket=function(n){this.emit("packet",n)},r.prototype.onClose=function(){this.readyState="closed",this.emit("close")},Ct}var Ee={};Ee.encode=function(t){var e="";for(var r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e};Ee.decode=function(t){for(var e={},r=t.split("&"),n=0,o=r.length;n<o;n++){var c=r[n].split("=");e[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return e};var it=function(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t},Ir="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),et=64,Br={},rr=0,ve=0,nr;function Lt(t){var e="";do e=Ir[t%et]+e,t=Math.floor(t/et);while(t>0);return e}function ho(t){var e=0;for(ve=0;ve<t.length;ve++)e=e*et+Br[t.charAt(ve)];return e}function Wt(){var t=Lt(+new Date);return t!==nr?(rr=0,nr=t):t+"."+Lt(rr++)}for(;ve<et;ve++)Br[Ir[ve]]=ve;Wt.encode=Lt;Wt.decode=ho;var _r=Wt,It={exports:{}},Bt={exports:{}},Me=1e3,qe=Me*60,ze=qe*60,Xe=ze*24,uo=Xe*365.25,po=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return lo(t);if(r==="number"&&isNaN(t)===!1)return e.long?yo(t):fo(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function lo(t){if(t=String(t),!(t.length>100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var r=parseFloat(e[1]),n=(e[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*uo;case"days":case"day":case"d":return r*Xe;case"hours":case"hour":case"hrs":case"hr":case"h":return r*ze;case"minutes":case"minute":case"mins":case"min":case"m":return r*qe;case"seconds":case"second":case"secs":case"sec":case"s":return r*Me;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function fo(t){return t>=Xe?Math.round(t/Xe)+"d":t>=ze?Math.round(t/ze)+"h":t>=qe?Math.round(t/qe)+"m":t>=Me?Math.round(t/Me)+"s":t+"ms"}function yo(t){return $e(t,Xe,"day")||$e(t,ze,"hour")||$e(t,qe,"minute")||$e(t,Me,"second")||t+" ms"}function $e(t,e,r){if(!(t<e))return t<e*1.5?Math.floor(t/e)+" "+r:Math.ceil(t/e)+" "+r+"s"}(function(t,e){e=t.exports=n.debug=n.default=n,e.coerce=f,e.disable=l,e.enable=c,e.enabled=p,e.humanize=po,e.instances=[],e.names=[],e.skips=[],e.formatters={};function r(i){var u=0,h;for(h in i)u=(u<<5)-u+i.charCodeAt(h),u|=0;return e.colors[Math.abs(u)%e.colors.length]}function n(i){var u;function h(){if(h.enabled){var a=h,s=+new Date,d=s-(u||s);a.diff=d,a.prev=u,a.curr=s,u=s;for(var y=new Array(arguments.length),m=0;m<y.length;m++)y[m]=arguments[m];y[0]=e.coerce(y[0]),typeof y[0]!="string"&&y.unshift("%O");var v=0;y[0]=y[0].replace(/%([a-zA-Z%])/g,function(R,b){if(R==="%%")return R;v++;var S=e.formatters[b];if(typeof S=="function"){var g=y[v];R=S.call(a,g),y.splice(v,1),v--}return R}),e.formatArgs.call(a,y);var T=h.log||e.log||console.log.bind(console);T.apply(a,y)}}return h.namespace=i,h.enabled=e.enabled(i),h.useColors=e.useColors(),h.color=r(i),h.destroy=o,typeof e.init=="function"&&e.init(h),e.instances.push(h),h}function o(){var i=e.instances.indexOf(this);return i!==-1?(e.instances.splice(i,1),!0):!1}function c(i){e.save(i),e.names=[],e.skips=[];var u,h=(typeof i=="string"?i:"").split(/[\s,]+/),a=h.length;for(u=0;u<a;u++)h[u]&&(i=h[u].replace(/\*/g,".*?"),i[0]==="-"?e.skips.push(new RegExp("^"+i.substr(1)+"$")):e.names.push(new RegExp("^"+i+"$")));for(u=0;u<e.instances.length;u++){var s=e.instances[u];s.enabled=e.enabled(s.namespace)}}function l(){e.enable("")}function p(i){if(i[i.length-1]==="*")return!0;var u,h;for(u=0,h=e.skips.length;u<h;u++)if(e.skips[u].test(i))return!1;for(u=0,h=e.names.length;u<h;u++)if(e.names[u].test(i))return!0;return!1}function f(i){return i instanceof Error?i.stack||i.message:i}})(Bt,Bt.exports);var go=Bt.exports;(function(t,e){e=t.exports=go,e.log=o,e.formatArgs=n,e.save=c,e.load=l,e.useColors=r,e.storage=typeof chrome<"u"&&typeof chrome.storage<"u"?chrome.storage.local:p(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&window.process.type==="renderer"?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}e.formatters.j=function(f){try{return JSON.stringify(f)}catch(i){return"[UnexpectedJSONParseError]: "+i.message}};function n(f){var i=this.useColors;if(f[0]=(i?"%c":"")+this.namespace+(i?" %c":" ")+f[0]+(i?"%c ":" ")+"+"+e.humanize(this.diff),!!i){var u="color: "+this.color;f.splice(1,0,u,"color: inherit");var h=0,a=0;f[0].replace(/%[a-zA-Z%]/g,function(s){s!=="%%"&&(h++,s==="%c"&&(a=h))}),f.splice(a,0,u)}}function o(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function c(f){try{f==null?e.storage.removeItem("debug"):e.storage.debug=f}catch{}}function l(){var f;try{f=e.storage.debug}catch{}return!f&&typeof process<"u"&&"env"in process&&(f=process.env.DEBUG),f}e.enable(l());function p(){try{return window.localStorage}catch{}}})(It,It.exports);var at=It.exports,Fr=Xt(),mo=Ee,Ur=Ce,vo=it,Co=_r,ae=at("engine.io-client:polling"),Dr=pe,bo=function(){var t=qt,e=new t({xdomain:!1});return e.responseType!=null}();function pe(t){var e=t&&t.forceBase64;(!bo||e)&&(this.supportsBinary=!1),Fr.call(this,t)}vo(pe,Fr);pe.prototype.name="polling";pe.prototype.doOpen=function(){this.poll()};pe.prototype.pause=function(t){var e=this;this.readyState="pausing";function r(){ae("paused"),e.readyState="paused",t()}if(this.polling||!this.writable){var n=0;this.polling&&(ae("we are currently polling - waiting to pause"),n++,this.once("pollComplete",function(){ae("pre-pause polling complete"),--n||r()})),this.writable||(ae("we are currently writing - waiting to pause"),n++,this.once("drain",function(){ae("pre-pause writing complete"),--n||r()}))}else r()};pe.prototype.poll=function(){ae("polling"),this.polling=!0,this.doPoll(),this.emit("poll")};pe.prototype.onData=function(t){var e=this;ae("polling got data %s",t);var r=function(n,o,c){if(e.readyState==="opening"&&n.type==="open"&&e.onOpen(),n.type==="close")return e.onClose(),!1;e.onPacket(n)};Ur.decodePayload(t,this.socket.binaryType,r),this.readyState!=="closed"&&(this.polling=!1,this.emit("pollComplete"),this.readyState==="open"?this.poll():ae('ignoring poll - transport state "%s"',this.readyState))};pe.prototype.doClose=function(){var t=this;function e(){ae("writing close packet"),t.write([{type:"close"}])}this.readyState==="open"?(ae("transport open - closing"),e()):(ae("transport not open - deferring close"),this.once("open",e))};pe.prototype.write=function(t){var e=this;this.writable=!1;var r=function(){e.writable=!0,e.emit("drain")};Ur.encodePayload(t,this.supportsBinary,function(n){e.doWrite(n,r)})};pe.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",r="";this.timestampRequests!==!1&&(t[this.timestampParam]=Co()),!this.supportsBinary&&!t.sid&&(t.b64=1),t=mo.encode(t),this.port&&(e==="https"&&Number(this.port)!==443||e==="http"&&Number(this.port)!==80)&&(r=":"+this.port),t.length&&(t="?"+t);var n=this.hostname.indexOf(":")!==-1;return e+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+t};var ko=qt,Pr=Dr,wo=Se,So=it,_t=at("engine.io-client:polling-xhr"),Eo=Mt;zt.exports=Ae;zt.exports.Request=Q;function or(){}function Ae(t){if(Pr.call(this,t),this.requestTimeout=t.requestTimeout,this.extraHeaders=t.extraHeaders,typeof location<"u"){var e=location.protocol==="https:",r=location.port;r||(r=e?443:80),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port,this.xs=t.secure!==e}}So(Ae,Pr);Ae.prototype.supportsBinary=!0;Ae.prototype.request=function(t){return t=t||{},t.uri=this.uri(),t.xd=this.xd,t.xs=this.xs,t.agent=this.agent||!1,t.supportsBinary=this.supportsBinary,t.enablesXDR=this.enablesXDR,t.withCredentials=this.withCredentials,t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,t.requestTimeout=this.requestTimeout,t.extraHeaders=this.extraHeaders,new Q(t)};Ae.prototype.doWrite=function(t,e){var r=typeof t!="string"&&t!==void 0,n=this.request({method:"POST",data:t,isBinary:r}),o=this;n.on("success",e),n.on("error",function(c){o.onError("xhr post error",c)}),this.sendXhr=n};Ae.prototype.doPoll=function(){_t("xhr poll");var t=this.request(),e=this;t.on("data",function(r){e.onData(r)}),t.on("error",function(r){e.onError("xhr poll error",r)}),this.pollXhr=t};function Q(t){this.method=t.method||"GET",this.uri=t.uri,this.xd=!!t.xd,this.xs=!!t.xs,this.async=t.async!==!1,this.data=t.data!==void 0?t.data:null,this.agent=t.agent,this.isBinary=t.isBinary,this.supportsBinary=t.supportsBinary,this.enablesXDR=t.enablesXDR,this.withCredentials=t.withCredentials,this.requestTimeout=t.requestTimeout,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized,this.extraHeaders=t.extraHeaders,this.create()}wo(Q.prototype);Q.prototype.create=function(){var t={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};t.pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized;var e=this.xhr=new ko(t),r=this;try{_t("xhr open %s: %s",this.method,this.uri),e.open(this.method,this.uri,this.async);try{if(this.extraHeaders){e.setDisableHeaderCheck&&e.setDisableHeaderCheck(!0);for(var n in this.extraHeaders)this.extraHeaders.hasOwnProperty(n)&&e.setRequestHeader(n,this.extraHeaders[n])}}catch{}if(this.method==="POST")try{this.isBinary?e.setRequestHeader("Content-type","application/octet-stream"):e.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{e.setRequestHeader("Accept","*/*")}catch{}"withCredentials"in e&&(e.withCredentials=this.withCredentials),this.requestTimeout&&(e.timeout=this.requestTimeout),this.hasXDR()?(e.onload=function(){r.onLoad()},e.onerror=function(){r.onError(e.responseText)}):e.onreadystatechange=function(){if(e.readyState===2)try{var o=e.getResponseHeader("Content-Type");(r.supportsBinary&&o==="application/octet-stream"||o==="application/octet-stream; charset=UTF-8")&&(e.responseType="arraybuffer")}catch{}e.readyState===4&&(e.status===200||e.status===1223?r.onLoad():setTimeout(function(){r.onError(typeof e.status=="number"?e.status:0)},0))},_t("xhr data %s",this.data),e.send(this.data)}catch(o){setTimeout(function(){r.onError(o)},0);return}typeof document<"u"&&(this.index=Q.requestsCount++,Q.requests[this.index]=this)};Q.prototype.onSuccess=function(){this.emit("success"),this.cleanup()};Q.prototype.onData=function(t){this.emit("data",t),this.onSuccess()};Q.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)};Q.prototype.cleanup=function(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=or:this.xhr.onreadystatechange=or,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Q.requests[this.index],this.xhr=null}};Q.prototype.onLoad=function(){var t;try{var e;try{e=this.xhr.getResponseHeader("Content-Type")}catch{}e==="application/octet-stream"||e==="application/octet-stream; charset=UTF-8"?t=this.xhr.response||this.xhr.responseText:t=this.xhr.responseText}catch(r){this.onError(r)}t!=null&&this.onData(t)};Q.prototype.hasXDR=function(){return typeof XDomainRequest<"u"&&!this.xs&&this.enablesXDR};Q.prototype.abort=function(){this.cleanup()};Q.requestsCount=0;Q.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",sr);else if(typeof addEventListener=="function"){var Ao="onpagehide"in Eo?"pagehide":"unload";addEventListener(Ao,sr,!1)}}function sr(){for(var t in Q.requests)Q.requests.hasOwnProperty(t)&&Q.requests[t].abort()}var To=zt.exports,Gt=Dr,No=it,ir=Mt,Oo=Te,xo=/\n/g,Ro=/\\n/g,Ve;function Lo(){}function Te(t){Gt.call(this,t),this.query=this.query||{},Ve||(Ve=ir.___eio=ir.___eio||[]),this.index=Ve.length;var e=this;Ve.push(function(r){e.onData(r)}),this.query.j=this.index,typeof addEventListener=="function"&&addEventListener("beforeunload",function(){e.script&&(e.script.onerror=Lo)},!1)}No(Te,Gt);Te.prototype.supportsBinary=!1;Te.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),Gt.prototype.doClose.call(this)};Te.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(o){t.onError("jsonp poll error",o)};var r=document.getElementsByTagName("script")[0];r?r.parentNode.insertBefore(e,r):(document.head||document.body).appendChild(e),this.script=e;var n=typeof navigator<"u"&&/gecko/i.test(navigator.userAgent);n&&setTimeout(function(){var o=document.createElement("iframe");document.body.appendChild(o),document.body.removeChild(o)},100)};Te.prototype.doWrite=function(t,e){var r=this;if(!this.form){var n=document.createElement("form"),o=document.createElement("textarea"),c=this.iframeId="eio_iframe_"+this.index,l;n.className="socketio",n.style.position="absolute",n.style.top="-1000px",n.style.left="-1000px",n.target=c,n.method="POST",n.setAttribute("accept-charset","utf-8"),o.name="d",n.appendChild(o),document.body.appendChild(n),this.form=n,this.area=o}this.form.action=this.uri();function p(){f(),e()}function f(){if(r.iframe)try{r.form.removeChild(r.iframe)}catch(u){r.onError("jsonp polling iframe removal error",u)}try{var i='<iframe src="javascript:0" name="'+r.iframeId+'">';l=document.createElement(i)}catch{l=document.createElement("iframe"),l.name=r.iframeId,l.src="javascript:0"}l.id=r.iframeId,r.form.appendChild(l),r.iframe=l}f(),t=t.replace(Ro,`\\
19
- `),this.area.value=t.replace(xo,"\\n");try{this.form.submit()}catch{}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){r.iframe.readyState==="complete"&&p()}:this.iframe.onload=p};const Io={},Bo=Object.freeze(Object.defineProperty({__proto__:null,default:Io},Symbol.toStringTag,{value:"Module"})),_o=gn(Bo);var Jt=Xt(),Fo=Ce,Uo=Ee,Do=it,Po=_r,jo=at("engine.io-client:websocket"),tt,Ht;typeof WebSocket<"u"?tt=WebSocket:typeof self<"u"&&(tt=self.WebSocket||self.MozWebSocket);if(typeof window>"u")try{Ht=_o}catch{}var we=tt||Ht,Mo=se;function se(t){var e=t&&t.forceBase64;e&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=tt&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(we=Ht),Jt.call(this,t)}Do(se,Jt);se.prototype.name="websocket";se.prototype.supportsBinary=!0;se.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,r={};this.isReactNative||(r.agent=this.agent,r.perMessageDeflate=this.perMessageDeflate,r.pfx=this.pfx,r.key=this.key,r.passphrase=this.passphrase,r.cert=this.cert,r.ca=this.ca,r.ciphers=this.ciphers,r.rejectUnauthorized=this.rejectUnauthorized),this.extraHeaders&&(r.headers=this.extraHeaders),this.localAddress&&(r.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket&&!this.isReactNative?e?new we(t,e):new we(t):new we(t,e,r)}catch(n){return this.emit("error",n)}this.ws.binaryType===void 0&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}};se.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}};se.prototype.write=function(t){var e=this;this.writable=!1;for(var r=t.length,n=0,o=r;n<o;n++)(function(l){Fo.encodePacket(l,e.supportsBinary,function(p){if(!e.usingBrowserWebSocket){var f={};if(l.options&&(f.compress=l.options.compress),e.perMessageDeflate){var i=typeof p=="string"?Buffer.byteLength(p):p.length;i<e.perMessageDeflate.threshold&&(f.compress=!1)}}try{e.usingBrowserWebSocket?e.ws.send(p):e.ws.send(p,f)}catch{jo("websocket closed before onclose event")}--r||c()})})(t[n]);function c(){e.emit("flush"),setTimeout(function(){e.writable=!0,e.emit("drain")},0)}};se.prototype.onClose=function(){Jt.prototype.onClose.call(this)};se.prototype.doClose=function(){typeof this.ws<"u"&&this.ws.close()};se.prototype.uri=function(){var t=this.query||{},e=this.secure?"wss":"ws",r="";this.port&&(e==="wss"&&Number(this.port)!==443||e==="ws"&&Number(this.port)!==80)&&(r=":"+this.port),this.timestampRequests&&(t[this.timestampParam]=Po()),this.supportsBinary||(t.b64=1),t=Uo.encode(t),t.length&&(t="?"+t);var n=this.hostname.indexOf(":")!==-1;return e+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+t};se.prototype.check=function(){return!!we&&!("__initialize"in we&&this.name===se.prototype.name)};var qo=qt,zo=To,Xo=Oo,Wo=Mo;st.polling=Go;st.websocket=Wo;function Go(t){var e,r=!1,n=!1,o=t.jsonp!==!1;if(typeof location<"u"){var c=location.protocol==="https:",l=location.port;l||(l=c?443:80),r=t.hostname!==location.hostname||l!==t.port,n=t.secure!==c}if(t.xdomain=r,t.xscheme=n,e=new qo(t),"open"in e&&!t.forceJSONP)return new zo(t);if(!o)throw new Error("JSONP disabled");return new Xo(t)}var Jo=[].indexOf,jr=function(t,e){if(Jo)return t.indexOf(e);for(var r=0;r<t.length;++r)if(t[r]===e)return r;return-1},Ho=st,$o=Se,Y=at("engine.io-client:socket"),Vo=jr,Mr=Ce,ar=Sr,Ko=Ee,Yo=G;function G(t,e){if(!(this instanceof G))return new G(t,e);e=e||{},t&&typeof t=="object"&&(e=t,t=null),t?(t=ar(t),e.hostname=t.host,e.secure=t.protocol==="https"||t.protocol==="wss",e.port=t.port,t.query&&(e.query=t.query)):e.host&&(e.hostname=ar(e.host).host),this.secure=e.secure!=null?e.secure:typeof location<"u"&&location.protocol==="https:",e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.agent=e.agent||!1,this.hostname=e.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=e.port||(typeof location<"u"&&location.port?location.port:this.secure?443:80),this.query=e.query||{},typeof this.query=="string"&&(this.query=Ko.decode(this.query)),this.upgrade=e.upgrade!==!1,this.path=(e.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!e.forceJSONP,this.jsonp=e.jsonp!==!1,this.forceBase64=!!e.forceBase64,this.enablesXDR=!!e.enablesXDR,this.withCredentials=e.withCredentials!==!1,this.timestampParam=e.timestampParam||"t",this.timestampRequests=e.timestampRequests,this.transports=e.transports||["polling","websocket"],this.transportOptions=e.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=e.policyPort||843,this.rememberUpgrade=e.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=e.onlyBinaryUpgrades,this.perMessageDeflate=e.perMessageDeflate!==!1?e.perMessageDeflate||{}:!1,this.perMessageDeflate===!0&&(this.perMessageDeflate={}),this.perMessageDeflate&&this.perMessageDeflate.threshold==null&&(this.perMessageDeflate.threshold=1024),this.pfx=e.pfx||void 0,this.key=e.key||void 0,this.passphrase=e.passphrase||void 0,this.cert=e.cert||void 0,this.ca=e.ca||void 0,this.ciphers=e.ciphers||void 0,this.rejectUnauthorized=e.rejectUnauthorized===void 0?!0:e.rejectUnauthorized,this.forceNode=!!e.forceNode,this.isReactNative=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",(typeof self>"u"||this.isReactNative)&&(e.extraHeaders&&Object.keys(e.extraHeaders).length>0&&(this.extraHeaders=e.extraHeaders),e.localAddress&&(this.localAddress=e.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}G.priorWebsocketSuccess=!1;$o(G.prototype);G.protocol=Mr.protocol;G.Socket=G;G.Transport=Xt();G.transports=st;G.parser=Ce;G.prototype.createTransport=function(t){Y('creating transport "%s"',t);var e=Qo(this.query);e.EIO=Mr.protocol,e.transport=t;var r=this.transportOptions[t]||{};this.id&&(e.sid=this.id);var n=new Ho[t]({query:e,socket:this,agent:r.agent||this.agent,hostname:r.hostname||this.hostname,port:r.port||this.port,secure:r.secure||this.secure,path:r.path||this.path,forceJSONP:r.forceJSONP||this.forceJSONP,jsonp:r.jsonp||this.jsonp,forceBase64:r.forceBase64||this.forceBase64,enablesXDR:r.enablesXDR||this.enablesXDR,withCredentials:r.withCredentials||this.withCredentials,timestampRequests:r.timestampRequests||this.timestampRequests,timestampParam:r.timestampParam||this.timestampParam,policyPort:r.policyPort||this.policyPort,pfx:r.pfx||this.pfx,key:r.key||this.key,passphrase:r.passphrase||this.passphrase,cert:r.cert||this.cert,ca:r.ca||this.ca,ciphers:r.ciphers||this.ciphers,rejectUnauthorized:r.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:r.perMessageDeflate||this.perMessageDeflate,extraHeaders:r.extraHeaders||this.extraHeaders,forceNode:r.forceNode||this.forceNode,localAddress:r.localAddress||this.localAddress,requestTimeout:r.requestTimeout||this.requestTimeout,protocols:r.protocols||void 0,isReactNative:this.isReactNative});return n};function Qo(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}G.prototype.open=function(){var t;if(this.rememberUpgrade&&G.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else if(this.transports.length===0){var e=this;setTimeout(function(){e.emit("error","No transports available")},0);return}else t=this.transports[0];this.readyState="opening";try{t=this.createTransport(t)}catch{this.transports.shift(),this.open();return}t.open(),this.setTransport(t)};G.prototype.setTransport=function(t){Y("setting transport %s",t.name);var e=this;this.transport&&(Y("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(r){e.onPacket(r)}).on("error",function(r){e.onError(r)}).on("close",function(){e.onClose("transport close")})};G.prototype.probe=function(t){Y('probing transport "%s"',t);var e=this.createTransport(t,{probe:1}),r=!1,n=this;G.priorWebsocketSuccess=!1;function o(){if(n.onlyBinaryUpgrades){var h=!this.supportsBinary&&n.transport.supportsBinary;r=r||h}r||(Y('probe transport "%s" opened',t),e.send([{type:"ping",data:"probe"}]),e.once("packet",function(a){if(!r)if(a.type==="pong"&&a.data==="probe"){if(Y('probe transport "%s" pong',t),n.upgrading=!0,n.emit("upgrading",e),!e)return;G.priorWebsocketSuccess=e.name==="websocket",Y('pausing current transport "%s"',n.transport.name),n.transport.pause(function(){r||n.readyState!=="closed"&&(Y("changing transport and sending upgrade packet"),u(),n.setTransport(e),e.send([{type:"upgrade"}]),n.emit("upgrade",e),e=null,n.upgrading=!1,n.flush())})}else{Y('probe transport "%s" failed',t);var s=new Error("probe error");s.transport=e.name,n.emit("upgradeError",s)}}))}function c(){r||(r=!0,u(),e.close(),e=null)}function l(h){var a=new Error("probe error: "+h);a.transport=e.name,c(),Y('probe transport "%s" failed because of error: %s',t,h),n.emit("upgradeError",a)}function p(){l("transport closed")}function f(){l("socket closed")}function i(h){e&&h.name!==e.name&&(Y('"%s" works - aborting "%s"',h.name,e.name),c())}function u(){e.removeListener("open",o),e.removeListener("error",l),e.removeListener("close",p),n.removeListener("close",f),n.removeListener("upgrading",i)}e.once("open",o),e.once("error",l),e.once("close",p),this.once("close",f),this.once("upgrading",i),e.open()};G.prototype.onOpen=function(){if(Y("socket open"),this.readyState="open",G.priorWebsocketSuccess=this.transport.name==="websocket",this.emit("open"),this.flush(),this.readyState==="open"&&this.upgrade&&this.transport.pause){Y("starting upgrade probes");for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}};G.prototype.onPacket=function(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(Y('socket receive: type "%s", data "%s"',t.type,t.data),this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var e=new Error("server error");e.code=t.data,this.onError(e);break;case"message":this.emit("data",t.data),this.emit("message",t.data);break}else Y('packet received with socket readyState "%s"',this.readyState)};G.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),this.readyState!=="closed"&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))};G.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout(function(){e.readyState!=="closed"&&e.onClose("ping timeout")},t||e.pingInterval+e.pingTimeout)};G.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){Y("writing ping packet - expecting pong within %sms",t.pingTimeout),t.ping(),t.onHeartbeat(t.pingTimeout)},t.pingInterval)};G.prototype.ping=function(){var t=this;this.sendPacket("ping",function(){t.emit("ping")})};G.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emit("drain"):this.flush()};G.prototype.flush=function(){this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(Y("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))};G.prototype.write=G.prototype.send=function(t,e,r){return this.sendPacket("message",t,e,r),this};G.prototype.sendPacket=function(t,e,r,n){if(typeof e=="function"&&(n=e,e=void 0),typeof r=="function"&&(n=r,r=null),!(this.readyState==="closing"||this.readyState==="closed")){r=r||{},r.compress=r.compress!==!1;var o={type:t,data:e,options:r};this.emit("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}};G.prototype.close=function(){if(this.readyState==="opening"||this.readyState==="open"){this.readyState="closing";var t=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?n():e()}):this.upgrading?n():e()}function e(){t.onClose("forced close"),Y("socket closing - telling transport to close"),t.transport.close()}function r(){t.removeListener("upgrade",r),t.removeListener("upgradeError",r),e()}function n(){t.once("upgrade",r),t.once("upgradeError",r)}return this};G.prototype.onError=function(t){Y("socket error %j",t),G.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)};G.prototype.onClose=function(t,e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){Y('socket close with reason: "%s"',t);var r=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",t,e),r.writeBuffer=[],r.prevBufferLen=0}};G.prototype.filterUpgrades=function(t){for(var e=[],r=0,n=t.length;r<n;r++)~Vo(this.transports,t[r])&&e.push(t[r]);return e};jt.exports=Yo;jt.exports.parser=Ce;var Zo=jt.exports,qr={exports:{}},es=ts;function ts(t,e){var r=[];e=e||0;for(var n=e||0;n<t.length;n++)r[n-e]=t[n];return r}var zr=rs;function rs(t,e,r){return t.on(e,r),{destroy:function(){t.removeListener(e,r)}}}var cr=[].slice,Xr=function(t,e){if(typeof e=="string"&&(e=t[e]),typeof e!="function")throw new Error("bind() requires a function");var r=cr.call(arguments,2);return function(){return e.apply(t,r.concat(cr.call(arguments)))}};(function(t,e){var r=nt,n=Se,o=es,c=zr,l=Xr,p=rt("socket.io-client:socket"),f=Ee,i=xr;t.exports=a;var u={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},h=n.prototype.emit;function a(s,d,y){this.io=s,this.nsp=d,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},y&&y.query&&(this.query=y.query),this.io.autoConnect&&this.open()}n(a.prototype),a.prototype.subEvents=function(){if(!this.subs){var s=this.io;this.subs=[c(s,"open",l(this,"onopen")),c(s,"packet",l(this,"onpacket")),c(s,"close",l(this,"onclose"))]}},a.prototype.open=a.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.reconnecting||this.io.open(),this.io.readyState==="open"&&this.onopen(),this.emit("connecting"),this)},a.prototype.send=function(){var s=o(arguments);return s.unshift("message"),this.emit.apply(this,s),this},a.prototype.emit=function(s){if(u.hasOwnProperty(s))return h.apply(this,arguments),this;var d=o(arguments),y={type:(this.flags.binary!==void 0?this.flags.binary:i(d))?r.BINARY_EVENT:r.EVENT,data:d};return y.options={},y.options.compress=!this.flags||this.flags.compress!==!1,typeof d[d.length-1]=="function"&&(p("emitting packet with ack id %d",this.ids),this.acks[this.ids]=d.pop(),y.id=this.ids++),this.connected?this.packet(y):this.sendBuffer.push(y),this.flags={},this},a.prototype.packet=function(s){s.nsp=this.nsp,this.io.packet(s)},a.prototype.onopen=function(){if(p("transport is open - connecting"),this.nsp!=="/")if(this.query){var s=typeof this.query=="object"?f.encode(this.query):this.query;p("sending connect packet with query %s",s),this.packet({type:r.CONNECT,query:s})}else this.packet({type:r.CONNECT})},a.prototype.onclose=function(s){p("close (%s)",s),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",s)},a.prototype.onpacket=function(s){var d=s.nsp===this.nsp,y=s.type===r.ERROR&&s.nsp==="/";if(!(!d&&!y))switch(s.type){case r.CONNECT:this.onconnect();break;case r.EVENT:this.onevent(s);break;case r.BINARY_EVENT:this.onevent(s);break;case r.ACK:this.onack(s);break;case r.BINARY_ACK:this.onack(s);break;case r.DISCONNECT:this.ondisconnect();break;case r.ERROR:this.emit("error",s.data);break}},a.prototype.onevent=function(s){var d=s.data||[];p("emitting event %j",d),s.id!=null&&(p("attaching ack callback to event"),d.push(this.ack(s.id))),this.connected?h.apply(this,d):this.receiveBuffer.push(d)},a.prototype.ack=function(s){var d=this,y=!1;return function(){if(!y){y=!0;var m=o(arguments);p("sending ack %j",m),d.packet({type:i(m)?r.BINARY_ACK:r.ACK,id:s,data:m})}}},a.prototype.onack=function(s){var d=this.acks[s.id];typeof d=="function"?(p("calling ack %s with %j",s.id,s.data),d.apply(this,s.data),delete this.acks[s.id]):p("bad ack %s",s.id)},a.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emitBuffered(),this.emit("connect")},a.prototype.emitBuffered=function(){var s;for(s=0;s<this.receiveBuffer.length;s++)h.apply(this,this.receiveBuffer[s]);for(this.receiveBuffer=[],s=0;s<this.sendBuffer.length;s++)this.packet(this.sendBuffer[s]);this.sendBuffer=[]},a.prototype.ondisconnect=function(){p("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},a.prototype.destroy=function(){if(this.subs){for(var s=0;s<this.subs.length;s++)this.subs[s].destroy();this.subs=null}this.io.destroy(this)},a.prototype.close=a.prototype.disconnect=function(){return this.connected&&(p("performing disconnect (%s)",this.nsp),this.packet({type:r.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},a.prototype.compress=function(s){return this.flags.compress=s,this},a.prototype.binary=function(s){return this.flags.binary=s,this}})(qr);var Wr=qr.exports,ns=Ne;function Ne(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}Ne.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),r=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+r:t-r}return Math.min(t,this.max)|0};Ne.prototype.reset=function(){this.attempts=0};Ne.prototype.setMin=function(t){this.ms=t};Ne.prototype.setMax=function(t){this.max=t};Ne.prototype.setJitter=function(t){this.jitter=t};var os=Zo,ss=Wr,is=Se,as=nt,ye=zr,ke=Xr,ee=rt("socket.io-client:manager"),Gr=jr,cs=ns,Jr=Object.prototype.hasOwnProperty,hr=H;function H(t,e){if(!(this instanceof H))return new H(t,e);t&&typeof t=="object"&&(e=t,t=void 0),e=e||{},e.path=e.path||"/socket.io",this.nsps={},this.subs=[],this.opts=e,this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor(e.randomizationFactor||.5),this.backoff=new cs({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(e.timeout==null?2e4:e.timeout),this.readyState="closed",this.uri=t,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var r=e.parser||as;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=e.autoConnect!==!1,this.autoConnect&&this.open()}H.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var t in this.nsps)Jr.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)};H.prototype.updateSocketIds=function(){for(var t in this.nsps)Jr.call(this.nsps,t)&&(this.nsps[t].id=this.generateId(t))};H.prototype.generateId=function(t){return(t==="/"?"":t+"#")+this.engine.id};is(H.prototype);H.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection};H.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts};H.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay};H.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor};H.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax};H.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout};H.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()};H.prototype.open=H.prototype.connect=function(t,e){if(ee("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;ee("opening %s",this.uri),this.engine=os(this.uri,this.opts);var r=this.engine,n=this;this.readyState="opening",this.skipReconnect=!1;var o=ye(r,"open",function(){n.onopen(),t&&t()}),c=ye(r,"error",function(f){if(ee("connect_error"),n.cleanup(),n.readyState="closed",n.emitAll("connect_error",f),t){var i=new Error("Connection error");i.data=f,t(i)}else n.maybeReconnectOnOpen()});if(this._timeout!==!1){var l=this._timeout;ee("connect attempt will timeout after %d",l),l===0&&o.destroy();var p=setTimeout(function(){ee("connect attempt timed out after %d",l),o.destroy(),r.close(),r.emit("error","timeout"),n.emitAll("connect_timeout",l)},l);this.subs.push({destroy:function(){clearTimeout(p)}})}return this.subs.push(o),this.subs.push(c),this};H.prototype.onopen=function(){ee("open"),this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(ye(t,"data",ke(this,"ondata"))),this.subs.push(ye(t,"ping",ke(this,"onping"))),this.subs.push(ye(t,"pong",ke(this,"onpong"))),this.subs.push(ye(t,"error",ke(this,"onerror"))),this.subs.push(ye(t,"close",ke(this,"onclose"))),this.subs.push(ye(this.decoder,"decoded",ke(this,"ondecoded")))};H.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")};H.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)};H.prototype.ondata=function(t){this.decoder.add(t)};H.prototype.ondecoded=function(t){this.emit("packet",t)};H.prototype.onerror=function(t){ee("error",t),this.emitAll("error",t)};H.prototype.socket=function(t,e){var r=this.nsps[t];if(!r){r=new ss(this,t,e),this.nsps[t]=r;var n=this;r.on("connecting",o),r.on("connect",function(){r.id=n.generateId(t)}),this.autoConnect&&o()}function o(){~Gr(n.connecting,r)||n.connecting.push(r)}return r};H.prototype.destroy=function(t){var e=Gr(this.connecting,t);~e&&this.connecting.splice(e,1),!this.connecting.length&&this.close()};H.prototype.packet=function(t){ee("writing packet %j",t);var e=this;t.query&&t.type===0&&(t.nsp+="?"+t.query),e.encoding?e.packetBuffer.push(t):(e.encoding=!0,this.encoder.encode(t,function(r){for(var n=0;n<r.length;n++)e.engine.write(r[n],t.options);e.encoding=!1,e.processPacketQueue()}))};H.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}};H.prototype.cleanup=function(){ee("cleanup");for(var t=this.subs.length,e=0;e<t;e++){var r=this.subs.shift();r.destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()};H.prototype.close=H.prototype.disconnect=function(){ee("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,this.readyState==="opening"&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()};H.prototype.onclose=function(t){ee("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()};H.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)ee("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();ee("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var r=setTimeout(function(){t.skipReconnect||(ee("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),!t.skipReconnect&&t.open(function(n){n?(ee("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",n.data)):(ee("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(r)}})}};H.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)};(function(t,e){var r=On,n=nt,o=hr,c=rt("socket.io-client");t.exports=e=p;var l=e.managers={};function p(f,i){typeof f=="object"&&(i=f,f=void 0),i=i||{};var u=r(f),h=u.source,a=u.id,s=u.path,d=l[a]&&s in l[a].nsps,y=i.forceNew||i["force new connection"]||i.multiplex===!1||d,m;return y?(c("ignoring socket cache for %s",h),m=o(h,i)):(l[a]||(c("new io instance for %s",h),l[a]=o(h,i)),m=l[a]),u.query&&!i.query&&(i.query=u.query),m.socket(u.path,i)}e.protocol=n.protocol,e.connect=p,e.Manager=hr,e.Socket=Wr})(St,St.exports);var hs=St.exports;const us=yn(hs);let Ke;const ps=new Uint8Array(16);function ls(){if(!Ke&&(Ke=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ke))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ke(ps)}const Z=[];for(let t=0;t<256;++t)Z.push((t+256).toString(16).slice(1));function fs(t,e=0){return Z[t[e+0]]+Z[t[e+1]]+Z[t[e+2]]+Z[t[e+3]]+"-"+Z[t[e+4]]+Z[t[e+5]]+"-"+Z[t[e+6]]+Z[t[e+7]]+"-"+Z[t[e+8]]+Z[t[e+9]]+"-"+Z[t[e+10]]+Z[t[e+11]]+Z[t[e+12]]+Z[t[e+13]]+Z[t[e+14]]+Z[t[e+15]]}const ds=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ur={randomUUID:ds};function ys(t,e,r){if(ur.randomUUID&&!t)return ur.randomUUID();t=t||{};const n=t.random||(t.rng||ls)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,fs(n)}function gs(t,e){const r=e.map(o=>JSON.stringify(o)).join(" "),n=new Date().toISOString();return JSON.stringify({level:t,time:n,message:r})}function ms(t,e){const r=JSON.parse(t);return e.forEach(n=>delete r[n]),r}function vs(t){if(typeof t=="object"&&t!==null)return t;try{return JSON.parse(t)}catch{return{extraData:t}}}function Cs(t){const e=/\(([^)]+)\)/,r=t.match(e);if(r&&r[1]){const n=r[1].split(";");for(let o of n)if(o=o.trim(),o.startsWith("Windows")||o.startsWith("Macintosh")||o.startsWith("Linux"))return o}return"Unknown"}function pr(t){return(...e)=>new Promise((r,n)=>{try{const o=t(...e);r(o)}catch(o){n(o)}})}const bs={reconnection:!0,reconnectionDelay:5e3,reconnectionAttempts:10,upgrade:!1,transports:["websocket"],debug:!1},bt={logToConsole:!0,overloadGlobalConsole:!1,socketEmitInterval:6e4},ce={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"},ks={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},he={INFO:"info",WARNING:"warning",MODIFY:"modify",ERROR:"error",VIEW:"view"},W={INFO:"info",WARNING:"warning",ERROR:"error",DEBUG:"debug"};let re=console;class ws{constructor(e){$(this,"logToConsole"),$(this,"overloadGlobalConsole"),$(this,"system"),$(this,"socketEmitInterval"),$(this,"storageId"),$(this,"loggerLevel",W.DEBUG),$(this,"loggerLevelMap",{[W.DEBUG]:[W.DEBUG,W.INFO,W.WARNING,W.ERROR],[W.INFO]:[W.INFO,W.WARNING,W.ERROR],[W.WARNING]:[W.WARNING,W.ERROR],[W.ERROR]:[W.ERROR]}),$(this,"emitInProgress"),$(this,"queue"),$(this,"processing"),$(this,"storageInitialized"),$(this,"interval"),$(this,"logIndex"),$(this,"socket"),$(this,"requestUrl"),$(this,"staticObject",{}),$(this,"localObject",{}),$(this,"isGetItemAsync"),$(this,"isSetItemAsync"),$(this,"getItem"),$(this,"setItem"),$(this,"parseLog"),$(this,"_logMethod"),$(this,"_warnMethod"),$(this,"_errorMethod"),$(this,"_debugMethod");const{loggerOptions:r}=e;if(!r.system)throw new Error("Config property 'system' should be provided!");this.isGetItemAsync=r.isGetItemAsync||!1,this.isSetItemAsync=r.isSetItemAsync||!1,this.setupStorageFunctions(r.getItem,r.setItem,r.parseLog),this.system=r.system,r.loggerLevel&&(this.loggerLevel=r.loggerLevel),this.socketEmitInterval=r.socketEmitInterval||bt.socketEmitInterval,this.logToConsole=r.logToConsole!==void 0?r.logToConsole:bt.logToConsole,this.overloadGlobalConsole=r.overloadGlobalConsole!==void 0?r.overloadGlobalConsole:bt.overloadGlobalConsole,this.storageId=this.getStorageName(),this.queue=[],this.processing=!1,this.storageInitialized=!1,this.emitInProgress=!1,this.logIndex=0,this.staticObject=r.staticObject??{},this.init(e)}get currentLoggerLevelLogLevels(){return this.loggerLevelMap[this.loggerLevel]}changeLogLevel(e){this.loggerLevel=e}isLogLevelAllowed(e){return this.currentLoggerLevelLogLevels.includes(e)}setupStorageFunctions(e,r,n){this.getItem=e&&typeof e=="function"?this.isGetItemAsync?e:pr(e):this.defaultGetItemFunction,this.setItem=r&&typeof r=="function"?this.isSetItemAsync?r:pr(r):this.defaultSetItemFunction,this.parseLog=n&&typeof n=="function"?n:gs}sendHttpRequest(e){if(!this.requestUrl)throw new Error("requestUrl is not provided");const r={Data:e};return fetch(this.requestUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}init(e){const{socket:r,url:n,requestUrl:o,socketOptions:c={}}=e;this._logMethod=re.log.bind(re),this._warnMethod=re.warn.bind(re),this._errorMethod=re.error.bind(re),this._debugMethod=re.debug.bind(re),this.initStorage().then(()=>{if(r)this.socket=r;else if(n)this.socket=this.createConnection(n,c);else if(o)this.requestUrl=o;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,r){let n={...bs};return r&&(n={...n,...r}),us(e,n)}async emitLogs(){if(!this.emitInProgress)try{const e=await this.getItem(this.storageId),r=JSON.parse(e||"{}"),n={...this.localObject,...r};if(!Object.keys(n).length)return;const o=[];this.emitInProgress=!0;const c=Object.keys(n);if(!c.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 l=[];for(const i of c){const u=vs(n[i]),h={...this.staticObject,...u},a=this.populateSendingLog(h);a.Body&&typeof a.Body=="string"&&(a.Body=JSON.parse(a.Body)),this.socket?this.socket.emit("Log",a):this.requestUrl&&l.push(a),o.push(i)}l.length&&await this.sendHttpRequest(l);const p=await this.getItem(this.storageId);if(!p)return;const f=ms(p,o);this.localObject={},await this.setItem(this.storageId,JSON.stringify(f))}catch(e){this._errorMethod(e)}finally{this.emitInProgress=!1}}populateSendingLog(e){const r={...e},n=r.ActionName;return n&&(r.ActionID=ks[n]),r}setupStaticFields(e){this.staticObject={...e}}populateMetaData(){const e=new Date;let r;typeof window<"u"&&typeof window.document<"u"?r=window==null?void 0:window.navigator.userAgent:typeof self<"u"&&self.navigator&&(r=self.navigator.userAgent);let n;return r&&(n=Cs(r)),{System:this.system,DateTime:e,UserAgent:r,OSVersion:n}}async stop(){!this.socket||!this.socket.connected||(clearInterval(this.interval),await this.emitLogs(),this.socket.disconnect())}async start(){var e;this.socket&&this.socket.connected||((e=this.socket)==null||e.connect(),this.interval=setInterval(async()=>{await this.emitLogs()},this.socketEmitInterval))}_overloadConsole(){re=Object.assign(re,{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=ys();return this.system.toString().toUpperCase()+e+Date.now()}async processLog(...e){try{if(e.length<2)return;const r=e[0],n=e[1],o=this.formItemKey(r);if(!this.storageInitialized){this.localObject={...this.localObject,[o]:n};return}const c=await this.getItem(this.storageId);if(!c)return;const l=JSON.parse(c);l[o]=JSON.stringify(n),await this.setItem(this.storageId,JSON.stringify(l))}catch(r){this._errorMethod(r)}}async processQueue(){if(this.processing||this.queue.length===0)return;const e=this.queue.shift();e&&(this.processing=!0,await this.processLog(...e).finally(()=>{this.processing=!1,this.processQueue()}))}log(e){if(!this.isLogLevelAllowed(W.INFO))return;const r={...this.populateMetaData(),...e},n=["INFO",r];this.queue.push(n),this.logToConsole&&this._logMethod.apply(re,[r]),this.processQueue()}warn(e){if(!this.isLogLevelAllowed(W.WARNING))return;const r=["WARN",e];this.queue.push(r),this.logToConsole&&this._warnMethod.apply(re,[e]),this.processQueue()}error(e){if(!this.isLogLevelAllowed(W.ERROR))return;const r=["ERROR",e];this.queue.push(r),this.logToConsole&&this._errorMethod.apply(re,[e]),this.processQueue()}debug(e){if(!this.isLogLevelAllowed(W.DEBUG))return;const r=["DEBUG",e];this.queue.push(r),this.logToConsole&&this._debugMethod.apply(re,[e]),this.processQueue()}async defaultGetItemFunction(e){return localStorage.getItem(e)}async defaultSetItemFunction(e,r){try{localStorage.setItem(e,r)}catch(n){this._errorMethod(n)}}formItemKey(e){const r=new Date().toISOString();return this.logIndex++,`${e}-${this.system}-${r}-${this.logIndex}`}}class Ss{constructor(e){J(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 ws({socket:e,loggerOptions:this.eventsSdkClass.options.loggerConfig}))}async start(){this.storageLogger&&await this.storageLogger.start()}stop(){this.storageLogger&&this.storageLogger.stop()}log(e){if(this.eventsSdkClass.options.useLogger)if(this.storageLogger)switch(e.Level){case W.INFO:this.storageLogger.log(e);break;case W.DEBUG:this.storageLogger.debug(e);break;case W.WARNING:this.storageLogger.warn(e);break;case W.ERROR:this.storageLogger.error(e)}else e.Level===W.INFO?console.log(e):e.Level===W.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:ce.WSCONNECT,isShowClient:!1,Status:"Connection established",StatusCode:200,Level:W.INFO,LogType:he.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:ce.WSCONNECT,isShowClient:!1,Status:"Connection closed",StatusCode:200,Level:W.INFO,LogType:he.INFO})}sdkAttemptToConnect(e){this.log({Message:`${this.eventsSdkClass.options.loggerConfig.system} is trying to connect to WS server ${e}`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Switching Protocols",StatusCode:101,Level:W.INFO,LogType:he.INFO})}sdkAttemptToConnectError(e){this.log({Message:`${e}`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Connection error",StatusCode:500,Level:W.ERROR,LogType:he.ERROR})}loginError(e,r,n,o){this.log({Message:`External login request error with the login type ${e} ${e===ie.TOKEN?n:o}`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"External login error",StatusCode:r||400,Level:W.ERROR,LogType:he.ERROR})}getSettingsError(e,r){this.log({Message:`Get settings error with token ${e}, error: ${r}`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:W.ERROR,LogType:he.ERROR})}refreshTokenError(e,r,n){this.log({Message:`Refresh token error with old refresh token ${e}, url: ${r}, error: ${n}`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:W.ERROR,LogType:he.ERROR})}keepAliveEmit(){this.log({Message:`Keep alive event emitted with this token: ${this.eventsSdkClass.authClass.token}`,ActionName:ce.WSCONNECT,isShowClient:!1,Level:W.INFO,LogType:he.INFO})}keepAliveResponse(e){this.log({Message:`Keep alive response: ${JSON.stringify(e)}`,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Successful",StatusCode:200,Level:W.INFO,LogType:he.INFO})}eventLog(e,r){const n={[fe.FULL]:[],[fe.BOOTSTRAP]:[j.LOGIN_STATUS,j.LOGIN_SUCCESS,j.ALL_EXTENSION_STATUS,j.ALL_DIALER_STATUS],[fe.DEBUG_EXTENSIONS]:[j.ALL_EXTENSION_STATUS,j.EXTENSION_EVENT,j.EXTENSIONS_UPDATED],[fe.DEBUG_DIALER]:[j.ALL_DIALER_STATUS,j.DIALER_EVENT],[fe.DEBUG_QUEUE]:[j.QUEUE_EVENT]};this.eventsSdkClass.options.debugOption&&(n[this.eventsSdkClass.options.debugOption].includes(e)||this.eventsSdkClass.options.debugOption===fe.FULL)&&this.log({Message:`Event name: ${e}`,Body:r,ActionName:ce.WSCONNECT,isShowClient:!1,Status:"Successful",Level:W.DEBUG,LogType:he.INFO})}}class Es{constructor(e){J(this,"listeners",{[j.ALL_EXTENSION_STATUS]:[],[j.ALL_DIALER_STATUS]:[],[j.ALL_USERS_STATUS]:[],[j.QUEUE_EVENT]:[],[j.EXTENSION_EVENT]:[],[j.DIALER_EVENT]:[],[j.LOGIN_SUCCESS]:[],[j.LOGIN_STATUS]:[],[j.KEEP_ALIVE_RESPONSE]:[],[j.ONLINE_STATUS_EVENT]:[],[j.EXTENSIONS_UPDATED]:[]});J(this,"allListeners",[]);this.eventsSdkClass=e,this.eventsSdkClass=e}on(e,r){e==="*"?this.allListeners.push(r):this.listeners[e].push(r)}off(e,r){if(e==="*")this.allListeners=this.allListeners.filter(n=>n!==r);else{const o=this.listeners[e].filter(c=>c!==r);this.listeners={...this.listeners,[e]:o}}}emit(e,r){this.eventsSdkClass.socketIoClass.lastEventTimestamp=new Date().getTime(),this.listeners[e].forEach(o=>o({name:e,data:r}));const n={name:e,data:r};this.allListeners.forEach(o=>o(n))}}class As{constructor(e){J(this,"options");J(this,"servers",[]);J(this,"URLList",[]);J(this,"server");J(this,"URL");J(this,"socket");J(this,"mainServer");J(this,"alreadyAttemptedOtherServers",[]);J(this,"authClass",new rn(this));J(this,"socketIoClass",new ln(this));J(this,"loggerClass",new Ss(this));J(this,"eventEmitterClass",new Es(this));J(this,"getCircularReplacer",()=>{const e=new WeakSet;return(r,n)=>{if(!(r==="socket"||r==="io"||r==="nsps")){if(typeof n=="object"&&n!==null){if(e.has(n))return;e.add(n)}return n}}});this.options={...nn,...e}}on(e,r){this.eventEmitterClass.on(e,r)}emit(e,...r){this.socketIoClass.io&&this.socketIoClass.io.emit(e,...r)}connect(e){e===ue.MAIN&&this.findMainServer(),e===ue.NEXT&&this.findNextServer(),this.socketIoClass.doReconnect=!0;try{this.loggerClass.init()}catch(r){console.error(r)}this.socketIoClass.initSocketConnection(),this.socketIoClass.initSocketEvents(),this.socketIoClass.initKeepAlive()}disconnect(){this.socketIoClass.doReconnect=!1,this.socketIoClass.closeAllConnections(),this.loggerClass.stop()}clearKeepAliveInterval(){this.socketIoClass.clearKeepAliveInterval()}findMainServer(){this.servers.length?(this.mainServer=this.servers.reduce((e,r)=>r.Priority>e.Priority?r:e),this.server=this.mainServer):this.URLList.length&&(this.URL=this.URLList[0])}findNextServer(){if(this.servers.length&&this.server)if(this.server.Priority===this.mainServer.Priority){let e=this.servers.filter(r=>r.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(r.Priority)+1===0);e.length||(this.alreadyAttemptedOtherServers=[],e=this.servers.filter(r=>r.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(r.Priority)+1===0)),e.length&&(this.server=e.reduce((r,n)=>n.Priority>r.Priority?n:r),this.alreadyAttemptedOtherServers.push(this.server.Priority))}else this.server=this.mainServer;else if(this.URLList.length)if(this.URL===this.URLList[0]){let e=this.URLList.filter(r=>r!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(r)+1===0);e.length||(this.alreadyAttemptedOtherServers=[],e=this.URLList.filter(r=>r!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(r)+1===0)),e.length&&(this.URL=e[0],this.alreadyAttemptedOtherServers.push(this.URL))}else this.URL=this.URLList[0]}async init(){const e=await this.authClass.login();return e&&this.authClass.onLoginResponse(e),!0}getCurrentMonitorServer(){return this.server}}exports.CallStatusEnum=gr;exports.CallTypeEnum=mr;exports.ConnectionStatusEnum=de;exports.DebugOption=fe;exports.DialerTypeEnum=vr;exports.DirectionEnum=Cr;exports.DoNotCallMeStatusCodeEnum=br;exports.EventsEnum=j;exports.ExtensionEventReasonEnum=Ft;exports.ExtensionHangupCauseEnum=kr;exports.LoginType=ie;exports.QueueEventReasonEnum=wr;exports.ServerListenerEventsEnum=Ut;exports.ServerParameter=ue;exports.default=As;
11
+ ]`&&k(new Date(-864e13))=='"-271821-04-20T00:00:00.000Z"'&&k(new Date(864e13))=='"+275760-09-13T00:00:00.000Z"'&&k(new Date(-621987552e5))=='"-000001-01-01T00:00:00.000Z"'&&k(new Date(-1))=='"1969-12-31T23:59:59.999Z"'}catch{x=!1}}O=x}if(E=="json-parse"){var B=u.parse;if(typeof B=="function")try{if(B("0")===0&&!B(!1)){w=B(D);var N=w.a.length==5&&w.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 o[E]=!!O}var h,f,l,d={}.toString,i=typeof JSON=="object"&&JSON,u=typeof e=="object"&&e&&!e.nodeType&&e;u&&i?(u.stringify=i.stringify,u.parse=i.parse):u=s.JSON=i||{};var c=new Date(-0xc782b5b800cec);try{c=c.getUTCFullYear()==-109252&&c.getUTCMonth()===0&&c.getUTCDate()===1&&c.getUTCHours()==10&&c.getUTCMinutes()==37&&c.getUTCSeconds()==6&&c.getUTCMilliseconds()==708}catch{}if(!o("json")){var r="[object Function]",n="[object Date]",p="[object Number]",g="[object String]",y="[object Array]",T="[object Boolean]",P=o("bug-string-char-index");if(!c)var U=Math.floor,M=[0,31,59,90,120,151,181,212,243,273,304,334],_=function(E,O){return M[O]+365*(E-1970)+U((E-1969+(O=+(O>1)))/4)-U((E-1901+O)/100)+U((E-1601+O)/400)};(h={}.hasOwnProperty)||(h=function(E){var O,w={};return(w.__proto__=null,w.__proto__={toString:1},w).toString!=d?h=function(D){var k=this.__proto__,x=D in(this.__proto__=null,this);return this.__proto__=k,x}:(O=w.constructor,h=function(D){var k=(this.constructor||O).prototype;return D in this&&!(D in k&&this[D]===k[D])}),w=null,h.call(this,E)});var C={boolean:1,number:1,string:1,undefined:1},b=function(E,O){var w=typeof E[O];return w=="object"?!!E[O]:!C[w]};if(f=function(E,O){var w,D,k,x=0;(w=function(){this.valueOf=0}).prototype.valueOf=0,D=new w;for(k in D)h.call(D,k)&&x++;return w=D=null,x?f=x==2?function(B,N){var F,G={},W=d.call(B)==r;for(F in B)W&&F=="prototype"||h.call(G,F)||!(G[F]=1)||!h.call(B,F)||N(F)}:function(B,N){var F,G,W=d.call(B)==r;for(F in B)W&&F=="prototype"||!h.call(B,F)||(G=F==="constructor")||N(F);(G||h.call(B,F="constructor"))&&N(F)}:(D=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],f=function(B,N){var F,G,W=d.call(B)==r,H=!W&&typeof B.constructor!="function"&&b(B,"hasOwnProperty")?B.hasOwnProperty:h;for(F in B)W&&F=="prototype"||!H.call(B,F)||N(F);for(G=D.length;F=D[--G];H.call(B,F)&&N(F));}),f(E,O)},!o("json-stringify")){var A={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},v="000000",m=function(E,O){return(v+(O||0)).slice(-E)},L="\\u00",I=function(E){var O,w='"',D=0,k=E.length,x=k>10&&P;for(x&&(O=E.split(""));k>D;D++){var B=E.charCodeAt(D);switch(B){case 8:case 9:case 10:case 12:case 13:case 34:case 92:w+=A[B];break;default:if(32>B){w+=L+m(2,B.toString(16));break}w+=x?O[D]:P?E.charAt(D):E[D]}}return w+'"'},R=function(E,O,w,D,k,x,B){var N,F,G,W,H,re,ce,le,he,ue,Z,pe,ie,se,fe,de;try{N=O[E]}catch{}if(typeof N=="object"&&N)if(F=d.call(N),F!=n||h.call(N,"toJSON"))typeof N.toJSON=="function"&&(F!=p&&F!=g&&F!=y||h.call(N,"toJSON"))&&(N=N.toJSON(E));else if(N>-1/0&&1/0>N){if(_){for(H=U(N/864e5),G=U(H/365.2425)+1970-1;_(G+1,0)<=H;G++);for(W=U((H-_(G,0))/30.42);_(G,W+1)<=H;W++);H=1+H-_(G,W),re=(N%864e5+864e5)%864e5,ce=U(re/36e5)%24,le=U(re/6e4)%60,he=U(re/1e3)%60,ue=re%1e3}else G=N.getUTCFullYear(),W=N.getUTCMonth(),H=N.getUTCDate(),ce=N.getUTCHours(),le=N.getUTCMinutes(),he=N.getUTCSeconds(),ue=N.getUTCMilliseconds();N=(0>=G||G>=1e4?(0>G?"-":"+")+m(6,0>G?-G:G):m(4,G))+"-"+m(2,W+1)+"-"+m(2,H)+"T"+m(2,ce)+":"+m(2,le)+":"+m(2,he)+"."+m(3,ue)+"Z"}else N=null;if(w&&(N=w.call(O,E,N)),N===null)return"null";if(F=d.call(N),F==T)return""+N;if(F==p)return N>-1/0&&1/0>N?""+N:"null";if(F==g)return I(""+N);if(typeof N=="object"){for(se=B.length;se--;)if(B[se]===N)throw TypeError();if(B.push(N),Z=[],fe=x,x+=k,F==y){for(ie=0,se=N.length;se>ie;ie++)pe=R(ie,N,w,D,k,x,B),Z.push(pe===l?"null":pe);de=Z.length?k?`[
12
+ `+x+Z.join(`,
13
+ `+x)+`
14
+ `+fe+"]":"["+Z.join(",")+"]":"[]"}else f(D||N,function(ge){var Ee=R(ge,N,w,D,k,x,B);Ee!==l&&Z.push(I(ge)+":"+(k?" ":"")+Ee)}),de=Z.length?k?`{
15
+ `+x+Z.join(`,
16
+ `+x)+`
17
+ `+fe+"}":"{"+Z.join(",")+"}":"{}";return B.pop(),de}};u.stringify=function(E,O,w){var D,k,x,B;if(typeof O=="function"||typeof O=="object"&&O){if((B=d.call(O))==r)k=O;else if(B==y){x={};for(var N,F=0,G=O.length;G>F;N=O[F++],B=d.call(N),(B==g||B==p)&&(x[N]=1));}}if(w)if((B=d.call(w))==p){if((w-=w%1)>0)for(D="",w>10&&(w=10);D.length<w;D+=" ");}else B==g&&(D=w.length<=10?w:w.slice(0,10));return R("",(N={},N[""]=E,N),k,x,D,"",[])}}if(!o("json-parse")){var S,K,$=String.fromCharCode,z={92:"\\",34:'"',47:"/",98:"\b",116:" ",110:`
18
+ `,102:"\f",114:"\r"},X=function(){throw S=K=null,SyntaxError()},J=function(){for(var E,O,w,D,k,x=K,B=x.length;B>S;)switch(k=x.charCodeAt(S)){case 9:case 10:case 13:case 32:S++;break;case 123:case 125:case 91:case 93:case 58:case 44:return E=P?x.charAt(S):x[S],S++,E;case 34:for(E="@",S++;B>S;)if(k=x.charCodeAt(S),32>k)X();else if(k==92)switch(k=x.charCodeAt(++S)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:E+=z[k],S++;break;case 117:for(O=++S,w=S+4;w>S;S++)k=x.charCodeAt(S),k>=48&&57>=k||k>=97&&102>=k||k>=65&&70>=k||X();E+=$("0x"+x.slice(O,S));break;default:X()}else{if(k==34)break;for(k=x.charCodeAt(S),O=S;k>=32&&k!=92&&k!=34;)k=x.charCodeAt(++S);E+=x.slice(O,S)}if(x.charCodeAt(S)==34)return S++,E;X();default:if(O=S,k==45&&(D=!0,k=x.charCodeAt(++S)),k>=48&&57>=k){for(k==48&&(k=x.charCodeAt(S+1),k>=48&&57>=k)&&X(),D=!1;B>S&&(k=x.charCodeAt(S),k>=48&&57>=k);S++);if(x.charCodeAt(S)==46){for(w=++S;B>w&&(k=x.charCodeAt(w),k>=48&&57>=k);w++);w==S&&X(),S=w}if(k=x.charCodeAt(S),k==101||k==69){for(k=x.charCodeAt(++S),(k==43||k==45)&&S++,w=S;B>w&&(k=x.charCodeAt(w),k>=48&&57>=k);w++);w==S&&X(),S=w}return+x.slice(O,S)}if(D&&X(),x.slice(S,S+4)=="true")return S+=4,!0;if(x.slice(S,S+5)=="false")return S+=5,!1;if(x.slice(S,S+4)=="null")return S+=4,null;X()}return"$"},ne=function(E){var O,w;if(E=="$"&&X(),typeof E=="string"){if((P?E.charAt(0):E[0])=="@")return E.slice(1);if(E=="["){for(O=[];E=J(),E!="]";w||(w=!0))w&&(E==","?(E=J(),E=="]"&&X()):X()),E==","&&X(),O.push(ne(E));return O}if(E=="{"){for(O={};E=J(),E!="}";w||(w=!0))w&&(E==","?(E=J(),E=="}"&&X()):X()),(E==","||typeof E!="string"||(P?E.charAt(0):E[0])!="@"||J()!=":")&&X(),O[E.slice(1)]=ne(J());return O}X()}return E},ke=function(E,O,w){var D=Ce(E,O,w);D===l?delete E[O]:E[O]=D},Ce=function(E,O,w){var D,k=E[O];if(typeof k=="object"&&k)if(d.call(k)==y)for(D=k.length;D--;)ke(k,D,w);else f(k,function(x){ke(k,x,w)});return w.call(E,O,k)};u.parse=function(E,O){var w,D;return S=0,K=""+E,w=ne(J()),J()!="$"&&X(),S=K=null,O&&d.call(O)==r?Ce((D={},D[""]=w,D),"",O):w}}}})(this)},{}],48:[function(a,t){function e(s,o){var h=[];o=o||0;for(var f=o||0;f<s.length;f++)h[f-o]=s[f];return h}t.exports=e},{}]},{},[1])(1)}const ze=Object.freeze(Object.defineProperty({__proto__:null,default:Ge},Symbol.toStringTag,{value:"Module"})),Je=Object.assign({"./v1_3_7.js":ze}),We=/v\d+_\d+_\d+/;function He(a){return typeof a=="function"}const ve=Object.entries(Je).reduce((a,t)=>{var o;const e=t[1].default,s=(o=t[0].match(We))==null?void 0:o[0];return He(e)&&s&&(a[s]=e()),a},{}),Ne=a=>{if(a in ve)return ve[a];throw new Error(`Socket version ${a} not found`)},Ye=(a,...t)=>Ne(a)(...t),Qe={...ve,getSocketVersion:Ne,makeSocketVersion:Ye};var Le=(a=>(a.RINGING="Ringing",a.TALKING="Talking",a.DIALING="Dialing",a.HOLD="Hold",a))(Le||{}),Oe=(a=>(a.INCOMING="Incoming",a.OUTGOING="Outgoing",a))(Oe||{}),te=(a=>(a.CONNECTED="connected",a.DISCONNECTED="disconnected",a.TRYING_TO_CONNECT="tryingToConnect",a))(te||{}),_e=(a=>(a.AUTOMATIC="Automatic",a.IVR="IVR",a))(_e||{}),Re=(a=>(a.INCOMINC="Incoming",a.OUTGOING="Outgoing",a.SPY="Spy",a.CLICK2CALL="Click2Call",a))(Re||{}),Ie=(a=>(a.RESPONSE_FROM_API_VALID="RESPONSE_FROM_API_VALID",a.RESPONSE_FROM_API_INVALID="RESPONSE_FROM_API_INVALID",a))(Ie||{}),j=(a=>(a.ALL_DIALER_STATUS="AllDialersStatus",a.ALL_EXTENSION_STATUS="AllExtensionsStatus",a.ALL_USERS_STATUS="AllUsersStatus",a.CONNECT="connect",a.DISCONNECT="disconnect",a.CONNECT_ERROR_EVENT="connect_error",a.EXTENSION_EVENT="ExtensionEvent",a.KEEP_ALIVE="keepalive",a.KEEP_ALIVE_RESPONSE="keepaliveResponse",a.LOGIN_STATUS="loginStatus",a.LOGIN_SUCCESS="loginSuccess",a.QUEUE_EVENT="QueueEvent",a.ONLINE_STATUS_EVENT="onlineStatusEvent",a.DIALER_EVENT="DialerEvent",a.EXTENSIONS_UPDATED="ExtensionsUpdated",a))(j||{}),me=(a=>(a.NEWCALL="NEWCALL",a.ANSWER="ANSWER",a.HOLD="HOLD",a.UNHOLD="UNHOLD",a.HANGUP="HANGUP",a.USER_STATUS_UPDATE="userStatusUpdate",a))(me||{}),xe=(a=>(a.NORMAL_HANGUP="Normal hangup",a.USER_BUSY="User busy",a.CALL_REJECTED="Call Rejected",a.UNALLOCATED_NUMBER="Unallocated (unassigned) number",a.UNKNOWN="Unknown",a.NO_USER_RESPONDING="No user responding",a.USER_ALERTING="User alerting, no answer",a.ANSWERED_ELSEWHERE="Answered elsewhere",a))(xe||{}),Ue=(a=>(a.ANSWER="ANSWER",a.ABANDONED="ABANDONED",a.EXIT="EXIT",a.JOIN="JOIN",a))(Ue||{});class ae{static mapExtensionEvent(t){var f,l;const e=t.reason;let s,o;t.data.currentCall&&(o=this.mapExtensionCall(t,t.data.currentCall));const h=this.mapExtensionData(t,t.data);return e===me.HANGUP?s={...t,reason:e,data:{...h,currentCall:o?{...o,duration:o.callAnswered_UTC_CLIENT?Date.now()-o.callAnswered_UTC_CLIENT:0}:void 0,calls:(f=t.data.calls)==null?void 0:f.map(d=>{const i=this.mapExtensionCall(t,d);return{...i,duration:i.callAnswered_UTC_CLIENT?Date.now()-i.callAnswered_UTC_CLIENT:0}})}}:s={...t,data:{...h,currentCall:o,calls:(l=t.data.calls)==null?void 0:l.map(d=>this.mapExtensionCall(t,d))},reason:e},s}static mapAllExtensionStatus(t){return{...t,extensions:t.extensions.map(e=>{var s;return{...this.mapExtensionData(t,e),currentCall:e.currentCall?this.mapExtensionCall(t,e.currentCall):void 0,calls:(s=e.calls)==null?void 0:s.map(o=>this.mapExtensionCall(t,o))}})}}static mapExtensionData(t,e){return this.configureUTCForObject(e,[{key:"lastAnsweredCallEventEpoch",format:"sec"},{key:"lastCallEventEpoch",format:"sec"},{key:"lastHangupCallEpoch",format:"sec"},{key:"representativeUpdated",format:"ms"}],t.servertime,t.servertimeoffset)}static mapExtensionCall(t,e){return this.configureUTCForObject(e,[{key:"callAnswered",format:"sec"},{key:"callStarted",format:"sec"}],t.servertime,t.servertimeoffset)}static mapQueueCall(t,e){return this.configureUTCForObject(e,[{key:"JoinTimeStamp",format:"sec"},{key:"VHJoinTimeStamp",format:"sec"}],t.servertime,t.servertimeoffset)}static mapLoginStatusEvent(t){return{...t,queues:t.queues.map(e=>({...e,Calls:e.Calls.map(s=>this.mapQueueCall(t,s))}))}}static mapQueueEvent(t){return{...t,data:{...t.data,Calls:t.data.Calls.map(e=>this.mapQueueCall(t,e))}}}static assignProperty(t,e,s){t[e]=s}static configureUTCForObject(t,e,s,o){const h=(s-o*60)*1e3,f=Date.now()-h,l={};return e.forEach(d=>{const i=t[d.key],u=d.key;if(i!==0&&typeof i=="number"&&!isNaN(i)){let c=i;d.format==="ms"&&(c=Math.floor(c/1e3));const r=(c-o*60)*1e3;this.assignProperty(l,`${u}_UTC`,r),this.assignProperty(l,`${u}_UTC_CLIENT`,r+f)}else this.assignProperty(l,`${u}_UTC`,0),this.assignProperty(l,`${u}_UTC_CLIENT`,0)}),{...t,...l}}}var Se=(a=>(a.UPDATE_MONITORED_EXTENSIONS="updateMonitoredExtensions",a.KEEP_ALIVE="keepalive",a))(Se||{});class Ze{constructor(t){V(this,"io");V(this,"ioFunction");V(this,"lastEventTimestamp",new Date().getTime());V(this,"doReconnect",!0);V(this,"keepAliveInterval");V(this,"keepReconnectInterval");V(this,"keepReconnectTimeout");V(this,"connected",!1);V(this,"reconnectionTime",20);this.eventsSdkClass=t,this.eventsSdkClass=t,typeof window<"u"&&(window.addEventListener("offline",()=>{this.closeAllConnections()}),window.addEventListener("online",()=>{setTimeout(()=>{this.keepReconnectTimeout&&clearTimeout(this.keepReconnectTimeout),this.eventsSdkClass.connect(Q.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(Q.NEXT)},5e3)}))}getSocketIoFunction(t){const e=t.split("v="),s="v".concat(e[e.length-1]).replaceAll(".","_");this.ioFunction=Qe.getSocketVersion(s)}initSocketConnection(){const t=this.eventsSdkClass.authClass.token,e=this.eventsSdkClass.options.protocol,s=this.eventsSdkClass.server;try{const o=s?s.Domain:this.eventsSdkClass.URL,h=s?`${e}://${o}`:this.eventsSdkClass.URL,f={reconnection:!1,upgrade:!1,transports:["websocket"],forceNew:!0,query:{token:t},timeout:this.eventsSdkClass.options.timeout};if(this.ioFunction&&h)this.io=this.ioFunction(h,f),this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT,{attemptToConnect:h,connectionStatus:te.TRYING_TO_CONNECT}),this.eventsSdkClass.loggerClass.sdkAttemptToConnect(o);else throw new Error("Socket server url no defined")}catch(o){this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(o)}}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(Se.KEEP_ALIVE,this.eventsSdkClass.authClass.token),this.eventsSdkClass.loggerClass.keepAliveEmit();return}},this.eventsSdkClass.options.keepAliveTimeout)}closeAllConnections(){var t;this.io&&(this.io.close(),(t=this.io)==null||t.disconnect(),this.io=void 0),this.eventsSdkClass.loggerClass.stop(),oe.clearSessionStorage()}initSocketEvents(){this.io&&this.io.on(j.LOGIN_SUCCESS,t=>this.onLoginSuccessEvent(t,j.LOGIN_SUCCESS)).on(j.QUEUE_EVENT,t=>this.onQueueEvent(t,j.QUEUE_EVENT)).on(j.EXTENSION_EVENT,t=>this.onExtensionEvent(t,j.EXTENSION_EVENT)).on(j.DIALER_EVENT,t=>this.onDialerEvent(t,j.DIALER_EVENT)).on(j.LOGIN_STATUS,t=>this.onLoginStatusEvent(t,j.LOGIN_STATUS)).on(j.ALL_EXTENSION_STATUS,t=>this.onAllExtensionStatus(t,j.ALL_EXTENSION_STATUS)).on(j.ALL_DIALER_STATUS,t=>this.onAllDialerStatus(t,j.ALL_DIALER_STATUS)).on(j.KEEP_ALIVE_RESPONSE,t=>this.onKeepAliveResponse(t)).on(j.EXTENSIONS_UPDATED,t=>this.onExtensionsUpdatedEvent(t,j.EXTENSIONS_UPDATED)).on(j.CONNECT,()=>this.onConnect()).on(j.DISCONNECT,t=>this.onDisconnect(t)).on(j.CONNECT_ERROR_EVENT,t=>this.onConnectError(t))}onLoginSuccessEvent(t,e){this.eventsSdkClass.loggerClass.eventLog(e,t),this.eventsSdkClass.eventEmitterClass.emit(e,t)}onQueueEvent(t,e){this.eventsSdkClass.loggerClass.eventLog(e,t),this.eventsSdkClass.eventEmitterClass.emit(e,ae.mapQueueEvent(t))}onExtensionEvent(t,e){const s=ae.mapExtensionEvent(t);s&&(this.eventsSdkClass.loggerClass.eventLog(e,t),this.eventsSdkClass.eventEmitterClass.emit(e,s))}onDialerEvent(t,e){this.eventsSdkClass.loggerClass.eventLog(e,t),this.eventsSdkClass.eventEmitterClass.emit(e,t)}onLoginStatusEvent(t,e){this.eventsSdkClass.loggerClass.eventLog(e,t),this.eventsSdkClass.eventEmitterClass.emit(e,ae.mapLoginStatusEvent(t))}onAllExtensionStatus(t,e){const s=ae.mapAllExtensionStatus(t);this.eventsSdkClass.loggerClass.eventLog(e,t),this.eventsSdkClass.eventEmitterClass.emit(e,s)}onAllDialerStatus(t,e){this.eventsSdkClass.loggerClass.eventLog(e,t),this.eventsSdkClass.eventEmitterClass.emit(e,t)}onKeepAliveResponse(t){if(this.eventsSdkClass.loggerClass.keepAliveResponse(t),t.errorCode){this.initSocketConnection();return}this.connected?this.lastEventTimestamp=new Date().getTime():this.initSocketConnection()}onExtensionsUpdatedEvent(t,e){this.eventsSdkClass.loggerClass.eventLog(e,t),this.eventsSdkClass.eventEmitterClass.emit(e,t)}onConnect(){this.connected=!0,this.keepReconnectInterval&&clearInterval(this.keepReconnectInterval),this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT,{connectionStatus:te.CONNECTED}),this.eventsSdkClass.loggerClass.start().then(()=>{this.eventsSdkClass.loggerClass.sdkConnectionSuccess()})}onDisconnect(t){this.connected=!1,this.doReconnect&&(this.closeAllConnections(),this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT,{connectionStatus:this.doReconnect?te.TRYING_TO_CONNECT:te.DISCONNECTED}),this.eventsSdkClass.loggerClass.sdkDisconnect([t]),this.keepReconnectTimeout=setTimeout(()=>{this.reconnectionTime=this.reconnectionTime+20,this.reconnectionTime>120&&(this.reconnectionTime=20),this.eventsSdkClass.connect(Q.NEXT)},this.reconnectionTime*1e3))}onConnectError(t){this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT,{connectionStatus:this.doReconnect?te.TRYING_TO_CONNECT:te.DISCONNECTED}),this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(t),this.keepReconnectTimeout=setTimeout(()=>{this.reconnectionTime=this.reconnectionTime+20,this.reconnectionTime>60&&(this.reconnectionTime=20),this.eventsSdkClass.connect(Q.NEXT)},this.reconnectionTime*1e3)}}class et{constructor(t){V(this,"storageLogger");this.eventsSdkClass=t,this.eventsSdkClass=t}init(){if(!this.eventsSdkClass.options.useLogger)return;if(this.eventsSdkClass.options.storageLoggerInstance){this.storageLogger=this.eventsSdkClass.options.storageLoggerInstance;return}let t;this.eventsSdkClass.options.loggerSocketConnection&&(t=this.eventsSdkClass.options.loggerSocketConnection),this.eventsSdkClass.socketIoClass.ioFunction&&!t&&(t=this.eventsSdkClass.socketIoClass.ioFunction(this.eventsSdkClass.options.loggerServer,this.eventsSdkClass.options.loggerConnectOptions)),t&&(this.storageLogger=new q({socket:t,loggerOptions:this.eventsSdkClass.options.loggerConfig}))}async start(){this.storageLogger&&await this.storageLogger.start()}stop(){this.storageLogger&&this.storageLogger.stop()}log(t){if(this.eventsSdkClass.options.useLogger)if(this.storageLogger)switch(t.Level){case q.LevelEnum.INFO:this.storageLogger.log(t);break;case q.LevelEnum.DEBUG:this.storageLogger.debug(t);break;case q.LevelEnum.WARNING:this.storageLogger.warn(t);break;case q.LevelEnum.ERROR:this.storageLogger.error(t)}else t.Level===q.LevelEnum.INFO?console.log(t):t.Level===q.LevelEnum.ERROR&&console.error(t)}sdkConnectionSuccess(){const t={...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(t,this.eventsSdkClass.getCircularReplacer()),ActionName:q.ActionNameEnum.WSCONNECT,isShowClient:!1,Status:"Connection established",StatusCode:200,Level:q.LevelEnum.INFO,LogType:q.LogTypeEnum.INFO})}sdkDisconnect(t){this.log({Message:`Sdk disconnected from the socket server ${this.eventsSdkClass.server&&this.eventsSdkClass.server.Domain?this.eventsSdkClass.server.Domain:this.eventsSdkClass.URL} (${t})`,ActionName:q.ActionNameEnum.WSCONNECT,isShowClient:!1,Status:"Connection closed",StatusCode:200,Level:q.LevelEnum.INFO,LogType:q.LogTypeEnum.INFO})}sdkAttemptToConnect(t){this.log({Message:`${this.eventsSdkClass.options.loggerConfig.system} is trying to connect to WS server ${t}`,ActionName:q.ActionNameEnum.WSCONNECT,isShowClient:!1,Status:"Switching Protocols",StatusCode:101,Level:q.LevelEnum.INFO,LogType:q.LogTypeEnum.INFO})}sdkAttemptToConnectError(t){this.log({Message:`${t}`,ActionName:q.ActionNameEnum.WSCONNECT,isShowClient:!1,Status:"Connection error",StatusCode:500,Level:q.LevelEnum.ERROR,LogType:q.LogTypeEnum.ERROR})}loginError(t,e,s,o){this.log({Message:`External login request error with the login type ${t} ${t===Y.TOKEN?s:o}`,ActionName:q.ActionNameEnum.WSCONNECT,isShowClient:!1,Status:"External login error",StatusCode:e||400,Level:q.LevelEnum.ERROR,LogType:q.LogTypeEnum.ERROR})}getSettingsError(t,e){this.log({Message:`Get settings error with token ${t}, error: ${e}`,ActionName:q.ActionNameEnum.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:q.LevelEnum.ERROR,LogType:q.LogTypeEnum.ERROR})}refreshTokenError(t,e,s){this.log({Message:`Refresh token error with old refresh token ${t}, url: ${e}, error: ${s}`,ActionName:q.ActionNameEnum.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:q.LevelEnum.ERROR,LogType:q.LogTypeEnum.ERROR})}keepAliveEmit(){this.log({Message:`Keep alive event emitted with this token: ${this.eventsSdkClass.authClass.token}`,ActionName:q.ActionNameEnum.WSCONNECT,isShowClient:!1,Level:q.LevelEnum.INFO,LogType:q.LogTypeEnum.INFO})}keepAliveResponse(t){this.log({Message:`Keep alive response: ${JSON.stringify(t)}`,ActionName:q.ActionNameEnum.WSCONNECT,isShowClient:!1,Status:"Successful",StatusCode:200,Level:q.LevelEnum.INFO,LogType:q.LogTypeEnum.INFO})}eventLog(t,e){const s={[ee.FULL]:[],[ee.BOOTSTRAP]:[j.LOGIN_STATUS,j.LOGIN_SUCCESS,j.ALL_EXTENSION_STATUS,j.ALL_DIALER_STATUS],[ee.DEBUG_EXTENSIONS]:[j.ALL_EXTENSION_STATUS,j.EXTENSION_EVENT,j.EXTENSIONS_UPDATED],[ee.DEBUG_DIALER]:[j.ALL_DIALER_STATUS,j.DIALER_EVENT],[ee.DEBUG_QUEUE]:[j.QUEUE_EVENT]};this.eventsSdkClass.options.debugOption&&(s[this.eventsSdkClass.options.debugOption].includes(t)||this.eventsSdkClass.options.debugOption===ee.FULL)&&this.log({Message:`Event name: ${t}`,Body:e,ActionName:q.ActionNameEnum.WSCONNECT,isShowClient:!1,Status:"Successful",Level:q.LevelEnum.DEBUG,LogType:q.LogTypeEnum.INFO})}}class tt{constructor(t){V(this,"listeners",{[j.ALL_EXTENSION_STATUS]:[],[j.ALL_DIALER_STATUS]:[],[j.ALL_USERS_STATUS]:[],[j.QUEUE_EVENT]:[],[j.EXTENSION_EVENT]:[],[j.DIALER_EVENT]:[],[j.LOGIN_SUCCESS]:[],[j.LOGIN_STATUS]:[],[j.KEEP_ALIVE_RESPONSE]:[],[j.ONLINE_STATUS_EVENT]:[],[j.EXTENSIONS_UPDATED]:[]});V(this,"allListeners",[]);this.eventsSdkClass=t,this.eventsSdkClass=t}on(t,e){t==="*"?this.allListeners.push(e):this.listeners[t].push(e)}off(t,e){if(t==="*")this.allListeners=this.allListeners.filter(s=>s!==e);else{const o=this.listeners[t].filter(h=>h!==e);this.listeners={...this.listeners,[t]:o}}}emit(t,e){this.eventsSdkClass.socketIoClass.lastEventTimestamp=new Date().getTime(),this.listeners[t].forEach(o=>o({name:t,data:e}));const s={name:t,data:e};this.allListeners.forEach(o=>o(s))}}class nt{constructor(t){V(this,"options");V(this,"servers",[]);V(this,"URLList",[]);V(this,"server");V(this,"URL");V(this,"socket");V(this,"mainServer");V(this,"alreadyAttemptedOtherServers",[]);V(this,"authClass",new Ke(this));V(this,"socketIoClass",new Ze(this));V(this,"loggerClass",new et(this));V(this,"eventEmitterClass",new tt(this));V(this,"getCircularReplacer",()=>{const t=new WeakSet;return(e,s)=>{if(!(e==="socket"||e==="io"||e==="nsps")){if(typeof s=="object"&&s!==null){if(t.has(s))return;t.add(s)}return s}}});this.options={...$e,...t}}on(t,e){this.eventEmitterClass.on(t,e)}emit(t,...e){this.socketIoClass.io&&this.socketIoClass.io.emit(t,...e)}connect(t){t===Q.MAIN&&this.findMainServer(),t===Q.NEXT&&this.findNextServer(),this.socketIoClass.doReconnect=!0;try{this.loggerClass.start()}catch(e){console.error(e)}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((t,e)=>e.Priority>t.Priority?e:t),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 t=this.servers.filter(e=>e.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(e.Priority)+1===0);t.length||(this.alreadyAttemptedOtherServers=[],t=this.servers.filter(e=>e.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(e.Priority)+1===0)),t.length&&(this.server=t.reduce((e,s)=>s.Priority>e.Priority?s:e),this.alreadyAttemptedOtherServers.push(this.server.Priority))}else this.server=this.mainServer;else if(this.URLList.length)if(this.URL===this.URLList[0]){let t=this.URLList.filter(e=>e!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(e)+1===0);t.length||(this.alreadyAttemptedOtherServers=[],t=this.URLList.filter(e=>e!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(e)+1===0)),t.length&&(this.URL=t[0],this.alreadyAttemptedOtherServers.push(this.URL))}else this.URL=this.URLList[0]}async init(){const t=await this.authClass.login();return t&&this.authClass.onLoginResponse(t),!0}getCurrentMonitorServer(){return this.server}}exports.CallStatusEnum=Le;exports.CallTypeEnum=Oe;exports.ConnectionStatusEnum=te;exports.DebugOption=ee;exports.DialerTypeEnum=_e;exports.DirectionEnum=Re;exports.DoNotCallMeStatusCodeEnum=Ie;exports.EventsEnum=j;exports.ExtensionEventReasonEnum=me;exports.ExtensionHangupCauseEnum=xe;exports.LoginType=Y;exports.QueueEventReasonEnum=Ue;exports.ServerListenerEventsEnum=Se;exports.ServerParameter=Q;exports.default=nt;
20
19
  //# sourceMappingURL=voicenter-events-sdk.cjs.js.map