2 lines
40 KiB
JavaScript
2 lines
40 KiB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.imsdk=e():t.imsdk=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=4)}([function(t,e,n){"use strict";var r=this&&this.__spreadArrays||function(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),i=0;for(e=0;e<n;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,i++)r[i]=o[s];return r};e.__esModule=!0;var i=function(){function t(){}return t.info=function(e){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];t.debug&&console.info.apply(console,r([(new Date).toISOString()+" : "+e],n))},t.infoTag=function(e,n){for(var i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];t.debug&&console.info.apply(console,r([(new Date).toISOString()+" "+e+" : "+n],i))},t.error=function(e){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];t.debug&&console.error.apply(console,r([(new Date).toISOString()+" : "+e],n))},t.errorTag=function(e,n){for(var i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];t.debug&&console.error.apply(console,r([(new Date).toISOString()+" "+e+" : "+n],i))},t.trace=function(e){t.debug&&(e instanceof Error?console.error(e.message+" \n "+(void 0!==e.stack?e.stack:"")):console.error(e))},t.debug=!1,t}();e.default=i},function(t,e,n){"use strict";e.__esModule=!0;var r=function(){function t(){}return t.to=function(t){return JSON.parse(JSON.stringify(t))},t.bean=function(t){return JSON.parse(t)},t.copy=function(e){return t.to(e)},t.replace=function(e,n){var r=t.to(e);for(var i in n)r[i]=n[i];return r},t.toMapByKey=function(t,e){var n={};return t.forEach((function(t){t.hasOwnProperty(e)&&(n[e]=t)})),n},t.json=function(t){return JSON.stringify(t)},t.strEmpty=function(t){return!!t},t.strNotEmpty=function(t){return!t},t.isEmpty=function(t){return null===t||""===t||void 0===t||0===t.length},t.uuid=function(){return(36*Math.random()).toString(36).slice(2)+(new Date).getTime().toString()},t}();e.default=r},function(t,e,n){"use strict";var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,o){function s(t){try{u(r.next(t))}catch(t){o(t)}}function a(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}u((r=r.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=2&o[0]?r.return:o[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,o[1])).done)return i;switch(r=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,r=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){s.label=o[1];break}if(6===o[0]&&s.label<i[1]){s.label=i[1],i=o;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(o);break}i[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],r=0}finally{n=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}};e.__esModule=!0,e.imClient=e.getLen=e.limLogin=e.ImClient=e.sleep=e.State=void 0;var o,s,a=n(0),u=n(5),l=n(6),f=n(7),c=n(10),h=n(14),d=n(15),p=n(16),_=n(1),y=n(18),g=n(19),m=!1;!function(t){t[t.INIT=0]="INIT",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED",t[t.RECONNECTING=3]="RECONNECTING",t[t.CLOSEING=4]="CLOSEING",t[t.CLOSED=5]="CLOSED"}(o=e.State||(e.State={})),function(t){t[t.Second=1e3]="Second",t[t.Millisecond=1]="Millisecond"}(s||(s={})),e.sleep=function(t,e){return void 0===e&&(e=s.Second),r(void 0,void 0,void 0,(function(){return i(this,(function(n){return[2,new Promise((function(n,r){setTimeout((function(){n()}),t*e)}))]}))}))};var b=function(){function t(){this.url="",this.version=1,this.clientType=1,this.listeners=null,this.state=o.INIT,this.lastOfflineMessageSequence=0,this.offlineMessageList=new Array,this.httpUrl=""}return t.prototype.getRequestBase=function(){return new h.RequestBase(this.appId,this.clientType,this.imei)},t.prototype.isInit=function(){return this.state==o.CONNECTED},t.prototype.getRequestParams=function(){return new d.RequestParams(this.appId,this.userId,this.userSign)},t.prototype.init=function(t,n,s,c,h,d){return r(this,void 0,void 0,(function(){var r,g,b,E,v,S,T,C,w,I,R=this;return i(this,(function(i){switch(i.label){case 0:return(r=this).httpUrl=t,r.appId=n,r.listeners=h,r.imei=f.default.getDeviceInfo().system,r.imeiLength=e.getLen(r.imei),r.userId=s,this.userSign=c,this.imeiLength=r.imeiLength,_.default.isEmpty(this.url)?(a.default.info("获取im地址"),[4,new p.default(this.httpUrl).call("/user/login",{},{clientType:this.clientType,appId:this.appId,userId:this.userId})]):[3,2];case 1:if((g=i.sent()).isFailed())return a.default.info("登录失败:获取im地址失败"),[2];b=g.data.ip,E=g.data.port,"http:"==(v=document.location.protocol)?this.url="ws://"+b+":"+E+"/ws":"https:"==v&&(this.url="wss://"+b+"/hs_ws"),i.label=2;case 2:return S=new l.LoginPack(r.appId,r.userId,1),[4,e.limLogin(r.url,S,r)];case 3:return T=i.sent(),C=T.success,w=T.err,I=T.conn,C?(m||(m=!0),I.onerror=function(t){a.default.info("websocket error: ",t),"function"==typeof e.imClient.listeners.onSocketErrorEvent&&e.imClient.listeners.onSocketErrorEvent(t),R.errorHandler(t,S)},I.onclose=function(t){a.default.info("event[onclose] fired"),r.state!=o.CLOSEING?("function"==typeof e.imClient.listeners.onSocketCloseEvent&&e.imClient.listeners.onSocketCloseEvent(),R.errorHandler(new Error(t.reason),S)):R.onclose("logout")},I.onmessage=function(t){var n=new u.default(t.data),r=n.int32().int32().unpack(),i=r[0],o=r[1],s=n.vstring(null,o).unpack()[2];console.log("sdk收到服务端数据 command:"+i),console.log("sdk收到服务端数据:"+s),i===y.MessageCommand.MSG_P2P?"function"==typeof e.imClient.listeners.onP2PMessage&&e.imClient.listeners.onP2PMessage(s):"function"==typeof e.imClient.listeners.onTestMessage&&e.imClient.listeners.onTestMessage(s)},this.conn=I,this.state=o.CONNECTED,this.loadOfflineMessage(),this.heartbeatLoop(this.conn),"function"==typeof e.imClient.listeners.onLogin&&e.imClient.listeners.onLogin(this.userId),d(r)):a.default.error(null==w?void 0:w.message),[2]}}))}))},t.prototype.buildMessagePack=function(t,n){var r=JSON.stringify(n),i=e.getLen(r),o=new u.default(null,0);return o.int32(t).int32(this.version).int32(this.clientType).int32(0).int32(this.appId).int32(this.imeiLength).int32(i).vstring(this.imei,this.imeiLength).vstring(r,i),o},t.prototype.errorHandler=function(t,n){return r(this,void 0,void 0,(function(){var t,r,s,u,l;return i(this,(function(i){switch(i.label){case 0:if(this.state==o.CLOSED||this.state==o.CLOSEING)return[2];this.state=o.RECONNECTING,"function"==typeof e.imClient.listeners.onSocketReConnectEvent&&e.imClient.listeners.onSocketReConnectEvent(),t=0,i.label=1;case 1:return t<10?[4,e.sleep(3)]:[3,7];case 2:i.sent(),i.label=3;case 3:return i.trys.push([3,5,,6]),a.default.info("try to relogin"),[4,e.limLogin(this.url,n,this)];case 4:return r=i.sent(),s=r.success,u=r.err,r.conn,s?("function"==typeof e.imClient.listeners.onSocketReConnectSuccessEvent&&e.imClient.listeners.onSocketReConnectSuccessEvent(),[2]):(a.default.info(u),[3,6]);case 5:return l=i.sent(),a.default.info(l),[3,6];case 6:return t++,[3,1];case 7:return this.onclose("reconnect timeout"),[2]}}))}))},t.prototype.onclose=function(t){this.state!=o.CLOSED&&(this.state=o.CLOSED,a.default.info("connection closed due to "+t),this.conn=void 0,this.userId="","function"==typeof e.imClient.listeners.onSocketErrorEvent&&e.imClient.listeners.onSocketCloseEvent())},t.prototype.getSingleUserInfo=function(t){var e=this;return new Promise((function(n,r){n(new p.default(e.httpUrl).call("/user/data/getSingleUserInfo",e.getRequestParams(),{userId:t}))}))},t.prototype.syncGetUserInfo=function(t){return r(this,void 0,void 0,(function(){var e;return i(this,(function(n){return e=new p.default(this.httpUrl),[2,e.call("/user/data/getUserInfo",this.getRequestParams(),{userIds:t})]}))}))},t.prototype.getUserInfo=function(t){var e=this;return new Promise((function(n,r){n(new p.default(e.httpUrl).call("/user/data/getUserInfo",e.getRequestParams(),{userIds:t}))}))},t.prototype.getAllFriend=function(){var t=this;return new Promise((function(e,n){e(new p.default(t.httpUrl).call("/friendship/getAllFriendShip",t.getRequestParams(),{fromId:t.userId}))}))},t.prototype.getUserSequence=function(){var t=this;return new Promise((function(e,n){e(new p.default(t.httpUrl).call("/user/getUserSequence",t.getRequestParams(),{userId:t.userId}))}))},t.prototype.getUserConversationList=function(t){var e=this;return new Promise((function(n,r){n(new p.default(e.httpUrl).call("/conversation/syncConversationList",e.getRequestParams(),{userId:e.userId,appId:e.appId,maxLimit:100,lastSequence:t,operater:e.userId}))}))},t.prototype.createRoom=function(t){var e=this;return new Promise((function(n,r){return new p.default(e.httpUrl).call("/room/createRoom",e.getRequestParams(),t)}))},t.prototype.joinRoom=function(t){var e=this;return new Promise((function(n,r){return new p.default(e.httpUrl).call("/room/joinRoom",e.getRequestParams(),t)}))},t.prototype.getRoomInfo=function(t){var e=this;return new Promise((function(n,r){return new p.default(e.httpUrl).call("/room/getRoomInfo",e.getRequestParams(),{roomId:t})}))},t.prototype.heartbeatLoop=function(t){var n=this,r=Date.now(),i=function(){if(n.state==o.CONNECTED){if(Date.now()-r>=1e4){r=Date.now();var s=e.imClient.buildMessagePack(y.SystemCommand.PING,{});t.send(s.pack(!1))}setTimeout(i,500)}else a.default.error("heartbeatLoop exited")};setTimeout(i,500)},t.prototype.createP2PTextMessage=function(t,e){var n=new g.MessagePack(this.appId);return n.buildTextMessagePack(this.userId,t,e),n},t.prototype.sendP2PMessage=function(t){var n=e.imClient.buildMessagePack(y.MessageCommand.MSG_P2P,t);this.conn&&this.conn.send(n.pack(!1))},t.prototype.sendP2PMessageReciveAck=function(t){console.log("=============== sendP2PMessageReciveAck"),console.log(t),t.toId=t.fromId,t.fromId=this.userId,console.log(t);var n=e.imClient.buildMessagePack(y.MessageCommand.MSG_RECIVE_ACK,t);t.conversationType=0;var r=e.imClient.buildMessagePack(y.MessageCommand.MSG_READED,t),i=e.imClient.buildMessagePack(y.MessageCommand.MSG_READED_RECEIPT,t);this.conn&&(this.conn.send(n.pack(!1)),this.conn.send(r.pack(!1)),this.conn.send(i.pack(!1)))},t.prototype.sendP2PMessageReadedReceipt=function(t){console.log("=============== sendP2PMessageReadedRECEIPT"),console.log(t),t.toId=t.fromId,t.fromId=this.userId,console.log(t);var n=e.imClient.buildMessagePack(y.MessageCommand.MSG_READED_RECEIPT,t);this.conn&&(console.log("=============== sendP2PMessageReadedRECEIPT 正式开始发送已读回执"),this.conn.send(n.pack(!1)))},t.prototype.getUserId=function(){return this.userId},t.prototype.loadOfflineMessage=function(){return r(this,void 0,void 0,(function(){var t,n;return i(this,(function(r){switch(r.label){case 0:return a.default.info("loadOfflineMessage start"),[4,new p.default(this.httpUrl).call("/message/syncOfflineMessage",this.getRequestParams(),{clientType:this.clientType,operater:this.userId,appId:this.appId,lastSequence:this.lastOfflineMessageSequence,maxLimit:100})];case 1:return(t=r.sent()).isSucceed()?(this.lastOfflineMessageSequence=t.data.maxSequence,n=t.data.dataList,this.offlineMessageList.push(n),n.length>0&&"function"==typeof e.imClient.listeners.onOfflineMessage&&e.imClient.listeners.onOfflineMessage(n),console.log(t.data.completed),t.data.completed||this.loadOfflineMessage()):a.default.error("loadOfflineMessage - error"),[2]}}))}))},t}();e.ImClient=b,e.limLogin=function(t,e,n){return r(void 0,void 0,void 0,(function(){return i(this,(function(r){return[2,new Promise((function(r,i){var o=new c.w3cwebsocket(t);o.binaryType="arraybuffer",a.default.info("limLogin");var s=setTimeout((function(){clearTimeout(s),r({success:!1,err:new Error("timeout"),conn:o})}),1e4);o.onopen=function(){if(o.readyState==c.w3cwebsocket.OPEN){"function"==typeof n.listeners.onSocketConnectEvent&&n.listeners.onSocketConnectEvent(t,e),a.default.info("开启连接");var r={userId:e.userId},i=n.buildMessagePack(9e3,r);o.send(i.pack(!1))}},o.onerror=function(t){clearTimeout(s),a.default.error(t),r({success:!1,err:t,conn:o})},o.onmessage=function(t){if("string"!=typeof t.data){clearTimeout(s);var e=new u.default(t.data).int32().int32().unpack(),n=e[0];e[1];9001==n&&r({success:!0,conn:o})}else a.default.info("Received: '"+t.data+"'")}}))]}))}))},e.getLen=function(t){for(var e=0,n=0;n<t.length;n++){var r=t.charCodeAt(n);r>=1&&r<=126||65376<=r&&r<=65439?e++:e+=3}return e},e.imClient=new b},function(t,e,n){"use strict";(function(t){e.__esModule=!0;var r=function(){function e(){}return e.getFetchToolkit=function(){var e;if(void 0!==t.fetch&&"function"==typeof t.fetch)e=t.fetch;else if("function"==typeof fetch)e=fetch;else{e=n(9).fetch}return e},e}();e.default=r}).call(this,n(8))},function(t,e,n){"use strict";e.__esModule=!0,e.im=void 0;var r=n(2);e.im=r.imClient,"undefined"!=typeof uni&&(uni.im=r.imClient)},function(t,e,n){"use strict";e.__esModule=!0;var r=function(){function t(t,e){this.Type_Byte=1,this.Type_Short=2,this.Type_UShort=3,this.Type_Int32=4,this.Type_UInt32=5,this.Type_String=6,this.Type_VString=7,this.Type_Int64=8,this.Type_Float=9,this.Type_Double=10,this.Type_ByteArray=11,this._offset=0,this._list=[],this._littleEndian=!1,this._org_buf=t?t.constructor==DataView?t:t.constructor==Uint8Array?new DataView(t.buffer,e):new DataView(t,e):new DataView(new Uint8Array([]).buffer),this.arrayBuf=t,this.offset=e}return t.prototype.bigEndian=function(){return this._littleEndian=!1,this},t.prototype.littleEndianfunction=function(){return this._littleEndian=!0,this},t.prototype.utf8Write=function(t,e,n){for(var r=0,i=0,o=n.length;i<o;i++)(r=n.charCodeAt(i))<128?t.setUint8(e++,r):r<2048?(t.setUint8(e++,192|r>>6),t.setUint8(e++,128|63&r)):r<55296||r>=57344?(t.setUint8(e++,224|r>>12),t.setUint8(e++,128|r>>6&63),t.setUint8(e++,128|63&r)):(i++,r=65536+((1023&r)<<10|1023&n.charCodeAt(i)),t.setUint8(e++,240|r>>18),t.setUint8(e++,128|r>>12&63),t.setUint8(e++,128|r>>6&63),t.setUint8(e++,128|63&r))},t.prototype.int32=function(t,e){return 0==arguments.length?(this._list.push(this._org_buf.getInt32(this._offset,this._littleEndian)),this._offset+=4):(this._list.splice(null!=e?e:this._list.length,0,{t:this.Type_Int32,d:t,l:4}),this._offset+=4),this},t.prototype.uint32=function(t,e){return 0==arguments.length?(this._list.push(this._org_buf.getUint32(this._offset,this._littleEndian)),this._offset+=4):(this._list.splice(null!=e?e:this._list.length,0,{t:this.Type_UInt32,d:t,l:4}),this._offset+=4),this},t.prototype.blength=function(){return this._offset},t.prototype.string=function(t,e){if(0==arguments.length){var n=this._org_buf.getInt32(this._offset,this._littleEndian);this._offset+=4,this._list.push(this.utf8Read(this._org_buf,this._offset,n)),this._offset+=n}else{n=0;t&&(n=this.utf8Length(t)),this._list.splice(null!=e?e:this._list.length,0,{t:this.Type_String,d:t,l:n}),this._offset+=n+4}return this},t.prototype.utf8Length=function(t){for(var e=0,n=0,r=0,i=t.length;r<i;r++)(e=t.charCodeAt(r))<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(r++,n+=4);return n},t.prototype.utf8Read=function(t,e,n){for(var r="",i=0,o=e,s=e+n;o<s;o++){var a=t.getUint8(o);if(0!=(128&a))if(192!=(224&a))if(224!=(240&a)){if(240!=(248&a))throw new Error("Invalid byte "+a.toString(16));(i=(7&a)<<18|(63&t.getUint8(++o))<<12|(63&t.getUint8(++o))<<6|(63&t.getUint8(++o))<<0)>=65536?(i-=65536,r+=String.fromCharCode(55296+(i>>>10),56320+(1023&i))):r+=String.fromCharCode(i)}else r+=String.fromCharCode((15&a)<<12|(63&t.getUint8(++o))<<6|(63&t.getUint8(++o))<<0);else r+=String.fromCharCode((15&a)<<6|63&t.getUint8(++o));else r+=String.fromCharCode(a)}return r},t.prototype.vstring=function(t,e,n){if(!e)throw new Error("vstring must got len argument");if(null==t||null==t){for(var r=0,i=this._offset;i<this._offset+e;i++)this._org_buf.getUint8(i)>0&&r++;this._list.push(this.utf8Read(this._org_buf,this._offset,r)),this._offset+=e}else this._list.splice(null!=n?n:this._list.length,0,{t:this.Type_VString,d:t,l:e}),this._offset+=e;return this},t.prototype.int64=function(t,e){return 0==arguments.length?(this._list.push(this._org_buf.getFloat64(this._offset,this._littleEndian)),this._offset+=8):(this._list.splice(null!=e?e:this._list.length,0,{t:this.Type_Int64,d:t,l:8}),this._offset+=8),this},t.prototype.float=function(t,e){return 0==arguments.length?(this._list.push(this._org_buf.getFloat32(this._offset,this._littleEndian)),this._offset+=4):(this._list.splice(null!=e?e:this._list.length,0,{t:this.Type_Float,d:t,l:4}),this._offset+=4),this},t.prototype.double=function(t,e){return 0==arguments.length?(this._list.push(this._org_buf.getFloat64(this._offset,this._littleEndian)),this._offset+=8):(this._list.splice(null!=e?e:this._list.length,0,{t:this.Type_Double,d:t,l:8}),this._offset+=8),this},t.prototype.byteArray=function(t,e,n){if(!e)throw new Error("byteArray must got len argument");if(null==t||null==t){var r=new Uint8Array(this._org_buf.buffer.slice(this._offset,this._offset+e));this._list.push(r),this._offset+=e}else this._list.splice(null!=n?n:this._list.length,0,{t:this.Type_ByteArray,d:t,l:e}),this._offset+=e;return this},t.prototype.unpack=function(){return this._list},t.prototype.packWithHead=function(){return this.pack(!0)},t.prototype.pack=function(t){this._org_buf=new DataView(new ArrayBuffer(t?this._offset+4:this._offset));var e=0;t&&(this._org_buf.setUint32(e,this._offset,this._littleEndian),e+=4);for(var n=0;n<this._list.length;n++)switch(this._list[n].t){case this.Type_Byte:this._org_buf.setInt8(e,this._list[n].d),e+=this._list[n].l;break;case this.Type_Short:this._org_buf.setInt16(e,this._list[n].d,this._littleEndian),e+=this._list[n].l;break;case this.Type_UShort:this._org_buf.setUint16(e,this._list[n].d,this._littleEndian),e+=this._list[n].l;break;case this.Type_Int32:this._org_buf.setInt32(e,this._list[n].d,this._littleEndian),e+=this._list[n].l;break;case this.Type_UInt32:this._org_buf.setUint32(e,this._list[n].d,this._littleEndian),e+=this._list[n].l;break;case this.Type_String:this._org_buf.setUint32(e,this._list[n].l,this._littleEndian),e+=4,this.utf8Write(this._org_buf,e,this._list[n].d),e+=this._list[n].l;break;case this.Type_VString:this.utf8Write(this._org_buf,e,this._list[n].d);for(var r=e+this.utf8Length(this._list[n].d);r<e+this._list[n].l;r++)this._org_buf.setUint8(r,0);e+=this._list[n].l;break;case this.Type_Int64:this._org_buf.setFloat64(e,this._list[n].d,this._littleEndian),e+=this._list[n].l;break;case this.Type_Float:this._org_buf.setFloat32(e,this._list[n].d,this._littleEndian),e+=this._list[n].l;break;case this.Type_Double:this._org_buf.setFloat64(e,this._list[n].d,this._littleEndian),e+=this._list[n].l;break;case this.Type_ByteArray:var i=0;for(r=e;r<e+this._list[n].l;r++)i<this._list[n].d.length?this._org_buf.setUint8(r,this._list[n].d[i]):this._org_buf.setUint8(r,0),i++;e+=this._list[n].l}return this._org_buf.buffer},t.prototype.getAvailable=function(){return this._org_buf?this._org_buf.buffer.byteLength-this._offset:this._offset},t}();e.default=r},function(t,e,n){"use strict";e.__esModule=!0,e.LoginPack=void 0;var r=function(t,e,n){this.userId=e,this.clientType=n,this.appId=t};e.LoginPack=r},function(module,exports,__webpack_require__){"use strict";exports.__esModule=!0;var Fetch_1=__webpack_require__(3),Logger_1=__webpack_require__(0),Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(t){var e,n,r,i,o,s,a,u="",l=0;for(t=Base64._utf8_encode(t);l<t.length;)i=(e=t.charCodeAt(l++))>>2,o=(3&e)<<4|(n=t.charCodeAt(l++))>>4,s=(15&n)<<2|(r=t.charCodeAt(l++))>>6,a=63&r,isNaN(n)?s=a=64:isNaN(r)&&(a=64),u=u+this._keyStr.charAt(i)+this._keyStr.charAt(o)+this._keyStr.charAt(s)+this._keyStr.charAt(a);return u},decode:function(t){var e,n,r,i,o,s,a="",u=0;for(t=t.replace(/[^A-Za-z0-9+/=]/g,"");u<t.length;)e=this._keyStr.indexOf(t.charAt(u++))<<2|(i=this._keyStr.indexOf(t.charAt(u++)))>>4,n=(15&i)<<4|(o=this._keyStr.indexOf(t.charAt(u++)))>>2,r=(3&o)<<6|(s=this._keyStr.indexOf(t.charAt(u++))),a+=String.fromCharCode(e),64!=o&&(a+=String.fromCharCode(n)),64!=s&&(a+=String.fromCharCode(r));return a=Base64._utf8_decode(a)},_utf8_encode:function(t){t=t.replace(/rn/g,"n");for(var e="",n=0;n<t.length;n++){var r=t.charCodeAt(n);r<128?e+=String.fromCharCode(r):r>127&&r<2048?(e+=String.fromCharCode(r>>6|192),e+=String.fromCharCode(63&r|128)):(e+=String.fromCharCode(r>>12|224),e+=String.fromCharCode(r>>6&63|128),e+=String.fromCharCode(63&r|128))}return e},_utf8_decode:function(t){for(var e="",n=0,r=0,i=0;n<t.length;)if((r=t.charCodeAt(n))<128)e+=String.fromCharCode(r),n++;else if(r>191&&r<224)i=t.charCodeAt(n+1),e+=String.fromCharCode((31&r)<<6|63&i),n+=2;else{i=t.charCodeAt(n+1);var o=t.charCodeAt(n+2);e+=String.fromCharCode((15&r)<<12|(63&i)<<6|63&o),n+=3}return e}},WebToolkit=function(){function WebToolkit(){}return WebToolkit.getBrowserInfo=function(){var t=navigator.userAgent.toLowerCase(),e=/edge\/[\d.]+/gi,n=/trident\/[\d.]+/gi,r=/msie\s[\d.]+/gi,i=/firefox\/[\d.]+/gi,o=/chrome\/[\d.]+/gi,s=/safari\/[\d.]+/gi,a=/opr\/[\d.]+/gi,u={code:0,system:t.split(" ")[1].split(" ")[0].split("(")[1],browser:"",browserVersion:""};return t.indexOf("trident")>0?(u.browser=t.match(n)[0].split("/")[0],u.browserVersion=t.match(n)[0].split("/")[1],u):t.indexOf("msie")>0?(u.browser=t.match(r)[0].split(" ")[0],u.browserVersion=t.match(r)[0].split(" ")[1],u):t.indexOf("edge")>0?(u.browser=t.match(e)[0].split("/")[0],u.browserVersion=t.match(e)[0].split("/")[1],u):t.indexOf("firefox")>0?(u.browser=t.match(i)[0].split("/")[0],u.browserVersion=t.match(i)[0].split("/")[1],u):t.indexOf("opr")>0?(u.browser=t.match(a)[0].split("/")[0],u.browserVersion=t.match(a)[0].split("/")[1],u):t.indexOf("safari")>0&&t.indexOf("chrome")<0?(u.browser=t.match(s)[0].split("/")[0],u.browserVersion=t.match(s)[0].split("/")[1],u):t.indexOf("chrome")>0?(u.browser=t.match(o)[0].split("/")[0],u.browserVersion=t.match(o)[0].split("/")[1],u):(u.code=-1,u)},WebToolkit.getWxappInfo=function(){return{system:"WXAPP",browser:"WXAPP",browserVersion:"1.0"}},WebToolkit.getReactNativeInfo=function(){return{system:"RNNative",browser:"RNNative",browserVersion:"1.0"}},WebToolkit.getUniAppInfo=function(){return{system:"UNIAPP",browser:"UNIAPP",browserVersion:"1.0"}},WebToolkit.loadJS=function(t,e){var n=document.createElement("script"),r=e||function(){};n.type="text/javascript";var i=!1;for(var o in document.getElementsByTagName("head")[0].children){var s=document.getElementsByTagName("head")[0].children[o];void 0!==s.outerHTML&&s.outerHTML.indexOf(t)>=0&&(i=!0)}i?r():(n.readyState?n.onreadystatechange=function(){"loaded"!=n.readyState&&"complete"!=n.readyState||(n.onreadystatechange=null,r())}:n.onload=function(){r()},n.src=t,document.getElementsByTagName("head")[0].appendChild(n))},WebToolkit.getIpInfoByFetch=function(callback){var url="http://pv.sohu.com/cityjson?ie=utf-8",fetch=Fetch_1.default.getFetchToolkit(),request={method:"GET",mode:"cors",headers:{"Content-Type":"application/json"}};return fetch(url,request).then((function(t){return t.text()})).then((function(res){if("function"==typeof callback){var currentCity=eval("_current_city="+res.replace("var returnCitySN = ",""));callback(currentCity)}})).catch((function(t){Logger_1.default.trace(t)}))},WebToolkit.getIpInfoByInsertScript=function(t){WebToolkit.loadJS("http://pv.sohu.com/cityjson?ie=utf-8",(function(){t(window.returnCitySN)}))},WebToolkit.getIpInfo=function(t){WebToolkit.getIpInfoByFetch(t)},WebToolkit.getDeviceInfo=function(){return WebToolkit.getUniAppInfo()},WebToolkit.base64Encode=function(t){return Base64.encode(t)},WebToolkit.base64Decode=function(t){return Base64.decode(t)},WebToolkit}();exports.default=WebToolkit},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";n.r(e),n.d(e,"Headers",(function(){return p})),n.d(e,"Request",(function(){return v})),n.d(e,"Response",(function(){return C})),n.d(e,"DOMException",(function(){return I})),n.d(e,"fetch",(function(){return R}));var r="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==r&&r,i="URLSearchParams"in r,o="Symbol"in r&&"iterator"in Symbol,s="FileReader"in r&&"Blob"in r&&function(){try{return new Blob,!0}catch(t){return!1}}(),a="FormData"in r,u="ArrayBuffer"in r;if(u)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],f=ArrayBuffer.isView||function(t){return t&&l.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(t)||""===t)throw new TypeError('Invalid character in header field name: "'+t+'"');return t}function h(t){return"string"!=typeof t&&(t=String(t)),t}function d(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return o&&(e[Symbol.iterator]=function(){return e}),e}function p(t){this.map={},t instanceof p?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function _(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function y(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function g(t){var e=new FileReader,n=y(e);return e.readAsArrayBuffer(t),n}function m(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(t){var e;this.bodyUsed=this.bodyUsed,this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:s&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:a&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:i&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():u&&s&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=m(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u&&(ArrayBuffer.prototype.isPrototypeOf(t)||f(t))?this._bodyArrayBuffer=m(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("Content-Type")||("string"==typeof t?this.headers.set("Content-Type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("Content-Type",this._bodyBlob.type):i&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("Content-Type","application/x-www-form-urlencoded;charset=UTF-8"))},s&&(this.blob=function(){var t=_(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){if(this._bodyArrayBuffer){var t=_(this);return t||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer))}return this.blob().then(g)}),this.text=function(){var t,e,n,r=_(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=y(e),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},a&&(this.formData=function(){return this.text().then(S)}),this.json=function(){return this.text().then(JSON.parse)},this}p.prototype.append=function(t,e){t=c(t),e=h(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},p.prototype.delete=function(t){delete this.map[c(t)]},p.prototype.get=function(t){return t=c(t),this.has(t)?this.map[t]:null},p.prototype.has=function(t){return this.map.hasOwnProperty(c(t))},p.prototype.set=function(t,e){this.map[c(t)]=h(e)},p.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},p.prototype.keys=function(){var t=[];return this.forEach((function(e,n){t.push(n)})),d(t)},p.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),d(t)},p.prototype.entries=function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),d(t)},o&&(p.prototype[Symbol.iterator]=p.prototype.entries);var E=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function v(t,e){if(!(this instanceof v))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');var n,r,i=(e=e||{}).body;if(t instanceof v){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new p(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new p(e.headers)),this.method=(n=e.method||this.method||"GET",r=n.toUpperCase(),E.indexOf(r)>-1?r:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(i),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==e.cache&&"no-cache"!==e.cache)){var o=/([?&])_=[^&]*/;if(o.test(this.url))this.url=this.url.replace(o,"$1_="+(new Date).getTime());else{this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}}function S(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}})),e}function T(t){var e=new p;for(var n in t)e.append(n,t[n]);return e}function C(t,e){if(!(this instanceof C))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText=void 0===e.statusText?"":""+e.statusText,this.headers=new p(e.headers),this.url=e.url||"",this._initBody(t)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},b.call(v.prototype),b.call(C.prototype),C.prototype.clone=function(){return new C(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},C.error=function(){var t=new C(null,{status:0,statusText:""});return t.type="error",t};var w=[301,302,303,307,308];C.redirect=function(t,e){if(-1===w.indexOf(e))throw new RangeError("Invalid status code");return new C(null,{status:e,headers:{location:t}})};var I=r.DOMException;try{new I}catch(t){(I=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack}).prototype=Object.create(Error.prototype),I.prototype.constructor=I}function R(t,e){return new Promise((function(n,i){var o=new v(t,e);if(o.signal&&o.signal.aborted)return i(new I("Aborted","AbortError"));function s(t){try{if("object"==typeof t)return JSON.stringify(t);if("string"==typeof t)return t}catch(t){}return t.toString()}let a=void 0===o._bodyInit?null:o._bodyInit;o.headers.hasOwnProperty("Content-Type")&&o.headers["Content-Type"].indexOf("application/json")>=0&&"POST"===o.method.toUpperCase()&&(a=JSON.parse(a));const u=uni.request({url:function(t){try{return""===t&&r.location.href?r.location.href:t}catch(e){return t}}(o.url),method:o.method,data:a,header:o.headers.map,complete:t=>{if(o.signal&&o.signal.removeEventListener("abort",l),t.errMsg.indexOf("fail")>=0)setTimeout((function(){i(new TypeError("Network request failed"))}),0);else{var e={status:t.statusCode,statusText:t.data?s(t.data):"",headers:T(t.header||{})};e.url=e.headers.get("X-Request-URL");var r=e.statusText;setTimeout((function(){n(new C(r,e))}),0)}}});function l(){u.abort()}o.signal&&o.signal.addEventListener("abort",l)}))}R.polyfill=!0,r.fetch||(r.fetch=R,r.Headers=p,r.Request=v,r.Response=C)},function(t,e,n){var r;if("object"==typeof globalThis)r=globalThis;else try{r=n(11)}catch(t){}finally{if(r||"undefined"==typeof window||(r=window),!r)throw new Error("Could not determine global this")}var i=r.WebSocket||r.MozWebSocket,o=n(12);function s(t,e){return e?new i(t,e):new i(t)}i&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(t){Object.defineProperty(s,t,{get:function(){return i[t]}})})),t.exports={w3cwebsocket:i?s:null,version:o}},function(t,e){var n=function(){if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;throw new Error("Unable to resolve global `this`")};t.exports=function(){if(this)return this;if("object"==typeof globalThis&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(t){return n()}try{return __global__||n()}finally{delete Object.prototype.__global__}}()},function(t,e,n){t.exports=n(13).version},function(t){t.exports=JSON.parse('{"name":"websocket","description":"Websocket Client & Server Library implementing the WebSocket protocol as specified in RFC 6455.","keywords":["websocket","websockets","socket","networking","comet","push","RFC-6455","realtime","server","client"],"author":"Brian McKelvey <theturtle32@gmail.com> (https://github.com/theturtle32)","contributors":["Iñaki Baz Castillo <ibc@aliax.net> (http://dev.sipdoc.net)"],"version":"1.0.34","repository":{"type":"git","url":"https://github.com/theturtle32/WebSocket-Node.git"},"homepage":"https://github.com/theturtle32/WebSocket-Node","engines":{"node":">=4.0.0"},"dependencies":{"bufferutil":"^4.0.1","debug":"^2.2.0","es5-ext":"^0.10.50","typedarray-to-buffer":"^3.1.5","utf-8-validate":"^5.0.2","yaeti":"^0.0.6"},"devDependencies":{"buffer-equal":"^1.0.0","gulp":"^4.0.2","gulp-jshint":"^2.0.4","jshint-stylish":"^2.2.1","jshint":"^2.0.0","tape":"^4.9.1"},"config":{"verbose":false},"scripts":{"test":"tape test/unit/*.js","gulp":"gulp"},"main":"index","directories":{"lib":"./lib"},"browser":"lib/browser.js","license":"Apache-2.0"}')},function(t,e,n){"use strict";e.__esModule=!0,e.RequestBase=void 0;var r=function(t,e,n){this.appId=t,this.clientType=e,this.imei=n};e.RequestBase=r},function(t,e,n){"use strict";e.__esModule=!0,e.RequestParams=void 0;var r=function(t,e,n){this.appId=t,this.identifier=e,this.userSign=n};e.RequestParams=r},function(t,e,n){"use strict";e.__esModule=!0;var r=n(0),i=n(2),o=n(17),s=n(1),a=n(3),u=function(){function t(t){this.url="",this.url=t}return t.prototype.call=function(t,e,n){var o=i.imClient.userId;r.default.info(o);var a=this.url+t;null!=e&&(a+=this.setQueryConfig(e));n=this.setQueryToBody(e,n);var u={method:"POST",headers:{"Content-Type":"application/json"},body:s.default.json(n)};return this.httpFetch(a,u)},t.prototype.setQueryToBody=function(t,e){for(var n in t)e[n]=t[n];return e},t.prototype.setQueryConfig=function(t){var e="?";for(var n in t)e+=n+"="+t[n]+"&";return e=e.substring(0,e.length-1)},t.prototype.httpFetch=function(t,e){var n=this;return console.log("httpFetch"),a.default.getFetchToolkit()(t,e).then((function(t){return t.json()})).then((function(i){r.default.info("==> ["+e.method+"] "+t+" back:"+s.default.json(i));var o=n.response2ApiResponse(i);return o.isFailed()?Promise.reject(o):Promise.resolve(o)}))},t.prototype.response2ApiResponse=function(t){var e=new o.default(!0);return e.data=t.data,e.msg=t.msg,e.code=t.code,e},t}();e.default=u},function(t,e,n){"use strict";e.__esModule=!0;var r=function(){function t(t){void 0===t&&(t=!1),this.msg="",this.data=null,t&&(this.code=200)}return t.prototype.isSucceed=function(){return 200===this.code},t.prototype.isFailed=function(){return!this.isSucceed()},t}();e.default=r},function(t,e,n){"use strict";var r,i,o,s,a,u;e.__esModule=!0,e.ConversationEventCommand=e.UserEventCommand=e.SystemCommand=e.GroupCommand=e.FriendShipCommand=e.MessageCommand=void 0,function(t){t[t.MSG_P2P=1103]="MSG_P2P",t[t.MSG_P2P_SYNC=1108]="MSG_P2P_SYNC",t[t.MSG_READED=1106]="MSG_READED",t[t.MSG_RECIVE_ACK=1107]="MSG_RECIVE_ACK",t[t.MSG_ACK=1046]="MSG_ACK",t[t.MSG_RECALL=1050]="MSG_RECALL",t[t.MSG_RECALL_NOTIFY=1052]="MSG_RECALL_NOTIFY",t[t.MSG_RECALL_ACK=1051]="MSG_RECALL_ACK",t[t.MSG_READED_NOTIFY=1053]="MSG_READED_NOTIFY",t[t.MSG_READED_RECEIPT=1054]="MSG_READED_RECEIPT"}(r||(r={})),e.MessageCommand=r,function(t){t[t.FRIEND_ADD=3e3]="FRIEND_ADD",t[t.FRIEND_UPDATE=3001]="FRIEND_UPDATE",t[t.FRIEND_DELETE=3002]="FRIEND_DELETE",t[t.FRIEND_REQUEST=3003]="FRIEND_REQUEST",t[t.FRIEND_REQUEST_READ=3004]="FRIEND_REQUEST_READ",t[t.FRIEND_REQUEST_APPROVER=3005]="FRIEND_REQUEST_APPROVER",t[t.FRIEND_BLACK_ADD=3010]="FRIEND_BLACK_ADD",t[t.FRIEND_BLACK_DELETE=3011]="FRIEND_BLACK_DELETE",t[t.FRIEND_GROUP_ADD=3012]="FRIEND_GROUP_ADD",t[t.FRIEND_GROUP_DELETE=3013]="FRIEND_GROUP_DELETE",t[t.FRIEND_GROUP_MEMBER_ADD=3014]="FRIEND_GROUP_MEMBER_ADD",t[t.FRIEND_GROUP_MEMBER_DELETE=3015]="FRIEND_GROUP_MEMBER_DELETE"}(i||(i={})),e.FriendShipCommand=i,function(t){t[t.JOIN_GROUP=2e3]="JOIN_GROUP",t[t.ADDED_MEMBER=2001]="ADDED_MEMBER",t[t.CREATED_GROUP=2002]="CREATED_GROUP",t[t.UPDATED_GROUP=2003]="UPDATED_GROUP",t[t.EXIT_GROUP=2004]="EXIT_GROUP",t[t.UPDATED_MEMBER=2005]="UPDATED_MEMBER",t[t.DELETED_MEMBER=2006]="DELETED_MEMBER",t[t.DESTROY_GROUP=2007]="DESTROY_GROUP",t[t.TRANSFER_GROUP=2008]="TRANSFER_GROUP",t[t.MUTE_GROUP=2009]="MUTE_GROUP",t[t.SPEAK_GOUP_MEMBER=2010]="SPEAK_GOUP_MEMBER",t[t.MSG_GROUP=2104]="MSG_GROUP",t[t.MSG_GROUP_SYNC=2105]="MSG_GROUP_SYNC",t[t.GROUP_MSG_ACK=2047]="GROUP_MSG_ACK"}(o||(o={})),e.GroupCommand=o,function(t){t[t.PING=9999]="PING",t[t.LOGIN=9e3]="LOGIN",t[t.LOGINACK=9001]="LOGINACK",t[t.MUTUALLOGIN=9002]="MUTUALLOGIN",t[t.LOGOUT=9003]="LOGOUT"}(s||(s={})),e.SystemCommand=s,function(t){t[t.USER_MODIFY=4e3]="USER_MODIFY",t[t.USER_ONLINE_STATUS_CHANGE=4001]="USER_ONLINE_STATUS_CHANGE",t[t.USER_ONLINE_STATUS_SUBSCRIBE=4002]="USER_ONLINE_STATUS_SUBSCRIBE",t[t.PULL_USER_ONLINE_STATUS=4003]="PULL_USER_ONLINE_STATUS",t[t.USER_ONLINE_STATUS_CHANGE_NOTIFY=4004]="USER_ONLINE_STATUS_CHANGE_NOTIFY"}(a||(a={})),e.UserEventCommand=a,function(t){t[t.CONVERSATION_DELETE=5e3]="CONVERSATION_DELETE",t[t.CONVERSATION_UPDATE=5001]="CONVERSATION_UPDATE"}(u||(u={})),e.ConversationEventCommand=u},function(t,e,n){"use strict";e.__esModule=!0,e.MessagePack=void 0;var r=n(1),i=function(){function t(t){this.messageId=r.default.uuid(),this.appId=t,this.messageRandom=this.RangeInteger(0,1e4),this.messageTime=Date.parse((new Date).toString())}return t.prototype.RangeInteger=function(t,e){var n=e-t;return Math.floor(Math.random()*n)+t},t.prototype.buildTextMessagePack=function(t,e,n){this.fromId=t,this.toId=e,console.warn(typeof n),console.log(n);var i=n;this.messageBody=r.default.json(i)},t.prototype.buildCustomerMessagePack=function(t,e,n,i){this.fromId=t,this.toId=e;var o={type:n,content:i};this.messageBody=r.default.json(o)},t}();e.MessagePack=i}])}));
|
||
//# sourceMappingURL=lim-sdk.js.map
|