@cg-devcenter/rtc-fpnn-webjs-sdk 1.0.0-cg.5 → 1.0.0-cg.7
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/README.md +24 -14
- package/dist/rtm.d.cts +3 -0
- package/dist/rtm.d.mts +40 -0
- package/dist/rtm.d.ts +54 -25
- package/dist/rtm.min.js +5 -5
- package/dist/rtm.mjs +17 -0
- package/dist/rtm.shared-worker.js +6 -6
- package/dist/rtm.vite-plugin.d.mts +8 -0
- package/dist/rtm.vite-plugin.mjs +23 -0
- package/dist/rtm.vite.d.ts +27 -0
- package/dist/rtm.vite.mjs +13 -15
- package/dist/rtm.webpack4-adapter.cjs +29 -0
- package/dist/rtm.webpack4-plugin.cjs +50 -0
- package/dist/rtm.webpack4-plugin.d.cts +5 -0
- package/docs/CAPABILITIES.md +9 -9
- package/docs/Chat.md +278 -0
- package/docs/Data.md +33 -0
- package/docs/EventProcess.md +126 -0
- package/docs/Files.md +52 -0
- package/docs/Friends.md +50 -0
- package/docs/Groups.md +64 -0
- package/docs/Messages.md +183 -0
- package/docs/NPM_MODERNIZATION_PLAN.md +474 -0
- package/docs/PROTOCOL_MIGRATION.md +6 -5
- package/docs/RTM_MIGRATION.md +205 -0
- package/docs/Rooms.md +67 -0
- package/docs/System.md +49 -0
- package/docs/USAGE.md +127 -58
- package/docs/Users.md +48 -0
- package/docs/ValueAdded.md +82 -0
- package/package.json +41 -8
package/dist/rtm.mjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var Si=Object.create;var lr=Object.defineProperty;var ki=Object.getOwnPropertyDescriptor;var xi=Object.getOwnPropertyNames;var Ii=Object.getPrototypeOf,Mi=Object.prototype.hasOwnProperty;var kt=(R=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(R,{get:(g,m)=>(typeof require<"u"?require:g)[m]}):R)(function(R){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+R+'" is not supported')});var Ge=(R,g)=>()=>(g||R((g={exports:{}}).exports,g),g.exports);var Ui=(R,g,m,E)=>{if(g&&typeof g=="object"||typeof g=="function")for(let C of xi(g))!Mi.call(R,C)&&C!==m&&lr(R,C,{get:()=>g[C],enumerable:!(E=ki(g,C))||E.enumerable});return R};var Ni=(R,g,m)=>(m=R!=null?Si(Ii(R)):{},Ui(g||!R||!R.__esModule?lr(m,"default",{value:R,enumerable:!0}):m,R));var hr=Ge((xt,wn)=>{(function(R,g){typeof xt=="object"&&typeof wn=="object"?wn.exports=g():typeof define=="function"&&define.amd?define([],g):typeof xt=="object"?xt.fpnn=g():R.fpnn=g()})(typeof globalThis<"u"?globalThis:typeof self<"u"?self:xt,(function(){return(function(R){var g={};function m(E){if(g[E])return g[E].exports;var C=g[E]={i:E,l:!1,exports:{}};return R[E].call(C.exports,C,C.exports,m),C.l=!0,C.exports}return m.m=R,m.c=g,m.d=function(E,C,T){m.o(E,C)||Object.defineProperty(E,C,{enumerable:!0,get:T})},m.r=function(E){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(E,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(E,"__esModule",{value:!0})},m.t=function(E,C){if(1&C&&(E=m(E)),8&C||4&C&&typeof E=="object"&&E&&E.__esModule)return E;var T=Object.create(null);if(m.r(T),Object.defineProperty(T,"default",{enumerable:!0,value:E}),2&C&&typeof E!="string")for(var O in E)m.d(T,O,function(P){return E[P]}.bind(null,O));return T},m.n=function(E){var C=E&&E.__esModule?function(){return E.default}:function(){return E};return m.d(C,"a",C),C},m.o=function(E,C){return Object.prototype.hasOwnProperty.call(E,C)},m.p="",m(m.s=8)})([function(R,g,m){"use strict";var E=(function(){function H(V,K){for(var Q=0;Q<K.length;Q++){var Z=K[Q];Z.enumerable=Z.enumerable||!1,Z.configurable=!0,"value"in Z&&(Z.writable=!0),Object.defineProperty(V,Z.key,Z)}}return function(V,K,Q){return K&&H(V.prototype,K),Q&&H(V,Q),V}})(),C=m(10).Buffer,T={FPNN_EC_OK:0,FPNN_EC_PROTO_UNKNOWN_ERROR:10001,FPNN_EC_PROTO_NOT_SUPPORTED:10002,FPNN_EC_PROTO_INVALID_PACKAGE:10003,FPNN_EC_PROTO_JSON_CONVERT:10004,FPNN_EC_PROTO_STRING_KEY:10005,FPNN_EC_PROTO_MAP_VALUE:10006,FPNN_EC_PROTO_METHOD_TYPE:10007,FPNN_EC_PROTO_PROTO_TYPE:10008,FPNN_EC_PROTO_KEY_NOT_FOUND:10009,FPNN_EC_PROTO_TYPE_CONVERT:10010,FPNN_EC_CORE_UNKNOWN_ERROR:20001,FPNN_EC_CORE_CONNECTION_CLOSED:20002,FPNN_EC_CORE_TIMEOUT:20003,FPNN_EC_CORE_UNKNOWN_METHOD:20004,FPNN_EC_CORE_ENCODING:20005,FPNN_EC_CORE_DECODING:20006,FPNN_EC_CORE_SEND_ERROR:20007,FPNN_EC_CORE_RECV_ERROR:20008,FPNN_EC_CORE_INVALID_PACKAGE:20009,FPNN_EC_CORE_HTTP_ERROR:20010,FPNN_EC_CORE_WORK_QUEUE_FULL:20011,FPNN_EC_CORE_INVALID_CONNECTION:20012,FPNN_EC_CORE_FORBIDDEN:20013,FPNN_EC_CORE_SERVER_STOPPING:20014},O=C.from([0,1]),P=C.from([64,128]),S=C.from([0,1,2]),U=C.from("FPNN"),N=C.from("POST"),D=["secp256k1","secp224r1"],L=["aes-128-cfb","aes-256-cfb"],q=(function(){function H(){(function(V,K){if(!(V instanceof K))throw new TypeError("Cannot call a class as a function")})(this,H)}return E(H,null,[{key:"SDK_VERSION",get:function(){return"2.0.0"}},{key:"BUFFER",get:function(){return C}},{key:"ERROR_CODE",get:function(){return T}},{key:"FP_FLAG",get:function(){return P}},{key:"FP_MESSAGE_TYPE",get:function(){return S}},{key:"TCP_MAGIC",get:function(){return U}},{key:"HTTP_MAGIC",get:function(){return N}},{key:"FPNN_VERSION",get:function(){return O}},{key:"READ_BUFFER_LEN",get:function(){return 1024}},{key:"CHECK_CBS_INTERVAL",get:function(){return 1e3}},{key:"SEND_TIMEOUT",get:function(){return 2e4}},{key:"CRYPTO_CURVES",get:function(){return D}},{key:"CRYPTO_ALGORITHM",get:function(){return L}}]),H})();R.exports=q},function(R,g,m){"use strict";var E=(function(){function T(O,P){for(var S=0;S<P.length;S++){var U=P[S];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(O,U.key,U)}}return function(O,P,S){return P&&T(O.prototype,P),S&&T(O,S),O}})(),C=(function(){function T(){(function(O,P){if(!(O instanceof P))throw new TypeError("Cannot call a class as a function")})(this,T)}return E(T,null,[{key:"assign",value:function(O){if(!O||O.hasOwnProperty("events"))throw new Error(O+" is null or hasOwnProperty [ events ]");if(O.hasOwnProperty("on")||O.hasOwnProperty("emit")||O.hasOwnProperty("removeEvent"))throw new Error(O+" hasOwnProperty [ on | emit | removeEvent | listenerCount]");O.events={},O.on=function(P,S){O.events.hasOwnProperty(P)||(O.events[P]=[]),O.events[P].indexOf(S)==-1&&O.events[P].push(S)},O.emit=function(){if(arguments.length!=0)for(var P=O.events[arguments[0]]||[],S=0;S<P.length;S++){var U=P[S];if(U){for(var N=[],D=1;D<arguments.length;D++)N[D-1]=arguments[D];U.apply(O,N)}}},O.removeEvent=function(){if(arguments.length!=0)if(arguments.length!=1){var P=arguments[0],S=O.events[P].indexOf(arguments[1]);S>-1&&O.events[P].splice(S,1)}else{var U=arguments[0];O.events.hasOwnProperty(U)&&delete O.events[U]}else O.events={}},O.listenerCount=function(P){return O.events.hasOwnProperty(P)?(O.events[P]||[]).length:0}}}]),T})();R.exports=C},function(R,g,m){"use strict";function E(C,T){this.code=C,this.name="FPError",this.message=T.message||"",this.stack=T.stack,this.error=T}E.prototype=Object.create(Error.prototype),E.prototype.toString=function(){return"code: "+this.code+" ex: "+this.message},R.exports=E},function(R,g,m){"use strict";var E=(function(){function L(q,H){for(var V=0;V<H.length;V++){var K=H[V];K.enumerable=K.enumerable||!1,K.configurable=!0,"value"in K&&(K.writable=!0),Object.defineProperty(q,K.key,K)}}return function(q,H,V){return H&&L(q.prototype,H),V&&L(q,V),q}})();m(0);var C=m(1),T=m(4),O=(function(){function L(q){(function(V,K){if(!(V instanceof K))throw new TypeError("Cannot call a class as a function")})(this,L),C.assign(this),this._endpoint=q.endpoint||null,this._timeout=q.connectionTimeout||1e4,this._platform=q.platformImpl||new T,this._connectTimeout=0,this._queue=[];var H=this;C.assign(this._platform),this._platform.on("open",(function(){U.call(H)})),this._platform.on("message",(function(V){S.call(H,V)})),this._platform.on("close",(function(){N.call(H)})),this._platform.on("error",(function(V){D.call(H,V)}))}return E(L,[{key:"write",value:function(q){if(q)if(Object.prototype.toString.call(q)==="[object String]")this._queue.push(q);else{var H=q.buffer.slice(q.byteOffset,q.byteOffset+q.byteLength);this._queue.push(H)}P.call(this)}},{key:"close",value:function(q){q&&this.emit("error",q),this._platform.close()}},{key:"open",value:function(){if(this.isConnecting||this.isOpen||!this._endpoint)this.emit("error",new Error("has connected or worng endpoint!"));else{var q=this;this._connectTimeout&&(clearTimeout(this._connectTimeout),this._connectTimeout=0),this._connectTimeout=setTimeout((function(){var H=new Error("connect timeout!");if(q.isOpen)q.close(H);else{if(q.isConnecting)return q.close(H),void N.call(q);D.call(q,H),N.call(q)}}),this._timeout),this._platform.open(this._endpoint)}}},{key:"destroy",value:function(){this.removeEvent(),this.close(),this._platform.removeEvent(),N.call(this)}},{key:"endpoint",get:function(){return this._endpoint}},{key:"isOpen",get:function(){return this._platform.isOpen}},{key:"isConnecting",get:function(){return this._platform.isConnecting}}]),L})();function P(){if(this.isOpen)for(;this._queue.length;)this._platform.send(this._queue.shift())}function S(L){this.emit("data",L)}function U(){this._connectTimeout&&(clearTimeout(this._connectTimeout),this._connectTimeout=0),P.call(this),this.emit("connect")}function N(){this._connectTimeout&&(clearTimeout(this._connectTimeout),this._connectTimeout=0),this._queue=[],this.emit("close")}function D(L){this.emit("error",L)}R.exports=O},function(R,g,m){"use strict";var E=(function(){function T(O,P){for(var S=0;S<P.length;S++){var U=P[S];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(O,U.key,U)}}return function(O,P,S){return P&&T(O.prototype,P),S&&T(O,S),O}})(),C=(function(){function T(){(function(O,P){if(!(O instanceof P))throw new TypeError("Cannot call a class as a function")})(this,T),this._socket=null}return E(T,[{key:"open",value:function(O){var P=this;try{this._socket=new WebSocket(O)}catch(S){return void this.emit("error",S)}this._socket.binaryType="arraybuffer",this._socket.onopen=function(S){P.emit("open")},this._socket.onmessage=function(S){P.emit("message",S.data)},this._socket.onclose=function(S){P.emit("close")},this._socket.onerror=function(S){P.emit("error",S)}}},{key:"send",value:function(O){try{this._socket.send(O)}catch(P){return void this.emit("error",P)}}},{key:"close",value:function(){this._socket&&this._socket.close()}},{key:"isOpen",get:function(){return!!this._socket&&this._socket.readyState==WebSocket.OPEN}},{key:"isConnecting",get:function(){return!!this._socket&&this._socket.readyState==WebSocket.CONNECTING}}]),T})();R.exports=C},function(R,g,m){"use strict";var E=(function(){function P(S,U){for(var N=0;N<U.length;N++){var D=U[N];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(S,D.key,D)}}return function(S,U,N){return U&&P(S.prototype,U),N&&P(S,N),S}})(),C=m(0),T=(function(){function P(){(function(S,U){if(!(S instanceof U))throw new TypeError("Cannot call a class as a function")})(this,P)}return E(P,[{key:"buildPkgData",value:function(S){var U={};return U.magic=S.magic||C.TCP_MAGIC,U.version=S.version||0,U.flag=S.flag||0,U.mtype=S.mtype||0,U.ss=S.ss||0,U.method=S.method||null,U.seq=S.seq||0,U.payload=S.payload||null,U.payload&&(U.psize=C.BUFFER.byteLength(U.payload)),U.method&&(U.ss=C.BUFFER.byteLength(U.method)),U.wpos=0,U}},{key:"cbKey",value:function(S){return S.magic+"_"+S.seq}},{key:"isHTTP",value:function(S){return C.HTTP_MAGIC.equals(S.magic)}},{key:"isTCP",value:function(S){return C.TCP_MAGIC.equals(S.magic)}},{key:"isMsgPack",value:function(S){return S.flag==1}},{key:"isJson",value:function(S){return S.flag==0}},{key:"isOneWay",value:function(S){return S.mtype==0}},{key:"isTwoWay",value:function(S){return S.mtype==1}},{key:"isQuest",value:function(S){return this.isTwoWay(S)||this.isOneWay(S)}},{key:"isAnswer",value:function(S){return S.mtype==2}},{key:"isSupportPack",value:function(S){return this.isMsgPack(S)!=this.isJson(S)}},{key:"enCode",value:function(S){return this.isOneWay(S)?this.enCodeOneway(S):this.isTwoWay(S)?this.enCodeTwoway(S):this.isAnswer(S)?this.enCodeAnswer(S):null}},{key:"enCodeOneway",value:function(S){var U=O.call(this,S,12+S.ss+S.psize);S.wpos=U.writeUInt8(S.ss,S.wpos),S.wpos=U.writeUInt32LE(S.psize,S.wpos);var N=C.BUFFER.from(S.method);if(S.wpos+=N.copy(U,S.wpos,0),this.isJson(S)){var D=C.BUFFER.from(S.payload);S.wpos+=D.copy(U,S.wpos,0)}return this.isMsgPack(S)&&(this.wpos+=this.payload.copy(U,this.wpos,0)),U}},{key:"enCodeTwoway",value:function(S){var U=O.call(this,S,16+S.ss+S.psize);S.wpos=U.writeUInt8(S.ss,S.wpos),S.wpos=U.writeUInt32LE(S.psize,S.wpos),S.wpos=U.writeUInt32LE(S.seq,S.wpos);var N=C.BUFFER.from(S.method);if(S.wpos+=N.copy(U,S.wpos,0),this.isJson(S)){var D=C.BUFFER.from(S.payload);S.wpos+=D.copy(U,S.wpos,0)}return this.isMsgPack(S)&&(S.wpos+=S.payload.copy(U,S.wpos,0)),U}},{key:"enCodeAnswer",value:function(S){var U=O.call(this,S,16+S.psize);if(S.wpos=U.writeUInt8(S.ss,S.wpos),S.wpos=U.writeUInt32LE(S.psize,S.wpos),S.wpos=U.writeUInt32LE(S.seq,S.wpos),this.isJson(S)){var N=C.BUFFER.from(S.payload);S.wpos+=N.copy(U,S.wpos,0)}return this.isMsgPack(S)&&(S.wpos+=S.payload.copy(U,S.wpos,0)),U}},{key:"peekHead",value:function(S){var U={},N=0,D=C.BUFFER.allocUnsafe(4);return N+=S.copy(D,0,N,N+4),U.magic=D,D=C.BUFFER.allocUnsafe(1),N+=S.copy(D,0,N,N+1),U.version=C.FPNN_VERSION.indexOf(D),N+=S.copy(D,0,N,N+1),U.flag=C.FP_FLAG.indexOf(D),N+=S.copy(D,0,N,N+1),U.mtype=C.FP_MESSAGE_TYPE.indexOf(D),N+=S.copy(D,0,N,N+1),U.ss=D.readUInt8(0),U.psize=S.readUInt32LE(N),U.wpos=N+4,U}},{key:"deCode",value:function(S){var U=this.peekHead(S);return this.isOneWay(U)&&this.deCodeOneWay(S,U),this.isTwoWay(U)&&this.deCodeTwoWay(S,U),this.isAnswer(U)&&this.deCodeAnswer(S,U),U}},{key:"deCodeOneWay",value:function(S,U){if(S.length==12+U.ss+U.psize){var N=C.BUFFER.allocUnsafe(U.ss);U.wpos+=S.copy(N,0,U.wpos,U.wpos+U.ss),U.method=N.toString();var D=C.BUFFER.allocUnsafe(U.psize);U.wpos+=S.copy(D,0,U.wpos),this.isJson(U)&&(U.payload=D.toString()),this.isMsgPack(U)&&(U.payload=D)}else U=null}},{key:"deCodeTwoWay",value:function(S,U){if(S.length==16+U.ss+U.psize){U.seq=S.readUInt32LE(U.wpos),U.wpos+=4;var N=C.BUFFER.allocUnsafe(U.ss);U.wpos+=S.copy(N,0,U.wpos,U.wpos+U.ss),U.method=N.toString();var D=C.BUFFER.allocUnsafe(U.psize);U.wpos+=S.copy(D,0,U.wpos),this.isJson(U)&&(U.payload=D.toString()),this.isMsgPack(U)&&(U.payload=D)}else U=null}},{key:"deCodeAnswer",value:function(S,U){if(S.length==16+U.psize){U.seq=S.readUInt32LE(U.wpos),U.wpos+=4;var N=C.BUFFER.allocUnsafe(U.psize);U.wpos+=S.copy(N,0,U.wpos),this.isJson(U)&&(U.payload=N.toString()),this.isMsgPack(U)&&(U.payload=N)}else U=null}}]),P})();function O(P,S){var U=C.BUFFER.allocUnsafe(S);return this.isHTTP(P)&&(P.wpos+=C.HTTP_MAGIC.copy(U,P.wpos,0)),this.isTCP(P)&&(P.wpos+=C.TCP_MAGIC.copy(U,P.wpos,0)),P.wpos+=C.FPNN_VERSION.copy(U,P.wpos,P.version,P.version+1),this.isJson(P)&&(P.wpos+=C.FP_FLAG.copy(U,P.wpos,P.flag,P.flag+1)),this.isMsgPack(P)&&(P.wpos+=C.FP_FLAG.copy(U,P.wpos,P.flag,P.flag+1)),P.wpos+=C.FP_MESSAGE_TYPE.copy(U,P.wpos,P.mtype,P.mtype+1),U}R.exports=T},function(R,g,m){"use strict";var E=(function(){function L(q,H){for(var V=0;V<H.length;V++){var K=H[V];K.enumerable=K.enumerable||!1,K.configurable=!0,"value"in K&&(K.writable=!0),Object.defineProperty(q,K.key,K)}}return function(q,H,V){return H&&L(q.prototype,H),V&&L(q,V),q}})(),C=m(0),T=m(2),O=(function(){function L(){(function(q,H){if(!(q instanceof H))throw new TypeError("Cannot call a class as a function")})(this,L),this._cbMap={},this._exMap={},P.call(this)}return E(L,[{key:"addCb",value:function(q,H,V){this._cbMap.hasOwnProperty(q)||(this._cbMap[q]=H),V||(V=C.SEND_TIMEOUT),this._exMap[q]=V+Date.now()}},{key:"removeCb",value:function(q){if(q)N.call(this,q);else for(var H in this._cbMap)S.call(this,H,new T(C.ERROR_CODE.FPNN_EC_CORE_CONNECTION_CLOSED,new Error("Connection Closed")))}},{key:"execCb",value:function(q,H){S.call(this,q,H)}}]),L})();function P(){var L=this;setInterval((function(){for(var q in L._exMap)L._exMap[q]>Date.now()||S.call(L,q,new T(C.ERROR_CODE.FPNN_EC_CORE_TIMEOUT,Error("Timeout")))}),C.CHECK_CBS_INTERVAL)}function S(L,q){var H=this;setTimeout((function(){U.call(H,L,q)}),0)}function U(L,q){if(this._cbMap.hasOwnProperty(L)){var H=this._cbMap[L];D.call(this,L),H&&H(q)}}function N(L){var q=this;setTimeout((function(){D.call(q,L)}),0)}function D(L){this._cbMap.hasOwnProperty(L)&&delete this._cbMap[L],this._exMap.hasOwnProperty(L)&&delete this._exMap[L]}R.exports=O},function(R,g,m){"use strict";var E=(function(){function O(P,S){for(var U=0;U<S.length;U++){var N=S[U];N.enumerable=N.enumerable||!1,N.configurable=!0,"value"in N&&(N.writable=!0),Object.defineProperty(P,N.key,N)}}return function(P,S,U){return S&&O(P.prototype,S),U&&O(P,U),P}})(),C=m(1),T=(function(){function O(){(function(P,S){if(!(P instanceof S))throw new TypeError("Cannot call a class as a function")})(this,O),C.assign(this)}return E(O,[{key:"service",value:function(P,S){this.emit(P.method,P.payload,S)}},{key:"destroy",value:function(){}}]),O})();R.exports=T},function(R,g,m){"use strict";var E=m(9),C=m(0),T=m(1),O=m(3),P=m(5),S=m(6),U=m(7),N=m(2),D=m(4),L=m(13);R.exports={FPClient:E,FPConfig:C,FPEvent:T,FPSocket:O,FPPackage:P,FPCallback:S,FPProcessor:U,FPError:N,BrowserImpl:D,WechatImpl:L}},function(R,g,m){"use strict";var E=(function(){function X(ee,le){for(var $=0;$<le.length;$++){var he=le[$];he.enumerable=he.enumerable||!1,he.configurable=!0,"value"in he&&(he.writable=!0),Object.defineProperty(ee,he.key,he)}}return function(ee,le,$){return le&&X(ee.prototype,le),$&&X(ee,$),ee}})(),C=m(0),T=m(1),O=m(3),P=m(5),S=m(6),U=m(7),N=m(2),D=(function(){function X(ee){(function($,he){if(!($ instanceof he))throw new TypeError("Cannot call a class as a function")})(this,X),T.assign(this),this._autoReconnect=ee.autoReconnect||!1,this._conn=new O(ee);var le=this;this._conn.on("connect",(function(){q.call(le)})),this._conn.on("close",(function(){H.call(le)})),this._conn.on("data",(function($){K.call(le,$)})),this._conn.on("error",(function($){L.call(le,new N(C.ERROR_CODE.FPNN_EC_CORE_UNKNOWN_ERROR,$))})),this._pkg=new P,this._cbs=new S,this._psr=new U,this._seq=0,this._wpos=0,this._peekData=null,this._readID=0,this._reconnectID=0,this._buffer=C.BUFFER.allocUnsafe(C.READ_BUFFER_LEN)}return E(X,[{key:"connect",value:function(){this.hasConnect||this._conn.open()}},{key:"sendQuest",value:function(ee,le,$){if(this._conn.isOpen){var he={};he.magic=ee.magic||C.TCP_MAGIC,he.version=ee.version||1,he.flag=ee.flag||0,he.mtype=ee.hasOwnProperty("mtype")?ee.mtype:1,he.method=ee.method,he.seq=ee.hasOwnProperty("seq")?ee.seq:++this._seq,he.payload=ee.payload,he=this._pkg.buildPkgData(he),le&&this._cbs.addCb(this._pkg.cbKey(he),le,$);var Fe=this._pkg.enCode(he);this._conn.write(Fe)}else le&&le(new N(C.ERROR_CODE.FPNN_EC_CORE_CONNECTION_CLOSED,new Error("Connection Closed")))}},{key:"sendNotify",value:function(ee){var le={};le.magic=ee.magic||C.TCP_MAGIC,le.version=ee.version||1,le.flag=ee.flag||0,le.mtype=ee.mtype||0,le.method=ee.method,le.payload=ee.payload,le=this._pkg.buildPkgData(le);var $=this._pkg.enCode(le);this._conn.write($)}},{key:"close",value:function(ee){ee&&L.call(this,ee),this._conn.close()}},{key:"destroy",value:function(){this._autoReconnect=!1,this.removeEvent(),this._psr.destroy(),this._conn.destroy(),H.call(this)}},{key:"processor",get:function(){return this._psr},set:function(ee){return this._psr=ee}},{key:"isOpen",get:function(){return this._conn.isOpen}},{key:"hasConnect",get:function(){return this._conn.isOpen||this._conn.isConnecting}}]),X})();function L(X){this.emit("error",X)}function q(){this._reconnectID&&(clearTimeout(this._reconnectID),this._reconnectID=0),this.emit("connect")}function H(){this._readID&&(clearInterval(this._readID),this._readID=0),this._reconnectID&&(clearTimeout(this._reconnectID),this._reconnectID=0),this._seq=0,this._wpos=0,this._peekData=null,this._cbs.removeCb(),this._buffer=C.BUFFER.allocUnsafe(C.READ_BUFFER_LEN),this.emit("close"),this._autoReconnect&&V.call(this)}function V(){if(!this._reconnectID){var X=this;this._reconnectID=setTimeout((function(){X.connect()}),100)}}function K(X){X=C.BUFFER.from(X);var ee=this._wpos+X.length;if(ee>this._buffer.length&&Q.call(this,ee,2*C.READ_BUFFER_LEN),this._wpos+=X.copy(this._buffer,this._wpos,0),!this._readID){var le=this;this._readID=setInterval((function(){Z.call(le)}),0)}}function Q(X,ee){var le=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,$=Math.max(X,ee),he=C.BUFFER.allocUnsafe($);this._wpos=this._buffer.copy(he,0,le,this._wpos),this._buffer=he}function Z(){if(!(this._wpos<12))if(this._peekData||(this._peekData=se.call(this,this._buffer),this._peekData)){var X=this._wpos-this._peekData.pkgLen;if(!(X<0)){this._buffer.copy(this._peekData.buffer,0,0,this._peekData.pkgLen);var ee=this._pkg.deCode(this._peekData.buffer);if(Q.call(this,2*X,C.READ_BUFFER_LEN,this._peekData.pkgLen),delete this._peekData,this._peekData=null,this._pkg.isAnswer(ee)){var le=this._pkg.cbKey(ee);this._cbs.execCb(le,ee)}if(this._pkg.isQuest(ee)){var $=this;this._psr.service(ee,(function(he,Fe){ie.call($,ee.flag,ee.seq,he,Fe)}))}}}else this.conn.close(new N(C.ERROR_CODE.FPNN_EC_PROTO_INVALID_PACKAGE,new Error("Invalid Protocol Package")))}function ie(X,ee,le,$){var he={flag:X,mtype:2,seq:ee,ss:($=$||!1)?1:0,payload:le};this.sendQuest(he)}function se(X){var ee=null;if(X.length>=12){if(ee=this._pkg.peekHead(X),!ue.call(this,ee))return null;this._pkg.isOneWay(ee)&&(ee.pkgLen=12+ee.ss+ee.psize),this._pkg.isTwoWay(ee)&&(ee.pkgLen=16+ee.ss+ee.psize),this._pkg.isAnswer(ee)&&(ee.pkgLen=16+ee.psize),ee.pkgLen>0&&(ee.buffer=C.BUFFER.allocUnsafe(ee.pkgLen))}return ee}function ue(X){return!(!C.TCP_MAGIC.equals(X.magic)&&!C.HTTP_MAGIC.equals(X.magic))&&!(X.version<0||X.version>=C.FPNN_VERSION.length)&&!(X.flag<0||X.flag>=C.FP_FLAG.length)&&!(X.mtype<0||X.mtype>=C.FP_MESSAGE_TYPE.length)}R.exports=D},function(R,g,m){"use strict";var E=m(11),C=m(12);g.Buffer=O,g.SlowBuffer=function(x){return+x!=x&&(x=0),O.alloc(+x)},g.INSPECT_MAX_BYTES=50;function T(x){if(x>2147483647)throw new RangeError('The value "'+x+'" is invalid for option "size"');var M=new Uint8Array(x);return M.__proto__=O.prototype,M}function O(x,M,B){if(typeof x=="number"){if(typeof M=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return U(x)}return P(x,M,B)}function P(x,M,B){if(typeof x=="string")return(function(z,ae){if(typeof ae=="string"&&ae!==""||(ae="utf8"),!O.isEncoding(ae))throw new TypeError("Unknown encoding: "+ae);var ve=0|L(z,ae),Te=T(ve),Me=Te.write(z,ae);return Me!==ve&&(Te=Te.slice(0,Me)),Te})(x,M);if(ArrayBuffer.isView(x))return N(x);if(x==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof x);if(qe(x,ArrayBuffer)||x&&qe(x.buffer,ArrayBuffer))return(function(z,ae,ve){if(ae<0||z.byteLength<ae)throw new RangeError('"offset" is outside of buffer bounds');if(z.byteLength<ae+(ve||0))throw new RangeError('"length" is outside of buffer bounds');var Te;return Te=ae===void 0&&ve===void 0?new Uint8Array(z):ve===void 0?new Uint8Array(z,ae):new Uint8Array(z,ae,ve),Te.__proto__=O.prototype,Te})(x,M,B);if(typeof x=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var j=x.valueOf&&x.valueOf();if(j!=null&&j!==x)return O.from(j,M,B);var Y=(function(z){if(O.isBuffer(z)){var ae=0|D(z.length),ve=T(ae);return ve.length===0||z.copy(ve,0,0,ae),ve}if(z.length!==void 0)return typeof z.length!="number"||Be(z.length)?T(0):N(z);if(z.type==="Buffer"&&Array.isArray(z.data))return N(z.data)})(x);if(Y)return Y;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof x[Symbol.toPrimitive]=="function")return O.from(x[Symbol.toPrimitive]("string"),M,B);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof x)}function S(x){if(typeof x!="number")throw new TypeError('"size" argument must be of type number');if(x<0)throw new RangeError('The value "'+x+'" is invalid for option "size"')}function U(x){return S(x),T(x<0?0:0|D(x))}function N(x){for(var M=x.length<0?0:0|D(x.length),B=T(M),j=0;j<M;j+=1)B[j]=255&x[j];return B}function D(x){if(x>=2147483647)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|x}function L(x,M){if(O.isBuffer(x))return x.length;if(ArrayBuffer.isView(x)||qe(x,ArrayBuffer))return x.byteLength;if(typeof x!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof x);var B=x.length,j=arguments.length>2&&arguments[2]===!0;if(!j&&B===0)return 0;for(var Y=!1;;)switch(M){case"ascii":case"latin1":case"binary":return B;case"utf8":case"utf-8":return ce(x).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*B;case"hex":return B>>>1;case"base64":return ye(x).length;default:if(Y)return j?-1:ce(x).length;M=(""+M).toLowerCase(),Y=!0}}function q(x,M,B){var j=!1;if((M===void 0||M<0)&&(M=0),M>this.length||((B===void 0||B>this.length)&&(B=this.length),B<=0)||(B>>>=0)<=(M>>>=0))return"";for(x||(x="utf8");;)switch(x){case"hex":return Fe(this,M,B);case"utf8":case"utf-8":return le(this,M,B);case"ascii":return $(this,M,B);case"latin1":case"binary":return he(this,M,B);case"base64":return ee(this,M,B);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ie(this,M,B);default:if(j)throw new TypeError("Unknown encoding: "+x);x=(x+"").toLowerCase(),j=!0}}function H(x,M,B){var j=x[M];x[M]=x[B],x[B]=j}function V(x,M,B,j,Y){if(x.length===0)return-1;if(typeof B=="string"?(j=B,B=0):B>2147483647?B=2147483647:B<-2147483648&&(B=-2147483648),Be(B=+B)&&(B=Y?0:x.length-1),B<0&&(B=x.length+B),B>=x.length){if(Y)return-1;B=x.length-1}else if(B<0){if(!Y)return-1;B=0}if(typeof M=="string"&&(M=O.from(M,j)),O.isBuffer(M))return M.length===0?-1:K(x,M,B,j,Y);if(typeof M=="number")return M&=255,typeof Uint8Array.prototype.indexOf=="function"?Y?Uint8Array.prototype.indexOf.call(x,M,B):Uint8Array.prototype.lastIndexOf.call(x,M,B):K(x,[M],B,j,Y);throw new TypeError("val must be string, number or Buffer")}function K(x,M,B,j,Y){var z,ae=1,ve=x.length,Te=M.length;if(j!==void 0&&((j=String(j).toLowerCase())==="ucs2"||j==="ucs-2"||j==="utf16le"||j==="utf-16le")){if(x.length<2||M.length<2)return-1;ae=2,ve/=2,Te/=2,B/=2}function Me(Se,xe){return ae===1?Se[xe]:Se.readUInt16BE(xe*ae)}if(Y){var Ae=-1;for(z=B;z<ve;z++)if(Me(x,z)===Me(M,Ae===-1?0:z-Ae)){if(Ae===-1&&(Ae=z),z-Ae+1===Te)return Ae*ae}else Ae!==-1&&(z-=z-Ae),Ae=-1}else for(B+Te>ve&&(B=ve-Te),z=B;z>=0;z--){for(var Re=!0,we=0;we<Te;we++)if(Me(x,z+we)!==Me(M,we)){Re=!1;break}if(Re)return z}return-1}function Q(x,M,B,j){B=Number(B)||0;var Y=x.length-B;j?(j=Number(j))>Y&&(j=Y):j=Y;var z=M.length;j>z/2&&(j=z/2);for(var ae=0;ae<j;++ae){var ve=parseInt(M.substr(2*ae,2),16);if(Be(ve))return ae;x[B+ae]=ve}return ae}function Z(x,M,B,j){return ke(ce(M,x.length-B),x,B,j)}function ie(x,M,B,j){return ke((function(Y){for(var z=[],ae=0;ae<Y.length;++ae)z.push(255&Y.charCodeAt(ae));return z})(M),x,B,j)}function se(x,M,B,j){return ie(x,M,B,j)}function ue(x,M,B,j){return ke(ye(M),x,B,j)}function X(x,M,B,j){return ke((function(Y,z){for(var ae,ve,Te,Me=[],Ae=0;Ae<Y.length&&!((z-=2)<0);++Ae)ae=Y.charCodeAt(Ae),ve=ae>>8,Te=ae%256,Me.push(Te),Me.push(ve);return Me})(M,x.length-B),x,B,j)}function ee(x,M,B){return M===0&&B===x.length?E.fromByteArray(x):E.fromByteArray(x.slice(M,B))}function le(x,M,B){B=Math.min(x.length,B);for(var j=[],Y=M;Y<B;){var z,ae,ve,Te,Me=x[Y],Ae=null,Re=Me>239?4:Me>223?3:Me>191?2:1;if(Y+Re<=B)switch(Re){case 1:Me<128&&(Ae=Me);break;case 2:(192&(z=x[Y+1]))==128&&(Te=(31&Me)<<6|63&z)>127&&(Ae=Te);break;case 3:z=x[Y+1],ae=x[Y+2],(192&z)==128&&(192&ae)==128&&(Te=(15&Me)<<12|(63&z)<<6|63&ae)>2047&&(Te<55296||Te>57343)&&(Ae=Te);break;case 4:z=x[Y+1],ae=x[Y+2],ve=x[Y+3],(192&z)==128&&(192&ae)==128&&(192&ve)==128&&(Te=(15&Me)<<18|(63&z)<<12|(63&ae)<<6|63&ve)>65535&&Te<1114112&&(Ae=Te)}Ae===null?(Ae=65533,Re=1):Ae>65535&&(Ae-=65536,j.push(Ae>>>10&1023|55296),Ae=56320|1023&Ae),j.push(Ae),Y+=Re}return(function(we){var Se=we.length;if(Se<=4096)return String.fromCharCode.apply(String,we);for(var xe="",We=0;We<Se;)xe+=String.fromCharCode.apply(String,we.slice(We,We+=4096));return xe})(j)}g.kMaxLength=2147483647,O.TYPED_ARRAY_SUPPORT=(function(){try{var x=new Uint8Array(1);return x.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},x.foo()===42}catch{return!1}})(),O.TYPED_ARRAY_SUPPORT||typeof console>"u"||typeof console.error!="function"||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(O.prototype,"parent",{enumerable:!0,get:function(){if(O.isBuffer(this))return this.buffer}}),Object.defineProperty(O.prototype,"offset",{enumerable:!0,get:function(){if(O.isBuffer(this))return this.byteOffset}}),typeof Symbol<"u"&&Symbol.species!=null&&O[Symbol.species]===O&&Object.defineProperty(O,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),O.poolSize=8192,O.from=function(x,M,B){return P(x,M,B)},O.prototype.__proto__=Uint8Array.prototype,O.__proto__=Uint8Array,O.alloc=function(x,M,B){return(function(j,Y,z){return S(j),j<=0?T(j):Y!==void 0?typeof z=="string"?T(j).fill(Y,z):T(j).fill(Y):T(j)})(x,M,B)},O.allocUnsafe=function(x){return U(x)},O.allocUnsafeSlow=function(x){return U(x)},O.isBuffer=function(x){return x!=null&&x._isBuffer===!0&&x!==O.prototype},O.compare=function(x,M){if(qe(x,Uint8Array)&&(x=O.from(x,x.offset,x.byteLength)),qe(M,Uint8Array)&&(M=O.from(M,M.offset,M.byteLength)),!O.isBuffer(x)||!O.isBuffer(M))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(x===M)return 0;for(var B=x.length,j=M.length,Y=0,z=Math.min(B,j);Y<z;++Y)if(x[Y]!==M[Y]){B=x[Y],j=M[Y];break}return B<j?-1:j<B?1:0},O.isEncoding=function(x){switch(String(x).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},O.concat=function(x,M){if(!Array.isArray(x))throw new TypeError('"list" argument must be an Array of Buffers');if(x.length===0)return O.alloc(0);var B;if(M===void 0)for(M=0,B=0;B<x.length;++B)M+=x[B].length;var j=O.allocUnsafe(M),Y=0;for(B=0;B<x.length;++B){var z=x[B];if(qe(z,Uint8Array)&&(z=O.from(z)),!O.isBuffer(z))throw new TypeError('"list" argument must be an Array of Buffers');z.copy(j,Y),Y+=z.length}return j},O.byteLength=L,O.prototype._isBuffer=!0,O.prototype.swap16=function(){var x=this.length;if(x%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var M=0;M<x;M+=2)H(this,M,M+1);return this},O.prototype.swap32=function(){var x=this.length;if(x%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var M=0;M<x;M+=4)H(this,M,M+3),H(this,M+1,M+2);return this},O.prototype.swap64=function(){var x=this.length;if(x%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var M=0;M<x;M+=8)H(this,M,M+7),H(this,M+1,M+6),H(this,M+2,M+5),H(this,M+3,M+4);return this},O.prototype.toString=function(){var x=this.length;return x===0?"":arguments.length===0?le(this,0,x):q.apply(this,arguments)},O.prototype.toLocaleString=O.prototype.toString,O.prototype.equals=function(x){if(!O.isBuffer(x))throw new TypeError("Argument must be a Buffer");return this===x||O.compare(this,x)===0},O.prototype.inspect=function(){var x="",M=g.INSPECT_MAX_BYTES;return x=this.toString("hex",0,M).replace(/(.{2})/g,"$1 ").trim(),this.length>M&&(x+=" ... "),"<Buffer "+x+">"},O.prototype.compare=function(x,M,B,j,Y){if(qe(x,Uint8Array)&&(x=O.from(x,x.offset,x.byteLength)),!O.isBuffer(x))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof x);if(M===void 0&&(M=0),B===void 0&&(B=x?x.length:0),j===void 0&&(j=0),Y===void 0&&(Y=this.length),M<0||B>x.length||j<0||Y>this.length)throw new RangeError("out of range index");if(j>=Y&&M>=B)return 0;if(j>=Y)return-1;if(M>=B)return 1;if(this===x)return 0;for(var z=(Y>>>=0)-(j>>>=0),ae=(B>>>=0)-(M>>>=0),ve=Math.min(z,ae),Te=this.slice(j,Y),Me=x.slice(M,B),Ae=0;Ae<ve;++Ae)if(Te[Ae]!==Me[Ae]){z=Te[Ae],ae=Me[Ae];break}return z<ae?-1:ae<z?1:0},O.prototype.includes=function(x,M,B){return this.indexOf(x,M,B)!==-1},O.prototype.indexOf=function(x,M,B){return V(this,x,M,B,!0)},O.prototype.lastIndexOf=function(x,M,B){return V(this,x,M,B,!1)},O.prototype.write=function(x,M,B,j){if(M===void 0)j="utf8",B=this.length,M=0;else if(B===void 0&&typeof M=="string")j=M,B=this.length,M=0;else{if(!isFinite(M))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");M>>>=0,isFinite(B)?(B>>>=0,j===void 0&&(j="utf8")):(j=B,B=void 0)}var Y=this.length-M;if((B===void 0||B>Y)&&(B=Y),x.length>0&&(B<0||M<0)||M>this.length)throw new RangeError("Attempt to write outside buffer bounds");j||(j="utf8");for(var z=!1;;)switch(j){case"hex":return Q(this,x,M,B);case"utf8":case"utf-8":return Z(this,x,M,B);case"ascii":return ie(this,x,M,B);case"latin1":case"binary":return se(this,x,M,B);case"base64":return ue(this,x,M,B);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return X(this,x,M,B);default:if(z)throw new TypeError("Unknown encoding: "+j);j=(""+j).toLowerCase(),z=!0}},O.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function $(x,M,B){var j="";B=Math.min(x.length,B);for(var Y=M;Y<B;++Y)j+=String.fromCharCode(127&x[Y]);return j}function he(x,M,B){var j="";B=Math.min(x.length,B);for(var Y=M;Y<B;++Y)j+=String.fromCharCode(x[Y]);return j}function Fe(x,M,B){var j=x.length;(!M||M<0)&&(M=0),(!B||B<0||B>j)&&(B=j);for(var Y="",z=M;z<B;++z)Y+=de(x[z]);return Y}function Ie(x,M,B){for(var j=x.slice(M,B),Y="",z=0;z<j.length;z+=2)Y+=String.fromCharCode(j[z]+256*j[z+1]);return Y}function Ce(x,M,B){if(x%1!=0||x<0)throw new RangeError("offset is not uint");if(x+M>B)throw new RangeError("Trying to access beyond buffer length")}function Oe(x,M,B,j,Y,z){if(!O.isBuffer(x))throw new TypeError('"buffer" argument must be a Buffer instance');if(M>Y||M<z)throw new RangeError('"value" argument is out of bounds');if(B+j>x.length)throw new RangeError("Index out of range")}function be(x,M,B,j,Y,z){if(B+j>x.length)throw new RangeError("Index out of range");if(B<0)throw new RangeError("Index out of range")}function te(x,M,B,j,Y){return M=+M,B>>>=0,Y||be(x,0,B,4),C.write(x,M,B,j,23,4),B+4}function oe(x,M,B,j,Y){return M=+M,B>>>=0,Y||be(x,0,B,8),C.write(x,M,B,j,52,8),B+8}O.prototype.slice=function(x,M){var B=this.length;(x=~~x)<0?(x+=B)<0&&(x=0):x>B&&(x=B),(M=M===void 0?B:~~M)<0?(M+=B)<0&&(M=0):M>B&&(M=B),M<x&&(M=x);var j=this.subarray(x,M);return j.__proto__=O.prototype,j},O.prototype.readUIntLE=function(x,M,B){x>>>=0,M>>>=0,B||Ce(x,M,this.length);for(var j=this[x],Y=1,z=0;++z<M&&(Y*=256);)j+=this[x+z]*Y;return j},O.prototype.readUIntBE=function(x,M,B){x>>>=0,M>>>=0,B||Ce(x,M,this.length);for(var j=this[x+--M],Y=1;M>0&&(Y*=256);)j+=this[x+--M]*Y;return j},O.prototype.readUInt8=function(x,M){return x>>>=0,M||Ce(x,1,this.length),this[x]},O.prototype.readUInt16LE=function(x,M){return x>>>=0,M||Ce(x,2,this.length),this[x]|this[x+1]<<8},O.prototype.readUInt16BE=function(x,M){return x>>>=0,M||Ce(x,2,this.length),this[x]<<8|this[x+1]},O.prototype.readUInt32LE=function(x,M){return x>>>=0,M||Ce(x,4,this.length),(this[x]|this[x+1]<<8|this[x+2]<<16)+16777216*this[x+3]},O.prototype.readUInt32BE=function(x,M){return x>>>=0,M||Ce(x,4,this.length),16777216*this[x]+(this[x+1]<<16|this[x+2]<<8|this[x+3])},O.prototype.readIntLE=function(x,M,B){x>>>=0,M>>>=0,B||Ce(x,M,this.length);for(var j=this[x],Y=1,z=0;++z<M&&(Y*=256);)j+=this[x+z]*Y;return j>=(Y*=128)&&(j-=Math.pow(2,8*M)),j},O.prototype.readIntBE=function(x,M,B){x>>>=0,M>>>=0,B||Ce(x,M,this.length);for(var j=M,Y=1,z=this[x+--j];j>0&&(Y*=256);)z+=this[x+--j]*Y;return z>=(Y*=128)&&(z-=Math.pow(2,8*M)),z},O.prototype.readInt8=function(x,M){return x>>>=0,M||Ce(x,1,this.length),128&this[x]?-1*(255-this[x]+1):this[x]},O.prototype.readInt16LE=function(x,M){x>>>=0,M||Ce(x,2,this.length);var B=this[x]|this[x+1]<<8;return 32768&B?4294901760|B:B},O.prototype.readInt16BE=function(x,M){x>>>=0,M||Ce(x,2,this.length);var B=this[x+1]|this[x]<<8;return 32768&B?4294901760|B:B},O.prototype.readInt32LE=function(x,M){return x>>>=0,M||Ce(x,4,this.length),this[x]|this[x+1]<<8|this[x+2]<<16|this[x+3]<<24},O.prototype.readInt32BE=function(x,M){return x>>>=0,M||Ce(x,4,this.length),this[x]<<24|this[x+1]<<16|this[x+2]<<8|this[x+3]},O.prototype.readFloatLE=function(x,M){return x>>>=0,M||Ce(x,4,this.length),C.read(this,x,!0,23,4)},O.prototype.readFloatBE=function(x,M){return x>>>=0,M||Ce(x,4,this.length),C.read(this,x,!1,23,4)},O.prototype.readDoubleLE=function(x,M){return x>>>=0,M||Ce(x,8,this.length),C.read(this,x,!0,52,8)},O.prototype.readDoubleBE=function(x,M){return x>>>=0,M||Ce(x,8,this.length),C.read(this,x,!1,52,8)},O.prototype.writeUIntLE=function(x,M,B,j){x=+x,M>>>=0,B>>>=0,j||Oe(this,x,M,B,Math.pow(2,8*B)-1,0);var Y=1,z=0;for(this[M]=255&x;++z<B&&(Y*=256);)this[M+z]=x/Y&255;return M+B},O.prototype.writeUIntBE=function(x,M,B,j){x=+x,M>>>=0,B>>>=0,j||Oe(this,x,M,B,Math.pow(2,8*B)-1,0);var Y=B-1,z=1;for(this[M+Y]=255&x;--Y>=0&&(z*=256);)this[M+Y]=x/z&255;return M+B},O.prototype.writeUInt8=function(x,M,B){return x=+x,M>>>=0,B||Oe(this,x,M,1,255,0),this[M]=255&x,M+1},O.prototype.writeUInt16LE=function(x,M,B){return x=+x,M>>>=0,B||Oe(this,x,M,2,65535,0),this[M]=255&x,this[M+1]=x>>>8,M+2},O.prototype.writeUInt16BE=function(x,M,B){return x=+x,M>>>=0,B||Oe(this,x,M,2,65535,0),this[M]=x>>>8,this[M+1]=255&x,M+2},O.prototype.writeUInt32LE=function(x,M,B){return x=+x,M>>>=0,B||Oe(this,x,M,4,4294967295,0),this[M+3]=x>>>24,this[M+2]=x>>>16,this[M+1]=x>>>8,this[M]=255&x,M+4},O.prototype.writeUInt32BE=function(x,M,B){return x=+x,M>>>=0,B||Oe(this,x,M,4,4294967295,0),this[M]=x>>>24,this[M+1]=x>>>16,this[M+2]=x>>>8,this[M+3]=255&x,M+4},O.prototype.writeIntLE=function(x,M,B,j){if(x=+x,M>>>=0,!j){var Y=Math.pow(2,8*B-1);Oe(this,x,M,B,Y-1,-Y)}var z=0,ae=1,ve=0;for(this[M]=255&x;++z<B&&(ae*=256);)x<0&&ve===0&&this[M+z-1]!==0&&(ve=1),this[M+z]=(x/ae>>0)-ve&255;return M+B},O.prototype.writeIntBE=function(x,M,B,j){if(x=+x,M>>>=0,!j){var Y=Math.pow(2,8*B-1);Oe(this,x,M,B,Y-1,-Y)}var z=B-1,ae=1,ve=0;for(this[M+z]=255&x;--z>=0&&(ae*=256);)x<0&&ve===0&&this[M+z+1]!==0&&(ve=1),this[M+z]=(x/ae>>0)-ve&255;return M+B},O.prototype.writeInt8=function(x,M,B){return x=+x,M>>>=0,B||Oe(this,x,M,1,127,-128),x<0&&(x=255+x+1),this[M]=255&x,M+1},O.prototype.writeInt16LE=function(x,M,B){return x=+x,M>>>=0,B||Oe(this,x,M,2,32767,-32768),this[M]=255&x,this[M+1]=x>>>8,M+2},O.prototype.writeInt16BE=function(x,M,B){return x=+x,M>>>=0,B||Oe(this,x,M,2,32767,-32768),this[M]=x>>>8,this[M+1]=255&x,M+2},O.prototype.writeInt32LE=function(x,M,B){return x=+x,M>>>=0,B||Oe(this,x,M,4,2147483647,-2147483648),this[M]=255&x,this[M+1]=x>>>8,this[M+2]=x>>>16,this[M+3]=x>>>24,M+4},O.prototype.writeInt32BE=function(x,M,B){return x=+x,M>>>=0,B||Oe(this,x,M,4,2147483647,-2147483648),x<0&&(x=4294967295+x+1),this[M]=x>>>24,this[M+1]=x>>>16,this[M+2]=x>>>8,this[M+3]=255&x,M+4},O.prototype.writeFloatLE=function(x,M,B){return te(this,x,M,!0,B)},O.prototype.writeFloatBE=function(x,M,B){return te(this,x,M,!1,B)},O.prototype.writeDoubleLE=function(x,M,B){return oe(this,x,M,!0,B)},O.prototype.writeDoubleBE=function(x,M,B){return oe(this,x,M,!1,B)},O.prototype.copy=function(x,M,B,j){if(!O.isBuffer(x))throw new TypeError("argument should be a Buffer");if(B||(B=0),j||j===0||(j=this.length),M>=x.length&&(M=x.length),M||(M=0),j>0&&j<B&&(j=B),j===B||x.length===0||this.length===0)return 0;if(M<0)throw new RangeError("targetStart out of bounds");if(B<0||B>=this.length)throw new RangeError("Index out of range");if(j<0)throw new RangeError("sourceEnd out of bounds");j>this.length&&(j=this.length),x.length-M<j-B&&(j=x.length-M+B);var Y=j-B;if(this===x&&typeof Uint8Array.prototype.copyWithin=="function")this.copyWithin(M,B,j);else if(this===x&&B<M&&M<j)for(var z=Y-1;z>=0;--z)x[z+M]=this[z+B];else Uint8Array.prototype.set.call(x,this.subarray(B,j),M);return Y},O.prototype.fill=function(x,M,B,j){if(typeof x=="string"){if(typeof M=="string"?(j=M,M=0,B=this.length):typeof B=="string"&&(j=B,B=this.length),j!==void 0&&typeof j!="string")throw new TypeError("encoding must be a string");if(typeof j=="string"&&!O.isEncoding(j))throw new TypeError("Unknown encoding: "+j);if(x.length===1){var Y=x.charCodeAt(0);(j==="utf8"&&Y<128||j==="latin1")&&(x=Y)}}else typeof x=="number"&&(x&=255);if(M<0||this.length<M||this.length<B)throw new RangeError("Out of range index");if(B<=M)return this;var z;if(M>>>=0,B=B===void 0?this.length:B>>>0,x||(x=0),typeof x=="number")for(z=M;z<B;++z)this[z]=x;else{var ae=O.isBuffer(x)?x:O.from(x,j),ve=ae.length;if(ve===0)throw new TypeError('The value "'+x+'" is invalid for argument "value"');for(z=0;z<B-M;++z)this[z+M]=ae[z%ve]}return this};var re=/[^+/0-9A-Za-z-_]/g;function de(x){return x<16?"0"+x.toString(16):x.toString(16)}function ce(x,M){var B;M=M||1/0;for(var j=x.length,Y=null,z=[],ae=0;ae<j;++ae){if((B=x.charCodeAt(ae))>55295&&B<57344){if(!Y){if(B>56319){(M-=3)>-1&&z.push(239,191,189);continue}if(ae+1===j){(M-=3)>-1&&z.push(239,191,189);continue}Y=B;continue}if(B<56320){(M-=3)>-1&&z.push(239,191,189),Y=B;continue}B=65536+(Y-55296<<10|B-56320)}else Y&&(M-=3)>-1&&z.push(239,191,189);if(Y=null,B<128){if((M-=1)<0)break;z.push(B)}else if(B<2048){if((M-=2)<0)break;z.push(B>>6|192,63&B|128)}else if(B<65536){if((M-=3)<0)break;z.push(B>>12|224,B>>6&63|128,63&B|128)}else{if(!(B<1114112))throw new Error("Invalid code point");if((M-=4)<0)break;z.push(B>>18|240,B>>12&63|128,B>>6&63|128,63&B|128)}}return z}function ye(x){return E.toByteArray((function(M){if((M=(M=M.split("=")[0]).trim().replace(re,"")).length<2)return"";for(;M.length%4!=0;)M+="=";return M})(x))}function ke(x,M,B,j){for(var Y=0;Y<j&&!(Y+B>=M.length||Y>=x.length);++Y)M[Y+B]=x[Y];return Y}function qe(x,M){return x instanceof M||x!=null&&x.constructor!=null&&x.constructor.name!=null&&x.constructor.name===M.name}function Be(x){return x!=x}},function(R,g,m){"use strict";g.byteLength=function(D){var L=U(D),q=L[0],H=L[1];return 3*(q+H)/4-H},g.toByteArray=function(D){var L,q,H=U(D),V=H[0],K=H[1],Q=new T((function(se,ue,X){return 3*(ue+X)/4-X})(0,V,K)),Z=0,ie=K>0?V-4:V;for(q=0;q<ie;q+=4)L=C[D.charCodeAt(q)]<<18|C[D.charCodeAt(q+1)]<<12|C[D.charCodeAt(q+2)]<<6|C[D.charCodeAt(q+3)],Q[Z++]=L>>16&255,Q[Z++]=L>>8&255,Q[Z++]=255&L;return K===2&&(L=C[D.charCodeAt(q)]<<2|C[D.charCodeAt(q+1)]>>4,Q[Z++]=255&L),K===1&&(L=C[D.charCodeAt(q)]<<10|C[D.charCodeAt(q+1)]<<4|C[D.charCodeAt(q+2)]>>2,Q[Z++]=L>>8&255,Q[Z++]=255&L),Q},g.fromByteArray=function(D){for(var L,q=D.length,H=q%3,V=[],K=0,Q=q-H;K<Q;K+=16383)V.push(N(D,K,K+16383>Q?Q:K+16383));return H===1?(L=D[q-1],V.push(E[L>>2]+E[L<<4&63]+"==")):H===2&&(L=(D[q-2]<<8)+D[q-1],V.push(E[L>>10]+E[L>>4&63]+E[L<<2&63]+"=")),V.join("")};for(var E=[],C=[],T=typeof Uint8Array<"u"?Uint8Array:Array,O="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",P=0,S=O.length;P<S;++P)E[P]=O[P],C[O.charCodeAt(P)]=P;function U(D){var L=D.length;if(L%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var q=D.indexOf("=");return q===-1&&(q=L),[q,q===L?0:4-q%4]}function N(D,L,q){for(var H,V,K=[],Q=L;Q<q;Q+=3)H=(D[Q]<<16&16711680)+(D[Q+1]<<8&65280)+(255&D[Q+2]),K.push(E[(V=H)>>18&63]+E[V>>12&63]+E[V>>6&63]+E[63&V]);return K.join("")}C[45]=62,C[95]=63},function(R,g){g.read=function(m,E,C,T,O){var P,S,U=8*O-T-1,N=(1<<U)-1,D=N>>1,L=-7,q=C?O-1:0,H=C?-1:1,V=m[E+q];for(q+=H,P=V&(1<<-L)-1,V>>=-L,L+=U;L>0;P=256*P+m[E+q],q+=H,L-=8);for(S=P&(1<<-L)-1,P>>=-L,L+=T;L>0;S=256*S+m[E+q],q+=H,L-=8);if(P===0)P=1-D;else{if(P===N)return S?NaN:1/0*(V?-1:1);S+=Math.pow(2,T),P-=D}return(V?-1:1)*S*Math.pow(2,P-T)},g.write=function(m,E,C,T,O,P){var S,U,N,D=8*P-O-1,L=(1<<D)-1,q=L>>1,H=O===23?Math.pow(2,-24)-Math.pow(2,-77):0,V=T?0:P-1,K=T?1:-1,Q=E<0||E===0&&1/E<0?1:0;for(E=Math.abs(E),isNaN(E)||E===1/0?(U=isNaN(E)?1:0,S=L):(S=Math.floor(Math.log(E)/Math.LN2),E*(N=Math.pow(2,-S))<1&&(S--,N*=2),(E+=S+q>=1?H/N:H*Math.pow(2,1-q))*N>=2&&(S++,N/=2),S+q>=L?(U=0,S=L):S+q>=1?(U=(E*N-1)*Math.pow(2,O),S+=q):(U=E*Math.pow(2,q-1)*Math.pow(2,O),S=0));O>=8;m[C+V]=255&U,V+=K,U/=256,O-=8);for(S=S<<O|U,D+=O;D>0;m[C+V]=255&S,V+=K,S/=256,D-=8);m[C+V-K]|=128*Q}},function(R,g,m){"use strict";var E=(function(){function T(O,P){for(var S=0;S<P.length;S++){var U=P[S];U.enumerable=U.enumerable||!1,U.configurable=!0,"value"in U&&(U.writable=!0),Object.defineProperty(O,U.key,U)}}return function(O,P,S){return P&&T(O.prototype,P),S&&T(O,S),O}})(),C=(function(){function T(){(function(O,P){if(!(O instanceof P))throw new TypeError("Cannot call a class as a function")})(this,T),this._socket=null}return E(T,[{key:"open",value:function(O){var P=this;wx&&wx.connectSocket?(this._socket=wx.connectSocket({url:O,protocols:"arraybuffer"}),this._socket.onOpen((function(S){P.emit("open")})),this._socket.onMessage((function(S){P.emit("message",S.data)})),this._socket.onClose((function(){P.emit("close")})),this._socket.onError((function(S){P.emit("error",S)}))):this.emit("error",new Error("Not support `wx` or `wx.connectSocket` undefined"))}},{key:"send",value:function(O){this._socket&&this._socket.send({data:O})}},{key:"close",value:function(){this._socket&&this._socket.close({})}},{key:"isOpen",get:function(){return!!this._socket&&this._socket.readyState==1}},{key:"isConnecting",get:function(){return!!this._socket&&this._socket.readyState==0}}]),T})();R.exports=C}])}))});var pr=Ge((dr,vn)=>{(function(R){if(typeof dr=="object"&&typeof vn<"u")vn.exports=R();else if(typeof define=="function"&&define.amd)define([],R);else{var g;g=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:this,g.msgpack=R()}})(function(){return(function R(g,m,E){function C(P,S){if(!m[P]){if(!g[P]){var U=typeof kt=="function"&&kt;if(!S&&U)return U(P,!0);if(T)return T(P,!0);var N=new Error("Cannot find module '"+P+"'");throw N.code="MODULE_NOT_FOUND",N}var D=m[P]={exports:{}};g[P][0].call(D.exports,function(L){var q=g[P][1][L];return C(q||L)},D,D.exports,R,g,m,E)}return m[P].exports}for(var T=typeof kt=="function"&&kt,O=0;O<E.length;O++)C(E[O]);return C})({1:[function(R,g,m){m.encode=R("./encode").encode,m.decode=R("./decode").decode,m.Encoder=R("./encoder").Encoder,m.Decoder=R("./decoder").Decoder,m.createCodec=R("./ext").createCodec,m.codec=R("./codec").codec},{"./codec":10,"./decode":12,"./decoder":13,"./encode":15,"./encoder":16,"./ext":20}],2:[function(R,g,m){(function(E){function C(T){return T&&T.isBuffer&&T}g.exports=C(typeof E<"u"&&E)||C(this.Buffer)||C(typeof window<"u"&&window.Buffer)||this.Buffer}).call(this,R("buffer").Buffer)},{buffer:29}],3:[function(R,g,m){function E(O,P){for(var S=this,U=P||(P|=0),N=O.length,D=0,L=0;L<N;)D=O.charCodeAt(L++),D<128?S[U++]=D:D<2048?(S[U++]=192|D>>>6,S[U++]=128|63&D):D<55296||D>57343?(S[U++]=224|D>>>12,S[U++]=128|D>>>6&63,S[U++]=128|63&D):(D=(D-55296<<10|O.charCodeAt(L++)-56320)+65536,S[U++]=240|D>>>18,S[U++]=128|D>>>12&63,S[U++]=128|D>>>6&63,S[U++]=128|63&D);return U-P}function C(O,P,S){var U=this,N=0|P;S||(S=U.length);for(var D="",L=0;N<S;)L=U[N++],L<128?D+=String.fromCharCode(L):((224&L)===192?L=(31&L)<<6|63&U[N++]:(240&L)===224?L=(15&L)<<12|(63&U[N++])<<6|63&U[N++]:(248&L)===240&&(L=(7&L)<<18|(63&U[N++])<<12|(63&U[N++])<<6|63&U[N++]),L>=65536?(L-=65536,D+=String.fromCharCode((L>>>10)+55296,(1023&L)+56320)):D+=String.fromCharCode(L));return D}function T(O,P,S,U){var N;S||(S=0),U||U===0||(U=this.length),P||(P=0);var D=U-S;if(O===this&&S<P&&P<U)for(N=D-1;N>=0;N--)O[N+P]=this[N+S];else for(N=0;N<D;N++)O[N+P]=this[N+S];return D}m.copy=T,m.toString=C,m.write=E},{}],4:[function(R,g,O){function E(P){return new Array(P)}function C(P){if(!T.isBuffer(P)&&T.isView(P))P=T.Uint8Array.from(P);else if(T.isArrayBuffer(P))P=new Uint8Array(P);else{if(typeof P=="string")return T.from.call(O,P);if(typeof P=="number")throw new TypeError('"value" argument must not be a number')}return Array.prototype.slice.call(P)}var T=R("./bufferish"),O=g.exports=E(0);O.alloc=E,O.concat=T.concat,O.from=C},{"./bufferish":8}],5:[function(R,g,P){function E(S){return new O(S)}function C(S){if(!T.isBuffer(S)&&T.isView(S))S=T.Uint8Array.from(S);else if(T.isArrayBuffer(S))S=new Uint8Array(S);else{if(typeof S=="string")return T.from.call(P,S);if(typeof S=="number")throw new TypeError('"value" argument must not be a number')}return O.from&&O.from.length!==1?O.from(S):new O(S)}var T=R("./bufferish"),O=T.global,P=g.exports=T.hasBuffer?E(0):[];P.alloc=T.hasBuffer&&O.alloc||E,P.concat=T.concat,P.from=C},{"./bufferish":8}],6:[function(R,g,m){function E(L,q,H,V){var K=S.isBuffer(this),Q=S.isBuffer(L);if(K&&Q)return this.copy(L,q,H,V);if(D||K||Q||!S.isView(this)||!S.isView(L))return P.copy.call(this,L,q,H,V);var Z=H||V!=null?C.call(this,H,V):this;return L.set(Z,q),Z.length}function C(L,q){var H=this.slice||!D&&this.subarray;if(H)return H.call(this,L,q);var V=S.alloc.call(this,q-L);return E.call(this,V,0,L,q),V}function T(L,q,H){var V=!N&&S.isBuffer(this)?this.toString:P.toString;return V.apply(this,arguments)}function O(L){function q(){var H=this[L]||P[L];return H.apply(this,arguments)}return q}var P=R("./buffer-lite");m.copy=E,m.slice=C,m.toString=T,m.write=O("write");var S=R("./bufferish"),U=S.global,N=S.hasBuffer&&"TYPED_ARRAY_SUPPORT"in U,D=N&&!U.TYPED_ARRAY_SUPPORT},{"./buffer-lite":3,"./bufferish":8}],7:[function(R,g,O){function E(P){return new Uint8Array(P)}function C(P){if(T.isView(P)){var S=P.byteOffset,U=P.byteLength;P=P.buffer,P.byteLength!==U&&(P.slice?P=P.slice(S,S+U):(P=new Uint8Array(P),P.byteLength!==U&&(P=Array.prototype.slice.call(P,S,S+U))))}else{if(typeof P=="string")return T.from.call(O,P);if(typeof P=="number")throw new TypeError('"value" argument must not be a number')}return new Uint8Array(P)}var T=R("./bufferish"),O=g.exports=T.hasArrayBuffer?E(0):[];O.alloc=E,O.concat=T.concat,O.from=C},{"./bufferish":8}],8:[function(R,g,m){function E(X){return typeof X=="string"?P.call(this,X):S(this).from(X)}function C(X){return S(this).alloc(X)}function T(X,ee){function le(Ce){ee+=Ce.length}function $(Ce){Ie+=se.copy.call(Ce,Fe,Ie)}ee||(ee=0,Array.prototype.forEach.call(X,le));var he=this!==m&&this||X[0],Fe=C.call(he,ee),Ie=0;return Array.prototype.forEach.call(X,$),Fe}function O(X){return X instanceof ArrayBuffer||ue(X)}function P(X){var ee=3*X.length,le=C.call(this,ee),$=se.write.call(le,X);return ee!==$&&(le=se.slice.call(le,0,$)),le}function S(X){return V(X)?Z:K(X)?ie:H(X)?Q:L?Z:q?ie:Q}function U(){return!1}function N(X,ee){return X="[object "+X+"]",function(le){return le!=null&&{}.toString.call(ee?le[ee]:le)===X}}var D=m.global=R("./buffer-global"),L=m.hasBuffer=D&&!!D.isBuffer,q=m.hasArrayBuffer=typeof ArrayBuffer<"u",H=m.isArray=R("isarray");m.isArrayBuffer=q?O:U;var V=m.isBuffer=L?D.isBuffer:U,K=m.isView=q?ArrayBuffer.isView||N("ArrayBuffer","buffer"):U;m.alloc=C,m.concat=T,m.from=E;var Q=m.Array=R("./bufferish-array"),Z=m.Buffer=R("./bufferish-buffer"),ie=m.Uint8Array=R("./bufferish-uint8array"),se=m.prototype=R("./bufferish-proto"),ue=N("ArrayBuffer")},{"./buffer-global":2,"./bufferish-array":4,"./bufferish-buffer":5,"./bufferish-proto":6,"./bufferish-uint8array":7,isarray:34}],9:[function(R,g,m){function E(D){return this instanceof E?(this.options=D,void this.init()):new E(D)}function C(D){for(var L in D)E.prototype[L]=T(E.prototype[L],D[L])}function T(D,L){function q(){return D.apply(this,arguments),L.apply(this,arguments)}return D&&L?q:D||L}function O(D){function L(q,H){return H(q)}return D=D.slice(),function(q){return D.reduce(L,q)}}function P(D){return U(D)?O(D):D}function S(D){return new E(D)}var U=R("isarray");m.createCodec=S,m.install=C,m.filter=P;var N=R("./bufferish");E.prototype.init=function(){var D=this.options;return D&&D.uint8array&&(this.bufferish=N.Uint8Array),this},m.preset=S({preset:!0})},{"./bufferish":8,isarray:34}],10:[function(R,g,m){R("./read-core"),R("./write-core"),m.codec={preset:R("./codec-base").preset}},{"./codec-base":9,"./read-core":22,"./write-core":25}],11:[function(R,g,m){function E(O){if(!(this instanceof E))return new E(O);if(O&&(this.options=O,O.codec)){var P=this.codec=O.codec;P.bufferish&&(this.bufferish=P.bufferish)}}m.DecodeBuffer=E;var C=R("./read-core").preset,T=R("./flex-buffer").FlexDecoder;T.mixin(E.prototype),E.prototype.codec=C,E.prototype.fetch=function(){return this.codec.decode(this)}},{"./flex-buffer":21,"./read-core":22}],12:[function(R,g,m){function E(T,O){var P=new C(O);return P.write(T),P.read()}m.decode=E;var C=R("./decode-buffer").DecodeBuffer},{"./decode-buffer":11}],13:[function(R,g,m){function E(O){return this instanceof E?void T.call(this,O):new E(O)}m.Decoder=E;var C=R("event-lite"),T=R("./decode-buffer").DecodeBuffer;E.prototype=new T,C.mixin(E.prototype),E.prototype.decode=function(O){arguments.length&&this.write(O),this.flush()},E.prototype.push=function(O){this.emit("data",O)},E.prototype.end=function(O){this.decode(O),this.emit("end")}},{"./decode-buffer":11,"event-lite":31}],14:[function(R,g,m){function E(O){if(!(this instanceof E))return new E(O);if(O&&(this.options=O,O.codec)){var P=this.codec=O.codec;P.bufferish&&(this.bufferish=P.bufferish)}}m.EncodeBuffer=E;var C=R("./write-core").preset,T=R("./flex-buffer").FlexEncoder;T.mixin(E.prototype),E.prototype.codec=C,E.prototype.write=function(O){this.codec.encode(this,O)}},{"./flex-buffer":21,"./write-core":25}],15:[function(R,g,m){function E(T,O){var P=new C(O);return P.write(T),P.read()}m.encode=E;var C=R("./encode-buffer").EncodeBuffer},{"./encode-buffer":14}],16:[function(R,g,m){function E(O){return this instanceof E?void T.call(this,O):new E(O)}m.Encoder=E;var C=R("event-lite"),T=R("./encode-buffer").EncodeBuffer;E.prototype=new T,C.mixin(E.prototype),E.prototype.encode=function(O){this.write(O),this.emit("data",this.read())},E.prototype.end=function(O){arguments.length&&this.encode(O),this.flush(),this.emit("end")}},{"./encode-buffer":14,"event-lite":31}],17:[function(R,g,m){function E(T,O){return this instanceof E?(this.buffer=C.from(T),void(this.type=O)):new E(T,O)}m.ExtBuffer=E;var C=R("./bufferish")},{"./bufferish":8}],18:[function(R,g,m){function E(q){q.addExtPacker(14,Error,[P,C]),q.addExtPacker(1,EvalError,[P,C]),q.addExtPacker(2,RangeError,[P,C]),q.addExtPacker(3,ReferenceError,[P,C]),q.addExtPacker(4,SyntaxError,[P,C]),q.addExtPacker(5,TypeError,[P,C]),q.addExtPacker(6,URIError,[P,C]),q.addExtPacker(10,RegExp,[O,C]),q.addExtPacker(11,Boolean,[T,C]),q.addExtPacker(12,String,[T,C]),q.addExtPacker(13,Date,[Number,C]),q.addExtPacker(15,Number,[T,C]),typeof Uint8Array<"u"&&(q.addExtPacker(17,Int8Array,D),q.addExtPacker(18,Uint8Array,D),q.addExtPacker(19,Int16Array,D),q.addExtPacker(20,Uint16Array,D),q.addExtPacker(21,Int32Array,D),q.addExtPacker(22,Uint32Array,D),q.addExtPacker(23,Float32Array,D),typeof Float64Array<"u"&&q.addExtPacker(24,Float64Array,D),typeof Uint8ClampedArray<"u"&&q.addExtPacker(25,Uint8ClampedArray,D),q.addExtPacker(26,ArrayBuffer,D),q.addExtPacker(29,DataView,D)),U.hasBuffer&&q.addExtPacker(27,N,U.from)}function C(q){return S||(S=R("./encode").encode),S(q)}function T(q){return q.valueOf()}function O(q){q=RegExp.prototype.toString.call(q).split("/"),q.shift();var H=[q.pop()];return H.unshift(q.join("/")),H}function P(q){var H={};for(var V in L)H[V]=q[V];return H}m.setExtPackers=E;var S,U=R("./bufferish"),N=U.global,D=U.Uint8Array.from,L={name:1,message:1,stack:1,columnNumber:1,fileName:1,lineNumber:1}},{"./bufferish":8,"./encode":15}],19:[function(R,g,m){function E(q){q.addExtUnpacker(14,[C,O(Error)]),q.addExtUnpacker(1,[C,O(EvalError)]),q.addExtUnpacker(2,[C,O(RangeError)]),q.addExtUnpacker(3,[C,O(ReferenceError)]),q.addExtUnpacker(4,[C,O(SyntaxError)]),q.addExtUnpacker(5,[C,O(TypeError)]),q.addExtUnpacker(6,[C,O(URIError)]),q.addExtUnpacker(10,[C,T]),q.addExtUnpacker(11,[C,P(Boolean)]),q.addExtUnpacker(12,[C,P(String)]),q.addExtUnpacker(13,[C,P(Date)]),q.addExtUnpacker(15,[C,P(Number)]),typeof Uint8Array<"u"&&(q.addExtUnpacker(17,P(Int8Array)),q.addExtUnpacker(18,P(Uint8Array)),q.addExtUnpacker(19,[S,P(Int16Array)]),q.addExtUnpacker(20,[S,P(Uint16Array)]),q.addExtUnpacker(21,[S,P(Int32Array)]),q.addExtUnpacker(22,[S,P(Uint32Array)]),q.addExtUnpacker(23,[S,P(Float32Array)]),typeof Float64Array<"u"&&q.addExtUnpacker(24,[S,P(Float64Array)]),typeof Uint8ClampedArray<"u"&&q.addExtUnpacker(25,P(Uint8ClampedArray)),q.addExtUnpacker(26,S),q.addExtUnpacker(29,[S,P(DataView)])),N.hasBuffer&&q.addExtUnpacker(27,P(D))}function C(q){return U||(U=R("./decode").decode),U(q)}function T(q){return RegExp.apply(null,q)}function O(q){return function(H){var V=new q;for(var K in L)V[K]=H[K];return V}}function P(q){return function(H){return new q(H)}}function S(q){return new Uint8Array(q).buffer}m.setExtUnpackers=E;var U,N=R("./bufferish"),D=N.global,L={name:1,message:1,stack:1,columnNumber:1,fileName:1,lineNumber:1}},{"./bufferish":8,"./decode":12}],20:[function(R,g,m){R("./read-core"),R("./write-core"),m.createCodec=R("./codec-base").createCodec},{"./codec-base":9,"./read-core":22,"./write-core":25}],21:[function(R,g,m){function E(){if(!(this instanceof E))return new E}function C(){if(!(this instanceof C))return new C}function T(){function Q(se){var ue=this.offset?q.prototype.slice.call(this.buffer,this.offset):this.buffer;this.buffer=ue?se?this.bufferish.concat([ue,se]):ue:se,this.offset=0}function Z(){for(;this.offset<this.buffer.length;){var se,ue=this.offset;try{se=this.fetch()}catch(X){if(X&&X.message!=K)throw X;this.offset=ue;break}this.push(se)}}function ie(se){var ue=this.offset,X=ue+se;if(X>this.buffer.length)throw new Error(K);return this.offset=X,ue}return{bufferish:q,write:Q,fetch:S,flush:Z,push:N,pull:D,read:U,reserve:ie,offset:0}}function O(){function Q(){var X=this.start;if(X<this.offset){var ee=this.start=this.offset;return q.prototype.slice.call(this.buffer,X,ee)}}function Z(){for(;this.start<this.offset;){var X=this.fetch();X&&this.push(X)}}function ie(){var X=this.buffers||(this.buffers=[]),ee=X.length>1?this.bufferish.concat(X):X[0];return X.length=0,ee}function se(X){var ee=0|X;if(this.buffer){var le=this.buffer.length,$=0|this.offset,he=$+ee;if(he<le)return this.offset=he,$;this.flush(),X=Math.max(X,Math.min(2*le,this.maxBufferSize))}return X=Math.max(X,this.minBufferSize),this.buffer=this.bufferish.alloc(X),this.start=0,this.offset=ee,0}function ue(X){var ee=X.length;if(ee>this.minBufferSize)this.flush(),this.push(X);else{var le=this.reserve(ee);q.prototype.copy.call(X,this.buffer,le)}}return{bufferish:q,write:P,fetch:Q,flush:Z,push:N,pull:ie,read:U,reserve:se,send:ue,maxBufferSize:V,minBufferSize:H,offset:0,start:0}}function P(){throw new Error("method not implemented: write()")}function S(){throw new Error("method not implemented: fetch()")}function U(){var Q=this.buffers&&this.buffers.length;return Q?(this.flush(),this.pull()):this.fetch()}function N(Q){var Z=this.buffers||(this.buffers=[]);Z.push(Q)}function D(){var Q=this.buffers||(this.buffers=[]);return Q.shift()}function L(Q){function Z(ie){for(var se in Q)ie[se]=Q[se];return ie}return Z}m.FlexDecoder=E,m.FlexEncoder=C;var q=R("./bufferish"),H=2048,V=65536,K="BUFFER_SHORTAGE";E.mixin=L(T()),E.mixin(E.prototype),C.mixin=L(O()),C.mixin(C.prototype)},{"./bufferish":8}],22:[function(R,g,m){function E(L){function q(V){var K=U(V),Q=H[K];if(!Q)throw new Error("Invalid type: "+(K&&"0x"+K.toString(16)));return Q(V)}var H=N.getReadToken(L);return q}function C(){var L=this.options;return this.decode=E(L),L&&L.preset&&S.setExtUnpackers(this),this}function T(L,q){var H=this.extUnpackers||(this.extUnpackers=[]);H[L]=D.filter(q)}function O(L){function q(V){return new P(V,L)}var H=this.extUnpackers||(this.extUnpackers=[]);return H[L]||q}var P=R("./ext-buffer").ExtBuffer,S=R("./ext-unpacker"),U=R("./read-format").readUint8,N=R("./read-token"),D=R("./codec-base");D.install({addExtUnpacker:T,getExtUnpacker:O,init:C}),m.preset=C.call(D.preset)},{"./codec-base":9,"./ext-buffer":17,"./ext-unpacker":19,"./read-format":23,"./read-token":24}],23:[function(R,g,m){function E(te){var oe=Ie.hasArrayBuffer&&te&&te.binarraybuffer,re=te&&te.int64,de=Oe&&te&&te.usemap,ce={map:de?T:C,array:O,str:P,bin:oe?U:S,ext:N,uint8:D,uint16:q,uint32:V,uint64:Q(8,re?se:Z),int8:L,int16:H,int32:K,int64:Q(8,re?ue:ie),float32:Q(4,X),float64:Q(8,ee)};return ce}function C(te,oe){var re,de={},ce=new Array(oe),ye=new Array(oe),ke=te.codec.decode;for(re=0;re<oe;re++)ce[re]=ke(te),ye[re]=ke(te);for(re=0;re<oe;re++)de[ce[re]]=ye[re];return de}function T(te,oe){var re,de=new Map,ce=new Array(oe),ye=new Array(oe),ke=te.codec.decode;for(re=0;re<oe;re++)ce[re]=ke(te),ye[re]=ke(te);for(re=0;re<oe;re++)de.set(ce[re],ye[re]);return de}function O(te,oe){for(var re=new Array(oe),de=te.codec.decode,ce=0;ce<oe;ce++)re[ce]=de(te);return re}function P(te,oe){var re=te.reserve(oe),de=re+oe;return Ce.toString.call(te.buffer,"utf-8",re,de)}function S(te,oe){var re=te.reserve(oe),de=re+oe,ce=Ce.slice.call(te.buffer,re,de);return Ie.from(ce)}function U(te,oe){var re=te.reserve(oe),de=re+oe,ce=Ce.slice.call(te.buffer,re,de);return Ie.Uint8Array.from(ce).buffer}function N(te,oe){var re=te.reserve(oe+1),de=te.buffer[re++],ce=re+oe,ye=te.codec.getExtUnpacker(de);if(!ye)throw new Error("Invalid ext type: "+(de&&"0x"+de.toString(16)));var ke=Ce.slice.call(te.buffer,re,ce);return ye(ke)}function D(te){var oe=te.reserve(1);return te.buffer[oe]}function L(te){var oe=te.reserve(1),re=te.buffer[oe];return 128&re?re-256:re}function q(te){var oe=te.reserve(2),re=te.buffer;return re[oe++]<<8|re[oe]}function H(te){var oe=te.reserve(2),re=te.buffer,de=re[oe++]<<8|re[oe];return 32768&de?de-65536:de}function V(te){var oe=te.reserve(4),re=te.buffer;return 16777216*re[oe++]+(re[oe++]<<16)+(re[oe++]<<8)+re[oe]}function K(te){var oe=te.reserve(4),re=te.buffer;return re[oe++]<<24|re[oe++]<<16|re[oe++]<<8|re[oe]}function Q(te,oe){return function(re){var de=re.reserve(te);return oe.call(re.buffer,de,be)}}function Z(te){return new he(this,te).toNumber()}function ie(te){return new Fe(this,te).toNumber()}function se(te){return new he(this,te)}function ue(te){return new Fe(this,te)}function X(te){return le.read(this,te,!1,23,4)}function ee(te){return le.read(this,te,!1,52,8)}var le=R("ieee754"),$=R("int64-buffer"),he=$.Uint64BE,Fe=$.Int64BE;m.getReadFormat=E,m.readUint8=D;var Ie=R("./bufferish"),Ce=R("./bufferish-proto"),Oe=typeof Map<"u",be=!0},{"./bufferish":8,"./bufferish-proto":6,ieee754:32,"int64-buffer":33}],24:[function(R,g,m){function E(N){var D=U.getReadFormat(N);return N&&N.useraw?T(D):C(D)}function C(N){var D,L=new Array(256);for(D=0;D<=127;D++)L[D]=O(D);for(D=128;D<=143;D++)L[D]=S(D-128,N.map);for(D=144;D<=159;D++)L[D]=S(D-144,N.array);for(D=160;D<=191;D++)L[D]=S(D-160,N.str);for(L[192]=O(null),L[193]=null,L[194]=O(!1),L[195]=O(!0),L[196]=P(N.uint8,N.bin),L[197]=P(N.uint16,N.bin),L[198]=P(N.uint32,N.bin),L[199]=P(N.uint8,N.ext),L[200]=P(N.uint16,N.ext),L[201]=P(N.uint32,N.ext),L[202]=N.float32,L[203]=N.float64,L[204]=N.uint8,L[205]=N.uint16,L[206]=N.uint32,L[207]=N.uint64,L[208]=N.int8,L[209]=N.int16,L[210]=N.int32,L[211]=N.int64,L[212]=S(1,N.ext),L[213]=S(2,N.ext),L[214]=S(4,N.ext),L[215]=S(8,N.ext),L[216]=S(16,N.ext),L[217]=P(N.uint8,N.str),L[218]=P(N.uint16,N.str),L[219]=P(N.uint32,N.str),L[220]=P(N.uint16,N.array),L[221]=P(N.uint32,N.array),L[222]=P(N.uint16,N.map),L[223]=P(N.uint32,N.map),D=224;D<=255;D++)L[D]=O(D-256);return L}function T(N){var D,L=C(N).slice();for(L[217]=L[196],L[218]=L[197],L[219]=L[198],D=160;D<=191;D++)L[D]=S(D-160,N.bin);return L}function O(N){return function(){return N}}function P(N,D){return function(L){var q=N(L);return D(L,q)}}function S(N,D){return function(L){return D(L,N)}}var U=R("./read-format");m.getReadToken=E},{"./read-format":23}],25:[function(R,g,m){function E(D){function L(H,V){var K=q[typeof V];if(!K)throw new Error('Unsupported type "'+typeof V+'": '+V);K(H,V)}var q=U.getWriteType(D);return L}function C(){var D=this.options;return this.encode=E(D),D&&D.preset&&S.setExtPackers(this),this}function T(D,L,q){function H(Z){return q&&(Z=q(Z)),new P(Z,D)}q=N.filter(q);var V=L.name;if(V&&V!=="Object"){var K=this.extPackers||(this.extPackers={});K[V]=H}else{var Q=this.extEncoderList||(this.extEncoderList=[]);Q.unshift([L,H])}}function O(D){var L=this.extPackers||(this.extPackers={}),q=D.constructor,H=q&&q.name&&L[q.name];if(H)return H;for(var V=this.extEncoderList||(this.extEncoderList=[]),K=V.length,Q=0;Q<K;Q++){var Z=V[Q];if(q===Z[0])return Z[1]}}var P=R("./ext-buffer").ExtBuffer,S=R("./ext-packer"),U=R("./write-type"),N=R("./codec-base");N.install({addExtPacker:T,getExtPacker:O,init:C}),m.preset=C.call(N.preset)},{"./codec-base":9,"./ext-buffer":17,"./ext-packer":18,"./write-type":27}],26:[function(R,g,m){function E($){return $&&$.uint8array?C():ee||se.hasBuffer&&$&&$.safe?O():T()}function C(){var $=T();return $[202]=N(202,4,q),$[203]=N(203,8,H),$}function T(){var $=ie.slice();return $[196]=P(196),$[197]=S(197),$[198]=U(198),$[199]=P(199),$[200]=S(200),$[201]=U(201),$[202]=N(202,4,le.writeFloatBE||q,!0),$[203]=N(203,8,le.writeDoubleBE||H,!0),$[204]=P(204),$[205]=S(205),$[206]=U(206),$[207]=N(207,8,D),$[208]=P(208),$[209]=S(209),$[210]=U(210),$[211]=N(211,8,L),$[217]=P(217),$[218]=S(218),$[219]=U(219),$[220]=S(220),$[221]=U(221),$[222]=S(222),$[223]=U(223),$}function O(){var $=ie.slice();return $[196]=N(196,1,ue.prototype.writeUInt8),$[197]=N(197,2,ue.prototype.writeUInt16BE),$[198]=N(198,4,ue.prototype.writeUInt32BE),$[199]=N(199,1,ue.prototype.writeUInt8),$[200]=N(200,2,ue.prototype.writeUInt16BE),$[201]=N(201,4,ue.prototype.writeUInt32BE),$[202]=N(202,4,ue.prototype.writeFloatBE),$[203]=N(203,8,ue.prototype.writeDoubleBE),$[204]=N(204,1,ue.prototype.writeUInt8),$[205]=N(205,2,ue.prototype.writeUInt16BE),$[206]=N(206,4,ue.prototype.writeUInt32BE),$[207]=N(207,8,D),$[208]=N(208,1,ue.prototype.writeInt8),$[209]=N(209,2,ue.prototype.writeInt16BE),$[210]=N(210,4,ue.prototype.writeInt32BE),$[211]=N(211,8,L),$[217]=N(217,1,ue.prototype.writeUInt8),$[218]=N(218,2,ue.prototype.writeUInt16BE),$[219]=N(219,4,ue.prototype.writeUInt32BE),$[220]=N(220,2,ue.prototype.writeUInt16BE),$[221]=N(221,4,ue.prototype.writeUInt32BE),$[222]=N(222,2,ue.prototype.writeUInt16BE),$[223]=N(223,4,ue.prototype.writeUInt32BE),$}function P($){return function(he,Fe){var Ie=he.reserve(2),Ce=he.buffer;Ce[Ie++]=$,Ce[Ie]=Fe}}function S($){return function(he,Fe){var Ie=he.reserve(3),Ce=he.buffer;Ce[Ie++]=$,Ce[Ie++]=Fe>>>8,Ce[Ie]=Fe}}function U($){return function(he,Fe){var Ie=he.reserve(5),Ce=he.buffer;Ce[Ie++]=$,Ce[Ie++]=Fe>>>24,Ce[Ie++]=Fe>>>16,Ce[Ie++]=Fe>>>8,Ce[Ie]=Fe}}function N($,he,Fe,Ie){return function(Ce,Oe){var be=Ce.reserve(he+1);Ce.buffer[be++]=$,Fe.call(Ce.buffer,Oe,be,Ie)}}function D($,he){new Q(this,he,$)}function L($,he){new Z(this,he,$)}function q($,he){V.write(this,$,he,!1,23,4)}function H($,he){V.write(this,$,he,!1,52,8)}var V=R("ieee754"),K=R("int64-buffer"),Q=K.Uint64BE,Z=K.Int64BE,ie=R("./write-uint8").uint8,se=R("./bufferish"),ue=se.global,X=se.hasBuffer&&"TYPED_ARRAY_SUPPORT"in ue,ee=X&&!ue.TYPED_ARRAY_SUPPORT,le=se.hasBuffer&&ue.prototype||{};m.getWriteToken=E},{"./bufferish":8,"./write-uint8":28,ieee754:32,"int64-buffer":33}],27:[function(R,g,m){function E(K){function Q(M,B){var j=B?195:194;re[j](M,B)}function Z(M,B){var j,Y=0|B;return B!==Y?(j=203,void re[j](M,B)):(j=-32<=Y&&Y<=127?255&Y:0<=Y?Y<=255?204:Y<=65535?205:206:-128<=Y?208:-32768<=Y?209:210,void re[j](M,Y))}function ie(M,B){var j=207;re[j](M,B.toArray())}function se(M,B){var j=211;re[j](M,B.toArray())}function ue(M){return M<32?1:M<=255?2:M<=65535?3:5}function X(M){return M<32?1:M<=65535?3:5}function ee(M){function B(j,Y){var z=Y.length,ae=5+3*z;j.offset=j.reserve(ae);var ve=j.buffer,Te=M(z),Me=j.offset+Te;z=U.write.call(ve,Y,Me);var Ae=M(z);if(Te!==Ae){var Re=Me+Ae-Te,we=Me+z;U.copy.call(ve,ve,Re,Me,we)}var Se=Ae===1?160+z:Ae<=3?215+Ae:219;re[Se](j,z),j.offset+=z}return B}function le(M,B){if(B===null)return he(M,B);if(ye(B))return ke(M,B);if(C(B))return Fe(M,B);if(O.isUint64BE(B))return ie(M,B);if(P.isInt64BE(B))return se(M,B);var j=M.codec.getExtPacker(B);return j&&(B=j(B)),B instanceof L?Oe(M,B):void Be(M,B)}function $(M,B){return ye(B)?oe(M,B):void le(M,B)}function he(M,B){var j=192;re[j](M,B)}function Fe(M,B){var j=B.length,Y=j<16?144+j:j<=65535?220:221;re[Y](M,j);for(var z=M.codec.encode,ae=0;ae<j;ae++)z(M,B[ae])}function Ie(M,B){var j=B.length,Y=j<255?196:j<=65535?197:198;re[Y](M,j),M.send(B)}function Ce(M,B){Ie(M,new Uint8Array(B))}function Oe(M,B){var j=B.buffer,Y=j.length,z=V[Y]||(Y<255?199:Y<=65535?200:201);re[z](M,Y),D[B.type](M),M.send(j)}function be(M,B){var j=Object.keys(B),Y=j.length,z=Y<16?128+Y:Y<=65535?222:223;re[z](M,Y);var ae=M.codec.encode;j.forEach(function(ve){ae(M,ve),ae(M,B[ve])})}function te(M,B){if(!(B instanceof Map))return be(M,B);var j=B.size,Y=j<16?128+j:j<=65535?222:223;re[Y](M,j);var z=M.codec.encode;B.forEach(function(ae,ve,Te){z(M,ve),z(M,ae)})}function oe(M,B){var j=B.length,Y=j<32?160+j:j<=65535?218:219;re[Y](M,j),M.send(B)}var re=N.getWriteToken(K),de=K&&K.useraw,ce=q&&K&&K.binarraybuffer,ye=ce?S.isArrayBuffer:S.isBuffer,ke=ce?Ce:Ie,qe=H&&K&&K.usemap,Be=qe?te:be,x={boolean:Q,function:he,number:Z,object:de?$:le,string:ee(de?X:ue),symbol:he,undefined:he};return x}var C=R("isarray"),T=R("int64-buffer"),O=T.Uint64BE,P=T.Int64BE,S=R("./bufferish"),U=R("./bufferish-proto"),N=R("./write-token"),D=R("./write-uint8").uint8,L=R("./ext-buffer").ExtBuffer,q=typeof Uint8Array<"u",H=typeof Map<"u",V=[];V[1]=212,V[2]=213,V[4]=214,V[8]=215,V[16]=216,m.getWriteType=E},{"./bufferish":8,"./bufferish-proto":6,"./ext-buffer":17,"./write-token":26,"./write-uint8":28,"int64-buffer":33,isarray:34}],28:[function(R,g,m){function E(O){return function(P){var S=P.reserve(1);P.buffer[S]=O}}for(var C=m.uint8=new Array(256),T=0;T<=255;T++)C[T]=E(T)},{}],29:[function(R,g,m){(function(E){"use strict";function C(){try{var k=new Uint8Array(1);return k.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},k.foo()===42&&typeof k.subarray=="function"&&k.subarray(1,1).byteLength===0}catch{return!1}}function T(){return P.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function O(k,I){if(T()<I)throw new RangeError("Invalid typed array length");return P.TYPED_ARRAY_SUPPORT?(k=new Uint8Array(I),k.__proto__=P.prototype):(k===null&&(k=new P(I)),k.length=I),k}function P(k,I,F){if(!(P.TYPED_ARRAY_SUPPORT||this instanceof P))return new P(k,I,F);if(typeof k=="number"){if(typeof I=="string")throw new Error("If encoding is specified then the first argument must be a string");return D(this,k)}return S(this,k,I,F)}function S(k,I,F,W){if(typeof I=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&I instanceof ArrayBuffer?H(k,I,F,W):typeof I=="string"?L(k,I,F):V(k,I)}function U(k){if(typeof k!="number")throw new TypeError('"size" argument must be a number');if(k<0)throw new RangeError('"size" argument must not be negative')}function N(k,I,F,W){return U(I),I<=0?O(k,I):F!==void 0?typeof W=="string"?O(k,I).fill(F,W):O(k,I).fill(F):O(k,I)}function D(k,I){if(U(I),k=O(k,I<0?0:0|K(I)),!P.TYPED_ARRAY_SUPPORT)for(var F=0;F<I;++F)k[F]=0;return k}function L(k,I,F){if(typeof F=="string"&&F!==""||(F="utf8"),!P.isEncoding(F))throw new TypeError('"encoding" must be a valid string encoding');var W=0|Z(I,F);k=O(k,W);var J=k.write(I,F);return J!==W&&(k=k.slice(0,J)),k}function q(k,I){var F=I.length<0?0:0|K(I.length);k=O(k,F);for(var W=0;W<F;W+=1)k[W]=255&I[W];return k}function H(k,I,F,W){if(I.byteLength,F<0||I.byteLength<F)throw new RangeError("'offset' is out of bounds");if(I.byteLength<F+(W||0))throw new RangeError("'length' is out of bounds");return I=F===void 0&&W===void 0?new Uint8Array(I):W===void 0?new Uint8Array(I,F):new Uint8Array(I,F,W),P.TYPED_ARRAY_SUPPORT?(k=I,k.__proto__=P.prototype):k=q(k,I),k}function V(k,I){if(P.isBuffer(I)){var F=0|K(I.length);return k=O(k,F),k.length===0||I.copy(k,0,0,F),k}if(I){if(typeof ArrayBuffer<"u"&&I.buffer instanceof ArrayBuffer||"length"in I)return typeof I.length!="number"||Ae(I.length)?O(k,0):q(k,I);if(I.type==="Buffer"&&Se(I.data))return q(k,I.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function K(k){if(k>=T())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+T().toString(16)+" bytes");return 0|k}function Q(k){return+k!=k&&(k=0),P.alloc(+k)}function Z(k,I){if(P.isBuffer(k))return k.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(k)||k instanceof ArrayBuffer))return k.byteLength;typeof k!="string"&&(k=""+k);var F=k.length;if(F===0)return 0;for(var W=!1;;)switch(I){case"ascii":case"latin1":case"binary":return F;case"utf8":case"utf-8":case void 0:return z(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*F;case"hex":return F>>>1;case"base64":return Te(k).length;default:if(W)return z(k).length;I=(""+I).toLowerCase(),W=!0}}function ie(k,I,F){var W=!1;if((I===void 0||I<0)&&(I=0),I>this.length||((F===void 0||F>this.length)&&(F=this.length),F<=0)||(F>>>=0,I>>>=0,F<=I))return"";for(k||(k="utf8");;)switch(k){case"hex":return re(this,I,F);case"utf8":case"utf-8":return Oe(this,I,F);case"ascii":return te(this,I,F);case"latin1":case"binary":return oe(this,I,F);case"base64":return Ce(this,I,F);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return de(this,I,F);default:if(W)throw new TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),W=!0}}function se(k,I,F){var W=k[I];k[I]=k[F],k[F]=W}function ue(k,I,F,W,J){if(k.length===0)return-1;if(typeof F=="string"?(W=F,F=0):F>2147483647?F=2147483647:F<-2147483648&&(F=-2147483648),F=+F,isNaN(F)&&(F=J?0:k.length-1),F<0&&(F=k.length+F),F>=k.length){if(J)return-1;F=k.length-1}else if(F<0){if(!J)return-1;F=0}if(typeof I=="string"&&(I=P.from(I,W)),P.isBuffer(I))return I.length===0?-1:X(k,I,F,W,J);if(typeof I=="number")return I=255&I,P.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?J?Uint8Array.prototype.indexOf.call(k,I,F):Uint8Array.prototype.lastIndexOf.call(k,I,F):X(k,[I],F,W,J);throw new TypeError("val must be string, number or Buffer")}function X(k,I,F,W,J){function ne(fr,cr){return Pe===1?fr[cr]:fr.readUInt16BE(cr*Pe)}var Pe=1,Ve=k.length,Qe=I.length;if(W!==void 0&&(W=String(W).toLowerCase(),W==="ucs2"||W==="ucs-2"||W==="utf16le"||W==="utf-16le")){if(k.length<2||I.length<2)return-1;Pe=2,Ve/=2,Qe/=2,F/=2}var He;if(J){var Je=-1;for(He=F;He<Ve;He++)if(ne(k,He)===ne(I,Je===-1?0:He-Je)){if(Je===-1&&(Je=He),He-Je+1===Qe)return Je*Pe}else Je!==-1&&(He-=He-Je),Je=-1}else for(F+Qe>Ve&&(F=Ve-Qe),He=F;He>=0;He--){for(var Ze=!0,Vt=0;Vt<Qe;Vt++)if(ne(k,He+Vt)!==ne(I,Vt)){Ze=!1;break}if(Ze)return He}return-1}function ee(k,I,F,W){F=Number(F)||0;var J=k.length-F;W?(W=Number(W),W>J&&(W=J)):W=J;var ne=I.length;if(ne%2!==0)throw new TypeError("Invalid hex string");W>ne/2&&(W=ne/2);for(var Pe=0;Pe<W;++Pe){var Ve=parseInt(I.substr(2*Pe,2),16);if(isNaN(Ve))return Pe;k[F+Pe]=Ve}return Pe}function le(k,I,F,W){return Me(z(I,k.length-F),k,F,W)}function $(k,I,F,W){return Me(ae(I),k,F,W)}function he(k,I,F,W){return $(k,I,F,W)}function Fe(k,I,F,W){return Me(Te(I),k,F,W)}function Ie(k,I,F,W){return Me(ve(I,k.length-F),k,F,W)}function Ce(k,I,F){return I===0&&F===k.length?Re.fromByteArray(k):Re.fromByteArray(k.slice(I,F))}function Oe(k,I,F){F=Math.min(k.length,F);for(var W=[],J=I;J<F;){var ne=k[J],Pe=null,Ve=ne>239?4:ne>223?3:ne>191?2:1;if(J+Ve<=F){var Qe,He,Je,Ze;switch(Ve){case 1:ne<128&&(Pe=ne);break;case 2:Qe=k[J+1],(192&Qe)===128&&(Ze=(31&ne)<<6|63&Qe,Ze>127&&(Pe=Ze));break;case 3:Qe=k[J+1],He=k[J+2],(192&Qe)===128&&(192&He)===128&&(Ze=(15&ne)<<12|(63&Qe)<<6|63&He,Ze>2047&&(Ze<55296||Ze>57343)&&(Pe=Ze));break;case 4:Qe=k[J+1],He=k[J+2],Je=k[J+3],(192&Qe)===128&&(192&He)===128&&(192&Je)===128&&(Ze=(15&ne)<<18|(63&Qe)<<12|(63&He)<<6|63&Je,Ze>65535&&Ze<1114112&&(Pe=Ze))}}Pe===null?(Pe=65533,Ve=1):Pe>65535&&(Pe-=65536,W.push(Pe>>>10&1023|55296),Pe=56320|1023&Pe),W.push(Pe),J+=Ve}return be(W)}function be(k){var I=k.length;if(I<=xe)return String.fromCharCode.apply(String,k);for(var F="",W=0;W<I;)F+=String.fromCharCode.apply(String,k.slice(W,W+=xe));return F}function te(k,I,F){var W="";F=Math.min(k.length,F);for(var J=I;J<F;++J)W+=String.fromCharCode(127&k[J]);return W}function oe(k,I,F){var W="";F=Math.min(k.length,F);for(var J=I;J<F;++J)W+=String.fromCharCode(k[J]);return W}function re(k,I,F){var W=k.length;(!I||I<0)&&(I=0),(!F||F<0||F>W)&&(F=W);for(var J="",ne=I;ne<F;++ne)J+=Y(k[ne]);return J}function de(k,I,F){for(var W=k.slice(I,F),J="",ne=0;ne<W.length;ne+=2)J+=String.fromCharCode(W[ne]+256*W[ne+1]);return J}function ce(k,I,F){if(k%1!==0||k<0)throw new RangeError("offset is not uint");if(k+I>F)throw new RangeError("Trying to access beyond buffer length")}function ye(k,I,F,W,J,ne){if(!P.isBuffer(k))throw new TypeError('"buffer" argument must be a Buffer instance');if(I>J||I<ne)throw new RangeError('"value" argument is out of bounds');if(F+W>k.length)throw new RangeError("Index out of range")}function ke(k,I,F,W){I<0&&(I=65535+I+1);for(var J=0,ne=Math.min(k.length-F,2);J<ne;++J)k[F+J]=(I&255<<8*(W?J:1-J))>>>8*(W?J:1-J)}function qe(k,I,F,W){I<0&&(I=4294967295+I+1);for(var J=0,ne=Math.min(k.length-F,4);J<ne;++J)k[F+J]=I>>>8*(W?J:3-J)&255}function Be(k,I,F,W,J,ne){if(F+W>k.length)throw new RangeError("Index out of range");if(F<0)throw new RangeError("Index out of range")}function x(k,I,F,W,J){return J||Be(k,I,F,4,34028234663852886e22,-34028234663852886e22),we.write(k,I,F,W,23,4),F+4}function M(k,I,F,W,J){return J||Be(k,I,F,8,17976931348623157e292,-17976931348623157e292),we.write(k,I,F,W,52,8),F+8}function B(k){if(k=j(k).replace(We,""),k.length<2)return"";for(;k.length%4!==0;)k+="=";return k}function j(k){return k.trim?k.trim():k.replace(/^\s+|\s+$/g,"")}function Y(k){return k<16?"0"+k.toString(16):k.toString(16)}function z(k,I){I=I||1/0;for(var F,W=k.length,J=null,ne=[],Pe=0;Pe<W;++Pe){if(F=k.charCodeAt(Pe),F>55295&&F<57344){if(!J){if(F>56319){(I-=3)>-1&&ne.push(239,191,189);continue}if(Pe+1===W){(I-=3)>-1&&ne.push(239,191,189);continue}J=F;continue}if(F<56320){(I-=3)>-1&&ne.push(239,191,189),J=F;continue}F=(J-55296<<10|F-56320)+65536}else J&&(I-=3)>-1&&ne.push(239,191,189);if(J=null,F<128){if((I-=1)<0)break;ne.push(F)}else if(F<2048){if((I-=2)<0)break;ne.push(F>>6|192,63&F|128)}else if(F<65536){if((I-=3)<0)break;ne.push(F>>12|224,F>>6&63|128,63&F|128)}else{if(!(F<1114112))throw new Error("Invalid code point");if((I-=4)<0)break;ne.push(F>>18|240,F>>12&63|128,F>>6&63|128,63&F|128)}}return ne}function ae(k){for(var I=[],F=0;F<k.length;++F)I.push(255&k.charCodeAt(F));return I}function ve(k,I){for(var F,W,J,ne=[],Pe=0;Pe<k.length&&!((I-=2)<0);++Pe)F=k.charCodeAt(Pe),W=F>>8,J=F%256,ne.push(J),ne.push(W);return ne}function Te(k){return Re.toByteArray(B(k))}function Me(k,I,F,W){for(var J=0;J<W&&!(J+F>=I.length||J>=k.length);++J)I[J+F]=k[J];return J}function Ae(k){return k!==k}var Re=R("base64-js"),we=R("ieee754"),Se=R("isarray");m.Buffer=P,m.SlowBuffer=Q,m.INSPECT_MAX_BYTES=50,P.TYPED_ARRAY_SUPPORT=E.TYPED_ARRAY_SUPPORT!==void 0?E.TYPED_ARRAY_SUPPORT:C(),m.kMaxLength=T(),P.poolSize=8192,P._augment=function(k){return k.__proto__=P.prototype,k},P.from=function(k,I,F){return S(null,k,I,F)},P.TYPED_ARRAY_SUPPORT&&(P.prototype.__proto__=Uint8Array.prototype,P.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&P[Symbol.species]===P&&Object.defineProperty(P,Symbol.species,{value:null,configurable:!0})),P.alloc=function(k,I,F){return N(null,k,I,F)},P.allocUnsafe=function(k){return D(null,k)},P.allocUnsafeSlow=function(k){return D(null,k)},P.isBuffer=function(k){return!(k==null||!k._isBuffer)},P.compare=function(k,I){if(!P.isBuffer(k)||!P.isBuffer(I))throw new TypeError("Arguments must be Buffers");if(k===I)return 0;for(var F=k.length,W=I.length,J=0,ne=Math.min(F,W);J<ne;++J)if(k[J]!==I[J]){F=k[J],W=I[J];break}return F<W?-1:W<F?1:0},P.isEncoding=function(k){switch(String(k).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},P.concat=function(k,I){if(!Se(k))throw new TypeError('"list" argument must be an Array of Buffers');if(k.length===0)return P.alloc(0);var F;if(I===void 0)for(I=0,F=0;F<k.length;++F)I+=k[F].length;var W=P.allocUnsafe(I),J=0;for(F=0;F<k.length;++F){var ne=k[F];if(!P.isBuffer(ne))throw new TypeError('"list" argument must be an Array of Buffers');ne.copy(W,J),J+=ne.length}return W},P.byteLength=Z,P.prototype._isBuffer=!0,P.prototype.swap16=function(){var k=this.length;if(k%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var I=0;I<k;I+=2)se(this,I,I+1);return this},P.prototype.swap32=function(){var k=this.length;if(k%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var I=0;I<k;I+=4)se(this,I,I+3),se(this,I+1,I+2);return this},P.prototype.swap64=function(){var k=this.length;if(k%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var I=0;I<k;I+=8)se(this,I,I+7),se(this,I+1,I+6),se(this,I+2,I+5),se(this,I+3,I+4);return this},P.prototype.toString=function(){var k=0|this.length;return k===0?"":arguments.length===0?Oe(this,0,k):ie.apply(this,arguments)},P.prototype.equals=function(k){if(!P.isBuffer(k))throw new TypeError("Argument must be a Buffer");return this===k||P.compare(this,k)===0},P.prototype.inspect=function(){var k="",I=m.INSPECT_MAX_BYTES;return this.length>0&&(k=this.toString("hex",0,I).match(/.{2}/g).join(" "),this.length>I&&(k+=" ... ")),"<Buffer "+k+">"},P.prototype.compare=function(k,I,F,W,J){if(!P.isBuffer(k))throw new TypeError("Argument must be a Buffer");if(I===void 0&&(I=0),F===void 0&&(F=k?k.length:0),W===void 0&&(W=0),J===void 0&&(J=this.length),I<0||F>k.length||W<0||J>this.length)throw new RangeError("out of range index");if(W>=J&&I>=F)return 0;if(W>=J)return-1;if(I>=F)return 1;if(I>>>=0,F>>>=0,W>>>=0,J>>>=0,this===k)return 0;for(var ne=J-W,Pe=F-I,Ve=Math.min(ne,Pe),Qe=this.slice(W,J),He=k.slice(I,F),Je=0;Je<Ve;++Je)if(Qe[Je]!==He[Je]){ne=Qe[Je],Pe=He[Je];break}return ne<Pe?-1:Pe<ne?1:0},P.prototype.includes=function(k,I,F){return this.indexOf(k,I,F)!==-1},P.prototype.indexOf=function(k,I,F){return ue(this,k,I,F,!0)},P.prototype.lastIndexOf=function(k,I,F){return ue(this,k,I,F,!1)},P.prototype.write=function(k,I,F,W){if(I===void 0)W="utf8",F=this.length,I=0;else if(F===void 0&&typeof I=="string")W=I,F=this.length,I=0;else{if(!isFinite(I))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");I=0|I,isFinite(F)?(F=0|F,W===void 0&&(W="utf8")):(W=F,F=void 0)}var J=this.length-I;if((F===void 0||F>J)&&(F=J),k.length>0&&(F<0||I<0)||I>this.length)throw new RangeError("Attempt to write outside buffer bounds");W||(W="utf8");for(var ne=!1;;)switch(W){case"hex":return ee(this,k,I,F);case"utf8":case"utf-8":return le(this,k,I,F);case"ascii":return $(this,k,I,F);case"latin1":case"binary":return he(this,k,I,F);case"base64":return Fe(this,k,I,F);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ie(this,k,I,F);default:if(ne)throw new TypeError("Unknown encoding: "+W);W=(""+W).toLowerCase(),ne=!0}},P.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var xe=4096;P.prototype.slice=function(k,I){var F=this.length;k=~~k,I=I===void 0?F:~~I,k<0?(k+=F,k<0&&(k=0)):k>F&&(k=F),I<0?(I+=F,I<0&&(I=0)):I>F&&(I=F),I<k&&(I=k);var W;if(P.TYPED_ARRAY_SUPPORT)W=this.subarray(k,I),W.__proto__=P.prototype;else{var J=I-k;W=new P(J,void 0);for(var ne=0;ne<J;++ne)W[ne]=this[ne+k]}return W},P.prototype.readUIntLE=function(k,I,F){k=0|k,I=0|I,F||ce(k,I,this.length);for(var W=this[k],J=1,ne=0;++ne<I&&(J*=256);)W+=this[k+ne]*J;return W},P.prototype.readUIntBE=function(k,I,F){k=0|k,I=0|I,F||ce(k,I,this.length);for(var W=this[k+--I],J=1;I>0&&(J*=256);)W+=this[k+--I]*J;return W},P.prototype.readUInt8=function(k,I){return I||ce(k,1,this.length),this[k]},P.prototype.readUInt16LE=function(k,I){return I||ce(k,2,this.length),this[k]|this[k+1]<<8},P.prototype.readUInt16BE=function(k,I){return I||ce(k,2,this.length),this[k]<<8|this[k+1]},P.prototype.readUInt32LE=function(k,I){return I||ce(k,4,this.length),(this[k]|this[k+1]<<8|this[k+2]<<16)+16777216*this[k+3]},P.prototype.readUInt32BE=function(k,I){return I||ce(k,4,this.length),16777216*this[k]+(this[k+1]<<16|this[k+2]<<8|this[k+3])},P.prototype.readIntLE=function(k,I,F){k=0|k,I=0|I,F||ce(k,I,this.length);for(var W=this[k],J=1,ne=0;++ne<I&&(J*=256);)W+=this[k+ne]*J;return J*=128,W>=J&&(W-=Math.pow(2,8*I)),W},P.prototype.readIntBE=function(k,I,F){k=0|k,I=0|I,F||ce(k,I,this.length);for(var W=I,J=1,ne=this[k+--W];W>0&&(J*=256);)ne+=this[k+--W]*J;return J*=128,ne>=J&&(ne-=Math.pow(2,8*I)),ne},P.prototype.readInt8=function(k,I){return I||ce(k,1,this.length),128&this[k]?(255-this[k]+1)*-1:this[k]},P.prototype.readInt16LE=function(k,I){I||ce(k,2,this.length);var F=this[k]|this[k+1]<<8;return 32768&F?4294901760|F:F},P.prototype.readInt16BE=function(k,I){I||ce(k,2,this.length);var F=this[k+1]|this[k]<<8;return 32768&F?4294901760|F:F},P.prototype.readInt32LE=function(k,I){return I||ce(k,4,this.length),this[k]|this[k+1]<<8|this[k+2]<<16|this[k+3]<<24},P.prototype.readInt32BE=function(k,I){return I||ce(k,4,this.length),this[k]<<24|this[k+1]<<16|this[k+2]<<8|this[k+3]},P.prototype.readFloatLE=function(k,I){return I||ce(k,4,this.length),we.read(this,k,!0,23,4)},P.prototype.readFloatBE=function(k,I){return I||ce(k,4,this.length),we.read(this,k,!1,23,4)},P.prototype.readDoubleLE=function(k,I){return I||ce(k,8,this.length),we.read(this,k,!0,52,8)},P.prototype.readDoubleBE=function(k,I){return I||ce(k,8,this.length),we.read(this,k,!1,52,8)},P.prototype.writeUIntLE=function(k,I,F,W){if(k=+k,I=0|I,F=0|F,!W){var J=Math.pow(2,8*F)-1;ye(this,k,I,F,J,0)}var ne=1,Pe=0;for(this[I]=255&k;++Pe<F&&(ne*=256);)this[I+Pe]=k/ne&255;return I+F},P.prototype.writeUIntBE=function(k,I,F,W){if(k=+k,I=0|I,F=0|F,!W){var J=Math.pow(2,8*F)-1;ye(this,k,I,F,J,0)}var ne=F-1,Pe=1;for(this[I+ne]=255&k;--ne>=0&&(Pe*=256);)this[I+ne]=k/Pe&255;return I+F},P.prototype.writeUInt8=function(k,I,F){return k=+k,I=0|I,F||ye(this,k,I,1,255,0),P.TYPED_ARRAY_SUPPORT||(k=Math.floor(k)),this[I]=255&k,I+1},P.prototype.writeUInt16LE=function(k,I,F){return k=+k,I=0|I,F||ye(this,k,I,2,65535,0),P.TYPED_ARRAY_SUPPORT?(this[I]=255&k,this[I+1]=k>>>8):ke(this,k,I,!0),I+2},P.prototype.writeUInt16BE=function(k,I,F){return k=+k,I=0|I,F||ye(this,k,I,2,65535,0),P.TYPED_ARRAY_SUPPORT?(this[I]=k>>>8,this[I+1]=255&k):ke(this,k,I,!1),I+2},P.prototype.writeUInt32LE=function(k,I,F){return k=+k,I=0|I,F||ye(this,k,I,4,4294967295,0),P.TYPED_ARRAY_SUPPORT?(this[I+3]=k>>>24,this[I+2]=k>>>16,this[I+1]=k>>>8,this[I]=255&k):qe(this,k,I,!0),I+4},P.prototype.writeUInt32BE=function(k,I,F){return k=+k,I=0|I,F||ye(this,k,I,4,4294967295,0),P.TYPED_ARRAY_SUPPORT?(this[I]=k>>>24,this[I+1]=k>>>16,this[I+2]=k>>>8,this[I+3]=255&k):qe(this,k,I,!1),I+4},P.prototype.writeIntLE=function(k,I,F,W){if(k=+k,I=0|I,!W){var J=Math.pow(2,8*F-1);ye(this,k,I,F,J-1,-J)}var ne=0,Pe=1,Ve=0;for(this[I]=255&k;++ne<F&&(Pe*=256);)k<0&&Ve===0&&this[I+ne-1]!==0&&(Ve=1),this[I+ne]=(k/Pe>>0)-Ve&255;return I+F},P.prototype.writeIntBE=function(k,I,F,W){if(k=+k,I=0|I,!W){var J=Math.pow(2,8*F-1);ye(this,k,I,F,J-1,-J)}var ne=F-1,Pe=1,Ve=0;for(this[I+ne]=255&k;--ne>=0&&(Pe*=256);)k<0&&Ve===0&&this[I+ne+1]!==0&&(Ve=1),this[I+ne]=(k/Pe>>0)-Ve&255;return I+F},P.prototype.writeInt8=function(k,I,F){return k=+k,I=0|I,F||ye(this,k,I,1,127,-128),P.TYPED_ARRAY_SUPPORT||(k=Math.floor(k)),k<0&&(k=255+k+1),this[I]=255&k,I+1},P.prototype.writeInt16LE=function(k,I,F){return k=+k,I=0|I,F||ye(this,k,I,2,32767,-32768),P.TYPED_ARRAY_SUPPORT?(this[I]=255&k,this[I+1]=k>>>8):ke(this,k,I,!0),I+2},P.prototype.writeInt16BE=function(k,I,F){return k=+k,I=0|I,F||ye(this,k,I,2,32767,-32768),P.TYPED_ARRAY_SUPPORT?(this[I]=k>>>8,this[I+1]=255&k):ke(this,k,I,!1),I+2},P.prototype.writeInt32LE=function(k,I,F){return k=+k,I=0|I,F||ye(this,k,I,4,2147483647,-2147483648),P.TYPED_ARRAY_SUPPORT?(this[I]=255&k,this[I+1]=k>>>8,this[I+2]=k>>>16,this[I+3]=k>>>24):qe(this,k,I,!0),I+4},P.prototype.writeInt32BE=function(k,I,F){return k=+k,I=0|I,F||ye(this,k,I,4,2147483647,-2147483648),k<0&&(k=4294967295+k+1),P.TYPED_ARRAY_SUPPORT?(this[I]=k>>>24,this[I+1]=k>>>16,this[I+2]=k>>>8,this[I+3]=255&k):qe(this,k,I,!1),I+4},P.prototype.writeFloatLE=function(k,I,F){return x(this,k,I,!0,F)},P.prototype.writeFloatBE=function(k,I,F){return x(this,k,I,!1,F)},P.prototype.writeDoubleLE=function(k,I,F){return M(this,k,I,!0,F)},P.prototype.writeDoubleBE=function(k,I,F){return M(this,k,I,!1,F)},P.prototype.copy=function(k,I,F,W){if(F||(F=0),W||W===0||(W=this.length),I>=k.length&&(I=k.length),I||(I=0),W>0&&W<F&&(W=F),W===F||k.length===0||this.length===0)return 0;if(I<0)throw new RangeError("targetStart out of bounds");if(F<0||F>=this.length)throw new RangeError("sourceStart out of bounds");if(W<0)throw new RangeError("sourceEnd out of bounds");W>this.length&&(W=this.length),k.length-I<W-F&&(W=k.length-I+F);var J,ne=W-F;if(this===k&&F<I&&I<W)for(J=ne-1;J>=0;--J)k[J+I]=this[J+F];else if(ne<1e3||!P.TYPED_ARRAY_SUPPORT)for(J=0;J<ne;++J)k[J+I]=this[J+F];else Uint8Array.prototype.set.call(k,this.subarray(F,F+ne),I);return ne},P.prototype.fill=function(k,I,F,W){if(typeof k=="string"){if(typeof I=="string"?(W=I,I=0,F=this.length):typeof F=="string"&&(W=F,F=this.length),k.length===1){var J=k.charCodeAt(0);J<256&&(k=J)}if(W!==void 0&&typeof W!="string")throw new TypeError("encoding must be a string");if(typeof W=="string"&&!P.isEncoding(W))throw new TypeError("Unknown encoding: "+W)}else typeof k=="number"&&(k=255&k);if(I<0||this.length<I||this.length<F)throw new RangeError("Out of range index");if(F<=I)return this;I>>>=0,F=F===void 0?this.length:F>>>0,k||(k=0);var ne;if(typeof k=="number")for(ne=I;ne<F;++ne)this[ne]=k;else{var Pe=P.isBuffer(k)?k:z(new P(k,W).toString()),Ve=Pe.length;for(ne=0;ne<F-I;++ne)this[ne+I]=Pe[ne%Ve]}return this};var We=/[^+\/0-9A-Za-z-_]/g}).call(this,typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{})},{"base64-js":30,ieee754:32,isarray:34}],30:[function(R,g,m){"use strict";function E(V){var K=V.length;if(K%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return V[K-2]==="="?2:V[K-1]==="="?1:0}function C(V){return 3*V.length/4-E(V)}function T(V){var K,Q,Z,ie,se,ue,X=V.length;se=E(V),ue=new D(3*X/4-se),Z=se>0?X-4:X;var ee=0;for(K=0,Q=0;K<Z;K+=4,Q+=3)ie=N[V.charCodeAt(K)]<<18|N[V.charCodeAt(K+1)]<<12|N[V.charCodeAt(K+2)]<<6|N[V.charCodeAt(K+3)],ue[ee++]=ie>>16&255,ue[ee++]=ie>>8&255,ue[ee++]=255&ie;return se===2?(ie=N[V.charCodeAt(K)]<<2|N[V.charCodeAt(K+1)]>>4,ue[ee++]=255&ie):se===1&&(ie=N[V.charCodeAt(K)]<<10|N[V.charCodeAt(K+1)]<<4|N[V.charCodeAt(K+2)]>>2,ue[ee++]=ie>>8&255,ue[ee++]=255&ie),ue}function O(V){return U[V>>18&63]+U[V>>12&63]+U[V>>6&63]+U[63&V]}function P(V,K,Q){for(var Z,ie=[],se=K;se<Q;se+=3)Z=(V[se]<<16)+(V[se+1]<<8)+V[se+2],ie.push(O(Z));return ie.join("")}function S(V){for(var K,Q=V.length,Z=Q%3,ie="",se=[],ue=16383,X=0,ee=Q-Z;X<ee;X+=ue)se.push(P(V,X,X+ue>ee?ee:X+ue));return Z===1?(K=V[Q-1],ie+=U[K>>2],ie+=U[K<<4&63],ie+="=="):Z===2&&(K=(V[Q-2]<<8)+V[Q-1],ie+=U[K>>10],ie+=U[K>>4&63],ie+=U[K<<2&63],ie+="="),se.push(ie),se.join("")}m.byteLength=C,m.toByteArray=T,m.fromByteArray=S;for(var U=[],N=[],D=typeof Uint8Array<"u"?Uint8Array:Array,L="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",q=0,H=L.length;q<H;++q)U[q]=L[q],N[L.charCodeAt(q)]=q;N[45]=62,N[95]=63},{}],31:[function(R,g,m){function E(){if(!(this instanceof E))return new E}(function(C){function T(q){for(var H in L)q[H]=L[H];return q}function O(q,H){return N(this,q).push(H),this}function P(q,H){function V(){S.call(K,q,V),H.apply(this,arguments)}var K=this;return V.originalListener=H,N(K,q).push(V),K}function S(q,H){function V(Z){return Z!==H&&Z.originalListener!==H}var K,Q=this;if(arguments.length){if(H){if(K=N(Q,q,!0)){if(K=K.filter(V),!K.length)return S.call(Q,q);Q[D][q]=K}}else if(K=Q[D],K&&(delete K[q],!Object.keys(K).length))return S.call(Q)}else delete Q[D];return Q}function U(q,H){function V(X){X.call(Z)}function K(X){X.call(Z,H)}function Q(X){X.apply(Z,ue)}var Z=this,ie=N(Z,q,!0);if(!ie)return!1;var se=arguments.length;if(se===1)ie.forEach(V);else if(se===2)ie.forEach(K);else{var ue=Array.prototype.slice.call(arguments,1);ie.forEach(Q)}return!!ie.length}function N(q,H,V){if(!V||q[D]){var K=q[D]||(q[D]={});return K[H]||(K[H]=[])}}typeof g<"u"&&(g.exports=C);var D="listeners",L={on:O,once:P,off:S,emit:U};T(C.prototype),C.mixin=T})(E)},{}],32:[function(R,g,m){m.read=function(E,C,T,O,P){var S,U,N=8*P-O-1,D=(1<<N)-1,L=D>>1,q=-7,H=T?P-1:0,V=T?-1:1,K=E[C+H];for(H+=V,S=K&(1<<-q)-1,K>>=-q,q+=N;q>0;S=256*S+E[C+H],H+=V,q-=8);for(U=S&(1<<-q)-1,S>>=-q,q+=O;q>0;U=256*U+E[C+H],H+=V,q-=8);if(S===0)S=1-L;else{if(S===D)return U?NaN:(K?-1:1)*(1/0);U+=Math.pow(2,O),S-=L}return(K?-1:1)*U*Math.pow(2,S-O)},m.write=function(E,C,T,O,P,S){var U,N,D,L=8*S-P-1,q=(1<<L)-1,H=q>>1,V=P===23?Math.pow(2,-24)-Math.pow(2,-77):0,K=O?0:S-1,Q=O?1:-1,Z=C<0||C===0&&1/C<0?1:0;for(C=Math.abs(C),isNaN(C)||C===1/0?(N=isNaN(C)?1:0,U=q):(U=Math.floor(Math.log(C)/Math.LN2),C*(D=Math.pow(2,-U))<1&&(U--,D*=2),C+=U+H>=1?V/D:V*Math.pow(2,1-H),C*D>=2&&(U++,D/=2),U+H>=q?(N=0,U=q):U+H>=1?(N=(C*D-1)*Math.pow(2,P),U+=H):(N=C*Math.pow(2,H-1)*Math.pow(2,P),U=0));P>=8;E[T+K]=255&N,K+=Q,N/=256,P-=8);for(U=U<<P|N,L+=P;L>0;E[T+K]=255&U,K+=Q,U/=256,L-=8);E[T+K-Q]|=128*Z}},{}],33:[function(R,g,m){(function(E){var C,T,O,P;(function(S){function U(Oe,be,te){function oe(Re,we,Se,xe){return this instanceof oe?de(this,Re,we,Se,xe):new oe(Re,we,Se,xe)}function re(Re){return!(!Re||!Re[Ae])}function de(Re,we,Se,xe,We){if(le&&$&&(we instanceof $&&(we=new le(we)),xe instanceof $&&(xe=new le(xe))),!(we||Se||xe||ue))return void(Re.buffer=V(he,0));if(!q(we,Se)){var k=ue||Array;We=Se,xe=we,Se=0,we=new k(8)}Re.buffer=we,Re.offset=Se|=0,X!==typeof xe&&(typeof xe=="string"?ce(we,Se,xe,We||10):q(xe,We)?H(we,Se,xe,We):typeof We=="number"?(qe(we,Se+x,xe),qe(we,Se+M,We)):xe>0?ae(we,Se,xe):xe<0?ve(we,Se,xe):H(we,Se,he,0))}function ce(Re,we,Se,xe){var We=0,k=Se.length,I=0,F=0;Se[0]==="-"&&We++;for(var W=We;We<k;){var J=parseInt(Se[We++],xe);if(!(J>=0))break;F=F*xe+J,I=I*xe+Math.floor(F/Ie),F%=Ie}W&&(I=~I,F?F=Ie-F:I++),qe(Re,we+x,I),qe(Re,we+M,F)}function ye(){var Re=this.buffer,we=this.offset,Se=Be(Re,we+x),xe=Be(Re,we+M);return te||(Se|=0),Se?Se*Ie+xe:xe}function ke(Re){var we=this.buffer,Se=this.offset,xe=Be(we,Se+x),We=Be(we,Se+M),k="",I=!te&&2147483648&xe;for(I&&(xe=~xe,We=Ie-We),Re=Re||10;;){var F=xe%Re*Ie+We;if(xe=Math.floor(xe/Re),We=Math.floor(F/Re),k=(F%Re).toString(Re)+k,!xe&&!We)break}return I&&(k="-"+k),k}function qe(Re,we,Se){Re[we+z]=255&Se,Se>>=8,Re[we+Y]=255&Se,Se>>=8,Re[we+j]=255&Se,Se>>=8,Re[we+B]=255&Se}function Be(Re,we){return Re[we+B]*Ce+(Re[we+j]<<16)+(Re[we+Y]<<8)+Re[we+z]}var x=be?0:4,M=be?4:0,B=be?0:3,j=be?1:2,Y=be?2:1,z=be?3:0,ae=be?K:Z,ve=be?Q:ie,Te=oe.prototype,Me="is"+Oe,Ae="_"+Me;return Te.buffer=void 0,Te.offset=0,Te[Ae]=!0,Te.toNumber=ye,Te.toString=ke,Te.toJSON=ye,Te.toArray=N,ee&&(Te.toBuffer=D),le&&(Te.toArrayBuffer=L),oe[Me]=re,S[Oe]=oe,oe}function N(Oe){var be=this.buffer,te=this.offset;return ue=null,Oe!==!1&&te===0&&be.length===8&&Fe(be)?be:V(be,te)}function D(Oe){var be=this.buffer,te=this.offset;if(ue=ee,Oe!==!1&&te===0&&be.length===8&&E.isBuffer(be))return be;var oe=new ee(8);return H(oe,0,be,te),oe}function L(Oe){var be=this.buffer,te=this.offset,oe=be.buffer;if(ue=le,Oe!==!1&&te===0&&oe instanceof $&&oe.byteLength===8)return oe;var re=new le(8);return H(re,0,be,te),re.buffer}function q(Oe,be){var te=Oe&&Oe.length;return be|=0,te&&be+8<=te&&typeof Oe[be]!="string"}function H(Oe,be,te,oe){be|=0,oe|=0;for(var re=0;re<8;re++)Oe[be++]=255&te[oe++]}function V(Oe,be){return Array.prototype.slice.call(Oe,be,be+8)}function K(Oe,be,te){for(var oe=be+8;oe>be;)Oe[--oe]=255&te,te/=256}function Q(Oe,be,te){var oe=be+8;for(te++;oe>be;)Oe[--oe]=255&-te^255,te/=256}function Z(Oe,be,te){for(var oe=be+8;be<oe;)Oe[be++]=255&te,te/=256}function ie(Oe,be,te){var oe=be+8;for(te++;be<oe;)Oe[be++]=255&-te^255,te/=256}function se(Oe){return!!Oe&&Object.prototype.toString.call(Oe)=="[object Array]"}var ue,X="undefined",ee=X!==typeof E&&E,le=X!==typeof Uint8Array&&Uint8Array,$=X!==typeof ArrayBuffer&&ArrayBuffer,he=[0,0,0,0,0,0,0,0],Fe=Array.isArray||se,Ie=4294967296,Ce=16777216;C=U("Uint64BE",!0,!0),T=U("Int64BE",!0,!1),O=U("Uint64LE",!1,!0),P=U("Int64LE",!1,!1)})(typeof m=="object"&&typeof m.nodeName!="string"?m:this||{})}).call(this,R("buffer").Buffer)},{buffer:29}],34:[function(R,g,m){var E={}.toString;g.exports=Array.isArray||function(C){return E.call(C)=="[object Array]"}},{}]},{},[1])(1)})});var gr=Ge((exports,module)=>{(function(){"use strict";function t(R){if(R)d[0]=d[16]=d[1]=d[2]=d[3]=d[4]=d[5]=d[6]=d[7]=d[8]=d[9]=d[10]=d[11]=d[12]=d[13]=d[14]=d[15]=0,this.blocks=d,this.buffer8=l;else if(a){var g=new ArrayBuffer(68);this.buffer8=new Uint8Array(g),this.blocks=new Uint32Array(g)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}var r="input is invalid type",e=typeof window=="object",i=e?window:{};i.JS_MD5_NO_WINDOW&&(e=!1);var s=!e&&typeof self=="object",h=!i.JS_MD5_NO_NODE_JS&&typeof process=="object"&&process.versions&&void 0;h?i=global:s&&(i=self);var f=!i.JS_MD5_NO_COMMON_JS&&typeof module=="object"&&module.exports,o=typeof define=="function"&&define.amd,a=!i.JS_MD5_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",n="0123456789abcdef".split(""),u=[128,32768,8388608,-2147483648],y=[0,8,16,24],c=["hex","array","digest","buffer","arrayBuffer","base64"],p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),d=[],l;if(a){var A=new ArrayBuffer(68);l=new Uint8Array(A),d=new Uint32Array(A)}!i.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(R){return Object.prototype.toString.call(R)==="[object Array]"}),!a||!i.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(R){return typeof R=="object"&&R.buffer&&R.buffer.constructor===ArrayBuffer});var b=function(R){return function(g){return new t(!0).update(g)[R]()}},v=function(){var R=b("hex");h&&(R=w(R)),R.create=function(){return new t},R.update=function(E){return R.create().update(E)};for(var g=0;g<c.length;++g){var m=c[g];R[m]=b(m)}return R},w=function(t){var e=eval("require('crypto')"),i=eval("require('buffer').Buffer"),s=function(R){if(typeof R=="string")return e.createHash("md5").update(R,"utf8").digest("hex");if(R==null)throw r;return R.constructor===ArrayBuffer&&(R=new Uint8Array(R)),Array.isArray(R)||ArrayBuffer.isView(R)||R.constructor===i?e.createHash("md5").update(new i(R)).digest("hex"):t(R)};return s};t.prototype.update=function(R){if(!this.finalized){var g,m=typeof R;if(m!=="string"){if(m!=="object"||R===null)throw r;if(a&&R.constructor===ArrayBuffer)R=new Uint8Array(R);else if(!(Array.isArray(R)||a&&ArrayBuffer.isView(R)))throw r;g=!0}for(var E,C,T=0,O=R.length,P=this.blocks,S=this.buffer8;T<O;){if(this.hashed&&(this.hashed=!1,P[0]=P[16],P[16]=P[1]=P[2]=P[3]=P[4]=P[5]=P[6]=P[7]=P[8]=P[9]=P[10]=P[11]=P[12]=P[13]=P[14]=P[15]=0),g)if(a)for(C=this.start;T<O&&C<64;++T)S[C++]=R[T];else for(C=this.start;T<O&&C<64;++T)P[C>>2]|=R[T]<<y[3&C++];else if(a)for(C=this.start;T<O&&C<64;++T)(E=R.charCodeAt(T))<128?S[C++]=E:E<2048?(S[C++]=192|E>>6,S[C++]=128|63&E):E<55296||E>=57344?(S[C++]=224|E>>12,S[C++]=128|E>>6&63,S[C++]=128|63&E):(E=65536+((1023&E)<<10|1023&R.charCodeAt(++T)),S[C++]=240|E>>18,S[C++]=128|E>>12&63,S[C++]=128|E>>6&63,S[C++]=128|63&E);else for(C=this.start;T<O&&C<64;++T)(E=R.charCodeAt(T))<128?P[C>>2]|=E<<y[3&C++]:E<2048?(P[C>>2]|=(192|E>>6)<<y[3&C++],P[C>>2]|=(128|63&E)<<y[3&C++]):E<55296||E>=57344?(P[C>>2]|=(224|E>>12)<<y[3&C++],P[C>>2]|=(128|E>>6&63)<<y[3&C++],P[C>>2]|=(128|63&E)<<y[3&C++]):(E=65536+((1023&E)<<10|1023&R.charCodeAt(++T)),P[C>>2]|=(240|E>>18)<<y[3&C++],P[C>>2]|=(128|E>>12&63)<<y[3&C++],P[C>>2]|=(128|E>>6&63)<<y[3&C++],P[C>>2]|=(128|63&E)<<y[3&C++]);this.lastByteIndex=C,this.bytes+=C-this.start,C>=64?(this.start=C-64,this.hash(),this.hashed=!0):this.start=C}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},t.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var R=this.blocks,g=this.lastByteIndex;R[g>>2]|=u[3&g],g>=56&&(this.hashed||this.hash(),R[0]=R[16],R[16]=R[1]=R[2]=R[3]=R[4]=R[5]=R[6]=R[7]=R[8]=R[9]=R[10]=R[11]=R[12]=R[13]=R[14]=R[15]=0),R[14]=this.bytes<<3,R[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},t.prototype.hash=function(){var R,g,m,E,C,T,O=this.blocks;this.first?g=((g=((R=((R=O[0]-680876937)<<7|R>>>25)-271733879<<0)^(m=((m=(-271733879^(E=((E=(-1732584194^2004318071&R)+O[1]-117830708)<<12|E>>>20)+R<<0)&(-271733879^R))+O[2]-1126478375)<<17|m>>>15)+E<<0)&(E^R))+O[3]-1316259209)<<22|g>>>10)+m<<0:(R=this.h0,g=this.h1,m=this.h2,g=((g+=((R=((R+=((E=this.h3)^g&(m^E))+O[0]-680876936)<<7|R>>>25)+g<<0)^(m=((m+=(g^(E=((E+=(m^R&(g^m))+O[1]-389564586)<<12|E>>>20)+R<<0)&(R^g))+O[2]+606105819)<<17|m>>>15)+E<<0)&(E^R))+O[3]-1044525330)<<22|g>>>10)+m<<0),g=((g+=((R=((R+=(E^g&(m^E))+O[4]-176418897)<<7|R>>>25)+g<<0)^(m=((m+=(g^(E=((E+=(m^R&(g^m))+O[5]+1200080426)<<12|E>>>20)+R<<0)&(R^g))+O[6]-1473231341)<<17|m>>>15)+E<<0)&(E^R))+O[7]-45705983)<<22|g>>>10)+m<<0,g=((g+=((R=((R+=(E^g&(m^E))+O[8]+1770035416)<<7|R>>>25)+g<<0)^(m=((m+=(g^(E=((E+=(m^R&(g^m))+O[9]-1958414417)<<12|E>>>20)+R<<0)&(R^g))+O[10]-42063)<<17|m>>>15)+E<<0)&(E^R))+O[11]-1990404162)<<22|g>>>10)+m<<0,g=((g+=((R=((R+=(E^g&(m^E))+O[12]+1804603682)<<7|R>>>25)+g<<0)^(m=((m+=(g^(E=((E+=(m^R&(g^m))+O[13]-40341101)<<12|E>>>20)+R<<0)&(R^g))+O[14]-1502002290)<<17|m>>>15)+E<<0)&(E^R))+O[15]+1236535329)<<22|g>>>10)+m<<0,g=((g+=((E=((E+=(g^m&((R=((R+=(m^E&(g^m))+O[1]-165796510)<<5|R>>>27)+g<<0)^g))+O[6]-1069501632)<<9|E>>>23)+R<<0)^R&((m=((m+=(R^g&(E^R))+O[11]+643717713)<<14|m>>>18)+E<<0)^E))+O[0]-373897302)<<20|g>>>12)+m<<0,g=((g+=((E=((E+=(g^m&((R=((R+=(m^E&(g^m))+O[5]-701558691)<<5|R>>>27)+g<<0)^g))+O[10]+38016083)<<9|E>>>23)+R<<0)^R&((m=((m+=(R^g&(E^R))+O[15]-660478335)<<14|m>>>18)+E<<0)^E))+O[4]-405537848)<<20|g>>>12)+m<<0,g=((g+=((E=((E+=(g^m&((R=((R+=(m^E&(g^m))+O[9]+568446438)<<5|R>>>27)+g<<0)^g))+O[14]-1019803690)<<9|E>>>23)+R<<0)^R&((m=((m+=(R^g&(E^R))+O[3]-187363961)<<14|m>>>18)+E<<0)^E))+O[8]+1163531501)<<20|g>>>12)+m<<0,g=((g+=((E=((E+=(g^m&((R=((R+=(m^E&(g^m))+O[13]-1444681467)<<5|R>>>27)+g<<0)^g))+O[2]-51403784)<<9|E>>>23)+R<<0)^R&((m=((m+=(R^g&(E^R))+O[7]+1735328473)<<14|m>>>18)+E<<0)^E))+O[12]-1926607734)<<20|g>>>12)+m<<0,g=((g+=((T=(E=((E+=((C=g^m)^(R=((R+=(C^E)+O[5]-378558)<<4|R>>>28)+g<<0))+O[8]-2022574463)<<11|E>>>21)+R<<0)^R)^(m=((m+=(T^g)+O[11]+1839030562)<<16|m>>>16)+E<<0))+O[14]-35309556)<<23|g>>>9)+m<<0,g=((g+=((T=(E=((E+=((C=g^m)^(R=((R+=(C^E)+O[1]-1530992060)<<4|R>>>28)+g<<0))+O[4]+1272893353)<<11|E>>>21)+R<<0)^R)^(m=((m+=(T^g)+O[7]-155497632)<<16|m>>>16)+E<<0))+O[10]-1094730640)<<23|g>>>9)+m<<0,g=((g+=((T=(E=((E+=((C=g^m)^(R=((R+=(C^E)+O[13]+681279174)<<4|R>>>28)+g<<0))+O[0]-358537222)<<11|E>>>21)+R<<0)^R)^(m=((m+=(T^g)+O[3]-722521979)<<16|m>>>16)+E<<0))+O[6]+76029189)<<23|g>>>9)+m<<0,g=((g+=((T=(E=((E+=((C=g^m)^(R=((R+=(C^E)+O[9]-640364487)<<4|R>>>28)+g<<0))+O[12]-421815835)<<11|E>>>21)+R<<0)^R)^(m=((m+=(T^g)+O[15]+530742520)<<16|m>>>16)+E<<0))+O[2]-995338651)<<23|g>>>9)+m<<0,g=((g+=((E=((E+=(g^((R=((R+=(m^(g|~E))+O[0]-198630844)<<6|R>>>26)+g<<0)|~m))+O[7]+1126891415)<<10|E>>>22)+R<<0)^((m=((m+=(R^(E|~g))+O[14]-1416354905)<<15|m>>>17)+E<<0)|~R))+O[5]-57434055)<<21|g>>>11)+m<<0,g=((g+=((E=((E+=(g^((R=((R+=(m^(g|~E))+O[12]+1700485571)<<6|R>>>26)+g<<0)|~m))+O[3]-1894986606)<<10|E>>>22)+R<<0)^((m=((m+=(R^(E|~g))+O[10]-1051523)<<15|m>>>17)+E<<0)|~R))+O[1]-2054922799)<<21|g>>>11)+m<<0,g=((g+=((E=((E+=(g^((R=((R+=(m^(g|~E))+O[8]+1873313359)<<6|R>>>26)+g<<0)|~m))+O[15]-30611744)<<10|E>>>22)+R<<0)^((m=((m+=(R^(E|~g))+O[6]-1560198380)<<15|m>>>17)+E<<0)|~R))+O[13]+1309151649)<<21|g>>>11)+m<<0,g=((g+=((E=((E+=(g^((R=((R+=(m^(g|~E))+O[4]-145523070)<<6|R>>>26)+g<<0)|~m))+O[11]-1120210379)<<10|E>>>22)+R<<0)^((m=((m+=(R^(E|~g))+O[2]+718787259)<<15|m>>>17)+E<<0)|~R))+O[9]-343485551)<<21|g>>>11)+m<<0,this.first?(this.h0=R+1732584193<<0,this.h1=g-271733879<<0,this.h2=m-1732584194<<0,this.h3=E+271733878<<0,this.first=!1):(this.h0=this.h0+R<<0,this.h1=this.h1+g<<0,this.h2=this.h2+m<<0,this.h3=this.h3+E<<0)},t.prototype.hex=function(){this.finalize();var R=this.h0,g=this.h1,m=this.h2,E=this.h3;return n[R>>4&15]+n[15&R]+n[R>>12&15]+n[R>>8&15]+n[R>>20&15]+n[R>>16&15]+n[R>>28&15]+n[R>>24&15]+n[g>>4&15]+n[15&g]+n[g>>12&15]+n[g>>8&15]+n[g>>20&15]+n[g>>16&15]+n[g>>28&15]+n[g>>24&15]+n[m>>4&15]+n[15&m]+n[m>>12&15]+n[m>>8&15]+n[m>>20&15]+n[m>>16&15]+n[m>>28&15]+n[m>>24&15]+n[E>>4&15]+n[15&E]+n[E>>12&15]+n[E>>8&15]+n[E>>20&15]+n[E>>16&15]+n[E>>28&15]+n[E>>24&15]},t.prototype.toString=t.prototype.hex,t.prototype.digest=function(){this.finalize();var R=this.h0,g=this.h1,m=this.h2,E=this.h3;return[255&R,R>>8&255,R>>16&255,R>>24&255,255&g,g>>8&255,g>>16&255,g>>24&255,255&m,m>>8&255,m>>16&255,m>>24&255,255&E,E>>8&255,E>>16&255,E>>24&255]},t.prototype.array=t.prototype.digest,t.prototype.arrayBuffer=function(){this.finalize();var R=new ArrayBuffer(16),g=new Uint32Array(R);return g[0]=this.h0,g[1]=this.h1,g[2]=this.h2,g[3]=this.h3,R},t.prototype.buffer=t.prototype.arrayBuffer,t.prototype.base64=function(){for(var R,g,m,E="",C=this.array(),T=0;T<15;)R=C[T++],g=C[T++],m=C[T++],E+=p[R>>>2]+p[63&(R<<4|g>>>4)]+p[63&(g<<2|m>>>6)]+p[63&m];return R=C[T],E+=p[R>>>2]+p[R<<4&63]+"=="};var _=v();f?module.exports=_:(i.md5=_,o&&define(function(){return _}))})()});var _r=Ge(It=>{var Bi,Fi,Di,Li;(function(R){function g(Q,Z,ie){function se(de,ce,ye,ke){return this instanceof se?(function(qe,Be,x,M,B){if(D&&L&&(Be instanceof L&&(Be=new D(Be)),M instanceof L&&(M=new D(M))),!(Be||x||M||S))return void(qe.buffer=P(q,0));if(!T(Be,x)){var j=S||Array;B=x,M=Be,x=0,Be=new j(8)}qe.buffer=Be,qe.offset=x|=0,U!==typeof M&&(typeof M=="string"?(function(Y,z,ae,ve){var Te=0,Me=ae.length,Ae=0,Re=0;ae[0]==="-"&&Te++;for(var we=Te;Te<Me;){var Se=parseInt(ae[Te++],ve);if(!(Se>=0))break;Re=Re*ve+Se,Ae=Ae*ve+Math.floor(Re/V),Re%=V}we&&(Ae=~Ae,Re?Re=V-Re:Ae++),X(Y,z+le,Ae),X(Y,z+$,Re)})(Be,x,M,B||10):T(M,B)?O(Be,x,M,B):typeof B=="number"?(X(Be,x+le,M),X(Be,x+$,B)):M>0?Oe(Be,x,M):M<0?be(Be,x,M):O(Be,x,q,0))})(this,de,ce,ye,ke):new se(de,ce,ye,ke)}function ue(){var de=this.buffer,ce=this.offset,ye=ee(de,ce+le),ke=ee(de,ce+$);return ie||(ye|=0),ye?ye*V+ke:ke}function X(de,ce,ye){de[ce+Ce]=255&ye,ye>>=8,de[ce+Ie]=255&ye,ye>>=8,de[ce+Fe]=255&ye,ye>>=8,de[ce+he]=255&ye}function ee(de,ce){return de[ce+he]*K+(de[ce+Fe]<<16)+(de[ce+Ie]<<8)+de[ce+Ce]}var le=Z?0:4,$=Z?4:0,he=Z?0:3,Fe=Z?1:2,Ie=Z?2:1,Ce=Z?3:0,Oe=Z?function(de,ce,ye){for(var ke=ce+8;ke>ce;)de[--ke]=255&ye,ye/=256}:function(de,ce,ye){for(var ke=ce+8;ce<ke;)de[ce++]=255&ye,ye/=256},be=Z?function(de,ce,ye){var ke=ce+8;for(ye++;ke>ce;)de[--ke]=255&-ye^255,ye/=256}:function(de,ce,ye){var ke=ce+8;for(ye++;ce<ke;)de[ce++]=255&-ye^255,ye/=256},te=se.prototype,oe="is"+Q,re="_"+oe;return te.buffer=void 0,te.offset=0,te[re]=!0,te.toNumber=ue,te.toString=function(de){var ce=this.buffer,ye=this.offset,ke=ee(ce,ye+le),qe=ee(ce,ye+$),Be="",x=!ie&&2147483648&ke;for(x&&(ke=~ke,qe=V-qe),de=de||10;;){var M=ke%de*V+qe;if(ke=Math.floor(ke/de),qe=Math.floor(M/de),Be=(M%de).toString(de)+Be,!ke&&!qe)break}return x&&(Be="-"+Be),Be},te.toJSON=ue,te.toArray=m,N&&(te.toBuffer=E),D&&(te.toArrayBuffer=C),se[oe]=function(de){return!(!de||!de[re])},R[Q]=se,se}function m(Q){var Z=this.buffer,ie=this.offset;return S=null,Q!==!1&&ie===0&&Z.length===8&&H(Z)?Z:P(Z,ie)}function E(Q){var Z=this.buffer,ie=this.offset;if(S=N,Q!==!1&&ie===0&&Z.length===8&&Buffer.isBuffer(Z))return Z;var se=new N(8);return O(se,0,Z,ie),se}function C(Q){var Z=this.buffer,ie=this.offset,se=Z.buffer;if(S=D,Q!==!1&&ie===0&&se instanceof L&&se.byteLength===8)return se;var ue=new D(8);return O(ue,0,Z,ie),ue.buffer}function T(Q,Z){var ie=Q&&Q.length;return Z|=0,ie&&Z+8<=ie&&typeof Q[Z]!="string"}function O(Q,Z,ie,se){Z|=0,se|=0;for(var ue=0;ue<8;ue++)Q[Z++]=255&ie[se++]}function P(Q,Z){return Array.prototype.slice.call(Q,Z,Z+8)}var S,U="undefined",N=U!==typeof Buffer&&Buffer,D=U!==typeof Uint8Array&&Uint8Array,L=U!==typeof ArrayBuffer&&ArrayBuffer,q=[0,0,0,0,0,0,0,0],H=Array.isArray||function(Q){return!!Q&&Object.prototype.toString.call(Q)=="[object Array]"},V=4294967296,K=16777216;Bi=g("Uint64BE",!0,!0),Fi=g("Int64BE",!0,!1),Di=g("Uint64LE",!1,!0),Li=g("Int64LE",!1,!1)})(typeof It=="object"&&typeof It.nodeName!="string"?It:It||{})});var Rt=Ge((Ea,yr)=>{"use strict";var ft=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};function qi(){if(ft.fpnn)return ft.fpnn;let R=typeof self<"u"&&typeof self.importScripts=="function"&&typeof self.WebSocket=="function";return typeof window>"u"&&!R?ji():hr()}function ji(){let R={FPNN_EC_OK:0,FPNN_EC_CORE_UNKNOWN_ERROR:20001,FPNN_EC_CORE_CONNECTION_CLOSED:20002,FPNN_EC_CORE_INVALID_CONNECTION:20012};class g extends Error{constructor(C,T){let O=T instanceof Error?T:new Error(String(T||"FPNN error"));super(O.message),this.code=C,this.name="FPError",this.stack=O.stack||this.stack,this.error=O}toString(){return"code: "+this.code+" ex: "+this.message}}class m{constructor(){throw new Error('protocol: "fpnn" requires the browser FPNN runtime; use protocol: "tlv-v1" with WebSocket or webSocketFactory')}}return{FPClient:m,FPConfig:{ERROR_CODE:R},FPError:g,FPEvent:{assign:function(E){if(!E||Object.prototype.hasOwnProperty.call(E,"events"))throw new Error(E+" is null or hasOwnProperty [ events ]");if(Object.prototype.hasOwnProperty.call(E,"on")||Object.prototype.hasOwnProperty.call(E,"emit")||Object.prototype.hasOwnProperty.call(E,"removeEvent"))throw new Error(E+" hasOwnProperty [ on | emit | removeEvent | listenerCount]");E.events={},E.on=function(C,T){Object.prototype.hasOwnProperty.call(E.events,C)||(E.events[C]=[]),E.events[C].indexOf(T)===-1&&E.events[C].push(T)},E.emit=function(C){let T=Array.prototype.slice.call(arguments,1);(E.events[C]||[]).slice().forEach(function(O){O&&O.apply(E,T)})},E.removeEvent=function(C,T){if(arguments.length===0)E.events={};else if(arguments.length===1)Object.prototype.hasOwnProperty.call(E.events,C)&&delete E.events[C];else if(E.events[C]){let O=E.events[C].indexOf(T);O!==-1&&E.events[C].splice(O,1)}},E.listenerCount=function(C){return Object.prototype.hasOwnProperty.call(E.events,C)?E.events[C].length:0}}}}}function Vi(){return ft.msgpack||pr()}function Hi(){return ft.md5||gr()}function Wi(){return ft.Int64BE&&ft.Uint64BE?{Int64BE:ft.Int64BE,Uint64BE:ft.Uint64BE}:_r()}var Yi=qi(),Gi=Vi(),zi=Hi(),mr=Wi();yr.exports={fpnn:Yi,msgpack:Gi,md5:zi,Int64BE:mr.Int64BE,Uint64BE:mr.Uint64BE}});var ct=Ge((ba,Er)=>{"use strict";var{msgpack:Ki,Int64BE:Ji,Uint64BE:Qi}=Rt(),Xi="2.7.3",$i="2.7.6",Zi={RTM_EC_UNKNOWN_METHOD:20004,RTM_EC_INVALID_PROJECT_ID_OR_USER_ID:200001,RTM_EC_INVALID_PROJECT_ID_OR_SIGN:200002,RTM_EC_INVALID_FILE_OR_SIGN_OR_TOKEN:200003,RTM_EC_ATTRS_WITHOUT_SIGN_OR_EXT:200004,RTM_EC_API_FREQUENCY_LIMITED:200010,RTM_EC_MESSAGE_FREQUENCY_LIMITED:200011,RTM_EC_FORBIDDEN_METHOD:200020,RTM_EC_PERMISSION_DENIED:200021,RTM_EC_UNAUTHORIZED:200022,RTM_EC_DUPLCATED_AUTH:200023,RTM_EC_AUTH_DENIED:200024,RTM_EC_ADMIN_LOGIN:200025,RTM_EC_ADMIN_ONLY:200026,RTM_EC_INVALID_AUTH_TOEKN:200027,RTM_EC_LARGE_MESSAGE_OR_ATTRS:200030,RTM_EC_LARGE_FILE_OR_ATTRS:200031,RTM_EC_TOO_MANY_ITEMS_IN_PARAMETERS:200032,RTM_EC_EMPTY_PARAMETER:200033,RTM_EC_INVALID_PARAMETER:200034,RTM_EC_NOT_IN_ROOM:200040,RTM_EC_NOT_GROUP_MEMBER:200041,RTM_EC_MAX_GROUP_MEMBER_COUNT:200042,RTM_EC_NOT_FRIEND:200043,RTM_EC_BANNED_IN_GROUP:200044,RTM_EC_BANNED_IN_ROOM:200045,RTM_EC_EMPTY_GROUP:200046,RTM_EC_ENTER_TOO_MANY_ROOMS:200047,RTM_EC_UNSUPPORTED_LANGUAGE:200050,RTM_EC_EMPTY_TRANSLATION:200051,RTM_EC_SEND_TO_SELF:200052,RTM_EC_DUPLCATED_MID:200053,RTM_EC_SENSITIVE_WORDS:200054,RTM_EC_UNKNOWN_ERROR:200999},eo={image:40,audio:41,video:42,file:50},to={text:30,audio:31,cmd:32},no=60,ro={kickOut:"kickout",kickOutRoom:"kickoutroom",recvMessage:"pushmsg",recvGroupMessage:"pushgroupmsg",recvRoomMessage:"pushroommsg",recvBroadcastMessage:"pushbroadcastmsg",recvFile:"pushfile",recvGroupFile:"pushgroupfile",recvRoomFile:"pushroomfile",recvBroadcastFile:"pushbroadcastfile",recvPing:"ping",recvChat:"pushchat",recvAudio:"pushaudio",recvCmd:"pushcmd",recvGroupChat:"pushgroupchat",recvGroupAudio:"pushgroupaudio",recvGroupCmd:"pushgroupcmd",recvRoomChat:"pushroomchat",recvRoomAudio:"pushroomaudio",recvRoomCmd:"pushroomcmd",recvBroadcastChat:"pushbroadcastchat",recvBroadcastAudio:"pushbroadcastaudio",recvBroadcastCmd:"pushbroadcastcmd"},io={kickOut:"event.kicked",kickOutRoom:"event.room_removed",recvBroadcastMessage:"event.broadcast",recvGroupMessage:"event.group",recvMessage:"event.direct",recvRoomMessage:"event.room"},Mt=class{static get ERROR_CODE(){return Zi}static get MsgPack(){return Ki}static get FILE_TYPE(){return eo}static get CHAT_TYPE(){return to}static get SERVER_PUSH(){return ro}static get TLV_SERVER_PUSH(){return io}static get MID_TTL(){return 5*1e3}static get API_VERSION(){return Xi}static get SDK_VERSION(){return $i}static get MAX_PING_SECONDS(){return no}};Mt.Int64=function(R){return new Ji(""+R)};Mt.Uint64=function(R){return new Qi(""+R)};Er.exports=Mt});var Cn=Ge((va,br)=>{"use strict";var{fpnn:oo}=Rt(),pe=ct(),wa=Ut(),Rn=class{constructor(g){oo.FPEvent.assign(this),this._map={},this._client=g,this.uid=0,this._expireTimerID=0,this._msgOptions={codec:pe.MsgPack.createCodec({int64:!0})},this._binaryOptions={codec:pe.MsgPack.createCodec({int64:!0,useraw:!0})},this._binaryMessageMethodList=[pe.SERVER_PUSH.recvMessage,pe.SERVER_PUSH.recvGroupMessage,pe.SERVER_PUSH.recvRoomMessage,pe.SERVER_PUSH.recvBroadcastMessage,pe.SERVER_PUSH.recvFile,pe.SERVER_PUSH.recvGroupFile,pe.SERVER_PUSH.recvRoomFile,pe.SERVER_PUSH.recvBroadcastFile],ao.call(this)}service(g,m){if(g&&Object.prototype.hasOwnProperty.call(g,"_tlvPayload")&&so(g.method)){this._serviceTLVPush(g);return}let E=!0;pe.SERVER_PUSH.kickOut==g.method&&(E=!1),pe.SERVER_PUSH.kickOutRoom==g.method&&(E=!1),E&&m&&(g.flag==0&&m(JSON.stringify({}),!1),g.flag==1&&m(pe.MsgPack.encode({},this._msgOptions),!1));let C=null;if(g&&Object.prototype.hasOwnProperty.call(g,"_tlvPayload")&&(C=g._tlvPayload,g._tlvBinaryPayload&&(C.binary=C.msg)),!C&&g.flag==0&&(C=JSON.parse(g.payload)),!C&&g.flag==1)if(this._binaryMessageMethodList.indexOf(g.method)!==-1)if(C=pe.MsgPack.decode(g.payload,this._binaryOptions),C.mtype==pe.CHAT_TYPE.text)C=pe.MsgPack.decode(g.payload,this._msgOptions);else{C.binary=C.msg;try{C.msg=new TextDecoder("utf-8",{fatal:!0}).decode(C.msg)}catch{C.msg=void 0}try{C.attrs=new TextDecoder("utf-8",{fatal:!0}).decode(C.attrs)}catch{}}else C=pe.MsgPack.decode(g.payload,this._msgOptions);if(C){if(C.attrs!==void 0)try{let T=JSON.parse(C.attrs);if(T&&T.excludedUids!==void 0&&Array.isArray(T.excludedUids)&&T.excludedUids.includes(this.uid.toString()))return}catch{}typeof this[g.method]=="function"&&this[g.method].call(this,C)}}_serviceTLVPush(g){let m=g._tlvPayload;if(m&&m.extra!==void 0)try{let E=JSON.parse(m.extra);if(E&&E.excludedUids!==void 0&&Array.isArray(E.excludedUids)&&E.excludedUids.includes(this.uid.toString()))return}catch{}this.emit(g.method,m)}destroy(){this._map={},this._expireTimerID&&(clearInterval(this._expireTimerID),this._expireTimerID=0)}kickout(g){this.emit(pe.SERVER_PUSH.kickOut,g)}kickoutroom(g){g.rid&&(g.rid=new pe.Int64(g.rid)),this.emit(pe.SERVER_PUSH.kickOutRoom,g)}pushmsg(g){if(g.from&&(g.from=new pe.Int64(g.from)),!(g.mid&&(g.mid=new pe.Int64(g.mid),!Ht.call(this,1,g.mid,g.from)))){if(g.mtime&&(g.mtime=new pe.Int64(g.mtime)),g.mtype>=40&&g.mtype<=50){this.emit(pe.SERVER_PUSH.recvFile,g);return}if(g.mtype==pe.CHAT_TYPE.text){this.emit(pe.SERVER_PUSH.recvChat,g);return}if(g.mtype==pe.CHAT_TYPE.audio){this.emit(pe.SERVER_PUSH.recvFile,g);return}if(g.mtype==pe.CHAT_TYPE.cmd){this.emit(pe.SERVER_PUSH.recvCmd,g);return}delete g.ftype,this.emit(pe.SERVER_PUSH.recvMessage,g)}}pushgroupmsg(g){if(g.from&&(g.from=new pe.Int64(g.from)),!(g.mid&&(g.mid=new pe.Int64(g.mid),!Ht.call(this,2,g.mid,g.from,g.gid)))){if(g.gid&&(g.gid=new pe.Int64(g.gid)),g.mtime&&(g.mtime=new pe.Int64(g.mtime)),g.mtype>=40&&g.mtype<=50){this.emit(pe.SERVER_PUSH.recvGroupFile,g);return}if(g.mtype==pe.CHAT_TYPE.text){this.emit(pe.SERVER_PUSH.recvGroupChat,g);return}if(g.mtype==pe.CHAT_TYPE.audio){this.emit(pe.SERVER_PUSH.recvGroupFile,g);return}if(g.mtype==pe.CHAT_TYPE.cmd){this.emit(pe.SERVER_PUSH.recvGroupCmd,g);return}delete g.ftype,this.emit(pe.SERVER_PUSH.recvGroupMessage,g)}}pushroommsg(g){if(g.from&&(g.from=new pe.Int64(g.from)),!(g.mid&&(g.mid=new pe.Int64(g.mid),!Ht.call(this,3,g.mid,g.from,g.rid)))){if(g.rid&&(g.rid=new pe.Int64(g.rid)),g.mtime&&(g.mtime=new pe.Int64(g.mtime)),g.mtype>=40&&g.mtype<=50){this.emit(pe.SERVER_PUSH.recvRoomFile,g);return}if(g.mtype==pe.CHAT_TYPE.text){this.emit(pe.SERVER_PUSH.recvRoomChat,g);return}if(g.mtype==pe.CHAT_TYPE.audio){this.emit(pe.SERVER_PUSH.recvRoomFile,g);return}if(g.mtype==pe.CHAT_TYPE.cmd){this.emit(pe.SERVER_PUSH.recvRoomCmd,g);return}delete g.ftype,this.emit(pe.SERVER_PUSH.recvRoomMessage,g)}}pushbroadcastmsg(g){if(g.from&&(g.from=new pe.Int64(g.from)),!(g.mid&&(g.mid=new pe.Int64(g.mid),!Ht.call(this,4,g.mid,g.from)))){if(g.mtime&&(g.mtime=new pe.Int64(g.mtime)),g.mtype>=40&&g.mtype<=50){this.emit(pe.SERVER_PUSH.recvBroadcastFile,g);return}if(g.mtype==pe.CHAT_TYPE.text){this.emit(pe.SERVER_PUSH.recvBroadcastChat,g);return}if(g.mtype==pe.CHAT_TYPE.audio){this.emit(pe.SERVER_PUSH.recvBroadcastFile,g);return}if(g.mtype==pe.CHAT_TYPE.cmd){this.emit(pe.SERVER_PUSH.recvBroadcastCmd,g);return}delete g.ftype,this.emit(pe.SERVER_PUSH.recvBroadcastMessage,g)}}ping(g){this._client._lastPingTime=parseInt(Date.now()/1e3),this.emit(pe.SERVER_PUSH.recvPing,g)}};function Ht(R,g,m,E){let C=[];C.push(R),C.push(g),C.push(m),E!=null&&C.push(E);let T=C.join("_");if(this._map.hasOwnProperty(T)){if(this._map[T]>Date.now())return!1;delete this._map[T]}return this._map[T]=pe.MID_TTL+Date.now(),!0}function so(R){let g=pe.TLV_SERVER_PUSH;return R===g.recvMessage||R===g.recvGroupMessage||R===g.recvRoomMessage||R===g.recvBroadcastMessage||R===g.kickOut||R===g.kickOutRoom}function ao(){let R=this;this._expireTimerID=setInterval(function(){for(let g in R._map)R._map[g]>Date.now()||uo.call(R,g)},pe.MID_TTL+1e3)}function uo(R){let g=this;setTimeout(function(){delete g._map[R]},0)}br.exports=Rn});var Kt=Ge((Ra,Pr)=>{"use strict";var Ne=class extends Error{constructor(g){super(g),this.name="TLVMsgPackError"}},lt=class{constructor(g,m,E){this.high=g>>>0,this.low=m>>>0,this.signed=!!E}isNegative(){return this.signed&&(this.high&2147483648)!==0}toString(){if(!this.isNegative())return wr(this.high,this.low);let g=Wt(this.high,this.low);return"-"+wr(g.high,g.low)}valueOf(){return Number(this.toString())}};function Wt(R,g){let m=~g+1>>>0,E=~R>>>0;return m===0&&(E=E+1>>>0),{high:E,low:m}}function wr(R,g){let m=[R>>>0];vr(m,65536),vr(m,65536),fo(m,g>>>0);let E=String(m[m.length-1]);for(let C=m.length-2;C>=0;C-=1)E+=String(m[C]).padStart(7,"0");return E}function vr(R,g){let m=0;for(let E=0;E<R.length;E+=1){let C=R[E]*g+m;R[E]=C%1e7,m=Math.floor(C/1e7)}for(;m>0;)R.push(m%1e7),m=Math.floor(m/1e7)}function fo(R,g){let m=g,E=0;for(;m>0;){E===R.length&&R.push(0);let C=R[E]+m;R[E]=C%1e7,m=Math.floor(C/1e7),E+=1}}function co(R){if(!/^[0-9]+$/.test(R))throw new Ne("invalid integer text");let g=0,m=0;for(let E=0;E<R.length;E+=1){let C=R.charCodeAt(E)-48,T=m*10+C;m=T%4294967296;let O=Math.floor(T/4294967296),P=g*10+O;if(P>=4294967296)throw new Ne("integer exceeds uint64");g=P}return{high:g>>>0,low:m>>>0}}function Rr(R){return Number.isSafeInteger?Number.isSafeInteger(R):typeof R=="number"&&isFinite(R)&&Math.floor(R)===R&&Math.abs(R)<=9007199254740991}function Yt(R){if(!R||typeof R!="object"||Array.isArray(R))return!1;let g=Object.getPrototypeOf(R);return g===Object.prototype||g===null}function An(R){if(R instanceof Uint8Array)return R;if(typeof ArrayBuffer<"u"&&R instanceof ArrayBuffer)return new Uint8Array(R);if(typeof ArrayBuffer<"u"&&ArrayBuffer.isView&&ArrayBuffer.isView(R))return new Uint8Array(R.buffer,R.byteOffset,R.byteLength);if(typeof ArrayBuffer<"u"&&R&&Object.prototype.toString.call(R)==="[object ArrayBuffer]")try{return new Uint8Array(ArrayBuffer.prototype.slice.call(R,0))}catch{}return null}function Gt(R){let g=An(R);if(!g)throw new Ne("expected binary data");return g}function lo(R){if(!R||typeof R!="object"||R instanceof lt||typeof R.offset!="number"||typeof R.toString!="function"||!R.buffer)return!1;let g=R.buffer,m=typeof g.length=="number"?g.length:g.byteLength;return typeof m=="number"&&R.offset>=0&&R.offset+8<=m}function ho(R){let g=R.buffer,m=R.offset,E=function(C){return g[m+C]&255};return{high:E(0)*16777216+E(1)*65536+E(2)*256+E(3)>>>0,low:E(4)*16777216+E(5)*65536+E(6)*256+E(7)>>>0,signed:String(R).charAt(0)==="-"}}function po(R){for(let g=0;g<R.length;g+=1){let m=R.charCodeAt(g);if(m>=55296&&m<=56319){let E=R.charCodeAt(g+1);if(E<56320||E>57343)throw new Ne("string contains an unpaired surrogate");g+=1}else if(m>=56320&&m<=57343)throw new Ne("string contains an unpaired surrogate")}}function Cr(R){if(typeof R!="string")throw new Ne("expected UTF-8 string");if(po(R),typeof TextEncoder<"u")return new TextEncoder().encode(R);let g=[];for(let m=0;m<R.length;m+=1){let E=R.charCodeAt(m);if(E>=55296&&E<=56319){let C=R.charCodeAt(m+1);E=65536+(E-55296<<10)+(C-56320),m+=1}E<=127?g.push(E):E<=2047?g.push(192|E>>6,128|E&63):E<=65535?g.push(224|E>>12,128|E>>6&63,128|E&63):g.push(240|E>>18,128|E>>12&63,128|E>>6&63,128|E&63)}return new Uint8Array(g)}function Or(R){let g=Gt(R);if(typeof TextDecoder<"u")try{return new TextDecoder("utf-8",{fatal:!0}).decode(g)}catch{throw new Ne("invalid UTF-8 string")}let m="";for(let E=0;E<g.length;E+=1){let C=g[E],T;if(C<=127)T=C;else if(C>=194&&C<=223){let O=Ct(g,E+1);T=(C&31)<<6|O&63,E+=1}else if(C>=224&&C<=239){let O=Ct(g,E+1),P=Ct(g,E+2);if(C===224&&O<160||C===237&&O>159)throw new Ne("invalid UTF-8 string");T=(C&15)<<12|(O&63)<<6|P&63,E+=2}else if(C>=240&&C<=244){let O=Ct(g,E+1),P=Ct(g,E+2),S=Ct(g,E+3);if(C===240&&O<144||C===244&&O>143)throw new Ne("invalid UTF-8 string");T=(C&7)<<18|(O&63)<<12|(P&63)<<6|S&63,E+=3}else throw new Ne("invalid UTF-8 string");if(T<=65535)m+=String.fromCharCode(T);else{let O=T-65536;m+=String.fromCharCode(55296|O>>10,56320|O&1023)}}return m}function Ct(R,g){if(g>=R.length||(R[g]&192)!==128)throw new Ne("invalid UTF-8 string");return R[g]}var On=class{constructor(){this.chunks=[],this.length=0}byte(g){this.chunks.push(new Uint8Array([g&255])),this.length+=1}bytes(g){let m=Gt(g);this.chunks.push(m),this.length+=m.length}uint16(g){this.byte(g>>>8),this.byte(g)}uint32(g){let m=g>>>0;this.byte(m>>>24),this.byte(m>>>16),this.byte(m>>>8),this.byte(m)}uint64(g,m){this.uint32(g),this.uint32(m)}finish(){let g=new Uint8Array(this.length),m=0;return this.chunks.forEach(function(E){g.set(E,m),m+=E.length}),g}};function go(R){if(!Yt(R))throw new Ne("TLV payload must be a map");let g=new On;return Sn(R,g,0),g.finish()}function Sn(R,g,m){if(m>128)throw new Ne("MessagePack nesting is too deep");if(R==null)throw new Ne("nil and undefined are not allowed in TLV payloads");let E=typeof R;if(E==="boolean"){g.byte(R?195:194);return}if(E==="string"){Tr(R,g);return}if(E==="number"){Eo(R,g);return}if(E==="bigint"){wo(R.toString(),g);return}if(E!=="object")throw new Ne("unsupported MessagePack value type: "+E);if(R instanceof lt){vo(R,g);return}let C=An(R);if(C){_o(C,g);return}if(lo(R)){Ro(R,g);return}if(Array.isArray(R)){mo(R,g,m+1);return}if(Yt(R)){yo(R,g,m+1);return}throw new Ne("unsupported MessagePack object")}function Tr(R,g){let m=Cr(R);m.length<=31?g.byte(160|m.length):m.length<=255?(g.byte(217),g.byte(m.length)):m.length<=65535?(g.byte(218),g.uint16(m.length)):(g.byte(219),g.uint32(m.length)),g.bytes(m)}function _o(R,g){R.length<=255?(g.byte(196),g.byte(R.length)):R.length<=65535?(g.byte(197),g.uint16(R.length)):(g.byte(198),g.uint32(R.length)),g.bytes(R)}function mo(R,g,m){R.length<=15?g.byte(144|R.length):R.length<=65535?(g.byte(220),g.uint16(R.length)):(g.byte(221),g.uint32(R.length)),R.forEach(function(E){Sn(E,g,m)})}function yo(R,g,m){let E=Object.keys(R);E.length<=15?g.byte(128|E.length):E.length<=65535?(g.byte(222),g.uint16(E.length)):(g.byte(223),g.uint32(E.length)),E.forEach(function(C){Tr(C,g),Sn(R[C],g,m)})}function Eo(R,g){if(!isFinite(R))throw new Ne("non-finite numbers are not allowed");if(!Rr(R))throw new Ne("floating-point and unsafe integer numbers are not allowed");zt(R,g)}function zt(R,g){if(R>=0){if(R<=127)g.byte(R);else if(R<=255)g.byte(204),g.byte(R);else if(R<=65535)g.byte(205),g.uint16(R);else if(R<=4294967295)g.byte(206),g.uint32(R);else{let m=Tn(R);g.byte(207),g.uint64(m.high,m.low)}return}if(R>=-32)g.byte(256+R);else if(R>=-128)g.byte(208),g.byte(R);else if(R>=-32768)g.byte(209),g.uint16(R);else if(R>=-2147483648)g.byte(210),g.uint32(R);else{let m=bo(R);g.byte(211),g.uint64(m.high,m.low)}}function Tn(R){let g=Math.floor(R/4294967296),m=R-g*4294967296;return{high:g>>>0,low:m>>>0}}function bo(R){if(R>=0)return Tn(R);let g=Tn(-R);return Wt(g.high,g.low)}function wo(R,g){let m=R.charAt(0)==="-",E=m?R.slice(1):R,C=co(E);if(m){if(C.high>2147483648||C.high===2147483648&&C.low!==0)throw new Ne("integer is below int64 minimum");let T=Wt(C.high,C.low);g.byte(211),g.uint64(T.high,T.low);return}if(kn(C),C.high===0){zt(C.low,g);return}g.byte(207),g.uint64(C.high,C.low)}function vo(R,g){if(R.isNegative()){g.byte(211),g.uint64(R.high,R.low);return}if(kn(R),R.high===0){zt(R.low,g);return}g.byte(207),g.uint64(R.high,R.low)}function Ro(R,g){let m=ho(R);if(m.signed){g.byte(211),g.uint64(m.high,m.low);return}if(kn(m),m.high===0){zt(m.low,g);return}g.byte(207),g.uint64(m.high,m.low)}function kn(R){if(R.high>=2147483648)throw new Ne("unsigned integer exceeds the supported int64 range")}var Pn=class{constructor(g,m){this.bytes=Gt(g),this.offset=0,this.allowIntegerMapKeyAtPath=m&&Array.isArray(m.allowIntegerMapKeyAtPath)?m.allowIntegerMapKeyAtPath.slice():null}ensure(g){if(g<0||this.offset+g>this.bytes.length)throw new Ne("truncated MessagePack value")}byte(){this.ensure(1);let g=this.bytes[this.offset];return this.offset+=1,g}uint16(){this.ensure(2);let g=this.bytes[this.offset]*256+this.bytes[this.offset+1];return this.offset+=2,g}uint32(){this.ensure(4);let g=this.bytes[this.offset]*16777216+this.bytes[this.offset+1]*65536+this.bytes[this.offset+2]*256+this.bytes[this.offset+3];return this.offset+=4,g>>>0}uint64(g){let m=this.uint32(),E=this.uint32();if(g&&(m&2147483648)!==0){let C=Wt(m,E);return C.high<2097152?-(C.high*4294967296+C.low):new lt(m,E,!0)}if(m>=2147483648)throw new Ne("unsigned integer exceeds the supported int64 range");return m<2097152?m*4294967296+E:new lt(m,E,!!g)}int8(){let g=this.byte();return g&128?g-256:g}int16(){let g=this.uint16();return g&32768?g-65536:g}int32(){let g=this.uint32();return g>2147483647?g-4294967296:g}float32(){this.ensure(4);let g=new DataView(this.bytes.buffer,this.bytes.byteOffset+this.offset,4).getFloat32(0,!1);if(this.offset+=4,!isFinite(g))throw new Ne("non-finite float is not allowed");return g}float64(){this.ensure(8);let g=new DataView(this.bytes.buffer,this.bytes.byteOffset+this.offset,8).getFloat64(0,!1);if(this.offset+=8,!isFinite(g))throw new Ne("non-finite float is not allowed");return g}binary(g){this.ensure(g);let m=new Uint8Array(g);return m.set(this.bytes.subarray(this.offset,this.offset+g)),this.offset+=g,m}string(g){this.ensure(g);let m=Or(this.bytes.subarray(this.offset,this.offset+g));return this.offset+=g,m}array(g,m,E){if(g>this.bytes.length-this.offset)throw new Ne("truncated MessagePack array");let C=new Array(g);for(let T=0;T<g;T+=1)C[T]=this.value(m+1,E.concat(String(T)));return C}map(g,m,E){if(g>Math.floor((this.bytes.length-this.offset)/2))throw new Ne("truncated MessagePack map");let C={};for(let T=0;T<g;T+=1){let P=this.value(m+1,E);if(typeof P!="string")if(this._allowsIntegerMapKey(E)&&Co(P))P=String(P);else throw new Ne("MessagePack map key must be a string");if(Object.prototype.hasOwnProperty.call(C,P))throw new Ne("duplicate MessagePack map key: "+P);Object.defineProperty(C,P,{configurable:!0,enumerable:!0,value:this.value(m+1,E.concat(P)),writable:!0})}return C}_allowsIntegerMapKey(g){if(!this.allowIntegerMapKeyAtPath||g.length!==this.allowIntegerMapKeyAtPath.length)return!1;for(let m=0;m<g.length;m+=1)if(g[m]!==this.allowIntegerMapKeyAtPath[m])return!1;return!0}value(g,m){if(g>128)throw new Ne("MessagePack nesting is too deep");let E=this.byte();if(E<=127)return E;if(E>=224)return E-256;if(E>=160&&E<=191)return this.string(E&31);if(E>=144&&E<=159)return this.array(E&15,g,m);if(E>=128&&E<=143)return this.map(E&15,g,m);switch(E){case 192:throw new Ne("nil is not allowed in TLV payloads");case 194:return!1;case 195:return!0;case 196:return this.binary(this.byte());case 197:return this.binary(this.uint16());case 198:return this.binary(this.uint32());case 202:return this.float32();case 203:return this.float64();case 204:return this.byte();case 205:return this.uint16();case 206:return this.uint32();case 207:return this.uint64(!1);case 208:return this.int8();case 209:return this.int16();case 210:return this.int32();case 211:return this.uint64(!0);case 217:return this.string(this.byte());case 218:return this.string(this.uint16());case 219:return this.string(this.uint32());case 220:return this.array(this.uint16(),g,m);case 221:return this.array(this.uint32(),g,m);case 222:return this.map(this.uint16(),g,m);case 223:return this.map(this.uint32(),g,m);default:throw new Ne("MessagePack extension and reserved values are not allowed")}}};function Co(R){return Rr(R)||R instanceof lt}function Oo(R,g){let m=new Pn(R,g),E=m.value(0,[]);if(!Yt(E))throw new Ne("TLV payload must be a map");if(m.offset!==m.bytes.length)throw new Ne("MessagePack payload has trailing bytes or values");return E}Pr.exports={Int64Value:lt,MsgPackError:Ne,decodeMap:Oo,encodeMap:go,getByteView:An,isPlainMap:Yt,toUint8Array:Gt,utf8Decode:Or,utf8Encode:Cr}});var Ln=Ge((Ca,xr)=>{"use strict";var Nt=Kt(),Un=204,Nn=1,Bn=4,Ar=0,Fn=7,Jt=64*1024*1024,Dn=Jt+128*1024,Sr=2147483647,Mn=new Uint8Array([2,0,109,116,1,0]),ze=class extends Error{constructor(g){super(g),this.name="TLVCodecError"}};function kr(R){if(typeof R!="number"||!isFinite(R)||Math.floor(R)!==R||R<1||R>Sr)throw new ze("sequence must be an integer in 1..2147483647")}function To(R){if(R!=="0"&&R!=="1"&&R!=="2")throw new ze('metadata mt must be "0", "1", or "2"')}function Po(R){if(typeof R!="string"||R.length===0)throw new ze("URI must be a non-empty UTF-8 string");let g=Nt.utf8Encode(R);if(g.length===0||g.length>255)throw new ze("URI UTF-8 length must be in 1..255");return g}function Ao(R,g,m){R[g]=m&255,R[g+1]=m>>>8&255}function xn(R,g,m){let E=m>>>0;R[g]=E&255,R[g+1]=E>>>8&255,R[g+2]=E>>>16&255,R[g+3]=E>>>24&255}function So(R,g){return R[g]+R[g+1]*256}function In(R,g){return R[g]+R[g+1]*256+R[g+2]*65536+R[g+3]*16777216>>>0}function ko(R,g,m,E){kr(R),To(g);let C=Po(m),T=Nt.encodeMap(E===void 0?{}:E);if(T.length===0||T.length>Jt)throw new ze("MsgPack payload length is outside the TLV v1 limit");let O=1+C.length+1+4+T.length,P=21+O;if(P>Dn)throw new ze("TLV frame exceeds the maximum frame length");let S=new Uint8Array(P);S[0]=Un,S[1]=Nn,S[2]=Bn,S[3]=Ar,xn(S,4,R),Ao(S,8,Fn),S.set(Mn,10),S[16]=g.charCodeAt(0),xn(S,17,O);let U=21;return S[U]=C.length,U+=1,S.set(C,U),U+=C.length,S[U]=0,U+=1,xn(S,U,T.length),U+=4,S.set(T,U),S}function xo(R){let g=Nt.toUint8Array(R);if(g.length===0||g.length>Dn)throw new ze("TLV frame length is outside the allowed limit");if(g.length<27)throw new ze("TLV frame is too short");if(g[0]!==Un||g[1]!==Nn||g[2]!==Bn||g[3]!==Ar)throw new ze("invalid TLV v1 header");let m=In(g,4);if(kr(m),So(g,8)!==Fn)throw new ze("TLV v1 metadata length must be exactly 7");for(let L=0;L<Mn.length;L+=1)if(g[10+L]!==Mn[L])throw new ze("TLV v1 metadata must contain only key mt");let E=g[16];if(E!==48&&E!==49&&E!==50)throw new ze("TLV v1 metadata mt is invalid");let C=String.fromCharCode(E);if(In(g,17)!==g.length-21)throw new ze("message queue length does not match the frame boundary");let O=21,P=g[O];if(O+=1,P===0||O+P+1+4>g.length)throw new ze("invalid URI length in message queue");let S=Nt.utf8Decode(g.subarray(O,O+P));if(O+=P,g[O]!==0)throw new ze("TLV v1 passThrough must be empty");O+=1;let U=In(g,O);if(O+=4,U===0||U>Jt||O+U!==g.length)throw new ze("invalid MsgPack payload length or trailing bytes");let N=g.subarray(O,O+U),D;try{D=Nt.decodeMap(N,{allowIntegerMapKeyAtPath:S==="room.last_messages"?["last_by_room"]:null})}catch(L){throw L instanceof ze?L:new ze("invalid MsgPack payload: "+L.message)}return{mt:C,payload:D,payloadBytes:new Uint8Array(N),sequence:m,uri:S}}xr.exports={FLAGS:Bn,MAGIC:Un,MAX_FRAME_LENGTH:Dn,MAX_PAYLOAD_LENGTH:Jt,MAX_SEQUENCE:Sr,METADATA_LENGTH:Fn,TLVCodecError:ze,VERSION:Nn,decodeFrame:xo,encodeFrame:ko}});var Hr=Ge((Oa,Vr)=>{"use strict";var _t=Kt(),Xe=class extends Error{constructor(g,m){super(m),this.name="TLVContractError",this.status=g}};function _e(R,g,m,E){let C=E||{};return{defaults:C.defaults||{},pass:C.pass||[],request:g||{},required:C.required||[],response:m||{},uri:R}}var Qt={cursor:0,end_ms:0,limit:20,reverse:!1,start_ms:0},Xt={end_ms:0,limit:20,reverse:!1,start_ms:0},$t={end_ms:0,start_ms:0},Zt={begin:"start_ms",desc:"reverse",end:"end_ms",lastid:"cursor",mtypes:"kinds",num:"limit"},en={begin:"start_ms",desc:"reverse",end:"end_ms",mid:"anchor",mtypes:"kinds",num:"limit"},tn={begin:"start_ms",end:"end_ms",mtypes:"kinds"},ht={begin:"first_ms",end:"last_ms",lastid:"next",msgs:"items",num:"size"},cn={auth:_e("auth.login",{attrs:"props",authv:"auth_ver",lang:"locale",pid:"project",token:"credential",ts:"auth_sec",uid:"user",version:"client_ver"},{ok:"accepted"},{required:["project","user","credential","client_ver"]}),bye:_e("connection.close"),getservertime:_e("system.time",null,{mts:"server_ms"}),addattrs:_e("connection.set_props",{attrs:"props"},null,{required:["props"]}),getattrs:_e("connection.get_props",null,{attrs:"props"}),adddebuglog:_e("system.debug",{attrs:"context",msg:"entry"},null,{required:["entry","context"]}),getonlineusers:_e("presence.online",{uids:"users"},{uids:"online_users"},{required:["users"]}),setuserinfo:_e("user.set_profile",{oinfo:"public_data",pinfo:"private_data"}),getuserinfo:_e("user.get_profile",null,{oinfo:"public_data",pinfo:"private_data"}),getuseropeninfo:_e("user.get_public",{uids:"users"},{info:"profiles"},{required:["users"]}),setlang:_e("user.set_locale",{lang:"locale"},{ok:"updated"},{required:["locale"]}),dataget:_e("storage.get",{key:"slot"},{val:"value"},{required:["slot"]}),dataset:_e("storage.set",{key:"slot",val:"value"},null,{required:["slot","value"]}),datadel:_e("storage.delete",{key:"slot"},null,{required:["slot"]}),addblacks:_e("blacklist.add",{blacks:"blocked_users"},null,{required:["blocked_users"]}),delblacks:_e("blacklist.remove",{blacks:"blocked_users"},null,{required:["blocked_users"]}),getblacks:_e("blacklist.list",null,{uids:"blocked_users"}),addgroupmembers:_e("group.add",{gid:"group_ref",uids:"members"},null,{required:["group_ref","members"]}),delgroupmembers:_e("group.remove",{gid:"group_ref",uids:"members"},null,{required:["group_ref","members"]}),getgroupmembers:_e("group.members",{gid:"group_ref",online:"with_online"},{onlines:"active_members",uids:"members"},{required:["group_ref"]}),getgroupcount:_e("group.count",{gid:"group_ref",online:"with_online"},{cn:"total",online:"active_total"},{required:["group_ref"]}),getusergroups:_e("group.joined",null,{gids:"group_refs"}),setgroupinfo:_e("group.set_profile",{gid:"group_ref",oinfo:"public_data",pinfo:"private_data"},null,{required:["group_ref"]}),getgroupinfo:_e("group.get_profile",{gid:"group_ref"},{oinfo:"public_data",pinfo:"private_data"},{required:["group_ref"]}),getgroupopeninfo:_e("group.get_public",{gid:"group_ref"},{oinfo:"public_data"},{required:["group_ref"]}),getgroupsopeninfo:_e("group.get_public_batch",{gids:"group_refs"},{info:"profiles"},{required:["group_refs"]}),enterroom:_e("room.join",{rid:"room_ref"},null,{required:["room_ref"]}),leaveroom:_e("room.leave",{rid:"room_ref"},null,{required:["room_ref"]}),enterrooms:_e("room.join_batch",{rids:"room_refs"},null,{required:["room_refs"]}),getuserrooms:_e("room.joined",null,{rooms:"room_refs"}),getroommembers:_e("room.members",{rid:"room_ref"},{uids:"members"},{required:["room_ref"]}),getroomcount:_e("room.counts",{rids:"room_refs"},{cn:"totals"},{required:["room_refs"]}),setroominfo:_e("room.set_profile",{icon:"avatar",name:"label",oinfo:"public_data",pinfo:"private_data",rid:"room_ref"},null,{required:["room_ref"]}),getroominfo:_e("room.get_profile",{rid:"room_ref"},{oinfo:"public_data",pinfo:"private_data"},{required:["room_ref"]}),getroomopeninfo:_e("room.get_public",{rid:"room_ref"},{oinfo:"public_data"},{required:["room_ref"]}),getroomsopeninfo:_e("room.get_public_batch",{rids:"room_refs"},{info:"profiles"},{required:["room_refs"]}),getuserroomsandlastmsg:_e("room.last_messages",{mtypes:"kinds"},{rooms:"last_by_room"}),sendmsg:_e("message.send",{attrs:"extra",mid:"message_ref",msg:"payload",mtype:"kind",to:"recipient"},{mid:"message_ref",mtime:"time_ms"},{pass:["checkParams","strategyid"],required:["recipient","message_ref","kind","payload","extra"]}),sendmsgs:_e("message.send_batch",{attrs:"extra",mid:"message_ref",msg:"payload",mtype:"kind",tos:"recipients"},{mid:"message_ref",mtime:"time_ms"},{required:["recipients","message_ref","kind","payload","extra"]}),sendgroupmsg:_e("message.send_group",{attrs:"extra",gid:"group_ref",mid:"message_ref",msg:"payload",mtype:"kind"},{mid:"message_ref",mtime:"time_ms"},{pass:["checkParams","strategyid"],required:["group_ref","message_ref","kind","payload","extra"]}),sendroommsg:_e("message.send_room",{attrs:"extra",mid:"message_ref",msg:"payload",mtype:"kind",rid:"room_ref"},{mid:"message_ref",mtime:"time_ms"},{pass:["checkParams","strategyid"],required:["room_ref","message_ref","kind","payload","extra"]}),tcheck:_e("moderation.check",{region:"zone",text:"payload"},{language:"detected_locale",result:"decision",text:"filtered",wlist:"matches"},{pass:["checkParams","strategyId"],required:["payload"]}),translate:_e("translation.run",{dst:"to_locale",profanity:"filter_mode",src:"from_locale",text:"input",type:"format"},{dtext:"output",dst:"to_locale",source:"detected_locale",sourceText:"original",src:"from_locale",stext:"input",target:"resolved_locale",targetText:"translated"},{defaults:{filter_mode:"off",format:"chat"},required:["input","to_locale","format","filter_mode"]}),getp2pmsg:_e("history.direct",Object.assign({ouid:"peer"},Zt),ht,{defaults:Qt,required:["peer","reverse","limit","start_ms","end_ms","cursor"]}),getgroupmsg:_e("history.group",Object.assign({gid:"group_ref"},Zt),ht,{defaults:Qt,required:["group_ref","reverse","limit","start_ms","end_ms","cursor"]}),getroommsg:_e("history.room",Object.assign({rid:"room_ref"},Zt),ht,{defaults:Qt,required:["room_ref","reverse","limit","start_ms","end_ms","cursor"]}),getbroadcastmsg:_e("history.broadcast",Zt,ht,{defaults:Qt,required:["reverse","limit","start_ms","end_ms","cursor"]}),getp2pmsgbymessageid:_e("history.direct_anchor",Object.assign({ouid:"peer"},en),ht,{defaults:Xt,required:["peer","anchor","reverse","limit","start_ms","end_ms"]}),getgroupmsgbymessageid:_e("history.group_anchor",Object.assign({gid:"group_ref"},en),ht,{defaults:Xt,required:["group_ref","anchor","reverse","limit","start_ms","end_ms"]}),getroommsgbymessageid:_e("history.room_anchor",Object.assign({rid:"room_ref"},en),ht,{defaults:Xt,required:["room_ref","anchor","reverse","limit","start_ms","end_ms"]}),getbroadcastmsgbymessageid:_e("history.broadcast_anchor",en,ht,{defaults:Xt,required:["anchor","reverse","limit","start_ms","end_ms"]}),getp2pmsgcount:_e("history.direct_count",Object.assign({ouid:"peer"},tn),{count:"total"},{defaults:$t,required:["peer","start_ms","end_ms"]}),getgroupmsgcount:_e("history.group_count",Object.assign({gid:"group_ref"},tn),{count:"total"},{defaults:$t,required:["group_ref","start_ms","end_ms"]}),getroommsgcount:_e("history.room_count",Object.assign({rid:"room_ref"},tn),{count:"total"},{defaults:$t,required:["room_ref","start_ms","end_ms"]}),getbroadcastmsgcount:_e("history.broadcast_count",tn,{count:"total"},{defaults:$t,required:["start_ms","end_ms"]}),getmsg:_e("message.get",{from:"sender",mid:"message_ref",type:"channel",xid:"target_ref"},{attrs:"extra",from:"sender",id:"sequence",mid:"message_ref",msg:"payload",mtime:"time_ms",mtype:"kind"},{required:["sender","message_ref","target_ref","channel"]}),delmsg:_e("message.revoke",{from:"sender",mid:"message_ref",type:"channel",xid:"target_ref"},null,{required:["sender","message_ref","target_ref","channel"]}),getunread:_e("unread.summary",{clear:"mark_read",gettime:"with_logout"},{group:"group_refs",logouttime:"logout_sec",p2p:"peers"},{defaults:{mark_read:!1},required:["mark_read"]}),getsession:_e("session.list",null,{group:"group_refs",p2p:"peers"}),cleanunread:_e("unread.clear"),setsessionread:_e("session.read",{category:"channel",read_seq:"through",xid:"target_ref"},null,{required:["channel","target_ref","through"]}),getp2punread:_e("unread.direct",{mtime:"since_ms",mtypes:"kinds",uids:"peers"},{ltime:"times",p2p:"counts"},{required:["peers"]}),getgroupunread:_e("unread.group",{gids:"group_refs",mtime:"since_ms",mtypes:"kinds"},{group:"counts",ltime:"times"},{required:["group_refs"]}),removesession:_e("session.remove",{oneway:"local_only",to:"peer"},null,{defaults:{local_only:!1},required:["peer","local_only"]}),getp2pconversationlist:_e("conversation.direct",{mtime:"since_ms",mtypes:"kinds"},{conversations:"peers",msgs:"last_items",unreads:"badges"}),getp2punreadconversationlist:_e("conversation.direct_unread",{mtime:"since_ms",mtypes:"kinds"},{conversations:"peers",msgs:"last_items",unreads:"badges"}),getgroupconversationlist:_e("conversation.group",{mtime:"since_ms",mtypes:"kinds"},{conversations:"group_refs",msgs:"last_items",unreads:"badges"}),getgroupunreadconversationlist:_e("conversation.group_unread",{mtime:"since_ms",mtypes:"kinds"},{conversations:"group_refs",msgs:"last_items",unreads:"badges"}),getunreadconversationlist:_e("conversation.unread",{clear:"mark_read",mtime:"since_ms",mtypes:"kinds"},{groupConversations:"group_refs",groupMsgs:"group_last",groupUnreads:"group_badges",p2pConversations:"peers",p2pMsgs:"peer_last",p2pUnreads:"peer_badges"},{defaults:{mark_read:!1},required:["mark_read"]})},Ur=new Set(["acheck","adddevice","addfriends","addoption","addprojectban","adminCommand","broadcastfile","closeRTCRoom","delfriends","filetoken","getfriends","getoption","getRTCRoomList","getRTCRoomMemberCount","getRTCRoomMembers","icheck","inviteUserIntoRTCRoom","isfriend","isfriends","isprojectban","kickoutFromRTCRoom","profanity","pullIntoRTCRoom","removedevice","removeoption","removeprojectban","sendfile","sendfiles","sendgroupfile","sendroomfile","setRTCRoomMicStatus","speech2text","speechtranslation","uploadfile","vcheck"]),Nr={"event.broadcast":!0,"event.direct":!0,"event.group":!0,"event.room":!0},Io={"event.kicked":!0,"event.room_removed":!0},Br="-9223372036854775808",Wn="9223372036854775807",Mo="-2147483648",Uo="2147483647";function et(R,g,m){return Object.assign({required:!!g,type:R},m||{})}function Ke(R,g){return et("integer",R,Object.assign({min:Br,max:Wn},g||{}))}function gt(R,g){return et("integer",R,Object.assign({min:Mo,max:Uo},g||{}))}function Ue(R,g){return Ke(R,Object.assign({min:"1"},g||{}))}function Ye(R,g){return Ke(R,Object.assign({min:"0"},g||{}))}function st(R,g){return gt(R,Object.assign({min:"0"},g||{}))}function Ee(R,g){return et("string",R,g)}function it(R){return et("boolean",R)}function ot(R,g,m){return et("array",R,Object.assign({element:g},m||{}))}function Bt(R,g,m,E){return et("map",R,Object.assign({key:g,value:m},E||{}))}function me(R){return Object.assign({sent_ms:Ke(!1),trace:Ee(!1)},R||{})}function ge(R,g){return{allowEmpty:!!(g&&g.allowEmpty),fields:R||{}}}var Fr=Ke(!1),No=gt(!1),Bo=st(!1),nn=Ke(!1),Fo=Ye(!1),Do=Ue(!1),ln=Ee(!1),Lo=et("string_or_bin",!1),pt=et("tuple8",!1);function Le(R,g){return ot(R,Do,g)}function nt(R,g){return ot(R,Fr,g)}function Ot(R,g){return ot(R,No,g)}function qo(R,g){return ot(R,ln,g)}function Hn(R){return Bt(R,"string",ln)}function qn(R){return Bt(R,"positive_decimal_int64",ln)}function jn(R){return Bt(R,"positive_decimal_int64",Bo)}function Ir(R){return Bt(R,"positive_decimal_int64",Fo)}function jo(R){return Bt(R,"positive_decimal_int64",pt)}function Vo(R){return Ke(R,{messageKind:!0})}function Dr(R){return Ke(R,{max:"255",min:"0"})}var rn={extra:Ee(!0,{maxBytes:65535}),kind:Vo(!0),message_ref:Ye(!0),payload:et("string_or_bin",!0,{maxBytes:65535})},on={cursor:Ke(!0),end_ms:Ye(!0),kinds:nt(!1),limit:st(!0),reverse:it(!0),start_ms:Ye(!0)},sn={anchor:Ue(!0),end_ms:Ye(!0),kinds:nt(!1),limit:st(!0),reverse:it(!0),start_ms:Ye(!0)},an={end_ms:Ye(!0),kinds:nt(!1),start_ms:Ye(!0)},Yn={"auth.login":me({auth_sec:Ye(!1),auth_ver:gt(!1,{enum:["2"]}),client_ver:Ee(!0,{nonEmpty:!0}),credential:Ee(!0,{nonEmpty:!0}),locale:Ee(!1),project:Ke(!0,{max:"4294967295",min:"1"}),props:Hn(!1),user:Ue(!0)}),"connection.close":me(),"system.time":me(),"connection.set_props":me({props:Hn(!0)}),"connection.get_props":me(),"system.debug":me({context:Ee(!0),entry:Ee(!0,{nonEmpty:!0})}),"presence.online":me({users:Le(!0,{minItems:1})}),"user.set_profile":me({private_data:Ee(!1),public_data:Ee(!1)}),"user.get_profile":me(),"user.get_public":me({users:Le(!0,{minItems:1})}),"user.set_locale":me({locale:Ee(!0)}),"storage.get":me({slot:Ee(!0)}),"storage.set":me({slot:Ee(!0),value:Ee(!0)}),"storage.delete":me({slot:Ee(!0)}),"blacklist.add":me({blocked_users:Le(!0,{minItems:1,uniqueInt64Max:100})}),"blacklist.remove":me({blocked_users:Le(!0,{minItems:1,uniqueInt64Max:100})}),"blacklist.list":me(),"group.add":me({group_ref:Ue(!0),members:Le(!0,{minItems:1})}),"group.remove":me({group_ref:Ue(!0),members:Le(!0,{minItems:1})}),"group.members":me({group_ref:Ue(!0),with_online:it(!1)}),"group.count":me({group_ref:Ue(!0),with_online:it(!1)}),"group.joined":me(),"group.set_profile":me({group_ref:Ue(!0),private_data:Ee(!1),public_data:Ee(!1)}),"group.get_profile":me({group_ref:Ue(!0)}),"group.get_public":me({group_ref:Ue(!0)}),"group.get_public_batch":me({group_refs:Le(!0,{minItems:1})}),"room.join":me({room_ref:Ue(!0)}),"room.leave":me({room_ref:Ue(!0)}),"room.join_batch":me({room_refs:Le(!0,{maxItems:100,minItems:1})}),"room.joined":me(),"room.members":me({room_ref:Ue(!0)}),"room.counts":me({room_refs:Le(!0,{minItems:1})}),"room.set_profile":me({avatar:Ee(!1),label:Ee(!1),private_data:Ee(!1),public_data:Ee(!1),room_ref:Ue(!0)}),"room.get_profile":me({room_ref:Ue(!0)}),"room.get_public":me({room_ref:Ue(!0)}),"room.get_public_batch":me({room_refs:Le(!0,{minItems:1})}),"room.last_messages":me({kinds:nt(!1)}),"message.send":me(Object.assign({recipient:Ue(!0)},rn,{checkParams:Ee(!1),strategyid:Ee(!1)})),"message.send_batch":me(Object.assign({recipients:Le(!0,{maxItems:100,minItems:1})},rn)),"message.send_group":me(Object.assign({group_ref:Ue(!0)},rn,{checkParams:Ee(!1),strategyid:Ee(!1)})),"message.send_room":me(Object.assign({room_ref:Ue(!0)},rn,{checkParams:Ee(!1),strategyid:Ee(!1)})),"moderation.check":me({checkParams:Ee(!1),payload:Ee(!0,{nonEmpty:!0}),strategyId:Ee(!1),zone:Ee(!1)}),"translation.run":me({filter_mode:Ee(!0,{enum:["off","stop","censor"]}),format:Ee(!0,{nonEmpty:!0}),from_locale:Ee(!1),input:Ee(!0,{nonEmpty:!0}),to_locale:Ee(!0)}),"history.direct":me(Object.assign({peer:Ue(!0)},on)),"history.group":me(Object.assign({group_ref:Ue(!0)},on)),"history.room":me(Object.assign({room_ref:Ue(!0)},on)),"history.broadcast":me(on),"history.direct_anchor":me(Object.assign({peer:Ue(!0)},sn)),"history.group_anchor":me(Object.assign({group_ref:Ue(!0)},sn)),"history.room_anchor":me(Object.assign({room_ref:Ue(!0)},sn)),"history.broadcast_anchor":me(sn),"history.direct_count":me(Object.assign({peer:Ue(!0)},an)),"history.group_count":me(Object.assign({group_ref:Ue(!0)},an)),"history.room_count":me(Object.assign({room_ref:Ue(!0)},an)),"history.broadcast_count":me(an),"message.get":me({channel:gt(!0,{enum:["1","2","3","4"]}),message_ref:Ke(!0),sender:Ue(!0),target_ref:Ye(!0)}),"message.revoke":me({channel:gt(!0,{enum:["1","2","3","4"]}),message_ref:Ke(!0),sender:Ue(!0),target_ref:Ye(!0)}),"unread.summary":me({mark_read:it(!0),with_logout:it(!1)}),"session.list":me(),"unread.clear":me(),"session.read":me({channel:gt(!0,{enum:["1","2","3","4","5"]}),target_ref:Ye(!0),through:Ue(!0)}),"unread.direct":me({kinds:nt(!1),peers:Le(!0,{minItems:1}),since_ms:Ye(!1)}),"unread.group":me({group_refs:Le(!0,{minItems:1}),kinds:nt(!1),since_ms:Ye(!1)}),"session.remove":me({local_only:it(!0),peer:Ue(!0)}),"conversation.direct":me({kinds:nt(!1),since_ms:Ye(!1)}),"conversation.direct_unread":me({kinds:nt(!1),since_ms:Ye(!1)}),"conversation.group":me({kinds:nt(!1),since_ms:Ye(!1)}),"conversation.group_unread":me({kinds:nt(!1),since_ms:Ye(!1)}),"conversation.unread":me({kinds:nt(!1),mark_read:it(!0),since_ms:Ye(!1)})},dt={first_ms:Ye(!0),items:ot(!0,pt),last_ms:Ye(!0),next:Ke(!0),size:st(!0)},un={message_ref:Ke(!0),time_ms:Ke(!0)},Ho={extra:Ee(!0),kind:Dr(!0),message_ref:Ke(!0),payload:et("string_or_bin",!0),sender:Ue(!0),sequence:Ke(!0),time_ms:Ke(!0)},Lr={"auth.login":ge({accepted:it(!0),telemetry_on:it(!1)}),"connection.close":ge(),"system.time":ge({server_ms:Ke(!0)}),"connection.set_props":ge(),"connection.get_props":ge({props:Hn(!0)}),"system.debug":ge(),"presence.online":ge({online_users:Le(!0)}),"user.set_profile":ge(),"user.get_profile":ge({private_data:Ee(!0),public_data:Ee(!0)}),"user.get_public":ge({profiles:qn(!0)}),"user.set_locale":ge({updated:it(!0)}),"storage.get":ge({value:Ee(!0)}),"storage.set":ge(),"storage.delete":ge(),"blacklist.add":ge(),"blacklist.remove":ge(),"blacklist.list":ge({blocked_users:Le(!0)}),"group.add":ge(),"group.remove":ge(),"group.members":ge({active_members:Le(!1),members:Le(!0)}),"group.count":ge({active_total:st(!1),total:st(!0)}),"group.joined":ge({group_refs:Le(!0)}),"group.set_profile":ge(),"group.get_profile":ge({private_data:Ee(!0),public_data:Ee(!0)}),"group.get_public":ge({public_data:Ee(!0)}),"group.get_public_batch":ge({profiles:qn(!0)}),"room.join":ge(),"room.leave":ge(),"room.join_batch":ge(),"room.joined":ge({room_refs:Le(!0)}),"room.members":ge({members:Le(!0)}),"room.counts":ge({totals:jn(!0)}),"room.set_profile":ge(),"room.get_profile":ge({private_data:Ee(!0),public_data:Ee(!0)}),"room.get_public":ge({public_data:Ee(!0)}),"room.get_public_batch":ge({profiles:qn(!0)}),"room.last_messages":ge({last_by_room:jo(!0)}),"message.send":ge(un),"message.send_batch":ge(un),"message.send_group":ge(un),"message.send_room":ge(un),"moderation.check":ge({decision:gt(!0),detected_locale:Ee(!0),filtered:Ee(!0),matches:qo(!1)}),"translation.run":ge({detected_locale:Ee(!0),from_locale:Ee(!0),input:Ee(!0),original:Ee(!0),output:Ee(!0),resolved_locale:Ee(!0),to_locale:Ee(!0),translated:Ee(!0)}),"history.direct":ge(dt),"history.group":ge(dt),"history.room":ge(dt),"history.broadcast":ge(dt),"history.direct_anchor":ge(dt),"history.group_anchor":ge(dt),"history.room_anchor":ge(dt),"history.broadcast_anchor":ge(dt),"history.direct_count":ge({total:st(!0)}),"history.group_count":ge({total:st(!0)}),"history.room_count":ge({total:st(!0)}),"history.broadcast_count":ge({total:st(!0)}),"message.get":ge(Ho,{allowEmpty:!0}),"message.revoke":ge(),"unread.summary":ge({group_refs:Le(!0),logout_sec:Ye(!1),peers:Le(!0)}),"session.list":ge({group_refs:Le(!0),peers:Le(!0)}),"unread.clear":ge(),"session.read":ge(),"unread.direct":ge({counts:jn(!0),times:Ir(!0)}),"unread.group":ge({counts:jn(!0),times:Ir(!0)}),"session.remove":ge(),"conversation.direct":ge({badges:Ot(!0),last_items:ot(!0,pt),peers:Le(!0)}),"conversation.direct_unread":ge({badges:Ot(!0),last_items:ot(!0,pt),peers:Le(!0)}),"conversation.group":ge({badges:Ot(!0),group_refs:Le(!0),last_items:ot(!0,pt)}),"conversation.group_unread":ge({badges:Ot(!0),group_refs:Le(!0),last_items:ot(!0,pt)}),"conversation.unread":ge({group_badges:Ot(!0),group_last:ot(!0,pt),group_refs:Le(!0),peer_badges:Ot(!0),peer_last:ot(!0,pt),peers:Le(!0)}),"control.ping":ge({ts:Ke(!1)})},Wo={from_locale:Ee(!0),original:Ee(!0),to_locale:Ee(!0),translated:Ee(!0)},fn={extra:Ee(!0,{maxBytes:65535}),kind:Dr(!0),message_ref:Ke(!0),payload:et("push_payload",!0),sender:Ue(!0),time_ms:Ke(!0)},Yo={"event.direct":Object.assign({recipient:Ue(!0)},fn),"event.group":Object.assign({group_ref:Ue(!0)},fn),"event.room":Object.assign({room_ref:Ue(!0)},fn),"event.broadcast":fn,"event.kicked":{},"event.room_removed":{room_ref:Ue(!0)}};function qr(R){return cn[R]||null}function Go(R){let g=Object.keys(cn);for(let m=0;m<g.length;m+=1){let E=cn[g[m]];if(E.uri===R)return{method:g[m],route:E}}return null}function wt(R){let g=String(R);if(!/^-?[0-9]+$/.test(g))return null;let m=g.charAt(0)==="-",E=(m?g.slice(1):g).replace(/^0+/,"")||"0";return m&&E!=="0"?"-"+E:E}function Gn(R){return typeof R=="number"?zo(R)?wt(R):null:typeof R=="bigint"||R instanceof _t.Int64Value||R&&typeof R=="object"&&typeof R.offset=="number"&&R.buffer&&typeof R.toString=="function"?wt(R.toString()):null}function zo(R){return Number.isSafeInteger?Number.isSafeInteger(R):typeof R=="number"&&isFinite(R)&&Math.floor(R)===R&&Math.abs(R)<=9007199254740991}function ut(R,g){let m=wt(R),E=wt(g);if(m===null||E===null)throw new Error("integer comparison requires decimal integers");if(m===E)return 0;let C=m.charAt(0)==="-",T=E.charAt(0)==="-";if(C!==T)return C?-1:1;let O=C?m.slice(1):m,P=T?E.slice(1):E,S;return O.length!==P.length?S=O.length<P.length?-1:1:S=O<P?-1:1,C?-S:S}function Mr(R){let g=0;for(let m=0;m<R.length;m+=1){let E=R.charCodeAt(m);if(E>=55296&&E<=56319){let C=R.charCodeAt(m+1);if(C<56320||C>57343)throw new Xe(200034,"string contains an unpaired surrogate");g+=4,m+=1}else{if(E>=56320&&E<=57343)throw new Xe(200034,"string contains an unpaired surrogate");E<=127?g+=1:E<=2047?g+=2:g+=3}}return g}function je(R,g){throw new Xe(200034,R+" "+g)}function Ko(R,g,m){let E=Gn(R);(E===null||ut(E,Br)<0||ut(E,Wn)>0)&&je(m,"must be a signed int64 integer"),g.min!==void 0&&ut(E,g.min)<0&&je(m,"is below the allowed range"),g.max!==void 0&&ut(E,g.max)>0&&je(m,"is above the allowed range"),g.enum&&g.enum.indexOf(E)===-1&&je(m,"is not an allowed value"),g.messageKind&&!(ut(E,"1")>=0&&ut(E,"39")<=0||ut(E,"51")>=0&&ut(E,"127")<=0)&&je(m,"must be in kind ranges [1,39] or [51,127]")}function Jo(R,g,m){if(g!=="string"){if(g==="positive_decimal_int64"){let E=wt(R);(E===null||E.charAt(0)==="-"||E==="0"||ut(E,Wn)>0)&&je(m,"must be a positive decimal int64 map key");return}je(m,"uses an unsupported map-key contract")}}function Qo(R,g){(!Array.isArray(R)||R.length!==8)&&je(g,"must be an 8-item message tuple"),rt(R[0],nn,g+"[0]"),rt(R[1],nn,g+"[1]"),rt(R[2],Fr,g+"[2]"),rt(R[3],nn,g+"[3]"),rt(R[4],et("boolean",!1),g+"[4]"),rt(R[5],Lo,g+"[5]"),rt(R[6],ln,g+"[6]"),rt(R[7],nn,g+"[7]")}function rt(R,g,m){if(R==null&&je(m,"must not be nil"),g.type==="integer"){Ko(R,g,m);return}if(g.type==="boolean"){typeof R!="boolean"&&je(m,"must be boolean");return}if(g.type==="string"){typeof R!="string"&&je(m,"must be a UTF-8 string"),g.nonEmpty&&R.length===0&&je(m,"must not be empty"),g.enum&&g.enum.indexOf(R)===-1&&je(m,"is not an allowed value"),g.maxBytes!==void 0&&Mr(R)>g.maxBytes&&je(m,"exceeds "+g.maxBytes+" UTF-8 bytes");return}if(g.type==="string_or_bin"){if(typeof R=="string"){g.maxBytes!==void 0&&Mr(R)>g.maxBytes&&je(m,"exceeds "+g.maxBytes+" UTF-8 bytes");return}let E=_t.getByteView(R);E||je(m,"must be a string or MsgPack bin value"),g.maxBytes!==void 0&&E.byteLength>g.maxBytes&&je(m,"exceeds "+g.maxBytes+" bytes");return}if(g.type==="array"){if(Array.isArray(R)||je(m,"must be an array"),g.minItems!==void 0&&R.length<g.minItems&&je(m,"must not be empty"),g.maxItems!==void 0&&R.length>g.maxItems&&je(m,"contains too many items"),R.forEach(function(E,C){rt(E,g.element,m+"["+C+"]")}),g.uniqueInt64Max!==void 0){let E={};R.forEach(function(C){E[Gn(C)]=!0}),Object.keys(E).length>g.uniqueInt64Max&&je(m,"contains too many distinct int64 items")}return}if(g.type==="map"){_t.isPlainMap(R)||je(m,"must be a map"),Object.keys(R).forEach(function(E){Jo(E,g.key,m+"."+E),rt(R[E],g.value,m+"."+E)});return}if(g.type==="tuple8"){Qo(R,m);return}if(g.type==="push_payload"){if(typeof R=="string"||_t.getByteView(R))return;Ft("Chat payload",R,Wo);return}je(m,"uses an unsupported value contract")}function Ft(R,g,m){_t.isPlainMap(g)||je(R,"body must be a map"),Object.keys(g).forEach(function(E){Object.prototype.hasOwnProperty.call(m,E)||je(R+"."+E,"is not defined by this contract")}),Object.keys(m).forEach(function(E){let C=m[E];if(!Object.prototype.hasOwnProperty.call(g,E)){C.required&&je(R+"."+E,"is required");return}rt(g[E],C,R+"."+E)})}function Xo(R,g){if(g==="trace"||g==="sent_ms"||Object.prototype.hasOwnProperty.call(R.defaults,g))return!0;let m=Yn[R.uri];return!!(m&&m[g]&&!m[g].required)}function $o(R,g){let m=Lr[R];if(!m)throw new Xe(200034,"unsupported Answer URI: "+R);m.allowEmpty&&_t.isPlainMap(g)&&Object.keys(g).length===0||(Ft(R+" Answer",g,m.fields),Zo(R,g))}function Zo(R,g){let m;if(R==="conversation.direct"||R==="conversation.direct_unread")m=["peers","badges","last_items"];else if(R==="conversation.group"||R==="conversation.group_unread")m=["group_refs","badges","last_items"];else if(R==="conversation.unread"){Vn(R,g,["group_refs","group_badges","group_last"]),Vn(R,g,["peers","peer_badges","peer_last"]);return}m&&Vn(R,g,m)}function Vn(R,g,m){let E=g[m[0]].length;for(let C=1;C<m.length;C+=1)g[m[C]].length!==E&&je(R+" Answer",m.join(", ")+" must have matching lengths")}function es(R,g){let m=Yo[R];if(!m)throw new Xe(200034,"unsupported Push URI: "+R);Ft(R+" Push",g,m)}function ts(R){Ft("control.error Answer",R,{reason:Ee(!0),status:gt(!0)})}function ns(R,g,m,E){let C=qr(R);if(!C)throw jr(R)?new Xe(200020,R+" is reserved and unavailable on the TLV Client port"):new Xe(20004,"unknown or unsupported TLV Client wire: "+R);if(!_t.isPlainMap(g))throw new Xe(200034,R+" request body must be a map");let T={};return Object.keys(g).forEach(function(O){let P;if(!(O==="trace_id"||O==="send_ts")){if(O==="trace"||O==="sent_ms")P=O;else if(Object.prototype.hasOwnProperty.call(C.request,O))P=C.request[O];else if(C.pass.indexOf(O)!==-1)P=O;else throw new Xe(200034,C.uri+" does not accept field "+O);if(Object.prototype.hasOwnProperty.call(T,P))throw new Xe(200034,C.uri+" received duplicate field mapping for "+P);E&&E.omitLegacyNil&&(g[O]===void 0||g[O]===null)&&Xo(C,P)||(T[P]=g[O])}}),Object.keys(C.defaults).forEach(function(O){Object.prototype.hasOwnProperty.call(T,O)||(T[O]=C.defaults[O])}),rs(T,m,C.uri),is(C,T),{payload:T,uri:C.uri}}function jr(R){return Ur.has(R)||typeof R=="string"&&R.indexOf("imclient_")===0}function rs(R,g,m){if(!g)return;let E=typeof g=="function"?g():g;if(E){if(!_t.isPlainMap(E))throw new Xe(200034,m+" request metadata must be a map");["trace","sent_ms"].forEach(function(C){if(E[C]!==void 0){if(Object.prototype.hasOwnProperty.call(R,C)&&R[C]!==E[C])throw new Xe(200034,m+" has conflicting "+C+" values");R[C]=E[C]}})}}function is(R,g){let m=Yn[R.uri];if(!m)throw new Xe(200034,"missing request schema for "+R.uri);if(Ft(R.uri+" request",g,m),R.uri==="auth.login"){let E=Object.prototype.hasOwnProperty.call(g,"auth_sec"),C=Object.prototype.hasOwnProperty.call(g,"auth_ver");if(E!==C)throw new Xe(200034,"auth.login requires auth_sec and auth_ver together");if(C&&Gn(g.auth_ver)!=="2")throw new Xe(200034,"auth.login auth_ver must be 2")}}function os(R){return Object.prototype.hasOwnProperty.call(Nr,R)}function ss(R){return Object.prototype.hasOwnProperty.call(Io,R)}Vr.exports={RELIABLE_PUSHES:Nr,REQUEST_SCHEMAS:Yn,RESPONSE_SCHEMAS:Lr,RESERVED_WIRES:Ur,ROUTES:cn,TLVContractError:Xe,getRoute:qr,getRouteByUri:Go,isOneWayPush:ss,isReliablePush:os,isReservedWire:jr,toWireRequest:ns,validateControlError:ts,validatePush:es,validateResponse:$o}});var Kn=Ge((Ta,Gr)=>{"use strict";var hn=Ln(),mt=Hr(),Et=Kt(),Yr=ct(),as=20*1e3,us=30*1e3,fs=30*1e3,cs=10*1e3,ls=30*1e3,zn=class{constructor(g){let m=g||{};if(typeof m.endpoint!="string"||!/^wss?:\/\//i.test(m.endpoint))throw new Error("tlv-v1 requires an explicit ws:// or wss:// endpoint URL");this._endpoint=m.endpoint,this._webSocketFactory=m.webSocketFactory||hs,this._legacyMsgPack=m.legacyMsgPack||Yr.MsgPack,this._legacyMsgOptions=m.legacyMsgOptions,this._requestMetadata=m.requestMetadata,this._connectionTimeout=m.connectionTimeout||us,this._requestTimeout=m.requestTimeout||as,this._heartbeatIdleMs=m.heartbeatIdleMs||fs,this._heartbeatTimeoutMs=m.heartbeatTimeoutMs||cs,this._dedupTtlMs=Math.max(m.pushDedupTtlMs||ls,20*1e3),this._listeners={},this._pending=new Map,this._receivedMessages=new Map,this._nextSequence=1,this._socket=null,this._connectionGeneration=0,this._state="idle",this._authenticated=!1,this._connectionTimer=0,this._heartbeatTimer=0,this._heartbeatPending=!1,this._lastActivity=0,this._incomingQueue=Promise.resolve(),this._protocolClosing=!1,this._destroyed=!1,this.processor=null}on(g,m){return typeof m!="function"?this:(this._listeners[g]||(this._listeners[g]=[]),this._listeners[g].push(m),this)}off(g,m){let E=this._listeners[g];return E?(this._listeners[g]=E.filter(function(C){return C!==m}),this):this}emit(g){let m=this._listeners[g]||[],E=Array.prototype.slice.call(arguments,1),C=this;m.slice().forEach(function(T){T.apply(C,E)})}connect(){if(this._destroyed||this._state==="connecting"||this._state==="open"||this._state==="closing")return;let g=this._connectionGeneration+1;this._connectionGeneration=g,this._nextSequence=1,this._receivedMessages.clear(),this._incomingQueue=Promise.resolve(),this._state="connecting",this._protocolClosing=!1;let m;try{m=this._webSocketFactory(this._endpoint)}catch(E){this._state="closed",this.emit("error",yt("cannot create WebSocket: "+E.message)),this.emit("close");return}if(!m||typeof m.send!="function"||typeof m.close!="function"){this._state="closed",this.emit("error",yt("webSocketFactory returned an invalid socket")),this.emit("close");return}this._socket=m;try{m.binaryType="arraybuffer"}catch{}m.onopen=this._onOpen.bind(this,m,g),m.onmessage=this._onMessage.bind(this,m,g),m.onerror=this._onError.bind(this,m,g),m.onclose=this._onClose.bind(this,m,g),this._connectionTimer=setTimeout(this._onConnectionTimeout.bind(this,m,g),this._connectionTimeout)}close(){this._clearConnectionTimeout(),this._stopHeartbeat(),this._authenticated=!1,(this._state==="open"||this._state==="connecting")&&(this._state="closing");let g=this._socket;if(!g){this._finalizeClose();return}try{g.close()}catch{this._finalizeClose()}}destroy(){if(this._destroyed)return;this._destroyed=!0,this._clearConnectionTimeout(),this._stopHeartbeat(),this._authenticated=!1;let g=this._socket;if(g)try{g.close()}catch{}this._finalizeClose(),this._listeners={},this._receivedMessages.clear()}markAuthenticated(){this._destroyed||this._state!=="open"||(this._authenticated=!0,this._lastActivity=Date.now(),this._startHeartbeat())}sendQuest(g,m,E){try{let C=this._decodeLegacyPayload(g&&g.payload),T=mt.toWireRequest(g&&g.method,C.payload,this._requestMetadata,{omitLegacyNil:C.legacyEncoded});this._request(T.uri,T.payload,E,{onError:function(O){m&&m(Wr(O))},onSuccess:function(O){m&&m({_tlvPayload:Dt(O),mtype:2,ss:0})}})}catch(C){m&&m(Wr(C))}}_decodeLegacyPayload(g){if(g==null)return{legacyEncoded:!1,payload:{}};if(Et.isPlainMap(g))return{legacyEncoded:!1,payload:g};try{let m=this._legacyMsgPack.decode(g,this._legacyMsgOptions);if(!Et.isPlainMap(m))throw new Error("legacy request payload is not a map");return{legacyEncoded:!0,payload:m}}catch(m){throw new mt.TLVContractError(200034,"cannot decode local request payload: "+m.message)}}_onOpen(g,m){g!==this._socket||m!==this._connectionGeneration||this._state!=="connecting"||this._destroyed||(this._clearConnectionTimeout(),this._state="open",this._lastActivity=Date.now(),this.emit("connect"))}_onMessage(g,m,E){if(g!==this._socket||m!==this._connectionGeneration||this._state!=="open"||this._destroyed)return;let T=E&&(typeof E=="object"||typeof E=="function")&&"data"in E?E.data:E;this._incomingQueue=this._incomingQueue.then(function(){return ds(T)}).then(this._handleIncomingBytes.bind(this,g,m)).catch(this._handleIncomingFailure.bind(this,g,m))}_onError(g,m,E){if(g!==this._socket||m!==this._connectionGeneration||this._destroyed)return;let C=E&&E.message?E.message:"WebSocket transport error";this.emit("error",yt(C))}_onClose(g,m){g!==this._socket||m!==this._connectionGeneration||this._finalizeClose()}_onConnectionTimeout(g,m){if(this._connectionTimer=0,g!==this._socket||m!==this._connectionGeneration||this._state!=="connecting"||this._destroyed)return;let E=yt("WebSocket connection timed out after "+this._connectionTimeout+" ms");try{this.emit("error",E)}finally{if(g===this._socket&&m===this._connectionGeneration&&!this._destroyed&&this._state!=="closed"){this._state="closing";try{g.close()}catch{}g===this._socket&&m===this._connectionGeneration&&this._state!=="closed"&&this._finalizeClose()}}}_clearConnectionTimeout(){this._connectionTimer&&(clearTimeout(this._connectionTimer),this._connectionTimer=0)}_handleIncomingBytes(g,m,E){if(g!==this._socket||m!==this._connectionGeneration||this._state!=="open"||this._destroyed)return;this._lastActivity=Date.now();let C=hn.decodeFrame(E);if(C.mt==="2"){this._handleAnswer(C);return}if(C.mt==="1"){this._handleReliablePush(C);return}this._handleOneWayPush(C)}_handleIncomingFailure(g,m,E){g!==this._socket||m!==this._connectionGeneration||this._destroyed||this._protocolFailure(E)}_handleAnswer(g){if(g.uri==="control.ack")throw new Error("Gate must not send control.ack to a Client");let m=this._pending.get(g.sequence);if(m){if(g.uri==="control.error"){mt.validateControlError(g.payload),this._completePending(g.sequence,!1,{reason:g.payload.reason,status:Number(g.payload.status)});return}if(g.uri!==m.uri)throw new Error("Answer URI does not match pending request URI");mt.validateResponse(g.uri,g.payload),this._completePending(g.sequence,!0,g.payload)}}_handleReliablePush(g){if(!mt.isReliablePush(g.uri))throw new Error('Gate sent an unsupported mt="1" Quest URI: '+g.uri);mt.validatePush(g.uri,g.payload);let m=String(g.payload.message_ref),E=this._isDuplicateMessage(m);if(this._sendFrame(g.sequence,"2","control.ack",{}),E)return;let C={method:g.uri,payload:Dt(g.payload)};this._rememberMessage(m),this._dispatchPush(C)}_handleOneWayPush(g){if(!mt.isOneWayPush(g.uri))throw new Error('Gate sent an unsupported mt="0" URI: '+g.uri);mt.validatePush(g.uri,g.payload);let m={method:g.uri,payload:Dt(g.payload)};g.uri==="event.kicked"&&(this._authenticated=!1,this._stopHeartbeat()),this._dispatchPush(m)}_dispatchPush(g){if(!this.processor||typeof this.processor.service!="function")return;let m=Et.getByteView(g.payload.payload);this.processor.service({_tlvBinaryPayload:!!m,_tlvPayload:g.payload,flag:1,method:g.method})}_request(g,m,E,C){if(this._destroyed||this._state!=="open"||!this._socket){C.onError(yt("invalid WebSocket connection"));return}if(!this._authenticated&&g!=="auth.login"&&g!=="control.ping"){C.onError({status:200022,reason:"authentication is required before "+g});return}if(this._authenticated&&g==="auth.login"){C.onError({status:200023,reason:"auth.login cannot be sent twice on one connection"});return}let T=this._allocateSequence(),O=typeof E=="number"&&E>0?E:this._requestTimeout,P={handlers:C,timer:setTimeout(this._onRequestTimeout.bind(this,T),O),uri:g};this._pending.set(T,P);try{this._sendFrame(T,"1",g,m)}catch(S){this._pending.delete(T),clearTimeout(P.timer),C.onError(dn(S))}}_onRequestTimeout(g){let m=this._pending.get(g);m&&(this._pending.delete(g),m.handlers.onError({status:200999,reason:"request timeout"}))}_completePending(g,m,E){let C=this._pending.get(g);C&&(this._pending.delete(g),clearTimeout(C.timer),m?C.handlers.onSuccess(E):C.handlers.onError(E))}_allocateSequence(){for(let g=0;g<hn.MAX_SEQUENCE;g+=1){let m=this._nextSequence;if(this._nextSequence=m===hn.MAX_SEQUENCE?1:m+1,!this._pending.has(m))return m}throw new Error("all TLV request sequences are pending")}_sendFrame(g,m,E,C){if(this._destroyed||this._state!=="open"||!this._socket)throw yt("invalid WebSocket connection");let T=hn.encodeFrame(g,m,E,C),O=T.buffer.slice(T.byteOffset,T.byteOffset+T.byteLength);this._socket.send(O),this._lastActivity=Date.now()}_startHeartbeat(){this._stopHeartbeat(),this._heartbeatTimer=setInterval(this._heartbeatTick.bind(this),1e3)}_stopHeartbeat(){this._heartbeatTimer&&(clearInterval(this._heartbeatTimer),this._heartbeatTimer=0),this._heartbeatPending=!1}_heartbeatTick(){!this._authenticated||this._heartbeatPending||this._state!=="open"||Date.now()-this._lastActivity<this._heartbeatIdleMs||(this._heartbeatPending=!0,this._request("control.ping",{},this._heartbeatTimeoutMs,{onError:this._onHeartbeatError.bind(this),onSuccess:this._onHeartbeatAnswer.bind(this)}))}_onHeartbeatAnswer(g){this._heartbeatPending=!1,Et.isPlainMap(g)||this._protocolFailure(new Error("control.ping Answer body must be a map"))}_onHeartbeatError(g){this._heartbeatPending=!1,this._protocolFailure(new Error("control.ping failed: "+dn(g).reason))}_isDuplicateMessage(g){this._expireReceivedMessages();let m=this._receivedMessages.get(g);return m!==void 0&&m>Date.now()}_rememberMessage(g){this._receivedMessages.set(g,Date.now()+this._dedupTtlMs)}_expireReceivedMessages(){let g=Date.now();this._receivedMessages.forEach(function(m,E){m<=g&&this._receivedMessages.delete(E)},this)}_protocolFailure(g){if(this._protocolClosing||this._state==="closed")return;this._protocolClosing=!0;let m=dn(g);this.emit("error",yt("TLV protocol error: "+m.reason));let E=this._socket;if(!E){this._finalizeClose();return}this._state="closing";try{E.close(1002,"TLV protocol error")}catch{this._finalizeClose()}}_finalizeClose(){if(this._state==="closed")return;this._state="closed",this._clearConnectionTimeout(),this._socket=null,this._authenticated=!1,this._stopHeartbeat();let g=Array.from(this._pending.values());this._pending.clear(),g.forEach(function(m){clearTimeout(m.timer),m.handlers.onError(yt("WebSocket connection closed"))}),this.emit("close")}};function hs(R){let g=typeof WebSocket<"u"?WebSocket:typeof globalThis<"u"?globalThis.WebSocket:void 0;if(typeof g!="function")throw new Error("WebSocket is unavailable; provide options.webSocketFactory");return new g(R)}function ds(R){if(typeof R=="string")return Promise.reject(new Error("WebSocket text messages are forbidden by TLV v1"));let g=Et.getByteView(R);if(g)return Promise.resolve(g);if(R&&typeof R.arrayBuffer=="function"){let m;try{m=R.arrayBuffer()}catch(E){return Promise.reject(E)}return Promise.resolve(m).then(function(E){let C=Et.getByteView(E);if(!C)throw new Error("WebSocket Blob did not resolve to binary data");return C})}return Promise.reject(new Error("WebSocket message is not binary data"))}function dn(R){return R&&typeof R.status=="number"?{reason:typeof R.reason=="string"?R.reason:R.message||String(R.status),status:R.status}:{reason:R&&R.message?R.message:String(R||"unknown error"),status:200999}}function yt(R){return{reason:R,status:200999}}function Wr(R){let g=dn(R);return{_tlvPayload:{reason:g.reason,status:g.status},mtype:2,ss:1}}function Dt(R){if(R instanceof Et.Int64Value)return new Yr.Int64(R.toString());if(Array.isArray(R))return R.map(Dt);if(Et.isPlainMap(R)){let g={};return Object.keys(R).forEach(function(m){g[m]=Dt(R[m])}),g}return R}Gr.exports=zn});var pn=Ge((Pa,Kr)=>{"use strict";var ps={close:!0,constructor:!0,destroy:!0,emit:!0,listenerCount:!0,off:!0,on:!0,removeEvent:!0,startAutoReconnect:!0};function gs(R,g){let m={};return Object.getOwnPropertyNames(g).forEach(function(E){if(ps[E]||E.charAt(0)==="_")return;let C=g[E];if(typeof C!="function")return;let T=E==="login"?2:C.length-1;T<0||Object.defineProperty(m,E,{configurable:!1,enumerable:!0,writable:!1,value:function(){let O=Array.prototype.slice.call(arguments);if(E==="login"){if(O.length>3)return Promise.reject(new TypeError("promises.login(uid, credential, timeout?)"));let S=O.length>2?O[2]:void 0;return O.length=2,new Promise(function(U,N){O.push(function(D,L){if(D instanceof Error)N(D);else if(D)U({accepted:!0,errorCode:L||0});else{let q=new Error("RTM login rejected ("+String(L)+")");q.code=L,q.status=L,N(q)}},S),zr(R,E,O,N)})}if(O.length>T)return Promise.reject(new TypeError("Do not pass a callback to promises."+E+"()"));let P=E==="textCheck"&&O.length===2&&typeof O[1]=="number"?2:T;for(;O.length<P;)O.push(void 0);return new Promise(function(S,U){O.push(function(N,D){N?U(N):S(D)}),zr(R,E,O,U)})}})}),Object.freeze(m)}function zr(R,g,m,E){try{R[g].apply(R,m)}catch(C){E(C)}}Kr.exports=gs});var gn=Ge((Aa,Xr)=>{"use strict";function _s(R){if(typeof R!="string"||R.length===0||R!==R.trim()||/[\s\\/?#@%]/.test(R))return!1;let g,m;if(R.charAt(0)==="["){let E=R.indexOf("]");if(E<0)return!1;g=R.slice(0,E+1);let C=R.slice(E+1);if(C){if(!/^:\d+$/.test(C))return!1;m=C.slice(1)}if(!/^\[[0-9a-f:.]+\]$/i.test(g))return!1}else{let E=R.indexOf(":");if(E>=0){if(R.indexOf(":",E+1)>=0||(g=R.slice(0,E),m=R.slice(E+1),!/^\d+$/.test(m)))return!1}else g=R}if(!g||m!==void 0&&(Number(m)<1||Number(m)>65535))return!1;if(typeof URL!="function")return ms(g);try{let E=new URL("ws://"+R);if(E.protocol!=="ws:"||E.username||E.password||E.pathname!=="/"||E.search||E.hash||!E.hostname)return!1;if(g.charAt(0)==="[")return E.hostname.charAt(0)==="[";let C=E.hostname.replace(/\.$/,"");return!C||C.length>253?!1:C.split(".").every(function(T){return T.length>0&&T.length<=63&&/^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i.test(T)})}catch{return!1}}function ms(R){if(R.charAt(0)==="[")return ys(R.slice(1,-1));let g=R.replace(/\.$/,"");return!g||g.length>253?!1:/^[0-9.]+$/.test(g)?Qr(g):g.split(".").every(function(m){return m.length>0&&m.length<=63&&/^[a-z0-9\u0080-\uFFFF](?:[a-z0-9\u0080-\uFFFF-]*[a-z0-9\u0080-\uFFFF])?$/i.test(m)})}function Qr(R){let g=R.split(".");return g.length===4&&g.every(function(m){return/^\d{1,3}$/.test(m)&&Number(m)<=255})}function ys(R){if(!R||R.indexOf(":")<0||R.indexOf(":::")>=0)return!1;if(R.indexOf(".")>=0){let E=R.lastIndexOf(":");if(E<0||!Qr(R.slice(E+1)))return!1;R=R.slice(0,E)+":0:0"}let g=R.indexOf("::");if(g>=0){if(R.indexOf("::",g+2)>=0)return!1;let E=R.slice(0,g).split(":").filter(Boolean),C=R.slice(g+2).split(":").filter(Boolean);return E.length+C.length<8&&E.concat(C).every(Jr)}let m=R.split(":");return m.length===8&&m.every(Jr)}function Jr(R){return/^[0-9a-f]{1,4}$/i.test(R)}function Es(R){if(typeof R!="string")return R;let g=/^(\[[^\]]+\]|[^:]+):13325$/.exec(R);return g?g[1]+":13321":R}Xr.exports={isValidFpnnEndpoint:_s,normalizeFpnnEndpoint:Es}});var Jn=Ge((Sa,$r)=>{"use strict";var{isValidFpnnEndpoint:bs,normalizeFpnnEndpoint:ws}=gn();function vs(R){let g=Object.assign({},R||{});if(g.protocol===void 0&&(g.protocol="fpnn"),g.protocol!=="fpnn"&&g.protocol!=="tlv-v1")throw new Error('options.protocol must be "fpnn" or "tlv-v1"');if(g.protocol==="fpnn"){let m=g.ssl_endpoint!==void 0,E=m?g.ssl_endpoint:ws(g.endpoint);if(!bs(E))throw new Error("FPNN requires options.endpoint or options.ssl_endpoint as host[:port], without a URL scheme or path");m||(g.endpoint=E)}else{let m=g.tlvEndpoint||g.tlv_endpoint;if(!m&&typeof g.endpoint=="string"&&/^wss?:\/\//i.test(g.endpoint)&&(m=g.endpoint),!m&&typeof g.ssl_endpoint=="string"&&/^wss?:\/\//i.test(g.ssl_endpoint)&&(m=g.ssl_endpoint),typeof m!="string"||!/^wss?:\/\//i.test(m))throw new Error("tlv-v1 requires options.tlvEndpoint as the deployment-provided ws:// or wss:// URL");g.tlvEndpoint=m}return g}$r.exports={normalizeClientOptions:vs}});var Ut=Ge((ka,ai)=>{"use strict";var G=ct(),Rs=Cn(),Cs=Kn(),Os=pn(),{fpnn:De,md5:Ts}=Rt(),{normalizeFpnnEndpoint:Ps}=gn(),{normalizeClientOptions:As}=Jn();function Ss(R){let g="ws://";return this._ssl&&(g="wss://"),g+R+"/service/websocket"}function ti(R){let g=De.FPConfig.ERROR_CODE;return R===g.FPNN_EC_CORE_INVALID_CONNECTION||R===g.FPNN_EC_CORE_CONNECTION_CLOSED||R===g.FPNN_EC_CORE_UNKNOWN_ERROR||R===G.ERROR_CODE.RTM_EC_API_FREQUENCY_LIMITED||R===G.ERROR_CODE.RTM_EC_UNKNOWN_ERROR}function ni(R,g){return!R&&!ti(g)}function ks(R,g){if(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=0),this._checkLastPingTimerID&&(clearInterval(this._checkLastPingTimerID),this._checkLastPingTimerID=0),this._baseClient!=null){let U=this._baseClient;this._baseClient=null,U.destroy()}this._protocol==="tlv-v1"?this._baseClient=new Cs({endpoint:this._tlvEndpoint,heartbeatIdleMs:this._tlvHeartbeatIdleMs,heartbeatTimeoutMs:this._tlvHeartbeatTimeoutMs,connectionTimeout:this._connectionTimeout,legacyMsgOptions:this._msgOptions,pushDedupTtlMs:this._pushDedupTtlMs,requestMetadata:this._requestMetadata,requestTimeout:this._requestTimeout,webSocketFactory:this._webSocketFactory}):this._baseClient=new De.FPClient({endpoint:Ss.call(this,this._endpoint),autoReconnect:!1,connectionTimeout:this._connectionTimeout,platformImpl:this._platformImpl});let m=this._baseClient,E=this,C=!1,T=!1,O=!1,P=!1;this._protocol==="tlv-v1"&&(this._canReconnect=this._autoReconnect);function S(U,N){O||(O=!0,R&&R(U,N))}m.on("close",function(){m===E._baseClient&&!T&&!P&&(P=!0,S(!1,De.FPConfig.ERROR_CODE.FPNN_EC_CORE_INVALID_CONNECTION),E._protocol==="tlv-v1"&&ri.call(E))}),m.on("error",function(U){m===E._baseClient&&(T||tt.call(E,U),C||S(!1,De.FPConfig.ERROR_CODE.FPNN_EC_CORE_INVALID_CONNECTION))}),m.on("connect",function(){m===E._baseClient&&(C||(C=!0,E._requireClose=!1,xs.call(E,function(U,N){if(U)T=!0;else if(E._protocol==="tlv-v1"&&ni(U,N))E._canReconnect=!1;else if(E._protocol==="tlv-v1"&&!P&&m===E._baseClient){S(U,N),m.close();return}S(U,N)},g)))}),m.processor=this._processor,m.connect()}function xs(R,g){let m=this._baseClient;if(!m){R&&R(!1,De.FPConfig.ERROR_CODE.FPNN_EC_CORE_INVALID_CONNECTION);return}let E={pid:this._pid,uid:this._uid,token:this._token,version:this._clientVersion||"WebSocket_"+G.SDK_VERSION};this._attrs&&(E.attrs=this._attrs),this._protocol==="tlv-v1"&&(this._authSec!==void 0&&(E.ts=this._authSec),this._authVer!==void 0&&(E.authv=this._authVer),this._locale!==void 0&&(E.lang=this._locale));let C={flag:1,method:"auth",payload:G.MsgPack.encode(E,this._msgOptions)},T=this;fe.call(this,m,C,function(O,P){if(m!==T._baseClient)return;let S=P&&(T._protocol==="tlv-v1"?P.accepted:P.ok);if(S){T._reconnectTimeout&&(clearTimeout(T._reconnectTimeout),T._reconnectTimeout=0),T._reconnectCount=0,T._reconnectInterval=0,T._canReconnect=!0,m.on("close",function(){m===T._baseClient&&ri.call(T)}),m.on("error",function(N){m===T._baseClient&&tt.call(T,N)}),T._protocol==="tlv-v1"?m.markAuthenticated():(T._lastPingTime=parseInt(Date.now()/1e3),T._checkLastPingTimerID=setInterval(function(){parseInt(Date.now()/1e3)-T._lastPingTime>=T._maxPingIntervalSeconds&&(tt.call(T,new De.FPError(De.FPConfig.ERROR_CODE.FPNN_EC_CORE_CONNECTION_CLOSED,Error("Close connection for no ping, start reconnect"))),T.startAutoReconnect())},T._maxPingIntervalSeconds*1e3/2)),R&&R(!0,De.FPConfig.ERROR_CODE.FPNN_EC_OK);return}let U=!1;if(P&&!S){let N=T._protocol==="tlv-v1"?G.ERROR_CODE.RTM_EC_INVALID_AUTH_TOEKN:De.FPConfig.ERROR_CODE.FPNN_EC_OK;R&&R(!1,N),T._protocol==="tlv-v1"&&tt.call(T,new De.FPError(N,new Error("Gate rejected auth.login (accepted=false)")))}O&&(R&&R(!1,O.code),tt.call(T,O),U=T._protocol==="tlv-v1"?ti(O.code):!!T._reconnectTimeout),U||(T._reconnectTimeout&&(clearTimeout(T._reconnectTimeout),T._reconnectTimeout=0),T._reconnectCount=0,T._reconnectInterval=0)},g)}function ri(){if(this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=0),this._checkLastPingTimerID&&(clearInterval(this._checkLastPingTimerID),this._checkLastPingTimerID=0),this._requireClose){this.emit("SessionClosed",De.FPConfig.ERROR_CODE.FPNN_EC_OK),this._reconnectCount=0,this._reconnectInterval=0,this._canReconnect=!1;return}if(!this._autoReconnect){this.emit("SessionClosed",De.FPConfig.ERROR_CODE.FPNN_EC_CORE_UNKNOWN_ERROR),this._reconnectCount=0,this._reconnectInterval=0,this._canReconnect=!1;return}tt.call(this,new De.FPError(De.FPConfig.ERROR_CODE.FPNN_EC_CORE_UNKNOWN_ERROR,new Error("connection closed, requireClose: "+this._requireClose))),ii.call(this)}function ii(){if(this._requireClose||!this._canReconnect||this._reconnectTimeout)return;let R=0;this._reconnectCount>=this._regressiveStrategy.startConnectFailedCount&&(R=this._reconnectInterval+this._regressiveStrategy.maxIntervalSeconds*1e3/this._regressiveStrategy.linearRegressiveCount,R>this._regressiveStrategy.maxIntervalSeconds*1e3&&(R=this._regressiveStrategy.maxIntervalSeconds*1e3),this._reconnectInterval=R),this._reconnectCount+=1;let g=this._reconnectCount,m=this;this._reconnectTimeout=setTimeout(function(){m._reconnectTimeout=0;let E=m._protocol==="tlv-v1"?void 0:R;m.login(m._uid,m._token,function(C,T){T==De.FPConfig.ERROR_CODE.FPNN_EC_OK?C?(m.emit("ReloginCompleted",!0,!1,De.FPConfig.ERROR_CODE.FPNN_EC_OK,g),tt.call(m,new De.FPError(De.FPConfig.ERROR_CODE.FPNN_EC_OK,new Error("relogin successfully, reconnectCount: "+g))),m._reconnectCount=0,m._reconnectInterval=0):(m.emit("ReloginCompleted",!1,!1,G.ERROR_CODE.RTM_EC_INVALID_AUTH_TOEKN,g),m.emit("SessionClosed",G.ERROR_CODE.RTM_EC_INVALID_AUTH_TOEKN),tt.call(m,new De.FPError(G.ERROR_CODE.RTM_EC_UNKNOWN_ERROR,new Error("relogin fail, token error, reconnectCount: "+g))),m._reconnectCount=0,m._reconnectInterval=0,m._canReconnect=!1):m._protocol==="tlv-v1"&&ni(C,T)?(m.emit("ReloginCompleted",!1,!1,T,g),m.emit("SessionClosed",T),tt.call(m,new De.FPError(T,new Error("relogin terminal auth failure, errorCode: "+T+", reconnectCount: "+g))),m._reconnectCount=0,m._reconnectInterval=0,m._canReconnect=!1):(m.emit("ReloginCompleted",!1,!0,T,g),m._protocol!=="tlv-v1"&&ii.call(m),tt.call(m,new De.FPError(G.ERROR_CODE.RTM_EC_UNKNOWN_ERROR,new Error("relogin fail, errorCode: "+T+", reconnectCount: "+g))))},E)},R)}function tt(R){this.emit("ErrorRecorder",R)}function Zr(R){return this._md5?this._md5(R).toUpperCase():Ts(R).toUpperCase()}function Qn(R,g,m,E,C){let T=this;(!m||m.toString()=="0")&&(m=si.call(this)),oi.call(T,R,function(O,P){if(O){E&&E({mid:m,error:O},null);return}let S=P.token,U=P.endpoint,N=null;if(g!=null&&g.name!==void 0){let L=g.name.lastIndexOf(".");L!=-1&&(N=g.name.slice(L+1))}if(!S||!U){E&&E({mid:m,error:new De.FPError(G.ERROR_CODE.RTM_EC_UNKNOWN_ERROR,new Error(JSON.stringify(P)))},null);return}let D=new FileReader;D.onload=function(L){let q=Buffer.from(L.target.result);if(console.log("content:"),console.log(q.length),!q){E&&E({mid:m,error:new De.FPError(G.ERROR_CODE.RTM_EC_UNKNOWN_ERROR,new Error("no file content!"))},null);return}let H=Zr.call(T,q).toLowerCase(),V=Zr.call(T,H+":"+S).toLowerCase(),K=T._endpoint.split(":");var Q="ws://fileproxy-"+K[0]+":13461/service/websocket";T._ssl&&(Q="wss://fileproxy-"+K[0]+":13462/service/websocket");let Z=new De.FPClient({endpoint:Q,autoReconnect:!1,connectionTimeout:C,platformImpl:T._platformImpl});Z.on("close",function(){}),Z.on("error",function(ie){let se=G.ERROR_CODE.RTM_EC_UNKNOWN_ERROR;ie.code!==void 0&&(se=ie.code),tt.call(T,new De.FPError(se,ie))}),Z.on("connect",function(){let ie={token:S,sign:V,ext:N,file:q,endpoint:U};for(let se in R)ie[se]=R[se];Is.call(T,Z,ie,m,E,C)}),Z.connect()},D.readAsArrayBuffer(g)})}function oi(R,g,m){let E={};for(let T in R)T!="mtype"&&(E[T]=R[T]);let C={flag:1,method:"filetoken",payload:G.MsgPack.encode(E,this._msgOptions)};fe.call(this,this._baseClient,C,g,m)}function Is(R,g,m,E,C){let T={pid:this._pid,from:this._uid,mid:m,endpoint:g.endpoint};for(let P in g){if(P=="sign"){T.attrs=JSON.stringify({rtm:{sign:g.sign,ext:g.ext}});continue}P!="ext"&&P!="cmd"&&(T[P]=g[P])}let O={flag:1,method:g.cmd,payload:G.MsgPack.encode(T,this._msgOptions)};fe.call(this,R,O,function(P,S){if(R.destroy(),P){E&&E({mid:T.mid,error:P},null);return}S.mtime!==void 0&&(S.mtime=new G.Int64(""+S.mtime)),E&&E(null,{mid:T.mid,payload:S})},C)}function si(){++this._midSeq>=999&&(this._midSeq=0);let R=this._midSeq.toString();return this._midSeq<100&&(R="0"+R),this._midSeq<10&&(R="0"+R),new G.Int64(Date.now().toString()+R)}function _n(R){return this._protocol==="tlv-v1"?R??0:!R||R.toString()=="0"?si.call(this):R}function ei(R,g,m){let E=typeof R=="boolean";return E?typeof g=="function"&&m===void 0&&(m=g,g=void 0):typeof g=="function"&&m===void 0?(m=g,g=R):g===void 0&&(typeof R=="function"&&m===void 0?m=R:R!==void 0&&(g=R)),{value:E?R:void 0,provided:E,timeout:g,callback:m}}function Xn(R,g){if(!g)return new De.FPError(G.ERROR_CODE.RTM_EC_UNKNOWN_ERROR,Error("data is null"));if(g instanceof Error){let m=G.ERROR_CODE.RTM_EC_UNKNOWN_ERROR;return g.code!==void 0&&(m=g.code),new De.FPError(m,g)}if(R){if(g.hasOwnProperty("code")&&g.hasOwnProperty("ex"))return new De.FPError(g.code,new Error(g.ex));if(g.hasOwnProperty("status")&&g.hasOwnProperty("reason")){let m=new De.FPError(g.status,new Error(g.reason));return m.status=g.status,m.reason=g.reason,m}}return null}function fe(R,g,m,E,C=!1){let T=this;if(!R){m&&m(new De.FPError(De.FPConfig.ERROR_CODE.FPNN_EC_CORE_INVALID_CONNECTION,Error("invalid connection")),null);return}R.sendQuest(g,function(O){if(!m)return;let P=null,S=!1;if(O&&Object.prototype.hasOwnProperty.call(O,"_tlvPayload")){if(O.mtype==2&&(S=O.ss!=0),P=Xn.call(T,S,O._tlvPayload),P){m&&m(P,null);return}m&&m(null,O._tlvPayload);return}if(O&&O.payload){let U=null;if(C?U=G.MsgPack.decode(O.payload,T._binaryOptions):U=G.MsgPack.decode(O.payload,T._msgOptions),O.mtype==2&&(S=O.ss!=0),P=Xn.call(T,S,U),P){m&&m(P,null);return}m&&m(null,U);return}if(P=Xn.call(T,S,O),P){m&&m(P,null);return}m&&m(null,O)},E)}function at(R){if(typeof R=="string")return R;try{return new TextDecoder("utf-8",{fatal:!0}).decode(R)}catch{return}}function Ms(R,g){let m=R&&R.msgs;return m&&m.forEach(function(E,C){let T={id:new G.Int64(""+E[0]),mtype:Number(E[2]),mid:new G.Int64(""+E[3]),deleted:E[4],msg:at(E[5]),binary:E[5],attrs:at(E[6]),mtime:new G.Int64(""+E[7])};g?T.direction=Number(E[1]):T.from=new G.Int64(""+E[1]),m[C]=T}),R}var $n=class R{constructor(g){if(g=As(g),De.FPEvent.assign(this),this._protocol=g.protocol,this._endpoint=g.endpoint,this._pid=g.pid,this._attrs=g.attrs,this._autoReconnect=g.autoReconnect!==void 0?g.autoReconnect:!0,this._connectionTimeout=g.connectionTimeout||30*1e3,this._maxPingIntervalSeconds=G.MAX_PING_SECONDS,this._platformImpl=void 0,this._requestMetadata=g.requestMetadata||g.requestMetadataProvider,this._requestTimeout=g.requestTimeout||20*1e3,this._tlvHeartbeatIdleMs=g.tlvHeartbeatIdleMs||30*1e3,this._tlvHeartbeatTimeoutMs=g.tlvHeartbeatTimeoutMs||10*1e3,this._pushDedupTtlMs=g.pushDedupTtlMs||30*1e3,this._webSocketFactory=g.webSocketFactory,this._authSec=g.authSec,this._authVer=g.authVer,this._locale=g.locale,this._clientVersion=g.clientVersion,g.maxPingIntervalSeconds!==void 0&&(this._maxPingIntervalSeconds=g.maxPingIntervalSeconds),this._lastPingTime=0,this._checkLastPingTimerID=0,this._regressiveStrategy={startConnectFailedCount:3,maxIntervalSeconds:8,linearRegressiveCount:4},g.regressiveStrategy!==void 0&&g.regressiveStrategy.startConnectFailedCount!==void 0&&g.regressiveStrategy.maxIntervalSeconds!==void 0&&g.regressiveStrategy.linearRegressiveCount!==void 0&&(this._regressiveStrategy.startConnectFailedCount=g.regressiveStrategy.startConnectFailedCount,this._regressiveStrategy.maxIntervalSeconds=g.regressiveStrategy.maxIntervalSeconds,this._regressiveStrategy.linearRegressiveCount=g.regressiveStrategy.linearRegressiveCount),this._canReconnect=!1,this._reconnectCount=0,this._reconnectInterval=0,this._ssl=!1,this._protocol==="tlv-v1")this._tlvEndpoint=g.tlvEndpoint;else{let C=g.ssl_endpoint!==void 0,T=C?g.ssl_endpoint:g.endpoint;this._endpoint=C?T:Ps(T),this._ssl=C}g.platformImpl!==void 0&&(this._platformImpl=g.platformImpl),this._md5=g.md5||null,this._midSeq=0,this._saltSeq=0,this._baseClient=null,this._reconnectTimeout=0,this._requireClose=!1,this._msgOptions={codec:G.MsgPack.createCodec({int64:!0})},this._binaryOptions={codec:G.MsgPack.createCodec({int64:!0,useraw:!0})};let m=this;this._processor=new Rs(this);let E=function(){m._requireClose=!0,m._canReconnect=!1,m._protocol!=="tlv-v1"&&m._baseClient&&m._baseClient.close()};this._processor.on(G.SERVER_PUSH.kickOut,E),this._processor.on(G.TLV_SERVER_PUSH.kickOut,E),this.promises=Os(this,R.prototype)}get processor(){return this._processor}login(g,m,E,C){this._uid=g,this._token=m,this._processor&&(this._processor.uid=this._uid),ks.call(this,E,C)}bye(g,m){typeof g=="function"&&(m=g,g=void 0);let E={},C={flag:1,method:"bye",payload:G.MsgPack.encode(E,this._msgOptions)},T=this;this._requireClose=!0,fe.call(this,this._baseClient,C,function(O,P){T._protocol==="tlv-v1"?O&&(tt.call(T,O),T._baseClient&&T._baseClient.close()):T._baseClient&&T._baseClient.close(),m&&m(O||null,P)},g)}getServerTime(g,m){let E={flag:1,method:"getservertime",payload:G.MsgPack.encode({},this._msgOptions)};fe.call(this,this._baseClient,E,function(C,T){if(C){m&&m(C,null);return}T&&T.mts!==void 0&&(T.mts=new G.Int64(""+T.mts)),m&&m(null,T)},g)}close(){this._requireClose=!0,this._baseClient&&this._baseClient.close()}startAutoReconnect(){this._requireClose=!1,this._baseClient&&this._baseClient.close()}destroy(){this.close(),this._midSeq=0,this._saltSeq=0,this._processor&&(this._processor.destroy(),this._processor=null),this._baseClient&&(this._baseClient.destroy(),this._baseClient=null),this._reconnectTimeout&&(clearTimeout(this._reconnectTimeout),this._reconnectTimeout=0),this._checkLastPingTimerID&&(clearInterval(this._checkLastPingTimerID),this._checkLastPingTimerID=0),this.removeEvent()}sendMessage(g,m,E,C,T,O,P){T=_n.call(this,T);let S={to:g,mid:T,mtype:m,msg:E,attrs:C},U={flag:1,method:"sendmsg",payload:this._protocol==="tlv-v1"?S:G.MsgPack.encode(S,this._msgOptions)},N=this._protocol==="tlv-v1";fe.call(this,this._baseClient,U,function(D,L){if(D){P&&P(N?{message_ref:S.mid,error:D}:{mid:S.mid,error:D},null);return}!N&&L.mtime!==void 0&&(L.mtime=new G.Int64(L.mtime)),P&&P(null,N?{message_ref:L.message_ref,payload:L}:{mid:S.mid,payload:L})},O)}sendMessages(g,m,E,C,T,O,P){T=_n.call(this,T);let S={tos:g,mid:T,mtype:m,msg:E,attrs:C},U={flag:1,method:"sendmsgs",payload:this._protocol==="tlv-v1"?S:G.MsgPack.encode(S,this._msgOptions)},N=this._protocol==="tlv-v1";fe.call(this,this._baseClient,U,function(D,L){if(D){P&&P(N?{message_ref:S.mid,error:D}:{mid:S.mid,error:D},null);return}!N&&L.mtime!==void 0&&(L.mtime=new G.Int64(L.mtime)),P&&P(null,N?{message_ref:L.message_ref,payload:L}:{mid:S.mid,payload:L})},O)}sendGroupMessage(g,m,E,C,T,O,P){T=_n.call(this,T);let S={gid:g,mid:T,mtype:m,msg:E,attrs:C},U={flag:1,method:"sendgroupmsg",payload:this._protocol==="tlv-v1"?S:G.MsgPack.encode(S,this._msgOptions)},N=this._protocol==="tlv-v1";fe.call(this,this._baseClient,U,function(D,L){if(D){P&&P(N?{message_ref:S.mid,error:D}:{mid:S.mid,error:D},null);return}!N&&L.mtime!==void 0&&(L.mtime=new G.Int64(L.mtime)),P&&P(null,N?{message_ref:L.message_ref,payload:L}:{mid:S.mid,payload:L})},O)}sendRoomMessage(g,m,E,C,T,O,P){T=_n.call(this,T);let S={rid:g,mid:T,mtype:m,msg:E,attrs:C},U={flag:1,method:"sendroommsg",payload:this._protocol==="tlv-v1"?S:G.MsgPack.encode(S,this._msgOptions)},N=this._protocol==="tlv-v1";fe.call(this,this._baseClient,U,function(D,L){if(D){P&&P(N?{message_ref:S.mid,error:D}:{mid:S.mid,error:D},null);return}!N&&L.mtime!==void 0&&(L.mtime=new G.Int64(L.mtime)),P&&P(null,N?{message_ref:L.message_ref,payload:L}:{mid:S.mid,payload:L})},O)}getUnreadMessage(g,m,E,C){let T=ei(m,E,C);m=T.value,E=T.timeout,C=T.callback;let O={clear:g===void 0?!1:g};m!==void 0&&(O.gettime=m);let P={flag:1,method:"getunread",payload:G.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,function(S,U){if(S){C&&C(S,null);return}let N=U.p2p;if(N){let L=[];N.forEach(function(q,H){L[H]=new G.Int64(""+q)}),U.p2p=L}let D=U.group;if(D){let L=[];D.forEach(function(q,H){L[H]=new G.Int64(""+q)}),U.group=L}C&&C(null,U)},E)}getP2PUnreadMessageNum(g,m,E,C,T){let O={uids:g};m!==void 0&&(O.mtime=m),E!==void 0&&(O.mtypes=E);let P={flag:1,method:"getp2punread",payload:G.MsgPack.encode(O,this._msgOptions)},S=this._protocol==="tlv-v1";fe.call(this,this._baseClient,P,function(U,N){if(U){T&&T(U,null);return}if(S){T&&T(null,N);return}let D={};D.p2p={},D.ltime={};let L=N.p2p;if(L)for(var q in L)D.p2p[new G.Int64(""+q)]=L[q];let H=N.ltime;if(H)for(var q in H)D.ltime[new G.Int64(""+q)]=new G.Int64(""+H[q]);T&&T(null,D)},C)}getGroupUnreadMessageNum(g,m,E,C,T){let O={gids:g};m!==void 0&&(O.mtime=m),E!==void 0&&(O.mtypes=E);let P={flag:1,method:"getgroupunread",payload:G.MsgPack.encode(O,this._msgOptions)},S=this._protocol==="tlv-v1";fe.call(this,this._baseClient,P,function(U,N){if(U){T&&T(U,null);return}if(S){T&&T(null,N);return}let D={};D.group={},D.ltime={};let L=N.group;if(L)for(var q in L)D.group[new G.Int64(""+q)]=L[q];let H=N.ltime;if(H)for(var q in H)D.ltime[new G.Int64(""+q)]=new G.Int64(""+H[q]);T&&T(null,D)},C)}cleanUnreadMessage(g,m){let E={},C={flag:1,method:"cleanunread",payload:G.MsgPack.encode(E,this._msgOptions)};fe.call(this,this._baseClient,C,m,g)}setSessionRead(g,m,E,C,T){let O={category:g,xid:m,read_seq:E},P={flag:1,method:"setsessionread",payload:G.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,T,C)}getSession(g,m){let E={},C={flag:1,method:"getsession",payload:G.MsgPack.encode(E,this._msgOptions)};fe.call(this,this._baseClient,C,function(T,O){if(T){m&&m(T,null);return}let P=O.p2p;if(P){let U=[];P.forEach(function(N,D){U[D]=new G.Int64(""+N)}),O.p2p=U}let S=O.group;if(S){let U=[];S.forEach(function(N,D){U[D]=new G.Int64(""+N)}),O.group=U}m&&m(null,O)},g)}getGroupMessage(g,m,E,C,T,O,P,S,U){let N={gid:g,desc:m,num:E};C!==void 0&&(N.begin=C),T!==void 0&&(N.end=T),O!==void 0&&(N.lastid=O),P!==void 0&&(N.mtypes=P);let D={flag:1,method:"getgroupmsg",payload:G.MsgPack.encode(N,this._msgOptions)};fe.call(this,this._baseClient,D,function(L,q){if(L){U&&U(L,null);return}let H=q.msgs;H&&H.forEach(function(V,K){let Q=V[5],Z=at(V[5]),ie=at(V[6]);H[K]={id:new G.Int64(""+V[0]),from:new G.Int64(""+V[1]),mtype:Number(V[2]),mid:new G.Int64(""+V[3]),deleted:V[4],msg:Z,binary:Q,attrs:ie,mtime:new G.Int64(""+V[7])}}),U&&U(null,q)},S,!0)}getRoomMessage(g,m,E,C,T,O,P,S,U){let N={rid:g,desc:m,num:E};C!==void 0&&(N.begin=C),T!==void 0&&(N.end=T),O!==void 0&&(N.lastid=O),P!==void 0&&(N.mtypes=P);let D={flag:1,method:"getroommsg",payload:G.MsgPack.encode(N,this._msgOptions)};fe.call(this,this._baseClient,D,function(L,q){if(L){U&&U(L,null);return}let H=q.msgs;H&&H.forEach(function(V,K){let Q=V[5],Z=at(V[5]),ie=at(V[6]);H[K]={id:new G.Int64(""+V[0]),from:new G.Int64(""+V[1]),mtype:Number(V[2]),mid:new G.Int64(""+V[3]),deleted:V[4],msg:Z,binary:Q,attrs:ie,mtime:new G.Int64(""+V[7])}}),U&&U(null,q)},S,!0)}getBroadcastMessage(g,m,E,C,T,O,P,S){let U={desc:g,num:m};E!==void 0&&(U.begin=E),C!==void 0&&(U.end=C),T!==void 0&&(U.lastid=T),O!==void 0&&(U.mtypes=O);let N={flag:1,method:"getbroadcastmsg",payload:G.MsgPack.encode(U,this._msgOptions)};fe.call(this,this._baseClient,N,function(D,L){if(D){S&&S(D,null);return}let q=L.msgs;q&&q.forEach(function(H,V){let K=H[5],Q=at(H[5]),Z=at(H[6]);q[V]={id:new G.Int64(""+H[0]),from:new G.Int64(""+H[1]),mtype:Number(H[2]),mid:new G.Int64(""+H[3]),deleted:H[4],msg:Q,binary:K,attrs:Z,mtime:new G.Int64(""+H[7])}}),S&&S(null,L)},P,!0)}getP2PMessage(g,m,E,C,T,O,P,S,U){let N={ouid:g,desc:m,num:E};C!==void 0&&(N.begin=C),T!==void 0&&(N.end=T),O!==void 0&&(N.lastid=O),P!==void 0&&(N.mtypes=P);let D={flag:1,method:"getp2pmsg",payload:G.MsgPack.encode(N,this._msgOptions)};fe.call(this,this._baseClient,D,function(L,q){if(L){U&&U(L,null);return}let H=q.msgs;H&&H.forEach(function(V,K){let Q=V[5],Z=at(V[5]),ie=at(V[6]);H[K]={id:new G.Int64(""+V[0]),direction:Number(V[1]),mtype:Number(V[2]),mid:new G.Int64(""+V[3]),deleted:V[4],msg:Z,binary:Q,attrs:ie,mtime:new G.Int64(""+V[7])}}),U&&U(null,q)},S,!0)}getP2PMessageByMessageId(g,m,E,C,T,O,P,S,U){let N={ouid:g,mid:m,desc:E,num:C};T!==void 0&&(N.begin=T),O!==void 0&&(N.end=O),P!==void 0&&(N.mtypes=P),this._getMessageByAnchor("getp2pmsgbymessageid",N,!0,S,U)}getGroupMessageByMessageId(g,m,E,C,T,O,P,S,U){let N={gid:g,mid:m,desc:E,num:C};T!==void 0&&(N.begin=T),O!==void 0&&(N.end=O),P!==void 0&&(N.mtypes=P),this._getMessageByAnchor("getgroupmsgbymessageid",N,!1,S,U)}getRoomMessageByMessageId(g,m,E,C,T,O,P,S,U){let N={rid:g,mid:m,desc:E,num:C};T!==void 0&&(N.begin=T),O!==void 0&&(N.end=O),P!==void 0&&(N.mtypes=P),this._getMessageByAnchor("getroommsgbymessageid",N,!1,S,U)}getBroadcastMessageByMessageId(g,m,E,C,T,O,P,S){let U={mid:g,desc:m,num:E};C!==void 0&&(U.begin=C),T!==void 0&&(U.end=T),O!==void 0&&(U.mtypes=O),this._getMessageByAnchor("getbroadcastmsgbymessageid",U,!1,P,S)}_getMessageByAnchor(g,m,E,C,T){let O={flag:1,method:g,payload:G.MsgPack.encode(m,this._msgOptions)};fe.call(this,this._baseClient,O,function(P,S){if(P){T&&T(P,null);return}T&&T(null,Ms(S,E))},C,!0)}getP2PMessageCount(g,m,E,C,T,O){this._getMessageCount("getp2pmsgcount",{ouid:g,begin:m,end:E,mtypes:C},T,O)}getGroupMessageCount(g,m,E,C,T,O){this._getMessageCount("getgroupmsgcount",{gid:g,begin:m,end:E,mtypes:C},T,O)}getRoomMessageCount(g,m,E,C,T,O){this._getMessageCount("getroommsgcount",{rid:g,begin:m,end:E,mtypes:C},T,O)}getBroadcastMessageCount(g,m,E,C,T){this._getMessageCount("getbroadcastmsgcount",{begin:g,end:m,mtypes:E},C,T)}_getMessageCount(g,m,E,C){let T={};Object.keys(m).forEach(function(P){m[P]!==void 0&&(T[P]=m[P])});let O={flag:1,method:g,payload:G.MsgPack.encode(T,this._msgOptions)};fe.call(this,this._baseClient,O,C,E)}fileToken(g,m,E,C,T,O,P){let S={cmd:g};m!==void 0&&(S.tos=m),E!==void 0&&(S.to=E),C!==void 0&&(S.rid=C),T!==void 0&&(S.gid=T),oi.call(this,S,P,O)}addAttrs(g,m,E){let C={attrs:g},T={flag:1,method:"addattrs",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}getAttrs(g,m){let E={},C={flag:1,method:"getattrs",payload:G.MsgPack.encode(E,this._msgOptions)};fe.call(this,this._baseClient,C,m,g)}addDebugLog(g,m,E,C){let T={msg:g,attrs:m},O={flag:1,method:"adddebuglog",payload:G.MsgPack.encode(T,this._msgOptions)};fe.call(this,this._baseClient,O,C,E)}addDevice(g,m,E,C){let T={apptype:g,devicetoken:m},O={flag:1,method:"adddevice",payload:G.MsgPack.encode(T,this._msgOptions)};fe.call(this,this._baseClient,O,C,E)}removeDevice(g,m,E){let C={devicetoken:g},T={flag:1,method:"removedevice",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}setTranslationLanguage(g,m,E){let C={lang:g},T={flag:1,method:"setlang",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}translate(g,m,E,C,T,O,P){let S={text:g,dst:E};m!==void 0&&(S.src=m),C!==void 0&&(S.type=C),T!==void 0&&(S.profanity=T);let U={flag:1,method:"translate",payload:G.MsgPack.encode(S,this._msgOptions)};fe.call(this,this._baseClient,U,P,O)}profanity(g,m,E,C){let T={text:g};m!==void 0&&(T.classify=m);let O={flag:1,method:"profanity",payload:G.MsgPack.encode(T,this._msgOptions)};fe.call(this,this._baseClient,O,C,E)}textCheck(g,m,E,C){typeof m=="function"?(C=m,m=void 0,E=void 0):arguments.length<4&&typeof m=="number"&&(E===void 0||typeof E=="function")&&(C=typeof E=="function"?E:C,E=m,m=void 0);let T={text:g};m!==void 0&&(T.strategyId=m);let O={flag:1,method:"tcheck",payload:G.MsgPack.encode(T,this._msgOptions)};fe.call(this,this._baseClient,O,C,E)}imageCheck(g,m,E,C,T){let O={image:g,type:m};E!==void 0&&(O.strategyId=E);let P={flag:1,method:"icheck",payload:G.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,T,C)}audioCheck(g,m,E,C,T,O,P,S){let U={audio:g,type:m,lang:E};C!==void 0&&(U.codec=C),T!==void 0&&(U.srate=T),O!==void 0&&(U.strategyId=O);let N={flag:1,method:"acheck",payload:G.MsgPack.encode(U,this._msgOptions)};fe.call(this,this._baseClient,N,S,P)}videoCheck(g,m,E,C,T,O){let P={video:g,type:m,videoName:E};C!==void 0&&(P.strategyId=C);let S={flag:1,method:"vcheck",payload:G.MsgPack.encode(P,this._msgOptions)};fe.call(this,this._baseClient,S,O,T)}speech2Text(g,m,E,C,T,O,P){let S={audio:g,type:m,lang:E};C!==void 0&&(S.codec=C),T!==void 0&&(S.srate=T);let U={flag:1,method:"speech2text",payload:G.MsgPack.encode(S,this._msgOptions)};fe.call(this,this._baseClient,U,P,O)}getGroupsOpenInfo(g,m,E){let C={gids:g},T={flag:1,method:"getgroupsopeninfo",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}getRoomsOpenInfo(g,m,E){let C={rids:g},T={flag:1,method:"getroomsopeninfo",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}getRoomMembers(g,m,E){let C={rid:g},T={flag:1,method:"getroommembers",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}getRoomCount(g,m,E){let C={rids:g},T={flag:1,method:"getroomcount",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}addDevicePushOption(g,m,E,C,T){let O={type:g,xid:m};E!==void 0&&(O.mtypes=E);let P={flag:1,method:"addoption",payload:G.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,T,C)}removeDevicePushOption(g,m,E,C,T){let O={type:g,xid:m};E!==void 0&&(O.mtypes=E);let P={flag:1,method:"removeoption",payload:G.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,T,C)}getDevicePushOption(g,m){let E={},C={flag:1,method:"getoption",payload:G.MsgPack.encode(E,this._msgOptions)};fe.call(this,this._baseClient,C,m,g)}addFriends(g,m,E){let C={friends:g},T={flag:1,method:"addfriends",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}deleteFriends(g,m,E){let C={friends:g},T={flag:1,method:"delfriends",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}getFriends(g,m){let E={},C={flag:1,method:"getfriends",payload:G.MsgPack.encode(E,this._msgOptions)};fe.call(this,this._baseClient,C,function(T,O){if(T){m&&m(T,null);return}let P=O.uids;if(P){let S=[];P.forEach(function(U,N){S[N]=new G.Int64(U)}),m&&m(null,S);return}m&&m(null,O)},g)}addGroupMembers(g,m,E,C){let T={gid:g,uids:m},O={flag:1,method:"addgroupmembers",payload:G.MsgPack.encode(T,this._msgOptions)};fe.call(this,this._baseClient,O,C,E)}deleteGroupMembers(g,m,E,C){let T={gid:g,uids:m},O={flag:1,method:"delgroupmembers",payload:G.MsgPack.encode(T,this._msgOptions)};fe.call(this,this._baseClient,O,C,E)}getGroupMembers(g,m,E,C){let T={gid:g};m!==void 0&&(T.online=m);let O={flag:1,method:"getgroupmembers",payload:G.MsgPack.encode(T,this._msgOptions)};fe.call(this,this._baseClient,O,function(P,S){if(P){C&&C(P,null);return}let U=S.uids;if(U){let D=[];U.forEach(function(L,q){D[q]=new G.Int64(L)}),S.uids=D}let N=S.onlines;if(N){let D=[];N.forEach(function(L,q){D[q]=new G.Int64(L)}),S.onlines=D}C&&C(null,S)},E)}getGroupCount(g,m,E,C){let T={gid:g};m!==void 0&&(T.online=m);let O={flag:1,method:"getgroupcount",payload:G.MsgPack.encode(T,this._msgOptions)};fe.call(this,this._baseClient,O,function(P,S){if(P){C&&C(P,null);return}C&&C(null,S)},E)}getUserGroups(g,m){let E={},C={flag:1,method:"getusergroups",payload:G.MsgPack.encode(E,this._msgOptions)},T=this._protocol==="tlv-v1"?"group_refs":"gids";fe.call(this,this._baseClient,C,function(O,P){if(O){m&&m(O,null);return}let S=P[T];if(S){let U=[];S.forEach(function(N,D){U[D]=new G.Int64(N)}),m&&m(null,U);return}m&&m(null,P)},g)}enterRoom(g,m,E){let C={rid:g},T={flag:1,method:"enterroom",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}enterRooms(g,m,E){let C={rids:g},T={flag:1,method:"enterrooms",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}leaveRoom(g,m,E){let C={rid:g},T={flag:1,method:"leaveroom",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}getUserRooms(g,m){let E={},C={flag:1,method:"getuserrooms",payload:G.MsgPack.encode(E,this._msgOptions)},T=this._protocol==="tlv-v1"?"room_refs":"rooms";fe.call(this,this._baseClient,C,function(O,P){if(O){m&&m(O,null);return}let S=P[T];if(S){let U=[];S.forEach(function(N,D){U[D]=new G.Int64(N)}),m&&m(null,U);return}m&&m(null,P)},g)}getUserRoomsAndLastMessage(g,m,E){let C={};g!==void 0&&(C.mtypes=g);let T={flag:1,method:"getuserroomsandlastmsg",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}getOnlineUsers(g,m,E){let C={uids:g},T={flag:1,method:"getonlineusers",payload:G.MsgPack.encode(C,this._msgOptions)},O=this._protocol==="tlv-v1"?"online_users":"uids";fe.call(this,this._baseClient,T,function(P,S){if(P){E&&E(P,null);return}let U=S[O];if(U){let N=[];U.forEach(function(D,L){N[L]=new G.Int64(D)}),E&&E(null,N);return}E&&E(null,S)},m)}deleteMessage(g,m,E,C,T,O){let P={from:g,mid:m,xid:E,type:C},S={flag:1,method:"delmsg",payload:G.MsgPack.encode(P,this._msgOptions)};fe.call(this,this._baseClient,S,O,T)}getMessage(g,m,E,C,T,O){let P={from:g,mid:m,xid:E,type:C},S={flag:1,method:"getmsg",payload:G.MsgPack.encode(P,this._msgOptions)};fe.call(this,this._baseClient,S,function(U,N){if(U){O&&O(U,null);return}N.id!==void 0&&(N.id=new G.Int64(""+N.id)),N.mtime!==void 0&&(N.mtime=new G.Int64(""+N.mtime)),O&&O(null,N)},T,!0)}sendChat(g,m,E,C,T,O){this.sendMessage.call(this,g,G.CHAT_TYPE.text,m,E,C,T,O)}sendAudio(g,m,E,C,T,O){this.sendMessage.call(this,g,G.CHAT_TYPE.audio,m,E,C,T,O)}sendCmd(g,m,E,C,T,O){this.sendMessage.call(this,g,G.CHAT_TYPE.cmd,m,E,C,T,O)}sendGroupChat(g,m,E,C,T,O){this.sendGroupMessage.call(this,g,G.CHAT_TYPE.text,m,E,C,T,O)}sendGroupAudio(g,m,E,C,T,O){this.sendGroupMessage.call(this,g,G.CHAT_TYPE.audio,m,E,C,T,O)}sendGroupCmd(g,m,E,C,T,O){this.sendGroupMessage.call(this,g,G.CHAT_TYPE.cmd,m,E,C,T,O)}sendRoomChat(g,m,E,C,T,O){this.sendRoomMessage.call(this,g,G.CHAT_TYPE.text,m,E,C,T,O)}sendRoomAudio(g,m,E,C,T,O){this.sendRoomMessage.call(this,g,G.CHAT_TYPE.audio,m,E,C,T,O)}sendRoomCmd(g,m,E,C,T,O){this.sendRoomMessage.call(this,g,G.CHAT_TYPE.cmd,m,E,C,T,O)}getGroupChat(g,m,E,C,T,O,P,S){this.getGroupMessage.call(this,g,m,E,C,T,O,[G.CHAT_TYPE.text,G.CHAT_TYPE.audio,G.CHAT_TYPE.cmd],P,S)}getRoomChat(g,m,E,C,T,O,P,S){this.getRoomMessage.call(this,g,m,E,C,T,O,[G.CHAT_TYPE.text,G.CHAT_TYPE.audio,G.CHAT_TYPE.cmd],P,S)}getP2PChat(g,m,E,C,T,O,P,S){this.getP2PMessage.call(this,g,m,E,C,T,O,[G.CHAT_TYPE.text,G.CHAT_TYPE.audio,G.CHAT_TYPE.cmd],P,S)}getBroadcastChat(g,m,E,C,T,O,P){this.getBroadcastMessage.call(this,g,m,E,C,T,[G.CHAT_TYPE.text,G.CHAT_TYPE.audio,G.CHAT_TYPE.cmd],O,P)}deleteChat(g,m,E,C,T,O){this.deleteMessage(g,m,E,C,T,O)}getChat(g,m,E,C,T,O){this.getMessage(g,m,E,C,T,O)}setUserInfo(g,m,E,C){let T={};g!==void 0&&(T.oinfo=g),m!==void 0&&(T.pinfo=m);let O={flag:1,method:"setuserinfo",payload:G.MsgPack.encode(T,this._msgOptions)};fe.call(this,this._baseClient,O,C,E)}getUserInfo(g,m){let E={},C={flag:1,method:"getuserinfo",payload:G.MsgPack.encode(E,this._msgOptions)};fe.call(this,this._baseClient,C,m,g)}getUserOpenInfo(g,m,E){let C={uids:g},T={flag:1,method:"getuseropeninfo",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}setGroupInfo(g,m,E,C,T){let O={gid:g};m!==void 0&&(O.oinfo=m),E!==void 0&&(O.pinfo=E);let P={flag:1,method:"setgroupinfo",payload:G.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,T,C)}getGroupInfo(g,m,E){let C={gid:g},T={flag:1,method:"getgroupinfo",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}getGroupOpenInfo(g,m,E){let C={gid:g},T={flag:1,method:"getgroupopeninfo",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}setRoomInfo(g,m,E,C,T){let O={rid:g};m!==void 0&&(O.oinfo=m),E!==void 0&&(O.pinfo=E);let P={flag:1,method:"setroominfo",payload:G.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,T,C)}setRoomProfile(g,m,E,C,T,O,P){let S={rid:g};m!==void 0&&(S.oinfo=m),E!==void 0&&(S.pinfo=E),C!==void 0&&(S.name=C),T!==void 0&&(S.icon=T);let U={flag:1,method:"setroominfo",payload:G.MsgPack.encode(S,this._msgOptions)};fe.call(this,this._baseClient,U,P,O)}getRoomInfo(g,m,E){let C={rid:g},T={flag:1,method:"getroominfo",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}getRoomOpenInfo(g,m,E){let C={rid:g},T={flag:1,method:"getroomopeninfo",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}dataSet(g,m,E,C){let T={key:g,val:m},O={flag:1,method:"dataset",payload:G.MsgPack.encode(T,this._msgOptions)};fe.call(this,this._baseClient,O,C,E)}dataGet(g,m,E){let C={key:g},T={flag:1,method:"dataget",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}dataDelete(g,m,E){let C={key:g},T={flag:1,method:"datadel",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}addBlacks(g,m,E){let C={blacks:g},T={flag:1,method:"addblacks",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}deleteBlacks(g,m,E){let C={blacks:g},T={flag:1,method:"delblacks",payload:G.MsgPack.encode(C,this._msgOptions)};fe.call(this,this._baseClient,T,E,m)}getBlacks(g,m){let E={},C={flag:1,method:"getblacks",payload:G.MsgPack.encode(E,this._msgOptions)},T=this._protocol==="tlv-v1"?"blocked_users":"uids";fe.call(this,this._baseClient,C,function(O,P){if(O){m&&m(O,null);return}let S=P[T];if(S){let U=[];S.forEach(function(N,D){U[D]=new G.Int64(""+N)}),m&&m(null,U);return}m&&m(null,P)},g)}sendFile(g,m,E,C,T,O){let P={to:m,mtype:g,cmd:"sendfile"};Qn.call(this,P,E,C,O,T)}sendGroupFile(g,m,E,C,T,O){let P={gid:m,mtype:g,cmd:"sendgroupfile"};Qn.call(this,P,E,C,O,T)}sendRoomFile(g,m,E,C,T,O){let P={rid:m,mtype:g,cmd:"sendroomfile"};Qn.call(this,P,E,C,O,T)}getP2PConversationList(g,m,E,C){let T={};g!==void 0&&(T.mtime=g),m!==void 0&&(T.mtypes=m);let O={flag:1,method:"getp2pconversationlist",payload:G.MsgPack.encode(T,this._msgOptions)};fe.call(this,this._baseClient,O,C,E)}getP2PUnreadConversationList(g,m,E,C){let T={};g!==void 0&&(T.mtime=g),m!==void 0&&(T.mtypes=m);let O={flag:1,method:"getp2punreadconversationlist",payload:G.MsgPack.encode(T,this._msgOptions)};fe.call(this,this._baseClient,O,C,E)}getGroupConversationList(g,m,E,C){let T={};g!==void 0&&(T.mtime=g),m!==void 0&&(T.mtypes=m);let O={flag:1,method:"getgroupconversationlist",payload:G.MsgPack.encode(T,this._msgOptions)};fe.call(this,this._baseClient,O,C,E)}getGroupUnreadConversationList(g,m,E,C){let T={};g!==void 0&&(T.mtime=g),m!==void 0&&(T.mtypes=m);let O={flag:1,method:"getgroupunreadconversationlist",payload:G.MsgPack.encode(T,this._msgOptions)};fe.call(this,this._baseClient,O,C,E)}getUnreadConversationList(g,m,E,C,T){let O={};g!==void 0&&(O.clear=g),m!==void 0&&(O.mtime=m),E!==void 0&&(O.mtypes=E);let P={flag:1,method:"getunreadconversationlist",payload:G.MsgPack.encode(O,this._msgOptions)};fe.call(this,this._baseClient,P,T,C)}removeSession(g,m,E,C){let T=ei(m,E,C),O=T.provided;m=O?T.value:!1,E=T.timeout,C=T.callback;let P={to:g};(this._protocol==="tlv-v1"||O)&&(P.oneway=m);let S={flag:1,method:"removesession",payload:G.MsgPack.encode(P,this._msgOptions)};fe.call(this,this._baseClient,S,C,E)}};ai.exports=$n});var Zn=Ge((xa,ui)=>{"use strict";var{normalizeClientOptions:Us}=Jn(),{normalizeFpnnEndpoint:Ns}=gn();function Bs(R){return R.protocol==="tlv-v1"?R.tlvEndpoint||R.tlv_endpoint||R.endpoint||R.ssl_endpoint:R.ssl_endpoint!==void 0?"wss://"+R.ssl_endpoint+"/service/websocket":"ws://"+Ns(R.endpoint)+"/service/websocket"}ui.exports={normalizeClientOptions:Us,sharedEndpoint:Bs}});var er=Ge((Ia,fi)=>{"use strict";var{Int64BE:Fs,Uint64BE:Ds}=Rt();function Ls(R){if(R==null)return null;if(!js(R)||["direct","group","room"].indexOf(R.type)===-1)throw new Error('conversation.type must be "direct", "group", or "room"');let g=R.id,m;if(typeof g=="string")m=g;else if(typeof g=="number"&&qs(g))m=String(g);else if(typeof g=="bigint"||g&&(Fs.isInt64BE(g)||Ds.isUint64BE(g)))m=g.toString();else throw new Error("conversation.id must be a positive int64 string, safe integer, or RTMConfig.Int64");if(!/^\d+$/.test(m)||/^0+$/.test(m))throw new Error("conversation.id must be a positive int64");if(m=m.replace(/^0+(?=\d)/,""),m.length>19||m.length===19&&m>"9223372036854775807")throw new Error("conversation.id exceeds the positive int64 range");return{type:R.type,id:m}}function qs(R){return Number.isSafeInteger?Number.isSafeInteger(R):isFinite(R)&&Math.floor(R)===R&&Math.abs(R)<=9007199254740991}function js(R){if(R===null||typeof R!="object")return!1;let g=Object.getPrototypeOf(R);return g===Object.prototype||g===null}fi.exports=Ls});var tr=Ge((Ma,hi)=>{"use strict";var ci=ct(),li={"tlv-v1":{},fpnn:{}};function Tt(R,g,m,E){g.forEach(function(C){li[R][C]={type:m,field:E}})}var mn=ci.TLV_SERVER_PUSH;Tt("tlv-v1",[mn.recvMessage],"direct","sender");Tt("tlv-v1",[mn.recvGroupMessage],"group","group_ref");Tt("tlv-v1",[mn.recvRoomMessage,mn.kickOutRoom],"room","room_ref");var $e=ci.SERVER_PUSH;Tt("fpnn",[$e.recvMessage,$e.recvChat,$e.recvAudio,$e.recvCmd,$e.recvFile],"direct","from");Tt("fpnn",[$e.recvGroupMessage,$e.recvGroupChat,$e.recvGroupAudio,$e.recvGroupCmd,$e.recvGroupFile],"group","gid");Tt("fpnn",[$e.recvRoomMessage,$e.recvRoomChat,$e.recvRoomAudio,$e.recvRoomCmd,$e.recvRoomFile,$e.kickOutRoom],"room","rid");function Vs(R,g,m,E){if(!R)return!0;let C=li[g],T=C&&Object.prototype.hasOwnProperty.call(C,m)?C[m]:null;if(!T)return!0;let O=E&&E[T.field];return R.type===T.type&&String(O)===R.id}hi.exports=Vs});var ir=Ge((Ua,Ei)=>{"use strict";var rr=Ut(),Pt=ct(),Hs=pn(),{Int64BE:Ws,Uint64BE:Ys}=Rt(),{normalizeClientOptions:Gs,sharedEndpoint:zs}=Zn(),di=er(),Ks=tr(),Lt="__rtmSharedWorkerType__",Js="__rtmSharedWorkerCallback__",pi=Xs(),Qs=5e3,St=class{constructor(g){let m=g||{};if(typeof SharedWorker>"u")throw new Error("RTMSharedWorkerClient requires browser SharedWorker support");let E=$s(m.workerUrl),C=Gs(m.clientOptions);if(this._protocol=C.protocol,typeof C.requestMetadata=="function"||typeof C.requestMetadataProvider=="function"||typeof C.webSocketFactory=="function")throw new Error("SharedWorker client options must be structured-cloneable; requestMetadata and webSocketFactory functions are not supported");let T=di(m.conversation),O=m.workerName||(m.uid!==void 0&&m.uid!==null?mi({pid:C.pid,uid:m.uid,protocol:C.protocol,endpoint:zs(C),namespace:m.workerNamespace}):C.protocol==="fpnn"?"rtm-shared-worker:fpnn":"rtm-shared-worker"),P=m.idleShutdownTimeout===void 0?Qs:m.idleShutdownTimeout;if(!ea(P))throw new Error("RTMSharedWorkerClient idleShutdownTimeout must be a non-negative number");if(this._listeners=Object.create(null),this._processorListeners=Object.create(null),this._callbackSeq=0,this._callbacks=new Map,this._destroyed=!1,this._destroying=!1,this._failedError=null,this._conversation=T,this.promises=Hs(this,rr.prototype),this._pageWindow=typeof window<"u"&&window.addEventListener?window:null,this._pageHideListener=N=>{N&&N.persisted||this.destroy()},this._session={status:"idle",uid:null},this._readySettled=!1,this._readyPromise=new Promise((N,D)=>{this._resolveReady=N,this._rejectReady=D}),this._readyPromise.catch(function(){}),this._worker=new SharedWorker(E,O),this._worker.onerror=this._onWorkerError.bind(this),this._port=this._worker.port,this._pageWindow&&this._pageWindow.addEventListener("pagehide",this._pageHideListener),this._port.onmessage=this._onMessage.bind(this),this._port.onmessageerror=this._onMessageError.bind(this),typeof this._port.start=="function"&&this._port.start(),!this._post({type:"init",options:C,idleShutdownTimeout:P}))this._settleReady(new Error("Failed to initialize the RTM SharedWorker client")),this.destroy();else{let N=Zs(m.readyTimeout)?m.readyTimeout:1e4;this._readyTimer=setTimeout(()=>{let D=nr("Timed out waiting for the RTM SharedWorker to initialize","RTM_SHARED_WORKER_READY_TIMEOUT");this._failedError=D;let L=this._failPendingCallbacks(D);this._settleReady(D);try{this._emit(this._listeners,"SharedWorkerError",[D])}finally{this.destroy()}if(L)throw L.error},N)}let U=this;this.processor={on:function(N,D){return U._addListener(U._processorListeners,N,D),this},off:function(N,D){return U._removeListener(U._processorListeners,N,D),this},removeEvent:function(N,D){return arguments.length===0?U._processorListeners=Object.create(null):U._removeListener(U._processorListeners,N,D),this},emit:function(N){U._emit(U._processorListeners,N,Array.prototype.slice.call(arguments,1))},listenerCount:function(N){return(U._processorListeners[N]||[]).length}}}on(g,m){return this._addListener(this._listeners,g,m),this}off(g,m){return this._removeListener(this._listeners,g,m),this}emit(g){this._emit(this._listeners,g,Array.prototype.slice.call(arguments,1))}listenerCount(g){return(this._listeners[g]||[]).length}removeEvent(g,m){return arguments.length===0?this._listeners=Object.create(null):this._removeListener(this._listeners,g,m),this}whenReady(){return this._readyPromise.then(yn)}getSharedSession(){return yn(this._session)}loginIfNeeded(g,m,E){let C=this;return this.whenReady().then(function(){if(C._destroyed||C._destroying)throw new Error("RTMSharedWorkerClient has been destroyed");return new Promise(function(T,O){let P=++C._callbackSeq,S=function(D){D instanceof Error?O(D):T(D)};S.rejectOnDestroy=!0,C._callbacks.set(P,S);let U=En(g,C._callbacks,C);C._post({type:"login-if-needed",uid:U,credential:m,timeout:E,requestId:P})||(C._callbacks.delete(P),O(new Error("Failed to request shared RTM login")))})})}setConversation(g,m){let E=di(g);if(this._destroyed||this._destroying){let C=new Error("RTMSharedWorkerClient has been destroyed");return typeof m=="function"&&m(C),this._emit(this._listeners,"SharedWorkerError",[C]),this}return this._conversation=E,typeof m=="function"&&m(null),this}destroy(){if(this._destroyed||this._destroying)return;this._destroying=!0;let g=null,m=null;try{this._settleReady(new Error("RTMSharedWorkerClient was destroyed before it became ready"));let E=new Error("RTMSharedWorkerClient was destroyed before the shared login completed");g=this._failPendingCallbacks(E)}finally{try{this._post({type:"detach"},!0)}catch(E){m=E}if(this._destroyed=!0,this._destroying=!1,this._callbacks.clear(),this._listeners=Object.create(null),this._processorListeners=Object.create(null),this._pageWindow&&this._pageHideListener)try{this._pageWindow.removeEventListener("pagehide",this._pageHideListener)}catch(E){m=m||E}this._pageWindow=null,this._pageHideListener=null,this._worker.onerror=null,this._port.onmessage=null,this._port.onmessageerror=null;try{this._port.close()}catch(E){m=m||E}}if(m)throw m;if(g)throw g.error}_addListener(g,m,E){typeof E=="function"&&(g[m]||(g[m]=[]),g[m].indexOf(E)===-1&&g[m].push(E))}_removeListener(g,m,E){if(g[m]){if(E===void 0){delete g[m];return}g[m]=g[m].filter(function(C){return C!==E}),g[m].length===0&&delete g[m]}}_emit(g,m,E){(g[m]||[]).slice().forEach(function(T){T.apply(null,E)})}_onMessage(g){let m=g&&g.data;if(!(!m||this._destroyed)){if(m.type==="callback"){let E=this._callbacks.get(m.callbackId);E&&(this._callbacks.delete(m.callbackId),E.apply(null,At(m.args,Pt)));return}if(m.type==="event"){let E=At(m.args,Pt);if(m.channel==="processor"&&!Ks(this._conversation,this._protocol,m.name,E[0]))return;this._emit(m.channel==="processor"?this._processorListeners:this._listeners,m.name,E);return}if(m.type==="login-result"){let E=this._callbacks.get(m.requestId);E&&(this._callbacks.delete(m.requestId),E(m.error?At(m.error,Pt):m.result));return}if(m.type==="error"){let E=At(m.error,Pt),C=null;if(m.requestId!==void 0){let T=this._callbacks.get(m.requestId);T&&(this._callbacks.delete(m.requestId),T(E))}else this._failedError=E,C=this._failPendingCallbacks(E);try{this._settleReady(E),this._emit(this._listeners,"SharedWorkerError",[E])}finally{m.fatal===!0&&this.destroy()}if(C)throw C.error;return}if(m.type==="ready"){let E=gi(m.session);this._session=E,this._settleReady(null,E),this._emit(this._listeners,"SharedWorkerReady",[E]);return}m.type==="session-state"&&(this._session=gi(m.session),this._emit(this._listeners,"SharedSessionState",[yn(this._session)]))}}_onMessageError(g){let m=new Error("Failed to read a SharedWorker message");m.code="RTM_SHARED_WORKER_MESSAGE_ERROR",m.event=g,this._failedError=m;let E=this._failPendingCallbacks(m);this._settleReady(m);try{this._emit(this._listeners,"SharedWorkerError",[m])}finally{this.destroy()}if(E)throw E.error}_onWorkerError(g){let m=new Error(g&&g.message?"RTM SharedWorker failed to load: "+g.message:"RTM SharedWorker failed to load");m.code="RTM_SHARED_WORKER_LOAD_ERROR",g&&g.filename&&(m.filename=g.filename),g&&g.lineno&&(m.lineno=g.lineno),this._failedError=m;let E=this._failPendingCallbacks(m);this._settleReady(m);try{this._emit(this._listeners,"SharedWorkerError",[m])}finally{this.destroy()}if(E)throw E.error}_failPendingCallbacks(g){let m=this,E=null;return this._callbacks.forEach(function(C,T){if(!(typeof C.fail!="function"&&!C.rejectOnDestroy)){m._callbacks.delete(T);try{typeof C.fail=="function"?C.fail(g):C(g)}catch(O){E||(E={error:O})}}}),E}_invoke(g,m){if(this._destroyed||this._destroying){let T=nr("RTMSharedWorkerClient has been destroyed","RTM_SHARED_CLIENT_DESTROYED");_i(g,m,T),this._emit(this._listeners,"SharedWorkerError",[T]);return}if(this._failedError){_i(g,m,this._failedError);return}let E=this._callbackSeq;this._post({type:"invoke",method:g,args:En(m,this._callbacks,this,g)})||this._failCallbacksSince(E,this._failedError||nr("Failed to send request to RTM SharedWorker","RTM_SHARED_WORKER_POST_MESSAGE_ERROR"))}_failCallbacksSince(g,m){let E=this;this._callbacks.forEach(function(C,T){T<=g||(E._callbacks.delete(T),typeof C.fail=="function"&&C.fail(m))})}_post(g,m){let E=m&&g&&g.type==="detach";if((this._destroyed||this._destroying)&&!E||this._failedError&&!E)return!1;try{return this._port.postMessage(g),!0}catch(C){return this._emit(this._listeners,"SharedWorkerError",[C]),!1}}_settleReady(g,m){this._readySettled||(this._readySettled=!0,this._readyTimer!==void 0&&(clearTimeout(this._readyTimer),this._readyTimer=void 0),g?this._rejectReady(g):this._resolveReady(yn(m)))}};function mi(R){if(!R||typeof R!="object")throw new Error("createSharedWorkerName requires { pid, uid }");let g=R.pid===void 0||R.pid===null?"":String(R.pid).trim(),m=R.uid===void 0||R.uid===null?"":String(R.uid).trim();if(!g||!m)throw new Error("createSharedWorkerName requires non-empty pid and uid");let E=R.protocol===void 0?"fpnn":R.protocol;if(E!=="tlv-v1"&&E!=="fpnn")throw new Error('createSharedWorkerName protocol must be "tlv-v1" or "fpnn"');let C=[String(R.namespace===void 0||R.namespace===null?"":R.namespace),g,m,String(R.endpoint===void 0||R.endpoint===null?"":R.endpoint)];return E==="fpnn"&&C.unshift(E),"rtm-shared:"+C.map(function(O){let P=encodeURIComponent(O);return P.length+":"+P}).join("|")}St.createWorkerName=mi;function gi(R){if(!R||typeof R!="object")return{status:"idle",uid:null};let g=["idle","connecting","authenticated"].indexOf(R.status)>=0?R.status:"idle";return{status:g,uid:g==="idle"||R.uid===void 0||R.uid===null?null:String(R.uid)}}function yn(R){return{status:R.status,uid:R.uid}}Object.getOwnPropertyNames(rr.prototype).forEach(function(R){R==="constructor"||R==="destroy"||R.charAt(0)==="_"||Object.prototype.hasOwnProperty.call(St.prototype,R)||typeof Object.getOwnPropertyDescriptor(rr.prototype,R).value!="function"||Object.defineProperty(St.prototype,R,{configurable:!0,enumerable:!1,writable:!0,value:function(){return this._invoke(R,Array.prototype.slice.call(arguments))}})});function Xs(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.src)return document.currentScript.src;if(typeof document.getElementsByTagName=="function"){let R=document.getElementsByTagName("script");for(let g=0;g<R.length;g++){let m=R[g];if(m&&m.src&&/\/rtm(?:\.min)?\.js(?:[?#]|$)/i.test(m.src))return m.src}}return null}function $s(R){if(R!=null&&R!==""){if(typeof R!="string")throw new Error("RTMSharedWorkerClient workerUrl must be a string");return R}if(!pi)throw new Error("RTMSharedWorkerClient could not infer workerUrl; serve rtm.shared-worker.js next to the SDK script or provide workerUrl");let g;try{g=new URL("rtm.shared-worker.js",pi)}catch{throw new Error("RTMSharedWorkerClient could not resolve rtm.shared-worker.js beside the SDK script; provide workerUrl")}if(typeof window<"u"&&window.location&&g.origin!==window.location.origin)throw new Error("RTMSharedWorkerClient default worker URL is cross-origin; serve rtm.shared-worker.js from this page origin or provide a same-origin workerUrl");return g.href}function Zs(R){return typeof R=="number"&&isFinite(R)&&R>0}function ea(R){return typeof R=="number"&&isFinite(R)&&R>=0}function En(R,g,m,E){if(typeof R=="function"){let C=++m._callbackSeq,T=function(){return R.apply(null,arguments)};return T.fail=function(O){E==="login"?R(!1,O.status||Pt.ERROR_CODE.RTM_EC_UNKNOWN_ERROR):R(O,null)},g.set(C,T),{[Js]:C}}if(R&&typeof R=="object"){if(Ws.isInt64BE(R))return{[Lt]:"int64",value:R.toString()};if(Ys.isUint64BE(R))return{[Lt]:"uint64",value:R.toString()};if(Array.isArray(R))return R.map(function(C){return En(C,g,m,E)});if(yi(R)){let C={};return Object.keys(R).forEach(function(T){C[T]=En(R[T],g,m,E)}),C}}return R}function _i(R,g,m){(g||[]).forEach(function(E){typeof E=="function"&&(R==="login"?E(!1,m.status||Pt.ERROR_CODE.RTM_EC_UNKNOWN_ERROR):E(m,null))})}function nr(R,g){let m=new Error(R);return m.code=g,m}function At(R,g){if(Array.isArray(R))return R.map(function(E){return At(E,g)});if(!yi(R))return R;if(R[Lt]==="int64")return g.Int64(R.value);if(R[Lt]==="uint64")return g.Uint64(R.value);if(R[Lt]==="error"){let E=new Error(R.message||"SharedWorker error");return E.name=R.name||"Error",R.code!==void 0&&(E.code=R.code),R.status!==void 0&&(E.status=R.status),R.reason!==void 0&&(E.reason=R.reason),R.stack&&(E.stack=R.stack),E}let m={};return Object.keys(R).forEach(function(E){m[E]=At(R[E],g)}),m}function yi(R){if(R===null||typeof R!="object")return!1;let g=Object.getPrototypeOf(R);return g===Object.prototype||g===null}Ei.exports=St});var Ci=Ge((Na,Ri)=>{"use strict";var qt=Ut(),bi=ir(),or=ct(),ta=pn(),{normalizeClientOptions:na,sharedEndpoint:ra}=Zn(),wi=er(),ia=tr(),oa=["sharing","uid","conversation","workerName","workerUrl","workerNamespace","readyTimeout","idleShutdownTimeout"],jt=class{constructor(g){if(this._sharedWorkerSupported=typeof SharedWorker=="function",!this._sharedWorkerSupported&&typeof window>"u")throw bt("SharedWorker is unavailable outside a browser; use RTMClient or sharing: false for an independent connection","RTM_SHARED_WORKER_UNSUPPORTED");this._config=Object.assign({},g),this._options=na(vi(g)),this._config.conversation=wi(g.conversation),this._delegate=null,this._delegateType=null,this._uid=null,this._session={status:"idle",uid:null},this._directLoginPromise=null,this._destroyed=!1,this._events=new bn,this.processor=new bn,this.promises=sa(this),g.uid!==void 0&&g.uid!==null&&this._attach(g.uid)}_attach(g){if(this._assertActive(),typeof g=="number"&&(!isFinite(g)||Math.floor(g)!==g||Math.abs(g)>9007199254740991))throw bt("Use a decimal string for a UID outside the safe integer range","RTM_SHARED_UID_INVALID");let m=g==null?"":String(g).trim().replace(/^0+(?=\d)/,"");if(!/^\d+$/.test(m)||/^0+$/.test(m))throw bt("Provide a positive UID in login() or createClient({ uid }) before attaching","RTM_SHARED_UID_REQUIRED");if(m.length>20||m.length===20&&m>"18446744073709551615")throw bt("UID exceeds the uint64 range","RTM_SHARED_UID_INVALID");if(this._uid!==null&&this._uid!==m)throw bt("This client is bound to UID "+this._uid+"; create another client for UID "+m,"RTM_SHARED_UID_MISMATCH");if(!this._delegate){let E=this._config,C=this._sharedWorkerSupported?new bi({workerName:E.workerName||bi.createWorkerName({pid:this._options.pid,protocol:this._options.protocol,uid:m,endpoint:ra(this._options),namespace:E.workerNamespace}),workerUrl:E.workerUrl,conversation:E.conversation,readyTimeout:E.readyTimeout,idleShutdownTimeout:E.idleShutdownTimeout,clientOptions:this._options}):new qt(this._options);this._uid=m,this._delegate=C,this._delegateType=this._sharedWorkerSupported?"shared":"direct",this._delegateType==="direct"&&C.on("SessionClosed",()=>{this._session={status:"idle",uid:null}}),this._events.bind(C);let T=this._delegateType==="direct"?(O,P)=>ia(this._config.conversation,this._options.protocol,O,P[0]):null;this.processor.bind(C.processor,T)}return this._delegate}_assertActive(){if(this._destroyed)throw bt("RTM client has been destroyed","RTM_CLIENT_DESTROYED")}login(g,m,E,C){this.loginIfNeeded(g,m,C).then(function(O){typeof E=="function"&&E(O.accepted,O.errorCode)},O=>{let P=typeof O.status=="number"?O.status:typeof O.code=="number"?O.code:or.ERROR_CODE.RTM_EC_UNKNOWN_ERROR;try{typeof E=="function"&&E(!1,P)}finally{this._sharedWorkerSupported&&this._events.emit("SharedWorkerError",O)}})}loginIfNeeded(g,m,E){try{let C=this._attach(g),O=this._uid.length>19||this._uid.length===19&&this._uid>"9223372036854775807"?or.Uint64(this._uid):or.Int64(this._uid);return this._sharedWorkerSupported?C.loginIfNeeded(O,m,E):this._loginDirect(C,O,m,E)}catch(C){return Promise.reject(C)}}_loginDirect(g,m,E,C){if(this._session.status==="authenticated")return Promise.resolve({accepted:!0,errorCode:0,reused:!0,uid:this._uid});if(this._session.status==="connecting"&&this._directLoginPromise)return this._directLoginPromise;if(typeof E!="string"||E.length===0)return Promise.reject(bt("This RTM UID is not logged in yet; provide its server-issued credential first.","RTM_SHARED_CREDENTIAL_REQUIRED"));this._session={status:"connecting",uid:this._uid};let T=new Promise((O,P)=>{let S=!1;try{g.login(m,E,(U,N)=>{S||(S=!0,this._session=U?{status:"authenticated",uid:this._uid}:{status:"idle",uid:null},O({accepted:!!U,errorCode:N||0,reused:!1,uid:U?this._uid:null}))},C)}catch(U){this._session={status:"idle",uid:null},P(U)}});return this._directLoginPromise=T.then(O=>(this._directLoginPromise=null,O),O=>{throw this._directLoginPromise=null,O}),this._directLoginPromise}whenReady(g){try{let m=this._attach(g===void 0?this._uid:g);return this._sharedWorkerSupported?m.whenReady():Promise.resolve({status:this._session.status,uid:this._session.uid})}catch(m){return Promise.reject(m)}}getSharedSession(){return this._delegateType==="shared"?this._delegate.getSharedSession():{status:this._session.status,uid:this._session.uid}}setConversation(g,m){return this._assertActive(),g=wi(g),this._delegateType==="shared"?this._delegate.setConversation(g,m):(this._config.conversation=g,typeof m=="function"&&m(null)),this}on(g,m){return this._events.on(g,m),this}off(g,m){return this._events.off(g,m),this}removeEvent(){return this._events.removeEvent.apply(this._events,arguments),this}emit(){this._events.emit.apply(this._events,arguments)}listenerCount(g){return this._events.listenerCount(g)}close(){this._assertActive(),this._delegate&&this._delegate.close()}destroy(){if(!this._destroyed){this._destroyed=!0;try{this._delegate&&this._delegate.destroy()}finally{this._events.clear(),this.processor.clear()}}}_invoke(g,m){try{if(this._assertActive(),!this._delegate)throw bt("Call login() before "+g+"()","RTM_SHARED_UID_REQUIRED")}catch(E){let C=m.slice().reverse().find(T=>typeof T=="function");if(C){C(E,null);return}throw E}return this._delegate[g].apply(this._delegate,m)}},bn=class{constructor(){this._listeners=Object.create(null),this._bindings=Object.create(null),this._target=null,this._filter=null}bind(g,m){this._target=g,this._filter=typeof m=="function"?m:null,Object.keys(this._listeners).forEach(E=>{this._listeners[E].forEach(C=>this._bind(E,C))})}_bind(g,m){let E=this._filter?(...T)=>{this._filter(g,T)&&m.apply(null,T)}:m;(this._bindings[g]||(this._bindings[g]=[])).push({callback:m,wrapped:E}),this._target.on(g,E)}_unbind(g,m){let E=this._bindings[g]||[];E.slice().forEach(C=>{m!==void 0&&m!==C.callback||(this._target.removeEvent(g,C.wrapped),E.splice(E.indexOf(C),1))}),E.length||delete this._bindings[g]}on(g,m){if(typeof m!="function")return this;let E=this._listeners[g]||(this._listeners[g]=[]);return E.indexOf(m)===-1&&(E.push(m),this._target&&this._bind(g,m)),this}off(g,m){let E=this._listeners[g]||[];return E.slice().forEach(C=>{m!==void 0&&C!==m||(this._target&&this._unbind(g,C),E.splice(E.indexOf(C),1))}),E.length||delete this._listeners[g],this}removeEvent(g,m){return arguments.length?this.off(g,m):(Object.keys(this._listeners).forEach(E=>this.off(E)),this)}emit(g){let m=Array.prototype.slice.call(arguments,1);(this._listeners[g]||[]).slice().forEach(E=>E.apply(null,m))}listenerCount(g){return(this._listeners[g]||[]).length}clear(){this._target&&Object.keys(this._bindings).forEach(g=>this._unbind(g)),this._target=null,this._filter=null,this._listeners=Object.create(null),this._bindings=Object.create(null)}};Object.getOwnPropertyNames(qt.prototype).forEach(function(R){R==="constructor"||R.charAt(0)==="_"||Object.prototype.hasOwnProperty.call(jt.prototype,R)||typeof Object.getOwnPropertyDescriptor(qt.prototype,R).value!="function"||(jt.prototype[R]=function(){return this._invoke(R,Array.prototype.slice.call(arguments))})});function vi(R){let g=Object.assign({},R);return oa.forEach(m=>{delete g[m]}),g}function sa(R){let g=Object.assign({},ta(R,qt.prototype));return g.login=function(m,E,C){return arguments.length>3?Promise.reject(new TypeError("promises.login(uid, credential, timeout?)")):R.loginIfNeeded(m,E,C).then(function(T){if(T.accepted)return{accepted:!0,errorCode:T.errorCode||0};let O=new Error("RTM login rejected ("+String(T.errorCode)+")");throw O.code=T.errorCode,O.status=T.errorCode,O})},Object.freeze(g)}function bt(R,g){let m=new Error(R);return m.code=g,m}function aa(R){let g=Object.assign({},R||{});if(g.protocol===void 0&&(g.protocol="fpnn"),g.sharing!==void 0&&typeof g.sharing!="boolean")throw new TypeError("sharing must be a boolean");if(g.sharing===!1){let m=vi(g);return new qt(m)}return new jt(g)}Ri.exports=aa});var Pi=Ge((Ba,Ti)=>{"use strict";var ua=Ut(),Oi=ir(),fa=Ci(),ca=Oi.createWorkerName,la=ct(),ha=Cn(),da=Ln(),pa=Kn();Ti.exports={RTMClient:ua,createClient:fa,RTMSharedWorkerClient:Oi,createSharedWorkerName:ca,RTMConfig:la,RTMProcessor:ha,TLVCodec:da,TLVWebSocketClient:pa}});var sr=Ni(Pi(),1),ur=sr.default.default||sr.default,Ai=new URL("../dist/rtm.shared-worker.js",import.meta.url).href,ar=class extends ur.RTMSharedWorkerClient{constructor(g){let m=g||{};super(Object.assign({},m,{workerUrl:m.workerUrl||Ai}))}};function ga(R){let g=R||{};return ur.createClient(Object.assign({},g,{workerUrl:g.workerUrl||Ai}))}var vt=Object.assign({},ur,{RTMSharedWorkerClient:ar,createClient:ga}),Fa=vt.RTMClient;var Da=vt.RTMConfig,La=vt.RTMProcessor,qa=vt.TLVCodec,ja=vt.TLVWebSocketClient,Va=vt.createSharedWorkerName,Ha=vt;export{Fa as RTMClient,Da as RTMConfig,La as RTMProcessor,ar as RTMSharedWorkerClient,qa as TLVCodec,ja as TLVWebSocketClient,ga as createClient,Va as createSharedWorkerName,Ha as default};
|
|
2
|
+
/*!
|
|
3
|
+
* The buffer module from node.js, for the browser.
|
|
4
|
+
*
|
|
5
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
6
|
+
* @license MIT
|
|
7
|
+
*/
|
|
8
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
9
|
+
/**
|
|
10
|
+
* [js-md5]{@link https://github.com/emn178/js-md5}
|
|
11
|
+
*
|
|
12
|
+
* @namespace md5
|
|
13
|
+
* @version 0.7.3
|
|
14
|
+
* @author Chen, Yi-Cyuan [emn178@gmail.com]
|
|
15
|
+
* @copyright Chen, Yi-Cyuan 2014-2017
|
|
16
|
+
* @license MIT
|
|
17
|
+
*/
|