!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.io=e():t.io=e()}(this,function(){return function(t){var e={};function n(o){if(e[o])return e[o].exports;var r=e[o]={exports:{},id:o,loaded:!1};return t[o].call(r.exports,r,r.exports,n),r.loaded=!0,r.exports}return n.m=t,n.c=e,n.p="",n(0)}([function(t,e,n){"use strict";var o=n(1);window.JMessage=t.exports=o},function(t,e,n){"use strict";var o=n(2),r=n(5),i=n(6),s=n(59),a=n(60),c=n(61),u=n(62),p=n(63)(),h=n(64),l=function(t){var e=t||{};this.opts={address:e.address?e.address:s.WSS_ADDRESS,upload_file:e.upload_file?e.upload_file:s.UPLOAD_FILE,download_file:e.download_file?e.download_file:s.DOWNLOAD_FILE,debug:!!e.debug},this.channel=new i(this.opts),this.syncTask=0,this.msgReceipTask=0};l.prototype.init=function(t){var e=this;return e.autoDiscon=!0,t.flag!==s.SYNC_TYPE_OPEN&&t.flag!==s.SYNC_TYPE_CLOSE||(e.channel.sync_type=t.flag),t.fromPlatForm=s.FROM_PLATFORM,new a(this.channel).setEvent(s.EVENTS.INIT).setData(t).send().addHook(function(n,o){e.current_appkey=t.appkey,o&&o(n)})},l.prototype.loginOut=function(){if(this.current_user){this.autoDiscon=!1,this.channel.client.close();var t=this.channel.dataCache;for(var e in t)t[e].cleanAckTimeout(),t[e].cleanRespTimeout();this.current_user=null,this.current_appkey=null,this.channel.init(this.channel.opts)}},l.prototype.login=function(t){this.__checkInit(),t.is_md5||(t.password=p(t.password)),t.version=s.SDK_VERSION;var e=this,n=new a(this.channel).setEvent(s.EVENTS.LOGIN).setData(t).addHook(function(n,o){e.current_user=t.username,h.StorageUtils.removeItems(e.current_user),e.channel.sync_key=0,e.channel.sync_event_key=0,e.channel.msg_receipt_key=0,e.channel.ses_key=s.SESSION_KEY+e.current_appkey+"-"+e.current_user,e.channel.conversations_key=s.CONVERSATION_KEY+e.current_appkey+"-"+e.current_user,e.channel.event_key=s.EVENT_KEY+e.current_appkey+"-"+e.current_user,e._syncCheckTask(),e._receiptReportTask(),e._initConversation(),e.lastMsgs={},e.channel.client.removeListener(s.EVENTS.LOGIN),e._addEventListen(),e.firstLogin=!1,o&&o(n)});return setTimeout(function(){n.send()},500),n},l.prototype._initConversation=function(){var t=this,e=h.StorageUtils.getItem(t.channel.conversations_key);null===e&&(e=JSON.stringify({}),h.StorageUtils.addItem(t.channel.conversations_key,e)),t.conversations=JSON.parse(e)},l.prototype._receiptReportTask=function(){var t=this;t.report=[],t.msgReceipTask=setInterval(function(){t._receiptReport()},s.RECEIPT_REPORT_INTERVAL)},l.prototype._syncCheckTask=function(){var t=this,e=h.StorageUtils.getItem(t.channel.event_key);null!=e&&(t.channel.sync_event_key=e),t._syncCheck({sync_key:t.channel.sync_key,sync_type:t.channel.sync_type,sync_event_key:t.channel.sync_event_key,msg_receipt_key:t.channel.msg_receipt_key}).onSuccess(function(e){e&&0===e.code&&(t.channel.sync_key=e.sync_key,t.channel.sync_type=e.sync_type,t.channel.sync_event_key=e.sync_event_key,t.channel.msg_receipt_key=e.msg_receipt_key,h.StorageUtils.addItem(t.channel.event_key,e.sync_event_key))}),t.syncTask=setInterval(function(){t._syncCheck({sync_key:t.channel.sync_key,sync_type:t.channel.sync_type,sync_event_key:t.channel.sync_event_key,msg_receipt_key:t.channel.msg_receipt_key}).onSuccess(function(e){e&&0===e.code&&(t.channel.sync_key=e.sync_key,t.channel.sync_type=e.sync_type,t.channel.sync_event_key=e.sync_event_key,t.channel.msg_receipt_key=e.msg_receipt_key,h.StorageUtils.addItem(t.channel.event_key,e.sync_event_key))})},s.SYNC_INTERVAL)},l.prototype._syncCheck=function(t){return new a(this.channel).setEvent(s.EVENTS.SYNC_CHECK).setData(t).send()},l.prototype.register=function(t){return this.__checkInit(),t.is_md5||(t.password=p(t.password)),new a(this.channel).setEvent(s.EVENTS.REGISTER).setData(t).send()},l.prototype.getUserInfo=function(t){return this.__checkLogin(),h.StringUtils.isBlack(t.appkey)&&(t.appkey=this.current_appkey),new a(this.channel).setEvent(s.EVENTS.GET_ACROSS_USER_INFO).setData(t).send()},l.prototype.updateSelfInfo=function(t){return this.__checkLogin(),h.StringUtils.isBlack(t.avatar)||delete t.avatar,new a(this.channel).setEvent(s.EVENTS.UPDATE_SELF_INFO).setData(t).send()},l.prototype.updateSelfAvatar=function(t){this.__checkLogin();var e=new a(this.channel).setEvent(s.EVENTS.UPDATE_SELF_INFO);return this.__uploadFile({appkey:this.current_appkey,username:this.current_user,file:t.avatar,type:"image"},function(t,n){if(t)return t.is_timeout?e.timeout&&e.timeout(t.data):e.fail&&e.fail(t.data);e.setData({avatar:n.media_id}).send()}),e},l.prototype.updateSelfPwd=function(t){return this.__checkLogin(),t.is_md5||(t.old_pwd=p(t.old_pwd),t.new_pwd=p(t.new_pwd)),new a(this.channel).setEvent(s.EVENTS.UPDATE_SELF_PWD).setData(t).send()},l.prototype.getConversation=function(){this.__checkLogin();var t=this;return new a(this.channel).setEvent(s.EVENTS.GET_CONVERSATIONS).setData({}).send().addHook(function(e,n){e.conversations.forEach(function(e){var n;3===e.type?(t[e.key]=e.utime,delete e.utime,n=e.appkey+e.username):(n=e.key,e.gid=e.key),t.conversations[n]?(t.conversations[n].extras?e.extras=t.conversations[n].extras:e.extras={},e.unread_msg_count=t.conversations[n].unread_msg_count):(e.extras={},e.unread_msg_count=0,t.conversations[n]={},t.conversations[n].extras={},t.conversations[n].unread_msg_count=0,t.conversations[n].msg_time=[])}),h.StorageUtils.addItem(t.channel.conversations_key,JSON.stringify(t.conversations)),n&&n(e)})},l.prototype.resetUnreadCount=function(t){this.__checkLogin();var e,n=this;t.gid?e=String(t.gid):(t.appkey||(t.appkey=n.current_appkey),e=t.appkey+t.username),n.conversations[e]=void 0===n.conversations[e]?{}:n.conversations[e],t.gid?n._updateGroupUnreadCount({gid:t.gid}):n._updateSingleUnreadCount({appkey:t.appkey,username:t.username}),n.conversations[e].unread_msg_count=0,n.conversations[e].msg_time=[];var o=(new Date).getTime();n.lastMsgs[e]&&(o=n.lastMsgs[e].last_msg_time),n.conversations[e].recent_time=o,n.current_conversation=e,h.StorageUtils.addItem(n.channel.conversations_key,JSON.stringify(n.conversations))},l.prototype.getUnreadMsgCnt=function(t){this.__checkLogin();var e,n=this;return t.gid?e=String(t.gid):(t.appkey||(t.appkey=n.current_appkey),e=t.appkey+t.username),n.conversations[e]||(n.conversations[e]={}),n.conversations[e].unread_msg_count?n.conversations[e].unread_msg_count:0},l.prototype.msgRetract=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.MSG_RETRACT).setData(t).send()},l.prototype.sendSingleMsg=function(t){return this.__sendMsg({type:"single",target_id:t.target_username,target_name:t.target_nickname,content:t.content,extras:t.extras,msg_body:t.msg_body,appkey:t.appkey,no_offline:t.no_offline,no_notification:t.no_notification,custom_notification:t.custom_notification,need_receipt:t.need_receipt})},l.prototype.sendGroupMsg=function(t){return this.__sendMsg({type:"group",target_id:t.target_gid,target_name:t.target_gname,content:t.content,extras:t.extras,msg_body:t.msg_body,at_list:t.at_list,no_offline:t.no_offline,no_notification:t.no_notification,custom_notification:t.custom_notification,need_receipt:t.need_receipt})},l.prototype.sendSinglePic=function(t){return this.__sendPic({type:"single",target_id:t.target_username,target_name:t.target_nickname,file:t.image,msg_body:t.msg_body,extras:t.extras,appkey:t.appkey,no_offline:t.no_offline,no_notification:t.no_notification,custom_notification:t.custom_notification,need_receipt:t.need_receipt})},l.prototype.sendGroupPic=function(t){return this.__sendPic({type:"group",target_id:t.target_gid,target_name:t.target_gname,file:t.image,msg_body:t.msg_body,extras:t.extras,no_offline:t.no_offline,no_notification:t.no_notification,custom_notification:t.custom_notification,need_receipt:t.need_receipt})},l.prototype.sendSingleFile=function(t){return this.__sendFile({type:"single",target_id:t.target_username,target_name:t.target_nickname,file:t.file,msg_body:t.msg_body,extras:t.extras,appkey:t.appkey,no_offline:t.no_offline,no_notification:t.no_notification,custom_notification:t.custom_notification,need_receipt:t.need_receipt})},l.prototype.sendGroupFile=function(t){return this.__sendFile({type:"group",target_id:t.target_gid,target_name:t.target_gname,file:t.file,msg_body:t.msg_body,extras:t.extras,no_offline:t.no_offline,no_notification:t.no_notification,custom_notification:t.custom_notification,need_receipt:t.need_receipt})},l.prototype.sendSingleLocation=function(t){return this.__sendLocation({type:"single",target_id:t.target_username,target_name:t.target_nickname,latitude:t.latitude,longitude:t.longitude,scale:t.scale,label:t.label,msg_body:t.msg_body,extras:t.extras,appkey:t.appkey,no_offline:t.no_offline,no_notification:t.no_notification,custom_notification:t.custom_notification,need_receipt:t.need_receipt})},l.prototype.sendGroupLocation=function(t){return this.__sendLocation({type:"group",target_id:t.target_gid,target_name:t.target_gname,latitude:t.latitude,longitude:t.longitude,scale:t.scale,label:t.label,msg_body:t.msg_body,extras:t.extras,no_offline:t.no_offline,no_notification:t.no_notification,custom_notification:t.custom_notification,need_receipt:t.need_receipt})},l.prototype.sendSingleCustom=function(t){return this.__sendCustom({type:"single",target_id:t.target_username,target_name:t.target_nickname,custom:t.custom,extras:t.extras,msg_body:t.msg_body,appkey:t.appkey,no_offline:t.no_offline,no_notification:t.no_notification,custom_notification:t.custom_notification,need_receipt:t.need_receipt})},l.prototype.sendGroupCustom=function(t){return this.__sendCustom({type:"group",target_id:t.target_gid,target_name:t.target_gname,custom:t.custom,msg_body:t.msg_body,extras:t.extras,no_offline:t.no_offline,no_notification:t.no_notification,custom_notification:t.custom_notification,need_receipt:t.need_receipt})},l.prototype.createGroup=function(t){this.__checkLogin();var e=new a(this.channel).setEvent(s.EVENTS.CREATE_GROUP);return t.avatar?this.__uploadFile({appkey:this.current_appkey,username:this.current_user,file:t.avatar,type:"image"},function(n,o){if(n)return n.is_timeout?e.timeout&&e.timeout(n.data):e.fail&&e.fail(n.data);delete t.avatar,t.media_id=o.media_id,e.setData(t).send()}):e.setData(t).send(),e},l.prototype.exitGroup=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.EXIT_GROUP).setData(t).send()},l.prototype.getGroups=function(){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.GET_GROUPS_LIST).setData({}).send().addHook(function(t,e){t.group_list.forEach(function(t){t.group_type=t.flag,delete t.flag}),e&&e(t)})},l.prototype.getGroupInfo=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.GET_GROUP_INFO).setData(t).send().addHook(function(t,e){t.group_info.group_type=t.group_info.flag,delete t.group_info.flag,e&&e(t)})},l.prototype.updateGroupInfo=function(t){this.__checkLogin();var e=new a(this.channel).setEvent(s.EVENTS.UPDATE_GROUP_INFO);return t.avatar?this.__uploadFile({appkey:this.current_appkey,username:this.current_user,file:t.avatar,type:"image"},function(n,o){if(n)return n.is_timeout?e.timeout&&e.timeout(n.data):e.fail&&e.fail(n.data);delete t.avatar,t.media_id=o.media_id,e.setData(t).send()}):e.setData(t).send(),e},l.prototype.getGroupMembers=function(t){this.__checkLogin();var e=this;return new a(this.channel).setEvent(s.EVENTS.GET_GROUP_MEMBERS).setData(t).send().onUserInfoGet(function(t,n){e[t]=n})},l.prototype.addGroupMembers=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.ADD_ACROSS_GROUP_MEMBER).setData(t).send()},l.prototype.delGroupMembers=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.DEL_ACROSS_GROUP_MEMBER).setData(t).send()},l.prototype.getNoDisturb=function(){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.NO_DISTURB).setData({version:0}).send().addHook(function(t,e){t.no_disturb.groups.forEach(function(t){t.group_type=t.flag,delete t.flag}),e&&e(t)})},l.prototype.addSingleNoDisturb=function(t){return this.__checkLogin(),t.version=0,new a(this.channel).setEvent(s.EVENTS.ADD_MSG_NO_DISTURB_SINGLE).setData(t).send()},l.prototype.delSingleNoDisturb=function(t){return this.__checkLogin(),t.version=0,new a(this.channel).setEvent(s.EVENTS.DELETE_MSG_NO_DISTURB_SINGLE).setData(t).send()},l.prototype.addGroupNoDisturb=function(t){return this.__checkLogin(),t.version=0,new a(this.channel).setEvent(s.EVENTS.ADD_MSG_NO_DISTURB_GROUP).setData(t).send()},l.prototype.delGroupNoDisturb=function(t){return this.__checkLogin(),t.version=0,new a(this.channel).setEvent(s.EVENTS.DELETE_MSG_NO_DISTURB_GROUP).setData(t).send()},l.prototype.addGlobalNoDisturb=function(){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.ADD_MSG_NO_DISTURB_GLOBAL).setData({version:0}).send()},l.prototype.delGlobalNoDisturb=function(){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.DELETE_MSG_NO_DISTURB_GLOBAL).setData({version:0}).send()},l.prototype.getBlacks=function(){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.GET_BLACK_LIST).setData({version:0}).send()},l.prototype.addSingleBlacks=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.ADD_BLACK_LIST).setData(t).send()},l.prototype.delSingleBlacks=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.DEL_BLACK_LIST).setData(t).send()},l.prototype.getFriendList=function(){this.__checkLogin();var t=this;return new a(this.channel).setEvent(s.EVENTS.GET_FRIEND_LIST).setData({}).send().onUserInfoGet(function(e,n){t[e]=n})},l.prototype.addFriend=function(t){return this.__checkLogin(),t.from_type=s.FRIEND_INVITE,new a(this.channel).setEvent(s.EVENTS.ADD_FRIEND).setData(t).send()},l.prototype.acceptFriend=function(t){return this.__checkLogin(),t.why="yes",t.from_type=s.FRIEND_INVITED,new a(this.channel).setEvent(s.EVENTS.ADD_FRIEND).setData(t).send()},l.prototype.declineFriend=function(t){return this.__checkLogin(),t.why&&""!=t.why.trim()||(t.why="no"),t.from_type=s.FRIEND_INVITED,new a(this.channel).setEvent(s.EVENTS.ADD_FRIEND).setData(t).send()},l.prototype.delFriend=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.DEL_FRIEND).setData(t).send()},l.prototype.updateFriendMemo=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.UPDATE_FRIEND_MEMO).setData(t).send()},l.prototype.addGroupShield=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.ADD_MSG_SHIELD_GROUP).setData(t).send()},l.prototype.delGroupShield=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.DEL_MSG_SHIELD_GROUP).setData(t).send()},l.prototype.groupShieldList=function(){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.LIST_SHIELD_GROUP).setData({}).send().addHook(function(t,e){t.groups.forEach(function(t){t.group_type=t.flag,delete t.flag}),e&&e(t)})},l.prototype.getResource=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.GET_RESOURCE).setData(t).send()},l.prototype._updateGroupUnreadCount=function(t){this.__checkLogin(),t.type=4,new a(this.channel).setEvent(s.EVENTS.UNREAD_GROUP_COUNT).setData(t).send()},l.prototype._updateSingleUnreadCount=function(t){this.__checkLogin(),t.type=3,new a(this.channel).setEvent(s.EVENTS.UNREAD_SINGLE_COUNT).setData(t).send()},l.prototype.msgUnreadList=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.MSG_UNREAD_LIST).setData(t).send()},l.prototype.addGroupReceiptReport=function(t){this.__checkLogin();var e=this;if(t.msg_ids instanceof Array&&0!==t.msg_ids.length){t.key=t.gid,t.type=4;var n=new c(t);return e.report.push(n),setTimeout(function(){e._checkReportSize()>=s.RECEIPT_REPORT_MAX_SIZE&&e._receiptReport()},50),n}console.error("msg_ids is not Array type or msg_ids size=0")},l.prototype.addSingleReceiptReport=function(t){this.__checkLogin();var e=this;if(t.msg_ids instanceof Array&&0!==t.msg_ids.length){t.appkey||(t.appkey=e.current_appkey),t.type=3,t.key=t.appkey+t.username;var n=new c(t);return e.report.push(n),setTimeout(function(){e._checkReportSize()>=s.RECEIPT_REPORT_MAX_SIZE&&e._receiptReport()},50),n}console.error("msg_ids is not Array type or msg_ids size=0")},l.prototype._checkReportSize=function(){var t=0;return this.report.forEach(function(e){t+=e.args.msg_ids.length}),t},l.prototype.transSingleMsg=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.TRANS_MSG_SINGLE).setData(t).send()},l.prototype.transGroupMsg=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.TRANS_MSG_GROUP).setData(t).send()},l.prototype.transPlatMsg=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.TRANS_MSG_PLATFORM).setData(t).send()},l.prototype.updateConversation=function(t){this.__checkLogin();var e,n=this;t.appkey||(t.appkey=n.current_appkey),t.gid?e=t.gid:t.username&&(e=t.appkey+t.username),e&&t.extras&&(n.conversations[e]||(n.conversations[e]={}),n.conversations[e].extras=t.extras),h.StorageUtils.addItem(n.channel.conversations_key,JSON.stringify(n.conversations))},l.prototype.addGroupMemberResp=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.ADMIN_ADD_GROUP_MEMBER).setData(t).send()},l.prototype.joinGroup=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.APPLY_JOIN_GROUP).setData(t).send()},l.prototype.getAppkeyChatrooms=function(t){return this.__checkLogin(),!t&&(t={}),new a(this.channel).setEvent(s.EVENTS.ROOM_LIST).setData(t).send().addHook(function(t,e){t.result.rooms.forEach(function(t){h.Cache.rooms[t.id]=t}),e&&e(t)})},l.prototype.getSelfChatrooms=function(){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.ROOM_LIST_SELF).setData({}).send().addHook(function(t,e){t.chat_rooms.forEach(function(t){h.Cache.rooms[t.id]=t}),e&&e(t)})},l.prototype.getChatroomInfo=function(t){this.__checkLogin();var e=new a(this.channel);return h.Cache.rooms[t.id]?setTimeout(function(){var n={code:0,message:"success"};n.info=h.Cache.rooms[t.id],e.cleanRespTimeout(),e.success&&e.success(n)},100):e.setEvent(s.EVENTS.ROOM_INFO).setData(t).send().addHook(function(t,e){h.Cache.rooms[t.info.id]=t.info,e&&e(t)}),e},l.prototype.enterChatroom=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.JOIN_ROOM).setData(t).send()},l.prototype.exitChatroom=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.EXIT_ROOM).setData(t).send()},l.prototype.sendChatroomMsg=function(t){return this.__checkLogin(),t.target_rname||(t.target_rname=void 0===h.Cache.rooms[t.target_rid]?"":h.Cache.rooms[t.target_rid].name),this.__sendMsg({type:"chatroom",target_id:t.target_rid,target_name:t.target_rname,content:t.content,extras:t.extras,msg_body:t.msg_body})},l.prototype.sendChatroomPic=function(t){return this.__checkLogin(),t.target_rname||(t.target_rname=void 0===h.Cache.rooms[t.target_rid]?"":h.Cache.rooms[t.target_rid].name),this.__sendPic({type:"chatroom",target_id:t.target_rid,target_name:t.target_rname,file:t.image,extras:t.extras,msg_body:t.msg_body})},l.prototype.sendChatroomFile=function(t){return this.__checkLogin(),t.target_rname||(t.target_rname=void 0===h.Cache.rooms[t.target_rid]?"":h.Cache.rooms[t.target_rid].name),this.__sendFile({type:"chatroom",target_id:t.target_rid,target_name:t.target_rname,file:t.file,extras:t.extras,msg_body:t.msg_body})},l.prototype.sendChatroomCustom=function(t){return this.__checkLogin(),t.target_rname||(t.target_rname=void 0===h.Cache.rooms[t.target_rid]?"":h.Cache.rooms[t.target_rid].name),this.__sendCustom({type:"chatroom",target_id:t.target_rid,target_name:t.target_rname,custom:t.custom,extras:t.extras,msg_body:t.msg_body})},l.prototype.sendChatroomLocation=function(t){return this.__checkLogin(),t.target_rname||(t.target_rname=void 0===h.Cache.rooms[t.target_rid]?"":h.Cache.rooms[t.target_rid].name),this.__sendLocation({type:"chatroom",target_id:t.target_rid,target_name:t.target_rname,latitude:t.latitude,longitude:t.longitude,scale:t.scale,label:t.label,extras:t.extras,msg_body:t.msg_body})},l.prototype.addGroupMemSilence=function(t){return this.__checkLogin(),t.keep_silence=!0,new a(this.channel).setEvent(s.EVENTS.GROUP_MEM_SILENCE).setData(t).send()},l.prototype.delGroupMemSilence=function(t){return this.__checkLogin(),t.keep_silence=!1,new a(this.channel).setEvent(s.EVENTS.GROUP_MEM_SILENCE).setData(t).send()},l.prototype.dissolveGroup=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.DISSOLVE_GROUP).setData(t).send()},l.prototype.addGroupKeeper=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.ADD_GROUP_KEEPER).setData(t).send()},l.prototype.delGroupKeeper=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.DEL_GROUP_KEEPER).setData(t).send()},l.prototype.changeGroupAdmin=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.CHANGE_GROUP_ADMIN).setData(t).send()},l.prototype.getAppkeyPublicGroups=function(t){return this.__checkLogin(),new a(this.channel).setEvent(s.EVENTS.PUBLIC_GROUP_LIST).setData(t).send().addHook(function(t,e){t.result.groups.forEach(function(t){t.group_type=t.flag,delete t.flag}),e&&e(t)})},l.prototype.isInit=function(){return!!this.current_appkey},l.prototype.isLogin=function(){return!!this.current_user},l.prototype.isConnect=function(){return!!this.channel.client.connected},l.prototype._addEventListen=function(){var t=this;t.channel.client.on(s.EVENTS.MSG_SYNC,function(e){t._onMsgReceive(e)}),t.channel.client.on(s.EVENTS.EVENT_NOTIFICATION,function(e){t._onEventNotification(e)}),t.channel.client.on(s.EVENTS.SYNC_CONVERSATION,function(e){t._onSyncConversation(e)}),t.channel.client.on(s.EVENTS.SYNC_EVENT,function(e){t._onSyncEvent(e)}),t.channel.client.on(s.EVENTS.SYNC_RECEIPT,function(e){t._onSyncMsgReceipt(e)}),t.channel.client.on(s.EVENTS.RECEIPT_CHANGE,function(e){t._onMsgReceiptChange(e)}),t.channel.client.on(s.EVENTS.TRANS_MSG_REC,function(e){t._onTransMsgRec(e)}),t.channel.client.on(s.EVENTS.ROOM_MSG_SYNC,function(e){t._onRoomMsg(e)}),t.channel.client.on(s.EVENTS.ROOM_MSG_SYNC_HIS,function(e){t._onSyncRoomMsg(e)}),t.channel.client.on("disconnect",function(){t._onDisconnect()})},l.prototype.onRoomMsg=function(t){this._onRoomMsgFn=t},l.prototype._onRoomMsg=function(t){this._onRoomMsgFn&&this._onRoomMsgFn(t)},l.prototype._onSyncRoomMsg=function(t){var e=this;t.messages.forEach(function(n){h.Cache.rooms[n.room_id]||e.getChatroomInfo({id:t.room_id}),n.msgs&&n.msgs.forEach(function(t){e._onRoomMsgFn&&e._onRoomMsgFn(t)})})},l.prototype.onMsgReceive=function(t){this._onMsgReceiveFn=t},l.prototype._onMsgReceive=function(t){var e=this;Array.prototype.push.apply([],t.messages.map(function(t){return{msg_id:t.msg_id,msg_type:t.msg_type,from_uid:t.from_uid,from_gid:t.from_gid}})),t.messages.forEach(function(t){if(t.content.sui_mtime&&e[t.from_uid]&&t.content.sui_mtime>new Date(e[t.from_uid]).getTime()/1e3){e[t.from_uid]=1e3*t.content.sui_mtime;var n={};n.from_username=t.content.from_id,n.from_appkey=t.content.from_appkey,n.mtime=t.content.sui_mtime,delete t.content.sui_mtime,e._updateInfoEventFun&&e._updateInfoEventFun(n)}var o;3===t.msg_type?(t.key=t.from_uid,t.from_username=t.content.from_id,t.from_appkey=t.content.from_appkey,o=t.from_appkey+t.from_username):(t.key=t.from_gid,o=String(t.from_gid)),0===t.msg_level?t.msg_level="normal":1===t.msg_level&&(t.msg_level="across");var r=!1;t.from_appkey===e.current_appkey&&t.from_username===e.current_user&&(r=!0,o=(void 0===t.content.target_appkey||""===t.content.target_appkey?t.content.from_appkey:t.content.target_appkey)+t.content.target_id);e.lastMsgs[o]={last_msg_time:t.ctime_ms},e.conversations[o]||(e.conversations[o]={},e.conversations[o].extras={},e.conversations[o].unread_msg_count=0,e.conversations[o].msg_time=[]),e.current_conversation===o||r?(e.conversations[o].recent_time=t.ctime_ms,e.conversations[o].unread_msg_count=0,e.conversations[o].msg_time=[]):(e.conversations[o].unread_msg_count=e.conversations[o].unread_msg_count+1,e.conversations[o].msg_time.push(t.ctime_ms)),new a(e.channel).setEvent(s.EVENTS.MSG_RECV_V2).setData({msg_id:t.msg_id,msg_type:t.msg_type,from_uid:t.from_uid,from_gid:t.from_gid}).send()}),h.StorageUtils.addItem(e.channel.conversations_key,JSON.stringify(e.conversations)),this._onMsgReceiveFn&&this._onMsgReceiveFn(t)},l.prototype.onEventNotification=function(t){this._onEventNotificationFn=t},l.prototype._onEventNotification=function(t){var e=this;if(200!==t.event_type){var n=e.__eventDateFilter(t);if(56===t.event_type&&10==t.extra?(n.by_self=!1,delete n.extra):56===t.event_type&&59==t.extra&&(n.by_self=!0,delete n.extra),1===t.event_type){var o={event_id:t.event_id,event_type:t.event_type,from_uid:t.from_uid,gid:t.gid};new a(e.channel).setEvent(s.EVENTS.EVENT_NOTIFICATION).setData(o).send()}e._onEventNotificationFn&&e._onEventNotificationFn(n),-1!=s.LOGIN_OUT_EVENT.indexOf(t.event_type)&&e.loginOut()}else 3===t.description.type?e._dealMutlReadEvent(t.description.type,t.ctime_ms,t.description.appkey,t.description.username):e._dealMutlReadEvent(t.description.type,t.ctime_ms,t.description.gid)},l.prototype.onSyncConversation=function(t){this._onSyncConversationFn=t},l.prototype._onSyncConversation=function(t){var e=this;e.channel.sync_key=t.sync_key,t.messages&&(t.messages.forEach(function(t){var n,o=0;n=3===t.msg_type?t.from_appkey+t.from_username:String(t.from_gid);var r=t.msgs[t.msgs.length-1].ctime_ms;if(e.current_conversation===n)e.conversations[n]=void 0===e.conversations[n]?{}:e.conversations[n],e.conversations[n].unread_msg_count=o,e.conversations[n].recent_time=r,e.conversations[n].msg_time=[];else if(e.conversations[n]&&e.conversations[n].recent_time){var i=e.conversations[n].recent_time;t.msgs.forEach(function(t){t.ctime_ms<=i||t.content.from_appkey===e.current_appkey&&t.content.from_id===e.current_user?(o=0,e.conversations[n].msg_time=[]):(o++,e.conversations[n].msg_time.push(t.ctime_ms))}),e.channel.sync_type===s.SYNC_TYPE_OPEN?e.conversations[n].unread_msg_count=o:e.conversations[n].unread_msg_count+=o}else o=t.unsync_count,e.conversations[n]=void 0===e.conversations[n]?{}:e.conversations[n],e.conversations[n].unread_msg_count=o,t.msgs.length-1-o<0?e.conversations[n].recent_time=-1:e.conversations[n].recent_time=t.msgs[t.msgs.length-1-o].ctime_ms,e.conversations[n].msg_time=[];e.lastMsgs[n]={last_msg_time:r},delete t.unsync_count,t.unread_msg_count=e.conversations[n].unread_msg_count}),h.StorageUtils.addItem(e.channel.conversations_key,JSON.stringify(e.conversations)),e._onSyncConversationFn&&t.messages.length>0&&e._onSyncConversationFn(t.messages));var n={sync_key:e.channel.sync_key};new a(e.channel).setEvent(s.EVENTS.SYNC_CONVERSATION_ACK).setData(n).send()},l.prototype.onSyncEvent=function(t){this._onSyncEventFn=t},l.prototype._onSyncEvent=function(t){var e=this;e.channel.sync_event_key=t.sync_key,h.StorageUtils.addItem(e.channel.event_key,t.sync_key);var n={sync_key:e.channel.sync_event_key};new a(e.channel).setEvent(s.EVENTS.SYNC_EVENT_ACK).setData(n).send(),setTimeout(function(){if(e._onSyncEventFn&&t.events&&t.events.length>0){var n=[];t.events.forEach(function(o){if(200===o.event_type)3===o.description.type?e._dealMutlReadEvent(o.description.type,o.ctime_ms,o.description.appkey,o.description.username):e._dealMutlReadEvent(o.description.type,o.ctime_ms,o.description.gid);else{var r=e.__eventDateFilter(o);56===t.event_type&&10==t.extra?(delete r.extra,r.by_self=!1):56===t.event_type&&59==t.extra&&(delete r.extra,r.by_self=!0),n.push(r)}}),e._onSyncEventFn(n)}},1700)},l.prototype.onSyncMsgReceipt=function(t){this._onSyncMsgReceiptFn=t},l.prototype._onSyncMsgReceipt=function(t){var e=this;if(e.channel.msg_receipt_key=t.sync_key,e._onSyncMsgReceiptFn&&t.receipts&&t.receipts.length>0){var n={},o=[];t.receipts.forEach(function(t){var e=t.gid;if(3===t.type&&(e=t.appkey+t.username),n[e]){var r=Number(n[e]);Array.prototype.push.apply(o[r].receipt_msgs,t.receipt_msgs)}else t.receipt_msgs.length>0&&(n[e]=String(o.length),o.push(t))}),setTimeout(function(){e._onSyncMsgReceiptFn&&o.length>0&&e._onSyncMsgReceiptFn(o)},1500)}var r={sync_key:e.channel.msg_receipt_key};new a(e.channel).setEvent(s.EVENTS.SYNC_RECEIPT_ACK).setData(r).send()},l.prototype.onMsgReceiptChange=function(t){this._onMsgReceiptChangeFn=t},l.prototype._onMsgReceiptChange=function(t){this._onMsgReceiptChangeFn&&this._onMsgReceiptChangeFn(t)},l.prototype.onUserInfUpdate=function(t){this._updateInfoEventFun=t},l.prototype.onMutiUnreadMsgUpdate=function(t){this._conversationUpdateFun=t},l.prototype.onTransMsgRec=function(t){this._onTransMsgRecFn=t},l.prototype._onTransMsgRec=function(t){this._onTransMsgRecFn&&this._onTransMsgRecFn(t)},l.prototype.onDisconnect=function(t){this._onDisconnectFn=t},l.prototype._onDisconnect=function(){var t=this;clearTimeout(t.syncTask),clearTimeout(t.msgReceipTask),t.autoDiscon&&(t.current_appkey=null,t.current_user=null,t._onDisconnectFn&&t._onDisconnectFn()),this.channel.init(this.channel.opts)},l.prototype._dealMutlReadEvent=function(t,e,n,o){var r,i=this,s={};if(s.type=t,3===t?(r=n+o,s.username=o,s.appkey=n):(r=String(n),s.gid=n),i.conversations[r]=void 0===i.conversations[r]?{msg_time:[],unread_msg_count:0}:i.conversations[r],i.conversations[r].recent_time=e,i.current_conversation===r)i.conversations[r].unread_msg_count=0,i.conversations[r].msg_time=[];else{var a=i.conversations[r].unread_msg_count,c=[],u=0;i.conversations[r].msg_time.forEach(function(t){t>e&&(u++,c.push(t))}),i.conversations[r].msg_time=c,u0){var t={},e=[];this.report.forEach(function(n){if(t[n.args.key]){var o=Number(t[n.args.key]);Array.prototype.push.apply(e[o].result.msg_ids,n.args.msg_ids),e[o].msg_reports.push(n)}else t[n.args.key]=String(e.length),e.push({result:n.args,msg_reports:[n]})}),this.report=[];for(var n=0;n=t.length)return[];for(var n=t.length,o=Array(n-e);n-- >e;)o[n-e]=t[n];return o}function a(t,e){try{e.apply(null,s(arguments,2))}catch(e){t(e)}}function c(t,e){var n=arguments;r(function(){a.apply(null,n)})}function u(t,e){return function(t,e){for(var n=[],o=0,r=t.length;or?e(null,s):void(--u>0?a:(u=t,c))(e,n[o],p))}p._isCont=!0,n[0](p)}function v(t,e,n){var o=0,r=0,i=e.length,s=[],a=!1;n=n>=1?Math.floor(n):Number.MAX_VALUE;do{c()}while(o=i?(a=!0,g(t,s)):void(r>=n||(r++,s.push(new p(e[o++]).fin(function(e,n,o){if(null!=n)return a=!0,t(n);r--,c(),e(null,o)}).toThunk())))}}function E(){console.log.apply(console,arguments)}function k(t,e){return new Error("The argument "+(t&&t.toString())+' in "'+e+'" is not Array!')}return h.fin=h.finally=function(t){return _(function(e,n){n._finally=y(e,t)},this)},h.then=function(t,e){return _(function(n,o){t&&(o._success=y(n,t)),e&&(o._error=y(n,e))},this)},h.fail=h.catch=function(t){return _(function(e,n){n._error=y(e,t),n._success=function(){var t=s(arguments);t.unshift(null),e.apply(null,t)}},this)},h.parallel=function(t){return _(function(e,n){n._parallel=function(n){g(e,t||n)}},this)},h.series=function(t){return _(function(e,n){n._series=function(n){m(e,t||n)}},this)},h.each=function(t,e){return _(function(n,o){o._parallel=function(o,r){g(n,u(t||o,e||r))}},this)},h.eachSeries=function(t,e){return _(function(n,o){o._series=function(o,r){m(n,u(t||o,e||r))}},this)},h.parallelLimit=function(t,e){return _(function(n,o){o._parallel=function(o){v(n,t||o,e)}},this)},h.eachLimit=function(t,e,n){return _(function(o,r){r._series=function(r,i){v(o,u(t||r,e||i),n)}},this)},h.toThunk=function(){var t=this;return function(e){t._result?(e.apply(null,t._result),t._result=!1):!1!==t._result&&(t._finally=t._error=e)}},h.inspect=function(){var t={};for(var e in this)o.call(this,e)&&(t[e]="_nextThen"===e?this[e]&&this[e]._chain:this[e]);return t},p.NAME="Thenjs",p.VERSION="2.0.3",p})}).call(e,n(3).setImmediate)},function(t,e,n){(function(t,o){var r=n(4).nextTick,i=Function.prototype.apply,s=Array.prototype.slice,a={},c=0;function u(t,e){this._id=t,this._clearFn=e}e.setTimeout=function(){return new u(i.call(setTimeout,window,arguments),clearTimeout)},e.setInterval=function(){return new u(i.call(setInterval,window,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t.close()},u.prototype.unref=u.prototype.ref=function(){},u.prototype.close=function(){this._clearFn.call(window,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},e.setImmediate="function"==typeof t?t:function(t){var n=c++,o=!(arguments.length<2)&&s.call(arguments,1);return a[n]=!0,r(function(){a[n]&&(o?t.apply(null,o):t.call(null),e.clearImmediate(n))}),n},e.clearImmediate="function"==typeof o?o:function(t){delete a[t]}}).call(e,n(3).setImmediate,n(3).clearImmediate)},function(t,e){var n,o,r=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{o="function"==typeof clearTimeout?clearTimeout:s}catch(t){o=s}}();var c,u=[],p=!1,h=-1;function l(){p&&c&&(p=!1,c.length?u=c.concat(u):h=-1,u.length&&f())}function f(){if(!p){var t=a(l);p=!0;for(var e=u.length;e;){for(c=u,u=[];++h1)for(var n=1;n>8-s%1*8)){if((r=i.charCodeAt(s+=.75))>255)throw new o("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");e=e<<8|r}return c}),t.atob||(t.atob=function(t){var e=String(t).replace(/=+$/,"");if(e.length%4==1)throw new o("'atob' failed: The string to be decoded is not correctly encoded.");for(var r,i,s=0,a=0,c="";i=e.charAt(a++);~i&&(r=s%4?64*r+i:i,s++%4)?c+=String.fromCharCode(255&r>>(-2*s&6)):0)i=n.indexOf(i);return c})}()},function(t,e,n){"use strict";var o=n(7),r=n(8),i=n(59),s=function(t){this.init(t)};s.prototype.init=function(t){this.opts=t,this.dataCache={},this.memStore={},this.sync_key=0,this.sync_type=0,this.client=r(this.opts.address,{transports:["websocket","polling"]});var e=this,n=o.prototype.emit,i=this.client.onevent;this.client.onevent=function(t){var o=t.data||[];i.call(e.client,t),n.apply(e.client,["*"].concat(o))},this.client.on("*",function(t,n){e.onReceive(t,n)})},s.prototype.onReceive=function(t,e){if(this.opts.debug&&console.info("---<- event:%s, data:%s",t,JSON.stringify(e)),t!==i.EVENTS.EVENT_NOTIFICATION&&t!==i.EVENTS.MSG_SYNC&&t!==i.EVENTS.SYNC_CONVERSATION&&t!==i.EVENTS.SYNC_EVENT&&t!==i.EVENTS.SYNC_RECEIPT&&t!==i.EVENTS.RECEIPT_CHANGE&&t!==i.ROOM_MSG_SYNC&&t!==i.ROOM_MSG_SYNC_HIS){var n=this.dataCache[e.rid];delete e.rid,n&&(0===e.code&&t===i.EVENTS.GET_GROUP_MEMBERS?e.member_list.forEach(function(t){n.userInfoGet&&n.userInfoGet(t.uid,t.mtime),delete t.uid,delete t.mtime}):0===e.code&&t===i.EVENTS.GET_FRIEND_LIST?e.friend_list.forEach(function(t){n.userInfoGet&&n.userInfoGet(t.uid,1e3*t.mtime),delete t.uid}):0===e.code&&t===i.EVENTS.GET_BLACK_LIST?e.black_list.forEach(function(t){delete t.uid}):0===e.code&&t===i.EVENTS.GET_ACROSS_USER_INFO&&delete e.user_info.uid,t===i.EVENTS.ACK?(n.ack&&n.ack({rid:e.rid,data:n.data}),n.cleanAckTimeout()):(n.cleanRespTimeout(),delete this.dataCache[n.rid],e.code&&0!==e.code?n.fail&&n.fail(e):t!=i.EVENTS.S_SINGLE_TEXT_&&t!=i.EVENTS.SEND_GROUP_MSG&&t!=i.EVENTS.SEND_ROOM_MSG?n.hook?n.hook(e,n.success):n.success&&n.success(e):(n.data.msg_id=e.msg_id,t===i.EVENTS.S_SINGLE_TEXT_&&(e.target_username=n.data.target_id,e.appkey=n.data.appkey),n.success&&n.success(e,n.data),n.innerCall&&n.innerCall(e.msg_id))))}},s.prototype.generateRid=function(){for(var t=Math.floor(-2147483646*Math.random()+2147483647);this.dataCache[t];)t=Math.floor(-2147483646*Math.random()+2147483647);return t},s.prototype.send=function(t,e){this.opts.debug&&console.info("---\x3e- event:%s, data:%s",t,JSON.stringify(e)),this.client.emit(t,e)},t.exports=s},function(t,e,n){function o(t){if(t)return function(t){for(var e in o.prototype)t[e]=o.prototype[e];return t}(t)}t.exports=o,o.prototype.on=o.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},o.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},o.prototype.off=o.prototype.removeListener=o.prototype.removeAllListeners=o.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,o=this._callbacks["$"+t];if(!o)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var r=0;r=31},e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},e.enable(r())}).call(e,n(4))},function(t,e,n){(e=t.exports=i.debug=i).coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){e.enable("")},e.enable=function(t){e.save(t);for(var n=(t||"").split(/[\s,]+/),o=n.length,r=0;r0)return function(t){if((t=String(t)).length>1e4)return;var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(!e)return;var a=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*i;case"hours":case"hour":case"hrs":case"hr":case"h":return a*r;case"minutes":case"minute":case"mins":case"min":case"m":return a*o;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}(t);if("number"===u&&!1===isNaN(t))return e.long?a(c=t,i,"day")||a(c,r,"hour")||a(c,o,"minute")||a(c,n,"second")||c+" ms":function(t){if(t>=i)return Math.round(t/i)+"d";if(t>=r)return Math.round(t/r)+"h";if(t>=o)return Math.round(t/o)+"m";if(t>=n)return Math.round(t/n)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,n){var o=n(15)("socket.io-parser"),r=n(18),i=n(21),s=n(22),a=n(24);function c(){}function u(t){var n="",i=!1;return n+=t.type,e.BINARY_EVENT!=t.type&&e.BINARY_ACK!=t.type||(n+=t.attachments,n+="-"),t.nsp&&"/"!=t.nsp&&(i=!0,n+=t.nsp),null!=t.id&&(i&&(n+=",",i=!1),n+=t.id),null!=t.data&&(i&&(n+=","),n+=r.stringify(t.data)),o("encoded %j as %s",t,n),n}function p(){this.reconstructor=null}function h(t){this.reconPack=t,this.buffers=[]}function l(t){return{type:e.ERROR,data:"parser error"}}e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=c,e.Decoder=p,c.prototype.encode=function(t,n){(o("encoding packet %j",t),e.BINARY_EVENT==t.type||e.BINARY_ACK==t.type)?function(t,e){s.removeBlobs(t,function(t){var n=s.deconstructPacket(t),o=u(n.packet),r=n.buffers;r.unshift(o),e(r)})}(t,n):n([u(t)])},i(p.prototype),p.prototype.add=function(t){var n;if("string"==typeof t)n=function(t){var n={},i=0;if(n.type=Number(t.charAt(0)),null==e.types[n.type])return l();if(e.BINARY_EVENT==n.type||e.BINARY_ACK==n.type){for(var s="";"-"!=t.charAt(++i)&&(s+=t.charAt(i),i!=t.length););if(s!=Number(s)||"-"!=t.charAt(i))throw new Error("Illegal attachments");n.attachments=Number(s)}if("/"==t.charAt(i+1))for(n.nsp="";++i;){var a=t.charAt(i);if(","==a)break;if(n.nsp+=a,i==t.length)break}else n.nsp="/";var c=t.charAt(i+1);if(""!==c&&Number(c)==c){for(n.id="";++i;){var a=t.charAt(i);if(null==a||Number(a)!=a){--i;break}if(n.id+=t.charAt(i),i==t.length)break}n.id=Number(n.id)}t.charAt(++i)&&(n=function(t,e){try{t.data=r.parse(e)}catch(t){return l()}return t}(n,t.substr(i)));return o("decoded %s as %j",t,n),n}(t),e.BINARY_EVENT==n.type||e.BINARY_ACK==n.type?(this.reconstructor=new h(n),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",n)):this.emit("decoded",n);else{if(!a(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");(n=this.reconstructor.takeBinaryData(t))&&(this.reconstructor=null,this.emit("decoded",n))}},p.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},h.prototype.takeBinaryData=function(t){if(this.buffers.push(t),this.buffers.length==this.reconPack.attachments){var e=s.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null},h.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(t,e,n){function o(){var t;try{t=e.storage.debug}catch(t){}return t}(e=t.exports=n(16)).log=function(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)},e.formatArgs=function(){var t=arguments,n=this.useColors;if(t[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+t[0]+(n?"%c ":" ")+"+"+e.humanize(this.diff),!n)return t;var o="color: "+this.color,r=0,i=0;return(t=[t[0],o,"color: inherit"].concat(Array.prototype.slice.call(t,1)))[0].replace(/%[a-z%]/g,function(t){"%%"!==t&&"%c"===t&&(i=++r)}),t.splice(i,0,o),t},e.save=function(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(t){}},e.load=o,e.useColors=function(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31},e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(t){return JSON.stringify(t)},e.enable(o())},function(t,e,n){(e=t.exports=function(t){function n(){}function i(){var t=i,n=+new Date,s=n-(o||n);t.diff=s,t.prev=o,t.curr=n,o=n,null==t.useColors&&(t.useColors=e.useColors()),null==t.color&&t.useColors&&(t.color=e.colors[r++%e.colors.length]);var a=Array.prototype.slice.call(arguments);a[0]=e.coerce(a[0]),"string"!=typeof a[0]&&(a=["%o"].concat(a));var c=0;a[0]=a[0].replace(/%([a-z%])/g,function(n,o){if("%%"===n)return n;c++;var r=e.formatters[o];if("function"==typeof r){var i=a[c];n=r.call(t,i),a.splice(c,1),c--}return n}),"function"==typeof e.formatArgs&&(a=e.formatArgs.apply(t,a));var u=i.log||e.log||console.log.bind(console);u.apply(t,a)}n.enabled=!1,i.enabled=!0;var s=e.enabled(t)?i:n;return s.namespace=t,s}).coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){e.enable("")},e.enable=function(t){e.save(t);for(var n=(t||"").split(/[\s,]+/),o=n.length,r=0;r1e4)return;var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(!e)return;var a=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*i;case"hours":case"hour":case"hrs":case"hr":case"h":return a*r;case"minutes":case"minute":case"mins":case"min":case"m":return a*o;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a}}(t):e.long?a(u=t,i,"day")||a(u,r,"hour")||a(u,o,"minute")||a(u,n,"second")||u+" ms":(c=t)>=i?Math.round(c/i)+"d":c>=r?Math.round(c/r)+"h":c>=o?Math.round(c/o)+"m":c>=n?Math.round(c/n)+"s":c+"ms";var c,u}},function(t,e,n){var o;(function(t,r){(function(){var i=n(20),s={function:!0,object:!0},a=s[typeof e]&&e&&!e.nodeType&&e,c=s[typeof window]&&window||this,u=a&&s[typeof t]&&t&&!t.nodeType&&"object"==typeof r&&r;function p(t,e){t||(t=c.Object()),e||(e=c.Object());var n=t.Number||c.Number,o=t.String||c.String,r=t.Object||c.Object,i=t.Date||c.Date,a=t.SyntaxError||c.SyntaxError,u=t.TypeError||c.TypeError,h=t.Math||c.Math,l=t.JSON||c.JSON;"object"==typeof l&&l&&(e.stringify=l.stringify,e.parse=l.parse);var f,d,_,y=r.prototype,g=y.toString,m=new i(-0xc782b5b800cec);try{m=-109252==m.getUTCFullYear()&&0===m.getUTCMonth()&&1===m.getUTCDate()&&10==m.getUTCHours()&&37==m.getUTCMinutes()&&6==m.getUTCSeconds()&&708==m.getUTCMilliseconds()}catch(t){}function v(t){if(v[t]!==_)return v[t];var r;if("bug-string-char-index"==t)r="a"!="a"[0];else if("json"==t)r=v("json-stringify")&&v("json-parse");else{var s,a='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if("json-stringify"==t){var c=e.stringify,u="function"==typeof c&&m;if(u){(s=function(){return 1}).toJSON=s;try{u="0"===c(0)&&"0"===c(new n)&&'""'==c(new o)&&c(g)===_&&c(_)===_&&c()===_&&"1"===c(s)&&"[1]"==c([s])&&"[null]"==c([_])&&"null"==c(null)&&"[null,null,null]"==c([_,g,null])&&c({a:[s,!0,!1,null,"\0\b\n\f\r\t"]})==a&&"1"===c(null,s)&&"[\n 1,\n 2\n]"==c([1,2],null,1)&&'"-271821-04-20T00:00:00.000Z"'==c(new i(-864e13))&&'"+275760-09-13T00:00:00.000Z"'==c(new i(864e13))&&'"-000001-01-01T00:00:00.000Z"'==c(new i(-621987552e5))&&'"1969-12-31T23:59:59.999Z"'==c(new i(-1))}catch(t){u=!1}}r=u}if("json-parse"==t){var p=e.parse;if("function"==typeof p)try{if(0===p("0")&&!p(!1)){var h=5==(s=p(a)).a.length&&1===s.a[0];if(h){try{h=!p('"\t"')}catch(t){}if(h)try{h=1!==p("01")}catch(t){}if(h)try{h=1!==p("1.")}catch(t){}}}}catch(t){h=!1}r=h}}return v[t]=!!r}if(!v("json")){var E="[object Function]",k="[object Number]",S="[object String]",T="[object Array]",b=v("bug-string-char-index");if(!m)var N=h.floor,w=[0,31,59,90,120,151,181,212,243,273,304,334],R=function(t,e){return w[e]+365*(t-1970)+N((t-1969+(e=+(e>1)))/4)-N((t-1901+e)/100)+N((t-1601+e)/400)};if((f=y.hasOwnProperty)||(f=function(t){var e,n={};return(n.__proto__=null,n.__proto__={toString:1},n).toString!=g?f=function(t){var e=this.__proto__,n=t in(this.__proto__=null,this);return this.__proto__=e,n}:(e=n.constructor,f=function(t){var n=(this.constructor||e).prototype;return t in this&&!(t in n&&this[t]===n[t])}),n=null,f.call(this,t)}),d=function(t,e){var n,o,r,i=0;for(r in(n=function(){this.valueOf=0}).prototype.valueOf=0,o=new n)f.call(o,r)&&i++;return n=o=null,i?d=2==i?function(t,e){var n,o={},r=g.call(t)==E;for(n in t)r&&"prototype"==n||f.call(o,n)||!(o[n]=1)||!f.call(t,n)||e(n)}:function(t,e){var n,o,r=g.call(t)==E;for(n in t)r&&"prototype"==n||!f.call(t,n)||(o="constructor"===n)||e(n);(o||f.call(t,n="constructor"))&&e(n)}:(o=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"],d=function(t,e){var n,r,i=g.call(t)==E,a=!i&&"function"!=typeof t.constructor&&s[typeof t.hasOwnProperty]&&t.hasOwnProperty||f;for(n in t)i&&"prototype"==n||!a.call(t,n)||e(n);for(r=o.length;n=o[--r];a.call(t,n)&&e(n));}),d(t,e)},!v("json-stringify")){var C={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},A=function(t,e){return("000000"+(e||0)).slice(-t)},O=function(t){for(var e='"',n=0,o=t.length,r=!b||o>10,i=r&&(b?t.split(""):t);n-1/0&&a<1/0){if(R){for(l=N(a/864e5),p=N(l/365.2425)+1970-1;R(p+1,0)<=l;p++);for(h=N((l-R(p,0))/30.42);R(p,h+1)<=l;h++);l=1+l-R(p,h),m=N((y=(a%864e5+864e5)%864e5)/36e5)%24,v=N(y/6e4)%60,E=N(y/1e3)%60,b=y%1e3}else p=a.getUTCFullYear(),h=a.getUTCMonth(),l=a.getUTCDate(),m=a.getUTCHours(),v=a.getUTCMinutes(),E=a.getUTCSeconds(),b=a.getUTCMilliseconds();a=(p<=0||p>=1e4?(p<0?"-":"+")+A(6,p<0?-p:p):A(4,p))+"-"+A(2,h+1)+"-"+A(2,l)+"T"+A(2,m)+":"+A(2,v)+":"+A(2,E)+"."+A(3,b)+"Z"}else a=null;if(n&&(a=n.call(e,t,a)),null===a)return"null";if("[object Boolean]"==(c=g.call(a)))return""+a;if(c==k)return a>-1/0&&a<1/0?""+a:"null";if(c==S)return O(""+a);if("object"==typeof a){for(x=s.length;x--;)if(s[x]===a)throw u();if(s.push(a),w=[],L=i,i+=r,c==T){for(I=0,x=a.length;I0)for(o="",n>10&&(n=10);o.length=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70||P();t+=L("0x"+i.slice(e,I));break;default:P()}else{if(34==r)break;for(r=i.charCodeAt(I),e=I;r>=32&&92!=r&&34!=r;)r=i.charCodeAt(++I);t+=i.slice(e,I)}if(34==i.charCodeAt(I))return I++,t;P();default:if(e=I,45==r&&(o=!0,r=i.charCodeAt(++I)),r>=48&&r<=57){for(48==r&&((r=i.charCodeAt(I+1))>=48&&r<=57)&&P(),o=!1;I=48&&r<=57);I++);if(46==i.charCodeAt(I)){for(n=++I;n=48&&r<=57);n++);n==I&&P(),I=n}if(101==(r=i.charCodeAt(I))||69==r){for(43!=(r=i.charCodeAt(++I))&&45!=r||I++,n=I;n=48&&r<=57);n++);n==I&&P(),I=n}return+i.slice(e,I)}if(o&&P(),"true"==i.slice(I,I+4))return I+=4,!0;if("false"==i.slice(I,I+5))return I+=5,!1;if("null"==i.slice(I,I+4))return I+=4,null;P()}return"$"},G=function(t){var e,n;if("$"==t&&P(),"string"==typeof t){if("@"==(b?t.charAt(0):t[0]))return t.slice(1);if("["==t){for(e=[];"]"!=(t=U());n||(n=!0))n&&(","==t?"]"==(t=U())&&P():P()),","==t&&P(),e.push(G(t));return e}if("{"==t){for(e={};"}"!=(t=U());n||(n=!0))n&&(","==t?"}"==(t=U())&&P():P()),","!=t&&"string"==typeof t&&"@"==(b?t.charAt(0):t[0])&&":"==U()||P(),e[t.slice(1)]=G(U());return e}P()}return t},B=function(t,e,n){var o=V(t,e,n);o===_?delete t[e]:t[e]=o},V=function(t,e,n){var o,r=t[e];if("object"==typeof r&&r)if(g.call(r)==T)for(o=r.length;o--;)B(r,o,n);else d(r,function(t){B(r,t,n)});return n.call(t,e,r)};e.parse=function(t,e){var n,o;return I=0,x=""+t,n=G(U()),"$"!=U()&&P(),I=x=null,e&&g.call(e)==E?V(((o={})[""]=n,o),"",e):n}}}return e.runInContext=p,e}if(!u||u.global!==u&&u.window!==u&&u.self!==u||(c=u),a&&!i)p(c,a);else{var h=c.JSON,l=c.JSON3,f=!1,d=p(c,c.JSON3={noConflict:function(){return f||(f=!0,c.JSON=h,c.JSON3=l,h=l=null),d}});c.JSON={parse:d.parse,stringify:d.stringify}}i&&(void 0===(o=function(){return d}.call(e,n,e,t))||(t.exports=o))}).call(this)}).call(e,n(19)(t),window)},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){(function(e){t.exports=e}).call(e,{})},function(t,e){function n(t){if(t)return function(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}(t)}t.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},n.prototype.once=function(t,e){var n=this;function o(){n.off(t,o),e.apply(this,arguments)}return this._callbacks=this._callbacks||{},o.fn=e,this.on(t,o),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,o=this._callbacks[t];if(!o)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var r=0;r0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},f.prototype.cleanup=function(){u("cleanup");for(var t=this.subs.length,e=0;e=this._reconnectionAttempts)u("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();u("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var n=setTimeout(function(){t.skipReconnect||(u("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open(function(e){e?(u("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):(u("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(n)}})}},f.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)}},function(t,e,n){t.exports=n(27)},function(t,e,n){t.exports=n(28),t.exports.parser=n(35)},function(t,e,n){(function(e){var o=n(29),r=n(7),i=n(46)("engine.io-client:socket"),s=n(52),a=n(35),c=n(10),u=n(53),p=n(43);function h(t,n){if(!(this instanceof h))return new h(t,n);n=n||{},t&&"object"==typeof t&&(n=t,t=null),t?(t=c(t),n.hostname=t.host,n.secure="https"===t.protocol||"wss"===t.protocol,n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=c(n.host).host),this.secure=null!=n.secure?n.secure:e.location&&"https:"===location.protocol,n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.agent=n.agent||!1,this.hostname=n.hostname||(e.location?location.hostname:"localhost"),this.port=n.port||(e.location&&location.port?location.port:this.secure?443:80),this.query=n.query||{},"string"==typeof this.query&&(this.query=p.decode(this.query)),this.upgrade=!1!==n.upgrade,this.path=(n.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!n.forceJSONP,this.jsonp=!1!==n.jsonp,this.forceBase64=!!n.forceBase64,this.enablesXDR=!!n.enablesXDR,this.timestampParam=n.timestampParam||"t",this.timestampRequests=n.timestampRequests,this.transports=n.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=n.policyPort||843,this.rememberUpgrade=n.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=n.onlyBinaryUpgrades,this.perMessageDeflate=!1!==n.perMessageDeflate&&(n.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=n.pfx||null,this.key=n.key||null,this.passphrase=n.passphrase||null,this.cert=n.cert||null,this.ca=n.ca||null,this.ciphers=n.ciphers||null,this.rejectUnauthorized=void 0===n.rejectUnauthorized?null:n.rejectUnauthorized,this.forceNode=!!n.forceNode;var o="object"==typeof e&&e;o.global===o&&(n.extraHeaders&&Object.keys(n.extraHeaders).length>0&&(this.extraHeaders=n.extraHeaders),n.localAddress&&(this.localAddress=n.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}t.exports=h,h.priorWebsocketSuccess=!1,r(h.prototype),h.protocol=a.protocol,h.Socket=h,h.Transport=n(34),h.transports=n(29),h.parser=n(35),h.prototype.createTransport=function(t){i('creating transport "%s"',t);var e=function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}(this.query);return e.EIO=a.protocol,e.transport=t,this.id&&(e.sid=this.id),new o[t]({agent:this.agent,hostname:this.hostname,port:this.port,secure:this.secure,path:this.path,query:e,forceJSONP:this.forceJSONP,jsonp:this.jsonp,forceBase64:this.forceBase64,enablesXDR:this.enablesXDR,timestampRequests:this.timestampRequests,timestampParam:this.timestampParam,policyPort:this.policyPort,socket:this,pfx:this.pfx,key:this.key,passphrase:this.passphrase,cert:this.cert,ca:this.ca,ciphers:this.ciphers,rejectUnauthorized:this.rejectUnauthorized,perMessageDeflate:this.perMessageDeflate,extraHeaders:this.extraHeaders,forceNode:this.forceNode,localAddress:this.localAddress})},h.prototype.open=function(){var t;if(this.rememberUpgrade&&h.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))t="websocket";else{if(0===this.transports.length){var e=this;return void setTimeout(function(){e.emit("error","No transports available")},0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(t){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)},h.prototype.setTransport=function(t){i("setting transport %s",t.name);var e=this;this.transport&&(i("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(t){e.onPacket(t)}).on("error",function(t){e.onError(t)}).on("close",function(){e.onClose("transport close")})},h.prototype.probe=function(t){i('probing transport "%s"',t);var e=this.createTransport(t,{probe:1}),n=!1,o=this;function r(){if(o.onlyBinaryUpgrades){var r=!this.supportsBinary&&o.transport.supportsBinary;n=n||r}n||(i('probe transport "%s" opened',t),e.send([{type:"ping",data:"probe"}]),e.once("packet",function(r){if(!n)if("pong"===r.type&&"probe"===r.data){if(i('probe transport "%s" pong',t),o.upgrading=!0,o.emit("upgrading",e),!e)return;h.priorWebsocketSuccess="websocket"===e.name,i('pausing current transport "%s"',o.transport.name),o.transport.pause(function(){n||"closed"!==o.readyState&&(i("changing transport and sending upgrade packet"),l(),o.setTransport(e),e.send([{type:"upgrade"}]),o.emit("upgrade",e),e=null,o.upgrading=!1,o.flush())})}else{i('probe transport "%s" failed',t);var s=new Error("probe error");s.transport=e.name,o.emit("upgradeError",s)}}))}function s(){n||(n=!0,l(),e.close(),e=null)}function a(n){var r=new Error("probe error: "+n);r.transport=e.name,s(),i('probe transport "%s" failed because of error: %s',t,n),o.emit("upgradeError",r)}function c(){a("transport closed")}function u(){a("socket closed")}function p(t){e&&t.name!==e.name&&(i('"%s" works - aborting "%s"',t.name,e.name),s())}function l(){e.removeListener("open",r),e.removeListener("error",a),e.removeListener("close",c),o.removeListener("close",u),o.removeListener("upgrading",p)}h.priorWebsocketSuccess=!1,e.once("open",r),e.once("error",a),e.once("close",c),this.once("close",u),this.once("upgrading",p),e.open()},h.prototype.onOpen=function(){if(i("socket open"),this.readyState="open",h.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){i("starting upgrade probes");for(var t=0,e=this.upgrades.length;t1?{type:f[r],data:t.substring(1)}:{type:f[r]}:d}r=new Uint8Array(t)[0];var i=s(t,1);return _&&"blob"===n&&(i=new _([i])),{type:f[r],data:i}},e.decodeBase64Packet=function(t,e){var n=f[t.charAt(0)];if(!o)return{type:n,data:{base64:!0,data:t.substr(1)}};var r=o.decode(t.substr(1));return"blob"===e&&_&&(r=new _([r])),{type:n,data:r}},e.encodePayload=function(t,n,o){"function"==typeof n&&(o=n,n=null);var r=i(t);if(n&&r)return _&&!h?e.encodePayloadAsBlob(t,o):e.encodePayloadAsArrayBuffer(t,o);if(!t.length)return o("0:");y(t,function(t,o){e.encodePacket(t,!!r&&n,!0,function(t){var e;o(null,(e=t).length+":"+e)})},function(t,e){return o(e.join(""))})},e.decodePayload=function(t,n,o){if("string"!=typeof t)return e.decodePayloadAsBinary(t,n,o);var r;if("function"==typeof n&&(o=n,n=null),""==t)return o(d,0,1);for(var i,s,a="",c=0,u=t.length;c0;){for(var c=new Uint8Array(r),u=0===c[0],p="",h=1;255!=c[h];h++){if(p.length>310){a=!0;break}p+=c[h]}if(a)return o(d,0,1);r=s(r,2+p.length),p=parseInt(p);var l=s(r,0,p);if(u)try{l=String.fromCharCode.apply(null,new Uint8Array(l))}catch(t){var f=new Uint8Array(l);l="";for(h=0;ho&&(n=o),e>=o||e>=n||0===o)return new ArrayBuffer(0);for(var r=new Uint8Array(t),i=new Uint8Array(n-e),s=e,a=0;s=55296&&e<=56319&&r>e&63|128)}function d(t){if(0==(4294967168&t))return h(t);var e="";return 0==(4294965248&t)?e=h(t>>6&31|192):0==(4294901760&t)?(e=h(t>>12&15|224),e+=f(t,6)):0==(4292870144&t)&&(e=h(t>>18&7|240),e+=f(t,12),e+=f(t,6)),e+=h(63&t|128)}function _(){if(p>=u)throw Error("Invalid byte index");var t=255&c[p];if(p++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function y(){var t,e;if(p>u)throw Error("Invalid byte index");if(p==u)return!1;if(t=255&c[p],p++,0==(128&t))return t;if(192==(224&t)){if((e=(31&t)<<6|_())>=128)return e;throw Error("Invalid continuation byte")}if(224==(240&t)){if((e=(15&t)<<12|_()<<6|_())>=2048)return e;throw Error("Invalid continuation byte")}if(240==(248&t)&&(e=(15&t)<<18|_()<<12|_()<<6|_())>=65536&&e<=1114111)return e;throw Error("Invalid WTF-8 detected")}var g={version:"1.0.0",encode:function(t){for(var e=l(t),n=e.length,o=-1,r="";++o65535&&(r+=h((e-=65536)>>>10&1023|55296),e=56320|1023&e),r+=h(e);return r}(n)}};void 0===(o=function(){return g}.call(e,n,e,t))||(t.exports=o)}()}).call(e,n(19)(t),window)},function(t,e){!function(){"use strict";for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(256),o=0;o>2],i+=t[(3&o[n])<<4|o[n+1]>>4],i+=t[(15&o[n+1])<<2|o[n+2]>>6],i+=t[63&o[n+2]];return r%3==2?i=i.substring(0,i.length-1)+"=":r%3==1&&(i=i.substring(0,i.length-2)+"=="),i},e.decode=function(t){var e,o,r,i,s,a=.75*t.length,c=t.length,u=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var p=new ArrayBuffer(a),h=new Uint8Array(p);for(e=0;e>4,h[u++]=(15&r)<<4|i>>2,h[u++]=(3&i)<<6|63&s;return p}}()},function(t,e){(function(e){var n=e.BlobBuilder||e.WebKitBlobBuilder||e.MSBlobBuilder||e.MozBlobBuilder,o=function(){try{return 2===new Blob(["hi"]).size}catch(t){return!1}}(),r=o&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(t){return!1}}(),i=n&&n.prototype.append&&n.prototype.getBlob;function s(t){for(var e=0;e0);return e}function u(){var t=c(+new Date);return t!==n?(s=0,n=t):t+"."+c(s++)}for(;a=31},e.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(t){}}(),e.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(t){return"[UnexpectedJSONParseError]: "+t.message}},e.enable(r())}).call(e,n(4))},function(t,e,n){(e=t.exports=i.debug=i).coerce=function(t){return t instanceof Error?t.stack||t.message:t},e.disable=function(){e.enable("")},e.enable=function(t){e.save(t);for(var n=(t||"").split(/[\s,]+/),o=n.length,r=0;r0)return function(t){if((t=String(t)).length>1e4)return;var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(!e)return;var a=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return a*s;case"days":case"day":case"d":return a*i;case"hours":case"hour":case"hrs":case"hr":case"h":return a*r;case"minutes":case"minute":case"mins":case"min":case"m":return a*o;case"seconds":case"second":case"secs":case"sec":case"s":return a*n;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return a;default:return}}(t);if("number"===u&&!1===isNaN(t))return e.long?a(c=t,i,"day")||a(c,r,"hour")||a(c,o,"minute")||a(c,n,"second")||c+" ms":function(t){if(t>=i)return Math.round(t/i)+"d";if(t>=r)return Math.round(t/r)+"h";if(t>=o)return Math.round(t/o)+"m";if(t>=n)return Math.round(t/n)+"s";return t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,n){(function(e){var o=n(33),r=n(44);t.exports=u;var i,s=/\n/g,a=/\\n/g;function c(){}function u(t){o.call(this,t),this.query=this.query||{},i||(e.___eio||(e.___eio=[]),i=e.___eio),this.index=i.length;var n=this;i.push(function(t){n.onData(t)}),this.query.j=this.index,e.document&&e.addEventListener&&e.addEventListener("beforeunload",function(){n.script&&(n.script.onerror=c)},!1)}r(u,o),u.prototype.supportsBinary=!1,u.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),o.prototype.doClose.call(this)},u.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(e,n):(document.head||document.body).appendChild(e),this.script=e,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout(function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)},100)},u.prototype.doWrite=function(t,e){var n=this;if(!this.form){var o,r=document.createElement("form"),i=document.createElement("textarea"),c=this.iframeId="eio_iframe_"+this.index;r.className="socketio",r.style.position="absolute",r.style.top="-1000px",r.style.left="-1000px",r.target=c,r.method="POST",r.setAttribute("accept-charset","utf-8"),i.name="d",r.appendChild(i),document.body.appendChild(r),this.form=r,this.area=i}function u(){p(),e()}function p(){if(n.iframe)try{n.form.removeChild(n.iframe)}catch(t){n.onError("jsonp polling iframe removal error",t)}try{var t='