@voicenter-team/events-sdk 0.0.96 → 0.0.99

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
- var VoicenterEventsSDK=function(K,fe){"use strict";var Es=Object.defineProperty;var As=(K,fe,ke)=>fe in K?Es(K,fe,{enumerable:!0,configurable:!0,writable:!0,value:ke}):K[fe]=ke;var H=(K,fe,ke)=>(As(K,typeof fe!="symbol"?fe+"":fe,ke),ke);function ke(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Yt={exports:{}},Qt={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}};Qt.exports=e})();var Kr=Qt.exports,pt={utf8:{stringToBytes:function(t){return pt.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(pt.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("")}}},Zt=pt;/*!
1
+ var VoicenterEventsSDK=function($,ut){"use strict";var gs=Object.defineProperty;var ys=($,ut,gt)=>ut in $?gs($,ut,{enumerable:!0,configurable:!0,writable:!0,value:gt}):$[ut]=gt;var K=($,ut,gt)=>(ys($,typeof ut!="symbol"?ut+"":ut,gt),gt);function gt(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var ce={exports:{}},he={exports:{}};(function(){var s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e={rotl:function(t,n){return t<<n|t>>>32-n},rotr:function(t,n){return t<<32-n|t>>>n},endian:function(t){if(t.constructor==Number)return e.rotl(t,8)&16711935|e.rotl(t,24)&4278255360;for(var n=0;n<t.length;n++)t[n]=e.endian(t[n]);return t},randomBytes:function(t){for(var n=[];t>0;t--)n.push(Math.floor(Math.random()*256));return n},bytesToWords:function(t){for(var n=[],r=0,o=0;r<t.length;r++,o+=8)n[o>>>5]|=t[r]<<24-o%32;return n},wordsToBytes:function(t){for(var n=[],r=0;r<t.length*32;r+=8)n.push(t[r>>>5]>>>24-r%32&255);return n},bytesToHex:function(t){for(var n=[],r=0;r<t.length;r++)n.push((t[r]>>>4).toString(16)),n.push((t[r]&15).toString(16));return n.join("")},hexToBytes:function(t){for(var n=[],r=0;r<t.length;r+=2)n.push(parseInt(t.substr(r,2),16));return n},bytesToBase64:function(t){for(var n=[],r=0;r<t.length;r+=3)for(var o=t[r]<<16|t[r+1]<<8|t[r+2],u=0;u<4;u++)r*8+u*6<=t.length*8?n.push(s.charAt(o>>>6*(3-u)&63)):n.push("=");return n.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/ig,"");for(var n=[],r=0,o=0;r<t.length;o=++r%4)o!=0&&n.push((s.indexOf(t.charAt(r-1))&Math.pow(2,-2*o+8)-1)<<o*2|s.indexOf(t.charAt(r))>>>6-o*2);return n}};he.exports=e})();var ze=he.exports,Bt={utf8:{stringToBytes:function(s){return Bt.bin.stringToBytes(unescape(encodeURIComponent(s)))},bytesToString:function(s){return decodeURIComponent(escape(Bt.bin.bytesToString(s)))}},bin:{stringToBytes:function(s){for(var e=[],t=0;t<s.length;t++)e.push(s.charCodeAt(t)&255);return e},bytesToString:function(s){for(var e=[],t=0;t<s.length;t++)e.push(String.fromCharCode(s[t]));return e.join("")}}},le=Bt;/*!
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 Yr=function(t){return t!=null&&(er(t)||Qr(t)||!!t._isBuffer)};function er(t){return!!t.constructor&&typeof t.constructor.isBuffer=="function"&&t.constructor.isBuffer(t)}function Qr(t){return typeof t.readFloatLE=="function"&&typeof t.slice=="function"&&er(t.slice(0,0))}(function(){var t=Kr,e=Zt.utf8,r=Yr,n=Zt.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,Yt.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 Zr=Yt.exports;const en=ke(Zr);var ye=(t=>(t.BOOTSTRAP="bootstrap",t.DEBUG_EXTENSIONS="debugExtensions",t.DEBUG_QUEUE="debugQueue",t.DEBUG_DIALER="debugDialer",t.FULL="full",t))(ye||{}),he=(t=>(t.MAIN="main",t.NEXT="next",t))(he||{}),ae=(t=>(t.USER="User",t.TOKEN="Token",t))(ae||{});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 tn{constructor(e){H(this,"delay",1e3);H(this,"lastLoginTimestamp");H(this,"token");H(this,"refreshToken");H(this,"tokenExpiry");H(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=en(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(he.MAIN)),e.Token&&(this.token=e.Token,this.eventsSdkClass.connect(he.MAIN)),e.RefreshToken&&e.IdentityCodeExpiry&&this.eventsSdkClass.options.loginType===ae.USER&&(this.refreshToken=e.RefreshToken,this.tokenExpiry=e.IdentityCodeExpiry,this.handleTokenExpiry()),e.RefreshToken&&e.TokenExpiry&&this.normalizeLoginType(this.eventsSdkClass.options.loginType)===ae.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===ae.TOKEN?l=JSON.stringify({identityType:ae.TOKEN,token:n}):l=JSON.stringify({identityType:ae.USER,username:o,password:r}):this.eventsSdkClass.options.loginType===ae.TOKEN?(l=JSON.stringify({token:n}),e=`${e}/${ae.TOKEN}`):(l=JSON.stringify({email:o,pin:r}),e=`${e}/${ae.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 rn={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 nn(){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=fe,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,Y){C[L]=Y,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 Y=new Uint8Array(A.length),G=0;G<A.length;G++)Y[G]=A.charCodeAt(G);M=Y.buffer}x[L++]=z?0:1;for(var ne=M.byteLength.toString(),G=0;G<ne.length;G++)x[L++]=parseInt(ne[G]);x[L++]=255;for(var Y=new Uint8Array(M),G=0;G<Y.length;G++)x[L++]=Y[G]}),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(),Y=new Uint8Array(M.length+1),A=0;A<M.length;A++)Y[A]=parseInt(M[A]);if(Y[M.length]=255,S){var G=new S([x.buffer,Y.buffer,N]);k(null,G)}})}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 Y=new Uint8Array(M);M="";for(var z=0;z<Y.length;z++)M+=String.fromCharCode(Y[z])}k.push(M),C=h(C,A)}var G=k.length;k.forEach(function(ne,We){E(r.decodePacket(ne,w,!0),We,G)})}}).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 _,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){(_=function(){return 1}).toJSON=_;try{U=O(0)==="0"&&O(new Number)==="0"&&O(new String)=='""'&&O(f)===p&&O(p)===p&&O()===p&&O(_)==="1"&&O([_])=="[1]"&&O([p])=="[null]"&&O(null)=="null"&&O([p,f,null])=="[null,null,null]"&&O({a:[_,!0,!1,null,`\0\b
8
- \f\r `]})==P&&O(null,_)==="1"&&O([1,2],null,1)==`[
6
+ */var He=function(s){return s!=null&&(ue(s)||Ye(s)||!!s._isBuffer)};function ue(s){return!!s.constructor&&typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)}function Ye(s){return typeof s.readFloatLE=="function"&&typeof s.slice=="function"&&ue(s.slice(0,0))}(function(){var s=ze,e=le.utf8,t=He,n=le.bin,r=function(o,u){o.constructor==String?u&&u.encoding==="binary"?o=n.stringToBytes(o):o=e.stringToBytes(o):t(o)?o=Array.prototype.slice.call(o,0):!Array.isArray(o)&&o.constructor!==Uint8Array&&(o=o.toString());for(var h=s.bytesToWords(o),d=o.length*8,c=1732584193,p=-271733879,l=-1732584194,i=271733878,a=0;a<h.length;a++)h[a]=(h[a]<<8|h[a]>>>24)&16711935|(h[a]<<24|h[a]>>>8)&4278255360;h[d>>>5]|=128<<d%32,h[(d+64>>>9<<4)+14]=d;for(var f=r._ff,g=r._gg,y=r._hh,E=r._ii,a=0;a<h.length;a+=16){var j=c,U=p,F=l,L=i;c=f(c,p,l,i,h[a+0],7,-680876936),i=f(i,c,p,l,h[a+1],12,-389564586),l=f(l,i,c,p,h[a+2],17,606105819),p=f(p,l,i,c,h[a+3],22,-1044525330),c=f(c,p,l,i,h[a+4],7,-176418897),i=f(i,c,p,l,h[a+5],12,1200080426),l=f(l,i,c,p,h[a+6],17,-1473231341),p=f(p,l,i,c,h[a+7],22,-45705983),c=f(c,p,l,i,h[a+8],7,1770035416),i=f(i,c,p,l,h[a+9],12,-1958414417),l=f(l,i,c,p,h[a+10],17,-42063),p=f(p,l,i,c,h[a+11],22,-1990404162),c=f(c,p,l,i,h[a+12],7,1804603682),i=f(i,c,p,l,h[a+13],12,-40341101),l=f(l,i,c,p,h[a+14],17,-1502002290),p=f(p,l,i,c,h[a+15],22,1236535329),c=g(c,p,l,i,h[a+1],5,-165796510),i=g(i,c,p,l,h[a+6],9,-1069501632),l=g(l,i,c,p,h[a+11],14,643717713),p=g(p,l,i,c,h[a+0],20,-373897302),c=g(c,p,l,i,h[a+5],5,-701558691),i=g(i,c,p,l,h[a+10],9,38016083),l=g(l,i,c,p,h[a+15],14,-660478335),p=g(p,l,i,c,h[a+4],20,-405537848),c=g(c,p,l,i,h[a+9],5,568446438),i=g(i,c,p,l,h[a+14],9,-1019803690),l=g(l,i,c,p,h[a+3],14,-187363961),p=g(p,l,i,c,h[a+8],20,1163531501),c=g(c,p,l,i,h[a+13],5,-1444681467),i=g(i,c,p,l,h[a+2],9,-51403784),l=g(l,i,c,p,h[a+7],14,1735328473),p=g(p,l,i,c,h[a+12],20,-1926607734),c=y(c,p,l,i,h[a+5],4,-378558),i=y(i,c,p,l,h[a+8],11,-2022574463),l=y(l,i,c,p,h[a+11],16,1839030562),p=y(p,l,i,c,h[a+14],23,-35309556),c=y(c,p,l,i,h[a+1],4,-1530992060),i=y(i,c,p,l,h[a+4],11,1272893353),l=y(l,i,c,p,h[a+7],16,-155497632),p=y(p,l,i,c,h[a+10],23,-1094730640),c=y(c,p,l,i,h[a+13],4,681279174),i=y(i,c,p,l,h[a+0],11,-358537222),l=y(l,i,c,p,h[a+3],16,-722521979),p=y(p,l,i,c,h[a+6],23,76029189),c=y(c,p,l,i,h[a+9],4,-640364487),i=y(i,c,p,l,h[a+12],11,-421815835),l=y(l,i,c,p,h[a+15],16,530742520),p=y(p,l,i,c,h[a+2],23,-995338651),c=E(c,p,l,i,h[a+0],6,-198630844),i=E(i,c,p,l,h[a+7],10,1126891415),l=E(l,i,c,p,h[a+14],15,-1416354905),p=E(p,l,i,c,h[a+5],21,-57434055),c=E(c,p,l,i,h[a+12],6,1700485571),i=E(i,c,p,l,h[a+3],10,-1894986606),l=E(l,i,c,p,h[a+10],15,-1051523),p=E(p,l,i,c,h[a+1],21,-2054922799),c=E(c,p,l,i,h[a+8],6,1873313359),i=E(i,c,p,l,h[a+15],10,-30611744),l=E(l,i,c,p,h[a+6],15,-1560198380),p=E(p,l,i,c,h[a+13],21,1309151649),c=E(c,p,l,i,h[a+4],6,-145523070),i=E(i,c,p,l,h[a+11],10,-1120210379),l=E(l,i,c,p,h[a+2],15,718787259),p=E(p,l,i,c,h[a+9],21,-343485551),c=c+j>>>0,p=p+U>>>0,l=l+F>>>0,i=i+L>>>0}return s.endian([c,p,l,i])};r._ff=function(o,u,h,d,c,p,l){var i=o+(u&h|~u&d)+(c>>>0)+l;return(i<<p|i>>>32-p)+u},r._gg=function(o,u,h,d,c,p,l){var i=o+(u&d|h&~d)+(c>>>0)+l;return(i<<p|i>>>32-p)+u},r._hh=function(o,u,h,d,c,p,l){var i=o+(u^h^d)+(c>>>0)+l;return(i<<p|i>>>32-p)+u},r._ii=function(o,u,h,d,c,p,l){var i=o+(h^(u|~d))+(c>>>0)+l;return(i<<p|i>>>32-p)+u},r._blocksize=16,r._digestsize=16,ce.exports=function(o,u){if(o==null)throw new Error("Illegal argument "+o);var h=s.wordsToBytes(r(o,u));return u&&u.asBytes?h:u&&u.asString?n.bytesToString(h):s.bytesToHex(h)}})();var Qe=ce.exports;const Ze=gt(Qe);var ft=(s=>(s.BOOTSTRAP="bootstrap",s.DEBUG_EXTENSIONS="debugExtensions",s.DEBUG_QUEUE="debugQueue",s.DEBUG_DIALER="debugDialer",s.FULL="full",s))(ft||{}),it=(s=>(s.MAIN="main",s.NEXT="next",s))(it||{}),rt=(s=>(s.USER="User",s.TOKEN="Token",s))(rt||{});class vt{static async getSessionStorageDataByKey(e,t=!0){if(typeof chrome<"u"&&typeof chrome.storage<"u"){const n=await chrome.storage.session.get(e);if(n[e])return t?JSON.parse(n[e]):n[e]}if(typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.getItem=="function"){const n=window.sessionStorage.getItem(e);if(n)return t?JSON.parse(n):n}}static async updateSessionStorageKey(e,t){typeof chrome<"u"&&typeof chrome.storage<"u"&&await chrome.storage.session.set({[e]:JSON.stringify(t)}),typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.setItem=="function"&&window.sessionStorage.setItem(e,JSON.stringify(t))}static clearSessionStorage(){typeof chrome<"u"&&typeof chrome.storage<"u"&&chrome.storage.session.clear(),typeof window<"u"&&typeof window.sessionStorage<"u"&&typeof window.sessionStorage.clear=="function"&&window.sessionStorage.clear()}}class tn{constructor(e){K(this,"delay",1e3);K(this,"lastLoginTimestamp");K(this,"token");K(this,"refreshToken");K(this,"tokenExpiry");K(this,"storageKey");this.eventsSdkClass=e,this.eventsSdkClass=e,this.storageKey=""}async login(){const e={token:this.eventsSdkClass.options.token&&this.eventsSdkClass.options.token,email:this.eventsSdkClass.options.email&&this.eventsSdkClass.options.email,password:this.eventsSdkClass.options.password&&this.eventsSdkClass.options.password};if(this.storageKey=Ze(JSON.stringify({...this.eventsSdkClass.options,loggerSocketConnection:null},this.eventsSdkClass.getCircularReplacer())),this.lastLoginTimestamp&&this.lastLoginTimestamp+this.delay>new Date().getTime())return;this.updateLastLoginTimestamp();const t=await this.checkLoginStatus(this.storageKey);return t||(vt.clearSessionStorage(),await this.userLoginFunction(e,this.storageKey,this.eventsSdkClass.options.loginType))}updateLastLoginTimestamp(){this.lastLoginTimestamp=new Date().getTime()}async checkLoginStatus(e){const t=await vt.getSessionStorageDataByKey(e);if(t)return t}async userLoginFunction(e,t,n){let r,o,u;return this.eventsSdkClass.options.isNewStack?(r=await this.externalLogin(this.eventsSdkClass.options.loginUrl,e,n),o=await this.getSettings(r.Data.AccessToken),u={...r.Data,...o}):(r=await this.externalLogin(this.eventsSdkClass.options.loginUrl,e,n),u={...r.Data.Socket}),await vt.updateSessionStorageKey(t,u),u}onLoginResponse(e){if(!this.eventsSdkClass.options.isNewStack&&this.eventsSdkClass.options.servers&&(this.eventsSdkClass.servers=[...this.eventsSdkClass.options.servers],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((t,n)=>t.Priority>n.Priority?t:n)),this.eventsSdkClass.options.isNewStack&&this.eventsSdkClass.options.servers&&(this.eventsSdkClass.servers=[...this.eventsSdkClass.options.servers],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((t,n)=>t.Priority>n.Priority?t:n)),e.MonitorList&&e.MonitorList.length&&!this.eventsSdkClass.options.servers&&(this.eventsSdkClass.servers=[...e.MonitorList],this.eventsSdkClass.server=this.eventsSdkClass.servers.reduce((t,n)=>t.Priority>n.Priority?t:n)),!this.eventsSdkClass.options.isNewStack&&!this.eventsSdkClass.servers.length&&e.URLList&&(this.eventsSdkClass.URLList=e.URLList),!this.eventsSdkClass.options.isNewStack&&!this.eventsSdkClass.URLList.length&&!this.eventsSdkClass.servers.length)throw new Error("Socket servers not defined");if(this.eventsSdkClass.options.isNewStack&&!this.eventsSdkClass.servers.length)throw new Error("Socket servers not defined");this.eventsSdkClass.server&&this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${this.eventsSdkClass.server.Version}`),!this.eventsSdkClass.server&&this.eventsSdkClass.URLList.length&&this.eventsSdkClass.socketIoClass.getSocketIoFunction(`v=${e.Version}`),e.IdentityCode&&(this.token=e.IdentityCode,this.eventsSdkClass.connect(it.MAIN)),e.Token&&(this.token=e.Token,this.eventsSdkClass.connect(it.MAIN)),e.RefreshToken&&e.IdentityCodeExpiry&&this.eventsSdkClass.options.loginType===rt.USER&&(this.refreshToken=e.RefreshToken,this.tokenExpiry=e.IdentityCodeExpiry,this.handleTokenExpiry()),e.RefreshToken&&e.TokenExpiry&&this.normalizeLoginType(this.eventsSdkClass.options.loginType)===rt.USER&&(this.refreshToken=e.RefreshToken,this.tokenExpiry=e.TokenExpiry,this.handleTokenExpiry())}handleTokenExpiry(){if(!this.eventsSdkClass.options.refreshTokenUrl)throw new Error("refreshTokenUrl not provided");let e;if(this.tokenExpiry)e=new Date(this.tokenExpiry);else return;const t=e.getTime()-new Date().getTime()-5e3,n=Math.min(t,2147483647);setTimeout(async()=>{if(this.refreshToken){this.eventsSdkClass.socketIoClass.closeAllConnections();let r,o;if(this.eventsSdkClass.options.isNewStack){const u=await this.externalRefreshToken(this.eventsSdkClass.options.refreshTokenUrl,this.refreshToken);r=await this.getSettings(u.Data.AccessToken),o={...u.Data,...r}}else o={...(await this.externalRefreshToken(this.eventsSdkClass.options.refreshTokenUrl,this.refreshToken)).Data.Socket};this.onLoginResponse(o),await vt.updateSessionStorageKey(this.storageKey,o)}},n)}async externalLogin(e,{password:t,token:n,email:r},o){if(!e)throw new Error("loginUrl not provided");let u;this.eventsSdkClass.options.isNewStack?o===rt.TOKEN?u=JSON.stringify({identityType:rt.TOKEN,token:n}):u=JSON.stringify({identityType:rt.USER,username:r,password:t}):this.eventsSdkClass.options.loginType===rt.TOKEN?(u=JSON.stringify({token:n}),e=`${e}/${rt.TOKEN}`):(u=JSON.stringify({email:r,pin:t}),e=`${e}/${rt.USER}`);let h;try{const d=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:u});if(!d.ok&&d.status===400)throw h=400,new Error("Bad body request. Login type or isNewStack values not correct or not provided");if(!d.ok&&d.status===401)throw h=401,new Error("Unauthorized. Invalid token provided");if(!d.ok&&d.status===403)throw h=403,new Error("Forbidden. Identity token not provided or not valid");const c=await d.json();if(c.error)throw new Error(c.error);return c}catch(d){throw this.eventsSdkClass.loggerClass.loginError(o,h,n,r),d}}async getSettings(e){try{if(!this.eventsSdkClass.options.getSettingsUrl)throw new Error("getSettingsUrl not provided");const t=await fetch(this.eventsSdkClass.options.getSettingsUrl,{headers:{Authorization:`Bearer ${e}`}});if(!t.ok&&t.status===401)throw new Error("Unauthorized. Access token not provided or not valid");return t.json()}catch(t){throw this.eventsSdkClass.loggerClass.getSettingsError(e,t),t}}async externalRefreshToken(e,t){try{return(await fetch(e,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`}})).json()}catch(n){throw this.eventsSdkClass.loggerClass.refreshTokenError(t,e,n),n}}normalizeLoginType(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}}const en={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 nn(){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=ut,typeof self.navigator>"u"&&(self.navigator={userAgent:"node"})),function s(e,t,n){function r(h,d){if(!t[h]){if(!e[h]){var c=typeof require=="function"&&require;if(!d&&c)return c(h,!0);if(o)return o(h,!0);throw new Error("Cannot find module '"+h+"'")}var p=t[h]={exports:{}};e[h][0].call(p.exports,function(l){var i=e[h][1][l];return r(i||l)},p,p.exports,s,e,t,n)}return t[h].exports}for(var o=typeof require=="function"&&require,u=0;u<n.length;u++)r(n[u]);return r}({1:[function(s,e){e.exports=s("./lib/")},{"./lib/":2}],2:[function(s,e,t){function n(c,p){typeof c=="object"&&(p=c,c=void 0),p=p||{};var l,i=r(c),a=i.source,f=i.id;return p.forceNew||p["force new connection"]||p.multiplex===!1?(h("ignoring socket cache for %s",a),l=u(a,p)):(d[f]||(h("new io instance for %s",a),d[f]=u(a,p)),l=d[f]),l.socket(i.path)}var r=s("./url"),o=s("socket.io-parser"),u=s("./manager"),h=s("debug")("socket.io-client");e.exports=t=n;var d=t.managers={};t.protocol=o.protocol,t.connect=n,t.Manager=s("./manager"),t.Socket=s("./socket")},{"./manager":3,"./socket":5,"./url":6,debug:10,"socket.io-parser":44}],3:[function(s,e){function t(i,a){return this instanceof t?(i&&typeof i=="object"&&(a=i,i=void 0),a=a||{},a.path=a.path||"/socket.io",this.nsps={},this.subs=[],this.opts=a,this.reconnection(a.reconnection!==!1),this.reconnectionAttempts(a.reconnectionAttempts||1/0),this.reconnectionDelay(a.reconnectionDelay||1e3),this.reconnectionDelayMax(a.reconnectionDelayMax||5e3),this.randomizationFactor(a.randomizationFactor||.5),this.backoff=new l({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(a.timeout==null?2e4:a.timeout),this.readyState="closed",this.uri=i,this.connected=[],this.encoding=!1,this.packetBuffer=[],this.encoder=new u.Encoder,this.decoder=new u.Decoder,this.autoConnect=a.autoConnect!==!1,void(this.autoConnect&&this.open())):new t(i,a)}var n=(s("./url"),s("engine.io-client")),r=s("./socket"),o=s("component-emitter"),u=s("socket.io-parser"),h=s("./on"),d=s("component-bind"),c=(s("object-component"),s("debug")("socket.io-client:manager")),p=s("indexof"),l=s("backo2");e.exports=t,t.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var i in this.nsps)this.nsps[i].emit.apply(this.nsps[i],arguments)},t.prototype.updateSocketIds=function(){for(var i in this.nsps)this.nsps[i].id=this.engine.id},o(t.prototype),t.prototype.reconnection=function(i){return arguments.length?(this._reconnection=!!i,this):this._reconnection},t.prototype.reconnectionAttempts=function(i){return arguments.length?(this._reconnectionAttempts=i,this):this._reconnectionAttempts},t.prototype.reconnectionDelay=function(i){return arguments.length?(this._reconnectionDelay=i,this.backoff&&this.backoff.setMin(i),this):this._reconnectionDelay},t.prototype.randomizationFactor=function(i){return arguments.length?(this._randomizationFactor=i,this.backoff&&this.backoff.setJitter(i),this):this._randomizationFactor},t.prototype.reconnectionDelayMax=function(i){return arguments.length?(this._reconnectionDelayMax=i,this.backoff&&this.backoff.setMax(i),this):this._reconnectionDelayMax},t.prototype.timeout=function(i){return arguments.length?(this._timeout=i,this):this._timeout},t.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()},t.prototype.open=t.prototype.connect=function(i){if(c("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;c("opening %s",this.uri),this.engine=n(this.uri,this.opts);var a=this.engine,f=this;this.readyState="opening",this.skipReconnect=!1;var g=h(a,"open",function(){f.onopen(),i&&i()}),y=h(a,"error",function(U){if(c("connect_error"),f.cleanup(),f.readyState="closed",f.emitAll("connect_error",U),i){var F=new Error("Connection error");F.data=U,i(F)}else f.maybeReconnectOnOpen()});if(this._timeout!==!1){var E=this._timeout;c("connect attempt will timeout after %d",E);var j=setTimeout(function(){c("connect attempt timed out after %d",E),g.destroy(),a.close(),a.emit("error","timeout"),f.emitAll("connect_timeout",E)},E);this.subs.push({destroy:function(){clearTimeout(j)}})}return this.subs.push(g),this.subs.push(y),this},t.prototype.onopen=function(){c("open"),this.cleanup(),this.readyState="open",this.emit("open");var i=this.engine;this.subs.push(h(i,"data",d(this,"ondata"))),this.subs.push(h(this.decoder,"decoded",d(this,"ondecoded"))),this.subs.push(h(i,"error",d(this,"onerror"))),this.subs.push(h(i,"close",d(this,"onclose")))},t.prototype.ondata=function(i){this.decoder.add(i)},t.prototype.ondecoded=function(i){this.emit("packet",i)},t.prototype.onerror=function(i){c("error",i),this.emitAll("error",i)},t.prototype.socket=function(i){var a=this.nsps[i];if(!a){a=new r(this,i),this.nsps[i]=a;var f=this;a.on("connect",function(){a.id=f.engine.id,~p(f.connected,a)||f.connected.push(a)})}return a},t.prototype.destroy=function(i){var a=p(this.connected,i);~a&&this.connected.splice(a,1),this.connected.length||this.close()},t.prototype.packet=function(i){c("writing packet %j",i);var a=this;a.encoding?a.packetBuffer.push(i):(a.encoding=!0,this.encoder.encode(i,function(f){for(var g=0;g<f.length;g++)a.engine.write(f[g]);a.encoding=!1,a.processPacketQueue()}))},t.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var i=this.packetBuffer.shift();this.packet(i)}},t.prototype.cleanup=function(){for(var i;i=this.subs.shift();)i.destroy();this.packetBuffer=[],this.encoding=!1,this.decoder.destroy()},t.prototype.close=t.prototype.disconnect=function(){this.skipReconnect=!0,this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},t.prototype.onclose=function(i){c("close"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",i),this._reconnection&&!this.skipReconnect&&this.reconnect()},t.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var i=this;if(this.backoff.attempts>=this._reconnectionAttempts)c("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var a=this.backoff.duration();c("will wait %dms before reconnect attempt",a),this.reconnecting=!0;var f=setTimeout(function(){i.skipReconnect||(c("attempting reconnect"),i.emitAll("reconnect_attempt",i.backoff.attempts),i.emitAll("reconnecting",i.backoff.attempts),i.skipReconnect||i.open(function(g){g?(c("reconnect attempt error"),i.reconnecting=!1,i.reconnect(),i.emitAll("reconnect_error",g.data)):(c("reconnect success"),i.onreconnect())}))},a);this.subs.push({destroy:function(){clearTimeout(f)}})}},t.prototype.onreconnect=function(){var i=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",i)}},{"./on":4,"./socket":5,"./url":6,backo2:7,"component-bind":8,"component-emitter":9,debug:10,"engine.io-client":11,indexof:40,"object-component":41,"socket.io-parser":44}],4:[function(s,e){function t(n,r,o){return n.on(r,o),{destroy:function(){n.removeListener(r,o)}}}e.exports=t},{}],5:[function(s,e,t){function n(a,f){this.io=a,this.nsp=f,this.json=this,this.ids=0,this.acks={},this.io.autoConnect&&this.open(),this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0}var r=s("socket.io-parser"),o=s("component-emitter"),u=s("to-array"),h=s("./on"),d=s("component-bind"),c=s("debug")("socket.io-client:socket"),p=s("has-binary");e.exports=n;var l={connect:1,connect_error:1,connect_timeout:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1},i=o.prototype.emit;o(n.prototype),n.prototype.subEvents=function(){if(!this.subs){var a=this.io;this.subs=[h(a,"open",d(this,"onopen")),h(a,"packet",d(this,"onpacket")),h(a,"close",d(this,"onclose"))]}},n.prototype.open=n.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),this.io.readyState=="open"&&this.onopen(),this)},n.prototype.send=function(){var a=u(arguments);return a.unshift("message"),this.emit.apply(this,a),this},n.prototype.emit=function(a){if(l.hasOwnProperty(a))return i.apply(this,arguments),this;var f=u(arguments),g=r.EVENT;p(f)&&(g=r.BINARY_EVENT);var y={type:g,data:f};return typeof f[f.length-1]=="function"&&(c("emitting packet with ack id %d",this.ids),this.acks[this.ids]=f.pop(),y.id=this.ids++),this.connected?this.packet(y):this.sendBuffer.push(y),this},n.prototype.packet=function(a){a.nsp=this.nsp,this.io.packet(a)},n.prototype.onopen=function(){c("transport is open - connecting"),this.nsp!="/"&&this.packet({type:r.CONNECT})},n.prototype.onclose=function(a){c("close (%s)",a),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",a)},n.prototype.onpacket=function(a){if(a.nsp==this.nsp)switch(a.type){case r.CONNECT:this.onconnect();break;case r.EVENT:this.onevent(a);break;case r.BINARY_EVENT:this.onevent(a);break;case r.ACK:this.onack(a);break;case r.BINARY_ACK:this.onack(a);break;case r.DISCONNECT:this.ondisconnect();break;case r.ERROR:this.emit("error",a.data)}},n.prototype.onevent=function(a){var f=a.data||[];c("emitting event %j",f),a.id!=null&&(c("attaching ack callback to event"),f.push(this.ack(a.id))),this.connected?i.apply(this,f):this.receiveBuffer.push(f)},n.prototype.ack=function(a){var f=this,g=!1;return function(){if(!g){g=!0;var y=u(arguments);c("sending ack %j",y);var E=p(y)?r.BINARY_ACK:r.ACK;f.packet({type:E,id:a,data:y})}}},n.prototype.onack=function(a){c("calling ack %s with %j",a.id,a.data);var f=this.acks[a.id];f.apply(this,a.data),delete this.acks[a.id]},n.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},n.prototype.emitBuffered=function(){var a;for(a=0;a<this.receiveBuffer.length;a++)i.apply(this,this.receiveBuffer[a]);for(this.receiveBuffer=[],a=0;a<this.sendBuffer.length;a++)this.packet(this.sendBuffer[a]);this.sendBuffer=[]},n.prototype.ondisconnect=function(){c("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},n.prototype.destroy=function(){if(this.subs){for(var a=0;a<this.subs.length;a++)this.subs[a].destroy();this.subs=null}this.io.destroy(this)},n.prototype.close=n.prototype.disconnect=function(){return this.connected&&(c("performing disconnect (%s)",this.nsp),this.packet({type:r.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}},{"./on":4,"component-bind":8,"component-emitter":9,debug:10,"has-binary":36,"socket.io-parser":44,"to-array":48}],6:[function(s,e){(function(t){function n(u,c){var d=u,c=c||t.location;return u==null&&(u=c.protocol+"//"+c.host),typeof u=="string"&&(u.charAt(0)=="/"&&(u=u.charAt(1)=="/"?c.protocol+u:c.hostname+u),/^(https?|wss?):\/\//.test(u)||(o("protocol-less url %s",u),u=typeof c<"u"?c.protocol+"//"+u:"https://"+u),o("parse %s",u),d=r(u)),d.port||(/^(http|ws)$/.test(d.protocol)?d.port="80":/^(http|ws)s$/.test(d.protocol)&&(d.port="443")),d.path=d.path||"/",d.id=d.protocol+"://"+d.host+":"+d.port,d.href=d.protocol+"://"+d.host+(c&&c.port==d.port?"":":"+d.port),d}var r=s("parseuri"),o=s("debug")("socket.io-client:url");e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{debug:10,parseuri:42}],7:[function(s,e){function t(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}e.exports=t,t.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var r=Math.random(),o=Math.floor(r*this.jitter*n);n=1&Math.floor(10*r)?n+o:n-o}return 0|Math.min(n,this.max)},t.prototype.reset=function(){this.attempts=0},t.prototype.setMin=function(n){this.ms=n},t.prototype.setMax=function(n){this.max=n},t.prototype.setJitter=function(n){this.jitter=n}},{}],8:[function(s,e){var t=[].slice;e.exports=function(n,r){if(typeof r=="string"&&(r=n[r]),typeof r!="function")throw new Error("bind() requires a function");var o=t.call(arguments,2);return function(){return r.apply(n,o.concat(t.call(arguments)))}}},{}],9:[function(s,e){function t(r){return r?n(r):void 0}function n(r){for(var o in t.prototype)r[o]=t.prototype[o];return r}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(r,o){return this._callbacks=this._callbacks||{},(this._callbacks[r]=this._callbacks[r]||[]).push(o),this},t.prototype.once=function(r,o){function u(){h.off(r,u),o.apply(this,arguments)}var h=this;return this._callbacks=this._callbacks||{},u.fn=o,this.on(r,u),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(r,o){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var u=this._callbacks[r];if(!u)return this;if(arguments.length==1)return delete this._callbacks[r],this;for(var h,d=0;d<u.length;d++)if(h=u[d],h===o||h.fn===o){u.splice(d,1);break}return this},t.prototype.emit=function(r){this._callbacks=this._callbacks||{};var o=[].slice.call(arguments,1),u=this._callbacks[r];if(u){u=u.slice(0);for(var h=0,d=u.length;d>h;++h)u[h].apply(this,o)}return this},t.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks[r]||[]},t.prototype.hasListeners=function(r){return!!this.listeners(r).length}},{}],10:[function(s,e){function t(r){return t.enabled(r)?function(o){o=n(o);var u=new Date,h=u-(t[r]||u);t[r]=u,o=r+" "+o+" +"+t.humanize(h),window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}:function(){}}function n(r){return r instanceof Error?r.stack||r.message:r}e.exports=t,t.names=[],t.skips=[],t.enable=function(r){try{localStorage.debug=r}catch{}for(var o=(r||"").split(/[\s,]+/),u=o.length,h=0;u>h;h++)r=o[h].replace("*",".*?"),r[0]==="-"?t.skips.push(new RegExp("^"+r.substr(1)+"$")):t.names.push(new RegExp("^"+r+"$"))},t.disable=function(){t.enable("")},t.humanize=function(r){var o=1e3,u=6e4,h=60*u;return r>=h?(r/h).toFixed(1)+"h":r>=u?(r/u).toFixed(1)+"m":r>=o?(r/o|0)+"s":r+"ms"},t.enabled=function(r){for(var o=0,u=t.skips.length;u>o;o++)if(t.skips[o].test(r))return!1;for(var o=0,u=t.names.length;u>o;o++)if(t.names[o].test(r))return!0;return!1};try{window.localStorage&&t.enable(localStorage.debug)}catch{}},{}],11:[function(s,e){e.exports=s("./lib/")},{"./lib/":12}],12:[function(s,e){e.exports=s("./socket"),e.exports.parser=s("engine.io-parser")},{"./socket":13,"engine.io-parser":25}],13:[function(s,e){(function(t){function n(a,f){if(!(this instanceof n))return new n(a,f);if(f=f||{},a&&typeof a=="object"&&(f=a,a=null),a&&(a=p(a),f.host=a.host,f.secure=a.protocol=="https"||a.protocol=="wss",f.port=a.port,a.query&&(f.query=a.query)),this.secure=f.secure!=null?f.secure:t.location&&location.protocol=="https:",f.host){var g=f.host.split(":");f.hostname=g.shift(),g.length?f.port=g.pop():f.port||(f.port=this.secure?"443":"80")}this.agent=f.agent||!1,this.hostname=f.hostname||(t.location?location.hostname:"localhost"),this.port=f.port||(t.location&&location.port?location.port:this.secure?443:80),this.query=f.query||{},typeof this.query=="string"&&(this.query=i.decode(this.query)),this.upgrade=f.upgrade!==!1,this.path=(f.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!f.forceJSONP,this.jsonp=f.jsonp!==!1,this.forceBase64=!!f.forceBase64,this.enablesXDR=!!f.enablesXDR,this.timestampParam=f.timestampParam||"t",this.timestampRequests=f.timestampRequests,this.transports=f.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.callbackBuffer=[],this.policyPort=f.policyPort||843,this.rememberUpgrade=f.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=f.onlyBinaryUpgrades,this.pfx=f.pfx||null,this.key=f.key||null,this.passphrase=f.passphrase||null,this.cert=f.cert||null,this.ca=f.ca||null,this.ciphers=f.ciphers||null,this.rejectUnauthorized=f.rejectUnauthorized||null,this.open()}function r(a){var f={};for(var g in a)a.hasOwnProperty(g)&&(f[g]=a[g]);return f}var o=s("./transports"),u=s("component-emitter"),h=s("debug")("engine.io-client:socket"),d=s("indexof"),c=s("engine.io-parser"),p=s("parseuri"),l=s("parsejson"),i=s("parseqs");e.exports=n,n.priorWebsocketSuccess=!1,u(n.prototype),n.protocol=c.protocol,n.Socket=n,n.Transport=s("./transport"),n.transports=s("./transports"),n.parser=s("engine.io-parser"),n.prototype.createTransport=function(a){h('creating transport "%s"',a);var f=r(this.query);f.EIO=c.protocol,f.transport=a,this.id&&(f.sid=this.id);var g=new o[a]({agent:this.agent,hostname:this.hostname,port:this.port,secure:this.secure,path:this.path,query:f,forceJSONP:this.forceJSONP,jsonp:this.jsonp,forceBase64:this.forceBase64,enablesXDR:this.enablesXDR,timestampRequests:this.timestampRequests,timestampParam:this.timestampParam,policyPort:this.policyPort,socket:this,pfx:this.pfx,key:this.key,passphrase:this.passphrase,cert:this.cert,ca:this.ca,ciphers:this.ciphers,rejectUnauthorized:this.rejectUnauthorized});return g},n.prototype.open=function(){var f;if(this.rememberUpgrade&&n.priorWebsocketSuccess&&this.transports.indexOf("websocket")!=-1)f="websocket";else{if(this.transports.length==0){var a=this;return void setTimeout(function(){a.emit("error","No transports available")},0)}f=this.transports[0]}this.readyState="opening";var f;try{f=this.createTransport(f)}catch{return this.transports.shift(),void this.open()}f.open(),this.setTransport(f)},n.prototype.setTransport=function(a){h("setting transport %s",a.name);var f=this;this.transport&&(h("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=a,a.on("drain",function(){f.onDrain()}).on("packet",function(g){f.onPacket(g)}).on("error",function(g){f.onError(g)}).on("close",function(){f.onClose("transport close")})},n.prototype.probe=function(a){function f(){if(T.onlyBinaryUpgrades){var A=!this.supportsBinary&&T.transport.supportsBinary;S=S||A}S||(h('probe transport "%s" opened',a),L.send([{type:"ping",data:"probe"}]),L.once("packet",function(m){if(!S)if(m.type=="pong"&&m.data=="probe"){if(h('probe transport "%s" pong',a),T.upgrading=!0,T.emit("upgrading",L),!L)return;n.priorWebsocketSuccess=L.name=="websocket",h('pausing current transport "%s"',T.transport.name),T.transport.pause(function(){S||T.readyState!="closed"&&(h("changing transport and sending upgrade packet"),F(),T.setTransport(L),L.send([{type:"upgrade"}]),T.emit("upgrade",L),L=null,T.upgrading=!1,T.flush())})}else{h('probe transport "%s" failed',a);var v=new Error("probe error");v.transport=L.name,T.emit("upgradeError",v)}}))}function g(){S||(S=!0,F(),L.close(),L=null)}function y(A){var m=new Error("probe error: "+A);m.transport=L.name,g(),h('probe transport "%s" failed because of error: %s',a,A),T.emit("upgradeError",m)}function E(){y("transport closed")}function j(){y("socket closed")}function U(A){L&&A.name!=L.name&&(h('"%s" works - aborting "%s"',A.name,L.name),g())}function F(){L.removeListener("open",f),L.removeListener("error",y),L.removeListener("close",E),T.removeListener("close",j),T.removeListener("upgrading",U)}h('probing transport "%s"',a);var L=this.createTransport(a,{probe:1}),S=!1,T=this;n.priorWebsocketSuccess=!1,L.once("open",f),L.once("error",y),L.once("close",E),this.once("close",j),this.once("upgrading",U),L.open()},n.prototype.onOpen=function(){if(h("socket open"),this.readyState="open",n.priorWebsocketSuccess=this.transport.name=="websocket",this.emit("open"),this.flush(),this.readyState=="open"&&this.upgrade&&this.transport.pause){h("starting upgrade probes");for(var a=0,f=this.upgrades.length;f>a;a++)this.probe(this.upgrades[a])}},n.prototype.onPacket=function(a){if(this.readyState=="opening"||this.readyState=="open")switch(h('socket receive: type "%s", data "%s"',a.type,a.data),this.emit("packet",a),this.emit("heartbeat"),a.type){case"open":this.onHandshake(l(a.data));break;case"pong":this.setPing();break;case"error":var f=new Error("server error");f.code=a.data,this.emit("error",f);break;case"message":this.emit("data",a.data),this.emit("message",a.data)}else h('packet received with socket readyState "%s"',this.readyState)},n.prototype.onHandshake=function(a){this.emit("handshake",a),this.id=a.sid,this.transport.query.sid=a.sid,this.upgrades=this.filterUpgrades(a.upgrades),this.pingInterval=a.pingInterval,this.pingTimeout=a.pingTimeout,this.onOpen(),this.readyState!="closed"&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},n.prototype.onHeartbeat=function(a){clearTimeout(this.pingTimeoutTimer);var f=this;f.pingTimeoutTimer=setTimeout(function(){f.readyState!="closed"&&f.onClose("ping timeout")},a||f.pingInterval+f.pingTimeout)},n.prototype.setPing=function(){var a=this;clearTimeout(a.pingIntervalTimer),a.pingIntervalTimer=setTimeout(function(){h("writing ping packet - expecting pong within %sms",a.pingTimeout),a.ping(),a.onHeartbeat(a.pingTimeout)},a.pingInterval)},n.prototype.ping=function(){this.sendPacket("ping")},n.prototype.onDrain=function(){for(var a=0;a<this.prevBufferLen;a++)this.callbackBuffer[a]&&this.callbackBuffer[a]();this.writeBuffer.splice(0,this.prevBufferLen),this.callbackBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length==0?this.emit("drain"):this.flush()},n.prototype.flush=function(){this.readyState!="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(h("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},n.prototype.write=n.prototype.send=function(a,f){return this.sendPacket("message",a,f),this},n.prototype.sendPacket=function(a,f,g){if(this.readyState!="closing"&&this.readyState!="closed"){var y={type:a,data:f};this.emit("packetCreate",y),this.writeBuffer.push(y),this.callbackBuffer.push(g),this.flush()}},n.prototype.close=function(){function a(){y.onClose("forced close"),h("socket closing - telling transport to close"),y.transport.close()}function f(){y.removeListener("upgrade",f),y.removeListener("upgradeError",f),a()}function g(){y.once("upgrade",f),y.once("upgradeError",f)}if(this.readyState=="opening"||this.readyState=="open"){this.readyState="closing";var y=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?g():a()}):this.upgrading?g():a()}return this},n.prototype.onError=function(a){h("socket error %j",a),n.priorWebsocketSuccess=!1,this.emit("error",a),this.onClose("transport error",a)},n.prototype.onClose=function(a,f){if(this.readyState=="opening"||this.readyState=="open"||this.readyState=="closing"){h('socket close with reason: "%s"',a);var g=this;clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),setTimeout(function(){g.writeBuffer=[],g.callbackBuffer=[],g.prevBufferLen=0},0),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",a,f)}},n.prototype.filterUpgrades=function(a){for(var f=[],g=0,y=a.length;y>g;g++)~d(this.transports,a[g])&&f.push(a[g]);return f}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./transport":14,"./transports":15,"component-emitter":9,debug:22,"engine.io-parser":25,indexof:40,parsejson:32,parseqs:33,parseuri:34}],14:[function(s,e){function t(o){this.path=o.path,this.hostname=o.hostname,this.port=o.port,this.secure=o.secure,this.query=o.query,this.timestampParam=o.timestampParam,this.timestampRequests=o.timestampRequests,this.readyState="",this.agent=o.agent||!1,this.socket=o.socket,this.enablesXDR=o.enablesXDR,this.pfx=o.pfx,this.key=o.key,this.passphrase=o.passphrase,this.cert=o.cert,this.ca=o.ca,this.ciphers=o.ciphers,this.rejectUnauthorized=o.rejectUnauthorized}var n=s("engine.io-parser"),r=s("component-emitter");e.exports=t,r(t.prototype),t.timestamps=0,t.prototype.onError=function(o,u){var h=new Error(o);return h.type="TransportError",h.description=u,this.emit("error",h),this},t.prototype.open=function(){return(this.readyState=="closed"||this.readyState=="")&&(this.readyState="opening",this.doOpen()),this},t.prototype.close=function(){return(this.readyState=="opening"||this.readyState=="open")&&(this.doClose(),this.onClose()),this},t.prototype.send=function(o){if(this.readyState!="open")throw new Error("Transport not open");this.write(o)},t.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},t.prototype.onData=function(o){var u=n.decodePacket(o,this.socket.binaryType);this.onPacket(u)},t.prototype.onPacket=function(o){this.emit("packet",o)},t.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},{"component-emitter":9,"engine.io-parser":25}],15:[function(s,e,t){(function(n){function r(c){var p,l=!1,i=!1,a=c.jsonp!==!1;if(n.location){var f=location.protocol=="https:",g=location.port;g||(g=f?443:80),l=c.hostname!=location.hostname||g!=c.port,i=c.secure!=f}if(c.xdomain=l,c.xscheme=i,p=new o(c),"open"in p&&!c.forceJSONP)return new u(c);if(!a)throw new Error("JSONP disabled");return new h(c)}var o=s("xmlhttprequest"),u=s("./polling-xhr"),h=s("./polling-jsonp"),d=s("./websocket");t.polling=r,t.websocket=d}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling-jsonp":16,"./polling-xhr":17,"./websocket":19,xmlhttprequest:20}],16:[function(s,e){(function(t){function n(){}function r(p){o.call(this,p),this.query=this.query||{},h||(t.___eio||(t.___eio=[]),h=t.___eio),this.index=h.length;var l=this;h.push(function(i){l.onData(i)}),this.query.j=this.index,t.document&&t.addEventListener&&t.addEventListener("beforeunload",function(){l.script&&(l.script.onerror=n)},!1)}var o=s("./polling"),u=s("component-inherit");e.exports=r;var h,d=/\n/g,c=/\\n/g;u(r,o),r.prototype.supportsBinary=!1,r.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),o.prototype.doClose.call(this)},r.prototype.doPoll=function(){var p=this,l=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),l.async=!0,l.src=this.uri(),l.onerror=function(f){p.onError("jsonp poll error",f)};var i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(l,i),this.script=l;var a=typeof navigator<"u"&&/gecko/i.test(navigator.userAgent);a&&setTimeout(function(){var f=document.createElement("iframe");document.body.appendChild(f),document.body.removeChild(f)},100)},r.prototype.doWrite=function(p,l){function i(){a(),l()}function a(){if(f.iframe)try{f.form.removeChild(f.iframe)}catch(F){f.onError("jsonp polling iframe removal error",F)}try{var U='<iframe src="javascript:0" name="'+f.iframeId+'">';g=document.createElement(U)}catch{g=document.createElement("iframe"),g.name=f.iframeId,g.src="javascript:0"}g.id=f.iframeId,f.form.appendChild(g),f.iframe=g}var f=this;if(!this.form){var g,y=document.createElement("form"),E=document.createElement("textarea"),j=this.iframeId="eio_iframe_"+this.index;y.className="socketio",y.style.position="absolute",y.style.top="-1000px",y.style.left="-1000px",y.target=j,y.method="POST",y.setAttribute("accept-charset","utf-8"),E.name="d",y.appendChild(E),document.body.appendChild(y),this.form=y,this.area=E}this.form.action=this.uri(),a(),p=p.replace(c,`\\
7
+ `),this.area.value=p.replace(d,"\\n");try{this.form.submit()}catch{}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){f.iframe.readyState=="complete"&&i()}:this.iframe.onload=i}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling":18,"component-inherit":21}],17:[function(s,e){(function(t){function n(){}function r(i){if(d.call(this,i),t.location){var a=location.protocol=="https:",f=location.port;f||(f=a?443:80),this.xd=i.hostname!=t.location.hostname||f!=i.port,this.xs=i.secure!=a}}function o(i){this.method=i.method||"GET",this.uri=i.uri,this.xd=!!i.xd,this.xs=!!i.xs,this.async=i.async!==!1,this.data=i.data!=null?i.data:null,this.agent=i.agent,this.isBinary=i.isBinary,this.supportsBinary=i.supportsBinary,this.enablesXDR=i.enablesXDR,this.pfx=i.pfx,this.key=i.key,this.passphrase=i.passphrase,this.cert=i.cert,this.ca=i.ca,this.ciphers=i.ciphers,this.rejectUnauthorized=i.rejectUnauthorized,this.create()}function u(){for(var i in o.requests)o.requests.hasOwnProperty(i)&&o.requests[i].abort()}var h=s("xmlhttprequest"),d=s("./polling"),c=s("component-emitter"),p=s("component-inherit"),l=s("debug")("engine.io-client:polling-xhr");e.exports=r,e.exports.Request=o,p(r,d),r.prototype.supportsBinary=!0,r.prototype.request=function(i){return i=i||{},i.uri=this.uri(),i.xd=this.xd,i.xs=this.xs,i.agent=this.agent||!1,i.supportsBinary=this.supportsBinary,i.enablesXDR=this.enablesXDR,i.pfx=this.pfx,i.key=this.key,i.passphrase=this.passphrase,i.cert=this.cert,i.ca=this.ca,i.ciphers=this.ciphers,i.rejectUnauthorized=this.rejectUnauthorized,new o(i)},r.prototype.doWrite=function(i,a){var f=typeof i!="string"&&i!==void 0,g=this.request({method:"POST",data:i,isBinary:f}),y=this;g.on("success",a),g.on("error",function(E){y.onError("xhr post error",E)}),this.sendXhr=g},r.prototype.doPoll=function(){l("xhr poll");var i=this.request(),a=this;i.on("data",function(f){a.onData(f)}),i.on("error",function(f){a.onError("xhr poll error",f)}),this.pollXhr=i},c(o.prototype),o.prototype.create=function(){var i={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};i.pfx=this.pfx,i.key=this.key,i.passphrase=this.passphrase,i.cert=this.cert,i.ca=this.ca,i.ciphers=this.ciphers,i.rejectUnauthorized=this.rejectUnauthorized;var a=this.xhr=new h(i),f=this;try{if(l("xhr open %s: %s",this.method,this.uri),a.open(this.method,this.uri,this.async),this.supportsBinary&&(a.responseType="arraybuffer"),this.method=="POST")try{this.isBinary?a.setRequestHeader("Content-type","application/octet-stream"):a.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}"withCredentials"in a&&(a.withCredentials=!0),this.hasXDR()?(a.onload=function(){f.onLoad()},a.onerror=function(){f.onError(a.responseText)}):a.onreadystatechange=function(){a.readyState==4&&(a.status==200||a.status==1223?f.onLoad():setTimeout(function(){f.onError(a.status)},0))},l("xhr data %s",this.data),a.send(this.data)}catch(g){return void setTimeout(function(){f.onError(g)},0)}t.document&&(this.index=o.requestsCount++,o.requests[this.index]=this)},o.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},o.prototype.onData=function(i){this.emit("data",i),this.onSuccess()},o.prototype.onError=function(i){this.emit("error",i),this.cleanup(!0)},o.prototype.cleanup=function(i){if(typeof this.xhr<"u"&&this.xhr!==null){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=n:this.xhr.onreadystatechange=n,i)try{this.xhr.abort()}catch{}t.document&&delete o.requests[this.index],this.xhr=null}},o.prototype.onLoad=function(){var i;try{var a;try{a=this.xhr.getResponseHeader("Content-Type").split(";")[0]}catch{}i=a==="application/octet-stream"?this.xhr.response:this.supportsBinary?"ok":this.xhr.responseText}catch(f){this.onError(f)}i!=null&&this.onData(i)},o.prototype.hasXDR=function(){return typeof t.XDomainRequest<"u"&&!this.xs&&this.enablesXDR},o.prototype.abort=function(){this.cleanup()},t.document&&(o.requestsCount=0,o.requests={},t.attachEvent?t.attachEvent("onunload",u):t.addEventListener&&t.addEventListener("beforeunload",u,!1))}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./polling":18,"component-emitter":9,"component-inherit":21,debug:22,xmlhttprequest:20}],18:[function(s,e){function t(c){var p=c&&c.forceBase64;(!d||p)&&(this.supportsBinary=!1),n.call(this,c)}var n=s("../transport"),r=s("parseqs"),o=s("engine.io-parser"),u=s("component-inherit"),h=s("debug")("engine.io-client:polling");e.exports=t;var d=function(){var c=s("xmlhttprequest"),p=new c({xdomain:!1});return p.responseType!=null}();u(t,n),t.prototype.name="polling",t.prototype.doOpen=function(){this.poll()},t.prototype.pause=function(c){function p(){h("paused"),l.readyState="paused",c()}var l=this;if(this.readyState="pausing",this.polling||!this.writable){var i=0;this.polling&&(h("we are currently polling - waiting to pause"),i++,this.once("pollComplete",function(){h("pre-pause polling complete"),--i||p()})),this.writable||(h("we are currently writing - waiting to pause"),i++,this.once("drain",function(){h("pre-pause writing complete"),--i||p()}))}else p()},t.prototype.poll=function(){h("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},t.prototype.onData=function(c){var p=this;h("polling got data %s",c);var l=function(i){return p.readyState=="opening"&&p.onOpen(),i.type=="close"?(p.onClose(),!1):void p.onPacket(i)};o.decodePayload(c,this.socket.binaryType,l),this.readyState!="closed"&&(this.polling=!1,this.emit("pollComplete"),this.readyState=="open"?this.poll():h('ignoring poll - transport state "%s"',this.readyState))},t.prototype.doClose=function(){function c(){h("writing close packet"),p.write([{type:"close"}])}var p=this;this.readyState=="open"?(h("transport open - closing"),c()):(h("transport not open - deferring close"),this.once("open",c))},t.prototype.write=function(c){var l=this;this.writable=!1;var p=function(){l.writable=!0,l.emit("drain")},l=this;o.encodePayload(c,this.supportsBinary,function(i){l.doWrite(i,p)})},t.prototype.uri=function(){var c=this.query||{},p=this.secure?"https":"http",l="";return this.timestampRequests!==!1&&(c[this.timestampParam]=+new Date+"-"+n.timestamps++),this.supportsBinary||c.sid||(c.b64=1),c=r.encode(c),this.port&&(p=="https"&&this.port!=443||p=="http"&&this.port!=80)&&(l=":"+this.port),c.length&&(c="?"+c),p+"://"+this.hostname+l+this.path+c}},{"../transport":14,"component-inherit":21,debug:22,"engine.io-parser":25,parseqs:33,xmlhttprequest:20}],19:[function(s,e){function t(c){var p=c&&c.forceBase64;p&&(this.supportsBinary=!1),n.call(this,c)}var n=s("../transport"),r=s("engine.io-parser"),o=s("parseqs"),u=s("component-inherit"),h=s("debug")("engine.io-client:websocket"),d=s("ws");e.exports=t,u(t,n),t.prototype.name="websocket",t.prototype.supportsBinary=!0,t.prototype.doOpen=function(){if(this.check()){var c=this.uri(),p=void 0,l={agent:this.agent};l.pfx=this.pfx,l.key=this.key,l.passphrase=this.passphrase,l.cert=this.cert,l.ca=this.ca,l.ciphers=this.ciphers,l.rejectUnauthorized=this.rejectUnauthorized,this.ws=new d(c,p,l),this.ws.binaryType===void 0&&(this.supportsBinary=!1),this.ws.binaryType="arraybuffer",this.addEventListeners()}},t.prototype.addEventListeners=function(){var c=this;this.ws.onopen=function(){c.onOpen()},this.ws.onclose=function(){c.onClose()},this.ws.onmessage=function(p){c.onData(p.data)},this.ws.onerror=function(p){c.onError("websocket error",p)}},typeof navigator<"u"&&/iPad|iPhone|iPod/i.test(navigator.userAgent)&&(t.prototype.onData=function(c){var p=this;setTimeout(function(){n.prototype.onData.call(p,c)},0)}),t.prototype.write=function(c){function p(){l.writable=!0,l.emit("drain")}var l=this;this.writable=!1;for(var i=0,a=c.length;a>i;i++)r.encodePacket(c[i],this.supportsBinary,function(f){try{l.ws.send(f)}catch{h("websocket closed before onclose event")}});setTimeout(p,0)},t.prototype.onClose=function(){n.prototype.onClose.call(this)},t.prototype.doClose=function(){typeof this.ws<"u"&&this.ws.close()},t.prototype.uri=function(){var c=this.query||{},p=this.secure?"wss":"ws",l="";return this.port&&(p=="wss"&&this.port!=443||p=="ws"&&this.port!=80)&&(l=":"+this.port),this.timestampRequests&&(c[this.timestampParam]=+new Date),this.supportsBinary||(c.b64=1),c=o.encode(c),c.length&&(c="?"+c),p+"://"+this.hostname+l+this.path+c},t.prototype.check=function(){return!(!d||"__initialize"in d&&this.name===t.prototype.name)}},{"../transport":14,"component-inherit":21,debug:22,"engine.io-parser":25,parseqs:33,ws:35}],20:[function(s,e){var t=s("has-cors");e.exports=function(n){var r=n.xdomain,o=n.xscheme,u=n.enablesXDR;try{if(typeof XMLHttpRequest<"u"&&(!r||t))return new XMLHttpRequest}catch{}try{if(typeof XDomainRequest<"u"&&!o&&u)return new XDomainRequest}catch{}if(!r)try{return new ActiveXObject("Microsoft.XMLHTTP")}catch{}}},{"has-cors":38}],21:[function(s,e){e.exports=function(t,n){var r=function(){};r.prototype=n.prototype,t.prototype=new r,t.prototype.constructor=t}},{}],22:[function(s,e,t){function n(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function r(){var d=arguments,c=this.useColors;if(d[0]=(c?"%c":"")+this.namespace+(c?" %c":" ")+d[0]+(c?"%c ":" ")+"+"+t.humanize(this.diff),!c)return d;var p="color: "+this.color;d=[d[0],p,"color: inherit"].concat(Array.prototype.slice.call(d,1));var l=0,i=0;return d[0].replace(/%[a-z%]/g,function(a){a!=="%%"&&(l++,a==="%c"&&(i=l))}),d.splice(i,0,p),d}function o(){return typeof console=="object"&&typeof console.log=="function"&&Function.prototype.apply.call(console.log,console,arguments)}function u(d){try{d==null?localStorage.removeItem("debug"):localStorage.debug=d}catch{}}function h(){var d;try{d=localStorage.debug}catch{}return d}t=e.exports=s("./debug"),t.log=o,t.formatArgs=r,t.save=u,t.load=h,t.useColors=n,t.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],t.formatters.j=function(d){return JSON.stringify(d)},t.enable(h())},{"./debug":23}],23:[function(s,e,t){function n(){return t.colors[p++%t.colors.length]}function r(l){function i(){}function a(){var g=a,y=+new Date,E=y-(c||y);g.diff=E,g.prev=c,g.curr=y,c=y,g.useColors==null&&(g.useColors=t.useColors()),g.color==null&&g.useColors&&(g.color=n());var j=Array.prototype.slice.call(arguments);j[0]=t.coerce(j[0]),typeof j[0]!="string"&&(j=["%o"].concat(j));var U=0;j[0]=j[0].replace(/%([a-z%])/g,function(L,S){if(L==="%%")return L;U++;var T=t.formatters[S];if(typeof T=="function"){var A=j[U];L=T.call(g,A),j.splice(U,1),U--}return L}),typeof t.formatArgs=="function"&&(j=t.formatArgs.apply(g,j));var F=a.log||t.log||console.log.bind(console);F.apply(g,j)}i.enabled=!1,a.enabled=!0;var f=t.enabled(l)?a:i;return f.namespace=l,f}function o(l){t.save(l);for(var i=(l||"").split(/[\s,]+/),a=i.length,f=0;a>f;f++)i[f]&&(l=i[f].replace(/\*/g,".*?"),l[0]==="-"?t.skips.push(new RegExp("^"+l.substr(1)+"$")):t.names.push(new RegExp("^"+l+"$")))}function u(){t.enable("")}function h(l){var i,a;for(i=0,a=t.skips.length;a>i;i++)if(t.skips[i].test(l))return!1;for(i=0,a=t.names.length;a>i;i++)if(t.names[i].test(l))return!0;return!1}function d(l){return l instanceof Error?l.stack||l.message:l}t=e.exports=r,t.coerce=d,t.disable=u,t.enable=o,t.enabled=h,t.humanize=s("ms"),t.names=[],t.skips=[],t.formatters={};var c,p=0},{ms:24}],24:[function(s,e){function t(l){var i=/^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(l);if(i){var a=parseFloat(i[1]),f=(i[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"y":return a*p;case"days":case"day":case"d":return a*c;case"hours":case"hour":case"h":return a*d;case"minutes":case"minute":case"m":return a*h;case"seconds":case"second":case"s":return a*u;case"ms":return a}}}function n(l){return l>=c?Math.round(l/c)+"d":l>=d?Math.round(l/d)+"h":l>=h?Math.round(l/h)+"m":l>=u?Math.round(l/u)+"s":l+"ms"}function r(l){return o(l,c,"day")||o(l,d,"hour")||o(l,h,"minute")||o(l,u,"second")||l+" ms"}function o(l,i,a){return i>l?void 0:1.5*i>l?Math.floor(l/i)+" "+a:Math.ceil(l/i)+" "+a+"s"}var u=1e3,h=60*u,d=60*h,c=24*d,p=365.25*c;e.exports=function(l,i){return i=i||{},typeof l=="string"?t(l):i.long?r(l):n(l)}},{}],25:[function(s,e,t){(function(n){function r(S,T){var A="b"+t.packets[S.type]+S.data.data;return T(A)}function o(S,T,A){if(!T)return t.encodeBase64Packet(S,A);var m=S.data,v=new Uint8Array(m),_=new Uint8Array(1+m.byteLength);_[0]=j[S.type];for(var I=0;I<v.length;I++)_[I+1]=v[I];return A(_.buffer)}function u(S,T,A){if(!T)return t.encodeBase64Packet(S,A);var m=new FileReader;return m.onload=function(){S.data=m.result,t.encodePacket(S,T,!0,A)},m.readAsArrayBuffer(S.data)}function h(S,T,A){if(!T)return t.encodeBase64Packet(S,A);if(E)return u(S,T,A);var m=new Uint8Array(1);m[0]=j[S.type];var v=new L([m.buffer,S.data]);return A(v)}function d(S,T,A){for(var m=new Array(S.length),v=a(S.length,A),_=function(R,k,W){T(k,function(G,Y){m[R]=Y,W(G,m)})},I=0;I<S.length;I++)_(I,S[I],v)}var c=s("./keys"),p=s("has-binary"),l=s("arraybuffer.slice"),i=s("base64-arraybuffer"),a=s("after"),f=s("utf8"),g=navigator.userAgent.match(/Android/i),y=/PhantomJS/i.test(navigator.userAgent),E=g||y;t.protocol=3;var j=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},U=c(j),F={type:"error",data:"parser error"},L=s("blob");t.encodePacket=function(S,T,A,m){typeof T=="function"&&(m=T,T=!1),typeof A=="function"&&(m=A,A=null);var v=S.data===void 0?void 0:S.data.buffer||S.data;if(n.ArrayBuffer&&v instanceof ArrayBuffer)return o(S,T,m);if(L&&v instanceof n.Blob)return h(S,T,m);if(v&&v.base64)return r(S,m);var _=j[S.type];return S.data!==void 0&&(_+=A?f.encode(String(S.data)):String(S.data)),m(""+_)},t.encodeBase64Packet=function(S,T){var A="b"+t.packets[S.type];if(L&&S.data instanceof L){var m=new FileReader;return m.onload=function(){var k=m.result.split(",")[1];T(A+k)},m.readAsDataURL(S.data)}var v;try{v=String.fromCharCode.apply(null,new Uint8Array(S.data))}catch{for(var _=new Uint8Array(S.data),I=new Array(_.length),R=0;R<_.length;R++)I[R]=_[R];v=String.fromCharCode.apply(null,I)}return A+=n.btoa(v),T(A)},t.decodePacket=function(S,T,A){if(typeof S=="string"||S===void 0){if(S.charAt(0)=="b")return t.decodeBase64Packet(S.substr(1),T);if(A)try{S=f.decode(S)}catch{return F}var v=S.charAt(0);return Number(v)==v&&U[v]?S.length>1?{type:U[v],data:S.substring(1)}:{type:U[v]}:F}var m=new Uint8Array(S),v=m[0],_=l(S,1);return L&&T==="blob"&&(_=new L([_])),{type:U[v],data:_}},t.decodeBase64Packet=function(S,T){var A=U[S.charAt(0)];if(!n.ArrayBuffer)return{type:A,data:{base64:!0,data:S.substr(1)}};var m=i.decode(S.substr(1));return T==="blob"&&L&&(m=new L([m])),{type:A,data:m}},t.encodePayload=function(S,T,A){function m(I){return I.length+":"+I}function v(I,R){t.encodePacket(I,_?T:!1,!0,function(k){R(null,m(k))})}typeof T=="function"&&(A=T,T=null);var _=p(S);return T&&_?L&&!E?t.encodePayloadAsBlob(S,A):t.encodePayloadAsArrayBuffer(S,A):S.length?void d(S,v,function(I,R){return A(R.join(""))}):A("0:")},t.decodePayload=function(S,T,A){if(typeof S!="string")return t.decodePayloadAsBinary(S,T,A);typeof T=="function"&&(A=T,T=null);var m;if(S=="")return A(F,0,1);for(var v,_,I="",R=0,k=S.length;k>R;R++){var W=S.charAt(R);if(W!=":")I+=W;else{if(I==""||I!=(v=Number(I))||(_=S.substr(R+1,v),I!=_.length))return A(F,0,1);if(_.length){if(m=t.decodePacket(_,T,!0),F.type==m.type&&F.data==m.data)return A(F,0,1);var G=A(m,R+v,k);if(G===!1)return}R+=v,I=""}}return I!=""?A(F,0,1):void 0},t.encodePayloadAsArrayBuffer=function(S,T){function A(m,v){t.encodePacket(m,!0,!0,function(_){return v(null,_)})}return S.length?void d(S,A,function(m,v){var _=v.reduce(function(k,W){var G;return G=typeof W=="string"?W.length:W.byteLength,k+G.toString().length+G+2},0),I=new Uint8Array(_),R=0;return v.forEach(function(k){var W=typeof k=="string",G=k;if(W){for(var Y=new Uint8Array(k.length),V=0;V<k.length;V++)Y[V]=k.charCodeAt(V);G=Y.buffer}I[R++]=W?0:1;for(var tt=G.byteLength.toString(),V=0;V<tt.length;V++)I[R++]=parseInt(tt[V]);I[R++]=255;for(var Y=new Uint8Array(G),V=0;V<Y.length;V++)I[R++]=Y[V]}),T(I.buffer)}):T(new ArrayBuffer(0))},t.encodePayloadAsBlob=function(S,T){function A(m,v){t.encodePacket(m,!0,!0,function(_){var I=new Uint8Array(1);if(I[0]=1,typeof _=="string"){for(var R=new Uint8Array(_.length),k=0;k<_.length;k++)R[k]=_.charCodeAt(k);_=R.buffer,I[0]=0}for(var W=_ instanceof ArrayBuffer?_.byteLength:_.size,G=W.toString(),Y=new Uint8Array(G.length+1),k=0;k<G.length;k++)Y[k]=parseInt(G[k]);if(Y[G.length]=255,L){var V=new L([I.buffer,Y.buffer,_]);v(null,V)}})}d(S,A,function(m,v){return T(new L(v))})},t.decodePayloadAsBinary=function(S,T,A){typeof T=="function"&&(A=T,T=null);for(var m=S,v=[],_=!1;m.byteLength>0;){for(var I=new Uint8Array(m),R=I[0]===0,k="",W=1;I[W]!=255;W++){if(k.length>310){_=!0;break}k+=I[W]}if(_)return A(F,0,1);m=l(m,2+k.length),k=parseInt(k);var G=l(m,0,k);if(R)try{G=String.fromCharCode.apply(null,new Uint8Array(G))}catch{var Y=new Uint8Array(G);G="";for(var W=0;W<Y.length;W++)G+=String.fromCharCode(Y[W])}v.push(G),m=l(m,k)}var V=v.length;v.forEach(function(tt,St){A(t.decodePacket(tt,T,!0),St,V)})}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./keys":26,after:27,"arraybuffer.slice":28,"base64-arraybuffer":29,blob:30,"has-binary":36,utf8:31}],26:[function(s,e){e.exports=Object.keys||function(t){var n=[],r=Object.prototype.hasOwnProperty;for(var o in t)r.call(t,o)&&n.push(o);return n}},{}],27:[function(s,e){function t(r,o,u){function h(c,p){if(h.count<=0)throw new Error("after called too many times");--h.count,c?(d=!0,o(c),o=u):h.count!==0||d||o(null,p)}var d=!1;return u=u||n,h.count=r,r===0?o():h}function n(){}e.exports=t},{}],28:[function(s,e){e.exports=function(t,n,r){var o=t.byteLength;if(n=n||0,r=r||o,t.slice)return t.slice(n,r);if(0>n&&(n+=o),0>r&&(r+=o),r>o&&(r=o),n>=o||n>=r||o===0)return new ArrayBuffer(0);for(var u=new Uint8Array(t),h=new Uint8Array(r-n),d=n,c=0;r>d;d++,c++)h[c]=u[d];return h.buffer}},{}],29:[function(s,e,t){(function(n){t.encode=function(r){var o,u=new Uint8Array(r),h=u.length,d="";for(o=0;h>o;o+=3)d+=n[u[o]>>2],d+=n[(3&u[o])<<4|u[o+1]>>4],d+=n[(15&u[o+1])<<2|u[o+2]>>6],d+=n[63&u[o+2]];return h%3===2?d=d.substring(0,d.length-1)+"=":h%3===1&&(d=d.substring(0,d.length-2)+"=="),d},t.decode=function(r){var o,u,h,d,c,p=.75*r.length,l=r.length,i=0;r[r.length-1]==="="&&(p--,r[r.length-2]==="="&&p--);var a=new ArrayBuffer(p),f=new Uint8Array(a);for(o=0;l>o;o+=4)u=n.indexOf(r[o]),h=n.indexOf(r[o+1]),d=n.indexOf(r[o+2]),c=n.indexOf(r[o+3]),f[i++]=u<<2|h>>4,f[i++]=(15&h)<<4|d>>2,f[i++]=(3&d)<<6|63&c;return a}})("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")},{}],30:[function(s,e){(function(t){function n(p){for(var l=0;l<p.length;l++){var i=p[l];if(i.buffer instanceof ArrayBuffer){var a=i.buffer;if(i.byteLength!==a.byteLength){var f=new Uint8Array(i.byteLength);f.set(new Uint8Array(a,i.byteOffset,i.byteLength)),a=f.buffer}p[l]=a}}}function r(p,l){l=l||{};var i=new u;n(p);for(var a=0;a<p.length;a++)i.append(p[a]);return l.type?i.getBlob(l.type):i.getBlob()}function o(p,l){return n(p),new Blob(p,l||{})}var u=t.BlobBuilder||t.WebKitBlobBuilder||t.MSBlobBuilder||t.MozBlobBuilder,h=function(){try{var p=new Blob(["hi"]);return p.size===2}catch{return!1}}(),d=h&&function(){try{var p=new Blob([new Uint8Array([1,2])]);return p.size===2}catch{return!1}}(),c=u&&u.prototype.append&&u.prototype.getBlob;e.exports=function(){return h?d?t.Blob:o:c?r:void 0}()}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],31:[function(s,e,t){(function(n){(function(r){function o(m){for(var v,_,I=[],R=0,k=m.length;k>R;)v=m.charCodeAt(R++),v>=55296&&56319>=v&&k>R?(_=m.charCodeAt(R++),(64512&_)==56320?I.push(((1023&v)<<10)+(1023&_)+65536):(I.push(v),R--)):I.push(v);return I}function u(m){for(var v,_=m.length,I=-1,R="";++I<_;)v=m[I],v>65535&&(v-=65536,R+=F(v>>>10&1023|55296),v=56320|1023&v),R+=F(v);return R}function h(m){if(m>=55296&&57343>=m)throw Error("Lone surrogate U+"+m.toString(16).toUpperCase()+" is not a scalar value")}function d(m,v){return F(m>>v&63|128)}function c(m){if(!(4294967168&m))return F(m);var v="";return 4294965248&m?4294901760&m?!(4292870144&m)&&(v=F(m>>18&7|240),v+=d(m,12),v+=d(m,6)):(h(m),v=F(m>>12&15|224),v+=d(m,6)):v=F(m>>6&31|192),v+=F(63&m|128)}function p(m){for(var v,_=o(m),I=_.length,R=-1,k="";++R<I;)v=_[R],k+=c(v);return k}function l(){if(U>=j)throw Error("Invalid byte index");var m=255&E[U];if(U++,(192&m)==128)return 63&m;throw Error("Invalid continuation byte")}function i(){var m,v,_,I,R;if(U>j)throw Error("Invalid byte index");if(U==j)return!1;if(m=255&E[U],U++,(128&m)==0)return m;if((224&m)==192){var v=l();if(R=(31&m)<<6|v,R>=128)return R;throw Error("Invalid continuation byte")}if((240&m)==224){if(v=l(),_=l(),R=(15&m)<<12|v<<6|_,R>=2048)return h(R),R;throw Error("Invalid continuation byte")}if((248&m)==240&&(v=l(),_=l(),I=l(),R=(15&m)<<18|v<<12|_<<6|I,R>=65536&&1114111>=R))return R;throw Error("Invalid UTF-8 detected")}function a(m){E=o(m),j=E.length,U=0;for(var v,_=[];(v=i())!==!1;)_.push(v);return u(_)}var f=typeof t=="object"&&t,g=typeof e=="object"&&e&&e.exports==f&&e,y=typeof n=="object"&&n;(y.global===y||y.window===y)&&(r=y);var E,j,U,F=String.fromCharCode,L={version:"2.0.0",encode:p,decode:a};if(f&&!f.nodeType)if(g)g.exports=L;else{var S={},T=S.hasOwnProperty;for(var A in L)T.call(L,A)&&(f[A]=L[A])}else r.utf8=L})(this)}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],32:[function(s,e){(function(t){var n=/^[\],:{}\s]*$/,r=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,o=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,u=/(?:^|:|,)(?:\s*\[)+/g,h=/^\s+/,d=/\s+$/;e.exports=function(c){return typeof c=="string"&&c?(c=c.replace(h,"").replace(d,""),t.JSON&&JSON.parse?JSON.parse(c):n.test(c.replace(r,"@").replace(o,"]").replace(u,""))?new Function("return "+c)():void 0):null}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],33:[function(s,e,t){t.encode=function(n){var r="";for(var o in n)n.hasOwnProperty(o)&&(r.length&&(r+="&"),r+=encodeURIComponent(o)+"="+encodeURIComponent(n[o]));return r},t.decode=function(n){for(var r={},o=n.split("&"),u=0,h=o.length;h>u;u++){var d=o[u].split("=");r[decodeURIComponent(d[0])]=decodeURIComponent(d[1])}return r}},{}],34:[function(s,e){var t=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function(r){var o=r,u=r.indexOf("["),h=r.indexOf("]");u!=-1&&h!=-1&&(r=r.substring(0,u)+r.substring(u,h).replace(/:/g,";")+r.substring(h,r.length));for(var d=t.exec(r||""),c={},p=14;p--;)c[n[p]]=d[p]||"";return u!=-1&&h!=-1&&(c.source=o,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c}},{}],35:[function(s,e){function t(o,u){return u?new r(o,u):new r(o)}var n=function(){return self}(),r=n.WebSocket||n.MozWebSocket;e.exports=r?t:null,r&&(t.prototype=r.prototype)},{}],36:[function(s,e){(function(t){function n(o){function u(h){if(!h)return!1;if(t.Buffer&&t.Buffer.isBuffer(h)||t.ArrayBuffer&&h instanceof ArrayBuffer||t.Blob&&h instanceof Blob||t.File&&h instanceof File)return!0;if(r(h)){for(var d=0;d<h.length;d++)if(u(h[d]))return!0}else if(h&&typeof h=="object"){h.toJSON&&(h=h.toJSON());for(var c in h)if(Object.prototype.hasOwnProperty.call(h,c)&&u(h[c]))return!0}return!1}return u(o)}var r=s("isarray");e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{isarray:37}],37:[function(s,e){e.exports=Array.isArray||function(t){return Object.prototype.toString.call(t)=="[object Array]"}},{}],38:[function(s,e){var t=s("global");try{e.exports="XMLHttpRequest"in t&&"withCredentials"in new t.XMLHttpRequest}catch{e.exports=!1}},{global:39}],39:[function(s,e){e.exports=function(){return this}()},{}],40:[function(s,e){var t=[].indexOf;e.exports=function(n,r){if(t)return n.indexOf(r);for(var o=0;o<n.length;++o)if(n[o]===r)return o;return-1}},{}],41:[function(s,e,t){var n=Object.prototype.hasOwnProperty;t.keys=Object.keys||function(r){var o=[];for(var u in r)n.call(r,u)&&o.push(u);return o},t.values=function(r){var o=[];for(var u in r)n.call(r,u)&&o.push(r[u]);return o},t.merge=function(r,o){for(var u in o)n.call(o,u)&&(r[u]=o[u]);return r},t.length=function(r){return t.keys(r).length},t.isEmpty=function(r){return t.length(r)==0}},{}],42:[function(s,e){var t=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,n=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function(r){for(var o=t.exec(r||""),u={},h=14;h--;)u[n[h]]=o[h]||"";return u}},{}],43:[function(s,e,t){(function(n){var r=s("isarray"),o=s("./is-buffer");t.deconstructPacket=function(u){function h(l){if(!l)return l;if(o(l)){var i={_placeholder:!0,num:d.length};return d.push(l),i}if(r(l)){for(var a=new Array(l.length),f=0;f<l.length;f++)a[f]=h(l[f]);return a}if(typeof l=="object"&&!(l instanceof Date)){var a={};for(var g in l)a[g]=h(l[g]);return a}return l}var d=[],c=u.data,p=u;return p.data=h(c),p.attachments=d.length,{packet:p,buffers:d}},t.reconstructPacket=function(u,h){function d(c){if(c&&c._placeholder){var p=h[c.num];return p}if(r(c)){for(var l=0;l<c.length;l++)c[l]=d(c[l]);return c}if(c&&typeof c=="object"){for(var i in c)c[i]=d(c[i]);return c}return c}return u.data=d(u.data),u.attachments=void 0,u},t.removeBlobs=function(u,h){function d(l,i,a){if(!l)return l;if(n.Blob&&l instanceof Blob||n.File&&l instanceof File){c++;var f=new FileReader;f.onload=function(){a?a[i]=this.result:p=this.result,--c||h(p)},f.readAsArrayBuffer(l)}else if(r(l))for(var g=0;g<l.length;g++)d(l[g],g,l);else if(l&&typeof l=="object"&&!o(l))for(var y in l)d(l[y],y,l)}var c=0,p=u;d(p),c||h(p)}}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{"./is-buffer":45,isarray:46}],44:[function(s,e,t){function n(){}function r(g){var y="",E=!1;return y+=g.type,(t.BINARY_EVENT==g.type||t.BINARY_ACK==g.type)&&(y+=g.attachments,y+="-"),g.nsp&&g.nsp!="/"&&(E=!0,y+=g.nsp),g.id!=null&&(E&&(y+=",",E=!1),y+=g.id),g.data!=null&&(E&&(y+=","),y+=l.stringify(g.data)),p("encoded %j as %s",g,y),y}function o(g,y){function E(j){var U=a.deconstructPacket(j),F=r(U.packet),L=U.buffers;L.unshift(F),y(L)}a.removeBlobs(g,E)}function u(){this.reconstructor=null}function h(g){var y={},E=0;if(y.type=Number(g.charAt(0)),t.types[y.type]==null)return c();if(t.BINARY_EVENT==y.type||t.BINARY_ACK==y.type){for(var j="";g.charAt(++E)!="-"&&(j+=g.charAt(E),E!=g.length););if(j!=Number(j)||g.charAt(E)!="-")throw new Error("Illegal attachments");y.attachments=Number(j)}if(g.charAt(E+1)=="/")for(y.nsp="";++E;){var U=g.charAt(E);if(U==","||(y.nsp+=U,E==g.length))break}else y.nsp="/";var F=g.charAt(E+1);if(F!==""&&Number(F)==F){for(y.id="";++E;){var U=g.charAt(E);if(U==null||Number(U)!=U){--E;break}if(y.id+=g.charAt(E),E==g.length)break}y.id=Number(y.id)}if(g.charAt(++E))try{y.data=l.parse(g.substr(E))}catch{return c()}return p("decoded %s as %j",g,y),y}function d(g){this.reconPack=g,this.buffers=[]}function c(){return{type:t.ERROR,data:"parser error"}}var p=s("debug")("socket.io-parser"),l=s("json3"),i=(s("isarray"),s("component-emitter")),a=s("./binary"),f=s("./is-buffer");t.protocol=4,t.types=["CONNECT","DISCONNECT","EVENT","BINARY_EVENT","ACK","BINARY_ACK","ERROR"],t.CONNECT=0,t.DISCONNECT=1,t.EVENT=2,t.ACK=3,t.ERROR=4,t.BINARY_EVENT=5,t.BINARY_ACK=6,t.Encoder=n,t.Decoder=u,n.prototype.encode=function(g,y){if(p("encoding packet %j",g),t.BINARY_EVENT==g.type||t.BINARY_ACK==g.type)o(g,y);else{var E=r(g);y([E])}},i(u.prototype),u.prototype.add=function(g){var y;if(typeof g=="string")y=h(g),t.BINARY_EVENT==y.type||t.BINARY_ACK==y.type?(this.reconstructor=new d(y),this.reconstructor.reconPack.attachments===0&&this.emit("decoded",y)):this.emit("decoded",y);else{if(!f(g)&&!g.base64)throw new Error("Unknown type: "+g);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");y=this.reconstructor.takeBinaryData(g),y&&(this.reconstructor=null,this.emit("decoded",y))}},u.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},d.prototype.takeBinaryData=function(g){if(this.buffers.push(g),this.buffers.length==this.reconPack.attachments){var y=a.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),y}return null},d.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},{"./binary":43,"./is-buffer":45,"component-emitter":9,debug:10,isarray:46,json3:47}],45:[function(s,e){(function(t){function n(r){return t.Buffer&&t.Buffer.isBuffer(r)||t.ArrayBuffer&&r instanceof ArrayBuffer}e.exports=n}).call(this,typeof self<"u"?self:typeof window<"u"?window:{})},{}],46:[function(s,e){e.exports=s(37)},{}],47:[function(s,e,t){(function(n){function r(w){if(r[w]!==h)return r[w];var O;if(w=="bug-string-char-index")O=!1;else if(w=="json")O=r("json-stringify")&&r("json-parse");else{var C,D='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if(w=="json-stringify"){var b=p.stringify,x=typeof b=="function"&&l;if(x){(C=function(){return 1}).toJSON=C;try{x=b(0)==="0"&&b(new Number)==="0"&&b(new String)=='""'&&b(d)===h&&b(h)===h&&b()===h&&b(C)==="1"&&b([C])=="[1]"&&b([h])=="[null]"&&b(null)=="null"&&b([h,d,null])=="[null,null,null]"&&b({a:[C,!0,!1,null,`\0\b
8
+ \f\r `]})==D&&b(null,C)==="1"&&b([1,2],null,1)==`[
9
9
  1,
10
10
  2
11
- ]`&&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)){_=D(P);var B=_.a.length==5&&_.a[0]===1;if(B){try{B=!D('" "')}catch{}if(B)try{B=D("01")!==1}catch{}if(B)try{B=D("1.")!==1}catch{}}}}catch{B=!1}F=B}}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,_={};return(_.__proto__=null,_.__proto__={toString:1},_).toString!=f?c=function(P){var O=this.__proto__,U=P in(this.__proto__=null,this);return this.__proto__=O,U}:(F=_.constructor,c=function(P){var O=(this.constructor||F).prototype;return P in this&&!(P in O&&this[P]===O[P])}),_=null,c.call(this,I)});var g={boolean:1,number:1,string:1,undefined:1},w=function(I,F){var _=typeof I[F];return _=="object"?!!I[F]:!g[_]};if(l=function(I,F){var _,P,O,U=0;(_=function(){this.valueOf=0}).prototype.valueOf=0,P=new _;for(O in P)c.call(P,O)&&U++;return _=P=null,U?l=U==2?function(D,B){var q,$={},oe=f.call(D)==a;for(q in D)oe&&q=="prototype"||c.call($,q)||!($[q]=1)||!c.call(D,q)||B(q)}:function(D,B){var q,$,oe=f.call(D)==a;for(q in D)oe&&q=="prototype"||!c.call(D,q)||($=q==="constructor")||B(q);($||c.call(D,q="constructor"))&&B(q)}:(P=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],l=function(D,B){var q,$,oe=f.call(D)==a,ie=!oe&&typeof D.constructor!="function"&&w(D,"hasOwnProperty")?D.hasOwnProperty:c;for(q in D)oe&&q=="prototype"||!ie.call(D,q)||B(q);for($=P.length;q=P[--$];ie.call(D,q)&&B(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,_='"',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:_+=E[D];break;default:if(32>D){_+=N+k(2,D.toString(16));break}_+=U?F[P]:T?I.charAt(P):I[P]}}return _+'"'},L=function(I,F,_,P,O,U,D){var B,q,$,oe,ie,Ge,Xt,Wt,Gt,Jt,de,Ht,ut,Je,Vt,$t;try{B=F[I]}catch{}if(typeof B=="object"&&B)if(q=f.call(B),q!=s||c.call(B,"toJSON"))typeof B.toJSON=="function"&&(q!=d&&q!=y&&q!=m||c.call(B,"toJSON"))&&(B=B.toJSON(I));else if(B>-1/0&&1/0>B){if(S){for(ie=R(B/864e5),$=R(ie/365.2425)+1970-1;S($+1,0)<=ie;$++);for(oe=R((ie-S($,0))/30.42);S($,oe+1)<=ie;oe++);ie=1+ie-S($,oe),Ge=(B%864e5+864e5)%864e5,Xt=R(Ge/36e5)%24,Wt=R(Ge/6e4)%60,Gt=R(Ge/1e3)%60,Jt=Ge%1e3}else $=B.getUTCFullYear(),oe=B.getUTCMonth(),ie=B.getUTCDate(),Xt=B.getUTCHours(),Wt=B.getUTCMinutes(),Gt=B.getUTCSeconds(),Jt=B.getUTCMilliseconds();B=(0>=$||$>=1e4?(0>$?"-":"+")+k(6,0>$?-$:$):k(4,$))+"-"+k(2,oe+1)+"-"+k(2,ie)+"T"+k(2,Xt)+":"+k(2,Wt)+":"+k(2,Gt)+"."+k(3,Jt)+"Z"}else B=null;if(_&&(B=_.call(F,I,B)),B===null)return"null";if(q=f.call(B),q==v)return""+B;if(q==d)return B>-1/0&&1/0>B?""+B:"null";if(q==y)return x(""+B);if(typeof B=="object"){for(Je=D.length;Je--;)if(D[Je]===B)throw TypeError();if(D.push(B),de=[],Vt=U,U+=O,q==m){for(ut=0,Je=B.length;Je>ut;ut++)Ht=L(ut,B,_,P,O,U,D),de.push(Ht===p?"null":Ht);$t=de.length?O?`[
12
- `+U+de.join(`,
13
- `+U)+`
14
- `+Vt+"]":"["+de.join(",")+"]":"[]"}else l(P||B,function(Kt){var $r=L(Kt,B,_,P,O,U,D);$r!==p&&de.push(x(Kt)+":"+(O?" ":"")+$r)}),$t=de.length?O?`{
15
- `+U+de.join(`,
16
- `+U)+`
17
- `+Vt+"}":"{"+de.join(",")+"}":"{}";return D.pop(),$t}};u.stringify=function(I,F,_){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 B,q=0,$=F.length;$>q;B=F[q++],D=f.call(B),(D==y||D==d)&&(U[B]=1));}}if(_)if((D=f.call(_))==d){if((_-=_%1)>0)for(P="",_>10&&(_=10);P.length<_;P+=" ");}else D==y&&(P=_.length<=10?_:_.slice(0,10));return L("",(B={},B[""]=I,B),O,U,P,"",[])}}if(!o("json-parse")){var A,z,M=String.fromCharCode,Y={92:"\\",34:'"',47:"/",98:"\b",116:" ",110:`
18
- `,102:"\f",114:"\r"},G=function(){throw A=z=null,SyntaxError()},ne=function(){for(var I,F,_,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)G();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+=Y[O],A++;break;case 117:for(F=++A,_=A+4;_>A;A++)O=U.charCodeAt(A),O>=48&&57>=O||O>=97&&102>=O||O>=65&&70>=O||G();I+=M("0x"+U.slice(F,A));break;default:G()}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;G();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)&&G(),P=!1;D>A&&(O=U.charCodeAt(A),O>=48&&57>=O);A++);if(U.charCodeAt(A)==46){for(_=++A;D>_&&(O=U.charCodeAt(_),O>=48&&57>=O);_++);_==A&&G(),A=_}if(O=U.charCodeAt(A),O==101||O==69){for(O=U.charCodeAt(++A),(O==43||O==45)&&A++,_=A;D>_&&(O=U.charCodeAt(_),O>=48&&57>=O);_++);_==A&&G(),A=_}return+U.slice(F,A)}if(P&&G(),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;G()}return"$"},We=function(I){var F,_;if(I=="$"&&G(),typeof I=="string"){if((T?I.charAt(0):I[0])=="@")return I.slice(1);if(I=="["){for(F=[];I=ne(),I!="]";_||(_=!0))_&&(I==","?(I=ne(),I=="]"&&G()):G()),I==","&&G(),F.push(We(I));return F}if(I=="{"){for(F={};I=ne(),I!="}";_||(_=!0))_&&(I==","?(I=ne(),I=="}"&&G()):G()),(I==","||typeof I!="string"||(T?I.charAt(0):I[0])!="@"||ne()!=":")&&G(),F[I.slice(1)]=We(ne());return F}G()}return I},Hr=function(I,F,_){var P=Vr(I,F,_);P===p?delete I[F]:I[F]=P},Vr=function(I,F,_){var P,O=I[F];if(typeof O=="object"&&O)if(f.call(O)==m)for(P=O.length;P--;)Hr(O,P,_);else l(O,function(U){Hr(O,U,_)});return _.call(I,F,O)};u.parse=function(I,F){var _,P;return A=0,z=""+I,_=We(ne()),ne()!="$"&&G(),A=z=null,F&&f.call(F)==a?Vr((P={},P[""]=_,P),"",F):_}}}})(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 on=Object.assign({"./v1_3_7.js":Object.freeze(Object.defineProperty({__proto__:null,default:nn},Symbol.toStringTag,{value:"Module"}))}),sn=/v\d+_\d+_\d+/;function an(t){return typeof t=="function"}const lt=Object.entries(on).reduce((t,e)=>{var o;const r=e[1].default,n=(o=e[0].match(sn))==null?void 0:o[0];return an(r)&&n&&(t[n]=r()),t},{}),tr=t=>{if(t in lt)return lt[t];throw new Error(`Socket version ${t} not found`)},cn={...lt,getSocketVersion:tr,makeSocketVersion:(t,...e)=>tr(t)(...e)};var rr=(t=>(t.RINGING="Ringing",t.TALKING="Talking",t.DIALING="Dialing",t.HOLD="Hold",t))(rr||{}),nr=(t=>(t.INCOMING="Incoming",t.OUTGOING="Outgoing",t))(nr||{}),ge=(t=>(t.CONNECTED="connected",t.DISCONNECTED="disconnected",t.TRYING_TO_CONNECT="tryingToConnect",t))(ge||{}),or=(t=>(t.AUTOMATIC="Automatic",t.IVR="IVR",t))(or||{}),sr=(t=>(t.INCOMINC="Incoming",t.OUTGOING="Outgoing",t.SPY="Spy",t.CLICK2CALL="Click2Call",t))(sr||{}),ir=(t=>(t.RESPONSE_FROM_API_VALID="RESPONSE_FROM_API_VALID",t.RESPONSE_FROM_API_INVALID="RESPONSE_FROM_API_INVALID",t))(ir||{}),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||{}),ar=(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))(ar||{}),cr=(t=>(t.ANSWER="ANSWER",t.ABANDONED="ABANDONED",t.EXIT="EXIT",t.JOIN="JOIN",t))(cr||{});class He{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 dt=(t=>(t.UPDATE_MONITORED_EXTENSIONS="updateMonitoredExtensions",t.KEEP_ALIVE="keepalive",t))(dt||{});class hn{constructor(e){H(this,"io");H(this,"ioFunction");H(this,"lastEventTimestamp",new Date().getTime());H(this,"doReconnect",!0);H(this,"keepAliveInterval");H(this,"keepReconnectInterval");H(this,"keepReconnectTimeout");H(this,"connected",!1);H(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(he.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(he.NEXT)},5e3)}))}getSocketIoFunction(e){const r=e.split("v="),n="v".concat(r[r.length-1]).replaceAll(".","_");this.ioFunction=cn.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:ge.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(dt.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,He.mapQueueEvent(e))}onExtensionEvent(e,r){const n=He.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,He.mapLoginStatusEvent(e))}onAllExtensionStatus(e,r){const n=He.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:ge.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?ge.TRYING_TO_CONNECT:ge.DISCONNECTED}),this.eventsSdkClass.loggerClass.sdkDisconnect([e]),this.keepReconnectTimeout=setTimeout(()=>{this.reconnectionTime=this.reconnectionTime+20,this.reconnectionTime>120&&(this.reconnectionTime=20),this.eventsSdkClass.connect(he.NEXT)},this.reconnectionTime*1e3))}onConnectError(e){this.eventsSdkClass.eventEmitterClass.emit(j.ONLINE_STATUS_EVENT,{connectionStatus:this.doReconnect?ge.TRYING_TO_CONNECT:ge.DISCONNECTED}),this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(e),this.keepReconnectTimeout=setTimeout(()=>{this.reconnectionTime=this.reconnectionTime+20,this.reconnectionTime>60&&(this.reconnectionTime=20),this.eventsSdkClass.connect(he.NEXT)},this.reconnectionTime*1e3)}}var un=Object.defineProperty,pn=(t,e,r)=>e in t?un(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,V=(t,e,r)=>(pn(t,typeof e!="symbol"?e+"":e,r),r);function ln(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function fn(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 yt={exports:{}},dn=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,yn=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],hr=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=dn.exec(t||""),c={},l=14;l--;)c[yn[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=gn(c,c.path),c.queryKey=mn(c,c.query),c};function gn(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 mn(t,e){var r={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,o,c){o&&(r[o]=c)}),r}var gt={exports:{}},mt={exports:{}},Ie=1e3,_e=Ie*60,Be=_e*60,Fe=Be*24,vn=Fe*365.25,Cn=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return bn(t);if(r==="number"&&isNaN(t)===!1)return e.long?wn(t):kn(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function bn(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*vn;case"days":case"day":case"d":return r*Fe;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Be;case"minutes":case"minute":case"mins":case"min":case"m":return r*_e;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 kn(t){return t>=Fe?Math.round(t/Fe)+"d":t>=Be?Math.round(t/Be)+"h":t>=_e?Math.round(t/_e)+"m":t>=Ie?Math.round(t/Ie)+"s":t+"ms"}function wn(t){return Ve(t,Fe,"day")||Ve(t,Be,"hour")||Ve(t,_e,"minute")||Ve(t,Ie,"second")||t+" ms"}function Ve(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=Cn,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}})(mt,mt.exports);var Sn=mt.exports;(function(t,e){e=t.exports=Sn,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{}}})(gt,gt.exports);var $e=gt.exports,En=hr,ur=$e("socket.io-client:url"),An=Tn;function Tn(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)||(ur("protocol-less url %s",t),typeof e<"u"?t=e.protocol+"//"+t:t="https://"+t),ur("parse %s",t),r=En(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 Ke={},vt={exports:{}},Ct={exports:{}},Ue=1e3,De=Ue*60,Pe=De*60,je=Pe*24,Nn=je*365.25,On=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return xn(t);if(r==="number"&&isNaN(t)===!1)return e.long?Ln(t):Rn(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function xn(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*Nn;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 Rn(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 Ln(t){return Ye(t,je,"day")||Ye(t,Pe,"hour")||Ye(t,De,"minute")||Ye(t,Ue,"second")||t+" ms"}function Ye(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=On,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}})(Ct,Ct.exports);var In=Ct.exports;(function(t,e){e=t.exports=In,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{}}})(vt,vt.exports);var _n=vt.exports,pr={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}})(pr);var Se=pr.exports,Qe={},Bn={}.toString,bt=Array.isArray||function(t){return Bn.call(t)=="[object Array]"},lr=Pn,Fn=typeof Buffer=="function"&&typeof Buffer.isBuffer=="function",Un=typeof ArrayBuffer=="function",Dn=function(t){return typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer};function Pn(t){return Fn&&Buffer.isBuffer(t)||Un&&(t instanceof ArrayBuffer||Dn(t))}var kt=bt,fr=lr,dr=Object.prototype.toString,jn=typeof Blob=="function"||typeof Blob<"u"&&dr.call(Blob)==="[object BlobConstructor]",Mn=typeof File=="function"||typeof File<"u"&&dr.call(File)==="[object FileConstructor]";Qe.deconstructPacket=function(t){var e=[],r=t.data,n=t;return n.data=wt(r,e),n.attachments=e.length,{packet:n,buffers:e}};function wt(t,e){if(!t)return t;if(fr(t)){var r={_placeholder:!0,num:e.length};return e.push(t),r}else if(kt(t)){for(var n=new Array(t.length),o=0;o<t.length;o++)n[o]=wt(t[o],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){var n={};for(var c in t)n[c]=wt(t[c],e);return n}return t}Qe.reconstructPacket=function(t,e){return t.data=St(t.data,e),t.attachments=void 0,t};function St(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(kt(t))for(var n=0;n<t.length;n++)t[n]=St(t[n],e);else if(typeof t=="object")for(var o in t)t[o]=St(t[o],e);return t}Qe.removeBlobs=function(t,e){function r(c,l,p){if(!c)return c;if(jn&&c instanceof Blob||Mn&&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(kt(c))for(var i=0;i<c.length;i++)r(c[i],i,c);else if(typeof c=="object"&&!fr(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=_n("socket.io-parser"),r=Se,n=Qe,o=bt,c=lr;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}}}(Ke);var Et={exports:{}},Ze={},At={exports:{}};try{At.exports=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{At.exports=!1}var qn=At.exports,Tt=function(){return typeof self<"u"?self:typeof window<"u"?window:Function("return this")()}(),zn=qn,Xn=Tt,Nt=function(t){var e=t.xdomain,r=t.xscheme,n=t.enablesXDR;try{if(typeof XMLHttpRequest<"u"&&(!e||zn))return new XMLHttpRequest}catch{}try{if(typeof XDomainRequest<"u"&&!r&&n)return new XDomainRequest}catch{}if(!e)try{return new Xn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}},Ot={exports:{}},we={},Wn=Object.keys||function(t){var e=[],r=Object.prototype.hasOwnProperty;for(var n in t)r.call(t,n)&&e.push(n);return e},Gn=bt,yr=Object.prototype.toString,Jn=typeof Blob=="function"||typeof Blob<"u"&&yr.call(Blob)==="[object BlobConstructor]",Hn=typeof File=="function"||typeof File<"u"&&yr.call(File)==="[object FileConstructor]",gr=et;function et(t){if(!t||typeof t!="object")return!1;if(Gn(t)){for(var e=0,r=t.length;e<r;e++)if(et(t[e]))return!0;return!1}if(typeof Buffer=="function"&&Buffer.isBuffer&&Buffer.isBuffer(t)||typeof ArrayBuffer=="function"&&t instanceof ArrayBuffer||Jn&&t instanceof Blob||Hn&&t instanceof File)return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return et(t.toJSON(),!0);for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&et(t[n]))return!0;return!1}var Vn=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},$n=Kn;function Kn(t,e,r){var n=!1;return r=r||Yn,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 Yn(){}/*! https://mths.be/utf8js v2.1.2 by @mathias */var me=String.fromCharCode;function mr(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 Qn(t){for(var e=t.length,r=-1,n,o="";++r<e;)n=t[r],n>65535&&(n-=65536,o+=me(n>>>10&1023|55296),n=56320|n&1023),o+=me(n);return o}function vr(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 xt(t,e){return me(t>>e&63|128)}function Zn(t,e){if(!(t&4294967168))return me(t);var r="";return t&4294965248?t&4294901760?t&4292870144||(r=me(t>>18&7|240),r+=xt(t,12),r+=xt(t,6)):(vr(t,e)||(t=65533),r=me(t>>12&15|224),r+=xt(t,6)):r=me(t>>6&31|192),r+=me(t&63|128),r}function eo(t,e){e=e||{};for(var r=e.strict!==!1,n=mr(t),o=n.length,c=-1,l,p="";++c<o;)l=n[c],p+=Zn(l,r);return p}function Ee(){if(ve>=rt)throw Error("Invalid byte index");var t=tt[ve]&255;if(ve++,(t&192)==128)return t&63;throw Error("Invalid continuation byte")}function to(t){var e,r,n,o,c;if(ve>rt)throw Error("Invalid byte index");if(ve==rt)return!1;if(e=tt[ve]&255,ve++,!(e&128))return e;if((e&224)==192){if(r=Ee(),c=(e&31)<<6|r,c>=128)return c;throw Error("Invalid continuation byte")}if((e&240)==224){if(r=Ee(),n=Ee(),c=(e&15)<<12|r<<6|n,c>=2048)return vr(c,t)?c:65533;throw Error("Invalid continuation byte")}if((e&248)==240&&(r=Ee(),n=Ee(),o=Ee(),c=(e&7)<<18|r<<12|n<<6|o,c>=65536&&c<=1114111))return c;throw Error("Invalid UTF-8 detected")}var tt,rt,ve;function ro(t,e){e=e||{};var r=e.strict!==!1;tt=mr(t),rt=tt.length,ve=0;for(var n=[],o;(o=to(r))!==!1;)n.push(o);return Qn(n)}var no={version:"2.1.2",encode:eo,decode:ro},Rt={},Cr;function oo(){return Cr||(Cr=1,function(t){Rt.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},Rt.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+/")),Rt}var Lt,br;function so(){if(br)return Lt;br=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),Lt=function(){return e?r?Blob:l:n?c:void 0}(),Lt}(function(t){var e=Wn,r=gr,n=Vn,o=$n,c=no,l;typeof ArrayBuffer<"u"&&(l=oo());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=so();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 Y=A.byteLength.toString(),M=0;M<Y.length;M++)k[N++]=parseInt(Y[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,Y){g(t.decodePacket(M,S,!0),Y,z)})}})(we);var It,kr;function _t(){if(kr)return It;kr=1;var t=we,e=Se;It=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")},It}var Ae={};Ae.encode=function(t){var e="";for(var r in t)t.hasOwnProperty(r)&&(e.length&&(e+="&"),e+=encodeURIComponent(r)+"="+encodeURIComponent(t[r]));return e},Ae.decode=function(t){for(var e={},r=t.split("&"),n=0,o=r.length;n<o;n++){var c=r[n].split("=");e[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return e};var nt=function(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t},wr="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),ot=64,Sr={},Er=0,Ce=0,Ar;function Bt(t){var e="";do e=wr[t%ot]+e,t=Math.floor(t/ot);while(t>0);return e}function io(t){var e=0;for(Ce=0;Ce<t.length;Ce++)e=e*ot+Sr[t.charAt(Ce)];return e}function Ft(){var t=Bt(+new Date);return t!==Ar?(Er=0,Ar=t):t+"."+Bt(Er++)}for(;Ce<ot;Ce++)Sr[wr[Ce]]=Ce;Ft.encode=Bt,Ft.decode=io;var Tr=Ft,Ut={exports:{}},Dt={exports:{}},Me=1e3,qe=Me*60,ze=qe*60,Xe=ze*24,ao=Xe*365.25,co=function(t,e){e=e||{};var r=typeof t;if(r==="string"&&t.length>0)return ho(t);if(r==="number"&&isNaN(t)===!1)return e.long?po(t):uo(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))};function ho(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*ao;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 uo(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 po(t){return st(t,Xe,"day")||st(t,ze,"hour")||st(t,qe,"minute")||st(t,Me,"second")||t+" ms"}function st(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=co,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}})(Dt,Dt.exports);var lo=Dt.exports;(function(t,e){e=t.exports=lo,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{}}})(Ut,Ut.exports);var it=Ut.exports,Nr=_t(),fo=Ae,Or=we,yo=nt,go=Tr,ce=it("engine.io-client:polling"),xr=ue,mo=function(){var t=Nt,e=new t({xdomain:!1});return e.responseType!=null}();function ue(t){var e=t&&t.forceBase64;(!mo||e)&&(this.supportsBinary=!1),Nr.call(this,t)}yo(ue,Nr),ue.prototype.name="polling",ue.prototype.doOpen=function(){this.poll()},ue.prototype.pause=function(t){var e=this;this.readyState="pausing";function r(){ce("paused"),e.readyState="paused",t()}if(this.polling||!this.writable){var n=0;this.polling&&(ce("we are currently polling - waiting to pause"),n++,this.once("pollComplete",function(){ce("pre-pause polling complete"),--n||r()})),this.writable||(ce("we are currently writing - waiting to pause"),n++,this.once("drain",function(){ce("pre-pause writing complete"),--n||r()}))}else r()},ue.prototype.poll=function(){ce("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},ue.prototype.onData=function(t){var e=this;ce("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)};Or.decodePayload(t,this.socket.binaryType,r),this.readyState!=="closed"&&(this.polling=!1,this.emit("pollComplete"),this.readyState==="open"?this.poll():ce('ignoring poll - transport state "%s"',this.readyState))},ue.prototype.doClose=function(){var t=this;function e(){ce("writing close packet"),t.write([{type:"close"}])}this.readyState==="open"?(ce("transport open - closing"),e()):(ce("transport not open - deferring close"),this.once("open",e))},ue.prototype.write=function(t){var e=this;this.writable=!1;var r=function(){e.writable=!0,e.emit("drain")};Or.encodePayload(t,this.supportsBinary,function(n){e.doWrite(n,r)})},ue.prototype.uri=function(){var t=this.query||{},e=this.secure?"https":"http",r="";this.timestampRequests!==!1&&(t[this.timestampParam]=go()),!this.supportsBinary&&!t.sid&&(t.b64=1),t=fo.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 vo=Nt,Rr=xr,Co=Se,bo=nt,Pt=it("engine.io-client:polling-xhr"),ko=Tt;Ot.exports=Te,Ot.exports.Request=Z;function Lr(){}function Te(t){if(Rr.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}}bo(Te,Rr),Te.prototype.supportsBinary=!0,Te.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 Z(t)},Te.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},Te.prototype.doPoll=function(){Pt("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 Z(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()}if(Co(Z.prototype),Z.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 vo(t),r=this;try{Pt("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))},Pt("xhr data %s",this.data),e.send(this.data)}catch(o){setTimeout(function(){r.onError(o)},0);return}typeof document<"u"&&(this.index=Z.requestsCount++,Z.requests[this.index]=this)},Z.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},Z.prototype.onData=function(t){this.emit("data",t),this.onSuccess()},Z.prototype.onError=function(t){this.emit("error",t),this.cleanup(!0)},Z.prototype.cleanup=function(t){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=Lr:this.xhr.onreadystatechange=Lr,t)try{this.xhr.abort()}catch{}typeof document<"u"&&delete Z.requests[this.index],this.xhr=null}},Z.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)},Z.prototype.hasXDR=function(){return typeof XDomainRequest<"u"&&!this.xs&&this.enablesXDR},Z.prototype.abort=function(){this.cleanup()},Z.requestsCount=0,Z.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Ir);else if(typeof addEventListener=="function"){var wo="onpagehide"in ko?"pagehide":"unload";addEventListener(wo,Ir,!1)}}function Ir(){for(var t in Z.requests)Z.requests.hasOwnProperty(t)&&Z.requests[t].abort()}var So=Ot.exports,jt=xr,Eo=nt,_r=Tt,Ao=Ne,To=/\n/g,No=/\\n/g,at;function Oo(){}function Ne(t){jt.call(this,t),this.query=this.query||{},at||(at=_r.___eio=_r.___eio||[]),this.index=at.length;var e=this;at.push(function(r){e.onData(r)}),this.query.j=this.index,typeof addEventListener=="function"&&addEventListener("beforeunload",function(){e.script&&(e.script.onerror=Oo)},!1)}Eo(Ne,jt),Ne.prototype.supportsBinary=!1,Ne.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),jt.prototype.doClose.call(this)},Ne.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)},Ne.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(No,`\\
19
- `),this.area.value=t.replace(To,"\\n");try{this.form.submit()}catch{}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){r.iframe.readyState==="complete"&&p()}:this.iframe.onload=p};const xo={},Ro=Object.freeze(Object.defineProperty({__proto__:null,default:xo},Symbol.toStringTag,{value:"Module"})),Lo=fn(Ro);var Mt=_t(),Io=we,_o=Ae,Bo=nt,Fo=Tr,Uo=it("engine.io-client:websocket"),ct,qt;if(typeof WebSocket<"u"?ct=WebSocket:typeof self<"u"&&(ct=self.WebSocket||self.MozWebSocket),typeof window>"u")try{qt=Lo}catch{}var Oe=ct||qt,Do=se;function se(t){var e=t&&t.forceBase64;e&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=ct&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(Oe=qt),Mt.call(this,t)}Bo(se,Mt),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 Oe(t,e):new Oe(t):new Oe(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){Io.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{Uo("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(){Mt.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]=Fo()),this.supportsBinary||(t.b64=1),t=_o.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!!Oe&&!("__initialize"in Oe&&this.name===se.prototype.name)};var Po=Nt,jo=So,Mo=Ao,qo=Do;Ze.polling=zo,Ze.websocket=qo;function zo(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 Po(t),"open"in e&&!t.forceJSONP)return new jo(t);if(!o)throw new Error("JSONP disabled");return new Mo(t)}var Xo=[].indexOf,Br=function(t,e){if(Xo)return t.indexOf(e);for(var r=0;r<t.length;++r)if(t[r]===e)return r;return-1},Wo=Ze,Go=Se,Q=it("engine.io-client:socket"),Jo=Br,Fr=we,Ur=hr,Ho=Ae,Vo=X;function X(t,e){if(!(this instanceof X))return new X(t,e);e=e||{},t&&typeof t=="object"&&(e=t,t=null),t?(t=Ur(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=Ur(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=Ho.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()}X.priorWebsocketSuccess=!1,Go(X.prototype),X.protocol=Fr.protocol,X.Socket=X,X.Transport=_t(),X.transports=Ze,X.parser=we,X.prototype.createTransport=function(t){Q('creating transport "%s"',t);var e=$o(this.query);e.EIO=Fr.protocol,e.transport=t;var r=this.transportOptions[t]||{};this.id&&(e.sid=this.id);var n=new Wo[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 $o(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e}X.prototype.open=function(){var t;if(this.rememberUpgrade&&X.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)},X.prototype.setTransport=function(t){Q("setting transport %s",t.name);var e=this;this.transport&&(Q("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")})},X.prototype.probe=function(t){Q('probing transport "%s"',t);var e=this.createTransport(t,{probe:1}),r=!1,n=this;X.priorWebsocketSuccess=!1;function o(){if(n.onlyBinaryUpgrades){var h=!this.supportsBinary&&n.transport.supportsBinary;r=r||h}r||(Q('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(Q('probe transport "%s" pong',t),n.upgrading=!0,n.emit("upgrading",e),!e)return;X.priorWebsocketSuccess=e.name==="websocket",Q('pausing current transport "%s"',n.transport.name),n.transport.pause(function(){r||n.readyState!=="closed"&&(Q("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{Q('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(),Q('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&&(Q('"%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()},X.prototype.onOpen=function(){if(Q("socket open"),this.readyState="open",X.priorWebsocketSuccess=this.transport.name==="websocket",this.emit("open"),this.flush(),this.readyState==="open"&&this.upgrade&&this.transport.pause){Q("starting upgrade probes");for(var t=0,e=this.upgrades.length;t<e;t++)this.probe(this.upgrades[t])}},X.prototype.onPacket=function(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(Q('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 Q('packet received with socket readyState "%s"',this.readyState)},X.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))},X.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)},X.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){Q("writing ping packet - expecting pong within %sms",t.pingTimeout),t.ping(),t.onHeartbeat(t.pingTimeout)},t.pingInterval)},X.prototype.ping=function(){var t=this;this.sendPacket("ping",function(){t.emit("ping")})},X.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emit("drain"):this.flush()},X.prototype.flush=function(){this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(Q("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},X.prototype.write=X.prototype.send=function(t,e,r){return this.sendPacket("message",t,e,r),this},X.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()}},X.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"),Q("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},X.prototype.onError=function(t){Q("socket error %j",t),X.priorWebsocketSuccess=!1,this.emit("error",t),this.onClose("transport error",t)},X.prototype.onClose=function(t,e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){Q('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}},X.prototype.filterUpgrades=function(t){for(var e=[],r=0,n=t.length;r<n;r++)~Jo(this.transports,t[r])&&e.push(t[r]);return e},Et.exports=Vo,Et.exports.parser=we;var Ko=Et.exports,Dr={exports:{}},Yo=Qo;function Qo(t,e){var r=[];e=e||0;for(var n=e||0;n<t.length;n++)r[n-e]=t[n];return r}var Pr=Zo;function Zo(t,e,r){return t.on(e,r),{destroy:function(){t.removeListener(e,r)}}}var jr=[].slice,Mr=function(t,e){if(typeof e=="string"&&(e=t[e]),typeof e!="function")throw new Error("bind() requires a function");var r=jr.call(arguments,2);return function(){return e.apply(t,r.concat(jr.call(arguments)))}};(function(t,e){var r=Ke,n=Se,o=Yo,c=Pr,l=Mr,p=$e("socket.io-client:socket"),f=Ae,i=gr;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}})(Dr);var qr=Dr.exports,es=xe;function xe(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}xe.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},xe.prototype.reset=function(){this.attempts=0},xe.prototype.setMin=function(t){this.ms=t},xe.prototype.setMax=function(t){this.max=t},xe.prototype.setJitter=function(t){this.jitter=t};var ts=Ko,rs=qr,ns=Se,os=Ke,be=Pr,Re=Mr,te=$e("socket.io-client:manager"),zr=Br,ss=es,Xr=Object.prototype.hasOwnProperty,Wr=J;function J(t,e){if(!(this instanceof J))return new J(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 ss({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||os;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=e.autoConnect!==!1,this.autoConnect&&this.open()}J.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var t in this.nsps)Xr.call(this.nsps,t)&&this.nsps[t].emit.apply(this.nsps[t],arguments)},J.prototype.updateSocketIds=function(){for(var t in this.nsps)Xr.call(this.nsps,t)&&(this.nsps[t].id=this.generateId(t))},J.prototype.generateId=function(t){return(t==="/"?"":t+"#")+this.engine.id},ns(J.prototype),J.prototype.reconnection=function(t){return arguments.length?(this._reconnection=!!t,this):this._reconnection},J.prototype.reconnectionAttempts=function(t){return arguments.length?(this._reconnectionAttempts=t,this):this._reconnectionAttempts},J.prototype.reconnectionDelay=function(t){return arguments.length?(this._reconnectionDelay=t,this.backoff&&this.backoff.setMin(t),this):this._reconnectionDelay},J.prototype.randomizationFactor=function(t){return arguments.length?(this._randomizationFactor=t,this.backoff&&this.backoff.setJitter(t),this):this._randomizationFactor},J.prototype.reconnectionDelayMax=function(t){return arguments.length?(this._reconnectionDelayMax=t,this.backoff&&this.backoff.setMax(t),this):this._reconnectionDelayMax},J.prototype.timeout=function(t){return arguments.length?(this._timeout=t,this):this._timeout},J.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()},J.prototype.open=J.prototype.connect=function(t,e){if(te("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;te("opening %s",this.uri),this.engine=ts(this.uri,this.opts);var r=this.engine,n=this;this.readyState="opening",this.skipReconnect=!1;var o=be(r,"open",function(){n.onopen(),t&&t()}),c=be(r,"error",function(f){if(te("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;te("connect attempt will timeout after %d",l),l===0&&o.destroy();var p=setTimeout(function(){te("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},J.prototype.onopen=function(){te("open"),this.cleanup(),this.readyState="open",this.emit("open");var t=this.engine;this.subs.push(be(t,"data",Re(this,"ondata"))),this.subs.push(be(t,"ping",Re(this,"onping"))),this.subs.push(be(t,"pong",Re(this,"onpong"))),this.subs.push(be(t,"error",Re(this,"onerror"))),this.subs.push(be(t,"close",Re(this,"onclose"))),this.subs.push(be(this.decoder,"decoded",Re(this,"ondecoded")))},J.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},J.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},J.prototype.ondata=function(t){this.decoder.add(t)},J.prototype.ondecoded=function(t){this.emit("packet",t)},J.prototype.onerror=function(t){te("error",t),this.emitAll("error",t)},J.prototype.socket=function(t,e){var r=this.nsps[t];if(!r){r=new rs(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(){~zr(n.connecting,r)||n.connecting.push(r)}return r},J.prototype.destroy=function(t){var e=zr(this.connecting,t);~e&&this.connecting.splice(e,1),!this.connecting.length&&this.close()},J.prototype.packet=function(t){te("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()}))},J.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},J.prototype.cleanup=function(){te("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()},J.prototype.close=J.prototype.disconnect=function(){te("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,this.readyState==="opening"&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},J.prototype.onclose=function(t){te("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()},J.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)te("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();te("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var r=setTimeout(function(){t.skipReconnect||(te("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),!t.skipReconnect&&t.open(function(n){n?(te("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",n.data)):(te("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(r)}})}},J.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)},function(t,e){var r=An,n=Ke,o=Wr,c=$e("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=Wr,e.Socket=qr}(yt,yt.exports);var is=yt.exports;const as=ln(is);let ht;const cs=new Uint8Array(16);function hs(){if(!ht&&(ht=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ht))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ht(cs)}const ee=[];for(let t=0;t<256;++t)ee.push((t+256).toString(16).slice(1));function us(t,e=0){return ee[t[e+0]]+ee[t[e+1]]+ee[t[e+2]]+ee[t[e+3]]+"-"+ee[t[e+4]]+ee[t[e+5]]+"-"+ee[t[e+6]]+ee[t[e+7]]+"-"+ee[t[e+8]]+ee[t[e+9]]+"-"+ee[t[e+10]]+ee[t[e+11]]+ee[t[e+12]]+ee[t[e+13]]+ee[t[e+14]]+ee[t[e+15]]}const ps=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Gr={randomUUID:ps};function ls(t,e,r){if(Gr.randomUUID&&!t)return Gr.randomUUID();t=t||{};const n=t.random||(t.rng||hs)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,us(n)}function fs(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 ds(t,e){const r=JSON.parse(t);return e.forEach(n=>delete r[n]),r}function ys(t){if(typeof t=="object"&&t!==null)return t;try{return JSON.parse(t)}catch{return{extraData:t}}}function gs(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 Jr(t){return(...e)=>new Promise((r,n)=>{try{const o=t(...e);r(o)}catch(o){n(o)}})}const ms={reconnection:!0,reconnectionDelay:5e3,reconnectionAttempts:10,upgrade:!1,transports:["websocket"],debug:!1},zt={logToConsole:!0,overloadGlobalConsole:!1,socketEmitInterval:6e4},pe={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"},vs={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},le={INFO:"info",WARNING:"warning",MODIFY:"modify",ERROR:"error",VIEW:"view"},W={INFO:"info",WARNING:"warning",ERROR:"error",DEBUG:"debug"};let re=console;class Cs{constructor(e){V(this,"logToConsole"),V(this,"overloadGlobalConsole"),V(this,"system"),V(this,"socketEmitInterval"),V(this,"storageId"),V(this,"loggerLevel",W.DEBUG),V(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]}),V(this,"emitInProgress"),V(this,"queue"),V(this,"processing"),V(this,"storageInitialized"),V(this,"interval"),V(this,"logIndex"),V(this,"socket"),V(this,"requestUrl"),V(this,"staticObject",{}),V(this,"localObject",{}),V(this,"isGetItemAsync"),V(this,"isSetItemAsync"),V(this,"getItem"),V(this,"setItem"),V(this,"parseLog"),V(this,"_logMethod"),V(this,"_warnMethod"),V(this,"_errorMethod"),V(this,"_debugMethod");const{loggerOptions:r}=e;if(!r.system)throw new Error("Config property 'system' should be provided!");this.isGetItemAsync=r.isGetItemAsync||!1,this.isSetItemAsync=r.isSetItemAsync||!1,this.setupStorageFunctions(r.getItem,r.setItem,r.parseLog),this.system=r.system,r.loggerLevel&&(this.loggerLevel=r.loggerLevel),this.socketEmitInterval=r.socketEmitInterval||zt.socketEmitInterval,this.logToConsole=r.logToConsole!==void 0?r.logToConsole:zt.logToConsole,this.overloadGlobalConsole=r.overloadGlobalConsole!==void 0?r.overloadGlobalConsole:zt.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:Jr(e):this.defaultGetItemFunction,this.setItem=r&&typeof r=="function"?this.isSetItemAsync?r:Jr(r):this.defaultSetItemFunction,this.parseLog=n&&typeof n=="function"?n:fs}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={...ms};return r&&(n={...n,...r}),as(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=ys(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=ds(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=vs[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=gs(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=ls();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 bs{constructor(e){H(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 Cs({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:pe.WSCONNECT,isShowClient:!1,Status:"Connection established",StatusCode:200,Level:W.INFO,LogType:le.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:pe.WSCONNECT,isShowClient:!1,Status:"Connection closed",StatusCode:200,Level:W.INFO,LogType:le.INFO})}sdkAttemptToConnect(e){this.log({Message:`${this.eventsSdkClass.options.loggerConfig.system} is trying to connect to WS server ${e}`,ActionName:pe.WSCONNECT,isShowClient:!1,Status:"Switching Protocols",StatusCode:101,Level:W.INFO,LogType:le.INFO})}sdkAttemptToConnectError(e){this.log({Message:`${e}`,ActionName:pe.WSCONNECT,isShowClient:!1,Status:"Connection error",StatusCode:500,Level:W.ERROR,LogType:le.ERROR})}loginError(e,r,n,o){this.log({Message:`External login request error with the login type ${e} ${e===ae.TOKEN?n:o}`,ActionName:pe.WSCONNECT,isShowClient:!1,Status:"External login error",StatusCode:r||400,Level:W.ERROR,LogType:le.ERROR})}getSettingsError(e,r){this.log({Message:`Get settings error with token ${e}, error: ${r}`,ActionName:pe.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:W.ERROR,LogType:le.ERROR})}refreshTokenError(e,r,n){this.log({Message:`Refresh token error with old refresh token ${e}, url: ${r}, error: ${n}`,ActionName:pe.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:W.ERROR,LogType:le.ERROR})}keepAliveEmit(){this.log({Message:`Keep alive event emitted with this token: ${this.eventsSdkClass.authClass.token}`,ActionName:pe.WSCONNECT,isShowClient:!1,Level:W.INFO,LogType:le.INFO})}keepAliveResponse(e){this.log({Message:`Keep alive response: ${JSON.stringify(e)}`,ActionName:pe.WSCONNECT,isShowClient:!1,Status:"Successful",StatusCode:200,Level:W.INFO,LogType:le.INFO})}eventLog(e,r){const n={[ye.FULL]:[],[ye.BOOTSTRAP]:[j.LOGIN_STATUS,j.LOGIN_SUCCESS,j.ALL_EXTENSION_STATUS,j.ALL_DIALER_STATUS],[ye.DEBUG_EXTENSIONS]:[j.ALL_EXTENSION_STATUS,j.EXTENSION_EVENT,j.EXTENSIONS_UPDATED],[ye.DEBUG_DIALER]:[j.ALL_DIALER_STATUS,j.DIALER_EVENT],[ye.DEBUG_QUEUE]:[j.QUEUE_EVENT]};this.eventsSdkClass.options.debugOption&&(n[this.eventsSdkClass.options.debugOption].includes(e)||this.eventsSdkClass.options.debugOption===ye.FULL)&&this.log({Message:`Event name: ${e}`,Body:r,ActionName:pe.WSCONNECT,isShowClient:!1,Status:"Successful",Level:W.DEBUG,LogType:le.INFO})}}class ks{constructor(e){H(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]:[]});H(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 Ss{constructor(e){H(this,"options");H(this,"servers",[]);H(this,"URLList",[]);H(this,"server");H(this,"URL");H(this,"socket");H(this,"mainServer");H(this,"alreadyAttemptedOtherServers",[]);H(this,"authClass",new tn(this));H(this,"socketIoClass",new hn(this));H(this,"loggerClass",new bs(this));H(this,"eventEmitterClass",new ks(this));H(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={...rn,...e}}on(e,r){this.eventEmitterClass.on(e,r)}emit(e,...r){this.socketIoClass.io&&this.socketIoClass.io.emit(e,...r)}connect(e){e===he.MAIN&&this.findMainServer(),e===he.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}}return K.CallStatusEnum=rr,K.CallTypeEnum=nr,K.ConnectionStatusEnum=ge,K.DebugOption=ye,K.DialerTypeEnum=or,K.DirectionEnum=sr,K.DoNotCallMeStatusCodeEnum=ir,K.EventsEnum=j,K.ExtensionEventReasonEnum=ft,K.ExtensionHangupCauseEnum=ar,K.LoginType=ae,K.QueueEventReasonEnum=cr,K.ServerListenerEventsEnum=dt,K.ServerParameter=he,K.default=Ss,Object.defineProperties(K,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),K}({},ws);
11
+ ]`&&b(new Date(-864e13))=='"-271821-04-20T00:00:00.000Z"'&&b(new Date(864e13))=='"+275760-09-13T00:00:00.000Z"'&&b(new Date(-621987552e5))=='"-000001-01-01T00:00:00.000Z"'&&b(new Date(-1))=='"1969-12-31T23:59:59.999Z"'}catch{x=!1}}O=x}if(w=="json-parse"){var B=p.parse;if(typeof B=="function")try{if(B("0")===0&&!B(!1)){C=B(D);var N=C.a.length==5&&C.a[0]===1;if(N){try{N=!B('" "')}catch{}if(N)try{N=B("01")!==1}catch{}if(N)try{N=B("1.")!==1}catch{}}}}catch{N=!1}O=N}}return r[w]=!!O}var o,u,h,d={}.toString,c=typeof JSON=="object"&&JSON,p=typeof t=="object"&&t&&!t.nodeType&&t;p&&c?(p.stringify=c.stringify,p.parse=c.parse):p=n.JSON=c||{};var l=new Date(-0xc782b5b800cec);try{l=l.getUTCFullYear()==-109252&&l.getUTCMonth()===0&&l.getUTCDate()===1&&l.getUTCHours()==10&&l.getUTCMinutes()==37&&l.getUTCSeconds()==6&&l.getUTCMilliseconds()==708}catch{}if(!r("json")){var i="[object Function]",a="[object Date]",f="[object Number]",g="[object String]",y="[object Array]",E="[object Boolean]",j=r("bug-string-char-index");if(!l)var U=Math.floor,F=[0,31,59,90,120,151,181,212,243,273,304,334],L=function(w,O){return F[O]+365*(w-1970)+U((w-1969+(O=+(O>1)))/4)-U((w-1901+O)/100)+U((w-1601+O)/400)};(o={}.hasOwnProperty)||(o=function(w){var O,C={};return(C.__proto__=null,C.__proto__={toString:1},C).toString!=d?o=function(D){var b=this.__proto__,x=D in(this.__proto__=null,this);return this.__proto__=b,x}:(O=C.constructor,o=function(D){var b=(this.constructor||O).prototype;return D in this&&!(D in b&&this[D]===b[D])}),C=null,o.call(this,w)});var S={boolean:1,number:1,string:1,undefined:1},T=function(w,O){var C=typeof w[O];return C=="object"?!!w[O]:!S[C]};if(u=function(w,O){var C,D,b,x=0;(C=function(){this.valueOf=0}).prototype.valueOf=0,D=new C;for(b in D)o.call(D,b)&&x++;return C=D=null,x?u=x==2?function(B,N){var q,J={},et=d.call(B)==i;for(q in B)et&&q=="prototype"||o.call(J,q)||!(J[q]=1)||!o.call(B,q)||N(q)}:function(B,N){var q,J,et=d.call(B)==i;for(q in B)et&&q=="prototype"||!o.call(B,q)||(J=q==="constructor")||N(q);(J||o.call(B,q="constructor"))&&N(q)}:(D=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],u=function(B,N){var q,J,et=d.call(B)==i,st=!et&&typeof B.constructor!="function"&&T(B,"hasOwnProperty")?B.hasOwnProperty:o;for(q in B)et&&q=="prototype"||!st.call(B,q)||N(q);for(J=D.length;q=D[--J];st.call(B,q)&&N(q));}),u(w,O)},!r("json-stringify")){var A={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},m="000000",v=function(w,O){return(m+(O||0)).slice(-w)},_="\\u00",I=function(w){var O,C='"',D=0,b=w.length,x=b>10&&j;for(x&&(O=w.split(""));b>D;D++){var B=w.charCodeAt(D);switch(B){case 8:case 9:case 10:case 12:case 13:case 34:case 92:C+=A[B];break;default:if(32>B){C+=_+v(2,B.toString(16));break}C+=x?O[D]:j?w.charAt(D):w[D]}}return C+'"'},R=function(w,O,C,D,b,x,B){var N,q,J,et,st,wt,te,ee,ne,se,pt,re,Ut,Ct,oe,ie;try{N=O[w]}catch{}if(typeof N=="object"&&N)if(q=d.call(N),q!=a||o.call(N,"toJSON"))typeof N.toJSON=="function"&&(q!=f&&q!=g&&q!=y||o.call(N,"toJSON"))&&(N=N.toJSON(w));else if(N>-1/0&&1/0>N){if(L){for(st=U(N/864e5),J=U(st/365.2425)+1970-1;L(J+1,0)<=st;J++);for(et=U((st-L(J,0))/30.42);L(J,et+1)<=st;et++);st=1+st-L(J,et),wt=(N%864e5+864e5)%864e5,te=U(wt/36e5)%24,ee=U(wt/6e4)%60,ne=U(wt/1e3)%60,se=wt%1e3}else J=N.getUTCFullYear(),et=N.getUTCMonth(),st=N.getUTCDate(),te=N.getUTCHours(),ee=N.getUTCMinutes(),ne=N.getUTCSeconds(),se=N.getUTCMilliseconds();N=(0>=J||J>=1e4?(0>J?"-":"+")+v(6,0>J?-J:J):v(4,J))+"-"+v(2,et+1)+"-"+v(2,st)+"T"+v(2,te)+":"+v(2,ee)+":"+v(2,ne)+"."+v(3,se)+"Z"}else N=null;if(C&&(N=C.call(O,w,N)),N===null)return"null";if(q=d.call(N),q==E)return""+N;if(q==f)return N>-1/0&&1/0>N?""+N:"null";if(q==g)return I(""+N);if(typeof N=="object"){for(Ct=B.length;Ct--;)if(B[Ct]===N)throw TypeError();if(B.push(N),pt=[],oe=x,x+=b,q==y){for(Ut=0,Ct=N.length;Ct>Ut;Ut++)re=R(Ut,N,C,D,b,x,B),pt.push(re===h?"null":re);ie=pt.length?b?`[
12
+ `+x+pt.join(`,
13
+ `+x)+`
14
+ `+oe+"]":"["+pt.join(",")+"]":"[]"}else u(D||N,function(ae){var $e=R(ae,N,C,D,b,x,B);$e!==h&&pt.push(I(ae)+":"+(b?" ":"")+$e)}),ie=pt.length?b?`{
15
+ `+x+pt.join(`,
16
+ `+x)+`
17
+ `+oe+"}":"{"+pt.join(",")+"}":"{}";return B.pop(),ie}};p.stringify=function(w,O,C){var D,b,x,B;if(typeof O=="function"||typeof O=="object"&&O){if((B=d.call(O))==i)b=O;else if(B==y){x={};for(var N,q=0,J=O.length;J>q;N=O[q++],B=d.call(N),(B==g||B==f)&&(x[N]=1));}}if(C)if((B=d.call(C))==f){if((C-=C%1)>0)for(D="",C>10&&(C=10);D.length<C;D+=" ");}else B==g&&(D=C.length<=10?C:C.slice(0,10));return R("",(N={},N[""]=w,N),b,x,D,"",[])}}if(!r("json-parse")){var k,W,G=String.fromCharCode,Y={92:"\\",34:'"',47:"/",98:"\b",116:" ",110:`
18
+ `,102:"\f",114:"\r"},V=function(){throw k=W=null,SyntaxError()},tt=function(){for(var w,O,C,D,b,x=W,B=x.length;B>k;)switch(b=x.charCodeAt(k)){case 9:case 10:case 13:case 32:k++;break;case 123:case 125:case 91:case 93:case 58:case 44:return w=j?x.charAt(k):x[k],k++,w;case 34:for(w="@",k++;B>k;)if(b=x.charCodeAt(k),32>b)V();else if(b==92)switch(b=x.charCodeAt(++k)){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:w+=Y[b],k++;break;case 117:for(O=++k,C=k+4;C>k;k++)b=x.charCodeAt(k),b>=48&&57>=b||b>=97&&102>=b||b>=65&&70>=b||V();w+=G("0x"+x.slice(O,k));break;default:V()}else{if(b==34)break;for(b=x.charCodeAt(k),O=k;b>=32&&b!=92&&b!=34;)b=x.charCodeAt(++k);w+=x.slice(O,k)}if(x.charCodeAt(k)==34)return k++,w;V();default:if(O=k,b==45&&(D=!0,b=x.charCodeAt(++k)),b>=48&&57>=b){for(b==48&&(b=x.charCodeAt(k+1),b>=48&&57>=b)&&V(),D=!1;B>k&&(b=x.charCodeAt(k),b>=48&&57>=b);k++);if(x.charCodeAt(k)==46){for(C=++k;B>C&&(b=x.charCodeAt(C),b>=48&&57>=b);C++);C==k&&V(),k=C}if(b=x.charCodeAt(k),b==101||b==69){for(b=x.charCodeAt(++k),(b==43||b==45)&&k++,C=k;B>C&&(b=x.charCodeAt(C),b>=48&&57>=b);C++);C==k&&V(),k=C}return+x.slice(O,k)}if(D&&V(),x.slice(k,k+4)=="true")return k+=4,!0;if(x.slice(k,k+5)=="false")return k+=5,!1;if(x.slice(k,k+4)=="null")return k+=4,null;V()}return"$"},St=function(w){var O,C;if(w=="$"&&V(),typeof w=="string"){if((j?w.charAt(0):w[0])=="@")return w.slice(1);if(w=="["){for(O=[];w=tt(),w!="]";C||(C=!0))C&&(w==","?(w=tt(),w=="]"&&V()):V()),w==","&&V(),O.push(St(w));return O}if(w=="{"){for(O={};w=tt(),w!="}";C||(C=!0))C&&(w==","?(w=tt(),w=="}"&&V()):V()),(w==","||typeof w!="string"||(j?w.charAt(0):w[0])!="@"||tt()!=":")&&V(),O[w.slice(1)]=St(tt());return O}V()}return w},Je=function(w,O,C){var D=Xe(w,O,C);D===h?delete w[O]:w[O]=D},Xe=function(w,O,C){var D,b=w[O];if(typeof b=="object"&&b)if(d.call(b)==y)for(D=b.length;D--;)Je(b,D,C);else u(b,function(x){Je(b,x,C)});return C.call(w,O,b)};p.parse=function(w,O){var C,D;return k=0,W=""+w,C=St(tt()),tt()!="$"&&V(),k=W=null,O&&d.call(O)==i?Xe((D={},D[""]=C,D),"",O):C}}}})(this)},{}],48:[function(s,e){function t(n,r){var o=[];r=r||0;for(var u=r||0;u<n.length;u++)o[u-r]=n[u];return o}e.exports=t},{}]},{},[1])(1)}const sn=Object.assign({"./v1_3_7.js":Object.freeze(Object.defineProperty({__proto__:null,default:nn},Symbol.toStringTag,{value:"Module"}))}),rn=/v\d+_\d+_\d+/;function on(s){return typeof s=="function"}const Dt=Object.entries(sn).reduce((s,e)=>{var r;const t=e[1].default,n=(r=e[0].match(rn))==null?void 0:r[0];return on(t)&&n&&(s[n]=t()),s},{}),pe=s=>{if(s in Dt)return Dt[s];throw new Error(`Socket version ${s} not found`)},an={...Dt,getSocketVersion:pe,makeSocketVersion:(s,...e)=>pe(s)(...e)};var fe=(s=>(s.RINGING="Ringing",s.TALKING="Talking",s.DIALING="Dialing",s.HOLD="Hold",s))(fe||{}),de=(s=>(s.INCOMING="Incoming",s.OUTGOING="Outgoing",s))(de||{}),dt=(s=>(s.CONNECTED="connected",s.DISCONNECTED="disconnected",s.TRYING_TO_CONNECT="tryingToConnect",s))(dt||{}),ge=(s=>(s.AUTOMATIC="Automatic",s.IVR="IVR",s))(ge||{}),ye=(s=>(s.INCOMINC="Incoming",s.OUTGOING="Outgoing",s.SPY="Spy",s.CLICK2CALL="Click2Call",s))(ye||{}),me=(s=>(s.RESPONSE_FROM_API_VALID="RESPONSE_FROM_API_VALID",s.RESPONSE_FROM_API_INVALID="RESPONSE_FROM_API_INVALID",s))(me||{}),P=(s=>(s.ALL_DIALER_STATUS="AllDialersStatus",s.ALL_EXTENSION_STATUS="AllExtensionsStatus",s.ALL_USERS_STATUS="AllUsersStatus",s.CONNECT="connect",s.DISCONNECT="disconnect",s.CONNECT_ERROR_EVENT="connect_error",s.EXTENSION_EVENT="ExtensionEvent",s.KEEP_ALIVE="keepalive",s.KEEP_ALIVE_RESPONSE="keepaliveResponse",s.LOGIN_STATUS="loginStatus",s.LOGIN_SUCCESS="loginSuccess",s.QUEUE_EVENT="QueueEvent",s.ONLINE_STATUS_EVENT="onlineStatusEvent",s.DIALER_EVENT="DialerEvent",s.EXTENSIONS_UPDATED="ExtensionsUpdated",s))(P||{}),Pt=(s=>(s.NEWCALL="NEWCALL",s.ANSWER="ANSWER",s.HOLD="HOLD",s.UNHOLD="UNHOLD",s.HANGUP="HANGUP",s.USER_STATUS_UPDATE="userStatusUpdate",s))(Pt||{}),ve=(s=>(s.NORMAL_HANGUP="Normal hangup",s.USER_BUSY="User busy",s.CALL_REJECTED="Call Rejected",s.UNALLOCATED_NUMBER="Unallocated (unassigned) number",s.UNKNOWN="Unknown",s.NO_USER_RESPONDING="No user responding",s.USER_ALERTING="User alerting, no answer",s.ANSWERED_ELSEWHERE="Answered elsewhere",s))(ve||{}),ke=(s=>(s.ANSWER="ANSWER",s.ABANDONED="ABANDONED",s.EXIT="EXIT",s.JOIN="JOIN",s))(ke||{});class Et{static mapExtensionEvent(e){var u,h;const t=e.reason;let n,r;e.data.currentCall&&(r=this.mapExtensionCall(e,e.data.currentCall));const o=this.mapExtensionData(e,e.data);return t===Pt.HANGUP?n={...e,reason:t,data:{...o,currentCall:r?{...r,duration:r.callAnswered_UTC_CLIENT?Date.now()-r.callAnswered_UTC_CLIENT:0}:void 0,calls:(u=e.data.calls)==null?void 0:u.map(d=>{const c=this.mapExtensionCall(e,d);return{...c,duration:c.callAnswered_UTC_CLIENT?Date.now()-c.callAnswered_UTC_CLIENT:0}})}}:n={...e,data:{...o,currentCall:r,calls:(h=e.data.calls)==null?void 0:h.map(d=>this.mapExtensionCall(e,d))},reason:t},n}static mapAllExtensionStatus(e){return{...e,extensions:e.extensions.map(t=>{var n;return{...this.mapExtensionData(e,t),currentCall:t.currentCall?this.mapExtensionCall(e,t.currentCall):void 0,calls:(n=t.calls)==null?void 0:n.map(r=>this.mapExtensionCall(e,r))}})}}static mapExtensionData(e,t){return this.configureUTCForObject(t,[{key:"lastAnsweredCallEventEpoch",format:"sec"},{key:"lastCallEventEpoch",format:"sec"},{key:"lastHangupCallEpoch",format:"sec"},{key:"representativeUpdated",format:"ms"}],e.servertime,e.servertimeoffset)}static mapExtensionCall(e,t){return this.configureUTCForObject(t,[{key:"callAnswered",format:"sec"},{key:"callStarted",format:"sec"}],e.servertime,e.servertimeoffset)}static mapQueueCall(e,t){return this.configureUTCForObject(t,[{key:"JoinTimeStamp",format:"sec"},{key:"VHJoinTimeStamp",format:"sec"}],e.servertime,e.servertimeoffset)}static mapLoginStatusEvent(e){return{...e,queues:e.queues.map(t=>({...t,Calls:t.Calls.map(n=>this.mapQueueCall(e,n))}))}}static mapQueueEvent(e){return{...e,data:{...e.data,Calls:e.data.Calls.map(t=>this.mapQueueCall(e,t))}}}static assignProperty(e,t,n){e[t]=n}static configureUTCForObject(e,t,n,r){const o=(n-r*60)*1e3,u=Date.now()-o,h={};return t.forEach(d=>{const c=e[d.key],p=d.key;if(c!==0&&typeof c=="number"&&!isNaN(c)){let l=c;d.format==="ms"&&(l=Math.floor(l/1e3));const i=(l-r*60)*1e3;this.assignProperty(h,`${p}_UTC`,i),this.assignProperty(h,`${p}_UTC_CLIENT`,i+u)}else this.assignProperty(h,`${p}_UTC`,0),this.assignProperty(h,`${p}_UTC_CLIENT`,0)}),{...e,...h}}}var jt=(s=>(s.UPDATE_MONITORED_EXTENSIONS="updateMonitoredExtensions",s.KEEP_ALIVE="keepalive",s))(jt||{});class cn{constructor(e){K(this,"io");K(this,"ioFunction");K(this,"lastEventTimestamp",new Date().getTime());K(this,"doReconnect",!0);K(this,"keepAliveInterval");K(this,"keepReconnectInterval");K(this,"keepReconnectTimeout");K(this,"connected",!1);K(this,"reconnectionTime",20);this.eventsSdkClass=e,this.eventsSdkClass=e,typeof window<"u"&&(window.addEventListener("offline",()=>{this.closeAllConnections()}),window.addEventListener("online",()=>{setTimeout(()=>{this.keepReconnectTimeout&&clearTimeout(this.keepReconnectTimeout),this.eventsSdkClass.connect(it.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(it.NEXT)},5e3)}))}getSocketIoFunction(e){const t=e.split("v="),n="v".concat(t[t.length-1]).replaceAll(".","_");this.ioFunction=an.getSocketVersion(n)}initSocketConnection(){const e=this.eventsSdkClass.authClass.token,t=this.eventsSdkClass.options.protocol,n=this.eventsSdkClass.server;try{const r=n?n.Domain:this.eventsSdkClass.URL,o=n?`${t}://${r}`:this.eventsSdkClass.URL,u={reconnection:!1,upgrade:!1,transports:["websocket"],forceNew:!0,query:{token:e},timeout:this.eventsSdkClass.options.timeout};if(this.ioFunction&&o)this.io=this.ioFunction(o,u),this.eventsSdkClass.eventEmitterClass.emit(P.ONLINE_STATUS_EVENT,{attemptToConnect:o,connectionStatus:dt.TRYING_TO_CONNECT}),this.eventsSdkClass.loggerClass.sdkAttemptToConnect(r);else throw new Error("Socket server url no defined")}catch(r){this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(r)}}clearKeepAliveInterval(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval)}initKeepAlive(){this.keepAliveInterval&&clearInterval(this.keepAliveInterval),this.keepAliveInterval=setInterval(async()=>{if(new Date().getTime()>this.lastEventTimestamp+this.eventsSdkClass.options.keepAliveTimeout&&this.io&&this.eventsSdkClass.authClass.token){this.eventsSdkClass.emit(jt.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(),vt.clearSessionStorage()}initSocketEvents(){this.io&&this.io.on(P.LOGIN_SUCCESS,e=>this.onLoginSuccessEvent(e,P.LOGIN_SUCCESS)).on(P.QUEUE_EVENT,e=>this.onQueueEvent(e,P.QUEUE_EVENT)).on(P.EXTENSION_EVENT,e=>this.onExtensionEvent(e,P.EXTENSION_EVENT)).on(P.DIALER_EVENT,e=>this.onDialerEvent(e,P.DIALER_EVENT)).on(P.LOGIN_STATUS,e=>this.onLoginStatusEvent(e,P.LOGIN_STATUS)).on(P.ALL_EXTENSION_STATUS,e=>this.onAllExtensionStatus(e,P.ALL_EXTENSION_STATUS)).on(P.ALL_DIALER_STATUS,e=>this.onAllDialerStatus(e,P.ALL_DIALER_STATUS)).on(P.KEEP_ALIVE_RESPONSE,e=>this.onKeepAliveResponse(e)).on(P.EXTENSIONS_UPDATED,e=>this.onExtensionsUpdatedEvent(e,P.EXTENSIONS_UPDATED)).on(P.CONNECT,()=>this.onConnect()).on(P.DISCONNECT,e=>this.onDisconnect(e)).on(P.CONNECT_ERROR_EVENT,e=>this.onConnectError(e))}onLoginSuccessEvent(e,t){this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,e)}onQueueEvent(e,t){this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,Et.mapQueueEvent(e))}onExtensionEvent(e,t){const n=Et.mapExtensionEvent(e);n&&(this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,n))}onDialerEvent(e,t){this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,e)}onLoginStatusEvent(e,t){this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,Et.mapLoginStatusEvent(e))}onAllExtensionStatus(e,t){const n=Et.mapAllExtensionStatus(e);this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,n)}onAllDialerStatus(e,t){this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,e)}onKeepAliveResponse(e){if(this.eventsSdkClass.loggerClass.keepAliveResponse(e),e.errorCode){this.initSocketConnection();return}this.connected?this.lastEventTimestamp=new Date().getTime():this.initSocketConnection()}onExtensionsUpdatedEvent(e,t){this.eventsSdkClass.loggerClass.eventLog(t,e),this.eventsSdkClass.eventEmitterClass.emit(t,e)}onConnect(){this.connected=!0,this.keepReconnectInterval&&clearInterval(this.keepReconnectInterval),this.eventsSdkClass.eventEmitterClass.emit(P.ONLINE_STATUS_EVENT,{connectionStatus:dt.CONNECTED}),this.eventsSdkClass.loggerClass.start().then(()=>{this.eventsSdkClass.loggerClass.sdkConnectionSuccess()})}onDisconnect(e){this.connected=!1,this.doReconnect&&(this.closeAllConnections(),this.eventsSdkClass.eventEmitterClass.emit(P.ONLINE_STATUS_EVENT,{connectionStatus:this.doReconnect?dt.TRYING_TO_CONNECT:dt.DISCONNECTED}),this.eventsSdkClass.loggerClass.sdkDisconnect([e]),this.keepReconnectTimeout=setTimeout(()=>{this.reconnectionTime=this.reconnectionTime+20,this.reconnectionTime>120&&(this.reconnectionTime=20),this.eventsSdkClass.connect(it.NEXT)},this.reconnectionTime*1e3))}onConnectError(e){this.eventsSdkClass.eventEmitterClass.emit(P.ONLINE_STATUS_EVENT,{connectionStatus:this.doReconnect?dt.TRYING_TO_CONNECT:dt.DISCONNECTED}),this.eventsSdkClass.loggerClass.sdkAttemptToConnectError(e),this.keepReconnectTimeout=setTimeout(()=>{this.reconnectionTime=this.reconnectionTime+20,this.reconnectionTime>60&&(this.reconnectionTime=20),this.eventsSdkClass.connect(it.NEXT)},this.reconnectionTime*1e3)}}var hn=Object.defineProperty,ln=(s,e,t)=>e in s?hn(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,X=(s,e,t)=>(ln(s,typeof e!="symbol"?e+"":e,t),t);const at=Object.create(null);at.open="0",at.close="1",at.ping="2",at.pong="3",at.message="4",at.upgrade="5",at.noop="6";const Tt=Object.create(null);Object.keys(at).forEach(s=>{Tt[at[s]]=s});const qt={type:"error",data:"parser error"},be=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Se=typeof ArrayBuffer=="function",we=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s&&s.buffer instanceof ArrayBuffer,Ft=({type:s,data:e},t,n)=>be&&e instanceof Blob?t?n(e):Ce(e,n):Se&&(e instanceof ArrayBuffer||we(e))?t?n(e):Ce(new Blob([e]),n):n(at[s]+(e||"")),Ce=(s,e)=>{const t=new FileReader;return t.onload=function(){const n=t.result.split(",")[1];e("b"+(n||""))},t.readAsDataURL(s)};function Ee(s){return s instanceof Uint8Array?s:s instanceof ArrayBuffer?new Uint8Array(s):new Uint8Array(s.buffer,s.byteOffset,s.byteLength)}let Mt;function un(s,e){if(be&&s.data instanceof Blob)return s.data.arrayBuffer().then(Ee).then(e);if(Se&&(s.data instanceof ArrayBuffer||we(s.data)))return e(Ee(s.data));Ft(s,!1,t=>{Mt||(Mt=new TextEncoder),e(Mt.encode(t))})}const Te="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",kt=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let s=0;s<Te.length;s++)kt[Te.charCodeAt(s)]=s;const pn=s=>{let e=s.length*.75,t=s.length,n,r=0,o,u,h,d;s[s.length-1]==="="&&(e--,s[s.length-2]==="="&&e--);const c=new ArrayBuffer(e),p=new Uint8Array(c);for(n=0;n<t;n+=4)o=kt[s.charCodeAt(n)],u=kt[s.charCodeAt(n+1)],h=kt[s.charCodeAt(n+2)],d=kt[s.charCodeAt(n+3)],p[r++]=o<<2|u>>4,p[r++]=(u&15)<<4|h>>2,p[r++]=(h&3)<<6|d&63;return c},fn=typeof ArrayBuffer=="function",Vt=(s,e)=>{if(typeof s!="string")return{type:"message",data:Ae(s,e)};const t=s.charAt(0);return t==="b"?{type:"message",data:dn(s.substring(1),e)}:Tt[t]?s.length>1?{type:Tt[t],data:s.substring(1)}:{type:Tt[t]}:qt},dn=(s,e)=>{if(fn){const t=pn(s);return Ae(t,e)}else return{base64:!0,data:s}},Ae=(s,e)=>{switch(e){case"blob":return s instanceof Blob?s:new Blob([s]);case"arraybuffer":default:return s instanceof ArrayBuffer?s:s.buffer}},Ne="",gn=(s,e)=>{const t=s.length,n=new Array(t);let r=0;s.forEach((o,u)=>{Ft(o,!1,h=>{n[u]=h,++r===t&&e(n.join(Ne))})})},yn=(s,e)=>{const t=s.split(Ne),n=[];for(let r=0;r<t.length;r++){const o=Vt(t[r],e);if(n.push(o),o.type==="error")break}return n};function mn(){return new TransformStream({transform(s,e){un(s,t=>{const n=t.length;let r;if(n<126)r=new Uint8Array(1),new DataView(r.buffer).setUint8(0,n);else if(n<65536){r=new Uint8Array(3);const o=new DataView(r.buffer);o.setUint8(0,126),o.setUint16(1,n)}else{r=new Uint8Array(9);const o=new DataView(r.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(n))}s.data&&typeof s.data!="string"&&(r[0]|=128),e.enqueue(r),e.enqueue(t)})}})}let Kt;function At(s){return s.reduce((e,t)=>e+t.length,0)}function Nt(s,e){if(s[0].length===e)return s.shift();const t=new Uint8Array(e);let n=0;for(let r=0;r<e;r++)t[r]=s[0][n++],n===s[0].length&&(s.shift(),n=0);return s.length&&n<s[0].length&&(s[0]=s[0].slice(n)),t}function vn(s,e){Kt||(Kt=new TextDecoder);const t=[];let n=0,r=-1,o=!1;return new TransformStream({transform(u,h){for(t.push(u);;){if(n===0){if(At(t)<1)break;const d=Nt(t,1);o=(d[0]&128)===128,r=d[0]&127,r<126?n=3:r===126?n=1:n=2}else if(n===1){if(At(t)<2)break;const d=Nt(t,2);r=new DataView(d.buffer,d.byteOffset,d.length).getUint16(0),n=3}else if(n===2){if(At(t)<8)break;const d=Nt(t,8),c=new DataView(d.buffer,d.byteOffset,d.length),p=c.getUint32(0);if(p>Math.pow(2,21)-1){h.enqueue(qt);break}r=p*Math.pow(2,32)+c.getUint32(4),n=3}else{if(At(t)<r)break;const d=Nt(t,r);h.enqueue(Vt(o?d:Kt.decode(d),e)),n=0}if(r===0||r>s){h.enqueue(qt);break}}}})}const _e=4;function z(s){if(s)return kn(s)}function kn(s){for(var e in z.prototype)s[e]=z.prototype[e];return s}z.prototype.on=z.prototype.addEventListener=function(s,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+s]=this._callbacks["$"+s]||[]).push(e),this},z.prototype.once=function(s,e){function t(){this.off(s,t),e.apply(this,arguments)}return t.fn=e,this.on(s,t),this},z.prototype.off=z.prototype.removeListener=z.prototype.removeAllListeners=z.prototype.removeEventListener=function(s,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+s];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+s],this;for(var n,r=0;r<t.length;r++)if(n=t[r],n===e||n.fn===e){t.splice(r,1);break}return t.length===0&&delete this._callbacks["$"+s],this},z.prototype.emit=function(s){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+s],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(t){t=t.slice(0);for(var n=0,r=t.length;n<r;++n)t[n].apply(this,e)}return this},z.prototype.emitReserved=z.prototype.emit,z.prototype.listeners=function(s){return this._callbacks=this._callbacks||{},this._callbacks["$"+s]||[]},z.prototype.hasListeners=function(s){return!!this.listeners(s).length};const nt=typeof self<"u"?self:typeof window<"u"?window:Function("return this")();function Oe(s,...e){return e.reduce((t,n)=>(s.hasOwnProperty(n)&&(t[n]=s[n]),t),{})}const bn=nt.setTimeout,Sn=nt.clearTimeout;function _t(s,e){e.useNativeTimers?(s.setTimeoutFn=bn.bind(nt),s.clearTimeoutFn=Sn.bind(nt)):(s.setTimeoutFn=nt.setTimeout.bind(nt),s.clearTimeoutFn=nt.clearTimeout.bind(nt))}const wn=1.33;function Cn(s){return typeof s=="string"?En(s):Math.ceil((s.byteLength||s.size)*wn)}function En(s){let e=0,t=0;for(let n=0,r=s.length;n<r;n++)e=s.charCodeAt(n),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(n++,t+=4);return t}function Tn(s){let e="";for(let t in s)s.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(s[t]));return e}function An(s){let e={},t=s.split("&");for(let n=0,r=t.length;n<r;n++){let o=t[n].split("=");e[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return e}class Nn extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class Wt extends z{constructor(e){super(),this.writable=!1,_t(this,e),this.opts=e,this.query=e.query,this.socket=e.socket}onError(e,t,n){return super.emitReserved("error",new Nn(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Vt(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=Tn(e);return t.length?"?"+t:""}}const Le="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Gt=64,_n={};let Re=0,Ot=0,Ie;function xe(s){let e="";do e=Le[s%Gt]+e,s=Math.floor(s/Gt);while(s>0);return e}function Ue(){const s=xe(+new Date);return s!==Ie?(Re=0,Ie=s):s+"."+xe(Re++)}for(;Ot<Gt;Ot++)_n[Le[Ot]]=Ot;let Be=!1;try{Be=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const On=Be;function De(s){const e=s.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||On))return new XMLHttpRequest}catch{}if(!e)try{return new nt[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}function Ln(){}const Rn=function(){return new De({xdomain:!1}).responseType!=null}();class In extends Wt{constructor(e){if(super(e),this.polling=!1,typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}const t=e&&e.forceBase64;this.supportsBinary=Rn&&!t,this.opts.withCredentials&&(this.cookieJar=void 0)}get name(){return"polling"}doOpen(){this.poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this.polling||!this.writable){let n=0;this.polling&&(n++,this.once("pollComplete",function(){--n||t()})),this.writable||(n++,this.once("drain",function(){--n||t()}))}else t()}poll(){this.polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=n=>{if(this.readyState==="opening"&&n.type==="open"&&this.onOpen(),n.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(n)};yn(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this.polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this.poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,gn(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=Ue()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}request(e={}){return Object.assign(e,{xd:this.xd,cookieJar:this.cookieJar},this.opts),new ct(this.uri(),e)}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",(r,o)=>{this.onError("xhr post error",r,o)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,n)=>{this.onError("xhr poll error",t,n)}),this.pollXhr=e}}class ct extends z{constructor(e,t){super(),_t(this,t),this.opts=t,this.method=t.method||"GET",this.uri=e,this.data=t.data!==void 0?t.data:null,this.create()}create(){var e;const t=Oe(this.opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this.opts.xd;const n=this.xhr=new De(t);try{n.open(this.method,this.uri,!0);try{if(this.opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let r in this.opts.extraHeaders)this.opts.extraHeaders.hasOwnProperty(r)&&n.setRequestHeader(r,this.opts.extraHeaders[r])}}catch{}if(this.method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}(e=this.opts.cookieJar)===null||e===void 0||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this.opts.withCredentials),this.opts.requestTimeout&&(n.timeout=this.opts.requestTimeout),n.onreadystatechange=()=>{var r;n.readyState===3&&((r=this.opts.cookieJar)===null||r===void 0||r.parseCookies(n)),n.readyState===4&&(n.status===200||n.status===1223?this.onLoad():this.setTimeoutFn(()=>{this.onError(typeof n.status=="number"?n.status:0)},0))},n.send(this.data)}catch(r){this.setTimeoutFn(()=>{this.onError(r)},0);return}typeof document<"u"&&(this.index=ct.requestsCount++,ct.requests[this.index]=this)}onError(e){this.emitReserved("error",e,this.xhr),this.cleanup(!0)}cleanup(e){if(!(typeof this.xhr>"u"||this.xhr===null)){if(this.xhr.onreadystatechange=Ln,e)try{this.xhr.abort()}catch{}typeof document<"u"&&delete ct.requests[this.index],this.xhr=null}}onLoad(){const e=this.xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this.cleanup())}abort(){this.cleanup()}}if(ct.requestsCount=0,ct.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Pe);else if(typeof addEventListener=="function"){const s="onpagehide"in nt?"pagehide":"unload";addEventListener(s,Pe,!1)}}function Pe(){for(let s in ct.requests)ct.requests.hasOwnProperty(s)&&ct.requests[s].abort()}const Jt=typeof Promise=="function"&&typeof Promise.resolve=="function"?s=>Promise.resolve().then(s):(s,e)=>e(s,0),Lt=nt.WebSocket||nt.MozWebSocket,je=!0,xn="arraybuffer",qe=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Un extends Wt{constructor(e){super(e),this.supportsBinary=!e.forceBase64}get name(){return"websocket"}doOpen(){if(!this.check())return;const e=this.uri(),t=this.opts.protocols,n=qe?{}:Oe(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=je&&!qe?t?new Lt(e,t):new Lt(e):new Lt(e,t,n)}catch(r){return this.emitReserved("error",r)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;Ft(n,this.supportsBinary,o=>{try{je&&this.ws.send(o)}catch{}r&&Jt(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=Ue()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}check(){return!!Lt}}class Bn extends Wt{get name(){return"webtransport"}doOpen(){typeof WebTransport=="function"&&(this.transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name]),this.transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this.transport.ready.then(()=>{this.transport.createBidirectionalStream().then(e=>{const t=vn(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=mn();r.readable.pipeTo(e.writable),this.writer=r.writable.getWriter();const o=()=>{n.read().then(({done:h,value:d})=>{h||(this.onPacket(d),o())}).catch(h=>{})};o();const u={type:"open"};this.query.sid&&(u.data=`{"sid":"${this.query.sid}"}`),this.writer.write(u).then(()=>this.onOpen())})}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],r=t===e.length-1;this.writer.write(n).then(()=>{r&&Jt(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this.transport)===null||e===void 0||e.close()}}const Dn={websocket:Un,webtransport:Bn,polling:In},Pn=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,jn=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Xt(s){if(s.length>2e3)throw"URI too long";const e=s,t=s.indexOf("["),n=s.indexOf("]");t!=-1&&n!=-1&&(s=s.substring(0,t)+s.substring(t,n).replace(/:/g,";")+s.substring(n,s.length));let r=Pn.exec(s||""),o={},u=14;for(;u--;)o[jn[u]]=r[u]||"";return t!=-1&&n!=-1&&(o.source=e,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=qn(o,o.path),o.queryKey=Fn(o,o.query),o}function qn(s,e){const t=/\/{2,9}/g,n=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&n.splice(0,1),e.slice(-1)=="/"&&n.splice(n.length-1,1),n}function Fn(s,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,r,o){r&&(t[r]=o)}),t}let Fe=class mt extends z{constructor(e,t={}){super(),this.binaryType=xn,this.writeBuffer=[],e&&typeof e=="object"&&(t=e,e=null),e?(e=Xt(e),t.hostname=e.host,t.secure=e.protocol==="https"||e.protocol==="wss",t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=Xt(t.host).host),_t(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=t.transports||["polling","websocket","webtransport"],this.writeBuffer=[],this.prevBufferLen=0,this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=An(this.opts.query)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingTimeoutTimer=null,typeof addEventListener=="function"&&(this.opts.closeOnBeforeunload&&(this.beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this.beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this.offlineEventListener=()=>{this.onClose("transport close",{description:"network connection lost"})},addEventListener("offline",this.offlineEventListener,!1))),this.open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=_e,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new Dn[e](n)}open(){let e;if(this.opts.rememberUpgrade&&mt.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch{this.transports.shift(),this.open();return}e.open(),this.setTransport(e)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this.onDrain.bind(this)).on("packet",this.onPacket.bind(this)).on("error",this.onError.bind(this)).on("close",t=>this.onClose("transport close",t))}probe(e){let t=this.createTransport(e),n=!1;mt.priorWebsocketSuccess=!1;const r=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",l=>{if(!n)if(l.type==="pong"&&l.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;mt.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{n||this.readyState!=="closed"&&(p(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const i=new Error("probe error");i.transport=t.name,this.emitReserved("upgradeError",i)}}))};function o(){n||(n=!0,p(),t.close(),t=null)}const u=l=>{const i=new Error("probe error: "+l);i.transport=t.name,o(),this.emitReserved("upgradeError",i)};function h(){u("transport closed")}function d(){u("socket closed")}function c(l){t&&l.name!==t.name&&o()}const p=()=>{t.removeListener("open",r),t.removeListener("error",u),t.removeListener("close",h),this.off("close",d),this.off("upgrading",c)};t.once("open",r),t.once("error",u),t.once("close",h),this.once("close",d),this.once("upgrading",c),this.upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onOpen(){if(this.readyState="open",mt.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush(),this.readyState==="open"&&this.opts.upgrade){let e=0;const t=this.upgrades.length;for(;e<t;e++)this.probe(this.upgrades[e])}}onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),this.resetPingTimeout(),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this.sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong");break;case"error":const t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this.resetPingTimeout()}resetPingTimeout(){this.clearTimeoutFn(this.pingTimeoutTimer),this.pingTimeoutTimer=this.setTimeoutFn(()=>{this.onClose("ping timeout")},this.pingInterval+this.pingTimeout),this.opts.autoUnref&&this.pingTimeoutTimer.unref()}onDrain(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this.getWritablePackets();this.transport.send(e),this.prevBufferLen=e.length,this.emitReserved("flush")}}getWritablePackets(){if(!(this.maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){const n=this.writeBuffer[t].data;if(n&&(e+=Cn(n)),t>0&&e>this.maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}write(e,t,n){return this.sendPacket("message",e,t,n),this}send(e,t,n){return this.sendPacket("message",e,t,n),this}sendPacket(e,t,n,r){if(typeof t=="function"&&(r=t,t=void 0),typeof n=="function"&&(r=n,n=null),this.readyState==="closing"||this.readyState==="closed")return;n=n||{},n.compress=n.compress!==!1;const o={type:e,data:t,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),r&&this.once("flush",r),this.flush()}close(){const e=()=>{this.onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}onError(e){mt.priorWebsocketSuccess=!1,this.emitReserved("error",e),this.onClose("transport error",e)}onClose(e,t){(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")&&(this.clearTimeoutFn(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),typeof removeEventListener=="function"&&(removeEventListener("beforeunload",this.beforeunloadEventListener,!1),removeEventListener("offline",this.offlineEventListener,!1)),this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this.prevBufferLen=0)}filterUpgrades(e){const t=[];let n=0;const r=e.length;for(;n<r;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}};Fe.protocol=_e;function Mn(s,e="",t){let n=s;t=t||typeof location<"u"&&location,s==null&&(s=t.protocol+"//"+t.host),typeof s=="string"&&(s.charAt(0)==="/"&&(s.charAt(1)==="/"?s=t.protocol+s:s=t.host+s),/^(https?|wss?):\/\//.test(s)||(typeof t<"u"?s=t.protocol+"//"+s:s="https://"+s),n=Xt(s)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const r=n.host.indexOf(":")!==-1?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+r+":"+n.port+e,n.href=n.protocol+"://"+r+(t&&t.port===n.port?"":":"+n.port),n}const Vn=typeof ArrayBuffer=="function",Kn=s=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(s):s.buffer instanceof ArrayBuffer,Me=Object.prototype.toString,Wn=typeof Blob=="function"||typeof Blob<"u"&&Me.call(Blob)==="[object BlobConstructor]",Gn=typeof File=="function"||typeof File<"u"&&Me.call(File)==="[object FileConstructor]";function $t(s){return Vn&&(s instanceof ArrayBuffer||Kn(s))||Wn&&s instanceof Blob||Gn&&s instanceof File}function Rt(s,e){if(!s||typeof s!="object")return!1;if(Array.isArray(s)){for(let t=0,n=s.length;t<n;t++)if(Rt(s[t]))return!0;return!1}if($t(s))return!0;if(s.toJSON&&typeof s.toJSON=="function"&&arguments.length===1)return Rt(s.toJSON(),!0);for(const t in s)if(Object.prototype.hasOwnProperty.call(s,t)&&Rt(s[t]))return!0;return!1}function Jn(s){const e=[],t=s.data,n=s;return n.data=zt(t,e),n.attachments=e.length,{packet:n,buffers:e}}function zt(s,e){if(!s)return s;if($t(s)){const t={_placeholder:!0,num:e.length};return e.push(s),t}else if(Array.isArray(s)){const t=new Array(s.length);for(let n=0;n<s.length;n++)t[n]=zt(s[n],e);return t}else if(typeof s=="object"&&!(s instanceof Date)){const t={};for(const n in s)Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=zt(s[n],e));return t}return s}function Xn(s,e){return s.data=Ht(s.data,e),delete s.attachments,s}function Ht(s,e){if(!s)return s;if(s&&s._placeholder===!0){if(typeof s.num=="number"&&s.num>=0&&s.num<e.length)return e[s.num];throw new Error("illegal attachments")}else if(Array.isArray(s))for(let t=0;t<s.length;t++)s[t]=Ht(s[t],e);else if(typeof s=="object")for(const t in s)Object.prototype.hasOwnProperty.call(s,t)&&(s[t]=Ht(s[t],e));return s}const $n=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],zn=5;var M;(function(s){s[s.CONNECT=0]="CONNECT",s[s.DISCONNECT=1]="DISCONNECT",s[s.EVENT=2]="EVENT",s[s.ACK=3]="ACK",s[s.CONNECT_ERROR=4]="CONNECT_ERROR",s[s.BINARY_EVENT=5]="BINARY_EVENT",s[s.BINARY_ACK=6]="BINARY_ACK"})(M||(M={}));class Hn{constructor(e){this.replacer=e}encode(e){return(e.type===M.EVENT||e.type===M.ACK)&&Rt(e)?this.encodeAsBinary({type:e.type===M.EVENT?M.BINARY_EVENT:M.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===M.BINARY_EVENT||e.type===M.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Jn(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}}function Ve(s){return Object.prototype.toString.call(s)==="[object Object]"}class Yt extends z{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===M.BINARY_EVENT;n||t.type===M.BINARY_ACK?(t.type=n?M.EVENT:M.ACK,this.reconstructor=new Yn(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if($t(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(M[n.type]===void 0)throw new Error("unknown packet type "+n.type);if(n.type===M.BINARY_EVENT||n.type===M.BINARY_ACK){const o=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const u=e.substring(o,t);if(u!=Number(u)||e.charAt(t)!=="-")throw new Error("Illegal attachments");n.attachments=Number(u)}if(e.charAt(t+1)==="/"){const o=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););n.nsp=e.substring(o,t)}else n.nsp="/";const r=e.charAt(t+1);if(r!==""&&Number(r)==r){const o=t+1;for(;++t;){const u=e.charAt(t);if(u==null||Number(u)!=u){--t;break}if(t===e.length)break}n.id=Number(e.substring(o,t+1))}if(e.charAt(++t)){const o=this.tryParse(e.substr(t));if(Yt.isPayloadValid(n.type,o))n.data=o;else throw new Error("invalid payload")}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case M.CONNECT:return Ve(t);case M.DISCONNECT:return t===void 0;case M.CONNECT_ERROR:return typeof t=="string"||Ve(t);case M.EVENT:case M.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&$n.indexOf(t[0])===-1);case M.ACK:case M.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Yn{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=Xn(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Qn=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Yt,Encoder:Hn,get PacketType(){return M},protocol:zn},Symbol.toStringTag,{value:"Module"}));function ot(s,e,t){return s.on(e,t),function(){s.off(e,t)}}const Zn=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class Ke extends z{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[ot(e,"open",this.onopen.bind(this)),ot(e,"packet",this.onpacket.bind(this)),ot(e,"error",this.onerror.bind(this)),ot(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){if(Zn.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const n={type:M.EVENT,data:t};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const o=this.ids++,u=t.pop();this._registerAckCallback(o,u),n.id=o}const r=this.io.engine&&this.io.engine.transport&&this.io.engine.transport.writable;return this.flags.volatile&&(!r||!this.connected)||(this.connected?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){var n;const r=(n=this.flags.timeout)!==null&&n!==void 0?n:this._opts.ackTimeout;if(r===void 0){this.acks[e]=t;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let u=0;u<this.sendBuffer.length;u++)this.sendBuffer[u].id===e&&this.sendBuffer.splice(u,1);t.call(this,new Error("operation has timed out"))},r);this.acks[e]=(...u)=>{this.io.clearTimeoutFn(o),t.apply(this,[null,...u])}}emitWithAck(e,...t){const n=this.flags.timeout!==void 0||this._opts.ackTimeout!==void 0;return new Promise((r,o)=>{t.push((u,h)=>n?u?o(u):r(h):r(u)),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((r,...o)=>n!==this._queue[0]?void 0:(r!==null?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(r)):(this._queue.shift(),t&&t(null,...o)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:M.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t)}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case M.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case M.EVENT:case M.BINARY_EVENT:this.onevent(e);break;case M.ACK:case M.BINARY_ACK:this.onack(e);break;case M.DISCONNECT:this.ondisconnect();break;case M.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...r){n||(n=!0,t.packet({type:M.ACK,id:e,data:r}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(t.apply(this,e.data),delete this.acks[e.id])}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:M.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function yt(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}yt.prototype.duration=function(){var s=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*s);s=Math.floor(e*10)&1?s+t:s-t}return Math.min(s,this.max)|0},yt.prototype.reset=function(){this.attempts=0},yt.prototype.setMin=function(s){this.ms=s},yt.prototype.setMax=function(s){this.max=s},yt.prototype.setJitter=function(s){this.jitter=s};class Qt extends z{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,_t(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((n=t.randomizationFactor)!==null&&n!==void 0?n:.5),this.backoff=new yt({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const r=t.parser||Qn;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Fe(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const r=ot(t,"open",function(){n.onopen(),e&&e()}),o=h=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",h),e?e(h):this.maybeReconnectOnOpen()},u=ot(t,"error",o);if(this._timeout!==!1){const h=this._timeout,d=this.setTimeoutFn(()=>{r(),o(new Error("timeout")),t.close()},h);this.opts.autoUnref&&d.unref(),this.subs.push(()=>{this.clearTimeoutFn(d)})}return this.subs.push(r),this.subs.push(u),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(ot(e,"ping",this.onping.bind(this)),ot(e,"data",this.ondata.bind(this)),ot(e,"error",this.onerror.bind(this)),ot(e,"close",this.onclose.bind(this)),ot(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){Jt(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new Ke(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const n of t)if(this.nsps[n].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close"),this.engine&&this.engine.close()}disconnect(){return this._close()}onclose(e,t){this.cleanup(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(r=>{r?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",r)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const bt={};function It(s,e){typeof s=="object"&&(e=s,s=void 0),e=e||{};const t=Mn(s,e.path||"/socket.io"),n=t.source,r=t.id,o=t.path,u=bt[r]&&o in bt[r].nsps,h=e.forceNew||e["force new connection"]||e.multiplex===!1||u;let d;return h?d=new Qt(n,e):(bt[r]||(bt[r]=new Qt(n,e)),d=bt[r]),t.query&&!e.query&&(e.query=t.queryKey),d.socket(t.path,e)}Object.assign(It,{Manager:Qt,Socket:Ke,io:It,connect:It});let xt;const ts=new Uint8Array(16);function es(){if(!xt&&(xt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!xt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return xt(ts)}const H=[];for(let s=0;s<256;++s)H.push((s+256).toString(16).slice(1));function ns(s,e=0){return H[s[e+0]]+H[s[e+1]]+H[s[e+2]]+H[s[e+3]]+"-"+H[s[e+4]]+H[s[e+5]]+"-"+H[s[e+6]]+H[s[e+7]]+"-"+H[s[e+8]]+H[s[e+9]]+"-"+H[s[e+10]]+H[s[e+11]]+H[s[e+12]]+H[s[e+13]]+H[s[e+14]]+H[s[e+15]]}const ss=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),We={randomUUID:ss};function rs(s,e,t){if(We.randomUUID&&!e&&!s)return We.randomUUID();s=s||{};const n=s.random||(s.rng||es)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){t=t||0;for(let r=0;r<16;++r)e[t+r]=n[r];return e}return ns(n)}function os(s,e){const t=e.map(r=>JSON.stringify(r)).join(" "),n=new Date().toISOString();return JSON.stringify({level:s,time:n,message:t})}function is(s,e){const t=JSON.parse(s);return e.forEach(n=>delete t[n]),t}function as(s){if(typeof s=="object"&&s!==null)return s;try{return JSON.parse(s)}catch{return{extraData:s}}}function cs(s){const e=/\(([^)]+)\)/,t=s.match(e);if(t&&t[1]){const n=t[1].split(";");for(let r of n)if(r=r.trim(),r.startsWith("Windows")||r.startsWith("Macintosh")||r.startsWith("Linux"))return r}return"Unknown"}function Ge(s){return(...e)=>new Promise((t,n)=>{try{const r=s(...e);t(r)}catch(r){n(r)}})}const hs={reconnection:!0,reconnectionDelay:5e3,reconnectionAttempts:10,upgrade:!1,transports:["websocket"],debug:!1},Zt={logToConsole:!0,overloadGlobalConsole:!1,socketEmitInterval:6e4},ht={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"},ls={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},lt={INFO:"info",WARNING:"warning",MODIFY:"modify",ERROR:"error",VIEW:"view"},Q={INFO:"info",WARNING:"warning",ERROR:"error",DEBUG:"debug"};let Z=console;class us{constructor(e){X(this,"logToConsole"),X(this,"overloadGlobalConsole"),X(this,"system"),X(this,"socketEmitInterval"),X(this,"storageId"),X(this,"emitInProgress"),X(this,"queue"),X(this,"processing"),X(this,"storageInitialized"),X(this,"interval"),X(this,"logIndex"),X(this,"socket"),X(this,"requestUrl"),X(this,"staticObject",{}),X(this,"localObject",{}),X(this,"isGetItemAsync"),X(this,"isSetItemAsync"),X(this,"getItem"),X(this,"setItem"),X(this,"parseLog"),X(this,"_logMethod"),X(this,"_warnMethod"),X(this,"_errorMethod"),X(this,"_debugMethod");const{loggerOptions:t}=e;if(!t.system)throw new Error("Config property 'system' should be provided!");this.isGetItemAsync=t.isGetItemAsync||!1,this.isSetItemAsync=t.isSetItemAsync||!1,this.setupStorageFunctions(t.getItem,t.setItem,t.parseLog),this.system=t.system,this.socketEmitInterval=t.socketEmitInterval||Zt.socketEmitInterval,this.logToConsole=t.logToConsole!==void 0?t.logToConsole:Zt.logToConsole,this.overloadGlobalConsole=t.overloadGlobalConsole!==void 0?t.overloadGlobalConsole:Zt.overloadGlobalConsole,this.storageId=this.getStorageName(),this.queue=[],this.processing=!1,this.storageInitialized=!1,this.emitInProgress=!1,this.logIndex=0,this.init(e)}setupStorageFunctions(e,t,n){this.getItem=e&&typeof e=="function"?this.isGetItemAsync?e:Ge(e):this.defaultGetItemFunction,this.setItem=t&&typeof t=="function"?this.isSetItemAsync?t:Ge(t):this.defaultSetItemFunction,this.parseLog=n&&typeof n=="function"?n:os}sendHttpRequest(e){if(!this.requestUrl)throw new Error("requestUrl is not provided");const t={Data:e};return fetch(this.requestUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}init(e){const{socket:t,url:n,requestUrl:r,socketOptions:o={}}=e;this._logMethod=Z.log.bind(Z),this._warnMethod=Z.warn.bind(Z),this._errorMethod=Z.error.bind(Z),this._debugMethod=Z.debug.bind(Z),this.initStorage().then(()=>{if(t)this.socket=t;else if(n)this.socket=this.createConnection(n,o);else if(r)this.requestUrl=r;else throw new Error("Must provide either a 'socket', 'requestUrl' or a 'url' for logger requests");this.interval=setInterval(async()=>{await this.emitLogs()},this.socketEmitInterval),this.overloadGlobalConsole&&this._overloadConsole()})}createConnection(e,t){let n={...hs};return t&&(n={...n,...t}),It(e,n)}async emitLogs(){if(!this.emitInProgress)try{const e=await this.getItem(this.storageId),t=JSON.parse(e||"{}"),n={...this.localObject,...t};if(!Object.keys(n).length)return;const r=[];this.emitInProgress=!0;const o=Object.keys(n);if(!o.length)return;if((!this.socket||!this.socket.connected)&&!this.requestUrl)throw new Error("Log request can't be sent. Socket is disconnected or requestUrl is not provided");const u=[];for(const c of o){const p=as(n[c]),l={...this.staticObject,...p},i=this.populateSendingLog(l);this.socket?this.socket.emit("Log",JSON.stringify(i)):this.requestUrl&&u.push(i),r.push(c)}u.length&&await this.sendHttpRequest(u);const h=await this.getItem(this.storageId);if(!h)return;const d=is(h,r);this.localObject={},await this.setItem(this.storageId,JSON.stringify(d))}catch(e){this._errorMethod(e)}finally{this.emitInProgress=!1}}populateSendingLog(e){const t={...e},n=t.ActionName;return n&&(t.ActionID=ls[n]),t}setupStaticFields(e){this.staticObject={...e}}populateMetaData(){const e=new Date;let t;typeof window<"u"&&typeof window.document<"u"?t=window==null?void 0:window.navigator.userAgent:typeof self<"u"&&self.navigator&&(t=self.navigator.userAgent);let n;return t&&(n=cs(t)),{System:this.system,DateTime:e,UserAgent:t,OSVersion:n}}async stop(){!this.socket||!this.socket.connected||(clearInterval(this.interval),await this.emitLogs(),this.socket.disconnect())}async start(){var e;this.socket&&this.socket.connected||((e=this.socket)==null||e.connect(),this.interval=setInterval(async()=>{await this.emitLogs()},this.socketEmitInterval))}_overloadConsole(){Z=Object.assign(Z,{log:e=>{this.log(e)},warn:e=>{this.warn(e)},error:e=>{this.error(e)},debug:e=>{this.debug(e)}})}async initStorage(){const e=await this.getItem(this.storageId);(!e||typeof e!="string")&&(await this.setItem(this.storageId,JSON.stringify({})),this.storageInitialized=!0)}async resetStorage(){await this.setItem(this.storageId,JSON.stringify({}))}getStorageName(){const e=rs();return this.system.toString().toUpperCase()+e+Date.now()}async processLog(...e){try{if(e.length<2)return;const t=e[0],n=e[1],r=this.formItemKey(t);if(!this.storageInitialized){this.localObject={...this.localObject,[r]:n};return}const o=await this.getItem(this.storageId);if(!o)return;const u=JSON.parse(o);u[r]=JSON.stringify(n),await this.setItem(this.storageId,JSON.stringify(u))}catch(t){this._errorMethod(t)}}async processQueue(){if(this.processing||this.queue.length===0)return;const e=this.queue.shift();e&&(this.processing=!0,await this.processLog(...e).finally(()=>{this.processing=!1,this.processQueue()}))}log(e){const t={...this.populateMetaData(),...e},n=["INFO",t];this.queue.push(n),this.logToConsole&&this._logMethod.apply(Z,[t]),this.processQueue()}warn(e){const t=["WARN",e];this.queue.push(t),this.logToConsole&&this._warnMethod.apply(Z,[e]),this.processQueue()}error(e){const t=["ERROR",e];this.queue.push(t),this.logToConsole&&this._errorMethod.apply(Z,[e]),this.processQueue()}debug(e){const t=["DEBUG",e];this.queue.push(t),this.logToConsole&&this._debugMethod.apply(Z,[e]),this.processQueue()}async defaultGetItemFunction(e){return localStorage.getItem(e)}async defaultSetItemFunction(e,t){try{localStorage.setItem(e,t)}catch(n){this._errorMethod(n)}}formItemKey(e){const t=new Date().toISOString();return this.logIndex++,`${e}-${this.system}-${t}-${this.logIndex}`}}class ps{constructor(e){K(this,"storageLogger");this.eventsSdkClass=e,this.eventsSdkClass=e}init(){if(!this.eventsSdkClass.options.useLogger)return;if(this.eventsSdkClass.options.storageLoggerInstance){this.storageLogger=this.eventsSdkClass.options.storageLoggerInstance;return}let e;this.eventsSdkClass.options.loggerSocketConnection&&(e=this.eventsSdkClass.options.loggerSocketConnection),this.eventsSdkClass.socketIoClass.ioFunction&&!e&&(e=this.eventsSdkClass.socketIoClass.ioFunction(this.eventsSdkClass.options.loggerServer,this.eventsSdkClass.options.loggerConnectOptions)),e&&(this.storageLogger=new us({socket:e,loggerOptions:this.eventsSdkClass.options.loggerConfig}))}async start(){this.storageLogger&&await this.storageLogger.start()}stop(){this.storageLogger&&this.storageLogger.stop()}log(e){this.eventsSdkClass.options.useLogger&&(this.storageLogger?e.Level===Q.INFO?this.storageLogger.log(e):e.Level===Q.ERROR&&this.storageLogger.error(e):e.Level===Q.INFO?console.log(e):e.Level===Q.ERROR&&console.error(e))}sdkConnectionSuccess(){const e={...this.eventsSdkClass.options,token:"CENSORED",password:"CENSORED"};this.log({Message:`Sdk connected to the socket server ${this.eventsSdkClass.server&&this.eventsSdkClass.server.Domain?this.eventsSdkClass.server.Domain:this.eventsSdkClass.URL}`,Body:JSON.stringify(e,this.eventsSdkClass.getCircularReplacer()),ActionName:ht.WSCONNECT,isShowClient:!1,Status:"Connection established",StatusCode:200,Level:Q.INFO,LogType:lt.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:ht.WSCONNECT,isShowClient:!1,Status:"Connection closed",StatusCode:200,Level:Q.INFO,LogType:lt.INFO})}sdkAttemptToConnect(e){this.log({Message:`${this.eventsSdkClass.options.loggerConfig.system} is trying to connect to WS server ${e}`,ActionName:ht.WSCONNECT,isShowClient:!1,Status:"Switching Protocols",StatusCode:101,Level:Q.INFO,LogType:lt.INFO})}sdkAttemptToConnectError(e){this.log({Message:`${e}`,ActionName:ht.WSCONNECT,isShowClient:!1,Status:"Connection error",StatusCode:500,Level:Q.ERROR,LogType:lt.ERROR})}loginError(e,t,n,r){this.log({Message:`External login request error with the login type ${e} ${e===rt.TOKEN?n:r}`,ActionName:ht.WSCONNECT,isShowClient:!1,Status:"External login error",StatusCode:t||400,Level:Q.ERROR,LogType:lt.ERROR})}getSettingsError(e,t){this.log({Message:`Get settings error with token ${e}, error: ${t}`,ActionName:ht.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:Q.ERROR,LogType:lt.ERROR})}refreshTokenError(e,t,n){this.log({Message:`Refresh token error with old refresh token ${e}, url: ${t}, error: ${n}`,ActionName:ht.WSCONNECT,isShowClient:!1,Status:"Get settings error",StatusCode:400,Level:Q.ERROR,LogType:lt.ERROR})}keepAliveEmit(){this.log({Message:`Keep alive event emitted with this token: ${this.eventsSdkClass.authClass.token}`,ActionName:ht.WSCONNECT,isShowClient:!1,Level:Q.INFO,LogType:lt.INFO})}keepAliveResponse(e){this.log({Message:`Keep alive response: ${JSON.stringify(e)}`,ActionName:ht.WSCONNECT,isShowClient:!1,Status:"Successful",StatusCode:200,Level:Q.INFO,LogType:lt.INFO})}eventLog(e,t){const n={[ft.FULL]:[],[ft.BOOTSTRAP]:[P.LOGIN_STATUS,P.LOGIN_SUCCESS,P.ALL_EXTENSION_STATUS,P.ALL_DIALER_STATUS],[ft.DEBUG_EXTENSIONS]:[P.ALL_EXTENSION_STATUS,P.EXTENSION_EVENT,P.EXTENSIONS_UPDATED],[ft.DEBUG_DIALER]:[P.ALL_DIALER_STATUS,P.DIALER_EVENT],[ft.DEBUG_QUEUE]:[P.QUEUE_EVENT]};this.eventsSdkClass.options.debugOption&&(n[this.eventsSdkClass.options.debugOption].includes(e)||this.eventsSdkClass.options.debugOption===ft.FULL)&&this.log({Message:`Event name: ${e}`,Body:t,ActionName:ht.WSCONNECT,isShowClient:!1,Status:"Successful",Level:Q.INFO,LogType:lt.INFO})}}class fs{constructor(e){K(this,"listeners",{[P.ALL_EXTENSION_STATUS]:[],[P.ALL_DIALER_STATUS]:[],[P.ALL_USERS_STATUS]:[],[P.QUEUE_EVENT]:[],[P.EXTENSION_EVENT]:[],[P.DIALER_EVENT]:[],[P.LOGIN_SUCCESS]:[],[P.LOGIN_STATUS]:[],[P.KEEP_ALIVE_RESPONSE]:[],[P.ONLINE_STATUS_EVENT]:[],[P.EXTENSIONS_UPDATED]:[]});K(this,"allListeners",[]);this.eventsSdkClass=e,this.eventsSdkClass=e}on(e,t){e==="*"?this.allListeners.push(t):this.listeners[e].push(t)}off(e,t){if(e==="*")this.allListeners=this.allListeners.filter(n=>n!==t);else{const r=this.listeners[e].filter(o=>o!==t);this.listeners={...this.listeners,[e]:r}}}emit(e,t){this.eventsSdkClass.socketIoClass.lastEventTimestamp=new Date().getTime(),this.listeners[e].forEach(r=>r({name:e,data:t}));const n={name:e,data:t};this.allListeners.forEach(r=>r(n))}}class ds{constructor(e){K(this,"options");K(this,"servers",[]);K(this,"URLList",[]);K(this,"server");K(this,"URL");K(this,"socket");K(this,"mainServer");K(this,"alreadyAttemptedOtherServers",[]);K(this,"authClass",new tn(this));K(this,"socketIoClass",new cn(this));K(this,"loggerClass",new ps(this));K(this,"eventEmitterClass",new fs(this));K(this,"getCircularReplacer",()=>{const e=new WeakSet;return(t,n)=>{if(!(t==="socket"||t==="io"||t==="nsps")){if(typeof n=="object"&&n!==null){if(e.has(n))return;e.add(n)}return n}}});this.options={...en,...e}}on(e,t){this.eventEmitterClass.on(e,t)}emit(e,...t){this.socketIoClass.io&&this.socketIoClass.io.emit(e,...t)}connect(e){e===it.MAIN&&this.findMainServer(),e===it.NEXT&&this.findNextServer(),this.socketIoClass.doReconnect=!0;try{this.loggerClass.init()}catch(t){console.error(t)}this.socketIoClass.initSocketConnection(),this.socketIoClass.initSocketEvents(),this.socketIoClass.initKeepAlive()}disconnect(){this.socketIoClass.doReconnect=!1,this.socketIoClass.closeAllConnections(),this.loggerClass.stop()}clearKeepAliveInterval(){this.socketIoClass.clearKeepAliveInterval()}findMainServer(){this.servers.length?(this.mainServer=this.servers.reduce((e,t)=>t.Priority>e.Priority?t:e),this.server=this.mainServer):this.URLList.length&&(this.URL=this.URLList[0])}findNextServer(){if(this.servers.length&&this.server)if(this.server.Priority===this.mainServer.Priority){let e=this.servers.filter(t=>t.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(t.Priority)+1===0);e.length||(this.alreadyAttemptedOtherServers=[],e=this.servers.filter(t=>t.Priority!==this.mainServer.Priority&&this.alreadyAttemptedOtherServers.indexOf(t.Priority)+1===0)),e.length&&(this.server=e.reduce((t,n)=>n.Priority>t.Priority?n:t),this.alreadyAttemptedOtherServers.push(this.server.Priority))}else this.server=this.mainServer;else if(this.URLList.length)if(this.URL===this.URLList[0]){let e=this.URLList.filter(t=>t!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(t)+1===0);e.length||(this.alreadyAttemptedOtherServers=[],e=this.URLList.filter(t=>t!==this.URLList[0]&&this.alreadyAttemptedOtherServers.indexOf(t)+1===0)),e.length&&(this.URL=e[0],this.alreadyAttemptedOtherServers.push(this.URL))}else this.URL=this.URLList[0]}async init(){const e=await this.authClass.login();return e&&this.authClass.onLoginResponse(e),!0}getCurrentMonitorServer(){return this.server}}return $.CallStatusEnum=fe,$.CallTypeEnum=de,$.ConnectionStatusEnum=dt,$.DebugOption=ft,$.DialerTypeEnum=ge,$.DirectionEnum=ye,$.DoNotCallMeStatusCodeEnum=me,$.EventsEnum=P,$.ExtensionEventReasonEnum=Pt,$.ExtensionHangupCauseEnum=ve,$.LoginType=rt,$.QueueEventReasonEnum=ke,$.ServerListenerEventsEnum=jt,$.ServerParameter=it,$.default=ds,Object.defineProperties($,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),$}({},ws);
20
19
  //# sourceMappingURL=voicenter-events-sdk.iife.js.map