2 Star 0 Fork 0

火焰山网络/叠聚聊天APP

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
goeasy.js 227.98 KB
一键复制 编辑 原始数据 按行查看 历史
You V 提交于 2023-12-25 13:40 . 第一次提交
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.GoEasy=t():e.GoEasy=t()}(window,function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=32)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.noop=t.GoEasyDomainNumber=t.goEasyArray=t.UUID=t.calibrator=undefined;var o=n(35),r=n(61),i=n(65),s=n(36);t.calibrator=o.calibrator,t.UUID=r.UUID,t.goEasyArray=i.goEasyArray,t.GoEasyDomainNumber=s.GoEasyDomainNumber,t.noop=function(){}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t["default"]={WRITE:"WRITE",READ:"READ",NONE:"NONE"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t["default"]={"default":"default",text:"text",image:"image",video:"video",audio:"audio",emoji:"emoji",file:"file"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(0),s=n(1),a=(o=s)&&o.__esModule?o:{"default":o};var u=function(){function e(t){var n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.uuid=null,this.name="",this.params=null,this.success=null,this.fail=null,this.permission=a["default"].NONE,this.singleTimeout=0,this.totalTimeout=0,this.startTime=0,this.complete=!1,this.retried=0,this.uuid=i.UUID.get(),this.name=t.name,this.params=t.params,this.permission=t.permission,this.totalTimeout=t.totalTimeout,this.singleTimeout=t.singleTimeout,this.success=function(e){n.complete||(n.complete=!0,t.success(e))},this.fail=function(e){n.complete||(n.complete=!0,t.fail(e))}}return r(e,[{key:"start",value:function(){this.startTime=Date.now()}},{key:"isTimeout",value:function(){return this.startTime+this.totalTimeout<Date.now()}}]),e}();t["default"]=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.SocketTimeout={connect:1500,reconnectionDelayMax:3e3,commonQuerySingle:2500,commonQueryTotal:12e3,commonRequestSingle:1700,commonRequestTotal:12e3,commonInfiniteSingle:1700,commonInfiniteTotal:864e5}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.EmitType={authorize:"authorize",manualDisconnect:"manualDisconnect",subscribe:"subscribe",unsubscribe:"unsubscribe",publish:"publish",ack:"ack",historyMessages:"historyMessages",hereNow:"hereNow",hereNowByUserIds:"hereNowByUserIds",imLastConversations:"imLastConversations",markPrivateMessageAsRead:"markPrivateMessageAsRead",markGroupMessageAsRead:"markGroupMessageAsRead",imGroupOnlineCount:"imGroupOnlineCount",imHereNow:"imHereNow",imGroupHereNow:"imGroupHereNow",publishIM:"publishIM",imHistory:"imHistory",subscribeUserPresence:"subscribeUserPresence",unsubscribeUserPresence:"unsubscribeUserPresence",subscribeGroupPresence:"subscribeGroupPresence",unsubscribeGroupPresence:"unsubscribeGroupPresence",removeConversation:"removeConversation",topConversation:"topConversation",imData:"imData",subscribeGroups:"subscribeGroups",unsubscribeGroup:"unsubscribeGroup"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.str=t.noop=t.GoEasyDomainNumber=t.goEasyArray=t.UUID=t.calibrator=undefined;var o=n(69),r=n(0);t.calibrator=r.calibrator,t.UUID=r.UUID,t.goEasyArray=r.goEasyArray,t.GoEasyDomainNumber=r.GoEasyDomainNumber,t.noop=r.noop,t.str=o.str},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Conversion=t.ConversationType=t.Conversations=undefined;var o=n(38),r=n(23),i=n(107);t.Conversations=i.Conversations,t.ConversationType=r.ConversationType,t.Conversion=o.Conversion},function(e,t,n){"use strict";e.exports=function(){return function(){}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t["default"]={DISCONNECTED:"disconnected",DISCONNECTING:"disconnecting",CONNECTING:"connecting",CONNECTED:"connected",RECONNECTING:"reconnecting",RECONNECTED:"reconnected",EXPIRED_RECONNECTED:"reconnected",CONNECT_FAILED:"connect_failed"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImEventType=t.eventCenter=undefined;var o=n(33),r=n(34);t.eventCenter=o.eventCenter,t.ImEventType=r.ImEventType},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.im=t.IM=undefined;var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(7),i=n(68),s=w(n(2)),a=w(n(80)),u=w(n(96)),c=w(n(43)),l=w(n(97)),f=w(n(98)),p=w(n(99)),d=w(n(100)),h=w(n(101)),y=w(n(102)),m=w(n(103)),v=w(n(104)),b=w(n(106)),g=n(33);function w(e){return e&&e.__esModule?e:{"default":e}}var _=t.IM=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._event=g.eventCenter,this._goEasyUploader=null,this._goEasySocket=null,this._dataCache=null,this._messageSender=null,this._history=null,this._conversations=null,this._iMReceiver=null,this._groupMessageReceive=null,this._groupPresenceSubscriber=null,this._groupOnlineCount=null,this._groupHereNow=null,this._privateMessageReceive=null,this._userPresenceSubscriber=null,this._userHereNow=null}return o(e,[{key:"on",value:function(e,t){this._event.on(e,t)}},{key:"initialBeforeConnect",value:function(t){e.userId=t.id,e.userData=t.data,this._dataCache=new b["default"](this,t),this._messageSender=new a["default"](this),this._history=new u["default"](this),this._goEasyUploader=new c["default"](this),this._userHereNow=new y["default"](this),this._groupHereNow=new m["default"](this),this._groupOnlineCount=new p["default"](this)}},{key:"initialAfterConnect",value:function(){this._iMReceiver=new v["default"](this),this._conversations=new r.Conversations(this),this._groupPresenceSubscriber=new d["default"](this),this._groupMessageReceive=new l["default"](this),this._userPresenceSubscriber=new h["default"](this),this._privateMessageReceive=new f["default"](this)}},{key:"initialGoEasySocket",value:function(e){this._goEasySocket=e}},{key:"createTextMessage",value:function(e){return i.messageCreator.create(s["default"].text,e)}},{key:"createImageMessage",value:function(e){return i.messageCreator.create(s["default"].image,e)}},{key:"createFileMessage",value:function(e){return i.messageCreator.create(s["default"].file,e)}},{key:"createAudioMessage",value:function(e){return i.messageCreator.create(s["default"].audio,e)}},{key:"createVideoMessage",value:function(e){return i.messageCreator.create(s["default"].video,e)}},{key:"createCustomMessage",value:function(e){return i.messageCreator.create(e.type,e)}},{key:"latestConversations",value:function(){return this._conversations?this._conversations.latestConversations():Promise.reject({code:500,content:"Please connect GoEasyIM first."})}},{key:"groupMarkAsRead",value:function(e,t){return this._conversations.groupMarkAsRead(e,t)}},{key:"privateMarkAsRead",value:function(e,t){return this._conversations.privateMarkAsRead(e,t)}},{key:"removePrivateConversation",value:function(e){return this._conversations.removeConversation(e,r.ConversationType.PRIVATE)}},{key:"removeGroupConversation",value:function(e){return this._conversations.removeConversation(e,r.ConversationType.GROUP)}},{key:"topPrivateConversation",value:function(e,t){return this._conversations.topConversation(e,t,r.ConversationType.PRIVATE)}},{key:"topGroupConversation",value:function(e,t){return this._conversations.topConversation(e,t,r.ConversationType.GROUP)}},{key:"history",value:function(e){return this._history.history(e)}},{key:"upload",value:function(e,t,n){return this._goEasyUploader.upload(e,t,n)}},{key:"sendSystemMessage",value:function(e,t){return this._messageSender.send(e,t,r.ConversationType.SYSTEM)}},{key:"sendMessage",value:function(e){return this._messageSender.sendMessage(e)}},{key:"sendPrivateMessage",value:function(e,t){return this._messageSender.send(e,t,r.ConversationType.PRIVATE)}},{key:"subscribeUserPresence",value:function(e){return this._userPresenceSubscriber.presence(e)}},{key:"unsubscribeUserPresence",value:function(e){return this._userPresenceSubscriber.unPresence(e)}},{key:"hereNow",value:function(e){return this._userHereNow.hereNow(e,r.ConversationType.PRIVATE)}},{key:"sendGroupMessage",value:function(e,t){return this._messageSender.send(e,t,r.ConversationType.GROUP)}},{key:"subscribeGroup",value:function(e){return this._groupMessageReceive.subscribe(e)}},{key:"unsubscribeGroup",value:function(e){return this._groupMessageReceive.unsubscribe(e)}},{key:"subscribeGroupPresence",value:function(e){return this._groupPresenceSubscriber.presence(e)}},{key:"unsubscribeGroupPresence",value:function(e){return this._groupPresenceSubscriber.unPresence(e)}},{key:"groupHereNow",value:function(e){return this._groupHereNow.hereNow(e)}},{key:"groupOnlineCount",value:function(e){return this._groupOnlineCount.get(e)}}]),e}();_.version=null,_.userId=undefined,_.userData=null;var E=new _;t.im=E},function(e,t,n){function o(e){if(e)return function(e){for(var t in o.prototype)e[t]=o.prototype[t];return e}(e)}e.exports=o,o.prototype.on=o.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},o.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},o.prototype.off=o.prototype.removeListener=o.prototype.removeAllListeners=o.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,o=this._callbacks["$"+e];if(!o)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var r=0;r<o.length;r++)if((n=o[r])===t||n.fn===t){o.splice(r,1);break}return this},o.prototype.emit=function(e){this._callbacks=this._callbacks||{};var t=[].slice.call(arguments,1),n=this._callbacks["$"+e];if(n)for(var o=0,r=(n=n.slice(0)).length;o<r;++o)n[o].apply(this,t);return this},o.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},o.prototype.hasListeners=function(e){return!!this.listeners(e).length}},function(e,t,n){"use strict";var o=n(116),r=n(52),i=n(120),s=n(121);"undefined"!=typeof navigator&&/Android/i.test(navigator.userAgent),"undefined"!=typeof navigator&&/PhantomJS/i.test(navigator.userAgent);t.protocol=3;var a=t.packets={open:0,close:1,ping:2,pong:3,message:4,upgrade:5,noop:6},u=o(a),c={type:"error",data:"parser error"},l=n(122);t.encodePacket=function(e,t,n,o){"function"==typeof t&&(o=t,t=!1),"function"==typeof n&&(o=n,n=null);e.data===undefined?undefined:e.data.buffer||e.data;var r=a[e.type];return undefined!==e.data&&(r+=n?s.encode(String(e.data),{strict:!1}):String(e.data)),o(""+r)},t.decodePacket=function(e,t,n){if(e===undefined)return c;if("string"==typeof e){if(n&&!1===(e=function(e){try{e=s.decode(e,{strict:!1})}catch(t){return!1}return e}(e)))return c;var o=e.charAt(0);return Number(o)==o&&u[o]?e.length>1?{type:u[o],data:e.substring(1)}:{type:u[o]}:c}o=new Uint8Array(e)[0];var r=sliceBuffer(e,1);return l&&"blob"===t&&(r=new l([r])),{type:u[o],data:r}},t.encodePayload=function(e,n,o){"function"==typeof n&&(o=n,n=null);var s=r(e);if(!e.length)return o("0:");!function(e,t,n){for(var o=new Array(e.length),r=i(e.length,n),s=function(e,n,r){t(n,function(t,n){o[e]=n,r(t,o)})},a=0;a<e.length;a++)s(a,e[a],r)}(e,function(e,o){t.encodePacket(e,!!s&&n,!0,function(e){o(null,function(e){return e.length+":"+e}(e))})},function(e,t){return o(t.join(""))})},t.decodePayload=function(e,n,o){var r;if("function"==typeof n&&(o=n,n=null),""===e)return o(c,0,1);for(var i,s,a="",u=0,l=e.length;u<l;u++){var f=e.charAt(u);if(":"===f){if(""===a||a!=(i=Number(a)))return o(c,0,1);if(a!=(s=e.substr(u+1,i)).length)return o(c,0,1);if(s.length){if(r=t.decodePacket(s,n,!0),c.type===r.type&&c.data===r.data)return o(c,0,1);if(!1===o(r,u+i,l))return}u+=i,a=""}else a+=f}return""!==a?o(c,0,1):void 0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(11),i=n(0),s=(u(n(2)),u(n(19))),a=n(7);function u(e){return e&&e.__esModule?e:{"default":e}}var c=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.type="",this.to={type:null,id:null,data:null},this.timestamp=Date.now(),this.senderId=null,this.payload=null,this.messageId=i.UUID.get(),this.status=s["default"]["new"],this.validate(t),this.setSenderId(),this.setType(t),this.setNotification(t),this.setPayload(t),this.setTo(t),this.setData()}return o(e,[{key:"validate",value:function(e){if(!i.calibrator.isObject(e))throw Error("it is an empty message.")}},{key:"setType",value:function(e){throw Error("Abstract method")}},{key:"setNotification",value:function(e){if(e.notification){if(!i.calibrator.isObject(e.notification))throw Error("notification require an object.");if(i.calibrator.isEmpty(e.notification.title))throw Error("notification's title is empty.");if(i.calibrator.isEmpty(e.notification.body))throw Error("notification's body is empty.");if(e.notification.title.length>32)throw Error("notification's title over max length 32");if(e.notification.body.length>50)throw Error("notification's body over max length 50");this.notification=e.notification}}},{key:"setPayload",value:function(e){this.payload=Object.create(null)}},{key:"setSenderId",value:function(){if(!r.IM.userId)throw Error("please call connect() first.");this.senderId=r.IM.userId}},{key:"setTo",value:function(e){this.to=e.to}},{key:"setData",value:function(){this.to&&this.to.type==a.ConversationType.GROUP&&(this.senderData=r.IM.userData)}}]),e}();t["default"]=c},function(e,t,n){"use strict";(function(e){var n,o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};t.__esModule=!0,t.FrameworkDetector=t.Framework=void 0,function(e){e.UNIAPP="UNIAPP",e.REACT_NATIVE="REACT_NATIVE",e.TARO="TARO",e.IONIC="IONIC",e.NATIVE_APPLET_WX="NATIVE_APPLET_WX",e.NATIVE_APPLET_ALIPAY="NATIVE_APPLET_ALIPAY",e.UNKNOWN="UNKNOWN"}(n=t.Framework||(t.Framework={}));var r=function(){function t(){var e,t,r;this.framework=null,this.methods=((e={})[n.UNIAPP]=this.isUniApp,e[n.REACT_NATIVE]=this.isReactNative,e[n.NATIVE_APPLET_WX]=this.isWXApplet,e);var i=this.methods,s=Object.keys(i);try{for(var a=o(s),u=a.next();!u.done;u=a.next()){var c=u.value;if((0,i[c])()){this.framework=c;break}}}catch(l){t={error:l}}finally{try{u&&!u.done&&(r=a["return"])&&r.call(a)}finally{if(t)throw t.error}}this.framework=this.framework||n.UNKNOWN,this.framework}return t.currentFramework=function(){return this.instance.framework},t.prototype.isUniApp=function(){return"object"==typeof uni&&!!uni.getSystemInfoSync},t.prototype.isReactNative=function(){return void 0!==e&&e.__fbGenNativeModule},t.prototype.isTaro=function(){return!1},t.prototype.isWXApplet=function(){return"undefined"!=typeof wx&&wx.getLocation&&"undefined"==typeof uni},t.instance=new t,t}();t.FrameworkDetector=r}).call(this,n(25))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(0),s=n(7),a=n(19),u=(o=a)&&o.__esModule?o:{"default":o};var c=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,null,[{key:"assemble",value:function(e){if(!i.calibrator.isDef(e))return null;try{var t=Object.create(null);return t.type=e.mt,t.timestamp=e.ts,t.senderId=e.s,t.payload=JSON.parse(e.p),t.messageId=e.i,t.status=u["default"].success,e.t==s.ConversationType.GROUP?(t.groupId=e.r,t.senderData=e.d?JSON.parse(e.d):{}):t.receiverId=e.r,t}catch(n){throw Error(n)}}}]),e}();t["default"]=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t["default"]={message:"message",imMessage:"imMessage",userPresence:"userPresence",groupPresence:"groupPresence"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=function l(e,t,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,t);if(o===undefined){var r=Object.getPrototypeOf(e);return null===r?undefined:l(r,t,n)}if("value"in o)return o.value;var i=o.get;return i===undefined?undefined:i.call(n)},s=n(24),a=(o=s)&&o.__esModule?o:{"default":o},u=n(6);var c=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a["default"]),r(t,[{key:"validate",value:function(e){if(i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"validate",this).call(this,e),!u.calibrator.isDef(e.file))throw Error("file is empty.")}},{key:"setPayload",value:function(e){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setPayload",this).call(this,e)}}]),t}();t["default"]=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t["default"]={"new":"new",sending:"sending",success:"success",fail:"fail"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=function l(e,t,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,t);if(o===undefined){var r=Object.getPrototypeOf(e);return null===r?undefined:l(r,t,n)}if("value"in o)return o.value;var i=o.get;return i===undefined?undefined:i.call(n)},s=n(6),a=n(24),u=(o=a)&&o.__esModule?o:{"default":o};var c=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,u["default"]),r(t,[{key:"validate",value:function(e){if(i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"validate",this).call(this,e),!s.calibrator.isDef(e.file))throw Error("file is empty.")}},{key:"setPayload",value:function(e){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setPayload",this).call(this,e)}}]),t}();t["default"]=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=function c(e,t,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,t);if(o===undefined){var r=Object.getPrototypeOf(e);return null===r?undefined:c(r,t,n)}if("value"in o)return o.value;var i=o.get;return i===undefined?undefined:i.call(n)},s=n(24),a=(o=s)&&o.__esModule?o:{"default":o};var u=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a["default"]),r(t,[{key:"validate",value:function(e){if(i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"validate",this).call(this,e),!(e.file instanceof File))throw Error("wrong file type.");if(0==e.file.size)throw Error("File size is 0.");if(e.file.size>31457280)throw Error("message-length limit 30mib")}},{key:"setPayload",value:function(e){i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setPayload",this).call(this,e),this.payload.contentType=e.file.type,this.payload.name=e.file.name,this.payload.size=e.file.size;var n=(window.URL||window.webkitURL).createObjectURL(e.file);this.payload.url=n}}]),t}();t["default"]=u},function(e,t){t.encode=function(e){var t="";for(var n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t},t.decode=function(e){for(var t={},n=e.split("&"),o=0,r=n.length;o<r;o++){var i=n[o].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.ConversationType={GROUP:"group",PRIVATE:"private"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=function c(e,t,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,t);if(o===undefined){var r=Object.getPrototypeOf(e);return null===r?undefined:c(r,t,n)}if("value"in o)return o.value;var i=o.get;return i===undefined?undefined:i.call(n)},i=a(n(14)),s=a(n(2));function a(e){return e&&e.__esModule?e:{"default":e}}var u=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.file=null,n.onProgress=null,n.setFile(e.file),n.setOnProgress(e.onProgress),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i["default"]),o(t,[{key:"validate",value:function(e){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"validate",this).call(this,e)}},{key:"setPayload",value:function(e){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setPayload",this).call(this,e),this.payload.size="",this.payload.contentType="",this.payload.name="",this.payload.url=""}},{key:"setType",value:function(e){this.type=s["default"].file}},{key:"setFile",value:function(e){this.file=e}},{key:"setOnProgress",value:function(e){this.onProgress=e}}]),t}();t["default"]=u},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(o){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}();var r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return o(e,[{key:"upload",value:function(e){throw Error("Not implementation yet.")}}]),e}();t["default"]=r},function(e,t,n){"use strict";t.__esModule=!0,t.GoEasyEventCenter=void 0;var o=n(105),r=function(){function e(){}return e.on=function(t,n){e.eventDriver.on(t,n)},e.fire=function(t,n){e.eventDriver.fire(t,n)},e.eventDriver=new o.EmitterEventDriver,e}();t.GoEasyEventCenter=r},function(e,t,n){"use strict";n(8)("socket.io-parser");var o=n(12),r=n(49);function i(){}t.protocol=4,t.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],t.CONNECT=0,t.DISCONNECT=1,t.EVENT=2,t.ACK=3,t.ERROR=4,t.BINARY_EVENT=5,t.BINARY_ACK=6,t.Encoder=i,t.Decoder=a;var s=t.ERROR+'"encode error"';function a(){this.reconstructor=null}function u(e){this.reconPack=e,this.buffers=[]}function c(e){return{type:t.ERROR,data:"parser error: "+e}}i.prototype.encode=function(e,n){n([function(e){var n=""+e.type;t.BINARY_EVENT!==e.type&&t.BINARY_ACK!==e.type||(n+=e.attachments+"-");e.nsp&&"/"!==e.nsp&&(n+=e.nsp+",");null!=e.id&&(n+=e.id);if(null!=e.data){var o=function(e){try{return JSON.stringify(e)}catch(t){return!1}}(e.data);if(!1===o)return s;n+=o}return n}(e)])},o(a.prototype),a.prototype.add=function(e){var n;if("string"!=typeof e)throw new Error("Unknown type: "+e);n=function(e){var n=0,o={type:Number(e.charAt(0))};if(null==t.types[o.type])return c("unknown packet type "+o.type);if(t.BINARY_EVENT===o.type||t.BINARY_ACK===o.type){for(var i="";"-"!==e.charAt(++n)&&(i+=e.charAt(n),n!=e.length););if(i!=Number(i)||"-"!==e.charAt(n))throw new Error("Illegal attachments");o.attachments=Number(i)}if("/"===e.charAt(n+1))for(o.nsp="";++n;){var s=e.charAt(n);if(","===s)break;if(o.nsp+=s,n===e.length)break}else o.nsp="/";var a=e.charAt(n+1);if(""!==a&&Number(a)==a){for(o.id="";++n;){var s=e.charAt(n);if(null==s||Number(s)!=s){--n;break}if(o.id+=e.charAt(n),n===e.length)break}o.id=Number(o.id)}if(e.charAt(++n)){var u=function(e){try{return JSON.parse(e)}catch(t){return!1}}(e.substr(n)),l=!1!==u&&(o.type===t.ERROR||r(u));if(!l)return c("invalid payload");o.data=u}return o}(e),this.emit("decoded",n)},a.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},u.prototype.takeBinaryData=function(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){var t=binary.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null},u.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(e,t,n){"use strict";var o=n(13),r=n(12);function i(e){this.path=e.path,this.hostname=e.hostname,this.port=e.port,this.secure=e.secure,this.query=e.query,this.timestampParam=e.timestampParam,this.timestampRequests=e.timestampRequests,this.readyState="",this.agent=e.agent||!1,this.socket=e.socket,this.enablesXDR=e.enablesXDR,this.pfx=e.pfx,this.key=e.key,this.passphrase=e.passphrase,this.cert=e.cert,this.ca=e.ca,this.ciphers=e.ciphers,this.rejectUnauthorized=e.rejectUnauthorized,this.forceNode=e.forceNode,this.isReactNative=e.isReactNative,this.extraHeaders=e.extraHeaders,this.localAddress=e.localAddress}e.exports=i,r(i.prototype),i.prototype.onError=function(e,t){var n=new Error(e);return n.type="TransportError",n.description=t,this.emit("error",n),this},i.prototype.open=function(){return"closed"!==this.readyState&&""!==this.readyState||(this.readyState="opening",this.doOpen()),this},i.prototype.close=function(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this},i.prototype.send=function(e){if("open"!==this.readyState)throw new Error("Transport not open");this.write(e)},i.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},i.prototype.onData=function(e){var t=o.decodePacket(e,this.socket.binaryType);this.onPacket(t)},i.prototype.onPacket=function(e){this.emit("packet",e)},i.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},function(e,t){e.exports=function(e,t){var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},function(e,t,n){"use strict";var o,r=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};t.__esModule=!0,t.PlatformDetector=t.Platform=void 0,function(e){e.BROWSER="BROWSER",e.UNKNOWN="UNKNOWN",e.APP_IOS="APP_IOS",e.APP_ANDROID="APP_ANDROID",e.APPLET_WX="APPLET_WX",e.APPLET_WX_GAME="APPLET_WX_GAME",e.APPLET_ALIPAY="APPLET_ALIPAY",e.APPLET_BYTEDANCE="APPLET_BYTEDANCE"}(o=t.Platform||(t.Platform={}));var i=function(){function e(){var e,t,n;this.platform=null,this.methods=((e={})[o.BROWSER]=this.isBrowser,e[o.APP_IOS]=this.isAppiOS,e[o.APP_ANDROID]=this.isAppAndroid,e[o.APPLET_WX]=this.isWXApplet,e[o.APPLET_WX_GAME]=this.isWXGameApplet,e);var i=this.methods,s=Object.keys(i);try{for(var a=r(s),u=a.next();!u.done;u=a.next()){var c=u.value;if((0,i[c])()){this.platform=c;break}}}catch(l){t={error:l}}finally{try{u&&!u.done&&(n=a["return"])&&n.call(a)}finally{if(t)throw t.error}}this.platform=this.platform||o.UNKNOWN,this.platform}return e.currentPlatform=function(){return e.instance.platform},e.prototype.isBrowser=function(){return"undefined"!=typeof navigator&&"undefined"!=typeof document&&!!document.getElementById&&"undefined"==typeof GameGlobal},e.prototype.isAppiOS=function(){return"object"==typeof uni&&!!uni.getSystemInfoSync&&"ios"===uni.getSystemInfoSync().platform&&"object"==typeof plus},e.prototype.isAppAndroid=function(){return"object"==typeof uni&&!!uni.getSystemInfoSync&&"android"===uni.getSystemInfoSync().platform&&"object"==typeof plus},e.prototype.isWXApplet=function(){return"object"==typeof wx&&!!wx.getSystemInfoSync&&"undefined"==typeof WebSocket&&"undefined"==typeof XMLHttpRequest&&"undefined"==typeof plus},e.prototype.isWXGameApplet=function(){return"object"==typeof GameGlobal},e.prototype.isAlipayApplet=function(){return!1},e.prototype.isBytedanceApplet=function(){return!1},e.prototype.isQQApplet=function(){return!1},e.prototype.isBaiduApplet=function(){return!1},e.instance=new e,e}();t.PlatformDetector=i},function(e,t,n){"use strict";t.__esModule=!0,t.GoEasyIM=t.PubSub=t.MessageStatus=void 0;var o=n(10),r=n(7),i=n(9),s=n(108),a=n(0),u=n(133),c=n(11),l=n(134),f=n(135),p=n(136),d=n(137),h=n(139),y=n(141);!function(e){e["new"]="new",e.sending="sending",e.success="success",e.fail="fail"}(t.MessageStatus||(t.MessageStatus={}));var m=function(){function e(e){this.options=null,this.goEasySocket=null,this.publisher=null,this.subscriber=null,this.presence=null,this.histories=null,this.hereNows=null,this.neverConnect=!0,this.options=e}return e.prototype.initialGoEasySocket=function(e){this.goEasySocket=e,this.subscriber.initialGoEasySocket(),this.presence.initialGoEasySocket()},e.prototype.initialBeforeConnect=function(){this.neverConnect=!1,this.publisher=new p["default"](this),this.subscriber=new d["default"](this),this.histories=new l["default"](this),this.presence=new h["default"](this),this.hereNows=new f["default"](this)},e.prototype.validateOptions=function(){var e=this.options;if(!e.modules||!e.modules.includes(u.ModuleType.PUBSUB))throw Error("Invalid options: module '"+u.ModuleType.PUBSUB+"' is not enabled")},e.prototype.publish=function(e){this.validateOptions(),this.publisher.publish(e)},e.prototype.subscribe=function(e){this.validateOptions(),this.subscriber.subscribe(e)},e.prototype.unsubscribe=function(e){this.validateOptions(),this.subscriber.unsubscribe(e)},e.prototype.subscribePresence=function(e){this.validateOptions(),this.presence.subscribePresence(e)},e.prototype.unsubscribePresence=function(e){this.validateOptions(),this.presence.unsubscribePresence(e)},e.prototype.history=function(e){this.validateOptions(),this.histories.get(e)},e.prototype.hereNow=function(e){this.validateOptions(),this.hereNows.byChannel(e)},e.prototype.hereNowByUserIds=function(e){this.validateOptions(),this.hereNows.byUserId(e)},e.instance=null,e}();t.PubSub=m;var v=function(){function e(e){this.options=e}return e.prototype.initialBeforeConnect=function(e){c.im.initialBeforeConnect(e)},e.prototype.initialAfterConnect=function(){c.im.initialAfterConnect()},e.prototype.initialGoEasySocket=function(e){c.im.initialGoEasySocket(e)},e.prototype.validateOptions=function(){var e=this.options;if(!e.modules||!e.modules.includes(u.ModuleType.IM))throw Error("Invalid options: module '"+u.ModuleType.IM+"' is not enabled")},e.prototype.validateMessageToData=function(e){if(!a.calibrator.isObject(e.to))throw{code:400,content:"TypeError: to requires an object."};if(!a.calibrator.isObject(e.to.data))throw{code:400,content:"TypeError: to.data requires an object."}},e.prototype.on=function(e,t){this.validateOptions(),c.im.on(e,t)},e.prototype.createTextMessage=function(e){if(this.validateOptions(),this.validateMessageToData(e),!a.calibrator.isString(e.text))throw{code:400,content:"TypeError: text requires string."};if(e.text.length>2500)throw{code:400,content:"Message text over max length 2500"};return c.im.createTextMessage(e)},e.prototype.createImageMessage=function(e){return this.validateOptions(),this.validateMessageToData(e),c.im.createImageMessage(e)},e.prototype.createFileMessage=function(e){return this.validateOptions(),this.validateMessageToData(e),c.im.createFileMessage(e)},e.prototype.createAudioMessage=function(e){return this.validateOptions(),this.validateMessageToData(e),c.im.createAudioMessage(e)},e.prototype.createVideoMessage=function(e){return this.validateOptions(),this.validateMessageToData(e),c.im.createVideoMessage(e)},e.prototype.createCustomMessage=function(e){if(this.validateOptions(),this.validateMessageToData(e),!a.calibrator.isObject(e.payload))throw{code:400,content:"TypeError: payload requires an object."};return c.im.createCustomMessage(e)},e.prototype.latestConversations=function(e){this.validateOptions(),c.im.latestConversations().then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.removePrivateConversation=function(e){this.validateOptions(),c.im.removePrivateConversation(e.userId).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess()})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.removeGroupConversation=function(e){this.validateOptions(),c.im.removeGroupConversation(e.groupId).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess()})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.history=function(e){this.validateOptions();var t=Object.assign(e,{friendId:e.userId});c.im.history(t).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.upload=function(e){this.validateOptions(),c.im.upload(e.file,e.name,e.onProgress).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.sendMessage=function(e){this.validateOptions(),c.im.sendMessage(e).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.markGroupMessageAsRead=function(e){this.validateOptions(),c.im.groupMarkAsRead(e.groupId,e.timestamp).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.markPrivateMessageAsRead=function(e){this.validateOptions(),c.im.privateMarkAsRead(e.userId,e.timestamp).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.topPrivateConversation=function(e){this.validateOptions(),c.im.topPrivateConversation(e.userId,e.top).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess()})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.topGroupConversation=function(e){this.validateOptions(),c.im.topGroupConversation(e.groupId,e.top).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess()})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.subscribeUserPresence=function(e){this.validateOptions(),c.im.subscribeUserPresence(e.userIds).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.unsubscribeUserPresence=function(e){this.validateOptions(),c.im.unsubscribeUserPresence(e.userId).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.hereNow=function(e){this.validateOptions(),c.im.hereNow(e).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.subscribeGroup=function(e){this.validateOptions(),c.im.subscribeGroup(e).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.unsubscribeGroup=function(e){this.validateOptions(),c.im.unsubscribeGroup(e.groupId).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.subscribeGroupPresence=function(e){this.validateOptions(),c.im.subscribeGroupPresence(e.groupIds).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.unsubscribeGroupPresence=function(e){this.validateOptions(),c.im.unsubscribeGroupPresence(e.groupId).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.groupHereNow=function(e){this.validateOptions(),c.im.groupHereNow(e.groupId).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.groupOnlineCount=function(e){this.validateOptions(),c.im.groupOnlineCount(e.groupId).then(function(t){a.calibrator.isFunction(e.onSuccess)&&e.onSuccess(t)})["catch"](function(t){a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e}();t.GoEasyIM=v;var b=function(){function e(t){if(this.im=null,this.pubsub=null,this.goEasySocket=null,this.notification=null,null!==e.instance&&e.instance.getConnectionStatus()!==i["default"].DISCONNECTED)return e.instance;this.validateOptions(t),this.options=t,this.pubsub=new m(this.options),this.im=new v(this.options),this.notification=new y.GoEasyNotification(this.options.allowNotification)}return e.getInstance=function(t){return null===e.instance&&(e.instance=new e(t)),e.instance},e.prototype.connect=function(e){this.getConnectionStatus()!==i["default"].DISCONNECTED&&a.calibrator.isObject(e)&&a.calibrator.isFunction(e.onFailed)?e.onFailed({code:408,content:"It is already connected, don't try again until disconnect() is called. "}):(this.confirmUserId(e),this.pubsub.initialBeforeConnect(),this.im.initialBeforeConnect({id:e.id,data:e.data}),this.goEasySocket=new s["default"](this.options,e),this.im.initialGoEasySocket(this.goEasySocket),this.goEasySocket.connect(this.notification),this.pubsub.initialGoEasySocket(this.goEasySocket),this.im.initialAfterConnect())},e.prototype.disconnect=function(e){this.goEasySocket.disconnect(e).then(function(){a.calibrator.isObject(e)&&a.calibrator.isFunction(e.onSuccess)&&e.onSuccess()})["catch"](function(t){a.calibrator.isObject(e)&&a.calibrator.isFunction(e.onFailed)&&e.onFailed(t)})},e.prototype.getConnectionStatus=function(){return this.goEasySocket?this.goEasySocket.getStatus():i["default"].DISCONNECTED},e.prototype.validateOptions=function(e){var t="";if(!a.calibrator.isObject(e))throw t="options is require an object.",Error(t);if(!a.calibrator.isPrimitive(e.appkey)||0==e.appkey.length)throw t="Invalid options:'host' is empty.",Error(t);if(!a.calibrator.isPrimitive(e.host)||0==e.host.length)throw t="Invalid options:'host' is empty.",Error(t);if(!a.calibrator.isArray(e.modules))throw t="Invalid options: 'modules' must be nonempty array",Error(t);var n=[u.ModuleType.IM,u.ModuleType.PUBSUB],o=e.modules.map(function(e){var o=e.toUpperCase();if(!n.includes(o))throw t="Invalid options: module '"+e+"' is not support",Error(t);return o});e.modules=o},e.prototype.onClickNotification=function(e){this.notification.onClickNotification(e)},e.prototype.confirmUserId=function(e){if(this.options.modules.includes(u.ModuleType.IM)&&(a.calibrator.isEmpty(e.id)||!a.calibrator.isStringOrNumber(e.id)))throw{code:400,content:"TypeError: id requires number or string."};if("string"==typeof e.id&&e.id.length>60)throw{code:400,content:"id over max length 60"}},e.instance=null,e.version="2.2.7",e.IM_EVENT=o.ImEventType,e.IM_SCENE=r.ConversationType,e}();t["default"]=b},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.eventCenter=undefined;var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(34),i=n(0);var s=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.subs=null,this.subs=Object.create(null)}return o(e,[{key:"on",value:function(e,t){if(!i.calibrator.isString(e))throw Error("eventType require a string.");if(!i.calibrator.isDef(r.ImEventType[e]))throw Error("event not found.");if(!i.calibrator.isFunction(t))throw Error("event require a callback.");this.subs[e]=t}},{key:"notify",value:function(e,t){var n=this.subs[e];n&&n(t)}}]),e}());t.eventCenter=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.ImEventType={PRIVATE_MESSAGE_RECEIVED:"PRIVATE_MESSAGE_RECEIVED",GROUP_MESSAGE_RECEIVED:"GROUP_MESSAGE_RECEIVED",SYSTEM_MESSAGE_RECEIVED:"SYSTEM_MESSAGE_RECEIVED",CONVERSATIONS_UPDATED:"CONVERSATIONS_UPDATED",CONNECTED:"CONNECTED",CONNECTING:"CONNECTING",DISCONNECTED:"DISCONNECTED",USER_PRESENCE:"USER_PRESENCE",GROUP_PRESENCE:"GROUP_PRESENCE"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}();var i=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,[{key:"isUndef",value:function(e){return e===undefined||null===e}},{key:"isTrue",value:function(e){return!0===e}},{key:"isFalse",value:function(e){return!1===e}},{key:"isPrimitive",value:function(e){return"string"==typeof e||"number"==typeof e||"symbol"===(void 0===e?"undefined":o(e))||"boolean"==typeof e}},{key:"isDef",value:function(e){return e!==undefined&&null!==e}},{key:"isObject",value:function(e){return null!==e&&"object"===(void 0===e?"undefined":o(e))}},{key:"isPlainObject",value:function(e){return"[object Object]"===Object.prototype.toString.call(e)}},{key:"isRegExp",value:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)}},{key:"isValidArrayIndex",value:function(e){var t=parseFloat(String(e));return t>=0&&Math.floor(t)===t&&isFinite(e)}},{key:"isStringOrNumber",value:function(e){return"string"==typeof e||"number"==typeof e}},{key:"isString",value:function(e){return"string"==typeof e}},{key:"isNumber",value:function(e){return"number"==typeof e}},{key:"isArray",value:function(e){return"[object Array]"==Object.prototype.toString.call(e)}},{key:"isEmpty",value:function(e){return this.isArray(e)?0==e.length:this.isObject(e)?!this.isDef(e):!this.isNumber(e)&&(this.isString(e)?""==e.trim():!this.isDef(e))}},{key:"isNative",value:function(e){return"function"==typeof e&&/native code/.test(e.toString())}},{key:"isFunction",value:function(e){return"function"==typeof e}}]),e}());t.calibrator=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GoEasyDomainNumber=undefined;var o,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(66),s=(o=i)&&o.__esModule?o:{"default":o},a=n(37);var u=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,null,[{key:"refreshNumber",value:function(){var t=e.GOEASY_DOMAIN_NUMBER,n=a.LocalStorageDispatcher.localStorage(),o=Math.floor(Math.random()*(s["default"].maxNumber-1)+1);return null!==n&&(o=parseInt(n.get(t))||o),o>0&&o<s["default"].maxNumber?o+=1:o==s["default"].maxNumber&&(o=1),null!==n&&n.put(t,o),o}}]),e}();u.GOEASY_DOMAIN_NUMBER="GOEASY_DOMAIN_NUMBER",t.GoEasyDomainNumber=u},function(e,t,n){"use strict";var o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};t.__esModule=!0,t.LocalStorageDispatcher=void 0;var r=n(67),i=function(){function e(){this.domain=null;this.domain="undefined"!=typeof location&&/^(?:[A-za-z0-9-]+\.)+[A-za-z]{2,4}(?:[\/\?#][\/=\?%\-&~`@[\]\':+!\.#\w]*)?$/.test(location.host)?location.host.split(".").slice(-2).join("."):null}return e.prototype.get=function(e){var t=r.Cookie.get(e)||null;return JSON.parse(t)},e.prototype.put=function(e,t){var n=new Date(2030,12,31,0,0,0,0),o=this.domain;r.Cookie.set(e,JSON.stringify(t),n,o)},e.prototype.remove=function(e){var t=this.domain;r.Cookie.remove(e,t)},e.prototype.support=function(){return navigator&&!0===navigator.cookieEnabled},e}(),s=function(){function e(){}return e.prototype.get=function(e){var t=localStorage.getItem(e);return JSON.parse(t)},e.prototype.put=function(e,t){var n=localStorage.setItem(e,JSON.stringify(t));JSON.stringify(n)},e.prototype.remove=function(e){localStorage.removeItem(e)},e.prototype.support=function(){return!("undefined"!=typeof GameGlobal||"undefined"==typeof localStorage||!localStorage.setItem)},e}(),a=function(){function e(){}return e.prototype.get=function(e){var t=uni.getStorageSync(e)||null;return JSON.parse(t)},e.prototype.put=function(e,t){uni.setStorageSync(e,JSON.stringify(t))},e.prototype.remove=function(e){uni.removeStorageSync(e)},e.prototype.support=function(){return!("object"!=typeof uni||!uni.getStorageSync)},e}(),u=function(){function e(){}return e.prototype.get=function(e){var t=wx.getStorageSync(e)||null;return JSON.parse(t)},e.prototype.put=function(e,t){wx.setStorageSync(e,JSON.stringify(t))},e.prototype.remove=function(e){wx.removeStorageSync(e)},e.prototype.support=function(){return!("object"!=typeof wx||!wx.getStorageSync)},e}(),c=(function(){function e(){}e.prototype.get=function(e){var t=my.getStorageSync(e)||null;return JSON.parse(t)},e.prototype.put=function(e,t){my.setStorageSync(e,JSON.stringify(t))},e.prototype.remove=function(e){my.removeStorageSync(e)},e.prototype.support=function(){return!("undefined"==typeof my||!my.getStorageSync)}}(),function(){function e(){}e.prototype.get=function(e){var t=qq.getStorageSync(e)||null;return JSON.parse(t)},e.prototype.put=function(e,t){qq.setStorageSync(e,JSON.stringify(t))},e.prototype.remove=function(e){qq.removeStorageSync(e)},e.prototype.support=function(){return!("undefined"==typeof qq||!qq.getStorageSync)}}(),function(){function e(){}e.prototype.get=function(e){var t=tt.getStorageSync(e)||null;return JSON.parse(t)},e.prototype.put=function(e,t){tt.setStorageSync(e,JSON.stringify(t))},e.prototype.remove=function(e){tt.removeStorageSync(e)},e.prototype.support=function(){return!("object"!=typeof tt||!tt.getStorageSync)}}(),function(){function e(){}e.prototype.get=function(e){var t=swan.getStorageSync(e)||null;return JSON.parse(t)},e.prototype.put=function(e,t){swan.setStorageSync(e,JSON.stringify(t))},e.prototype.remove=function(e){swan.removeStorageSync(e)},e.prototype.support=function(){return!("undefined"==typeof swan||!swan.getStorageSync)}}(),function(){function e(){this.api=e.dispatch(),this.api}e.dispatch=function(){var e=new s,t=new i;return e.support()?e:t},e.prototype.get=function(e){return this.api.get(e)},e.prototype.put=function(e,t){this.api.put(e,t)},e.prototype.remove=function(e){this.api.remove(e)},e.prototype.support=function(){return"undefined"!=typeof localStorage}}(),function(){function e(){this.supportedStorage=null;var t=e.storages;t.push(new a),t.push(new s),t.push(new u),t.push(new i),this.dispatch(),this.supportedStorage}return e.localStorage=function(){return this.instance.supportedStorage},e.prototype.dispatch=function(){var t,n;try{for(var r=o(e.storages),i=r.next();!i.done;i=r.next()){var s=i.value;if(s.support()){this.supportedStorage=s;break}}}catch(a){t={error:a}}finally{try{i&&!i.done&&(n=r["return"])&&n.call(r)}finally{if(t)throw t.error}}},e.storages=new Array,e.instance=new e,e}());t.LocalStorageDispatcher=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Conversion=undefined;var o,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(23),s=n(11),a=n(16),u=(o=a)&&o.__esModule?o:{"default":o};t.Conversion=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.type="",this.lastMessage=null,this.unread=0,this.top=!1,this.data=null,this.lc=0,this.lm=0}return r(e,null,[{key:"buildByInMessage",value:function(t){var n=new e;return n.data={},n.type=t.t,n.lastMessage=u["default"].assemble(t),n.lc=n.lastMessage.timestamp-1,n.lm=n.lastMessage.timestamp,n.unread=0,t.t==i.ConversationType.GROUP?n.groupId=t.r:s.IM.userId==t.r?n.userId=t.s:n.userId=t.r,n}},{key:"buildByOutMessage",value:function(t,n,o,r){var s=new e;return s.type=n,s.lastMessage=t,s.lm=s.lastMessage.timestamp,s.lc=s.lm,s.unread=0,n==i.ConversationType.GROUP?(s.groupId=o,s.lastMessage.groupId=o):(s.userId=o,s.lastMessage.receiverId=o),s}},{key:"buildByConversation",value:function(t,n){var o=new e;o.type=n.t,n.lmsg.t=n.t,o.lastMessage=u["default"].assemble(n.lmsg),o.unread=0,o.lc=n.lcts,o.lm=o.lastMessage.timestamp,o.top=n.top||!1;var r=n.d?JSON.parse(n.d):{};return o.data=r,n.t==i.ConversationType.GROUP?(o.groupId=n.g,t.putGroupData(o.groupId,r)):(o.userId=n.uid,t.putUserData(o.userId,r),s.IM.userId==n.lmsg.s?o.lastMessage.senderData=s.IM.userData:o.lastMessage.senderData=r),o}}]),e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=a(n(14)),i=a(n(2)),s=n(0);function a(e){return e&&e.__esModule?e:{"default":e}}var u=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r["default"]),o(t,[{key:"validate",value:function(e){if(s.calibrator.isEmpty(e.text)||""==e.text.trim())throw Error("text is empty")}},{key:"setType",value:function(e){this.type=i["default"].text}},{key:"setPayload",value:function(e){(function n(e,t,o){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,t);if(r===undefined){var i=Object.getPrototypeOf(e);return null===i?undefined:n(i,t,o)}if("value"in r)return r.value;var s=r.get;return s===undefined?undefined:s.call(o)})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setPayload",this).call(this,e),this.payload.text=e.text}}]),t}();t["default"]=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}();var r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return o(e,[{key:"build",value:function(){throw Error("Not implementation yet.")}}]),e}();t["default"]=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=u(n(42)),i=u(n(2)),s=u(n(43)),a=u(n(40));function u(e){return e&&e.__esModule?e:{"default":e}}var c=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.im=null,n.goEasyUploader=new s["default"](e),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a["default"]),o(t,[{key:"build",value:function(e){var t=this;return new Promise(function(n,o){var i=new r["default"];t.upload(e).then(function(t){var o=t.content,r=o===undefined?{}:o;(i=e.payload).url=r.url,i.name=r.newFileName,n(i)})["catch"](function(e){o(e)})})}},{key:"upload",value:function(e){var t=e.type==i["default"].video?e.payload.video.name:e.payload.name;return this.goEasyUploader.upload(e.file,t,e.onProgress,e.type)}}]),t}();t["default"]=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t["default"]=function o(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(86),s=n(90),a=(o=s)&&o.__esModule?o:{"default":o};var u=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.requestBuilder=null,this.fileUploader=i.fileUploader,this.requestBuilder=new a["default"](t)}return r(e,[{key:"upload",value:function(e,t,n,o){var r=this;return new Promise(function(i,s){r.requestBuilder.build(e,t,o).then(function(e){i(r.doUpload(e,n))})["catch"](function(e){s(e)})})}},{key:"customizeUpload",value:function(e,t){this.doUpload(e,t)}},{key:"doUpload",value:function(e,t){return this.fileUploader.upload(e,t)}}]),e}();t["default"]=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t["default"]=function o(e,t,n,r,i){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),this.host="",this.headers={},this.parameters={},this.file={},this.payload={},this.host=e,this.headers=t,this.parameters=n,this.file=r,this.payload=i}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}();var r=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return o(e,[{key:"build",value:function(e,t){}},{key:"newFileName",value:function(e){return e&&e.newFilename||""}}]),e}();t["default"]=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.IM_INTERNAL_EVENTS={IM_INTERNAL:"IM_INTERNAL_",MESSAGE_RECEIVED:"IM_INTERNAL_MESSAGE_RECEIVED"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=c(n(9)),i=c(n(1)),s=c(n(109)),a=c(n(110)),u=n(0);function c(e){return e&&e.__esModule?e:{"default":e}}var l=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.io=a["default"],this.status=r["default"].DISCONNECTED,this.permissions=[i["default"].NONE],this.emitter=null,this.connectedObservers=[],this.disconnectedObservers=[],this.emitter=new s["default"](this)}return o(e,[{key:"connect",value:function(){this.status=r["default"].CONNECTING}},{key:"emit",value:function(e){this.emitter.emit(e)}},{key:"doEmit",value:function(e,t,n){}},{key:"on",value:function(e,t){this.io.on(e,t)}},{key:"disconnect",value:function(){this.io.disconnect()}},{key:"getStatus",value:function(){return this.status}},{key:"addConnectedObserver",value:function(e){u.calibrator.isFunction(e)&&this.connectedObservers.push(e)}},{key:"addDisconnectedObserver",value:function(e){u.calibrator.isFunction(e)&&this.disconnectedObservers.push(e)}},{key:"notify",value:function(e,t){for(var n=0;n<e.length;n++)e[n](t)}}]),e}();t["default"]=l},function(e,t){var n=/^(?:(?![^:@]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,o=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];e.exports=function(e){var t=e,r=e.indexOf("["),i=e.indexOf("]");-1!=r&&-1!=i&&(e=e.substring(0,r)+e.substring(r,i).replace(/:/g,";")+e.substring(i,e.length));for(var s=n.exec(e||""),a={},u=14;u--;)a[o[u]]=s[u]||"";return-1!=r&&-1!=i&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,":"),a.authority=a.authority.replace("[","").replace("]","").replace(/;/g,":"),a.ipv6uri=!0),a}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=n(112),i=n(56),s=n(12),a=n(28),u=n(57),c=n(58),l=(n(8)("socket.io-client:manager"),n(55)),f=n(128),p=n(36).GoEasyDomainNumber,d=Object.prototype.hasOwnProperty;function h(e,t){if(!(this instanceof h))return new h(e,t);e&&"object"===(void 0===e?"undefined":o(e))&&(t=e,e=undefined),(t=t||{}).path=t.path||"/socket.io",this.nsps={},this.subs=[],this.opts=t,this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||Infinity),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor||.5),this.backoff=new f({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this.readyState="closed",this.uri=e,this.connecting=[],this.lastPing=null,this.encoding=!1,this.packetBuffer=[];var n=t.parser||a;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this.autoConnect=!1!==t.autoConnect,this.autoConnect&&this.open()}function y(){var e=!1;return"object"===("undefined"==typeof uni?"undefined":o(uni))&&uni.getSystemInfo&&(e=!0),e&&!0===getApp().uniAppRunningBackend}e.exports=h,h.prototype.emitAll=function(){for(var e in this.emit.apply(this,arguments),this.nsps)d.call(this.nsps,e)&&this.nsps[e].emit.apply(this.nsps[e],arguments)},h.prototype.updateSocketIds=function(){for(var e in this.nsps)d.call(this.nsps,e)&&(this.nsps[e].id=this.generateId(e))},h.prototype.generateId=function(e){return("/"===e?"":e+"#")+this.engine.id},s(h.prototype),h.prototype.reconnection=function(e){return arguments.length?(this._reconnection=!!e,this):this._reconnection},h.prototype.reconnectionAttempts=function(e){return arguments.length?(this._reconnectionAttempts=e,this):this._reconnectionAttempts},h.prototype.reconnectionDelay=function(e){return arguments.length?(this._reconnectionDelay=e,this.backoff&&this.backoff.setMin(e),this):this._reconnectionDelay},h.prototype.randomizationFactor=function(e){return arguments.length?(this._randomizationFactor=e,this.backoff&&this.backoff.setJitter(e),this):this._randomizationFactor},h.prototype.reconnectionDelayMax=function(e){return arguments.length?(this._reconnectionDelayMax=e,this.backoff&&this.backoff.setMax(e),this):this._reconnectionDelayMax},h.prototype.timeout=function(e){return arguments.length?(this._timeout=e,this):this._timeout},h.prototype.maybeReconnectOnOpen=function(){!this.reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()},h.prototype.open=h.prototype.connect=function(e,t){if(this.readyState,~this.readyState.indexOf("open"))return this;this.uri,this.engine=r(this.uri,this.opts);var n=this.engine,o=this;this.readyState="opening",this.skipReconnect=!1;var i=u(n,"open",function(){o.onopen(),e&&e()}),s=u(n,"error",function(t){if("undefined"!=typeof window){var n=parseInt(o.uri.match(/[1-9][0-9]*/g)[0]),r=p.refreshNumber();o.uri=o.uri.replace(n,r)}if(o.cleanup(),o.readyState="closed",o.emitAll("connect_error",t),e){var i=new Error("Connection error");i.data=t,e(i)}else o.maybeReconnectOnOpen()});if(!1!==this._timeout){var a=this._timeout,c=setTimeout(function(){i.destroy(),n.close(),n.emit("error","timeout"),o.emitAll("connect_timeout",a)},a);this.subs.push({destroy:function(){clearTimeout(c)}})}return this.subs.push(i),this.subs.push(s),this},h.prototype.onopen=function(){this.cleanup(),this.readyState="open",this.emit("open");var e=this.engine;this.subs.push(u(e,"data",c(this,"ondata"))),this.subs.push(u(e,"ping",c(this,"onping"))),this.subs.push(u(e,"pong",c(this,"onpong"))),this.subs.push(u(e,"error",c(this,"onerror"))),this.subs.push(u(e,"close",c(this,"onclose"))),this.subs.push(u(this.decoder,"decoded",c(this,"ondecoded")))},h.prototype.onping=function(){this.lastPing=new Date,this.emitAll("ping")},h.prototype.onpong=function(){this.emitAll("pong",new Date-this.lastPing)},h.prototype.ondata=function(e){this.decoder.add(e)},h.prototype.ondecoded=function(e){this.emit("packet",e)},h.prototype.onerror=function(e){this.emitAll("error",e)},h.prototype.socket=function(e,t){var n=this.nsps[e];if(!n){n=new i(this,e,t),this.nsps[e]=n;var o=this;n.on("connecting",r),n.on("connect",function(){n.id=o.generateId(e)}),this.autoConnect&&r()}function r(){~l(o.connecting,n)||o.connecting.push(n)}return n},h.prototype.destroy=function(e){var t=l(this.connecting,e);~t&&this.connecting.splice(t,1),this.connecting.length||this.close()},h.prototype.packet=function(e){var t=this;e.query&&0===e.type&&(e.nsp+="?"+e.query),t.encoding?t.packetBuffer.push(e):(t.encoding=!0,this.encoder.encode(e,function(n){for(var o=0;o<n.length;o++)t.engine.write(n[o],e.options);t.encoding=!1,t.processPacketQueue()}))},h.prototype.processPacketQueue=function(){if(this.packetBuffer.length>0&&!this.encoding){var e=this.packetBuffer.shift();this.packet(e)}},h.prototype.cleanup=function(){for(var e=this.subs.length,t=0;t<e;t++){this.subs.shift().destroy()}this.packetBuffer=[],this.encoding=!1,this.lastPing=null,this.decoder.destroy()},h.prototype.close=h.prototype.disconnect=function(){this.skipReconnect=!0,this.reconnecting=!1,"opening"===this.readyState&&this.cleanup(),this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},h.prototype.onclose=function(e){this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",e),this._reconnection&&!this.skipReconnect&&this.reconnect()},h.prototype.reconnect=function(){if(y(),this.reconnecting||this.skipReconnect)return this;var e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var t=this.backoff.duration();this.reconnecting=!0;var n=setTimeout(function(){e.skipReconnect||(e.emitAll("reconnect_attempt",e.backoff.attempts),e.emitAll("reconnecting",e.backoff.attempts),e.skipReconnect||(y()?(e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error","Uniapp running backend, skipped reconnect...")):e.open(function(t){t?(e.reconnecting=!1,e.reconnect(),e.emitAll("reconnect_error",t.data)):e.onreconnect()})))},t);this.subs.push({destroy:function(){clearTimeout(n)}})}},h.prototype.onreconnect=function(){var e=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",e)}},function(e,t,n){"use strict";var o=n(114),r=n(125);t.polling=function(e){var t=!1,n=!1;e.jsonp;if("undefined"!=typeof location){var r="https:"===location.protocol,i=location.port;i||(i=r?443:80),t=e.hostname!==location.hostname||i!==e.port,n=e.secure!==r}return e.xdomain=t,e.xscheme=n,new o(e)},t.websocket=r},function(e,t,n){(function(t){var o=n(49),r=Object.prototype.toString,i="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===r.call(Blob),s="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===r.call(File);e.exports=function a(e){if(!e||"object"!=typeof e)return!1;if(o(e)){for(var n=0,r=e.length;n<r;n++)if(a(e[n]))return!0;return!1}if("function"==typeof t&&t.isBuffer&&t.isBuffer(e)||"function"==typeof ArrayBuffer&&e instanceof ArrayBuffer||i&&e instanceof Blob||s&&e instanceof File)return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return a(e.toJSON(),!0);for(var u in e)if(Object.prototype.hasOwnProperty.call(e,u)&&a(e[u]))return!0;return!1}}).call(this,n(53).Buffer)},function(e,t,n){"use strict";(function(e){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
var o=n(117),r=n(118),i=n(119);function s(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(s()<t)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=u.prototype:(null===e&&(e=new u(t)),e.length=t),e}function u(e,t,n){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return f(this,e)}return c(this,e,t,n)}function c(e,t,n,o){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,o){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(o||0))throw new RangeError("'length' is out of bounds");t=n===undefined&&o===undefined?new Uint8Array(t):o===undefined?new Uint8Array(t,n):new Uint8Array(t,n,o);u.TYPED_ARRAY_SUPPORT?(e=t).__proto__=u.prototype:e=p(e,t);return e}(e,t,n,o):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!u.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var o=0|h(t,n),r=(e=a(e,o)).write(t,n);r!==o&&(e=e.slice(0,r));return e}(e,t,n):function(e,t){if(u.isBuffer(t)){var n=0|d(t.length);return 0===(e=a(e,n)).length?e:(t.copy(e,0,0,n),e)}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(o=t.length)!=o?a(e,0):p(e,t);if("Buffer"===t.type&&i(t.data))return p(e,t.data)}var o;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function f(e,t){if(l(t),e=a(e,t<0?0:0|d(t)),!u.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function p(e,t){var n=t.length<0?0:0|d(t.length);e=a(e,n);for(var o=0;o<n;o+=1)e[o]=255&t[o];return e}function d(e){if(e>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|e}function h(e,t){if(u.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case undefined:return q(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(o)return q(e).length;t=(""+t).toLowerCase(),o=!0}}function y(e,t,n){var o=e[t];e[t]=e[n],e[n]=o}function m(e,t,n,o,r){if(0===e.length)return-1;if("string"==typeof n?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0){if(!r)return-1;n=0}if("string"==typeof t&&(t=u.from(t,o)),u.isBuffer(t))return 0===t.length?-1:v(e,t,n,o,r);if("number"==typeof t)return t&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):v(e,[t],n,o,r);throw new TypeError("val must be string, number or Buffer")}function v(e,t,n,o,r){var i,s=1,a=e.length,u=t.length;if(o!==undefined&&("ucs2"===(o=String(o).toLowerCase())||"ucs-2"===o||"utf16le"===o||"utf-16le"===o)){if(e.length<2||t.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(r){var l=-1;for(i=n;i<a;i++)if(c(e,i)===c(t,-1===l?0:i-l)){if(-1===l&&(l=i),i-l+1===u)return l*s}else-1!==l&&(i-=i-l),l=-1}else for(n+u>a&&(n=a-u),i=n;i>=0;i--){for(var f=!0,p=0;p<u;p++)if(c(e,i+p)!==c(t,p)){f=!1;break}if(f)return i}return-1}function b(e,t,n,o){n=Number(n)||0;var r=e.length-n;o?(o=Number(o))>r&&(o=r):o=r;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");o>i/2&&(o=i/2);for(var s=0;s<o;++s){var a=parseInt(t.substr(2*s,2),16);if(isNaN(a))return s;e[n+s]=a}return s}function g(e,t,n,o){return L(q(t,e.length-n),e,n,o)}function w(e,t,n,o){return L(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,o)}function _(e,t,n,o){return w(e,t,n,o)}function E(e,t,n,o){return L(G(t),e,n,o)}function O(e,t,n,o){return L(function(e,t){for(var n,o,r,i=[],s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),o=n>>8,r=n%256,i.push(r),i.push(o);return i}(t,e.length-n),e,n,o)}function k(e,t,n){return 0===t&&n===e.length?o.fromByteArray(e):o.fromByteArray(e.slice(t,n))}function S(e,t,n){n=Math.min(e.length,n);for(var o=[],r=t;r<n;){var i,s,a,u,c=e[r],l=null,f=c>239?4:c>223?3:c>191?2:1;if(r+f<=n)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(i=e[r+1]))&&(u=(31&c)<<6|63&i)>127&&(l=u);break;case 3:i=e[r+1],s=e[r+2],128==(192&i)&&128==(192&s)&&(u=(15&c)<<12|(63&i)<<6|63&s)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=e[r+1],s=e[r+2],a=e[r+3],128==(192&i)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&i)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,o.push(l>>>10&1023|55296),l=56320|1023&l),o.push(l),r+=f}return function(e){var t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);var n="",o=0;for(;o<t;)n+=String.fromCharCode.apply(String,e.slice(o,o+=P));return n}(o)}t.Buffer=u,t.SlowBuffer=function(e){+e!=e&&(e=0);return u.alloc(+e)},t.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=e.TYPED_ARRAY_SUPPORT!==undefined?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(t){return!1}}(),t.kMaxLength=s(),u.poolSize=8192,u._augment=function(e){return e.__proto__=u.prototype,e},u.from=function(e,t,n){return c(null,e,t,n)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(e,t,n){return function(e,t,n,o){return l(t),t<=0?a(e,t):n!==undefined?"string"==typeof o?a(e,t).fill(n,o):a(e,t).fill(n):a(e,t)}(null,e,t,n)},u.allocUnsafe=function(e){return f(null,e)},u.allocUnsafeSlow=function(e){return f(null,e)},u.isBuffer=function(e){return!(null==e||!e._isBuffer)},u.compare=function(e,t){if(!u.isBuffer(e)||!u.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,o=t.length,r=0,i=Math.min(n,o);r<i;++r)if(e[r]!==t[r]){n=e[r],o=t[r];break}return n<o?-1:o<n?1:0},u.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(e,t){if(!i(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);var n;if(t===undefined)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var o=u.allocUnsafe(t),r=0;for(n=0;n<e.length;++n){var s=e[n];if(!u.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(o,r),r+=s.length}return o},u.byteLength=h,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)y(this,t,t+1);return this},u.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},u.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},u.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?S(this,0,e):function(e,t,n){var o=!1;if((t===undefined||t<0)&&(t=0),t>this.length)return"";if((n===undefined||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return I(this,t,n);case"utf8":case"utf-8":return S(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return C(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}.apply(this,arguments)},u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},u.prototype.compare=function(e,t,n,o,r){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(t===undefined&&(t=0),n===undefined&&(n=e?e.length:0),o===undefined&&(o=0),r===undefined&&(r=this.length),t<0||n>e.length||o<0||r>this.length)throw new RangeError("out of range index");if(o>=r&&t>=n)return 0;if(o>=r)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,o>>>=0,r>>>=0,this===e)return 0;for(var i=r-o,s=n-t,a=Math.min(i,s),c=this.slice(o,r),l=e.slice(t,n),f=0;f<a;++f)if(c[f]!==l[f]){i=c[f],s=l[f];break}return i<s?-1:s<i?1:0},u.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},u.prototype.indexOf=function(e,t,n){return m(this,e,t,n,!0)},u.prototype.lastIndexOf=function(e,t,n){return m(this,e,t,n,!1)},u.prototype.write=function(e,t,n,o){if(t===undefined)o="utf8",n=this.length,t=0;else if(n===undefined&&"string"==typeof t)o=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,o===undefined&&(o="utf8")):(o=n,n=undefined)}var r=this.length-t;if((n===undefined||n>r)&&(n=r),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var i=!1;;)switch(o){case"hex":return b(this,e,t,n);case"utf8":case"utf-8":return g(this,e,t,n);case"ascii":return w(this,e,t,n);case"latin1":case"binary":return _(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var P=4096;function T(e,t,n){var o="";n=Math.min(e.length,n);for(var r=t;r<n;++r)o+=String.fromCharCode(127&e[r]);return o}function C(e,t,n){var o="";n=Math.min(e.length,n);for(var r=t;r<n;++r)o+=String.fromCharCode(e[r]);return o}function I(e,t,n){var o=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>o)&&(n=o);for(var r="",i=t;i<n;++i)r+=B(e[i]);return r}function N(e,t,n){for(var o=e.slice(t,n),r="",i=0;i<o.length;i+=2)r+=String.fromCharCode(o[i]+256*o[i+1]);return r}function j(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,n,o,r,i){if(!u.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<i)throw new RangeError('"value" argument is out of bounds');if(n+o>e.length)throw new RangeError("Index out of range")}function R(e,t,n,o){t<0&&(t=65535+t+1);for(var r=0,i=Math.min(e.length-n,2);r<i;++r)e[n+r]=(t&255<<8*(o?r:1-r))>>>8*(o?r:1-r)}function A(e,t,n,o){t<0&&(t=4294967295+t+1);for(var r=0,i=Math.min(e.length-n,4);r<i;++r)e[n+r]=t>>>8*(o?r:3-r)&255}function D(e,t,n,o,r,i){if(n+o>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function F(e,t,n,o,i){return i||D(e,0,n,4),r.write(e,t,n,o,23,4),n+4}function U(e,t,n,o,i){return i||D(e,0,n,8),r.write(e,t,n,o,52,8),n+8}u.prototype.slice=function(e,t){var n,o=this.length;if(e=~~e,t=t===undefined?o:~~t,e<0?(e+=o)<0&&(e=0):e>o&&(e=o),t<0?(t+=o)<0&&(t=0):t>o&&(t=o),t<e&&(t=e),u.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=u.prototype;else{var r=t-e;n=new u(r,undefined);for(var i=0;i<r;++i)n[i]=this[i+e]}return n},u.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||j(e,t,this.length);for(var o=this[e],r=1,i=0;++i<t&&(r*=256);)o+=this[e+i]*r;return o},u.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||j(e,t,this.length);for(var o=this[e+--t],r=1;t>0&&(r*=256);)o+=this[e+--t]*r;return o},u.prototype.readUInt8=function(e,t){return t||j(e,1,this.length),this[e]},u.prototype.readUInt16LE=function(e,t){return t||j(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUInt16BE=function(e,t){return t||j(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUInt32LE=function(e,t){return t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},u.prototype.readUInt32BE=function(e,t){return t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},u.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||j(e,t,this.length);for(var o=this[e],r=1,i=0;++i<t&&(r*=256);)o+=this[e+i]*r;return o>=(r*=128)&&(o-=Math.pow(2,8*t)),o},u.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||j(e,t,this.length);for(var o=t,r=1,i=this[e+--o];o>0&&(r*=256);)i+=this[e+--o]*r;return i>=(r*=128)&&(i-=Math.pow(2,8*t)),i},u.prototype.readInt8=function(e,t){return t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.prototype.readInt16LE=function(e,t){t||j(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(e,t){t||j(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(e,t){return t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},u.prototype.readInt32BE=function(e,t){return t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},u.prototype.readFloatLE=function(e,t){return t||j(e,4,this.length),r.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return t||j(e,4,this.length),r.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return t||j(e,8,this.length),r.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return t||j(e,8,this.length),r.read(this,e,!1,52,8)},u.prototype.writeUIntLE=function(e,t,n,o){(e=+e,t|=0,n|=0,o)||M(this,e,t,n,Math.pow(2,8*n)-1,0);var r=1,i=0;for(this[t]=255&e;++i<n&&(r*=256);)this[t+i]=e/r&255;return t+n},u.prototype.writeUIntBE=function(e,t,n,o){(e=+e,t|=0,n|=0,o)||M(this,e,t,n,Math.pow(2,8*n)-1,0);var r=n-1,i=1;for(this[t+r]=255&e;--r>=0&&(i*=256);)this[t+r]=e/i&255;return t+n},u.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,1,255,0),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},u.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},u.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},u.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):A(this,e,t,!0),t+4},u.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):A(this,e,t,!1),t+4},u.prototype.writeIntLE=function(e,t,n,o){if(e=+e,t|=0,!o){var r=Math.pow(2,8*n-1);M(this,e,t,n,r-1,-r)}var i=0,s=1,a=0;for(this[t]=255&e;++i<n&&(s*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+n},u.prototype.writeIntBE=function(e,t,n,o){if(e=+e,t|=0,!o){var r=Math.pow(2,8*n-1);M(this,e,t,n,r-1,-r)}var i=n-1,s=1,a=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/s>>0)-a&255;return t+n},u.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,1,127,-128),u.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):R(this,e,t,!0),t+2},u.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):R(this,e,t,!1),t+2},u.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):A(this,e,t,!0),t+4},u.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||M(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),u.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):A(this,e,t,!1),t+4},u.prototype.writeFloatLE=function(e,t,n){return F(this,e,t,!0,n)},u.prototype.writeFloatBE=function(e,t,n){return F(this,e,t,!1,n)},u.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},u.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},u.prototype.copy=function(e,t,n,o){if(n||(n=0),o||0===o||(o=this.length),t>=e.length&&(t=e.length),t||(t=0),o>0&&o<n&&(o=n),o===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-n&&(o=e.length-t+n);var r,i=o-n;if(this===e&&n<t&&t<o)for(r=i-1;r>=0;--r)e[r+t]=this[r+n];else if(i<1e3||!u.TYPED_ARRAY_SUPPORT)for(r=0;r<i;++r)e[r+t]=this[r+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+i),t);return i},u.prototype.fill=function(e,t,n,o){if("string"==typeof e){if("string"==typeof t?(o=t,t=0,n=this.length):"string"==typeof n&&(o=n,n=this.length),1===e.length){var r=e.charCodeAt(0);r<256&&(e=r)}if(o!==undefined&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!u.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var i;if(t>>>=0,n=n===undefined?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{var s=u.isBuffer(e)?e:q(new u(e,o).toString()),a=s.length;for(i=0;i<n-t;++i)this[i+t]=s[i%a]}return this};var x=/[^+\/0-9A-Za-z-_]/g;function B(e){return e<16?"0"+e.toString(16):e.toString(16)}function q(e,t){var n;t=t||Infinity;for(var o=e.length,r=null,i=[],s=0;s<o;++s){if((n=e.charCodeAt(s))>55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(s+1===o){(t-=3)>-1&&i.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(t-=3)>-1&&i.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function G(e){return o.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(x,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function L(e,t,n,o){for(var r=0;r<o&&!(r+n>=t.length||r>=e.length);++r)t[r+n]=e[r];return r}}).call(this,n(25))},function(e,t,n){"use strict";var o,r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_".split(""),i=64,s={},a=0,u=0;function c(e){var t="";do{t=r[e%i]+t,e=Math.floor(e/i)}while(e>0);return t}function l(){var e=c(+new Date);return e!==o?(a=0,o=e):e+"."+c(a++)}for(;u<i;u++)s[r[u]]=u;l.encode=c,l.decode=function(e){var t=0;for(u=0;u<e.length;u++)t=t*i+s[e.charAt(u)];return t},e.exports=l},function(e,t){var n=[].indexOf;e.exports=function(e,t){if(n)return e.indexOf(t);for(var o=0;o<e.length;++o)if(e[o]===t)return o;return-1}},function(e,t,n){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=n(28),i=n(12),s=n(127),a=n(57),u=n(58),c=(n(8)("socket.io-client:socket"),n(22)),l=n(52);e.exports=d;var f={connect:1,connect_error:1,connect_timeout:1,connecting:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1,ping:1,pong:1},p=i.prototype.emit;function d(e,t,n){this.io=e,this.nsp=t,this.json=this,this.ids=0,this.acks={},this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0,this.flags={},n&&n.query&&(this.query=n.query),this.io.autoConnect&&this.open()}i(d.prototype),d.prototype.subEvents=function(){if(!this.subs){var e=this.io;this.subs=[a(e,"open",u(this,"onopen")),a(e,"packet",u(this,"onpacket")),a(e,"close",u(this,"onclose"))]}},d.prototype.open=d.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),"open"===this.io.readyState&&this.onopen(),this.emit("connecting"),this)},d.prototype.send=function(){var e=s(arguments);return e.unshift("message"),this.emit.apply(this,e),this},d.prototype.emit=function(e){if(f.hasOwnProperty(e))return p.apply(this,arguments),this;var t=s(arguments),n={type:(this.flags.binary!==undefined?this.flags.binary:l(t))?r.BINARY_EVENT:r.EVENT,data:t,options:{}};return n.options.compress=!this.flags||!1!==this.flags.compress,"function"==typeof t[t.length-1]&&(this.ids,this.acks[this.ids]=t.pop(),n.id=this.ids++),this.connected?this.packet(n):this.sendBuffer.push(n),this.flags={},this},d.prototype.packet=function(e){e.nsp=this.nsp,this.io.packet(e)},d.prototype.onopen=function(){if("/"!==this.nsp)if(this.query){var e="object"===o(this.query)?c.encode(this.query):this.query;this.packet({type:r.CONNECT,query:e})}else this.packet({type:r.CONNECT})},d.prototype.onclose=function(e){this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",e)},d.prototype.onpacket=function(e){var t=e.nsp===this.nsp,n=e.type===r.ERROR&&"/"===e.nsp;if(t||n)switch(e.type){case r.CONNECT:this.onconnect();break;case r.EVENT:case r.BINARY_EVENT:this.onevent(e);break;case r.ACK:case r.BINARY_ACK:this.onack(e);break;case r.DISCONNECT:this.ondisconnect();break;case r.ERROR:this.emit("error",e.data)}},d.prototype.onevent=function(e){var t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?p.apply(this,t):this.receiveBuffer.push(t)},d.prototype.ack=function(e){var t=this,n=!1;return function(){if(!n){n=!0;var o=s(arguments);t.packet({type:l(o)?r.BINARY_ACK:r.ACK,id:e,data:o})}}},d.prototype.onack=function(e){var t=this.acks[e.id];"function"==typeof t?(e.id,e.data,t.apply(this,e.data),delete this.acks[e.id]):e.id},d.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},d.prototype.emitBuffered=function(){var e;for(e=0;e<this.receiveBuffer.length;e++)p.apply(this,this.receiveBuffer[e]);for(this.receiveBuffer=[],e=0;e<this.sendBuffer.length;e++)this.packet(this.sendBuffer[e]);this.sendBuffer=[]},d.prototype.ondisconnect=function(){this.nsp,this.destroy(),this.onclose("io server disconnect")},d.prototype.destroy=function(){if(this.subs){for(var e=0;e<this.subs.length;e++)this.subs[e].destroy();this.subs=null}this.io.destroy(this)},d.prototype.close=d.prototype.disconnect=function(){return this.connected&&(this.nsp,this.packet({type:r.DISCONNECT})),this.destroy(),this.connected&&this.onclose("io client disconnect"),this},d.prototype.compress=function(e){return this.flags.compress=e,this},d.prototype.binary=function(e){return this.flags.binary=e,this}},function(e,t,n){"use strict";e.exports=function(e,t,n){return e.on(t,n),{destroy:function(){e.removeListener(t,n)}}}},function(e,t){var n=[].slice;e.exports=function(e,t){if("string"==typeof t&&(t=e[t]),"function"!=typeof t)throw new Error("bind() requires a function");var o=n.call(arguments,2);return function(){return t.apply(e,o.concat(n.call(arguments)))}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uniApp=undefined;var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(15);var i=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.overrided=!1}return o(e,[{key:"overrideUniShowHideMethods",value:function(){if(r.FrameworkDetector.currentFramework()===r.Framework.UNIAPP&&!this.overrided&&getApp()&&"undefined"!=typeof getApp().$options){this.overrided=!0;var e=getApp().$options;if("undefined"!=typeof e.onShow){var t=e.onShow[0];e.onShow[0]=function(){getApp().uniAppRunningBackend=!1,t&&t.call(e)}}if("undefined"!=typeof e.onHide){var n=e.onHide[0];e.onHide[0]=function(){getApp().uniAppRunningBackend=!0,n&&n.call(e)}}}}},{key:"runningBackend",value:function(){return getApp().uniAppRunningBackend}}]),e}());t.uniApp=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.PUBSUB_INTERNAL_EVENTS={MESSAGE_RECEIVED:"PUBSUB_INTERNAL_MESSAGE_RECEIVED"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UUID=undefined;var o,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(62),s=(o=i)&&o.__esModule?o:{"default":o};var a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return r(e,null,[{key:"get",value:function(){return(0,s["default"])().replace(/-/g,"")}}]),e}();t.UUID=a},function(e,t,n){var o,r,i=n(63),s=n(64),a=0,u=0;e.exports=function(e,t,n){var c=t&&n||0,l=t||[],f=(e=e||{}).node||o,p=e.clockseq!==undefined?e.clockseq:r;if(null==f||null==p){var d=i();null==f&&(f=o=[1|d[0],d[1],d[2],d[3],d[4],d[5]]),null==p&&(p=r=16383&(d[6]<<8|d[7]))}var h=e.msecs!==undefined?e.msecs:(new Date).getTime(),y=e.nsecs!==undefined?e.nsecs:u+1,m=h-a+(y-u)/1e4;if(m<0&&e.clockseq===undefined&&(p=p+1&16383),(m<0||h>a)&&e.nsecs===undefined&&(y=0),y>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");a=h,u=y,r=p;var v=(1e4*(268435455&(h+=122192928e5))+y)%4294967296;l[c++]=v>>>24&255,l[c++]=v>>>16&255,l[c++]=v>>>8&255,l[c++]=255&v;var b=h/4294967296*1e4&268435455;l[c++]=b>>>8&255,l[c++]=255&b,l[c++]=b>>>24&15|16,l[c++]=b>>>16&255,l[c++]=p>>>8|128,l[c++]=255&p;for(var g=0;g<6;++g)l[c+g]=f[g];return t||s(l)}},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var o=new Uint8Array(16);e.exports=function(){return n(o),o}}else{var r=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),r[t]=e>>>((3&t)<<3)&255;return r}}},function(e,t){for(var n=[],o=0;o<256;++o)n[o]=(o+256).toString(16).substr(1);e.exports=function(e,t){var o=t||0,r=n;return[r[e[o++]],r[e[o++]],r[e[o++]],r[e[o++]],"-",r[e[o++]],r[e[o++]],"-",r[e[o++]],r[e[o++]],"-",r[e[o++]],r[e[o++]],"-",r[e[o++]],r[e[o++]],r[e[o++]],r[e[o++]],r[e[o++]],r[e[o++]]].join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}();var r=new(function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,Array),o(t,[{key:"deleteByKey",value:function(e,t,n){var o=e.findIndex(function(e){return e[t]==n});o>-1&&e.splice(o,1)}},{key:"unshiftGuid",value:function(e){var t=!1,n=this.findIndex(function(t){return t==e});for(n>-1&&(t=!0,this.splice(n,1)),this.unshift(e);this.length>300;)this.pop();return t}}]),t}());t.goEasyArray=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]={maxNumber:5}},function(e,t,n){"use strict";var o=this&&this.__values||function(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],o=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&o>=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};t.__esModule=!0,t.Cookie=void 0;var r=function(){function e(){}return e.get=function(e){var t,n,r=encodeURIComponent(e)+"=",i=document.cookie.split("; ");try{for(var s=o(i),a=s.next();!a.done;a=s.next()){var u=a.value;if(u.startsWith(r))return decodeURIComponent(u.substring(r.length))}}catch(c){t={error:c}}finally{try{a&&!a.done&&(n=s["return"])&&n.call(s)}finally{if(t)throw t.error}}return null},e.set=function(e,t,n,o,r,i){void 0===r&&(r="/"),void 0===i&&(i=!1);var s=encodeURIComponent(e)+"="+encodeURIComponent(t);n instanceof Date&&(s+="; expires="+n.toGMTString()),r&&(s+="; path="+r),o&&(s+="; domain="+o),i&&(s+="; secure"),document.cookie=s},e.remove=function(t,n,o,r){void 0===o&&(o="/"),void 0===r&&(r=!1),e.set(t,"",new Date(0),n,o,r)},e}();t.Cookie=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.messageCreator=undefined;var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=g(n(18)),i=g(n(70)),s=g(n(71)),a=g(n(72)),u=g(n(20)),c=g(n(73)),l=g(n(74)),f=g(n(75)),p=g(n(76)),d=g(n(77)),h=g(n(78)),y=g(n(39)),m=g(n(21)),v=g(n(79)),b=n(15);function g(e){return e&&e.__esModule?e:{"default":e}}function w(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var _=new(function(){function e(){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.messageTypes=(w(t={},b.Framework.NATIVE_APPLET_WX,{image:i["default"],file:r["default"],audio:s["default"],video:a["default"],text:y["default"]}),w(t,b.Framework.UNIAPP,{image:f["default"],file:u["default"],audio:c["default"],video:l["default"],text:y["default"]}),w(t,b.Framework.UNKNOWN,{image:p["default"],file:m["default"],audio:d["default"],video:h["default"],text:y["default"]}),t)}return o(e,[{key:"create",value:function(e,t){var n=b.FrameworkDetector.currentFramework(),o=this.messageTypes[n][e];return o?new o(t):new v["default"](t)}}]),e}());t.messageCreator=_},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.str=undefined;var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(35);var i=new(function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return o(e,[{key:"fileExtension",value:function(e,t){if(r.calibrator.isString(e))try{var n=e.split(t);return n[n.length-1]}catch(o){throw Error(o)}}}]),e}());t.str=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=function l(e,t,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,t);if(o===undefined){var r=Object.getPrototypeOf(e);return null===r?undefined:l(r,t,n)}if("value"in o)return o.value;var i=o.get;return i===undefined?undefined:i.call(n)},i=u(n(18)),s=u(n(2)),a=n(6);function u(e){return e&&e.__esModule?e:{"default":e}}var c=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i["default"]),o(t,[{key:"validate",value:function(e){if(r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"validate",this).call(this,e),!a.calibrator.isDef(e.file.tempFiles)||0==e.file.tempFiles[0].length)throw Error("tempFiles is empty.")}},{key:"setType",value:function(e){this.type=s["default"].image}},{key:"setFile",value:function(e){var t="chooseMedia:ok"==e.errMsg?e.tempFiles[0].tempFilePath:e.tempFiles[0].path;e.tempFiles[0].path=t,this.file=e}},{key:"setPayload",value:function(e){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setPayload",this).call(this,e);var n=this,o=e.file.tempFiles[0],i="chooseMedia:ok"==e.file.errMsg?o.tempFilePath:o.path;this.payload.url=i,this.payload.size=o.size,this.payload.width="",this.payload.height="",this.payload.contentType="";var s=a.calibrator.isEmpty(o.name)||o.name==undefined?i:o.name;this.payload.name="wx-image."+a.str.fileExtension(s,"."),this.payload.contentType="image/"+a.str.fileExtension(s,"."),wx.getImageInfo({src:i,success:function(e){n.payload.width=e.width,n.payload.height=e.height}})}}]),t}();t["default"]=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=function l(e,t,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,t);if(o===undefined){var r=Object.getPrototypeOf(e);return null===r?undefined:l(r,t,n)}if("value"in o)return o.value;var i=o.get;return i===undefined?undefined:i.call(n)},i=u(n(18)),s=u(n(2)),a=n(6);function u(e){return e&&e.__esModule?e:{"default":e}}var c=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i["default"]),o(t,[{key:"validate",value:function(e){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"validate",this).call(this,e)}},{key:"setType",value:function(e){this.type=s["default"].audio}},{key:"setPayload",value:function(e){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setPayload",this).call(this,e);var n=e.file.tempFilePath;this.payload.url=n,this.payload.duration=e.file.duration/1e3,this.payload.size=e.file.fileSize;var o=a.calibrator.isEmpty(e.file.name)||e.file.name==undefined?n:e.file.name;this.payload.contentType="audio/"+a.str.fileExtension(o,"."),this.payload.name="wx-audio."+a.str.fileExtension(o,".")}}]),t}();t["default"]=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=u(n(18)),i=u(n(2)),s=n(0),a=n(6);function u(e){return e&&e.__esModule?e:{"default":e}}var c=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r["default"]),o(t,[{key:"validate",value:function(e){(function n(e,t,o){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,t);if(r===undefined){var i=Object.getPrototypeOf(e);return null===i?undefined:n(i,t,o)}if("value"in r)return r.value;var s=r.get;return s===undefined?undefined:s.call(o)})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"validate",this).call(this,e)}},{key:"setType",value:function(e){this.type=i["default"].video}},{key:"setFile",value:function(e){this.file="chooseMedia:ok"==e.errMsg?e.tempFiles[0]:e}},{key:"setPayload",value:function(e){this.payload=Object.create(null);var t=Object.create(null),n=Object.create(null),o="chooseMedia:ok"==e.file.errMsg?e.file.tempFiles[0]:e.file,r=o.duration,i=o.height,u=o.size,c=o.tempFilePath,l=o.thumbTempFilePath,f=o.width,p=o.name,d=p===undefined?"":p,h=s.calibrator.isEmpty(d)?c:d;t.contentType="video/"+a.str.fileExtension(h,"."),t.name="wx-video."+a.str.fileExtension(h,"."),t.url=c,t.width=n.width=f,t.height=n.height=i,t.size=u,t.duration=r,n.url=l,n.contentType="image/jpg",n.name="wx-thumbnail.jpg",this.payload.video=t,this.payload.thumbnail=n}}]),t}();t["default"]=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=function l(e,t,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,t);if(o===undefined){var r=Object.getPrototypeOf(e);return null===r?undefined:l(r,t,n)}if("value"in o)return o.value;var i=o.get;return i===undefined?undefined:i.call(n)},i=u(n(20)),s=u(n(2)),a=n(6);function u(e){return e&&e.__esModule?e:{"default":e}}var c=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i["default"]),o(t,[{key:"validate",value:function(e){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"validate",this).call(this,e)}},{key:"setType",value:function(e){this.type=s["default"].audio}},{key:"setPayload",value:function(e){var n=this;r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setPayload",this).call(this,e);var o=this,i=e.file.tempFilePath;this.payload.url=i;var s=a.calibrator.isEmpty(e.file.name)||e.file.name==undefined?i:e.file.name;if(this.payload.contentType="audio/"+a.str.fileExtension(s,"."),this.payload.name="uni-audio."+a.str.fileExtension(s,"."),a.calibrator.isDef(e.file.duration))this.payload.duration=e.file.duration/1e3;else{this.payload.duration=0;var u=uni.createInnerAudioContext();u.src=i,u.onCanplay(function(e){o.payload.duration=u.duration,u.destroy()})}uni.getFileInfo({filePath:i,success:function(e){n.payload.size=e.size}})}}]),t}();t["default"]=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=a(n(20)),i=a(n(2)),s=n(6);function a(e){return e&&e.__esModule?e:{"default":e}}var u=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r["default"]),o(t,[{key:"validate",value:function(e){(function n(e,t,o){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,t);if(r===undefined){var i=Object.getPrototypeOf(e);return null===i?undefined:n(i,t,o)}if("value"in r)return r.value;var s=r.get;return s===undefined?undefined:s.call(o)})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"validate",this).call(this,e)}},{key:"setType",value:function(e){this.type=i["default"].video}},{key:"setPayload",value:function(e){var t=Object.create(null),n=Object.create(null);this.payload=Object.create(null);var o=e.file,r=o.duration,i=o.height,a=o.size,u=o.tempFilePath,c=o.width,l=o.name,f=l===undefined?"":l,p=s.calibrator.isEmpty(f)?u:f;t.contentType="video/"+s.str.fileExtension(p,"."),t.name="uni-video."+s.str.fileExtension(p,"."),t.size=a,t.duration=r,t.url=n.url=u,t.width=n.width=c,t.height=n.height=i,n.contentType="image/jpg",n.name="wx-thumbnail.jpg",this.payload.video=t,this.payload.thumbnail=n}}]),t}();t["default"]=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=function l(e,t,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,t);if(o===undefined){var r=Object.getPrototypeOf(e);return null===r?undefined:l(r,t,n)}if("value"in o)return o.value;var i=o.get;return i===undefined?undefined:i.call(n)},i=u(n(20)),s=n(6),a=u(n(2));function u(e){return e&&e.__esModule?e:{"default":e}}var c=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i["default"]),o(t,[{key:"validate",value:function(e){if(r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"validate",this).call(this,e),!s.calibrator.isDef(e.file.tempFiles)||0==e.file.tempFiles[0].length)throw Error("tempFiles is empty.")}},{key:"setType",value:function(e){this.type=a["default"].image}},{key:"setPayload",value:function(e){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setPayload",this).call(this,e);var n=this,o=e.file.tempFiles[0];this.payload.url=o.path,this.payload.size=o.size,this.payload.width="",this.payload.height="";var i=s.calibrator.isEmpty(o.name)||o.name==undefined?o.path:o.name;this.payload.contentType="image/"+s.str.fileExtension(i,"."),this.payload.name="uni-image."+s.str.fileExtension(i,"."),uni.getImageInfo({src:o.path,success:function(e){n.payload.width=e.width,n.payload.height=e.height}})}}]),t}();t["default"]=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=function c(e,t,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,t);if(o===undefined){var r=Object.getPrototypeOf(e);return null===r?undefined:c(r,t,n)}if("value"in o)return o.value;var i=o.get;return i===undefined?undefined:i.call(n)},i=a(n(21)),s=a(n(2));function a(e){return e&&e.__esModule?e:{"default":e}}var u=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i["default"]),o(t,[{key:"validate",value:function(e){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"validate",this).call(this,e);var n=["gif","jpg","png","jpeg"];if(!n.find(function(t){return t==e.file.type.split("/")[1].toLowerCase()}))throw Error("Only "+n.join(",")+" is supported image.")}},{key:"setType",value:function(e){this.type=s["default"].image}},{key:"setPayload",value:function(e){var n=this;r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setPayload",this).call(this,e);var o=window.URL||window.webkitURL,i=new Image;i.src=o.createObjectURL(e.file),i.onload=function(){n.payload.width=i.width,n.payload.height=i.height,o.revokeObjectURL(i.src)}}}]),t}();t["default"]=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=function c(e,t,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,t);if(o===undefined){var r=Object.getPrototypeOf(e);return null===r?undefined:c(r,t,n)}if("value"in o)return o.value;var i=o.get;return i===undefined?undefined:i.call(n)},i=a(n(21)),s=a(n(2));function a(e){return e&&e.__esModule?e:{"default":e}}var u=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i["default"]),o(t,[{key:"validate",value:function(e){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"validate",this).call(this,e);var n=["mp3","ogg","wav","wma","ape","acc","mpeg"];if(!n.find(function(t){return t==e.file.type.split("/")[1].toLowerCase()}))throw Error("Only "+n.join(",")+" is supported audio.")}},{key:"setType",value:function(e){this.type=s["default"].audio}},{key:"setPayload",value:function(e){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"setPayload",this).call(this,e);var n=this,o=window.URL||window.webkitURL,i=document.createElement("audio");i.src=o.createObjectURL(e.file),i.onloadedmetadata=function(){n.payload.duration=i.duration,o.revokeObjectURL(i.src)}}}]),t}();t["default"]=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=s(n(21)),i=s(n(2));function s(e){return e&&e.__esModule?e:{"default":e}}var a=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r["default"]),o(t,[{key:"validate",value:function(e){(function o(e,t,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,t);if(r===undefined){var i=Object.getPrototypeOf(e);return null===i?undefined:o(i,t,n)}if("value"in r)return r.value;var s=r.get;return s===undefined?undefined:s.call(n)})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"validate",this).call(this,e);var n=["avi","mov","rmvb","rm","flv","mp4","3gp","quicktime"];if(!n.find(function(t){return t==e.file.type.split("/")[1].toLowerCase()}))throw Error("Only "+n.join(",")+" is supported video.")}},{key:"setType",value:function(e){this.type=i["default"].video}},{key:"setPayload",value:function(e){this.payload=Object.create(null);var t=Object.create(null),n=Object.create(null);t.contentType=e.file.type,t.size=e.file.size,t.duration=0,t.url=n.url="",t.name=e.file.name,t.width=n.width=0,t.height=n.height=0,n.contentType="image/jpg",this.payload.video=t,this.payload.thumbnail=n;var o=this,r=window.URL||window.webkitURL,i=document.createElement("video"),s=r.createObjectURL(e.file);i.src=s,i.onloadedmetadata=function(){o.payload.video.duration=i.duration,o.payload.video.width=o.payload.thumbnail.width=i.videoWidth,o.payload.video.height=o.payload.thumbnail.height=i.videoHeight,o.payload.video.url=s,o.payload.thumbnail.url=function(e){var t=document.createElement("canvas");return t.width=e.videoWidth,t.height=e.videoHeight,t.getContext("2d").drawImage(e,0,0,t.width,t.height),t.toDataURL("image/png")}(i),r.revokeObjectURL(i.src)}}}]),t}();t["default"]=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(14),s=(o=i)&&o.__esModule?o:{"default":o},a=n(0);var u=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s["default"]),r(t,[{key:"setType",value:function(e){if(!a.calibrator.isStringOrNumber(e.type))throw Error("type require a string or number.");if(a.calibrator.isEmpty(e.type))throw Error("type is empty.");this.type=e.type}},{key:"setPayload",value:function(e){if(a.calibrator.isEmpty(e.payload))throw Error("payload is empty.");if(!a.calibrator.isPlainObject(e.payload)&&!a.calibrator.isStringOrNumber(e.payload))throw Error("payload require object | string | number.");this.payload=e.payload}}]),t}();t["default"]=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=d(n(81)),i=d(n(3)),s=d(n(1)),a=n(5),u=d(n(19)),c=n(7),l=d(n(14)),f=n(0),p=n(4);function d(e){return e&&e.__esModule?e:{"default":e}}var h=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.im=null,this.bulletMessageBuilder=null,this.im=t,this.bulletMessageBuilder=new r["default"](t)}return o(e,[{key:"send",value:function(e,t,n){var o=this;return new Promise(function(r,c){t.status===u["default"]["new"]?(t.status=u["default"].sending,o.bulletMessageBuilder.build(e,t,n).then(function(e){var n=new i["default"]({name:a.EmitType.publishIM,params:e,permission:s["default"].WRITE,singleTimeout:p.SocketTimeout.commonRequestSingle,totalTimeout:p.SocketTimeout.commonRequestTotal,fail:function(e){t.status=u["default"].fail,c({code:e.resultCode||408,content:e.content||"Failed to send private message."})},success:function(e){t.status=u["default"].success,200==e.resultCode?r({code:200,content:e.content}):c(e)}});o.im._goEasySocket.emit(n)})["catch"](function(e){c({code:e.code||400,content:e.content||e})})):c({code:400,content:"Please create a new message, a message can only be sent once"})})}},{key:"sendMessage",value:function(e){var t=this,n=this.im,o=e.message;return new Promise(function(r,d){if(o instanceof l["default"])if(o.status===u["default"]["new"]){o.status=u["default"].sending;var h=o.to;if(delete o.to,h)if(!h.type||h.type!=c.ConversationType.GROUP&&h.type!=c.ConversationType.PRIVATE)d({code:400,content:"message require property to.type"});else if(h.id)if(h.data&&f.calibrator.isFunction(h.data))d({code:400,content:"to.data can not be function"});else{var y=o.notification;if(y)if(f.calibrator.isObject(y)){if(f.calibrator.isEmpty(y.title))return void d({code:400,content:"notification title is required"});if(!f.calibrator.isString(y.title))return void d({code:400,content:"notification title must be string"});if(f.calibrator.isEmpty(o.notification.body))return void d({code:400,content:"notification body is required"});if(!f.calibrator.isString(o.notification.body))return void d({code:400,content:"notification body must be string"})}else if(f.calibrator.isPrimitive(o.notification))return void d({code:400,content:"notification must be an json object"});h.data||(h.data={}),n._conversations.updateByOutMessage(o,h.type,h.id,h.data),t.bulletMessageBuilder.build(h.id,o,h.type,e.accessToken).then(function(e){e.d=JSON.stringify(h.data);var t=new i["default"]({name:a.EmitType.publishIM,params:e,permission:s["default"].WRITE,singleTimeout:p.SocketTimeout.commonRequestSingle,totalTimeout:p.SocketTimeout.commonRequestTotal,fail:function(e){o.status=u["default"].fail,d({code:e.resultCode||408,content:e.content||"Failed to send private message."})},success:function(e){o.status=u["default"].success,o.timestamp=e.content.timestamp,r(o),n._conversations.updateByOutMessage(o,h.type,h.id,h.data)}});n._goEasySocket.emit(t)})["catch"](function(e){o.status=u["default"].fail,d({code:e.code||400,content:e.content||e})})}else d({code:400,content:"message require property to.id"});else d({code:400,content:"message require property to."})}else d({code:400,content:"Please create a new message, a message can only be sent once"});else d({code:400,content:"it is invalid message"})})}}]),e}();t["default"]=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=s(n(82)),i=s(n(83));s(n(2));function s(e){return e&&e.__esModule?e:{"default":e}}var a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.im=null,this.im=t}return o(e,[{key:"build",value:function(e,t,n,o){var s=this;return new Promise(function(a,u){var c=new r["default"]({to:e,message:t,conversationType:n,accessToken:o}),l=t.type;new i["default"](l,s.im).build(t).then(function(e){c.p=JSON.stringify(e),a(c)})["catch"](function(e){u(e)})})}}]),e}();t["default"]=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(6),i=c(n(14)),s=c(n(39)),a=c(n(2)),u=n(11);function c(e){return e&&e.__esModule?e:{"default":e}}var l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.mt=null,this.to=null,this.p=null,this.t=null,this.guid=null,this.nt=null,this.at=null,this.validate(t.to,t.message),this.mt=t.message.type,this.to=t.to,this.t=t.conversationType,this.guid=t.message.messageId,this.p=t.message.payload,this.nt=t.message.notification,this.at=t.accessToken}return o(e,[{key:"validate",value:function(e,t){if(!(t instanceof i["default"]))throw Error("createMessage first.");if(r.calibrator.isEmpty(e))throw Error("userId is empty.");if(!r.calibrator.isStringOrNumber(e))throw Error("userId should be a string or number.");if(u.IM.userId==e)throw Error("userId can not be the same as your id.");if(t.type==a["default"].text){if(!(t instanceof s["default"]))throw Error("it is not textMessage");if(JSON.stringify(t.payload).length>3072)throw Error("message-length limit 3kb")}}}]),e}();t["default"]=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(84),r=a(n(85)),i=a(n(41)),s=a(n(2));function a(e){return e&&e.__esModule?e:{"default":e}}t["default"]=function u(e,t){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),e==s["default"].video?new r["default"](t):e==s["default"].audio||e==s["default"].image||e==s["default"].file?new i["default"](t):o.simplePayloadBuilder}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.simplePayloadBuilder=undefined;var o,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(40),s=(o=i)&&o.__esModule?o:{"default":o};var a=new(function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s["default"]),r(t,[{key:"build",value:function(e){return new Promise(function(t,n){try{t(e.payload)}catch(o){n(o)}})}}]),t}());t.simplePayloadBuilder=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=s(n(41)),i=s(n(42));function s(e){return e&&e.__esModule?e:{"default":e}}var a=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r["default"]),o(t,[{key:"build",value:function(e){var t=this;return new Promise(function(n,o){var r=new i["default"];t.upload(e).then(function(t){var o=t.content;undefined;r=e.payload;var i="?x-oss-process=video/snapshot,t_0000,f_jpg,w_"+e.payload.video.width+",m_fast,ar_auto";r.video.url=t.content.url,r.thumbnail.url=t.content.url+i,r.video.name=t.content.newFileName,n(r)})["catch"](function(e){o(e)})})}}]),t}();t["default"]=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fileUploader=t.FileUploader=undefined;var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(87),i=n(88),s=n(89),a=n(15);function u(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var c=new(t.FileUploader=function(){function e(){var t;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.uploader=(u(t={},a.Framework.UNIAPP,r.uniAppFileUploader),u(t,a.Framework.NATIVE_APPLET_WX,i.wxFileUploader),u(t,a.Framework.UNKNOWN,s.htmlFileUploader),t)}return o(e,[{key:"upload",value:function(e,t){var n=a.FrameworkDetector.currentFramework();return this.uploader[n].upload(e,t)}}]),e}());t.fileUploader=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.uniAppFileUploader=undefined;var o,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(26),s=(o=i)&&o.__esModule?o:{"default":o};var a=new(function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s["default"]),r(t,[{key:"upload",value:function(e,t){var n=this;try{return new Promise(function(o,r){uni.uploadFile({url:e.host,filePath:n.getTempFilePath(e),name:"file",formData:e.parameters,success:function(t){if(200===t.statusCode){var n=e.payload;n.message=t.errMsg,o({code:200,content:n})}else r({code:t.statusCode,content:t.errMsg})},fail:function(e){r({code:500,content:e.errMsg})}}).onProgressUpdate(function(e){t&&t(e)})})}catch(o){return new Promise(function(e,t){t({code:500,content:o})})}}},{key:"getTempFilePath",value:function(e){var t=e.file||e.fileRes;return Array.isArray(t.tempFiles)?t.tempFiles[0].path:t.tempFilePath}}]),t}());t.uniAppFileUploader=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.wxFileUploader=undefined;var o,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(26),s=(o=i)&&o.__esModule?o:{"default":o};var a=new(function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s["default"]),r(t,[{key:"upload",value:function(e,t){var n=this;try{return new Promise(function(o,r){wx.uploadFile({url:e.host,filePath:n.getTempFilePath(e),name:"file",formData:e.parameters,success:function(t){if(200===t.statusCode){var n=e.payload;n.message=t.errMsg,o({code:200,content:n})}else r({code:t.statusCode,content:t.errMsg})},fail:function(e){r({code:500,content:e.errMsg})}}).onProgressUpdate(function(e){t&&t(e)})})}catch(o){return new Promise(function(e,t){t({code:500,content:o})})}}},{key:"getTempFilePath",value:function(e){var t=e.file||e.fileRes;return Array.isArray(t.tempFiles)?t.tempFiles[0].path:t.tempFilePath}}]),t}());t.wxFileUploader=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.htmlFileUploader=undefined;var o,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(26),s=(o=i)&&o.__esModule?o:{"default":o};var a=new(function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,s["default"]),r(t,[{key:"upload",value:function(e,t){try{return new Promise(function(n,o){var r=new XMLHttpRequest;for(var i in r.open("post",e.host,!0),e.headers)r.setRequestHeader(i,e.headers[i]);r.upload.onprogress=function(e){t&&t(e)},r.upload.onloadstart=function(e){t&&t(e)},r.upload.onloadend=function(e){t&&t(e)};var s=new FormData;for(var a in e.parameters)"fileRes"==a?s.append("file",e.parameters[a]):s.append(a,e.parameters[a]);r.send(s),r.onreadystatechange=function(){if(4==r.readyState)if(r.status>=200&&r.status<300||304==r.status){var t=e.payload;t.message=r.responseText,n({code:200,content:t})}else o({code:r.status,content:r.responseText})}})}catch(n){return new Promise(function(e,t){t({code:500,content:n})})}}}]),t}());t.htmlFileUploader=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=s(n(91)),i=s(n(95));function s(e){return e&&e.__esModule?e:{"default":e}}var a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.uploadTokenResolver=null,this.uploadTokenResolver=new i["default"](t)}return o(e,[{key:"build",value:function(e,t,n){var o=this;return new Promise(function(i,s){o.uploadTokenResolver.resolve(t).then(function(t){var o=t.content;i(new r["default"](o.vendor).build(o,e,n))})["catch"](function(e){s(e)})})}}]),e}();t["default"]=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(92),r=n(93),i=n(94);t["default"]=function s(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),e==o.OssType.aliYun?r.aliYunOSSRequestBuilder:i.qiNiuYunOSSRequestBuilder}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.OssType={aliYun:"ALI",qiNiu:"QN"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.aliYunOSSRequestBuilder=undefined;var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=a(n(44)),i=a(n(45)),s=a(n(2));function a(e){return e&&e.__esModule?e:{"default":e}}var u=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i["default"]),o(t,[{key:"url",value:function(e){return e.host+"/"+e.dir+"/"+this.newFileName(e)}},{key:"build",value:function(e,t,n){var o={key:e.dir+"/"+this.newFileName(e),OSSAccessKeyId:e.accessKeyId,policy:e.policy,signature:e.signature,success_action_status:"200",fileRes:t};s["default"].file===n&&(o={key:e.dir+"/"+this.newFileName(e),OSSAccessKeyId:e.accessKeyId,policy:e.policy,signature:e.signature,success_action_status:"200","Content-Disposition":"attachment;filename="+t.name,fileRes:t});var i={newFileName:this.newFileName(e),url:this.url(e)};return new r["default"](e.host,null,o,t,i)}}]),t}();t["default"]=u;var c=new u;t.aliYunOSSRequestBuilder=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.qiNiuYunOSSRequestBuilder=undefined;var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=s(n(45)),i=s(n(44));function s(e){return e&&e.__esModule?e:{"default":e}}var a=new(function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r["default"]),o(t,[{key:"url",value:function(e){return e.downloadUrl}},{key:"build",value:function(e,t){var n={key:this.newFileName(e),token:e.token,file:t},o={newFileName:this.newFileName(e),url:this.url(e)};return new i["default"](e.host,null,n,t,o)}}]),t}());t.qiNiuYunOSSRequestBuilder=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=a(n(3)),i=a(n(1)),s=n(4);function a(e){return e&&e.__esModule?e:{"default":e}}var u=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.im=null,this.im=t}return o(e,[{key:"resolve",value:function(e){var t=this;return new Promise(function(n,o){var a=new r["default"]({name:"uploadToken",params:{filename:e},permission:i["default"].WRITE,singleTimeout:s.SocketTimeout.commonRequestSingle,totalTimeout:s.SocketTimeout.commonRequestTotal,fail:function(e){o(e)},success:function(e){200==e.code?n(e):o(e)}});t.im._goEasySocket.emit(a)})}}]),e}();t["default"]=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(6),i=c(n(3)),s=c(n(1)),a=n(5),u=n(4);function c(e){return e&&e.__esModule?e:{"default":e}}var l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.im=null,this.im=t}return o(e,[{key:"history",value:function(e){var t=this;return new Promise(function(n,o){t.transformOptions(e);var r=new i["default"]({name:a.EmitType.imHistory,params:e,permission:s["default"].READ,singleTimeout:u.SocketTimeout.commonQuerySingle,totalTimeout:u.SocketTimeout.commonQueryTotal,fail:function(e){o({code:e.code||408,content:e.content||"Failed to query message"})},success:function(r){if(200==r.code){var i=t.transformHistories(r,e);n({code:200,content:i})}else o(r)}});t.im._goEasySocket.emit(r)})}},{key:"transformOptions",value:function(e){if(!r.calibrator.isObject(e)||!r.calibrator.isDef(e.friendId)&&!r.calibrator.isDef(e.groupId))throw Error("friendId or groupId is not define.");if(r.calibrator.isDef(e.friendId)&&r.calibrator.isDef(e.groupId))throw Error("only contain friendId or groupId.");if(r.calibrator.isDef(e.limit)||(e.limit=10),e.limit>30&&(e.limit=30),r.calibrator.isDef(e.friendId)){if(!r.calibrator.isStringOrNumber(e.friendId))throw Error("TypeError: friendId require string or number.");r.calibrator.isNumber(e.friendId)&&(e.friendId=e.friendId.toString())}else{if(!r.calibrator.isStringOrNumber(e.groupId))throw Error("TypeError: groupId require string or number.");r.calibrator.isNumber(e.groupId)&&(e.groupId=e.groupId.toString())}return e}},{key:"transformHistories",value:function(e,t){var n=[];return e&&e.content&&e.content.map(function(e){var o=Object.create(null);o.messageId=e.i,o.timestamp=e.ts,o.senderId=e.s,o.type=e.mt,o.payload=JSON.parse(e.p),t.groupId&&e.d&&(o.senderData=JSON.parse(e.d)),n.push(o)}),n}}]),e}();t["default"]=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=p(n(3)),i=n(5),s=p(n(1)),a=n(4),u=n(7),c=p(n(16)),l=n(0),f=n(10);function p(e){return e&&e.__esModule?e:{"default":e}}var d=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.im=null,this.im=t,t._iMReceiver.addIMMessageObserver(this.newNewMessageReceived.bind(this))}return o(e,[{key:"newNewMessageReceived",value:function(e){if(e.t===u.ConversationType.GROUP){var t=c["default"].assemble(e);this.im._event.notify(f.ImEventType.GROUP_MESSAGE_RECEIVED,t)}}},{key:"subscribe",value:function(e){var t=this,n=e.groupIds;return new Promise(function(o,u){if(Array.isArray(n)&&0!=n.length){for(var c=0;c<n.length;c++){if(!l.calibrator.isStringOrNumber(n[c]))return void u({code:400,content:"TypeError: groups item require string or number."});l.calibrator.isNumber(n[c])&&(n[c]=n[c].toString())}var f=new r["default"]({name:i.EmitType.subscribeGroups,params:{groupIds:n,at:e.accessToken},permission:s["default"].WRITE,singleTimeout:a.SocketTimeout.commonInfiniteSingle,totalTimeout:a.SocketTimeout.commonInfiniteTotal,success:function(){o({code:200,content:"ok"})},fail:function(e){u({code:e.resultCode||408,content:e.content||"Failed to subscribe group message"})}});t.im._goEasySocket.emit(f)}else u({code:400,content:"TypeError: groups require array."})})}},{key:"unsubscribe",value:function(e){var t=this;return new Promise(function(n,o){if(l.calibrator.isStringOrNumber(e)){e=e.toString();var u=new r["default"]({name:i.EmitType.unsubscribeGroup,params:{groupId:e},permission:s["default"].READ,singleTimeout:a.SocketTimeout.commonRequestSingle,totalTimeout:a.SocketTimeout.commonRequestTotal,success:function(){n({code:200,content:"ok"})},fail:function(e){o({code:e.resultCode||408,content:e.content||"Failed to unsubscribe group message"})}});t.im._goEasySocket.emit(u)}else o({code:400,content:"TypeError: channel require string or number."})})}}]),e}();t["default"]=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(16),s=(o=i)&&o.__esModule?o:{"default":o},a=n(7),u=n(10);var c=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.im=null,this.im=t,t._iMReceiver.addIMMessageObserver(this.onNewMessageReceived.bind(this))}return r(e,[{key:"onNewMessageReceived",value:function(e){if(e.t===a.ConversationType.PRIVATE){var t=s["default"].assemble(e);this.im._event.notify(u.ImEventType.PRIVATE_MESSAGE_RECEIVED,t)}}}]),e}();t["default"]=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=c(n(3)),i=n(5),s=c(n(1)),a=n(4),u=n(0);function c(e){return e&&e.__esModule?e:{"default":e}}var l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.im=null,this.im=t}return o(e,[{key:"get",value:function(e){var t=this;return new Promise(function(n,o){if(u.calibrator.isStringOrNumber(e)){u.calibrator.isNumber(e)&&(e=e.toString());var c=new r["default"]({name:i.EmitType.imGroupOnlineCount,params:{groupId:e},permission:s["default"].READ,singleTimeout:a.SocketTimeout.commonQuerySingle,totalTimeout:a.SocketTimeout.commonQueryTotal,fail:function(e){o(e||{code:408,content:"Failed to query online group users"})},success:function(e){200==e.code?n(e):o(e)}});t.im._goEasySocket.emit(c)}else o({code:400,content:"TypeError: groupId require string or number."})})}}]),e}();t["default"]=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=f(n(3)),i=f(n(1)),s=n(4),a=n(5),u=n(0),c=n(10),l=f(n(17));function f(e){return e&&e.__esModule?e:{"default":e}}var p=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.im=null,this.im=t,t._goEasySocket.addMessageObserver(l["default"].groupPresence,this.newMessageReceived.bind(this))}return o(e,[{key:"presence",value:function(e){var t=this;return new Promise(function(n,o){if(Array.isArray(e)&&0!=e.length){for(var r=0;r<e.length;r++){if(!u.calibrator.isStringOrNumber(e[r]))return void o({code:400,content:"TypeError: groupIds item require string or number."});if(u.calibrator.isNumber(e[r])&&(e[r]=e[r].toString()),0==e[r].length)return void o({code:400,content:"TypeError: groupIds has empty item."})}var i={groupIds:e};t.emitRocket(a.EmitType.subscribeGroupPresence,i,function(){n({code:200,content:"ok"})},function(e){o({code:e.code||408,content:e.content||"Failed to subscribe group message"})},s.SocketTimeout.commonInfiniteSingle,s.SocketTimeout.commonInfiniteTotal)}else o({code:400,content:"TypeError: groupIds require array."})})}},{key:"unPresence",value:function(e){var t=this;return new Promise(function(n,o){if(u.calibrator.isStringOrNumber(e)){u.calibrator.isNumber(e)&&(e=e.toString());var r={groupId:e};t.emitRocket(a.EmitType.unsubscribeGroupPresence,r,function(){n({code:200,content:"ok"})},function(e){o({code:e.code||408,content:e.content||"Failed to unsubscribe presence"})},s.SocketTimeout.commonRequestSingle,s.SocketTimeout.commonRequestTotal)}else o({code:400,content:"TypeError: groupId require string or number."})})}},{key:"emitRocket",value:function(e,t,n,o,s,a){var u=new r["default"]({name:e,params:t,singleTimeout:s,totalTimeout:a,permission:i["default"].WRITE,success:n,fail:o});this.im._goEasySocket.emit(u)}},{key:"newMessageReceived",value:function(e){var t=this,n=null;e.c&&(n=JSON.parse(e.c)),n&&n.events&&n.events.map(function(e){var o=e.userData?JSON.parse(e.userData):{},r={time:e.time,action:e.action,groupOnlineCount:n.userAmount,groupId:n.groupId,id:e.userId,data:o};t.im._event.notify(c.ImEventType.GROUP_PRESENCE,r)})}}]),e}();t["default"]=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=f(n(3)),i=f(n(1)),s=n(4),a=n(5),u=n(0),c=n(10),l=f(n(17));function f(e){return e&&e.__esModule?e:{"default":e}}var p=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.im=null,this.im=t,this.im._goEasySocket.addMessageObserver(l["default"].userPresence,this.newMessageReceived.bind(this))}return o(e,[{key:"presence",value:function(e){var t=this;return new Promise(function(n,o){if(Array.isArray(e)&&0!=e.length){for(var r=0;r<e.length;r++){if(!u.calibrator.isStringOrNumber(e[r]))return void o({code:400,content:"TypeError: userIds item require string or number."});if(u.calibrator.isNumber(e[r])&&(e[r]=e[r].toString()),0==e[r].length)return void o({code:400,content:"TypeError: userIds has empty item."})}var i={userIds:e};t.emitRocket(a.EmitType.subscribeUserPresence,i,function(){n({code:200,content:"ok"})},function(e){o({code:e.code||408,content:e.content||"Failed to subscribe group message"})},s.SocketTimeout.commonInfiniteSingle,s.SocketTimeout.commonInfiniteTotal)}else o({code:400,content:"TypeError: userIds require array."})})}},{key:"unPresence",value:function(e){var t=this;return new Promise(function(n,o){if(u.calibrator.isStringOrNumber(e)){u.calibrator.isNumber(e)&&(e=e.toString());var r={userId:e};t.emitRocket(a.EmitType.unsubscribeUserPresence,r,function(){n({code:200,content:"ok"})},function(e){o({code:e.code||408,content:e.content||"Failed to unsubscribe presence"})},s.SocketTimeout.commonRequestSingle,s.SocketTimeout.commonRequestTotal)}else o({code:400,content:"TypeError: id require string or number."})})}},{key:"emitRocket",value:function(e,t,n,o,s,a){var u=new r["default"]({name:e,params:t,singleTimeout:s,totalTimeout:a,permission:i["default"].WRITE,success:n,fail:o});this.im._goEasySocket.emit(u)}},{key:"newMessageReceived",value:function(e){var t=this,n=[];e.c&&(n=JSON.parse(e.c).events||[]),n.map(function(e){var n=e.userData?JSON.parse(e.userData):{},o={time:e.time,action:e.action,id:e.userId,data:n};t.im._event.notify(c.ImEventType.USER_PRESENCE,o)})}}]),e}();t["default"]=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(5),i=c(n(3)),s=c(n(1)),a=n(4),u=n(0);function c(e){return e&&e.__esModule?e:{"default":e}}var l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.im=null,this.im=t}return o(e,[{key:"hereNow",value:function(e){var t=this;return new Promise(function(n,o){if(e.userIds&&Array.isArray(e.userIds)&&0!=e.userIds.length){for(var c=0;c<e.userIds.length;c++){if(!u.calibrator.isStringOrNumber(e.userIds[c]))return void o({code:400,content:"TypeError: userIds item require string or number."});if(u.calibrator.isNumber(e.userIds[c])&&(e.userIds[c]=e.userIds[c].toString()),0==e.userIds[c].length)return void o({code:400,content:"TypeError: userIds has empty item."})}var l=new i["default"]({name:r.EmitType.imHereNow,params:e,permission:s["default"].READ,singleTimeout:a.SocketTimeout.commonQuerySingle,totalTimeout:a.SocketTimeout.commonQueryTotal,fail:function(e){o({code:e.resultCode||408,content:e.content||"Failed to query online users"})},success:function(e){if(200==e.code){var t=e.content;e.content=t.map(function(e){var t=e.userData?JSON.parse(e.userData):{};return{id:e.userId,data:t}}),n(e)}else o(e)}});t.im._goEasySocket.emit(l)}else o({code:400,content:"TypeError: userIds require array."})})}}]),e}();t["default"]=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(5),i=c(n(3)),s=c(n(1)),a=n(4),u=n(6);function c(e){return e&&e.__esModule?e:{"default":e}}var l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.im=null,this.im=t}return o(e,[{key:"hereNow",value:function(e){var t=this;return new Promise(function(n,o){if(u.calibrator.isStringOrNumber(e)){u.calibrator.isNumber(e)&&(e=e.toString());var c=new i["default"]({name:r.EmitType.imGroupHereNow,params:{groupId:e},permission:s["default"].READ,singleTimeout:a.SocketTimeout.commonQuerySingle,totalTimeout:a.SocketTimeout.commonQueryTotal,fail:function(e){o({code:e.resultCode||408,content:e.content||"Failed to query online group users"})},success:function(e){if(200==e.code){var t=e.content;e.content=t.map(function(e){var t=e.userData?JSON.parse(e.userData):{};return{id:e.userId,data:t}}),n(e)}else o(e)}});t.im._goEasySocket.emit(c)}else o({code:400,content:"TypeError: groupId require string or number."})})}}]),e}();t["default"]=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(17),s=(o=i)&&o.__esModule?o:{"default":o},a=n(46),u=n(27);var c=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.im=null,this.observers=[],this.im=t,t._goEasySocket.addMessageObserver(s["default"].imMessage,this.newNewMessageReceived.bind(this))}return r(e,[{key:"newNewMessageReceived",value:function(e){this.sendAck(e),this.notify(e),u.GoEasyEventCenter.fire(a.IM_INTERNAL_EVENTS.MESSAGE_RECEIVED,e)}},{key:"addIMMessageObserver",value:function(e){this.observers.push(e)}},{key:"sendAck",value:function(e){this.im._goEasySocket.sendAck("imAck",{publishGuid:e.i})}},{key:"notify",value:function(e){for(var t=0;t<this.observers.length;t++)this.observers[t](e)}}]),e}();t["default"]=c},function(e,t,n){"use strict";t.__esModule=!0,t.EmitterEventDriver=void 0;var o=n(12),r=function(){function e(){this.emitter=new o}return e.prototype.on=function(e,t){return this.emitter.on(e,t),this},e.prototype.once=function(e,t){return this.emitter.once(e,t),this},e.prototype.off=function(e,t){return this.emitter.off(e,t),this},e.prototype.fire=function(e,t){return this.emitter.emit(e,t),this},e}();t.EmitterEventDriver=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=c(n(3)),i=n(5),s=c(n(1)),a=n(4),u=n(7);function c(e){return e&&e.__esModule?e:{"default":e}}var l=function(){function e(t,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.im=null,this.userData={},this.groupData={},this.im=t,this.putUserData(n.id,n.data)}return o(e,[{key:"putData",value:function(e,t,n){n||(n={}),e==u.ConversationType.PRIVATE?this.userData[t]=n:this.groupData[t]=n}},{key:"putUserData",value:function(e,t){this.userData[e]=t}},{key:"putGroupData",value:function(e,t){this.groupData[e]=t}},{key:"loadData",value:function(e,t){var n=this;return new Promise(function(o,c){var l=void 0;if((l=u.ConversationType.PRIVATE===t?n.userData:n.groupData)[e]&&0!=Object.keys(l[e]).length)o(l[e]);else{var f={targetId:e,type:t},p=new r["default"]({name:i.EmitType.imData,params:f,permission:s["default"].READ,singleTimeout:a.SocketTimeout.commonQuerySingle,totalTimeout:a.SocketTimeout.commonQueryTotal,success:function(t){t.content?l[e]=JSON.parse(t.content):l[e]={},o(l[e])},fail:function(e){c(e)}});n.im._goEasySocket.emit(p)}})}}]),e}();t["default"]=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Conversations=undefined;var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(38),i=n(11),s=n(10),a=n(23),u=y(n(3)),c=y(n(1)),l=n(4),f=n(5),p=n(0),d=y(n(16)),h=y(n(19));function y(e){return e&&e.__esModule?e:{"default":e}}t.Conversations=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.im=null,this.list=[],this.synchronized=!1,this.im=t,t._iMReceiver.addIMMessageObserver(this.updateByInMessage.bind(this))}return o(e,[{key:"onUpdated",value:function(){var e=this;this.latestConversations().then(function(){e.im._event.notify(s.ImEventType.CONVERSATIONS_UPDATED,{unreadTotal:e.getUnreadTotal(e.list),conversations:e.list.slice(0)})})}},{key:"latestConversations",value:function(){return this.synchronized?this.loadLocalConversations():this.loadServerConversations()}},{key:"updateByInMessage",value:function(e){var t=this,n=null;n=e.t==a.ConversationType.GROUP?e.r:i.IM.userId==e.r?e.s:e.r;var o=this.list.findIndex(function(t){return e.t==a.ConversationType.GROUP&&n==t.groupId||e.t==a.ConversationType.PRIVATE&&n==t.userId}),s=void 0;function u(e){e.type===a.ConversationType.PRIVATE&&(i.IM.userId===e.lastMessage.senderId?e.lastMessage.senderData=i.IM.userData:e.lastMessage.senderData=e.data)}o>-1?(s=this.list[o],this.list.splice(o,1),s.lc<e.ts&&(s.lastMessage=d["default"].assemble(e),s.lm=e.ts),i.IM.userId!=e.senderId&&(s.unread+=1),u(s),this.insertOne(s),this.onUpdated()):(s=r.Conversion.buildByInMessage(e),i.IM.userId!=e.senderId&&(s.unread+=1),this.insertOne(s),this.im._dataCache.loadData(n,e.t).then(function(e){s.data=e,u(s),t.onUpdated()})["catch"](function(t){e.t}))}},{key:"updateByOutMessage",value:function(e,t,n,o){var s={};Object.assign(s,e),delete s.file;var u=this.list.findIndex(function(e){return e.type==a.ConversationType.GROUP&&n==e.groupId||e.type==a.ConversationType.PRIVATE&&n==e.userId}),c=void 0;u>-1?(c=this.list[u],this.list.splice(u,1),c.unread=0,c.lc=c.lm,c.lastMessage=s,e.status===h["default"].success&&(c.lc=e.timestamp,c.lm=e.timestamp)):c=r.Conversion.buildByOutMessage(s,t,n,o),c.data=o;var l=this.im._dataCache;t===a.ConversationType.GROUP?l.putGroupData(c.groupId,o):(l.putUserData(c.userId,o),c.lastMessage.senderData=i.IM.userData),this.insertOne(c),this.onUpdated()}},{key:"imLastConversations",value:function(e,t){var n=new u["default"]({name:f.EmitType.imLastConversations,params:{},permission:c["default"].READ,singleTimeout:l.SocketTimeout.commonQuerySingle,totalTimeout:l.SocketTimeout.commonQueryTotal,fail:t,success:e});this.im._goEasySocket.emit(n)}},{key:"loadServerConversations",value:function(){var e=this,t=this.im;return new Promise(function(n,o){e.imLastConversations(function(i){if(200==i.code){for(var s=i.content,u=function(n,o){var i=s[n],u=e.list.find(function(e){return i.t==a.ConversationType.GROUP&&i.g==e.groupId||i.t==a.ConversationType.PRIVATE&&i.uid==e.userId});p.calibrator.isDef(u)?u.top=i.top:(u=r.Conversion.buildByConversation(t._dataCache,i),e.insertOne(u))},c=0,l=s.length;c<l;c++)u(c);e.synchronized=!0,n({code:200,content:{unreadTotal:e.getUnreadTotal(e.list),conversations:e.list.slice(0)}})}else o(i)},function(e){o({code:e.resultCode,content:e.content})})})}},{key:"loadLocalConversations",value:function(){var e=this,t=[];return this.list.map(function(n){if(!n.data){var o="private"==n.t?n.userId:n.groupId,r=e.im._dataCache.loadData(o,n.t);r.then(function(e){n.data=e})["catch"](function(e){n.type}),t.push(r)}}),0!=t.length?new Promise(function(n,o){Promise.all(t).then(function(){n({code:200,content:{unreadTotal:e.getUnreadTotal(e.list),conversations:e.list.slice(0)}})})["catch"](function(e){o({code:408,content:e.message})})}):Promise.resolve({code:200,content:{unreadTotal:this.getUnreadTotal(this.list),conversations:this.list}})}},{key:"privateMarkAsRead",value:function(e){var t=this.list.find(function(t){return t.userId==e}),n={friendId:e};return this.markAsRead(n,t)}},{key:"groupMarkAsRead",value:function(e){var t=this.list.find(function(t){return t.groupId===e}),n={groupId:e};return this.markAsRead(n,t)}},{key:"markAsRead",value:function(e,t){var n=this;if(!t||t.unread<=0)return Promise.resolve({code:200,content:"OK"});var o=t.unread,r=t.lm;return t.mt=r,e.lastTimestamp=r,e.lastConsumedTimestamp=t.lc,new Promise(function(i,s){var u=t.type==a.ConversationType.PRIVATE?f.EmitType.markPrivateMessageAsRead:f.EmitType.markGroupMessageAsRead;n.requestEmit(u,e,function(e){200==e.code?(r===t.mt&&n.resetConversation(t,t.lm,o),i({code:200,content:"OK"})):s(e)},function(e){s(e||{code:e.code||408,content:e.content||"Failed to query message"})})})}},{key:"resetConversation",value:function(e,t,n){t<=e.lc||(e.unread-=n,e.lc=t,this.onUpdated())}},{key:"getUnreadTotal",value:function(e){for(var t=0,n=0,o=e.length;n<o;n++)t+=e[n].unread;return t}},{key:"insertOne",value:function(e){var t=this.getPosIndex(e);this.list.splice(t+1,0,e)}},{key:"getPosIndex",value:function(e){if(0==this.list.length)return-1;for(var t,n,o=0,r=this.list.length;r-o>1;){t=Math.floor((o+r)/2),n=this.list[t];var i=this.compares(e,n);if(0==i)return t;i>0?o=t:r=t}return 0==o&&this.compares(this.list[0],e)>0?-1:o}},{key:"compares",value:function(e,t){var n=void 0;return(n=e.top==t.top?t.lastMessage.timestamp-e.lastMessage.timestamp:e.top?-1:1)>0?1:0===n?0:-1}},{key:"removeConversation",value:function(e,t){var n=this,o=t==a.ConversationType.PRIVATE?"userId":"groupId";return p.calibrator.isStringOrNumber(e)?(p.calibrator.isNumber(e)&&(e=e.toString()),-1==this.findConversationIndex(t,e)?Promise.reject({code:400,content:"Failed to remove conversation, "+o+" does not exists."}):new Promise(function(o,r){var i={targetId:e,type:t};n.requestEmit(f.EmitType.removeConversation,i,function(i){var s=n.findConversationIndex(t,e);s>-1&&n.list.splice(s,1),n.onUpdated(),200==i.code?o({}):r({code:i.code||408,content:i.content||"Failed to remove conversation"})},function(e){r({code:e.code||408,content:e.content||"Failed to remove conversation"})})})):Promise.reject({code:400,content:"Failed to remove conversation, "+o+" must be a string or integer."})}},{key:"topConversation",value:function(e,t,n){var o=this,r=n==a.ConversationType.PRIVATE?"userId":"groupId";if(!p.calibrator.isStringOrNumber(e))return Promise.reject({code:400,content:"Failed to top conversation, "+r+" must be a string or integer."});p.calibrator.isNumber(e)&&(e=e.toString());var i=this.findConversationIndex(n,e);return-1==i||this.list[i].top==t?Promise.reject({code:400,content:"Failed to top conversation, "+r+" does not exists."}):new Promise(function(r,i){var s={targetId:e,top:t,type:n};o.requestEmit(f.EmitType.topConversation,s,function(){var i=o.findConversationIndex(n,e),s=o.list[i];s.top=t,o.list.splice(i,1),o.insertOne(s),o.onUpdated(),r({})},function(e){i({code:e.code||408,content:e.content||"Failed to top Conversation"})})})}},{key:"requestEmit",value:function(e,t,n,o){var r=new u["default"]({name:e,params:t,permission:c["default"].WRITE,singleTimeout:l.SocketTimeout.commonRequestSingle,totalTimeout:l.SocketTimeout.commonRequestTotal,success:n,fail:o});this.im._goEasySocket.emit(r)}},{key:"findConversationIndex",value:function(e,t){return this.list.findIndex(function(n){return e==a.ConversationType.PRIVATE?n.type==e&&n.userId==t:n.type==e&&n.groupId==t})}}]),e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=function _(e,t,n){null===e&&(e=Function.prototype);var o=Object.getOwnPropertyDescriptor(e,t);if(o===undefined){var r=Object.getPrototypeOf(e);return null===r?undefined:_(r,t,n)}if("value"in o)return o.value;var i=o.get;return i===undefined?undefined:i.call(n)},i=g(n(47)),s=n(5),a=g(n(129)),u=g(n(3)),c=g(n(1)),l=g(n(9)),f=g(n(130)),p=n(0),d=n(59),h=n(4),y=g(n(32)),m=n(31),v=n(131),b=n(132);function g(e){return e&&e.__esModule?e:{"default":e}}var w=function(e){function t(e,n){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o.ioSocket=null,o.sid=null,o.appKey=null,o.anonymous=!1,o.userId=null,o.userData=null,o.otp=null,o.artifactVersion="0.0.0",o.uri=null,o.ioOpts=null,o.allowNotification=!1,o.reconnectingTimes=0,o.messageObservers={},o.connectFailedObservers=[],o.connectingObservers=[],o.expiredReconnectedObservers=[],o.onConnectSuccess=p.noop,o.onConnectFailed=p.noop,o.onConnectProgress=p.noop,o.setUriAndOpts(e),o.extendOptions(n),o.ioSocket=new a["default"]({onDisconnected:o.onIoDisconnected.bind(o),onReconnecting:o.onIoReconnecting.bind(o)}),o.ioSocket.addConnectedObserver(o.onIoReconnected.bind(o)),o.appKey=e.appkey,o.allowNotification=e.allowNotification,o.modules=e.modules,p.calibrator.isEmpty(n.id)?(o.anonymous=!0,o.userId=v.AnonymousUserIdRepository.get()):o.userId=n.id,o.artifactVersion=y["default"].version,o.addConnectedObserver(o.onConnectSuccess),o.addConnectFailedObserver(o.onConnectFailed),o.addConnectingObserver(o.onConnectProgress),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i["default"]),o(t,[{key:"extendOptions",value:function(e){if(p.calibrator.isFunction(e.onSuccess)&&(this.onConnectSuccess=e.onSuccess),p.calibrator.isFunction(e.onFailed)&&(this.onConnectFailed=e.onFailed),p.calibrator.isFunction(e.onProgress)&&(this.onConnectProgress=e.onProgress),p.calibrator.isDef(e.data)&&!p.calibrator.isObject(e.data))throw{code:400,content:"TypeError: data requires an object."};if((p.calibrator.isDef(e.data)?String(e.data).length:0)>300){if(p.calibrator.isObject(e)&&p.calibrator.isFunction(e.onFailed))throw{code:400,content:"user.data-length limit 300 byte."}}else this.userData=e.data;this.otp=e.otp||null}},{key:"setUriAndOpts",value:function(e){var t=!0;if(m.PlatformDetector.currentPlatform()===m.Platform.BROWSER){var n="://"+p.GoEasyDomainNumber.refreshNumber()+e.host,o=void 0;!0===e.supportOldBrowser?(o=["polling","websocket"],t=!1):o=["websocket"],!1!==e.forceTLS&&t?this.uri="https"+n+":443":this.uri="http"+n+":80",this.ioOpts={transports:o,timeout:h.SocketTimeout.connect}}else this.uri="https://wx-"+e.host+":443",this.ioOpts={transports:["websocket"],reconnectionDelayMax:h.SocketTimeout.reconnectionDelayMax}}},{key:"onIoReconnected",value:function(){this.status===l["default"].RECONNECTING&&this.authorize()}},{key:"emit",value:function(e){r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"emit",this).call(this,e)}},{key:"doEmit",value:function(e,t,n){d.uniApp.overrideUniShowHideMethods(),t.sid=this.sid,this.ioSocket.doEmit(e,t,n)}},{key:"sendAck",value:function(e,t){this.ioSocket.io.emit(e,t)}},{key:"connect",value:function(e){var n=this;r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"connect",this).call(this),this.onConnecting(this.reconnectingTimes),this.ioSocket.connect({uri:this.uri,opts:this.ioOpts}),e&&e.supportNotification()&&e.getRegIdPromise()?e.getRegIdPromise().then(function(e){n.regId=e,n.authorize()})["catch"](function(e){console.warn("Failed to register the Manufacturers Push service:"+JSON.stringify(e)),n.authorize()}):this.authorize()}},{key:"disconnect",value:function(){var e=this;return new Promise(function(t,n){var o=function(){e.status=l["default"].DISCONNECTED,e.ioSocket.disconnect(),t()};if(e.allowNotification){var r=new u["default"]({name:s.EmitType.manualDisconnect,params:{},permission:c["default"].READ,singleTimeout:h.SocketTimeout.commonInfiniteSingle,totalTimeout:h.SocketTimeout.commonInfiniteTotal,fail:function(e){n(e)},success:o});e.emit(r)}else o()})}},{key:"authorize",value:function(){var e={appkey:this.appKey,userId:this.userId,userData:JSON.stringify(this.userData),otp:this.otp,artifactVersion:this.artifactVersion,sid:this.sid,allowNT:this.allowNotification,regId:this.regId,modules:this.modules,a:this.anonymous,z:b.clientInfo.z};JSON.stringify(e);var t=new u["default"]({name:s.EmitType.authorize,params:e,permission:c["default"].NONE,singleTimeout:h.SocketTimeout.commonInfiniteSingle,totalTimeout:h.SocketTimeout.commonInfiniteTotal,success:this.onAuthorizeSuccess.bind(this),fail:this.onAuthorizeFailed.bind(this)});this.ioSocket.emit(t)}},{key:"onConnecting",value:function(){this.notify(this.connectingObservers,this.reconnectingTimes)}},{key:"onIoReconnecting",value:function(){d.uniApp.overrideUniShowHideMethods(),this.reconnectingTimes++,this.status==l["default"].CONNECTED||this.status==l["default"].EXPIRED_RECONNECTED||this.status==l["default"].RECONNECTING?this.status=l["default"].RECONNECTING:this.status=l["default"].CONNECTING,this.onConnecting()}},{key:"onIoDisconnected",value:function(){this.status==l["default"].DISCONNECTING&&(this.status=l["default"].DISCONNECTED,this.notify(this.disconnectedObservers))}},{key:"onAuthorizeSuccess",value:function(e){(!0===this.anonymous&&e.u&&(v.AnonymousUserIdRepository.put(e.u),this.userId=e.u),this.status===l["default"].RECONNECTING)?this.sid!==e.sid?(this.status=l["default"].EXPIRED_RECONNECTED,this.notify(this.expiredReconnectedObservers)):this.status=l["default"].RECONNECTED:(this.status=l["default"].CONNECTED,this.sid=e.sid);e.enablePublish&&(this.permissions.find(function(e){return e==c["default"].WRITE})||this.permissions.push(c["default"].WRITE)),e.enableSubscribe&&(this.permissions.find(function(e){return e==c["default"].READ})||this.permissions.push(c["default"].READ)),this.reconnectingTimes=0,this.notify(this.connectedObservers)}},{key:"onAuthorizeFailed",value:function(e){this.ioSocket.disconnect(),this.status=l["default"].CONNECT_FAILED;var t={code:e.resultCode||408,content:e.content||"Host unreachable or timeout"};this.notify(this.connectFailedObservers,t)}},{key:"addConnectingObserver",value:function(e){p.calibrator.isFunction(e)&&this.connectingObservers.push(e)}},{key:"addConnectFailedObserver",value:function(e){p.calibrator.isFunction(e)&&this.connectFailedObservers.push(e)}},{key:"addExpiredReconnectedObserver",value:function(e){p.calibrator.isFunction(e)&&this.expiredReconnectedObservers.push(e)}},{key:"addMessageObserver",value:function(e,t){var n=this;this.ioSocket.io.on(e,function(t){n.notifyMessageObservers(e,t)}),this.messageObservers[e]||(this.messageObservers[e]=[]),this.messageObservers[e].push(new f["default"](t))}},{key:"notifyMessageObservers",value:function(e,t){for(var n=this.messageObservers[e],o=0;o<n.length;o++)n[o].onMessage(e,t)}}]),t}();t["default"]=w},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o,r=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),i=n(9),s=(o=i)&&o.__esModule?o:{"default":o};var a=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.socket=null,this.socket=t}return r(e,[{key:"emit",value:function(e){this.socket.status!==s["default"].CONNECT_FAILED&&this.socket.status!==s["default"].DISCONNECTED?(e.start(),this.doEmit(e)):e.fail({resultCode:"409",content:"Please connect first"})}},{key:"doEmit",value:function(e){var t=this;if(e.isTimeout())e.fail({resultCode:408,content:"Host unreachable or timeout"});else if(this.socket.status!==s["default"].CONNECT_FAILED)if(this.authenticated())if(this.hasPermission(e))if(this.socket.status===s["default"].CONNECTED||this.socket.status===s["default"].RECONNECTED||this.socket.status===s["default"].EXPIRED_RECONNECTED){if(!e.complete){var n=setTimeout(function(){t.doEmit(e)},e.singleTimeout);this.socket.doEmit(e.name,e.params,function(t){clearTimeout(n),200===t.resultCode||200==t.code?e.success(t):e.fail(t)}),e.retried++}}else setTimeout(function(){t.doEmit(e)},500);else e.fail({resultCode:401,content:"No permission"});else setTimeout(function(){t.doEmit(e)},500);else e.fail({resultCode:408,content:"Failed to connect GoEasy."})}},{key:"hasPermission",value:function(e){return!!this.socket.permissions.find(function(t){return t===e.permission})}},{key:"authenticated",value:function(){return this.socket.status===s["default"].CONNECTED||this.socket.status===s["default"].RECONNECTING||this.socket.status===s["default"].RECONNECTED||this.socket.status===s["default"].EXPIRED_RECONNECTED}}]),e}();t["default"]=a},function(e,t,n){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=n(111),i=n(28),s=n(50);n(8)("socket.io-client");e.exports=t=u;var a=t.managers={};function u(e,t){"object"===(void 0===e?"undefined":o(e))&&(t=e,e=undefined),t=t||{};var n,i=r(e),u=i.source,c=i.id,l=i.path,f=a[c]&&l in a[c].nsps;return t.forceNew||t["force new connection"]||!1===t.multiplex||f?n=s(u,t):(a[c]||(a[c]=s(u,t)),n=a[c]),i.query&&!t.query&&(t.query=i.query),n.socket(i.path,t)}t.protocol=i.protocol,t.connect=u,t.Manager=n(50),t.Socket=n(56)},function(e,t,n){"use strict";var o=n(48);n(8)("socket.io-client:url");e.exports=function(e,t){var n=e;t=t||"undefined"!=typeof location&&location,null==e&&(e=t.protocol+"//"+t.host);"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?t.protocol+e:t.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==t?t.protocol+"//"+e:"https://"+e),n=o(e));n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443"));n.path=n.path||"/";var r=-1!==n.host.indexOf(":")?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+r+":"+n.port,n.href=n.protocol+"://"+r+(t&&t.port===n.port?"":":"+n.port),n}},function(e,t,n){"use strict";e.exports=n(113),e.exports.parser=n(13)},function(e,t,n){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=n(51),i=n(12),s=(n(8)("engine.io-client:socket"),n(55)),a=n(13),u=n(48),c=n(22);function l(e,t){if(!(this instanceof l))return new l(e,t);t=t||{},e&&"object"===(void 0===e?"undefined":o(e))&&(t=e,e=null),e?(e=u(e),t.hostname=e.host,t.secure="https"===e.protocol||"wss"===e.protocol,t.port=e.port,e.query&&(t.query=e.query)):t.host&&(t.hostname=u(t.host).host),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.agent=t.agent||!1,this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?443:80),this.query=t.query||{},"string"==typeof this.query&&(this.query=c.decode(this.query)),this.upgrade=!1!==t.upgrade,this.path=(t.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!t.forceJSONP,this.jsonp=!1!==t.jsonp,this.forceBase64=!!t.forceBase64,this.enablesXDR=!!t.enablesXDR,this.timestampParam=t.timestampParam||"t",this.timestampRequests=t.timestampRequests,this.transports=t.transports||["polling","websocket"],this.transportOptions=t.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=t.policyPort||843,this.rememberUpgrade=t.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=t.onlyBinaryUpgrades,this.perMessageDeflate=!1!==t.perMessageDeflate&&(t.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=t.pfx||null,this.key=t.key||null,this.passphrase=t.passphrase||null,this.cert=t.cert||null,this.ca=t.ca||null,this.ciphers=t.ciphers||null,this.rejectUnauthorized=t.rejectUnauthorized===undefined||t.rejectUnauthorized,this.forceNode=!!t.forceNode,this.isReactNative="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase(),("undefined"==typeof self||this.isReactNative)&&(t.extraHeaders&&Object.keys(t.extraHeaders).length>0&&(this.extraHeaders=t.extraHeaders),t.localAddress&&(this.localAddress=t.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}e.exports=l,l.priorWebsocketSuccess=!1,i(l.prototype),l.protocol=a.protocol,l.Socket=l,l.Transport=n(29),l.transports=n(51),l.parser=n(13),l.prototype.createTransport=function(e){var t=function(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}(this.query);t.EIO=a.protocol,t.transport=e;var n=this.transportOptions[e]||{};return this.id&&(t.sid=this.id),new r[e]({query:t,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0,isReactNative:this.isReactNative})},l.prototype.open=function(){var e;if(this.rememberUpgrade&&l.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket"))e="websocket";else{if(0===this.transports.length){var t=this;return void setTimeout(function(){t.emit("error","No transports available")},0)}e=this.transports[0]}this.readyState="opening";try{e=this.createTransport(e)}catch(n){return this.transports.shift(),void this.open()}e.open(),this.setTransport(e)},l.prototype.setTransport=function(e){e.name;var t=this;this.transport&&(this.transport.name,this.transport.removeAllListeners()),this.transport=e,e.on("drain",function(){t.onDrain()}).on("packet",function(e){t.onPacket(e)}).on("error",function(e){t.onError(e)}).on("close",function(){t.onClose("transport close")})},l.prototype.probe=function(e){var t=this.createTransport(e,{probe:1}),n=!1,o=this;function r(){if(o.onlyBinaryUpgrades){var e=!this.supportsBinary&&o.transport.supportsBinary;n=n||e}n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",function(e){if(!n)if("pong"===e.type&&"probe"===e.data){if(o.upgrading=!0,o.emit("upgrading",t),!t)return;l.priorWebsocketSuccess="websocket"===t.name,o.transport.name,o.transport.pause(function(){n||"closed"!==o.readyState&&(f(),o.setTransport(t),t.send([{type:"upgrade"}]),o.emit("upgrade",t),t=null,o.upgrading=!1,o.flush())})}else{var r=new Error("probe error");r.transport=t.name,o.emit("upgradeError",r)}}))}function i(){n||(n=!0,f(),t.close(),t=null)}function s(e){var n=new Error("probe error: "+e);n.transport=t.name,i(),o.emit("upgradeError",n)}function a(){s("transport closed")}function u(){s("socket closed")}function c(e){t&&e.name!==t.name&&(e.name,t.name,i())}function f(){t.removeListener("open",r),t.removeListener("error",s),t.removeListener("close",a),o.removeListener("close",u),o.removeListener("upgrading",c)}l.priorWebsocketSuccess=!1,t.once("open",r),t.once("error",s),t.once("close",a),this.once("close",u),this.once("upgrading",c),t.open()},l.prototype.onOpen=function(){if(this.readyState="open",l.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause)for(var e=0,t=this.upgrades.length;e<t;e++)this.probe(this.upgrades[e])},l.prototype.onPacket=function(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(e.type,e.data,this.emit("packet",e),this.emit("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"pong":this.setPing(),this.emit("pong");break;case"error":var t=new Error("server error");t.code=e.data,this.onError(t);break;case"message":this.emit("data",e.data),this.emit("message",e.data)}else this.readyState},l.prototype.onHandshake=function(e){this.emit("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this.upgrades=this.filterUpgrades(e.upgrades),this.pingInterval=e.pingInterval,this.pingTimeout=e.pingTimeout,this.onOpen(),"closed"!==this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},l.prototype.onHeartbeat=function(e){clearTimeout(this.pingTimeoutTimer);var t=this;t.pingTimeoutTimer=setTimeout(function(){"closed"!==t.readyState&&t.onClose("ping timeout")},e||t.pingInterval+t.pingTimeout)},l.prototype.setPing=function(){var e=this;clearTimeout(e.pingIntervalTimer),e.pingIntervalTimer=setTimeout(function(){e.pingTimeout,e.ping(),e.onHeartbeat(e.pingTimeout)},e.pingInterval)},l.prototype.ping=function(){var e=this;this.sendPacket("ping",function(){e.emit("ping")})},l.prototype.onDrain=function(){this.writeBuffer.splice(0,this.prevBufferLen),this.prevBufferLen=0,0===this.writeBuffer.length?this.emit("drain"):this.flush()},l.prototype.flush=function(){"closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length&&(this.writeBuffer.length,this.transport.send(this.writeBuffer),this.prevBufferLen=this.writeBuffer.length,this.emit("flush"))},l.prototype.write=l.prototype.send=function(e,t,n){return this.sendPacket("message",e,t,n),this},l.prototype.sendPacket=function(e,t,n,o){if("function"==typeof t&&(o=t,t=undefined),"function"==typeof n&&(o=n,n=null),"closing"!==this.readyState&&"closed"!==this.readyState){(n=n||{}).compress=!1!==n.compress;var r={type:e,data:t,options:n};this.emit("packetCreate",r),this.writeBuffer.push(r),o&&this.once("flush",o),this.flush()}},l.prototype.close=function(){if("opening"===this.readyState||"open"===this.readyState){this.readyState="closing";var e=this;this.writeBuffer.length?this.once("drain",function(){this.upgrading?o():t()}):this.upgrading?o():t()}function t(){e.onClose("forced close"),e.transport.close()}function n(){e.removeListener("upgrade",n),e.removeListener("upgradeError",n),t()}function o(){e.once("upgrade",n),e.once("upgradeError",n)}return this},l.prototype.onError=function(e){l.priorWebsocketSuccess=!1,this.emit("error",e),this.onClose("transport error",e)},l.prototype.onClose=function(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){clearTimeout(this.pingIntervalTimer),clearTimeout(this.pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),this.readyState="closed",this.id=null,this.emit("close",e,t),this.writeBuffer=[],this.prevBufferLen=0}},l.prototype.filterUpgrades=function(e){for(var t=[],n=0,o=e.length;n<o;n++)~s(this.transports,e[n])&&t.push(e[n]);return t}},function(e,t,n){"use strict";(function(t){var o=n(115),r=n(30);e.exports=l;var i,s=/\n/g,a=/\\n/g;function u(){}function c(){return"undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:{}}function l(e){if(o.call(this,e),this.query=this.query||{},!i){var t=c();i=t.___eio=t.___eio||[]}this.index=i.length;var n=this;i.push(function(e){n.onData(e)}),this.query.j=this.index,"function"==typeof addEventListener&&addEventListener("beforeunload",function(){n.script&&(n.script.onerror=u)},!1)}r(l,o),l.prototype.supportsBinary=!1,l.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)},l.prototype.doPoll=function(){var e=this,t=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),t.async=!0,t.src=this.uri(),t.onerror=function(t){e.onError("jsonp poll error",t)};var n=document.getElementsByTagName("script")[0];n?n.parentNode.insertBefore(t,n):(document.head||document.body).appendChild(t),this.script=t,"undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent)&&setTimeout(function(){var e=document.createElement("iframe");document.body.appendChild(e),document.body.removeChild(e)},100)},l.prototype.doWrite=function(e,t){var n=this;if(!this.form){var o,r=document.createElement("form"),i=document.createElement("textarea"),u=this.iframeId="eio_iframe_"+this.index;r.className="socketio",r.style.position="absolute",r.style.top="-1000px",r.style.left="-1000px",r.target=u,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 c(){l(),t()}function l(){if(n.iframe)try{n.form.removeChild(n.iframe)}catch(t){n.onError("jsonp polling iframe removal error",t)}try{var e='<iframe src="javascript:0" name="'+n.iframeId+'">';o=document.createElement(e)}catch(t){(o=document.createElement("iframe")).name=n.iframeId,o.src="javascript:0"}o.id=n.iframeId,n.form.appendChild(o),n.iframe=o}this.form.action=this.uri(),l(),e=e.replace(a,"\\\n"),this.area.value=e.replace(s,"\\n");try{this.form.submit()}catch(f){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===n.iframe.readyState&&c()}:this.iframe.onload=c}}).call(this,n(25))},function(e,t,n){"use strict";var o=n(29),r=n(22),i=n(13),s=n(30),a=n(54);n(8)("engine.io-client:polling");e.exports=c;var u=null!=new(n(123))({xdomain:!1}).responseType;function c(e){var t=e&&e.forceBase64;u&&!t||(this.supportsBinary=!1),o.call(this,e)}s(c,o),c.prototype.name="polling",c.prototype.doOpen=function(){this.poll()},c.prototype.pause=function(e){var t=this;function n(){t.readyState="paused",e()}if(this.readyState="pausing",this.polling||!this.writable){var o=0;this.polling&&(o++,this.once("pollComplete",function(){--o||n()})),this.writable||(o++,this.once("drain",function(){--o||n()}))}else n()},c.prototype.poll=function(){this.polling=!0,this.doPoll(),this.emit("poll")},c.prototype.onData=function(e){var t=this;i.decodePayload(e,this.socket.binaryType,function(e,n,o){if("opening"===t.readyState&&t.onOpen(),"close"===e.type)return t.onClose(),!1;t.onPacket(e)}),"closed"!==this.readyState&&(this.polling=!1,this.emit("pollComplete"),"open"===this.readyState?this.poll():this.readyState)},c.prototype.doClose=function(){var e=this;function t(){e.write([{type:"close"}])}"open"===this.readyState?t():this.once("open",t)},c.prototype.write=function(e){var t=this;this.writable=!1;var n=function(){t.writable=!0,t.emit("drain")};i.encodePayload(e,this.supportsBinary,function(e){t.doWrite(e,n)})},c.prototype.uri=function(){var e=this.query||{},t=this.secure?"https":"http",n="";return!1!==this.timestampRequests&&(e[this.timestampParam]=a()),this.supportsBinary||e.sid||(e.b64=1),e=r.encode(e),this.port&&("https"===t&&443!==Number(this.port)||"http"===t&&80!==Number(this.port))&&(n=":"+this.port),e.length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e}},function(e,t,n){"use strict";e.exports=Object.keys||function(e){var t=[],n=Object.prototype.hasOwnProperty;for(var o in e)n.call(e,o)&&t.push(o);return t}},function(e,t,n){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],o=t[1];return 3*(n+o)/4-o},t.toByteArray=function(e){var t,n,o=c(e),s=o[0],a=o[1],u=new i(function(e,t,n){return 3*(t+n)/4-n}(0,s,a)),l=0,f=a>0?s-4:s;for(n=0;n<f;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[l++]=255&t);1===a&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,n=e.length,r=n%3,i=[],s=0,a=n-r;s<a;s+=16383)i.push(l(e,s,s+16383>a?a:s+16383));1===r?(t=e[n-1],i.push(o[t>>2]+o[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],i.push(o[t>>10]+o[t>>4&63]+o[t<<2&63]+"="));return i.join("")};for(var o=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,u=s.length;a<u;++a)o[a]=s[a],r[s.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var r,i,s=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(o[(i=r)>>18&63]+o[i>>12&63]+o[i>>6&63]+o[63&i]);return s.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},function(e,t){
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
t.read=function(e,t,n,o,r){var i,s,a=8*r-o-1,u=(1<<a)-1,c=u>>1,l=-7,f=n?r-1:0,p=n?-1:1,d=e[t+f];for(f+=p,i=d&(1<<-l)-1,d>>=-l,l+=a;l>0;i=256*i+e[t+f],f+=p,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=o;l>0;s=256*s+e[t+f],f+=p,l-=8);if(0===i)i=1-c;else{if(i===u)return s?NaN:(d?-1:1)*Infinity;s+=Math.pow(2,o),i-=c}return(d?-1:1)*s*Math.pow(2,i-o)},t.write=function(e,t,n,o,r,i){var s,a,u,c=8*i-r-1,l=(1<<c)-1,f=l>>1,p=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,d=o?0:i-1,h=o?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===Infinity?(a=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),(t+=s+f>=1?p/u:p*Math.pow(2,1-f))*u>=2&&(s++,u/=2),s+f>=l?(a=0,s=l):s+f>=1?(a=(t*u-1)*Math.pow(2,r),s+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,r),s=0));r>=8;e[n+d]=255&a,d+=h,a/=256,r-=8);for(s=s<<r|a,c+=r;c>0;e[n+d]=255&s,d+=h,s/=256,c-=8);e[n+d-h]|=128*y}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t){function n(){}e.exports=function(e,t,o){var r=!1;return o=o||n,i.count=e,0===e?t():i;function i(e,n){if(i.count<=0)throw new Error("after called too many times");--i.count,e?(r=!0,t(e),t=o):0!==i.count||r||t(null,n)}}},function(e,t,n){"use strict";
/*! https://mths.be/utf8js v2.1.2 by @mathias */var o,r,i,s=String.fromCharCode;function a(e){for(var t,n,o=[],r=0,i=e.length;r<i;)(t=e.charCodeAt(r++))>=55296&&t<=56319&&r<i?56320==(64512&(n=e.charCodeAt(r++)))?o.push(((1023&t)<<10)+(1023&n)+65536):(o.push(t),r--):o.push(t);return o}function u(e,t){if(e>=55296&&e<=57343){if(t)throw Error("Lone surrogate U+"+e.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function c(e,t){return s(e>>t&63|128)}function l(e,t){if(0==(4294967168&e))return s(e);var n="";return 0==(4294965248&e)?n=s(e>>6&31|192):0==(4294901760&e)?(u(e,t)||(e=65533),n=s(e>>12&15|224),n+=c(e,6)):0==(4292870144&e)&&(n=s(e>>18&7|240),n+=c(e,12),n+=c(e,6)),n+=s(63&e|128)}function f(){if(i>=r)throw Error("Invalid byte index");var e=255&o[i];if(i++,128==(192&e))return 63&e;throw Error("Invalid continuation byte")}function p(e){var t,n;if(i>r)throw Error("Invalid byte index");if(i==r)return!1;if(t=255&o[i],i++,0==(128&t))return t;if(192==(224&t)){if((n=(31&t)<<6|f())>=128)return n;throw Error("Invalid continuation byte")}if(224==(240&t)){if((n=(15&t)<<12|f()<<6|f())>=2048)return u(n,e)?n:65533;throw Error("Invalid continuation byte")}if(240==(248&t)&&(n=(7&t)<<18|f()<<12|f()<<6|f())>=65536&&n<=1114111)return n;throw Error("Invalid UTF-8 detected")}e.exports={version:"2.1.2",encode:function(e,t){for(var n=!1!==(t=t||{}).strict,o=a(e),r=o.length,i=-1,s="";++i<r;)s+=l(o[i],n);return s},decode:function(e,t){var n=!1!==(t=t||{}).strict;o=a(e),r=o.length,i=0;for(var u,c=[];!1!==(u=p(n));)c.push(u);return function(e){for(var t,n=e.length,o=-1,r="";++o<n;)(t=e[o])>65535&&(r+=s((t-=65536)>>>10&1023|55296),t=56320|1023&t),r+=s(t);return r}(c)}}},function(e,t){var n=void 0!==n?n:"undefined"!=typeof WebKitBlobBuilder?WebKitBlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder&&MozBlobBuilder,o=function(){try{return 2===new Blob(["hi"]).size}catch(e){return!1}}(),r=o&&function(){try{return 2===new Blob([new Uint8Array([1,2])]).size}catch(e){return!1}}(),i=n&&n.prototype.append&&n.prototype.getBlob;function s(e){return e.map(function(e){if(e.buffer instanceof ArrayBuffer){var t=e.buffer;if(e.byteLength!==t.byteLength){var n=new Uint8Array(e.byteLength);n.set(new Uint8Array(t,e.byteOffset,e.byteLength)),t=n.buffer}return t}return e})}function a(e,t){t=t||{};var o=new n;return s(e).forEach(function(e){o.append(e)}),t.type?o.getBlob(t.type):o.getBlob()}function u(e,t){return new Blob(s(e),t||{})}"undefined"!=typeof Blob&&(a.prototype=Blob.prototype,u.prototype=Blob.prototype),e.exports=o?r?Blob:u:i?a:undefined},function(e,t,n){"use strict";var o=n(124);e.exports=function(e){var t=e.xdomain,n=e.xscheme,r=e.enablesXDR;try{if("undefined"!=typeof XMLHttpRequest&&(!t||o))return new XMLHttpRequest}catch(i){}try{if("undefined"!=typeof XDomainRequest&&!n&&r)return new XDomainRequest}catch(i){}if(!t)try{return new(self[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(i){}}},function(e,t){try{e.exports="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(n){e.exports=!1}},function(e,t,n){"use strict";(function(t){var o,r,i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=n(29),a=n(13),u=n(22),c=n(30),l=n(54);n(8)("engine.io-client:websocket");if("undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket)if("undefined"!=typeof WebSocket)o=WebSocket;else if("undefined"!=typeof self)o=self.WebSocket||self.MozWebSocket;else try{r=n(126)}catch(d){}var f=o||r;function p(e){e&&e.forceBase64&&(this.supportsBinary=!1),("undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket)&&(this.perMessageDeflate=e.perMessageDeflate,this.usingBrowserWebSocket=o&&!e.forceNode,this.protocols=e.protocols,this.usingBrowserWebSocket||(f=r)),s.call(this,e)}("undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket)&&"undefined"==typeof GameGlobal||(f=function(e){var t=this;if(t.onopen=function(){},t.onclose=function(){},t.onmessage=function(e){},t.onerror=function(e){},"object"===("undefined"==typeof tt?"undefined":i(tt))&&tt.getSystemInfo){var n=tt.connectSocket({url:e});t.send=function(e){n.send({data:e})},t.close=function(){n.close()},n.onOpen(function(){t.onopen()}),n.onError(function(e){t.onerror(e)}),n.onMessage(function(e){t.onmessage(e)}),n.onClose(function(){t.onclose()})}else if("undefined"!=typeof uni){var o=uni.connectSocket({url:e,complete:function(){}});t.send=function(e){o.send({data:e})},t.close=function(){o.close()},o.onOpen(function(e){t.onopen()}),o.onError(function(e){t.onerror(e)}),o.onMessage(function(e){t.onmessage(e)}),o.onClose(function(e){t.onclose()})}else{var r=wx.connectSocket({url:e});t.send=function(e){r.send({data:e})},t.close=function(e){r.close({code:1e3})},r.onOpen(function(){t.onopen()}),r.onError(function(e){t.onerror(e)}),r.onMessage(function(e){t.onmessage(e)}),r.onClose(function(e){t.onclose(e)})}}),e.exports=p,c(p,s),p.prototype.name="websocket",p.prototype.supportsBinary=!1,p.prototype.doOpen=function(){if(this.check()){var e,t,n=this.uri();("undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket)&&(e=this.protocols),(t="undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket?{agent:this.agent,perMessageDeflate:this.perMessageDeflate}:{agent:this.agent}).pfx=this.pfx,t.key=this.key,t.passphrase=this.passphrase,t.cert=this.cert,t.ca=this.ca,t.ciphers=this.ciphers,t.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(t.headers=this.extraHeaders),this.localAddress&&(t.localAddress=this.localAddress);try{"undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket?this.ws=this.usingBrowserWebSocket&&!this.isReactNative?e?new f(n,e):new f(n):new f(n,e,t):this.ws=new f(n)}catch(o){return this.emit("error",o)}this.ws.binaryType===undefined&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},p.prototype.addEventListeners=function(){var e=this;this.ws.onopen=function(){e.onOpen()},this.ws.onclose=function(){e.onClose()},this.ws.onmessage=function(t){e.onData(t.data)},this.ws.onerror=function(t){e.onError("websocket error",t)}},p.prototype.write=function(e){var n=this;this.writable=!1;for(var o=e.length,r=0,i=o;r<i;r++)!function(e){a.encodePacket(e,n.supportsBinary,function(r){if("undefined"==typeof uni&&"undefined"==typeof wx||"undefined"!=typeof WebSocket){if(!n.usingBrowserWebSocket){var i={};if(e.options&&(i.compress=e.options.compress),n.perMessageDeflate)("string"==typeof r?t.byteLength(r):r.length)<n.perMessageDeflate.threshold&&(i.compress=!1)}try{n.usingBrowserWebSocket?n.ws.send(r):n.ws.send(r,i)}catch(d){}}else try{n.ws.send(r)}catch(d){}--o||s()})}(e[r]);function s(){n.emit("flush"),setTimeout(function(){n.writable=!0,n.emit("drain")},0)}},p.prototype.onClose=function(){s.prototype.onClose.call(this)},p.prototype.doClose=function(){"undefined"!=typeof this.ws&&this.ws.close()},p.prototype.uri=function(){var e=this.query||{},t=this.secure?"wss":"ws",n="";return this.port&&("wss"===t&&443!==Number(this.port)||"ws"===t&&80!==Number(this.port))&&(n=":"+this.port),this.timestampRequests&&(e[this.timestampParam]=l()),this.supportsBinary||(e.b64=1),(e=u.encode(e)).length&&(e="?"+e),t+"://"+(-1!==this.hostname.indexOf(":")?"["+this.hostname+"]":this.hostname)+n+this.path+e},p.prototype.check=function(){return!(!f||"__initialize"in f&&this.name===p.prototype.name)}}).call(this,n(53).Buffer)},function(e,t){},function(e,t){e.exports=function(e,t){for(var n=[],o=(t=t||0)||0;o<e.length;o++)n[o-t]=e[o];return n}},function(e,t){function n(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}e.exports=n,n.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=0==(1&Math.floor(10*t))?e-n:e+n}return 0|Math.min(e,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(e){this.ms=e},n.prototype.setMax=function(e){this.max=e},n.prototype.setJitter=function(e){this.jitter=e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=s(n(47)),i=s(n(9));function s(e){return e&&e.__esModule?e:{"default":e}}var a=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return n.reconnectingObservers=[],n.addReconnectingObserver(e.onReconnecting),n.addDisconnectedObserver(e.onDisconnected),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,r["default"]),o(t,[{key:"connect",value:function(e){(function n(e,t,o){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,t);if(r===undefined){var i=Object.getPrototypeOf(e);return null===i?undefined:n(i,t,o)}if("value"in r)return r.value;var s=r.get;return s===undefined?undefined:s.call(o)})(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"connect",this).call(this),this.io=this.io.connect(e.uri,e.opts),this.initListener()}},{key:"doEmit",value:function(e,t,n){this.io.emit(e,t,n)}},{key:"initListener",value:function(){var e=this;this.io.on("reconnecting",function(t){e.status=i["default"].CONNECTING,e.notify(e.reconnectingObservers,t)}),this.io.on("connect",function(){e.status=i["default"].CONNECTED,e.notify(e.connectedObservers)}),this.io.on("disconnect",function(){e.status=i["default"].DISCONNECTED,e.notify(e.disconnectedObservers)}),this.io.on("connect_error",function(e){})}},{key:"addReconnectingObserver",value:function(e){this.reconnectingObservers.push(e)}}]),t}();t["default"]=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(0);var i=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.callback=r.noop,this.guidList=[],this.callback=t}return o(e,[{key:"onMessage",value:function(e,t){"string"==typeof t&&(t=JSON.parse(t)),this.guidList.findIndex(function(e){return e===t.i})>-1||(this.guidList.unshift(t.i),this.guidList.length>300&&this.guidList.pop(),this.callback(t))}}]),e}();t["default"]=i},function(e,t,n){"use strict";t.__esModule=!0,t.AnonymousUserIdRepository=void 0;var o=n(0),r=n(37),i=function(){function e(){}return e.get=function(){var t=e.storage;if(null!==t){var n=t.get(e.ANONYMOUS_USER_ID_KEY);if(!o.calibrator.isEmpty(n))return n}return null},e.put=function(t){var n=e.storage;null!==n&&n.put(e.ANONYMOUS_USER_ID_KEY,t)},e.storage=r.LocalStorageDispatcher.localStorage(),e.ANONYMOUS_USER_ID_KEY="goeasy-anonymous-user-id",e}();t.AnonymousUserIdRepository=i},function(e,t,n){"use strict";t.__esModule=!0,t.clientInfo=void 0;var o=n(31),r=n(15),i=new(function(){function e(){this.platform=o.PlatformDetector.currentPlatform(),this.framework=r.FrameworkDetector.currentFramework(),this.z=this.toZ()}return e.prototype.toZ=function(){for(var e=JSON.stringify({platform:this.platform,framework:this.framework}),t="",n=0;n<e.length;n++){var o=e.charCodeAt(n);t+=String.fromCharCode(o+5)}return t},e}());t.clientInfo=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.ModuleType={IM:"IM",PUBSUB:"PUBSUB"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(0),i=n(5),s=c(n(3)),a=c(n(1)),u=n(4);function c(e){return e&&e.__esModule?e:{"default":e}}var l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.pubSub=null,this.pubSub=t}return o(e,[{key:"get",value:function(e,t){if(r.calibrator.isFunction(e.onSuccess)||(e.onSuccess=r.noop),r.calibrator.isFunction(e.onFailed)||(e.onFailed=r.noop),r.calibrator.isDef(e.channel)){r.calibrator.isNumber(e.channel)&&(e.channel=e.channel.toString());var n=new s["default"]({name:i.EmitType.historyMessages,permission:a["default"].READ,params:e,singleTimeout:u.SocketTimeout.commonQuerySingle,totalTimeout:u.SocketTimeout.commonQueryTotal,success:function(t){e.onSuccess({code:t.resultCode||t.code||200,content:t.content})},fail:function(t){e.onFailed({code:t.resultCode||t.code,content:t.content})}});this.pubSub.goEasySocket.emit(n)}else e.onFailed(res)}}]),e}();t["default"]=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(0),i=n(5),s=c(n(3)),a=c(n(1)),u=n(4);function c(e){return e&&e.__esModule?e:{"default":e}}var l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.pubSub=null,this.pubSub=t}return o(e,[{key:"byChannel",value:function(e){var t={channels:[],includeUsers:!1,distinct:!1};if(r.calibrator.isFunction(e.onSuccess)||(e.onSuccess=r.noop),r.calibrator.isFunction(e.onFailed)||(e.onFailed=r.noop),Array.isArray(e.channels))for(var n=0;n<e.channels.length;n++){var o=e.channels[n];r.calibrator.isNumber(o)&&(o=o.toString()),t.channels.push(o)}if(0!=t.channels.length){1==e.includeUsers&&(t.includeUsers=!0),1==e.distinct&&(t.distinct=!0);var c=new s["default"]({name:i.EmitType.hereNow,permission:a["default"].READ,params:t,singleTimeout:u.SocketTimeout.commonQuerySingle,totalTimeout:u.SocketTimeout.commonQueryTotal,success:function(t){var n=t.content,o=n.channels;for(var r in o)if(o.hasOwnProperty(r)){var i=o[r];i.users&&(i.users=i.users.map(function(e){return e.data=e.data?JSON.parse(e.data):{},e}))}e.onSuccess({code:t.resultCode||t.code||200,content:n})},fail:function(t){e.onFailed({code:t.resultCode||t.code||200,content:t.content})}});this.pubSub.goEasySocket.emit(c)}else e.onFailed({code:408,content:"channels is required."})}},{key:"byUserId",value:function(e){var t={userIds:[],distinct:!0};if(r.calibrator.isFunction(e.onSuccess)||(e.onSuccess=r.noop),r.calibrator.isFunction(e.onFailed)||(e.onFailed=r.noop),r.calibrator.isDef(e.userIds)&&(t.userIds=e.userIds),0==e.distinct&&(t.distinct=!1),0===t.userIds.length)e.onFailed({code:400,content:"userIds is required"});else if(t.userIds.length>500)e.onFailed({code:400,content:"userIds is over max length 500"});else{var n=new s["default"]({name:i.EmitType.hereNowByUserIds,permission:a["default"].READ,params:t,singleTimeout:u.SocketTimeout.commonQuerySingle,totalTimeout:u.SocketTimeout.commonQueryTotal,success:function(t){var n=t.content;n=n.map(function(e){var t={};return t.id=e.userId,t.data=e.userData?JSON.parse(e.userData):{},t}),e.onSuccess({code:t.resultCode||t.code||200,content:n})},fail:function(t){e.onFailed({code:t.resultCode||t.code||200,content:t.content})}});this.pubSub.goEasySocket.emit(n)}}}]),e}();t["default"]=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(0),i=c(n(3)),s=n(5),a=c(n(1)),u=n(4);function c(e){return e&&e.__esModule?e:{"default":e}}var l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.pubSub=null,this.pubSub=t}return o(e,[{key:"publish",value:function(e){if(r.calibrator.isFunction(e.onFailed)||(e.onFailed=r.noop),r.calibrator.isFunction(e.onSuccess)||(e.onSuccess=r.noop),r.calibrator.isEmpty(e.channel))throw{code:400,content:"channel is required."};if(r.calibrator.isNumber(e.channel)&&(e.channel=e.channel.toString()),r.calibrator.isEmpty(e.message))throw{code:400,content:"message is required."};if(r.calibrator.isNumber(e.message)&&(e.message=e.message.toString()),!r.calibrator.isString(e.message))throw{code:400,content:"TypeError: message requires string."};if(e.message.length>2500)throw{code:400,content:"Message over max length 2500."};if(r.calibrator.isObject(e.notification)){if(r.calibrator.isEmpty(e.notification.title))throw{code:400,content:"notification.title is required."};if(!r.calibrator.isString(e.notification.title))throw{code:400,content:"TypeError: notification.title requires string."};if(e.notification.title.length>32)throw{code:400,content:"TypeError: notification.title over max length 32."};if(r.calibrator.isEmpty(e.notification.body))throw{code:400,content:"notification.body is required."};if(!r.calibrator.isString(e.notification.body))throw{code:400,content:"TypeError: notification.body must be string."};if(e.notification.body.length>50)throw{code:400,content:"notification.body over max length 50."}}else if(r.calibrator.isPrimitive(e.notification))throw{code:400,content:"TypeError: notification requires an object."};var t={channel:e.channel,content:e.message,nt:e.notification,at:e.accessToken,guid:r.UUID.get()},n=new i["default"]({name:s.EmitType.publish,params:t,singleTimeout:u.SocketTimeout.commonRequestSingle,totalTimeout:u.SocketTimeout.commonRequestTotal,permission:a["default"].WRITE,success:function(t){e.onSuccess({code:200,content:"ok"})},fail:function(t){e.onFailed({code:t.resultCode,content:t.content})}});this.pubSub.goEasySocket.emit(n)}}]),e}();t["default"]=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(0),i=h(n(3)),s=n(5),a=h(n(1)),u=h(n(138)),c=h(n(17)),l=n(4),f=h(n(9)),p=n(27),d=n(60);function h(e){return e&&e.__esModule?e:{"default":e}}var y=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.subscriptions=[],this.pubSub=null,this.pubSub=t}return o(e,[{key:"initialGoEasySocket",value:function(){var e=this.pubSub.goEasySocket;e.addMessageObserver(c["default"].message,this.onNewMessage.bind(this)),e.addExpiredReconnectedObserver(this.onExpiredReconnected.bind(this)),e.addConnectedObserver(this.onReconnected.bind(this))}},{key:"resubscribe",value:function(){var e=this.subscriptions.slice(0);this.subscriptions=[];for(var t=0;t<e.length;t++)0!=e[t].channels.length&&this.subscribe(e[t])}},{key:"onExpiredReconnected",value:function(){this.resubscribe()}},{key:"onReconnected",value:function(){this.pubSub.neverConnect||this.pubSub.goEasySocket.status==f["default"].RECONNECTED||this.resubscribe()}},{key:"onNewMessage",value:function(e){if(!(e.n.indexOf("_presence")>-1)){e.a&&this.pubSub.goEasySocket.sendAck("ack",{publishGuid:e.i});var t={time:e.t,channel:e.n,content:e.c};p.GoEasyEventCenter.fire(d.PUBSUB_INTERNAL_EVENTS.MESSAGE_RECEIVED,e),this.findSubscriptionByChannel(t.channel).onMessage(t)}}},{key:"formatOptions",value:function(e){var t=!r.calibrator.isEmpty(e.channel),n=!r.calibrator.isEmpty(e.channels);if(this.formatCallback(e),r.calibrator.isFunction(e.onMessage)||(e.onMessage=r.noop),!t&&!n)return e.onFailed({code:400,content:"channel is required"}),!1;if(!t||!n){if(t&&(r.calibrator.isNumber(e.channel)&&(e.channel=e.channel.toString()),e.channels=[e.channel]),n){if(!Array.isArray(e.channels)||0==e.channels.length)return void e.onFailed({code:400,content:"channels must be an array"});if(e.channels.length>500)return e.onFailed({code:400,content:"channels over max length:500"}),!1;for(var o=0,i=e.channels.length;o<i;o++)if(r.calibrator.isNumber(e.channels[o])&&(e.channels[o]=e.channels[o].toString()),r.calibrator.isEmpty(e.channels[o]))return e.onFailed({code:400,content:"Channels array contains empty channel"}),!1}return!0}e.onFailed({code:400,content:"subscribe to either channel or channels, not both"})}},{key:"formatCallback",value:function(e){r.calibrator.isFunction(e.onSuccess)||(e.onSuccess=r.noop),r.calibrator.isFunction(e.onFailed)||(e.onFailed=r.noop)}},{key:"subscribe",value:function(e){var t=this;if(this.formatOptions(e)){var n=new i["default"]({name:s.EmitType.subscribe,permission:a["default"].READ,singleTimeout:l.SocketTimeout.commonInfiniteSingle,totalTimeout:l.SocketTimeout.commonInfiniteTotal,params:{channels:e.channels,accessToken:e.accessToken},success:function(){var n=new u["default"]({channels:e.channels,accessToken:e.accessToken,onSuccess:e.onSuccess,onFailed:e.onFailed,onMessage:e.onMessage});t.subscriptions.push(n),e.onSuccess({code:200,content:"ok"})},fail:function(t){e.onFailed({code:t.resultCode,content:t.content})}});this.pubSub.goEasySocket.emit(n)}}},{key:"unsubscribe",value:function(e){var t=this;if(this.formatCallback(e),r.calibrator.isDef(e.channel))if(r.calibrator.isNumber(e.channel)&&(e.channel=e.channel.toString()),this.findSubscriptionByChannel(e.channel)){var n=new i["default"]({name:s.EmitType.unsubscribe,params:{channel:e.channel},permission:a["default"].READ,singleTimeout:l.SocketTimeout.commonRequestSingle,totalTimeout:l.SocketTimeout.commonRequestTotal,success:function(){e.onSuccess({code:200,content:"ok"}),t.removeChannel(e.channel)},fail:function(t){e.onFailed({code:t.resultCode,content:t.content})}});this.pubSub.goEasySocket.emit(n)}else e.onFailed({code:400,content:"channel["+e.channel+"] is not subscribed"});else e.onFailed({code:400,content:"channel is required"})}},{key:"removeChannel",value:function(e){for(var t=0;t<this.subscriptions.length;t++)for(var n=this.subscriptions[t].channels,o=0;o<n.length;o++)if(n[o]==e){this.subscriptions[t].channels.splice(o,1);break}}},{key:"findSubscriptionByChannel",value:function(e){for(var t=!1,n=null,o=this.subscriptions.length-1;o>=0;o--){for(var r=this.subscriptions[o].channels,i=0;i<r.length;i++)if(r[i]==e){t=!0,n=this.subscriptions[o];break}if(t)break}return n}}]),e}();t["default"]=y},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}();var r=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.channels=[],this.accessToken=null,this.onSuccess=null,this.onFailed=null,this.onMessage=null,this.channels=t.channels,this.accessToken=t.accessToken,this.onSuccess=t.onSuccess,this.onFailed=t.onFailed,this.onMessage=t.onMessage}return o(e,[{key:"empty",value:function(){}}]),e}();t["default"]=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=n(0),i=p(n(3)),s=n(5),a=p(n(1)),u=n(4),c=p(n(17)),l=p(n(140)),f=p(n(9));function p(e){return e&&e.__esModule?e:{"default":e}}var d=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.presenters=[],this.pubSub=null,this.pubSub=t}return o(e,[{key:"initialGoEasySocket",value:function(){var e=this.pubSub.goEasySocket;e.addMessageObserver(c["default"].message,this.onNewMessage.bind(this)),e.addExpiredReconnectedObserver(this.onExpiredReconnected.bind(this)),e.addConnectedObserver(this.onReconnected.bind(this))}},{key:"resubscribe",value:function(){var e=this.presenters.slice(0);this.presenters=[];for(var t=0;t<e.length;t++){for(var n=0;n<e[t].channels.length;n++){var o=e[t].channels[n].split("_presence");e[t].channels[n]=o[0]}0!=e[t].channels.length&&this.subscribePresence(e[t])}}},{key:"onExpiredReconnected",value:function(){this.resubscribe()}},{key:"onReconnected",value:function(){this.pubSub.neverConnect||this.pubSub.goEasySocket.status==f["default"].RECONNECTED||this.resubscribe()}},{key:"onNewMessage",value:function(e){if(-1!=e.n.indexOf("_presence")){var t=this.findPresenceByChannel(e.n);if(t){var n=JSON.parse(e.c);n.events=n.events.map(function(e){var t=e.userData?JSON.parse(e.userData):{};return{time:e.time,action:e.action,id:e.userId,data:t}}),t.onPresence(n)}}}},{key:"formatOptions",value:function(e){var t=!r.calibrator.isEmpty(e.channel),n=!r.calibrator.isEmpty(e.channels);if(this.formatCallback(e),r.calibrator.isFunction(e.onPresence)||(e.onPresence=r.noop),!t&&!n)return e.onFailed({code:400,content:"channel is required"}),!1;if(!t||!n){if(t&&(r.calibrator.isNumber(e.channel)&&(e.channel=e.channel.toString()),e.channels=[e.channel]),n){if(!Array.isArray(e.channels)||0==e.channels.length)return void e.onFailed({code:400,content:"channels must be an array"});if(e.channels.length>500)return e.onFailed({code:400,content:"channels over max length:500"}),!1;for(var o=0,i=e.channels.length;o<i;o++)if(r.calibrator.isNumber(e.channels[o])&&(e.channels[o]=e.channels[o].toString()),r.calibrator.isEmpty(e.channels[o]))return e.onFailed({code:400,content:"Channels array contains empty channel"}),!1}return!0}e.onFailed({code:400,content:"subscribe to either channel or channels, not both"})}},{key:"formatCallback",value:function(e){r.calibrator.isFunction(e.onSuccess)||(e.onSuccess=r.noop),r.calibrator.isFunction(e.onFailed)||(e.onFailed=r.noop)}},{key:"subscribePresence",value:function(e){var t=this;if(this.formatOptions(e)){Array.isArray(e.channels)&&(e.channels=e.channels.map(function(e){return e+="_presence"}));var n=new i["default"]({name:s.EmitType.subscribe,permission:a["default"].READ,singleTimeout:u.SocketTimeout.commonInfiniteSingle,totalTimeout:u.SocketTimeout.commonInfiniteTotal,params:{channels:e.channels},success:function(){var n=new l["default"]({channels:e.channels,onSuccess:e.onSuccess,onFailed:e.onFailed,onPresence:e.onPresence});t.presenters.push(n),e.onSuccess({code:200,content:"ok"})},fail:function(t){e.onFailed({code:t.resultCode,content:t.content})}});this.pubSub.goEasySocket.emit(n)}}},{key:"unsubscribePresence",value:function(e){var t=this;if(this.formatCallback(e),r.calibrator.isDef(e.channel))if(e.channel+="_presence",this.findPresenceByChannel(e.channel)){var n=new i["default"]({name:s.EmitType.unsubscribe,params:{channel:e.channel},permission:a["default"].READ,singleTimeout:u.SocketTimeout.commonRequestSingle,totalTimeout:u.SocketTimeout.commonRequestTotal,success:function(){e.onSuccess({code:200,content:"ok"}),t.removeChannel(e.channel)},fail:function(t){e.onFailed({code:t.resultCode,content:t.content})}});this.pubSub.goEasySocket.emit(n)}else e.onFailed({code:400,content:"channel["+e.channel+"] is not subscribed"});else e.onFailed({code:400,content:"channel is required"})}},{key:"removeChannel",value:function(e){for(var t=0;t<this.presenters.length;t++)for(var n=this.presenters[t].channels,o=0;o<n.length;o++)if(n[o]==e){this.presenters[t].channels.splice(o,1);break}}},{key:"findPresenceByChannel",value:function(e){for(var t=!1,n=null,o=this.presenters.length-1;o>=0;o--){for(var r=this.presenters[o].channels,i=0;i<r.length;i++)if(r[i]==e){t=!0,n=this.presenters[o];break}if(t)break}return n}}]),e}();t["default"]=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}();var r=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.channels=[],this.onSuccess=null,this.onFailed=null,this.onPresence=null,this.channels=t.channels,this.onSuccess=t.onSuccess,this.onFailed=t.onFailed,this.onPresence=t.onPresence}return o(e,[{key:"empty",value:function(){}}]),e}();t["default"]=r},function(e,t,n){"use strict";var o=this&&this.__read||function(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var o,r,i=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(o=i.next()).done;)s.push(o.value)}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i["return"])&&n.call(i)}finally{if(r)throw r.error}}return s};t.__esModule=!0,t.GoEasyNotification=void 0;var r=n(59),i=n(0),s=n(27),a=n(46),u=n(60),c=n(15),l=n(31),f=n(16),p=n(11),d=n(7),h=function(){function e(e){this.uniappPlugin=null,this.regIdPromise=null,this.onClickNotificationCallback=null,this.allowNotification=e,this.supportNotification()&&(this.uniappPlugin=uni.requireNativePlugin("GoEasy-Uniapp"),this.uniappPlugin?this.regIdPromise=this.askRegId():console.warn("No GoEasy-Uniapp Native Plugin."),this.listenNewMessage())}return e.prototype.listenNewMessage=function(){var e=this;s.GoEasyEventCenter.on(a.IM_INTERNAL_EVENTS.MESSAGE_RECEIVED,function(t){return e.onReceivedIMMessage(t)}),s.GoEasyEventCenter.on(u.PUBSUB_INTERNAL_EVENTS.MESSAGE_RECEIVED,function(t){return e.onReceivedPubSubMessage(t)})},e.prototype.onReceivedIMMessage=function(e){var t=this;if(i.calibrator.isObject(e.nt)&&r.uniApp.runningBackend()){var n=f["default"].assemble(e),s={id:n.messageId,tm:n.timestamp,t:n.type,sid:n.senderId,rid:n.receiverId,gid:n.groupId,tt:e.t,nt:e.nt,sd:null,gd:null};e.t===d.ConversationType.PRIVATE?p.im._dataCache.loadData(n.senderId,d.ConversationType.PRIVATE).then(function(e){s.sd=JSON.stringify(e),t.createLocalNotification(s)})["catch"](function(e){t.createLocalNotification(s)}):e.t===d.ConversationType.GROUP?Promise.all([p.im._dataCache.loadData(n.senderId,d.ConversationType.PRIVATE),p.im._dataCache.loadData(n.groupId,d.ConversationType.GROUP)]).then(function(e){var n=o(e,2),r=n[0],i=n[1];s.sd=JSON.stringify(r),s.gd=JSON.stringify(i),t.createLocalNotification(s)})["catch"](function(e){t.createLocalNotification(s)}):this.createLocalNotification(s)}},e.prototype.onReceivedPubSubMessage=function(e){if(i.calibrator.isObject(e.nt)&&r.uniApp.runningBackend()){var t={tm:e.t,ch:e.n,ctt:e.c,nt:e.nt};this.createLocalNotification(t)}},e.prototype.createLocalNotification=function(e){var t=e.nt.t,n=e.nt.c,o=Object.assign({title:t,body:n},e,{g:1});delete o.nt,i.calibrator.isObject(o)&&o.body&&o.title?this.uniappPlugin?this.uniappPlugin.createLocalNotification(o):"undefined"!=typeof plus&&plus.push.createMessage(o.body,JSON.stringify(o),{title:o.title}):console.warn("The notification message must contain the <title> and <body> fields")},e.prototype.askRegId=function(){var e=this,t=null,n=0,o=function(){return new Promise(function(r,i){e.uniappPlugin.regId(function(e){r(e)},function(r){if(!(1e6===r.data.code&&n<=10))return clearTimeout(t),i(r);t=setTimeout(function(){n++,e.regIdPromise=o()},3500)})})};return o()},e.prototype.getRegIdPromise=function(){return this.regIdPromise},e.prototype.supportNotification=function(){var e=l.PlatformDetector.currentPlatform(),t=c.FrameworkDetector.currentFramework();return this.allowNotification&&t===c.Framework.UNIAPP&&(e===l.Platform.APP_ANDROID||e===l.Platform.APP_IOS)},e.prototype.parseMessage=function(e){return e.ch?{channel:e.ch,content:e.ctt}:{messageId:e.id,timestamp:e.tm,type:e.t,senderId:e.sid,senderData:e.sd?JSON.parse(e.sd):undefined,toType:e.tt,groupId:e.gid,groupData:e.gd?JSON.parse(e.gd):undefined}},e.prototype.listenIOSUserNotificationClick=function(){var e=this;this.uniappPlugin.onClickNotification(function(t){if(e.availableIntent(t)){var n=e.parseMessage(t);plus.push.clear(),e.onClickNotificationCallback(n)}})},e.prototype.listenAndroidNewIntent=function(){var e=this;plus.globalEvent.addEventListener("newintent",function(){var t=plus.runtime.arguments;try{var n=JSON.parse(t);if(n=e.extactIntentIfXiaoMi(n),!e.availableIntent(n))return;var o=e.parseMessage(n);e.uniappPlugin.clearAll(),e.onClickNotificationCallback(o)}catch(r){}},!1)},e.prototype.listenPlusClickNotification=function(){var e=this;plus.push.addEventListener("click",function(t){if(t&&t.payload)try{var n="string"==typeof t.payload?JSON.parse(t.payload):t.payload,o=e.parseMessage(n);plus.push.clear(),e.onClickNotificationCallback(o)}catch(r){}})},e.prototype.listenGoEasyClickNotification=function(){var e=l.PlatformDetector.currentPlatform();e===l.Platform.APP_IOS?this.listenIOSUserNotificationClick():e===l.Platform.APP_ANDROID&&this.listenAndroidNewIntent(),this.getIntentData()},e.prototype.availableIntent=function(e){return e&&Object.keys(e).length&&e.g&&1===parseInt(e.g)},e.prototype.extactIntentIfXiaoMi=function(e){var t=/content=\{(\{.*\})\},/;if(e.key_message&&t.exec(e.key_message)){var n=e.key_message.match(t);e=n.length?JSON.parse(n[1]):null}return e},e.prototype.getIntentData=function(){var e=this;this.uniappPlugin.getIntentData(function(t){if(e.availableIntent(t)){var n=e.parseMessage(t),o=l.PlatformDetector.currentPlatform();o===l.Platform.APP_ANDROID?e.uniappPlugin.clearAll():o===l.Platform.APP_IOS&&plus.push.clear(),e.onClickNotificationCallback(n)}})},e.prototype.onClickNotification=function(e){if(this.supportNotification()){if(!i.calibrator.isFunction(e))throw new Error("The arguments must be a function.");null===this.onClickNotificationCallback?(this.onClickNotificationCallback=e,this.uniappPlugin?this.listenGoEasyClickNotification():this.listenPlusClickNotification()):console.warn("The onClickNotification event has been listened on. Please do not listen to it more than once.")}else console.warn("The current environment doesn't support or allowNotification is false.")},e}();t.GoEasyNotification=h}])["default"]});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/huoyanshanwangluo/stacked-chat-app.git
[email protected]:huoyanshanwangluo/stacked-chat-app.git
huoyanshanwangluo
stacked-chat-app
叠聚聊天APP
master

搜索帮助