@polyv/socket 2.1.0-rc-20251023.1 → 2.1.0-rc-20251023.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +1 -1
- package/index.es.js +2 -2
- package/index.umd.js +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
19
19
|
* @license MIT
|
|
20
20
|
*/var Fx=function(e){return e!=null&&(Fi(e)||Ax(e)||!!e._isBuffer)};function Fi(e){return!!e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function Ax(e){return typeof e.readFloatLE=="function"&&typeof e.slice=="function"&&Fi(e.slice(0,0))}(function(){var e=Ex,t=Fa.utf8,r=Fx,n=Fa.bin,a=function(i,c){i.constructor==String?c&&c.encoding==="binary"?i=n.stringToBytes(i):i=t.stringToBytes(i):r(i)?i=Array.prototype.slice.call(i,0):!Array.isArray(i)&&i.constructor!==Uint8Array&&(i=i.toString());for(var f=e.bytesToWords(i),p=i.length*8,o=1732584193,x=-271733879,h=-1732584194,s=271733878,d=0;d<f.length;d++)f[d]=(f[d]<<8|f[d]>>>24)&16711935|(f[d]<<24|f[d]>>>8)&4278255360;f[p>>>5]|=128<<p%32,f[(p+64>>>9<<4)+14]=p;for(var v=a._ff,m=a._gg,C=a._hh,E=a._ii,d=0;d<f.length;d+=16){var y=o,B=x,b=h,F=s;o=v(o,x,h,s,f[d+0],7,-680876936),s=v(s,o,x,h,f[d+1],12,-389564586),h=v(h,s,o,x,f[d+2],17,606105819),x=v(x,h,s,o,f[d+3],22,-1044525330),o=v(o,x,h,s,f[d+4],7,-176418897),s=v(s,o,x,h,f[d+5],12,1200080426),h=v(h,s,o,x,f[d+6],17,-1473231341),x=v(x,h,s,o,f[d+7],22,-45705983),o=v(o,x,h,s,f[d+8],7,1770035416),s=v(s,o,x,h,f[d+9],12,-1958414417),h=v(h,s,o,x,f[d+10],17,-42063),x=v(x,h,s,o,f[d+11],22,-1990404162),o=v(o,x,h,s,f[d+12],7,1804603682),s=v(s,o,x,h,f[d+13],12,-40341101),h=v(h,s,o,x,f[d+14],17,-1502002290),x=v(x,h,s,o,f[d+15],22,1236535329),o=m(o,x,h,s,f[d+1],5,-165796510),s=m(s,o,x,h,f[d+6],9,-1069501632),h=m(h,s,o,x,f[d+11],14,643717713),x=m(x,h,s,o,f[d+0],20,-373897302),o=m(o,x,h,s,f[d+5],5,-701558691),s=m(s,o,x,h,f[d+10],9,38016083),h=m(h,s,o,x,f[d+15],14,-660478335),x=m(x,h,s,o,f[d+4],20,-405537848),o=m(o,x,h,s,f[d+9],5,568446438),s=m(s,o,x,h,f[d+14],9,-1019803690),h=m(h,s,o,x,f[d+3],14,-187363961),x=m(x,h,s,o,f[d+8],20,1163531501),o=m(o,x,h,s,f[d+13],5,-1444681467),s=m(s,o,x,h,f[d+2],9,-51403784),h=m(h,s,o,x,f[d+7],14,1735328473),x=m(x,h,s,o,f[d+12],20,-1926607734),o=C(o,x,h,s,f[d+5],4,-378558),s=C(s,o,x,h,f[d+8],11,-2022574463),h=C(h,s,o,x,f[d+11],16,1839030562),x=C(x,h,s,o,f[d+14],23,-35309556),o=C(o,x,h,s,f[d+1],4,-1530992060),s=C(s,o,x,h,f[d+4],11,1272893353),h=C(h,s,o,x,f[d+7],16,-155497632),x=C(x,h,s,o,f[d+10],23,-1094730640),o=C(o,x,h,s,f[d+13],4,681279174),s=C(s,o,x,h,f[d+0],11,-358537222),h=C(h,s,o,x,f[d+3],16,-722521979),x=C(x,h,s,o,f[d+6],23,76029189),o=C(o,x,h,s,f[d+9],4,-640364487),s=C(s,o,x,h,f[d+12],11,-421815835),h=C(h,s,o,x,f[d+15],16,530742520),x=C(x,h,s,o,f[d+2],23,-995338651),o=E(o,x,h,s,f[d+0],6,-198630844),s=E(s,o,x,h,f[d+7],10,1126891415),h=E(h,s,o,x,f[d+14],15,-1416354905),x=E(x,h,s,o,f[d+5],21,-57434055),o=E(o,x,h,s,f[d+12],6,1700485571),s=E(s,o,x,h,f[d+3],10,-1894986606),h=E(h,s,o,x,f[d+10],15,-1051523),x=E(x,h,s,o,f[d+1],21,-2054922799),o=E(o,x,h,s,f[d+8],6,1873313359),s=E(s,o,x,h,f[d+15],10,-30611744),h=E(h,s,o,x,f[d+6],15,-1560198380),x=E(x,h,s,o,f[d+13],21,1309151649),o=E(o,x,h,s,f[d+4],6,-145523070),s=E(s,o,x,h,f[d+11],10,-1120210379),h=E(h,s,o,x,f[d+2],15,718787259),x=E(x,h,s,o,f[d+9],21,-343485551),o=o+y>>>0,x=x+B>>>0,h=h+b>>>0,s=s+F>>>0}return e.endian([o,x,h,s])};a._ff=function(i,c,f,p,o,x,h){var s=i+(c&f|~c&p)+(o>>>0)+h;return(s<<x|s>>>32-x)+c},a._gg=function(i,c,f,p,o,x,h){var s=i+(c&p|f&~p)+(o>>>0)+h;return(s<<x|s>>>32-x)+c},a._hh=function(i,c,f,p,o,x,h){var s=i+(c^f^p)+(o>>>0)+h;return(s<<x|s>>>32-x)+c},a._ii=function(i,c,f,p,o,x,h){var s=i+(f^(c|~p))+(o>>>0)+h;return(s<<x|s>>>32-x)+c},a._blocksize=16,a._digestsize=16,_i.exports=function(i,c){if(i==null)throw new Error("Illegal argument "+i);var f=e.wordsToBytes(a(i,c));return c&&c.asBytes?f:c&&c.asString?n.bytesToString(f):e.bytesToHex(f)}})();var Dx=_i.exports;const kt=tt(Dx),Rt=/^(?:([a-z]+):)?\/{2,3}/i;function wx(e,t){return Rt.test(e)}function Ai(e,t){return Rt.test(t)||(t+="://"),wx(e)?e.replace(Rt,t):t+e}function Sx(e){return e.replace(Rt,"")}var Di={exports:{}},$r={exports:{}},Aa;function Tx(){return Aa||(Aa=1,function(e){(function(t){var r={bytesToHex:function(i){return n(i)},hexToBytes:function(i){if(i.length%2===1)throw new Error("hexToBytes can't have a string with an odd number of characters.");return i.indexOf("0x")===0&&(i=i.slice(2)),i.match(/../g).map(function(c){return parseInt(c,16)})}};function n(i){return i.map(function(c){return a(c.toString(16),2)}).join("")}function a(i,c){return i.length>c?i:Array(c-i.length+1).join("0")+i}e.exports?e.exports=r:t.convertHex=r})(G)}($r)),$r.exports}var Kr={exports:{}},Da;function kx(){return Da||(Da=1,function(e){(function(t){var r={bytesToString:function(n){return n.map(function(a){return String.fromCharCode(a)}).join("")},stringToBytes:function(n){return n.split("").map(function(a){return a.charCodeAt(0)})}};r.UTF8={bytesToString:function(n){return decodeURIComponent(escape(r.bytesToString(n)))},stringToBytes:function(n){return r.stringToBytes(unescape(encodeURIComponent(n)))}},e.exports?e.exports=r:t.convertString=r})(G)}(Kr)),Kr.exports}(function(e){(function(t){var r={};e.exports?(r.bytesToHex=Tx().bytesToHex,r.convertString=kx(),e.exports=p):(r.bytesToHex=t.convertHex.bytesToHex,r.convertString=t.convertString,t.sha256=p);var n=[];(function(){function o(d){for(var v=Math.sqrt(d),m=2;m<=v;m++)if(!(d%m))return!1;return!0}function x(d){return(d-(d|0))*4294967296|0}for(var h=2,s=0;s<64;)o(h)&&(n[s]=x(Math.pow(h,1/3)),s++),h++})();var a=function(o){for(var x=[],h=0,s=0;h<o.length;h++,s+=8)x[s>>>5]|=o[h]<<24-s%32;return x},i=function(o){for(var x=[],h=0;h<o.length*32;h+=8)x.push(o[h>>>5]>>>24-h%32&255);return x},c=[],f=function(o,x,h){for(var s=o[0],d=o[1],v=o[2],m=o[3],C=o[4],E=o[5],y=o[6],B=o[7],b=0;b<64;b++){if(b<16)c[b]=x[h+b]|0;else{var F=c[b-15],D=(F<<25|F>>>7)^(F<<14|F>>>18)^F>>>3,T=c[b-2],P=(T<<15|T>>>17)^(T<<13|T>>>19)^T>>>10;c[b]=D+c[b-7]+P+c[b-16]}var H=C&E^~C&y,S=s&d^s&v^d&v,A=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),q=(C<<26|C>>>6)^(C<<21|C>>>11)^(C<<7|C>>>25),N=B+q+H+n[b]+c[b],z=A+S;B=y,y=E,E=C,C=m+N|0,m=v,v=d,d=s,s=N+z|0}o[0]=o[0]+s|0,o[1]=o[1]+d|0,o[2]=o[2]+v|0,o[3]=o[3]+m|0,o[4]=o[4]+C|0,o[5]=o[5]+E|0,o[6]=o[6]+y|0,o[7]=o[7]+B|0};function p(o,x){o.constructor===String&&(o=r.convertString.UTF8.stringToBytes(o));var h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],s=a(o),d=o.length*8;s[d>>5]|=128<<24-d%32,s[(d+64>>9<<4)+15]=d;for(var v=0;v<s.length;v+=16)f(h,s,v);var m=i(h);return x&&x.asBytes?m:x&&x.asString?r.convertString.bytesToString(m):r.bytesToHex(m)}p.x2=function(o,x){return p(p(o,{asBytes:!0}),x)}})(G)})(Di);var Rx=Di.exports;const wi=tt(Rx);function Px(e,t,r){const n=Object.keys(e).filter(i=>i!=="sign").sort();let a="";return n.forEach(i=>{let c=e[i];typeof c=="object"&&(c=JSON.stringify(c)),a+=i+c}),r||(r=String(e.signatureMethod).toLowerCase()==="sha256"?"sha256":"md5"),(r==="sha256"?wi:kt)(t+a+t).toString().toUpperCase()}class Ix extends ti{constructor(t){super({baseUrl:Ai(vn(t.config.domainInfo).chatApiDomain,"https"),requestPlugins:[new ri({getTokenInfo:()=>Q(this,null,function*(){const r=yield t.getToken();if(!r)return;let n=be.Params,a="token";const i=t.getUserInfo();return t.isSpecialUserType(i.userType)&&(n=be.Header,a="authorization"),{token:r,tokenField:a,tokenMode:n}})}),new Qr({globalParams:r=>Q(this,null,function*(){const{appendChannelId:n=!0,appendAccountId:a=!1,appendUserId:i=!0}=r,c={};if(n||a){const f=yield t.getChannelInfo();n&&(c.channelId=f.channelId),a&&(c.accountId=f.accountId)}if(i){const f=t.getUserInfo();c.userId=f.userId}return c})}),new ni({successCode:200}),new Qr({globalParams:r=>Q(this,null,function*(){const{appendSign:n=!1}=r;if(n)return{sign:yield this.getRoomSign()};const{appendChatSign:a=!1}=r;if(a){const i=r.params||{};return{sign:yield this.getChatSign(i)}}return{}})}),new Ci({getDecryptInfo:r=>{const n=r.params||{};return{decryptKeys:{sign:Px(n,"polyvChatClient"),iv:""},decryptPosition:Se.WholeResponse}}})]}),this._plvSocket=t}getRoomSign(){return Q(this,null,function*(){const t=yield this._plvSocket.getChannelInfo();return kt(`polyv_room_sign${t.channelId}`)})}getChatSign(t){return Q(this,null,function*(){let r=Object.keys(t).sort((a,i)=>{a=a.toLocaleLowerCase(),i=i.toLocaleLowerCase();for(let c=0;c<a.length&&c<i.length;c++){const f=a.charCodeAt(c)-i.charCodeAt(c);if(f!==0)return f}return a.length>i.length?1:-1}).reduce((a,i)=>{let c=t[i];return!c&&c!==0?a:(typeof c=="object"&&(c=JSON.stringify(c)),`${a}${i}${c}`)},"");return kt("polyvChatSign"+r+"polyvChatSign").toLocaleUpperCase()})}}var Xe=(e=>(e.Token="token",e.Sign="sign",e))(Xe||{}),Pt=(e=>(e.None="none",e.AES="aes",e.SM2="sm2",e))(Pt||{});let yt;const qx=new Uint8Array(16);function Ox(){if(!yt&&(yt=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!yt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return yt(qx)}const p0=[];for(let e=0;e<256;++e)p0.push((e+256).toString(16).slice(1));function Hx(e,t=0){return p0[e[t+0]]+p0[e[t+1]]+p0[e[t+2]]+p0[e[t+3]]+"-"+p0[e[t+4]]+p0[e[t+5]]+"-"+p0[e[t+6]]+p0[e[t+7]]+"-"+p0[e[t+8]]+p0[e[t+9]]+"-"+p0[e[t+10]]+p0[e[t+11]]+p0[e[t+12]]+p0[e[t+13]]+p0[e[t+14]]+p0[e[t+15]]}const Nx=typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),wa={randomUUID:Nx};function Mx(e,t,r){if(wa.randomUUID&&!e)return wa.randomUUID();e=e||{};const n=e.random||(e.rng||Ox)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,Hx(n)}exports.SignatureMethod=void 0;(function(e){e.MD5="MD5",e.SHA256="SHA256"})(exports.SignatureMethod||(exports.SignatureMethod={}));function Ux(e){let t="";const r=Object.keys(e).sort();for(const n of r)e[n]&&(t+=`${n}${e[n]}`);return t}function zx(e,t,r=exports.SignatureMethod.MD5){const n=Ux(e),a=t+n+t;return(r===exports.SignatureMethod.MD5?kt(a):wi(a)).toUpperCase()}class Lx{constructor(t){V(this,"__config");V(this,"__appId");V(this,"__appSecret");V(this,"__signatureNonce");V(this,"__signatureMethod");V(this,"__getAppSign");var r,n;this.__config=t,this.__appId=t.appId||"",this.__appSecret=t.appSecret||"",this.__signatureNonce=(r=t.signatureNonce)!=null?r:!1,this.__signatureMethod=(n=t.signatureMethod)!=null?n:exports.SignatureMethod.MD5,this.__getAppSign=t.getAppSign}usePlugin(t){const{useAppSign:r=!0}=t;return r}interceptIncludeParams(t){const{signatureNonce:r=this.__signatureNonce,signatureMethod:n=this.__signatureMethod}=t,a={};return r&&(a.signatureNonce=Mx()),n&&(a.signatureMethod=n),a}interceptAuthorizeRequest(t){return Q(this,null,function*(){const r=a0({},t.params||{}),n=yield this.__getAppSignData(r,t);return n?(r.appId=n.appId,r.timestamp=n.timestamp,r.sign=n.sign,n.signatureMethod&&(r.signatureMethod=n.signatureMethod)):console.error("AuthorizeAppSignRequestPlugin error, signData is undefined"),W0(a0({},t),{params:r})})}__getAppSignData(t,r){return Q(this,null,function*(){const{signatureMethod:n=this.__signatureMethod}=r;if(this.__getAppSign)return yield this.__getAppSign({params:t,signatureMethod:n});if(this.__appId&&this.__appSecret){const a=Date.now(),i=W0(a0({},t),{appId:this.__appId,timestamp:a}),c=zx(i,this.__appSecret,n);return{appId:this.__appId,timestamp:a,sign:c,signatureMethod:n}}})}}const $x=j0("S0xmTzdabmZRQzhqSXZFWA=="),Kx=j0("VlRSZTdTbWRsbFJzSjdDYg=="),Wx=j0("UG9seXZBcGlSZXNwb25zZQ=="),jx=j0("UG9seXZMaXZlRW5jcnlwdA==");function Xx(e,t){const{sign:r,iv:n}=t,a=k0.enc.Utf8.parse(r),i=k0.enc.Utf8.parse(e);return k0.AES.encrypt(i,a,{iv:k0.enc.Utf8.parse(n),mode:k0.mode.CBC,padding:k0.pad.Pkcs7}).toString()}class Vx{constructor(t={}){V(this,"__config");V(this,"__encryptPostAES");var r;this.__config=t,this.__encryptPostAES=(r=t.encryptPostAES)!=null?r:!0}usePlugin(t){const{useAES:r=!0}=t;return r}interceptIncludeParams(){return{encryptResponseType:1}}interceptEncryptRequest(t){const r=this.__handleData(t),n=this.__handleHeaders(t);return W0(a0({},t),{data:r,headers:n})}interceptDecryptResponse(t){const r=t.data;if(!r.encryption||typeof r.data!="string")return t;const n=r.data,a=this.__getDecryptKeyInfo();return r.data=en(n,a,Ie.Base64),t}__handleHeaders(t){var a;const r=t.headers||{},{encryptPostAES:n=this.__encryptPostAES}=t;return((a=t.method)==null?void 0:a.toLocaleUpperCase())==="POST"&&n&&(r["x-e-type"]=1),r}__handleData(t){var i;const r=t.data||{};if(((i=t.method)==null?void 0:i.toLocaleUpperCase())!=="POST")return r;let n=r;const{encryptPostAES:a=this.__encryptPostAES}=t;if(a){t.requestType="json";let c="";typeof r=="string"?c=r:typeof r=="object"&&(c=JSON.stringify(r));const f=this.__getEncryptKeyInfo(t);n=Xx(c,f)}return n}__getDecryptKeyInfo(){return{sign:Wx,iv:jx}}__getEncryptKeyInfo(t){const r=t.params||{};let n=$x;return"appId"in r&&r.appId===this.__config.appId&&this.__config.appSecret&&(n=this.__config.appSecret),{sign:n,iv:Kx}}}var Si={exports:{}};(function(e,t){(function(){var r,n=0xdeadbeefcafe,a=(n&16777215)==15715070;function i(u,l,g){u!=null&&(typeof u=="number"?this.fromNumber(u,l,g):l==null&&typeof u!="string"?this.fromString(u,256):this.fromString(u,l))}function c(){return new i(null)}function f(u,l,g,R,M,U){for(;--U>=0;){var $=l*this[u++]+g[R]+M;M=Math.floor($/67108864),g[R++]=$&67108863}return M}function p(u,l,g,R,M,U){for(var $=l&32767,K=l>>15;--U>=0;){var x0=this[u]&32767,u0=this[u++]>>15,S0=K*x0+u0*$;x0=$*x0+((S0&32767)<<15)+g[R]+(M&1073741823),M=(x0>>>30)+(S0>>>15)+K*u0+(M>>>30),g[R++]=x0&1073741823}return M}function o(u,l,g,R,M,U){for(var $=l&16383,K=l>>14;--U>=0;){var x0=this[u]&16383,u0=this[u++]>>14,S0=K*x0+u0*$;x0=$*x0+((S0&16383)<<14)+g[R]+M,M=(x0>>28)+(S0>>14)+K*u0,g[R++]=x0&268435455}return M}var x=typeof navigator!="undefined";x&&a&&navigator.appName=="Microsoft Internet Explorer"?(i.prototype.am=p,r=30):x&&a&&navigator.appName!="Netscape"?(i.prototype.am=f,r=26):(i.prototype.am=o,r=28),i.prototype.DB=r,i.prototype.DM=(1<<r)-1,i.prototype.DV=1<<r;var h=52;i.prototype.FV=Math.pow(2,h),i.prototype.F1=h-r,i.prototype.F2=2*r-h;var s="0123456789abcdefghijklmnopqrstuvwxyz",d=new Array,v,m;for(v=48,m=0;m<=9;++m)d[v++]=m;for(v=97,m=10;m<36;++m)d[v++]=m;for(v=65,m=10;m<36;++m)d[v++]=m;function C(u){return s.charAt(u)}function E(u,l){var g=d[u.charCodeAt(l)];return g==null?-1:g}function y(u){for(var l=this.t-1;l>=0;--l)u[l]=this[l];u.t=this.t,u.s=this.s}function B(u){this.t=1,this.s=u<0?-1:0,u>0?this[0]=u:u<-1?this[0]=u+this.DV:this.t=0}function b(u){var l=c();return l.fromInt(u),l}function F(u,l){var g;if(l==16)g=4;else if(l==8)g=3;else if(l==256)g=8;else if(l==2)g=1;else if(l==32)g=5;else if(l==4)g=2;else{this.fromRadix(u,l);return}this.t=0,this.s=0;for(var R=u.length,M=!1,U=0;--R>=0;){var $=g==8?u[R]&255:E(u,R);if($<0){u.charAt(R)=="-"&&(M=!0);continue}M=!1,U==0?this[this.t++]=$:U+g>this.DB?(this[this.t-1]|=($&(1<<this.DB-U)-1)<<U,this[this.t++]=$>>this.DB-U):this[this.t-1]|=$<<U,U+=g,U>=this.DB&&(U-=this.DB)}g==8&&u[0]&128&&(this.s=-1,U>0&&(this[this.t-1]|=(1<<this.DB-U)-1<<U)),this.clamp(),M&&i.ZERO.subTo(this,this)}function D(){for(var u=this.s&this.DM;this.t>0&&this[this.t-1]==u;)--this.t}function T(u){if(this.s<0)return"-"+this.negate().toString(u);var l;if(u==16)l=4;else if(u==8)l=3;else if(u==2)l=1;else if(u==32)l=5;else if(u==4)l=2;else return this.toRadix(u);var g=(1<<l)-1,R,M=!1,U="",$=this.t,K=this.DB-$*this.DB%l;if($-- >0)for(K<this.DB&&(R=this[$]>>K)>0&&(M=!0,U=C(R));$>=0;)K<l?(R=(this[$]&(1<<K)-1)<<l-K,R|=this[--$]>>(K+=this.DB-l)):(R=this[$]>>(K-=l)&g,K<=0&&(K+=this.DB,--$)),R>0&&(M=!0),M&&(U+=C(R));return M?U:"0"}function P(){var u=c();return i.ZERO.subTo(this,u),u}function H(){return this.s<0?this.negate():this}function S(u){var l=this.s-u.s;if(l!=0)return l;var g=this.t;if(l=g-u.t,l!=0)return this.s<0?-l:l;for(;--g>=0;)if((l=this[g]-u[g])!=0)return l;return 0}function A(u){var l=1,g;return(g=u>>>16)!=0&&(u=g,l+=16),(g=u>>8)!=0&&(u=g,l+=8),(g=u>>4)!=0&&(u=g,l+=4),(g=u>>2)!=0&&(u=g,l+=2),(g=u>>1)!=0&&(u=g,l+=1),l}function q(){return this.t<=0?0:this.DB*(this.t-1)+A(this[this.t-1]^this.s&this.DM)}function N(u,l){var g;for(g=this.t-1;g>=0;--g)l[g+u]=this[g];for(g=u-1;g>=0;--g)l[g]=0;l.t=this.t+u,l.s=this.s}function z(u,l){for(var g=u;g<this.t;++g)l[g-u]=this[g];l.t=Math.max(this.t-u,0),l.s=this.s}function L(u,l){var g=u%this.DB,R=this.DB-g,M=(1<<R)-1,U=Math.floor(u/this.DB),$=this.s<<g&this.DM,K;for(K=this.t-1;K>=0;--K)l[K+U+1]=this[K]>>R|$,$=(this[K]&M)<<g;for(K=U-1;K>=0;--K)l[K]=0;l[U]=$,l.t=this.t+U+1,l.s=this.s,l.clamp()}function X(u,l){l.s=this.s;var g=Math.floor(u/this.DB);if(g>=this.t){l.t=0;return}var R=u%this.DB,M=this.DB-R,U=(1<<R)-1;l[0]=this[g]>>R;for(var $=g+1;$<this.t;++$)l[$-g-1]|=(this[$]&U)<<M,l[$-g]=this[$]>>R;R>0&&(l[this.t-g-1]|=(this.s&U)<<M),l.t=this.t-g,l.clamp()}function Y(u,l){for(var g=0,R=0,M=Math.min(u.t,this.t);g<M;)R+=this[g]-u[g],l[g++]=R&this.DM,R>>=this.DB;if(u.t<this.t){for(R-=u.s;g<this.t;)R+=this[g],l[g++]=R&this.DM,R>>=this.DB;R+=this.s}else{for(R+=this.s;g<u.t;)R-=u[g],l[g++]=R&this.DM,R>>=this.DB;R-=u.s}l.s=R<0?-1:0,R<-1?l[g++]=this.DV+R:R>0&&(l[g++]=R),l.t=g,l.clamp()}function r0(u,l){var g=this.abs(),R=u.abs(),M=g.t;for(l.t=M+R.t;--M>=0;)l[M]=0;for(M=0;M<R.t;++M)l[M+g.t]=g.am(0,R[M],l,M,0,g.t);l.s=0,l.clamp(),this.s!=u.s&&i.ZERO.subTo(l,l)}function o0(u){for(var l=this.abs(),g=u.t=2*l.t;--g>=0;)u[g]=0;for(g=0;g<l.t-1;++g){var R=l.am(g,l[g],u,2*g,0,1);(u[g+l.t]+=l.am(g+1,2*l[g],u,2*g+1,R,l.t-g-1))>=l.DV&&(u[g+l.t]-=l.DV,u[g+l.t+1]=1)}u.t>0&&(u[u.t-1]+=l.am(g,l[g],u,2*g,0,1)),u.s=0,u.clamp()}function n0(u,l,g){var R=u.abs();if(!(R.t<=0)){var M=this.abs();if(M.t<R.t){l!=null&&l.fromInt(0),g!=null&&this.copyTo(g);return}g==null&&(g=c());var U=c(),$=this.s,K=u.s,x0=this.DB-A(R[R.t-1]);x0>0?(R.lShiftTo(x0,U),M.lShiftTo(x0,g)):(R.copyTo(U),M.copyTo(g));var u0=U.t,S0=U[u0-1];if(S0!=0){var D0=S0*(1<<this.F1)+(u0>1?U[u0-2]>>this.F2:0),K0=this.FV/D0,lt=(1<<this.F1)/D0,I0=1<<this.F2,q0=g.t,pt=q0-u0,Z0=l==null?c():l;for(U.dlShiftTo(pt,Z0),g.compareTo(Z0)>=0&&(g[g.t++]=1,g.subTo(Z0,g)),i.ONE.dlShiftTo(u0,Z0),Z0.subTo(U,U);U.t<u0;)U[U.t++]=0;for(;--pt>=0;){var ir=g[--q0]==S0?this.DM:Math.floor(g[q0]*K0+(g[q0-1]+I0)*lt);if((g[q0]+=U.am(0,ir,g,pt,0,u0))<ir)for(U.dlShiftTo(pt,Z0),g.subTo(Z0,g);g[q0]<--ir;)g.subTo(Z0,g)}l!=null&&(g.drShiftTo(u0,l),$!=K&&i.ZERO.subTo(l,l)),g.t=u0,g.clamp(),x0>0&&g.rShiftTo(x0,g),$<0&&i.ZERO.subTo(g,g)}}}function _(u){var l=c();return this.abs().divRemTo(u,null,l),this.s<0&&l.compareTo(i.ZERO)>0&&u.subTo(l,l),l}function w(u){this.m=u}function I(u){return u.s<0||u.compareTo(this.m)>=0?u.mod(this.m):u}function k(u){return u}function O(u){u.divRemTo(this.m,null,u)}function W(u,l,g){u.multiplyTo(l,g),this.reduce(g)}function t0(u,l){u.squareTo(l),this.reduce(l)}w.prototype.convert=I,w.prototype.revert=k,w.prototype.reduce=O,w.prototype.mulTo=W,w.prototype.sqrTo=t0;function j(){if(this.t<1)return 0;var u=this[0];if(!(u&1))return 0;var l=u&3;return l=l*(2-(u&15)*l)&15,l=l*(2-(u&255)*l)&255,l=l*(2-((u&65535)*l&65535))&65535,l=l*(2-u*l%this.DV)%this.DV,l>0?this.DV-l:-l}function s0(u){this.m=u,this.mp=u.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<u.DB-15)-1,this.mt2=2*u.t}function l0(u){var l=c();return u.abs().dlShiftTo(this.m.t,l),l.divRemTo(this.m,null,l),u.s<0&&l.compareTo(i.ZERO)>0&&this.m.subTo(l,l),l}function C0(u){var l=c();return u.copyTo(l),this.reduce(l),l}function oe(u){for(;u.t<=this.mt2;)u[u.t++]=0;for(var l=0;l<this.m.t;++l){var g=u[l]&32767,R=g*this.mpl+((g*this.mph+(u[l]>>15)*this.mpl&this.um)<<15)&u.DM;for(g=l+this.m.t,u[g]+=this.m.am(0,R,u,l,0,this.m.t);u[g]>=u.DV;)u[g]-=u.DV,u[++g]++}u.clamp(),u.drShiftTo(this.m.t,u),u.compareTo(this.m)>=0&&u.subTo(this.m,u)}function E0(u,l){u.squareTo(l),this.reduce(l)}function y0(u,l,g){u.multiplyTo(l,g),this.reduce(g)}s0.prototype.convert=l0,s0.prototype.revert=C0,s0.prototype.reduce=oe,s0.prototype.mulTo=y0,s0.prototype.sqrTo=E0;function me(){return(this.t>0?this[0]&1:this.s)==0}function se(u,l){if(u>4294967295||u<1)return i.ONE;var g=c(),R=c(),M=l.convert(this),U=A(u)-1;for(M.copyTo(g);--U>=0;)if(l.sqrTo(g,R),(u&1<<U)>0)l.mulTo(R,M,g);else{var $=g;g=R,R=$}return l.revert(g)}function Be(u,l){var g;return u<256||l.isEven()?g=new w(l):g=new s0(l),this.exp(u,g)}i.prototype.copyTo=y,i.prototype.fromInt=B,i.prototype.fromString=F,i.prototype.clamp=D,i.prototype.dlShiftTo=N,i.prototype.drShiftTo=z,i.prototype.lShiftTo=L,i.prototype.rShiftTo=X,i.prototype.subTo=Y,i.prototype.multiplyTo=r0,i.prototype.squareTo=o0,i.prototype.divRemTo=n0,i.prototype.invDigit=j,i.prototype.isEven=me,i.prototype.exp=se,i.prototype.toString=T,i.prototype.negate=P,i.prototype.abs=H,i.prototype.compareTo=S,i.prototype.bitLength=q,i.prototype.mod=_,i.prototype.modPowInt=Be,i.ZERO=b(0),i.ONE=b(1);function xe(){var u=c();return this.copyTo(u),u}function $e(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function ce(){return this.t==0?this.s:this[0]<<24>>24}function F0(){return this.t==0?this.s:this[0]<<16>>16}function _0(u){return Math.floor(Math.LN2*this.DB/Math.log(u))}function U0(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function Ce(u){if(u==null&&(u=10),this.signum()==0||u<2||u>36)return"0";var l=this.chunkSize(u),g=Math.pow(u,l),R=b(g),M=c(),U=c(),$="";for(this.divRemTo(R,M,U);M.signum()>0;)$=(g+U.intValue()).toString(u).substr(1)+$,M.divRemTo(R,M,U);return U.intValue().toString(u)+$}function rt(u,l){this.fromInt(0),l==null&&(l=10);for(var g=this.chunkSize(l),R=Math.pow(l,g),M=!1,U=0,$=0,K=0;K<u.length;++K){var x0=E(u,K);if(x0<0){u.charAt(K)=="-"&&this.signum()==0&&(M=!0);continue}$=l*$+x0,++U>=g&&(this.dMultiply(R),this.dAddOffset($,0),U=0,$=0)}U>0&&(this.dMultiply(Math.pow(l,U)),this.dAddOffset($,0)),M&&i.ZERO.subTo(this,this)}function V0(u,l,g){if(typeof l=="number")if(u<2)this.fromInt(1);else for(this.fromNumber(u,g),this.testBit(u-1)||this.bitwiseTo(i.ONE.shiftLeft(u-1),_e,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(l);)this.dAddOffset(2,0),this.bitLength()>u&&this.subTo(i.ONE.shiftLeft(u-1),this);else{var R=new Array,M=u&7;R.length=(u>>3)+1,l.nextBytes(R),M>0?R[0]&=(1<<M)-1:R[0]=0,this.fromString(R,256)}}function fe(){var u=this.t,l=new Array;l[0]=this.s;var g=this.DB-u*this.DB%8,R,M=0;if(u-- >0)for(g<this.DB&&(R=this[u]>>g)!=(this.s&this.DM)>>g&&(l[M++]=R|this.s<<this.DB-g);u>=0;)g<8?(R=(this[u]&(1<<g)-1)<<8-g,R|=this[--u]>>(g+=this.DB-8)):(R=this[u]>>(g-=8)&255,g<=0&&(g+=this.DB,--u)),R&128&&(R|=-256),M==0&&(this.s&128)!=(R&128)&&++M,(M>0||R!=this.s)&&(l[M++]=R);return l}function Wt(u){return this.compareTo(u)==0}function nt(u){return this.compareTo(u)<0?this:u}function at(u){return this.compareTo(u)>0?this:u}function G0(u,l,g){var R,M,U=Math.min(u.t,this.t);for(R=0;R<U;++R)g[R]=l(this[R],u[R]);if(u.t<this.t){for(M=u.s&this.DM,R=U;R<this.t;++R)g[R]=l(this[R],M);g.t=this.t}else{for(M=this.s&this.DM,R=U;R<u.t;++R)g[R]=l(M,u[R]);g.t=u.t}g.s=l(this.s,u.s),g.clamp()}function de(u,l){return u&l}function jt(u){var l=c();return this.bitwiseTo(u,de,l),l}function _e(u,l){return u|l}function it(u){var l=c();return this.bitwiseTo(u,_e,l),l}function ot(u,l){return u^l}function Xt(u){var l=c();return this.bitwiseTo(u,ot,l),l}function Ke(u,l){return u&~l}function Vt(u){var l=c();return this.bitwiseTo(u,Ke,l),l}function st(){for(var u=c(),l=0;l<this.t;++l)u[l]=this.DM&~this[l];return u.t=this.t,u.s=~this.s,u}function Gt(u){var l=c();return u<0?this.rShiftTo(-u,l):this.lShiftTo(u,l),l}function xt(u){var l=c();return u<0?this.lShiftTo(-u,l):this.rShiftTo(u,l),l}function Zt(u){if(u==0)return-1;var l=0;return u&65535||(u>>=16,l+=16),u&255||(u>>=8,l+=8),u&15||(u>>=4,l+=4),u&3||(u>>=2,l+=2),u&1||++l,l}function Yt(){for(var u=0;u<this.t;++u)if(this[u]!=0)return u*this.DB+Zt(this[u]);return this.s<0?this.t*this.DB:-1}function Qt(u){for(var l=0;u!=0;)u&=u-1,++l;return l}function ct(){for(var u=0,l=this.s&this.DM,g=0;g<this.t;++g)u+=Qt(this[g]^l);return u}function Jt(u){var l=Math.floor(u/this.DB);return l>=this.t?this.s!=0:(this[l]&1<<u%this.DB)!=0}function er(u,l){var g=i.ONE.shiftLeft(u);return this.bitwiseTo(g,l,g),g}function ft(u){return this.changeBit(u,_e)}function tr(u){return this.changeBit(u,Ke)}function dt(u){return this.changeBit(u,ot)}function g0(u,l){for(var g=0,R=0,M=Math.min(u.t,this.t);g<M;)R+=this[g]+u[g],l[g++]=R&this.DM,R>>=this.DB;if(u.t<this.t){for(R+=u.s;g<this.t;)R+=this[g],l[g++]=R&this.DM,R>>=this.DB;R+=this.s}else{for(R+=this.s;g<u.t;)R+=u[g],l[g++]=R&this.DM,R>>=this.DB;R+=u.s}l.s=R<0?-1:0,R>0?l[g++]=R:R<-1&&(l[g++]=this.DV+R),l.t=g,l.clamp()}function z0(u){var l=c();return this.addTo(u,l),l}function ut(u){var l=c();return this.subTo(u,l),l}function rr(u){var l=c();return this.multiplyTo(u,l),l}function ho(){var u=c();return this.squareTo(u),u}function lo(u){var l=c();return this.divRemTo(u,l,null),l}function po(u){var l=c();return this.divRemTo(u,null,l),l}function bo(u){var l=c(),g=c();return this.divRemTo(u,l,g),new Array(l,g)}function vo(u){this[this.t]=this.am(0,u-1,this,0,0,this.t),++this.t,this.clamp()}function yo(u,l){if(u!=0){for(;this.t<=l;)this[this.t++]=0;for(this[l]+=u;this[l]>=this.DV;)this[l]-=this.DV,++l>=this.t&&(this[this.t++]=0),++this[l]}}function We(){}function Sn(u){return u}function go(u,l,g){u.multiplyTo(l,g)}function mo(u,l){u.squareTo(l)}We.prototype.convert=Sn,We.prototype.revert=Sn,We.prototype.mulTo=go,We.prototype.sqrTo=mo;function Bo(u){return this.exp(u,new We)}function Co(u,l,g){var R=Math.min(this.t+u.t,l);for(g.s=0,g.t=R;R>0;)g[--R]=0;var M;for(M=g.t-this.t;R<M;++R)g[R+this.t]=this.am(0,u[R],g,R,0,this.t);for(M=Math.min(u.t,l);R<M;++R)this.am(0,u[R],g,R,0,l-R);g.clamp()}function _o(u,l,g){--l;var R=g.t=this.t+u.t-l;for(g.s=0;--R>=0;)g[R]=0;for(R=Math.max(l-this.t,0);R<u.t;++R)g[this.t+R-l]=this.am(l-R,u[R],g,0,0,this.t+R-l);g.clamp(),g.drShiftTo(1,g)}function ue(u){this.r2=c(),this.q3=c(),i.ONE.dlShiftTo(2*u.t,this.r2),this.mu=this.r2.divide(u),this.m=u}function Eo(u){if(u.s<0||u.t>2*this.m.t)return u.mod(this.m);if(u.compareTo(this.m)<0)return u;var l=c();return u.copyTo(l),this.reduce(l),l}function Fo(u){return u}function Ao(u){for(u.drShiftTo(this.m.t-1,this.r2),u.t>this.m.t+1&&(u.t=this.m.t+1,u.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);u.compareTo(this.r2)<0;)u.dAddOffset(1,this.m.t+1);for(u.subTo(this.r2,u);u.compareTo(this.m)>=0;)u.subTo(this.m,u)}function Do(u,l){u.squareTo(l),this.reduce(l)}function wo(u,l,g){u.multiplyTo(l,g),this.reduce(g)}ue.prototype.convert=Eo,ue.prototype.revert=Fo,ue.prototype.reduce=Ao,ue.prototype.mulTo=wo,ue.prototype.sqrTo=Do;function So(u,l){var g=u.bitLength(),R,M=b(1),U;if(g<=0)return M;g<18?R=1:g<48?R=3:g<144?R=4:g<768?R=5:R=6,g<8?U=new w(l):l.isEven()?U=new ue(l):U=new s0(l);var $=new Array,K=3,x0=R-1,u0=(1<<R)-1;if($[1]=U.convert(this),R>1){var S0=c();for(U.sqrTo($[1],S0);K<=u0;)$[K]=c(),U.mulTo(S0,$[K-2],$[K]),K+=2}var D0=u.t-1,K0,lt=!0,I0=c(),q0;for(g=A(u[D0])-1;D0>=0;){for(g>=x0?K0=u[D0]>>g-x0&u0:(K0=(u[D0]&(1<<g+1)-1)<<x0-g,D0>0&&(K0|=u[D0-1]>>this.DB+g-x0)),K=R;!(K0&1);)K0>>=1,--K;if((g-=K)<0&&(g+=this.DB,--D0),lt)$[K0].copyTo(M),lt=!1;else{for(;K>1;)U.sqrTo(M,I0),U.sqrTo(I0,M),K-=2;K>0?U.sqrTo(M,I0):(q0=M,M=I0,I0=q0),U.mulTo(I0,$[K0],M)}for(;D0>=0&&!(u[D0]&1<<g);)U.sqrTo(M,I0),q0=M,M=I0,I0=q0,--g<0&&(g=this.DB-1,--D0)}return U.revert(M)}function To(u){var l=this.s<0?this.negate():this.clone(),g=u.s<0?u.negate():u.clone();if(l.compareTo(g)<0){var R=l;l=g,g=R}var M=l.getLowestSetBit(),U=g.getLowestSetBit();if(U<0)return l;for(M<U&&(U=M),U>0&&(l.rShiftTo(U,l),g.rShiftTo(U,g));l.signum()>0;)(M=l.getLowestSetBit())>0&&l.rShiftTo(M,l),(M=g.getLowestSetBit())>0&&g.rShiftTo(M,g),l.compareTo(g)>=0?(l.subTo(g,l),l.rShiftTo(1,l)):(g.subTo(l,g),g.rShiftTo(1,g));return U>0&&g.lShiftTo(U,g),g}function ko(u){if(u<=0)return 0;var l=this.DV%u,g=this.s<0?u-1:0;if(this.t>0)if(l==0)g=this[0]%u;else for(var R=this.t-1;R>=0;--R)g=(l*g+this[R])%u;return g}function Ro(u){var l=u.isEven();if(this.isEven()&&l||u.signum()==0)return i.ZERO;for(var g=u.clone(),R=this.clone(),M=b(1),U=b(0),$=b(0),K=b(1);g.signum()!=0;){for(;g.isEven();)g.rShiftTo(1,g),l?((!M.isEven()||!U.isEven())&&(M.addTo(this,M),U.subTo(u,U)),M.rShiftTo(1,M)):U.isEven()||U.subTo(u,U),U.rShiftTo(1,U);for(;R.isEven();)R.rShiftTo(1,R),l?((!$.isEven()||!K.isEven())&&($.addTo(this,$),K.subTo(u,K)),$.rShiftTo(1,$)):K.isEven()||K.subTo(u,K),K.rShiftTo(1,K);g.compareTo(R)>=0?(g.subTo(R,g),l&&M.subTo($,M),U.subTo(K,U)):(R.subTo(g,R),l&&$.subTo(M,$),K.subTo(U,K))}if(R.compareTo(i.ONE)!=0)return i.ZERO;if(K.compareTo(u)>=0)return K.subtract(u);if(K.signum()<0)K.addTo(u,K);else return K;return K.signum()<0?K.add(u):K}var m0=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Po=(1<<26)/m0[m0.length-1];function Io(u){var l,g=this.abs();if(g.t==1&&g[0]<=m0[m0.length-1]){for(l=0;l<m0.length;++l)if(g[0]==m0[l])return!0;return!1}if(g.isEven())return!1;for(l=1;l<m0.length;){for(var R=m0[l],M=l+1;M<m0.length&&R<Po;)R*=m0[M++];for(R=g.modInt(R);l<M;)if(R%m0[l++]==0)return!1}return g.millerRabin(u)}function qo(u){var l=this.subtract(i.ONE),g=l.getLowestSetBit();if(g<=0)return!1;var R=l.shiftRight(g);u=u+1>>1,u>m0.length&&(u=m0.length);for(var M=c(),U=0;U<u;++U){M.fromInt(m0[Math.floor(Math.random()*m0.length)]);var $=M.modPow(R,this);if($.compareTo(i.ONE)!=0&&$.compareTo(l)!=0){for(var K=1;K++<g&&$.compareTo(l)!=0;)if($=$.modPowInt(2,this),$.compareTo(i.ONE)==0)return!1;if($.compareTo(l)!=0)return!1}}return!0}i.prototype.chunkSize=_0,i.prototype.toRadix=Ce,i.prototype.fromRadix=rt,i.prototype.fromNumber=V0,i.prototype.bitwiseTo=G0,i.prototype.changeBit=er,i.prototype.addTo=g0,i.prototype.dMultiply=vo,i.prototype.dAddOffset=yo,i.prototype.multiplyLowerTo=Co,i.prototype.multiplyUpperTo=_o,i.prototype.modInt=ko,i.prototype.millerRabin=qo,i.prototype.clone=xe,i.prototype.intValue=$e,i.prototype.byteValue=ce,i.prototype.shortValue=F0,i.prototype.signum=U0,i.prototype.toByteArray=fe,i.prototype.equals=Wt,i.prototype.min=nt,i.prototype.max=at,i.prototype.and=jt,i.prototype.or=it,i.prototype.xor=Xt,i.prototype.andNot=Vt,i.prototype.not=st,i.prototype.shiftLeft=Gt,i.prototype.shiftRight=xt,i.prototype.getLowestSetBit=Yt,i.prototype.bitCount=ct,i.prototype.testBit=Jt,i.prototype.setBit=ft,i.prototype.clearBit=tr,i.prototype.flipBit=dt,i.prototype.add=z0,i.prototype.subtract=ut,i.prototype.multiply=rr,i.prototype.divide=lo,i.prototype.remainder=po,i.prototype.divideAndRemainder=bo,i.prototype.modPow=So,i.prototype.modInverse=Ro,i.prototype.pow=Bo,i.prototype.gcd=To,i.prototype.isProbablePrime=Io,i.prototype.square=ho,i.prototype.Barrett=ue;var ht,A0,d0;function Oo(u){A0[d0++]^=u&255,A0[d0++]^=u>>8&255,A0[d0++]^=u>>16&255,A0[d0++]^=u>>24&255,d0>=ar&&(d0-=ar)}function Tn(){Oo(new Date().getTime())}if(A0==null){A0=new Array,d0=0;var P0;if(typeof window!="undefined"&&window.crypto){if(window.crypto.getRandomValues){var kn=new Uint8Array(32);for(window.crypto.getRandomValues(kn),P0=0;P0<32;++P0)A0[d0++]=kn[P0]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var Rn=window.crypto.random(32);for(P0=0;P0<Rn.length;++P0)A0[d0++]=Rn.charCodeAt(P0)&255}}for(;d0<ar;)P0=Math.floor(65536*Math.random()),A0[d0++]=P0>>>8,A0[d0++]=P0&255;d0=0,Tn()}function Ho(){if(ht==null){for(Tn(),ht=zo(),ht.init(A0),d0=0;d0<A0.length;++d0)A0[d0]=0;d0=0}return ht.next()}function No(u){var l;for(l=0;l<u.length;++l)u[l]=Ho()}function Pn(){}Pn.prototype.nextBytes=No;function nr(){this.i=0,this.j=0,this.S=new Array}function Mo(u){var l,g,R;for(l=0;l<256;++l)this.S[l]=l;for(g=0,l=0;l<256;++l)g=g+this.S[l]+u[l%u.length]&255,R=this.S[l],this.S[l]=this.S[g],this.S[g]=R;this.i=0,this.j=0}function Uo(){var u;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,u=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=u,this.S[u+this.S[this.i]&255]}nr.prototype.init=Mo,nr.prototype.next=Uo;function zo(){return new nr}var ar=256;e.exports={default:i,BigInteger:i,SecureRandom:Pn}}).call(G)})(Si);var Ut=Si.exports;const{BigInteger:qe}=Ut;function Gx(e){let t=e.toString(16);if(t[0]!=="-")t.length%2===1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{t=t.substr(1);let r=t.length;r%2===1?r+=1:t.match(/^[0-7]/)||(r+=2);let n="";for(let a=0;a<r;a++)n+="f";n=new qe(n,16),t=n.xor(e).add(qe.ONE),t=t.toString(16).replace(/^-/,"")}return t}class Ti{constructor(){this.tlv=null,this.t="00",this.l="00",this.v=""}getEncodedHex(){return this.tlv||(this.v=this.getValue(),this.l=this.getLength(),this.tlv=this.t+this.l+this.v),this.tlv}getLength(){const t=this.v.length/2;let r=t.toString(16);return r.length%2===1&&(r="0"+r),t<128?r:(128+r.length/2).toString(16)+r}getValue(){return""}}class Sa extends Ti{constructor(t){super(),this.t="02",t&&(this.v=Gx(t))}getValue(){return this.v}}class Zx extends Ti{constructor(t){super(),this.t="30",this.asn1Array=t}getValue(){return this.v=this.asn1Array.map(t=>t.getEncodedHex()).join(""),this.v}}function ki(e,t){return+e[t+2]<8?1:+e.substr(t+2,2)&128}function Ta(e,t){const r=ki(e,t),n=e.substr(t+2,r*2);return n?(+n[0]<8?new qe(n,16):new qe(n.substr(2),16)).intValue():-1}function Wr(e,t){const r=ki(e,t);return t+(r+1)*2}var Yx={encodeDer(e,t){const r=new Sa(e),n=new Sa(t);return new Zx([r,n]).getEncodedHex()},decodeDer(e){const t=Wr(e,0),r=Wr(e,t),n=Ta(e,t),a=e.substr(r,n*2),i=r+a.length,c=Wr(e,i),f=Ta(e,i),p=e.substr(c,f*2),o=new qe(a,16),x=new qe(p,16);return{r:o,s:x}}};const{BigInteger:B0}=Ut,ka=new B0("2"),Ra=new B0("3");class Q0{constructor(t,r){this.x=r,this.q=t}equals(t){return t===this?!0:this.q.equals(t.q)&&this.x.equals(t.x)}toBigInteger(){return this.x}negate(){return new Q0(this.q,this.x.negate().mod(this.q))}add(t){return new Q0(this.q,this.x.add(t.toBigInteger()).mod(this.q))}subtract(t){return new Q0(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))}multiply(t){return new Q0(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))}divide(t){return new Q0(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))}square(){return new Q0(this.q,this.x.square().mod(this.q))}}class pe{constructor(t,r,n,a){this.curve=t,this.x=r,this.y=n,this.z=a==null?B0.ONE:a,this.zinv=null}getX(){return this.zinv===null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}getY(){return this.zinv===null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}equals(t){return t===this?!0:this.isInfinity()?t.isInfinity():t.isInfinity()?this.isInfinity():t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(B0.ZERO)?t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(B0.ZERO):!1}isInfinity(){return this.x===null&&this.y===null?!0:this.z.equals(B0.ZERO)&&!this.y.toBigInteger().equals(B0.ZERO)}negate(){return new pe(this.curve,this.x,this.y.negate(),this.z)}add(t){if(this.isInfinity())return t;if(t.isInfinity())return this;const r=this.x.toBigInteger(),n=this.y.toBigInteger(),a=this.z,i=t.x.toBigInteger(),c=t.y.toBigInteger(),f=t.z,p=this.curve.q,o=r.multiply(f).mod(p),x=i.multiply(a).mod(p),h=o.subtract(x),s=n.multiply(f).mod(p),d=c.multiply(a).mod(p),v=s.subtract(d);if(B0.ZERO.equals(h))return B0.ZERO.equals(v)?this.twice():this.curve.infinity;const m=o.add(x),C=a.multiply(f).mod(p),E=h.square().mod(p),y=h.multiply(E).mod(p),B=C.multiply(v.square()).subtract(m.multiply(E)).mod(p),b=h.multiply(B).mod(p),F=v.multiply(E.multiply(o).subtract(B)).subtract(s.multiply(y)).mod(p),D=y.multiply(C).mod(p);return new pe(this.curve,this.curve.fromBigInteger(b),this.curve.fromBigInteger(F),D)}twice(){if(this.isInfinity())return this;if(!this.y.toBigInteger().signum())return this.curve.infinity;const t=this.x.toBigInteger(),r=this.y.toBigInteger(),n=this.z,a=this.curve.q,i=this.curve.a.toBigInteger(),c=t.square().multiply(Ra).add(i.multiply(n.square())).mod(a),f=r.shiftLeft(1).multiply(n).mod(a),p=r.square().mod(a),o=p.multiply(t).multiply(n).mod(a),x=f.square().mod(a),h=c.square().subtract(o.shiftLeft(3)).mod(a),s=f.multiply(h).mod(a),d=c.multiply(o.shiftLeft(2).subtract(h)).subtract(x.shiftLeft(1).multiply(p)).mod(a),v=f.multiply(x).mod(a);return new pe(this.curve,this.curve.fromBigInteger(s),this.curve.fromBigInteger(d),v)}multiply(t){if(this.isInfinity())return this;if(!t.signum())return this.curve.infinity;const r=t.multiply(Ra),n=this.negate();let a=this;for(let i=r.bitLength()-2;i>0;i--){a=a.twice();const c=r.testBit(i),f=t.testBit(i);c!==f&&(a=a.add(c?this:n))}return a}}let Qx=class{constructor(t,r,n){this.q=t,this.a=this.fromBigInteger(r),this.b=this.fromBigInteger(n),this.infinity=new pe(this,null,null)}equals(t){return t===this?!0:this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)}fromBigInteger(t){return new Q0(this.q,t)}decodePointHex(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:const r=this.fromBigInteger(new B0(t.substr(2),16));let n=this.fromBigInteger(r.multiply(r.square()).add(r.multiply(this.a)).add(this.b).toBigInteger().modPow(this.q.divide(new B0("4")).add(B0.ONE),this.q));return n.toBigInteger().mod(ka).equals(new B0(t.substr(0,2),16).subtract(ka))||(n=n.negate()),new pe(this,r,n);case 4:case 6:case 7:const a=(t.length-2)/2,i=t.substr(2,a),c=t.substr(a+2,a);return new pe(this,this.fromBigInteger(new B0(i,16)),this.fromBigInteger(new B0(c,16)));default:return null}}};var Jx={ECCurveFp:Qx};const{BigInteger:M0,SecureRandom:ec}=Ut,{ECCurveFp:tc}=Jx,rc=new ec,{curve:ke,G:nc,n:Pa}=Ri();function ac(){return ke}function Ri(){const e=new M0("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF",16),t=new M0("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC",16),r=new M0("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93",16),n=new tc(e,t,r),c=n.decodePointHex("04"+"32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7"+"BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0"),f=new M0("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123",16);return{curve:n,G:c,n:f}}function ic(e,t,r){const a=(e?new M0(e,t,r):new M0(Pa.bitLength(),rc)).mod(Pa.subtract(M0.ONE)).add(M0.ONE),i=Ve(a.toString(16),64),c=nc.multiply(a),f=Ve(c.getX().toBigInteger().toString(16),64),p=Ve(c.getY().toBigInteger().toString(16),64),o="04"+f+p;return{privateKey:i,publicKey:o}}function oc(e){if(e.length!==130)throw new Error("Invalid public key to compress");const t=(e.length-2)/2,r=e.substr(2,t),n=new M0(e.substr(t+2,t),16);let a="03";return n.mod(new M0("2")).equals(M0.ZERO)&&(a="02"),a+r}function sc(e){e=unescape(encodeURIComponent(e));const t=e.length,r=[];for(let a=0;a<t;a++)r[a>>>2]|=(e.charCodeAt(a)&255)<<24-a%4*8;const n=[];for(let a=0;a<t;a++){const i=r[a>>>2]>>>24-a%4*8&255;n.push((i>>>4).toString(16)),n.push((i&15).toString(16))}return n.join("")}function Ve(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e}function xc(e){return e.map(t=>(t=t.toString(16),t.length===1?"0"+t:t)).join("")}function cc(e){const t=[];let r=0;for(let n=0;n<e.length*2;n+=2)t[n>>>3]|=parseInt(e[r],10)<<24-n%8*4,r++;try{const n=[];for(let a=0;a<e.length;a++){const i=t[a>>>2]>>>24-a%4*8&255;n.push(String.fromCharCode(i))}return decodeURIComponent(escape(n.join("")))}catch(n){throw new Error("Malformed UTF-8 data")}}function fc(e){const t=[];let r=e.length;r%2!==0&&(e=Ve(e,r+1)),r=e.length;for(let n=0;n<r;n+=2)t.push(parseInt(e.substr(n,2),16));return t}function dc(e){const t=ke.decodePointHex(e);if(!t)return!1;const r=t.getX();return t.getY().square().equals(r.multiply(r.square()).add(r.multiply(ke.a)).add(ke.b))}function uc(e,t){const r=ke.decodePointHex(e);if(!r)return!1;const n=ke.decodePointHex(t);return n?r.equals(n):!1}var hc={getGlobalCurve:ac,generateEcparam:Ri,generateKeyPairHex:ic,compressPublicKeyHex:oc,utf8ToHex:sc,leftPad:Ve,arrayToHex:xc,arrayToUtf8:cc,hexToArray:fc,verifyPublicKey:dc,comparePublicKeyHex:uc};const O0=new Uint32Array(68),jr=new Uint32Array(64);function T0(e,t){const r=t&31;return e<<r|e>>>32-r}function Ia(e,t){const r=[];for(let n=e.length-1;n>=0;n--)r[n]=(e[n]^t[n])&255;return r}function lc(e){return e^T0(e,9)^T0(e,17)}function pc(e){return e^T0(e,15)^T0(e,23)}function wt(e){let t=e.length*8,r=t%512;r=r>=448?512-r%448-1:448-r-1;const n=new Array((r-7)/8),a=new Array(8);for(let x=0,h=n.length;x<h;x++)n[x]=0;for(let x=0,h=a.length;x<h;x++)a[x]=0;t=t.toString(2);for(let x=7;x>=0;x--)if(t.length>8){const h=t.length-8;a[x]=parseInt(t.substr(h),2),t=t.substr(0,h)}else t.length>0&&(a[x]=parseInt(t,2),t="");const i=new Uint8Array([...e,128,...n,...a]),c=new DataView(i.buffer,0),f=i.length/64,p=new Uint32Array([1937774191,1226093241,388252375,3666478592,2842636476,372324522,3817729613,2969243214]);for(let x=0;x<f;x++){O0.fill(0),jr.fill(0);const h=16*x;for(let A=0;A<16;A++)O0[A]=c.getUint32((h+A)*4,!1);for(let A=16;A<68;A++)O0[A]=pc(O0[A-16]^O0[A-9]^T0(O0[A-3],15))^T0(O0[A-13],7)^O0[A-6];for(let A=0;A<64;A++)jr[A]=O0[A]^O0[A+4];const s=2043430169,d=2055708042;let v=p[0],m=p[1],C=p[2],E=p[3],y=p[4],B=p[5],b=p[6],F=p[7],D,T,P,H,S;for(let A=0;A<64;A++)S=A>=0&&A<=15?s:d,D=T0(T0(v,12)+y+T0(S,A),7),T=D^T0(v,12),P=(A>=0&&A<=15?v^m^C:v&m|v&C|m&C)+E+T+jr[A],H=(A>=0&&A<=15?y^B^b:y&B|~y&b)+F+D+O0[A],E=C,C=T0(m,9),m=v,v=P,F=b,b=T0(B,19),B=y,y=lc(H);p[0]^=v,p[1]^=m,p[2]^=C,p[3]^=E,p[4]^=y,p[5]^=B,p[6]^=b,p[7]^=F}const o=[];for(let x=0,h=p.length;x<h;x++){const s=p[x];o.push((s&4278190080)>>>24,(s&16711680)>>>16,(s&65280)>>>8,s&255)}return o}const Ze=64,Pi=new Uint8Array(Ze),Ii=new Uint8Array(Ze);for(let e=0;e<Ze;e++)Pi[e]=54,Ii[e]=92;function bc(e,t){for(t.length>Ze&&(t=wt(t));t.length<Ze;)t.push(0);const r=Ia(t,Pi),n=Ia(t,Ii),a=wt([...r,...e]);return wt([...n,...a])}var qi={sm3:wt,hmac:bc};const{BigInteger:w0}=Ut,{encodeDer:vc,decodeDer:yc}=Yx,Z=hc,Oe=qi.sm3,{G:le,curve:Oi,n:De}=Z.generateEcparam(),Hi=0;function gc(e,t,r=1){e=typeof e=="string"?Z.hexToArray(Z.utf8ToHex(e)):Array.prototype.slice.call(e),t=Z.getGlobalCurve().decodePointHex(t);const n=Z.generateKeyPairHex(),a=new w0(n.privateKey,16);let i=n.publicKey;i.length>128&&(i=i.substr(i.length-128));const c=t.multiply(a),f=Z.hexToArray(Z.leftPad(c.getX().toBigInteger().toRadix(16),64)),p=Z.hexToArray(Z.leftPad(c.getY().toBigInteger().toRadix(16),64)),o=Z.arrayToHex(Oe([].concat(f,e,p)));let x=1,h=0,s=[];const d=[].concat(f,p),v=()=>{s=Oe([...d,x>>24&255,x>>16&255,x>>8&255,x&255]),x++,h=0};v();for(let C=0,E=e.length;C<E;C++)h===s.length&&v(),e[C]^=s[h++]&255;const m=Z.arrayToHex(e);return r===Hi?i+m+o:i+o+m}function mc(e,t,r=1,{output:n="string"}={}){t=new w0(t,16);let a=e.substr(128,64),i=e.substr(192);r===Hi&&(a=e.substr(e.length-64),i=e.substr(128,e.length-128-64));const c=Z.hexToArray(i),p=Z.getGlobalCurve().decodePointHex("04"+e.substr(0,128)).multiply(t),o=Z.hexToArray(Z.leftPad(p.getX().toBigInteger().toRadix(16),64)),x=Z.hexToArray(Z.leftPad(p.getY().toBigInteger().toRadix(16),64));let h=1,s=0,d=[];const v=[].concat(o,x),m=()=>{d=Oe([...v,h>>24&255,h>>16&255,h>>8&255,h&255]),h++,s=0};m();for(let E=0,y=c.length;E<y;E++)s===d.length&&m(),c[E]^=d[s++]&255;return Z.arrayToHex(Oe([].concat(o,c,x)))===a.toLowerCase()?n==="array"?c:Z.arrayToUtf8(c):n==="array"?[]:""}function Bc(e,t,{pointPool:r,der:n,hash:a,publicKey:i,userId:c}={}){let f=typeof e=="string"?Z.utf8ToHex(e):Z.arrayToHex(e);a&&(i=i||Mi(t),f=Ni(f,i,c));const p=new w0(t,16),o=new w0(f,16);let x=null,h=null,s=null;do{do{let d;r&&r.length?d=r.pop():d=Ui(),x=d.k,h=o.add(d.x1).mod(De)}while(h.equals(w0.ZERO)||h.add(x).equals(De));s=p.add(w0.ONE).modInverse(De).multiply(x.subtract(h.multiply(p))).mod(De)}while(s.equals(w0.ZERO));return n?vc(h,s):Z.leftPad(h.toString(16),64)+Z.leftPad(s.toString(16),64)}function Cc(e,t,r,{der:n,hash:a,userId:i}={}){let c=typeof e=="string"?Z.utf8ToHex(e):Z.arrayToHex(e);a&&(c=Ni(c,r,i));let f,p;if(n){const v=yc(t);f=v.r,p=v.s}else f=new w0(t.substring(0,64),16),p=new w0(t.substring(64),16);const o=Oi.decodePointHex(r),x=new w0(c,16),h=f.add(p).mod(De);if(h.equals(w0.ZERO))return!1;const s=le.multiply(p).add(o.multiply(h)),d=x.add(s.getX().toBigInteger()).mod(De);return f.equals(d)}function Ni(e,t,r="1234567812345678"){r=Z.utf8ToHex(r);const n=Z.leftPad(le.curve.a.toBigInteger().toRadix(16),64),a=Z.leftPad(le.curve.b.toBigInteger().toRadix(16),64),i=Z.leftPad(le.getX().toBigInteger().toRadix(16),64),c=Z.leftPad(le.getY().toBigInteger().toRadix(16),64);let f,p;if(t.length===128)f=t.substr(0,64),p=t.substr(64,64);else{const s=le.curve.decodePointHex(t);f=Z.leftPad(s.getX().toBigInteger().toRadix(16),64),p=Z.leftPad(s.getY().toBigInteger().toRadix(16),64)}const o=Z.hexToArray(r+n+a+i+c+f+p),x=r.length*4;o.unshift(x&255),o.unshift(x>>8&255);const h=Oe(o);return Z.arrayToHex(Oe(h.concat(Z.hexToArray(e))))}function Mi(e){const t=le.multiply(new w0(e,16)),r=Z.leftPad(t.getX().toBigInteger().toString(16),64),n=Z.leftPad(t.getY().toBigInteger().toString(16),64);return"04"+r+n}function Ui(){const e=Z.generateKeyPairHex(),t=Oi.decodePointHex(e.publicKey);return e.k=new w0(e.privateKey,16),e.x1=t.getX().toBigInteger(),e}var _c={generateKeyPairHex:Z.generateKeyPairHex,compressPublicKeyHex:Z.compressPublicKeyHex,comparePublicKeyHex:Z.comparePublicKeyHex,doEncrypt:gc,doDecrypt:mc,doSignature:Bc,doVerifySignature:Cc,getPublicKeyFromPrivateKey:Mi,getPoint:Ui,verifyPublicKey:Z.verifyPublicKey};const{sm3:Ec,hmac:Fc}=qi;function Ac(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e}function qa(e){return e.map(t=>(t=t.toString(16),t.length===1?"0"+t:t)).join("")}function Dc(e){const t=[];let r=e.length;r%2!==0&&(e=Ac(e,r+1)),r=e.length;for(let n=0;n<r;n+=2)t.push(parseInt(e.substr(n,2),16));return t}function wc(e){const t=[];for(let r=0,n=e.length;r<n;r++){const a=e.codePointAt(r);if(a<=127)t.push(a);else if(a<=2047)t.push(192|a>>>6),t.push(128|a&63);else if(a<=55295||a>=57344&&a<=65535)t.push(224|a>>>12),t.push(128|a>>>6&63),t.push(128|a&63);else if(a>=65536&&a<=1114111)r++,t.push(240|a>>>18&28),t.push(128|a>>>12&63),t.push(128|a>>>6&63),t.push(128|a&63);else throw t.push(a),new Error("input is not supported")}return t}var Sc=function(e,t){if(e=typeof e=="string"?wc(e):Array.prototype.slice.call(e),t){if((t.mode||"hmac")!=="hmac")throw new Error("invalid mode");let n=t.key;if(!n)throw new Error("invalid key");return n=typeof n=="string"?Dc(n):Array.prototype.slice.call(n),qa(Fc(e,n))}return qa(Ec(e))};const Y0=0,Tc=32,he=16,gt=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],mt=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function Xr(e){const t=[];for(let r=0,n=e.length;r<n;r+=2)t.push(parseInt(e.substr(r,2),16));return t}function kc(e){return e.map(t=>(t=t.toString(16),t.length===1?"0"+t:t)).join("")}function Rc(e){const t=[];for(let r=0,n=e.length;r<n;r++){const a=e.codePointAt(r);if(a<=127)t.push(a);else if(a<=2047)t.push(192|a>>>6),t.push(128|a&63);else if(a<=55295||a>=57344&&a<=65535)t.push(224|a>>>12),t.push(128|a>>>6&63),t.push(128|a&63);else if(a>=65536&&a<=1114111)r++,t.push(240|a>>>18&28),t.push(128|a>>>12&63),t.push(128|a>>>6&63),t.push(128|a&63);else throw t.push(a),new Error("input is not supported")}return t}function Pc(e){const t=[];for(let r=0,n=e.length;r<n;r++)e[r]>=240&&e[r]<=247?(t.push(String.fromCodePoint(((e[r]&7)<<18)+((e[r+1]&63)<<12)+((e[r+2]&63)<<6)+(e[r+3]&63))),r+=3):e[r]>=224&&e[r]<=239?(t.push(String.fromCodePoint(((e[r]&15)<<12)+((e[r+1]&63)<<6)+(e[r+2]&63))),r+=2):e[r]>=192&&e[r]<=223?(t.push(String.fromCodePoint(((e[r]&31)<<6)+(e[r+1]&63))),r++):t.push(String.fromCodePoint(e[r]));return t.join("")}function we(e,t){const r=t&31;return e<<r|e>>>32-r}function te(e){return(gt[e>>>24&255]&255)<<24|(gt[e>>>16&255]&255)<<16|(gt[e>>>8&255]&255)<<8|gt[e&255]&255}function Bt(e){return e^we(e,2)^we(e,10)^we(e,18)^we(e,24)}function Ct(e){return e^we(e,13)^we(e,23)}function Ic(e,t,r){const n=new Array(4),a=new Array(4);for(let i=0;i<4;i++)a[0]=e[4*i]&255,a[1]=e[4*i+1]&255,a[2]=e[4*i+2]&255,a[3]=e[4*i+3]&255,n[i]=a[0]<<24|a[1]<<16|a[2]<<8|a[3];for(let i=0,c;i<32;i+=4)c=n[1]^n[2]^n[3]^r[i+0],n[0]^=Bt(te(c)),c=n[2]^n[3]^n[0]^r[i+1],n[1]^=Bt(te(c)),c=n[3]^n[0]^n[1]^r[i+2],n[2]^=Bt(te(c)),c=n[0]^n[1]^n[2]^r[i+3],n[3]^=Bt(te(c));for(let i=0;i<16;i+=4)t[i]=n[3-i/4]>>>24&255,t[i+1]=n[3-i/4]>>>16&255,t[i+2]=n[3-i/4]>>>8&255,t[i+3]=n[3-i/4]&255}function qc(e,t,r){const n=new Array(4),a=new Array(4);for(let i=0;i<4;i++)a[0]=e[0+4*i]&255,a[1]=e[1+4*i]&255,a[2]=e[2+4*i]&255,a[3]=e[3+4*i]&255,n[i]=a[0]<<24|a[1]<<16|a[2]<<8|a[3];n[0]^=2746333894,n[1]^=1453994832,n[2]^=1736282519,n[3]^=2993693404;for(let i=0,c;i<32;i+=4)c=n[1]^n[2]^n[3]^mt[i+0],t[i+0]=n[0]^=Ct(te(c)),c=n[2]^n[3]^n[0]^mt[i+1],t[i+1]=n[1]^=Ct(te(c)),c=n[3]^n[0]^n[1]^mt[i+2],t[i+2]=n[2]^=Ct(te(c)),c=n[0]^n[1]^n[2]^mt[i+3],t[i+3]=n[3]^=Ct(te(c));if(r===Y0)for(let i=0,c;i<16;i++)c=t[i],t[i]=t[31-i],t[31-i]=c}function Oa(e,t,r,{padding:n="pkcs#7",mode:a,iv:i=[],output:c="string"}={}){if(a==="cbc"&&(typeof i=="string"&&(i=Xr(i)),i.length!==128/8))throw new Error("iv is invalid");if(typeof t=="string"&&(t=Xr(t)),t.length!==128/8)throw new Error("key is invalid");if(typeof e=="string"?r!==Y0?e=Rc(e):e=Xr(e):e=[...e],(n==="pkcs#5"||n==="pkcs#7")&&r!==Y0){const s=he-e.length%he;for(let d=0;d<s;d++)e.push(s)}const f=new Array(Tc);qc(t,f,r);const p=[];let o=i,x=e.length,h=0;for(;x>=he;){const s=e.slice(h,h+16),d=new Array(16);if(a==="cbc")for(let v=0;v<he;v++)r!==Y0&&(s[v]^=o[v]);Ic(s,d,f);for(let v=0;v<he;v++)a==="cbc"&&r===Y0&&(d[v]^=o[v]),p[h+v]=d[v];a==="cbc"&&(r!==Y0?o=d:o=s),x-=he,h+=he}if((n==="pkcs#5"||n==="pkcs#7")&&r===Y0){const s=p.length,d=p[s-1];for(let v=1;v<=d;v++)if(p[s-v]!==d)throw new Error("padding is invalid");p.splice(s-d,d)}return c!=="array"?r!==Y0?kc(p):Pc(p):p}var Oc={encrypt(e,t,r){return Oa(e,t,1,r)},decrypt(e,t,r){return Oa(e,t,0,r)}},Ha={sm2:_c,sm3:Sc,sm4:Oc};const Hc=["appId","signatureMethod","signatureNonce","timestamp","viewerToken","sign","encryptResponseType"],Nc=j0("MDQ1QjgxNTVFOTc0N0MyODNBQ0Y4NDI4OTVEMzA0OEU2Q0E5NDNDQzQ1NEFGQTZBOUE0NTJCNTkwM0NDMzBGQ0UyNzhBNkY4OEY2MDJFREY4MDNEQUI0MEJENDVFMzVGNjYwNjc2QkY2OEZEN0NDQkUwRjZBRDMyMzg4MTM2Q0QwRA=="),Mc=j0("MDBCMzE5NjE4QjRCMUJBRUI4Q0M2NzY1RDg5MDNDMDVBMEIxNkQ5RDlGQ0QxNjMyNzFCQjZGMUI4OEY2NTdBMjhF");var It;(function(e){e[e.C1C3C2=1]="C1C3C2",e[e.C1C2C3=0]="C1C2C3"})(It||(It={}));function Na(e,t){const r=/^04/.test(e);return r&&!t?e.substring(2):!r&&t?`04${e}`:e}class Uc{constructor(t){V(this,"__platformPublicKey");V(this,"__userPrivateKey");V(this,"__ignoreEncryptFields");V(this,"__useSM2");V(this,"__encryptPostSM2");var r,n;this.__platformPublicKey=t.platformPublicKey,this.__userPrivateKey=t.userPrivateKey,this.__ignoreEncryptFields=[...Hc],t.includeIgnoreEncryptFields&&this.__ignoreEncryptFields.push(...t.includeIgnoreEncryptFields),this.__useSM2=(r=t.useSM2)!=null?r:!0,this.__encryptPostSM2=(n=t.encryptPostSM2)!=null?n:!0}usePlugin(t){const{useSM2:r=this.__useSM2}=t;return r}interceptIncludeParams(){return{encryptResponseType:2}}interceptEncryptRequest(t){const r=this.__handleParams(t),n=this.__handleData(t),a=this.__handleHeaders(t);return W0(a0({},t),{params:r,data:n,headers:a})}interceptDecryptResponse(t,r){const n=t.data;if(!n.encryption||typeof n.data!="string")return t;const a=n.data;return n.data=this.__decryptTextSM2(a,r),t}__handleHeaders(t){var a;const r=t.headers||{},{encryptPostSM2:n=this.__encryptPostSM2}=t;return((a=t.method)==null?void 0:a.toLocaleUpperCase())==="POST"&&n&&(r["x-e-type"]=2),r}__handleParams(t){var a;const{encryptPostSM2:r=this.__encryptPostSM2}=t,n=t.params||{};return((a=t.method)==null?void 0:a.toLocaleUpperCase())!=="POST"||!r?n:this.__encryptObjectSM2(n,t,"xurlparam")}__handleData(t){var i;const r=t.data||{};if(((i=t.method)==null?void 0:i.toLocaleUpperCase())!=="POST")return r;let n=r;const{encryptPostSM2:a=this.__encryptPostSM2}=t;return a&&(typeof r=="string"?n=this.__encryptTextSM2(r,t):t.requestType==="json"?n=this.__encryptTextSM2(JSON.stringify(t.data||{}),t):n=this.__encryptObjectSM2(r,t,"xparam")),n}__encryptObjectSM2(t,r,n){const a=Object.keys(t);if(a.length===0)return t;const i={},c={};a.forEach(p=>{this.__ignoreEncryptFields.includes(p)?i[p]=t[p]:c[p]=t[p]});const f=a0({},i);if(Object.keys(c).length){const p=this.__encryptTextSM2(JSON.stringify(c),r);f[n]=p}return f}__encryptTextSM2(t,r){const n=this.__getPublicKey(r);return Na(Ha.sm2.doEncrypt(t,n,It.C1C2C3),!0)}__decryptTextSM2(t,r){const n=this.__getPrivateKey(r);let a="";try{a=Ha.sm2.doDecrypt(Na(t,!1),n,It.C1C2C3)}catch(c){console.error("decryptTextSM2 decrypt error",c,{encryptedText:t})}let i=a;try{i=JSON.parse(i)}catch(c){}return i}__getPrivateKey(t){return"appId"in(t.params||{})?this.__userPrivateKey:Mc}__getPublicKey(t){return"appId"in(t.params||{})?this.__platformPublicKey:Nc}}class zc extends ti{constructor(t){var i,c,f,p;const r=[],{authorizeMethod:n=Xe.Token}=t.config;n===Xe.Token&&r.push(new ri({getTokenInfo:()=>Q(this,null,function*(){const{getChannelToken:o,getViewerToken:x}=t.config;let h;if(o){const s=yield o();if(!s)return;h=s.channelToken}if(x){const s=yield x();if(!s)return;h=s.viewerToken}if(h)return{token:h}})})),n===Xe.Sign&&r.push(new Lx({appId:(i=t.config.appSignSecretKey)==null?void 0:i.appId,appSecret:(c=t.config.appSignSecretKey)==null?void 0:c.appSecret,signatureNonce:t.config.signatureNonce,signatureMethod:t.config.signatureMethod,getAppSign:t.config.getAppSign}));const a=t.config.securityMode;a===Pt.AES&&r.push(new Vx({appId:(f=t.config.appSignSecretKey)==null?void 0:f.appId,appSecret:(p=t.config.appSignSecretKey)==null?void 0:p.appSecret})),a===Pt.SM2&&t.config.sm2Key&&r.push(new Uc({platformPublicKey:t.config.sm2Key.platformPublicKey,userPrivateKey:t.config.sm2Key.userPrivateKey})),super({baseUrl:Ai(vn(t.config.domainInfo).polyvApiDomain,"https"),requestPlugins:[...r,new Cx({getBusinessData:()=>Q(this,null,function*(){const[o,x]=yield Promise.all([t.getUserInfo(),t.getChannelInfo()]);return{channelId:x.channelId,viewerId:o.userId,unionId:o.unionId}})}),new Ci({decryptKeys:{sign:"polyvInteractSdk",iv:"1111000011101101"}}),new ni({successCode:200})]}),this._plvSocket=t}getTokenFieldByUserType(){return Q(this,null,function*(){const t=this._plvSocket.getUserInfo();let r="viewerToken";return this._plvSocket.isSpecialUserType(t.userType)&&(r="channelToken"),r})}}var H0=(e=>(e.ConnectSuccess="ConnectSuccess",e.ReconnectSuccess="ReconnectSuccess",e.ConnectFailed="ConnectFailed",e.Disconnect="Disconnect",e.LoginSuccess="LoginSuccess",e.LoginFailed="LoginFailed",e))(H0||{}),L0=(e=>(e.Student="student",e.Slice="slice",e.Viewer="viewer",e.Teacher="teacher",e.Assistant="assistant",e.Manager="manager",e.Guest="guest",e.UserTagsMonitor="userTagsMonitor",e.Attendee="attendee",e.Listener="listener",e.Host="host",e.Dummy="dummy",e))(L0||{}),Re=(e=>(e.TokenExpired="TokenExpired",e.SocketConnectError="SocketConnectError",e.SocketConnectTimeout="SocketConnectTimeout",e))(Re||{});class Lc{constructor(){this.__eventStore={}}__addOnEvent(t,r,n,a){if(!r||!n)return;let i=this.__eventStore[r];i||(i=[]),i.push({type:t,handler:n,callbackHandler:n.bind(a)}),this.__eventStore[r]=i}on(t,r,n=this){this.__addOnEvent("normal",t,r,n)}once(t,r,n=this){this.__addOnEvent("once",t,r,n)}off(t,r){let n=this.__eventStore[t];n&&(n=n.filter(a=>a.handler!==r),this.__eventStore[t]=n)}emit(t,r,n){const a=this.__eventStore[t];a&&a.forEach(i=>{const{type:c,handler:f,callbackHandler:p}=i;typeof p=="function"&&p(r,n),c==="once"&&this.off(t,f)})}destroy(){this.__eventStore={}}}var rn={exports:{}},$c=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Kc=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],zi=function(t){var r=t,n=t.indexOf("["),a=t.indexOf("]");n!=-1&&a!=-1&&(t=t.substring(0,n)+t.substring(n,a).replace(/:/g,";")+t.substring(a,t.length));for(var i=$c.exec(t||""),c={},f=14;f--;)c[Kc[f]]=i[f]||"";return n!=-1&&a!=-1&&(c.source=r,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=Wc(c,c.path),c.queryKey=jc(c,c.query),c};function Wc(e,t){var r=/\/{2,9}/g,n=t.replace(r,"/").split("/");return(t.substr(0,1)=="/"||t.length===0)&&n.splice(0,1),t.substr(t.length-1,1)=="/"&&n.splice(n.length-1,1),n}function jc(e,t){var r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,a,i){a&&(r[a]=i)}),r}var nn={exports:{}},an={exports:{}},Ye=1e3,Qe=Ye*60,Je=Qe*60,et=Je*24,Xc=et*365.25,Vc=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Gc(e);if(r==="number"&&isNaN(e)===!1)return t.long?Yc(e):Zc(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Gc(e){if(e=String(e),!(e.length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Xc;case"days":case"day":case"d":return r*et;case"hours":case"hour":case"hrs":case"hr":case"h":return r*Je;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*Ye;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function Zc(e){return e>=et?Math.round(e/et)+"d":e>=Je?Math.round(e/Je)+"h":e>=Qe?Math.round(e/Qe)+"m":e>=Ye?Math.round(e/Ye)+"s":e+"ms"}function Yc(e){return _t(e,et,"day")||_t(e,Je,"hour")||_t(e,Qe,"minute")||_t(e,Ye,"second")||e+" ms"}function _t(e,t,r){if(!(e<t))return e<t*1.5?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}(function(e,t){t=e.exports=n.debug=n.default=n,t.coerce=p,t.disable=c,t.enable=i,t.enabled=f,t.humanize=Vc,t.instances=[],t.names=[],t.skips=[],t.formatters={};function r(o){var x=0,h;for(h in o)x=(x<<5)-x+o.charCodeAt(h),x|=0;return t.colors[Math.abs(x)%t.colors.length]}function n(o){var x;function h(){if(h.enabled){var s=h,d=+new Date,v=d-(x||d);s.diff=v,s.prev=x,s.curr=d,x=d;for(var m=new Array(arguments.length),C=0;C<m.length;C++)m[C]=arguments[C];m[0]=t.coerce(m[0]),typeof m[0]!="string"&&m.unshift("%O");var E=0;m[0]=m[0].replace(/%([a-zA-Z%])/g,function(B,b){if(B==="%%")return B;E++;var F=t.formatters[b];if(typeof F=="function"){var D=m[E];B=F.call(s,D),m.splice(E,1),E--}return B}),t.formatArgs.call(s,m);var y=h.log||t.log||console.log.bind(console);y.apply(s,m)}}return h.namespace=o,h.enabled=t.enabled(o),h.useColors=t.useColors(),h.color=r(o),h.destroy=a,typeof t.init=="function"&&t.init(h),t.instances.push(h),h}function a(){var o=t.instances.indexOf(this);return o!==-1?(t.instances.splice(o,1),!0):!1}function i(o){t.save(o),t.names=[],t.skips=[];var x,h=(typeof o=="string"?o:"").split(/[\s,]+/),s=h.length;for(x=0;x<s;x++)h[x]&&(o=h[x].replace(/\*/g,".*?"),o[0]==="-"?t.skips.push(new RegExp("^"+o.substr(1)+"$")):t.names.push(new RegExp("^"+o+"$")));for(x=0;x<t.instances.length;x++){var d=t.instances[x];d.enabled=t.enabled(d.namespace)}}function c(){t.enable("")}function f(o){if(o[o.length-1]==="*")return!0;var x,h;for(x=0,h=t.skips.length;x<h;x++)if(t.skips[x].test(o))return!1;for(x=0,h=t.names.length;x<h;x++)if(t.names[x].test(o))return!0;return!1}function p(o){return o instanceof Error?o.stack||o.message:o}})(an,an.exports);var Qc=an.exports;(function(e,t){t=e.exports=Qc,t.log=a,t.formatArgs=n,t.save=i,t.load=c,t.useColors=r,t.storage=typeof chrome!="undefined"&&typeof chrome.storage!="undefined"?chrome.storage.local:f(),t.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!="undefined"&&window.process&&window.process.type==="renderer"?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}t.formatters.j=function(p){try{return JSON.stringify(p)}catch(o){return"[UnexpectedJSONParseError]: "+o.message}};function n(p){var o=this.useColors;if(p[0]=(o?"%c":"")+this.namespace+(o?" %c":" ")+p[0]+(o?"%c ":" ")+"+"+t.humanize(this.diff),!!o){var x="color: "+this.color;p.splice(1,0,x,"color: inherit");var h=0,s=0;p[0].replace(/%[a-zA-Z%]/g,function(d){d!=="%%"&&(h++,d==="%c"&&(s=h))}),p.splice(s,0,x)}}function a(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function i(p){try{p==null?t.storage.removeItem("debug"):t.storage.debug=p}catch(o){}}function c(){var p;try{p=t.storage.debug}catch(o){}return!p&&typeof process!="undefined"&&"env"in process&&(p=process.env.DEBUG),p}t.enable(c());function f(){try{return window.localStorage}catch(p){}}})(nn,nn.exports);var X0=nn.exports,Jc=zi,Ma=X0("socket.io-client:url"),ef=tf;function tf(e,t){var r=e;t=t||typeof location!="undefined"&&location,e==null&&(e=t.protocol+"//"+t.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=t.protocol+e:e=t.host+e),/^(https?|wss?):\/\//.test(e)||(Ma("protocol-less url %s",e),typeof t!="undefined"?e=t.protocol+"//"+e:e="https://"+e),Ma("parse %s",e),r=Jc(e)),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,a=n?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+a+":"+r.port,r.href=r.protocol+"://"+a+(t&&t.port===r.port?"":":"+r.port),r}var zt={},Li={exports:{}};(function(e){e.exports=t;function t(n){if(n)return r(n)}function r(n){for(var a in t.prototype)n[a]=t.prototype[a];return n}t.prototype.on=t.prototype.addEventListener=function(n,a){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(a),this},t.prototype.once=function(n,a){function i(){this.off(n,i),a.apply(this,arguments)}return i.fn=a,this.on(n,i),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(n,a){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var i=this._callbacks["$"+n];if(!i)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var c,f=0;f<i.length;f++)if(c=i[f],c===a||c.fn===a){i.splice(f,1);break}return i.length===0&&delete this._callbacks["$"+n],this},t.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var a=new Array(arguments.length-1),i=this._callbacks["$"+n],c=1;c<arguments.length;c++)a[c-1]=arguments[c];if(i){i=i.slice(0);for(var c=0,f=i.length;c<f;++c)i[c].apply(this,a)}return this},t.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]},t.prototype.hasListeners=function(n){return!!this.listeners(n).length}})(Li);var Ne=Li.exports,Lt={},rf={}.toString,yn=Array.isArray||function(e){return rf.call(e)=="[object Array]"},$i=sf,nf=typeof Buffer=="function"&&typeof Buffer.isBuffer=="function",af=typeof ArrayBuffer=="function",of=function(e){return typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer};function sf(e){return nf&&Buffer.isBuffer(e)||af&&(e instanceof ArrayBuffer||of(e))}var gn=yn,Ki=$i,Wi=Object.prototype.toString,xf=typeof Blob=="function"||typeof Blob!="undefined"&&Wi.call(Blob)==="[object BlobConstructor]",cf=typeof File=="function"||typeof File!="undefined"&&Wi.call(File)==="[object FileConstructor]";Lt.deconstructPacket=function(e){var t=[],r=e.data,n=e;return n.data=on(r,t),n.attachments=t.length,{packet:n,buffers:t}};function on(e,t){if(!e)return e;if(Ki(e)){var r={_placeholder:!0,num:t.length};return t.push(e),r}else if(gn(e)){for(var n=new Array(e.length),a=0;a<e.length;a++)n[a]=on(e[a],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){var n={};for(var i in e)n[i]=on(e[i],t);return n}return e}Lt.reconstructPacket=function(e,t){return e.data=sn(e.data,t),e.attachments=void 0,e};function sn(e,t){if(!e)return e;if(e&&e._placeholder===!0){var r=typeof e.num=="number"&&e.num>=0&&e.num<t.length;if(r)return t[e.num];throw new Error("illegal attachments")}else if(gn(e))for(var n=0;n<e.length;n++)e[n]=sn(e[n],t);else if(typeof e=="object")for(var a in e)e[a]=sn(e[a],t);return e}Lt.removeBlobs=function(e,t){function r(i,c,f){if(!i)return i;if(xf&&i instanceof Blob||cf&&i instanceof File){n++;var p=new FileReader;p.onload=function(){f?f[c]=this.result:a=this.result,--n||t(a)},p.readAsArrayBuffer(i)}else if(gn(i))for(var o=0;o<i.length;o++)r(i[o],o,i);else if(typeof i=="object"&&!Ki(i))for(var x in i)r(i[x],x,i)}var n=0,a=e;r(a),n||t(a)};(function(e){var t=X0("socket.io-parser"),r=Ne,n=Lt,a=yn,i=$i;e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=c,e.Decoder=h;function c(){}var f=e.ERROR+'"encode error"';c.prototype.encode=function(E,y){if(t("encoding packet %j",E),e.BINARY_EVENT===E.type||e.BINARY_ACK===E.type)x(E,y);else{var B=p(E);y([B])}};function p(E){var y=""+E.type;if((e.BINARY_EVENT===E.type||e.BINARY_ACK===E.type)&&(y+=E.attachments+"-"),E.nsp&&E.nsp!=="/"&&(y+=E.nsp+","),E.id!=null&&(y+=E.id),E.data!=null){var B=o(E.data);if(B!==!1)y+=B;else return f}return t("encoded %j as %s",E,y),y}function o(E){try{return JSON.stringify(E)}catch(y){return!1}}function x(E,y){function B(b){var F=n.deconstructPacket(b),D=p(F.packet),T=F.buffers;T.unshift(D),y(T)}n.removeBlobs(E,B)}function h(){this.reconstructor=null}r(h.prototype),h.prototype.add=function(E){var y;if(typeof E=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");y=d(E),e.BINARY_EVENT===y.type||e.BINARY_ACK===y.type?(this.reconstructor=new m(y),this.reconstructor.reconPack.attachments===0&&this.emit("decoded",y)):this.emit("decoded",y)}else if(i(E)||E.base64)if(this.reconstructor)y=this.reconstructor.takeBinaryData(E),y&&(this.reconstructor=null,this.emit("decoded",y));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+E)};function s(E,y){switch(E){case 0:return typeof y=="object";case 1:return y===void 0;case 4:return typeof y=="string"||typeof y=="object";case 2:case 5:return a(y)&&(typeof y[0]=="string"||typeof y[0]=="number");case 3:case 6:return a(y)}}function d(E){var y=0,B={type:Number(E.charAt(0))};if(e.types[B.type]==null)return C("unknown packet type "+B.type);if(e.BINARY_EVENT===B.type||e.BINARY_ACK===B.type){for(var b=y+1;E.charAt(++y)!=="-"&&y!=E.length;);var F=E.substring(b,y);if(F!=Number(F)||E.charAt(y)!=="-")throw new Error("Illegal attachments");B.attachments=Number(F)}if(E.charAt(y+1)==="/"){for(var b=y+1;++y;){var D=E.charAt(y);if(D===","||y===E.length)break}B.nsp=E.substring(b,y)}else B.nsp="/";var T=E.charAt(y+1);if(T!==""&&Number(T)==T){for(var b=y+1;++y;){var D=E.charAt(y);if(D==null||Number(D)!=D){--y;break}if(y===E.length)break}B.id=Number(E.substring(b,y+1))}if(E.charAt(++y)){var P=v(E.substr(y));if(s(B.type,P))B.data=P;else throw new Error("invalid payload")}return t("decoded %s as %j",E,B),B}function v(E){try{return JSON.parse(E)}catch(y){return!1}}h.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()};function m(E){this.reconPack=E,this.buffers=[]}m.prototype.takeBinaryData=function(E){if(this.buffers.push(E),this.buffers.length===this.reconPack.attachments){var y=n.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),y}return null},m.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]};function C(E){return{type:e.ERROR,data:"parser error: "+E}}})(zt);var mn={exports:{}},$t={},xn={exports:{}};try{xn.exports=typeof XMLHttpRequest!="undefined"&&"withCredentials"in new XMLHttpRequest}catch(e){xn.exports=!1}var ff=xn.exports,Bn=function(){return typeof self!="undefined"?self:typeof window!="undefined"?window:Function("return this")()}(),df=ff,uf=Bn,Cn=function(e){var t=e.xdomain,r=e.xscheme,n=e.enablesXDR;try{if(typeof XMLHttpRequest!="undefined"&&(!t||df))return new XMLHttpRequest}catch(a){}try{if(typeof XDomainRequest!="undefined"&&!r&&n)return new XDomainRequest}catch(a){}if(!t)try{return new uf[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(a){}},_n={exports:{}},ge={},hf=Object.keys||function(t){var r=[],n=Object.prototype.hasOwnProperty;for(var a in t)n.call(t,a)&&r.push(a);return r},lf=yn,ji=Object.prototype.toString,pf=typeof Blob=="function"||typeof Blob!="undefined"&&ji.call(Blob)==="[object BlobConstructor]",bf=typeof File=="function"||typeof File!="undefined"&&ji.call(File)==="[object FileConstructor]",Xi=St;function St(e){if(!e||typeof e!="object")return!1;if(lf(e)){for(var t=0,r=e.length;t<r;t++)if(St(e[t]))return!0;return!1}if(typeof Buffer=="function"&&Buffer.isBuffer&&Buffer.isBuffer(e)||typeof ArrayBuffer=="function"&&e instanceof ArrayBuffer||pf&&e instanceof Blob||bf&&e instanceof File)return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return St(e.toJSON(),!0);for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&St(e[n]))return!0;return!1}var vf=function(e,t,r){var n=e.byteLength;if(t=t||0,r=r||n,e.slice)return e.slice(t,r);if(t<0&&(t+=n),r<0&&(r+=n),r>n&&(r=n),t>=n||t>=r||n===0)return new ArrayBuffer(0);for(var a=new Uint8Array(e),i=new Uint8Array(r-t),c=t,f=0;c<r;c++,f++)i[f]=a[c];return i.buffer},yf=gf;function gf(e,t,r){var n=!1;return r=r||mf,a.count=e,e===0?t():a;function a(i,c){if(a.count<=0)throw new Error("after called too many times");--a.count,i?(n=!0,t(i),t=r):a.count===0&&!n&&t(null,c)}}function mf(){}/*! https://mths.be/utf8js v2.1.2 by @mathias */var ee=String.fromCharCode;function Vi(e){for(var t=[],r=0,n=e.length,a,i;r<n;)a=e.charCodeAt(r++),a>=55296&&a<=56319&&r<n?(i=e.charCodeAt(r++),(i&64512)==56320?t.push(((a&1023)<<10)+(i&1023)+65536):(t.push(a),r--)):t.push(a);return t}function Bf(e){for(var t=e.length,r=-1,n,a="";++r<t;)n=e[r],n>65535&&(n-=65536,a+=ee(n>>>10&1023|55296),n=56320|n&1023),a+=ee(n);return a}function Gi(e,t){if(e>=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function Vr(e,t){return ee(e>>t&63|128)}function Cf(e,t){if(!(e&4294967168))return ee(e);var r="";return e&4294965248?e&4294901760?e&4292870144||(r=ee(e>>18&7|240),r+=Vr(e,12),r+=Vr(e,6)):(Gi(e,t)||(e=65533),r=ee(e>>12&15|224),r+=Vr(e,6)):r=ee(e>>6&31|192),r+=ee(e&63|128),r}function _f(e,t){t=t||{};for(var r=t.strict!==!1,n=Vi(e),a=n.length,i=-1,c,f="";++i<a;)c=n[i],f+=Cf(c,r);return f}function Ee(){if(re>=Ot)throw Error("Invalid byte index");var e=qt[re]&255;if(re++,(e&192)==128)return e&63;throw Error("Invalid continuation byte")}function Ef(e){var t,r,n,a,i;if(re>Ot)throw Error("Invalid byte index");if(re==Ot)return!1;if(t=qt[re]&255,re++,!(t&128))return t;if((t&224)==192){if(r=Ee(),i=(t&31)<<6|r,i>=128)return i;throw Error("Invalid continuation byte")}if((t&240)==224){if(r=Ee(),n=Ee(),i=(t&15)<<12|r<<6|n,i>=2048)return Gi(i,e)?i:65533;throw Error("Invalid continuation byte")}if((t&248)==240&&(r=Ee(),n=Ee(),a=Ee(),i=(t&7)<<18|r<<12|n<<6|a,i>=65536&&i<=1114111))return i;throw Error("Invalid UTF-8 detected")}var qt,Ot,re;function Ff(e,t){t=t||{};var r=t.strict!==!1;qt=Vi(e),Ot=qt.length,re=0;for(var n=[],a;(a=Ef(r))!==!1;)n.push(a);return Bf(n)}var Af={version:"2.1.2",encode:_f,decode:Ff},Et={},Ua;function Df(){return Ua||(Ua=1,function(e){Et.encode=function(t){var r=new Uint8Array(t),n,a=r.length,i="";for(n=0;n<a;n+=3)i+=e[r[n]>>2],i+=e[(r[n]&3)<<4|r[n+1]>>4],i+=e[(r[n+1]&15)<<2|r[n+2]>>6],i+=e[r[n+2]&63];return a%3===2?i=i.substring(0,i.length-1)+"=":a%3===1&&(i=i.substring(0,i.length-2)+"=="),i},Et.decode=function(t){var r=t.length*.75,n=t.length,a,i=0,c,f,p,o;t[t.length-1]==="="&&(r--,t[t.length-2]==="="&&r--);var x=new ArrayBuffer(r),h=new Uint8Array(x);for(a=0;a<n;a+=4)c=e.indexOf(t[a]),f=e.indexOf(t[a+1]),p=e.indexOf(t[a+2]),o=e.indexOf(t[a+3]),h[i++]=c<<2|f>>4,h[i++]=(f&15)<<4|p>>2,h[i++]=(p&3)<<6|o&63;return x}}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")),Et}var Gr,za;function wf(){if(za)return Gr;za=1;var e=typeof e!="undefined"?e:typeof WebKitBlobBuilder!="undefined"?WebKitBlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:!1,t=function(){try{var f=new Blob(["hi"]);return f.size===2}catch(p){return!1}}(),r=t&&function(){try{var f=new Blob([new Uint8Array([1,2])]);return f.size===2}catch(p){return!1}}(),n=e&&e.prototype.append&&e.prototype.getBlob;function a(f){return f.map(function(p){if(p.buffer instanceof ArrayBuffer){var o=p.buffer;if(p.byteLength!==o.byteLength){var x=new Uint8Array(p.byteLength);x.set(new Uint8Array(o,p.byteOffset,p.byteLength)),o=x.buffer}return o}return p})}function i(f,p){p=p||{};var o=new e;return a(f).forEach(function(x){o.append(x)}),p.type?o.getBlob(p.type):o.getBlob()}function c(f,p){return new Blob(a(f),p||{})}return typeof Blob!="undefined"&&(i.prototype=Blob.prototype,c.prototype=Blob.prototype),Gr=function(){return t?r?Blob:c:n?i:void 0}(),Gr}(function(e){var t=hf,r=Xi,n=vf,a=yf,i=Af,c;typeof ArrayBuffer!="undefined"&&(c=Df());var f=typeof navigator!="undefined"&&/Android/i.test(navigator.userAgent),p=typeof navigator!="undefined"&&/PhantomJS/i.test(navigator.userAgent),o=f||p;e.protocol=3;var x=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},h=t(x),s={type:"error",data:"parser error"},d=wf();e.encodePacket=function(b,F,D,T){typeof F=="function"&&(T=F,F=!1),typeof D=="function"&&(T=D,D=null);var P=b.data===void 0?void 0:b.data.buffer||b.data;if(typeof ArrayBuffer!="undefined"&&P instanceof ArrayBuffer)return m(b,F,T);if(typeof d!="undefined"&&P instanceof d)return E(b,F,T);if(P&&P.base64)return v(b,T);var H=x[b.type];return b.data!==void 0&&(H+=D?i.encode(String(b.data),{strict:!1}):String(b.data)),T(""+H)};function v(b,F){var D="b"+e.packets[b.type]+b.data.data;return F(D)}function m(b,F,D){if(!F)return e.encodeBase64Packet(b,D);var T=b.data,P=new Uint8Array(T),H=new Uint8Array(1+T.byteLength);H[0]=x[b.type];for(var S=0;S<P.length;S++)H[S+1]=P[S];return D(H.buffer)}function C(b,F,D){if(!F)return e.encodeBase64Packet(b,D);var T=new FileReader;return T.onload=function(){e.encodePacket({type:b.type,data:T.result},F,!0,D)},T.readAsArrayBuffer(b.data)}function E(b,F,D){if(!F)return e.encodeBase64Packet(b,D);if(o)return C(b,F,D);var T=new Uint8Array(1);T[0]=x[b.type];var P=new d([T.buffer,b.data]);return D(P)}e.encodeBase64Packet=function(b,F){var D="b"+e.packets[b.type];if(typeof d!="undefined"&&b.data instanceof d){var T=new FileReader;return T.onload=function(){var q=T.result.split(",")[1];F(D+q)},T.readAsDataURL(b.data)}var P;try{P=String.fromCharCode.apply(null,new Uint8Array(b.data))}catch(q){for(var H=new Uint8Array(b.data),S=new Array(H.length),A=0;A<H.length;A++)S[A]=H[A];P=String.fromCharCode.apply(null,S)}return D+=btoa(P),F(D)},e.decodePacket=function(b,F,D){if(b===void 0)return s;if(typeof b=="string"){if(b.charAt(0)==="b")return e.decodeBase64Packet(b.substr(1),F);if(D&&(b=y(b),b===!1))return s;var P=b.charAt(0);return Number(P)!=P||!h[P]?s:b.length>1?{type:h[P],data:b.substring(1)}:{type:h[P]}}var T=new Uint8Array(b),P=T[0],H=n(b,1);return d&&F==="blob"&&(H=new d([H])),{type:h[P],data:H}};function y(b){try{b=i.decode(b,{strict:!1})}catch(F){return!1}return b}e.decodeBase64Packet=function(b,F){var D=h[b.charAt(0)];if(!c)return{type:D,data:{base64:!0,data:b.substr(1)}};var T=c.decode(b.substr(1));return F==="blob"&&d&&(T=new d([T])),{type:D,data:T}},e.encodePayload=function(b,F,D){typeof F=="function"&&(D=F,F=null);var T=r(b);if(F&&T)return d&&!o?e.encodePayloadAsBlob(b,D):e.encodePayloadAsArrayBuffer(b,D);if(!b.length)return D("0:");function P(S){return S.length+":"+S}function H(S,A){e.encodePacket(S,T?F:!1,!1,function(q){A(null,P(q))})}B(b,H,function(S,A){return D(A.join(""))})};function B(b,F,D){for(var T=new Array(b.length),P=a(b.length,D),H=function(A,q,N){F(q,function(z,L){T[A]=L,N(z,T)})},S=0;S<b.length;S++)H(S,b[S],P)}e.decodePayload=function(b,F,D){if(typeof b!="string")return e.decodePayloadAsBinary(b,F,D);typeof F=="function"&&(D=F,F=null);var T;if(b==="")return D(s,0,1);for(var P="",H,S,A=0,q=b.length;A<q;A++){var N=b.charAt(A);if(N!==":"){P+=N;continue}if(P===""||P!=(H=Number(P))||(S=b.substr(A+1,H),P!=S.length))return D(s,0,1);if(S.length){if(T=e.decodePacket(S,F,!1),s.type===T.type&&s.data===T.data)return D(s,0,1);var z=D(T,A+H,q);if(z===!1)return}A+=H,P=""}if(P!=="")return D(s,0,1)},e.encodePayloadAsArrayBuffer=function(b,F){if(!b.length)return F(new ArrayBuffer(0));function D(T,P){e.encodePacket(T,!0,!0,function(H){return P(null,H)})}B(b,D,function(T,P){var H=P.reduce(function(q,N){var z;return typeof N=="string"?z=N.length:z=N.byteLength,q+z.toString().length+z+2},0),S=new Uint8Array(H),A=0;return P.forEach(function(q){var N=typeof q=="string",z=q;if(N){for(var Y=new Uint8Array(q.length),L=0;L<q.length;L++)Y[L]=q.charCodeAt(L);z=Y.buffer}N?S[A++]=0:S[A++]=1;for(var X=z.byteLength.toString(),L=0;L<X.length;L++)S[A++]=parseInt(X[L]);S[A++]=255;for(var Y=new Uint8Array(z),L=0;L<Y.length;L++)S[A++]=Y[L]}),F(S.buffer)})},e.encodePayloadAsBlob=function(b,F){function D(T,P){e.encodePacket(T,!0,!0,function(H){var S=new Uint8Array(1);if(S[0]=1,typeof H=="string"){for(var A=new Uint8Array(H.length),q=0;q<H.length;q++)A[q]=H.charCodeAt(q);H=A.buffer,S[0]=0}for(var N=H instanceof ArrayBuffer?H.byteLength:H.size,z=N.toString(),L=new Uint8Array(z.length+1),q=0;q<z.length;q++)L[q]=parseInt(z[q]);if(L[z.length]=255,d){var X=new d([S.buffer,L.buffer,H]);P(null,X)}})}B(b,D,function(T,P){return F(new d(P))})},e.decodePayloadAsBinary=function(b,F,D){typeof F=="function"&&(D=F,F=null);for(var T=b,P=[];T.byteLength>0;){for(var H=new Uint8Array(T),S=H[0]===0,A="",q=1;H[q]!==255;q++){if(A.length>310)return D(s,0,1);A+=H[q]}T=n(T,2+A.length),A=parseInt(A);var N=n(T,0,A);if(S)try{N=String.fromCharCode.apply(null,new Uint8Array(N))}catch(X){var z=new Uint8Array(N);N="";for(var q=0;q<z.length;q++)N+=String.fromCharCode(z[q])}P.push(N),T=n(T,A)}var L=P.length;P.forEach(function(X,Y){D(e.decodePacket(X,F,!0),Y,L)})}})(ge);var Zr,La;function En(){if(La)return Zr;La=1;var e=ge,t=Ne;Zr=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 t(r.prototype),r.prototype.onError=function(n,a){var i=new Error(n);return i.type="TransportError",i.description=a,this.emit("error",i),this},r.prototype.open=function(){return(this.readyState==="closed"||this.readyState==="")&&(this.readyState="opening",this.doOpen()),this},r.prototype.close=function(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this},r.prototype.send=function(n){if(this.readyState==="open")this.write(n);else throw new Error("Transport not open")},r.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},r.prototype.onData=function(n){var a=e.decodePacket(n,this.socket.binaryType);this.onPacket(a)},r.prototype.onPacket=function(n){this.emit("packet",n)},r.prototype.onClose=function(){this.readyState="closed",this.emit("close")},Zr}var Me={};Me.encode=function(e){var t="";for(var r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t};Me.decode=function(e){for(var t={},r=e.split("&"),n=0,a=r.length;n<a;n++){var i=r[n].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t};var Kt=function(e,t){var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e},Zi="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),Ht=64,Yi={},$a=0,ne=0,Ka;function cn(e){var t="";do t=Zi[e%Ht]+t,e=Math.floor(e/Ht);while(e>0);return t}function Sf(e){var t=0;for(ne=0;ne<e.length;ne++)t=t*Ht+Yi[e.charAt(ne)];return t}function Fn(){var e=cn(+new Date);return e!==Ka?($a=0,Ka=e):e+"."+cn($a++)}for(;ne<Ht;ne++)Yi[Zi[ne]]=ne;Fn.encode=cn;Fn.decode=Sf;var Qi=Fn,Ji=En(),Tf=Me,eo=ge,kf=Kt,Rf=Qi,N0=X0("engine.io-client:polling"),to=$0,Pf=function(){var e=Cn,t=new e({xdomain:!1});return t.responseType!=null}();function $0(e){var t=e&&e.forceBase64;(!Pf||t)&&(this.supportsBinary=!1),Ji.call(this,e)}kf($0,Ji);$0.prototype.name="polling";$0.prototype.doOpen=function(){this.poll()};$0.prototype.pause=function(e){var t=this;this.readyState="pausing";function r(){N0("paused"),t.readyState="paused",e()}if(this.polling||!this.writable){var n=0;this.polling&&(N0("we are currently polling - waiting to pause"),n++,this.once("pollComplete",function(){N0("pre-pause polling complete"),--n||r()})),this.writable||(N0("we are currently writing - waiting to pause"),n++,this.once("drain",function(){N0("pre-pause writing complete"),--n||r()}))}else r()};$0.prototype.poll=function(){N0("polling"),this.polling=!0,this.doPoll(),this.emit("poll")};$0.prototype.onData=function(e){var t=this;N0("polling got data %s",e);var r=function(n,a,i){if(t.readyState==="opening"&&n.type==="open"&&t.onOpen(),n.type==="close")return t.onClose(),!1;t.onPacket(n)};eo.decodePayload(e,this.socket.binaryType,r),this.readyState!=="closed"&&(this.polling=!1,this.emit("pollComplete"),this.readyState==="open"?this.poll():N0('ignoring poll - transport state "%s"',this.readyState))};$0.prototype.doClose=function(){var e=this;function t(){N0("writing close packet"),e.write([{type:"close"}])}this.readyState==="open"?(N0("transport open - closing"),t()):(N0("transport not open - deferring close"),this.once("open",t))};$0.prototype.write=function(e){var t=this;this.writable=!1;var r=function(){t.writable=!0,t.emit("drain")};eo.encodePayload(e,this.supportsBinary,function(n){t.doWrite(n,r)})};$0.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",r="";this.timestampRequests!==!1&&(e[this.timestampParam]=Rf()),!this.supportsBinary&&!e.sid&&(e.b64=1),e=Tf.encode(e),this.port&&(t==="https"&&Number(this.port)!==443||t==="http"&&Number(this.port)!==80)&&(r=":"+this.port),e.length&&(e="?"+e);var n=this.hostname.indexOf(":")!==-1;return t+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+e};var If=Cn,ro=to,qf=Ne,Of=Kt,fn=X0("engine.io-client:polling-xhr"),Hf=Bn;_n.exports=Ue;_n.exports.Request=f0;function Wa(){}function Ue(e){if(ro.call(this,e),this.requestTimeout=e.requestTimeout,this.extraHeaders=e.extraHeaders,typeof location!="undefined"){var t=location.protocol==="https:",r=location.port;r||(r=t?443:80),this.xd=typeof location!="undefined"&&e.hostname!==location.hostname||r!==e.port,this.xs=e.secure!==t}}Of(Ue,ro);Ue.prototype.supportsBinary=!0;Ue.prototype.request=function(e){return e=e||{},e.uri=this.uri(),e.xd=this.xd,e.xs=this.xs,e.agent=this.agent||!1,e.supportsBinary=this.supportsBinary,e.enablesXDR=this.enablesXDR,e.withCredentials=this.withCredentials,e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized,e.requestTimeout=this.requestTimeout,e.extraHeaders=this.extraHeaders,new f0(e)};Ue.prototype.doWrite=function(e,t){var r=typeof e!="string"&&e!==void 0,n=this.request({method:"POST",data:e,isBinary:r}),a=this;n.on("success",t),n.on("error",function(i){a.onError("xhr post error",i)}),this.sendXhr=n};Ue.prototype.doPoll=function(){fn("xhr poll");var e=this.request(),t=this;e.on("data",function(r){t.onData(r)}),e.on("error",function(r){t.onError("xhr poll error",r)}),this.pollXhr=e};function f0(e){this.method=e.method||"GET",this.uri=e.uri,this.xd=!!e.xd,this.xs=!!e.xs,this.async=e.async!==!1,this.data=e.data!==void 0?e.data:null,this.agent=e.agent,this.isBinary=e.isBinary,this.supportsBinary=e.supportsBinary,this.enablesXDR=e.enablesXDR,this.withCredentials=e.withCredentials,this.requestTimeout=e.requestTimeout,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.extraHeaders=e.extraHeaders,this.create()}qf(f0.prototype);f0.prototype.create=function(){var e={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized;var t=this.xhr=new If(e),r=this;try{fn("xhr open %s: %s",this.method,this.uri),t.open(this.method,this.uri,this.async);try{if(this.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(var n in this.extraHeaders)this.extraHeaders.hasOwnProperty(n)&&t.setRequestHeader(n,this.extraHeaders[n])}}catch(a){}if(this.method==="POST")try{this.isBinary?t.setRequestHeader("Content-type","application/octet-stream"):t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(a){}try{t.setRequestHeader("Accept","*/*")}catch(a){}"withCredentials"in t&&(t.withCredentials=this.withCredentials),this.requestTimeout&&(t.timeout=this.requestTimeout),this.hasXDR()?(t.onload=function(){r.onLoad()},t.onerror=function(){r.onError(t.responseText)}):t.onreadystatechange=function(){if(t.readyState===2)try{var a=t.getResponseHeader("Content-Type");(r.supportsBinary&&a==="application/octet-stream"||a==="application/octet-stream; charset=UTF-8")&&(t.responseType="arraybuffer")}catch(i){}t.readyState===4&&(t.status===200||t.status===1223?r.onLoad():setTimeout(function(){r.onError(typeof t.status=="number"?t.status:0)},0))},fn("xhr data %s",this.data),t.send(this.data)}catch(a){setTimeout(function(){r.onError(a)},0);return}typeof document!="undefined"&&(this.index=f0.requestsCount++,f0.requests[this.index]=this)};f0.prototype.onSuccess=function(){this.emit("success"),this.cleanup()};f0.prototype.onData=function(e){this.emit("data",e),this.onSuccess()};f0.prototype.onError=function(e){this.emit("error",e),this.cleanup(!0)};f0.prototype.cleanup=function(e){if(!(typeof this.xhr=="undefined"||this.xhr===null)){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=Wa:this.xhr.onreadystatechange=Wa,e)try{this.xhr.abort()}catch(t){}typeof document!="undefined"&&delete f0.requests[this.index],this.xhr=null}};f0.prototype.onLoad=function(){var e;try{var t;try{t=this.xhr.getResponseHeader("Content-Type")}catch(r){}t==="application/octet-stream"||t==="application/octet-stream; charset=UTF-8"?e=this.xhr.response||this.xhr.responseText:e=this.xhr.responseText}catch(r){this.onError(r)}e!=null&&this.onData(e)};f0.prototype.hasXDR=function(){return typeof XDomainRequest!="undefined"&&!this.xs&&this.enablesXDR};f0.prototype.abort=function(){this.cleanup()};f0.requestsCount=0;f0.requests={};if(typeof document!="undefined"){if(typeof attachEvent=="function")attachEvent("onunload",ja);else if(typeof addEventListener=="function"){var Nf="onpagehide"in Hf?"pagehide":"unload";addEventListener(Nf,ja,!1)}}function ja(){for(var e in f0.requests)f0.requests.hasOwnProperty(e)&&f0.requests[e].abort()}var Mf=_n.exports,An=to,Uf=Kt,Xa=Bn,zf=ze,Lf=/\n/g,$f=/\\n/g,Ft;function Kf(){}function ze(e){An.call(this,e),this.query=this.query||{},Ft||(Ft=Xa.___eio=Xa.___eio||[]),this.index=Ft.length;var t=this;Ft.push(function(r){t.onData(r)}),this.query.j=this.index,typeof addEventListener=="function"&&addEventListener("beforeunload",function(){t.script&&(t.script.onerror=Kf)},!1)}Uf(ze,An);ze.prototype.supportsBinary=!1;ze.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),An.prototype.doClose.call(this)};ze.prototype.doPoll=function(){var e=this,t=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),t.async=!0,t.src=this.uri(),t.onerror=function(a){e.onError("jsonp poll error",a)};var r=document.getElementsByTagName("script")[0];r?r.parentNode.insertBefore(t,r):(document.head||document.body).appendChild(t),this.script=t;var n=typeof navigator!="undefined"&&/gecko/i.test(navigator.userAgent);n&&setTimeout(function(){var a=document.createElement("iframe");document.body.appendChild(a),document.body.removeChild(a)},100)};ze.prototype.doWrite=function(e,t){var r=this;if(!this.form){var n=document.createElement("form"),a=document.createElement("textarea"),i=this.iframeId="eio_iframe_"+this.index,c;n.className="socketio",n.style.position="absolute",n.style.top="-1000px",n.style.left="-1000px",n.target=i,n.method="POST",n.setAttribute("accept-charset","utf-8"),a.name="d",n.appendChild(a),document.body.appendChild(n),this.form=n,this.area=a}this.form.action=this.uri();function f(){p(),t()}function p(){if(r.iframe)try{r.form.removeChild(r.iframe)}catch(x){r.onError("jsonp polling iframe removal error",x)}try{var o='<iframe src="javascript:0" name="'+r.iframeId+'">';c=document.createElement(o)}catch(x){c=document.createElement("iframe"),c.name=r.iframeId,c.src="javascript:0"}c.id=r.iframeId,r.form.appendChild(c),r.iframe=c}p(),e=e.replace($f,`\\
|
|
21
|
-
`),this.area.value=e.replace(Lf,"\\n");try{this.form.submit()}catch(o){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){r.iframe.readyState==="complete"&&f()}:this.iframe.onload=f};var Dn=En(),Wf=ge,jf=Me,Xf=Kt,Vf=Qi,Gf=X0("engine.io-client:websocket"),Nt,wn;typeof WebSocket!="undefined"?Nt=WebSocket:typeof self!="undefined"&&(Nt=self.WebSocket||self.MozWebSocket);if(typeof window=="undefined")try{wn=oi}catch(e){}var Pe=Nt||wn,Zf=R0;function R0(e){var t=e&&e.forceBase64;t&&(this.supportsBinary=!1),this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=Nt&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(Pe=wn),Dn.call(this,e)}Xf(R0,Dn);R0.prototype.name="websocket";R0.prototype.supportsBinary=!0;R0.prototype.doOpen=function(){if(this.check()){var e=this.uri(),t=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?t?new Pe(e,t):new Pe(e):new Pe(e,t,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()}};R0.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}};R0.prototype.write=function(e){var t=this;this.writable=!1;for(var r=e.length,n=0,a=r;n<a;n++)(function(c){Wf.encodePacket(c,t.supportsBinary,function(f){if(!t.usingBrowserWebSocket){var p={};if(c.options&&(p.compress=c.options.compress),t.perMessageDeflate){var o=typeof f=="string"?Buffer.byteLength(f):f.length;o<t.perMessageDeflate.threshold&&(p.compress=!1)}}try{t.usingBrowserWebSocket?t.ws.send(f):t.ws.send(f,p)}catch(x){Gf("websocket closed before onclose event")}--r||i()})})(e[n]);function i(){t.emit("flush"),setTimeout(function(){t.writable=!0,t.emit("drain")},0)}};R0.prototype.onClose=function(){Dn.prototype.onClose.call(this)};R0.prototype.doClose=function(){typeof this.ws!="undefined"&&this.ws.close()};R0.prototype.uri=function(){var e=this.query||{},t=this.secure?"wss":"ws",r="";this.port&&(t==="wss"&&Number(this.port)!==443||t==="ws"&&Number(this.port)!==80)&&(r=":"+this.port),this.timestampRequests&&(e[this.timestampParam]=Vf()),this.supportsBinary||(e.b64=1),e=jf.encode(e),e.length&&(e="?"+e);var n=this.hostname.indexOf(":")!==-1;return t+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+e};R0.prototype.check=function(){return!!Pe&&!("__initialize"in Pe&&this.name===R0.prototype.name)};var Yf=Cn,Qf=Mf,Jf=zf,e1=Zf;$t.polling=t1;$t.websocket=e1;function t1(e){var t,r=!1,n=!1,a=e.jsonp!==!1;if(typeof location!="undefined"){var i=location.protocol==="https:",c=location.port;c||(c=i?443:80),r=e.hostname!==location.hostname||c!==e.port,n=e.secure!==i}if(e.xdomain=r,e.xscheme=n,t=new Yf(e),"open"in t&&!e.forceJSONP)return new Qf(e);if(!a)throw new Error("JSONP disabled");return new Jf(e)}var r1=[].indexOf,no=function(e,t){if(r1)return e.indexOf(t);for(var r=0;r<e.length;++r)if(e[r]===t)return r;return-1},n1=$t,a1=Ne,c0=X0("engine.io-client:socket"),i1=no,ao=ge,Va=zi,o1=Me,s1=J;function J(e,t){if(!(this instanceof J))return new J(e,t);t=t||{},e&&typeof e=="object"&&(t=e,e=null),e?(e=Va(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=Va(t.host).host),this.secure=t.secure!=null?t.secure:typeof location!="undefined"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.agent=t.agent||!1,this.hostname=t.hostname||(typeof location!="undefined"?location.hostname:"localhost"),this.port=t.port||(typeof location!="undefined"&&location.port?location.port:this.secure?443:80),this.query=t.query||{},typeof this.query=="string"&&(this.query=o1.decode(this.query)),this.upgrade=t.upgrade!==!1,this.path=(t.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!t.forceJSONP,this.jsonp=t.jsonp!==!1,this.forceBase64=!!t.forceBase64,this.enablesXDR=!!t.enablesXDR,this.withCredentials=t.withCredentials!==!1,this.timestampParam=t.timestampParam||"t",this.timestampRequests=t.timestampRequests,this.transports=t.transports||["polling","websocket"],this.transportOptions=t.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=t.policyPort||843,this.rememberUpgrade=t.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=t.onlyBinaryUpgrades,this.perMessageDeflate=t.perMessageDeflate!==!1?t.perMessageDeflate||{}:!1,this.perMessageDeflate===!0&&(this.perMessageDeflate={}),this.perMessageDeflate&&this.perMessageDeflate.threshold==null&&(this.perMessageDeflate.threshold=1024),this.pfx=t.pfx||void 0,this.key=t.key||void 0,this.passphrase=t.passphrase||void 0,this.cert=t.cert||void 0,this.ca=t.ca||void 0,this.ciphers=t.ciphers||void 0,this.rejectUnauthorized=t.rejectUnauthorized===void 0?!0:t.rejectUnauthorized,this.forceNode=!!t.forceNode,this.isReactNative=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",(typeof self=="undefined"||this.isReactNative)&&(t.extraHeaders&&Object.keys(t.extraHeaders).length>0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}J.priorWebsocketSuccess=!1;a1(J.prototype);J.protocol=ao.protocol;J.Socket=J;J.Transport=En();J.transports=$t;J.parser=ge;J.prototype.createTransport=function(e){c0('creating transport "%s"',e);var t=x1(this.query);t.EIO=ao.protocol,t.transport=e;var r=this.transportOptions[e]||{};this.id&&(t.sid=this.id);var n=new n1[e]({query:t,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 x1(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}J.prototype.open=function(){var e;if(this.rememberUpgrade&&J.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){var t=this;setTimeout(function(){t.emit("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch(r){this.transports.shift(),this.open();return}e.open(),this.setTransport(e)};J.prototype.setTransport=function(e){c0("setting transport %s",e.name);var t=this;this.transport&&(c0("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.onDrain()}).on("packet",function(r){t.onPacket(r)}).on("error",function(r){t.onError(r)}).on("close",function(){t.onClose("transport close")})};J.prototype.probe=function(e){c0('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),r=!1,n=this;J.priorWebsocketSuccess=!1;function a(){if(n.onlyBinaryUpgrades){var h=!this.supportsBinary&&n.transport.supportsBinary;r=r||h}r||(c0('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",function(s){if(!r)if(s.type==="pong"&&s.data==="probe"){if(c0('probe transport "%s" pong',e),n.upgrading=!0,n.emit("upgrading",t),!t)return;J.priorWebsocketSuccess=t.name==="websocket",c0('pausing current transport "%s"',n.transport.name),n.transport.pause(function(){r||n.readyState!=="closed"&&(c0("changing transport and sending upgrade packet"),x(),n.setTransport(t),t.send([{type:"upgrade"}]),n.emit("upgrade",t),t=null,n.upgrading=!1,n.flush())})}else{c0('probe transport "%s" failed',e);var d=new Error("probe error");d.transport=t.name,n.emit("upgradeError",d)}}))}function i(){r||(r=!0,x(),t.close(),t=null)}function c(h){var s=new Error("probe error: "+h);s.transport=t.name,i(),c0('probe transport "%s" failed because of error: %s',e,h),n.emit("upgradeError",s)}function f(){c("transport closed")}function p(){c("socket closed")}function o(h){t&&h.name!==t.name&&(c0('"%s" works - aborting "%s"',h.name,t.name),i())}function x(){t.removeListener("open",a),t.removeListener("error",c),t.removeListener("close",f),n.removeListener("close",p),n.removeListener("upgrading",o)}t.once("open",a),t.once("error",c),t.once("close",f),this.once("close",p),this.once("upgrading",o),t.open()};J.prototype.onOpen=function(){if(c0("socket open"),this.readyState="open",J.priorWebsocketSuccess=this.transport.name==="websocket",this.emit("open"),this.flush(),this.readyState==="open"&&this.upgrade&&this.transport.pause){c0("starting upgrade probes");for(var e=0,t=this.upgrades.length;e<t;e++)this.probe(this.upgrades[e])}};J.prototype.onPacket=function(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(c0('socket receive: type "%s", data "%s"',e.type,e.data),this.emit("packet",e),this.emit("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emit("data",e.data),this.emit("message",e.data);break}else c0('packet received with socket readyState "%s"',this.readyState)};J.prototype.onHandshake=function(e){this.emit("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.onOpen(),this.readyState!=="closed"&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))};J.prototype.onHeartbeat=function(e){clearTimeout(this.pingTimeoutTimer);var t=this;t.pingTimeoutTimer=setTimeout(function(){t.readyState!=="closed"&&t.onClose("ping timeout")},e||t.pingInterval+t.pingTimeout)};J.prototype.setPing=function(){var e=this;clearTimeout(e.pingIntervalTimer),e.pingIntervalTimer=setTimeout(function(){c0("writing ping packet - expecting pong within %sms",e.pingTimeout),e.ping(),e.onHeartbeat(e.pingTimeout)},e.pingInterval)};J.prototype.ping=function(){var e=this;this.sendPacket("ping",function(){e.emit("ping")})};J.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emit("drain"):this.flush()};J.prototype.flush=function(){this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(c0("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))};J.prototype.write=J.prototype.send=function(e,t,r){return this.sendPacket("message",e,t,r),this};J.prototype.sendPacket=function(e,t,r,n){if(typeof t=="function"&&(n=t,t=void 0),typeof r=="function"&&(n=r,r=null),!(this.readyState==="closing"||this.readyState==="closed")){r=r||{},r.compress=r.compress!==!1;var a={type:e,data:t,options:r};this.emit("packetCreate",a),this.writeBuffer.push(a),n&&this.once("flush",n),this.flush()}};J.prototype.close=function(){if(this.readyState==="opening"||this.readyState==="open"){this.readyState="closing";var e=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?n():t()}):this.upgrading?n():t()}function t(){e.onClose("forced close"),c0("socket closing - telling transport to close"),e.transport.close()}function r(){e.removeListener("upgrade",r),e.removeListener("upgradeError",r),t()}function n(){e.once("upgrade",r),e.once("upgradeError",r)}return this};J.prototype.onError=function(e){c0("socket error %j",e),J.priorWebsocketSuccess=!1,this.emit("error",e),this.onClose("transport error",e)};J.prototype.onClose=function(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){c0('socket close with reason: "%s"',e);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",e,t),r.writeBuffer=[],r.prevBufferLen=0}};J.prototype.filterUpgrades=function(e){for(var t=[],r=0,n=e.length;r<n;r++)~i1(this.transports,e[r])&&t.push(e[r]);return t};mn.exports=s1;mn.exports.parser=ge;var c1=mn.exports,io={exports:{}},f1=d1;function d1(e,t){var r=[];t=t||0;for(var n=t||0;n<e.length;n++)r[n-t]=e[n];return r}var oo=u1;function u1(e,t,r){return e.on(t,r),{destroy:function(){e.removeListener(t,r)}}}var Ga=[].slice,so=function(e,t){if(typeof t=="string"&&(t=e[t]),typeof t!="function")throw new Error("bind() requires a function");var r=Ga.call(arguments,2);return function(){return t.apply(e,r.concat(Ga.call(arguments)))}};(function(e,t){var r=zt,n=Ne,a=f1,i=oo,c=so,f=X0("socket.io-client:socket"),p=Me,o=Xi;e.exports=s;var x={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 s(d,v,m){this.io=d,this.nsp=v,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},m&&m.query&&(this.query=m.query),this.io.autoConnect&&this.open()}n(s.prototype),s.prototype.subEvents=function(){if(!this.subs){var d=this.io;this.subs=[i(d,"open",c(this,"onopen")),i(d,"packet",c(this,"onpacket")),i(d,"close",c(this,"onclose"))]}},s.prototype.open=s.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)},s.prototype.send=function(){var d=a(arguments);return d.unshift("message"),this.emit.apply(this,d),this},s.prototype.emit=function(d){if(x.hasOwnProperty(d))return h.apply(this,arguments),this;var v=a(arguments),m={type:(this.flags.binary!==void 0?this.flags.binary:o(v))?r.BINARY_EVENT:r.EVENT,data:v};return m.options={},m.options.compress=!this.flags||this.flags.compress!==!1,typeof v[v.length-1]=="function"&&(f("emitting packet with ack id %d",this.ids),this.acks[this.ids]=v.pop(),m.id=this.ids++),this.connected?this.packet(m):this.sendBuffer.push(m),this.flags={},this},s.prototype.packet=function(d){d.nsp=this.nsp,this.io.packet(d)},s.prototype.onopen=function(){if(f("transport is open - connecting"),this.nsp!=="/")if(this.query){var d=typeof this.query=="object"?p.encode(this.query):this.query;f("sending connect packet with query %s",d),this.packet({type:r.CONNECT,query:d})}else this.packet({type:r.CONNECT})},s.prototype.onclose=function(d){f("close (%s)",d),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",d)},s.prototype.onpacket=function(d){var v=d.nsp===this.nsp,m=d.type===r.ERROR&&d.nsp==="/";if(!(!v&&!m))switch(d.type){case r.CONNECT:this.onconnect();break;case r.EVENT:this.onevent(d);break;case r.BINARY_EVENT:this.onevent(d);break;case r.ACK:this.onack(d);break;case r.BINARY_ACK:this.onack(d);break;case r.DISCONNECT:this.ondisconnect();break;case r.ERROR:this.emit("error",d.data);break}},s.prototype.onevent=function(d){var v=d.data||[];f("emitting event %j",v),d.id!=null&&(f("attaching ack callback to event"),v.push(this.ack(d.id))),this.connected?h.apply(this,v):this.receiveBuffer.push(v)},s.prototype.ack=function(d){var v=this,m=!1;return function(){if(!m){m=!0;var C=a(arguments);f("sending ack %j",C),v.packet({type:o(C)?r.BINARY_ACK:r.ACK,id:d,data:C})}}},s.prototype.onack=function(d){var v=this.acks[d.id];typeof v=="function"?(f("calling ack %s with %j",d.id,d.data),v.apply(this,d.data),delete this.acks[d.id]):f("bad ack %s",d.id)},s.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emitBuffered(),this.emit("connect")},s.prototype.emitBuffered=function(){var d;for(d=0;d<this.receiveBuffer.length;d++)h.apply(this,this.receiveBuffer[d]);for(this.receiveBuffer=[],d=0;d<this.sendBuffer.length;d++)this.packet(this.sendBuffer[d]);this.sendBuffer=[]},s.prototype.ondisconnect=function(){f("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},s.prototype.destroy=function(){if(this.subs){for(var d=0;d<this.subs.length;d++)this.subs[d].destroy();this.subs=null}this.io.destroy(this)},s.prototype.close=s.prototype.disconnect=function(){return this.connected&&(f("performing disconnect (%s)",this.nsp),this.packet({type:r.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},s.prototype.compress=function(d){return this.flags.compress=d,this},s.prototype.binary=function(d){return this.flags.binary=d,this}})(io);var xo=io.exports,h1=Le;function Le(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Le.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+r:e-r}return Math.min(e,this.max)|0};Le.prototype.reset=function(){this.attempts=0};Le.prototype.setMin=function(e){this.ms=e};Le.prototype.setMax=function(e){this.max=e};Le.prototype.setJitter=function(e){this.jitter=e};var l1=c1,p1=xo,b1=Ne,v1=zt,J0=oo,Fe=so,v0=X0("socket.io-client:manager"),co=no,y1=h1,fo=Object.prototype.hasOwnProperty,Za=i0;function i0(e,t){if(!(this instanceof i0))return new i0(e,t);e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new y1({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var r=t.parser||v1;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=t.autoConnect!==!1,this.autoConnect&&this.open()}i0.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var e in this.nsps)fo.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)};i0.prototype.updateSocketIds=function(){for(var e in this.nsps)fo.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))};i0.prototype.generateId=function(e){return(e==="/"?"":e+"#")+this.engine.id};b1(i0.prototype);i0.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection};i0.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts};i0.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay};i0.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor};i0.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax};i0.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout};i0.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()};i0.prototype.open=i0.prototype.connect=function(e,t){if(v0("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;v0("opening %s",this.uri),this.engine=l1(this.uri,this.opts);var r=this.engine,n=this;this.readyState="opening",this.skipReconnect=!1;var a=J0(r,"open",function(){n.onopen(),e&&e()}),i=J0(r,"error",function(p){if(v0("connect_error"),n.cleanup(),n.readyState="closed",n.emitAll("connect_error",p),e){var o=new Error("Connection error");o.data=p,e(o)}else n.maybeReconnectOnOpen()});if(this._timeout!==!1){var c=this._timeout;v0("connect attempt will timeout after %d",c),c===0&&a.destroy();var f=setTimeout(function(){v0("connect attempt timed out after %d",c),a.destroy(),r.close(),r.emit("error","timeout"),n.emitAll("connect_timeout",c)},c);this.subs.push({destroy:function(){clearTimeout(f)}})}return this.subs.push(a),this.subs.push(i),this};i0.prototype.onopen=function(){v0("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(J0(e,"data",Fe(this,"ondata"))),this.subs.push(J0(e,"ping",Fe(this,"onping"))),this.subs.push(J0(e,"pong",Fe(this,"onpong"))),this.subs.push(J0(e,"error",Fe(this,"onerror"))),this.subs.push(J0(e,"close",Fe(this,"onclose"))),this.subs.push(J0(this.decoder,"decoded",Fe(this,"ondecoded")))};i0.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")};i0.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)};i0.prototype.ondata=function(e){this.decoder.add(e)};i0.prototype.ondecoded=function(e){this.emit("packet",e)};i0.prototype.onerror=function(e){v0("error",e),this.emitAll("error",e)};i0.prototype.socket=function(e,t){var r=this.nsps[e];if(!r){r=new p1(this,e,t),this.nsps[e]=r;var n=this;r.on("connecting",a),r.on("connect",function(){r.id=n.generateId(e)}),this.autoConnect&&a()}function a(){~co(n.connecting,r)||n.connecting.push(r)}return r};i0.prototype.destroy=function(e){var t=co(this.connecting,e);~t&&this.connecting.splice(t,1),!this.connecting.length&&this.close()};i0.prototype.packet=function(e){v0("writing packet %j",e);var t=this;e.query&&e.type===0&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,function(r){for(var n=0;n<r.length;n++)t.engine.write(r[n],e.options);t.encoding=!1,t.processPacketQueue()}))};i0.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}};i0.prototype.cleanup=function(){v0("cleanup");for(var e=this.subs.length,t=0;t<e;t++){var r=this.subs.shift();r.destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()};i0.prototype.close=i0.prototype.disconnect=function(){v0("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,this.readyState==="opening"&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()};i0.prototype.onclose=function(e){v0("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",e),this._reconnection&&!this.skipReconnect&&this.reconnect()};i0.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var e=this;if(this.backoff.attempts>=this._reconnectionAttempts)v0("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();v0("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var r=setTimeout(function(){e.skipReconnect||(v0("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),!e.skipReconnect&&e.open(function(n){n?(v0("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",n.data)):(v0("reconnect success"),e.onreconnect())}))},t);this.subs.push({destroy:function(){clearTimeout(r)}})}};i0.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)};(function(e,t){var r=ef,n=zt,a=Za,i=X0("socket.io-client");e.exports=t=f;var c=t.managers={};function f(p,o){typeof p=="object"&&(o=p,p=void 0),o=o||{};var x=r(p),h=x.source,s=x.id,d=x.path,v=c[s]&&d in c[s].nsps,m=o.forceNew||o["force new connection"]||o.multiplex===!1||v,C;return m?(i("ignoring socket cache for %s",h),C=a(h,o)):(c[s]||(i("new io instance for %s",h),c[s]=a(h,o)),C=c[s]),x.query&&!o.query&&(o.query=x.query),C.socket(x.path,o)}t.protocol=n.protocol,t.connect=f,t.Manager=Za,t.Socket=xo})(rn,rn.exports);var g1=rn.exports;const m1=tt(g1),B1=Object.prototype.hasOwnProperty;function Ya(e,t){return B1.call(e,t)}function C1(){return Ya(window,"WebSocket")||Ya(window,"MozWebSocket")}const uo=["message","product","lottery","questionnaire","coupon","activityLottery","testQuestion","emotion","speak","customMessage","motivation"];class _1{constructor(){V(this,"__defaultEventKey","DEFAULT_EVENT");V(this,"__allEventKey","ALL_EVENT");V(this,"__appSocketEventStore",{});V(this,"__socketListens",{});for(const t of uo)this.__socketListens[t]=this.__createSocketHandle(t)}__createSocketHandle(t){return r=>{try{if(r instanceof ArrayBuffer)return;const n=JSON.parse(r);if(n){const a=c=>{for(const f in this.__appSocketEventStore){const p=`${t}.${c}`;f.includes(p)&&this.__appSocketEventStore[f].forEach(x=>{x(n)})}},i=n.EVENT||this.__defaultEventKey;a(i),a(this.__allEventKey)}}catch(n){console.warn(n)}}}listenSocketEvent(t){return Q(this,null,function*(){for(const r in this.__socketListens){const n=this.__socketListens[r];if(!n)return;t.on(r,n)}})}addSocketHandles(t,r,n){const a=(i,c)=>{const f=`${t}.${n}.${i}`;this.__appSocketEventStore[f]||(this.__appSocketEventStore[f]=[]),this.__appSocketEventStore[f].push(c)};if(typeof r=="function"){a(this.__allEventKey,r);return}for(const i in r)a(i,r[i])}}class E1{constructor(t){V(this,"eventEmitter",new Lc);V(this,"__eventStore",new _1);V(this,"__socket");this.config=t}_afterConnect(){}getToken(){return Promise.resolve(this.config.token)}getChannelInfo(){return Promise.resolve(this.config.channelInfo)}getUserInfo(){return typeof this.config.userInfo=="function"?this.config.userInfo():this.config.userInfo}getSocket(t=!0){if(t&&!this.__socket)throw new Error("Socket 连接未初始化");return this.__socket}_initSocket(){return new Promise(t=>{Q(this,null,function*(){const r=vn(this.config.domainInfo).chatWsDomain,n=[2e3,3e3,4e3,5e3],a=yield this.getToken();this.config.customSocket?this.__socket=this.config.customSocket:this.__socket=m1(Sx(r),{query:{token:a,version:this.config.socketVersion||"3.0"},transports:[C1()?"websocket":"polling"],reconnectionDelay:n[Math.floor(Math.random()*n.length)],randomizationFactor:Math.random()}),this.__bindConnectEvent(),this.__eventStore.listenSocketEvent(this.__socket),t()})})}_connectSocket(){return new Promise(t=>{const r=this.getSocket(),n=()=>{t()};r.disconnected&&(r.once("connect",n),r.connect()),r.connected&&n()})}__bindConnectEvent(){const t=this.getSocket(),r={connect:()=>{this._afterConnect(),this.eventEmitter.emit(H0.ConnectSuccess)},disconnect:()=>{this.eventEmitter.emit(H0.Disconnect)},reconnect:()=>{this.eventEmitter.emit(H0.ReconnectSuccess)},error:()=>{this.eventEmitter.emit(H0.ConnectFailed,{reason:Re.SocketConnectError})},connect_error:()=>{this.eventEmitter.emit(H0.ConnectFailed,{reason:Re.SocketConnectError})},connect_timeout:()=>{this.eventEmitter.emit(H0.ConnectFailed,{reason:Re.SocketConnectTimeout})}};for(const n in r)t.on(n,r[n])}emitSocket(t,r="message",n){return new Promise((a,i)=>{Q(this,null,function*(){const{checkCode:c=!0,directCallback:f=!1}=n||{},p=this.getSocket(),o=(...x)=>{if(f){a(x);return}const h=x[0];let s=h;if(h instanceof ArrayBuffer)return;let d=h;if(typeof h=="string")try{d=JSON.parse(h)}catch(v){}if(typeof h=="object"&&(d=h),d&&typeof d.code=="number"&&c)if(d.code===200)s=d.data;else{i(d);return}else s=d;a(s)};p==null||p.emit(r,JSON.stringify(t),o)})})}addSocketHandles(t,r,n="message"){this.__eventStore.addSocketHandles(t,r,n)}disconnect(){return new Promise(t=>{const r=this.getSocket();if(r.disconnected){t();return}r.once("disconnect",()=>{t()}),r.disconnect()})}}class F1 extends E1{constructor(r){super(r);V(this,"ConnectFailReason",Re);V(this,"SocketUserType",L0);V(this,"PolyvSocketEvent",H0);V(this,"chatApi",new Ix(this));V(this,"polyvApi",new zc(this))}setup(){return Q(this,null,function*(){yield this._initSocket(),this.config.customSocket||(yield this._connectSocket())})}_afterConnect(){const{autoLogin:r=!0}=this.config;r&&this.loginSocket()}loginSocket(){return Q(this,null,function*(){const r=this.getUserInfo(),n=yield this.getChannelInfo(),a=this.config.statisticsParams,i={EVENT:"LOGIN",values:[r.nick,r.pic,r.userId],channelId:String(n.channelId),roomId:String(n.channelId),type:r.userType};n.sessionId&&(i.sessionId=n.sessionId),(a!=null&&a.param4||r.wxUnionId)&&(i.param4=a==null?void 0:a.param4),a!=null&&a.param5&&(i.param5=a.param5),r.actor&&(i.actor=r.actor);const f=(yield this.emitSocket(i,"message",{directCallback:!0}))[0];String(f)[0]==="2"?this.eventEmitter.emit(H0.LoginSuccess,{code:f}):this.eventEmitter.emit(H0.LoginFailed,{code:f})})}isSpecialUserType(r,n){return r===L0.Dummy?!!n&&["主讲","讲师","嘉宾","助教","管理员"].includes(n):[L0.Teacher,L0.Manager,L0.Guest,L0.Assistant,L0.Attendee,L0.UserTagsMonitor].includes(r)}isCurrentUser(r){return this.getUserInfo().userId===r}}exports.ConnectFailReason=Re;exports.PolyvSocket=F1;exports.PolyvSocketEvent=H0;exports.RequestAuthorizeMethod=Xe;exports.SecurityMode=Pt;exports.SocketUserType=L0;exports.socketEventTypes=uo;console.log("%c@polyv/socket","background:#67C23A;padding: 2px 6px;border-radius: 3px;color: #fff","[version: 2.1.0-rc-20251023.1]","[buildTime: 2025-10-21 10:21:22]");
|
|
21
|
+
`),this.area.value=e.replace(Lf,"\\n");try{this.form.submit()}catch(o){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){r.iframe.readyState==="complete"&&f()}:this.iframe.onload=f};var Dn=En(),Wf=ge,jf=Me,Xf=Kt,Vf=Qi,Gf=X0("engine.io-client:websocket"),Nt,wn;typeof WebSocket!="undefined"?Nt=WebSocket:typeof self!="undefined"&&(Nt=self.WebSocket||self.MozWebSocket);if(typeof window=="undefined")try{wn=oi}catch(e){}var Pe=Nt||wn,Zf=R0;function R0(e){var t=e&&e.forceBase64;t&&(this.supportsBinary=!1),this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=Nt&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(Pe=wn),Dn.call(this,e)}Xf(R0,Dn);R0.prototype.name="websocket";R0.prototype.supportsBinary=!0;R0.prototype.doOpen=function(){if(this.check()){var e=this.uri(),t=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?t?new Pe(e,t):new Pe(e):new Pe(e,t,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()}};R0.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}};R0.prototype.write=function(e){var t=this;this.writable=!1;for(var r=e.length,n=0,a=r;n<a;n++)(function(c){Wf.encodePacket(c,t.supportsBinary,function(f){if(!t.usingBrowserWebSocket){var p={};if(c.options&&(p.compress=c.options.compress),t.perMessageDeflate){var o=typeof f=="string"?Buffer.byteLength(f):f.length;o<t.perMessageDeflate.threshold&&(p.compress=!1)}}try{t.usingBrowserWebSocket?t.ws.send(f):t.ws.send(f,p)}catch(x){Gf("websocket closed before onclose event")}--r||i()})})(e[n]);function i(){t.emit("flush"),setTimeout(function(){t.writable=!0,t.emit("drain")},0)}};R0.prototype.onClose=function(){Dn.prototype.onClose.call(this)};R0.prototype.doClose=function(){typeof this.ws!="undefined"&&this.ws.close()};R0.prototype.uri=function(){var e=this.query||{},t=this.secure?"wss":"ws",r="";this.port&&(t==="wss"&&Number(this.port)!==443||t==="ws"&&Number(this.port)!==80)&&(r=":"+this.port),this.timestampRequests&&(e[this.timestampParam]=Vf()),this.supportsBinary||(e.b64=1),e=jf.encode(e),e.length&&(e="?"+e);var n=this.hostname.indexOf(":")!==-1;return t+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+e};R0.prototype.check=function(){return!!Pe&&!("__initialize"in Pe&&this.name===R0.prototype.name)};var Yf=Cn,Qf=Mf,Jf=zf,e1=Zf;$t.polling=t1;$t.websocket=e1;function t1(e){var t,r=!1,n=!1,a=e.jsonp!==!1;if(typeof location!="undefined"){var i=location.protocol==="https:",c=location.port;c||(c=i?443:80),r=e.hostname!==location.hostname||c!==e.port,n=e.secure!==i}if(e.xdomain=r,e.xscheme=n,t=new Yf(e),"open"in t&&!e.forceJSONP)return new Qf(e);if(!a)throw new Error("JSONP disabled");return new Jf(e)}var r1=[].indexOf,no=function(e,t){if(r1)return e.indexOf(t);for(var r=0;r<e.length;++r)if(e[r]===t)return r;return-1},n1=$t,a1=Ne,c0=X0("engine.io-client:socket"),i1=no,ao=ge,Va=zi,o1=Me,s1=J;function J(e,t){if(!(this instanceof J))return new J(e,t);t=t||{},e&&typeof e=="object"&&(t=e,e=null),e?(e=Va(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=Va(t.host).host),this.secure=t.secure!=null?t.secure:typeof location!="undefined"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.agent=t.agent||!1,this.hostname=t.hostname||(typeof location!="undefined"?location.hostname:"localhost"),this.port=t.port||(typeof location!="undefined"&&location.port?location.port:this.secure?443:80),this.query=t.query||{},typeof this.query=="string"&&(this.query=o1.decode(this.query)),this.upgrade=t.upgrade!==!1,this.path=(t.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!t.forceJSONP,this.jsonp=t.jsonp!==!1,this.forceBase64=!!t.forceBase64,this.enablesXDR=!!t.enablesXDR,this.withCredentials=t.withCredentials!==!1,this.timestampParam=t.timestampParam||"t",this.timestampRequests=t.timestampRequests,this.transports=t.transports||["polling","websocket"],this.transportOptions=t.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=t.policyPort||843,this.rememberUpgrade=t.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=t.onlyBinaryUpgrades,this.perMessageDeflate=t.perMessageDeflate!==!1?t.perMessageDeflate||{}:!1,this.perMessageDeflate===!0&&(this.perMessageDeflate={}),this.perMessageDeflate&&this.perMessageDeflate.threshold==null&&(this.perMessageDeflate.threshold=1024),this.pfx=t.pfx||void 0,this.key=t.key||void 0,this.passphrase=t.passphrase||void 0,this.cert=t.cert||void 0,this.ca=t.ca||void 0,this.ciphers=t.ciphers||void 0,this.rejectUnauthorized=t.rejectUnauthorized===void 0?!0:t.rejectUnauthorized,this.forceNode=!!t.forceNode,this.isReactNative=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",(typeof self=="undefined"||this.isReactNative)&&(t.extraHeaders&&Object.keys(t.extraHeaders).length>0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}J.priorWebsocketSuccess=!1;a1(J.prototype);J.protocol=ao.protocol;J.Socket=J;J.Transport=En();J.transports=$t;J.parser=ge;J.prototype.createTransport=function(e){c0('creating transport "%s"',e);var t=x1(this.query);t.EIO=ao.protocol,t.transport=e;var r=this.transportOptions[e]||{};this.id&&(t.sid=this.id);var n=new n1[e]({query:t,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 x1(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}J.prototype.open=function(){var e;if(this.rememberUpgrade&&J.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){var t=this;setTimeout(function(){t.emit("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch(r){this.transports.shift(),this.open();return}e.open(),this.setTransport(e)};J.prototype.setTransport=function(e){c0("setting transport %s",e.name);var t=this;this.transport&&(c0("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.onDrain()}).on("packet",function(r){t.onPacket(r)}).on("error",function(r){t.onError(r)}).on("close",function(){t.onClose("transport close")})};J.prototype.probe=function(e){c0('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),r=!1,n=this;J.priorWebsocketSuccess=!1;function a(){if(n.onlyBinaryUpgrades){var h=!this.supportsBinary&&n.transport.supportsBinary;r=r||h}r||(c0('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",function(s){if(!r)if(s.type==="pong"&&s.data==="probe"){if(c0('probe transport "%s" pong',e),n.upgrading=!0,n.emit("upgrading",t),!t)return;J.priorWebsocketSuccess=t.name==="websocket",c0('pausing current transport "%s"',n.transport.name),n.transport.pause(function(){r||n.readyState!=="closed"&&(c0("changing transport and sending upgrade packet"),x(),n.setTransport(t),t.send([{type:"upgrade"}]),n.emit("upgrade",t),t=null,n.upgrading=!1,n.flush())})}else{c0('probe transport "%s" failed',e);var d=new Error("probe error");d.transport=t.name,n.emit("upgradeError",d)}}))}function i(){r||(r=!0,x(),t.close(),t=null)}function c(h){var s=new Error("probe error: "+h);s.transport=t.name,i(),c0('probe transport "%s" failed because of error: %s',e,h),n.emit("upgradeError",s)}function f(){c("transport closed")}function p(){c("socket closed")}function o(h){t&&h.name!==t.name&&(c0('"%s" works - aborting "%s"',h.name,t.name),i())}function x(){t.removeListener("open",a),t.removeListener("error",c),t.removeListener("close",f),n.removeListener("close",p),n.removeListener("upgrading",o)}t.once("open",a),t.once("error",c),t.once("close",f),this.once("close",p),this.once("upgrading",o),t.open()};J.prototype.onOpen=function(){if(c0("socket open"),this.readyState="open",J.priorWebsocketSuccess=this.transport.name==="websocket",this.emit("open"),this.flush(),this.readyState==="open"&&this.upgrade&&this.transport.pause){c0("starting upgrade probes");for(var e=0,t=this.upgrades.length;e<t;e++)this.probe(this.upgrades[e])}};J.prototype.onPacket=function(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(c0('socket receive: type "%s", data "%s"',e.type,e.data),this.emit("packet",e),this.emit("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emit("data",e.data),this.emit("message",e.data);break}else c0('packet received with socket readyState "%s"',this.readyState)};J.prototype.onHandshake=function(e){this.emit("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.onOpen(),this.readyState!=="closed"&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))};J.prototype.onHeartbeat=function(e){clearTimeout(this.pingTimeoutTimer);var t=this;t.pingTimeoutTimer=setTimeout(function(){t.readyState!=="closed"&&t.onClose("ping timeout")},e||t.pingInterval+t.pingTimeout)};J.prototype.setPing=function(){var e=this;clearTimeout(e.pingIntervalTimer),e.pingIntervalTimer=setTimeout(function(){c0("writing ping packet - expecting pong within %sms",e.pingTimeout),e.ping(),e.onHeartbeat(e.pingTimeout)},e.pingInterval)};J.prototype.ping=function(){var e=this;this.sendPacket("ping",function(){e.emit("ping")})};J.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emit("drain"):this.flush()};J.prototype.flush=function(){this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(c0("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))};J.prototype.write=J.prototype.send=function(e,t,r){return this.sendPacket("message",e,t,r),this};J.prototype.sendPacket=function(e,t,r,n){if(typeof t=="function"&&(n=t,t=void 0),typeof r=="function"&&(n=r,r=null),!(this.readyState==="closing"||this.readyState==="closed")){r=r||{},r.compress=r.compress!==!1;var a={type:e,data:t,options:r};this.emit("packetCreate",a),this.writeBuffer.push(a),n&&this.once("flush",n),this.flush()}};J.prototype.close=function(){if(this.readyState==="opening"||this.readyState==="open"){this.readyState="closing";var e=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?n():t()}):this.upgrading?n():t()}function t(){e.onClose("forced close"),c0("socket closing - telling transport to close"),e.transport.close()}function r(){e.removeListener("upgrade",r),e.removeListener("upgradeError",r),t()}function n(){e.once("upgrade",r),e.once("upgradeError",r)}return this};J.prototype.onError=function(e){c0("socket error %j",e),J.priorWebsocketSuccess=!1,this.emit("error",e),this.onClose("transport error",e)};J.prototype.onClose=function(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){c0('socket close with reason: "%s"',e);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",e,t),r.writeBuffer=[],r.prevBufferLen=0}};J.prototype.filterUpgrades=function(e){for(var t=[],r=0,n=e.length;r<n;r++)~i1(this.transports,e[r])&&t.push(e[r]);return t};mn.exports=s1;mn.exports.parser=ge;var c1=mn.exports,io={exports:{}},f1=d1;function d1(e,t){var r=[];t=t||0;for(var n=t||0;n<e.length;n++)r[n-t]=e[n];return r}var oo=u1;function u1(e,t,r){return e.on(t,r),{destroy:function(){e.removeListener(t,r)}}}var Ga=[].slice,so=function(e,t){if(typeof t=="string"&&(t=e[t]),typeof t!="function")throw new Error("bind() requires a function");var r=Ga.call(arguments,2);return function(){return t.apply(e,r.concat(Ga.call(arguments)))}};(function(e,t){var r=zt,n=Ne,a=f1,i=oo,c=so,f=X0("socket.io-client:socket"),p=Me,o=Xi;e.exports=s;var x={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 s(d,v,m){this.io=d,this.nsp=v,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},m&&m.query&&(this.query=m.query),this.io.autoConnect&&this.open()}n(s.prototype),s.prototype.subEvents=function(){if(!this.subs){var d=this.io;this.subs=[i(d,"open",c(this,"onopen")),i(d,"packet",c(this,"onpacket")),i(d,"close",c(this,"onclose"))]}},s.prototype.open=s.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)},s.prototype.send=function(){var d=a(arguments);return d.unshift("message"),this.emit.apply(this,d),this},s.prototype.emit=function(d){if(x.hasOwnProperty(d))return h.apply(this,arguments),this;var v=a(arguments),m={type:(this.flags.binary!==void 0?this.flags.binary:o(v))?r.BINARY_EVENT:r.EVENT,data:v};return m.options={},m.options.compress=!this.flags||this.flags.compress!==!1,typeof v[v.length-1]=="function"&&(f("emitting packet with ack id %d",this.ids),this.acks[this.ids]=v.pop(),m.id=this.ids++),this.connected?this.packet(m):this.sendBuffer.push(m),this.flags={},this},s.prototype.packet=function(d){d.nsp=this.nsp,this.io.packet(d)},s.prototype.onopen=function(){if(f("transport is open - connecting"),this.nsp!=="/")if(this.query){var d=typeof this.query=="object"?p.encode(this.query):this.query;f("sending connect packet with query %s",d),this.packet({type:r.CONNECT,query:d})}else this.packet({type:r.CONNECT})},s.prototype.onclose=function(d){f("close (%s)",d),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",d)},s.prototype.onpacket=function(d){var v=d.nsp===this.nsp,m=d.type===r.ERROR&&d.nsp==="/";if(!(!v&&!m))switch(d.type){case r.CONNECT:this.onconnect();break;case r.EVENT:this.onevent(d);break;case r.BINARY_EVENT:this.onevent(d);break;case r.ACK:this.onack(d);break;case r.BINARY_ACK:this.onack(d);break;case r.DISCONNECT:this.ondisconnect();break;case r.ERROR:this.emit("error",d.data);break}},s.prototype.onevent=function(d){var v=d.data||[];f("emitting event %j",v),d.id!=null&&(f("attaching ack callback to event"),v.push(this.ack(d.id))),this.connected?h.apply(this,v):this.receiveBuffer.push(v)},s.prototype.ack=function(d){var v=this,m=!1;return function(){if(!m){m=!0;var C=a(arguments);f("sending ack %j",C),v.packet({type:o(C)?r.BINARY_ACK:r.ACK,id:d,data:C})}}},s.prototype.onack=function(d){var v=this.acks[d.id];typeof v=="function"?(f("calling ack %s with %j",d.id,d.data),v.apply(this,d.data),delete this.acks[d.id]):f("bad ack %s",d.id)},s.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emitBuffered(),this.emit("connect")},s.prototype.emitBuffered=function(){var d;for(d=0;d<this.receiveBuffer.length;d++)h.apply(this,this.receiveBuffer[d]);for(this.receiveBuffer=[],d=0;d<this.sendBuffer.length;d++)this.packet(this.sendBuffer[d]);this.sendBuffer=[]},s.prototype.ondisconnect=function(){f("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},s.prototype.destroy=function(){if(this.subs){for(var d=0;d<this.subs.length;d++)this.subs[d].destroy();this.subs=null}this.io.destroy(this)},s.prototype.close=s.prototype.disconnect=function(){return this.connected&&(f("performing disconnect (%s)",this.nsp),this.packet({type:r.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},s.prototype.compress=function(d){return this.flags.compress=d,this},s.prototype.binary=function(d){return this.flags.binary=d,this}})(io);var xo=io.exports,h1=Le;function Le(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Le.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+r:e-r}return Math.min(e,this.max)|0};Le.prototype.reset=function(){this.attempts=0};Le.prototype.setMin=function(e){this.ms=e};Le.prototype.setMax=function(e){this.max=e};Le.prototype.setJitter=function(e){this.jitter=e};var l1=c1,p1=xo,b1=Ne,v1=zt,J0=oo,Fe=so,v0=X0("socket.io-client:manager"),co=no,y1=h1,fo=Object.prototype.hasOwnProperty,Za=i0;function i0(e,t){if(!(this instanceof i0))return new i0(e,t);e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new y1({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var r=t.parser||v1;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=t.autoConnect!==!1,this.autoConnect&&this.open()}i0.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var e in this.nsps)fo.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)};i0.prototype.updateSocketIds=function(){for(var e in this.nsps)fo.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))};i0.prototype.generateId=function(e){return(e==="/"?"":e+"#")+this.engine.id};b1(i0.prototype);i0.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection};i0.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts};i0.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay};i0.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor};i0.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax};i0.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout};i0.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()};i0.prototype.open=i0.prototype.connect=function(e,t){if(v0("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;v0("opening %s",this.uri),this.engine=l1(this.uri,this.opts);var r=this.engine,n=this;this.readyState="opening",this.skipReconnect=!1;var a=J0(r,"open",function(){n.onopen(),e&&e()}),i=J0(r,"error",function(p){if(v0("connect_error"),n.cleanup(),n.readyState="closed",n.emitAll("connect_error",p),e){var o=new Error("Connection error");o.data=p,e(o)}else n.maybeReconnectOnOpen()});if(this._timeout!==!1){var c=this._timeout;v0("connect attempt will timeout after %d",c),c===0&&a.destroy();var f=setTimeout(function(){v0("connect attempt timed out after %d",c),a.destroy(),r.close(),r.emit("error","timeout"),n.emitAll("connect_timeout",c)},c);this.subs.push({destroy:function(){clearTimeout(f)}})}return this.subs.push(a),this.subs.push(i),this};i0.prototype.onopen=function(){v0("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(J0(e,"data",Fe(this,"ondata"))),this.subs.push(J0(e,"ping",Fe(this,"onping"))),this.subs.push(J0(e,"pong",Fe(this,"onpong"))),this.subs.push(J0(e,"error",Fe(this,"onerror"))),this.subs.push(J0(e,"close",Fe(this,"onclose"))),this.subs.push(J0(this.decoder,"decoded",Fe(this,"ondecoded")))};i0.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")};i0.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)};i0.prototype.ondata=function(e){this.decoder.add(e)};i0.prototype.ondecoded=function(e){this.emit("packet",e)};i0.prototype.onerror=function(e){v0("error",e),this.emitAll("error",e)};i0.prototype.socket=function(e,t){var r=this.nsps[e];if(!r){r=new p1(this,e,t),this.nsps[e]=r;var n=this;r.on("connecting",a),r.on("connect",function(){r.id=n.generateId(e)}),this.autoConnect&&a()}function a(){~co(n.connecting,r)||n.connecting.push(r)}return r};i0.prototype.destroy=function(e){var t=co(this.connecting,e);~t&&this.connecting.splice(t,1),!this.connecting.length&&this.close()};i0.prototype.packet=function(e){v0("writing packet %j",e);var t=this;e.query&&e.type===0&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,function(r){for(var n=0;n<r.length;n++)t.engine.write(r[n],e.options);t.encoding=!1,t.processPacketQueue()}))};i0.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}};i0.prototype.cleanup=function(){v0("cleanup");for(var e=this.subs.length,t=0;t<e;t++){var r=this.subs.shift();r.destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()};i0.prototype.close=i0.prototype.disconnect=function(){v0("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,this.readyState==="opening"&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()};i0.prototype.onclose=function(e){v0("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",e),this._reconnection&&!this.skipReconnect&&this.reconnect()};i0.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var e=this;if(this.backoff.attempts>=this._reconnectionAttempts)v0("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();v0("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var r=setTimeout(function(){e.skipReconnect||(v0("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),!e.skipReconnect&&e.open(function(n){n?(v0("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",n.data)):(v0("reconnect success"),e.onreconnect())}))},t);this.subs.push({destroy:function(){clearTimeout(r)}})}};i0.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)};(function(e,t){var r=ef,n=zt,a=Za,i=X0("socket.io-client");e.exports=t=f;var c=t.managers={};function f(p,o){typeof p=="object"&&(o=p,p=void 0),o=o||{};var x=r(p),h=x.source,s=x.id,d=x.path,v=c[s]&&d in c[s].nsps,m=o.forceNew||o["force new connection"]||o.multiplex===!1||v,C;return m?(i("ignoring socket cache for %s",h),C=a(h,o)):(c[s]||(i("new io instance for %s",h),c[s]=a(h,o)),C=c[s]),x.query&&!o.query&&(o.query=x.query),C.socket(x.path,o)}t.protocol=n.protocol,t.connect=f,t.Manager=Za,t.Socket=xo})(rn,rn.exports);var g1=rn.exports;const m1=tt(g1),B1=Object.prototype.hasOwnProperty;function Ya(e,t){return B1.call(e,t)}function C1(){return Ya(window,"WebSocket")||Ya(window,"MozWebSocket")}const uo=["message","product","lottery","questionnaire","coupon","activityLottery","testQuestion","emotion","speak","customMessage","motivation"];class _1{constructor(){V(this,"__defaultEventKey","DEFAULT_EVENT");V(this,"__allEventKey","ALL_EVENT");V(this,"__appSocketEventStore",{});V(this,"__socketListens",{});for(const t of uo)this.__socketListens[t]=this.__createSocketHandle(t)}__createSocketHandle(t){return r=>{try{if(r instanceof ArrayBuffer)return;const n=JSON.parse(r);if(n){const a=c=>{for(const f in this.__appSocketEventStore){const p=`${t}.${c}`;f.includes(p)&&this.__appSocketEventStore[f].forEach(x=>{x(n)})}},i=n.EVENT||this.__defaultEventKey;a(i),a(this.__allEventKey)}}catch(n){console.warn(n)}}}listenSocketEvent(t){return Q(this,null,function*(){for(const r in this.__socketListens){const n=this.__socketListens[r];if(!n)return;t.on(r,n)}})}addSocketHandles(t,r,n){const a=(i,c)=>{const f=`${t}.${n}.${i}`;this.__appSocketEventStore[f]||(this.__appSocketEventStore[f]=[]),this.__appSocketEventStore[f].push(c)};if(typeof r=="function"){a(this.__allEventKey,r);return}for(const i in r)a(i,r[i])}}class E1{constructor(t){V(this,"eventEmitter",new Lc);V(this,"__eventStore",new _1);V(this,"__socket");this.config=t}_afterConnect(){}getToken(){return Promise.resolve(this.config.token)}getChannelInfo(){return Promise.resolve(this.config.channelInfo)}getUserInfo(){return typeof this.config.userInfo=="function"?this.config.userInfo():this.config.userInfo}getSocket(t=!0){if(t&&!this.__socket)throw new Error("Socket 连接未初始化");return this.__socket}_initSocket(){return new Promise(t=>{Q(this,null,function*(){const r=vn(this.config.domainInfo).chatWsDomain,n=[2e3,3e3,4e3,5e3],a=yield this.getToken();this.config.customSocket?this.__socket=this.config.customSocket:this.__socket=m1(Sx(r),{query:{token:a,version:this.config.socketVersion||"3.0"},transports:[C1()?"websocket":"polling"],reconnectionDelay:n[Math.floor(Math.random()*n.length)],randomizationFactor:Math.random()}),this.__bindConnectEvent(),this.__eventStore.listenSocketEvent(this.__socket),t()})})}_connectSocket(){return new Promise(t=>{const r=this.getSocket(),n=()=>{t()};r.disconnected&&(r.once("connect",n),r.connect()),r.connected&&n()})}__bindConnectEvent(){const t=this.getSocket(),r={connect:()=>{this._afterConnect(),this.eventEmitter.emit(H0.ConnectSuccess)},disconnect:()=>{this.eventEmitter.emit(H0.Disconnect)},reconnect:()=>{this.eventEmitter.emit(H0.ReconnectSuccess)},error:()=>{this.eventEmitter.emit(H0.ConnectFailed,{reason:Re.SocketConnectError})},connect_error:()=>{this.eventEmitter.emit(H0.ConnectFailed,{reason:Re.SocketConnectError})},connect_timeout:()=>{this.eventEmitter.emit(H0.ConnectFailed,{reason:Re.SocketConnectTimeout})}};for(const n in r)t.on(n,r[n])}emitSocket(t,r="message",n){return new Promise((a,i)=>{Q(this,null,function*(){const{checkCode:c=!0,directCallback:f=!1}=n||{},p=this.getSocket(),o=(...x)=>{if(f){a(x);return}const h=x[0];let s=h;if(h instanceof ArrayBuffer)return;let d=h;if(typeof h=="string")try{d=JSON.parse(h)}catch(v){}if(typeof h=="object"&&(d=h),d&&typeof d.code=="number"&&c)if(d.code===200)s=d.data;else{i(d);return}else s=d;a(s)};p==null||p.emit(r,JSON.stringify(t),o)})})}addSocketHandles(t,r,n="message"){this.__eventStore.addSocketHandles(t,r,n)}disconnect(){return new Promise(t=>{const r=this.getSocket();if(r.disconnected){t();return}r.once("disconnect",()=>{t()}),r.disconnect()})}}class F1 extends E1{constructor(r){super(r);V(this,"ConnectFailReason",Re);V(this,"SocketUserType",L0);V(this,"PolyvSocketEvent",H0);V(this,"chatApi",new Ix(this));V(this,"polyvApi",new zc(this))}setup(){return Q(this,null,function*(){yield this._initSocket(),this.config.customSocket||(yield this._connectSocket())})}_afterConnect(){const{autoLogin:r=!0}=this.config;r&&this.loginSocket()}loginSocket(){return Q(this,null,function*(){const r=this.getUserInfo(),n=yield this.getChannelInfo(),a=this.config.statisticsParams,i={EVENT:"LOGIN",values:[r.nick,r.pic,r.userId],channelId:String(n.channelId),roomId:String(n.channelId),type:r.userType};n.sessionId&&(i.sessionId=n.sessionId),(a!=null&&a.param4||r.wxUnionId)&&(i.param4=a==null?void 0:a.param4),a!=null&&a.param5&&(i.param5=a.param5),r.actor&&(i.actor=r.actor);const f=(yield this.emitSocket(i,"message",{directCallback:!0}))[0];String(f)[0]==="2"?this.eventEmitter.emit(H0.LoginSuccess,{code:f}):this.eventEmitter.emit(H0.LoginFailed,{code:f})})}isSpecialUserType(r,n){return r===L0.Dummy?!!n&&["主讲","讲师","嘉宾","助教","管理员"].includes(n):[L0.Teacher,L0.Manager,L0.Guest,L0.Assistant,L0.Attendee,L0.UserTagsMonitor].includes(r)}isCurrentUser(r){return this.getUserInfo().userId===r}}exports.ConnectFailReason=Re;exports.PolyvSocket=F1;exports.PolyvSocketEvent=H0;exports.RequestAuthorizeMethod=Xe;exports.SecurityMode=Pt;exports.SocketUserType=L0;exports.socketEventTypes=uo;console.log("%c@polyv/socket","background:#67C23A;padding: 2px 6px;border-radius: 3px;color: #fff","[version: 2.1.0-rc-20251023.2]","[buildTime: 2025-10-22 01:22:16]");
|
package/index.es.js
CHANGED
|
@@ -11135,8 +11135,8 @@ class T1 extends F1 {
|
|
|
11135
11135
|
console.log(
|
|
11136
11136
|
"%c@polyv/socket",
|
|
11137
11137
|
"background:#67C23A;padding: 2px 6px;border-radius: 3px;color: #fff",
|
|
11138
|
-
"[version: 2.1.0-rc-20251023.
|
|
11139
|
-
"[buildTime: 2025-10-
|
|
11138
|
+
"[version: 2.1.0-rc-20251023.2]",
|
|
11139
|
+
"[buildTime: 2025-10-22 01:22:15]"
|
|
11140
11140
|
);
|
|
11141
11141
|
export {
|
|
11142
11142
|
Xe as ConnectFailReason,
|
package/index.umd.js
CHANGED
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
19
19
|
* @license MIT
|
|
20
20
|
*/var Ls=function(e){return e!=null&&(Ja(e)||$s(e)||!!e._isBuffer)};function Ja(e){return!!e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function $s(e){return typeof e.readFloatLE=="function"&&typeof e.slice=="function"&&Ja(e.slice(0,0))}(function(){var e=zs,t=Qa.utf8,r=Ls,n=Qa.bin,a=function(i,c){i.constructor==String?c&&c.encoding==="binary"?i=n.stringToBytes(i):i=t.stringToBytes(i):r(i)?i=Array.prototype.slice.call(i,0):!Array.isArray(i)&&i.constructor!==Uint8Array&&(i=i.toString());for(var f=e.bytesToWords(i),p=i.length*8,o=1732584193,x=-271733879,h=-1732584194,s=271733878,d=0;d<f.length;d++)f[d]=(f[d]<<8|f[d]>>>24)&16711935|(f[d]<<24|f[d]>>>8)&4278255360;f[p>>>5]|=128<<p%32,f[(p+64>>>9<<4)+14]=p;for(var v=a._ff,m=a._gg,C=a._hh,E=a._ii,d=0;d<f.length;d+=16){var y=o,B=x,b=h,F=s;o=v(o,x,h,s,f[d+0],7,-680876936),s=v(s,o,x,h,f[d+1],12,-389564586),h=v(h,s,o,x,f[d+2],17,606105819),x=v(x,h,s,o,f[d+3],22,-1044525330),o=v(o,x,h,s,f[d+4],7,-176418897),s=v(s,o,x,h,f[d+5],12,1200080426),h=v(h,s,o,x,f[d+6],17,-1473231341),x=v(x,h,s,o,f[d+7],22,-45705983),o=v(o,x,h,s,f[d+8],7,1770035416),s=v(s,o,x,h,f[d+9],12,-1958414417),h=v(h,s,o,x,f[d+10],17,-42063),x=v(x,h,s,o,f[d+11],22,-1990404162),o=v(o,x,h,s,f[d+12],7,1804603682),s=v(s,o,x,h,f[d+13],12,-40341101),h=v(h,s,o,x,f[d+14],17,-1502002290),x=v(x,h,s,o,f[d+15],22,1236535329),o=m(o,x,h,s,f[d+1],5,-165796510),s=m(s,o,x,h,f[d+6],9,-1069501632),h=m(h,s,o,x,f[d+11],14,643717713),x=m(x,h,s,o,f[d+0],20,-373897302),o=m(o,x,h,s,f[d+5],5,-701558691),s=m(s,o,x,h,f[d+10],9,38016083),h=m(h,s,o,x,f[d+15],14,-660478335),x=m(x,h,s,o,f[d+4],20,-405537848),o=m(o,x,h,s,f[d+9],5,568446438),s=m(s,o,x,h,f[d+14],9,-1019803690),h=m(h,s,o,x,f[d+3],14,-187363961),x=m(x,h,s,o,f[d+8],20,1163531501),o=m(o,x,h,s,f[d+13],5,-1444681467),s=m(s,o,x,h,f[d+2],9,-51403784),h=m(h,s,o,x,f[d+7],14,1735328473),x=m(x,h,s,o,f[d+12],20,-1926607734),o=C(o,x,h,s,f[d+5],4,-378558),s=C(s,o,x,h,f[d+8],11,-2022574463),h=C(h,s,o,x,f[d+11],16,1839030562),x=C(x,h,s,o,f[d+14],23,-35309556),o=C(o,x,h,s,f[d+1],4,-1530992060),s=C(s,o,x,h,f[d+4],11,1272893353),h=C(h,s,o,x,f[d+7],16,-155497632),x=C(x,h,s,o,f[d+10],23,-1094730640),o=C(o,x,h,s,f[d+13],4,681279174),s=C(s,o,x,h,f[d+0],11,-358537222),h=C(h,s,o,x,f[d+3],16,-722521979),x=C(x,h,s,o,f[d+6],23,76029189),o=C(o,x,h,s,f[d+9],4,-640364487),s=C(s,o,x,h,f[d+12],11,-421815835),h=C(h,s,o,x,f[d+15],16,530742520),x=C(x,h,s,o,f[d+2],23,-995338651),o=E(o,x,h,s,f[d+0],6,-198630844),s=E(s,o,x,h,f[d+7],10,1126891415),h=E(h,s,o,x,f[d+14],15,-1416354905),x=E(x,h,s,o,f[d+5],21,-57434055),o=E(o,x,h,s,f[d+12],6,1700485571),s=E(s,o,x,h,f[d+3],10,-1894986606),h=E(h,s,o,x,f[d+10],15,-1051523),x=E(x,h,s,o,f[d+1],21,-2054922799),o=E(o,x,h,s,f[d+8],6,1873313359),s=E(s,o,x,h,f[d+15],10,-30611744),h=E(h,s,o,x,f[d+6],15,-1560198380),x=E(x,h,s,o,f[d+13],21,1309151649),o=E(o,x,h,s,f[d+4],6,-145523070),s=E(s,o,x,h,f[d+11],10,-1120210379),h=E(h,s,o,x,f[d+2],15,718787259),x=E(x,h,s,o,f[d+9],21,-343485551),o=o+y>>>0,x=x+B>>>0,h=h+b>>>0,s=s+F>>>0}return e.endian([o,x,h,s])};a._ff=function(i,c,f,p,o,x,h){var s=i+(c&f|~c&p)+(o>>>0)+h;return(s<<x|s>>>32-x)+c},a._gg=function(i,c,f,p,o,x,h){var s=i+(c&p|f&~p)+(o>>>0)+h;return(s<<x|s>>>32-x)+c},a._hh=function(i,c,f,p,o,x,h){var s=i+(c^f^p)+(o>>>0)+h;return(s<<x|s>>>32-x)+c},a._ii=function(i,c,f,p,o,x,h){var s=i+(f^(c|~p))+(o>>>0)+h;return(s<<x|s>>>32-x)+c},a._blocksize=16,a._digestsize=16,Za.exports=function(i,c){if(i==null)throw new Error("Illegal argument "+i);var f=e.wordsToBytes(a(i,c));return c&&c.asBytes?f:c&&c.asString?n.bytesToString(f):e.bytesToHex(f)}})();var Ks=Za.exports;const pt=Ze(Ks),bt=/^(?:([a-z]+):)?\/{2,3}/i;function Ws(e,t){return bt.test(e)}function ei(e,t){return bt.test(t)||(t+="://"),Ws(e)?e.replace(bt,t):t+e}function js(e){return e.replace(bt,"")}var ti={exports:{}},Xr={exports:{}},ri;function Xs(){return ri||(ri=1,function(e){(function(t){var r={bytesToHex:function(i){return n(i)},hexToBytes:function(i){if(i.length%2===1)throw new Error("hexToBytes can't have a string with an odd number of characters.");return i.indexOf("0x")===0&&(i=i.slice(2)),i.match(/../g).map(function(c){return parseInt(c,16)})}};function n(i){return i.map(function(c){return a(c.toString(16),2)}).join("")}function a(i,c){return i.length>c?i:Array(c-i.length+1).join("0")+i}e.exports?e.exports=r:t.convertHex=r})(G)}(Xr)),Xr.exports}var Vr={exports:{}},ni;function Vs(){return ni||(ni=1,function(e){(function(t){var r={bytesToString:function(n){return n.map(function(a){return String.fromCharCode(a)}).join("")},stringToBytes:function(n){return n.split("").map(function(a){return a.charCodeAt(0)})}};r.UTF8={bytesToString:function(n){return decodeURIComponent(escape(r.bytesToString(n)))},stringToBytes:function(n){return r.stringToBytes(unescape(encodeURIComponent(n)))}},e.exports?e.exports=r:t.convertString=r})(G)}(Vr)),Vr.exports}(function(e){(function(t){var r={};e.exports?(r.bytesToHex=Xs().bytesToHex,r.convertString=Vs(),e.exports=p):(r.bytesToHex=t.convertHex.bytesToHex,r.convertString=t.convertString,t.sha256=p);var n=[];(function(){function o(d){for(var v=Math.sqrt(d),m=2;m<=v;m++)if(!(d%m))return!1;return!0}function x(d){return(d-(d|0))*4294967296|0}for(var h=2,s=0;s<64;)o(h)&&(n[s]=x(Math.pow(h,1/3)),s++),h++})();var a=function(o){for(var x=[],h=0,s=0;h<o.length;h++,s+=8)x[s>>>5]|=o[h]<<24-s%32;return x},i=function(o){for(var x=[],h=0;h<o.length*32;h+=8)x.push(o[h>>>5]>>>24-h%32&255);return x},c=[],f=function(o,x,h){for(var s=o[0],d=o[1],v=o[2],m=o[3],C=o[4],E=o[5],y=o[6],B=o[7],b=0;b<64;b++){if(b<16)c[b]=x[h+b]|0;else{var F=c[b-15],D=(F<<25|F>>>7)^(F<<14|F>>>18)^F>>>3,T=c[b-2],P=(T<<15|T>>>17)^(T<<13|T>>>19)^T>>>10;c[b]=D+c[b-7]+P+c[b-16]}var H=C&E^~C&y,S=s&d^s&v^d&v,A=(s<<30|s>>>2)^(s<<19|s>>>13)^(s<<10|s>>>22),q=(C<<26|C>>>6)^(C<<21|C>>>11)^(C<<7|C>>>25),N=B+q+H+n[b]+c[b],z=A+S;B=y,y=E,E=C,C=m+N|0,m=v,v=d,d=s,s=N+z|0}o[0]=o[0]+s|0,o[1]=o[1]+d|0,o[2]=o[2]+v|0,o[3]=o[3]+m|0,o[4]=o[4]+C|0,o[5]=o[5]+E|0,o[6]=o[6]+y|0,o[7]=o[7]+B|0};function p(o,x){o.constructor===String&&(o=r.convertString.UTF8.stringToBytes(o));var h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],s=a(o),d=o.length*8;s[d>>5]|=128<<24-d%32,s[(d+64>>9<<4)+15]=d;for(var v=0;v<s.length;v+=16)f(h,s,v);var m=i(h);return x&&x.asBytes?m:x&&x.asString?r.convertString.bytesToString(m):r.bytesToHex(m)}p.x2=function(o,x){return p(p(o,{asBytes:!0}),x)}})(G)})(ti);var Gs=ti.exports;const ai=Ze(Gs);function Zs(e,t,r){const n=Object.keys(e).filter(i=>i!=="sign").sort();let a="";return n.forEach(i=>{let c=e[i];typeof c=="object"&&(c=JSON.stringify(c)),a+=i+c}),r||(r=String(e.signatureMethod).toLowerCase()==="sha256"?"sha256":"md5"),(r==="sha256"?ai:pt)(t+a+t).toString().toUpperCase()}class Ys extends Mn{constructor(t){super({baseUrl:ei(Wr(t.config.domainInfo).chatApiDomain,"https"),requestPlugins:[new Un({getTokenInfo:()=>Q(this,null,function*(){const r=yield t.getToken();if(!r)return;let n=de.Params,a="token";const i=t.getUserInfo();return t.isSpecialUserType(i.userType)&&(n=de.Header,a="authorization"),{token:r,tokenField:a,tokenMode:n}})}),new nr({globalParams:r=>Q(this,null,function*(){const{appendChannelId:n=!0,appendAccountId:a=!1,appendUserId:i=!0}=r,c={};if(n||a){const f=yield t.getChannelInfo();n&&(c.channelId=f.channelId),a&&(c.accountId=f.accountId)}if(i){const f=t.getUserInfo();c.userId=f.userId}return c})}),new zn({successCode:200}),new nr({globalParams:r=>Q(this,null,function*(){const{appendSign:n=!1}=r;if(n)return{sign:yield this.getRoomSign()};const{appendChatSign:a=!1}=r;if(a){const i=r.params||{};return{sign:yield this.getChatSign(i)}}return{}})}),new Xa({getDecryptInfo:r=>{const n=r.params||{};return{decryptKeys:{sign:Zs(n,"polyvChatClient"),iv:""},decryptPosition:De.WholeResponse}}})]}),this._plvSocket=t}getRoomSign(){return Q(this,null,function*(){const t=yield this._plvSocket.getChannelInfo();return pt(`polyv_room_sign${t.channelId}`)})}getChatSign(t){return Q(this,null,function*(){let r=Object.keys(t).sort((a,i)=>{a=a.toLocaleLowerCase(),i=i.toLocaleLowerCase();for(let c=0;c<a.length&&c<i.length;c++){const f=a.charCodeAt(c)-i.charCodeAt(c);if(f!==0)return f}return a.length>i.length?1:-1}).reduce((a,i)=>{let c=t[i];return!c&&c!==0?a:(typeof c=="object"&&(c=JSON.stringify(c)),`${a}${i}${c}`)},"");return pt("polyvChatSign"+r+"polyvChatSign").toLocaleUpperCase()})}}var Qe=(e=>(e.Token="token",e.Sign="sign",e))(Qe||{}),vt=(e=>(e.None="none",e.AES="aes",e.SM2="sm2",e))(vt||{});let yt;const Qs=new Uint8Array(16);function Js(){if(!yt&&(yt=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!yt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return yt(Qs)}const y0=[];for(let e=0;e<256;++e)y0.push((e+256).toString(16).slice(1));function ex(e,t=0){return y0[e[t+0]]+y0[e[t+1]]+y0[e[t+2]]+y0[e[t+3]]+"-"+y0[e[t+4]]+y0[e[t+5]]+"-"+y0[e[t+6]]+y0[e[t+7]]+"-"+y0[e[t+8]]+y0[e[t+9]]+"-"+y0[e[t+10]]+y0[e[t+11]]+y0[e[t+12]]+y0[e[t+13]]+y0[e[t+14]]+y0[e[t+15]]}const ii={randomUUID:typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function tx(e,t,r){if(ii.randomUUID&&!e)return ii.randomUUID();e=e||{};const n=e.random||(e.rng||Js)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,ex(n)}n0.SignatureMethod=void 0,function(e){e.MD5="MD5",e.SHA256="SHA256"}(n0.SignatureMethod||(n0.SignatureMethod={}));function rx(e){let t="";const r=Object.keys(e).sort();for(const n of r)e[n]&&(t+=`${n}${e[n]}`);return t}function nx(e,t,r=n0.SignatureMethod.MD5){const n=rx(e),a=t+n+t;return(r===n0.SignatureMethod.MD5?pt(a):ai(a)).toUpperCase()}class ax{constructor(t){V(this,"__config");V(this,"__appId");V(this,"__appSecret");V(this,"__signatureNonce");V(this,"__signatureMethod");V(this,"__getAppSign");var r,n;this.__config=t,this.__appId=t.appId||"",this.__appSecret=t.appSecret||"",this.__signatureNonce=(r=t.signatureNonce)!=null?r:!1,this.__signatureMethod=(n=t.signatureMethod)!=null?n:n0.SignatureMethod.MD5,this.__getAppSign=t.getAppSign}usePlugin(t){const{useAppSign:r=!0}=t;return r}interceptIncludeParams(t){const{signatureNonce:r=this.__signatureNonce,signatureMethod:n=this.__signatureMethod}=t,a={};return r&&(a.signatureNonce=tx()),n&&(a.signatureMethod=n),a}interceptAuthorizeRequest(t){return Q(this,null,function*(){const r=o0({},t.params||{}),n=yield this.__getAppSignData(r,t);return n?(r.appId=n.appId,r.timestamp=n.timestamp,r.sign=n.sign,n.signatureMethod&&(r.signatureMethod=n.signatureMethod)):console.error("AuthorizeAppSignRequestPlugin error, signData is undefined"),Y0(o0({},t),{params:r})})}__getAppSignData(t,r){return Q(this,null,function*(){const{signatureMethod:n=this.__signatureMethod}=r;if(this.__getAppSign)return yield this.__getAppSign({params:t,signatureMethod:n});if(this.__appId&&this.__appSecret){const a=Date.now(),i=Y0(o0({},t),{appId:this.__appId,timestamp:a}),c=nx(i,this.__appSecret,n);return{appId:this.__appId,timestamp:a,sign:c,signatureMethod:n}}})}}const ix=V0("S0xmTzdabmZRQzhqSXZFWA=="),ox=V0("VlRSZTdTbWRsbFJzSjdDYg=="),sx=V0("UG9seXZBcGlSZXNwb25zZQ=="),xx=V0("UG9seXZMaXZlRW5jcnlwdA==");function cx(e,t){const{sign:r,iv:n}=t,a=R0.enc.Utf8.parse(r),i=R0.enc.Utf8.parse(e);return R0.AES.encrypt(i,a,{iv:R0.enc.Utf8.parse(n),mode:R0.mode.CBC,padding:R0.pad.Pkcs7}).toString()}class fx{constructor(t={}){V(this,"__config");V(this,"__encryptPostAES");var r;this.__config=t,this.__encryptPostAES=(r=t.encryptPostAES)!=null?r:!0}usePlugin(t){const{useAES:r=!0}=t;return r}interceptIncludeParams(){return{encryptResponseType:1}}interceptEncryptRequest(t){const r=this.__handleData(t),n=this.__handleHeaders(t);return Y0(o0({},t),{data:r,headers:n})}interceptDecryptResponse(t){const r=t.data;if(!r.encryption||typeof r.data!="string")return t;const n=r.data,a=this.__getDecryptKeyInfo();return r.data=Kr(n,a,we.Base64),t}__handleHeaders(t){var a;const r=t.headers||{},{encryptPostAES:n=this.__encryptPostAES}=t;return((a=t.method)==null?void 0:a.toLocaleUpperCase())==="POST"&&n&&(r["x-e-type"]=1),r}__handleData(t){var i;const r=t.data||{};if(((i=t.method)==null?void 0:i.toLocaleUpperCase())!=="POST")return r;let n=r;const{encryptPostAES:a=this.__encryptPostAES}=t;if(a){t.requestType="json";let c="";typeof r=="string"?c=r:typeof r=="object"&&(c=JSON.stringify(r));const f=this.__getEncryptKeyInfo(t);n=cx(c,f)}return n}__getDecryptKeyInfo(){return{sign:sx,iv:xx}}__getEncryptKeyInfo(t){const r=t.params||{};let n=ix;return"appId"in r&&r.appId===this.__config.appId&&this.__config.appSecret&&(n=this.__config.appSecret),{sign:n,iv:ox}}}var oi={exports:{}};(function(e,t){(function(){var r,n=0xdeadbeefcafe,a=(n&16777215)==15715070;function i(u,l,g){u!=null&&(typeof u=="number"?this.fromNumber(u,l,g):l==null&&typeof u!="string"?this.fromString(u,256):this.fromString(u,l))}function c(){return new i(null)}function f(u,l,g,R,M,U){for(;--U>=0;){var $=l*this[u++]+g[R]+M;M=Math.floor($/67108864),g[R++]=$&67108863}return M}function p(u,l,g,R,M,U){for(var $=l&32767,K=l>>15;--U>=0;){var c0=this[u]&32767,b0=this[u++]>>15,q0=K*c0+b0*$;c0=$*c0+((q0&32767)<<15)+g[R]+(M&1073741823),M=(c0>>>30)+(q0>>>15)+K*b0+(M>>>30),g[R++]=c0&1073741823}return M}function o(u,l,g,R,M,U){for(var $=l&16383,K=l>>14;--U>=0;){var c0=this[u]&16383,b0=this[u++]>>14,q0=K*c0+b0*$;c0=$*c0+((q0&16383)<<14)+g[R]+M,M=(c0>>28)+(q0>>14)+K*b0,g[R++]=c0&268435455}return M}var x=typeof navigator!="undefined";x&&a&&navigator.appName=="Microsoft Internet Explorer"?(i.prototype.am=p,r=30):x&&a&&navigator.appName!="Netscape"?(i.prototype.am=f,r=26):(i.prototype.am=o,r=28),i.prototype.DB=r,i.prototype.DM=(1<<r)-1,i.prototype.DV=1<<r;var h=52;i.prototype.FV=Math.pow(2,h),i.prototype.F1=h-r,i.prototype.F2=2*r-h;var s="0123456789abcdefghijklmnopqrstuvwxyz",d=new Array,v,m;for(v=48,m=0;m<=9;++m)d[v++]=m;for(v=97,m=10;m<36;++m)d[v++]=m;for(v=65,m=10;m<36;++m)d[v++]=m;function C(u){return s.charAt(u)}function E(u,l){var g=d[u.charCodeAt(l)];return g==null?-1:g}function y(u){for(var l=this.t-1;l>=0;--l)u[l]=this[l];u.t=this.t,u.s=this.s}function B(u){this.t=1,this.s=u<0?-1:0,u>0?this[0]=u:u<-1?this[0]=u+this.DV:this.t=0}function b(u){var l=c();return l.fromInt(u),l}function F(u,l){var g;if(l==16)g=4;else if(l==8)g=3;else if(l==256)g=8;else if(l==2)g=1;else if(l==32)g=5;else if(l==4)g=2;else{this.fromRadix(u,l);return}this.t=0,this.s=0;for(var R=u.length,M=!1,U=0;--R>=0;){var $=g==8?u[R]&255:E(u,R);if($<0){u.charAt(R)=="-"&&(M=!0);continue}M=!1,U==0?this[this.t++]=$:U+g>this.DB?(this[this.t-1]|=($&(1<<this.DB-U)-1)<<U,this[this.t++]=$>>this.DB-U):this[this.t-1]|=$<<U,U+=g,U>=this.DB&&(U-=this.DB)}g==8&&u[0]&128&&(this.s=-1,U>0&&(this[this.t-1]|=(1<<this.DB-U)-1<<U)),this.clamp(),M&&i.ZERO.subTo(this,this)}function D(){for(var u=this.s&this.DM;this.t>0&&this[this.t-1]==u;)--this.t}function T(u){if(this.s<0)return"-"+this.negate().toString(u);var l;if(u==16)l=4;else if(u==8)l=3;else if(u==2)l=1;else if(u==32)l=5;else if(u==4)l=2;else return this.toRadix(u);var g=(1<<l)-1,R,M=!1,U="",$=this.t,K=this.DB-$*this.DB%l;if($-- >0)for(K<this.DB&&(R=this[$]>>K)>0&&(M=!0,U=C(R));$>=0;)K<l?(R=(this[$]&(1<<K)-1)<<l-K,R|=this[--$]>>(K+=this.DB-l)):(R=this[$]>>(K-=l)&g,K<=0&&(K+=this.DB,--$)),R>0&&(M=!0),M&&(U+=C(R));return M?U:"0"}function P(){var u=c();return i.ZERO.subTo(this,u),u}function H(){return this.s<0?this.negate():this}function S(u){var l=this.s-u.s;if(l!=0)return l;var g=this.t;if(l=g-u.t,l!=0)return this.s<0?-l:l;for(;--g>=0;)if((l=this[g]-u[g])!=0)return l;return 0}function A(u){var l=1,g;return(g=u>>>16)!=0&&(u=g,l+=16),(g=u>>8)!=0&&(u=g,l+=8),(g=u>>4)!=0&&(u=g,l+=4),(g=u>>2)!=0&&(u=g,l+=2),(g=u>>1)!=0&&(u=g,l+=1),l}function q(){return this.t<=0?0:this.DB*(this.t-1)+A(this[this.t-1]^this.s&this.DM)}function N(u,l){var g;for(g=this.t-1;g>=0;--g)l[g+u]=this[g];for(g=u-1;g>=0;--g)l[g]=0;l.t=this.t+u,l.s=this.s}function z(u,l){for(var g=u;g<this.t;++g)l[g-u]=this[g];l.t=Math.max(this.t-u,0),l.s=this.s}function L(u,l){var g=u%this.DB,R=this.DB-g,M=(1<<R)-1,U=Math.floor(u/this.DB),$=this.s<<g&this.DM,K;for(K=this.t-1;K>=0;--K)l[K+U+1]=this[K]>>R|$,$=(this[K]&M)<<g;for(K=U-1;K>=0;--K)l[K]=0;l[U]=$,l.t=this.t+U+1,l.s=this.s,l.clamp()}function X(u,l){l.s=this.s;var g=Math.floor(u/this.DB);if(g>=this.t){l.t=0;return}var R=u%this.DB,M=this.DB-R,U=(1<<R)-1;l[0]=this[g]>>R;for(var $=g+1;$<this.t;++$)l[$-g-1]|=(this[$]&U)<<M,l[$-g]=this[$]>>R;R>0&&(l[this.t-g-1]|=(this.s&U)<<M),l.t=this.t-g,l.clamp()}function Y(u,l){for(var g=0,R=0,M=Math.min(u.t,this.t);g<M;)R+=this[g]-u[g],l[g++]=R&this.DM,R>>=this.DB;if(u.t<this.t){for(R-=u.s;g<this.t;)R+=this[g],l[g++]=R&this.DM,R>>=this.DB;R+=this.s}else{for(R+=this.s;g<u.t;)R-=u[g],l[g++]=R&this.DM,R>>=this.DB;R-=u.s}l.s=R<0?-1:0,R<-1?l[g++]=this.DV+R:R>0&&(l[g++]=R),l.t=g,l.clamp()}function r0(u,l){var g=this.abs(),R=u.abs(),M=g.t;for(l.t=M+R.t;--M>=0;)l[M]=0;for(M=0;M<R.t;++M)l[M+g.t]=g.am(0,R[M],l,M,0,g.t);l.s=0,l.clamp(),this.s!=u.s&&i.ZERO.subTo(l,l)}function s0(u){for(var l=this.abs(),g=u.t=2*l.t;--g>=0;)u[g]=0;for(g=0;g<l.t-1;++g){var R=l.am(g,l[g],u,2*g,0,1);(u[g+l.t]+=l.am(g+1,2*l[g],u,2*g+1,R,l.t-g-1))>=l.DV&&(u[g+l.t]-=l.DV,u[g+l.t+1]=1)}u.t>0&&(u[u.t-1]+=l.am(g,l[g],u,2*g,0,1)),u.s=0,u.clamp()}function i0(u,l,g){var R=u.abs();if(!(R.t<=0)){var M=this.abs();if(M.t<R.t){l!=null&&l.fromInt(0),g!=null&&this.copyTo(g);return}g==null&&(g=c());var U=c(),$=this.s,K=u.s,c0=this.DB-A(R[R.t-1]);c0>0?(R.lShiftTo(c0,U),M.lShiftTo(c0,g)):(R.copyTo(U),M.copyTo(g));var b0=U.t,q0=U[b0-1];if(q0!=0){var k0=q0*(1<<this.F1)+(b0>1?U[b0-2]>>this.F2:0),Z0=this.FV/k0,Zt=(1<<this.F1)/k0,z0=1<<this.F2,L0=g.t,Yt=L0-b0,fe=l==null?c():l;for(U.dlShiftTo(Yt,fe),g.compareTo(fe)>=0&&(g[g.t++]=1,g.subTo(fe,g)),i.ONE.dlShiftTo(b0,fe),fe.subTo(U,U);U.t<b0;)U[U.t++]=0;for(;--Yt>=0;){var qn=g[--L0]==q0?this.DM:Math.floor(g[L0]*Z0+(g[L0-1]+z0)*Zt);if((g[L0]+=U.am(0,qn,g,Yt,0,b0))<qn)for(U.dlShiftTo(Yt,fe),g.subTo(fe,g);g[L0]<--qn;)g.subTo(fe,g)}l!=null&&(g.drShiftTo(b0,l),$!=K&&i.ZERO.subTo(l,l)),g.t=b0,g.clamp(),c0>0&&g.rShiftTo(c0,g),$<0&&i.ZERO.subTo(g,g)}}}function _(u){var l=c();return this.abs().divRemTo(u,null,l),this.s<0&&l.compareTo(i.ZERO)>0&&u.subTo(l,l),l}function w(u){this.m=u}function I(u){return u.s<0||u.compareTo(this.m)>=0?u.mod(this.m):u}function k(u){return u}function O(u){u.divRemTo(this.m,null,u)}function W(u,l,g){u.multiplyTo(l,g),this.reduce(g)}function t0(u,l){u.squareTo(l),this.reduce(l)}w.prototype.convert=I,w.prototype.revert=k,w.prototype.reduce=O,w.prototype.mulTo=W,w.prototype.sqrTo=t0;function j(){if(this.t<1)return 0;var u=this[0];if(!(u&1))return 0;var l=u&3;return l=l*(2-(u&15)*l)&15,l=l*(2-(u&255)*l)&255,l=l*(2-((u&65535)*l&65535))&65535,l=l*(2-u*l%this.DV)%this.DV,l>0?this.DV-l:-l}function x0(u){this.m=u,this.mp=u.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<u.DB-15)-1,this.mt2=2*u.t}function g0(u){var l=c();return u.abs().dlShiftTo(this.m.t,l),l.divRemTo(this.m,null,l),u.s<0&&l.compareTo(i.ZERO)>0&&this.m.subTo(l,l),l}function F0(u){var l=c();return u.copyTo(l),this.reduce(l),l}function ye(u){for(;u.t<=this.mt2;)u[u.t++]=0;for(var l=0;l<this.m.t;++l){var g=u[l]&32767,R=g*this.mpl+((g*this.mph+(u[l]>>15)*this.mpl&this.um)<<15)&u.DM;for(g=l+this.m.t,u[g]+=this.m.am(0,R,u,l,0,this.m.t);u[g]>=u.DV;)u[g]-=u.DV,u[++g]++}u.clamp(),u.drShiftTo(this.m.t,u),u.compareTo(this.m)>=0&&u.subTo(this.m,u)}function w0(u,l){u.squareTo(l),this.reduce(l)}function C0(u,l,g){u.multiplyTo(l,g),this.reduce(g)}x0.prototype.convert=g0,x0.prototype.revert=F0,x0.prototype.reduce=ye,x0.prototype.mulTo=C0,x0.prototype.sqrTo=w0;function We(){return(this.t>0?this[0]&1:this.s)==0}function ge(u,l){if(u>4294967295||u<1)return i.ONE;var g=c(),R=c(),M=l.convert(this),U=A(u)-1;for(M.copyTo(g);--U>=0;)if(l.sqrTo(g,R),(u&1<<U)>0)l.mulTo(R,M,g);else{var $=g;g=R,R=$}return l.revert(g)}function je(u,l){var g;return u<256||l.isEven()?g=new w(l):g=new x0(l),this.exp(u,g)}i.prototype.copyTo=y,i.prototype.fromInt=B,i.prototype.fromString=F,i.prototype.clamp=D,i.prototype.dlShiftTo=N,i.prototype.drShiftTo=z,i.prototype.lShiftTo=L,i.prototype.rShiftTo=X,i.prototype.subTo=Y,i.prototype.multiplyTo=r0,i.prototype.squareTo=s0,i.prototype.divRemTo=i0,i.prototype.invDigit=j,i.prototype.isEven=We,i.prototype.exp=ge,i.prototype.toString=T,i.prototype.negate=P,i.prototype.abs=H,i.prototype.compareTo=S,i.prototype.bitLength=q,i.prototype.mod=_,i.prototype.modPowInt=je,i.ZERO=b(0),i.ONE=b(1);function me(){var u=c();return this.copyTo(u),u}function it(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function Be(){return this.t==0?this.s:this[0]<<24>>24}function S0(){return this.t==0?this.s:this[0]<<16>>16}function A0(u){return Math.floor(Math.LN2*this.DB/Math.log(u))}function W0(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function Xe(u){if(u==null&&(u=10),this.signum()==0||u<2||u>36)return"0";var l=this.chunkSize(u),g=Math.pow(u,l),R=b(g),M=c(),U=c(),$="";for(this.divRemTo(R,M,U);M.signum()>0;)$=(g+U.intValue()).toString(u).substr(1)+$,M.divRemTo(R,M,U);return U.intValue().toString(u)+$}function Nt(u,l){this.fromInt(0),l==null&&(l=10);for(var g=this.chunkSize(l),R=Math.pow(l,g),M=!1,U=0,$=0,K=0;K<u.length;++K){var c0=E(u,K);if(c0<0){u.charAt(K)=="-"&&this.signum()==0&&(M=!0);continue}$=l*$+c0,++U>=g&&(this.dMultiply(R),this.dAddOffset($,0),U=0,$=0)}U>0&&(this.dMultiply(Math.pow(l,U)),this.dAddOffset($,0)),M&&i.ZERO.subTo(this,this)}function xe(u,l,g){if(typeof l=="number")if(u<2)this.fromInt(1);else for(this.fromNumber(u,g),this.testBit(u-1)||this.bitwiseTo(i.ONE.shiftLeft(u-1),Ve,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(l);)this.dAddOffset(2,0),this.bitLength()>u&&this.subTo(i.ONE.shiftLeft(u-1),this);else{var R=new Array,M=u&7;R.length=(u>>3)+1,l.nextBytes(R),M>0?R[0]&=(1<<M)-1:R[0]=0,this.fromString(R,256)}}function Ce(){var u=this.t,l=new Array;l[0]=this.s;var g=this.DB-u*this.DB%8,R,M=0;if(u-- >0)for(g<this.DB&&(R=this[u]>>g)!=(this.s&this.DM)>>g&&(l[M++]=R|this.s<<this.DB-g);u>=0;)g<8?(R=(this[u]&(1<<g)-1)<<8-g,R|=this[--u]>>(g+=this.DB-8)):(R=this[u]>>(g-=8)&255,g<=0&&(g+=this.DB,--u)),R&128&&(R|=-256),M==0&&(this.s&128)!=(R&128)&&++M,(M>0||R!=this.s)&&(l[M++]=R);return l}function Bn(u){return this.compareTo(u)==0}function Mt(u){return this.compareTo(u)<0?this:u}function Ut(u){return this.compareTo(u)>0?this:u}function ce(u,l,g){var R,M,U=Math.min(u.t,this.t);for(R=0;R<U;++R)g[R]=l(this[R],u[R]);if(u.t<this.t){for(M=u.s&this.DM,R=U;R<this.t;++R)g[R]=l(this[R],M);g.t=this.t}else{for(M=this.s&this.DM,R=U;R<u.t;++R)g[R]=l(M,u[R]);g.t=u.t}g.s=l(this.s,u.s),g.clamp()}function _e(u,l){return u&l}function Cn(u){var l=c();return this.bitwiseTo(u,_e,l),l}function Ve(u,l){return u|l}function zt(u){var l=c();return this.bitwiseTo(u,Ve,l),l}function Lt(u,l){return u^l}function _n(u){var l=c();return this.bitwiseTo(u,Lt,l),l}function ot(u,l){return u&~l}function En(u){var l=c();return this.bitwiseTo(u,ot,l),l}function $t(){for(var u=c(),l=0;l<this.t;++l)u[l]=this.DM&~this[l];return u.t=this.t,u.s=~this.s,u}function Fn(u){var l=c();return u<0?this.rShiftTo(-u,l):this.lShiftTo(u,l),l}function Kt(u){var l=c();return u<0?this.lShiftTo(-u,l):this.rShiftTo(u,l),l}function An(u){if(u==0)return-1;var l=0;return u&65535||(u>>=16,l+=16),u&255||(u>>=8,l+=8),u&15||(u>>=4,l+=4),u&3||(u>>=2,l+=2),u&1||++l,l}function Dn(){for(var u=0;u<this.t;++u)if(this[u]!=0)return u*this.DB+An(this[u]);return this.s<0?this.t*this.DB:-1}function wn(u){for(var l=0;u!=0;)u&=u-1,++l;return l}function Wt(){for(var u=0,l=this.s&this.DM,g=0;g<this.t;++g)u+=wn(this[g]^l);return u}function Sn(u){var l=Math.floor(u/this.DB);return l>=this.t?this.s!=0:(this[l]&1<<u%this.DB)!=0}function Tn(u,l){var g=i.ONE.shiftLeft(u);return this.bitwiseTo(g,l,g),g}function jt(u){return this.changeBit(u,Ve)}function kn(u){return this.changeBit(u,ot)}function Xt(u){return this.changeBit(u,Lt)}function _0(u,l){for(var g=0,R=0,M=Math.min(u.t,this.t);g<M;)R+=this[g]+u[g],l[g++]=R&this.DM,R>>=this.DB;if(u.t<this.t){for(R+=u.s;g<this.t;)R+=this[g],l[g++]=R&this.DM,R>>=this.DB;R+=this.s}else{for(R+=this.s;g<u.t;)R+=u[g],l[g++]=R&this.DM,R>>=this.DB;R+=u.s}l.s=R<0?-1:0,R>0?l[g++]=R:R<-1&&(l[g++]=this.DV+R),l.t=g,l.clamp()}function j0(u){var l=c();return this.addTo(u,l),l}function Vt(u){var l=c();return this.subTo(u,l),l}function Rn(u){var l=c();return this.multiplyTo(u,l),l}function zf(){var u=c();return this.squareTo(u),u}function Lf(u){var l=c();return this.divRemTo(u,l,null),l}function $f(u){var l=c();return this.divRemTo(u,null,l),l}function Kf(u){var l=c(),g=c();return this.divRemTo(u,l,g),new Array(l,g)}function Wf(u){this[this.t]=this.am(0,u-1,this,0,0,this.t),++this.t,this.clamp()}function jf(u,l){if(u!=0){for(;this.t<=l;)this[this.t++]=0;for(this[l]+=u;this[l]>=this.DV;)this[l]-=this.DV,++l>=this.t&&(this[this.t++]=0),++this[l]}}function st(){}function ho(u){return u}function Xf(u,l,g){u.multiplyTo(l,g)}function Vf(u,l){u.squareTo(l)}st.prototype.convert=ho,st.prototype.revert=ho,st.prototype.mulTo=Xf,st.prototype.sqrTo=Vf;function Gf(u){return this.exp(u,new st)}function Zf(u,l,g){var R=Math.min(this.t+u.t,l);for(g.s=0,g.t=R;R>0;)g[--R]=0;var M;for(M=g.t-this.t;R<M;++R)g[R+this.t]=this.am(0,u[R],g,R,0,this.t);for(M=Math.min(u.t,l);R<M;++R)this.am(0,u[R],g,R,0,l-R);g.clamp()}function Yf(u,l,g){--l;var R=g.t=this.t+u.t-l;for(g.s=0;--R>=0;)g[R]=0;for(R=Math.max(l-this.t,0);R<u.t;++R)g[this.t+R-l]=this.am(l-R,u[R],g,0,0,this.t+R-l);g.clamp(),g.drShiftTo(1,g)}function Ee(u){this.r2=c(),this.q3=c(),i.ONE.dlShiftTo(2*u.t,this.r2),this.mu=this.r2.divide(u),this.m=u}function Qf(u){if(u.s<0||u.t>2*this.m.t)return u.mod(this.m);if(u.compareTo(this.m)<0)return u;var l=c();return u.copyTo(l),this.reduce(l),l}function Jf(u){return u}function e1(u){for(u.drShiftTo(this.m.t-1,this.r2),u.t>this.m.t+1&&(u.t=this.m.t+1,u.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);u.compareTo(this.r2)<0;)u.dAddOffset(1,this.m.t+1);for(u.subTo(this.r2,u);u.compareTo(this.m)>=0;)u.subTo(this.m,u)}function t1(u,l){u.squareTo(l),this.reduce(l)}function r1(u,l,g){u.multiplyTo(l,g),this.reduce(g)}Ee.prototype.convert=Qf,Ee.prototype.revert=Jf,Ee.prototype.reduce=e1,Ee.prototype.mulTo=r1,Ee.prototype.sqrTo=t1;function n1(u,l){var g=u.bitLength(),R,M=b(1),U;if(g<=0)return M;g<18?R=1:g<48?R=3:g<144?R=4:g<768?R=5:R=6,g<8?U=new w(l):l.isEven()?U=new Ee(l):U=new x0(l);var $=new Array,K=3,c0=R-1,b0=(1<<R)-1;if($[1]=U.convert(this),R>1){var q0=c();for(U.sqrTo($[1],q0);K<=b0;)$[K]=c(),U.mulTo(q0,$[K-2],$[K]),K+=2}var k0=u.t-1,Z0,Zt=!0,z0=c(),L0;for(g=A(u[k0])-1;k0>=0;){for(g>=c0?Z0=u[k0]>>g-c0&b0:(Z0=(u[k0]&(1<<g+1)-1)<<c0-g,k0>0&&(Z0|=u[k0-1]>>this.DB+g-c0)),K=R;!(Z0&1);)Z0>>=1,--K;if((g-=K)<0&&(g+=this.DB,--k0),Zt)$[Z0].copyTo(M),Zt=!1;else{for(;K>1;)U.sqrTo(M,z0),U.sqrTo(z0,M),K-=2;K>0?U.sqrTo(M,z0):(L0=M,M=z0,z0=L0),U.mulTo(z0,$[Z0],M)}for(;k0>=0&&!(u[k0]&1<<g);)U.sqrTo(M,z0),L0=M,M=z0,z0=L0,--g<0&&(g=this.DB-1,--k0)}return U.revert(M)}function a1(u){var l=this.s<0?this.negate():this.clone(),g=u.s<0?u.negate():u.clone();if(l.compareTo(g)<0){var R=l;l=g,g=R}var M=l.getLowestSetBit(),U=g.getLowestSetBit();if(U<0)return l;for(M<U&&(U=M),U>0&&(l.rShiftTo(U,l),g.rShiftTo(U,g));l.signum()>0;)(M=l.getLowestSetBit())>0&&l.rShiftTo(M,l),(M=g.getLowestSetBit())>0&&g.rShiftTo(M,g),l.compareTo(g)>=0?(l.subTo(g,l),l.rShiftTo(1,l)):(g.subTo(l,g),g.rShiftTo(1,g));return U>0&&g.lShiftTo(U,g),g}function i1(u){if(u<=0)return 0;var l=this.DV%u,g=this.s<0?u-1:0;if(this.t>0)if(l==0)g=this[0]%u;else for(var R=this.t-1;R>=0;--R)g=(l*g+this[R])%u;return g}function o1(u){var l=u.isEven();if(this.isEven()&&l||u.signum()==0)return i.ZERO;for(var g=u.clone(),R=this.clone(),M=b(1),U=b(0),$=b(0),K=b(1);g.signum()!=0;){for(;g.isEven();)g.rShiftTo(1,g),l?((!M.isEven()||!U.isEven())&&(M.addTo(this,M),U.subTo(u,U)),M.rShiftTo(1,M)):U.isEven()||U.subTo(u,U),U.rShiftTo(1,U);for(;R.isEven();)R.rShiftTo(1,R),l?((!$.isEven()||!K.isEven())&&($.addTo(this,$),K.subTo(u,K)),$.rShiftTo(1,$)):K.isEven()||K.subTo(u,K),K.rShiftTo(1,K);g.compareTo(R)>=0?(g.subTo(R,g),l&&M.subTo($,M),U.subTo(K,U)):(R.subTo(g,R),l&&$.subTo(M,$),K.subTo(U,K))}if(R.compareTo(i.ONE)!=0)return i.ZERO;if(K.compareTo(u)>=0)return K.subtract(u);if(K.signum()<0)K.addTo(u,K);else return K;return K.signum()<0?K.add(u):K}var E0=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],s1=(1<<26)/E0[E0.length-1];function x1(u){var l,g=this.abs();if(g.t==1&&g[0]<=E0[E0.length-1]){for(l=0;l<E0.length;++l)if(g[0]==E0[l])return!0;return!1}if(g.isEven())return!1;for(l=1;l<E0.length;){for(var R=E0[l],M=l+1;M<E0.length&&R<s1;)R*=E0[M++];for(R=g.modInt(R);l<M;)if(R%E0[l++]==0)return!1}return g.millerRabin(u)}function c1(u){var l=this.subtract(i.ONE),g=l.getLowestSetBit();if(g<=0)return!1;var R=l.shiftRight(g);u=u+1>>1,u>E0.length&&(u=E0.length);for(var M=c(),U=0;U<u;++U){M.fromInt(E0[Math.floor(Math.random()*E0.length)]);var $=M.modPow(R,this);if($.compareTo(i.ONE)!=0&&$.compareTo(l)!=0){for(var K=1;K++<g&&$.compareTo(l)!=0;)if($=$.modPowInt(2,this),$.compareTo(i.ONE)==0)return!1;if($.compareTo(l)!=0)return!1}}return!0}i.prototype.chunkSize=A0,i.prototype.toRadix=Xe,i.prototype.fromRadix=Nt,i.prototype.fromNumber=xe,i.prototype.bitwiseTo=ce,i.prototype.changeBit=Tn,i.prototype.addTo=_0,i.prototype.dMultiply=Wf,i.prototype.dAddOffset=jf,i.prototype.multiplyLowerTo=Zf,i.prototype.multiplyUpperTo=Yf,i.prototype.modInt=i1,i.prototype.millerRabin=c1,i.prototype.clone=me,i.prototype.intValue=it,i.prototype.byteValue=Be,i.prototype.shortValue=S0,i.prototype.signum=W0,i.prototype.toByteArray=Ce,i.prototype.equals=Bn,i.prototype.min=Mt,i.prototype.max=Ut,i.prototype.and=Cn,i.prototype.or=zt,i.prototype.xor=_n,i.prototype.andNot=En,i.prototype.not=$t,i.prototype.shiftLeft=Fn,i.prototype.shiftRight=Kt,i.prototype.getLowestSetBit=Dn,i.prototype.bitCount=Wt,i.prototype.testBit=Sn,i.prototype.setBit=jt,i.prototype.clearBit=kn,i.prototype.flipBit=Xt,i.prototype.add=j0,i.prototype.subtract=Vt,i.prototype.multiply=Rn,i.prototype.divide=Lf,i.prototype.remainder=$f,i.prototype.divideAndRemainder=Kf,i.prototype.modPow=n1,i.prototype.modInverse=o1,i.prototype.pow=Gf,i.prototype.gcd=a1,i.prototype.isProbablePrime=x1,i.prototype.square=zf,i.prototype.Barrett=Ee;var Gt,T0,p0;function f1(u){T0[p0++]^=u&255,T0[p0++]^=u>>8&255,T0[p0++]^=u>>16&255,T0[p0++]^=u>>24&255,p0>=In&&(p0-=In)}function lo(){f1(new Date().getTime())}if(T0==null){T0=new Array,p0=0;var U0;if(typeof window!="undefined"&&window.crypto){if(window.crypto.getRandomValues){var po=new Uint8Array(32);for(window.crypto.getRandomValues(po),U0=0;U0<32;++U0)T0[p0++]=po[U0]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var bo=window.crypto.random(32);for(U0=0;U0<bo.length;++U0)T0[p0++]=bo.charCodeAt(U0)&255}}for(;p0<In;)U0=Math.floor(65536*Math.random()),T0[p0++]=U0>>>8,T0[p0++]=U0&255;p0=0,lo()}function d1(){if(Gt==null){for(lo(),Gt=p1(),Gt.init(T0),p0=0;p0<T0.length;++p0)T0[p0]=0;p0=0}return Gt.next()}function u1(u){var l;for(l=0;l<u.length;++l)u[l]=d1()}function vo(){}vo.prototype.nextBytes=u1;function Pn(){this.i=0,this.j=0,this.S=new Array}function h1(u){var l,g,R;for(l=0;l<256;++l)this.S[l]=l;for(g=0,l=0;l<256;++l)g=g+this.S[l]+u[l%u.length]&255,R=this.S[l],this.S[l]=this.S[g],this.S[g]=R;this.i=0,this.j=0}function l1(){var u;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,u=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=u,this.S[u+this.S[this.i]&255]}Pn.prototype.init=h1,Pn.prototype.next=l1;function p1(){return new Pn}var In=256;e.exports={default:i,BigInteger:i,SecureRandom:vo}}).call(G)})(oi);var gt=oi.exports;const{BigInteger:ke}=gt;function dx(e){let t=e.toString(16);if(t[0]!=="-")t.length%2===1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{t=t.substr(1);let r=t.length;r%2===1?r+=1:t.match(/^[0-7]/)||(r+=2);let n="";for(let a=0;a<r;a++)n+="f";n=new ke(n,16),t=n.xor(e).add(ke.ONE),t=t.toString(16).replace(/^-/,"")}return t}class si{constructor(){this.tlv=null,this.t="00",this.l="00",this.v=""}getEncodedHex(){return this.tlv||(this.v=this.getValue(),this.l=this.getLength(),this.tlv=this.t+this.l+this.v),this.tlv}getLength(){const t=this.v.length/2;let r=t.toString(16);return r.length%2===1&&(r="0"+r),t<128?r:(128+r.length/2).toString(16)+r}getValue(){return""}}class xi extends si{constructor(t){super(),this.t="02",t&&(this.v=dx(t))}getValue(){return this.v}}class ux extends si{constructor(t){super(),this.t="30",this.asn1Array=t}getValue(){return this.v=this.asn1Array.map(t=>t.getEncodedHex()).join(""),this.v}}function ci(e,t){return+e[t+2]<8?1:+e.substr(t+2,2)&128}function fi(e,t){const r=ci(e,t),n=e.substr(t+2,r*2);return n?(+n[0]<8?new ke(n,16):new ke(n.substr(2),16)).intValue():-1}function Gr(e,t){const r=ci(e,t);return t+(r+1)*2}var hx={encodeDer(e,t){const r=new xi(e),n=new xi(t);return new ux([r,n]).getEncodedHex()},decodeDer(e){const t=Gr(e,0),r=Gr(e,t),n=fi(e,t),a=e.substr(r,n*2),i=r+a.length,c=Gr(e,i),f=fi(e,i),p=e.substr(c,f*2),o=new ke(a,16),x=new ke(p,16);return{r:o,s:x}}};const{BigInteger:B0}=gt,di=new B0("2"),ui=new B0("3");class te{constructor(t,r){this.x=r,this.q=t}equals(t){return t===this?!0:this.q.equals(t.q)&&this.x.equals(t.x)}toBigInteger(){return this.x}negate(){return new te(this.q,this.x.negate().mod(this.q))}add(t){return new te(this.q,this.x.add(t.toBigInteger()).mod(this.q))}subtract(t){return new te(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))}multiply(t){return new te(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))}divide(t){return new te(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))}square(){return new te(this.q,this.x.square().mod(this.q))}}class le{constructor(t,r,n,a){this.curve=t,this.x=r,this.y=n,this.z=a==null?B0.ONE:a,this.zinv=null}getX(){return this.zinv===null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}getY(){return this.zinv===null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}equals(t){return t===this?!0:this.isInfinity()?t.isInfinity():t.isInfinity()?this.isInfinity():t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(B0.ZERO)?t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(B0.ZERO):!1}isInfinity(){return this.x===null&&this.y===null?!0:this.z.equals(B0.ZERO)&&!this.y.toBigInteger().equals(B0.ZERO)}negate(){return new le(this.curve,this.x,this.y.negate(),this.z)}add(t){if(this.isInfinity())return t;if(t.isInfinity())return this;const r=this.x.toBigInteger(),n=this.y.toBigInteger(),a=this.z,i=t.x.toBigInteger(),c=t.y.toBigInteger(),f=t.z,p=this.curve.q,o=r.multiply(f).mod(p),x=i.multiply(a).mod(p),h=o.subtract(x),s=n.multiply(f).mod(p),d=c.multiply(a).mod(p),v=s.subtract(d);if(B0.ZERO.equals(h))return B0.ZERO.equals(v)?this.twice():this.curve.infinity;const m=o.add(x),C=a.multiply(f).mod(p),E=h.square().mod(p),y=h.multiply(E).mod(p),B=C.multiply(v.square()).subtract(m.multiply(E)).mod(p),b=h.multiply(B).mod(p),F=v.multiply(E.multiply(o).subtract(B)).subtract(s.multiply(y)).mod(p),D=y.multiply(C).mod(p);return new le(this.curve,this.curve.fromBigInteger(b),this.curve.fromBigInteger(F),D)}twice(){if(this.isInfinity())return this;if(!this.y.toBigInteger().signum())return this.curve.infinity;const t=this.x.toBigInteger(),r=this.y.toBigInteger(),n=this.z,a=this.curve.q,i=this.curve.a.toBigInteger(),c=t.square().multiply(ui).add(i.multiply(n.square())).mod(a),f=r.shiftLeft(1).multiply(n).mod(a),p=r.square().mod(a),o=p.multiply(t).multiply(n).mod(a),x=f.square().mod(a),h=c.square().subtract(o.shiftLeft(3)).mod(a),s=f.multiply(h).mod(a),d=c.multiply(o.shiftLeft(2).subtract(h)).subtract(x.shiftLeft(1).multiply(p)).mod(a),v=f.multiply(x).mod(a);return new le(this.curve,this.curve.fromBigInteger(s),this.curve.fromBigInteger(d),v)}multiply(t){if(this.isInfinity())return this;if(!t.signum())return this.curve.infinity;const r=t.multiply(ui),n=this.negate();let a=this;for(let i=r.bitLength()-2;i>0;i--){a=a.twice();const c=r.testBit(i),f=t.testBit(i);c!==f&&(a=a.add(c?this:n))}return a}}var lx={ECCurveFp:class{constructor(t,r,n){this.q=t,this.a=this.fromBigInteger(r),this.b=this.fromBigInteger(n),this.infinity=new le(this,null,null)}equals(t){return t===this?!0:this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)}fromBigInteger(t){return new te(this.q,t)}decodePointHex(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:const r=this.fromBigInteger(new B0(t.substr(2),16));let n=this.fromBigInteger(r.multiply(r.square()).add(r.multiply(this.a)).add(this.b).toBigInteger().modPow(this.q.divide(new B0("4")).add(B0.ONE),this.q));return n.toBigInteger().mod(di).equals(new B0(t.substr(0,2),16).subtract(di))||(n=n.negate()),new le(this,r,n);case 4:case 6:case 7:const a=(t.length-2)/2,i=t.substr(2,a),c=t.substr(a+2,a);return new le(this,this.fromBigInteger(new B0(i,16)),this.fromBigInteger(new B0(c,16)));default:return null}}}};const{BigInteger:O0,SecureRandom:px}=gt,{ECCurveFp:bx}=lx,vx=new px,{curve:Re,G:yx,n:hi}=li();function gx(){return Re}function li(){const e=new O0("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF",16),t=new O0("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC",16),r=new O0("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93",16),n=new bx(e,t,r),c=n.decodePointHex("04"+"32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7"+"BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0"),f=new O0("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123",16);return{curve:n,G:c,n:f}}function mx(e,t,r){const a=(e?new O0(e,t,r):new O0(hi.bitLength(),vx)).mod(hi.subtract(O0.ONE)).add(O0.ONE),i=Je(a.toString(16),64),c=yx.multiply(a),f=Je(c.getX().toBigInteger().toString(16),64),p=Je(c.getY().toBigInteger().toString(16),64),o="04"+f+p;return{privateKey:i,publicKey:o}}function Bx(e){if(e.length!==130)throw new Error("Invalid public key to compress");const t=(e.length-2)/2,r=e.substr(2,t),n=new O0(e.substr(t+2,t),16);let a="03";return n.mod(new O0("2")).equals(O0.ZERO)&&(a="02"),a+r}function Cx(e){e=unescape(encodeURIComponent(e));const t=e.length,r=[];for(let a=0;a<t;a++)r[a>>>2]|=(e.charCodeAt(a)&255)<<24-a%4*8;const n=[];for(let a=0;a<t;a++){const i=r[a>>>2]>>>24-a%4*8&255;n.push((i>>>4).toString(16)),n.push((i&15).toString(16))}return n.join("")}function Je(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e}function _x(e){return e.map(t=>(t=t.toString(16),t.length===1?"0"+t:t)).join("")}function Ex(e){const t=[];let r=0;for(let n=0;n<e.length*2;n+=2)t[n>>>3]|=parseInt(e[r],10)<<24-n%8*4,r++;try{const n=[];for(let a=0;a<e.length;a++){const i=t[a>>>2]>>>24-a%4*8&255;n.push(String.fromCharCode(i))}return decodeURIComponent(escape(n.join("")))}catch(n){throw new Error("Malformed UTF-8 data")}}function Fx(e){const t=[];let r=e.length;r%2!==0&&(e=Je(e,r+1)),r=e.length;for(let n=0;n<r;n+=2)t.push(parseInt(e.substr(n,2),16));return t}function Ax(e){const t=Re.decodePointHex(e);if(!t)return!1;const r=t.getX();return t.getY().square().equals(r.multiply(r.square()).add(r.multiply(Re.a)).add(Re.b))}function Dx(e,t){const r=Re.decodePointHex(e);if(!r)return!1;const n=Re.decodePointHex(t);return n?r.equals(n):!1}var wx={getGlobalCurve:gx,generateEcparam:li,generateKeyPairHex:mx,compressPublicKeyHex:Bx,utf8ToHex:Cx,leftPad:Je,arrayToHex:_x,arrayToUtf8:Ex,hexToArray:Fx,verifyPublicKey:Ax,comparePublicKeyHex:Dx};const H0=new Uint32Array(68),Zr=new Uint32Array(64);function P0(e,t){const r=t&31;return e<<r|e>>>32-r}function pi(e,t){const r=[];for(let n=e.length-1;n>=0;n--)r[n]=(e[n]^t[n])&255;return r}function Sx(e){return e^P0(e,9)^P0(e,17)}function Tx(e){return e^P0(e,15)^P0(e,23)}function mt(e){let t=e.length*8,r=t%512;r=r>=448?512-r%448-1:448-r-1;const n=new Array((r-7)/8),a=new Array(8);for(let x=0,h=n.length;x<h;x++)n[x]=0;for(let x=0,h=a.length;x<h;x++)a[x]=0;t=t.toString(2);for(let x=7;x>=0;x--)if(t.length>8){const h=t.length-8;a[x]=parseInt(t.substr(h),2),t=t.substr(0,h)}else t.length>0&&(a[x]=parseInt(t,2),t="");const i=new Uint8Array([...e,128,...n,...a]),c=new DataView(i.buffer,0),f=i.length/64,p=new Uint32Array([1937774191,1226093241,388252375,3666478592,2842636476,372324522,3817729613,2969243214]);for(let x=0;x<f;x++){H0.fill(0),Zr.fill(0);const h=16*x;for(let A=0;A<16;A++)H0[A]=c.getUint32((h+A)*4,!1);for(let A=16;A<68;A++)H0[A]=Tx(H0[A-16]^H0[A-9]^P0(H0[A-3],15))^P0(H0[A-13],7)^H0[A-6];for(let A=0;A<64;A++)Zr[A]=H0[A]^H0[A+4];const s=2043430169,d=2055708042;let v=p[0],m=p[1],C=p[2],E=p[3],y=p[4],B=p[5],b=p[6],F=p[7],D,T,P,H,S;for(let A=0;A<64;A++)S=A>=0&&A<=15?s:d,D=P0(P0(v,12)+y+P0(S,A),7),T=D^P0(v,12),P=(A>=0&&A<=15?v^m^C:v&m|v&C|m&C)+E+T+Zr[A],H=(A>=0&&A<=15?y^B^b:y&B|~y&b)+F+D+H0[A],E=C,C=P0(m,9),m=v,v=P,F=b,b=P0(B,19),B=y,y=Sx(H);p[0]^=v,p[1]^=m,p[2]^=C,p[3]^=E,p[4]^=y,p[5]^=B,p[6]^=b,p[7]^=F}const o=[];for(let x=0,h=p.length;x<h;x++){const s=p[x];o.push((s&4278190080)>>>24,(s&16711680)>>>16,(s&65280)>>>8,s&255)}return o}const et=64,bi=new Uint8Array(et),vi=new Uint8Array(et);for(let e=0;e<et;e++)bi[e]=54,vi[e]=92;function kx(e,t){for(t.length>et&&(t=mt(t));t.length<et;)t.push(0);const r=pi(t,bi),n=pi(t,vi),a=mt([...r,...e]);return mt([...n,...a])}var yi={sm3:mt,hmac:kx};const{BigInteger:D0}=gt,{encodeDer:Rx,decodeDer:Px}=hx,Z=wx,Pe=yi.sm3,{G:pe,curve:gi,n:Ie}=Z.generateEcparam(),mi=0;function Ix(e,t,r=1){e=typeof e=="string"?Z.hexToArray(Z.utf8ToHex(e)):Array.prototype.slice.call(e),t=Z.getGlobalCurve().decodePointHex(t);const n=Z.generateKeyPairHex(),a=new D0(n.privateKey,16);let i=n.publicKey;i.length>128&&(i=i.substr(i.length-128));const c=t.multiply(a),f=Z.hexToArray(Z.leftPad(c.getX().toBigInteger().toRadix(16),64)),p=Z.hexToArray(Z.leftPad(c.getY().toBigInteger().toRadix(16),64)),o=Z.arrayToHex(Pe([].concat(f,e,p)));let x=1,h=0,s=[];const d=[].concat(f,p),v=()=>{s=Pe([...d,x>>24&255,x>>16&255,x>>8&255,x&255]),x++,h=0};v();for(let C=0,E=e.length;C<E;C++)h===s.length&&v(),e[C]^=s[h++]&255;const m=Z.arrayToHex(e);return r===mi?i+m+o:i+o+m}function qx(e,t,r=1,{output:n="string"}={}){t=new D0(t,16);let a=e.substr(128,64),i=e.substr(192);r===mi&&(a=e.substr(e.length-64),i=e.substr(128,e.length-128-64));const c=Z.hexToArray(i),p=Z.getGlobalCurve().decodePointHex("04"+e.substr(0,128)).multiply(t),o=Z.hexToArray(Z.leftPad(p.getX().toBigInteger().toRadix(16),64)),x=Z.hexToArray(Z.leftPad(p.getY().toBigInteger().toRadix(16),64));let h=1,s=0,d=[];const v=[].concat(o,x),m=()=>{d=Pe([...v,h>>24&255,h>>16&255,h>>8&255,h&255]),h++,s=0};m();for(let E=0,y=c.length;E<y;E++)s===d.length&&m(),c[E]^=d[s++]&255;return Z.arrayToHex(Pe([].concat(o,c,x)))===a.toLowerCase()?n==="array"?c:Z.arrayToUtf8(c):n==="array"?[]:""}function Ox(e,t,{pointPool:r,der:n,hash:a,publicKey:i,userId:c}={}){let f=typeof e=="string"?Z.utf8ToHex(e):Z.arrayToHex(e);a&&(i=i||Ci(t),f=Bi(f,i,c));const p=new D0(t,16),o=new D0(f,16);let x=null,h=null,s=null;do{do{let d;r&&r.length?d=r.pop():d=_i(),x=d.k,h=o.add(d.x1).mod(Ie)}while(h.equals(D0.ZERO)||h.add(x).equals(Ie));s=p.add(D0.ONE).modInverse(Ie).multiply(x.subtract(h.multiply(p))).mod(Ie)}while(s.equals(D0.ZERO));return n?Rx(h,s):Z.leftPad(h.toString(16),64)+Z.leftPad(s.toString(16),64)}function Hx(e,t,r,{der:n,hash:a,userId:i}={}){let c=typeof e=="string"?Z.utf8ToHex(e):Z.arrayToHex(e);a&&(c=Bi(c,r,i));let f,p;if(n){const v=Px(t);f=v.r,p=v.s}else f=new D0(t.substring(0,64),16),p=new D0(t.substring(64),16);const o=gi.decodePointHex(r),x=new D0(c,16),h=f.add(p).mod(Ie);if(h.equals(D0.ZERO))return!1;const s=pe.multiply(p).add(o.multiply(h)),d=x.add(s.getX().toBigInteger()).mod(Ie);return f.equals(d)}function Bi(e,t,r="1234567812345678"){r=Z.utf8ToHex(r);const n=Z.leftPad(pe.curve.a.toBigInteger().toRadix(16),64),a=Z.leftPad(pe.curve.b.toBigInteger().toRadix(16),64),i=Z.leftPad(pe.getX().toBigInteger().toRadix(16),64),c=Z.leftPad(pe.getY().toBigInteger().toRadix(16),64);let f,p;if(t.length===128)f=t.substr(0,64),p=t.substr(64,64);else{const s=pe.curve.decodePointHex(t);f=Z.leftPad(s.getX().toBigInteger().toRadix(16),64),p=Z.leftPad(s.getY().toBigInteger().toRadix(16),64)}const o=Z.hexToArray(r+n+a+i+c+f+p),x=r.length*4;o.unshift(x&255),o.unshift(x>>8&255);const h=Pe(o);return Z.arrayToHex(Pe(h.concat(Z.hexToArray(e))))}function Ci(e){const t=pe.multiply(new D0(e,16)),r=Z.leftPad(t.getX().toBigInteger().toString(16),64),n=Z.leftPad(t.getY().toBigInteger().toString(16),64);return"04"+r+n}function _i(){const e=Z.generateKeyPairHex(),t=gi.decodePointHex(e.publicKey);return e.k=new D0(e.privateKey,16),e.x1=t.getX().toBigInteger(),e}var Nx={generateKeyPairHex:Z.generateKeyPairHex,compressPublicKeyHex:Z.compressPublicKeyHex,comparePublicKeyHex:Z.comparePublicKeyHex,doEncrypt:Ix,doDecrypt:qx,doSignature:Ox,doVerifySignature:Hx,getPublicKeyFromPrivateKey:Ci,getPoint:_i,verifyPublicKey:Z.verifyPublicKey};const{sm3:Mx,hmac:Ux}=yi;function zx(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e}function Ei(e){return e.map(t=>(t=t.toString(16),t.length===1?"0"+t:t)).join("")}function Lx(e){const t=[];let r=e.length;r%2!==0&&(e=zx(e,r+1)),r=e.length;for(let n=0;n<r;n+=2)t.push(parseInt(e.substr(n,2),16));return t}function $x(e){const t=[];for(let r=0,n=e.length;r<n;r++){const a=e.codePointAt(r);if(a<=127)t.push(a);else if(a<=2047)t.push(192|a>>>6),t.push(128|a&63);else if(a<=55295||a>=57344&&a<=65535)t.push(224|a>>>12),t.push(128|a>>>6&63),t.push(128|a&63);else if(a>=65536&&a<=1114111)r++,t.push(240|a>>>18&28),t.push(128|a>>>12&63),t.push(128|a>>>6&63),t.push(128|a&63);else throw t.push(a),new Error("input is not supported")}return t}var Kx=function(e,t){if(e=typeof e=="string"?$x(e):Array.prototype.slice.call(e),t){if((t.mode||"hmac")!=="hmac")throw new Error("invalid mode");let n=t.key;if(!n)throw new Error("invalid key");return n=typeof n=="string"?Lx(n):Array.prototype.slice.call(n),Ei(Ux(e,n))}return Ei(Mx(e))};const re=0,Wx=32,be=16,Bt=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],Ct=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function Yr(e){const t=[];for(let r=0,n=e.length;r<n;r+=2)t.push(parseInt(e.substr(r,2),16));return t}function jx(e){return e.map(t=>(t=t.toString(16),t.length===1?"0"+t:t)).join("")}function Xx(e){const t=[];for(let r=0,n=e.length;r<n;r++){const a=e.codePointAt(r);if(a<=127)t.push(a);else if(a<=2047)t.push(192|a>>>6),t.push(128|a&63);else if(a<=55295||a>=57344&&a<=65535)t.push(224|a>>>12),t.push(128|a>>>6&63),t.push(128|a&63);else if(a>=65536&&a<=1114111)r++,t.push(240|a>>>18&28),t.push(128|a>>>12&63),t.push(128|a>>>6&63),t.push(128|a&63);else throw t.push(a),new Error("input is not supported")}return t}function Vx(e){const t=[];for(let r=0,n=e.length;r<n;r++)e[r]>=240&&e[r]<=247?(t.push(String.fromCodePoint(((e[r]&7)<<18)+((e[r+1]&63)<<12)+((e[r+2]&63)<<6)+(e[r+3]&63))),r+=3):e[r]>=224&&e[r]<=239?(t.push(String.fromCodePoint(((e[r]&15)<<12)+((e[r+1]&63)<<6)+(e[r+2]&63))),r+=2):e[r]>=192&&e[r]<=223?(t.push(String.fromCodePoint(((e[r]&31)<<6)+(e[r+1]&63))),r++):t.push(String.fromCodePoint(e[r]));return t.join("")}function qe(e,t){const r=t&31;return e<<r|e>>>32-r}function ne(e){return(Bt[e>>>24&255]&255)<<24|(Bt[e>>>16&255]&255)<<16|(Bt[e>>>8&255]&255)<<8|Bt[e&255]&255}function _t(e){return e^qe(e,2)^qe(e,10)^qe(e,18)^qe(e,24)}function Et(e){return e^qe(e,13)^qe(e,23)}function Gx(e,t,r){const n=new Array(4),a=new Array(4);for(let i=0;i<4;i++)a[0]=e[4*i]&255,a[1]=e[4*i+1]&255,a[2]=e[4*i+2]&255,a[3]=e[4*i+3]&255,n[i]=a[0]<<24|a[1]<<16|a[2]<<8|a[3];for(let i=0,c;i<32;i+=4)c=n[1]^n[2]^n[3]^r[i+0],n[0]^=_t(ne(c)),c=n[2]^n[3]^n[0]^r[i+1],n[1]^=_t(ne(c)),c=n[3]^n[0]^n[1]^r[i+2],n[2]^=_t(ne(c)),c=n[0]^n[1]^n[2]^r[i+3],n[3]^=_t(ne(c));for(let i=0;i<16;i+=4)t[i]=n[3-i/4]>>>24&255,t[i+1]=n[3-i/4]>>>16&255,t[i+2]=n[3-i/4]>>>8&255,t[i+3]=n[3-i/4]&255}function Zx(e,t,r){const n=new Array(4),a=new Array(4);for(let i=0;i<4;i++)a[0]=e[0+4*i]&255,a[1]=e[1+4*i]&255,a[2]=e[2+4*i]&255,a[3]=e[3+4*i]&255,n[i]=a[0]<<24|a[1]<<16|a[2]<<8|a[3];n[0]^=2746333894,n[1]^=1453994832,n[2]^=1736282519,n[3]^=2993693404;for(let i=0,c;i<32;i+=4)c=n[1]^n[2]^n[3]^Ct[i+0],t[i+0]=n[0]^=Et(ne(c)),c=n[2]^n[3]^n[0]^Ct[i+1],t[i+1]=n[1]^=Et(ne(c)),c=n[3]^n[0]^n[1]^Ct[i+2],t[i+2]=n[2]^=Et(ne(c)),c=n[0]^n[1]^n[2]^Ct[i+3],t[i+3]=n[3]^=Et(ne(c));if(r===re)for(let i=0,c;i<16;i++)c=t[i],t[i]=t[31-i],t[31-i]=c}function Fi(e,t,r,{padding:n="pkcs#7",mode:a,iv:i=[],output:c="string"}={}){if(a==="cbc"&&(typeof i=="string"&&(i=Yr(i)),i.length!==128/8))throw new Error("iv is invalid");if(typeof t=="string"&&(t=Yr(t)),t.length!==128/8)throw new Error("key is invalid");if(typeof e=="string"?r!==re?e=Xx(e):e=Yr(e):e=[...e],(n==="pkcs#5"||n==="pkcs#7")&&r!==re){const s=be-e.length%be;for(let d=0;d<s;d++)e.push(s)}const f=new Array(Wx);Zx(t,f,r);const p=[];let o=i,x=e.length,h=0;for(;x>=be;){const s=e.slice(h,h+16),d=new Array(16);if(a==="cbc")for(let v=0;v<be;v++)r!==re&&(s[v]^=o[v]);Gx(s,d,f);for(let v=0;v<be;v++)a==="cbc"&&r===re&&(d[v]^=o[v]),p[h+v]=d[v];a==="cbc"&&(r!==re?o=d:o=s),x-=be,h+=be}if((n==="pkcs#5"||n==="pkcs#7")&&r===re){const s=p.length,d=p[s-1];for(let v=1;v<=d;v++)if(p[s-v]!==d)throw new Error("padding is invalid");p.splice(s-d,d)}return c!=="array"?r!==re?jx(p):Vx(p):p}var Yx={encrypt(e,t,r){return Fi(e,t,1,r)},decrypt(e,t,r){return Fi(e,t,0,r)}},Ai={sm2:Nx,sm3:Kx,sm4:Yx};const Qx=["appId","signatureMethod","signatureNonce","timestamp","viewerToken","sign","encryptResponseType"],Jx=V0("MDQ1QjgxNTVFOTc0N0MyODNBQ0Y4NDI4OTVEMzA0OEU2Q0E5NDNDQzQ1NEFGQTZBOUE0NTJCNTkwM0NDMzBGQ0UyNzhBNkY4OEY2MDJFREY4MDNEQUI0MEJENDVFMzVGNjYwNjc2QkY2OEZEN0NDQkUwRjZBRDMyMzg4MTM2Q0QwRA=="),ec=V0("MDBCMzE5NjE4QjRCMUJBRUI4Q0M2NzY1RDg5MDNDMDVBMEIxNkQ5RDlGQ0QxNjMyNzFCQjZGMUI4OEY2NTdBMjhF");var Ft;(function(e){e[e.C1C3C2=1]="C1C3C2",e[e.C1C2C3=0]="C1C2C3"})(Ft||(Ft={}));function Di(e,t){const r=/^04/.test(e);return r&&!t?e.substring(2):!r&&t?`04${e}`:e}class tc{constructor(t){V(this,"__platformPublicKey");V(this,"__userPrivateKey");V(this,"__ignoreEncryptFields");V(this,"__useSM2");V(this,"__encryptPostSM2");var r,n;this.__platformPublicKey=t.platformPublicKey,this.__userPrivateKey=t.userPrivateKey,this.__ignoreEncryptFields=[...Qx],t.includeIgnoreEncryptFields&&this.__ignoreEncryptFields.push(...t.includeIgnoreEncryptFields),this.__useSM2=(r=t.useSM2)!=null?r:!0,this.__encryptPostSM2=(n=t.encryptPostSM2)!=null?n:!0}usePlugin(t){const{useSM2:r=this.__useSM2}=t;return r}interceptIncludeParams(){return{encryptResponseType:2}}interceptEncryptRequest(t){const r=this.__handleParams(t),n=this.__handleData(t),a=this.__handleHeaders(t);return Y0(o0({},t),{params:r,data:n,headers:a})}interceptDecryptResponse(t,r){const n=t.data;if(!n.encryption||typeof n.data!="string")return t;const a=n.data;return n.data=this.__decryptTextSM2(a,r),t}__handleHeaders(t){var a;const r=t.headers||{},{encryptPostSM2:n=this.__encryptPostSM2}=t;return((a=t.method)==null?void 0:a.toLocaleUpperCase())==="POST"&&n&&(r["x-e-type"]=2),r}__handleParams(t){var a;const{encryptPostSM2:r=this.__encryptPostSM2}=t,n=t.params||{};return((a=t.method)==null?void 0:a.toLocaleUpperCase())!=="POST"||!r?n:this.__encryptObjectSM2(n,t,"xurlparam")}__handleData(t){var i;const r=t.data||{};if(((i=t.method)==null?void 0:i.toLocaleUpperCase())!=="POST")return r;let n=r;const{encryptPostSM2:a=this.__encryptPostSM2}=t;return a&&(typeof r=="string"?n=this.__encryptTextSM2(r,t):t.requestType==="json"?n=this.__encryptTextSM2(JSON.stringify(t.data||{}),t):n=this.__encryptObjectSM2(r,t,"xparam")),n}__encryptObjectSM2(t,r,n){const a=Object.keys(t);if(a.length===0)return t;const i={},c={};a.forEach(p=>{this.__ignoreEncryptFields.includes(p)?i[p]=t[p]:c[p]=t[p]});const f=o0({},i);if(Object.keys(c).length){const p=this.__encryptTextSM2(JSON.stringify(c),r);f[n]=p}return f}__encryptTextSM2(t,r){const n=this.__getPublicKey(r);return Di(Ai.sm2.doEncrypt(t,n,Ft.C1C2C3),!0)}__decryptTextSM2(t,r){const n=this.__getPrivateKey(r);let a="";try{a=Ai.sm2.doDecrypt(Di(t,!1),n,Ft.C1C2C3)}catch(c){console.error("decryptTextSM2 decrypt error",c,{encryptedText:t})}let i=a;try{i=JSON.parse(i)}catch(c){}return i}__getPrivateKey(t){return"appId"in(t.params||{})?this.__userPrivateKey:ec}__getPublicKey(t){return"appId"in(t.params||{})?this.__platformPublicKey:Jx}}class rc extends Mn{constructor(t){var i,c,f,p;const r=[],{authorizeMethod:n=Qe.Token}=t.config;n===Qe.Token&&r.push(new Un({getTokenInfo:()=>Q(this,null,function*(){const{getChannelToken:o,getViewerToken:x}=t.config;let h;if(o){const s=yield o();if(!s)return;h=s.channelToken}if(x){const s=yield x();if(!s)return;h=s.viewerToken}if(h)return{token:h}})})),n===Qe.Sign&&r.push(new ax({appId:(i=t.config.appSignSecretKey)==null?void 0:i.appId,appSecret:(c=t.config.appSignSecretKey)==null?void 0:c.appSecret,signatureNonce:t.config.signatureNonce,signatureMethod:t.config.signatureMethod,getAppSign:t.config.getAppSign}));const a=t.config.securityMode;a===vt.AES&&r.push(new fx({appId:(f=t.config.appSignSecretKey)==null?void 0:f.appId,appSecret:(p=t.config.appSignSecretKey)==null?void 0:p.appSecret})),a===vt.SM2&&t.config.sm2Key&&r.push(new tc({platformPublicKey:t.config.sm2Key.platformPublicKey,userPrivateKey:t.config.sm2Key.userPrivateKey})),super({baseUrl:ei(Wr(t.config.domainInfo).polyvApiDomain,"https"),requestPlugins:[...r,new Ms({getBusinessData:()=>Q(this,null,function*(){const[o,x]=yield Promise.all([t.getUserInfo(),t.getChannelInfo()]);return{channelId:x.channelId,viewerId:o.userId,unionId:o.unionId}})}),new Xa({decryptKeys:{sign:"polyvInteractSdk",iv:"1111000011101101"}}),new zn({successCode:200})]}),this._plvSocket=t}getTokenFieldByUserType(){return Q(this,null,function*(){const t=this._plvSocket.getUserInfo();let r="viewerToken";return this._plvSocket.isSpecialUserType(t.userType)&&(r="channelToken"),r})}}var N0=(e=>(e.ConnectSuccess="ConnectSuccess",e.ReconnectSuccess="ReconnectSuccess",e.ConnectFailed="ConnectFailed",e.Disconnect="Disconnect",e.LoginSuccess="LoginSuccess",e.LoginFailed="LoginFailed",e))(N0||{}),$0=(e=>(e.Student="student",e.Slice="slice",e.Viewer="viewer",e.Teacher="teacher",e.Assistant="assistant",e.Manager="manager",e.Guest="guest",e.UserTagsMonitor="userTagsMonitor",e.Attendee="attendee",e.Listener="listener",e.Host="host",e.Dummy="dummy",e))($0||{}),Oe=(e=>(e.TokenExpired="TokenExpired",e.SocketConnectError="SocketConnectError",e.SocketConnectTimeout="SocketConnectTimeout",e))(Oe||{});class nc{constructor(){this.__eventStore={}}__addOnEvent(t,r,n,a){if(!r||!n)return;let i=this.__eventStore[r];i||(i=[]),i.push({type:t,handler:n,callbackHandler:n.bind(a)}),this.__eventStore[r]=i}on(t,r,n=this){this.__addOnEvent("normal",t,r,n)}once(t,r,n=this){this.__addOnEvent("once",t,r,n)}off(t,r){let n=this.__eventStore[t];n&&(n=n.filter(a=>a.handler!==r),this.__eventStore[t]=n)}emit(t,r,n){const a=this.__eventStore[t];a&&a.forEach(i=>{const{type:c,handler:f,callbackHandler:p}=i;typeof p=="function"&&p(r,n),c==="once"&&this.off(t,f)})}destroy(){this.__eventStore={}}}var Qr={exports:{}},ac=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ic=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],wi=function(t){var r=t,n=t.indexOf("["),a=t.indexOf("]");n!=-1&&a!=-1&&(t=t.substring(0,n)+t.substring(n,a).replace(/:/g,";")+t.substring(a,t.length));for(var i=ac.exec(t||""),c={},f=14;f--;)c[ic[f]]=i[f]||"";return n!=-1&&a!=-1&&(c.source=r,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=oc(c,c.path),c.queryKey=sc(c,c.query),c};function oc(e,t){var r=/\/{2,9}/g,n=t.replace(r,"/").split("/");return(t.substr(0,1)=="/"||t.length===0)&&n.splice(0,1),t.substr(t.length-1,1)=="/"&&n.splice(n.length-1,1),n}function sc(e,t){var r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,a,i){a&&(r[a]=i)}),r}var Jr={exports:{}},en={exports:{}},tt=1e3,rt=tt*60,nt=rt*60,at=nt*24,xc=at*365.25,cc=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return fc(e);if(r==="number"&&isNaN(e)===!1)return t.long?uc(e):dc(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function fc(e){if(e=String(e),!(e.length>100)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*xc;case"days":case"day":case"d":return r*at;case"hours":case"hour":case"hrs":case"hr":case"h":return r*nt;case"minutes":case"minute":case"mins":case"min":case"m":return r*rt;case"seconds":case"second":case"secs":case"sec":case"s":return r*tt;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}}}function dc(e){return e>=at?Math.round(e/at)+"d":e>=nt?Math.round(e/nt)+"h":e>=rt?Math.round(e/rt)+"m":e>=tt?Math.round(e/tt)+"s":e+"ms"}function uc(e){return At(e,at,"day")||At(e,nt,"hour")||At(e,rt,"minute")||At(e,tt,"second")||e+" ms"}function At(e,t,r){if(!(e<t))return e<t*1.5?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}(function(e,t){t=e.exports=n.debug=n.default=n,t.coerce=p,t.disable=c,t.enable=i,t.enabled=f,t.humanize=cc,t.instances=[],t.names=[],t.skips=[],t.formatters={};function r(o){var x=0,h;for(h in o)x=(x<<5)-x+o.charCodeAt(h),x|=0;return t.colors[Math.abs(x)%t.colors.length]}function n(o){var x;function h(){if(h.enabled){var s=h,d=+new Date,v=d-(x||d);s.diff=v,s.prev=x,s.curr=d,x=d;for(var m=new Array(arguments.length),C=0;C<m.length;C++)m[C]=arguments[C];m[0]=t.coerce(m[0]),typeof m[0]!="string"&&m.unshift("%O");var E=0;m[0]=m[0].replace(/%([a-zA-Z%])/g,function(B,b){if(B==="%%")return B;E++;var F=t.formatters[b];if(typeof F=="function"){var D=m[E];B=F.call(s,D),m.splice(E,1),E--}return B}),t.formatArgs.call(s,m);var y=h.log||t.log||console.log.bind(console);y.apply(s,m)}}return h.namespace=o,h.enabled=t.enabled(o),h.useColors=t.useColors(),h.color=r(o),h.destroy=a,typeof t.init=="function"&&t.init(h),t.instances.push(h),h}function a(){var o=t.instances.indexOf(this);return o!==-1?(t.instances.splice(o,1),!0):!1}function i(o){t.save(o),t.names=[],t.skips=[];var x,h=(typeof o=="string"?o:"").split(/[\s,]+/),s=h.length;for(x=0;x<s;x++)h[x]&&(o=h[x].replace(/\*/g,".*?"),o[0]==="-"?t.skips.push(new RegExp("^"+o.substr(1)+"$")):t.names.push(new RegExp("^"+o+"$")));for(x=0;x<t.instances.length;x++){var d=t.instances[x];d.enabled=t.enabled(d.namespace)}}function c(){t.enable("")}function f(o){if(o[o.length-1]==="*")return!0;var x,h;for(x=0,h=t.skips.length;x<h;x++)if(t.skips[x].test(o))return!1;for(x=0,h=t.names.length;x<h;x++)if(t.names[x].test(o))return!0;return!1}function p(o){return o instanceof Error?o.stack||o.message:o}})(en,en.exports);var hc=en.exports;(function(e,t){t=e.exports=hc,t.log=a,t.formatArgs=n,t.save=i,t.load=c,t.useColors=r,t.storage=typeof chrome!="undefined"&&typeof chrome.storage!="undefined"?chrome.storage.local:f(),t.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!="undefined"&&window.process&&window.process.type==="renderer"?!0:typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document!="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}t.formatters.j=function(p){try{return JSON.stringify(p)}catch(o){return"[UnexpectedJSONParseError]: "+o.message}};function n(p){var o=this.useColors;if(p[0]=(o?"%c":"")+this.namespace+(o?" %c":" ")+p[0]+(o?"%c ":" ")+"+"+t.humanize(this.diff),!!o){var x="color: "+this.color;p.splice(1,0,x,"color: inherit");var h=0,s=0;p[0].replace(/%[a-zA-Z%]/g,function(d){d!=="%%"&&(h++,d==="%c"&&(s=h))}),p.splice(s,0,x)}}function a(){return typeof console=="object"&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function i(p){try{p==null?t.storage.removeItem("debug"):t.storage.debug=p}catch(o){}}function c(){var p;try{p=t.storage.debug}catch(o){}return!p&&typeof process!="undefined"&&"env"in process&&(p=process.env.DEBUG),p}t.enable(c());function f(){try{return window.localStorage}catch(p){}}})(Jr,Jr.exports);var G0=Jr.exports,lc=wi,Si=G0("socket.io-client:url"),pc=bc;function bc(e,t){var r=e;t=t||typeof location!="undefined"&&location,e==null&&(e=t.protocol+"//"+t.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=t.protocol+e:e=t.host+e),/^(https?|wss?):\/\//.test(e)||(Si("protocol-less url %s",e),typeof t!="undefined"?e=t.protocol+"//"+e:e="https://"+e),Si("parse %s",e),r=lc(e)),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,a=n?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+a+":"+r.port,r.href=r.protocol+"://"+a+(t&&t.port===r.port?"":":"+r.port),r}var Dt={},Ti={exports:{}};(function(e){e.exports=t;function t(n){if(n)return r(n)}function r(n){for(var a in t.prototype)n[a]=t.prototype[a];return n}t.prototype.on=t.prototype.addEventListener=function(n,a){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(a),this},t.prototype.once=function(n,a){function i(){this.off(n,i),a.apply(this,arguments)}return i.fn=a,this.on(n,i),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(n,a){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var i=this._callbacks["$"+n];if(!i)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var c,f=0;f<i.length;f++)if(c=i[f],c===a||c.fn===a){i.splice(f,1);break}return i.length===0&&delete this._callbacks["$"+n],this},t.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var a=new Array(arguments.length-1),i=this._callbacks["$"+n],c=1;c<arguments.length;c++)a[c-1]=arguments[c];if(i){i=i.slice(0);for(var c=0,f=i.length;c<f;++c)i[c].apply(this,a)}return this},t.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]},t.prototype.hasListeners=function(n){return!!this.listeners(n).length}})(Ti);var He=Ti.exports,wt={},vc={}.toString,tn=Array.isArray||function(e){return vc.call(e)=="[object Array]"},ki=Bc,yc=typeof Buffer=="function"&&typeof Buffer.isBuffer=="function",gc=typeof ArrayBuffer=="function",mc=function(e){return typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer};function Bc(e){return yc&&Buffer.isBuffer(e)||gc&&(e instanceof ArrayBuffer||mc(e))}var rn=tn,Ri=ki,Pi=Object.prototype.toString,Cc=typeof Blob=="function"||typeof Blob!="undefined"&&Pi.call(Blob)==="[object BlobConstructor]",_c=typeof File=="function"||typeof File!="undefined"&&Pi.call(File)==="[object FileConstructor]";wt.deconstructPacket=function(e){var t=[],r=e.data,n=e;return n.data=nn(r,t),n.attachments=t.length,{packet:n,buffers:t}};function nn(e,t){if(!e)return e;if(Ri(e)){var r={_placeholder:!0,num:t.length};return t.push(e),r}else if(rn(e)){for(var n=new Array(e.length),a=0;a<e.length;a++)n[a]=nn(e[a],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){var n={};for(var i in e)n[i]=nn(e[i],t);return n}return e}wt.reconstructPacket=function(e,t){return e.data=an(e.data,t),e.attachments=void 0,e};function an(e,t){if(!e)return e;if(e&&e._placeholder===!0){var r=typeof e.num=="number"&&e.num>=0&&e.num<t.length;if(r)return t[e.num];throw new Error("illegal attachments")}else if(rn(e))for(var n=0;n<e.length;n++)e[n]=an(e[n],t);else if(typeof e=="object")for(var a in e)e[a]=an(e[a],t);return e}wt.removeBlobs=function(e,t){function r(i,c,f){if(!i)return i;if(Cc&&i instanceof Blob||_c&&i instanceof File){n++;var p=new FileReader;p.onload=function(){f?f[c]=this.result:a=this.result,--n||t(a)},p.readAsArrayBuffer(i)}else if(rn(i))for(var o=0;o<i.length;o++)r(i[o],o,i);else if(typeof i=="object"&&!Ri(i))for(var x in i)r(i[x],x,i)}var n=0,a=e;r(a),n||t(a)},function(e){var t=G0("socket.io-parser"),r=He,n=wt,a=tn,i=ki;e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=c,e.Decoder=h;function c(){}var f=e.ERROR+'"encode error"';c.prototype.encode=function(E,y){if(t("encoding packet %j",E),e.BINARY_EVENT===E.type||e.BINARY_ACK===E.type)x(E,y);else{var B=p(E);y([B])}};function p(E){var y=""+E.type;if((e.BINARY_EVENT===E.type||e.BINARY_ACK===E.type)&&(y+=E.attachments+"-"),E.nsp&&E.nsp!=="/"&&(y+=E.nsp+","),E.id!=null&&(y+=E.id),E.data!=null){var B=o(E.data);if(B!==!1)y+=B;else return f}return t("encoded %j as %s",E,y),y}function o(E){try{return JSON.stringify(E)}catch(y){return!1}}function x(E,y){function B(b){var F=n.deconstructPacket(b),D=p(F.packet),T=F.buffers;T.unshift(D),y(T)}n.removeBlobs(E,B)}function h(){this.reconstructor=null}r(h.prototype),h.prototype.add=function(E){var y;if(typeof E=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");y=d(E),e.BINARY_EVENT===y.type||e.BINARY_ACK===y.type?(this.reconstructor=new m(y),this.reconstructor.reconPack.attachments===0&&this.emit("decoded",y)):this.emit("decoded",y)}else if(i(E)||E.base64)if(this.reconstructor)y=this.reconstructor.takeBinaryData(E),y&&(this.reconstructor=null,this.emit("decoded",y));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+E)};function s(E,y){switch(E){case 0:return typeof y=="object";case 1:return y===void 0;case 4:return typeof y=="string"||typeof y=="object";case 2:case 5:return a(y)&&(typeof y[0]=="string"||typeof y[0]=="number");case 3:case 6:return a(y)}}function d(E){var y=0,B={type:Number(E.charAt(0))};if(e.types[B.type]==null)return C("unknown packet type "+B.type);if(e.BINARY_EVENT===B.type||e.BINARY_ACK===B.type){for(var b=y+1;E.charAt(++y)!=="-"&&y!=E.length;);var F=E.substring(b,y);if(F!=Number(F)||E.charAt(y)!=="-")throw new Error("Illegal attachments");B.attachments=Number(F)}if(E.charAt(y+1)==="/"){for(var b=y+1;++y;){var D=E.charAt(y);if(D===","||y===E.length)break}B.nsp=E.substring(b,y)}else B.nsp="/";var T=E.charAt(y+1);if(T!==""&&Number(T)==T){for(var b=y+1;++y;){var D=E.charAt(y);if(D==null||Number(D)!=D){--y;break}if(y===E.length)break}B.id=Number(E.substring(b,y+1))}if(E.charAt(++y)){var P=v(E.substr(y));if(s(B.type,P))B.data=P;else throw new Error("invalid payload")}return t("decoded %s as %j",E,B),B}function v(E){try{return JSON.parse(E)}catch(y){return!1}}h.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()};function m(E){this.reconPack=E,this.buffers=[]}m.prototype.takeBinaryData=function(E){if(this.buffers.push(E),this.buffers.length===this.reconPack.attachments){var y=n.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),y}return null},m.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]};function C(E){return{type:e.ERROR,data:"parser error: "+E}}}(Dt);var on={exports:{}},St={},sn={exports:{}};try{sn.exports=typeof XMLHttpRequest!="undefined"&&"withCredentials"in new XMLHttpRequest}catch(e){sn.exports=!1}var Ec=sn.exports,xn=function(){return typeof self!="undefined"?self:typeof window!="undefined"?window:Function("return this")()}(),Fc=Ec,Ac=xn,cn=function(e){var t=e.xdomain,r=e.xscheme,n=e.enablesXDR;try{if(typeof XMLHttpRequest!="undefined"&&(!t||Fc))return new XMLHttpRequest}catch(a){}try{if(typeof XDomainRequest!="undefined"&&!r&&n)return new XDomainRequest}catch(a){}if(!t)try{return new Ac[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch(a){}},fn={exports:{}},ve={},Dc=Object.keys||function(t){var r=[],n=Object.prototype.hasOwnProperty;for(var a in t)n.call(t,a)&&r.push(a);return r},wc=tn,Ii=Object.prototype.toString,Sc=typeof Blob=="function"||typeof Blob!="undefined"&&Ii.call(Blob)==="[object BlobConstructor]",Tc=typeof File=="function"||typeof File!="undefined"&&Ii.call(File)==="[object FileConstructor]",qi=Tt;function Tt(e){if(!e||typeof e!="object")return!1;if(wc(e)){for(var t=0,r=e.length;t<r;t++)if(Tt(e[t]))return!0;return!1}if(typeof Buffer=="function"&&Buffer.isBuffer&&Buffer.isBuffer(e)||typeof ArrayBuffer=="function"&&e instanceof ArrayBuffer||Sc&&e instanceof Blob||Tc&&e instanceof File)return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Tt(e.toJSON(),!0);for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&Tt(e[n]))return!0;return!1}var kc=function(e,t,r){var n=e.byteLength;if(t=t||0,r=r||n,e.slice)return e.slice(t,r);if(t<0&&(t+=n),r<0&&(r+=n),r>n&&(r=n),t>=n||t>=r||n===0)return new ArrayBuffer(0);for(var a=new Uint8Array(e),i=new Uint8Array(r-t),c=t,f=0;c<r;c++,f++)i[f]=a[c];return i.buffer},Rc=Pc;function Pc(e,t,r){var n=!1;return r=r||Ic,a.count=e,e===0?t():a;function a(i,c){if(a.count<=0)throw new Error("after called too many times");--a.count,i?(n=!0,t(i),t=r):a.count===0&&!n&&t(null,c)}}function Ic(){}/*! https://mths.be/utf8js v2.1.2 by @mathias */var ae=String.fromCharCode;function Oi(e){for(var t=[],r=0,n=e.length,a,i;r<n;)a=e.charCodeAt(r++),a>=55296&&a<=56319&&r<n?(i=e.charCodeAt(r++),(i&64512)==56320?t.push(((a&1023)<<10)+(i&1023)+65536):(t.push(a),r--)):t.push(a);return t}function qc(e){for(var t=e.length,r=-1,n,a="";++r<t;)n=e[r],n>65535&&(n-=65536,a+=ae(n>>>10&1023|55296),n=56320|n&1023),a+=ae(n);return a}function Hi(e,t){if(e>=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function dn(e,t){return ae(e>>t&63|128)}function Oc(e,t){if(!(e&4294967168))return ae(e);var r="";return e&4294965248?e&4294901760?e&4292870144||(r=ae(e>>18&7|240),r+=dn(e,12),r+=dn(e,6)):(Hi(e,t)||(e=65533),r=ae(e>>12&15|224),r+=dn(e,6)):r=ae(e>>6&31|192),r+=ae(e&63|128),r}function Hc(e,t){t=t||{};for(var r=t.strict!==!1,n=Oi(e),a=n.length,i=-1,c,f="";++i<a;)c=n[i],f+=Oc(c,r);return f}function Ne(){if(ie>=Rt)throw Error("Invalid byte index");var e=kt[ie]&255;if(ie++,(e&192)==128)return e&63;throw Error("Invalid continuation byte")}function Nc(e){var t,r,n,a,i;if(ie>Rt)throw Error("Invalid byte index");if(ie==Rt)return!1;if(t=kt[ie]&255,ie++,!(t&128))return t;if((t&224)==192){if(r=Ne(),i=(t&31)<<6|r,i>=128)return i;throw Error("Invalid continuation byte")}if((t&240)==224){if(r=Ne(),n=Ne(),i=(t&15)<<12|r<<6|n,i>=2048)return Hi(i,e)?i:65533;throw Error("Invalid continuation byte")}if((t&248)==240&&(r=Ne(),n=Ne(),a=Ne(),i=(t&7)<<18|r<<12|n<<6|a,i>=65536&&i<=1114111))return i;throw Error("Invalid UTF-8 detected")}var kt,Rt,ie;function Mc(e,t){t=t||{};var r=t.strict!==!1;kt=Oi(e),Rt=kt.length,ie=0;for(var n=[],a;(a=Nc(r))!==!1;)n.push(a);return qc(n)}var Uc={version:"2.1.2",encode:Hc,decode:Mc},Pt={},Ni;function zc(){return Ni||(Ni=1,function(e){Pt.encode=function(t){var r=new Uint8Array(t),n,a=r.length,i="";for(n=0;n<a;n+=3)i+=e[r[n]>>2],i+=e[(r[n]&3)<<4|r[n+1]>>4],i+=e[(r[n+1]&15)<<2|r[n+2]>>6],i+=e[r[n+2]&63];return a%3===2?i=i.substring(0,i.length-1)+"=":a%3===1&&(i=i.substring(0,i.length-2)+"=="),i},Pt.decode=function(t){var r=t.length*.75,n=t.length,a,i=0,c,f,p,o;t[t.length-1]==="="&&(r--,t[t.length-2]==="="&&r--);var x=new ArrayBuffer(r),h=new Uint8Array(x);for(a=0;a<n;a+=4)c=e.indexOf(t[a]),f=e.indexOf(t[a+1]),p=e.indexOf(t[a+2]),o=e.indexOf(t[a+3]),h[i++]=c<<2|f>>4,h[i++]=(f&15)<<4|p>>2,h[i++]=(p&3)<<6|o&63;return x}}("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/")),Pt}var un,Mi;function Lc(){if(Mi)return un;Mi=1;var e=typeof e!="undefined"?e:typeof WebKitBlobBuilder!="undefined"?WebKitBlobBuilder:typeof MSBlobBuilder!="undefined"?MSBlobBuilder:typeof MozBlobBuilder!="undefined"?MozBlobBuilder:!1,t=function(){try{var f=new Blob(["hi"]);return f.size===2}catch(p){return!1}}(),r=t&&function(){try{var f=new Blob([new Uint8Array([1,2])]);return f.size===2}catch(p){return!1}}(),n=e&&e.prototype.append&&e.prototype.getBlob;function a(f){return f.map(function(p){if(p.buffer instanceof ArrayBuffer){var o=p.buffer;if(p.byteLength!==o.byteLength){var x=new Uint8Array(p.byteLength);x.set(new Uint8Array(o,p.byteOffset,p.byteLength)),o=x.buffer}return o}return p})}function i(f,p){p=p||{};var o=new e;return a(f).forEach(function(x){o.append(x)}),p.type?o.getBlob(p.type):o.getBlob()}function c(f,p){return new Blob(a(f),p||{})}return typeof Blob!="undefined"&&(i.prototype=Blob.prototype,c.prototype=Blob.prototype),un=function(){return t?r?Blob:c:n?i:void 0}(),un}(function(e){var t=Dc,r=qi,n=kc,a=Rc,i=Uc,c;typeof ArrayBuffer!="undefined"&&(c=zc());var f=typeof navigator!="undefined"&&/Android/i.test(navigator.userAgent),p=typeof navigator!="undefined"&&/PhantomJS/i.test(navigator.userAgent),o=f||p;e.protocol=3;var x=e.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},h=t(x),s={type:"error",data:"parser error"},d=Lc();e.encodePacket=function(b,F,D,T){typeof F=="function"&&(T=F,F=!1),typeof D=="function"&&(T=D,D=null);var P=b.data===void 0?void 0:b.data.buffer||b.data;if(typeof ArrayBuffer!="undefined"&&P instanceof ArrayBuffer)return m(b,F,T);if(typeof d!="undefined"&&P instanceof d)return E(b,F,T);if(P&&P.base64)return v(b,T);var H=x[b.type];return b.data!==void 0&&(H+=D?i.encode(String(b.data),{strict:!1}):String(b.data)),T(""+H)};function v(b,F){var D="b"+e.packets[b.type]+b.data.data;return F(D)}function m(b,F,D){if(!F)return e.encodeBase64Packet(b,D);var T=b.data,P=new Uint8Array(T),H=new Uint8Array(1+T.byteLength);H[0]=x[b.type];for(var S=0;S<P.length;S++)H[S+1]=P[S];return D(H.buffer)}function C(b,F,D){if(!F)return e.encodeBase64Packet(b,D);var T=new FileReader;return T.onload=function(){e.encodePacket({type:b.type,data:T.result},F,!0,D)},T.readAsArrayBuffer(b.data)}function E(b,F,D){if(!F)return e.encodeBase64Packet(b,D);if(o)return C(b,F,D);var T=new Uint8Array(1);T[0]=x[b.type];var P=new d([T.buffer,b.data]);return D(P)}e.encodeBase64Packet=function(b,F){var D="b"+e.packets[b.type];if(typeof d!="undefined"&&b.data instanceof d){var T=new FileReader;return T.onload=function(){var q=T.result.split(",")[1];F(D+q)},T.readAsDataURL(b.data)}var P;try{P=String.fromCharCode.apply(null,new Uint8Array(b.data))}catch(q){for(var H=new Uint8Array(b.data),S=new Array(H.length),A=0;A<H.length;A++)S[A]=H[A];P=String.fromCharCode.apply(null,S)}return D+=btoa(P),F(D)},e.decodePacket=function(b,F,D){if(b===void 0)return s;if(typeof b=="string"){if(b.charAt(0)==="b")return e.decodeBase64Packet(b.substr(1),F);if(D&&(b=y(b),b===!1))return s;var P=b.charAt(0);return Number(P)!=P||!h[P]?s:b.length>1?{type:h[P],data:b.substring(1)}:{type:h[P]}}var T=new Uint8Array(b),P=T[0],H=n(b,1);return d&&F==="blob"&&(H=new d([H])),{type:h[P],data:H}};function y(b){try{b=i.decode(b,{strict:!1})}catch(F){return!1}return b}e.decodeBase64Packet=function(b,F){var D=h[b.charAt(0)];if(!c)return{type:D,data:{base64:!0,data:b.substr(1)}};var T=c.decode(b.substr(1));return F==="blob"&&d&&(T=new d([T])),{type:D,data:T}},e.encodePayload=function(b,F,D){typeof F=="function"&&(D=F,F=null);var T=r(b);if(F&&T)return d&&!o?e.encodePayloadAsBlob(b,D):e.encodePayloadAsArrayBuffer(b,D);if(!b.length)return D("0:");function P(S){return S.length+":"+S}function H(S,A){e.encodePacket(S,T?F:!1,!1,function(q){A(null,P(q))})}B(b,H,function(S,A){return D(A.join(""))})};function B(b,F,D){for(var T=new Array(b.length),P=a(b.length,D),H=function(A,q,N){F(q,function(z,L){T[A]=L,N(z,T)})},S=0;S<b.length;S++)H(S,b[S],P)}e.decodePayload=function(b,F,D){if(typeof b!="string")return e.decodePayloadAsBinary(b,F,D);typeof F=="function"&&(D=F,F=null);var T;if(b==="")return D(s,0,1);for(var P="",H,S,A=0,q=b.length;A<q;A++){var N=b.charAt(A);if(N!==":"){P+=N;continue}if(P===""||P!=(H=Number(P))||(S=b.substr(A+1,H),P!=S.length))return D(s,0,1);if(S.length){if(T=e.decodePacket(S,F,!1),s.type===T.type&&s.data===T.data)return D(s,0,1);var z=D(T,A+H,q);if(z===!1)return}A+=H,P=""}if(P!=="")return D(s,0,1)},e.encodePayloadAsArrayBuffer=function(b,F){if(!b.length)return F(new ArrayBuffer(0));function D(T,P){e.encodePacket(T,!0,!0,function(H){return P(null,H)})}B(b,D,function(T,P){var H=P.reduce(function(q,N){var z;return typeof N=="string"?z=N.length:z=N.byteLength,q+z.toString().length+z+2},0),S=new Uint8Array(H),A=0;return P.forEach(function(q){var N=typeof q=="string",z=q;if(N){for(var Y=new Uint8Array(q.length),L=0;L<q.length;L++)Y[L]=q.charCodeAt(L);z=Y.buffer}N?S[A++]=0:S[A++]=1;for(var X=z.byteLength.toString(),L=0;L<X.length;L++)S[A++]=parseInt(X[L]);S[A++]=255;for(var Y=new Uint8Array(z),L=0;L<Y.length;L++)S[A++]=Y[L]}),F(S.buffer)})},e.encodePayloadAsBlob=function(b,F){function D(T,P){e.encodePacket(T,!0,!0,function(H){var S=new Uint8Array(1);if(S[0]=1,typeof H=="string"){for(var A=new Uint8Array(H.length),q=0;q<H.length;q++)A[q]=H.charCodeAt(q);H=A.buffer,S[0]=0}for(var N=H instanceof ArrayBuffer?H.byteLength:H.size,z=N.toString(),L=new Uint8Array(z.length+1),q=0;q<z.length;q++)L[q]=parseInt(z[q]);if(L[z.length]=255,d){var X=new d([S.buffer,L.buffer,H]);P(null,X)}})}B(b,D,function(T,P){return F(new d(P))})},e.decodePayloadAsBinary=function(b,F,D){typeof F=="function"&&(D=F,F=null);for(var T=b,P=[];T.byteLength>0;){for(var H=new Uint8Array(T),S=H[0]===0,A="",q=1;H[q]!==255;q++){if(A.length>310)return D(s,0,1);A+=H[q]}T=n(T,2+A.length),A=parseInt(A);var N=n(T,0,A);if(S)try{N=String.fromCharCode.apply(null,new Uint8Array(N))}catch(X){var z=new Uint8Array(N);N="";for(var q=0;q<z.length;q++)N+=String.fromCharCode(z[q])}P.push(N),T=n(T,A)}var L=P.length;P.forEach(function(X,Y){D(e.decodePacket(X,F,!0),Y,L)})}})(ve);var hn,Ui;function ln(){if(Ui)return hn;Ui=1;var e=ve,t=He;hn=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 t(r.prototype),r.prototype.onError=function(n,a){var i=new Error(n);return i.type="TransportError",i.description=a,this.emit("error",i),this},r.prototype.open=function(){return(this.readyState==="closed"||this.readyState==="")&&(this.readyState="opening",this.doOpen()),this},r.prototype.close=function(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this},r.prototype.send=function(n){if(this.readyState==="open")this.write(n);else throw new Error("Transport not open")},r.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},r.prototype.onData=function(n){var a=e.decodePacket(n,this.socket.binaryType);this.onPacket(a)},r.prototype.onPacket=function(n){this.emit("packet",n)},r.prototype.onClose=function(){this.readyState="closed",this.emit("close")},hn}var Me={};Me.encode=function(e){var t="";for(var r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t},Me.decode=function(e){for(var t={},r=e.split("&"),n=0,a=r.length;n<a;n++){var i=r[n].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t};var It=function(e,t){var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e},zi="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),qt=64,Li={},$i=0,oe=0,Ki;function pn(e){var t="";do t=zi[e%qt]+t,e=Math.floor(e/qt);while(e>0);return t}function $c(e){var t=0;for(oe=0;oe<e.length;oe++)t=t*qt+Li[e.charAt(oe)];return t}function bn(){var e=pn(+new Date);return e!==Ki?($i=0,Ki=e):e+"."+pn($i++)}for(;oe<qt;oe++)Li[zi[oe]]=oe;bn.encode=pn,bn.decode=$c;var Wi=bn,ji=ln(),Kc=Me,Xi=ve,Wc=It,jc=Wi,M0=G0("engine.io-client:polling"),Vi=K0,Xc=function(){var e=cn,t=new e({xdomain:!1});return t.responseType!=null}();function K0(e){var t=e&&e.forceBase64;(!Xc||t)&&(this.supportsBinary=!1),ji.call(this,e)}Wc(K0,ji),K0.prototype.name="polling",K0.prototype.doOpen=function(){this.poll()},K0.prototype.pause=function(e){var t=this;this.readyState="pausing";function r(){M0("paused"),t.readyState="paused",e()}if(this.polling||!this.writable){var n=0;this.polling&&(M0("we are currently polling - waiting to pause"),n++,this.once("pollComplete",function(){M0("pre-pause polling complete"),--n||r()})),this.writable||(M0("we are currently writing - waiting to pause"),n++,this.once("drain",function(){M0("pre-pause writing complete"),--n||r()}))}else r()},K0.prototype.poll=function(){M0("polling"),this.polling=!0,this.doPoll(),this.emit("poll")},K0.prototype.onData=function(e){var t=this;M0("polling got data %s",e);var r=function(n,a,i){if(t.readyState==="opening"&&n.type==="open"&&t.onOpen(),n.type==="close")return t.onClose(),!1;t.onPacket(n)};Xi.decodePayload(e,this.socket.binaryType,r),this.readyState!=="closed"&&(this.polling=!1,this.emit("pollComplete"),this.readyState==="open"?this.poll():M0('ignoring poll - transport state "%s"',this.readyState))},K0.prototype.doClose=function(){var e=this;function t(){M0("writing close packet"),e.write([{type:"close"}])}this.readyState==="open"?(M0("transport open - closing"),t()):(M0("transport not open - deferring close"),this.once("open",t))},K0.prototype.write=function(e){var t=this;this.writable=!1;var r=function(){t.writable=!0,t.emit("drain")};Xi.encodePayload(e,this.supportsBinary,function(n){t.doWrite(n,r)})},K0.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",r="";this.timestampRequests!==!1&&(e[this.timestampParam]=jc()),!this.supportsBinary&&!e.sid&&(e.b64=1),e=Kc.encode(e),this.port&&(t==="https"&&Number(this.port)!==443||t==="http"&&Number(this.port)!==80)&&(r=":"+this.port),e.length&&(e="?"+e);var n=this.hostname.indexOf(":")!==-1;return t+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+e};var Vc=cn,Gi=Vi,Gc=He,Zc=It,vn=G0("engine.io-client:polling-xhr"),Yc=xn;fn.exports=Ue,fn.exports.Request=h0;function Zi(){}function Ue(e){if(Gi.call(this,e),this.requestTimeout=e.requestTimeout,this.extraHeaders=e.extraHeaders,typeof location!="undefined"){var t=location.protocol==="https:",r=location.port;r||(r=t?443:80),this.xd=typeof location!="undefined"&&e.hostname!==location.hostname||r!==e.port,this.xs=e.secure!==t}}Zc(Ue,Gi),Ue.prototype.supportsBinary=!0,Ue.prototype.request=function(e){return e=e||{},e.uri=this.uri(),e.xd=this.xd,e.xs=this.xs,e.agent=this.agent||!1,e.supportsBinary=this.supportsBinary,e.enablesXDR=this.enablesXDR,e.withCredentials=this.withCredentials,e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized,e.requestTimeout=this.requestTimeout,e.extraHeaders=this.extraHeaders,new h0(e)},Ue.prototype.doWrite=function(e,t){var r=typeof e!="string"&&e!==void 0,n=this.request({method:"POST",data:e,isBinary:r}),a=this;n.on("success",t),n.on("error",function(i){a.onError("xhr post error",i)}),this.sendXhr=n},Ue.prototype.doPoll=function(){vn("xhr poll");var e=this.request(),t=this;e.on("data",function(r){t.onData(r)}),e.on("error",function(r){t.onError("xhr poll error",r)}),this.pollXhr=e};function h0(e){this.method=e.method||"GET",this.uri=e.uri,this.xd=!!e.xd,this.xs=!!e.xs,this.async=e.async!==!1,this.data=e.data!==void 0?e.data:null,this.agent=e.agent,this.isBinary=e.isBinary,this.supportsBinary=e.supportsBinary,this.enablesXDR=e.enablesXDR,this.withCredentials=e.withCredentials,this.requestTimeout=e.requestTimeout,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.extraHeaders=e.extraHeaders,this.create()}if(Gc(h0.prototype),h0.prototype.create=function(){var e={agent:this.agent,xdomain:this.xd,xscheme:this.xs,enablesXDR:this.enablesXDR};e.pfx=this.pfx,e.key=this.key,e.passphrase=this.passphrase,e.cert=this.cert,e.ca=this.ca,e.ciphers=this.ciphers,e.rejectUnauthorized=this.rejectUnauthorized;var t=this.xhr=new Vc(e),r=this;try{vn("xhr open %s: %s",this.method,this.uri),t.open(this.method,this.uri,this.async);try{if(this.extraHeaders){t.setDisableHeaderCheck&&t.setDisableHeaderCheck(!0);for(var n in this.extraHeaders)this.extraHeaders.hasOwnProperty(n)&&t.setRequestHeader(n,this.extraHeaders[n])}}catch(a){}if(this.method==="POST")try{this.isBinary?t.setRequestHeader("Content-type","application/octet-stream"):t.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(a){}try{t.setRequestHeader("Accept","*/*")}catch(a){}"withCredentials"in t&&(t.withCredentials=this.withCredentials),this.requestTimeout&&(t.timeout=this.requestTimeout),this.hasXDR()?(t.onload=function(){r.onLoad()},t.onerror=function(){r.onError(t.responseText)}):t.onreadystatechange=function(){if(t.readyState===2)try{var a=t.getResponseHeader("Content-Type");(r.supportsBinary&&a==="application/octet-stream"||a==="application/octet-stream; charset=UTF-8")&&(t.responseType="arraybuffer")}catch(i){}t.readyState===4&&(t.status===200||t.status===1223?r.onLoad():setTimeout(function(){r.onError(typeof t.status=="number"?t.status:0)},0))},vn("xhr data %s",this.data),t.send(this.data)}catch(a){setTimeout(function(){r.onError(a)},0);return}typeof document!="undefined"&&(this.index=h0.requestsCount++,h0.requests[this.index]=this)},h0.prototype.onSuccess=function(){this.emit("success"),this.cleanup()},h0.prototype.onData=function(e){this.emit("data",e),this.onSuccess()},h0.prototype.onError=function(e){this.emit("error",e),this.cleanup(!0)},h0.prototype.cleanup=function(e){if(!(typeof this.xhr=="undefined"||this.xhr===null)){if(this.hasXDR()?this.xhr.onload=this.xhr.onerror=Zi:this.xhr.onreadystatechange=Zi,e)try{this.xhr.abort()}catch(t){}typeof document!="undefined"&&delete h0.requests[this.index],this.xhr=null}},h0.prototype.onLoad=function(){var e;try{var t;try{t=this.xhr.getResponseHeader("Content-Type")}catch(r){}t==="application/octet-stream"||t==="application/octet-stream; charset=UTF-8"?e=this.xhr.response||this.xhr.responseText:e=this.xhr.responseText}catch(r){this.onError(r)}e!=null&&this.onData(e)},h0.prototype.hasXDR=function(){return typeof XDomainRequest!="undefined"&&!this.xs&&this.enablesXDR},h0.prototype.abort=function(){this.cleanup()},h0.requestsCount=0,h0.requests={},typeof document!="undefined"){if(typeof attachEvent=="function")attachEvent("onunload",Yi);else if(typeof addEventListener=="function"){var Qc="onpagehide"in Yc?"pagehide":"unload";addEventListener(Qc,Yi,!1)}}function Yi(){for(var e in h0.requests)h0.requests.hasOwnProperty(e)&&h0.requests[e].abort()}var Jc=fn.exports,yn=Vi,ef=It,Qi=xn,tf=ze,rf=/\n/g,nf=/\\n/g,Ot;function af(){}function ze(e){yn.call(this,e),this.query=this.query||{},Ot||(Ot=Qi.___eio=Qi.___eio||[]),this.index=Ot.length;var t=this;Ot.push(function(r){t.onData(r)}),this.query.j=this.index,typeof addEventListener=="function"&&addEventListener("beforeunload",function(){t.script&&(t.script.onerror=af)},!1)}ef(ze,yn),ze.prototype.supportsBinary=!1,ze.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),yn.prototype.doClose.call(this)},ze.prototype.doPoll=function(){var e=this,t=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),t.async=!0,t.src=this.uri(),t.onerror=function(a){e.onError("jsonp poll error",a)};var r=document.getElementsByTagName("script")[0];r?r.parentNode.insertBefore(t,r):(document.head||document.body).appendChild(t),this.script=t;var n=typeof navigator!="undefined"&&/gecko/i.test(navigator.userAgent);n&&setTimeout(function(){var a=document.createElement("iframe");document.body.appendChild(a),document.body.removeChild(a)},100)},ze.prototype.doWrite=function(e,t){var r=this;if(!this.form){var n=document.createElement("form"),a=document.createElement("textarea"),i=this.iframeId="eio_iframe_"+this.index,c;n.className="socketio",n.style.position="absolute",n.style.top="-1000px",n.style.left="-1000px",n.target=i,n.method="POST",n.setAttribute("accept-charset","utf-8"),a.name="d",n.appendChild(a),document.body.appendChild(n),this.form=n,this.area=a}this.form.action=this.uri();function f(){p(),t()}function p(){if(r.iframe)try{r.form.removeChild(r.iframe)}catch(x){r.onError("jsonp polling iframe removal error",x)}try{var o='<iframe src="javascript:0" name="'+r.iframeId+'">';c=document.createElement(o)}catch(x){c=document.createElement("iframe"),c.name=r.iframeId,c.src="javascript:0"}c.id=r.iframeId,r.form.appendChild(c),r.iframe=c}p(),e=e.replace(nf,`\\
|
|
21
|
-
`),this.area.value=e.replace(rf,"\\n");try{this.form.submit()}catch(o){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){r.iframe.readyState==="complete"&&f()}:this.iframe.onload=f};var gn=ln(),of=ve,sf=Me,xf=It,cf=Wi,ff=G0("engine.io-client:websocket"),Ht,mn;if(typeof WebSocket!="undefined"?Ht=WebSocket:typeof self!="undefined"&&(Ht=self.WebSocket||self.MozWebSocket),typeof window=="undefined")try{mn=Kn}catch(e){}var Le=Ht||mn,df=I0;function I0(e){var t=e&&e.forceBase64;t&&(this.supportsBinary=!1),this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=Ht&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(Le=mn),gn.call(this,e)}xf(I0,gn),I0.prototype.name="websocket",I0.prototype.supportsBinary=!0,I0.prototype.doOpen=function(){if(this.check()){var e=this.uri(),t=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?t?new Le(e,t):new Le(e):new Le(e,t,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()}},I0.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},I0.prototype.write=function(e){var t=this;this.writable=!1;for(var r=e.length,n=0,a=r;n<a;n++)(function(c){of.encodePacket(c,t.supportsBinary,function(f){if(!t.usingBrowserWebSocket){var p={};if(c.options&&(p.compress=c.options.compress),t.perMessageDeflate){var o=typeof f=="string"?Buffer.byteLength(f):f.length;o<t.perMessageDeflate.threshold&&(p.compress=!1)}}try{t.usingBrowserWebSocket?t.ws.send(f):t.ws.send(f,p)}catch(x){ff("websocket closed before onclose event")}--r||i()})})(e[n]);function i(){t.emit("flush"),setTimeout(function(){t.writable=!0,t.emit("drain")},0)}},I0.prototype.onClose=function(){gn.prototype.onClose.call(this)},I0.prototype.doClose=function(){typeof this.ws!="undefined"&&this.ws.close()},I0.prototype.uri=function(){var e=this.query||{},t=this.secure?"wss":"ws",r="";this.port&&(t==="wss"&&Number(this.port)!==443||t==="ws"&&Number(this.port)!==80)&&(r=":"+this.port),this.timestampRequests&&(e[this.timestampParam]=cf()),this.supportsBinary||(e.b64=1),e=sf.encode(e),e.length&&(e="?"+e);var n=this.hostname.indexOf(":")!==-1;return t+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+e},I0.prototype.check=function(){return!!Le&&!("__initialize"in Le&&this.name===I0.prototype.name)};var uf=cn,hf=Jc,lf=tf,pf=df;St.polling=bf,St.websocket=pf;function bf(e){var t,r=!1,n=!1,a=e.jsonp!==!1;if(typeof location!="undefined"){var i=location.protocol==="https:",c=location.port;c||(c=i?443:80),r=e.hostname!==location.hostname||c!==e.port,n=e.secure!==i}if(e.xdomain=r,e.xscheme=n,t=new uf(e),"open"in t&&!e.forceJSONP)return new hf(e);if(!a)throw new Error("JSONP disabled");return new lf(e)}var vf=[].indexOf,Ji=function(e,t){if(vf)return e.indexOf(t);for(var r=0;r<e.length;++r)if(e[r]===t)return r;return-1},yf=St,gf=He,u0=G0("engine.io-client:socket"),mf=Ji,eo=ve,to=wi,Bf=Me,Cf=e0;function e0(e,t){if(!(this instanceof e0))return new e0(e,t);t=t||{},e&&typeof e=="object"&&(t=e,e=null),e?(e=to(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=to(t.host).host),this.secure=t.secure!=null?t.secure:typeof location!="undefined"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.agent=t.agent||!1,this.hostname=t.hostname||(typeof location!="undefined"?location.hostname:"localhost"),this.port=t.port||(typeof location!="undefined"&&location.port?location.port:this.secure?443:80),this.query=t.query||{},typeof this.query=="string"&&(this.query=Bf.decode(this.query)),this.upgrade=t.upgrade!==!1,this.path=(t.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!t.forceJSONP,this.jsonp=t.jsonp!==!1,this.forceBase64=!!t.forceBase64,this.enablesXDR=!!t.enablesXDR,this.withCredentials=t.withCredentials!==!1,this.timestampParam=t.timestampParam||"t",this.timestampRequests=t.timestampRequests,this.transports=t.transports||["polling","websocket"],this.transportOptions=t.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=t.policyPort||843,this.rememberUpgrade=t.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=t.onlyBinaryUpgrades,this.perMessageDeflate=t.perMessageDeflate!==!1?t.perMessageDeflate||{}:!1,this.perMessageDeflate===!0&&(this.perMessageDeflate={}),this.perMessageDeflate&&this.perMessageDeflate.threshold==null&&(this.perMessageDeflate.threshold=1024),this.pfx=t.pfx||void 0,this.key=t.key||void 0,this.passphrase=t.passphrase||void 0,this.cert=t.cert||void 0,this.ca=t.ca||void 0,this.ciphers=t.ciphers||void 0,this.rejectUnauthorized=t.rejectUnauthorized===void 0?!0:t.rejectUnauthorized,this.forceNode=!!t.forceNode,this.isReactNative=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",(typeof self=="undefined"||this.isReactNative)&&(t.extraHeaders&&Object.keys(t.extraHeaders).length>0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}e0.priorWebsocketSuccess=!1,gf(e0.prototype),e0.protocol=eo.protocol,e0.Socket=e0,e0.Transport=ln(),e0.transports=St,e0.parser=ve,e0.prototype.createTransport=function(e){u0('creating transport "%s"',e);var t=_f(this.query);t.EIO=eo.protocol,t.transport=e;var r=this.transportOptions[e]||{};this.id&&(t.sid=this.id);var n=new yf[e]({query:t,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 _f(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}e0.prototype.open=function(){var e;if(this.rememberUpgrade&&e0.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){var t=this;setTimeout(function(){t.emit("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch(r){this.transports.shift(),this.open();return}e.open(),this.setTransport(e)},e0.prototype.setTransport=function(e){u0("setting transport %s",e.name);var t=this;this.transport&&(u0("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.onDrain()}).on("packet",function(r){t.onPacket(r)}).on("error",function(r){t.onError(r)}).on("close",function(){t.onClose("transport close")})},e0.prototype.probe=function(e){u0('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),r=!1,n=this;e0.priorWebsocketSuccess=!1;function a(){if(n.onlyBinaryUpgrades){var h=!this.supportsBinary&&n.transport.supportsBinary;r=r||h}r||(u0('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",function(s){if(!r)if(s.type==="pong"&&s.data==="probe"){if(u0('probe transport "%s" pong',e),n.upgrading=!0,n.emit("upgrading",t),!t)return;e0.priorWebsocketSuccess=t.name==="websocket",u0('pausing current transport "%s"',n.transport.name),n.transport.pause(function(){r||n.readyState!=="closed"&&(u0("changing transport and sending upgrade packet"),x(),n.setTransport(t),t.send([{type:"upgrade"}]),n.emit("upgrade",t),t=null,n.upgrading=!1,n.flush())})}else{u0('probe transport "%s" failed',e);var d=new Error("probe error");d.transport=t.name,n.emit("upgradeError",d)}}))}function i(){r||(r=!0,x(),t.close(),t=null)}function c(h){var s=new Error("probe error: "+h);s.transport=t.name,i(),u0('probe transport "%s" failed because of error: %s',e,h),n.emit("upgradeError",s)}function f(){c("transport closed")}function p(){c("socket closed")}function o(h){t&&h.name!==t.name&&(u0('"%s" works - aborting "%s"',h.name,t.name),i())}function x(){t.removeListener("open",a),t.removeListener("error",c),t.removeListener("close",f),n.removeListener("close",p),n.removeListener("upgrading",o)}t.once("open",a),t.once("error",c),t.once("close",f),this.once("close",p),this.once("upgrading",o),t.open()},e0.prototype.onOpen=function(){if(u0("socket open"),this.readyState="open",e0.priorWebsocketSuccess=this.transport.name==="websocket",this.emit("open"),this.flush(),this.readyState==="open"&&this.upgrade&&this.transport.pause){u0("starting upgrade probes");for(var e=0,t=this.upgrades.length;e<t;e++)this.probe(this.upgrades[e])}},e0.prototype.onPacket=function(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(u0('socket receive: type "%s", data "%s"',e.type,e.data),this.emit("packet",e),this.emit("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emit("data",e.data),this.emit("message",e.data);break}else u0('packet received with socket readyState "%s"',this.readyState)},e0.prototype.onHandshake=function(e){this.emit("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.onOpen(),this.readyState!=="closed"&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},e0.prototype.onHeartbeat=function(e){clearTimeout(this.pingTimeoutTimer);var t=this;t.pingTimeoutTimer=setTimeout(function(){t.readyState!=="closed"&&t.onClose("ping timeout")},e||t.pingInterval+t.pingTimeout)},e0.prototype.setPing=function(){var e=this;clearTimeout(e.pingIntervalTimer),e.pingIntervalTimer=setTimeout(function(){u0("writing ping packet - expecting pong within %sms",e.pingTimeout),e.ping(),e.onHeartbeat(e.pingTimeout)},e.pingInterval)},e0.prototype.ping=function(){var e=this;this.sendPacket("ping",function(){e.emit("ping")})},e0.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emit("drain"):this.flush()},e0.prototype.flush=function(){this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(u0("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},e0.prototype.write=e0.prototype.send=function(e,t,r){return this.sendPacket("message",e,t,r),this},e0.prototype.sendPacket=function(e,t,r,n){if(typeof t=="function"&&(n=t,t=void 0),typeof r=="function"&&(n=r,r=null),!(this.readyState==="closing"||this.readyState==="closed")){r=r||{},r.compress=r.compress!==!1;var a={type:e,data:t,options:r};this.emit("packetCreate",a),this.writeBuffer.push(a),n&&this.once("flush",n),this.flush()}},e0.prototype.close=function(){if(this.readyState==="opening"||this.readyState==="open"){this.readyState="closing";var e=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?n():t()}):this.upgrading?n():t()}function t(){e.onClose("forced close"),u0("socket closing - telling transport to close"),e.transport.close()}function r(){e.removeListener("upgrade",r),e.removeListener("upgradeError",r),t()}function n(){e.once("upgrade",r),e.once("upgradeError",r)}return this},e0.prototype.onError=function(e){u0("socket error %j",e),e0.priorWebsocketSuccess=!1,this.emit("error",e),this.onClose("transport error",e)},e0.prototype.onClose=function(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){u0('socket close with reason: "%s"',e);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",e,t),r.writeBuffer=[],r.prevBufferLen=0}},e0.prototype.filterUpgrades=function(e){for(var t=[],r=0,n=e.length;r<n;r++)~mf(this.transports,e[r])&&t.push(e[r]);return t},on.exports=Cf,on.exports.parser=ve;var Ef=on.exports,ro={exports:{}},Ff=Af;function Af(e,t){var r=[];t=t||0;for(var n=t||0;n<e.length;n++)r[n-t]=e[n];return r}var no=Df;function Df(e,t,r){return e.on(t,r),{destroy:function(){e.removeListener(t,r)}}}var ao=[].slice,io=function(e,t){if(typeof t=="string"&&(t=e[t]),typeof t!="function")throw new Error("bind() requires a function");var r=ao.call(arguments,2);return function(){return t.apply(e,r.concat(ao.call(arguments)))}};(function(e,t){var r=Dt,n=He,a=Ff,i=no,c=io,f=G0("socket.io-client:socket"),p=Me,o=qi;e.exports=s;var x={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 s(d,v,m){this.io=d,this.nsp=v,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},m&&m.query&&(this.query=m.query),this.io.autoConnect&&this.open()}n(s.prototype),s.prototype.subEvents=function(){if(!this.subs){var d=this.io;this.subs=[i(d,"open",c(this,"onopen")),i(d,"packet",c(this,"onpacket")),i(d,"close",c(this,"onclose"))]}},s.prototype.open=s.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)},s.prototype.send=function(){var d=a(arguments);return d.unshift("message"),this.emit.apply(this,d),this},s.prototype.emit=function(d){if(x.hasOwnProperty(d))return h.apply(this,arguments),this;var v=a(arguments),m={type:(this.flags.binary!==void 0?this.flags.binary:o(v))?r.BINARY_EVENT:r.EVENT,data:v};return m.options={},m.options.compress=!this.flags||this.flags.compress!==!1,typeof v[v.length-1]=="function"&&(f("emitting packet with ack id %d",this.ids),this.acks[this.ids]=v.pop(),m.id=this.ids++),this.connected?this.packet(m):this.sendBuffer.push(m),this.flags={},this},s.prototype.packet=function(d){d.nsp=this.nsp,this.io.packet(d)},s.prototype.onopen=function(){if(f("transport is open - connecting"),this.nsp!=="/")if(this.query){var d=typeof this.query=="object"?p.encode(this.query):this.query;f("sending connect packet with query %s",d),this.packet({type:r.CONNECT,query:d})}else this.packet({type:r.CONNECT})},s.prototype.onclose=function(d){f("close (%s)",d),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",d)},s.prototype.onpacket=function(d){var v=d.nsp===this.nsp,m=d.type===r.ERROR&&d.nsp==="/";if(!(!v&&!m))switch(d.type){case r.CONNECT:this.onconnect();break;case r.EVENT:this.onevent(d);break;case r.BINARY_EVENT:this.onevent(d);break;case r.ACK:this.onack(d);break;case r.BINARY_ACK:this.onack(d);break;case r.DISCONNECT:this.ondisconnect();break;case r.ERROR:this.emit("error",d.data);break}},s.prototype.onevent=function(d){var v=d.data||[];f("emitting event %j",v),d.id!=null&&(f("attaching ack callback to event"),v.push(this.ack(d.id))),this.connected?h.apply(this,v):this.receiveBuffer.push(v)},s.prototype.ack=function(d){var v=this,m=!1;return function(){if(!m){m=!0;var C=a(arguments);f("sending ack %j",C),v.packet({type:o(C)?r.BINARY_ACK:r.ACK,id:d,data:C})}}},s.prototype.onack=function(d){var v=this.acks[d.id];typeof v=="function"?(f("calling ack %s with %j",d.id,d.data),v.apply(this,d.data),delete this.acks[d.id]):f("bad ack %s",d.id)},s.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emitBuffered(),this.emit("connect")},s.prototype.emitBuffered=function(){var d;for(d=0;d<this.receiveBuffer.length;d++)h.apply(this,this.receiveBuffer[d]);for(this.receiveBuffer=[],d=0;d<this.sendBuffer.length;d++)this.packet(this.sendBuffer[d]);this.sendBuffer=[]},s.prototype.ondisconnect=function(){f("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},s.prototype.destroy=function(){if(this.subs){for(var d=0;d<this.subs.length;d++)this.subs[d].destroy();this.subs=null}this.io.destroy(this)},s.prototype.close=s.prototype.disconnect=function(){return this.connected&&(f("performing disconnect (%s)",this.nsp),this.packet({type:r.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},s.prototype.compress=function(d){return this.flags.compress=d,this},s.prototype.binary=function(d){return this.flags.binary=d,this}})(ro);var oo=ro.exports,wf=$e;function $e(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}$e.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+r:e-r}return Math.min(e,this.max)|0},$e.prototype.reset=function(){this.attempts=0},$e.prototype.setMin=function(e){this.ms=e},$e.prototype.setMax=function(e){this.max=e},$e.prototype.setJitter=function(e){this.jitter=e};var Sf=Ef,Tf=oo,kf=He,Rf=Dt,se=no,Ke=io,m0=G0("socket.io-client:manager"),so=Ji,Pf=wf,xo=Object.prototype.hasOwnProperty,co=a0;function a0(e,t){if(!(this instanceof a0))return new a0(e,t);e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new Pf({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var r=t.parser||Rf;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=t.autoConnect!==!1,this.autoConnect&&this.open()}a0.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var e in this.nsps)xo.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},a0.prototype.updateSocketIds=function(){for(var e in this.nsps)xo.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},a0.prototype.generateId=function(e){return(e==="/"?"":e+"#")+this.engine.id},kf(a0.prototype),a0.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},a0.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},a0.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},a0.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},a0.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},a0.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},a0.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()},a0.prototype.open=a0.prototype.connect=function(e,t){if(m0("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;m0("opening %s",this.uri),this.engine=Sf(this.uri,this.opts);var r=this.engine,n=this;this.readyState="opening",this.skipReconnect=!1;var a=se(r,"open",function(){n.onopen(),e&&e()}),i=se(r,"error",function(p){if(m0("connect_error"),n.cleanup(),n.readyState="closed",n.emitAll("connect_error",p),e){var o=new Error("Connection error");o.data=p,e(o)}else n.maybeReconnectOnOpen()});if(this._timeout!==!1){var c=this._timeout;m0("connect attempt will timeout after %d",c),c===0&&a.destroy();var f=setTimeout(function(){m0("connect attempt timed out after %d",c),a.destroy(),r.close(),r.emit("error","timeout"),n.emitAll("connect_timeout",c)},c);this.subs.push({destroy:function(){clearTimeout(f)}})}return this.subs.push(a),this.subs.push(i),this},a0.prototype.onopen=function(){m0("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(se(e,"data",Ke(this,"ondata"))),this.subs.push(se(e,"ping",Ke(this,"onping"))),this.subs.push(se(e,"pong",Ke(this,"onpong"))),this.subs.push(se(e,"error",Ke(this,"onerror"))),this.subs.push(se(e,"close",Ke(this,"onclose"))),this.subs.push(se(this.decoder,"decoded",Ke(this,"ondecoded")))},a0.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},a0.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},a0.prototype.ondata=function(e){this.decoder.add(e)},a0.prototype.ondecoded=function(e){this.emit("packet",e)},a0.prototype.onerror=function(e){m0("error",e),this.emitAll("error",e)},a0.prototype.socket=function(e,t){var r=this.nsps[e];if(!r){r=new Tf(this,e,t),this.nsps[e]=r;var n=this;r.on("connecting",a),r.on("connect",function(){r.id=n.generateId(e)}),this.autoConnect&&a()}function a(){~so(n.connecting,r)||n.connecting.push(r)}return r},a0.prototype.destroy=function(e){var t=so(this.connecting,e);~t&&this.connecting.splice(t,1),!this.connecting.length&&this.close()},a0.prototype.packet=function(e){m0("writing packet %j",e);var t=this;e.query&&e.type===0&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,function(r){for(var n=0;n<r.length;n++)t.engine.write(r[n],e.options);t.encoding=!1,t.processPacketQueue()}))},a0.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},a0.prototype.cleanup=function(){m0("cleanup");for(var e=this.subs.length,t=0;t<e;t++){var r=this.subs.shift();r.destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},a0.prototype.close=a0.prototype.disconnect=function(){m0("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,this.readyState==="opening"&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},a0.prototype.onclose=function(e){m0("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",e),this._reconnection&&!this.skipReconnect&&this.reconnect()},a0.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var e=this;if(this.backoff.attempts>=this._reconnectionAttempts)m0("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();m0("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var r=setTimeout(function(){e.skipReconnect||(m0("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),!e.skipReconnect&&e.open(function(n){n?(m0("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",n.data)):(m0("reconnect success"),e.onreconnect())}))},t);this.subs.push({destroy:function(){clearTimeout(r)}})}},a0.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)},function(e,t){var r=pc,n=Dt,a=co,i=G0("socket.io-client");e.exports=t=f;var c=t.managers={};function f(p,o){typeof p=="object"&&(o=p,p=void 0),o=o||{};var x=r(p),h=x.source,s=x.id,d=x.path,v=c[s]&&d in c[s].nsps,m=o.forceNew||o["force new connection"]||o.multiplex===!1||v,C;return m?(i("ignoring socket cache for %s",h),C=a(h,o)):(c[s]||(i("new io instance for %s",h),c[s]=a(h,o)),C=c[s]),x.query&&!o.query&&(o.query=x.query),C.socket(x.path,o)}t.protocol=n.protocol,t.connect=f,t.Manager=co,t.Socket=oo}(Qr,Qr.exports);var If=Qr.exports;const qf=Ze(If),Of=Object.prototype.hasOwnProperty;function fo(e,t){return Of.call(e,t)}function Hf(){return fo(window,"WebSocket")||fo(window,"MozWebSocket")}const uo=["message","product","lottery","questionnaire","coupon","activityLottery","testQuestion","emotion","speak","customMessage","motivation"];class Nf{constructor(){V(this,"__defaultEventKey","DEFAULT_EVENT");V(this,"__allEventKey","ALL_EVENT");V(this,"__appSocketEventStore",{});V(this,"__socketListens",{});for(const t of uo)this.__socketListens[t]=this.__createSocketHandle(t)}__createSocketHandle(t){return r=>{try{if(r instanceof ArrayBuffer)return;const n=JSON.parse(r);if(n){const a=c=>{for(const f in this.__appSocketEventStore){const p=`${t}.${c}`;f.includes(p)&&this.__appSocketEventStore[f].forEach(x=>{x(n)})}},i=n.EVENT||this.__defaultEventKey;a(i),a(this.__allEventKey)}}catch(n){console.warn(n)}}}listenSocketEvent(t){return Q(this,null,function*(){for(const r in this.__socketListens){const n=this.__socketListens[r];if(!n)return;t.on(r,n)}})}addSocketHandles(t,r,n){const a=(i,c)=>{const f=`${t}.${n}.${i}`;this.__appSocketEventStore[f]||(this.__appSocketEventStore[f]=[]),this.__appSocketEventStore[f].push(c)};if(typeof r=="function"){a(this.__allEventKey,r);return}for(const i in r)a(i,r[i])}}class Mf{constructor(t){V(this,"eventEmitter",new nc);V(this,"__eventStore",new Nf);V(this,"__socket");this.config=t}_afterConnect(){}getToken(){return Promise.resolve(this.config.token)}getChannelInfo(){return Promise.resolve(this.config.channelInfo)}getUserInfo(){return typeof this.config.userInfo=="function"?this.config.userInfo():this.config.userInfo}getSocket(t=!0){if(t&&!this.__socket)throw new Error("Socket 连接未初始化");return this.__socket}_initSocket(){return new Promise(t=>{Q(this,null,function*(){const r=Wr(this.config.domainInfo).chatWsDomain,n=[2e3,3e3,4e3,5e3],a=yield this.getToken();this.config.customSocket?this.__socket=this.config.customSocket:this.__socket=qf(js(r),{query:{token:a,version:this.config.socketVersion||"3.0"},transports:[Hf()?"websocket":"polling"],reconnectionDelay:n[Math.floor(Math.random()*n.length)],randomizationFactor:Math.random()}),this.__bindConnectEvent(),this.__eventStore.listenSocketEvent(this.__socket),t()})})}_connectSocket(){return new Promise(t=>{const r=this.getSocket(),n=()=>{t()};r.disconnected&&(r.once("connect",n),r.connect()),r.connected&&n()})}__bindConnectEvent(){const t=this.getSocket(),r={connect:()=>{this._afterConnect(),this.eventEmitter.emit(N0.ConnectSuccess)},disconnect:()=>{this.eventEmitter.emit(N0.Disconnect)},reconnect:()=>{this.eventEmitter.emit(N0.ReconnectSuccess)},error:()=>{this.eventEmitter.emit(N0.ConnectFailed,{reason:Oe.SocketConnectError})},connect_error:()=>{this.eventEmitter.emit(N0.ConnectFailed,{reason:Oe.SocketConnectError})},connect_timeout:()=>{this.eventEmitter.emit(N0.ConnectFailed,{reason:Oe.SocketConnectTimeout})}};for(const n in r)t.on(n,r[n])}emitSocket(t,r="message",n){return new Promise((a,i)=>{Q(this,null,function*(){const{checkCode:c=!0,directCallback:f=!1}=n||{},p=this.getSocket(),o=(...x)=>{if(f){a(x);return}const h=x[0];let s=h;if(h instanceof ArrayBuffer)return;let d=h;if(typeof h=="string")try{d=JSON.parse(h)}catch(v){}if(typeof h=="object"&&(d=h),d&&typeof d.code=="number"&&c)if(d.code===200)s=d.data;else{i(d);return}else s=d;a(s)};p==null||p.emit(r,JSON.stringify(t),o)})})}addSocketHandles(t,r,n="message"){this.__eventStore.addSocketHandles(t,r,n)}disconnect(){return new Promise(t=>{const r=this.getSocket();if(r.disconnected){t();return}r.once("disconnect",()=>{t()}),r.disconnect()})}}class Uf extends Mf{constructor(r){super(r);V(this,"ConnectFailReason",Oe);V(this,"SocketUserType",$0);V(this,"PolyvSocketEvent",N0);V(this,"chatApi",new Ys(this));V(this,"polyvApi",new rc(this))}setup(){return Q(this,null,function*(){yield this._initSocket(),this.config.customSocket||(yield this._connectSocket())})}_afterConnect(){const{autoLogin:r=!0}=this.config;r&&this.loginSocket()}loginSocket(){return Q(this,null,function*(){const r=this.getUserInfo(),n=yield this.getChannelInfo(),a=this.config.statisticsParams,i={EVENT:"LOGIN",values:[r.nick,r.pic,r.userId],channelId:String(n.channelId),roomId:String(n.channelId),type:r.userType};n.sessionId&&(i.sessionId=n.sessionId),(a!=null&&a.param4||r.wxUnionId)&&(i.param4=a==null?void 0:a.param4),a!=null&&a.param5&&(i.param5=a.param5),r.actor&&(i.actor=r.actor);const f=(yield this.emitSocket(i,"message",{directCallback:!0}))[0];String(f)[0]==="2"?this.eventEmitter.emit(N0.LoginSuccess,{code:f}):this.eventEmitter.emit(N0.LoginFailed,{code:f})})}isSpecialUserType(r,n){return r===$0.Dummy?!!n&&["主讲","讲师","嘉宾","助教","管理员"].includes(n):[$0.Teacher,$0.Manager,$0.Guest,$0.Assistant,$0.Attendee,$0.UserTagsMonitor].includes(r)}isCurrentUser(r){return this.getUserInfo().userId===r}}n0.ConnectFailReason=Oe,n0.PolyvSocket=Uf,n0.PolyvSocketEvent=N0,n0.RequestAuthorizeMethod=Qe,n0.SecurityMode=vt,n0.SocketUserType=$0,n0.socketEventTypes=uo,Object.defineProperty(n0,Symbol.toStringTag,{value:"Module"})});console.log("%c@polyv/socket","background:#67C23A;padding: 2px 6px;border-radius: 3px;color: #fff","[version: 2.1.0-rc-20251023.1]","[buildTime: 2025-10-21 10:21:20]");
|
|
21
|
+
`),this.area.value=e.replace(rf,"\\n");try{this.form.submit()}catch(o){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){r.iframe.readyState==="complete"&&f()}:this.iframe.onload=f};var gn=ln(),of=ve,sf=Me,xf=It,cf=Wi,ff=G0("engine.io-client:websocket"),Ht,mn;if(typeof WebSocket!="undefined"?Ht=WebSocket:typeof self!="undefined"&&(Ht=self.WebSocket||self.MozWebSocket),typeof window=="undefined")try{mn=Kn}catch(e){}var Le=Ht||mn,df=I0;function I0(e){var t=e&&e.forceBase64;t&&(this.supportsBinary=!1),this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=Ht&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(Le=mn),gn.call(this,e)}xf(I0,gn),I0.prototype.name="websocket",I0.prototype.supportsBinary=!0,I0.prototype.doOpen=function(){if(this.check()){var e=this.uri(),t=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?t?new Le(e,t):new Le(e):new Le(e,t,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()}},I0.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},I0.prototype.write=function(e){var t=this;this.writable=!1;for(var r=e.length,n=0,a=r;n<a;n++)(function(c){of.encodePacket(c,t.supportsBinary,function(f){if(!t.usingBrowserWebSocket){var p={};if(c.options&&(p.compress=c.options.compress),t.perMessageDeflate){var o=typeof f=="string"?Buffer.byteLength(f):f.length;o<t.perMessageDeflate.threshold&&(p.compress=!1)}}try{t.usingBrowserWebSocket?t.ws.send(f):t.ws.send(f,p)}catch(x){ff("websocket closed before onclose event")}--r||i()})})(e[n]);function i(){t.emit("flush"),setTimeout(function(){t.writable=!0,t.emit("drain")},0)}},I0.prototype.onClose=function(){gn.prototype.onClose.call(this)},I0.prototype.doClose=function(){typeof this.ws!="undefined"&&this.ws.close()},I0.prototype.uri=function(){var e=this.query||{},t=this.secure?"wss":"ws",r="";this.port&&(t==="wss"&&Number(this.port)!==443||t==="ws"&&Number(this.port)!==80)&&(r=":"+this.port),this.timestampRequests&&(e[this.timestampParam]=cf()),this.supportsBinary||(e.b64=1),e=sf.encode(e),e.length&&(e="?"+e);var n=this.hostname.indexOf(":")!==-1;return t+"://"+(n?"["+this.hostname+"]":this.hostname)+r+this.path+e},I0.prototype.check=function(){return!!Le&&!("__initialize"in Le&&this.name===I0.prototype.name)};var uf=cn,hf=Jc,lf=tf,pf=df;St.polling=bf,St.websocket=pf;function bf(e){var t,r=!1,n=!1,a=e.jsonp!==!1;if(typeof location!="undefined"){var i=location.protocol==="https:",c=location.port;c||(c=i?443:80),r=e.hostname!==location.hostname||c!==e.port,n=e.secure!==i}if(e.xdomain=r,e.xscheme=n,t=new uf(e),"open"in t&&!e.forceJSONP)return new hf(e);if(!a)throw new Error("JSONP disabled");return new lf(e)}var vf=[].indexOf,Ji=function(e,t){if(vf)return e.indexOf(t);for(var r=0;r<e.length;++r)if(e[r]===t)return r;return-1},yf=St,gf=He,u0=G0("engine.io-client:socket"),mf=Ji,eo=ve,to=wi,Bf=Me,Cf=e0;function e0(e,t){if(!(this instanceof e0))return new e0(e,t);t=t||{},e&&typeof e=="object"&&(t=e,e=null),e?(e=to(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=to(t.host).host),this.secure=t.secure!=null?t.secure:typeof location!="undefined"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.agent=t.agent||!1,this.hostname=t.hostname||(typeof location!="undefined"?location.hostname:"localhost"),this.port=t.port||(typeof location!="undefined"&&location.port?location.port:this.secure?443:80),this.query=t.query||{},typeof this.query=="string"&&(this.query=Bf.decode(this.query)),this.upgrade=t.upgrade!==!1,this.path=(t.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!t.forceJSONP,this.jsonp=t.jsonp!==!1,this.forceBase64=!!t.forceBase64,this.enablesXDR=!!t.enablesXDR,this.withCredentials=t.withCredentials!==!1,this.timestampParam=t.timestampParam||"t",this.timestampRequests=t.timestampRequests,this.transports=t.transports||["polling","websocket"],this.transportOptions=t.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=t.policyPort||843,this.rememberUpgrade=t.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=t.onlyBinaryUpgrades,this.perMessageDeflate=t.perMessageDeflate!==!1?t.perMessageDeflate||{}:!1,this.perMessageDeflate===!0&&(this.perMessageDeflate={}),this.perMessageDeflate&&this.perMessageDeflate.threshold==null&&(this.perMessageDeflate.threshold=1024),this.pfx=t.pfx||void 0,this.key=t.key||void 0,this.passphrase=t.passphrase||void 0,this.cert=t.cert||void 0,this.ca=t.ca||void 0,this.ciphers=t.ciphers||void 0,this.rejectUnauthorized=t.rejectUnauthorized===void 0?!0:t.rejectUnauthorized,this.forceNode=!!t.forceNode,this.isReactNative=typeof navigator!="undefined"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",(typeof self=="undefined"||this.isReactNative)&&(t.extraHeaders&&Object.keys(t.extraHeaders).length>0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}e0.priorWebsocketSuccess=!1,gf(e0.prototype),e0.protocol=eo.protocol,e0.Socket=e0,e0.Transport=ln(),e0.transports=St,e0.parser=ve,e0.prototype.createTransport=function(e){u0('creating transport "%s"',e);var t=_f(this.query);t.EIO=eo.protocol,t.transport=e;var r=this.transportOptions[e]||{};this.id&&(t.sid=this.id);var n=new yf[e]({query:t,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 _f(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}e0.prototype.open=function(){var e;if(this.rememberUpgrade&&e0.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)e="websocket";else if(this.transports.length===0){var t=this;setTimeout(function(){t.emit("error","No transports available")},0);return}else e=this.transports[0];this.readyState="opening";try{e=this.createTransport(e)}catch(r){this.transports.shift(),this.open();return}e.open(),this.setTransport(e)},e0.prototype.setTransport=function(e){u0("setting transport %s",e.name);var t=this;this.transport&&(u0("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.onDrain()}).on("packet",function(r){t.onPacket(r)}).on("error",function(r){t.onError(r)}).on("close",function(){t.onClose("transport close")})},e0.prototype.probe=function(e){u0('probing transport "%s"',e);var t=this.createTransport(e,{probe:1}),r=!1,n=this;e0.priorWebsocketSuccess=!1;function a(){if(n.onlyBinaryUpgrades){var h=!this.supportsBinary&&n.transport.supportsBinary;r=r||h}r||(u0('probe transport "%s" opened',e),t.send([{type:"ping",data:"probe"}]),t.once("packet",function(s){if(!r)if(s.type==="pong"&&s.data==="probe"){if(u0('probe transport "%s" pong',e),n.upgrading=!0,n.emit("upgrading",t),!t)return;e0.priorWebsocketSuccess=t.name==="websocket",u0('pausing current transport "%s"',n.transport.name),n.transport.pause(function(){r||n.readyState!=="closed"&&(u0("changing transport and sending upgrade packet"),x(),n.setTransport(t),t.send([{type:"upgrade"}]),n.emit("upgrade",t),t=null,n.upgrading=!1,n.flush())})}else{u0('probe transport "%s" failed',e);var d=new Error("probe error");d.transport=t.name,n.emit("upgradeError",d)}}))}function i(){r||(r=!0,x(),t.close(),t=null)}function c(h){var s=new Error("probe error: "+h);s.transport=t.name,i(),u0('probe transport "%s" failed because of error: %s',e,h),n.emit("upgradeError",s)}function f(){c("transport closed")}function p(){c("socket closed")}function o(h){t&&h.name!==t.name&&(u0('"%s" works - aborting "%s"',h.name,t.name),i())}function x(){t.removeListener("open",a),t.removeListener("error",c),t.removeListener("close",f),n.removeListener("close",p),n.removeListener("upgrading",o)}t.once("open",a),t.once("error",c),t.once("close",f),this.once("close",p),this.once("upgrading",o),t.open()},e0.prototype.onOpen=function(){if(u0("socket open"),this.readyState="open",e0.priorWebsocketSuccess=this.transport.name==="websocket",this.emit("open"),this.flush(),this.readyState==="open"&&this.upgrade&&this.transport.pause){u0("starting upgrade probes");for(var e=0,t=this.upgrades.length;e<t;e++)this.probe(this.upgrades[e])}},e0.prototype.onPacket=function(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(u0('socket receive: type "%s", data "%s"',e.type,e.data),this.emit("packet",e),this.emit("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emit("data",e.data),this.emit("message",e.data);break}else u0('packet received with socket readyState "%s"',this.readyState)},e0.prototype.onHandshake=function(e){this.emit("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.onOpen(),this.readyState!=="closed"&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},e0.prototype.onHeartbeat=function(e){clearTimeout(this.pingTimeoutTimer);var t=this;t.pingTimeoutTimer=setTimeout(function(){t.readyState!=="closed"&&t.onClose("ping timeout")},e||t.pingInterval+t.pingTimeout)},e0.prototype.setPing=function(){var e=this;clearTimeout(e.pingIntervalTimer),e.pingIntervalTimer=setTimeout(function(){u0("writing ping packet - expecting pong within %sms",e.pingTimeout),e.ping(),e.onHeartbeat(e.pingTimeout)},e.pingInterval)},e0.prototype.ping=function(){var e=this;this.sendPacket("ping",function(){e.emit("ping")})},e0.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,this.writeBuffer.length===0?this.emit("drain"):this.flush()},e0.prototype.flush=function(){this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(u0("flushing %d packets in socket",this.writeBuffer.length),this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},e0.prototype.write=e0.prototype.send=function(e,t,r){return this.sendPacket("message",e,t,r),this},e0.prototype.sendPacket=function(e,t,r,n){if(typeof t=="function"&&(n=t,t=void 0),typeof r=="function"&&(n=r,r=null),!(this.readyState==="closing"||this.readyState==="closed")){r=r||{},r.compress=r.compress!==!1;var a={type:e,data:t,options:r};this.emit("packetCreate",a),this.writeBuffer.push(a),n&&this.once("flush",n),this.flush()}},e0.prototype.close=function(){if(this.readyState==="opening"||this.readyState==="open"){this.readyState="closing";var e=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?n():t()}):this.upgrading?n():t()}function t(){e.onClose("forced close"),u0("socket closing - telling transport to close"),e.transport.close()}function r(){e.removeListener("upgrade",r),e.removeListener("upgradeError",r),t()}function n(){e.once("upgrade",r),e.once("upgradeError",r)}return this},e0.prototype.onError=function(e){u0("socket error %j",e),e0.priorWebsocketSuccess=!1,this.emit("error",e),this.onClose("transport error",e)},e0.prototype.onClose=function(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){u0('socket close with reason: "%s"',e);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",e,t),r.writeBuffer=[],r.prevBufferLen=0}},e0.prototype.filterUpgrades=function(e){for(var t=[],r=0,n=e.length;r<n;r++)~mf(this.transports,e[r])&&t.push(e[r]);return t},on.exports=Cf,on.exports.parser=ve;var Ef=on.exports,ro={exports:{}},Ff=Af;function Af(e,t){var r=[];t=t||0;for(var n=t||0;n<e.length;n++)r[n-t]=e[n];return r}var no=Df;function Df(e,t,r){return e.on(t,r),{destroy:function(){e.removeListener(t,r)}}}var ao=[].slice,io=function(e,t){if(typeof t=="string"&&(t=e[t]),typeof t!="function")throw new Error("bind() requires a function");var r=ao.call(arguments,2);return function(){return t.apply(e,r.concat(ao.call(arguments)))}};(function(e,t){var r=Dt,n=He,a=Ff,i=no,c=io,f=G0("socket.io-client:socket"),p=Me,o=qi;e.exports=s;var x={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 s(d,v,m){this.io=d,this.nsp=v,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},m&&m.query&&(this.query=m.query),this.io.autoConnect&&this.open()}n(s.prototype),s.prototype.subEvents=function(){if(!this.subs){var d=this.io;this.subs=[i(d,"open",c(this,"onopen")),i(d,"packet",c(this,"onpacket")),i(d,"close",c(this,"onclose"))]}},s.prototype.open=s.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)},s.prototype.send=function(){var d=a(arguments);return d.unshift("message"),this.emit.apply(this,d),this},s.prototype.emit=function(d){if(x.hasOwnProperty(d))return h.apply(this,arguments),this;var v=a(arguments),m={type:(this.flags.binary!==void 0?this.flags.binary:o(v))?r.BINARY_EVENT:r.EVENT,data:v};return m.options={},m.options.compress=!this.flags||this.flags.compress!==!1,typeof v[v.length-1]=="function"&&(f("emitting packet with ack id %d",this.ids),this.acks[this.ids]=v.pop(),m.id=this.ids++),this.connected?this.packet(m):this.sendBuffer.push(m),this.flags={},this},s.prototype.packet=function(d){d.nsp=this.nsp,this.io.packet(d)},s.prototype.onopen=function(){if(f("transport is open - connecting"),this.nsp!=="/")if(this.query){var d=typeof this.query=="object"?p.encode(this.query):this.query;f("sending connect packet with query %s",d),this.packet({type:r.CONNECT,query:d})}else this.packet({type:r.CONNECT})},s.prototype.onclose=function(d){f("close (%s)",d),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",d)},s.prototype.onpacket=function(d){var v=d.nsp===this.nsp,m=d.type===r.ERROR&&d.nsp==="/";if(!(!v&&!m))switch(d.type){case r.CONNECT:this.onconnect();break;case r.EVENT:this.onevent(d);break;case r.BINARY_EVENT:this.onevent(d);break;case r.ACK:this.onack(d);break;case r.BINARY_ACK:this.onack(d);break;case r.DISCONNECT:this.ondisconnect();break;case r.ERROR:this.emit("error",d.data);break}},s.prototype.onevent=function(d){var v=d.data||[];f("emitting event %j",v),d.id!=null&&(f("attaching ack callback to event"),v.push(this.ack(d.id))),this.connected?h.apply(this,v):this.receiveBuffer.push(v)},s.prototype.ack=function(d){var v=this,m=!1;return function(){if(!m){m=!0;var C=a(arguments);f("sending ack %j",C),v.packet({type:o(C)?r.BINARY_ACK:r.ACK,id:d,data:C})}}},s.prototype.onack=function(d){var v=this.acks[d.id];typeof v=="function"?(f("calling ack %s with %j",d.id,d.data),v.apply(this,d.data),delete this.acks[d.id]):f("bad ack %s",d.id)},s.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emitBuffered(),this.emit("connect")},s.prototype.emitBuffered=function(){var d;for(d=0;d<this.receiveBuffer.length;d++)h.apply(this,this.receiveBuffer[d]);for(this.receiveBuffer=[],d=0;d<this.sendBuffer.length;d++)this.packet(this.sendBuffer[d]);this.sendBuffer=[]},s.prototype.ondisconnect=function(){f("server disconnect (%s)",this.nsp),this.destroy(),this.onclose("io server disconnect")},s.prototype.destroy=function(){if(this.subs){for(var d=0;d<this.subs.length;d++)this.subs[d].destroy();this.subs=null}this.io.destroy(this)},s.prototype.close=s.prototype.disconnect=function(){return this.connected&&(f("performing disconnect (%s)",this.nsp),this.packet({type:r.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},s.prototype.compress=function(d){return this.flags.compress=d,this},s.prototype.binary=function(d){return this.flags.binary=d,this}})(ro);var oo=ro.exports,wf=$e;function $e(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}$e.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+r:e-r}return Math.min(e,this.max)|0},$e.prototype.reset=function(){this.attempts=0},$e.prototype.setMin=function(e){this.ms=e},$e.prototype.setMax=function(e){this.max=e},$e.prototype.setJitter=function(e){this.jitter=e};var Sf=Ef,Tf=oo,kf=He,Rf=Dt,se=no,Ke=io,m0=G0("socket.io-client:manager"),so=Ji,Pf=wf,xo=Object.prototype.hasOwnProperty,co=a0;function a0(e,t){if(!(this instanceof a0))return new a0(e,t);e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new Pf({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var r=t.parser||Rf;this.encoder=new r.Encoder,this.decoder=new r.Decoder,this.autoConnect=t.autoConnect!==!1,this.autoConnect&&this.open()}a0.prototype.emitAll=function(){this.emit.apply(this,arguments);for(var e in this.nsps)xo.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},a0.prototype.updateSocketIds=function(){for(var e in this.nsps)xo.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},a0.prototype.generateId=function(e){return(e==="/"?"":e+"#")+this.engine.id},kf(a0.prototype),a0.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},a0.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},a0.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},a0.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},a0.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},a0.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},a0.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()},a0.prototype.open=a0.prototype.connect=function(e,t){if(m0("readyState %s",this.readyState),~this.readyState.indexOf("open"))return this;m0("opening %s",this.uri),this.engine=Sf(this.uri,this.opts);var r=this.engine,n=this;this.readyState="opening",this.skipReconnect=!1;var a=se(r,"open",function(){n.onopen(),e&&e()}),i=se(r,"error",function(p){if(m0("connect_error"),n.cleanup(),n.readyState="closed",n.emitAll("connect_error",p),e){var o=new Error("Connection error");o.data=p,e(o)}else n.maybeReconnectOnOpen()});if(this._timeout!==!1){var c=this._timeout;m0("connect attempt will timeout after %d",c),c===0&&a.destroy();var f=setTimeout(function(){m0("connect attempt timed out after %d",c),a.destroy(),r.close(),r.emit("error","timeout"),n.emitAll("connect_timeout",c)},c);this.subs.push({destroy:function(){clearTimeout(f)}})}return this.subs.push(a),this.subs.push(i),this},a0.prototype.onopen=function(){m0("open"),this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(se(e,"data",Ke(this,"ondata"))),this.subs.push(se(e,"ping",Ke(this,"onping"))),this.subs.push(se(e,"pong",Ke(this,"onpong"))),this.subs.push(se(e,"error",Ke(this,"onerror"))),this.subs.push(se(e,"close",Ke(this,"onclose"))),this.subs.push(se(this.decoder,"decoded",Ke(this,"ondecoded")))},a0.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},a0.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},a0.prototype.ondata=function(e){this.decoder.add(e)},a0.prototype.ondecoded=function(e){this.emit("packet",e)},a0.prototype.onerror=function(e){m0("error",e),this.emitAll("error",e)},a0.prototype.socket=function(e,t){var r=this.nsps[e];if(!r){r=new Tf(this,e,t),this.nsps[e]=r;var n=this;r.on("connecting",a),r.on("connect",function(){r.id=n.generateId(e)}),this.autoConnect&&a()}function a(){~so(n.connecting,r)||n.connecting.push(r)}return r},a0.prototype.destroy=function(e){var t=so(this.connecting,e);~t&&this.connecting.splice(t,1),!this.connecting.length&&this.close()},a0.prototype.packet=function(e){m0("writing packet %j",e);var t=this;e.query&&e.type===0&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,function(r){for(var n=0;n<r.length;n++)t.engine.write(r[n],e.options);t.encoding=!1,t.processPacketQueue()}))},a0.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},a0.prototype.cleanup=function(){m0("cleanup");for(var e=this.subs.length,t=0;t<e;t++){var r=this.subs.shift();r.destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},a0.prototype.close=a0.prototype.disconnect=function(){m0("disconnect"),this.skipReconnect=!0,this.reconnecting=!1,this.readyState==="opening"&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},a0.prototype.onclose=function(e){m0("onclose"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",e),this._reconnection&&!this.skipReconnect&&this.reconnect()},a0.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var e=this;if(this.backoff.attempts>=this._reconnectionAttempts)m0("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();m0("will wait %dms before reconnect attempt",t),this.reconnecting=!0;var r=setTimeout(function(){e.skipReconnect||(m0("attempting reconnect"),e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),!e.skipReconnect&&e.open(function(n){n?(m0("reconnect attempt error"),e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",n.data)):(m0("reconnect success"),e.onreconnect())}))},t);this.subs.push({destroy:function(){clearTimeout(r)}})}},a0.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)},function(e,t){var r=pc,n=Dt,a=co,i=G0("socket.io-client");e.exports=t=f;var c=t.managers={};function f(p,o){typeof p=="object"&&(o=p,p=void 0),o=o||{};var x=r(p),h=x.source,s=x.id,d=x.path,v=c[s]&&d in c[s].nsps,m=o.forceNew||o["force new connection"]||o.multiplex===!1||v,C;return m?(i("ignoring socket cache for %s",h),C=a(h,o)):(c[s]||(i("new io instance for %s",h),c[s]=a(h,o)),C=c[s]),x.query&&!o.query&&(o.query=x.query),C.socket(x.path,o)}t.protocol=n.protocol,t.connect=f,t.Manager=co,t.Socket=oo}(Qr,Qr.exports);var If=Qr.exports;const qf=Ze(If),Of=Object.prototype.hasOwnProperty;function fo(e,t){return Of.call(e,t)}function Hf(){return fo(window,"WebSocket")||fo(window,"MozWebSocket")}const uo=["message","product","lottery","questionnaire","coupon","activityLottery","testQuestion","emotion","speak","customMessage","motivation"];class Nf{constructor(){V(this,"__defaultEventKey","DEFAULT_EVENT");V(this,"__allEventKey","ALL_EVENT");V(this,"__appSocketEventStore",{});V(this,"__socketListens",{});for(const t of uo)this.__socketListens[t]=this.__createSocketHandle(t)}__createSocketHandle(t){return r=>{try{if(r instanceof ArrayBuffer)return;const n=JSON.parse(r);if(n){const a=c=>{for(const f in this.__appSocketEventStore){const p=`${t}.${c}`;f.includes(p)&&this.__appSocketEventStore[f].forEach(x=>{x(n)})}},i=n.EVENT||this.__defaultEventKey;a(i),a(this.__allEventKey)}}catch(n){console.warn(n)}}}listenSocketEvent(t){return Q(this,null,function*(){for(const r in this.__socketListens){const n=this.__socketListens[r];if(!n)return;t.on(r,n)}})}addSocketHandles(t,r,n){const a=(i,c)=>{const f=`${t}.${n}.${i}`;this.__appSocketEventStore[f]||(this.__appSocketEventStore[f]=[]),this.__appSocketEventStore[f].push(c)};if(typeof r=="function"){a(this.__allEventKey,r);return}for(const i in r)a(i,r[i])}}class Mf{constructor(t){V(this,"eventEmitter",new nc);V(this,"__eventStore",new Nf);V(this,"__socket");this.config=t}_afterConnect(){}getToken(){return Promise.resolve(this.config.token)}getChannelInfo(){return Promise.resolve(this.config.channelInfo)}getUserInfo(){return typeof this.config.userInfo=="function"?this.config.userInfo():this.config.userInfo}getSocket(t=!0){if(t&&!this.__socket)throw new Error("Socket 连接未初始化");return this.__socket}_initSocket(){return new Promise(t=>{Q(this,null,function*(){const r=Wr(this.config.domainInfo).chatWsDomain,n=[2e3,3e3,4e3,5e3],a=yield this.getToken();this.config.customSocket?this.__socket=this.config.customSocket:this.__socket=qf(js(r),{query:{token:a,version:this.config.socketVersion||"3.0"},transports:[Hf()?"websocket":"polling"],reconnectionDelay:n[Math.floor(Math.random()*n.length)],randomizationFactor:Math.random()}),this.__bindConnectEvent(),this.__eventStore.listenSocketEvent(this.__socket),t()})})}_connectSocket(){return new Promise(t=>{const r=this.getSocket(),n=()=>{t()};r.disconnected&&(r.once("connect",n),r.connect()),r.connected&&n()})}__bindConnectEvent(){const t=this.getSocket(),r={connect:()=>{this._afterConnect(),this.eventEmitter.emit(N0.ConnectSuccess)},disconnect:()=>{this.eventEmitter.emit(N0.Disconnect)},reconnect:()=>{this.eventEmitter.emit(N0.ReconnectSuccess)},error:()=>{this.eventEmitter.emit(N0.ConnectFailed,{reason:Oe.SocketConnectError})},connect_error:()=>{this.eventEmitter.emit(N0.ConnectFailed,{reason:Oe.SocketConnectError})},connect_timeout:()=>{this.eventEmitter.emit(N0.ConnectFailed,{reason:Oe.SocketConnectTimeout})}};for(const n in r)t.on(n,r[n])}emitSocket(t,r="message",n){return new Promise((a,i)=>{Q(this,null,function*(){const{checkCode:c=!0,directCallback:f=!1}=n||{},p=this.getSocket(),o=(...x)=>{if(f){a(x);return}const h=x[0];let s=h;if(h instanceof ArrayBuffer)return;let d=h;if(typeof h=="string")try{d=JSON.parse(h)}catch(v){}if(typeof h=="object"&&(d=h),d&&typeof d.code=="number"&&c)if(d.code===200)s=d.data;else{i(d);return}else s=d;a(s)};p==null||p.emit(r,JSON.stringify(t),o)})})}addSocketHandles(t,r,n="message"){this.__eventStore.addSocketHandles(t,r,n)}disconnect(){return new Promise(t=>{const r=this.getSocket();if(r.disconnected){t();return}r.once("disconnect",()=>{t()}),r.disconnect()})}}class Uf extends Mf{constructor(r){super(r);V(this,"ConnectFailReason",Oe);V(this,"SocketUserType",$0);V(this,"PolyvSocketEvent",N0);V(this,"chatApi",new Ys(this));V(this,"polyvApi",new rc(this))}setup(){return Q(this,null,function*(){yield this._initSocket(),this.config.customSocket||(yield this._connectSocket())})}_afterConnect(){const{autoLogin:r=!0}=this.config;r&&this.loginSocket()}loginSocket(){return Q(this,null,function*(){const r=this.getUserInfo(),n=yield this.getChannelInfo(),a=this.config.statisticsParams,i={EVENT:"LOGIN",values:[r.nick,r.pic,r.userId],channelId:String(n.channelId),roomId:String(n.channelId),type:r.userType};n.sessionId&&(i.sessionId=n.sessionId),(a!=null&&a.param4||r.wxUnionId)&&(i.param4=a==null?void 0:a.param4),a!=null&&a.param5&&(i.param5=a.param5),r.actor&&(i.actor=r.actor);const f=(yield this.emitSocket(i,"message",{directCallback:!0}))[0];String(f)[0]==="2"?this.eventEmitter.emit(N0.LoginSuccess,{code:f}):this.eventEmitter.emit(N0.LoginFailed,{code:f})})}isSpecialUserType(r,n){return r===$0.Dummy?!!n&&["主讲","讲师","嘉宾","助教","管理员"].includes(n):[$0.Teacher,$0.Manager,$0.Guest,$0.Assistant,$0.Attendee,$0.UserTagsMonitor].includes(r)}isCurrentUser(r){return this.getUserInfo().userId===r}}n0.ConnectFailReason=Oe,n0.PolyvSocket=Uf,n0.PolyvSocketEvent=N0,n0.RequestAuthorizeMethod=Qe,n0.SecurityMode=vt,n0.SocketUserType=$0,n0.socketEventTypes=uo,Object.defineProperty(n0,Symbol.toStringTag,{value:"Module"})});console.log("%c@polyv/socket","background:#67C23A;padding: 2px 6px;border-radius: 3px;color: #fff","[version: 2.1.0-rc-20251023.2]","[buildTime: 2025-10-22 01:22:14]");
|