1
0
Fork 0
Agora-Miniapp-Tutorial/lib/mini-app-sdk-production.js

15 lines
156 KiB
JavaScript

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("AgoraSDK",[],t):"object"==typeof exports?exports.AgoraSDK=t():e.AgoraSDK=t()}(window,(function(){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=54)}([function(e,t,i){"use strict";var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(r,s){function a(e){try{u(n.next(e))}catch(e){s(e)}}function o(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,o)}u((n=n.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const s=r(i(36)),a=i(5),o=r(i(1)),u=i(6),l=i(4),h=()=>{};class c extends s.default{constructor(e,t){super(),this._state=g.RELAY_STATE_IDLE,this._onStatus=e=>{o.default.debug(`[${this.clientId}] ChannelMediaStatus: ${JSON.stringify(e)}`),e&&e.command&&("onAudioPacketReceived"===e.command&&this.emit("event",v.PACKET_RECEIVED_AUDIO_FROM_SRC),"onVideoPacketReceived"===e.command&&this.emit("event",v.PACKET_RECEIVED_VIDEO_FROM_SRC),"onSrcTokenPrivilegeDidExpire"===e.command&&(this._state=g.RELAY_STATE_FAILURE,this.emit("state",g.RELAY_STATE_FAILURE,T.SRC_TOKEN_EXPIRED)),"onDestTokenPrivilegeDidExpire"===e.command&&(this._state=g.RELAY_STATE_FAILURE,this.emit("state",g.RELAY_STATE_FAILURE,T.DEST_TOKEN_EXPIRED,e.channelName?{came:e.channelName}:null)))},this._onClose=()=>n(this,void 0,void 0,(function*(){if(o.default.debug(`[${this.clientId}] ChannelMediaSocket onClose`),this.emit("event",v.NETWORK_DISCONNECTED),this.state=g.RELAY_STATE_IDLE,this._prevChannelMediaConfig)try{yield this.startChannelMediaRelay(this._prevChannelMediaConfig)}catch(e){if(e instanceof p&&(e.message===f.WS_ABORT||e.message===f.AP_REQUEST_ABORT))return;this.emit("state",g.RELAY_STATE_FAILURE,T.SERVER_CONNECTION_LOST)}})),this.token=e.appId,this.appId=e.appId,this.cname=e.cname,this.uid=e.uid,this.sid=e.sid,this.clientId=t}set state(e){const t=this._state;this._state=e,t!==e&&this.emit("state",e)}get state(){return this._state}startChannelMediaRelay(e){return n(this,void 0,void 0,(function*(){if(this.state!==g.RELAY_STATE_IDLE)throw new p(f.BAD_STATE);this.state=g.RELAY_STATE_CONNECTING,yield this._connect(),o.default.debug(`[${this.clientId}] startChannelMediaRelay: connect success`),yield this._sendStartRelayMessage(e),this._prevChannelMediaConfig=e}))}updateChannelMediaRelay(e){return n(this,void 0,void 0,(function*(){if(this.state!==g.RELAY_STATE_RUNNING)throw new p(f.BAD_STATE);yield this._sendUpdateMessage(e),this._prevChannelMediaConfig=e}))}stopChannelMediaRelay(){return n(this,void 0,void 0,(function*(){yield this._sendStopRelayMessage(),o.default.debug(`[${this.clientId}] stopChannelMediaRelay: send stop message success`),this.state=g.RELAY_STATE_IDLE,this.dispose()}))}dispose(){o.default.debug(`[${this.clientId}] disposeChannelMediaRelay`),this.state=g.RELAY_STATE_IDLE,this.emit("dispose"),this._signal&&this._signal.dispose(),this._prevChannelMediaConfig=null,this.removeEvent()}_requestOneAP(e){return new Promise((t,i)=>{const n={command:"convergeAllocateEdge",sid:this.sid,appId:this.appId,token:"",ts:+new Date,version:a.VERSION,cname:this.cname,uid:this.uid+"",seq:1,requestId:1},r={service_name:"tele_channel",json_body:JSON.stringify(n)},s="https://"+e;wx.request({url:s,data:r,header:{"content-type":"application/json","X-Packet-Service-Type":0,"X-Packet-URI":61},method:"POST",success:e=>{let n=null,r=null;try{n=e.data}catch(e){i(new p(f.AP_JSON_PARSE_ERROR,e))}0!==n.code&&i(new p(f.AP_REQUEST_ERROR,n));try{r=JSON.parse(n.json_body)}catch(e){i(new p(f.AP_JSON_PARSE_ERROR,e))}200!==r.code&&i(new p(f.AP_REQUEST_ERROR,r)),r.servers?t(r.servers):i(new p(f.AP_JSON_PARSE_ERROR,r))},fail:e=>i(e)})})}_requestAP(){const e=["uap-ap-web-1.agora.io","uap-ap-web-2.agoraio.cn","uap-ap-web-3.agora.io","uap-ap-web-4.agoraio.cn"];return new Promise((t,i)=>{setTimeout(()=>{i(new p(f.AP_REQUEST_TIMEOUT))},3e3),this.on("dispose",()=>{i(new p(f.AP_REQUEST_ABORT))}),e.forEach(e=>{e+="/api/v1",this._requestOneAP(e).then(i=>{o.default.debug(`[${this.clientId}] startChannelMediaRelay request AP ${e} success: ${JSON.stringify(i)}`);const n=i[0];let r=(e=n.address).split("."),s=r.length;const a=`wss://miniapp.agoraio.cn/${r[s-4]}-${r[s-3]}-${r[s-2]}-${r[s-1]}-${n.ws}/`;t(a)}).catch(t=>{o.default.debug(`[${this.clientId}] startChannelMediaRelay request AP ${e} failed: ${JSON.stringify(t)}`)})})})}_connectWebsocket(e){return this._signal=new d(this.appId,this.cname,this.uid,this.sid),this._signal.connect(e)}_connect(){return n(this,void 0,void 0,(function*(){const e=yield this._requestAP();yield this._connectWebsocket(e),this._signal.on("close",this._onClose.bind(this)),this._signal.on("status",this._onStatus.bind(this)),this.emit("event",v.NETWORK_CONNECTED)}))}_sendStartRelayMessage(e){return n(this,void 0,void 0,(function*(){this._checkSignal();const t=this._genMessage(y.StopPacketTransfer);yield Promise.all([this._signal.request(t),this._signal.waitStatus("Normal Quit")]),o.default.debug(`[${this.clientId}] startChannelMediaRelay: StopPacketTransfer success`);const i=this._genMessage(y.SetSdkProfile,e);yield this._signal.request(i),o.default.debug(`[${this.clientId}] startChannelMediaRelay: SetSdkProfile success`);const n=this._genMessage(y.SetSourceChannel,e);yield Promise.all([this._signal.request(n),this._signal.waitStatus("SetSourceChannelStatus")]),this.emit("event",v.PACKET_JOINED_SRC_CHANNEL),o.default.debug(`[${this.clientId}] startChannelMediaRelay: SetSourceChannel success`);const r=this._genMessage(y.SetSourceUserId,e);yield this._signal.request(r),o.default.debug(`[${this.clientId}] startChannelMediaRelay: SetSourceUserId success`);const s=this._genMessage(y.SetDestChannel,e);yield Promise.all([this._signal.request(s),this._signal.waitStatus("SetDestChannelStatus")]),this.emit("event",v.PACKET_JOINED_DEST_CHANNEL),o.default.debug(`[${this.clientId}] startChannelMediaRelay: SetDestChannel success`);const a=this._genMessage(y.StartPacketTransfer,e);yield this._signal.request(a),this.emit("event",v.PACKET_SENT_TO_DEST_CHANNEL),this.state=g.RELAY_STATE_RUNNING,o.default.debug(`[${this.clientId}] startChannelMediaRelay: StartPacketTransfer success`)}))}_sendReconnectMessage(e){return n(this,void 0,void 0,(function*(){this._checkSignal();const t=this._genMessage(y.Reconnect,e);yield this._signal.request(t)}))}_sendUpdateMessage(e){return n(this,void 0,void 0,(function*(){this._checkSignal();const t=this._genMessage(y.UpdateDestChannel,e);yield this._signal.request(t),this.emit("event",v.PACKET_UPDATE_DEST_CHANNEL),o.default.debug(`[${this.clientId}] sendUpdateMessage: UpdateDestChannel success`)}))}_sendStopRelayMessage(){return n(this,void 0,void 0,(function*(){this._checkSignal();const e=this._genMessage(y.StopPacketTransfer);yield this._signal.request(e),o.default.debug(`[${this.clientId}] sendStopRelayMessage: StopPacketTransfer success`)}))}_genMessage(e,t){const i=[],n=[],r=[],s={appId:this.appId,cname:this.cname,uid:this.uid+"",sdkVersion:a.VERSION,sid:this.sid,ts:+new Date,requestId:0,seq:0,allocate:!0,clientRequest:{}};let o=null,u=null;switch(e){case y.SetSdkProfile:return s.clientRequest={command:"SetSdkProfile",type:"multi_channel"},s;case y.SetSourceChannel:return u=t.getSrcChannelMediaInfo(),s.clientRequest={command:"SetSourceChannel",uid:u.uid+"",channelName:u.channelName,token:u.token||this.appId},s;case y.SetSourceUserId:return u=t.getSrcChannelMediaInfo(),s.clientRequest={command:"SetSourceUserId",uid:this.uid+""},s;case y.SetDestChannel:return o=t.getDestChannelMediaInfos(),o.forEach(e=>{i.push(e.channelName),n.push(e.uid+""),r.push(e.token||this.appId)}),s.clientRequest={command:"SetDestChannel",channelName:i,uid:n,token:r},s;case y.StartPacketTransfer:return s.clientRequest={command:"StartPacketTransfer"},s;case y.Reconnect:return s.clientRequest={command:"Reconnect"},s;case y.StopPacketTransfer:return s.clientRequest={command:"StopPacketTransfer"},s;case y.UpdateDestChannel:return o=t.getDestChannelMediaInfos(),o.forEach(e=>{i.push(e.channelName),n.push(e.uid+""),r.push(e.token||this.appId)}),s.clientRequest={command:"UpdateDestChannel",channelName:i,uid:n,token:r},s}}_checkSignal(){if(!this._signal||!this._signal.isConnect())throw new p(f.WS_DISCONNECTED)}}t.default=c;t.ChannelMediaRelayConfiguration=class{constructor(){this.destChannelMediaInfos=new Map}setSrcChannelInfo(e){u.checkValidObject(e,"srcInfo");const{uid:t,channelName:i,token:n}=e;if(n&&!u.isValidToken(n))throw new Error("Invalid token in SrcChannelInfo");if(!u.isValidChannelName(i))throw new Error("Invalid channelName in SrcChannelInfo");if(!l.is32Uint(t))throw new Error("Invalid uid in SrcChannelInfo");o.default.debug("[setSrcChannelInfo]: srcInfo: ",e),this.srcChannelMediaInfo=e}setDestChannelInfo(e,t){if(!u.isValidChannelName(e))throw new Error("Invalid channelName in DestChannelInfo");u.checkValidObject(t,"destInfo");const{uid:i,token:n}=t,r=t.channelName;if(n&&!u.isValidToken(n))throw new Error("Invalid token in DestChannelInfo");if(!u.isValidChannelName(r))throw new Error("Invalid channelName in DestChannelInfo");if(!l.is32Uint(i))throw new Error("Invalid uid in DestChannelInfo");o.default.debug("[setDestChannelInfo]: destInfo: ",t,"channelName: ",e),this.destChannelMediaInfos.set(e,t)}removeDestChannelInfo(e){if(!u.isValidChannelName(e))throw new Error("Invalid channelName when invoke removeDestChannelInfo");o.default.debug("[removeDestChannelInfo]: channelName: ",e),this.destChannelMediaInfos.delete(e)}getSrcChannelMediaInfo(){return this.srcChannelMediaInfo}getDestChannelMediaInfos(){return this.destChannelMediaInfos}};class d extends s.default{constructor(e,t,i,n){super(),this._onOpen=()=>{o.default.debug("[ChannelMediaRelay] onOpen"),this.emit("open")},this._onClose=e=>{o.default.debug("[ChannelMediaRelay] onClose"),this.emit("close"),this.dispose()},this._onMessage=e=>{o.default.blind("ChannelMediaRelay receive message",e);const t=JSON.parse(e.data);if(!t||"serverResponse"!==t.command||!t.requestId)return t&&"serverStatus"===t.command&&t.serverStatus&&t.serverStatus.command?(this.emit("status",t.serverStatus),void this.emit(t.serverStatus.command,t.serverStatus)):void 0;this.emit("req_"+t.requestId,t)},this._requestId=1,this.appId=e,this.cname=t,this.uid=i,this.sid=n}isConnect(){return this._ws&&1===this._ws.readyState}sendMessage(e){if(!this._ws||1!==this._ws.readyState)throw new p(f.WS_DISCONNECTED);const t=this._requestId++;return e.requestId=t,e.seq=t,this._ws.send({data:JSON.stringify(e)}),t}waitStatus(e){return new Promise((t,i)=>{const n=setTimeout(()=>{i(new p(f.WAIT_STATUS_TIMEOUT,e))},5e3);this.once(e,r=>{clearTimeout(n),r.state&&0!==r.state?i(new p(f.WAIT_STATUS_ERROR,e)):t()}),this.once("dispose",()=>{clearTimeout(n),i(new p(f.WS_ABORT))})})}request(e){return new Promise((t,i)=>{const n=this.sendMessage(e),r=setTimeout(()=>{this.removeAllListeners("req_"+n),i(new p(f.REQUEST_TIMEOUT))},3e3);this.once("req_"+n,e=>{clearTimeout(r),e&&200===e.code?t(e):i(new p(f.REQUEST_FAILED,e))}),this.once("dispose",()=>{clearTimeout(r),i(new p(f.WS_ABORT))})})}connect(e){return new Promise((t,i)=>{this._ws=wx.connectSocket({url:e}),this._ws.onOpen((i,n)=>{o.default.debug("[ChannelMediaRelay] ws.onOpen"),this._onOpen(),this._prvUrl=e,this._ws.onMessage(this._onMessage),this._ws.onClose(this._onClose),this._startHeartBeatCheck(),t()}),this._ws.onClose(e=>{o.default.debug("[ChannelMediaRelay] ws.onClose",e),this.dispose(),i(new p(f.CONNECT_FAILED,"websocket error code: "+e.code))}),setTimeout(()=>{this._ws&&1!==this._ws.readyState&&(this._ws.onMessage(h),this._ws.onClose(h),this._ws.close(),this._ws=null,i(new p(f.CONNECT_TIMEOUT)))},5e3),this.once("dispose",()=>{i(new p(f.WS_ABORT))})})}dispose(){o.default.debug("[ChannelMediaRelay] dispose"),this._clearHeartBeatCheck(),this.emit("dispose"),this.removeEvent(),this._ws&&(this._ws.onOpen(h),this._ws.onClose(h),this._ws.onMessage(h),this._ws.close(h)),this._ws=null}_sendPing(e){if(!this._ws||1!==this._ws.readyState)throw new p(f.WS_DISCONNECTED);const t=this._requestId++;return e.requestId=t,this._ws.send({data:JSON.stringify(e)}),t}_startHeartBeatCheck(){this._heartBeatTimer=setInterval(()=>{this._sendPing({command:"ping",appId:this.appId,cname:this.cname,uid:this.uid+"",sid:this.sid,ts:+new Date,requestId:0})},3e3)}_clearHeartBeatCheck(){clearInterval(this._heartBeatTimer)}}class p{constructor(e="",t,i){this.code=i,this.data=t,this.message=e}}var f,y,v,g,T;t.ChannelMediaError=p,function(e){e.CONNECT_FAILED="connect failed",e.CONNECT_TIMEOUT="connect timeout",e.WS_DISCONNECTED="websocket disconnected",e.REQUEST_TIMEOUT="request timeout",e.REQUEST_FAILED="request failed",e.WAIT_STATUS_TIMEOUT="wait status timeout",e.WAIT_STATUS_ERROR="wait status error",e.BAD_STATE="bad state",e.WS_ABORT="ws abort",e.AP_REQUEST_TIMEOUT="AP request timeout",e.AP_JSON_PARSE_ERROR="AP json parse error",e.AP_REQUEST_ERROR="AP request error",e.AP_REQUEST_ABORT="AP request abort"}(f=t.CHANNEL_MEDIA_ERROR||(t.CHANNEL_MEDIA_ERROR={})),function(e){e[e.SetSdkProfile=0]="SetSdkProfile",e[e.SetSourceChannel=1]="SetSourceChannel",e[e.SetSourceUserId=2]="SetSourceUserId",e[e.SetDestChannel=3]="SetDestChannel",e[e.StartPacketTransfer=4]="StartPacketTransfer",e[e.StopPacketTransfer=5]="StopPacketTransfer",e[e.UpdateDestChannel=6]="UpdateDestChannel",e[e.Reconnect=7]="Reconnect",e[e.SetVideoProfile=8]="SetVideoProfile"}(y||(y={})),function(e){e[e.NETWORK_DISCONNECTED=0]="NETWORK_DISCONNECTED",e[e.NETWORK_CONNECTED=1]="NETWORK_CONNECTED",e[e.PACKET_JOINED_SRC_CHANNEL=2]="PACKET_JOINED_SRC_CHANNEL",e[e.PACKET_JOINED_DEST_CHANNEL=3]="PACKET_JOINED_DEST_CHANNEL",e[e.PACKET_SENT_TO_DEST_CHANNEL=4]="PACKET_SENT_TO_DEST_CHANNEL",e[e.PACKET_RECEIVED_VIDEO_FROM_SRC=5]="PACKET_RECEIVED_VIDEO_FROM_SRC",e[e.PACKET_RECEIVED_AUDIO_FROM_SRC=6]="PACKET_RECEIVED_AUDIO_FROM_SRC",e[e.PACKET_UPDATE_DEST_CHANNEL=7]="PACKET_UPDATE_DEST_CHANNEL",e[e.PACKET_UPDATE_DEST_CHANNEL_REFUSED=8]="PACKET_UPDATE_DEST_CHANNEL_REFUSED",e[e.PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE=9]="PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE"}(v=t.CHANNEL_MEDIA_RELAY_EVENT||(t.CHANNEL_MEDIA_RELAY_EVENT={})),function(e){e[e.RELAY_STATE_IDLE=0]="RELAY_STATE_IDLE",e[e.RELAY_STATE_CONNECTING=1]="RELAY_STATE_CONNECTING",e[e.RELAY_STATE_RUNNING=2]="RELAY_STATE_RUNNING",e[e.RELAY_STATE_FAILURE=3]="RELAY_STATE_FAILURE"}(g=t.CHANNEL_MEDIA_RELAY_STATE||(t.CHANNEL_MEDIA_RELAY_STATE={})),function(e){e[e.RELAY_OK=0]="RELAY_OK",e[e.SERVER_ERROR_RESPONSE=1]="SERVER_ERROR_RESPONSE",e[e.SERVER_NO_RESPONSE=2]="SERVER_NO_RESPONSE",e[e.NO_RESOURCE_AVAILABLE=3]="NO_RESOURCE_AVAILABLE",e[e.FAILED_JOIN_SRC=4]="FAILED_JOIN_SRC",e[e.FAILED_JOIN_DEST=5]="FAILED_JOIN_DEST",e[e.FAILED_PACKET_RECEIVED_FROM_SRC=6]="FAILED_PACKET_RECEIVED_FROM_SRC",e[e.FAILED_PACKET_SENT_TO_DEST=7]="FAILED_PACKET_SENT_TO_DEST",e[e.SERVER_CONNECTION_LOST=8]="SERVER_CONNECTION_LOST",e[e.INTERNAL_ERROR=9]="INTERNAL_ERROR",e[e.SRC_TOKEN_EXPIRED=10]="SRC_TOKEN_EXPIRED",e[e.DEST_TOKEN_EXPIRED=11]="DEST_TOKEN_EXPIRED",e[e.RELAY_ALREADY_START=12]="RELAY_ALREADY_START",e[e.RELAY_NOT_START=13]="RELAY_NOT_START",e[e.OPERATION_ABORT=14]="OPERATION_ABORT"}(T=t.CHANNEL_MEDIA_RELAY_ERROR||(t.CHANNEL_MEDIA_RELAY_ERROR={}))},function(e,t,i){"use strict";i.r(t),i.d(t,"Log",(function(){return l}));var n=i(10),r=i.n(n),s=i(2),a=i.n(s),o=i(3),u=i.n(o),l=function(){function e(){a()(this,e),this.level=3,this.onLog=null}return u()(e,[{key:"setLogLevel",value:function(e){if("number"!=typeof e||!(e<=4&&e>=-1))throw Error("Invaild level");this.level=e}},{key:"log",value:function(){var e,t=Array.prototype.slice.call(arguments);this.onLog&&this.onLog(JSON.stringify(t)),(e=console).log.apply(e,r()(t))}},{key:"err",value:function(){var e,t=Array.prototype.slice.call(arguments);this.onLog&&this.onLog(JSON.stringify(t)),(e=console).error.apply(e,r()(t))}},{key:"blind",value:function(){var e=Array.prototype.slice.call(arguments);this.level<=-1&&this.log.apply(this,["".concat(new Date," [BLIND]: ")].concat(r()(e)))}},{key:"debug",value:function(){var e=Array.prototype.slice.call(arguments);this.level<=0&&this.log.apply(this,["".concat(new Date," [DEBUG]: ")].concat(r()(e)))}},{key:"info",value:function(e){this.level<=1&&this.log("".concat(new Date," [INFO]: ").concat(e))}},{key:"warn",value:function(e){this.level<=2&&this.log("".concat(new Date," [WARN]: ").concat(e))}},{key:"error",value:function(e){this.level<=3&&this.err("".concat(new Date," [ERROR]: ").concat(e))}}]),e}(),h=new l;t.default=h},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function i(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}},function(e,t,i){"use strict";i.r(t),i.d(t,"generateSessionId",(function(){return a})),i.d(t,"shouldUseHttps",(function(){return o})),i.d(t,"random",(function(){return s})),i.d(t,"isWeiXin",(function(){return u})),i.d(t,"is32Uint",(function(){return l}));var n=i(20),r=i.n(n),s=function(e){isNaN(e)&&(e=1e3);var t=+new Date,i=(t=(9301*t+49297)%233280)/233280;return Math.ceil(i*e)},a=function(){return r()().replace(/-/g,"").toUpperCase()},o=function(){return"https:"==document.location.protocol},u=function(){try{return wx,!0}catch(e){return!1}},l=function(e){return!!(0<=e&&e<=4294967295)}},function(e,t,i){"use strict";i.r(t),i.d(t,"VERSION",(function(){return n})),i.d(t,"SDK_VERSION",(function(){return r})),i.d(t,"DOMAIN_NAME",(function(){return s}));var n="1.1.0",r="2.5.3",s="mini-app.broadcastapp.agoraio.cn"},function(e,t,i){"use strict";i.r(t),i.d(t,"checkValidObject",(function(){return a})),i.d(t,"checkValidString",(function(){return o})),i.d(t,"checkValidNumber",(function(){return u})),i.d(t,"checkValidFloatNumber",(function(){return l})),i.d(t,"checkValidBoolean",(function(){return h})),i.d(t,"checkValidEnum",(function(){return s})),i.d(t,"isValidString",(function(){return c})),i.d(t,"isValidNumber",(function(){return d})),i.d(t,"isValidBoolean",(function(){return f})),i.d(t,"isASCII",(function(){return g})),i.d(t,"isInteger",(function(){return T})),i.d(t,"isNumber",(function(){return _})),i.d(t,"isString",(function(){return S})),i.d(t,"isArray",(function(){return m})),i.d(t,"isEmpty",(function(){return E})),i.d(t,"isValidToken",(function(){return y})),i.d(t,"isValidChannelName",(function(){return v}));var n=i(22),r=i.n(n),s=function(e,t,i){for(var n=0;n<i.length;n++)if(e===i[n])return!0;throw new Error("".concat(t," can only be set as ").concat(JSON.stringify(i)))},a=function(e,t){if(!e)throw new Error("Invalid param: ".concat(t||"param"," cannot be empty"));if("object"!==r()(e))throw new Error("".concat(t||"This paramter"," is of the object type"));return!0},o=function(e,t,i,n,r){if(E(i)&&(i=1),n=n||255,E(r)&&(r=!0),E(e))throw new Error("".concat(t||"param"," cannot be empty"));if(!c(e,i,n,r))throw new Error("Invalid ".concat(t||"string param",": Length of the string: [").concat(i,",").concat(n,"].").concat(r?" ASCII characters only.":""))},u=function(e,t,i,n){if(E(i)&&(i=1),n=n||1e4,E(e))throw new Error("".concat(t||"param"," cannot be empty"));if(!d(e,i,n))throw new Error("Invalid ".concat(t||"number param",": The value range is [").concat(i,",").concat(n,"]. integer only"))},l=function(e,t,i,n){if(null==e)throw new Error("".concat(t||"param"," cannot be null"));if(E(i)&&(i=0),n=n||1e4,E(e))throw new Error("".concat(t||"param"," cannot be empty"));if(!p(e,i,n))throw new Error("Invalid ".concat(t||"number param",": The value range is [").concat(i,",").concat(n,"]."))},h=function(e,t){if(E(e))throw new Error("".concat(t||"param"," cannot be empty"));if(!f(e))throw new Error("Invalid ".concat(t||"boolean param",": The value is of the boolean type."))},c=function(e,t,i,n){return t||(t=0),i||(i=Number.MAX_SAFE_INTEGER),E(n)&&(n=!0),S(e)&&(!n||g(e))&&e.length>=t&&e.length<=i},d=function(e,t,i){return T(e)&&e>=t&&e<=i},p=function(e,t,i){return _(e)&&e>=t&&e<=i},f=function(e){return"boolean"==typeof e},y=function(e){return c(e,1,2047)},v=function(e){return S(e)&&/^[a-zA-Z0-9 \!\#\$\%\&\(\)\+\-\:\;\<\=\.\>\?\@\[\]\^\_\{\}\|\~\,]{1,64}$/.test(e)},g=function(e){if("string"==typeof e){for(var t=0;t<e.length;t++){var i=e.charCodeAt(t);if(i<0||i>255)return!1}return!0}},T=function(e){return"number"==typeof e&&e%1==0},_=function(e){return"number"==typeof e},S=function(e){return"string"==typeof e},m=function(e){return e instanceof Array},E=function(e){return null==e}},function(e,t,i){"use strict";(function(e){var n=t;function r(e,t,i){for(var n=Object.keys(t),r=0;r<n.length;++r)void 0!==e[n[r]]&&i||(e[n[r]]=t[n[r]]);return e}function s(e){function t(e,i){if(!(this instanceof t))return new t(e,i);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),i&&r(this,i)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}n.asPromise=i(41),n.base64=i(42),n.EventEmitter=i(43),n.float=i(44),n.inquire=i(45),n.utf8=i(46),n.pool=i(47),n.LongBits=i(48),n.isNode=Boolean(void 0!==e&&e&&e.process&&e.process.versions&&e.process.versions.node),n.global=n.isNode&&e||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,n.emptyArray=Object.freeze?Object.freeze([]):[],n.emptyObject=Object.freeze?Object.freeze({}):{},n.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},n.isString=function(e){return"string"==typeof e||e instanceof String},n.isObject=function(e){return e&&"object"==typeof e},n.isset=n.isSet=function(e,t){var i=e[t];return!(null==i||!e.hasOwnProperty(t))&&("object"!=typeof i||(Array.isArray(i)?i.length:Object.keys(i).length)>0)},n.Buffer=function(){try{var e=n.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),n._Buffer_from=null,n._Buffer_allocUnsafe=null,n.newBuffer=function(e){return"number"==typeof e?n.Buffer?n._Buffer_allocUnsafe(e):new n.Array(e):n.Buffer?n._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},n.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,n.Long=n.global.dcodeIO&&n.global.dcodeIO.Long||n.global.Long||n.inquire("long"),n.key2Re=/^true|false|0|1$/,n.key32Re=/^-?(?:0|[1-9][0-9]*)$/,n.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,n.longToHash=function(e){return e?n.LongBits.from(e).toHash():n.LongBits.zeroHash},n.longFromHash=function(e,t){var i=n.LongBits.fromHash(e);return n.Long?n.Long.fromBits(i.lo,i.hi,t):i.toNumber(Boolean(t))},n.merge=r,n.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},n.newError=s,n.ProtocolError=s("ProtocolError"),n.oneOfGetter=function(e){for(var t={},i=0;i<e.length;++i)t[e[i]]=1;return function(){for(var e=Object.keys(this),i=e.length-1;i>-1;--i)if(1===t[e[i]]&&void 0!==this[e[i]]&&null!==this[e[i]])return e[i]}},n.oneOfSetter=function(e){return function(t){for(var i=0;i<e.length;++i)e[i]!==t&&delete this[e[i]]}},n.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},n._configure=function(){var e=n.Buffer;e?(n._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,i){return new e(t,i)},n._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):n._Buffer_from=n._Buffer_allocUnsafe=null}}).call(this,i(13))},function(e,t,i){e.exports=i(26)},function(module,__webpack_exports__,__webpack_require__){"use strict";__webpack_require__.r(__webpack_exports__);var Thrift={Version:"0.11.0",Type:{STOP:0,VOID:1,BOOL:2,BYTE:3,I08:3,DOUBLE:4,I16:6,I32:8,I64:10,STRING:11,UTF7:11,STRUCT:12,MAP:13,SET:14,LIST:15,UTF8:16,UTF16:17},MessageType:{CALL:1,REPLY:2,EXCEPTION:3,ONEWAY:4},objectLength:function(e){var t=0;for(var i in e)e.hasOwnProperty(i)&&t++;return t},inherits:function(e,t,i){function n(){}n.prototype=t.prototype,e.prototype=new n,e.prototype.name=i||""}},_copyList,_copyMap;Thrift.TException=function(e){this.message=e},Thrift.inherits(Thrift.TException,Error,"TException"),Thrift.TException.prototype.getMessage=function(){return this.message},Thrift.TApplicationExceptionType={UNKNOWN:0,UNKNOWN_METHOD:1,INVALID_MESSAGE_TYPE:2,WRONG_METHOD_NAME:3,BAD_SEQUENCE_ID:4,MISSING_RESULT:5,INTERNAL_ERROR:6,PROTOCOL_ERROR:7,INVALID_TRANSFORM:8,INVALID_PROTOCOL:9,UNSUPPORTED_CLIENT_TYPE:10},Thrift.TApplicationException=function(e,t){this.message=e,this.code="number"==typeof t?t:0},Thrift.inherits(Thrift.TApplicationException,Thrift.TException,"TApplicationException"),Thrift.TApplicationException.prototype.read=function(e){for(;;){var t=e.readFieldBegin();if(t.ftype==Thrift.Type.STOP)break;switch(t.fid){case 1:t.ftype==Thrift.Type.STRING?(t=e.readString(),this.message=t.value):t=e.skip(t.ftype);break;case 2:t.ftype==Thrift.Type.I32?(t=e.readI32(),this.code=t.value):t=e.skip(t.ftype);break;default:t=e.skip(t.ftype)}e.readFieldEnd()}e.readStructEnd()},Thrift.TApplicationException.prototype.write=function(e){e.writeStructBegin("TApplicationException"),this.message&&(e.writeFieldBegin("message",Thrift.Type.STRING,1),e.writeString(this.getMessage()),e.writeFieldEnd()),this.code&&(e.writeFieldBegin("type",Thrift.Type.I32,2),e.writeI32(this.code),e.writeFieldEnd()),e.writeFieldStop(),e.writeStructEnd()},Thrift.TApplicationException.prototype.getCode=function(){return this.code},Thrift.TProtocolExceptionType={UNKNOWN:0,INVALID_DATA:1,NEGATIVE_SIZE:2,SIZE_LIMIT:3,BAD_VERSION:4,NOT_IMPLEMENTED:5,DEPTH_LIMIT:6},Thrift.TProtocolException=function(e,t){Error.call(this),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.type=e,this.message=t},Thrift.inherits(Thrift.TProtocolException,Thrift.TException,"TProtocolException"),Thrift.Transport=Thrift.TXHRTransport=function(e,t){this.url=e,this.wpos=0,this.rpos=0,this.useCORS=t&&t.useCORS,this.customHeaders=t&&t.customHeaders?t.customHeaders:{},this.send_buf="",this.recv_buf=""},Thrift.TXHRTransport.prototype={getXmlHttpRequestObject:function(){try{return new XMLHttpRequest}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}throw"Your browser doesn't support XHR."},flush:function(e,t){var i=this;if(e&&!t||void 0===this.url||""===this.url)return this.send_buf;var n,r={};r.header={},r.method="POST",r.header.MediaType="application/vnd.apache.thrift.json; charset=utf-8",t&&(r.success=(n=t,function(e){if(i.responseText=JSON.stringify(e.data),i.setRecvBuffer(i.responseText),e&&200!==e.statusCode)return n(e.statusCode);n()}),r.fail=function(){var e=t;return function(t){e(t)}}()),Object.keys(i.customHeaders).forEach((function(e){r.header[e]=i.customHeaders[e]})),r.header.Accept="application/vnd.apache.thrift.json; charset=utf-8",r.header["Content-Type"]="application/vnd.apache.thrift.json; charset=utf-8",r.data=this.send_buf,r.url=this.url,wx.request(r)},jqRequest:function(e,t,i,n){if("undefined"==typeof jQuery||void 0===jQuery.Deferred)throw"Thrift.js requires jQuery 1.5+ to use asynchronous requests";var r=this;return jQuery.ajax({url:this.url,data:t,type:"POST",cache:!1,contentType:"application/vnd.apache.thrift.json; charset=utf-8",dataType:"text thrift",converters:{"text thrift":function(t){return r.setRecvBuffer(t),n.call(e)}},context:e,success:jQuery.makeArray(i).pop()})},setRecvBuffer:function(e){this.recv_buf=e,this.recv_buf_sz=this.recv_buf.length,this.wpos=this.recv_buf.length,this.rpos=0},isOpen:function(){return!0},open:function(){},close:function(){},read:function(e){var t=this.wpos-this.rpos;if(0===t)return"";var i=e;t<e&&(i=t);var n=this.read_buf.substr(this.rpos,i);return this.rpos+=i,n},readAll:function(){return this.recv_buf},write:function(e){this.send_buf=e},getSendBuffer:function(){return this.send_buf}},Thrift.TWebSocketTransport=function(e){this.__reset(e)},Thrift.TWebSocketTransport.prototype={__reset:function(e){this.url=e,this.socket=null,this.callbacks=[],this.send_pending=[],this.send_buf="",this.recv_buf="",this.rb_wpos=0,this.rb_rpos=0},flush:function(e,t){var i,n=this;this.isOpen()?(this.socket.send(this.send_buf),this.callbacks.push((i=t,function(e){n.setRecvBuffer(e),i()})),t&&this.callbacks.push(function(){var e=t;return function(t){n.setRecvBuffer(t),e()}}())):this.send_pending.push({buf:this.send_buf,cb:t})},__onOpen:function(){var e=this;this.send_pending.length>0&&(this.send_pending.forEach((function(t){var i;this.socket.send(t.buf),this.callbacks.push((i=t.cb,function(t){e.setRecvBuffer(t),i()}))})),this.send_pending=[])},__onClose:function(e){this.__reset(this.url)},__onMessage:function(e){this.callbacks.length&&this.callbacks.shift()(e.data)},__onError:function(e){console.log("Thrift WebSocket Error: "+e.toString()),this.socket.close()},setRecvBuffer:function(e){this.recv_buf=e,this.recv_buf_sz=this.recv_buf.length,this.wpos=this.recv_buf.length,this.rpos=0},isOpen:function(){return this.socket&&this.socket.readyState==this.socket.OPEN},open:function(){this.socket&&this.socket.readyState!=this.socket.CLOSED||(this.socket=new WebSocket(this.url),this.socket.onopen=this.__onOpen.bind(this),this.socket.onmessage=this.__onMessage.bind(this),this.socket.onerror=this.__onError.bind(this),this.socket.onclose=this.__onClose.bind(this))},close:function(){this.socket.close()},read:function(e){var t=this.wpos-this.rpos;if(0===t)return"";var i=e;t<e&&(i=t);var n=this.read_buf.substr(this.rpos,i);return this.rpos+=i,n},readAll:function(){return this.recv_buf},write:function(e){this.send_buf=e},getSendBuffer:function(){return this.send_buf}},Thrift.TJSONProtocol=Thrift.Protocol=function(e){this.tstack=[],this.tpos=[],this.transport=e},Thrift.Protocol.Type={},Thrift.Protocol.Type[Thrift.Type.BOOL]='"tf"',Thrift.Protocol.Type[Thrift.Type.BYTE]='"i8"',Thrift.Protocol.Type[Thrift.Type.I16]='"i16"',Thrift.Protocol.Type[Thrift.Type.I32]='"i32"',Thrift.Protocol.Type[Thrift.Type.I64]='"i64"',Thrift.Protocol.Type[Thrift.Type.DOUBLE]='"dbl"',Thrift.Protocol.Type[Thrift.Type.STRUCT]='"rec"',Thrift.Protocol.Type[Thrift.Type.STRING]='"str"',Thrift.Protocol.Type[Thrift.Type.MAP]='"map"',Thrift.Protocol.Type[Thrift.Type.LIST]='"lst"',Thrift.Protocol.Type[Thrift.Type.SET]='"set"',Thrift.Protocol.RType={},Thrift.Protocol.RType.tf=Thrift.Type.BOOL,Thrift.Protocol.RType.i8=Thrift.Type.BYTE,Thrift.Protocol.RType.i16=Thrift.Type.I16,Thrift.Protocol.RType.i32=Thrift.Type.I32,Thrift.Protocol.RType.i64=Thrift.Type.I64,Thrift.Protocol.RType.dbl=Thrift.Type.DOUBLE,Thrift.Protocol.RType.rec=Thrift.Type.STRUCT,Thrift.Protocol.RType.str=Thrift.Type.STRING,Thrift.Protocol.RType.map=Thrift.Type.MAP,Thrift.Protocol.RType.lst=Thrift.Type.LIST,Thrift.Protocol.RType.set=Thrift.Type.SET,Thrift.Protocol.Version=1,Thrift.Protocol.prototype={getTransport:function(){return this.transport},writeMessageBegin:function(e,t,i){this.tstack=[],this.tpos=[],this.tstack.push([Thrift.Protocol.Version,'"'+e+'"',t,i])},writeMessageEnd:function(){var e=this.tstack.pop();this.wobj=this.tstack.pop(),this.wobj.push(e),this.wbuf="["+this.wobj.join(",")+"]",this.transport.write(this.wbuf)},writeStructBegin:function(e){this.tpos.push(this.tstack.length),this.tstack.push({})},writeStructEnd:function(){var e=this.tpos.pop(),t=this.tstack[e],i="{",n=!0;for(var r in t)n?n=!1:i+=",",i+=r+":"+t[r];i+="}",this.tstack[e]=i},writeFieldBegin:function(e,t,i){this.tpos.push(this.tstack.length),this.tstack.push({fieldId:'"'+i+'"',fieldType:Thrift.Protocol.Type[t]})},writeFieldEnd:function(){var e=this.tstack.pop(),t=this.tstack.pop();this.tstack[this.tstack.length-1][t.fieldId]="{"+t.fieldType+":"+e+"}",this.tpos.pop()},writeFieldStop:function(){},writeMapBegin:function(e,t,i){this.tpos.push(this.tstack.length),this.tstack.push([Thrift.Protocol.Type[e],Thrift.Protocol.Type[t],0])},writeMapEnd:function(){var e=this.tpos.pop();if(e!=this.tstack.length){(this.tstack.length-e-1)%2!=0&&this.tstack.push("");var t=(this.tstack.length-e-1)/2;this.tstack[e][this.tstack[e].length-1]=t;for(var i="}",n=!0;this.tstack.length>e+1;){var r=this.tstack.pop(),s=this.tstack.pop();n?n=!1:i=","+i,isNaN(s)||(s='"'+s+'"'),i=s+":"+r+i}i="{"+i,this.tstack[e].push(i),this.tstack[e]="["+this.tstack[e].join(",")+"]"}},writeListBegin:function(e,t){this.tpos.push(this.tstack.length),this.tstack.push([Thrift.Protocol.Type[e],t])},writeListEnd:function(){for(var e=this.tpos.pop();this.tstack.length>e+1;){var t=this.tstack[e+1];this.tstack.splice(e+1,1),this.tstack[e].push(t)}this.tstack[e]="["+this.tstack[e].join(",")+"]"},writeSetBegin:function(e,t){this.tpos.push(this.tstack.length),this.tstack.push([Thrift.Protocol.Type[e],t])},writeSetEnd:function(){for(var e=this.tpos.pop();this.tstack.length>e+1;){var t=this.tstack[e+1];this.tstack.splice(e+1,1),this.tstack[e].push(t)}this.tstack[e]="["+this.tstack[e].join(",")+"]"},writeBool:function(e){this.tstack.push(e?1:0)},writeByte:function(e){this.tstack.push(e)},writeI16:function(e){this.tstack.push(e)},writeI32:function(e){this.tstack.push(e)},writeI64:function(e){this.tstack.push(e)},writeDouble:function(e){this.tstack.push(e)},writeString:function(e){if(null===e)this.tstack.push(null);else{for(var t="",i=0;i<e.length;i++){var n=e.charAt(i);t+='"'===n?'\\"':"\\"===n?"\\\\":"\b"===n?"\\b":"\f"===n?"\\f":"\n"===n?"\\n":"\r"===n?"\\r":"\t"===n?"\\t":n}this.tstack.push('"'+t+'"')}},writeBinary:function(e){var t="";if("string"==typeof e)t=e;else{if(!(e instanceof Uint8Array))throw new TypeError("writeBinary only accepts String or Uint8Array.");for(var i=e,n=0;n<i.length;++n)t+=String.fromCharCode(i[n])}this.tstack.push('"'+btoa(t)+'"')},readMessageBegin:function readMessageBegin(){if(this.rstack=[],this.rpos=[],"undefined"!=typeof JSON&&"function"==typeof JSON.parse){var a=this.transport.readAll();this.robj=JSON.parse(a)}else"undefined"!=typeof jQuery?this.robj=jQuery.parseJSON(this.transport.readAll()):this.robj=eval(this.transport.readAll());this.robj instanceof Array==0&&(this.robj=[this.robj]);var r={},version=this.robj.shift();if(version!=Thrift.Protocol.Version)throw"Wrong thrift protocol version: "+version;return r.fname=this.robj.shift(),r.mtype=this.robj.shift(),r.rseqid=this.robj.shift(),this.rstack.push(this.robj.shift()),r},readMessageEnd:function(){},readStructBegin:function(e){var t={fname:""};return this.rstack[this.rstack.length-1]instanceof Array&&this.rstack.push(this.rstack[this.rstack.length-1].shift()),t},readStructEnd:function(){this.rstack[this.rstack.length-2]instanceof Array&&this.rstack.pop()},readFieldBegin:function(){var e={},t=-1,i=Thrift.Type.STOP;for(var n in this.rstack[this.rstack.length-1])if(null!==n){t=parseInt(n,10),this.rpos.push(this.rstack.length);var r=this.rstack[this.rstack.length-1][t];delete this.rstack[this.rstack.length-1][t],this.rstack.push(r);break}if(-1!=t)for(var s in this.rstack[this.rstack.length-1])null!==Thrift.Protocol.RType[s]&&(i=Thrift.Protocol.RType[s],this.rstack[this.rstack.length-1]=this.rstack[this.rstack.length-1][s]);return e.fname="",e.ftype=i,e.fid=t,e},readFieldEnd:function(){for(var e=this.rpos.pop();this.rstack.length>e;)this.rstack.pop()},readMapBegin:function(){var e=this.rstack.pop(),t=e.shift();t instanceof Array&&(this.rstack.push(e),t=(e=t).shift());var i={};return i.ktype=Thrift.Protocol.RType[t],i.vtype=Thrift.Protocol.RType[e.shift()],i.size=e.shift(),this.rpos.push(this.rstack.length),this.rstack.push(e.shift()),i},readMapEnd:function(){this.readFieldEnd()},readListBegin:function(){var e=this.rstack[this.rstack.length-1],t={};return t.etype=Thrift.Protocol.RType[e.shift()],t.size=e.shift(),this.rpos.push(this.rstack.length),this.rstack.push(e.shift()),t},readListEnd:function(){this.readFieldEnd()},readSetBegin:function(e,t){return this.readListBegin(e,t)},readSetEnd:function(){return this.readListEnd()},readBool:function(){var e=this.readI32();return null!==e&&"1"==e.value?e.value=!0:e.value=!1,e},readByte:function(){return this.readI32()},readI16:function(){return this.readI32()},readI32:function(e){void 0===e&&(e=this.rstack[this.rstack.length-1]);var t={};if(e instanceof Array)0===e.length?t.value=void 0:t.value=e.shift();else if(e instanceof Object){for(var i in e)if(null!==i){this.rstack.push(e[i]),delete e[i],t.value=i;break}}else t.value=e,this.rstack.pop();return t},readI64:function(){return this.readI32()},readDouble:function(){return this.readI32()},readString:function(){return this.readI32()},readBinary:function(){var e=this.readI32();return e.value=atob(e.value),e},skip:function(e){var t,i;switch(e){case Thrift.Type.STOP:return null;case Thrift.Type.BOOL:return this.readBool();case Thrift.Type.BYTE:return this.readByte();case Thrift.Type.I16:return this.readI16();case Thrift.Type.I32:return this.readI32();case Thrift.Type.I64:return this.readI64();case Thrift.Type.DOUBLE:return this.readDouble();case Thrift.Type.STRING:return this.readString();case Thrift.Type.STRUCT:for(this.readStructBegin();(t=this.readFieldBegin()).ftype!=Thrift.Type.STOP;)this.skip(t.ftype),this.readFieldEnd();return this.readStructEnd(),null;case Thrift.Type.MAP:for(t=this.readMapBegin(),i=0;i<t.size;i++)i>0&&this.rstack.length>this.rpos[this.rpos.length-1]+1&&this.rstack.pop(),this.skip(t.ktype),this.skip(t.vtype);return this.readMapEnd(),null;case Thrift.Type.SET:for(t=this.readSetBegin(),i=0;i<t.size;i++)this.skip(t.etype);return this.readSetEnd(),null;case Thrift.Type.LIST:for(t=this.readListBegin(),i=0;i<t.size;i++)this.skip(t.etype);return this.readListEnd(),null}}},Thrift.MultiplexProtocol=function(e,t,i,n){Thrift.Protocol.call(this,t,i,n),this.serviceName=e},Thrift.inherits(Thrift.MultiplexProtocol,Thrift.Protocol,"multiplexProtocol"),Thrift.MultiplexProtocol.prototype.writeMessageBegin=function(e,t,i){t===Thrift.MessageType.CALL||t===Thrift.MessageType.ONEWAY?Thrift.Protocol.prototype.writeMessageBegin.call(this,this.serviceName+":"+e,t,i):Thrift.Protocol.prototype.writeMessageBegin.call(this,e,t,i)},Thrift.Multiplexer=function(){this.seqid=0},Thrift.Multiplexer.prototype.createClient=function(e,t,i){t.Client&&(t=t.Client);var n=this;return t.prototype.new_seqid=function(){return n.seqid+=1,n.seqid},new t(new Thrift.MultiplexProtocol(e,i))},_copyList=function(e,t){if(!e)return e;var i,n,r,s=i=void 0===t.shift?t:t[0],a=e.length,o=[];for(n=0;n<a;n++)r=e[n],null===i?o.push(r):i===_copyMap||i===_copyList?o.push(i(r,t.slice(1))):o.push(new s(r));return o},_copyMap=function(e,t){if(!e)return e;var i,n,r=i=void 0===t.shift?t:t[0],s={};for(var a in e)e.hasOwnProperty(a)&&(n=e[a],s[a]=null===i?n:i===_copyMap||i===_copyList?i(n,t.slice(1)):new r(n));return s},Thrift.copyMap=_copyMap,Thrift.copyList=_copyList,__webpack_exports__.default=Thrift},function(e,t,i){var n=i(27),r=i(28),s=i(29),a=i(30);e.exports=function(e){return n(e)||r(e)||s(e)||a()}},function(e,t,i){var n,r,s,a,o;n=i(34),r=i(15).utf8,s=i(35),a=i(15).bin,(o=function(e,t){e.constructor==String?e=t&&"binary"===t.encoding?a.stringToBytes(e):r.stringToBytes(e):s(e)?e=Array.prototype.slice.call(e,0):Array.isArray(e)||e.constructor===Uint8Array||(e=e.toString());for(var i=n.bytesToWords(e),u=8*e.length,l=1732584193,h=-271733879,c=-1732584194,d=271733878,p=0;p<i.length;p++)i[p]=16711935&(i[p]<<8|i[p]>>>24)|4278255360&(i[p]<<24|i[p]>>>8);i[u>>>5]|=128<<u%32,i[14+(u+64>>>9<<4)]=u;var f=o._ff,y=o._gg,v=o._hh,g=o._ii;for(p=0;p<i.length;p+=16){var T=l,_=h,S=c,m=d;l=f(l,h,c,d,i[p+0],7,-680876936),d=f(d,l,h,c,i[p+1],12,-389564586),c=f(c,d,l,h,i[p+2],17,606105819),h=f(h,c,d,l,i[p+3],22,-1044525330),l=f(l,h,c,d,i[p+4],7,-176418897),d=f(d,l,h,c,i[p+5],12,1200080426),c=f(c,d,l,h,i[p+6],17,-1473231341),h=f(h,c,d,l,i[p+7],22,-45705983),l=f(l,h,c,d,i[p+8],7,1770035416),d=f(d,l,h,c,i[p+9],12,-1958414417),c=f(c,d,l,h,i[p+10],17,-42063),h=f(h,c,d,l,i[p+11],22,-1990404162),l=f(l,h,c,d,i[p+12],7,1804603682),d=f(d,l,h,c,i[p+13],12,-40341101),c=f(c,d,l,h,i[p+14],17,-1502002290),l=y(l,h=f(h,c,d,l,i[p+15],22,1236535329),c,d,i[p+1],5,-165796510),d=y(d,l,h,c,i[p+6],9,-1069501632),c=y(c,d,l,h,i[p+11],14,643717713),h=y(h,c,d,l,i[p+0],20,-373897302),l=y(l,h,c,d,i[p+5],5,-701558691),d=y(d,l,h,c,i[p+10],9,38016083),c=y(c,d,l,h,i[p+15],14,-660478335),h=y(h,c,d,l,i[p+4],20,-405537848),l=y(l,h,c,d,i[p+9],5,568446438),d=y(d,l,h,c,i[p+14],9,-1019803690),c=y(c,d,l,h,i[p+3],14,-187363961),h=y(h,c,d,l,i[p+8],20,1163531501),l=y(l,h,c,d,i[p+13],5,-1444681467),d=y(d,l,h,c,i[p+2],9,-51403784),c=y(c,d,l,h,i[p+7],14,1735328473),l=v(l,h=y(h,c,d,l,i[p+12],20,-1926607734),c,d,i[p+5],4,-378558),d=v(d,l,h,c,i[p+8],11,-2022574463),c=v(c,d,l,h,i[p+11],16,1839030562),h=v(h,c,d,l,i[p+14],23,-35309556),l=v(l,h,c,d,i[p+1],4,-1530992060),d=v(d,l,h,c,i[p+4],11,1272893353),c=v(c,d,l,h,i[p+7],16,-155497632),h=v(h,c,d,l,i[p+10],23,-1094730640),l=v(l,h,c,d,i[p+13],4,681279174),d=v(d,l,h,c,i[p+0],11,-358537222),c=v(c,d,l,h,i[p+3],16,-722521979),h=v(h,c,d,l,i[p+6],23,76029189),l=v(l,h,c,d,i[p+9],4,-640364487),d=v(d,l,h,c,i[p+12],11,-421815835),c=v(c,d,l,h,i[p+15],16,530742520),l=g(l,h=v(h,c,d,l,i[p+2],23,-995338651),c,d,i[p+0],6,-198630844),d=g(d,l,h,c,i[p+7],10,1126891415),c=g(c,d,l,h,i[p+14],15,-1416354905),h=g(h,c,d,l,i[p+5],21,-57434055),l=g(l,h,c,d,i[p+12],6,1700485571),d=g(d,l,h,c,i[p+3],10,-1894986606),c=g(c,d,l,h,i[p+10],15,-1051523),h=g(h,c,d,l,i[p+1],21,-2054922799),l=g(l,h,c,d,i[p+8],6,1873313359),d=g(d,l,h,c,i[p+15],10,-30611744),c=g(c,d,l,h,i[p+6],15,-1560198380),h=g(h,c,d,l,i[p+13],21,1309151649),l=g(l,h,c,d,i[p+4],6,-145523070),d=g(d,l,h,c,i[p+11],10,-1120210379),c=g(c,d,l,h,i[p+2],15,718787259),h=g(h,c,d,l,i[p+9],21,-343485551),l=l+T>>>0,h=h+_>>>0,c=c+S>>>0,d=d+m>>>0}return n.endian([l,h,c,d])})._ff=function(e,t,i,n,r,s,a){var o=e+(t&i|~t&n)+(r>>>0)+a;return(o<<s|o>>>32-s)+t},o._gg=function(e,t,i,n,r,s,a){var o=e+(t&n|i&~n)+(r>>>0)+a;return(o<<s|o>>>32-s)+t},o._hh=function(e,t,i,n,r,s,a){var o=e+(t^i^n)+(r>>>0)+a;return(o<<s|o>>>32-s)+t},o._ii=function(e,t,i,n,r,s,a){var o=e+(i^(t|~n))+(r>>>0)+a;return(o<<s|o>>>32-s)+t},o._blocksize=16,o._digestsize=16,e.exports=function(e,t){if(null==e)throw new Error("Illegal argument "+e);var i=n.wordsToBytes(o(e,t));return t&&t.asBytes?i:t&&t.asString?a.bytesToString(i):n.bytesToHex(i)}},function(e,t){function i(e,t,i,n,r,s,a){try{var o=e[s](a),u=o.value}catch(e){return void i(e)}o.done?t(u):Promise.resolve(u).then(n,r)}e.exports=function(e){return function(){var t=this,n=arguments;return new Promise((function(r,s){var a=e.apply(t,n);function o(e){i(a,r,s,o,u,"next",e)}function u(e){i(a,r,s,o,u,"throw",e)}o(void 0)}))}}},function(e,t){var i;i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,n=new Array(t);i<t;i++)n[i]=e[i];return n}},function(e,t){var i={utf8:{stringToBytes:function(e){return i.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(i.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],i=0;i<e.length;i++)t.push(255&e.charCodeAt(i));return t},bytesToString:function(e){for(var t=[],i=0;i<e.length;i++)t.push(String.fromCharCode(e[i]));return t.join("")}}};e.exports=i},function(e,t,i){var n=i(9).default,r=i(38),s=r.MiniappSession,a=r.MiniappJoinChooseServer,o=r.MiniappConnectWebSocket,u=r.MiniappJoin,l=r.MiniappPublish,h=r.MiniappUnpublish,c=r.MiniappSubscribe,d=r.MiniappUnsubscribe,p=r.MiniappLeave,f=r.MiniappServerEvent,y=r.MiniappPusherState,v=r.MiniappPlayerState,g=function(e){this.uri=null,this.miniappSession=null,this.miniappJoinChooseServer=null,this.miniappConnectWebSocket=null,this.miniappJoin=null,this.miniappPublish=null,this.miniappUnpublish=null,this.miniappSubscribe=null,this.miniappUnsubscribe=null,this.miniappLeave=null,this.miniappServerEvent=null,this.miniappPusherState=null,this.miniappPlayerState=null,e&&(void 0!==e.uri&&null!==e.uri&&(this.uri=e.uri),void 0!==e.miniappSession&&null!==e.miniappSession&&(this.miniappSession=new s(e.miniappSession)),void 0!==e.miniappJoinChooseServer&&null!==e.miniappJoinChooseServer&&(this.miniappJoinChooseServer=new a(e.miniappJoinChooseServer)),void 0!==e.miniappConnectWebSocket&&null!==e.miniappConnectWebSocket&&(this.miniappConnectWebSocket=new o(e.miniappConnectWebSocket)),void 0!==e.miniappJoin&&null!==e.miniappJoin&&(this.miniappJoin=new u(e.miniappJoin)),void 0!==e.miniappPublish&&null!==e.miniappPublish&&(this.miniappPublish=new l(e.miniappPublish)),void 0!==e.miniappUnpublish&&null!==e.miniappUnpublish&&(this.miniappUnpublish=new h(e.miniappUnpublish)),void 0!==e.miniappSubscribe&&null!==e.miniappSubscribe&&(this.miniappSubscribe=new c(e.miniappSubscribe)),void 0!==e.miniappUnsubscribe&&null!==e.miniappUnsubscribe&&(this.miniappUnsubscribe=new d(e.miniappUnsubscribe)),void 0!==e.miniappLeave&&null!==e.miniappLeave&&(this.miniappLeave=new p(e.miniappLeave)),void 0!==e.miniappServerEvent&&null!==e.miniappServerEvent&&(this.miniappServerEvent=new f(e.miniappServerEvent)),void 0!==e.miniappPusherState&&null!==e.miniappPusherState&&(this.miniappPusherState=new y(e.miniappPusherState)),void 0!==e.miniappPlayerState&&null!==e.miniappPlayerState&&(this.miniappPlayerState=new v(e.miniappPlayerState)))};(g.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype),r=t.fid;if(i==n.Type.STOP)break;switch(r){case 1:i==n.Type.I32?this.uri=e.readI32().value:e.skip(i);break;case 8e3:i==n.Type.STRUCT?(this.miniappSession=new s,this.miniappSession.read(e)):e.skip(i);break;case 8001:i==n.Type.STRUCT?(this.miniappJoinChooseServer=new a,this.miniappJoinChooseServer.read(e)):e.skip(i);break;case 8002:i==n.Type.STRUCT?(this.miniappConnectWebSocket=new o,this.miniappConnectWebSocket.read(e)):e.skip(i);break;case 8003:i==n.Type.STRUCT?(this.miniappJoin=new u,this.miniappJoin.read(e)):e.skip(i);break;case 8004:i==n.Type.STRUCT?(this.miniappPublish=new l,this.miniappPublish.read(e)):e.skip(i);break;case 8005:i==n.Type.STRUCT?(this.miniappUnpublish=new h,this.miniappUnpublish.read(e)):e.skip(i);break;case 8006:i==n.Type.STRUCT?(this.miniappSubscribe=new c,this.miniappSubscribe.read(e)):e.skip(i);break;case 8007:i==n.Type.STRUCT?(this.miniappUnsubscribe=new d,this.miniappUnsubscribe.read(e)):e.skip(i);break;case 8008:i==n.Type.STRUCT?(this.miniappLeave=new p,this.miniappLeave.read(e)):e.skip(i);break;case 8009:i==n.Type.STRUCT?(this.miniappServerEvent=new f,this.miniappServerEvent.read(e)):e.skip(i);break;case 8010:i==n.Type.STRUCT?(this.miniappPusherStateEvent=new MiniappPusherStateEvent,this.miniappPusherStateEvent.read(e)):e.skip(i);break;case 8011:i==n.Type.STRUCT?(this.miniappPlayerStateEvent=new MiniappPlayerStateEvent,this.miniappPlayerStateEvent.read(e)):e.skip(i);break;default:e.skip(i)}e.readFieldEnd()}e.readStructEnd()},g.prototype.write=function(e){e.writeStructBegin("ReportItem"),null!==this.uri&&void 0!==this.uri&&(e.writeFieldBegin("uri",n.Type.I32,1),e.writeI32(this.uri),e.writeFieldEnd()),null!==this.miniappSession&&void 0!==this.miniappSession&&(e.writeFieldBegin("miniappSession",n.Type.STRUCT,8e3),this.miniappSession.write(e),e.writeFieldEnd()),null!==this.miniappJoinChooseServer&&void 0!==this.miniappJoinChooseServer&&(e.writeFieldBegin("miniappJoinChooseServer",n.Type.STRUCT,8001),this.miniappJoinChooseServer.write(e),e.writeFieldEnd()),null!==this.miniappConnectWebSocket&&void 0!==this.miniappConnectWebSocket&&(e.writeFieldBegin("miniappConnectWebSocket",n.Type.STRUCT,8002),this.miniappConnectWebSocket.write(e),e.writeFieldEnd()),null!==this.miniappJoin&&void 0!==this.miniappJoin&&(e.writeFieldBegin("miniappJoin",n.Type.STRUCT,8003),this.miniappJoin.write(e),e.writeFieldEnd()),null!==this.miniappPublish&&void 0!==this.miniappPublish&&(e.writeFieldBegin("miniappPublish",n.Type.STRUCT,8004),this.miniappPublish.write(e),e.writeFieldEnd()),null!==this.miniappUnpublish&&void 0!==this.miniappUnpublish&&(e.writeFieldBegin("miniappUnpublish",n.Type.STRUCT,8005),this.miniappUnpublish.write(e),e.writeFieldEnd()),null!==this.miniappSubscribe&&void 0!==this.miniappSubscribe&&(e.writeFieldBegin("miniappSubscribe",n.Type.STRUCT,8006),this.miniappSubscribe.write(e),e.writeFieldEnd()),null!==this.miniappUnsubscribe&&void 0!==this.miniappUnsubscribe&&(e.writeFieldBegin("miniappUnsubscribe",n.Type.STRUCT,8007),this.miniappUnsubscribe.write(e),e.writeFieldEnd()),null!==this.miniappLeave&&void 0!==this.miniappLeave&&(e.writeFieldBegin("miniappLeave",n.Type.STRUCT,8008),this.miniappLeave.write(e),e.writeFieldEnd()),null!==this.miniappServerEvent&&void 0!==this.miniappServerEvent&&(e.writeFieldBegin("miniappServerEvent",n.Type.STRUCT,8009),this.miniappServerEvent.write(e),e.writeFieldEnd()),null!==this.miniappPusherStateEvent&&void 0!==this.miniappPusherStateEvent&&(e.writeFieldBegin("miniappPusherStateEvent",n.Type.STRUCT,8010),this.miniappPusherStateEvent.write(e),e.writeFieldEnd()),null!==this.miniappPlayerStateEvent&&void 0!==this.miniappPlayerStateEvent&&(e.writeFieldBegin("miniappPlayerStateEvent",n.Type.STRUCT,8011),this.miniappPlayerStateEvent.write(e),e.writeFieldEnd()),e.writeFieldStop(),e.writeStructEnd()},e.exports=g},function(e,t,i){var n=i(9).default,r=function(e){this.sid=null,this.cname=null,this.cid=null,this.lts=null,this.ip=null,this.uid=null,this.success=null,this.elapse=null,this.peer=null,e&&(void 0!==e.sid&&null!==e.sid&&(this.sid=e.sid),void 0!==e.cname&&null!==e.cname&&(this.cname=e.cname),void 0!==e.cid&&null!==e.cid&&(this.cid=e.cid),void 0!==e.lts&&null!==e.lts&&(this.lts=e.lts),void 0!==e.ip&&null!==e.ip&&(this.ip=e.ip),void 0!==e.uid&&null!==e.uid&&(this.uid=e.uid),void 0!==e.success&&null!==e.success&&(this.success=e.success),void 0!==e.elapse&&null!==e.elapse&&(this.elapse=e.elapse),void 0!==e.peer&&null!==e.peer&&(this.peer=e.peer))};(r.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype),r=t.fid;if(i==n.Type.STOP)break;switch(r){case 1:i==n.Type.STRING?this.sid=e.readString().value:e.skip(i);break;case 2:i==n.Type.STRING?this.cname=e.readString().value:e.skip(i);break;case 3:i==n.Type.I64?this.cid=e.readI64().value:e.skip(i);break;case 4:i==n.Type.I64?this.lts=e.readI64().value:e.skip(i);break;case 5:i==n.Type.STRING?this.ip=e.readString().value:e.skip(i);break;case 6:i==n.Type.I64?this.uid=e.readI64().value:e.skip(i);break;case 7:i==n.Type.BOOL?this.success=e.readBool().value:e.skip(i);break;case 8:i==n.Type.I64?this.elapse=e.readI64().value:e.skip(i);break;case 9:i==n.Type.I64?this.peer=e.readI64().value:e.skip(i);break;default:e.skip(i)}e.readFieldEnd()}e.readStructEnd()},r.prototype.write=function(e){e.writeStructBegin("VosdkHeader"),null!==this.sid&&void 0!==this.sid&&(e.writeFieldBegin("sid",n.Type.STRING,1),e.writeString(this.sid),e.writeFieldEnd()),null!==this.cname&&void 0!==this.cname&&(e.writeFieldBegin("cname",n.Type.STRING,2),e.writeString(this.cname),e.writeFieldEnd()),null!==this.cid&&void 0!==this.cid&&(e.writeFieldBegin("cid",n.Type.I64,3),e.writeI64(this.cid),e.writeFieldEnd()),null!==this.lts&&void 0!==this.lts&&(e.writeFieldBegin("lts",n.Type.I64,4),e.writeI64(this.lts),e.writeFieldEnd()),null!==this.ip&&void 0!==this.ip&&(e.writeFieldBegin("ip",n.Type.STRING,5),e.writeString(this.ip),e.writeFieldEnd()),null!==this.uid&&void 0!==this.uid&&(e.writeFieldBegin("uid",n.Type.I64,6),e.writeI64(this.uid),e.writeFieldEnd()),null!==this.success&&void 0!==this.success&&(e.writeFieldBegin("success",n.Type.BOOL,7),e.writeBool(this.success),e.writeFieldEnd()),null!==this.elapse&&void 0!==this.elapse&&(e.writeFieldBegin("elapse",n.Type.I64,8),e.writeI64(this.elapse),e.writeFieldEnd()),null!==this.peer&&void 0!==this.peer&&(e.writeFieldBegin("peer",n.Type.I64,9),e.writeI64(this.peer),e.writeFieldEnd()),e.writeFieldStop(),e.writeStructEnd()};var s=function(e){this.name=null,this.lts=null,this.value=null,this.id=null,this.tagErrorCode=null,e&&(void 0!==e.name&&null!==e.name&&(this.name=e.name),void 0!==e.lts&&null!==e.lts&&(this.lts=e.lts),void 0!==e.value&&null!==e.value&&(this.value=e.value),void 0!==e.id&&null!==e.id&&(this.id=e.id),void 0!==e.tagErrorCode&&null!==e.tagErrorCode&&(this.tagErrorCode=e.tagErrorCode))};(s.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype),r=t.fid;if(i==n.Type.STOP)break;switch(r){case 1:i==n.Type.STRING?this.name=e.readString().value:e.skip(i);break;case 2:i==n.Type.I64?this.lts=e.readI64().value:e.skip(i);break;case 3:i==n.Type.I32?this.value=e.readI32().value:e.skip(i);break;case 4:i==n.Type.I32?this.id=e.readI32().value:e.skip(i);break;case 5:i==n.Type.I32?this.tagErrorCode=e.readI32().value:e.skip(i);break;default:e.skip(i)}e.readFieldEnd()}e.readStructEnd()},s.prototype.write=function(e){e.writeStructBegin("VosdkCounterItem"),null!==this.name&&void 0!==this.name&&(e.writeFieldBegin("name",n.Type.STRING,1),e.writeString(this.name),e.writeFieldEnd()),null!==this.lts&&void 0!==this.lts&&(e.writeFieldBegin("lts",n.Type.I64,2),e.writeI64(this.lts),e.writeFieldEnd()),null!==this.value&&void 0!==this.value&&(e.writeFieldBegin("value",n.Type.I32,3),e.writeI32(this.value),e.writeFieldEnd()),null!==this.id&&void 0!==this.id&&(e.writeFieldBegin("id",n.Type.I32,4),e.writeI32(this.id),e.writeFieldEnd()),null!==this.tagErrorCode&&void 0!==this.tagErrorCode&&(e.writeFieldBegin("tagErrorCode",n.Type.I32,5),e.writeI32(this.tagErrorCode),e.writeFieldEnd()),e.writeFieldStop(),e.writeStructEnd()};var a=function(e){this.header=null,this.items=null,e&&(void 0!==e.header&&null!==e.header&&(this.header=new r(e.header)),void 0!==e.items&&null!==e.items&&(this.items=n.copyList(e.items,[s])))};(a.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype),a=t.fid;if(i==n.Type.STOP)break;switch(a){case 1:i==n.Type.STRUCT?(this.header=new r,this.header.read(e)):e.skip(i);break;case 2:if(i==n.Type.LIST){var o,u;this.items=[];(u=e.readListBegin()).etype,o=u.size;for(var l=0;l<o;++l){var h=null;(h=new s).read(e),this.items.push(h)}e.readListEnd()}else e.skip(i);break;default:e.skip(i)}e.readFieldEnd()}e.readStructEnd()},a.prototype.write=function(e){if(e.writeStructBegin("VosdkCounter"),null!==this.header&&void 0!==this.header&&(e.writeFieldBegin("header",n.Type.STRUCT,1),this.header.write(e),e.writeFieldEnd()),null!==this.items&&void 0!==this.items){for(var t in e.writeFieldBegin("items",n.Type.LIST,2),e.writeListBegin(n.Type.STRUCT,this.items.length),this.items)this.items.hasOwnProperty(t)&&(t=this.items[t]).write(e);e.writeListEnd(),e.writeFieldEnd()}e.writeFieldStop(),e.writeStructEnd()},e.exports={VosdkHeader:r,VosdkCounter:a,VosdkCounterItem:s}},function(e,t,i){"use strict";e.exports=c;var n,r=i(7),s=r.LongBits,a=r.base64,o=r.utf8;function u(e,t,i){this.fn=e,this.len=t,this.next=void 0,this.val=i}function l(){}function h(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function c(){this.len=0,this.head=new u(l,0,0),this.tail=this.head,this.states=null}var d=function(){return r.Buffer?function(){return(c.create=function(){return new n})()}:function(){return new c}};function p(e,t,i){t[i]=255&e}function f(e,t){this.len=e,this.next=void 0,this.val=t}function y(e,t,i){for(;e.hi;)t[i++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[i++]=127&e.lo|128,e.lo=e.lo>>>7;t[i++]=e.lo}function v(e,t,i){t[i]=255&e,t[i+1]=e>>>8&255,t[i+2]=e>>>16&255,t[i+3]=e>>>24}c.create=d(),c.alloc=function(e){return new r.Array(e)},r.Array!==Array&&(c.alloc=r.pool(c.alloc,r.Array.prototype.subarray)),c.prototype._push=function(e,t,i){return this.tail=this.tail.next=new u(e,t,i),this.len+=t,this},f.prototype=Object.create(u.prototype),f.prototype.fn=function(e,t,i){for(;e>127;)t[i++]=127&e|128,e>>>=7;t[i]=e},c.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new f((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},c.prototype.int32=function(e){return e<0?this._push(y,10,s.fromNumber(e)):this.uint32(e)},c.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},c.prototype.uint64=function(e){var t=s.from(e);return this._push(y,t.length(),t)},c.prototype.int64=c.prototype.uint64,c.prototype.sint64=function(e){var t=s.from(e).zzEncode();return this._push(y,t.length(),t)},c.prototype.bool=function(e){return this._push(p,1,e?1:0)},c.prototype.fixed32=function(e){return this._push(v,4,e>>>0)},c.prototype.sfixed32=c.prototype.fixed32,c.prototype.fixed64=function(e){var t=s.from(e);return this._push(v,4,t.lo)._push(v,4,t.hi)},c.prototype.sfixed64=c.prototype.fixed64,c.prototype.float=function(e){return this._push(r.float.writeFloatLE,4,e)},c.prototype.double=function(e){return this._push(r.float.writeDoubleLE,8,e)};var g=r.Array.prototype.set?function(e,t,i){t.set(e,i)}:function(e,t,i){for(var n=0;n<e.length;++n)t[i+n]=e[n]};c.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(p,1,0);if(r.isString(e)){var i=c.alloc(t=a.length(e));a.decode(e,i,0),e=i}return this.uint32(t)._push(g,t,e)},c.prototype.string=function(e){var t=o.length(e);return t?this.uint32(t)._push(o.write,t,e):this._push(p,1,0)},c.prototype.fork=function(){return this.states=new h(this),this.head=this.tail=new u(l,0,0),this.len=0,this},c.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new u(l,0,0),this.len=0),this},c.prototype.ldelim=function(){var e=this.head,t=this.tail,i=this.len;return this.reset().uint32(i),i&&(this.tail.next=e.next,this.tail=t,this.len+=i),this},c.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),i=0;e;)e.fn(e.val,t,i),i+=e.len,e=e.next;return t},c._configure=function(e){n=e,c.create=d(),n._configure()}},function(e,t,i){"use strict";e.exports=u;var n,r=i(7),s=r.LongBits,a=r.utf8;function o(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function u(e){this.buf=e,this.pos=0,this.len=e.length}var l,h="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new u(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new u(e);throw Error("illegal buffer")},c=function(){return r.Buffer?function(e){return(u.create=function(e){return r.Buffer.isBuffer(e)?new n(e):h(e)})(e)}:h};function d(){var e=new s(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw o(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw o(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function p(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw o(this,8);return new s(p(this.buf,this.pos+=4),p(this.buf,this.pos+=4))}u.create=c(),u.prototype._slice=r.Array.prototype.subarray||r.Array.prototype.slice,u.prototype.uint32=(l=4294967295,function(){if(l=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return l;if(l=(l|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return l;if((this.pos+=5)>this.len)throw this.pos=this.len,o(this,10);return l}),u.prototype.int32=function(){return 0|this.uint32()},u.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},u.prototype.bool=function(){return 0!==this.uint32()},u.prototype.fixed32=function(){if(this.pos+4>this.len)throw o(this,4);return p(this.buf,this.pos+=4)},u.prototype.sfixed32=function(){if(this.pos+4>this.len)throw o(this,4);return 0|p(this.buf,this.pos+=4)},u.prototype.float=function(){if(this.pos+4>this.len)throw o(this,4);var e=r.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},u.prototype.double=function(){if(this.pos+8>this.len)throw o(this,4);var e=r.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},u.prototype.bytes=function(){var e=this.uint32(),t=this.pos,i=this.pos+e;if(i>this.len)throw o(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,i):t===i?new this.buf.constructor(0):this._slice.call(this.buf,t,i)},u.prototype.string=function(){var e=this.bytes();return a.read(e,0,e.length)},u.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw o(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw o(this)}while(128&this.buf[this.pos++]);return this},u.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},u._configure=function(e){n=e,u.create=c(),n._configure();var t=r.Long?"toLong":"toNumber";r.merge(u.prototype,{int64:function(){return d.call(this)[t](!1)},uint64:function(){return d.call(this)[t](!0)},sint64:function(){return d.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},function(e,t,i){var n=i(24),r=i(25);e.exports=function(e,t,i){var s=t&&i||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||n)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var o=0;o<16;++o)t[s+o]=a[o];return t||r(a)}},function(e,t){function i(){return e.exports=i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},i.apply(this,arguments)}e.exports=i},function(e,t){function i(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=i=function(e){return typeof e}:e.exports=i=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i(t)}e.exports=i},function(e,t,i){"use strict";var n,r,s,a,o,u=i(39),l=u.Writer,h=u.util,c=u.roots.default||(u.roots.default={});c.io=((o={}).agora=((a={}).pb=((s={}).CounterCompact=function(){function e(e){if(this.items=[],e)for(var t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.sid="",e.prototype.peer=h.Long?h.Long.fromBits(0,0,!1):0,e.prototype.items=h.emptyArray,e.create=function(t){return new e(t)},e.encode=function(e,t){if(t||(t=l.create()),null!=e.sid&&Object.hasOwnProperty.call(e,"sid")&&t.uint32(10).string(e.sid),null!=e.peer&&Object.hasOwnProperty.call(e,"peer")&&t.uint32(16).int64(e.peer),null!=e.items&&e.items.length)for(var i=0;i<e.items.length;++i)c.io.agora.pb.Item.encode(e.items[i],t.uint32(26).fork()).ldelim();return t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e}(),s.Item=function(){function e(e){if(e)for(var t=Object.keys(e),i=0;i<t.length;++i)null!=e[t[i]]&&(this[t[i]]=e[t[i]])}return e.prototype.lts=h.Long?h.Long.fromBits(0,0,!1):0,e.prototype.id=11001,e.prototype.value=0,e.prototype.tagErrorCode=0,e.prototype.streamId=0,e.create=function(t){return new e(t)},e.encode=function(e,t){return t||(t=l.create()),null!=e.lts&&Object.hasOwnProperty.call(e,"lts")&&t.uint32(8).int64(e.lts),null!=e.id&&Object.hasOwnProperty.call(e,"id")&&t.uint32(16).int32(e.id),null!=e.value&&Object.hasOwnProperty.call(e,"value")&&t.uint32(24).int32(e.value),null!=e.tagErrorCode&&Object.hasOwnProperty.call(e,"tagErrorCode")&&t.uint32(32).int32(e.tagErrorCode),null!=e.streamId&&Object.hasOwnProperty.call(e,"streamId")&&t.uint32(40).uint32(e.streamId),t},e.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},e}(),s.Id=(n={},(r=Object.create(n))[n[11001]="Miniapp_SDK_Pusher_Video_Bitrate"]=11001,r[n[11002]="Miniapp_SDK_Pusher_Audio_Bitrate"]=11002,r[n[11003]="Miniapp_SDK_Pusher_Video_FPS"]=11003,r[n[11004]="Miniapp_SDK_Pusher_Video_GOP"]=11004,r[n[11005]="Miniapp_SDK_Pusher_Net_Speed"]=11005,r[n[11006]="Miniapp_SDK_Pusher_Video_Cache"]=11006,r[n[11007]="Miniapp_SDK_Pusher_Audio_Cache"]=11007,r[n[11008]="Miniapp_SDK_Player_Video_Bitrate"]=11008,r[n[11009]="Miniapp_SDK_Player_Audio_Bitrate"]=11009,r[n[11010]="Miniapp_SDK_Player_Video_FPS"]=11010,r[n[11011]="Miniapp_SDK_Player_Video_GOP"]=11011,r[n[11012]="Miniapp_SDK_Player_Net_Speed"]=11012,r[n[11013]="Miniapp_SDK_Player_Video_Cache"]=11013,r[n[11014]="Miniapp_SDK_Player_Audio_Cache"]=11014,r[n[11015]="Miniapp_SDK_Player_V_Dec_Cache_Size"]=11015,r[n[11016]="Miniapp_SDK_Player_V_Sum_Cache_Size"]=11016,r[n[11017]="Miniapp_SDK_Player_AV_Play_Interval"]=11017,r[n[11018]="Miniapp_SDK_Player_AV_Recv_Interval"]=11018,r[n[11019]="Miniapp_SDK_Player_Audio_Cache_Threshold"]=11019,r[n[11022]="Miniapp_SDK_Pusher_Video_Height"]=11022,r[n[11023]="Miniapp_SDK_Pusher_Video_Width"]=11023,r[n[11024]="Miniapp_SDK_Player_Video_Width"]=11024,r[n[11025]="Miniapp_SDK_Player_Video_Height"]=11025,r),s),a),o),e.exports=c},function(e,t){var i="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(i){var n=new Uint8Array(16);e.exports=function(){return i(n),n}}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 i=[],n=0;n<256;++n)i[n]=(n+256).toString(16).substr(1);e.exports=function(e,t){var n=t||0,r=i;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}},function(e,t,i){var n=function(e){"use strict";var t=Object.prototype,i=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",s=n.asyncIterator||"@@asyncIterator",a=n.toStringTag||"@@toStringTag";function o(e,t,i,n){var r=t&&t.prototype instanceof h?t:h,s=Object.create(r.prototype),a=new E(n||[]);return s._invoke=function(e,t,i){var n="suspendedStart";return function(r,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===r)throw s;return R()}for(i.method=r,i.arg=s;;){var a=i.delegate;if(a){var o=_(a,i);if(o){if(o===l)continue;return o}}if("next"===i.method)i.sent=i._sent=i.arg;else if("throw"===i.method){if("suspendedStart"===n)throw n="completed",i.arg;i.dispatchException(i.arg)}else"return"===i.method&&i.abrupt("return",i.arg);n="executing";var h=u(e,t,i);if("normal"===h.type){if(n=i.done?"completed":"suspendedYield",h.arg===l)continue;return{value:h.arg,done:i.done}}"throw"===h.type&&(n="completed",i.method="throw",i.arg=h.arg)}}}(e,i,a),s}function u(e,t,i){try{return{type:"normal",arg:e.call(t,i)}}catch(e){return{type:"throw",arg:e}}}e.wrap=o;var l={};function h(){}function c(){}function d(){}var p={};p[r]=function(){return this};var f=Object.getPrototypeOf,y=f&&f(f(w([])));y&&y!==t&&i.call(y,r)&&(p=y);var v=d.prototype=h.prototype=Object.create(p);function g(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function T(e,t){var n;this._invoke=function(r,s){function a(){return new t((function(n,a){!function n(r,s,a,o){var l=u(e[r],e,s);if("throw"!==l.type){var h=l.arg,c=h.value;return c&&"object"==typeof c&&i.call(c,"__await")?t.resolve(c.__await).then((function(e){n("next",e,a,o)}),(function(e){n("throw",e,a,o)})):t.resolve(c).then((function(e){h.value=e,a(h)}),(function(e){return n("throw",e,a,o)}))}o(l.arg)}(r,s,n,a)}))}return n=n?n.then(a,a):a()}}function _(e,t){var i=e.iterator[t.method];if(void 0===i){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(i,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var r=n.arg;return r?r.done?(t[e.resultName]=r.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):r:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function w(e){if(e){var t=e[r];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,s=function t(){for(;++n<e.length;)if(i.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return s.next=s}}return{next:R}}function R(){return{value:void 0,done:!0}}return c.prototype=v.constructor=d,d.constructor=c,d[a]=c.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===c||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,d):(e.__proto__=d,a in e||(e[a]="GeneratorFunction")),e.prototype=Object.create(v),e},e.awrap=function(e){return{__await:e}},g(T.prototype),T.prototype[s]=function(){return this},e.AsyncIterator=T,e.async=function(t,i,n,r,s){void 0===s&&(s=Promise);var a=new T(o(t,i,n,r),s);return e.isGeneratorFunction(i)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},g(v),v[a]="Generator",v[r]=function(){return this},v.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var i in e)t.push(i);return t.reverse(),function i(){for(;t.length;){var n=t.pop();if(n in e)return i.value=n,i.done=!1,i}return i.done=!0,i}},e.values=w,E.prototype={constructor:E,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(i,n){return a.type="throw",a.arg=e,t.next=i,n&&(t.method="next",t.arg=void 0),!!n}for(var r=this.tryEntries.length-1;r>=0;--r){var s=this.tryEntries[r],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var o=i.call(s,"catchLoc"),u=i.call(s,"finallyLoc");if(o&&u){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var s=r;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=e,a.arg=t,s?(this.method="next",this.next=s.finallyLoc,l):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.finallyLoc===e)return this.complete(i.completion,i.afterLoc),m(i),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var i=this.tryEntries[t];if(i.tryLoc===e){var n=i.completion;if("throw"===n.type){var r=n.arg;m(i)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,i){return this.delegate={iterator:w(e),resultName:t,nextLoc:i},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=n}catch(e){Function("r","regeneratorRuntime = r")(n)}},function(e,t,i){var n=i(14);e.exports=function(e){if(Array.isArray(e))return n(e)}},function(e,t){e.exports=function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}},function(e,t,i){var n=i(14);e.exports=function(e,t){if(e){if("string"==typeof e)return n(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?n(e,t):void 0}}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}},function(e,t,i){(function(e){var n=void 0!==e&&e||"undefined"!=typeof self&&self||window,r=Function.prototype.apply;function s(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new s(r.call(setTimeout,n,arguments),clearTimeout)},t.setInterval=function(){return new s(r.call(setInterval,n,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(n,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},i(32),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,i(13))},function(e,t,i){(function(e,t){!function(e,i){"use strict";if(!e.setImmediate){var n,r,s,a,o,u=1,l={},h=!1,c=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,"[object process]"==={}.toString.call(e.process)?n=function(e){t.nextTick((function(){f(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,i=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=i,t}}()?e.MessageChannel?((s=new MessageChannel).port1.onmessage=function(e){f(e.data)},n=function(e){s.port2.postMessage(e)}):c&&"onreadystatechange"in c.createElement("script")?(r=c.documentElement,n=function(e){var t=c.createElement("script");t.onreadystatechange=function(){f(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):n=function(e){setTimeout(f,0,e)}:(a="setImmediate$"+Math.random()+"$",o=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(a)&&f(+t.data.slice(a.length))},e.addEventListener?e.addEventListener("message",o,!1):e.attachEvent("onmessage",o),n=function(t){e.postMessage(a+t,"*")}),d.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),i=0;i<t.length;i++)t[i]=arguments[i+1];var r={callback:e,args:t};return l[u]=r,n(u),u++},d.clearImmediate=p}function p(e){delete l[e]}function f(e){if(h)setTimeout(f,0,e);else{var t=l[e];if(t){h=!0;try{!function(e){var t=e.callback,i=e.args;switch(i.length){case 0:t();break;case 1:t(i[0]);break;case 2:t(i[0],i[1]);break;case 3:t(i[0],i[1],i[2]);break;default:t.apply(void 0,i)}}(t)}finally{p(e),h=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,i(13),i(33))},function(e,t){var i,n,r=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function o(e){if(i===setTimeout)return setTimeout(e,0);if((i===s||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:s}catch(e){i=s}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var u,l=[],h=!1,c=-1;function d(){h&&u&&(h=!1,u.length?l=u.concat(l):c=-1,l.length&&p())}function p(){if(!h){var e=o(d);h=!0;for(var t=l.length;t;){for(u=l,l=[];++c<t;)u&&u[c].run();c=-1,t=l.length}u=null,h=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function y(){}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var i=1;i<arguments.length;i++)t[i-1]=arguments[i];l.push(new f(e,t)),1!==l.length||h||o(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=y,r.addListener=y,r.once=y,r.off=y,r.removeListener=y,r.removeAllListeners=y,r.emit=y,r.prependListener=y,r.prependOnceListener=y,r.listeners=function(e){return[]},r.binding=function(e){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(e){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(e,t){var i,n;i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(e,t){return e<<t|e>>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&n.rotl(e,8)|4278255360&n.rotl(e,24);for(var t=0;t<e.length;t++)e[t]=n.endian(e[t]);return e},randomBytes:function(e){for(var t=[];e>0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],i=0,n=0;i<e.length;i++,n+=8)t[n>>>5]|=e[i]<<24-n%32;return t},wordsToBytes:function(e){for(var t=[],i=0;i<32*e.length;i+=8)t.push(e[i>>>5]>>>24-i%32&255);return t},bytesToHex:function(e){for(var t=[],i=0;i<e.length;i++)t.push((e[i]>>>4).toString(16)),t.push((15&e[i]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],i=0;i<e.length;i+=2)t.push(parseInt(e.substr(i,2),16));return t},bytesToBase64:function(e){for(var t=[],n=0;n<e.length;n+=3)for(var r=e[n]<<16|e[n+1]<<8|e[n+2],s=0;s<4;s++)8*n+6*s<=8*e.length?t.push(i.charAt(r>>>6*(3-s)&63)):t.push("=");return t.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var t=[],n=0,r=0;n<e.length;r=++n%4)0!=r&&t.push((i.indexOf(e.charAt(n-1))&Math.pow(2,-2*r+8)-1)<<2*r|i.indexOf(e.charAt(n))>>>6-2*r);return t}},e.exports=n},function(e,t){function i(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
e.exports=function(e){return null!=e&&(i(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&i(e.slice(0,0))}(e)||!!e._isBuffer)}},function(e,t,i){var n;
/*!
* EventEmitter v5.2.9 - git.io/ee
* Unlicense - http://unlicense.org/
* Oliver Caldwell - https://oli.me.uk/
* @preserve
*/!function(t){"use strict";function r(){}var s=r.prototype,a=t.EventEmitter;function o(e,t){for(var i=e.length;i--;)if(e[i].listener===t)return i;return-1}function u(e){return function(){return this[e].apply(this,arguments)}}s.getListeners=function(e){var t,i,n=this._getEvents();if(e instanceof RegExp)for(i in t={},n)n.hasOwnProperty(i)&&e.test(i)&&(t[i]=n[i]);else t=n[e]||(n[e]=[]);return t},s.flattenListeners=function(e){var t,i=[];for(t=0;t<e.length;t+=1)i.push(e[t].listener);return i},s.getListenersAsObject=function(e){var t,i=this.getListeners(e);return i instanceof Array&&((t={})[e]=i),t||i},s.addListener=function(e,t){if(!function e(t){return"function"==typeof t||t instanceof RegExp||!(!t||"object"!=typeof t)&&e(t.listener)}(t))throw new TypeError("listener must be a function");var i,n=this.getListenersAsObject(e),r="object"==typeof t;for(i in n)n.hasOwnProperty(i)&&-1===o(n[i],t)&&n[i].push(r?t:{listener:t,once:!1});return this},s.on=u("addListener"),s.addOnceListener=function(e,t){return this.addListener(e,{listener:t,once:!0})},s.once=u("addOnceListener"),s.defineEvent=function(e){return this.getListeners(e),this},s.defineEvents=function(e){for(var t=0;t<e.length;t+=1)this.defineEvent(e[t]);return this},s.removeListener=function(e,t){var i,n,r=this.getListenersAsObject(e);for(n in r)r.hasOwnProperty(n)&&-1!==(i=o(r[n],t))&&r[n].splice(i,1);return this},s.off=u("removeListener"),s.addListeners=function(e,t){return this.manipulateListeners(!1,e,t)},s.removeListeners=function(e,t){return this.manipulateListeners(!0,e,t)},s.manipulateListeners=function(e,t,i){var n,r,s=e?this.removeListener:this.addListener,a=e?this.removeListeners:this.addListeners;if("object"!=typeof t||t instanceof RegExp)for(n=i.length;n--;)s.call(this,t,i[n]);else for(n in t)t.hasOwnProperty(n)&&(r=t[n])&&("function"==typeof r?s.call(this,n,r):a.call(this,n,r));return this},s.removeEvent=function(e){var t,i=typeof e,n=this._getEvents();if("string"===i)delete n[e];else if(e instanceof RegExp)for(t in n)n.hasOwnProperty(t)&&e.test(t)&&delete n[t];else delete this._events;return this},s.removeAllListeners=u("removeEvent"),s.emitEvent=function(e,t){var i,n,r,s,a=this.getListenersAsObject(e);for(s in a)if(a.hasOwnProperty(s))for(i=a[s].slice(0),r=0;r<i.length;r++)!0===(n=i[r]).once&&this.removeListener(e,n.listener),n.listener.apply(this,t||[])===this._getOnceReturnValue()&&this.removeListener(e,n.listener);return this},s.trigger=u("emitEvent"),s.emit=function(e){var t=Array.prototype.slice.call(arguments,1);return this.emitEvent(e,t)},s.setOnceReturnValue=function(e){return this._onceReturnValue=e,this},s._getOnceReturnValue=function(){return!this.hasOwnProperty("_onceReturnValue")||this._onceReturnValue},s._getEvents=function(){return this._events||(this._events={})},r.noConflict=function(){return t.EventEmitter=a,r},void 0===(n=function(){return r}.call(t,i,t,e))||(e.exports=n)}("undefined"!=typeof window?window:this||{})},function(e,t,i){var n=i(9).default,r=i(16),s=function(e){this.item=null,e&&void 0!==e.item&&null!==e.item&&(this.item=new r(e.item))};(s.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype),s=t.fid;if(i==n.Type.STOP)break;switch(s){case 1:i==n.Type.STRUCT?(this.item=new r,this.item.read(e)):e.skip(i);break;case 0:e.skip(i);break;default:e.skip(i)}e.readFieldEnd()}e.readStructEnd()},s.prototype.write=function(e){e.writeStructBegin("ReportService_Report_args"),null!==this.item&&void 0!==this.item&&(e.writeFieldBegin("item",n.Type.STRUCT,1),this.item.write(e),e.writeFieldEnd()),e.writeFieldStop(),e.writeStructEnd()};var a=function(e){};(a.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype);t.fid;if(i==n.Type.STOP)break;e.skip(i),e.readFieldEnd()}e.readStructEnd()},a.prototype.write=function(e){e.writeStructBegin("ReportService_Report_result"),e.writeFieldStop(),e.writeStructEnd()};var o=function(e,t){this.input=e,this.output=t||e,this.seqid=0};(o.prototype={}).Report=function(e,t){this.send_Report(e,t),t||this.recv_Report()},o.prototype.send_Report=function(e,t){if(this.output.writeMessageBegin("Report",n.MessageType.CALL,this.seqid),new s({item:e}).write(this.output),this.output.writeMessageEnd(),!t)return this.output.getTransport().flush();this.output.getTransport().flush(!0,(function(e){t(e)}))},o.prototype.recv_Report=function(){var e=this.input.readMessageBegin(),t=(e.fname,e.mtype);e.rseqid;if(t==n.MessageType.EXCEPTION){var i=new n.TApplicationException;throw i.read(this.input),this.input.readMessageEnd(),i}(new a).read(this.input),this.input.readMessageEnd()},e.exports={ReportService_Report_args:s,ReportService_Report_result:a,ReportServiceClient:o}},function(e,t,i){var n=i(9).default,r=i(17).VosdkHeader,s=function(e){this.header=null,this.appid=null,this.uname=null,this.ver=null,this.dk=null,this.details=null,e&&(void 0!==e.header&&null!==e.header&&(this.header=new r(e.header)),void 0!==e.appid&&null!==e.appid&&(this.appid=e.appid),void 0!==e.uname&&null!==e.uname&&(this.uname=e.uname),void 0!==e.ver&&null!==e.ver&&(this.ver=e.ver),void 0!==e.dk&&null!==e.dk&&(this.dk=e.dk),void 0!==e.details&&null!==e.details&&(this.details=e.details))};(s.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype),s=t.fid;if(i==n.Type.STOP)break;switch(s){case 1:i==n.Type.STRUCT?(this.header=new r,this.header.read(e)):e.skip(i);break;case 2:i==n.Type.STRING?this.appid=e.readString().value:e.skip(i);break;case 3:i==n.Type.STRING?this.uname=e.readString().value:e.skip(i);break;case 4:i==n.Type.STRING?this.ver=e.readString().value:e.skip(i);break;case 5:i==n.Type.STRING?this.dk=e.readString().value:e.skip(i);break;case 6:i==n.Type.STRING?this.details=e.readString().value:e.skip(i);break;default:e.skip(i)}e.readFieldEnd()}e.readStructEnd()},s.prototype.write=function(e){e.writeStructBegin("MiniappSession"),null!==this.header&&void 0!==this.header&&(e.writeFieldBegin("header",n.Type.STRUCT,1),this.header.write(e),e.writeFieldEnd()),null!==this.appid&&void 0!==this.appid&&(e.writeFieldBegin("appid",n.Type.STRING,2),e.writeString(this.appid),e.writeFieldEnd()),null!==this.uname&&void 0!==this.uname&&(e.writeFieldBegin("uname",n.Type.STRING,3),e.writeString(this.uname),e.writeFieldEnd()),null!==this.ver&&void 0!==this.ver&&(e.writeFieldBegin("ver",n.Type.STRING,4),e.writeString(this.ver),e.writeFieldEnd()),null!==this.dk&&void 0!==this.dk&&(e.writeFieldBegin("dk",n.Type.STRING,5),e.writeString(this.dk),e.writeFieldEnd()),null!==this.details&&void 0!==this.details&&(e.writeFieldBegin("details",n.Type.STRING,6),e.writeString(this.details),e.writeFieldEnd()),e.writeFieldStop(),e.writeStructEnd()};var a=function(e){this.header=null,this.csurl=null,this.ec=null,this.gatewaylist=null,this.details=null,e&&(void 0!==e.header&&null!==e.header&&(this.header=new r(e.header)),void 0!==e.csurl&&null!==e.csurl&&(this.csurl=e.csurl),void 0!==e.ec&&null!==e.ec&&(this.ec=e.ec),void 0!==e.gatewaylist&&null!==e.gatewaylist&&(this.gatewaylist=n.copyList(e.gatewaylist,[null])),void 0!==e.details&&null!==e.details&&(this.details=e.details))};(a.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype),s=t.fid;if(i==n.Type.STOP)break;switch(s){case 1:i==n.Type.STRUCT?(this.header=new r,this.header.read(e)):e.skip(i);break;case 2:i==n.Type.STRING?this.csurl=e.readString().value:e.skip(i);break;case 3:i==n.Type.STRING?this.ec=e.readString().value:e.skip(i);break;case 4:if(i==n.Type.LIST){var a,o;this.gatewaylist=[];(o=e.readListBegin()).etype,a=o.size;for(var u=0;u<a;++u){var l;l=e.readString().value,this.gatewaylist.push(l)}e.readListEnd()}else e.skip(i);break;case 5:i==n.Type.STRING?this.details=e.readString().value:e.skip(i);break;default:e.skip(i)}e.readFieldEnd()}e.readStructEnd()},a.prototype.write=function(e){if(e.writeStructBegin("MiniappJoinChooseServer"),null!==this.header&&void 0!==this.header&&(e.writeFieldBegin("header",n.Type.STRUCT,1),this.header.write(e),e.writeFieldEnd()),null!==this.csurl&&void 0!==this.csurl&&(e.writeFieldBegin("csurl",n.Type.STRING,2),e.writeString(this.csurl),e.writeFieldEnd()),null!==this.ec&&void 0!==this.ec&&(e.writeFieldBegin("ec",n.Type.STRING,3),e.writeString(this.ec),e.writeFieldEnd()),null!==this.gatewaylist&&void 0!==this.gatewaylist){for(var t in e.writeFieldBegin("gatewaylist",n.Type.LIST,4),e.writeListBegin(n.Type.STRING,this.gatewaylist.length),this.gatewaylist)this.gatewaylist.hasOwnProperty(t)&&(t=this.gatewaylist[t],e.writeString(t));e.writeListEnd(),e.writeFieldEnd()}null!==this.details&&void 0!==this.details&&(e.writeFieldBegin("details",n.Type.STRING,5),e.writeString(this.details),e.writeFieldEnd()),e.writeFieldStop(),e.writeStructEnd()};var o=function(e){this.header=null,this.gateway=null,this.ec=null,this.wsurl=null,this.details=null,e&&(void 0!==e.header&&null!==e.header&&(this.header=new r(e.header)),void 0!==e.gateway&&null!==e.gateway&&(this.gateway=e.gateway),void 0!==e.ec&&null!==e.ec&&(this.ec=e.ec),void 0!==e.wsurl&&null!==e.wsurl&&(this.wsurl=e.wsurl),void 0!==e.details&&null!==e.details&&(this.details=e.details))};(o.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype),s=t.fid;if(i==n.Type.STOP)break;switch(s){case 1:i==n.Type.STRUCT?(this.header=new r,this.header.read(e)):e.skip(i);break;case 2:i==n.Type.STRING?this.gateway=e.readString().value:e.skip(i);break;case 3:i==n.Type.STRING?this.ec=e.readString().value:e.skip(i);break;case 4:i==n.Type.STRING?this.wsurl=e.readString().value:e.skip(i);break;case 5:i==n.Type.STRING?this.details=e.readString().value:e.skip(i);break;default:e.skip(i)}e.readFieldEnd()}e.readStructEnd()},o.prototype.write=function(e){e.writeStructBegin("MiniappConnectWebSocket"),null!==this.header&&void 0!==this.header&&(e.writeFieldBegin("header",n.Type.STRUCT,1),this.header.write(e),e.writeFieldEnd()),null!==this.gateway&&void 0!==this.gateway&&(e.writeFieldBegin("gateway",n.Type.STRING,2),e.writeString(this.gateway),e.writeFieldEnd()),null!==this.ec&&void 0!==this.ec&&(e.writeFieldBegin("ec",n.Type.STRING,3),e.writeString(this.ec),e.writeFieldEnd()),null!==this.wsurl&&void 0!==this.wsurl&&(e.writeFieldBegin("wsurl",n.Type.STRING,4),e.writeString(this.wsurl),e.writeFieldEnd()),null!==this.details&&void 0!==this.details&&(e.writeFieldBegin("details",n.Type.STRING,5),e.writeString(this.details),e.writeFieldEnd()),e.writeFieldStop(),e.writeStructEnd()};var u=function(e){this.header=null,this.uid=null,this.ec=null,this.isrejoin=null,this.details=null,e&&(void 0!==e.header&&null!==e.header&&(this.header=new r(e.header)),void 0!==e.uid&&null!==e.uid&&(this.uid=e.uid),void 0!==e.ec&&null!==e.ec&&(this.ec=e.ec),void 0!==e.isrejoin&&null!==e.isrejoin&&(this.isrejoin=e.isrejoin),void 0!==e.details&&null!==e.details&&(this.details=e.details))};(u.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype),s=t.fid;if(i==n.Type.STOP)break;switch(s){case 1:i==n.Type.STRUCT?(this.header=new r,this.header.read(e)):e.skip(i);break;case 2:i==n.Type.STRING?this.uid=e.readString().value:e.skip(i);break;case 3:i==n.Type.STRING?this.ec=e.readString().value:e.skip(i);break;case 4:i==n.Type.BOOL?this.isrejoin=e.readBool().value:e.skip(i);break;case 5:i==n.Type.STRING?this.details=e.readString().value:e.skip(i);break;default:e.skip(i)}e.readFieldEnd()}e.readStructEnd()},u.prototype.write=function(e){e.writeStructBegin("MiniappJoin"),null!==this.header&&void 0!==this.header&&(e.writeFieldBegin("header",n.Type.STRUCT,1),this.header.write(e),e.writeFieldEnd()),null!==this.uid&&void 0!==this.uid&&(e.writeFieldBegin("uid",n.Type.STRING,2),e.writeString(this.uid),e.writeFieldEnd()),null!==this.ec&&void 0!==this.ec&&(e.writeFieldBegin("ec",n.Type.STRING,3),e.writeString(this.ec),e.writeFieldEnd()),null!==this.isrejoin&&void 0!==this.isrejoin&&(e.writeFieldBegin("isrejoin",n.Type.BOOL,4),e.writeBool(this.isrejoin),e.writeFieldEnd()),null!==this.details&&void 0!==this.details&&(e.writeFieldBegin("details",n.Type.STRING,5),e.writeString(this.details),e.writeFieldEnd()),e.writeFieldStop(),e.writeStructEnd()};var l=function(e){this.header=null,this.ec=null,this.pushurl=null,this.uid=null,this.details=null,e&&(void 0!==e.header&&null!==e.header&&(this.header=new r(e.header)),void 0!==e.ec&&null!==e.ec&&(this.ec=e.ec),void 0!==e.pushurl&&null!==e.pushurl&&(this.pushurl=e.pushurl),void 0!==e.uid&&null!==e.uid&&(this.uid=e.uid),void 0!==e.details&&null!==e.details&&(this.details=e.details))};(l.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype),s=t.fid;if(i==n.Type.STOP)break;switch(s){case 1:i==n.Type.STRUCT?(this.header=new r,this.header.read(e)):e.skip(i);break;case 2:i==n.Type.STRING?this.ec=e.readString().value:e.skip(i);break;case 3:i==n.Type.STRING?this.pushurl=e.readString().value:e.skip(i);break;case 4:i==n.Type.STRING?this.uid=e.readString().value:e.skip(i);break;case 5:i==n.Type.STRING?this.details=e.readString().value:e.skip(i);break;default:e.skip(i)}e.readFieldEnd()}e.readStructEnd()},l.prototype.write=function(e){e.writeStructBegin("MiniappPublish"),null!==this.header&&void 0!==this.header&&(e.writeFieldBegin("header",n.Type.STRUCT,1),this.header.write(e),e.writeFieldEnd()),null!==this.ec&&void 0!==this.ec&&(e.writeFieldBegin("ec",n.Type.STRING,2),e.writeString(this.ec),e.writeFieldEnd()),null!==this.pushurl&&void 0!==this.pushurl&&(e.writeFieldBegin("pushurl",n.Type.STRING,3),e.writeString(this.pushurl),e.writeFieldEnd()),null!==this.uid&&void 0!==this.uid&&(e.writeFieldBegin("uid",n.Type.STRING,4),e.writeString(this.uid),e.writeFieldEnd()),null!==this.details&&void 0!==this.details&&(e.writeFieldBegin("details",n.Type.STRING,5),e.writeString(this.details),e.writeFieldEnd()),e.writeFieldStop(),e.writeStructEnd()};var h=function(e){this.header=null,this.ec=null,this.uid=null,this.details=null,e&&(void 0!==e.header&&null!==e.header&&(this.header=new r(e.header)),void 0!==e.ec&&null!==e.ec&&(this.ec=e.ec),void 0!==e.uid&&null!==e.uid&&(this.uid=e.uid),void 0!==e.details&&null!==e.details&&(this.details=e.details))};(h.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype),s=t.fid;if(i==n.Type.STOP)break;switch(s){case 1:i==n.Type.STRUCT?(this.header=new r,this.header.read(e)):e.skip(i);break;case 2:i==n.Type.STRING?this.ec=e.readString().value:e.skip(i);break;case 3:i==n.Type.STRING?this.uid=e.readString().value:e.skip(i);break;case 5:i==n.Type.STRING?this.details=e.readString().value:e.skip(i);break;default:e.skip(i)}e.readFieldEnd()}e.readStructEnd()},h.prototype.write=function(e){e.writeStructBegin("MiniappUnpublish"),null!==this.header&&void 0!==this.header&&(e.writeFieldBegin("header",n.Type.STRUCT,1),this.header.write(e),e.writeFieldEnd()),null!==this.ec&&void 0!==this.ec&&(e.writeFieldBegin("ec",n.Type.STRING,2),e.writeString(this.ec),e.writeFieldEnd()),null!==this.uid&&void 0!==this.uid&&(e.writeFieldBegin("uid",n.Type.STRING,3),e.writeString(this.uid),e.writeFieldEnd()),null!==this.details&&void 0!==this.details&&(e.writeFieldBegin("details",n.Type.STRING,5),e.writeString(this.details),e.writeFieldEnd()),e.writeFieldStop(),e.writeStructEnd()};var c=function(e){this.header=null,this.ec=null,this.pullurl=null,this.peerid=null,this.details=null,e&&(void 0!==e.header&&null!==e.header&&(this.header=new r(e.header)),void 0!==e.ec&&null!==e.ec&&(this.ec=e.ec),void 0!==e.pullurl&&null!==e.pullurl&&(this.pullurl=e.pullurl),void 0!==e.peerid&&null!==e.peerid&&(this.peerid=e.peerid),void 0!==e.details&&null!==e.details&&(this.details=e.details))};(c.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype),s=t.fid;if(i==n.Type.STOP)break;switch(s){case 1:i==n.Type.STRUCT?(this.header=new r,this.header.read(e)):e.skip(i);break;case 2:i==n.Type.STRING?this.ec=e.readString().value:e.skip(i);break;case 3:i==n.Type.STRING?this.pullurl=e.readString().value:e.skip(i);break;case 4:i==n.Type.STRING?this.peerid=e.readString().value:e.skip(i);break;case 5:i==n.Type.STRING?this.details=e.readString().value:e.skip(i);break;default:e.skip(i)}e.readFieldEnd()}e.readStructEnd()},c.prototype.write=function(e){e.writeStructBegin("MiniappSubscribe"),null!==this.header&&void 0!==this.header&&(e.writeFieldBegin("header",n.Type.STRUCT,1),this.header.write(e),e.writeFieldEnd()),null!==this.ec&&void 0!==this.ec&&(e.writeFieldBegin("ec",n.Type.STRING,2),e.writeString(this.ec),e.writeFieldEnd()),null!==this.pullurl&&void 0!==this.pullurl&&(e.writeFieldBegin("pullurl",n.Type.STRING,3),e.writeString(this.pullurl),e.writeFieldEnd()),null!==this.peerid&&void 0!==this.peerid&&(e.writeFieldBegin("peerid",n.Type.STRING,4),e.writeString(this.peerid),e.writeFieldEnd()),null!==this.details&&void 0!==this.details&&(e.writeFieldBegin("details",n.Type.STRING,5),e.writeString(this.details),e.writeFieldEnd()),e.writeFieldStop(),e.writeStructEnd()};var d=function(e){this.header=null,this.ec=null,this.peerid=null,this.details=null,e&&(void 0!==e.header&&null!==e.header&&(this.header=new r(e.header)),void 0!==e.ec&&null!==e.ec&&(this.ec=e.ec),void 0!==e.peerid&&null!==e.peerid&&(this.peerid=e.peerid),void 0!==e.details&&null!==e.details&&(this.details=e.details))};(d.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype),s=t.fid;if(i==n.Type.STOP)break;switch(s){case 1:i==n.Type.STRUCT?(this.header=new r,this.header.read(e)):e.skip(i);break;case 2:i==n.Type.STRING?this.ec=e.readString().value:e.skip(i);break;case 3:i==n.Type.STRING?this.peerid=e.readString().value:e.skip(i);break;case 4:i==n.Type.STRING?this.details=e.readString().value:e.skip(i);break;default:e.skip(i)}e.readFieldEnd()}e.readStructEnd()},d.prototype.write=function(e){e.writeStructBegin("MiniappUnsubscribe"),null!==this.header&&void 0!==this.header&&(e.writeFieldBegin("header",n.Type.STRUCT,1),this.header.write(e),e.writeFieldEnd()),null!==this.ec&&void 0!==this.ec&&(e.writeFieldBegin("ec",n.Type.STRING,2),e.writeString(this.ec),e.writeFieldEnd()),null!==this.peerid&&void 0!==this.peerid&&(e.writeFieldBegin("peerid",n.Type.STRING,3),e.writeString(this.peerid),e.writeFieldEnd()),null!==this.details&&void 0!==this.details&&(e.writeFieldBegin("details",n.Type.STRING,4),e.writeString(this.details),e.writeFieldEnd()),e.writeFieldStop(),e.writeStructEnd()};var p=function(e){this.header=null,this.uid=null,this.details=null,e&&(void 0!==e.header&&null!==e.header&&(this.header=new r(e.header)),void 0!==e.uid&&null!==e.uid&&(this.uid=e.uid),void 0!==e.details&&null!==e.details&&(this.details=e.details))};(p.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype),s=t.fid;if(i==n.Type.STOP)break;switch(s){case 1:i==n.Type.STRUCT?(this.header=new r,this.header.read(e)):e.skip(i);break;case 2:i==n.Type.STRING?this.uid=e.readString().value:e.skip(i);break;case 3:i==n.Type.STRING?this.details=e.readString().value:e.skip(i);break;default:e.skip(i)}e.readFieldEnd()}e.readStructEnd()},p.prototype.write=function(e){e.writeStructBegin("MiniappLeave"),null!==this.header&&void 0!==this.header&&(e.writeFieldBegin("header",n.Type.STRUCT,1),this.header.write(e),e.writeFieldEnd()),null!==this.uid&&void 0!==this.uid&&(e.writeFieldBegin("uid",n.Type.STRING,2),e.writeString(this.uid),e.writeFieldEnd()),null!==this.details&&void 0!==this.details&&(e.writeFieldBegin("details",n.Type.STRING,3),e.writeString(this.details),e.writeFieldEnd()),e.writeFieldStop(),e.writeStructEnd()};var f=function(e){this.header=null,this.action=null,this.details=null,this.req_ts=null,e&&(void 0!==e.header&&null!==e.header&&(this.header=new r(e.header)),void 0!==e.action&&null!==e.action&&(this.action=e.action),void 0!==e.details&&null!==e.details&&(this.details=e.details),void 0!==e.req_ts&&null!==e.req_ts&&(this.req_ts=e.req_ts))};(f.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype),s=t.fid;if(i==n.Type.STOP)break;switch(s){case 1:i==n.Type.STRUCT?(this.header=new r,this.header.read(e)):e.skip(i);break;case 2:i==n.Type.STRING?this.action=e.readString().value:e.skip(i);break;case 3:i==n.Type.STRING?this.details=e.readString().value:e.skip(i);break;case 4:i==n.Type.I64?this.req_ts=e.readI64().value:e.skip(i);break;default:e.skip(i)}e.readFieldEnd()}e.readStructEnd()},f.prototype.write=function(e){e.writeStructBegin("MiniappServerEvent"),null!==this.header&&void 0!==this.header&&(e.writeFieldBegin("header",n.Type.STRUCT,1),this.header.write(e),e.writeFieldEnd()),null!==this.action&&void 0!==this.action&&(e.writeFieldBegin("action",n.Type.STRING,2),e.writeString(this.action),e.writeFieldEnd()),null!==this.details&&void 0!==this.details&&(e.writeFieldBegin("details",n.Type.STRING,3),e.writeString(this.details),e.writeFieldEnd()),null!==this.req_ts&&void 0!==this.req_ts&&(e.writeFieldBegin("req_ts",n.Type.I64,4),e.writeI64(this.req_ts),e.writeFieldEnd()),e.writeFieldStop(),e.writeStructEnd()};var y=function(e){this.header=null,this.url=null,this.code=null,this.status=null,this.error=null,this.details=null,e&&(void 0!==e.header&&null!==e.header&&(this.header=new r(e.header)),void 0!==e.url&&null!==e.url&&(this.url=e.url),void 0!==e.code&&null!==e.code&&(this.code=e.code),void 0!==e.status&&null!==e.status&&(this.status=e.status),void 0!==e.error&&null!==e.error&&(this.error=e.error),void 0!==e.details&&null!==e.details&&(this.details=e.details))};(y.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype),s=t.fid;if(i==n.Type.STOP)break;switch(s){case 1:i==n.Type.STRUCT?(this.header=new r,this.header.read(e)):e.skip(i);break;case 2:i==n.Type.STRING?this.url=e.readString().value:e.skip(i);break;case 3:i==n.Type.STRING?this.code=e.readString().value:e.skip(i);break;case 4:i==n.Type.STRING?this.status=e.readString().value:e.skip(i);break;case 5:i==n.Type.STRING?this.error=e.readString().value:e.skip(i);break;case 6:i==n.Type.STRING?this.details=e.readString().value:e.skip(i);break;default:e.skip(i)}e.readFieldEnd()}e.readStructEnd()},y.prototype.write=function(e){e.writeStructBegin("MiniappPusherState"),null!==this.header&&void 0!==this.header&&(e.writeFieldBegin("header",n.Type.STRUCT,1),this.header.write(e),e.writeFieldEnd()),null!==this.url&&void 0!==this.url&&(e.writeFieldBegin("url",n.Type.STRING,2),e.writeString(this.url),e.writeFieldEnd()),null!==this.code&&void 0!==this.code&&(e.writeFieldBegin("code",n.Type.STRING,3),e.writeString(this.code),e.writeFieldEnd()),null!==this.status&&void 0!==this.status&&(e.writeFieldBegin("status",n.Type.STRING,4),e.writeString(this.status),e.writeFieldEnd()),null!==this.error&&void 0!==this.error&&(e.writeFieldBegin("error",n.Type.STRING,5),e.writeString(this.error),e.writeFieldEnd()),null!==this.details&&void 0!==this.details&&(e.writeFieldBegin("details",n.Type.STRING,6),e.writeString(this.details),e.writeFieldEnd()),e.writeFieldStop(),e.writeStructEnd()};var v=function(e){this.header=null,this.url=null,this.code=null,this.status=null,this.error=null,this.details=null,e&&(void 0!==e.header&&null!==e.header&&(this.header=new r(e.header)),void 0!==e.url&&null!==e.url&&(this.url=e.url),void 0!==e.code&&null!==e.code&&(this.code=e.code),void 0!==e.status&&null!==e.status&&(this.status=e.status),void 0!==e.error&&null!==e.error&&(this.error=e.error),void 0!==e.details&&null!==e.details&&(this.details=e.details))};(v.prototype={}).read=function(e){for(e.readStructBegin();;){var t=e.readFieldBegin(),i=(t.fname,t.ftype),s=t.fid;if(i==n.Type.STOP)break;switch(s){case 1:i==n.Type.STRUCT?(this.header=new r,this.header.read(e)):e.skip(i);break;case 2:i==n.Type.STRING?this.url=e.readString().value:e.skip(i);break;case 3:i==n.Type.STRING?this.code=e.readString().value:e.skip(i);break;case 4:i==n.Type.STRING?this.status=e.readString().value:e.skip(i);break;case 5:i==n.Type.STRING?this.error=e.readString().value:e.skip(i);break;case 6:i==n.Type.STRING?this.details=e.readString().value:e.skip(i);break;default:e.skip(i)}e.readFieldEnd()}e.readStructEnd()},v.prototype.write=function(e){e.writeStructBegin("MiniappPlayerState"),null!==this.header&&void 0!==this.header&&(e.writeFieldBegin("header",n.Type.STRUCT,1),this.header.write(e),e.writeFieldEnd()),null!==this.url&&void 0!==this.url&&(e.writeFieldBegin("url",n.Type.STRING,2),e.writeString(this.url),e.writeFieldEnd()),null!==this.code&&void 0!==this.code&&(e.writeFieldBegin("code",n.Type.STRING,3),e.writeString(this.code),e.writeFieldEnd()),null!==this.status&&void 0!==this.status&&(e.writeFieldBegin("status",n.Type.STRING,4),e.writeString(this.status),e.writeFieldEnd()),null!==this.error&&void 0!==this.error&&(e.writeFieldBegin("error",n.Type.STRING,5),e.writeString(this.error),e.writeFieldEnd()),null!==this.details&&void 0!==this.details&&(e.writeFieldBegin("details",n.Type.STRING,6),e.writeString(this.details),e.writeFieldEnd()),e.writeFieldStop(),e.writeStructEnd()},e.exports={MiniappSession:s,MiniappJoinChooseServer:a,MiniappConnectWebSocket:o,MiniappJoin:u,MiniappPublish:l,MiniappUnpublish:h,MiniappSubscribe:c,MiniappUnsubscribe:d,MiniappLeave:p,MiniappServerEvent:f,MiniappPusherState:y,MiniappPlayerState:v}},function(e,t,i){"use strict";e.exports=i(40)},function(e,t,i){"use strict";var n=t;function r(){n.util._configure(),n.Writer._configure(n.BufferWriter),n.Reader._configure(n.BufferReader)}n.build="minimal",n.Writer=i(18),n.BufferWriter=i(49),n.Reader=i(19),n.BufferReader=i(50),n.util=i(7),n.rpc=i(51),n.roots=i(53),n.configure=r,r()},function(e,t,i){"use strict";e.exports=function(e,t){var i=new Array(arguments.length-1),n=0,r=2,s=!0;for(;r<arguments.length;)i[n++]=arguments[r++];return new Promise((function(r,a){i[n]=function(e){if(s)if(s=!1,e)a(e);else{for(var t=new Array(arguments.length-1),i=0;i<t.length;)t[i++]=arguments[i];r.apply(null,t)}};try{e.apply(t||null,i)}catch(e){s&&(s=!1,a(e))}}))}},function(e,t,i){"use strict";var n=t;n.length=function(e){var t=e.length;if(!t)return 0;for(var i=0;--t%4>1&&"="===e.charAt(t);)++i;return Math.ceil(3*e.length)/4-i};for(var r=new Array(64),s=new Array(123),a=0;a<64;)s[r[a]=a<26?a+65:a<52?a+71:a<62?a-4:a-59|43]=a++;n.encode=function(e,t,i){for(var n,s=null,a=[],o=0,u=0;t<i;){var l=e[t++];switch(u){case 0:a[o++]=r[l>>2],n=(3&l)<<4,u=1;break;case 1:a[o++]=r[n|l>>4],n=(15&l)<<2,u=2;break;case 2:a[o++]=r[n|l>>6],a[o++]=r[63&l],u=0}o>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,a)),o=0)}return u&&(a[o++]=r[n],a[o++]=61,1===u&&(a[o++]=61)),s?(o&&s.push(String.fromCharCode.apply(String,a.slice(0,o))),s.join("")):String.fromCharCode.apply(String,a.slice(0,o))};n.decode=function(e,t,i){for(var n,r=i,a=0,o=0;o<e.length;){var u=e.charCodeAt(o++);if(61===u&&a>1)break;if(void 0===(u=s[u]))throw Error("invalid encoding");switch(a){case 0:n=u,a=1;break;case 1:t[i++]=n<<2|(48&u)>>4,n=u,a=2;break;case 2:t[i++]=(15&n)<<4|(60&u)>>2,n=u,a=3;break;case 3:t[i++]=(3&n)<<6|u,a=0}}if(1===a)throw Error("invalid encoding");return i-r},n.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},function(e,t,i){"use strict";function n(){this._listeners={}}e.exports=n,n.prototype.on=function(e,t,i){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:i||this}),this},n.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var i=this._listeners[e],n=0;n<i.length;)i[n].fn===t?i.splice(n,1):++n;return this},n.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var i=[],n=1;n<arguments.length;)i.push(arguments[n++]);for(n=0;n<t.length;)t[n].fn.apply(t[n++].ctx,i)}return this}},function(e,t,i){"use strict";function n(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),i=new Uint8Array(t.buffer),n=128===i[3];function r(e,n,r){t[0]=e,n[r]=i[0],n[r+1]=i[1],n[r+2]=i[2],n[r+3]=i[3]}function s(e,n,r){t[0]=e,n[r]=i[3],n[r+1]=i[2],n[r+2]=i[1],n[r+3]=i[0]}function a(e,n){return i[0]=e[n],i[1]=e[n+1],i[2]=e[n+2],i[3]=e[n+3],t[0]}function o(e,n){return i[3]=e[n],i[2]=e[n+1],i[1]=e[n+2],i[0]=e[n+3],t[0]}e.writeFloatLE=n?r:s,e.writeFloatBE=n?s:r,e.readFloatLE=n?a:o,e.readFloatBE=n?o:a}():function(){function t(e,t,i,n){var r=t<0?1:0;if(r&&(t=-t),0===t)e(1/t>0?0:2147483648,i,n);else if(isNaN(t))e(2143289344,i,n);else if(t>34028234663852886e22)e((r<<31|2139095040)>>>0,i,n);else if(t<11754943508222875e-54)e((r<<31|Math.round(t/1401298464324817e-60))>>>0,i,n);else{var s=Math.floor(Math.log(t)/Math.LN2);e((r<<31|s+127<<23|8388607&Math.round(t*Math.pow(2,-s)*8388608))>>>0,i,n)}}function i(e,t,i){var n=e(t,i),r=2*(n>>31)+1,s=n>>>23&255,a=8388607&n;return 255===s?a?NaN:r*(1/0):0===s?1401298464324817e-60*r*a:r*Math.pow(2,s-150)*(a+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,s),e.readFloatLE=i.bind(null,a),e.readFloatBE=i.bind(null,o)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),i=new Uint8Array(t.buffer),n=128===i[7];function r(e,n,r){t[0]=e,n[r]=i[0],n[r+1]=i[1],n[r+2]=i[2],n[r+3]=i[3],n[r+4]=i[4],n[r+5]=i[5],n[r+6]=i[6],n[r+7]=i[7]}function s(e,n,r){t[0]=e,n[r]=i[7],n[r+1]=i[6],n[r+2]=i[5],n[r+3]=i[4],n[r+4]=i[3],n[r+5]=i[2],n[r+6]=i[1],n[r+7]=i[0]}function a(e,n){return i[0]=e[n],i[1]=e[n+1],i[2]=e[n+2],i[3]=e[n+3],i[4]=e[n+4],i[5]=e[n+5],i[6]=e[n+6],i[7]=e[n+7],t[0]}function o(e,n){return i[7]=e[n],i[6]=e[n+1],i[5]=e[n+2],i[4]=e[n+3],i[3]=e[n+4],i[2]=e[n+5],i[1]=e[n+6],i[0]=e[n+7],t[0]}e.writeDoubleLE=n?r:s,e.writeDoubleBE=n?s:r,e.readDoubleLE=n?a:o,e.readDoubleBE=n?o:a}():function(){function t(e,t,i,n,r,s){var a=n<0?1:0;if(a&&(n=-n),0===n)e(0,r,s+t),e(1/n>0?0:2147483648,r,s+i);else if(isNaN(n))e(0,r,s+t),e(2146959360,r,s+i);else if(n>17976931348623157e292)e(0,r,s+t),e((a<<31|2146435072)>>>0,r,s+i);else{var o;if(n<22250738585072014e-324)e((o=n/5e-324)>>>0,r,s+t),e((a<<31|o/4294967296)>>>0,r,s+i);else{var u=Math.floor(Math.log(n)/Math.LN2);1024===u&&(u=1023),e(4503599627370496*(o=n*Math.pow(2,-u))>>>0,r,s+t),e((a<<31|u+1023<<20|1048576*o&1048575)>>>0,r,s+i)}}}function i(e,t,i,n,r){var s=e(n,r+t),a=e(n,r+i),o=2*(a>>31)+1,u=a>>>20&2047,l=4294967296*(1048575&a)+s;return 2047===u?l?NaN:o*(1/0):0===u?5e-324*o*l:o*Math.pow(2,u-1075)*(l+4503599627370496)}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,s,4,0),e.readDoubleLE=i.bind(null,a,0,4),e.readDoubleBE=i.bind(null,o,4,0)}(),e}function r(e,t,i){t[i]=255&e,t[i+1]=e>>>8&255,t[i+2]=e>>>16&255,t[i+3]=e>>>24}function s(e,t,i){t[i]=e>>>24,t[i+1]=e>>>16&255,t[i+2]=e>>>8&255,t[i+3]=255&e}function a(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function o(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=n(n)},function(module,exports,__webpack_require__){"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},function(e,t,i){"use strict";var n=t;n.length=function(e){for(var t=0,i=0,n=0;n<e.length;++n)(i=e.charCodeAt(n))<128?t+=1:i<2048?t+=2:55296==(64512&i)&&56320==(64512&e.charCodeAt(n+1))?(++n,t+=4):t+=3;return t},n.read=function(e,t,i){if(i-t<1)return"";for(var n,r=null,s=[],a=0;t<i;)(n=e[t++])<128?s[a++]=n:n>191&&n<224?s[a++]=(31&n)<<6|63&e[t++]:n>239&&n<365?(n=((7&n)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,s[a++]=55296+(n>>10),s[a++]=56320+(1023&n)):s[a++]=(15&n)<<12|(63&e[t++])<<6|63&e[t++],a>8191&&((r||(r=[])).push(String.fromCharCode.apply(String,s)),a=0);return r?(a&&r.push(String.fromCharCode.apply(String,s.slice(0,a))),r.join("")):String.fromCharCode.apply(String,s.slice(0,a))},n.write=function(e,t,i){for(var n,r,s=i,a=0;a<e.length;++a)(n=e.charCodeAt(a))<128?t[i++]=n:n<2048?(t[i++]=n>>6|192,t[i++]=63&n|128):55296==(64512&n)&&56320==(64512&(r=e.charCodeAt(a+1)))?(n=65536+((1023&n)<<10)+(1023&r),++a,t[i++]=n>>18|240,t[i++]=n>>12&63|128,t[i++]=n>>6&63|128,t[i++]=63&n|128):(t[i++]=n>>12|224,t[i++]=n>>6&63|128,t[i++]=63&n|128);return i-s}},function(e,t,i){"use strict";e.exports=function(e,t,i){var n=i||8192,r=n>>>1,s=null,a=n;return function(i){if(i<1||i>r)return e(i);a+i>n&&(s=e(n),a=0);var o=t.call(s,a,a+=i);return 7&a&&(a=1+(7|a)),o}}},function(e,t,i){"use strict";e.exports=r;var n=i(7);function r(e,t){this.lo=e>>>0,this.hi=t>>>0}var s=r.zero=new r(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var a=r.zeroHash="\0\0\0\0\0\0\0\0";r.fromNumber=function(e){if(0===e)return s;var t=e<0;t&&(e=-e);var i=e>>>0,n=(e-i)/4294967296>>>0;return t&&(n=~n>>>0,i=~i>>>0,++i>4294967295&&(i=0,++n>4294967295&&(n=0))),new r(i,n)},r.from=function(e){if("number"==typeof e)return r.fromNumber(e);if(n.isString(e)){if(!n.Long)return r.fromNumber(parseInt(e,10));e=n.Long.fromString(e)}return e.low||e.high?new r(e.low>>>0,e.high>>>0):s},r.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,i=~this.hi>>>0;return t||(i=i+1>>>0),-(t+4294967296*i)}return this.lo+4294967296*this.hi},r.prototype.toLong=function(e){return n.Long?new n.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var o=String.prototype.charCodeAt;r.fromHash=function(e){return e===a?s:new r((o.call(e,0)|o.call(e,1)<<8|o.call(e,2)<<16|o.call(e,3)<<24)>>>0,(o.call(e,4)|o.call(e,5)<<8|o.call(e,6)<<16|o.call(e,7)<<24)>>>0)},r.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},r.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},r.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},r.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,i=this.hi>>>24;return 0===i?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:i<128?9:10}},function(e,t,i){"use strict";e.exports=s;var n=i(18);(s.prototype=Object.create(n.prototype)).constructor=s;var r=i(7);function s(){n.call(this)}function a(e,t,i){e.length<40?r.utf8.write(e,t,i):t.utf8Write?t.utf8Write(e,i):t.write(e,i)}s._configure=function(){s.alloc=r._Buffer_allocUnsafe,s.writeBytesBuffer=r.Buffer&&r.Buffer.prototype instanceof Uint8Array&&"set"===r.Buffer.prototype.set.name?function(e,t,i){t.set(e,i)}:function(e,t,i){if(e.copy)e.copy(t,i,0,e.length);else for(var n=0;n<e.length;)t[i++]=e[n++]}},s.prototype.bytes=function(e){r.isString(e)&&(e=r._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(s.writeBytesBuffer,t,e),this},s.prototype.string=function(e){var t=r.Buffer.byteLength(e);return this.uint32(t),t&&this._push(a,t,e),this},s._configure()},function(e,t,i){"use strict";e.exports=s;var n=i(19);(s.prototype=Object.create(n.prototype)).constructor=s;var r=i(7);function s(e){n.call(this,e)}s._configure=function(){r.Buffer&&(s.prototype._slice=r.Buffer.prototype.slice)},s.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},s._configure()},function(e,t,i){"use strict";t.Service=i(52)},function(e,t,i){"use strict";e.exports=r;var n=i(7);function r(e,t,i){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");n.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(i)}(r.prototype=Object.create(n.EventEmitter.prototype)).constructor=r,r.prototype.rpcCall=function e(t,i,r,s,a){if(!s)throw TypeError("request must be specified");var o=this;if(!a)return n.asPromise(e,o,t,i,r,s);if(o.rpcImpl)try{return o.rpcImpl(t,i[o.requestDelimited?"encodeDelimited":"encode"](s).finish(),(function(e,i){if(e)return o.emit("error",e,t),a(e);if(null!==i){if(!(i instanceof r))try{i=r[o.responseDelimited?"decodeDelimited":"decode"](i)}catch(e){return o.emit("error",e,t),a(e)}return o.emit("data",i,t),a(null,i)}o.end(!0)}))}catch(e){return o.emit("error",e,t),void setTimeout((function(){a(e)}),0)}else setTimeout((function(){a(Error("already ended"))}),0)},r.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},function(e,t,i){"use strict";e.exports={}},function(e,t,i){"use strict";i.r(t);var n=i(2),r=i.n(n),s=i(3),a=i.n(s),o=i(4),u=i(5),l=i(8),h=i.n(l),c=i(12),d=i.n(c),p=i(1);var f=function(e){return e=e||Object.create(null),{on:function(t,i){(e[t]||(e[t]=[])).push(i)},off:function(t,i){e[t]&&e[t].splice(e[t].indexOf(i)>>>0,1)},emit:function(t,i){(e[t]||[]).slice().map((function(e){e(i)})),(e["*"]||[]).slice().map((function(e){e(t,i)}))}}},y=(i(31),i(21)),v=i.n(y),g=i(11),T=i.n(g),_="success",S="fail",m=function(){function e(){r()(this,e),this.vid=w().vid,this.url="https://report-ad.agoralab.co/v1/report",this.sdk_version=u.SDK_VERSION,this.onlineTimer=null}return a()(e,[{key:"onlineUser",value:function(){var e=this;this.onlineTimer=setInterval((function(){e.report("online_user")}),2e4)}},{key:"destroy",value:function(){null!==this.onlineTimer&&clearInterval(this.onlineTimer)}},{key:"report",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",r=Date.now(),s={pts:[{m:"online_user"===e?"online_user":"event",ls:{vid:this.vid,version:this.sdk_version},vs:{count:1}}],sign:T()("src=miniapp&ts=".concat(r)),src:"miniapp",ts:r};if("online_user"!==e){var a={event:e,result:"success"===t?"1":"0",err_code:i.toString()};"pusher_state_change"!==e&&"player_state_change"!==e||void 0!==n&&("string"==typeof n?a.message=n:(a.wx_version=n.version,a.user_mobile_model=n.model,a.user_IP=n.ip,a.system=n.system)),v()(s.pts[0].ls,a)}return this.request({body:s,url:this.url})}},{key:"request",value:function(e){return new Promise((function(t,i){wx.request({url:e.url,data:e.body,header:{"content-type":"application/json"},method:"POST",success:function(e){p.default.info("weixin request report success"),200===e.statusCode?(p.default.info("response success"),t(e)):p.default.info("response fail: ".concat(e.statusCode))},fail:function(e){p.default.warn("weixin request report fail"),i(e)}})}))}}]),e}(),E={};function w(){return E}var R=["https://uap-ap-web-1.agora.io/api/v1","https://uap-ap-web-3.agora.io/api/v1","https://uap-ap-web-2.agoraio.cn/api/v1","https://uap-ap-web-4.agoraio.cn/api/v1"],b=function(e){var t=e.reportManager,i=e.grafanaReport,n={command:"convergeAllocateEdge",sid:e.sid,appId:e.appId,token:e.appId,uid:e.uid+"",cname:e.channel,ts:Math.floor(Date.now()/1e3),version:u.VERSION,seq:0,requestId:1};return new Promise((function(r,s){var a=0,o=function(i,n){try{t.report("chooseServer",{header:{sid:e.sid,cname:e.channel,uid:e.uid,success:!1},body:{csurl:n,ec:JSON.stringify(i)}})}catch(e){}4===++a&&s(i)},u=function(s){var a=R[s];wx.request({url:a,data:{service_name:"miniapp",json_body:JSON.stringify(n)},header:{"content-type":"application/json","X-Packet-URI":61,"X-Packet-Service-Type":0},method:"POST",success:function(n){var s,u,l=n.data;if(p.default.debug("From choose server",n),n.profile){var h=n.profile.peerIP;s=h,E.ip=s}else p.default.debug("skip user IP report!");if(200!==n.statusCode){o({code:901,reason:l.error||"choose server fail"},a);try{i.report("chooseServer",S,n.statusCode)}catch(e){}}else{var c=JSON.parse(l.json_body),d=c.vid;u=d,E.vid=u;var f=function(e){if(void 0!==e)return e.map((function(e){var t=e.address.split("."),i=t.length;return"wss://miniapp.agoraio.cn/".concat(t[i-4],"-").concat(t[i-3],"-").concat(t[i-2],"-").concat(t[i-1],"/api")}));p.default.error("miniapp service is not enabled for this AppID")}(c.servers);t.report("chooseServer",{header:{sid:e.sid,cname:e.channel,uid:e.uid,success:!0},body:{csurl:a,gatewaylist:f}});try{i.report("chooseServer",_)}catch(e){}r({serverlist:f,url:a})}},fail:function(e){o({code:901,reason:e.errMsg||"choose server fail"},a)}})};R.map((function(e,t){u(t)}))}))},k=function(){function e(t,i){r()(this,e),this.serverlist=[],this.option=t,this.index=0,this.isInit=!0,this.state="disconnected",this.hasInvokeClose=!1,this.emitter=i,this.on=this.emitter.on,this.off=this.emitter.off,this.emit=this.emitter.emit}return a()(e,[{key:"connect",value:function(){var e=this;"disconnected"!==this.state&&this.close(),b(this.option).then((function(t){var i=t.serverlist,n=t.url;p.default.debug("Get server list from "+n),e.index=0,e.serverlist=i,e.option&&e.option.servers&&(e.serverlist=e.option.servers),p.default.debug("Connect server with list: ",e.serverlist),e.connectWorker(e.serverlist[e.index])})).catch((function(t){e.emit&&e.emit("socketError",t)}))}},{key:"connectWorker",value:function(){var e=this;this.state="connecting";var t=this.serverlist[this.index];p.default.debug("Connect server: ",t);var i=this.option,n=i.sid,r=i.channel,s=i.uid,a=i.reportManager,o=i.grafanaReport;this.ws=wx.connectSocket({url:t,complete:function(e){return p.default.debug("wxSocket: complete: ",e)},fail:function(e){p.default.debug("wxSocket: fail: ",e),a&&a.report("connectWebSocket",{header:{sid:n,cname:r,uid:s,success:!1},body:{wsurl:t,ec:JSON.stringify(e)}}),o&&o.report("connectWebSocket",S,e.statusCode)},success:function(e){p.default.debug("wxSocket success: ",e),a&&a.report("connectWebSocket",{header:{sid:n,cname:r,uid:s,success:!0},body:{wsurl:t}}),o&&o.report("connectWebSocket",_)}}),this.ws.onOpen(this._onopen.bind(this)),this.ws.onMessage(this._onmessage.bind(this)),this.establishWSTimeoutTimer=setTimeout((function(){"connected"!==e.state&&e.connectNextWorker()}),5e3)}},{key:"connectNextWorker",value:function(){"disconnected"!==this.state&&this.close(),p.default.debug(this.index,this.serverlist.length),this.index>=this.serverlist.length-1?this.emit&&this.emit("socketError",{code:905,reason:"connect websocket failed",wsurl:JSON.stringify(this.serverlist)}):(this.index++,this.connectWorker())}},{key:"_onopen",value:function(){p.default.info("websocket onopen"),clearTimeout(this.establishWSTimeoutTimer),this.state="connected",this.isInit=!1,this.hasInvokeClose?p.default.debug("Alread invoke ws.Close, will not throw onopen event"):(this.ws.onClose(this._onclose.bind(this)),this.emit&&this.emit("onopen"))}},{key:"_onclose",value:function(e){p.default.info("websocket onclose:"+JSON.stringify(e)),this.emitter.emit("_wsClose"),clearTimeout(this.establishWSTimeoutTimer),this.state="disconnected",e&&"close"==e.reason||this.hasInvokeClose||(this.isInit?this.connectNextWorker():this.emit&&this.emit("onclose"))}},{key:"_onmessage",value:function(e){this.hasInvokeClose||(p.default.blind("receive message: ",JSON.stringify(e)),this.isConnected()&&this.emit&&this.emit("onmessage",e))}},{key:"isConnected",value:function(){return"connected"===this.state}},{key:"sendMessage",value:function(e){p.default.blind("send message: ",e),this.isConnected()&&this.ws&&this.ws.send({data:e})}},{key:"_checkServerList",value:function(e){return e instanceof Array!=0&&0!=e.length}},{key:"destroy",value:function(e){var t=this;"disconnected"!==this.state&&this.close();this.on("_wsClose",(function i(){t.off("_wsClose",i),t.serverlist=null,t.ws=null,t.emitter=null,t.on=null,t.off=null,t.emit=null,e&&e()}))}},{key:"close",value:function(){p.default.debug("Close websocket"),clearTimeout(this.establishWSTimeoutTimer),this.hasInvokeClose=!0,this.state="disconnected",this.ws&&this.ws.close({reason:"close"}),this.ws=null}}]),e}(),I=function(){function e(t){r()(this,e),this.appId=t.appId,this.channel=t.channel,this.uid=t.uid+"",this.sid=t.sid,this.seq=1,this.requestId=2}return a()(e,[{key:"setSid",value:function(e){this.sid=e}},{key:"_getWorkerManagerMsg",value:function(){return{appId:this.appId,cname:this.channel,uid:this.uid,sid:this.sid,sdkVersion:u.VERSION,seq:++this.seq,requestId:++this.requestId,ts:Math.floor(Date.now()/1e3)}}},{key:"send",value:function(e){var t=this._getWorkerManagerMsg();return t.clientRequest=e,t}},{key:"updatePushUrl",value:function(){var e=this._getWorkerManagerMsg();return e.clientRequest={action:"update_url",role:"publish",uid:+this.uid},e}},{key:"ping",value:function(){return{command:"ping",requestId:++this.requestId,appId:this.appId,cname:this.channel,uid:this.uid+"",sid:this.sid,ts:Math.floor(Date.now()/1e3)}}},{key:"ping2",value:function(){var e=this._getWorkerManagerMsg();return e.clientRequest={action:"ping"},e}},{key:"setRole",value:function(e){var t=this._getWorkerManagerMsg();return t.clientRequest={action:"set_role",role:e},t}},{key:"rejoin",value:function(e,t,i,n,r,s){var a=this._getWorkerManagerMsg();return a.clientRequest={action:"join",role:s,appId:e,key_vocs:n||e,key_vos:n||e,channel_name:t,uid:i+"",known_speakers:r,clientType:"undefined"==typeof qq?"wechat":"qq"},a}},{key:"join",value:function(e,t,i,n,r,s,a){var o=this._getWorkerManagerMsg();return o.clientRequest={action:"join",role:r,appId:e,key_vocs:n||e,key_vos:n||e,channel_name:t,uid:i+"",vid:w().vid.toString(),device:s,os:a,version:u.SDK_VERSION,clientType:"undefined"==typeof qq?"wechat":"qq"},o}},{key:"muteLocal",value:function(e,t){var i=this._getWorkerManagerMsg();return i.clientRequest={action:"mute_local",uid:+e,target:t,mute:!0},i}},{key:"unmuteLocal",value:function(e,t){var i=this._getWorkerManagerMsg();return i.clientRequest={action:"mute_local",uid:+e,target:t,mute:!1},i}},{key:"mute",value:function(e,t){var i=this._getWorkerManagerMsg();return i.clientRequest={action:"mute",uid:+e,target:t},i}},{key:"unmute",value:function(e,t){var i=this._getWorkerManagerMsg();return i.clientRequest={action:"unmute",uid:+e,target:t},i}},{key:"publish",value:function(e){var t=this._getWorkerManagerMsg();return t.clientRequest={action:"publish",uid:+e},t}},{key:"unpublish",value:function(e){var t=this._getWorkerManagerMsg();return t.clientRequest={action:"unpublish",uid:+e},t}},{key:"subscribe",value:function(e,t){var i=this._getWorkerManagerMsg();return i.clientRequest={action:"subscribe",uid:+e,options:{audio:t.audio,video:t.video}},i}},{key:"unsubscribe",value:function(e){var t=this._getWorkerManagerMsg();return t.clientRequest={action:"unsubscribe",uid:[+e]},t}},{key:"setRemoteVideoStreamType",value:function(e,t){var i=this._getWorkerManagerMsg();return i.clientRequest={action:"set_remote_stream_type",uid:+e,type:t},i}},{key:"renewToken",value:function(e){var t=this._getWorkerManagerMsg();return t.clientRequest={action:"update_key",key_vos:e},t}},{key:"leave",value:function(e){var t=this._getWorkerManagerMsg();return t.clientRequest={action:"leave",uid:+e},t}}]),e}(),C=i(0),N=i.n(C),A=function(){function e(t,i){r()(this,e),this.appId=t.appId,this.channel=t.channel,this.uid=t.uid,this.sid=t.sid,this.role=t.role,this.channelKey=t.channelKey,this.clientId="client",this.option=t,this.timers=new Set,this.reportManager=t.reportManager,this.grafanaReport=t.grafanaReport,this.clientEmitter=i,this.emitter=new f,this.on=this.emitter.on,this.off=this.emitter.off,this.emit=this.emitter.emit,this.join=this.join.bind(this),this.msgManager=new I(t)}var t,i,n;return a()(e,[{key:"connect",value:function(){var e=this;return new Promise((function(t,i){e.ws=new k(e.option,e.emitter),e.ws.connect(),e.on("onmessage",e._onMessage.bind(e));e.on("socketError",i),e.on("onopen",(function i(){e.off&&e.off("onopen",i),e._ping(),t()})),e.on("onclose",(function(){return e.clientEmitter.emit("error",{code:904,reason:"websocket disconnected"})}))}))}},{key:"_onMessage",value:function(e){if(e&&e.data){var t=JSON.parse(e.data);if(t&&"pong"!==t.command){p.default.debug("worker message: ",t),p.default.debug("code message:",t);try{this.reportManager.report("serverEvent",{header:{sid:this.sid,cname:this.channel,uid:this.uid,success:!0},body:{action:"serverEvent",details:t,req_ts:+new Date}})}catch(e){}}if(t.requestId&&this.emit(t.requestId,t),"serverStatus"===t.command){if(t.code&&200!==t.code){if(503===t.code)return;this.clientEmitter.emit("error",{code:t.code,reason:t.reason||"server error"})}if(t.serverStatus){p.default.info("Receive message from server: ".concat(JSON.stringify(t.serverStatus)));var i=t.serverStatus.action;if("audio-mute"==i)return t.serverStatus.mute?this.clientEmitter.emit("mute-audio",{uid:t.serverStatus.uid}):this.clientEmitter.emit("unmute-audio",{uid:t.serverStatus.uid});if("video-mute"==i)return t.serverStatus.mute?this.clientEmitter.emit("mute-video",{uid:t.serverStatus.uid}):this.clientEmitter.emit("unmute-video",{uid:t.serverStatus.uid});if("key-expired"===i)return this.clientEmitter.emit("token-privilege-did-expire");if("key-will-expire"===i)return this.clientEmitter.emit("token-privilege-will-expire");this.clientEmitter.emit(i,t.serverStatus)}}}}},{key:"_sendMessage",value:function(e){var t=this;if(this.ws)return new Promise((function(i,n){if(!t.isWSConnected())return n({code:904,reason:"websocket disconnected",wsurl:t.getWSUrl()});"ping"!==e.command&&p.default.debug("send to woker: ",e);var r,s=e?e.requestId:null,a=function e(a){if(t.ws)return t.off(s,e),clearTimeout(r),t.timers.delete(r),200==a.code?i(a.serverResponse):n({code:a.code,reason:a.msg||a.reason,serverResponse:a.serverResponse,wsurl:t.getWSUrl()})};if(!s)return n({code:902,reason:"no requestid"});t.ws.sendMessage(JSON.stringify(e)),t.on(s,a),r=setTimeout((function(){return a({code:903,reason:"time out"})}),1e4),t.timers.add(r)}))}},{key:"_ping",value:function(){var e=this;this.pingTimer=setInterval((function(){e.ws.sendMessage(JSON.stringify(e.msgManager.ping()))}),3e3)}},{key:"setRole",value:function(e){return this._sendMessage(this.msgManager.setRole(e))}},{key:"rejoin",value:function(e){return this._sendMessage(this.msgManager.rejoin(this.appId,this.channel,this.uid,this.channelKey,e,this.role))}},{key:"join",value:function(e,t){return this._sendMessage(this.msgManager.join(this.appId,this.channel,this.uid,this.channelKey,this.role,e,t))}},{key:"send",value:function(e){return this._sendMessage(this.msgManager.send(e))}},{key:"updatePushUrl",value:function(){return this._sendMessage(this.msgManager.updatePushUrl())}},{key:"publish",value:function(){return this._sendMessage(this.msgManager.publish(this.uid))}},{key:"unpublish",value:function(){return this._sendMessage(this.msgManager.unpublish(this.uid))}},{key:"subscribe",value:function(e,t){return this._sendMessage(this.msgManager.subscribe(e,t))}},{key:"unsubscribe",value:function(e){return this._sendMessage(this.msgManager.unsubscribe(e))}},{key:"setRemoteVideoStreamType",value:function(e,t){return this._sendMessage(this.msgManager.setRemoteVideoStreamType(e,t))}},{key:"mute",value:function(e,t){return this._sendMessage(this.msgManager.mute(e,t))}},{key:"unmute",value:function(e,t){return this._sendMessage(this.msgManager.unmute(e,t))}},{key:"muteLocal",value:function(e){return this._sendMessage(this.msgManager.muteLocal(this.uid,e))}},{key:"unmuteLocal",value:function(e){return this._sendMessage(this.msgManager.unmuteLocal(this.uid,e))}},{key:"renewToken",value:function(e){return this._sendMessage(this.msgManager.renewToken(e))}},{key:"leave",value:function(){return this._sendMessage(this.msgManager.leave(this.uid))}},{key:"isWSConnected",value:function(){return!!this.ws&&this.ws.isConnected()}},{key:"getWSUrl",value:function(){return this.ws.serverlist[this.ws.index]}},{key:"destroy",value:function(e){var t=this;clearInterval(this.pingTimer),this.timers.forEach((function(e){clearInterval(e)})),this.timers=null,this.ws&&this.ws.destroy((function(){t.ws=null,t.emitter=null,t.on=null,t.off=null,t.emit=null,e&&e()}))}},{key:"startChannelMediaRelay",value:(n=d()(h.a.mark((function e(t){var i,n,r,s,a,o=this;return h.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.channelMediaRelayController){e.next=2;break}throw new C.ChannelMediaError("RELAY_ALREADY_START","",C.CHANNEL_MEDIA_RELAY_ERROR.RELAY_ALREADY_START);case 2:return i=function(e){o.clientEmitter.emit({type:"channel-media-relay-event",code:e})},n=function(e,t,i){e===C.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_FAILURE&&t===C.CHANNEL_MEDIA_RELAY_ERROR.SERVER_CONNECTION_LOST&&(o.channelMediaRelayController.dispose(),o.channelMediaRelayController=null),o.clientEmitter.emit({type:"channel-media-relay-state",state:e,code:t,data:i})},r={token:this.appId,appId:this.appId,cname:this.channel,uid:this.uid,sid:this.sid,clientId:this.clientId},this.channelMediaRelayController=new N.a(r,this.clientId),this.channelMediaRelayController.on("event",i),this.channelMediaRelayController.on("state",n),e.prev=8,e.next=11,this.channelMediaRelayController.startChannelMediaRelay(t);case 11:e.next=23;break;case 13:throw e.prev=13,e.t0=e.catch(8),p.default.debug("[".concat(this.clientId,"] startChannelMediaRelay exception: ").concat(JSON.stringify(e.t0))),s=C.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_FAILURE,a="",a=e.t0 instanceof C.ChannelMediaError?"SetSourceChannelStatus"===e.t0.data||e.t0.data&&e.t0.data.serverResponse&&"SetSourceChannel"===e.t0.data.serverResponse.command?"FAILED_JOIN_SRC":"SetDestChannelStatus"===e.t0.data||e.t0.data&&e.t0.data.serverResponse&&"SetDestChannel"===e.t0.data.serverResponse.command?"FAILED_JOIN_DEST":e.t0.data&&e.t0.data.serverResponse&&"StartPacketTransfer"===e.t0.data.serverResponse.command?"FAILED_PACKET_SENT_TO_DEST":e.t0.message===C.CHANNEL_MEDIA_ERROR.REQUEST_TIMEOUT||e.t0.message===C.CHANNEL_MEDIA_ERROR.WAIT_STATUS_TIMEOUT?"SERVER_NO_RESPONSE":e.t0.message===C.CHANNEL_MEDIA_ERROR.REQUEST_FAILED||e.t0.message===C.CHANNEL_MEDIA_ERROR.WAIT_STATUS_ERROR?"SERVER_ERROR_RESPONSE":e.t0.message===C.CHANNEL_MEDIA_ERROR.AP_REQUEST_TIMEOUT?"NO_RESOURCE_AVAILABLE":e.t0.message===C.CHANNEL_MEDIA_ERROR.WS_ABORT||e.t0.message===C.CHANNEL_MEDIA_ERROR.AP_REQUEST_ABORT?"OPERATION_ABORT":"INTERNAL_ERROR":"INTERNAL_ERROR",this.clientEmitter.emit({type:"channel-media-relay-state",state:s,code:C.CHANNEL_MEDIA_RELAY_ERROR[a]}),this.channelMediaRelayController&&(this.channelMediaRelayController.dispose(),this.channelMediaConfig=null,this.channelMediaRelayController=null),this.clientEmitter.emit({type:"channel-media-relay-state",state:C.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_IDLE}),new C.ChannelMediaError(a,null,C.CHANNEL_MEDIA_RELAY_ERROR[a]);case 23:this.clientEmitter.emit({type:"channel-media-relay-state",state:C.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_RUNNING,code:C.CHANNEL_MEDIA_RELAY_ERROR.RELAY_OK}),this.channelMediaConfig=t;case 25:case"end":return e.stop()}}),e,this,[[8,13]])}))),function(e){return n.apply(this,arguments)})},{key:"updateChannelMediaRelay",value:(i=d()(h.a.mark((function e(t){var i,n;return h.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.channelMediaRelayController){e.next=2;break}throw new C.ChannelMediaError("RELAY_NOT_START",null,C.CHANNEL_MEDIA_RELAY_ERROR.RELAY_NOT_START);case 2:return e.prev=2,e.next=5,this.channelMediaRelayController.updateChannelMediaRelay(t);case 5:e.next=18;break;case 7:throw e.prev=7,e.t0=e.catch(2),p.default.debug("[".concat(this.clientId,"] updateChannelMediaRelay exception: ").concat(JSON.stringify(e.t0))),i=C.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_FAILURE,n="",n=e.t0 instanceof C.ChannelMediaError?e.t0.message===C.CHANNEL_MEDIA_ERROR.REQUEST_TIMEOUT||e.t0.message===C.CHANNEL_MEDIA_ERROR.WAIT_STATUS_TIMEOUT?"SERVER_NO_RESPONSE":e.t0.message===C.CHANNEL_MEDIA_ERROR.REQUEST_FAILED||e.t0.message===C.CHANNEL_MEDIA_ERROR.WAIT_STATUS_ERROR?"SERVER_ERROR_RESPONSE":e.t0.message===C.CHANNEL_MEDIA_ERROR.WS_ABORT||e.t0.message===C.CHANNEL_MEDIA_ERROR.AP_REQUEST_ABORT?"OPERATION_ABORT":"INTERNAL_ERROR":"INTERNAL_ERROR",this.clientEmitter.emit({type:"channel-media-relay-event",code:C.CHANNEL_MEDIA_RELAY_EVENT.PACKET_UPDATE_DEST_CHANNEL_REFUSED}),this.clientEmitter.emit({type:"channel-media-relay-state",state:i,code:C.CHANNEL_MEDIA_RELAY_ERROR[n]}),this.channelMediaRelayController&&(this.channelMediaRelayController.dispose(),this.channelMediaConfig=null,this.channelMediaRelayController=null),this.clientEmitter.emit({type:"channel-media-relay-state",state:C.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_IDLE}),new C.ChannelMediaError(n,null,C.CHANNEL_MEDIA_RELAY_ERROR[n]);case 18:this.channelMediaConfig=t;case 19:case"end":return e.stop()}}),e,this,[[2,7]])}))),function(e){return i.apply(this,arguments)})},{key:"stopChannelMediaRelay",value:(t=d()(h.a.mark((function e(){var t,i;return h.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.channelMediaRelayController){e.next=2;break}throw new C.ChannelMediaError("RELAY_NOT_START",null,C.CHANNEL_MEDIA_RELAY_ERROR.RELAY_NOT_START);case 2:return e.prev=2,e.next=5,this.channelMediaRelayController.stopChannelMediaRelay();case 5:e.next=17;break;case 7:throw e.prev=7,e.t0=e.catch(2),p.default.debug("[".concat(this.clientId,"] stopChannelMediaRelay exception: ").concat(JSON.stringify(e.t0))),t=C.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_FAILURE,i="",i=e.t0 instanceof C.ChannelMediaError?e.t0.message===C.CHANNEL_MEDIA_ERROR.REQUEST_TIMEOUT||e.t0.message===C.CHANNEL_MEDIA_ERROR.WAIT_STATUS_TIMEOUT?"SERVER_NO_RESPONSE":e.t0.message===C.CHANNEL_MEDIA_ERROR.REQUEST_FAILED||e.t0.message===C.CHANNEL_MEDIA_ERROR.WAIT_STATUS_ERROR?"SERVER_ERROR_RESPONSE":"INTERNAL_ERROR":"INTERNAL_ERROR",this.clientEmitter.emit({type:"channel-media-relay-state",state:t,code:C.CHANNEL_MEDIA_RELAY_ERROR[i]}),this.channelMediaRelayController&&(this.channelMediaRelayController.dispose(),this.channelMediaConfig=null,this.channelMediaRelayController=null),this.emit({type:"channel-media-relay-state",state:C.CHANNEL_MEDIA_RELAY_STATE.RELAY_STATE_IDLE}),new C.ChannelMediaError(i,null,C.CHANNEL_MEDIA_RELAY_ERROR[i]);case 17:this.channelMediaConfig=null,this.channelMediaRelayController=null;case 19:case"end":return e.stop()}}),e,this,[[2,7]])}))),function(){return t.apply(this,arguments)})}]),e}(),M=i(37).ReportServiceClient,O=i(9).default,P=i(17).VosdkHeader,L=i(16),B=function(){function e(){r()(this,e),this.transport=new O.TXHRTransport("https://uni-webcollector.agora.io/report"),this.protocol=new O.TJSONProtocol(this.transport),this.client=new M(this.protocol),this.seqId=0,this._cache=[],this.isReporting=!1,this.retryCount=0}return a()(e,[{key:"generateHeader",value:function(e){if(e&&e.sid)return new P({sid:e.sid,cname:e.cname||"",lts:e.lts,elapse:e.lts-this.startTime,uid:e.uid,success:e.success})}},{key:"report",value:function(e,t){var i=null;if(t.header&&(t.header.lts=+new Date,"sessionStart"===e&&(this.startTime=t.header.lts),i=this.generateHeader(t.header)),t.body&&i){var n=t.body;switch(e){case"sessionStart":(r=new L({miniappSession:!0})).uri=8e3,r.miniappSession.header=i,r.miniappSession.appid=n.appId,r.miniappSession.uname=n.uname,r.miniappSession.ver=u.SDK_VERSION,r.miniappSession.dk=n.dk,r.miniappSession.details=JSON.stringify({seq:this.seqId++});break;case"chooseServer":(r=new L({miniappJoinChooseServer:!0})).uri=8001,r.miniappJoinChooseServer.header=i,r.miniappJoinChooseServer.csurl=n.csurl,r.miniappJoinChooseServer.ec=n.ec,r.miniappJoinChooseServer.gatewaylist=n.gatewaylist,r.miniappJoinChooseServer.details=JSON.stringify({seq:this.seqId++});break;case"connectWebSocket":(r=new L({miniappConnectWebSocket:!0})).uri=8002,r.miniappConnectWebSocket.header=i,r.miniappConnectWebSocket.ec=n.ec,r.miniappConnectWebSocket.wsurl=n.wsurl,r.miniappConnectWebSocket.details=JSON.stringify({seq:this.seqId++});break;case"join":(r=new L({miniappJoin:!0})).uri=8003,r.miniappJoin.header=i,r.miniappJoin.ec=n.ec,r.miniappJoin.isrejoin=n.isrejoin,r.miniappJoin.details=JSON.stringify({seq:this.seqId++,appId:n.appId,wsurl:n.wsurl});break;case"publish":(r=new L({miniappPublish:!0})).uri=8004,r.miniappPublish.header=i,r.miniappPublish.ec=n.ec,r.miniappPublish.pushurl=n.pushurl,r.miniappPublish.details=JSON.stringify({seq:this.seqId++});break;case"unpublish":(r=new L({miniappUnpublish:!0})).uri=8005,r.miniappUnpublish.header=i,r.miniappUnpublish.ec=n.ec,r.miniappUnpublish.details=JSON.stringify({seq:this.seqId++});break;case"subscribe":(r=new L({miniappSubscribe:!0})).uri=8006,r.miniappSubscribe.header=i,r.miniappSubscribe.ec=n.ec,r.miniappSubscribe.pullurl=n.pullurl,r.miniappSubscribe.peerid=n.peerid,r.miniappSubscribe.details=JSON.stringify({seq:this.seqId++});break;case"unsubscribe":(r=new L({miniappUnsubscribe:!0})).uri=8007,r.miniappUnsubscribe.header=i,r.miniappUnsubscribe.ec=n.ec,r.miniappUnsubscribe.peerid=n.peerid,r.miniappUnsubscribe.details=JSON.stringify({seq:this.seqId++});break;case"leave":(r=new L({miniappLeave:!0})).uri=8008,r.miniappLeave.header=i,r.miniappLeave.ec=n.ec,r.miniappLeave.details=JSON.stringify({seq:this.seqId++});break;case"pusherState":(r=new L({miniappPusherState:!0})).uri=8010,r.miniappPusherState.header=i,r.miniappPusherState.url=n.url,r.miniappPusherState.code=n.code,r.miniappPusherState.status=n.status,r.miniappPusherState.error=n.error,r.miniappPusherState.details=JSON.stringify({seq:this.seqId++});break;case"playerState":(r=new L({miniappPlayerState:!0})).uri=8011,r.miniappPlayerState.header=i,r.miniappPlayerState.url=n.url,r.miniappPlayerState.code=n.code,r.miniappPlayerState.status=n.status,r.miniappPlayerState.error=n.error,r.miniappPlayerState.details=JSON.stringify({seq:this.seqId++});break;case"serverEvent":(r=new L({miniappServerEvent:!0})).uri=8009,r.miniappServerEvent.header=i,r.miniappServerEvent.action=n.action,r.miniappServerEvent.details=JSON.stringify(n.details),r.miniappServerEvent.req_ts=n.req_ts}}if(this._cache.push(r),!this.isReporting&&this._cache.length>0){var r=this._cache.shift();this._report(r)}}},{key:"_report",value:function(e){var t=this;this.isReporting=!0,this.client.Report(e,(function(i){if(i){p.default.debug("Report failed: ",i,e);var n=t.retryCount++<2?200:1e4;setTimeout((function(){t._report(e)}),n)}else{p.default.debug("Report succcess: ",e);var r=t._cache.shift();r?t._report(r):t.isReporting=!1}}))}}]),e}(),F={videoBitrate:"Miniapp_SDK_Pusher_Video_Bitrate",audioBitrate:"Miniapp_SDK_Pusher_Audio_Bitrate",videoFPS:"Miniapp_SDK_Pusher_Video_FPS",videoGOP:"Miniapp_SDK_Pusher_Video_GOP",netSpeed:"Miniapp_SDK_Pusher_Net_Speed",videoCache:"Miniapp_SDK_Pusher_Video_Cache",audioCache:"Miniapp_SDK_Pusher_Audio_Cache",videoWidth:"Miniapp_SDK_Pusher_Video_Width",videoHeight:"Miniapp_SDK_Pusher_Video_Height"},D={videoBitrate:"Miniapp_SDK_Player_Video_Bitrate",audioBitrate:"Miniapp_SDK_Player_Audio_Bitrate",videoFPS:"Miniapp_SDK_Player_Video_FPS",videoGOP:"Miniapp_SDK_Player_Video_GOP",netSpeed:"Miniapp_SDK_Player_Video_Cache",videoCache:"Miniapp_SDK_Player_Video_Cache",audioCache:"Miniapp_SDK_Player_Audio_Cache",vDecCacheSize:"Miniapp_SDK_Player_V_Dec_Cache_Size",vSumCacheSize:"Miniapp_SDK_Player_V_Sum_Cache_Size",avPlayInterval:"Miniapp_SDK_Player_AV_Play_Interval",avRecvInterval:"Miniapp_SDK_Player_AV_Recv_Interval",audioCacheThreshold:"Miniapp_SDK_Player_Audio_Cache_Threshold",videoWidth:"Miniapp_SDK_Player_Video_Width",videoHeight:"Miniapp_SDK_Player_Video_Height"},U=i(23),x=i.n(U).a.io.agora.pb,j=x.CounterCompact,q=x.Id,V=(x.Item,function(){function e(){r()(this,e),this.url="https://rest-argus-ad.agoralab.co/v2/report",this.sid=Object(o.generateSessionId)(),this.pusherNet=null,this.playerNetMap={},this.pusherTimer=null,this.playerTimer=null,this.startPusherReport(),this.startPlayerReport()}return a()(e,[{key:"setPusherNetData",value:function(e){this.pusherNet=e}},{key:"setPlayerNetData",value:function(e,t){this.playerNetMap[e]=t}},{key:"getMessageTypeId",value:function(e){return q[e]}},{key:"shiftPb",value:function(e,t,i){var n=this,r=Date.now(),s=t.map((function(e){return{lts:r,id:n.getMessageTypeId(i[e.type]),value:e.value,tagErrorCode:6,streamId:0}})),a={sid:this.sid,peer:e,items:s},o=j.create(a);return j.encode(o).finish()}},{key:"startPusherReport",value:function(){var e=this;this.pusherTimer=setInterval((function(){if(e.pusherNet){var t=Object.keys(e.pusherNet).map((function(t){return void 0!==F[t]?{type:t,value:e.pusherNet[t]}:null}));t=t.filter((function(e){return null!==e}));var i=e.shiftPb(0,t,F);e.report(i)}}),6e3)}},{key:"startPlayerReport",value:function(){var e=this;this.playerTimer=setInterval((function(){if(e.playerNetMap){var t=function(t){var i=e.playerNetMap[t],n=Object.keys(i).map((function(e){return void 0!==D[e]?{type:e,value:i[e]}:null}));n=n.filter((function(e){return null!==e}));var r=e.shiftPb(t,n,D);e.report(r)};for(var i in e.playerNetMap)t(i)}e.playerNetMap={}}),6e3)}},{key:"destroy",value:function(){null!==this.pusherTimer&&clearInterval(this.pusherTimer),null!==this.playerTimer&&clearInterval(this.playerTimer),this.pusherNet=null,this.playerNet=null}},{key:"report",value:function(e){var t=Date.now();t=Math.floor(t/1e3);var i=wx.arrayBufferToBase64(e),n={id:1,payload:i,qos:1,sign:T()("payload=".concat(i,"&src=miniapp_sdk&ts=").concat(t)),src:"miniapp_sdk",ts:t};return this.request({body:n,url:this.url})}},{key:"request",value:function(e){return new Promise((function(t,i){wx.request({url:e.url,data:e.body,header:{"Content-Type":"application/json"},method:"POST",success:function(e){p.default.info("weixin request argus report success"),200===e.statusCode?(p.default.info("response success"),t(e)):p.default.info("response fail: ".concat(e.statusCode))},fail:function(e){p.default.warn("weixin request argus report fail"),i(e)}})}))}}]),e}()),W=i(6),G=function(){function e(t){var i=this;r()(this,e),this.emitter=new f,this.on=this.emitter.on,this.off=this.emitter.off,this.sid=Object(o.generateSessionId)(),this.pushUrl=null,this.playUrls=new Map,this.servers=t&&t.servers,this.reportManager=new B,this.role="broadcaster",this.grafanaReport=new m,this.argusReport=new V,this.systemInfo=null,this.emitter.on("stream-removed",(function(e){i.playUrls&&i.playUrls.delete(e.uid)}))}return a()(e,[{key:"init",value:function(e,t,i){if(!e||"string"!=typeof e||"null"===e.toLowerCase())throw Error("Invalid appId");this.appId=e.trim(),this.argusReport.sid=this.sid,this.grafanaReport.vid="",this.grafanaReport.onlineUser();try{this.systemInfo=wx.getSystemInfoSync()}catch(e){}this.reportManager.report("sessionStart",{header:{sid:this.sid,lts:+new Date,success:!0},body:{appId:e}}),t&&t()}},{key:"setRole",value:function(e,t,i){var n=this;if("broadcaster"===!e&&"audience"===!e)throw Error("Invalid role");this.role=e,this.worker&&this.worker.setRole(e).then((function(e){try{n.grafanaReport.report("set_role",_)}catch(e){}setTimeout((function(){if(!e)return t&&t();t&&t({updateURL:e["update-url"]})}),1)})).catch((function(){try{n.grafanaReport.report("set_role",S,err.code)}catch(e){}i&&i()}))}},{key:"rejoin",value:function(e,t,i,n,r,s){var a=this;if(!this.worker){if(e){if("string"!=typeof e||"null"===e.toLowerCase())throw Error("Invalid channelKey")}else e=this.appId;if(!t||"string"!=typeof t||"null"===t.toLowerCase()||t.length>128)throw Error("Invalid channel");if(this.uid=i||Object(o.random)(1e7),this.uid=Number.parseInt(this.uid),!Object(o.is32Uint)(this.uid))throw new Error("Invalid uid type");this.channel=t,this.worker=new A({appId:this.appId,channel:this.channel,uid:this.uid,sid:this.sid,role:this.role,servers:this.servers,channelKey:e,reportManager:this.reportManager,grafanaReport:this.grafanaReport},this.emitter),this.worker.connect().then((function(){return a.worker.rejoin(n)})).then((function(){try{a.reportManager.report("join",{header:{sid:a.sid,cname:a.channel,uid:a.uid,success:!0},body:{isrejoin:!0,appId:a.appId,wsurl:a.worker&&a.worker.getWSUrl()}})}catch(e){}try{a.grafanaReport.report("join",_)}catch(e){}setTimeout((function(){r&&r(this.uid)}),1)})).catch((function(e){try{a.reportManager.report("join",{header:{sid:a.sid,cname:a.channel,uid:a.uid,success:!1},body:{ec:JSON.stringify(e),appId:a.appId,wsurl:a.worker&&a.worker.getWSUrl()}})}catch(e){}try{a.grafanaReport.report("join",S,e.code)}catch(e){}a.destroy(),s&&s(e)}))}}},{key:"join",value:function(e,t,i,n,r){var s=this;if(!this.worker){if(e){if("string"!=typeof e||"null"===e.toLowerCase())throw Error("Invalid channelKey")}else e=this.appId;if(!t||"string"!=typeof t||"null"===t.toLowerCase()||t.length>128)throw Error("Invalid channel");if(this.uid=i||Object(o.random)(1e7),this.uid=Number.parseInt(this.uid),!Object(o.is32Uint)(this.uid))throw new Error("Invalid uid type");this.channel=t,this.worker=new A({appId:this.appId,channel:this.channel,uid:this.uid,sid:this.sid,role:this.role,servers:this.servers,channelKey:e,reportManager:this.reportManager,grafanaReport:this.grafanaReport},this.emitter),this.worker.connect().then((function(){return s.worker.join(s.systemInfo.model,s.systemInfo.system)})).then((function(e){try{s.reportManager.report("join",{header:{sid:s.sid,cname:s.channel,uid:s.uid,success:!0},body:{isrejoin:!1,appId:s.appId,wsurl:s.worker&&s.worker.getWSUrl()}})}catch(e){}try{s.grafanaReport.report("join",_,"",{model:s.systemInfo.model,version:s.systemInfo.version,system:s.systemInfo.system,ip:w().ip})}catch(e){}setTimeout((function(){n&&n(this.uid)}),1)})).catch((function(e){try{s.reportManager.report("join",{header:{sid:s.sid,cname:s.channel,uid:s.uid,success:!1},body:{ec:JSON.stringify(e),appId:s.appId,wsurl:e.wsurl||s.worker&&s.worker.getWSUrl()}})}catch(e){}try{s.grafanaReport.report("join",S,e.code,{model:s.systemInfo.model,version:s.systemInfo.version,system:s.systemInfo.system,ip:w().ip})}catch(e){}s.destroy(),r&&r(e)}))}}},{key:"publish",value:function(e,t){var i=this;this._checkWorker(),this.worker.publish().then((function(t){i.pushUrl=t.url;try{i.reportManager.report("publish",{header:{sid:i.sid,cname:i.channel,uid:i.uid,success:!0},body:{pushurl:t.url}})}catch(e){}try{i.grafanaReport.report("publish",_)}catch(e){}setTimeout((function(){e&&e(t.url)}),1)})).catch((function(e){i.reportManager.report("publish",{header:{sid:i.sid,cname:i.channel,uid:i.uid,success:!1},body:{ec:JSON.stringify(e)}});try{i.grafanaReport.report("publish",S,e.code)}catch(e){}t&&t(e)}))}},{key:"unpublish",value:function(e,t){var i=this;this._checkWorker(),this.worker.unpublish().then((function(t){i.pushUrl=null;try{i.reportManager.report("unpublish",{header:{sid:i.sid,cname:i.channel,uid:i.uid,success:!0},body:{}})}catch(e){}try{i.grafanaReport.report("unpublish",_)}catch(e){}setTimeout((function(){e&&e()}),1)})).catch((function(e){i.reportManager.report("unpublish",{header:{sid:i.sid,cname:i.channel,uid:i.uid,success:!1},body:{ec:JSON.stringify(e)}});try{i.grafanaReport.report("unpublish",S,e.code)}catch(e){}t&&t(e)}))}},{key:"subscribe",value:function(e,t,i){var n=this,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{audio:!0,video:!0};this._checkUid(e),this._checkWorker(),this.worker.subscribe(e,r).then((function(i){n.playUrls.set(e,i.url);try{n.reportManager.report("subscribe",{header:{sid:n.sid,cname:n.channel,uid:n.uid,success:!0},body:{pullurl:i.url}})}catch(e){}try{n.grafanaReport.report("subscribe",_)}catch(e){}setTimeout((function(){t&&t(i.url,i.rotation)}),1)})).catch((function(e){n.reportManager.report("subscribe",{header:{sid:n.sid,cname:n.channel,uid:n.uid,success:!1},body:{ec:JSON.stringify(e)}});try{n.grafanaReport.report("subscribe",S,e.code)}catch(e){}i&&i(e)}))}},{key:"unsubscribe",value:function(e,t,i){var n=this;this._checkUid(e),this._checkWorker(),this.worker.unsubscribe(e).then((function(i){n.playUrls.delete(e);try{n.reportManager.report("unsubscribe",{header:{sid:n.sid,cname:n.channel,uid:n.uid,success:!1},body:{}})}catch(e){}try{n.grafanaReport.report("unsubscribe",_)}catch(e){}setTimeout((function(){t&&t()}),1)})).catch((function(e){n.reportManager.report("unsubscribe",{header:{sid:n.sid,cname:n.channel,uid:n.uid,success:!1},body:{ec:JSON.stringify(e)}});try{n.grafanaReport.report("unsubscribe",S,e.code)}catch(e){}i&&i(e)}))}},{key:"mute",value:function(e,t,i,n){var r=this;if(this._checkUid(e),this._checkWorker(),"video"!==t&&"audio"!==t&&"all"!==t)throw new Error('target should be "video", "audio" or "all"');this.worker.mute(e,t).then((function(e){try{r.grafanaReport.report("mute",_)}catch(e){}setTimeout((function(){i&&i()}),1)})).catch((function(e){try{r.grafanaReport.report("mute",S,e.code)}catch(e){}n&&n(e)}))}},{key:"unmute",value:function(e,t,i,n){var r=this;if(this._checkUid(e),this._checkWorker(),"video"!==t&&"audio"!==t&&"all"!==t)throw new Error('target should be "video", "audio" or "all"');this.worker.unmute(e,t).then((function(e){try{r.grafanaReport.report("unmute",_)}catch(e){}setTimeout((function(){i&&i()}),1)})).catch((function(e){try{r.grafanaReport.report("unmute",S,e.code)}catch(e){}n&&n(e)}))}},{key:"setRemoteVideoStreamType",value:function(e,t,i,n){var r=this;this._checkUid(e),this._checkWorker(),this.worker.setRemoteVideoStreamType(e,t).then((function(e){try{r.grafanaReport.report("set_remote_stream_type",_)}catch(e){}setTimeout((function(){i&&i()}),1)})).catch((function(e){try{r.grafanaReport.report("set_remote_stream_type",S,e.code)}catch(e){}n&&n(e)}))}},{key:"renewToken",value:function(e,t,i){var n=this;this._checkWorker(),this.worker.renewToken(e).then((function(e){try{n.grafanaReport.report("update_token",_)}catch(e){}setTimeout((function(){t&&t()}),1)})).catch((function(e){try{n.grafanaReport.report("update_token",S,e.code)}catch(e){}i&&i(e)}))}},{key:"muteLocal",value:function(e,t,i){var n=this;if(this._checkWorker(),"video"!==e&&"audio"!==e&&"all"!==e)throw new Error('target should be "video", "audio" or "all"');this.worker.muteLocal(e).then((function(e){try{n.grafanaReport.report("mute_local",_)}catch(e){}setTimeout((function(){t&&t()}),1)})).catch((function(e){try{n.grafanaReport.report("mute_local",S,e.code)}catch(e){}i&&i(e)}))}},{key:"unmuteLocal",value:function(e,t,i){var n=this;if(this._checkWorker(),"video"!==e&&"audio"!==e&&"all"!==e)throw new Error('target should be "video", "audio" or "all"');this.worker.unmuteLocal(e).then((function(e){try{n.grafanaReport.report("unmute_local",_)}catch(e){}setTimeout((function(){t&&t()}),1)})).catch((function(e){try{n.grafanaReport.report("unmute_local",S,e.code)}catch(e){}i&&i(e)}))}},{key:"leave",value:function(e,t){var i=this;this.worker&&this.worker.isWSConnected()&&this.worker.leave().then((function(t){try{i.reportManager.report("leave",{header:{sid:i.sid,cname:i.channel,uid:i.uid,success:!0},body:{}})}catch(e){}try{i.grafanaReport.report("leave",_)}catch(e){}i.destroy((function(){setTimeout((function(){e&&e()}),1)}))})).catch((function(e){try{i.grafanaReport.report("leave",S,e.code)}catch(e){}t&&t(e)}))}},{key:"_checkUid",value:function(e){if(!e||"number"!=typeof e||!Object(o.is32Uint)(e))throw new Error("Invalid uid type")}},{key:"_checkWorker",value:function(){if(!this.worker||!this.worker.isWSConnected())throw new Error("Disconnected from server")}},{key:"isConnected",value:function(){return!(!this.worker||!this.worker.isWSConnected())}},{key:"updatePusherStateChange",value:function(e){if(this.pushUrl){var t=e.detail.code,i=e.detail.message;if(1002===t)try{this.grafanaReport.report("pusher_state_change",_,t)}catch(e){}if(-1307===t)try{this.grafanaReport.report("pusher_state_change",S,t,i)}catch(e){}}}},{key:"updatePlayerStateChange",value:function(e,t){if(this.playUrls.get(Number(e))){var i=t.detail.code,n=t.detail.message;if(2003===i||-2301===i){var r=2003===i?_:S;try{this.grafanaReport.report("player_state_change",r,i,n)}catch(e){}}}}},{key:"updatePusherNetStatus",value:function(e){if(this.pushUrl){var t=e.detail.info;this.argusReport.setPusherNetData(t)}}},{key:"updatePlayerNetStatus",value:function(e,t){if(this.playUrls.get(Number(e))){var i=t.detail.info;this.argusReport.setPlayerNetData(e,i)}}},{key:"send",value:function(e,t,i){this._checkWorker(),this.worker.send(e).then((function(e){t&&t(e)})).catch((function(e){i&&i(e)}))}},{key:"updatePushUrl",value:function(e,t){var i=this;this._checkWorker(),this.worker.updatePushUrl().then((function(t){setTimeout((function(){try{this.grafanaReport.report("update_url",_)}catch(e){}e&&e(t)}),1)})).catch((function(e){try{i.grafanaReport.report("update_url",S,e.code)}catch(e){}t&&t(e)}))}},{key:"destroy",value:function(e,t){var i=this;this.worker?(this.worker.destroy((function(){i.pushUrl=null,i.playUrls=null,e&&e()})),this.worker=null):(this.pushUrl=null,this.playUrls=null,e&&e()),this.grafanaReport.destroy(),this.argusReport.destroy()}},{key:"startChannelMediaRelay",value:function(e,t){if(!(e instanceof C.ChannelMediaRelayConfiguration))throw"Configration should be instance of [ChannelMediaRelayConfiguration]";var i=e.getSrcChannelMediaInfo(),n=e.getDestChannelMediaInfos();if(Object(W.isEmpty)(i))throw"srcChannelMediaInfo should not be empty";if(Object(W.isEmpty)(n)||0===n.length)throw"destChannelMediaInfos should not be empty";if(p.default.debug("[startChannelMediaRelay]: srcInfo: ",i," destInfo: ",n),!Object(o.is32Uint)(i.uid))throw"Invalid uid in srcChannelMediaInfo";if(!Object(W.isValidChannelName)(i.channelName))throw"Invalid channelName in srcChannelMediaInfo";if(i.token&&!Object(W.isValidToken)(i.token))throw"Invalid token in srcChannelMediaInfo";if(n.forEach((function(e){if(!Object(o.is32Uint)(e.uid))throw"Invalid uid in destChannelMediaInfo";if(!Object(W.isValidChannelName)(e.channelName))throw"Invalid channelName in destChannelMediaInfo";if(e.token&&!Object(W.isValidToken)(e.token))throw"Invalid token in destChannelMediaInfo"})),!this.worker)throw"startChannelMediaRelay should be used after join";this.worker.startChannelMediaRelay(e).then((function(){t&&t()})).catch((function(e){t&&t(e)}))}},{key:"updateChannelMediaRelay",value:function(e,t){if(!(e instanceof C.ChannelMediaRelayConfiguration))throw"Configration should be instance of [ChannelMediaRelayConfiguration]";var i=e.getSrcChannelMediaInfo(),n=e.getDestChannelMediaInfos();if(Object(W.isEmpty)(i))throw"srcChannelMediaInfo should not be empty";if(Object(W.isEmpty)(n)||0===n.length)throw"destChannelMediaInfos should not be empty";if(p.default.debug("[updateChannelMediaRelay]: srcInfo: ",i," destInfo: ",n),!Object(o.is32Uint)(i.uid))throw"Invalid uid in srcChannelMediaInfo";if(!Object(W.isValidChannelName)(i.channelName))throw"Invalid channelName in srcChannelMediaInfo";if(i.token&&!Object(W.isValidToken)(i.token))throw"Invalid token in srcChannelMediaInfo";if(n.forEach((function(e){if(!Object(o.is32Uint)(e.uid))throw"Invalid uid in destChannelMediaInfo";if(!Object(W.isValidChannelName)(e.channelName))throw"Invalid channelName in destChannelMediaInfo";if(e.token&&!Object(W.isValidToken)(e.token))throw"Invalid token in destChannelMediaInfo"})),!this.worker)throw"updateChannelMediaRelay should be used after join";this.worker.updateChannelMediaRelay(e).then((function(){t&&t()})).catch((function(e){t&&t(e)}))}},{key:"stopChannelMediaRelay",value:function(e){p.default.debug("[stopChannelMediaRelay]"),this.worker.stopChannelMediaRelay().then((function(){e&&e()})).catch((function(t){e&&e(t)}))}}]),e}();i.d(t,"Client",(function(){return G})),i.d(t,"LOG",(function(){return p.default})),i.d(t,"Log",(function(){return p.Log})),i.d(t,"ChannelMediaRelayConfiguration",(function(){return C.ChannelMediaRelayConfiguration})),i.d(t,"SDK_VERSION",(function(){return u.SDK_VERSION}))}])}));
//# sourceMappingURL=mini-app-sdk-production.js.map