@ylink-sdk/meeting 0.2.0-beta.1 → 0.2.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";function e(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(t){n(t)}}function a(e){try{c(s.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))}function t(e){return{all:e=e||new Map,on:function(t,r){var s=e.get(t);s?s.push(r):e.set(t,[r])},off:function(t,r){var s=e.get(t);s&&(r?s.splice(s.indexOf(r)>>>0,1):e.set(t,[]))},emit:function(t,r){var s=e.get(t);s&&s.slice().map((function(e){e(r)})),(s=e.get("*"))&&s.slice().map((function(e){e(t,r)}))}}}Object.defineProperty(exports,"__esModule",{value:!0});var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s={exports:{}};!function(e,t){var s="__lodash_hash_undefined__",i=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",h="[object Promise]",f="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",x="[object WeakMap]",y="[object ArrayBuffer]",b="[object DataView]",E="[object Float32Array]",I="[object Float64Array]",q="[object Int8Array]",D="[object Int16Array]",O="[object Int32Array]",T="[object Uint8Array]",$="[object Uint8ClampedArray]",_="[object Uint16Array]",S="[object Uint32Array]",A=/\w*$/,w=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,j={};j[n]=j["[object Array]"]=j[y]=j[b]=j[o]=j[a]=j[E]=j[I]=j[q]=j[D]=j[O]=j[d]=j[l]=j[p]=j[f]=j[m]=j[g]=j[v]=j[T]=j[$]=j[_]=j[S]=!0,j["[object Error]"]=j[c]=j[x]=!1;var P="object"==typeof self&&self&&self.Object===Object&&self,N="object"==typeof r&&r&&r.Object===Object&&r||P||Function("return this")(),C=t&&!t.nodeType&&t,R=C&&e&&!e.nodeType&&e,k=R&&R.exports===C;function L(e,t){return e.set(t[0],t[1]),e}function M(e,t){return e.add(t),e}function H(e,t,r,s){var i=-1,n=e?e.length:0;for(s&&n&&(r=e[++i]);++i<n;)r=t(r,e[i],i,e);return r}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(r){}return t}function G(e){var t=-1,r=Array(e.size);return e.forEach((function(e,s){r[++t]=[s,e]})),r}function B(e,t){return function(r){return e(t(r))}}function Y(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var W,X=Array.prototype,F=Function.prototype,J=Object.prototype,K=N["__core-js_shared__"],z=(W=/[^.]+$/.exec(K&&K.keys&&K.keys.IE_PROTO||""))?"Symbol(src)_1."+W:"",Q=F.toString,Z=J.hasOwnProperty,ee=J.toString,te=RegExp("^"+Q.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),re=k?N.Buffer:void 0,se=N.Symbol,ie=N.Uint8Array,ne=B(Object.getPrototypeOf,Object),oe=Object.create,ae=J.propertyIsEnumerable,ce=X.splice,ue=Object.getOwnPropertySymbols,de=re?re.isBuffer:void 0,le=B(Object.keys,Object),pe=Re(N,"DataView"),he=Re(N,"Map"),fe=Re(N,"Promise"),me=Re(N,"Set"),ge=Re(N,"WeakMap"),ve=Re(Object,"create"),xe=Ve(pe),ye=Ve(he),be=Ve(fe),Ee=Ve(me),Ie=Ve(ge),qe=se?se.prototype:void 0,De=qe?qe.valueOf:void 0;function Oe(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}function Te(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}function $e(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}function _e(e){this.__data__=new Te(e)}function Se(e,t){var r=Be(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ye(e)}(e)&&Z.call(e,"callee")&&(!ae.call(e,"callee")||ee.call(e)==n)}(e)?function(e,t){for(var r=-1,s=Array(e);++r<e;)s[r]=t(r);return s}(e.length,String):[],s=r.length,i=!!s;for(var o in e)!t&&!Z.call(e,o)||i&&("length"==o||Me(o,s))||r.push(o);return r}function Ae(e,t,r){var s=e[t];Z.call(e,t)&&Ge(s,r)&&(void 0!==r||t in e)||(e[t]=r)}function we(e,t){for(var r=e.length;r--;)if(Ge(e[r][0],t))return r;return-1}function Ue(e,t,r,s,i,h,x){var w;if(s&&(w=h?s(e,i,h,x):s(e)),void 0!==w)return w;if(!Fe(e))return e;var U=Be(e);if(U){if(w=function(e){var t=e.length,r=e.constructor(t);t&&"string"==typeof e[0]&&Z.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!t)return function(e,t){var r=-1,s=e.length;t||(t=Array(s));for(;++r<s;)t[r]=e[r];return t}(e,w)}else{var P=Le(e),N=P==c||P==u;if(We(e))return function(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}(e,t);if(P==p||P==n||N&&!h){if(V(e))return h?e:{};if(w=function(e){return"function"!=typeof e.constructor||He(e)?{}:(t=ne(e),Fe(t)?oe(t):{});var t}(N?{}:e),!t)return function(e,t){return Ne(e,ke(e),t)}(e,function(e,t){return e&&Ne(t,Je(t),e)}(w,e))}else{if(!j[P])return h?e:{};w=function(e,t,r,s){var i=e.constructor;switch(t){case y:return Pe(e);case o:case a:return new i(+e);case b:return function(e,t){var r=t?Pe(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,s);case E:case I:case q:case D:case O:case T:case $:case _:case S:return function(e,t){var r=t?Pe(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,s);case d:return function(e,t,r){return H(t?r(G(e),!0):G(e),L,new e.constructor)}(e,s,r);case l:case g:return new i(e);case f:return function(e){var t=new e.constructor(e.source,A.exec(e));return t.lastIndex=e.lastIndex,t}(e);case m:return function(e,t,r){return H(t?r(Y(e),!0):Y(e),M,new e.constructor)}(e,s,r);case v:return n=e,De?Object(De.call(n)):{}}var n}(e,P,Ue,t)}}x||(x=new _e);var C=x.get(e);if(C)return C;if(x.set(e,w),!U)var R=r?function(e){return function(e,t,r){var s=t(e);return Be(e)?s:function(e,t){for(var r=-1,s=t.length,i=e.length;++r<s;)e[i+r]=t[r];return e}(s,r(e))}(e,Je,ke)}(e):Je(e);return function(e,t){for(var r=-1,s=e?e.length:0;++r<s&&!1!==t(e[r],r,e););}(R||e,(function(i,n){R&&(i=e[n=i]),Ae(w,n,Ue(i,t,r,s,n,e,x))})),w}function je(e){return!(!Fe(e)||(t=e,z&&z in t))&&(Xe(e)||V(e)?te:w).test(Ve(e));var t}function Pe(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Ne(e,t,r,s){r||(r={});for(var i=-1,n=t.length;++i<n;){var o=t[i],a=s?s(r[o],e[o],o,r,e):void 0;Ae(r,o,void 0===a?e[o]:a)}return r}function Ce(e,t){var r,s,i=e.__data__;return("string"==(s=typeof(r=t))||"number"==s||"symbol"==s||"boolean"==s?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function Re(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return je(r)?r:void 0}Oe.prototype.clear=function(){this.__data__=ve?ve(null):{}},Oe.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Oe.prototype.get=function(e){var t=this.__data__;if(ve){var r=t[e];return r===s?void 0:r}return Z.call(t,e)?t[e]:void 0},Oe.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Z.call(t,e)},Oe.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?s:t,this},Te.prototype.clear=function(){this.__data__=[]},Te.prototype.delete=function(e){var t=this.__data__,r=we(t,e);return!(r<0)&&(r==t.length-1?t.pop():ce.call(t,r,1),!0)},Te.prototype.get=function(e){var t=this.__data__,r=we(t,e);return r<0?void 0:t[r][1]},Te.prototype.has=function(e){return we(this.__data__,e)>-1},Te.prototype.set=function(e,t){var r=this.__data__,s=we(r,e);return s<0?r.push([e,t]):r[s][1]=t,this},$e.prototype.clear=function(){this.__data__={hash:new Oe,map:new(he||Te),string:new Oe}},$e.prototype.delete=function(e){return Ce(this,e).delete(e)},$e.prototype.get=function(e){return Ce(this,e).get(e)},$e.prototype.has=function(e){return Ce(this,e).has(e)},$e.prototype.set=function(e,t){return Ce(this,e).set(e,t),this},_e.prototype.clear=function(){this.__data__=new Te},_e.prototype.delete=function(e){return this.__data__.delete(e)},_e.prototype.get=function(e){return this.__data__.get(e)},_e.prototype.has=function(e){return this.__data__.has(e)},_e.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Te){var s=r.__data__;if(!he||s.length<199)return s.push([e,t]),this;r=this.__data__=new $e(s)}return r.set(e,t),this};var ke=ue?B(ue,Object):function(){return[]},Le=function(e){return ee.call(e)};function Me(e,t){return!!(t=null==t?i:t)&&("number"==typeof e||U.test(e))&&e>-1&&e%1==0&&e<t}function He(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||J)}function Ve(e){if(null!=e){try{return Q.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Ge(e,t){return e===t||e!=e&&t!=t}(pe&&Le(new pe(new ArrayBuffer(1)))!=b||he&&Le(new he)!=d||fe&&Le(fe.resolve())!=h||me&&Le(new me)!=m||ge&&Le(new ge)!=x)&&(Le=function(e){var t=ee.call(e),r=t==p?e.constructor:void 0,s=r?Ve(r):void 0;if(s)switch(s){case xe:return b;case ye:return d;case be:return h;case Ee:return m;case Ie:return x}return t});var Be=Array.isArray;function Ye(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=i}(e.length)&&!Xe(e)}var We=de||function(){return!1};function Xe(e){var t=Fe(e)?ee.call(e):"";return t==c||t==u}function Fe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Je(e){return Ye(e)?Se(e):function(e){if(!He(e))return le(e);var t=[];for(var r in Object(e))Z.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}e.exports=function(e){return Ue(e,!0,!0)}}(s,s.exports);var i=s.exports;const n=e=>({get(t,r,s){if("__isProxy"===r)return!0;const i=Reflect.get(t,r);return Array.isArray(i)?i:"object"==typeof i&&null!==i?i.__isProxy?i:new Proxy(i,n(e)):i},set(t,r,s,n){const o=t[r];s=h(s)&&s.__isProxy?i(s):s;const a=Reflect.set(t,r,s,n);return((e,t)=>e!==t&&(e==e||t==t))(s,o)&&e.emit(`${x(r)}Change`,s),a}}),o=e=>encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class a{constructor(e){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=e.baseURL,this._beforeRequest=e.beforeRequest,this._errorHandler=e.error}_request(e){const{url:t="",timeout:r=6e4}=e;let{headers:s={}}=e;return e.url=this.baseURL.replace(/\/+$/,"")+"/"+((e,t)=>{if(!t)return e;const r=[];Object.keys(t).forEach((e=>{const s=t[e];if(null==s)return;let i;Array.isArray(s)?(i=s,e+="[]"):i=[s],i.forEach((t=>{null!==t&&"object"==typeof t&&(t=JSON.stringify(t)),r.push(`${o(e)}=${o(t)}`)}))}));const s=r.join("&");if(s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e})(t.replace(/^\/+/,""),e.params),s=Object.assign(s,this._defaultHeaders),Object.keys(s).forEach((e=>{"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(s["Content-Type"]=s[e],delete s[e])})),f(e.data)&&(s&&!s["Content-Type"]&&(s["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=s,e.timeout=r,this._beforeRequest&&this._beforeRequest(e),"undefined"!=typeof wx?d(e):u(e)}setDefaultHeader(e,t){e in this._defaultHeaders&&(""===t||null===t)?delete this._defaultHeaders[e]:this._defaultHeaders[e]=t}get(e,t){return this._errorHandler?this._request(Object.assign(t||{},{url:e,method:"GET"})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(t||{},{url:e,method:"GET"}))}post(e,t,r){return this._errorHandler?this._request(Object.assign(r||{},{url:e,method:"POST",data:t})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(r||{},{url:e,method:"POST",data:t}))}}class c{constructor(e){let t;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=e,t(this.reason))}))}static source(){let e;const t=new c((t=>{e=t}));return{cancel:e,token:t}}}const u=e=>new Promise(((t,r)=>{const{data:s=null,url:i,method:n="GET",headers:o,cancelToken:a,withResDate:c}=e;let u=new XMLHttpRequest;u.open(n.toUpperCase(),i,!0),u.timeout=e.timeout;const d=()=>{if(u){if(u.status>=200&&u.status<300)try{const e=JSON.parse(u.responseText);c&&(e.responseDate=new Date(u.getResponseHeader("Date")).getTime()),t(e)}catch(e){r(new Error("E_JSON_PARSE"+u.responseText))}else r({url:i,statusCode:u.status});u=null}};"onloadend"in u?u.onloadend=d:u.onreadystatechange=()=>{u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=()=>{u&&(r({url:i,statusCode:u.status,type:"request abort"}),u=null)},u.onerror=()=>{r(new Error("Network Error")),u=null},u.ontimeout=()=>{r(new Error("timeout of "+e.timeout+"ms exceeded")),u=null},"setRequestHeader"in u&&Object.keys(o).forEach((e=>{null===s&&"content-type"===e.toLowerCase()?delete o[e]:u.setRequestHeader(e,o[e])})),a&&a.promise.then((e=>{u&&(u.abort(),r(e),u=null)})),u.send(s)})),d=e=>new Promise(((t,r)=>{const{data:s=null,url:i,method:n="GET",headers:o,cancelToken:a}=e,c=wx.request({url:i,data:s,method:n.toUpperCase(),timeout:e.timeout,header:o,success(e){e.statusCode>=200&&e.statusCode<300?t(e.data):r({url:i,statusCode:e.statusCode})},fail(e){r("request:fail abort"===e.errMsg&&a&&a.reason||e)}});a&&a.promise.then((()=>{c&&c.abort()}))})),l=Array.isArray,p=e=>null==e,h=e=>"object"==typeof e&&null!==e,f=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},m=()=>{const e=[],t="0123456789abcdef";for(let r=0;r<36;r++)e[r]=t.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";return e.join("").split("-").join("")},g=(e,t)=>e?(Object.entries(e).forEach((e=>{const[r,s]=[e[0],e[1]];if(null!==s)return h(s)&&!l(s)?(t[r]||(t[r]={}),void(t[r]=g(s,t[r]))):void(t[r]=s)})),t):t,v=/-(\w)/g,x=e=>e.replace(v,((e,t)=>t?t.toUpperCase():""));var y,b,E,I,q,D;exports.EVENT=void 0,(y=exports.EVENT||(exports.EVENT={})).REQUEST_ERROR="requestError",y.STATE="state",exports.STATE=void 0,(b=exports.STATE||(exports.STATE={}))[b.CLOSE=0]="CLOSE",b[b.JOINED=1]="JOINED",b[b.READY=2]="READY",exports.ENDPOINT_TYPE=void 0,(E=exports.ENDPOINT_TYPE||(exports.ENDPOINT_TYPE={})).WEBAPP="webApp",E.WEBCTRL="webCtrl",E.WECHATMP="weChatMP",E.SUPERVISION="supervision",E.BIGSCREEN="bigScreen",E.DESKTOP="desktop",E.MOBILE="mobile",E.VCS="vcs",E.SIP="sip",E.H323="h323",E.PSTN="pstn",exports.ROLE=void 0,(I=exports.ROLE||(exports.ROLE={})).HOST="host",I.COHOST="coHost",I.ATTENDEE="attendee",I.AUDIENCE="audience",exports.RECORD_STATUS=void 0,(q=exports.RECORD_STATUS||(exports.RECORD_STATUS={})).STARTED="started",q.PAUSED="paused",q.STARTING="starting",q.STOPPED="stopped";class O{constructor(e,r){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"on",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"off",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=r,this.ctx=e,this.emitter=t(),this.on=this.emitter.on,this.off=this.emitter.off,this.data=new Proxy({},n(this.emitter)),this._bindOn()}cleanup(){this.emitter.all=new Map,this.data=new Proxy({},n(this.emitter))}reactive(e){if(h(e)){const t=new Map,r=(e,s)=>{Object.keys(e).forEach((i=>{!1===s&&i in this.data&&(e[i]=this.data[i]);const n=t=>e[i]=t,o=`${x(i)}Change`;this.emitter.on(o,n),t.set(o,n),h(e[i])&&!l(e[i])&&r(e[i],!0)}))};r(e,!1),e._destory=()=>{t.forEach(((e,t)=>{this.emitter.off(t,e)}))}}else console.warn("Parameter is not an object!");return e}}class T extends O{constructor(e){super(e,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(e=>{const{state:t,body:r}=e;("full"===t||"update"===t)&&g(r,this.data)})),this.ctx.emitter.on("participantCount",(e=>{const{body:t}=e;g({participantCount:t},this.data)}))}subject(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}/meetings/${r}/info/subject`,t)}))}practiceSession(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}/meetings/${t}/info/practiceSession`)}))}shareInfo(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${t}/meetings/${r}/shareInfo`,{params:e})}meetings(e){if(!e)return Promise.reject();const{prefix:{ctrl:t}}=this.ctx.config.request;return this.ctx.request.get(`${t}/meetings`,{params:e})}}function $(t){return e(this,void 0,void 0,(function*(){const r=S(t),{sessionID:s,meetingID:i}=t.config.request,n=yield function(t,r){return e(this,void 0,void 0,(function*(){const{topics:e,sessionID:s,meetingID:i}=r,n=yield t.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:s,meetingId:i},inboxes:e}),o=[];return n.data&&Object.keys(n.data).forEach((e=>{o.push({name:e,seqId:n.data[e].maxSeqId,limit:200})})),o}))}(t.request,{topics:r,sessionID:s,meetingID:i});yield A(r,t),t.status.polling.running=!0,t.status.keepalive.running=!0,w(t.request,{inboxes:n,sessionID:s,meetingID:i,cancelToken:t.config.request.cancelToken.token,status:t.status.polling},(e=>{t.emitter.emit(e.event,e)})),U(t)}))}function _(e){e.status.polling.running=!1,e.status.keepalive.running=!1,e.status.polling.timer&&(clearTimeout(e.status.polling.timer),e.status.polling.timer=null),e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null),e.config.request.cancelToken.cancel(),e.config.request.cancelToken=c.source()}function S(e){const t=[],{isInLobby:r}=e.modules.me.data;return r?(t.push("lobbyMember"),t):(Object.keys(e.modules).forEach((r=>{const s=e.modules[r]._topic();s&&(Array.isArray(s)?s.forEach((e=>{t.includes(e)||t.push(e)})):t.includes(s)||t.push(s))})),t)}function A(t,r){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=r.config.request,i=yield r.request.post(`${e}/meetings/${s}/subscribe`,{topics:t}),n=i&&i.data&&i.data.eventMsgs;n&&n.forEach((e=>{console.log("[subscribe]",e),r.emitter.emit(e.event,e)})),r.state!==exports.STATE.READY&&(r.state=exports.STATE.READY,r.emitter.emit(exports.EVENT.STATE,{state:r.state}))}))}function w(t,r,s){return e(this,void 0,void 0,(function*(){const{inboxes:i,sessionID:n,meetingID:o,cancelToken:a,status:c}=r;yield(()=>e(this,void 0,void 0,(function*(){const e=yield t.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:i},{cancelToken:a,withResDate:!0});if(!e||!e.data)return;const{data:r={}}=e;Object.keys(r).forEach((e=>{const t=i.find((t=>t.name===e));if(t){if(t.seqId=r[e].maxSeqId,!r[e].items)return;r[e].items.forEach((e=>{const t=JSON.parse(e.content);["liveStream","recording"].includes(t.event)&&(t.stime=e.stime),s(t)}))}}))})))(),c.running&&(c.timer=setTimeout((()=>{c.running&&w(t,r,s)}),200))}))}function U(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:r},meetingID:s,userID:i}=t.config.request;t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null),yield(()=>e(this,void 0,void 0,(function*(){const e=yield t.request.post(`${r}/meetings/${s}/users/${i}/keepalive`,{},{cancelToken:t.config.request.cancelToken.token});if(!e||!e.data)return;const{data:n={}}=e,o=n.interval||"";o&&(t.status.keepalive.interval=o)})))(),t.status.keepalive.running&&(t.status.keepalive.timer=setTimeout((()=>{t.status.keepalive.running&&U(t)}),1e3*t.status.keepalive.interval))}))}exports.MeEvent=void 0,(D=exports.MeEvent||(exports.MeEvent={})).INIT="meInit",D.UPDATE="meUpdate",D.UPDATE_USER_STATE="updateUserState",D.ROLECHANGE="meRoleChange",D.AUDIOCHANGE="meAudioChange",D.HANDUPCHANGE="meHandupChange",D.SETAUDIO="setAudio",D.VIDEOCHANGE="meVideoChange",D.SETVIDEO="setVideo",D.SHARECHANGE="meShareChange",D.DISPLAYNAMECHANGE="meDisplayNameChange",D.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",D.LOBBYCHANGE="meLobbyChange",D.BARRAGECHANGE="meBarrageChange",D.LEAVE="leave";class j extends O{constructor(e){super(e,"me")}_topic(){return""}_bindOn(){const t=t=>e(this,void 0,void 0,(function*(){"role"in t&&t.role!==this.data.role&&(t.role!==exports.ROLE.AUDIENCE&&this.data.role!==exports.ROLE.AUDIENCE||(yield P(this.ctx),this.data.isUpdatedUserState=!1,this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data,event:"roleChange"})),g({role:t.role},this.data),this.emitter.emit(exports.MeEvent.ROLECHANGE,t.role),this.ctx.emitter.emit(exports.MeEvent.ROLECHANGE,t.role))})),r=e=>{var t,r,s,i;if("audio"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.audio;(!p(n)&&n!==(null===(t=this.data.audio)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(r=this.data.audio)||void 0===r?void 0:r.sendOn))&&(g({audio:e.audio},this.data),this.emitter.emit(exports.MeEvent.AUDIOCHANGE,{deviceOn:p(n)?null===(s=this.data.audio)||void 0===s?void 0:s.deviceOn:n,sendOn:p(o)?null===(i=this.data.audio)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},s=e=>{var t,r,s,i;if("video"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.video;(!p(n)&&n!==(null===(t=this.data.video)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(r=this.data.video)||void 0===r?void 0:r.sendOn))&&(g({video:e.video},this.data),this.emitter.emit(exports.MeEvent.VIDEOCHANGE,{deviceOn:p(n)?null===(s=this.data.video)||void 0===s?void 0:s.deviceOn:n,sendOn:p(o)?null===(i=this.data.video)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},i=e=>{var t,r,s,i;if("share"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.share;(!p(n)&&n!==(null===(t=this.data.share)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(r=this.data.share)||void 0===r?void 0:r.sendOn))&&(g({share:e.share},this.data),this.emitter.emit(exports.MeEvent.SHARECHANGE,{deviceOn:p(n)?null===(s=this.data.share)||void 0===s?void 0:s.deviceOn:n,sendOn:p(o)?null===(i=this.data.share)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},n=e=>{e.displayName&&e.displayName!==this.data.displayName&&(g({displayName:e.displayName},this.data),this.emitter.emit(exports.MeEvent.DISPLAYNAMECHANGE,e.displayName))},o=e=>{"isHandUp"in e&&e.isHandUp!==this.data.isHandUp&&(g({isHandUp:e.isHandUp},this.data),this.emitter.emit(exports.MeEvent.HANDUPCHANGE,e.isHandUp))},a=e=>{"isSpotlightVideo"in e&&(g({isSpotlightVideo:e.isSpotlightVideo},this.data),this.emitter.emit(exports.MeEvent.SPOTLIGHTVIDEOCHANGE,e.isSpotlightVideo))},c=t=>e(this,void 0,void 0,(function*(){"isInLobby"in t&&t.isInLobby!==this.data.isInLobby&&(g({isInLobby:t.isInLobby},this.data),yield P(this.ctx),!1===t.isInLobby&&(this.data.isUpdatedUserState=!1,this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data,event:"inLobbyChange"})),this.emitter.emit(exports.MeEvent.LOBBYCHANGE,t.isInLobby))})),u=e=>{if(!e.barrage)return;let t=null;if(!e.barrage.wordsDisplayStatus)return t=null,delete e.barrage,this.data.barrage=t||void 0,void this.emitter.emit(exports.MeEvent.BARRAGECHANGE,t);t={content:e.barrage.content,contentType:e.barrage.contentType,type:e.barrage.type,duration:e.barrage.duration,position:e.barrage.position};const{role:r}=this.data;e.barrage.receiver&&(r===exports.ROLE.HOST||r===exports.ROLE.COHOST?t=e.barrage.receiver.host?t:null:r===exports.ROLE.ATTENDEE?t=e.barrage.receiver.attendee?t:null:r===exports.ROLE.AUDIENCE&&(t=e.barrage.receiver.audience?t:null),delete e.barrage,this.data.barrage=t||void 0,this.emitter.emit(exports.MeEvent.BARRAGECHANGE,t))},d=e=>{"leave"in e&&!0===e.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),_(this.ctx),G(this.ctx),this.emitter.emit(exports.MeEvent.LEAVE,e.resultInfo),this.ctx.state=exports.STATE.CLOSE,this.ctx.emitter.emit(exports.EVENT.STATE,{state:this.ctx.state,reason:e.resultInfo}))},l=e=>{t(e),r(e),s(e),i(e),n(e),o(e),c(e),a(e),u(e),d(e)};this.ctx.emitter.on(exports.MeEvent.INIT,(e=>{g(e,this.data),this.data.isUpdatedUserState=!1,this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on(exports.MeEvent.UPDATE,(e=>{l(e),g(e,this.data)})),this.ctx.emitter.on("me",(t=>e(this,void 0,void 0,(function*(){const{state:e,body:r={users:[]}}=t;if("delete"===e){const e=r.users[0];return e.leave=!0,void d(e)}const s=r.users.find((e=>e.userID===this.data.userID));s&&(l(s),g(s,this.data))})))),this.ctx.emitter.on("setUserVideo",(e=>{this.emitter.emit(exports.MeEvent.SETVIDEO,e.body)})),this.ctx.emitter.on("setUserAudio",(e=>{this.emitter.emit(exports.MeEvent.SETAUDIO,e.body)})),this.ctx.emitter.on("meetingState",(e=>{const{body:t={}}=e;if("ended"===t.state){d({leave:!0,resultInfo:t.resultInfo})}}))}updateUserState(e,t=!1){if(!t){const{role:t,initialMediaState:r}=this.data;e.audio.sendOn=e.audio.sendOn&&r.audio.sendOn,e.video.sendOn=e.video.sendOn&&r.video.sendOn,t===exports.ROLE.AUDIENCE&&(e.audio.sendOn=!1,e.video.sendOn=!1)}const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,g(e,this.data),this.ctx.request.post(`${r}/meetings/${s}/updateUserState`,e)}}function P(t){return e(this,void 0,void 0,(function*(){const e=S(t),{meetingID:r,sessionID:s}=t.config.request;"undefined"!=typeof Worker&&t.worker?(yield A(e,t),t.worker.postMessage({topics:e,meetingID:r,sessionID:s,rePolling:!0})):(_(t),yield $(t))}))}class N extends O{constructor(e){super(e,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(e=>{const{body:t,state:r}=e;if(t&&t.users){if("full"===r)return this.data.callRecordUsers=t.users.map((e=>(e.displayNamePinyin=N.setDisplayNamePinyinProp?N.setDisplayNamePinyinProp(e.displayName||""):e.displayName,e))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);t.users.forEach((e=>{const t=this.data.callRecordUsers.findIndex((t=>e.inviteTransID===t.inviteTransID));"update"===r&&-1!==t?g(e,this.data.callRecordUsers[t]):"update"===r&&-1===t&&(e.displayNamePinyin=N.setDisplayNamePinyinProp?N.setDisplayNamePinyinProp(e.displayName||""):e.displayName,this.data.callRecordUsers.push(e))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}/meetings/${r}/invite`,e)}mailTemplate(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${t}/mailTemplate`,{params:{meetingID:r},headers:{language:e.language}})}}class C extends O{constructor(e){super(e,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:e,endpointType:t}=this.ctx.modules.me.data;return t===exports.ENDPOINT_TYPE.SUPERVISION?["interactive","broadcast"]:e===exports.ROLE.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const e=(e,{event:t,state:r})=>{if(e.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:s={}}=e;if("delete"!==r||"delete"===r&&[901357,901358,901352,901351,901350,901349].includes(s.bizCode||-1))return void this.ctx.emitter.emit(exports.MeEvent.UPDATE,e);let i=!1;switch(t){case"interactiveUsers":e.isInLobby||(i=!0);break;case"broadcastUsers":e.isInLobby||e.role!==exports.ROLE.AUDIENCE||(i=!0);break;case"lobbyUsers":e.isInLobby&&(i=!0)}const n={};i&&(n.leave=!0),this.ctx.emitter.emit(exports.MeEvent.UPDATE,Object.assign(Object.assign({},e),n))},t=({updateUsers:t,state:r,sourceKey:s})=>{if("full"===r)return this.data[s]=t.map((t=>(t.displayNamePinyin=C.setDisplayNamePinyinProp?C.setDisplayNamePinyinProp(t.displayName):t.displayName,e(t,{event:s,state:r}),t))),this.emitter.emit(`${s}Change`,{users:this.data[s],isFull:!0}),this.data[s];void 0===this.data[s]&&(this.data[s]=[]);const{data:i,emitter:n}=this;return t.forEach((t=>{const o=i[s].findIndex((e=>t.userID===e.userID));if("delete"===r&&-1!==o){const[e]=this.data[s].splice(o,1);n.emit(`${s}Delete`,{user:e,resultInfo:t.resultInfo})}else"update"===r&&-1!==o?(this.updateUserProps(t,this.data[s][o]),g(t,this.data[s][o]),this.emitter.emit(`${s}Update`,{user:i[s][o]})):"update"===r&&-1===o&&(t.displayNamePinyin=C.setDisplayNamePinyinProp?C.setDisplayNamePinyinProp(t.displayName):t.displayName,i[s].push(t),this.emitter.emit(`${s}Add`,{user:t,resultInfo:t.resultInfo}));e(t,{event:s,state:r})})),this.emitter.emit(`${s}Change`,{users:this.data[s],isFull:!1}),this.data[s]};this.ctx.emitter.on("interactiveUsers",(e=>{const{state:r,body:s}=e;t({updateUsers:s.users,state:r,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(e=>{const{state:r,body:s}=e;t({updateUsers:s.users,state:r,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(e=>{const{state:r,body:s}=e;t({updateUsers:s.users,state:r,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(e=>{const{state:r,body:s}=e;t({updateUsers:s.users,state:r,sourceKey:"advCtrlUsers"})}))}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(e,t){e.displayName&&e.displayName!==t.displayName&&(e.displayNamePinyin=C.setDisplayNamePinyinProp?C.setDisplayNamePinyinProp(e.displayName):e.displayName)}setAudio(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${e}/audio`,t)}setVideo(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${e}/video`,t)}setShare(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${e}/share`,t)}setWhiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${e}/whiteboard`,t)}handUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${e}/handUp`,t)}setRole(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${e}/role`,t)}rename(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${e}/displayName`,t)}remove(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}/meetings/${r}/users/${e}/remove`)}replyHandUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${e}/replyHandUp`,t)}fecc(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${e}/fecc`,t)}lobbyState(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${e}/lobbyState`,t)}allowLocalRecord(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${e}/allowLocalRecord`,t)}whiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${e}/whiteboard`,t)}callStats(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${t}/meetings/${r}/users/${e}/callStats`)}replyAllHandUp(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}/meetings/${t}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}/meetings/${t}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}/meetings/${t}/lobby/refuseAll`)}}function R(e){const r=function(e){const{baseURL:r,modules:s,worker:i,singleton:n}=e;s.findIndex((e=>e===j))<0&&s.push(j),s.findIndex((e=>e===T))<0&&s.push(T);const o={config:{baseURL:r,modules:s,singleton:n||!1,request:{cancelToken:c.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1"},location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:i,emitter:t(),request:new a({baseURL:r,beforeRequest:e=>{e.headers["X-Y-Request-Id"]=m()},error:e=>{o.emitter.emit(exports.EVENT.REQUEST_ERROR,e)}}),modules:{},state:exports.STATE.CLOSE,status:{polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}}};return o}(e);return r.worker&&("undefined"!=typeof Worker?r.worker.postMessage({baseURL:r.config.baseURL}):console.error("The current environment does not support worker")),function(e,t){if(!l(e))return void console.error("The modules parameter requires an array type");e.forEach((e=>{const r=new e(t);t.modules[r.moduleName]=r}))}(r.config.modules,r),r.emitter.on(exports.EVENT.STATE,(({state:e})=>{e===exports.STATE.CLOSE&&Object.keys(r.modules).forEach((e=>{r.modules[e].cleanup()}))})),Object.assign({config:r.config,request:r.request,get state(){return r.state},on:r.emitter.on,off:r.emitter.off,join:k(r),leave:L(r),end:M(r)},r.modules)}function k(t){return function(r){var s;return e(this,void 0,void 0,(function*(){const e=`${null===(s=r.endpointType)||void 0===s?void 0:s.toLocaleUpperCase()}${m()}_${((e=new Date,t)=>{const r={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));for(const s in r)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?r[s]:("00"+r[s]).substr((""+r[s]).length)));return t})(new Date,"MMddHHmmss")}_${r.meetingNum}`;t.request.setDefaultHeader("X-Y-Session-Id",e);const{prefix:i}=t.config.request,n=yield t.request.get(`${i.ctrl}/credential`,{params:{meetingNum:r.meetingNum,pwd:r.pwd,url:r.url,mobileCode:r.mobileCode,mobile:r.mobile,regEmail:r.regEmail,accEmail:r.accEmail,tk:r.tk,displayName:r.displayName},headers:{"X-Y-Endpoint-Type":r.endpointType,"X-Y-Endpoint-Id":e}}),{credential:o="",location:a=""}=n&&n.data||{};if(!o)return n;t.config.request.location=a,delete r.pwd,delete r.url;const c=yield t.request.post(`${i.ctrl}/join?meetingNum=${r.meetingNum}&credential=${o}`,r,{headers:{"X-Y-Endpoint-Type":r.endpointType,"X-Y-Endpoint-Id":e}});if(c&&c.data&&c.ret>-1){const{meetingID:r="",ctrlID:s="",user:i={},mediaContent:o={},initialMediaState:u={},tk:d=""}=c.data;if(t.config.request.sessionID=e,t.config.request.meetingID=r,t.config.request.ctrlID=s,t.config.request.userID=i.userID,t.config.request.voteTk=d,t.request.setDefaultHeader("X-Y-Location",a),t.request.setDefaultHeader("X-Y-Ctrl-Id",s),t.emitter.emit(exports.MeEvent.INIT,Object.assign(Object.assign({},i),{mediaContent:o,initialMediaState:u})),t.state=exports.STATE.JOINED,t.emitter.emit(exports.EVENT.STATE,{state:t.state}),"undefined"!=typeof Worker&&t.worker){const s=S(t);yield A(s,t),t.status.keepalive.running=!0,U(t),t.worker.postMessage({topics:s,meetingID:r,sessionID:e,status:!0}),t.worker.onmessage=e=>{console.log("[Polling]",e.data),t.emitter.emit(e.data.event,e.data)}}else yield $(t);c.data=Object.assign(Object.assign({},c.data),n.data)}return c}))}}function L(t){return function(r){return e(this,void 0,void 0,(function*(){r||(r={bizCode:901359});const{prefix:e,meetingID:s}=t.config.request,i=yield t.request.post(`${e.ctrl}/meetings/${s}/leave`,r);return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),_(t),G(t),H(t),i}))}}function M(t){return function(){return e(this,void 0,void 0,(function*(){const{prefix:e,meetingID:r}=t.config.request,s=yield t.request.post(`${e.ctrl}/meetings/${r}/end`);return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),_(t),G(t),H(t),s}))}}function H(e){e.state!==exports.STATE.CLOSE&&(e.config.request.location="",e.config.request.meetingID="",e.config.request.ctrlID="",e.config.request.sessionID="",e.config.request.userID=-1,e.config.request.voteTk="",e.status={polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},e.request.setDefaultHeader("X-Y-Location",""),e.request.setDefaultHeader("X-Y-Ctrl-Id",""),e.request.setDefaultHeader("X-Y-Session-Id",""),e.state=exports.STATE.CLOSE,e.emitter.emit(exports.EVENT.STATE,{state:e.state}))}class V{constructor(e){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=R(e)}static getInstance(e){return this.instance?this.instance:this.instance=new V(e)}}function G(e){if(e.config.singleton){const{baseURL:t,modules:r,singleton:s}=e.config,i={baseURL:t,modules:r,worker:e.worker,singleton:s},n=V.getInstance(i);n&&(n.meeting=R(i))}}Object.defineProperty(V,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),exports.Chat=class extends O{constructor(e){super(e,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(e=>{const{body:t}=e;this.emitter.emit("chatMsg",t)}))}msg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}/meetings/${r}/chat/msg`,t)}))}historyMsg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}/meetings/${r}/chat/historyMsg`,t)}))}},exports.Info=T,exports.Invite=N,exports.LiveStream=class extends O{constructor(e){super(e,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(e=>{var t;const{state:r,body:s,stime:i}=e;if(s){if(i&&(this.data.jetlag=i),"full"===r){const{liveStreams:e=[]}=s;if(!e.length)return;this.data.status=[],this.data.liveStreams=e.map((e=>(e.requesting="starting"===e.status,this.data.status.push({platform:e.platform||"",status:(e.requesting?"stopped":e.status)||""}),e)));return g({status:this.data.status,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),s.liveStreams||(this.data.resultInfo={}),null===(t=s.liveStreams)||void 0===t||t.forEach((e=>{this.data.resultInfo=e.resultInfo||{};let t=this.data.liveStreams.findIndex((t=>t.platform===e.platform));-1===t?(e.requesting="starting"===e.status,this.data.liveStreams.push(e)):(e.requesting="starting"===e.status,e=Object.assign(Object.assign({},this.data.liveStreams[t]),e),this.data.liveStreams.splice(t,1,e)),t=this.data.status.findIndex((t=>t.platform===e.platform)),-1===t?this.data.status.push({platform:e.platform||"",status:e.requesting?"stopped":e.status||""}):this.data.status.splice(t,1,{platform:this.data.status[t].platform||"",status:e.requesting?this.data.status[t].status||"stopped":e.status||""})})),this.data}}))}setStatus(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}/meetings/${r}/liveStream/status`,t)}))}liveStreamDescription(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}/meetings/${r}/liveStream/description`,t)}))}liveStreamSetting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}/meetings/${r}/liveStream/setting`,t)}))}},exports.Me=j,exports.Recording=class extends O{constructor(e){super(e,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(e=>{const{state:t,body:r,stime:s}=e;if(r)return s&&(this.data.jetlag=s),this.data.isPracticeSession="started"===r.status&&this.data.status===r.status&&0===r.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),r),"starting"===r.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=r.status||this.data.status),this.data.resultInfo=r.resultInfo||{},["full","update"].includes(t)?(r.recordUsers&&(this.data.recording.recordUsers=r.recordUsers),this.data):void 0}))}history(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.get(`${e}meetings/${t}/recording/history`)}))}status(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/recording/status`,t)}))}layout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/recording/status`,t)}))}designatedUsers(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/recording/designatedUsers`,t)}))}participantAdd(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/recording/participant/add`,t)}))}participantDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/recording/participant/delete`,t)}))}getTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getTemplates`,{params:t})}))}getByIds(t){return e(this,void 0,void 0,(function*(){const{prefix:{user:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/subject/getByIds`,t)}))}recordLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/recording/layout`,t)}))}},exports.Setting=class extends O{constructor(e){super(e,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(e=>{const{state:t,body:r}=e;["full","update"].includes(t)&&g(r,this.data)}))}setting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}/meetings/${r}/setting`,t)}))}muteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}/meetings/${t}/muteAll`)}))}unmuteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}/meetings/${t}/unmuteAll`)}))}},exports.SpotlightVideo=class extends O{constructor(e){super(e,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(e=>{const{body:t}=e;if(!t||!t.userIDs)return;this.data.userIDs=t.userIDs;t.userIDs.findIndex((e=>e===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(exports.MeEvent.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(exports.MeEvent.UPDATE,{isSpotlightVideo:!1})}))}spotlight(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}/meetings/${r}/view/spotlight`,e)}},exports.Users=C,exports.View=class extends O{constructor(e){super(e,"view")}_topic(){return["hostAttendee","audience","advCtrl"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((e=>{this.ctx.emitter.on(e,(t=>{"personalView"!==e?this.updateLayout(t,e):this.updatePersonalLayouts(t)}))}))}updateLayout(e,t){const{event:r,body:s}=e;s&&("meetingView"===r?Object.keys(s).forEach((e=>{this.data[e]=s[e]})):this.data[t]=s)}updatePersonalLayouts(e){const{state:t,body:r}=e;"full"!==t&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),r.personalLayouts.forEach((e=>{const{subscriber:r={userID:-1}}=e,s=r.userID||r.subjectID||-1;"full"===t||"update"===t||e.templateStatus?this.data.personalLayouts[s]=e:delete this.data.personalLayouts[s]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/hostLayout`,t)}))}attendeeLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/attendeeLayout`,t)}))}audienceLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/audienceLayout`,t)}))}personalLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/personalLayout`,t)}))}personalLayoutDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/personalLayout/delete`,t)}))}virtualClassLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/virtualClass/layout`,t)}))}closeVirtualClass(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/view/virtualClass/close`)}))}getVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/layout/template/info`,{params:t})}))}addVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/layout/template/add`,t)}))}editVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/layout/template/edit`,t)}))}getTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getTemplates`,{params:t})}))}editTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/edit`,t)}))}addTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/add`,t)}))}deleteTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/delete`,t)}))}getDefaultTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getDefaultTemplates`,{params:t})}))}changeDefaultTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/changeDefaultTemplate`,t)}))}perspectiveBind(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/perspective/bind`,t)}))}},exports.Vote=class extends O{constructor(e){super(e,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(e=>{const{body:t}=e,{voteID:r}=t;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[r]=t,this.emitter.emit("voteChange",this.data.vote)}))}getVotes(e){const{prefix:{vote:t},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}/meetings/${r}/votes`,{params:e})}getVote(e){const{prefix:{vote:t},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}/meetings/${r}/vote`,{params:e})}getMeVote(e){const{prefix:{vote:t},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}/meetings/${r}/vote/me`,{params:e})}voteStatus(e,t){const{prefix:{vote:r},meetingID:s,voteTk:i}=this.ctx.config.request;return e.tk=e.tk||i,this.ctx.request.post(`${r}/meetings/${s}/vote/status?tk=${e.tk}&voteID=${e.voteID}`,t)}voteSubmit(e,t){const{prefix:{vote:r},meetingID:s,voteTk:i}=this.ctx.config.request;return e.tk=e.tk||i,this.ctx.request.post(`${r}/meetings/${s}/vote/submit?tk=${e.tk}&voteID=${e.voteID}`,t)}voteAdd(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}/personal/vote/add`,e)}voteEdit(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}/personal/vote/edit`,e)}voteDelete(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}/personal/vote/delete`,e)}voteInProgress(e){const{prefix:{vote:t},meetingID:r,voteTk:s}=this.ctx.config.request;return this.ctx.request.get(`${t}/meetings/${r}/vote/inProgress`,{params:{tk:e&&e.tk||s}})}},exports.Words=class extends O{constructor(e){super(e,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(e=>{this.data.timer&&clearTimeout(this.data.timer);const{state:t,body:r}=e;if(!r)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data});"full"===t&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),this.data.barrageRecord=[{content:r.content,time:(new Date).getTime(),durationType:r.durationType,duration:1e3*r.duration},...this.data.barrageRecord],r.wordsDisplayStatus=!0,-1!==r.duration&&(this.data.timer=setTimeout((()=>{r.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=r.wordsDisplayStatus,this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})}),1e3*r.duration)),g(r,this.data),this.emitter.emit("barrageRecordChange",this.data.barrageRecord),this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(exports.MeEvent.ROLECHANGE,(()=>this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})))}barrage(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}/meetings/${r}/barrage`,t)}))}deleteBarrage(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}/meetings/${t}/deleteBarrage`)}))}},exports.createMeeting=function(e){return e.singleton?V.getInstance(e).meeting:R(e)},exports.reset=G;
1
+ "use strict";function e(e,t,s,r){return new(s||(s=Promise))((function(i,n){function o(e){try{c(r.next(e))}catch(t){n(t)}}function a(e){try{c(r.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(o,a)}c((r=r.apply(e,t||[])).next())}))}function t(e){return{all:e=e||new Map,on:function(t,s){var r=e.get(t);r?r.push(s):e.set(t,[s])},off:function(t,s){var r=e.get(t);r&&(s?r.splice(r.indexOf(s)>>>0,1):e.set(t,[]))},emit:function(t,s){var r=e.get(t);r&&r.slice().map((function(e){e(s)})),(r=e.get("*"))&&r.slice().map((function(e){e(t,s)}))}}}Object.defineProperty(exports,"__esModule",{value:!0});var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}};!function(e,t){var r="__lodash_hash_undefined__",i=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",h="[object Promise]",f="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",x="[object WeakMap]",y="[object ArrayBuffer]",b="[object DataView]",E="[object Float32Array]",q="[object Float64Array]",I="[object Int8Array]",D="[object Int16Array]",O="[object Int32Array]",T="[object Uint8Array]",$="[object Uint8ClampedArray]",_="[object Uint16Array]",w="[object Uint32Array]",S=/\w*$/,A=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,j={};j[n]=j["[object Array]"]=j[y]=j[b]=j[o]=j[a]=j[E]=j[q]=j[I]=j[D]=j[O]=j[d]=j[l]=j[p]=j[f]=j[m]=j[g]=j[v]=j[T]=j[$]=j[_]=j[w]=!0,j["[object Error]"]=j[c]=j[x]=!1;var P="object"==typeof self&&self&&self.Object===Object&&self,C="object"==typeof s&&s&&s.Object===Object&&s||P||Function("return this")(),N=t&&!t.nodeType&&t,R=N&&e&&!e.nodeType&&e,k=R&&R.exports===N;function L(e,t){return e.set(t[0],t[1]),e}function M(e,t){return e.add(t),e}function H(e,t,s,r){var i=-1,n=e?e.length:0;for(r&&n&&(s=e[++i]);++i<n;)s=t(s,e[i],i,e);return s}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(s){}return t}function G(e){var t=-1,s=Array(e.size);return e.forEach((function(e,r){s[++t]=[r,e]})),s}function B(e,t){return function(s){return e(t(s))}}function Q(e){var t=-1,s=Array(e.size);return e.forEach((function(e){s[++t]=e})),s}var Y,F=Array.prototype,W=Function.prototype,X=Object.prototype,z=C["__core-js_shared__"],J=(Y=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Y:"",K=W.toString,Z=X.hasOwnProperty,ee=X.toString,te=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),se=k?C.Buffer:void 0,re=C.Symbol,ie=C.Uint8Array,ne=B(Object.getPrototypeOf,Object),oe=Object.create,ae=X.propertyIsEnumerable,ce=F.splice,ue=Object.getOwnPropertySymbols,de=se?se.isBuffer:void 0,le=B(Object.keys,Object),pe=Re(C,"DataView"),he=Re(C,"Map"),fe=Re(C,"Promise"),me=Re(C,"Set"),ge=Re(C,"WeakMap"),ve=Re(Object,"create"),xe=Ve(pe),ye=Ve(he),be=Ve(fe),Ee=Ve(me),qe=Ve(ge),Ie=re?re.prototype:void 0,De=Ie?Ie.valueOf:void 0;function Oe(e){var t=-1,s=e?e.length:0;for(this.clear();++t<s;){var r=e[t];this.set(r[0],r[1])}}function Te(e){var t=-1,s=e?e.length:0;for(this.clear();++t<s;){var r=e[t];this.set(r[0],r[1])}}function $e(e){var t=-1,s=e?e.length:0;for(this.clear();++t<s;){var r=e[t];this.set(r[0],r[1])}}function _e(e){this.__data__=new Te(e)}function we(e,t){var s=Be(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Qe(e)}(e)&&Z.call(e,"callee")&&(!ae.call(e,"callee")||ee.call(e)==n)}(e)?function(e,t){for(var s=-1,r=Array(e);++s<e;)r[s]=t(s);return r}(e.length,String):[],r=s.length,i=!!r;for(var o in e)!t&&!Z.call(e,o)||i&&("length"==o||Me(o,r))||s.push(o);return s}function Se(e,t,s){var r=e[t];Z.call(e,t)&&Ge(r,s)&&(void 0!==s||t in e)||(e[t]=s)}function Ae(e,t){for(var s=e.length;s--;)if(Ge(e[s][0],t))return s;return-1}function Ue(e,t,s,r,i,h,x){var A;if(r&&(A=h?r(e,i,h,x):r(e)),void 0!==A)return A;if(!We(e))return e;var U=Be(e);if(U){if(A=function(e){var t=e.length,s=e.constructor(t);t&&"string"==typeof e[0]&&Z.call(e,"index")&&(s.index=e.index,s.input=e.input);return s}(e),!t)return function(e,t){var s=-1,r=e.length;t||(t=Array(r));for(;++s<r;)t[s]=e[s];return t}(e,A)}else{var P=Le(e),C=P==c||P==u;if(Ye(e))return function(e,t){if(t)return e.slice();var s=new e.constructor(e.length);return e.copy(s),s}(e,t);if(P==p||P==n||C&&!h){if(V(e))return h?e:{};if(A=function(e){return"function"!=typeof e.constructor||He(e)?{}:(t=ne(e),We(t)?oe(t):{});var t}(C?{}:e),!t)return function(e,t){return Ce(e,ke(e),t)}(e,function(e,t){return e&&Ce(t,Xe(t),e)}(A,e))}else{if(!j[P])return h?e:{};A=function(e,t,s,r){var i=e.constructor;switch(t){case y:return Pe(e);case o:case a:return new i(+e);case b:return function(e,t){var s=t?Pe(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.byteLength)}(e,r);case E:case q:case I:case D:case O:case T:case $:case _:case w:return function(e,t){var s=t?Pe(e.buffer):e.buffer;return new e.constructor(s,e.byteOffset,e.length)}(e,r);case d:return function(e,t,s){return H(t?s(G(e),!0):G(e),L,new e.constructor)}(e,r,s);case l:case g:return new i(e);case f:return function(e){var t=new e.constructor(e.source,S.exec(e));return t.lastIndex=e.lastIndex,t}(e);case m:return function(e,t,s){return H(t?s(Q(e),!0):Q(e),M,new e.constructor)}(e,r,s);case v:return n=e,De?Object(De.call(n)):{}}var n}(e,P,Ue,t)}}x||(x=new _e);var N=x.get(e);if(N)return N;if(x.set(e,A),!U)var R=s?function(e){return function(e,t,s){var r=t(e);return Be(e)?r:function(e,t){for(var s=-1,r=t.length,i=e.length;++s<r;)e[i+s]=t[s];return e}(r,s(e))}(e,Xe,ke)}(e):Xe(e);return function(e,t){for(var s=-1,r=e?e.length:0;++s<r&&!1!==t(e[s],s,e););}(R||e,(function(i,n){R&&(i=e[n=i]),Se(A,n,Ue(i,t,s,r,n,e,x))})),A}function je(e){return!(!We(e)||(t=e,J&&J in t))&&(Fe(e)||V(e)?te:A).test(Ve(e));var t}function Pe(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function Ce(e,t,s,r){s||(s={});for(var i=-1,n=t.length;++i<n;){var o=t[i],a=r?r(s[o],e[o],o,s,e):void 0;Se(s,o,void 0===a?e[o]:a)}return s}function Ne(e,t){var s,r,i=e.__data__;return("string"==(r=typeof(s=t))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==s:null===s)?i["string"==typeof t?"string":"hash"]:i.map}function Re(e,t){var s=function(e,t){return null==e?void 0:e[t]}(e,t);return je(s)?s:void 0}Oe.prototype.clear=function(){this.__data__=ve?ve(null):{}},Oe.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Oe.prototype.get=function(e){var t=this.__data__;if(ve){var s=t[e];return s===r?void 0:s}return Z.call(t,e)?t[e]:void 0},Oe.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Z.call(t,e)},Oe.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?r:t,this},Te.prototype.clear=function(){this.__data__=[]},Te.prototype.delete=function(e){var t=this.__data__,s=Ae(t,e);return!(s<0)&&(s==t.length-1?t.pop():ce.call(t,s,1),!0)},Te.prototype.get=function(e){var t=this.__data__,s=Ae(t,e);return s<0?void 0:t[s][1]},Te.prototype.has=function(e){return Ae(this.__data__,e)>-1},Te.prototype.set=function(e,t){var s=this.__data__,r=Ae(s,e);return r<0?s.push([e,t]):s[r][1]=t,this},$e.prototype.clear=function(){this.__data__={hash:new Oe,map:new(he||Te),string:new Oe}},$e.prototype.delete=function(e){return Ne(this,e).delete(e)},$e.prototype.get=function(e){return Ne(this,e).get(e)},$e.prototype.has=function(e){return Ne(this,e).has(e)},$e.prototype.set=function(e,t){return Ne(this,e).set(e,t),this},_e.prototype.clear=function(){this.__data__=new Te},_e.prototype.delete=function(e){return this.__data__.delete(e)},_e.prototype.get=function(e){return this.__data__.get(e)},_e.prototype.has=function(e){return this.__data__.has(e)},_e.prototype.set=function(e,t){var s=this.__data__;if(s instanceof Te){var r=s.__data__;if(!he||r.length<199)return r.push([e,t]),this;s=this.__data__=new $e(r)}return s.set(e,t),this};var ke=ue?B(ue,Object):function(){return[]},Le=function(e){return ee.call(e)};function Me(e,t){return!!(t=null==t?i:t)&&("number"==typeof e||U.test(e))&&e>-1&&e%1==0&&e<t}function He(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||X)}function Ve(e){if(null!=e){try{return K.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Ge(e,t){return e===t||e!=e&&t!=t}(pe&&Le(new pe(new ArrayBuffer(1)))!=b||he&&Le(new he)!=d||fe&&Le(fe.resolve())!=h||me&&Le(new me)!=m||ge&&Le(new ge)!=x)&&(Le=function(e){var t=ee.call(e),s=t==p?e.constructor:void 0,r=s?Ve(s):void 0;if(r)switch(r){case xe:return b;case ye:return d;case be:return h;case Ee:return m;case qe:return x}return t});var Be=Array.isArray;function Qe(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=i}(e.length)&&!Fe(e)}var Ye=de||function(){return!1};function Fe(e){var t=We(e)?ee.call(e):"";return t==c||t==u}function We(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Xe(e){return Qe(e)?we(e):function(e){if(!He(e))return le(e);var t=[];for(var s in Object(e))Z.call(e,s)&&"constructor"!=s&&t.push(s);return t}(e)}e.exports=function(e){return Ue(e,!0,!0)}}(r,r.exports);var i=r.exports;const n=e=>({get(t,s,r){if("__isProxy"===s)return!0;const i=Reflect.get(t,s);return Array.isArray(i)?i:"object"==typeof i&&null!==i?i.__isProxy?i:new Proxy(i,n(e)):i},set(t,s,r,n){const o=t[s];r=h(r)&&r.__isProxy?i(r):r;const a=Reflect.set(t,s,r,n);return((e,t)=>e!==t&&(e==e||t==t))(r,o)&&e.emit(`${x(s)}Change`,r),a}}),o=e=>encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class a{constructor(e){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=e.baseURL,this._beforeRequest=e.beforeRequest,this._errorHandler=e.error}_request(e){const{url:t="",timeout:s=6e4}=e;let{headers:r={}}=e;return e.url=this.baseURL.replace(/\/+$/,"")+"/"+((e,t)=>{if(!t)return e;const s=[];Object.keys(t).forEach((e=>{const r=t[e];if(null==r)return;let i;Array.isArray(r)?(i=r,e+="[]"):i=[r],i.forEach((t=>{null!==t&&"object"==typeof t&&(t=JSON.stringify(t)),s.push(`${o(e)}=${o(t)}`)}))}));const r=s.join("&");if(r){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e})(t.replace(/^\/+/,""),e.params),r=Object.assign(r,this._defaultHeaders),Object.keys(r).forEach((e=>{"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(r["Content-Type"]=r[e],delete r[e])})),f(e.data)&&(r&&!r["Content-Type"]&&(r["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=r,e.timeout=s,this._beforeRequest&&this._beforeRequest(e),"undefined"!=typeof wx?d(e):u(e)}setDefaultHeader(e,t){e in this._defaultHeaders&&(""===t||null===t)?delete this._defaultHeaders[e]:this._defaultHeaders[e]=t}get(e,t){return this._errorHandler?this._request(Object.assign(t||{},{url:e,method:"GET"})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(t||{},{url:e,method:"GET"}))}post(e,t,s){return this._errorHandler?this._request(Object.assign(s||{},{url:e,method:"POST",data:t})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(s||{},{url:e,method:"POST",data:t}))}}class c{constructor(e){let t;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=e,t(this.reason))}))}static source(){let e;const t=new c((t=>{e=t}));return{cancel:e,token:t}}}const u=e=>new Promise(((t,s)=>{const{data:r=null,url:i,method:n="GET",headers:o,cancelToken:a,withResDate:c}=e;let u=new XMLHttpRequest;u.open(n.toUpperCase(),i,!0),u.timeout=e.timeout;const d=()=>{if(u){if(u.status>=200&&u.status<300)try{const e=JSON.parse(u.responseText);c&&(e.responseDate=new Date(u.getResponseHeader("Date")).getTime()),t(e)}catch(e){s(new Error("E_JSON_PARSE"+u.responseText))}else s({url:i,statusCode:u.status});u=null}};"onloadend"in u?u.onloadend=d:u.onreadystatechange=()=>{u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=()=>{u&&(s({url:i,statusCode:u.status,type:"request abort"}),u=null)},u.onerror=()=>{s(new Error("Network Error")),u=null},u.ontimeout=()=>{s(new Error("timeout of "+e.timeout+"ms exceeded")),u=null},"setRequestHeader"in u&&Object.keys(o).forEach((e=>{null===r&&"content-type"===e.toLowerCase()?delete o[e]:u.setRequestHeader(e,o[e])})),a&&a.promise.then((e=>{u&&(u.abort(),s(e),u=null)})),u.send(r)})),d=e=>new Promise(((t,s)=>{const{data:r=null,url:i,method:n="GET",headers:o,cancelToken:a}=e,c=wx.request({url:i,data:r,method:n.toUpperCase(),timeout:e.timeout,header:o,success(e){e.statusCode>=200&&e.statusCode<300?t(e.data):s({url:i,statusCode:e.statusCode})},fail(e){s("request:fail abort"===e.errMsg&&a&&a.reason||e)}});a&&a.promise.then((()=>{c&&c.abort()}))})),l=Array.isArray,p=e=>null==e,h=e=>"object"==typeof e&&null!==e,f=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},m=()=>{const e=[],t="0123456789abcdef";for(let s=0;s<36;s++)e[s]=t.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";return e.join("").split("-").join("")},g=(e,t)=>e?(Object.entries(e).forEach((e=>{const[s,r]=[e[0],e[1]];if(null!==r)return h(r)&&!l(r)?(t[s]||(t[s]={}),void(t[s]=g(r,t[s]))):void(t[s]=r)})),t):t,v=/-(\w)/g,x=e=>e.replace(v,((e,t)=>t?t.toUpperCase():"")),{hasOwnProperty:y}=Object.prototype,b=(e,t)=>y.call(e,t),E=(e,t=new Map)=>{if(t.get(e))return t.get(e);if(!(e instanceof Object))return e;let s;s=e instanceof Array?[]:e instanceof Function?()=>e():e instanceof RegExp?new RegExp(e.source,e.flags):e instanceof Date?new Date(e):{},t.set(e,s);for(const r in e)b(e,r)&&(s[r]=E(e[r],t));return s};var q,I,D,O,T,$;exports.EVENT=void 0,(q=exports.EVENT||(exports.EVENT={})).REQUEST_ERROR="requestError",q.STATE="state",q.FAILED="failed",exports.STATE=void 0,(I=exports.STATE||(exports.STATE={}))[I.CLOSE=0]="CLOSE",I[I.JOINED=1]="JOINED",I[I.READY=2]="READY",exports.ENDPOINT_TYPE=void 0,(D=exports.ENDPOINT_TYPE||(exports.ENDPOINT_TYPE={})).WEBAPP="webApp",D.WEBCTRL="webCtrl",D.WECHATMP="weChatMP",D.SUPERVISION="supervision",D.BIGSCREEN="bigScreen",D.DESKTOP="desktop",D.MOBILE="mobile",D.VCS="vcs",D.SIP="sip",D.H323="h323",D.PSTN="pstn",exports.ROLE=void 0,(O=exports.ROLE||(exports.ROLE={})).HOST="host",O.COHOST="coHost",O.ATTENDEE="attendee",O.AUDIENCE="audience",exports.RECORD_STATUS=void 0,(T=exports.RECORD_STATUS||(exports.RECORD_STATUS={})).STARTED="started",T.PAUSED="paused",T.STARTING="starting",T.STOPPED="stopped";class _{constructor(e,s){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"on",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"off",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=s,this.ctx=e,this.emitter=t(),this.on=this.emitter.on,this.off=this.emitter.off,this.data=new Proxy({},n(this.emitter)),this._bindOn()}cleanup(){this.emitter.all=new Map,this.data=new Proxy({},n(this.emitter))}reactive(e){if(h(e)){const t=new Map,s=(e,r)=>{Object.keys(e).forEach((i=>{!1===r&&i in this.data&&(e[i]=this.data[i]);const n=t=>e[i]=t,o=`${x(i)}Change`;this.emitter.on(o,n),t.set(o,n),h(e[i])&&!l(e[i])&&s(e[i],!0)}))};s(e,!1),e._destory=()=>{t.forEach(((e,t)=>{this.emitter.off(t,e)}))}}else console.warn("Parameter is not an object!");return e}}class w extends _{constructor(e){super(e,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(e=>{const{state:t,body:s}=e;("full"===t||"update"===t)&&g(s,this.data)})),this.ctx.emitter.on("participantCount",(e=>{const{body:t}=e;g({participantCount:t},this.data)}))}subject(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/info/subject`,t)}))}practiceSession(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/info/practiceSession`)}))}shareInfo(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${s}/shareInfo`,{params:e})}meetings(e){if(!e)return Promise.reject();const{prefix:{ctrl:t}}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings`,{params:e})}}function S(e){const t=[],{isInLobby:s}=e.modules.me.data;return s?(t.push("lobbyMember"),t):(Object.keys(e.modules).forEach((s=>{const r=e.modules[s]._topic();r&&(Array.isArray(r)?r.forEach((e=>{t.includes(e)||t.push(e)})):t.includes(r)||t.push(r))})),t)}function A(t,s){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=s.config.request,i=yield s.request.post(`${e}meetings/${r}/subscribe`,{topics:t}),n=i&&i.data&&i.data.eventMsgs;n&&n.forEach((e=>{console.log("[subscribe]",e),s.emitter.emit(e.event,e)})),s.state!==exports.STATE.READY&&(s.state=exports.STATE.READY,s.emitter.emit(exports.EVENT.STATE,{state:s.state}))}))}function U(t,s,r){return e(this,void 0,void 0,(function*(){const{inboxes:i,clientID:n,meetingID:o,cancelToken:a,status:c}=s;yield(()=>e(this,void 0,void 0,(function*(){const e=yield t.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:i},{cancelToken:a,withResDate:!0});if(!e||!e.data)return;const{data:s={}}=e;Object.keys(s).forEach((e=>{const t=i.find((t=>t.name===e));if(t){if(t.seqId=s[e].maxSeqId,!s[e].items)return;s[e].items.forEach((e=>{const t=JSON.parse(e.content);["liveStream","recording"].includes(t.event)&&(t.stime=e.stime),r(t)}))}}))})))(),c.running&&(c.timer=setTimeout((()=>{c.running&&U(t,s,r)}),200))}))}function j(t){return e(this,void 0,void 0,(function*(){const s=S(t),{clientID:r,meetingID:i}=t.config.request,n=yield function(t,s){return e(this,void 0,void 0,(function*(){const{topics:e,clientID:r,meetingID:i}=s,n=yield t.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:r,meetingId:i},inboxes:e}),o=[];return n.data&&Object.keys(n.data).forEach((e=>{o.push({name:e,seqId:n.data[e].maxSeqId,limit:200})})),o}))}(t.request,{topics:s,clientID:r,meetingID:i});yield A(s,t),t.status.polling.running=!0,t.status.keepalive.running=!0,U(t.request,{inboxes:n,clientID:r,meetingID:i,cancelToken:t.config.request.cancelToken.token,status:t.status.polling},(e=>{t.emitter.emit(e.event,e)})),C(t)}))}function P(e){e.status.polling.running=!1,e.status.keepalive.running=!1,e.status.polling.timer&&(clearTimeout(e.status.polling.timer),e.status.polling.timer=null),e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null),e.config.request.cancelToken.cancel(),e.config.request.cancelToken=c.source()}function C(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:s},meetingID:r,userID:i}=t.config.request;t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null),yield(()=>e(this,void 0,void 0,(function*(){const e=yield t.request.post(`${s}meetings/${r}/users/${i}/keepalive`,{},{cancelToken:t.config.request.cancelToken.token});if(!e||!e.data)return;const{data:n={}}=e,o=n.interval||"";o&&(t.status.keepalive.interval=o)})))(),t.status.keepalive.running&&(t.status.keepalive.timer=setTimeout((()=>{t.status.keepalive.running&&C(t)}),1e3*t.status.keepalive.interval))}))}exports.MeEvent=void 0,($=exports.MeEvent||(exports.MeEvent={})).INIT="meInit",$.UPDATE="meUpdate",$.UPDATE_USER_STATE="updateUserState",$.ROLECHANGE="meRoleChange",$.AUDIOCHANGE="meAudioChange",$.HANDUPCHANGE="meHandupChange",$.SETAUDIO="setAudio",$.VIDEOCHANGE="meVideoChange",$.SETVIDEO="setVideo",$.SHARECHANGE="meShareChange",$.DISPLAYNAMECHANGE="meDisplayNameChange",$.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",$.LOBBYCHANGE="meLobbyChange",$.BARRAGECHANGE="meBarrageChange",$.LEAVE="leave";class N extends _{constructor(e){super(e,"me")}_topic(){return""}_bindOn(){const t=t=>e(this,void 0,void 0,(function*(){"role"in t&&t.role!==this.data.role&&(t.role!==exports.ROLE.AUDIENCE&&this.data.role!==exports.ROLE.AUDIENCE||(yield R(this.ctx),this.data.isUpdatedUserState=!1,this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data,event:"roleChange"})),g({role:t.role},this.data),this.emitter.emit(exports.MeEvent.ROLECHANGE,t.role),this.ctx.emitter.emit(exports.MeEvent.ROLECHANGE,t.role))})),s=e=>{var t,s,r,i;if("audio"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.audio;(!p(n)&&n!==(null===(t=this.data.audio)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(s=this.data.audio)||void 0===s?void 0:s.sendOn))&&(g({audio:e.audio},this.data),this.emitter.emit(exports.MeEvent.AUDIOCHANGE,{deviceOn:p(n)?null===(r=this.data.audio)||void 0===r?void 0:r.deviceOn:n,sendOn:p(o)?null===(i=this.data.audio)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},r=e=>{var t,s,r,i;if("video"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.video;(!p(n)&&n!==(null===(t=this.data.video)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(s=this.data.video)||void 0===s?void 0:s.sendOn))&&(g({video:e.video},this.data),this.emitter.emit(exports.MeEvent.VIDEOCHANGE,{deviceOn:p(n)?null===(r=this.data.video)||void 0===r?void 0:r.deviceOn:n,sendOn:p(o)?null===(i=this.data.video)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},i=e=>{var t,s,r,i;if("share"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.share;(!p(n)&&n!==(null===(t=this.data.share)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(s=this.data.share)||void 0===s?void 0:s.sendOn))&&(g({share:e.share},this.data),this.emitter.emit(exports.MeEvent.SHARECHANGE,{deviceOn:p(n)?null===(r=this.data.share)||void 0===r?void 0:r.deviceOn:n,sendOn:p(o)?null===(i=this.data.share)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},n=e=>{e.displayName&&e.displayName!==this.data.displayName&&(g({displayName:e.displayName},this.data),this.emitter.emit(exports.MeEvent.DISPLAYNAMECHANGE,e.displayName))},o=e=>{"isHandUp"in e&&e.isHandUp!==this.data.isHandUp&&(g({isHandUp:e.isHandUp},this.data),this.emitter.emit(exports.MeEvent.HANDUPCHANGE,e.isHandUp))},a=e=>{"isSpotlightVideo"in e&&(g({isSpotlightVideo:e.isSpotlightVideo},this.data),this.emitter.emit(exports.MeEvent.SPOTLIGHTVIDEOCHANGE,e.isSpotlightVideo))},c=t=>e(this,void 0,void 0,(function*(){"isInLobby"in t&&t.isInLobby!==this.data.isInLobby&&(g({isInLobby:t.isInLobby},this.data),yield R(this.ctx),!1===t.isInLobby&&(this.data.isUpdatedUserState=!1,this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data,event:"inLobbyChange"})),this.emitter.emit(exports.MeEvent.LOBBYCHANGE,t.isInLobby))})),u=e=>{if(!e.barrage)return;let t=null;if(!e.barrage.wordsDisplayStatus)return t=null,delete e.barrage,this.data.barrage=t||void 0,void this.emitter.emit(exports.MeEvent.BARRAGECHANGE,t);t={content:e.barrage.content,contentType:e.barrage.contentType,type:e.barrage.type,duration:e.barrage.duration,position:e.barrage.position};const{role:s}=this.data;e.barrage.receiver&&(s===exports.ROLE.HOST||s===exports.ROLE.COHOST?t=e.barrage.receiver.host?t:null:s===exports.ROLE.ATTENDEE?t=e.barrage.receiver.attendee?t:null:s===exports.ROLE.AUDIENCE&&(t=e.barrage.receiver.audience?t:null),delete e.barrage,this.data.barrage=t||void 0,this.emitter.emit(exports.MeEvent.BARRAGECHANGE,t))},d=e=>{"leave"in e&&!0===e.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),P(this.ctx),Y(this.ctx),this.emitter.emit(exports.MeEvent.LEAVE,e.resultInfo),this.ctx.cleanup(e.resultInfo))},l=e=>{t(e),s(e),r(e),i(e),n(e),o(e),c(e),a(e),u(e),d(e)};this.ctx.emitter.on(exports.MeEvent.INIT,(e=>{g(e,this.data),this.data.isUpdatedUserState=!1,this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on(exports.MeEvent.UPDATE,(e=>{l(e),g(e,this.data)})),this.ctx.emitter.on("me",(t=>e(this,void 0,void 0,(function*(){const{state:e,body:s={users:[]}}=t;if("delete"===e){const e=s.users[0];return e.leave=!0,void d(e)}const r=s.users.find((e=>e.userID===this.data.userID));r&&(l(r),g(r,this.data))})))),this.ctx.emitter.on("setUserVideo",(e=>{this.emitter.emit(exports.MeEvent.SETVIDEO,e.body)})),this.ctx.emitter.on("setUserAudio",(e=>{this.emitter.emit(exports.MeEvent.SETAUDIO,e.body)})),this.ctx.emitter.on("meetingState",(e=>{const{body:t={}}=e;if("ended"===t.state){d({leave:!0,resultInfo:t.resultInfo})}}))}updateUserState(e,t=!1){if(!t){const{role:t,initialMediaState:s}=this.data;e.audio.sendOn=e.audio.sendOn&&s.audio.sendOn,e.video.sendOn=e.video.sendOn&&s.video.sendOn,t===exports.ROLE.AUDIENCE&&(e.audio.sendOn=!1,e.video.sendOn=!1)}const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,g(e,this.data),this.ctx.request.post(`${s}meetings/${r}/updateUserState`,e)}}function R(t){return e(this,void 0,void 0,(function*(){const e=S(t),{meetingID:s,clientID:r}=t.config.request;"undefined"!=typeof Worker&&t.worker?(yield A(e,t),t.worker.postMessage({topics:e,meetingID:s,clientID:r,rePolling:!0})):(P(t),yield j(t))}))}class k extends _{constructor(e){super(e,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(e=>{const{body:t,state:s}=e;if(t&&t.users){if("full"===s)return this.data.callRecordUsers=t.users.map((e=>(e.displayNamePinyin=k.setDisplayNamePinyinProp?k.setDisplayNamePinyinProp(e.displayName||""):e.displayName,e))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);t.users.forEach((e=>{const t=this.data.callRecordUsers.findIndex((t=>e.inviteTransID===t.inviteTransID));"update"===s&&-1!==t?g(e,this.data.callRecordUsers[t]):"update"===s&&-1===t&&(e.displayNamePinyin=k.setDisplayNamePinyinProp?k.setDisplayNamePinyinProp(e.displayName||""):e.displayName,this.data.callRecordUsers.push(e))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/invite`,e)}mailTemplate(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${t}mailTemplate`,{params:{meetingID:s},headers:{language:e.language}})}}class L extends _{constructor(e){super(e,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:e,endpointType:t}=this.ctx.modules.me.data;return t===exports.ENDPOINT_TYPE.SUPERVISION?["interactive","broadcast"]:e===exports.ROLE.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const e=(e,{event:t,state:s})=>{if(e.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:r={}}=e;if("delete"!==s||"delete"===s&&[901357,901358,901352,901351,901350,901349].includes(r.bizCode||-1))return void this.ctx.emitter.emit(exports.MeEvent.UPDATE,e);let i=!1;switch(t){case"interactiveUsers":e.isInLobby||(i=!0);break;case"broadcastUsers":e.isInLobby||e.role!==exports.ROLE.AUDIENCE||(i=!0);break;case"lobbyUsers":e.isInLobby&&(i=!0)}const n={};i&&(n.leave=!0),this.ctx.emitter.emit(exports.MeEvent.UPDATE,Object.assign(Object.assign({},e),n))},t=({updateUsers:t,state:s,sourceKey:r})=>{if("full"===s)return this.data[r]=t.map((t=>(t.displayNamePinyin=L.setDisplayNamePinyinProp?L.setDisplayNamePinyinProp(t.displayName):t.displayName,e(t,{event:r,state:s}),t))),this.emitter.emit(`${r}Change`,{users:this.data[r],isFull:!0}),this.data[r];void 0===this.data[r]&&(this.data[r]=[]);const{data:i,emitter:n}=this;return t.forEach((t=>{const o=i[r].findIndex((e=>t.userID===e.userID));if("delete"===s&&-1!==o){const[e]=this.data[r].splice(o,1);n.emit(`${r}Delete`,{user:e,resultInfo:t.resultInfo})}else if("update"===s&&-1!==o){const e=this.data[r][o];this.updateUserProps(t,e),g(t,e),this.data[r][o]=E(e),this.emitter.emit(`${r}Update`,{user:this.data[r][o]})}else"update"===s&&-1===o&&(t.displayNamePinyin=L.setDisplayNamePinyinProp?L.setDisplayNamePinyinProp(t.displayName):t.displayName,i[r].push(t),this.emitter.emit(`${r}Add`,{user:t,resultInfo:t.resultInfo}));e(t,{event:r,state:s})})),this.emitter.emit(`${r}Change`,{users:this.data[r],isFull:!1}),this.data[r]};this.ctx.emitter.on("interactiveUsers",(e=>{const{state:s,body:r}=e;t({updateUsers:r.users,state:s,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(e=>{const{state:s,body:r}=e;t({updateUsers:r.users,state:s,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(e=>{const{state:s,body:r}=e;t({updateUsers:r.users,state:s,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(e=>{const{state:s,body:r}=e;t({updateUsers:r.users,state:s,sourceKey:"advCtrlUsers"})}))}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(e,t){e.displayName&&e.displayName!==t.displayName&&(e.displayNamePinyin=L.setDisplayNamePinyinProp?L.setDisplayNamePinyinProp(e.displayName):e.displayName)}setAudio(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/audio`,t)}setVideo(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/video`,t)}setShare(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/share`,t)}setWhiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}users/${e}/whiteboard`,t)}handUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/handUp`,t)}setRole(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/role`,t)}rename(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/displayName`,t)}remove(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/users/${e}/remove`)}replyHandUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}users/${e}/replyHandUp`,t)}fecc(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/fecc`,t)}lobbyState(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/lobbyState`,t)}allowLocalRecord(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/allowLocalRecord`,t)}whiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${e}/whiteboard`,t)}callStats(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${s}/users/${e}/callStats`)}replyAllHandUp(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/refuseAll`)}}function M(e){const{baseURL:s,modules:r,worker:i,singleton:n}=e;r.findIndex((e=>e===N))<0&&r.push(N),r.findIndex((e=>e===w))<0&&r.push(w);const o=`${m()}_${((e=new Date,t)=>{const s={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));for(const r in s)new RegExp("("+r+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?s[r]:("00"+s[r]).substr((""+s[r]).length)));return t})(new Date,"MMddHHmmss")}`,u={config:{baseURL:s,modules:r,singleton:n||!1,request:{cancelToken:c.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1"},clientID:o,location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:i,emitter:t(),request:new a({baseURL:s,beforeRequest:e=>{e.headers["X-Y-Request-Id"]=m()},error:e=>{u.emitter.emit(exports.EVENT.REQUEST_ERROR,e)}}),modules:{},state:exports.STATE.CLOSE,status:{polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},cleanup:e=>{u.state!==exports.STATE.CLOSE&&(u.config.request.location="",u.config.request.meetingID="",u.config.request.ctrlID="",u.config.request.sessionID="",u.config.request.userID=-1,u.config.request.voteTk="",u.status={polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},u.request.setDefaultHeader("X-Y-Location",""),u.request.setDefaultHeader("X-Y-Ctrl-Id",""),u.request.setDefaultHeader("X-Y-Session-Id",""),u.state=exports.STATE.CLOSE,u.emitter.emit(exports.EVENT.STATE,{state:u.state,reason:e}))}};return u}function H(e){const t=M(e);return t.worker&&("undefined"!=typeof Worker?t.worker.postMessage({baseURL:t.config.baseURL}):console.error("The current environment does not support worker")),function(e,t){if(!l(e))return void console.error("The modules parameter requires an array type");e.forEach((e=>{const s=new e(t);t.modules[s.moduleName]=s}))}(t.config.modules,t),t.emitter.on(exports.EVENT.STATE,(({state:e})=>{e===exports.STATE.CLOSE&&Object.keys(t.modules).forEach((e=>{t.modules[e].cleanup()}))})),Object.assign({config:t.config,request:t.request,get state(){return t.state},on:t.emitter.on,off:t.emitter.off,join:V(t),leave:G(t),end:B(t)},t.modules)}function V(t){return function(s){var r;return e(this,void 0,void 0,(function*(){const{clientID:e}=t.config.request,i=`${null===(r=s.endpointType)||void 0===r?void 0:r.toLocaleUpperCase()}${e}_${s.meetingNum}`;t.config.request.sessionID=i,t.request.setDefaultHeader("X-Y-Session-Id",i);const{prefix:n}=t.config.request,o=yield t.request.get(`${n.ctrl}credential`,{params:{meetingNum:s.meetingNum,pwd:s.pwd,url:s.url,mobileCode:s.mobileCode,mobile:s.mobile,regEmail:s.regEmail,accEmail:s.accEmail,tk:s.tk,displayName:s.displayName},headers:{"X-Y-Endpoint-Type":s.endpointType}}),{credential:a="",location:c=""}=o&&o.data||{};if(!a)return t.emitter.emit(exports.EVENT.FAILED,{bizCode:o.bizCode,data:o.data}),o;t.config.request.location=c,t.request.setDefaultHeader("X-Y-Location",c),delete s.pwd,delete s.url;const u=yield t.request.post(`${n.ctrl}join?meetingNum=${s.meetingNum}&credential=${a}`,s,{headers:{"X-Y-Endpoint-Type":s.endpointType,"X-Y-Endpoint-Id":e}});if(!u||u&&u.ret<=-1)return t.emitter.emit(exports.EVENT.FAILED,{bizCode:u.bizCode,data:u.data}),u;const{meetingID:d="",ctrlID:l="",user:p={},mediaContent:h={},initialMediaState:f={},tk:m=""}=u.data;if(t.config.request.meetingID=d,t.config.request.ctrlID=l,t.config.request.userID=p.userID,t.config.request.voteTk=m,t.request.setDefaultHeader("X-Y-Ctrl-Id",l),t.emitter.emit(exports.MeEvent.INIT,Object.assign(Object.assign({},p),{mediaContent:h,initialMediaState:f})),t.state=exports.STATE.JOINED,t.emitter.emit(exports.EVENT.STATE,{state:t.state}),"undefined"!=typeof Worker&&t.worker){const s=S(t);yield A(s,t),t.status.keepalive.running=!0,C(t),t.worker.postMessage({topics:s,meetingID:d,clientID:e,status:!0}),t.worker.onmessage=e=>{console.log("[Polling]",e.data),t.emitter.emit(e.data.event,e.data)}}else yield j(t);return u.data=Object.assign(Object.assign({},u.data),o.data),u}))}}function G(t){return function(s){return e(this,void 0,void 0,(function*(){s||(s={resultInfo:{bizCode:901359}});const{prefix:e,meetingID:r}=t.config.request,i=yield t.request.post(`${e.ctrl}meetings/${r}/leave`,s);return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),P(t),Y(t),t.cleanup(),i}))}}function B(t){return function(){return e(this,void 0,void 0,(function*(){const{prefix:e,meetingID:s}=t.config.request,r=yield t.request.post(`${e.ctrl}meetings/${s}/end`);return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),P(t),Y(t),t.cleanup(),r}))}}class Q{constructor(e){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=H(e)}static getInstance(e){return this.instance?this.instance:this.instance=new Q(e)}}function Y(e){if(e.config.singleton){const{baseURL:t,modules:s,singleton:r}=e.config,i={baseURL:t,modules:s,worker:e.worker,singleton:r},n=Q.getInstance(i);n&&(n.meeting=H(i))}}Object.defineProperty(Q,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),exports.Chat=class extends _{constructor(e){super(e,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(e=>{const{body:t}=e;this.emitter.emit("chatMsg",t)}))}msg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/chat/msg`,t)}))}historyMsg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/chat/historyMsg`,t)}))}},exports.Info=w,exports.Invite=k,exports.LiveStream=class extends _{constructor(e){super(e,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(e=>{var t;const{state:s,body:r,stime:i}=e;if(r){if(i&&(this.data.jetlag=i),"full"===s){const{liveStreams:e=[]}=r;if(!e.length)return;this.data.status=[],this.data.liveStreams=e.map((e=>(e.requesting="starting"===e.status,this.data.status.push({platform:e.platform||"",status:(e.requesting?"stopped":e.status)||""}),e)));return g({status:this.data.status,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),r.liveStreams||(this.data.resultInfo={}),null===(t=r.liveStreams)||void 0===t||t.forEach((e=>{this.data.resultInfo=e.resultInfo||{};let t=this.data.liveStreams.findIndex((t=>t.platform===e.platform));-1===t?(e.requesting="starting"===e.status,this.data.liveStreams.push(e)):(e.requesting="starting"===e.status,e=Object.assign(Object.assign({},this.data.liveStreams[t]),e),this.data.liveStreams.splice(t,1,e)),t=this.data.status.findIndex((t=>t.platform===e.platform)),-1===t?this.data.status.push({platform:e.platform||"",status:e.requesting?"stopped":e.status||""}):this.data.status.splice(t,1,{platform:this.data.status[t].platform||"",status:e.requesting?this.data.status[t].status||"stopped":e.status||""})})),this.data}}))}setStatus(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/liveStream/status`,t)}))}liveStreamDescription(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/liveStream/description`,t)}))}liveStreamSetting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/liveStream/setting`,t)}))}},exports.Me=N,exports.Qa=class extends _{constructor(e){super(e,"qa"),this.data={questions:new Map,topSort:0}}_topic(){return"qa"}_bindOn(){this.ctx.emitter.on("qa",(e=>{const{body:t}=e;h(t)&&!l(t)?this.qaUpdate(this.data.questions,t):t.forEach((e=>this.qaUpdate(this.data.questions,e)))}))}qaUpdate(e,t){let s=e.get(t.question.id);const{clientID:r}=this.ctx.config.request;switch(t.command){case"addQuestion":s=this.createQuestion(t.question),e.set(t.question.id,s),this.emitter.emit("QuestionAdd",{question:s,selfSent:s.sender.endpointID===r});break;case"dismissQuestion":if(!s)break;s.sender.endpointID!==r?s.status="close":s.isTop=!1,this.emitter.emit("QuestionUpdate",{question:s}),e.set(t.question.id,s);break;case"reopenQuestion":s?(s.status="open",s.isTop=t.question.isTop,e.set(t.question.id,s)):(s=this.createQuestion(t.question),e.set(t.question.id,s)),this.emitter.emit("QuestionUpdate",{question:s});break;case"updateQuestion":s?e.set(t.question.id,Object.assign(Object.assign(Object.assign({},s),t.question),{topSort:t.question.isTop?this.data.topSort++:0})):(s=this.createQuestion(t.question),e.set(t.question.id,s)),this.emitter.emit("QuestionUpdate",{question:s});break;case"deleteQuestion":if(!s)break;s.sender.endpointID!==r?e.delete(t.question.id):(s.status="delete",s.isTop=!1,s.answers.clear(),e.set(t.question.id,s)),this.emitter.emit("QuestionDelete",{question:s});break;case"answerQuestion":s?s.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)):(s=this.createQuestion(t.question),s.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)),e.set(t.question.id,s)),this.emitter.emit("QuestionDelete",{question:s});break;case"deleteAnswer":s&&(s.answers.delete(t.answer.id),this.emitter.emit("QuestionDelete",{question:s}))}this.emitter.emit("QuestionChange",{questions:this.data.questions})}createQuestion(e){return{isAnonymous:e.isAnonymous,isTop:e.isTop,id:e.id,content:e.content,sender:e.sender,timestamp:e.timestamp||-1,status:e.status||"open",answers:new Map,topSort:0}}createQuestionAnswer(e){return{isPrivate:e.isPrivate,content:e.content,id:e.id,sender:e.sender,timestamp:e.timestamp||-1}}qa(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/qa`,t)}))}},exports.Recording=class extends _{constructor(e){super(e,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(e=>{const{state:t,body:s,stime:r}=e;if(s)return r&&(this.data.jetlag=r),this.data.isPracticeSession="started"===s.status&&this.data.status===s.status&&0===s.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),s),"starting"===s.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=s.status||this.data.status),this.data.resultInfo=s.resultInfo||{},["full","update"].includes(t)?(s.recordUsers&&(this.data.recording.recordUsers=s.recordUsers),this.data):void 0}))}history(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.get(`${e}meetings/${t}/recording/history`)}))}status(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/recording/status`,t)}))}layout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/recording/status`,t)}))}designatedUsers(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/recording/designatedUsers`,t)}))}participantAdd(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/recording/participant/add`,t)}))}participantDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/recording/participant/delete`,t)}))}getTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getTemplates`,{params:t})}))}getByIds(t){return e(this,void 0,void 0,(function*(){const{prefix:{user:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/subject/getByIds`,t)}))}recordLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/recording/layout`,t)}))}},exports.Setting=class extends _{constructor(e){super(e,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(e=>{const{state:t,body:s}=e;["full","update"].includes(t)&&g(s,this.data)}))}setting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/setting`,t)}))}muteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/muteAll`)}))}unmuteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/unmuteAll`)}))}},exports.SpotlightVideo=class extends _{constructor(e){super(e,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(e=>{const{body:t}=e;if(!t||!t.userIDs)return;this.data.userIDs=t.userIDs;t.userIDs.findIndex((e=>e===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(exports.MeEvent.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(exports.MeEvent.UPDATE,{isSpotlightVideo:!1})}))}spotlight(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/view/spotlight`,e)}},exports.Users=L,exports.View=class extends _{constructor(e){super(e,"view")}_topic(){return["hostAttendee","audience","advCtrl"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((e=>{this.ctx.emitter.on(e,(t=>{"personalView"!==e?this.updateLayout(t,e):this.updatePersonalLayouts(t)}))}))}updateLayout(e,t){const{event:s,body:r}=e;r&&("meetingView"===s?Object.keys(r).forEach((e=>{this.data[e]=r[e]})):this.data[t]=r)}updatePersonalLayouts(e){const{state:t,body:s}=e;"full"!==t&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),s.personalLayouts.forEach((e=>{const{subscriber:s={userID:-1}}=e,r=s.userID||s.subjectID||-1;"full"===t||"update"===t||e.templateStatus?this.data.personalLayouts[r]=e:delete this.data.personalLayouts[r]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/hostLayout`,t)}))}attendeeLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/attendeeLayout`,t)}))}audienceLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/audienceLayout`,t)}))}personalLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/personalLayout`,t)}))}personalLayoutDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/personalLayout/delete`,t)}))}virtualClassLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/view/virtualClass/layout`,t)}))}closeVirtualClass(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/view/virtualClass/close`)}))}getVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/layout/template/info`,{params:t})}))}addVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/layout/template/add`,t)}))}editVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/layout/template/edit`,t)}))}getTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getTemplates`,{params:t})}))}editTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/edit`,t)}))}addTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/add`,t)}))}deleteTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/delete`,t)}))}getDefaultTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getDefaultTemplates`,{params:t})}))}changeDefaultTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/changeDefaultTemplate`,t)}))}perspectiveBind(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/perspective/bind`,t)}))}},exports.Vote=class extends _{constructor(e){super(e,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(e=>{const{body:t}=e,{voteID:s}=t;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[s]=t,this.emitter.emit("voteChange",this.data.vote)}))}getVotes(e){const{prefix:{vote:t},meetingID:s,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.get(`${t}meetings/${s}/votes`,{params:e})}getVote(e){const{prefix:{vote:t},meetingID:s,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.get(`${t}meetings/${s}/vote`,{params:e})}getMeVote(e){const{prefix:{vote:t},meetingID:s,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.get(`${t}meetings/${s}/vote/me`,{params:e})}voteStatus(e,t){const{prefix:{vote:s},meetingID:r,voteTk:i}=this.ctx.config.request;return e.tk=e.tk||i,this.ctx.request.post(`${s}meetings/${r}/vote/status?tk=${e.tk}&voteID=${e.voteID}`,t)}voteSubmit(e,t){const{prefix:{vote:s},meetingID:r,voteTk:i}=this.ctx.config.request;return e.tk=e.tk||i,this.ctx.request.post(`${s}meetings/${r}/vote/submit?tk=${e.tk}&voteID=${e.voteID}`,t)}voteAdd(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/add`,e)}voteEdit(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/edit`,e)}voteDelete(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/delete`,e)}voteInProgress(e){const{prefix:{vote:t},meetingID:s,voteTk:r}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${s}/vote/inProgress`,{params:{tk:e&&e.tk||r}})}},exports.Words=class extends _{constructor(e){super(e,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(e=>{this.data.timer&&clearTimeout(this.data.timer);const{state:t,body:s}=e;if(!s)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data});"full"===t&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),this.data.barrageRecord=[{content:s.content,time:(new Date).getTime(),durationType:s.durationType,duration:1e3*s.duration},...this.data.barrageRecord],s.wordsDisplayStatus=!0,-1!==s.duration&&(this.data.timer=setTimeout((()=>{s.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=s.wordsDisplayStatus,this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})}),1e3*s.duration)),g(s,this.data),this.emitter.emit("barrageRecordChange",this.data.barrageRecord),this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(exports.MeEvent.ROLECHANGE,(()=>this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})))}barrage(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${s}/barrage`,t)}))}deleteBarrage(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/deleteBarrage`)}))}},exports.createMeeting=function(e){return e.singleton?Q.getInstance(e).meeting:H(e)},exports.reset=Y;
package/dist/meeting.d.ts CHANGED
@@ -81,6 +81,8 @@ export declare interface ChatMsgPayload {
81
81
  state: PollingPayloadState;
82
82
  }
83
83
 
84
+ declare type Command = 'addQuestion' | 'dismissQuestion' | 'reopenQuestion' | 'updateQuestion' | 'deleteQuestion' | 'answerQuestion' | 'deleteAnswer';
85
+
84
86
  declare interface Config {
85
87
  /**
86
88
  * 服务器地址
@@ -182,6 +184,10 @@ export declare interface Context {
182
184
  vote: string;
183
185
  [prop: string]: string;
184
186
  };
187
+ /**
188
+ * 设备ID
189
+ */
190
+ clientID: string;
185
191
  /**
186
192
  * 会议归属地
187
193
  */
@@ -263,6 +269,7 @@ export declare interface Context {
263
269
  interval: number;
264
270
  };
265
271
  };
272
+ cleanup: (reason?: Reason) => void;
266
273
  }
267
274
 
268
275
  /**
@@ -337,7 +344,11 @@ export declare enum EVENT {
337
344
  /**
338
345
  * 会议状态
339
346
  */
340
- STATE = "state"
347
+ STATE = "state",
348
+ /**
349
+ * 入会失败
350
+ */
351
+ FAILED = "failed"
341
352
  }
342
353
 
343
354
  /**
@@ -346,9 +357,10 @@ export declare enum EVENT {
346
357
  declare type Events = {
347
358
  [EVENT.STATE]: {
348
359
  state: STATE;
349
- reason?: ResultInfo;
360
+ reason?: Reason;
350
361
  };
351
362
  [EVENT.REQUEST_ERROR]: RequestError;
363
+ [EVENT.FAILED]: Reason;
352
364
  [MeEvent.INIT]: MeData;
353
365
  [MeEvent.UPDATE]: any;
354
366
  [MeEvent.ROLECHANGE]: ROLE;
@@ -375,21 +387,38 @@ declare type Events = {
375
387
  participantCount: any;
376
388
  liveStream: any;
377
389
  chatMsg: any;
390
+ qa: any;
378
391
  };
379
392
 
380
- declare type Events_10 = Record<EventType, unknown>;
381
-
382
- declare type Events_11 = Record<EventType, any>;
383
-
384
- declare type Events_12 = Record<EventType, any>;
385
-
386
- declare type Events_13 = {
393
+ declare type Events_10 = {
387
394
  hostLayoutChange: ViewData['hostLayout'];
388
395
  attendeeLayoutChange: ViewData['attendeeLayout'];
389
396
  audienceLayoutChange: ViewData['audienceLayout'];
390
397
  personalLayoutsChange: ViewData['personalLayouts'];
391
398
  };
392
399
 
400
+ declare type Events_11 = {
401
+ QuestionChange: {
402
+ questions: Map<string, Question>;
403
+ };
404
+ QuestionDelete: {
405
+ question: Question;
406
+ };
407
+ QuestionUpdate: {
408
+ question: Question;
409
+ };
410
+ QuestionAdd: {
411
+ question: Question;
412
+ selfSent: boolean;
413
+ };
414
+ };
415
+
416
+ declare type Events_12 = Record<EventType, unknown>;
417
+
418
+ declare type Events_13 = Record<EventType, any>;
419
+
420
+ declare type Events_14 = Record<EventType, any>;
421
+
393
422
  declare type Events_2 = {
394
423
  [MeEvent.INIT]: MeData;
395
424
  [MeEvent.UPDATE]: any;
@@ -696,7 +725,7 @@ export declare interface JoinParams {
696
725
  }
697
726
 
698
727
  export declare interface Layout {
699
- mode: 'custom' | 'basic';
728
+ mode: LayoutMode;
700
729
  layout: LayoutContent;
701
730
  seq?: number;
702
731
  applyToAttendee?: boolean;
@@ -715,6 +744,8 @@ export declare interface LayoutContent {
715
744
  mode?: string;
716
745
  }
717
746
 
747
+ export declare type LayoutMode = 'custom' | 'basic';
748
+
718
749
  export declare interface Live {
719
750
  duration?: number;
720
751
  lastStartTime?: number;
@@ -736,7 +767,7 @@ export declare interface Live {
736
767
  userID?: string;
737
768
  }
738
769
 
739
- export declare class LiveStream extends Module<LiveStreamData, Events_10> {
770
+ export declare class LiveStream extends Module<LiveStreamData, Events_12> {
740
771
  constructor(ctx: Context);
741
772
  _topic(): string;
742
773
  _bindOn(): void;
@@ -987,11 +1018,8 @@ export declare interface PersonalLayoutSubscriber {
987
1018
 
988
1019
  export declare interface Picture {
989
1020
  index: number;
990
- subscribeToUsers?: {
991
- subjectID: string;
992
- userID?: string;
993
- }[];
994
1021
  subscribeType: string;
1022
+ subscribeToUsers?: SubscribeToUser[];
995
1023
  priorSubscribeType?: string;
996
1024
  }
997
1025
 
@@ -1000,6 +1028,94 @@ export declare interface Picture {
1000
1028
  */
1001
1029
  export declare type PollingPayloadState = 'full' | 'delete' | 'update';
1002
1030
 
1031
+ export declare class Qa extends Module<QaData, Events_11> {
1032
+ constructor(ctx: Context);
1033
+ _topic(): string;
1034
+ _bindOn(): void;
1035
+ qaUpdate(questions: Map<string, Question>, data: any): void;
1036
+ createQuestion(data: Question): {
1037
+ isAnonymous: boolean;
1038
+ isTop: boolean;
1039
+ id: string;
1040
+ content: string;
1041
+ sender: {
1042
+ displayName: string;
1043
+ endpointID: string;
1044
+ };
1045
+ timestamp: number;
1046
+ status: string;
1047
+ answers: Map<any, any>;
1048
+ topSort: number;
1049
+ };
1050
+ createQuestionAnswer(data: QuestionAnswer): {
1051
+ isPrivate: boolean;
1052
+ content: string;
1053
+ id: string;
1054
+ sender: {
1055
+ displayName: string;
1056
+ endpointID: string;
1057
+ };
1058
+ timestamp: number;
1059
+ };
1060
+ /**
1061
+ * 问答
1062
+ * @param params
1063
+ * @returns
1064
+ */
1065
+ qa(params: {
1066
+ command: Command;
1067
+ question: {
1068
+ isAnonymous: boolean;
1069
+ isTop: boolean;
1070
+ id: string;
1071
+ content: string;
1072
+ sender: {
1073
+ endpointID: string;
1074
+ displayName: string;
1075
+ };
1076
+ };
1077
+ }): Promise<any>;
1078
+ }
1079
+
1080
+ export declare interface QaData {
1081
+ questions: Map<string, Question>;
1082
+ topSort: number;
1083
+ }
1084
+
1085
+ export declare interface QaPayload {
1086
+ body: {
1087
+ command: Command;
1088
+ question: Question;
1089
+ };
1090
+ state: PollingPayloadState;
1091
+ }
1092
+
1093
+ export declare interface Question {
1094
+ isAnonymous: boolean;
1095
+ isTop: boolean;
1096
+ id: string;
1097
+ content: string;
1098
+ sender: {
1099
+ displayName: string;
1100
+ endpointID: string;
1101
+ };
1102
+ timestamp: number;
1103
+ status: string;
1104
+ answers: Map<string, QuestionAnswer>;
1105
+ topSort?: number;
1106
+ }
1107
+
1108
+ export declare interface QuestionAnswer {
1109
+ isPrivate: boolean;
1110
+ id: string;
1111
+ sender: {
1112
+ displayName: string;
1113
+ endpointID: string;
1114
+ };
1115
+ content: string;
1116
+ timestamp: number;
1117
+ }
1118
+
1003
1119
  declare type ReactiveReturn = {
1004
1120
  /**
1005
1121
  * 取消响应式关联
@@ -1007,6 +1123,10 @@ declare type ReactiveReturn = {
1007
1123
  _destory: () => void;
1008
1124
  };
1009
1125
 
1126
+ export declare type Reason = ResultInfo & {
1127
+ data?: any;
1128
+ };
1129
+
1010
1130
  /**
1011
1131
  * 录制状态
1012
1132
  */
@@ -1017,7 +1137,7 @@ export declare enum RECORD_STATUS {
1017
1137
  STOPPED = "stopped"
1018
1138
  }
1019
1139
 
1020
- export declare class Recording extends Module<RecordingData, Events_11> {
1140
+ export declare class Recording extends Module<RecordingData, Events_13> {
1021
1141
  constructor(ctx: Context);
1022
1142
  _topic(): string;
1023
1143
  _bindOn(): void;
@@ -1225,7 +1345,7 @@ export declare interface SetMedia {
1225
1345
  };
1226
1346
  }
1227
1347
 
1228
- export declare class Setting extends Module<SettingData, Events_12> {
1348
+ export declare class Setting extends Module<SettingData, Events_14> {
1229
1349
  constructor(ctx: Context);
1230
1350
  _topic(): string;
1231
1351
  _bindOn(): void;
@@ -1347,6 +1467,11 @@ declare interface Status {
1347
1467
 
1348
1468
  declare type Status_2 = 'starting' | 'started' | 'stopped' | 'paused';
1349
1469
 
1470
+ export declare interface SubscribeToUser {
1471
+ subjectID: string;
1472
+ userID?: number;
1473
+ }
1474
+
1350
1475
  /**
1351
1476
  * User 数据
1352
1477
  */
@@ -1629,7 +1754,7 @@ export declare interface UsersData {
1629
1754
  advCtrlUsers: User[];
1630
1755
  }
1631
1756
 
1632
- export declare class View extends Module<ViewData, Events_13> {
1757
+ export declare class View extends Module<ViewData, Events_10> {
1633
1758
  constructor(ctx: Context);
1634
1759
  _topic(): string[];
1635
1760
  _bindOn(): void;
@@ -2036,7 +2161,9 @@ export declare interface YlinkSDKMeeting {
2036
2161
  /**
2037
2162
  * 离开会议
2038
2163
  */
2039
- leave: (params?: ResultInfo) => Promise<Response_2>;
2164
+ leave: (params?: {
2165
+ resultInfo: ResultInfo;
2166
+ }) => Promise<Response_2>;
2040
2167
  /**
2041
2168
  * 结束会议
2042
2169
  */
@@ -2073,6 +2200,14 @@ export declare interface YlinkSDKMeeting {
2073
2200
  * 聊天
2074
2201
  */
2075
2202
  chat?: Chat;
2203
+ /**
2204
+ * 布局
2205
+ */
2206
+ view?: View;
2207
+ /**
2208
+ * 问答
2209
+ */
2210
+ qa?: Qa;
2076
2211
  [props: string]: any;
2077
2212
  }
2078
2213
 
@@ -1 +1 @@
1
- function t(t,e,r,i){return new(r||(r=Promise))((function(s,n){function o(t){try{c(i.next(t))}catch(e){n(e)}}function a(t){try{c(i.throw(t))}catch(e){n(e)}}function c(t){var e;t.done?s(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(o,a)}c((i=i.apply(t,e||[])).next())}))}function e(t){return{all:t=t||new Map,on:function(e,r){var i=t.get(e);i?i.push(r):t.set(e,[r])},off:function(e,r){var i=t.get(e);i&&(r?i.splice(i.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var i=t.get(e);i&&i.slice().map((function(t){t(r)})),(i=t.get("*"))&&i.slice().map((function(t){t(e,r)}))}}}var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},i={exports:{}};!function(t,e){var i="__lodash_hash_undefined__",s=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",h="[object Promise]",f="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",b="[object ArrayBuffer]",x="[object DataView]",I="[object Float32Array]",q="[object Float64Array]",D="[object Int8Array]",E="[object Int16Array]",$="[object Int32Array]",O="[object Uint8Array]",_="[object Uint8ClampedArray]",T="[object Uint16Array]",w="[object Uint32Array]",S=/\w*$/,A=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,U={};U[n]=U["[object Array]"]=U[b]=U[x]=U[o]=U[a]=U[I]=U[q]=U[D]=U[E]=U[$]=U[d]=U[l]=U[p]=U[f]=U[m]=U[g]=U[v]=U[O]=U[_]=U[T]=U[w]=!0,U["[object Error]"]=U[c]=U[y]=!1;var P="object"==typeof self&&self&&self.Object===Object&&self,C="object"==typeof r&&r&&r.Object===Object&&r||P||Function("return this")(),k=e&&!e.nodeType&&e,N=k&&t&&!t.nodeType&&t,R=N&&N.exports===k;function L(t,e){return t.set(e[0],e[1]),t}function H(t,e){return t.add(e),t}function M(t,e,r,i){var s=-1,n=t?t.length:0;for(i&&n&&(r=t[++s]);++s<n;)r=e(r,t[s],s,t);return r}function V(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(r){}return e}function G(t){var e=-1,r=Array(t.size);return t.forEach((function(t,i){r[++e]=[i,t]})),r}function B(t,e){return function(r){return t(e(r))}}function Y(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var W,X=Array.prototype,F=Function.prototype,J=Object.prototype,K=C["__core-js_shared__"],z=(W=/[^.]+$/.exec(K&&K.keys&&K.keys.IE_PROTO||""))?"Symbol(src)_1."+W:"",Q=F.toString,Z=J.hasOwnProperty,tt=J.toString,et=RegExp("^"+Q.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=R?C.Buffer:void 0,it=C.Symbol,st=C.Uint8Array,nt=B(Object.getPrototypeOf,Object),ot=Object.create,at=J.propertyIsEnumerable,ct=X.splice,ut=Object.getOwnPropertySymbols,dt=rt?rt.isBuffer:void 0,lt=B(Object.keys,Object),pt=Nt(C,"DataView"),ht=Nt(C,"Map"),ft=Nt(C,"Promise"),mt=Nt(C,"Set"),gt=Nt(C,"WeakMap"),vt=Nt(Object,"create"),yt=Vt(pt),bt=Vt(ht),xt=Vt(ft),It=Vt(mt),qt=Vt(gt),Dt=it?it.prototype:void 0,Et=Dt?Dt.valueOf:void 0;function $t(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function Ot(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function _t(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}function Tt(t){this.__data__=new Ot(t)}function wt(t,e){var r=Bt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Yt(t)}(t)&&Z.call(t,"callee")&&(!at.call(t,"callee")||tt.call(t)==n)}(t)?function(t,e){for(var r=-1,i=Array(t);++r<t;)i[r]=e(r);return i}(t.length,String):[],i=r.length,s=!!i;for(var o in t)!e&&!Z.call(t,o)||s&&("length"==o||Ht(o,i))||r.push(o);return r}function St(t,e,r){var i=t[e];Z.call(t,e)&&Gt(i,r)&&(void 0!==r||e in t)||(t[e]=r)}function At(t,e){for(var r=t.length;r--;)if(Gt(t[r][0],e))return r;return-1}function jt(t,e,r,i,s,h,y){var A;if(i&&(A=h?i(t,s,h,y):i(t)),void 0!==A)return A;if(!Ft(t))return t;var j=Bt(t);if(j){if(A=function(t){var e=t.length,r=t.constructor(e);e&&"string"==typeof t[0]&&Z.call(t,"index")&&(r.index=t.index,r.input=t.input);return r}(t),!e)return function(t,e){var r=-1,i=t.length;e||(e=Array(i));for(;++r<i;)e[r]=t[r];return e}(t,A)}else{var P=Lt(t),C=P==c||P==u;if(Wt(t))return function(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}(t,e);if(P==p||P==n||C&&!h){if(V(t))return h?t:{};if(A=function(t){return"function"!=typeof t.constructor||Mt(t)?{}:(e=nt(t),Ft(e)?ot(e):{});var e}(C?{}:t),!e)return function(t,e){return Ct(t,Rt(t),e)}(t,function(t,e){return t&&Ct(e,Jt(e),t)}(A,t))}else{if(!U[P])return h?t:{};A=function(t,e,r,i){var s=t.constructor;switch(e){case b:return Pt(t);case o:case a:return new s(+t);case x:return function(t,e){var r=e?Pt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,i);case I:case q:case D:case E:case $:case O:case _:case T:case w:return function(t,e){var r=e?Pt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,i);case d:return function(t,e,r){return M(e?r(G(t),!0):G(t),L,new t.constructor)}(t,i,r);case l:case g:return new s(t);case f:return function(t){var e=new t.constructor(t.source,S.exec(t));return e.lastIndex=t.lastIndex,e}(t);case m:return function(t,e,r){return M(e?r(Y(t),!0):Y(t),H,new t.constructor)}(t,i,r);case v:return n=t,Et?Object(Et.call(n)):{}}var n}(t,P,jt,e)}}y||(y=new Tt);var k=y.get(t);if(k)return k;if(y.set(t,A),!j)var N=r?function(t){return function(t,e,r){var i=e(t);return Bt(t)?i:function(t,e){for(var r=-1,i=e.length,s=t.length;++r<i;)t[s+r]=e[r];return t}(i,r(t))}(t,Jt,Rt)}(t):Jt(t);return function(t,e){for(var r=-1,i=t?t.length:0;++r<i&&!1!==e(t[r],r,t););}(N||t,(function(s,n){N&&(s=t[n=s]),St(A,n,jt(s,e,r,i,n,t,y))})),A}function Ut(t){return!(!Ft(t)||(e=t,z&&z in e))&&(Xt(t)||V(t)?et:A).test(Vt(t));var e}function Pt(t){var e=new t.constructor(t.byteLength);return new st(e).set(new st(t)),e}function Ct(t,e,r,i){r||(r={});for(var s=-1,n=e.length;++s<n;){var o=e[s],a=i?i(r[o],t[o],o,r,t):void 0;St(r,o,void 0===a?t[o]:a)}return r}function kt(t,e){var r,i,s=t.__data__;return("string"==(i=typeof(r=e))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==r:null===r)?s["string"==typeof e?"string":"hash"]:s.map}function Nt(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return Ut(r)?r:void 0}$t.prototype.clear=function(){this.__data__=vt?vt(null):{}},$t.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},$t.prototype.get=function(t){var e=this.__data__;if(vt){var r=e[t];return r===i?void 0:r}return Z.call(e,t)?e[t]:void 0},$t.prototype.has=function(t){var e=this.__data__;return vt?void 0!==e[t]:Z.call(e,t)},$t.prototype.set=function(t,e){return this.__data__[t]=vt&&void 0===e?i:e,this},Ot.prototype.clear=function(){this.__data__=[]},Ot.prototype.delete=function(t){var e=this.__data__,r=At(e,t);return!(r<0)&&(r==e.length-1?e.pop():ct.call(e,r,1),!0)},Ot.prototype.get=function(t){var e=this.__data__,r=At(e,t);return r<0?void 0:e[r][1]},Ot.prototype.has=function(t){return At(this.__data__,t)>-1},Ot.prototype.set=function(t,e){var r=this.__data__,i=At(r,t);return i<0?r.push([t,e]):r[i][1]=e,this},_t.prototype.clear=function(){this.__data__={hash:new $t,map:new(ht||Ot),string:new $t}},_t.prototype.delete=function(t){return kt(this,t).delete(t)},_t.prototype.get=function(t){return kt(this,t).get(t)},_t.prototype.has=function(t){return kt(this,t).has(t)},_t.prototype.set=function(t,e){return kt(this,t).set(t,e),this},Tt.prototype.clear=function(){this.__data__=new Ot},Tt.prototype.delete=function(t){return this.__data__.delete(t)},Tt.prototype.get=function(t){return this.__data__.get(t)},Tt.prototype.has=function(t){return this.__data__.has(t)},Tt.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Ot){var i=r.__data__;if(!ht||i.length<199)return i.push([t,e]),this;r=this.__data__=new _t(i)}return r.set(t,e),this};var Rt=ut?B(ut,Object):function(){return[]},Lt=function(t){return tt.call(t)};function Ht(t,e){return!!(e=null==e?s:e)&&("number"==typeof t||j.test(t))&&t>-1&&t%1==0&&t<e}function Mt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||J)}function Vt(t){if(null!=t){try{return Q.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function Gt(t,e){return t===e||t!=t&&e!=e}(pt&&Lt(new pt(new ArrayBuffer(1)))!=x||ht&&Lt(new ht)!=d||ft&&Lt(ft.resolve())!=h||mt&&Lt(new mt)!=m||gt&&Lt(new gt)!=y)&&(Lt=function(t){var e=tt.call(t),r=e==p?t.constructor:void 0,i=r?Vt(r):void 0;if(i)switch(i){case yt:return x;case bt:return d;case xt:return h;case It:return m;case qt:return y}return e});var Bt=Array.isArray;function Yt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=s}(t.length)&&!Xt(t)}var Wt=dt||function(){return!1};function Xt(t){var e=Ft(t)?tt.call(t):"";return e==c||e==u}function Ft(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Jt(t){return Yt(t)?wt(t):function(t){if(!Mt(t))return lt(t);var e=[];for(var r in Object(t))Z.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return jt(t,!0,!0)}}(i,i.exports);var s=i.exports;const n=t=>({get(e,r,i){if("__isProxy"===r)return!0;const s=Reflect.get(e,r);return Array.isArray(s)?s:"object"==typeof s&&null!==s?s.__isProxy?s:new Proxy(s,n(t)):s},set(e,r,i,n){const o=e[r];i=h(i)&&i.__isProxy?s(i):i;const a=Reflect.set(e,r,i,n);return((t,e)=>t!==e&&(t==t||e==e))(i,o)&&t.emit(`${y(r)}Change`,i),a}}),o=t=>encodeURIComponent(t).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class a{constructor(t){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=t.baseURL,this._beforeRequest=t.beforeRequest,this._errorHandler=t.error}_request(t){const{url:e="",timeout:r=6e4}=t;let{headers:i={}}=t;return t.url=this.baseURL.replace(/\/+$/,"")+"/"+((t,e)=>{if(!e)return t;const r=[];Object.keys(e).forEach((t=>{const i=e[t];if(null==i)return;let s;Array.isArray(i)?(s=i,t+="[]"):s=[i],s.forEach((e=>{null!==e&&"object"==typeof e&&(e=JSON.stringify(e)),r.push(`${o(t)}=${o(e)}`)}))}));const i=r.join("&");if(i){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+i}return t})(e.replace(/^\/+/,""),t.params),i=Object.assign(i,this._defaultHeaders),Object.keys(i).forEach((t=>{"Content-Type"!==t&&t.toUpperCase()==="Content-Type".toUpperCase()&&(i["Content-Type"]=i[t],delete i[t])})),f(t.data)&&(i&&!i["Content-Type"]&&(i["Content-Type"]="application/json;charset=utf-8"),t.data=JSON.stringify(t.data)),t.headers=i,t.timeout=r,this._beforeRequest&&this._beforeRequest(t),"undefined"!=typeof wx?d(t):u(t)}setDefaultHeader(t,e){t in this._defaultHeaders&&(""===e||null===e)?delete this._defaultHeaders[t]:this._defaultHeaders[t]=e}get(t,e){return this._errorHandler?this._request(Object.assign(e||{},{url:t,method:"GET"})).catch((t=>{throw this._errorHandler&&this._errorHandler(t),t})):this._request(Object.assign(e||{},{url:t,method:"GET"}))}post(t,e,r){return this._errorHandler?this._request(Object.assign(r||{},{url:t,method:"POST",data:e})).catch((t=>{throw this._errorHandler&&this._errorHandler(t),t})):this._request(Object.assign(r||{},{url:t,method:"POST",data:e}))}}class c{constructor(t){let e;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((t=>{e=t})),t((t=>{this.reason||(this.reason=t,e(this.reason))}))}static source(){let t;const e=new c((e=>{t=e}));return{cancel:t,token:e}}}const u=t=>new Promise(((e,r)=>{const{data:i=null,url:s,method:n="GET",headers:o,cancelToken:a,withResDate:c}=t;let u=new XMLHttpRequest;u.open(n.toUpperCase(),s,!0),u.timeout=t.timeout;const d=()=>{if(u){if(u.status>=200&&u.status<300)try{const t=JSON.parse(u.responseText);c&&(t.responseDate=new Date(u.getResponseHeader("Date")).getTime()),e(t)}catch(t){r(new Error("E_JSON_PARSE"+u.responseText))}else r({url:s,statusCode:u.status});u=null}};"onloadend"in u?u.onloadend=d:u.onreadystatechange=()=>{u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=()=>{u&&(r({url:s,statusCode:u.status,type:"request abort"}),u=null)},u.onerror=()=>{r(new Error("Network Error")),u=null},u.ontimeout=()=>{r(new Error("timeout of "+t.timeout+"ms exceeded")),u=null},"setRequestHeader"in u&&Object.keys(o).forEach((t=>{null===i&&"content-type"===t.toLowerCase()?delete o[t]:u.setRequestHeader(t,o[t])})),a&&a.promise.then((t=>{u&&(u.abort(),r(t),u=null)})),u.send(i)})),d=t=>new Promise(((e,r)=>{const{data:i=null,url:s,method:n="GET",headers:o,cancelToken:a}=t,c=wx.request({url:s,data:i,method:n.toUpperCase(),timeout:t.timeout,header:o,success(t){t.statusCode>=200&&t.statusCode<300?e(t.data):r({url:s,statusCode:t.statusCode})},fail(t){r("request:fail abort"===t.errMsg&&a&&a.reason||t)}});a&&a.promise.then((()=>{c&&c.abort()}))})),l=Array.isArray,p=t=>null==t,h=t=>"object"==typeof t&&null!==t,f=t=>{if("[object Object]"!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype},m=()=>{const t=[],e="0123456789abcdef";for(let r=0;r<36;r++)t[r]=e.substr(Math.floor(16*Math.random()),1);t[14]="4",t[19]=e.substr(3&t[19]|8,1),t[8]=t[13]=t[18]=t[23]="-";return t.join("").split("-").join("")},g=(t,e)=>t?(Object.entries(t).forEach((t=>{const[r,i]=[t[0],t[1]];if(null!==i)return h(i)&&!l(i)?(e[r]||(e[r]={}),void(e[r]=g(i,e[r]))):void(e[r]=i)})),e):e,v=/-(\w)/g,y=t=>t.replace(v,((t,e)=>e?e.toUpperCase():""));var b,x,I,q,D,E;!function(t){t.REQUEST_ERROR="requestError",t.STATE="state"}(b||(b={})),function(t){t[t.CLOSE=0]="CLOSE",t[t.JOINED=1]="JOINED",t[t.READY=2]="READY"}(x||(x={})),function(t){t.WEBAPP="webApp",t.WEBCTRL="webCtrl",t.WECHATMP="weChatMP",t.SUPERVISION="supervision",t.BIGSCREEN="bigScreen",t.DESKTOP="desktop",t.MOBILE="mobile",t.VCS="vcs",t.SIP="sip",t.H323="h323",t.PSTN="pstn"}(I||(I={})),function(t){t.HOST="host",t.COHOST="coHost",t.ATTENDEE="attendee",t.AUDIENCE="audience"}(q||(q={})),function(t){t.STARTED="started",t.PAUSED="paused",t.STARTING="starting",t.STOPPED="stopped"}(D||(D={}));class ${constructor(t,r){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"on",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"off",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=r,this.ctx=t,this.emitter=e(),this.on=this.emitter.on,this.off=this.emitter.off,this.data=new Proxy({},n(this.emitter)),this._bindOn()}cleanup(){this.emitter.all=new Map,this.data=new Proxy({},n(this.emitter))}reactive(t){if(h(t)){const e=new Map,r=(t,i)=>{Object.keys(t).forEach((s=>{!1===i&&s in this.data&&(t[s]=this.data[s]);const n=e=>t[s]=e,o=`${y(s)}Change`;this.emitter.on(o,n),e.set(o,n),h(t[s])&&!l(t[s])&&r(t[s],!0)}))};r(t,!1),t._destory=()=>{e.forEach(((t,e)=>{this.emitter.off(e,t)}))}}else console.warn("Parameter is not an object!");return t}}class O extends ${constructor(t){super(t,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(t=>{const{state:e,body:r}=t;("full"===e||"update"===e)&&g(r,this.data)})),this.ctx.emitter.on("participantCount",(t=>{const{body:e}=t;g({participantCount:e},this.data)}))}subject(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${r}/info/subject`,e)}))}practiceSession(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${e}/info/practiceSession`)}))}shareInfo(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${e}/meetings/${r}/shareInfo`,{params:t})}meetings(t){if(!t)return Promise.reject();const{prefix:{ctrl:e}}=this.ctx.config.request;return this.ctx.request.get(`${e}/meetings`,{params:t})}}function _(e){return t(this,void 0,void 0,(function*(){const r=w(e),{sessionID:i,meetingID:s}=e.config.request,n=yield function(e,r){return t(this,void 0,void 0,(function*(){const{topics:t,sessionID:i,meetingID:s}=r,n=yield e.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:i,meetingId:s},inboxes:t}),o=[];return n.data&&Object.keys(n.data).forEach((t=>{o.push({name:t,seqId:n.data[t].maxSeqId,limit:200})})),o}))}(e.request,{topics:r,sessionID:i,meetingID:s});yield S(r,e),e.status.polling.running=!0,e.status.keepalive.running=!0,A(e.request,{inboxes:n,sessionID:i,meetingID:s,cancelToken:e.config.request.cancelToken.token,status:e.status.polling},(t=>{e.emitter.emit(t.event,t)})),j(e)}))}function T(t){t.status.polling.running=!1,t.status.keepalive.running=!1,t.status.polling.timer&&(clearTimeout(t.status.polling.timer),t.status.polling.timer=null),t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null),t.config.request.cancelToken.cancel(),t.config.request.cancelToken=c.source()}function w(t){const e=[],{isInLobby:r}=t.modules.me.data;return r?(e.push("lobbyMember"),e):(Object.keys(t.modules).forEach((r=>{const i=t.modules[r]._topic();i&&(Array.isArray(i)?i.forEach((t=>{e.includes(t)||e.push(t)})):e.includes(i)||e.push(i))})),e)}function S(e,r){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=r.config.request,s=yield r.request.post(`${t}/meetings/${i}/subscribe`,{topics:e}),n=s&&s.data&&s.data.eventMsgs;n&&n.forEach((t=>{console.log("[subscribe]",t),r.emitter.emit(t.event,t)})),r.state!==x.READY&&(r.state=x.READY,r.emitter.emit(b.STATE,{state:r.state}))}))}function A(e,r,i){return t(this,void 0,void 0,(function*(){const{inboxes:s,sessionID:n,meetingID:o,cancelToken:a,status:c}=r;yield(()=>t(this,void 0,void 0,(function*(){const t=yield e.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:s},{cancelToken:a,withResDate:!0});if(!t||!t.data)return;const{data:r={}}=t;Object.keys(r).forEach((t=>{const e=s.find((e=>e.name===t));if(e){if(e.seqId=r[t].maxSeqId,!r[t].items)return;r[t].items.forEach((t=>{const e=JSON.parse(t.content);["liveStream","recording"].includes(e.event)&&(e.stime=t.stime),i(e)}))}}))})))(),c.running&&(c.timer=setTimeout((()=>{c.running&&A(e,r,i)}),200))}))}function j(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:r},meetingID:i,userID:s}=e.config.request;e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null),yield(()=>t(this,void 0,void 0,(function*(){const t=yield e.request.post(`${r}/meetings/${i}/users/${s}/keepalive`,{},{cancelToken:e.config.request.cancelToken.token});if(!t||!t.data)return;const{data:n={}}=t,o=n.interval||"";o&&(e.status.keepalive.interval=o)})))(),e.status.keepalive.running&&(e.status.keepalive.timer=setTimeout((()=>{e.status.keepalive.running&&j(e)}),1e3*e.status.keepalive.interval))}))}!function(t){t.INIT="meInit",t.UPDATE="meUpdate",t.UPDATE_USER_STATE="updateUserState",t.ROLECHANGE="meRoleChange",t.AUDIOCHANGE="meAudioChange",t.HANDUPCHANGE="meHandupChange",t.SETAUDIO="setAudio",t.VIDEOCHANGE="meVideoChange",t.SETVIDEO="setVideo",t.SHARECHANGE="meShareChange",t.DISPLAYNAMECHANGE="meDisplayNameChange",t.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",t.LOBBYCHANGE="meLobbyChange",t.BARRAGECHANGE="meBarrageChange",t.LEAVE="leave"}(E||(E={}));class U extends ${constructor(t){super(t,"me")}_topic(){return""}_bindOn(){const e=e=>t(this,void 0,void 0,(function*(){"role"in e&&e.role!==this.data.role&&(e.role!==q.AUDIENCE&&this.data.role!==q.AUDIENCE||(yield P(this.ctx),this.data.isUpdatedUserState=!1,this.emitter.emit(E.UPDATE_USER_STATE,{data:this.data,event:"roleChange"})),g({role:e.role},this.data),this.emitter.emit(E.ROLECHANGE,e.role),this.ctx.emitter.emit(E.ROLECHANGE,e.role))})),r=t=>{var e,r,i,s;if("audio"in t){const{deviceOn:n,sendOn:o,opBy:a}=t.audio;(!p(n)&&n!==(null===(e=this.data.audio)||void 0===e?void 0:e.deviceOn)||!p(o)&&o!==(null===(r=this.data.audio)||void 0===r?void 0:r.sendOn))&&(g({audio:t.audio},this.data),this.emitter.emit(E.AUDIOCHANGE,{deviceOn:p(n)?null===(i=this.data.audio)||void 0===i?void 0:i.deviceOn:n,sendOn:p(o)?null===(s=this.data.audio)||void 0===s?void 0:s.sendOn:o,opBy:a}))}},i=t=>{var e,r,i,s;if("video"in t){const{deviceOn:n,sendOn:o,opBy:a}=t.video;(!p(n)&&n!==(null===(e=this.data.video)||void 0===e?void 0:e.deviceOn)||!p(o)&&o!==(null===(r=this.data.video)||void 0===r?void 0:r.sendOn))&&(g({video:t.video},this.data),this.emitter.emit(E.VIDEOCHANGE,{deviceOn:p(n)?null===(i=this.data.video)||void 0===i?void 0:i.deviceOn:n,sendOn:p(o)?null===(s=this.data.video)||void 0===s?void 0:s.sendOn:o,opBy:a}))}},s=t=>{var e,r,i,s;if("share"in t){const{deviceOn:n,sendOn:o,opBy:a}=t.share;(!p(n)&&n!==(null===(e=this.data.share)||void 0===e?void 0:e.deviceOn)||!p(o)&&o!==(null===(r=this.data.share)||void 0===r?void 0:r.sendOn))&&(g({share:t.share},this.data),this.emitter.emit(E.SHARECHANGE,{deviceOn:p(n)?null===(i=this.data.share)||void 0===i?void 0:i.deviceOn:n,sendOn:p(o)?null===(s=this.data.share)||void 0===s?void 0:s.sendOn:o,opBy:a}))}},n=t=>{t.displayName&&t.displayName!==this.data.displayName&&(g({displayName:t.displayName},this.data),this.emitter.emit(E.DISPLAYNAMECHANGE,t.displayName))},o=t=>{"isHandUp"in t&&t.isHandUp!==this.data.isHandUp&&(g({isHandUp:t.isHandUp},this.data),this.emitter.emit(E.HANDUPCHANGE,t.isHandUp))},a=t=>{"isSpotlightVideo"in t&&(g({isSpotlightVideo:t.isSpotlightVideo},this.data),this.emitter.emit(E.SPOTLIGHTVIDEOCHANGE,t.isSpotlightVideo))},c=e=>t(this,void 0,void 0,(function*(){"isInLobby"in e&&e.isInLobby!==this.data.isInLobby&&(g({isInLobby:e.isInLobby},this.data),yield P(this.ctx),!1===e.isInLobby&&(this.data.isUpdatedUserState=!1,this.emitter.emit(E.UPDATE_USER_STATE,{data:this.data,event:"inLobbyChange"})),this.emitter.emit(E.LOBBYCHANGE,e.isInLobby))})),u=t=>{if(!t.barrage)return;let e=null;if(!t.barrage.wordsDisplayStatus)return e=null,delete t.barrage,this.data.barrage=e||void 0,void this.emitter.emit(E.BARRAGECHANGE,e);e={content:t.barrage.content,contentType:t.barrage.contentType,type:t.barrage.type,duration:t.barrage.duration,position:t.barrage.position};const{role:r}=this.data;t.barrage.receiver&&(r===q.HOST||r===q.COHOST?e=t.barrage.receiver.host?e:null:r===q.ATTENDEE?e=t.barrage.receiver.attendee?e:null:r===q.AUDIENCE&&(e=t.barrage.receiver.audience?e:null),delete t.barrage,this.data.barrage=e||void 0,this.emitter.emit(E.BARRAGECHANGE,e))},d=t=>{"leave"in t&&!0===t.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),T(this.ctx),Q(this.ctx),this.emitter.emit(E.LEAVE,t.resultInfo),this.ctx.state=x.CLOSE,this.ctx.emitter.emit(b.STATE,{state:this.ctx.state,reason:t.resultInfo}))},l=t=>{e(t),r(t),i(t),s(t),n(t),o(t),c(t),a(t),u(t),d(t)};this.ctx.emitter.on(E.INIT,(t=>{g(t,this.data),this.data.isUpdatedUserState=!1,this.emitter.emit(E.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on(E.UPDATE,(t=>{l(t),g(t,this.data)})),this.ctx.emitter.on("me",(e=>t(this,void 0,void 0,(function*(){const{state:t,body:r={users:[]}}=e;if("delete"===t){const t=r.users[0];return t.leave=!0,void d(t)}const i=r.users.find((t=>t.userID===this.data.userID));i&&(l(i),g(i,this.data))})))),this.ctx.emitter.on("setUserVideo",(t=>{this.emitter.emit(E.SETVIDEO,t.body)})),this.ctx.emitter.on("setUserAudio",(t=>{this.emitter.emit(E.SETAUDIO,t.body)})),this.ctx.emitter.on("meetingState",(t=>{const{body:e={}}=t;if("ended"===e.state){d({leave:!0,resultInfo:e.resultInfo})}}))}updateUserState(t,e=!1){if(!e){const{role:e,initialMediaState:r}=this.data;t.audio.sendOn=t.audio.sendOn&&r.audio.sendOn,t.video.sendOn=t.video.sendOn&&r.video.sendOn,e===q.AUDIENCE&&(t.audio.sendOn=!1,t.video.sendOn=!1)}const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,g(t,this.data),this.ctx.request.post(`${r}/meetings/${i}/updateUserState`,t)}}function P(e){return t(this,void 0,void 0,(function*(){const t=w(e),{meetingID:r,sessionID:i}=e.config.request;"undefined"!=typeof Worker&&e.worker?(yield S(t,e),e.worker.postMessage({topics:t,meetingID:r,sessionID:i,rePolling:!0})):(T(e),yield _(e))}))}class C extends ${constructor(t){super(t,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(t=>{const{body:e}=t;this.emitter.emit("chatMsg",e)}))}msg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}/meetings/${r}/chat/msg`,e)}))}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}/meetings/${r}/chat/historyMsg`,e)}))}}class k extends ${constructor(t){super(t,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(t=>{const{body:e,state:r}=t;if(e&&e.users){if("full"===r)return this.data.callRecordUsers=e.users.map((t=>(t.displayNamePinyin=k.setDisplayNamePinyinProp?k.setDisplayNamePinyinProp(t.displayName||""):t.displayName,t))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);e.users.forEach((t=>{const e=this.data.callRecordUsers.findIndex((e=>t.inviteTransID===e.inviteTransID));"update"===r&&-1!==e?g(t,this.data.callRecordUsers[e]):"update"===r&&-1===e&&(t.displayNamePinyin=k.setDisplayNamePinyinProp?k.setDisplayNamePinyinProp(t.displayName||""):t.displayName,this.data.callRecordUsers.push(t))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}/meetings/${r}/invite`,t)}mailTemplate(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${e}/mailTemplate`,{params:{meetingID:r},headers:{language:t.language}})}}class N extends ${constructor(t){super(t,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(t=>{var e;const{state:r,body:i,stime:s}=t;if(i){if(s&&(this.data.jetlag=s),"full"===r){const{liveStreams:t=[]}=i;if(!t.length)return;this.data.status=[],this.data.liveStreams=t.map((t=>(t.requesting="starting"===t.status,this.data.status.push({platform:t.platform||"",status:(t.requesting?"stopped":t.status)||""}),t)));return g({status:this.data.status,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),i.liveStreams||(this.data.resultInfo={}),null===(e=i.liveStreams)||void 0===e||e.forEach((t=>{this.data.resultInfo=t.resultInfo||{};let e=this.data.liveStreams.findIndex((e=>e.platform===t.platform));-1===e?(t.requesting="starting"===t.status,this.data.liveStreams.push(t)):(t.requesting="starting"===t.status,t=Object.assign(Object.assign({},this.data.liveStreams[e]),t),this.data.liveStreams.splice(e,1,t)),e=this.data.status.findIndex((e=>e.platform===t.platform)),-1===e?this.data.status.push({platform:t.platform||"",status:t.requesting?"stopped":t.status||""}):this.data.status.splice(e,1,{platform:this.data.status[e].platform||"",status:t.requesting?this.data.status[e].status||"stopped":t.status||""})})),this.data}}))}setStatus(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${r}/liveStream/status`,e)}))}liveStreamDescription(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${r}/liveStream/description`,e)}))}liveStreamSetting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${r}/liveStream/setting`,e)}))}}class R extends ${constructor(t){super(t,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(t=>{const{state:e,body:r,stime:i}=t;if(r)return i&&(this.data.jetlag=i),this.data.isPracticeSession="started"===r.status&&this.data.status===r.status&&0===r.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),r),"starting"===r.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=r.status||this.data.status),this.data.resultInfo=r.resultInfo||{},["full","update"].includes(e)?(r.recordUsers&&(this.data.recording.recordUsers=r.recordUsers),this.data):void 0}))}history(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.get(`${t}meetings/${e}/recording/history`)}))}status(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/status`,e)}))}layout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/status`,e)}))}designatedUsers(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/designatedUsers`,e)}))}participantAdd(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/recording/participant/add`,e)}))}participantDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/recording/participant/delete`,e)}))}getTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getTemplates`,{params:e})}))}getByIds(e){return t(this,void 0,void 0,(function*(){const{prefix:{user:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/subject/getByIds`,e)}))}recordLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/layout`,e)}))}}class L extends ${constructor(t){super(t,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(t=>{const{state:e,body:r}=t;["full","update"].includes(e)&&g(r,this.data)}))}setting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${r}/setting`,e)}))}muteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${e}/muteAll`)}))}unmuteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${e}/unmuteAll`)}))}}class H extends ${constructor(t){super(t,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(t=>{const{body:e}=t;if(!e||!e.userIDs)return;this.data.userIDs=e.userIDs;e.userIDs.findIndex((t=>t===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(E.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(E.UPDATE,{isSpotlightVideo:!1})}))}spotlight(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}/meetings/${r}/view/spotlight`,t)}}class M extends ${constructor(t){super(t,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:t,endpointType:e}=this.ctx.modules.me.data;return e===I.SUPERVISION?["interactive","broadcast"]:t===q.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const t=(t,{event:e,state:r})=>{if(t.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:i={}}=t;if("delete"!==r||"delete"===r&&[901357,901358,901352,901351,901350,901349].includes(i.bizCode||-1))return void this.ctx.emitter.emit(E.UPDATE,t);let s=!1;switch(e){case"interactiveUsers":t.isInLobby||(s=!0);break;case"broadcastUsers":t.isInLobby||t.role!==q.AUDIENCE||(s=!0);break;case"lobbyUsers":t.isInLobby&&(s=!0)}const n={};s&&(n.leave=!0),this.ctx.emitter.emit(E.UPDATE,Object.assign(Object.assign({},t),n))},e=({updateUsers:e,state:r,sourceKey:i})=>{if("full"===r)return this.data[i]=e.map((e=>(e.displayNamePinyin=M.setDisplayNamePinyinProp?M.setDisplayNamePinyinProp(e.displayName):e.displayName,t(e,{event:i,state:r}),e))),this.emitter.emit(`${i}Change`,{users:this.data[i],isFull:!0}),this.data[i];void 0===this.data[i]&&(this.data[i]=[]);const{data:s,emitter:n}=this;return e.forEach((e=>{const o=s[i].findIndex((t=>e.userID===t.userID));if("delete"===r&&-1!==o){const[t]=this.data[i].splice(o,1);n.emit(`${i}Delete`,{user:t,resultInfo:e.resultInfo})}else"update"===r&&-1!==o?(this.updateUserProps(e,this.data[i][o]),g(e,this.data[i][o]),this.emitter.emit(`${i}Update`,{user:s[i][o]})):"update"===r&&-1===o&&(e.displayNamePinyin=M.setDisplayNamePinyinProp?M.setDisplayNamePinyinProp(e.displayName):e.displayName,s[i].push(e),this.emitter.emit(`${i}Add`,{user:e,resultInfo:e.resultInfo}));t(e,{event:i,state:r})})),this.emitter.emit(`${i}Change`,{users:this.data[i],isFull:!1}),this.data[i]};this.ctx.emitter.on("interactiveUsers",(t=>{const{state:r,body:i}=t;e({updateUsers:i.users,state:r,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(t=>{const{state:r,body:i}=t;e({updateUsers:i.users,state:r,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(t=>{const{state:r,body:i}=t;e({updateUsers:i.users,state:r,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(t=>{const{state:r,body:i}=t;e({updateUsers:i.users,state:r,sourceKey:"advCtrlUsers"})}))}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(t,e){t.displayName&&t.displayName!==e.displayName&&(t.displayNamePinyin=M.setDisplayNamePinyinProp?M.setDisplayNamePinyinProp(t.displayName):t.displayName)}setAudio(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${t}/audio`,e)}setVideo(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${t}/video`,e)}setShare(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${t}/share`,e)}setWhiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${t}/whiteboard`,e)}handUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${t}/handUp`,e)}setRole(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${t}/role`,e)}rename(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${t}/displayName`,e)}remove(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}/meetings/${r}/users/${t}/remove`)}replyHandUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${t}/replyHandUp`,e)}fecc(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${t}/fecc`,e)}lobbyState(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${t}/lobbyState`,e)}allowLocalRecord(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${t}/allowLocalRecord`,e)}whiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${t}/whiteboard`,e)}callStats(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${e}/meetings/${r}/users/${t}/callStats`)}replyAllHandUp(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}/meetings/${e}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}/meetings/${e}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}/meetings/${e}/lobby/refuseAll`)}}class V extends ${constructor(t){super(t,"view")}_topic(){return["hostAttendee","audience","advCtrl"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((t=>{this.ctx.emitter.on(t,(e=>{"personalView"!==t?this.updateLayout(e,t):this.updatePersonalLayouts(e)}))}))}updateLayout(t,e){const{event:r,body:i}=t;i&&("meetingView"===r?Object.keys(i).forEach((t=>{this.data[t]=i[t]})):this.data[e]=i)}updatePersonalLayouts(t){const{state:e,body:r}=t;"full"!==e&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),r.personalLayouts.forEach((t=>{const{subscriber:r={userID:-1}}=t,i=r.userID||r.subjectID||-1;"full"===e||"update"===e||t.templateStatus?this.data.personalLayouts[i]=t:delete this.data.personalLayouts[i]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/hostLayout`,e)}))}attendeeLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/attendeeLayout`,e)}))}audienceLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/audienceLayout`,e)}))}personalLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/personalLayout`,e)}))}personalLayoutDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/personalLayout/delete`,e)}))}virtualClassLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/virtualClass/layout`,e)}))}closeVirtualClass(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/view/virtualClass/close`)}))}getVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/layout/template/info`,{params:e})}))}addVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/layout/template/add`,e)}))}editVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/layout/template/edit`,e)}))}getTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getTemplates`,{params:e})}))}editTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/edit`,e)}))}addTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/add`,e)}))}deleteTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/delete`,e)}))}getDefaultTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getDefaultTemplates`,{params:e})}))}changeDefaultTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/changeDefaultTemplate`,e)}))}perspectiveBind(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/perspective/bind`,e)}))}}class G extends ${constructor(t){super(t,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(t=>{const{body:e}=t,{voteID:r}=e;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[r]=e,this.emitter.emit("voteChange",this.data.vote)}))}getVotes(t){const{prefix:{vote:e},meetingID:r,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.get(`${e}/meetings/${r}/votes`,{params:t})}getVote(t){const{prefix:{vote:e},meetingID:r,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.get(`${e}/meetings/${r}/vote`,{params:t})}getMeVote(t){const{prefix:{vote:e},meetingID:r,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.get(`${e}/meetings/${r}/vote/me`,{params:t})}voteStatus(t,e){const{prefix:{vote:r},meetingID:i,voteTk:s}=this.ctx.config.request;return t.tk=t.tk||s,this.ctx.request.post(`${r}/meetings/${i}/vote/status?tk=${t.tk}&voteID=${t.voteID}`,e)}voteSubmit(t,e){const{prefix:{vote:r},meetingID:i,voteTk:s}=this.ctx.config.request;return t.tk=t.tk||s,this.ctx.request.post(`${r}/meetings/${i}/vote/submit?tk=${t.tk}&voteID=${t.voteID}`,e)}voteAdd(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}/personal/vote/add`,t)}voteEdit(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}/personal/vote/edit`,t)}voteDelete(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}/personal/vote/delete`,t)}voteInProgress(t){const{prefix:{vote:e},meetingID:r,voteTk:i}=this.ctx.config.request;return this.ctx.request.get(`${e}/meetings/${r}/vote/inProgress`,{params:{tk:t&&t.tk||i}})}}class B extends ${constructor(t){super(t,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(t=>{this.data.timer&&clearTimeout(this.data.timer);const{state:e,body:r}=t;if(!r)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(E.UPDATE,{barrage:this.data});"full"===e&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),this.data.barrageRecord=[{content:r.content,time:(new Date).getTime(),durationType:r.durationType,duration:1e3*r.duration},...this.data.barrageRecord],r.wordsDisplayStatus=!0,-1!==r.duration&&(this.data.timer=setTimeout((()=>{r.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=r.wordsDisplayStatus,this.ctx.emitter.emit(E.UPDATE,{barrage:this.data})}),1e3*r.duration)),g(r,this.data),this.emitter.emit("barrageRecordChange",this.data.barrageRecord),this.ctx.emitter.emit(E.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(E.ROLECHANGE,(()=>this.ctx.emitter.emit(E.UPDATE,{barrage:this.data})))}barrage(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${r}/barrage`,e)}))}deleteBarrage(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${e}/deleteBarrage`)}))}}function Y(t){const r=function(t){const{baseURL:r,modules:i,worker:s,singleton:n}=t;i.findIndex((t=>t===U))<0&&i.push(U),i.findIndex((t=>t===O))<0&&i.push(O);const o={config:{baseURL:r,modules:i,singleton:n||!1,request:{cancelToken:c.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1"},location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:s,emitter:e(),request:new a({baseURL:r,beforeRequest:t=>{t.headers["X-Y-Request-Id"]=m()},error:t=>{o.emitter.emit(b.REQUEST_ERROR,t)}}),modules:{},state:x.CLOSE,status:{polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}}};return o}(t);return r.worker&&("undefined"!=typeof Worker?r.worker.postMessage({baseURL:r.config.baseURL}):console.error("The current environment does not support worker")),function(t,e){if(!l(t))return void console.error("The modules parameter requires an array type");t.forEach((t=>{const r=new t(e);e.modules[r.moduleName]=r}))}(r.config.modules,r),r.emitter.on(b.STATE,(({state:t})=>{t===x.CLOSE&&Object.keys(r.modules).forEach((t=>{r.modules[t].cleanup()}))})),Object.assign({config:r.config,request:r.request,get state(){return r.state},on:r.emitter.on,off:r.emitter.off,join:W(r),leave:X(r),end:F(r)},r.modules)}function W(e){return function(r){var i;return t(this,void 0,void 0,(function*(){const t=`${null===(i=r.endpointType)||void 0===i?void 0:i.toLocaleUpperCase()}${m()}_${((t=new Date,e)=>{const r={"M+":t.getMonth()+1,"d+":t.getDate(),"h+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),"q+":Math.floor((t.getMonth()+3)/3),S:t.getMilliseconds()};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(t.getFullYear()+"").substr(4-RegExp.$1.length)));for(const i in r)new RegExp("("+i+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?r[i]:("00"+r[i]).substr((""+r[i]).length)));return e})(new Date,"MMddHHmmss")}_${r.meetingNum}`;e.request.setDefaultHeader("X-Y-Session-Id",t);const{prefix:s}=e.config.request,n=yield e.request.get(`${s.ctrl}/credential`,{params:{meetingNum:r.meetingNum,pwd:r.pwd,url:r.url,mobileCode:r.mobileCode,mobile:r.mobile,regEmail:r.regEmail,accEmail:r.accEmail,tk:r.tk,displayName:r.displayName},headers:{"X-Y-Endpoint-Type":r.endpointType,"X-Y-Endpoint-Id":t}}),{credential:o="",location:a=""}=n&&n.data||{};if(!o)return n;e.config.request.location=a,delete r.pwd,delete r.url;const c=yield e.request.post(`${s.ctrl}/join?meetingNum=${r.meetingNum}&credential=${o}`,r,{headers:{"X-Y-Endpoint-Type":r.endpointType,"X-Y-Endpoint-Id":t}});if(c&&c.data&&c.ret>-1){const{meetingID:r="",ctrlID:i="",user:s={},mediaContent:o={},initialMediaState:u={},tk:d=""}=c.data;if(e.config.request.sessionID=t,e.config.request.meetingID=r,e.config.request.ctrlID=i,e.config.request.userID=s.userID,e.config.request.voteTk=d,e.request.setDefaultHeader("X-Y-Location",a),e.request.setDefaultHeader("X-Y-Ctrl-Id",i),e.emitter.emit(E.INIT,Object.assign(Object.assign({},s),{mediaContent:o,initialMediaState:u})),e.state=x.JOINED,e.emitter.emit(b.STATE,{state:e.state}),"undefined"!=typeof Worker&&e.worker){const i=w(e);yield S(i,e),e.status.keepalive.running=!0,j(e),e.worker.postMessage({topics:i,meetingID:r,sessionID:t,status:!0}),e.worker.onmessage=t=>{console.log("[Polling]",t.data),e.emitter.emit(t.data.event,t.data)}}else yield _(e);c.data=Object.assign(Object.assign({},c.data),n.data)}return c}))}}function X(e){return function(r){return t(this,void 0,void 0,(function*(){r||(r={bizCode:901359});const{prefix:t,meetingID:i}=e.config.request,s=yield e.request.post(`${t.ctrl}/meetings/${i}/leave`,r);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),T(e),Q(e),J(e),s}))}}function F(e){return function(){return t(this,void 0,void 0,(function*(){const{prefix:t,meetingID:r}=e.config.request,i=yield e.request.post(`${t.ctrl}/meetings/${r}/end`);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),T(e),Q(e),J(e),i}))}}function J(t){t.state!==x.CLOSE&&(t.config.request.location="",t.config.request.meetingID="",t.config.request.ctrlID="",t.config.request.sessionID="",t.config.request.userID=-1,t.config.request.voteTk="",t.status={polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},t.request.setDefaultHeader("X-Y-Location",""),t.request.setDefaultHeader("X-Y-Ctrl-Id",""),t.request.setDefaultHeader("X-Y-Session-Id",""),t.state=x.CLOSE,t.emitter.emit(b.STATE,{state:t.state}))}class K{constructor(t){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=Y(t)}static getInstance(t){return this.instance?this.instance:this.instance=new K(t)}}function z(t){return t.singleton?K.getInstance(t).meeting:Y(t)}function Q(t){if(t.config.singleton){const{baseURL:e,modules:r,singleton:i}=t.config,s={baseURL:e,modules:r,worker:t.worker,singleton:i},n=K.getInstance(s);n&&(n.meeting=Y(s))}}Object.defineProperty(K,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null});export{C as Chat,I as ENDPOINT_TYPE,b as EVENT,O as Info,k as Invite,N as LiveStream,U as Me,E as MeEvent,D as RECORD_STATUS,q as ROLE,R as Recording,x as STATE,L as Setting,H as SpotlightVideo,M as Users,V as View,G as Vote,B as Words,z as createMeeting,Q as reset};
1
+ function e(e,t,i,s){return new(i||(i=Promise))((function(r,n){function o(e){try{c(s.next(e))}catch(t){n(t)}}function a(e){try{c(s.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))}function t(e){return{all:e=e||new Map,on:function(t,i){var s=e.get(t);s?s.push(i):e.set(t,[i])},off:function(t,i){var s=e.get(t);s&&(i?s.splice(s.indexOf(i)>>>0,1):e.set(t,[]))},emit:function(t,i){var s=e.get(t);s&&s.slice().map((function(e){e(i)})),(s=e.get("*"))&&s.slice().map((function(e){e(t,i)}))}}}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s={exports:{}};!function(e,t){var s="__lodash_hash_undefined__",r=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",h="[object Promise]",f="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",b="[object ArrayBuffer]",x="[object DataView]",q="[object Float32Array]",I="[object Float64Array]",D="[object Int8Array]",E="[object Int16Array]",$="[object Int32Array]",O="[object Uint8Array]",_="[object Uint8ClampedArray]",w="[object Uint16Array]",T="[object Uint32Array]",A=/\w*$/,S=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,U={};U[n]=U["[object Array]"]=U[b]=U[x]=U[o]=U[a]=U[q]=U[I]=U[D]=U[E]=U[$]=U[d]=U[l]=U[p]=U[f]=U[m]=U[g]=U[v]=U[O]=U[_]=U[w]=U[T]=!0,U["[object Error]"]=U[c]=U[y]=!1;var P="object"==typeof self&&self&&self.Object===Object&&self,C="object"==typeof i&&i&&i.Object===Object&&i||P||Function("return this")(),k=t&&!t.nodeType&&t,N=k&&e&&!e.nodeType&&e,R=N&&N.exports===k;function L(e,t){return e.set(t[0],t[1]),e}function H(e,t){return e.add(t),e}function M(e,t,i,s){var r=-1,n=e?e.length:0;for(s&&n&&(i=e[++r]);++r<n;)i=t(i,e[r],r,e);return i}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(i){}return t}function G(e){var t=-1,i=Array(e.size);return e.forEach((function(e,s){i[++t]=[s,e]})),i}function B(e,t){return function(i){return e(t(i))}}function Q(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i}var Y,F=Array.prototype,W=Function.prototype,X=Object.prototype,z=C["__core-js_shared__"],J=(Y=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Y:"",K=W.toString,Z=X.hasOwnProperty,ee=X.toString,te=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ie=R?C.Buffer:void 0,se=C.Symbol,re=C.Uint8Array,ne=B(Object.getPrototypeOf,Object),oe=Object.create,ae=X.propertyIsEnumerable,ce=F.splice,ue=Object.getOwnPropertySymbols,de=ie?ie.isBuffer:void 0,le=B(Object.keys,Object),pe=Ne(C,"DataView"),he=Ne(C,"Map"),fe=Ne(C,"Promise"),me=Ne(C,"Set"),ge=Ne(C,"WeakMap"),ve=Ne(Object,"create"),ye=Ve(pe),be=Ve(he),xe=Ve(fe),qe=Ve(me),Ie=Ve(ge),De=se?se.prototype:void 0,Ee=De?De.valueOf:void 0;function $e(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var s=e[t];this.set(s[0],s[1])}}function Oe(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var s=e[t];this.set(s[0],s[1])}}function _e(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var s=e[t];this.set(s[0],s[1])}}function we(e){this.__data__=new Oe(e)}function Te(e,t){var i=Be(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Qe(e)}(e)&&Z.call(e,"callee")&&(!ae.call(e,"callee")||ee.call(e)==n)}(e)?function(e,t){for(var i=-1,s=Array(e);++i<e;)s[i]=t(i);return s}(e.length,String):[],s=i.length,r=!!s;for(var o in e)!t&&!Z.call(e,o)||r&&("length"==o||He(o,s))||i.push(o);return i}function Ae(e,t,i){var s=e[t];Z.call(e,t)&&Ge(s,i)&&(void 0!==i||t in e)||(e[t]=i)}function Se(e,t){for(var i=e.length;i--;)if(Ge(e[i][0],t))return i;return-1}function je(e,t,i,s,r,h,y){var S;if(s&&(S=h?s(e,r,h,y):s(e)),void 0!==S)return S;if(!We(e))return e;var j=Be(e);if(j){if(S=function(e){var t=e.length,i=e.constructor(t);t&&"string"==typeof e[0]&&Z.call(e,"index")&&(i.index=e.index,i.input=e.input);return i}(e),!t)return function(e,t){var i=-1,s=e.length;t||(t=Array(s));for(;++i<s;)t[i]=e[i];return t}(e,S)}else{var P=Le(e),C=P==c||P==u;if(Ye(e))return function(e,t){if(t)return e.slice();var i=new e.constructor(e.length);return e.copy(i),i}(e,t);if(P==p||P==n||C&&!h){if(V(e))return h?e:{};if(S=function(e){return"function"!=typeof e.constructor||Me(e)?{}:(t=ne(e),We(t)?oe(t):{});var t}(C?{}:e),!t)return function(e,t){return Ce(e,Re(e),t)}(e,function(e,t){return e&&Ce(t,Xe(t),e)}(S,e))}else{if(!U[P])return h?e:{};S=function(e,t,i,s){var r=e.constructor;switch(t){case b:return Pe(e);case o:case a:return new r(+e);case x:return function(e,t){var i=t?Pe(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}(e,s);case q:case I:case D:case E:case $:case O:case _:case w:case T:return function(e,t){var i=t?Pe(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}(e,s);case d:return function(e,t,i){return M(t?i(G(e),!0):G(e),L,new e.constructor)}(e,s,i);case l:case g:return new r(e);case f:return function(e){var t=new e.constructor(e.source,A.exec(e));return t.lastIndex=e.lastIndex,t}(e);case m:return function(e,t,i){return M(t?i(Q(e),!0):Q(e),H,new e.constructor)}(e,s,i);case v:return n=e,Ee?Object(Ee.call(n)):{}}var n}(e,P,je,t)}}y||(y=new we);var k=y.get(e);if(k)return k;if(y.set(e,S),!j)var N=i?function(e){return function(e,t,i){var s=t(e);return Be(e)?s:function(e,t){for(var i=-1,s=t.length,r=e.length;++i<s;)e[r+i]=t[i];return e}(s,i(e))}(e,Xe,Re)}(e):Xe(e);return function(e,t){for(var i=-1,s=e?e.length:0;++i<s&&!1!==t(e[i],i,e););}(N||e,(function(r,n){N&&(r=e[n=r]),Ae(S,n,je(r,t,i,s,n,e,y))})),S}function Ue(e){return!(!We(e)||(t=e,J&&J in t))&&(Fe(e)||V(e)?te:S).test(Ve(e));var t}function Pe(e){var t=new e.constructor(e.byteLength);return new re(t).set(new re(e)),t}function Ce(e,t,i,s){i||(i={});for(var r=-1,n=t.length;++r<n;){var o=t[r],a=s?s(i[o],e[o],o,i,e):void 0;Ae(i,o,void 0===a?e[o]:a)}return i}function ke(e,t){var i,s,r=e.__data__;return("string"==(s=typeof(i=t))||"number"==s||"symbol"==s||"boolean"==s?"__proto__"!==i:null===i)?r["string"==typeof t?"string":"hash"]:r.map}function Ne(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return Ue(i)?i:void 0}$e.prototype.clear=function(){this.__data__=ve?ve(null):{}},$e.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},$e.prototype.get=function(e){var t=this.__data__;if(ve){var i=t[e];return i===s?void 0:i}return Z.call(t,e)?t[e]:void 0},$e.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Z.call(t,e)},$e.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?s:t,this},Oe.prototype.clear=function(){this.__data__=[]},Oe.prototype.delete=function(e){var t=this.__data__,i=Se(t,e);return!(i<0)&&(i==t.length-1?t.pop():ce.call(t,i,1),!0)},Oe.prototype.get=function(e){var t=this.__data__,i=Se(t,e);return i<0?void 0:t[i][1]},Oe.prototype.has=function(e){return Se(this.__data__,e)>-1},Oe.prototype.set=function(e,t){var i=this.__data__,s=Se(i,e);return s<0?i.push([e,t]):i[s][1]=t,this},_e.prototype.clear=function(){this.__data__={hash:new $e,map:new(he||Oe),string:new $e}},_e.prototype.delete=function(e){return ke(this,e).delete(e)},_e.prototype.get=function(e){return ke(this,e).get(e)},_e.prototype.has=function(e){return ke(this,e).has(e)},_e.prototype.set=function(e,t){return ke(this,e).set(e,t),this},we.prototype.clear=function(){this.__data__=new Oe},we.prototype.delete=function(e){return this.__data__.delete(e)},we.prototype.get=function(e){return this.__data__.get(e)},we.prototype.has=function(e){return this.__data__.has(e)},we.prototype.set=function(e,t){var i=this.__data__;if(i instanceof Oe){var s=i.__data__;if(!he||s.length<199)return s.push([e,t]),this;i=this.__data__=new _e(s)}return i.set(e,t),this};var Re=ue?B(ue,Object):function(){return[]},Le=function(e){return ee.call(e)};function He(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||j.test(e))&&e>-1&&e%1==0&&e<t}function Me(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||X)}function Ve(e){if(null!=e){try{return K.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Ge(e,t){return e===t||e!=e&&t!=t}(pe&&Le(new pe(new ArrayBuffer(1)))!=x||he&&Le(new he)!=d||fe&&Le(fe.resolve())!=h||me&&Le(new me)!=m||ge&&Le(new ge)!=y)&&(Le=function(e){var t=ee.call(e),i=t==p?e.constructor:void 0,s=i?Ve(i):void 0;if(s)switch(s){case ye:return x;case be:return d;case xe:return h;case qe:return m;case Ie:return y}return t});var Be=Array.isArray;function Qe(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!Fe(e)}var Ye=de||function(){return!1};function Fe(e){var t=We(e)?ee.call(e):"";return t==c||t==u}function We(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Xe(e){return Qe(e)?Te(e):function(e){if(!Me(e))return le(e);var t=[];for(var i in Object(e))Z.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e)}e.exports=function(e){return je(e,!0,!0)}}(s,s.exports);var r=s.exports;const n=e=>({get(t,i,s){if("__isProxy"===i)return!0;const r=Reflect.get(t,i);return Array.isArray(r)?r:"object"==typeof r&&null!==r?r.__isProxy?r:new Proxy(r,n(e)):r},set(t,i,s,n){const o=t[i];s=h(s)&&s.__isProxy?r(s):s;const a=Reflect.set(t,i,s,n);return((e,t)=>e!==t&&(e==e||t==t))(s,o)&&e.emit(`${y(i)}Change`,s),a}}),o=e=>encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class a{constructor(e){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=e.baseURL,this._beforeRequest=e.beforeRequest,this._errorHandler=e.error}_request(e){const{url:t="",timeout:i=6e4}=e;let{headers:s={}}=e;return e.url=this.baseURL.replace(/\/+$/,"")+"/"+((e,t)=>{if(!t)return e;const i=[];Object.keys(t).forEach((e=>{const s=t[e];if(null==s)return;let r;Array.isArray(s)?(r=s,e+="[]"):r=[s],r.forEach((t=>{null!==t&&"object"==typeof t&&(t=JSON.stringify(t)),i.push(`${o(e)}=${o(t)}`)}))}));const s=i.join("&");if(s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e})(t.replace(/^\/+/,""),e.params),s=Object.assign(s,this._defaultHeaders),Object.keys(s).forEach((e=>{"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(s["Content-Type"]=s[e],delete s[e])})),f(e.data)&&(s&&!s["Content-Type"]&&(s["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=s,e.timeout=i,this._beforeRequest&&this._beforeRequest(e),"undefined"!=typeof wx?d(e):u(e)}setDefaultHeader(e,t){e in this._defaultHeaders&&(""===t||null===t)?delete this._defaultHeaders[e]:this._defaultHeaders[e]=t}get(e,t){return this._errorHandler?this._request(Object.assign(t||{},{url:e,method:"GET"})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(t||{},{url:e,method:"GET"}))}post(e,t,i){return this._errorHandler?this._request(Object.assign(i||{},{url:e,method:"POST",data:t})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(i||{},{url:e,method:"POST",data:t}))}}class c{constructor(e){let t;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=e,t(this.reason))}))}static source(){let e;const t=new c((t=>{e=t}));return{cancel:e,token:t}}}const u=e=>new Promise(((t,i)=>{const{data:s=null,url:r,method:n="GET",headers:o,cancelToken:a,withResDate:c}=e;let u=new XMLHttpRequest;u.open(n.toUpperCase(),r,!0),u.timeout=e.timeout;const d=()=>{if(u){if(u.status>=200&&u.status<300)try{const e=JSON.parse(u.responseText);c&&(e.responseDate=new Date(u.getResponseHeader("Date")).getTime()),t(e)}catch(e){i(new Error("E_JSON_PARSE"+u.responseText))}else i({url:r,statusCode:u.status});u=null}};"onloadend"in u?u.onloadend=d:u.onreadystatechange=()=>{u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=()=>{u&&(i({url:r,statusCode:u.status,type:"request abort"}),u=null)},u.onerror=()=>{i(new Error("Network Error")),u=null},u.ontimeout=()=>{i(new Error("timeout of "+e.timeout+"ms exceeded")),u=null},"setRequestHeader"in u&&Object.keys(o).forEach((e=>{null===s&&"content-type"===e.toLowerCase()?delete o[e]:u.setRequestHeader(e,o[e])})),a&&a.promise.then((e=>{u&&(u.abort(),i(e),u=null)})),u.send(s)})),d=e=>new Promise(((t,i)=>{const{data:s=null,url:r,method:n="GET",headers:o,cancelToken:a}=e,c=wx.request({url:r,data:s,method:n.toUpperCase(),timeout:e.timeout,header:o,success(e){e.statusCode>=200&&e.statusCode<300?t(e.data):i({url:r,statusCode:e.statusCode})},fail(e){i("request:fail abort"===e.errMsg&&a&&a.reason||e)}});a&&a.promise.then((()=>{c&&c.abort()}))})),l=Array.isArray,p=e=>null==e,h=e=>"object"==typeof e&&null!==e,f=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},m=()=>{const e=[],t="0123456789abcdef";for(let i=0;i<36;i++)e[i]=t.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";return e.join("").split("-").join("")},g=(e,t)=>e?(Object.entries(e).forEach((e=>{const[i,s]=[e[0],e[1]];if(null!==s)return h(s)&&!l(s)?(t[i]||(t[i]={}),void(t[i]=g(s,t[i]))):void(t[i]=s)})),t):t,v=/-(\w)/g,y=e=>e.replace(v,((e,t)=>t?t.toUpperCase():"")),{hasOwnProperty:b}=Object.prototype,x=(e,t)=>b.call(e,t),q=(e,t=new Map)=>{if(t.get(e))return t.get(e);if(!(e instanceof Object))return e;let i;i=e instanceof Array?[]:e instanceof Function?()=>e():e instanceof RegExp?new RegExp(e.source,e.flags):e instanceof Date?new Date(e):{},t.set(e,i);for(const s in e)x(e,s)&&(i[s]=q(e[s],t));return i};var I,D,E,$,O,_;!function(e){e.REQUEST_ERROR="requestError",e.STATE="state",e.FAILED="failed"}(I||(I={})),function(e){e[e.CLOSE=0]="CLOSE",e[e.JOINED=1]="JOINED",e[e.READY=2]="READY"}(D||(D={})),function(e){e.WEBAPP="webApp",e.WEBCTRL="webCtrl",e.WECHATMP="weChatMP",e.SUPERVISION="supervision",e.BIGSCREEN="bigScreen",e.DESKTOP="desktop",e.MOBILE="mobile",e.VCS="vcs",e.SIP="sip",e.H323="h323",e.PSTN="pstn"}(E||(E={})),function(e){e.HOST="host",e.COHOST="coHost",e.ATTENDEE="attendee",e.AUDIENCE="audience"}($||($={})),function(e){e.STARTED="started",e.PAUSED="paused",e.STARTING="starting",e.STOPPED="stopped"}(O||(O={}));class w{constructor(e,i){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"on",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"off",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=i,this.ctx=e,this.emitter=t(),this.on=this.emitter.on,this.off=this.emitter.off,this.data=new Proxy({},n(this.emitter)),this._bindOn()}cleanup(){this.emitter.all=new Map,this.data=new Proxy({},n(this.emitter))}reactive(e){if(h(e)){const t=new Map,i=(e,s)=>{Object.keys(e).forEach((r=>{!1===s&&r in this.data&&(e[r]=this.data[r]);const n=t=>e[r]=t,o=`${y(r)}Change`;this.emitter.on(o,n),t.set(o,n),h(e[r])&&!l(e[r])&&i(e[r],!0)}))};i(e,!1),e._destory=()=>{t.forEach(((e,t)=>{this.emitter.off(t,e)}))}}else console.warn("Parameter is not an object!");return e}}class T extends w{constructor(e){super(e,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(e=>{const{state:t,body:i}=e;("full"===t||"update"===t)&&g(i,this.data)})),this.ctx.emitter.on("participantCount",(e=>{const{body:t}=e;g({participantCount:t},this.data)}))}subject(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/info/subject`,t)}))}practiceSession(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/info/practiceSession`)}))}shareInfo(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/shareInfo`,{params:e})}meetings(e){if(!e)return Promise.reject();const{prefix:{ctrl:t}}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings`,{params:e})}}function A(e){const t=[],{isInLobby:i}=e.modules.me.data;return i?(t.push("lobbyMember"),t):(Object.keys(e.modules).forEach((i=>{const s=e.modules[i]._topic();s&&(Array.isArray(s)?s.forEach((e=>{t.includes(e)||t.push(e)})):t.includes(s)||t.push(s))})),t)}function S(t,i){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s}=i.config.request,r=yield i.request.post(`${e}meetings/${s}/subscribe`,{topics:t}),n=r&&r.data&&r.data.eventMsgs;n&&n.forEach((e=>{console.log("[subscribe]",e),i.emitter.emit(e.event,e)})),i.state!==D.READY&&(i.state=D.READY,i.emitter.emit(I.STATE,{state:i.state}))}))}function j(t,i,s){return e(this,void 0,void 0,(function*(){const{inboxes:r,clientID:n,meetingID:o,cancelToken:a,status:c}=i;yield(()=>e(this,void 0,void 0,(function*(){const e=yield t.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:r},{cancelToken:a,withResDate:!0});if(!e||!e.data)return;const{data:i={}}=e;Object.keys(i).forEach((e=>{const t=r.find((t=>t.name===e));if(t){if(t.seqId=i[e].maxSeqId,!i[e].items)return;i[e].items.forEach((e=>{const t=JSON.parse(e.content);["liveStream","recording"].includes(t.event)&&(t.stime=e.stime),s(t)}))}}))})))(),c.running&&(c.timer=setTimeout((()=>{c.running&&j(t,i,s)}),200))}))}function U(t){return e(this,void 0,void 0,(function*(){const i=A(t),{clientID:s,meetingID:r}=t.config.request,n=yield function(t,i){return e(this,void 0,void 0,(function*(){const{topics:e,clientID:s,meetingID:r}=i,n=yield t.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:s,meetingId:r},inboxes:e}),o=[];return n.data&&Object.keys(n.data).forEach((e=>{o.push({name:e,seqId:n.data[e].maxSeqId,limit:200})})),o}))}(t.request,{topics:i,clientID:s,meetingID:r});yield S(i,t),t.status.polling.running=!0,t.status.keepalive.running=!0,j(t.request,{inboxes:n,clientID:s,meetingID:r,cancelToken:t.config.request.cancelToken.token,status:t.status.polling},(e=>{t.emitter.emit(e.event,e)})),C(t)}))}function P(e){e.status.polling.running=!1,e.status.keepalive.running=!1,e.status.polling.timer&&(clearTimeout(e.status.polling.timer),e.status.polling.timer=null),e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null),e.config.request.cancelToken.cancel(),e.config.request.cancelToken=c.source()}function C(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:i},meetingID:s,userID:r}=t.config.request;t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null),yield(()=>e(this,void 0,void 0,(function*(){const e=yield t.request.post(`${i}meetings/${s}/users/${r}/keepalive`,{},{cancelToken:t.config.request.cancelToken.token});if(!e||!e.data)return;const{data:n={}}=e,o=n.interval||"";o&&(t.status.keepalive.interval=o)})))(),t.status.keepalive.running&&(t.status.keepalive.timer=setTimeout((()=>{t.status.keepalive.running&&C(t)}),1e3*t.status.keepalive.interval))}))}!function(e){e.INIT="meInit",e.UPDATE="meUpdate",e.UPDATE_USER_STATE="updateUserState",e.ROLECHANGE="meRoleChange",e.AUDIOCHANGE="meAudioChange",e.HANDUPCHANGE="meHandupChange",e.SETAUDIO="setAudio",e.VIDEOCHANGE="meVideoChange",e.SETVIDEO="setVideo",e.SHARECHANGE="meShareChange",e.DISPLAYNAMECHANGE="meDisplayNameChange",e.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",e.LOBBYCHANGE="meLobbyChange",e.BARRAGECHANGE="meBarrageChange",e.LEAVE="leave"}(_||(_={}));class k extends w{constructor(e){super(e,"me")}_topic(){return""}_bindOn(){const t=t=>e(this,void 0,void 0,(function*(){"role"in t&&t.role!==this.data.role&&(t.role!==$.AUDIENCE&&this.data.role!==$.AUDIENCE||(yield N(this.ctx),this.data.isUpdatedUserState=!1,this.emitter.emit(_.UPDATE_USER_STATE,{data:this.data,event:"roleChange"})),g({role:t.role},this.data),this.emitter.emit(_.ROLECHANGE,t.role),this.ctx.emitter.emit(_.ROLECHANGE,t.role))})),i=e=>{var t,i,s,r;if("audio"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.audio;(!p(n)&&n!==(null===(t=this.data.audio)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(i=this.data.audio)||void 0===i?void 0:i.sendOn))&&(g({audio:e.audio},this.data),this.emitter.emit(_.AUDIOCHANGE,{deviceOn:p(n)?null===(s=this.data.audio)||void 0===s?void 0:s.deviceOn:n,sendOn:p(o)?null===(r=this.data.audio)||void 0===r?void 0:r.sendOn:o,opBy:a}))}},s=e=>{var t,i,s,r;if("video"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.video;(!p(n)&&n!==(null===(t=this.data.video)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(i=this.data.video)||void 0===i?void 0:i.sendOn))&&(g({video:e.video},this.data),this.emitter.emit(_.VIDEOCHANGE,{deviceOn:p(n)?null===(s=this.data.video)||void 0===s?void 0:s.deviceOn:n,sendOn:p(o)?null===(r=this.data.video)||void 0===r?void 0:r.sendOn:o,opBy:a}))}},r=e=>{var t,i,s,r;if("share"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.share;(!p(n)&&n!==(null===(t=this.data.share)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(i=this.data.share)||void 0===i?void 0:i.sendOn))&&(g({share:e.share},this.data),this.emitter.emit(_.SHARECHANGE,{deviceOn:p(n)?null===(s=this.data.share)||void 0===s?void 0:s.deviceOn:n,sendOn:p(o)?null===(r=this.data.share)||void 0===r?void 0:r.sendOn:o,opBy:a}))}},n=e=>{e.displayName&&e.displayName!==this.data.displayName&&(g({displayName:e.displayName},this.data),this.emitter.emit(_.DISPLAYNAMECHANGE,e.displayName))},o=e=>{"isHandUp"in e&&e.isHandUp!==this.data.isHandUp&&(g({isHandUp:e.isHandUp},this.data),this.emitter.emit(_.HANDUPCHANGE,e.isHandUp))},a=e=>{"isSpotlightVideo"in e&&(g({isSpotlightVideo:e.isSpotlightVideo},this.data),this.emitter.emit(_.SPOTLIGHTVIDEOCHANGE,e.isSpotlightVideo))},c=t=>e(this,void 0,void 0,(function*(){"isInLobby"in t&&t.isInLobby!==this.data.isInLobby&&(g({isInLobby:t.isInLobby},this.data),yield N(this.ctx),!1===t.isInLobby&&(this.data.isUpdatedUserState=!1,this.emitter.emit(_.UPDATE_USER_STATE,{data:this.data,event:"inLobbyChange"})),this.emitter.emit(_.LOBBYCHANGE,t.isInLobby))})),u=e=>{if(!e.barrage)return;let t=null;if(!e.barrage.wordsDisplayStatus)return t=null,delete e.barrage,this.data.barrage=t||void 0,void this.emitter.emit(_.BARRAGECHANGE,t);t={content:e.barrage.content,contentType:e.barrage.contentType,type:e.barrage.type,duration:e.barrage.duration,position:e.barrage.position};const{role:i}=this.data;e.barrage.receiver&&(i===$.HOST||i===$.COHOST?t=e.barrage.receiver.host?t:null:i===$.ATTENDEE?t=e.barrage.receiver.attendee?t:null:i===$.AUDIENCE&&(t=e.barrage.receiver.audience?t:null),delete e.barrage,this.data.barrage=t||void 0,this.emitter.emit(_.BARRAGECHANGE,t))},d=e=>{"leave"in e&&!0===e.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),P(this.ctx),ie(this.ctx),this.emitter.emit(_.LEAVE,e.resultInfo),this.ctx.cleanup(e.resultInfo))},l=e=>{t(e),i(e),s(e),r(e),n(e),o(e),c(e),a(e),u(e),d(e)};this.ctx.emitter.on(_.INIT,(e=>{g(e,this.data),this.data.isUpdatedUserState=!1,this.emitter.emit(_.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on(_.UPDATE,(e=>{l(e),g(e,this.data)})),this.ctx.emitter.on("me",(t=>e(this,void 0,void 0,(function*(){const{state:e,body:i={users:[]}}=t;if("delete"===e){const e=i.users[0];return e.leave=!0,void d(e)}const s=i.users.find((e=>e.userID===this.data.userID));s&&(l(s),g(s,this.data))})))),this.ctx.emitter.on("setUserVideo",(e=>{this.emitter.emit(_.SETVIDEO,e.body)})),this.ctx.emitter.on("setUserAudio",(e=>{this.emitter.emit(_.SETAUDIO,e.body)})),this.ctx.emitter.on("meetingState",(e=>{const{body:t={}}=e;if("ended"===t.state){d({leave:!0,resultInfo:t.resultInfo})}}))}updateUserState(e,t=!1){if(!t){const{role:t,initialMediaState:i}=this.data;e.audio.sendOn=e.audio.sendOn&&i.audio.sendOn,e.video.sendOn=e.video.sendOn&&i.video.sendOn,t===$.AUDIENCE&&(e.audio.sendOn=!1,e.video.sendOn=!1)}const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,g(e,this.data),this.ctx.request.post(`${i}meetings/${s}/updateUserState`,e)}}function N(t){return e(this,void 0,void 0,(function*(){const e=A(t),{meetingID:i,clientID:s}=t.config.request;"undefined"!=typeof Worker&&t.worker?(yield S(e,t),t.worker.postMessage({topics:e,meetingID:i,clientID:s,rePolling:!0})):(P(t),yield U(t))}))}class R extends w{constructor(e){super(e,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(e=>{const{body:t}=e;this.emitter.emit("chatMsg",t)}))}msg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${i}/chat/msg`,t)}))}historyMsg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${i}/chat/historyMsg`,t)}))}}class L extends w{constructor(e){super(e,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(e=>{const{body:t,state:i}=e;if(t&&t.users){if("full"===i)return this.data.callRecordUsers=t.users.map((e=>(e.displayNamePinyin=L.setDisplayNamePinyinProp?L.setDisplayNamePinyinProp(e.displayName||""):e.displayName,e))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);t.users.forEach((e=>{const t=this.data.callRecordUsers.findIndex((t=>e.inviteTransID===t.inviteTransID));"update"===i&&-1!==t?g(e,this.data.callRecordUsers[t]):"update"===i&&-1===t&&(e.displayNamePinyin=L.setDisplayNamePinyinProp?L.setDisplayNamePinyinProp(e.displayName||""):e.displayName,this.data.callRecordUsers.push(e))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/invite`,e)}mailTemplate(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}mailTemplate`,{params:{meetingID:i},headers:{language:e.language}})}}class H extends w{constructor(e){super(e,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(e=>{var t;const{state:i,body:s,stime:r}=e;if(s){if(r&&(this.data.jetlag=r),"full"===i){const{liveStreams:e=[]}=s;if(!e.length)return;this.data.status=[],this.data.liveStreams=e.map((e=>(e.requesting="starting"===e.status,this.data.status.push({platform:e.platform||"",status:(e.requesting?"stopped":e.status)||""}),e)));return g({status:this.data.status,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),s.liveStreams||(this.data.resultInfo={}),null===(t=s.liveStreams)||void 0===t||t.forEach((e=>{this.data.resultInfo=e.resultInfo||{};let t=this.data.liveStreams.findIndex((t=>t.platform===e.platform));-1===t?(e.requesting="starting"===e.status,this.data.liveStreams.push(e)):(e.requesting="starting"===e.status,e=Object.assign(Object.assign({},this.data.liveStreams[t]),e),this.data.liveStreams.splice(t,1,e)),t=this.data.status.findIndex((t=>t.platform===e.platform)),-1===t?this.data.status.push({platform:e.platform||"",status:e.requesting?"stopped":e.status||""}):this.data.status.splice(t,1,{platform:this.data.status[t].platform||"",status:e.requesting?this.data.status[t].status||"stopped":e.status||""})})),this.data}}))}setStatus(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/liveStream/status`,t)}))}liveStreamDescription(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/liveStream/description`,t)}))}liveStreamSetting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/liveStream/setting`,t)}))}}class M extends w{constructor(e){super(e,"qa"),this.data={questions:new Map,topSort:0}}_topic(){return"qa"}_bindOn(){this.ctx.emitter.on("qa",(e=>{const{body:t}=e;h(t)&&!l(t)?this.qaUpdate(this.data.questions,t):t.forEach((e=>this.qaUpdate(this.data.questions,e)))}))}qaUpdate(e,t){let i=e.get(t.question.id);const{clientID:s}=this.ctx.config.request;switch(t.command){case"addQuestion":i=this.createQuestion(t.question),e.set(t.question.id,i),this.emitter.emit("QuestionAdd",{question:i,selfSent:i.sender.endpointID===s});break;case"dismissQuestion":if(!i)break;i.sender.endpointID!==s?i.status="close":i.isTop=!1,this.emitter.emit("QuestionUpdate",{question:i}),e.set(t.question.id,i);break;case"reopenQuestion":i?(i.status="open",i.isTop=t.question.isTop,e.set(t.question.id,i)):(i=this.createQuestion(t.question),e.set(t.question.id,i)),this.emitter.emit("QuestionUpdate",{question:i});break;case"updateQuestion":i?e.set(t.question.id,Object.assign(Object.assign(Object.assign({},i),t.question),{topSort:t.question.isTop?this.data.topSort++:0})):(i=this.createQuestion(t.question),e.set(t.question.id,i)),this.emitter.emit("QuestionUpdate",{question:i});break;case"deleteQuestion":if(!i)break;i.sender.endpointID!==s?e.delete(t.question.id):(i.status="delete",i.isTop=!1,i.answers.clear(),e.set(t.question.id,i)),this.emitter.emit("QuestionDelete",{question:i});break;case"answerQuestion":i?i.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)):(i=this.createQuestion(t.question),i.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)),e.set(t.question.id,i)),this.emitter.emit("QuestionDelete",{question:i});break;case"deleteAnswer":i&&(i.answers.delete(t.answer.id),this.emitter.emit("QuestionDelete",{question:i}))}this.emitter.emit("QuestionChange",{questions:this.data.questions})}createQuestion(e){return{isAnonymous:e.isAnonymous,isTop:e.isTop,id:e.id,content:e.content,sender:e.sender,timestamp:e.timestamp||-1,status:e.status||"open",answers:new Map,topSort:0}}createQuestionAnswer(e){return{isPrivate:e.isPrivate,content:e.content,id:e.id,sender:e.sender,timestamp:e.timestamp||-1}}qa(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${i}/qa`,t)}))}}class V extends w{constructor(e){super(e,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(e=>{const{state:t,body:i,stime:s}=e;if(i)return s&&(this.data.jetlag=s),this.data.isPracticeSession="started"===i.status&&this.data.status===i.status&&0===i.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),i),"starting"===i.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=i.status||this.data.status),this.data.resultInfo=i.resultInfo||{},["full","update"].includes(t)?(i.recordUsers&&(this.data.recording.recordUsers=i.recordUsers),this.data):void 0}))}history(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.get(`${e}meetings/${t}/recording/history`)}))}status(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/recording/status`,t)}))}layout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/recording/status`,t)}))}designatedUsers(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/recording/designatedUsers`,t)}))}participantAdd(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/recording/participant/add`,t)}))}participantDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/recording/participant/delete`,t)}))}getTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getTemplates`,{params:t})}))}getByIds(t){return e(this,void 0,void 0,(function*(){const{prefix:{user:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/subject/getByIds`,t)}))}recordLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/recording/layout`,t)}))}}class G extends w{constructor(e){super(e,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(e=>{const{state:t,body:i}=e;["full","update"].includes(t)&&g(i,this.data)}))}setting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/setting`,t)}))}muteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/muteAll`)}))}unmuteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/unmuteAll`)}))}}class B extends w{constructor(e){super(e,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(e=>{const{body:t}=e;if(!t||!t.userIDs)return;this.data.userIDs=t.userIDs;t.userIDs.findIndex((e=>e===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(_.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(_.UPDATE,{isSpotlightVideo:!1})}))}spotlight(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/view/spotlight`,e)}}class Q extends w{constructor(e){super(e,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:e,endpointType:t}=this.ctx.modules.me.data;return t===E.SUPERVISION?["interactive","broadcast"]:e===$.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const e=(e,{event:t,state:i})=>{if(e.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:s={}}=e;if("delete"!==i||"delete"===i&&[901357,901358,901352,901351,901350,901349].includes(s.bizCode||-1))return void this.ctx.emitter.emit(_.UPDATE,e);let r=!1;switch(t){case"interactiveUsers":e.isInLobby||(r=!0);break;case"broadcastUsers":e.isInLobby||e.role!==$.AUDIENCE||(r=!0);break;case"lobbyUsers":e.isInLobby&&(r=!0)}const n={};r&&(n.leave=!0),this.ctx.emitter.emit(_.UPDATE,Object.assign(Object.assign({},e),n))},t=({updateUsers:t,state:i,sourceKey:s})=>{if("full"===i)return this.data[s]=t.map((t=>(t.displayNamePinyin=Q.setDisplayNamePinyinProp?Q.setDisplayNamePinyinProp(t.displayName):t.displayName,e(t,{event:s,state:i}),t))),this.emitter.emit(`${s}Change`,{users:this.data[s],isFull:!0}),this.data[s];void 0===this.data[s]&&(this.data[s]=[]);const{data:r,emitter:n}=this;return t.forEach((t=>{const o=r[s].findIndex((e=>t.userID===e.userID));if("delete"===i&&-1!==o){const[e]=this.data[s].splice(o,1);n.emit(`${s}Delete`,{user:e,resultInfo:t.resultInfo})}else if("update"===i&&-1!==o){const e=this.data[s][o];this.updateUserProps(t,e),g(t,e),this.data[s][o]=q(e),this.emitter.emit(`${s}Update`,{user:this.data[s][o]})}else"update"===i&&-1===o&&(t.displayNamePinyin=Q.setDisplayNamePinyinProp?Q.setDisplayNamePinyinProp(t.displayName):t.displayName,r[s].push(t),this.emitter.emit(`${s}Add`,{user:t,resultInfo:t.resultInfo}));e(t,{event:s,state:i})})),this.emitter.emit(`${s}Change`,{users:this.data[s],isFull:!1}),this.data[s]};this.ctx.emitter.on("interactiveUsers",(e=>{const{state:i,body:s}=e;t({updateUsers:s.users,state:i,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(e=>{const{state:i,body:s}=e;t({updateUsers:s.users,state:i,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(e=>{const{state:i,body:s}=e;t({updateUsers:s.users,state:i,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(e=>{const{state:i,body:s}=e;t({updateUsers:s.users,state:i,sourceKey:"advCtrlUsers"})}))}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(e,t){e.displayName&&e.displayName!==t.displayName&&(e.displayNamePinyin=Q.setDisplayNamePinyinProp?Q.setDisplayNamePinyinProp(e.displayName):e.displayName)}setAudio(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/audio`,t)}setVideo(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/video`,t)}setShare(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/share`,t)}setWhiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}users/${e}/whiteboard`,t)}handUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/handUp`,t)}setRole(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/role`,t)}rename(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/displayName`,t)}remove(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/users/${e}/remove`)}replyHandUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}users/${e}/replyHandUp`,t)}fecc(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/fecc`,t)}lobbyState(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/lobbyState`,t)}allowLocalRecord(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/allowLocalRecord`,t)}whiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/whiteboard`,t)}callStats(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/users/${e}/callStats`)}replyAllHandUp(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/refuseAll`)}}class Y extends w{constructor(e){super(e,"view")}_topic(){return["hostAttendee","audience","advCtrl"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((e=>{this.ctx.emitter.on(e,(t=>{"personalView"!==e?this.updateLayout(t,e):this.updatePersonalLayouts(t)}))}))}updateLayout(e,t){const{event:i,body:s}=e;s&&("meetingView"===i?Object.keys(s).forEach((e=>{this.data[e]=s[e]})):this.data[t]=s)}updatePersonalLayouts(e){const{state:t,body:i}=e;"full"!==t&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),i.personalLayouts.forEach((e=>{const{subscriber:i={userID:-1}}=e,s=i.userID||i.subjectID||-1;"full"===t||"update"===t||e.templateStatus?this.data.personalLayouts[s]=e:delete this.data.personalLayouts[s]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/view/hostLayout`,t)}))}attendeeLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/view/attendeeLayout`,t)}))}audienceLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/view/audienceLayout`,t)}))}personalLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/view/personalLayout`,t)}))}personalLayoutDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/view/personalLayout/delete`,t)}))}virtualClassLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/view/virtualClass/layout`,t)}))}closeVirtualClass(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/view/virtualClass/close`)}))}getVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/layout/template/info`,{params:t})}))}addVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/layout/template/add`,t)}))}editVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/layout/template/edit`,t)}))}getTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getTemplates`,{params:t})}))}editTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/edit`,t)}))}addTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/add`,t)}))}deleteTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/delete`,t)}))}getDefaultTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getDefaultTemplates`,{params:t})}))}changeDefaultTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/changeDefaultTemplate`,t)}))}perspectiveBind(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/perspective/bind`,t)}))}}class F extends w{constructor(e){super(e,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(e=>{const{body:t}=e,{voteID:i}=t;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[i]=t,this.emitter.emit("voteChange",this.data.vote)}))}getVotes(e){const{prefix:{vote:t},meetingID:i,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}meetings/${i}/votes`,{params:e})}getVote(e){const{prefix:{vote:t},meetingID:i,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}meetings/${i}/vote`,{params:e})}getMeVote(e){const{prefix:{vote:t},meetingID:i,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}meetings/${i}/vote/me`,{params:e})}voteStatus(e,t){const{prefix:{vote:i},meetingID:s,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.post(`${i}meetings/${s}/vote/status?tk=${e.tk}&voteID=${e.voteID}`,t)}voteSubmit(e,t){const{prefix:{vote:i},meetingID:s,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.post(`${i}meetings/${s}/vote/submit?tk=${e.tk}&voteID=${e.voteID}`,t)}voteAdd(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/add`,e)}voteEdit(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/edit`,e)}voteDelete(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/delete`,e)}voteInProgress(e){const{prefix:{vote:t},meetingID:i,voteTk:s}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/vote/inProgress`,{params:{tk:e&&e.tk||s}})}}class W extends w{constructor(e){super(e,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(e=>{this.data.timer&&clearTimeout(this.data.timer);const{state:t,body:i}=e;if(!i)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(_.UPDATE,{barrage:this.data});"full"===t&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),this.data.barrageRecord=[{content:i.content,time:(new Date).getTime(),durationType:i.durationType,duration:1e3*i.duration},...this.data.barrageRecord],i.wordsDisplayStatus=!0,-1!==i.duration&&(this.data.timer=setTimeout((()=>{i.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=i.wordsDisplayStatus,this.ctx.emitter.emit(_.UPDATE,{barrage:this.data})}),1e3*i.duration)),g(i,this.data),this.emitter.emit("barrageRecordChange",this.data.barrageRecord),this.ctx.emitter.emit(_.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(_.ROLECHANGE,(()=>this.ctx.emitter.emit(_.UPDATE,{barrage:this.data})))}barrage(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${i}/barrage`,t)}))}deleteBarrage(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/deleteBarrage`)}))}}function X(e){const{baseURL:i,modules:s,worker:r,singleton:n}=e;s.findIndex((e=>e===k))<0&&s.push(k),s.findIndex((e=>e===T))<0&&s.push(T);const o=`${m()}_${((e=new Date,t)=>{const i={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));for(const s in i)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[s]:("00"+i[s]).substr((""+i[s]).length)));return t})(new Date,"MMddHHmmss")}`,u={config:{baseURL:i,modules:s,singleton:n||!1,request:{cancelToken:c.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1"},clientID:o,location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:r,emitter:t(),request:new a({baseURL:i,beforeRequest:e=>{e.headers["X-Y-Request-Id"]=m()},error:e=>{u.emitter.emit(I.REQUEST_ERROR,e)}}),modules:{},state:D.CLOSE,status:{polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},cleanup:e=>{u.state!==D.CLOSE&&(u.config.request.location="",u.config.request.meetingID="",u.config.request.ctrlID="",u.config.request.sessionID="",u.config.request.userID=-1,u.config.request.voteTk="",u.status={polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},u.request.setDefaultHeader("X-Y-Location",""),u.request.setDefaultHeader("X-Y-Ctrl-Id",""),u.request.setDefaultHeader("X-Y-Session-Id",""),u.state=D.CLOSE,u.emitter.emit(I.STATE,{state:u.state,reason:e}))}};return u}function z(e){const t=X(e);return t.worker&&("undefined"!=typeof Worker?t.worker.postMessage({baseURL:t.config.baseURL}):console.error("The current environment does not support worker")),function(e,t){if(!l(e))return void console.error("The modules parameter requires an array type");e.forEach((e=>{const i=new e(t);t.modules[i.moduleName]=i}))}(t.config.modules,t),t.emitter.on(I.STATE,(({state:e})=>{e===D.CLOSE&&Object.keys(t.modules).forEach((e=>{t.modules[e].cleanup()}))})),Object.assign({config:t.config,request:t.request,get state(){return t.state},on:t.emitter.on,off:t.emitter.off,join:J(t),leave:K(t),end:Z(t)},t.modules)}function J(t){return function(i){var s;return e(this,void 0,void 0,(function*(){const{clientID:e}=t.config.request,r=`${null===(s=i.endpointType)||void 0===s?void 0:s.toLocaleUpperCase()}${e}_${i.meetingNum}`;t.config.request.sessionID=r,t.request.setDefaultHeader("X-Y-Session-Id",r);const{prefix:n}=t.config.request,o=yield t.request.get(`${n.ctrl}credential`,{params:{meetingNum:i.meetingNum,pwd:i.pwd,url:i.url,mobileCode:i.mobileCode,mobile:i.mobile,regEmail:i.regEmail,accEmail:i.accEmail,tk:i.tk,displayName:i.displayName},headers:{"X-Y-Endpoint-Type":i.endpointType}}),{credential:a="",location:c=""}=o&&o.data||{};if(!a)return t.emitter.emit(I.FAILED,{bizCode:o.bizCode,data:o.data}),o;t.config.request.location=c,t.request.setDefaultHeader("X-Y-Location",c),delete i.pwd,delete i.url;const u=yield t.request.post(`${n.ctrl}join?meetingNum=${i.meetingNum}&credential=${a}`,i,{headers:{"X-Y-Endpoint-Type":i.endpointType,"X-Y-Endpoint-Id":e}});if(!u||u&&u.ret<=-1)return t.emitter.emit(I.FAILED,{bizCode:u.bizCode,data:u.data}),u;const{meetingID:d="",ctrlID:l="",user:p={},mediaContent:h={},initialMediaState:f={},tk:m=""}=u.data;if(t.config.request.meetingID=d,t.config.request.ctrlID=l,t.config.request.userID=p.userID,t.config.request.voteTk=m,t.request.setDefaultHeader("X-Y-Ctrl-Id",l),t.emitter.emit(_.INIT,Object.assign(Object.assign({},p),{mediaContent:h,initialMediaState:f})),t.state=D.JOINED,t.emitter.emit(I.STATE,{state:t.state}),"undefined"!=typeof Worker&&t.worker){const i=A(t);yield S(i,t),t.status.keepalive.running=!0,C(t),t.worker.postMessage({topics:i,meetingID:d,clientID:e,status:!0}),t.worker.onmessage=e=>{console.log("[Polling]",e.data),t.emitter.emit(e.data.event,e.data)}}else yield U(t);return u.data=Object.assign(Object.assign({},u.data),o.data),u}))}}function K(t){return function(i){return e(this,void 0,void 0,(function*(){i||(i={resultInfo:{bizCode:901359}});const{prefix:e,meetingID:s}=t.config.request,r=yield t.request.post(`${e.ctrl}meetings/${s}/leave`,i);return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),P(t),ie(t),t.cleanup(),r}))}}function Z(t){return function(){return e(this,void 0,void 0,(function*(){const{prefix:e,meetingID:i}=t.config.request,s=yield t.request.post(`${e.ctrl}meetings/${i}/end`);return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),P(t),ie(t),t.cleanup(),s}))}}class ee{constructor(e){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=z(e)}static getInstance(e){return this.instance?this.instance:this.instance=new ee(e)}}function te(e){return e.singleton?ee.getInstance(e).meeting:z(e)}function ie(e){if(e.config.singleton){const{baseURL:t,modules:i,singleton:s}=e.config,r={baseURL:t,modules:i,worker:e.worker,singleton:s},n=ee.getInstance(r);n&&(n.meeting=z(r))}}Object.defineProperty(ee,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null});export{R as Chat,E as ENDPOINT_TYPE,I as EVENT,T as Info,L as Invite,H as LiveStream,k as Me,_ as MeEvent,M as Qa,O as RECORD_STATUS,$ as ROLE,V as Recording,D as STATE,G as Setting,B as SpotlightVideo,Q as Users,Y as View,F as Vote,W as Words,te as createMeeting,ie as reset};
@@ -1 +1 @@
1
- var YlinkSDKMeeting=function(e){"use strict";function t(e,t,r,i){return new(r||(r=Promise))((function(s,n){function o(e){try{c(i.next(e))}catch(t){n(t)}}function a(e){try{c(i.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))}function r(e){return{all:e=e||new Map,on:function(t,r){var i=e.get(t);i?i.push(r):e.set(t,[r])},off:function(t,r){var i=e.get(t);i&&(r?i.splice(i.indexOf(r)>>>0,1):e.set(t,[]))},emit:function(t,r){var i=e.get(t);i&&i.slice().map((function(e){e(r)})),(i=e.get("*"))&&i.slice().map((function(e){e(t,r)}))}}}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s={exports:{}};!function(e,t){var r="__lodash_hash_undefined__",s=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",h="[object Promise]",f="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",b="[object ArrayBuffer]",x="[object DataView]",E="[object Float32Array]",I="[object Float64Array]",q="[object Int8Array]",D="[object Int16Array]",O="[object Int32Array]",T="[object Uint8Array]",$="[object Uint8ClampedArray]",_="[object Uint16Array]",S="[object Uint32Array]",A=/\w*$/,w=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,j={};j[n]=j["[object Array]"]=j[b]=j[x]=j[o]=j[a]=j[E]=j[I]=j[q]=j[D]=j[O]=j[d]=j[l]=j[p]=j[f]=j[m]=j[g]=j[v]=j[T]=j[$]=j[_]=j[S]=!0,j["[object Error]"]=j[c]=j[y]=!1;var P="object"==typeof self&&self&&self.Object===Object&&self,N="object"==typeof i&&i&&i.Object===Object&&i||P||Function("return this")(),C=t&&!t.nodeType&&t,R=C&&e&&!e.nodeType&&e,k=R&&R.exports===C;function L(e,t){return e.set(t[0],t[1]),e}function M(e,t){return e.add(t),e}function H(e,t,r,i){var s=-1,n=e?e.length:0;for(i&&n&&(r=e[++s]);++s<n;)r=t(r,e[s],s,e);return r}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(r){}return t}function G(e){var t=-1,r=Array(e.size);return e.forEach((function(e,i){r[++t]=[i,e]})),r}function B(e,t){return function(r){return e(t(r))}}function Y(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var W,X=Array.prototype,F=Function.prototype,J=Object.prototype,K=N["__core-js_shared__"],z=(W=/[^.]+$/.exec(K&&K.keys&&K.keys.IE_PROTO||""))?"Symbol(src)_1."+W:"",Q=F.toString,Z=J.hasOwnProperty,ee=J.toString,te=RegExp("^"+Q.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),re=k?N.Buffer:void 0,ie=N.Symbol,se=N.Uint8Array,ne=B(Object.getPrototypeOf,Object),oe=Object.create,ae=J.propertyIsEnumerable,ce=X.splice,ue=Object.getOwnPropertySymbols,de=re?re.isBuffer:void 0,le=B(Object.keys,Object),pe=Re(N,"DataView"),he=Re(N,"Map"),fe=Re(N,"Promise"),me=Re(N,"Set"),ge=Re(N,"WeakMap"),ve=Re(Object,"create"),ye=Ve(pe),be=Ve(he),xe=Ve(fe),Ee=Ve(me),Ie=Ve(ge),qe=ie?ie.prototype:void 0,De=qe?qe.valueOf:void 0;function Oe(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function Te(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function $e(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function _e(e){this.__data__=new Te(e)}function Se(e,t){var r=Be(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ye(e)}(e)&&Z.call(e,"callee")&&(!ae.call(e,"callee")||ee.call(e)==n)}(e)?function(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i}(e.length,String):[],i=r.length,s=!!i;for(var o in e)!t&&!Z.call(e,o)||s&&("length"==o||Me(o,i))||r.push(o);return r}function Ae(e,t,r){var i=e[t];Z.call(e,t)&&Ge(i,r)&&(void 0!==r||t in e)||(e[t]=r)}function we(e,t){for(var r=e.length;r--;)if(Ge(e[r][0],t))return r;return-1}function Ue(e,t,r,i,s,h,y){var w;if(i&&(w=h?i(e,s,h,y):i(e)),void 0!==w)return w;if(!Fe(e))return e;var U=Be(e);if(U){if(w=function(e){var t=e.length,r=e.constructor(t);t&&"string"==typeof e[0]&&Z.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!t)return function(e,t){var r=-1,i=e.length;t||(t=Array(i));for(;++r<i;)t[r]=e[r];return t}(e,w)}else{var P=Le(e),N=P==c||P==u;if(We(e))return function(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}(e,t);if(P==p||P==n||N&&!h){if(V(e))return h?e:{};if(w=function(e){return"function"!=typeof e.constructor||He(e)?{}:(t=ne(e),Fe(t)?oe(t):{});var t}(N?{}:e),!t)return function(e,t){return Ne(e,ke(e),t)}(e,function(e,t){return e&&Ne(t,Je(t),e)}(w,e))}else{if(!j[P])return h?e:{};w=function(e,t,r,i){var s=e.constructor;switch(t){case b:return Pe(e);case o:case a:return new s(+e);case x:return function(e,t){var r=t?Pe(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,i);case E:case I:case q:case D:case O:case T:case $:case _:case S:return function(e,t){var r=t?Pe(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,i);case d:return function(e,t,r){return H(t?r(G(e),!0):G(e),L,new e.constructor)}(e,i,r);case l:case g:return new s(e);case f:return function(e){var t=new e.constructor(e.source,A.exec(e));return t.lastIndex=e.lastIndex,t}(e);case m:return function(e,t,r){return H(t?r(Y(e),!0):Y(e),M,new e.constructor)}(e,i,r);case v:return n=e,De?Object(De.call(n)):{}}var n}(e,P,Ue,t)}}y||(y=new _e);var C=y.get(e);if(C)return C;if(y.set(e,w),!U)var R=r?function(e){return function(e,t,r){var i=t(e);return Be(e)?i:function(e,t){for(var r=-1,i=t.length,s=e.length;++r<i;)e[s+r]=t[r];return e}(i,r(e))}(e,Je,ke)}(e):Je(e);return function(e,t){for(var r=-1,i=e?e.length:0;++r<i&&!1!==t(e[r],r,e););}(R||e,(function(s,n){R&&(s=e[n=s]),Ae(w,n,Ue(s,t,r,i,n,e,y))})),w}function je(e){return!(!Fe(e)||(t=e,z&&z in t))&&(Xe(e)||V(e)?te:w).test(Ve(e));var t}function Pe(e){var t=new e.constructor(e.byteLength);return new se(t).set(new se(e)),t}function Ne(e,t,r,i){r||(r={});for(var s=-1,n=t.length;++s<n;){var o=t[s],a=i?i(r[o],e[o],o,r,e):void 0;Ae(r,o,void 0===a?e[o]:a)}return r}function Ce(e,t){var r,i,s=e.__data__;return("string"==(i=typeof(r=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==r:null===r)?s["string"==typeof t?"string":"hash"]:s.map}function Re(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return je(r)?r:void 0}Oe.prototype.clear=function(){this.__data__=ve?ve(null):{}},Oe.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Oe.prototype.get=function(e){var t=this.__data__;if(ve){var i=t[e];return i===r?void 0:i}return Z.call(t,e)?t[e]:void 0},Oe.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Z.call(t,e)},Oe.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?r:t,this},Te.prototype.clear=function(){this.__data__=[]},Te.prototype.delete=function(e){var t=this.__data__,r=we(t,e);return!(r<0)&&(r==t.length-1?t.pop():ce.call(t,r,1),!0)},Te.prototype.get=function(e){var t=this.__data__,r=we(t,e);return r<0?void 0:t[r][1]},Te.prototype.has=function(e){return we(this.__data__,e)>-1},Te.prototype.set=function(e,t){var r=this.__data__,i=we(r,e);return i<0?r.push([e,t]):r[i][1]=t,this},$e.prototype.clear=function(){this.__data__={hash:new Oe,map:new(he||Te),string:new Oe}},$e.prototype.delete=function(e){return Ce(this,e).delete(e)},$e.prototype.get=function(e){return Ce(this,e).get(e)},$e.prototype.has=function(e){return Ce(this,e).has(e)},$e.prototype.set=function(e,t){return Ce(this,e).set(e,t),this},_e.prototype.clear=function(){this.__data__=new Te},_e.prototype.delete=function(e){return this.__data__.delete(e)},_e.prototype.get=function(e){return this.__data__.get(e)},_e.prototype.has=function(e){return this.__data__.has(e)},_e.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Te){var i=r.__data__;if(!he||i.length<199)return i.push([e,t]),this;r=this.__data__=new $e(i)}return r.set(e,t),this};var ke=ue?B(ue,Object):function(){return[]},Le=function(e){return ee.call(e)};function Me(e,t){return!!(t=null==t?s:t)&&("number"==typeof e||U.test(e))&&e>-1&&e%1==0&&e<t}function He(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||J)}function Ve(e){if(null!=e){try{return Q.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Ge(e,t){return e===t||e!=e&&t!=t}(pe&&Le(new pe(new ArrayBuffer(1)))!=x||he&&Le(new he)!=d||fe&&Le(fe.resolve())!=h||me&&Le(new me)!=m||ge&&Le(new ge)!=y)&&(Le=function(e){var t=ee.call(e),r=t==p?e.constructor:void 0,i=r?Ve(r):void 0;if(i)switch(i){case ye:return x;case be:return d;case xe:return h;case Ee:return m;case Ie:return y}return t});var Be=Array.isArray;function Ye(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=s}(e.length)&&!Xe(e)}var We=de||function(){return!1};function Xe(e){var t=Fe(e)?ee.call(e):"";return t==c||t==u}function Fe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Je(e){return Ye(e)?Se(e):function(e){if(!He(e))return le(e);var t=[];for(var r in Object(e))Z.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}e.exports=function(e){return Ue(e,!0,!0)}}(s,s.exports);var n=s.exports;const o=e=>({get(t,r,i){if("__isProxy"===r)return!0;const s=Reflect.get(t,r);return Array.isArray(s)?s:"object"==typeof s&&null!==s?s.__isProxy?s:new Proxy(s,o(e)):s},set(t,r,i,s){const o=t[r];i=f(i)&&i.__isProxy?n(i):i;const a=Reflect.set(t,r,i,s);return((e,t)=>e!==t&&(e==e||t==t))(i,o)&&e.emit(`${b(r)}Change`,i),a}}),a=e=>encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class c{constructor(e){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=e.baseURL,this._beforeRequest=e.beforeRequest,this._errorHandler=e.error}_request(e){const{url:t="",timeout:r=6e4}=e;let{headers:i={}}=e;return e.url=this.baseURL.replace(/\/+$/,"")+"/"+((e,t)=>{if(!t)return e;const r=[];Object.keys(t).forEach((e=>{const i=t[e];if(null==i)return;let s;Array.isArray(i)?(s=i,e+="[]"):s=[i],s.forEach((t=>{null!==t&&"object"==typeof t&&(t=JSON.stringify(t)),r.push(`${a(e)}=${a(t)}`)}))}));const i=r.join("&");if(i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e})(t.replace(/^\/+/,""),e.params),i=Object.assign(i,this._defaultHeaders),Object.keys(i).forEach((e=>{"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(i["Content-Type"]=i[e],delete i[e])})),m(e.data)&&(i&&!i["Content-Type"]&&(i["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=i,e.timeout=r,this._beforeRequest&&this._beforeRequest(e),"undefined"!=typeof wx?l(e):d(e)}setDefaultHeader(e,t){e in this._defaultHeaders&&(""===t||null===t)?delete this._defaultHeaders[e]:this._defaultHeaders[e]=t}get(e,t){return this._errorHandler?this._request(Object.assign(t||{},{url:e,method:"GET"})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(t||{},{url:e,method:"GET"}))}post(e,t,r){return this._errorHandler?this._request(Object.assign(r||{},{url:e,method:"POST",data:t})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(r||{},{url:e,method:"POST",data:t}))}}class u{constructor(e){let t;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=e,t(this.reason))}))}static source(){let e;const t=new u((t=>{e=t}));return{cancel:e,token:t}}}const d=e=>new Promise(((t,r)=>{const{data:i=null,url:s,method:n="GET",headers:o,cancelToken:a,withResDate:c}=e;let u=new XMLHttpRequest;u.open(n.toUpperCase(),s,!0),u.timeout=e.timeout;const d=()=>{if(u){if(u.status>=200&&u.status<300)try{const e=JSON.parse(u.responseText);c&&(e.responseDate=new Date(u.getResponseHeader("Date")).getTime()),t(e)}catch(e){r(new Error("E_JSON_PARSE"+u.responseText))}else r({url:s,statusCode:u.status});u=null}};"onloadend"in u?u.onloadend=d:u.onreadystatechange=()=>{u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=()=>{u&&(r({url:s,statusCode:u.status,type:"request abort"}),u=null)},u.onerror=()=>{r(new Error("Network Error")),u=null},u.ontimeout=()=>{r(new Error("timeout of "+e.timeout+"ms exceeded")),u=null},"setRequestHeader"in u&&Object.keys(o).forEach((e=>{null===i&&"content-type"===e.toLowerCase()?delete o[e]:u.setRequestHeader(e,o[e])})),a&&a.promise.then((e=>{u&&(u.abort(),r(e),u=null)})),u.send(i)})),l=e=>new Promise(((t,r)=>{const{data:i=null,url:s,method:n="GET",headers:o,cancelToken:a}=e,c=wx.request({url:s,data:i,method:n.toUpperCase(),timeout:e.timeout,header:o,success(e){e.statusCode>=200&&e.statusCode<300?t(e.data):r({url:s,statusCode:e.statusCode})},fail(e){r("request:fail abort"===e.errMsg&&a&&a.reason||e)}});a&&a.promise.then((()=>{c&&c.abort()}))})),p=Array.isArray,h=e=>null==e,f=e=>"object"==typeof e&&null!==e,m=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},g=()=>{const e=[],t="0123456789abcdef";for(let r=0;r<36;r++)e[r]=t.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";return e.join("").split("-").join("")},v=(e,t)=>e?(Object.entries(e).forEach((e=>{const[r,i]=[e[0],e[1]];if(null!==i)return f(i)&&!p(i)?(t[r]||(t[r]={}),void(t[r]=v(i,t[r]))):void(t[r]=i)})),t):t,y=/-(\w)/g,b=e=>e.replace(y,((e,t)=>t?t.toUpperCase():""));var x,E,I,q,D,O;e.EVENT=void 0,(x=e.EVENT||(e.EVENT={})).REQUEST_ERROR="requestError",x.STATE="state",e.STATE=void 0,(E=e.STATE||(e.STATE={}))[E.CLOSE=0]="CLOSE",E[E.JOINED=1]="JOINED",E[E.READY=2]="READY",e.ENDPOINT_TYPE=void 0,(I=e.ENDPOINT_TYPE||(e.ENDPOINT_TYPE={})).WEBAPP="webApp",I.WEBCTRL="webCtrl",I.WECHATMP="weChatMP",I.SUPERVISION="supervision",I.BIGSCREEN="bigScreen",I.DESKTOP="desktop",I.MOBILE="mobile",I.VCS="vcs",I.SIP="sip",I.H323="h323",I.PSTN="pstn",e.ROLE=void 0,(q=e.ROLE||(e.ROLE={})).HOST="host",q.COHOST="coHost",q.ATTENDEE="attendee",q.AUDIENCE="audience",e.RECORD_STATUS=void 0,(D=e.RECORD_STATUS||(e.RECORD_STATUS={})).STARTED="started",D.PAUSED="paused",D.STARTING="starting",D.STOPPED="stopped";class T{constructor(e,t){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"on",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"off",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=t,this.ctx=e,this.emitter=r(),this.on=this.emitter.on,this.off=this.emitter.off,this.data=new Proxy({},o(this.emitter)),this._bindOn()}cleanup(){this.emitter.all=new Map,this.data=new Proxy({},o(this.emitter))}reactive(e){if(f(e)){const t=new Map,r=(e,i)=>{Object.keys(e).forEach((s=>{!1===i&&s in this.data&&(e[s]=this.data[s]);const n=t=>e[s]=t,o=`${b(s)}Change`;this.emitter.on(o,n),t.set(o,n),f(e[s])&&!p(e[s])&&r(e[s],!0)}))};r(e,!1),e._destory=()=>{t.forEach(((e,t)=>{this.emitter.off(t,e)}))}}else console.warn("Parameter is not an object!");return e}}class $ extends T{constructor(e){super(e,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(e=>{const{state:t,body:r}=e;("full"===t||"update"===t)&&v(r,this.data)})),this.ctx.emitter.on("participantCount",(e=>{const{body:t}=e;v({participantCount:t},this.data)}))}subject(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${r}/info/subject`,e)}))}practiceSession(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}/meetings/${t}/info/practiceSession`)}))}shareInfo(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${t}/meetings/${r}/shareInfo`,{params:e})}meetings(e){if(!e)return Promise.reject();const{prefix:{ctrl:t}}=this.ctx.config.request;return this.ctx.request.get(`${t}/meetings`,{params:e})}}function _(e){return t(this,void 0,void 0,(function*(){const r=A(e),{sessionID:i,meetingID:s}=e.config.request,n=yield function(e,r){return t(this,void 0,void 0,(function*(){const{topics:t,sessionID:i,meetingID:s}=r,n=yield e.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:i,meetingId:s},inboxes:t}),o=[];return n.data&&Object.keys(n.data).forEach((e=>{o.push({name:e,seqId:n.data[e].maxSeqId,limit:200})})),o}))}(e.request,{topics:r,sessionID:i,meetingID:s});yield w(r,e),e.status.polling.running=!0,e.status.keepalive.running=!0,U(e.request,{inboxes:n,sessionID:i,meetingID:s,cancelToken:e.config.request.cancelToken.token,status:e.status.polling},(t=>{e.emitter.emit(t.event,t)})),j(e)}))}function S(e){e.status.polling.running=!1,e.status.keepalive.running=!1,e.status.polling.timer&&(clearTimeout(e.status.polling.timer),e.status.polling.timer=null),e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null),e.config.request.cancelToken.cancel(),e.config.request.cancelToken=u.source()}function A(e){const t=[],{isInLobby:r}=e.modules.me.data;return r?(t.push("lobbyMember"),t):(Object.keys(e.modules).forEach((r=>{const i=e.modules[r]._topic();i&&(Array.isArray(i)?i.forEach((e=>{t.includes(e)||t.push(e)})):t.includes(i)||t.push(i))})),t)}function w(r,i){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=i.config.request,n=yield i.request.post(`${t}/meetings/${s}/subscribe`,{topics:r}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((e=>{console.log("[subscribe]",e),i.emitter.emit(e.event,e)})),i.state!==e.STATE.READY&&(i.state=e.STATE.READY,i.emitter.emit(e.EVENT.STATE,{state:i.state}))}))}function U(e,r,i){return t(this,void 0,void 0,(function*(){const{inboxes:s,sessionID:n,meetingID:o,cancelToken:a,status:c}=r;yield(()=>t(this,void 0,void 0,(function*(){const t=yield e.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:s},{cancelToken:a,withResDate:!0});if(!t||!t.data)return;const{data:r={}}=t;Object.keys(r).forEach((e=>{const t=s.find((t=>t.name===e));if(t){if(t.seqId=r[e].maxSeqId,!r[e].items)return;r[e].items.forEach((e=>{const t=JSON.parse(e.content);["liveStream","recording"].includes(t.event)&&(t.stime=e.stime),i(t)}))}}))})))(),c.running&&(c.timer=setTimeout((()=>{c.running&&U(e,r,i)}),200))}))}function j(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:r},meetingID:i,userID:s}=e.config.request;e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null),yield(()=>t(this,void 0,void 0,(function*(){const t=yield e.request.post(`${r}/meetings/${i}/users/${s}/keepalive`,{},{cancelToken:e.config.request.cancelToken.token});if(!t||!t.data)return;const{data:n={}}=t,o=n.interval||"";o&&(e.status.keepalive.interval=o)})))(),e.status.keepalive.running&&(e.status.keepalive.timer=setTimeout((()=>{e.status.keepalive.running&&j(e)}),1e3*e.status.keepalive.interval))}))}e.MeEvent=void 0,(O=e.MeEvent||(e.MeEvent={})).INIT="meInit",O.UPDATE="meUpdate",O.UPDATE_USER_STATE="updateUserState",O.ROLECHANGE="meRoleChange",O.AUDIOCHANGE="meAudioChange",O.HANDUPCHANGE="meHandupChange",O.SETAUDIO="setAudio",O.VIDEOCHANGE="meVideoChange",O.SETVIDEO="setVideo",O.SHARECHANGE="meShareChange",O.DISPLAYNAMECHANGE="meDisplayNameChange",O.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",O.LOBBYCHANGE="meLobbyChange",O.BARRAGECHANGE="meBarrageChange",O.LEAVE="leave";class P extends T{constructor(e){super(e,"me")}_topic(){return""}_bindOn(){const r=r=>t(this,void 0,void 0,(function*(){"role"in r&&r.role!==this.data.role&&(r.role!==e.ROLE.AUDIENCE&&this.data.role!==e.ROLE.AUDIENCE||(yield N(this.ctx),this.data.isUpdatedUserState=!1,this.emitter.emit(e.MeEvent.UPDATE_USER_STATE,{data:this.data,event:"roleChange"})),v({role:r.role},this.data),this.emitter.emit(e.MeEvent.ROLECHANGE,r.role),this.ctx.emitter.emit(e.MeEvent.ROLECHANGE,r.role))})),i=t=>{var r,i,s,n;if("audio"in t){const{deviceOn:o,sendOn:a,opBy:c}=t.audio;(!h(o)&&o!==(null===(r=this.data.audio)||void 0===r?void 0:r.deviceOn)||!h(a)&&a!==(null===(i=this.data.audio)||void 0===i?void 0:i.sendOn))&&(v({audio:t.audio},this.data),this.emitter.emit(e.MeEvent.AUDIOCHANGE,{deviceOn:h(o)?null===(s=this.data.audio)||void 0===s?void 0:s.deviceOn:o,sendOn:h(a)?null===(n=this.data.audio)||void 0===n?void 0:n.sendOn:a,opBy:c}))}},s=t=>{var r,i,s,n;if("video"in t){const{deviceOn:o,sendOn:a,opBy:c}=t.video;(!h(o)&&o!==(null===(r=this.data.video)||void 0===r?void 0:r.deviceOn)||!h(a)&&a!==(null===(i=this.data.video)||void 0===i?void 0:i.sendOn))&&(v({video:t.video},this.data),this.emitter.emit(e.MeEvent.VIDEOCHANGE,{deviceOn:h(o)?null===(s=this.data.video)||void 0===s?void 0:s.deviceOn:o,sendOn:h(a)?null===(n=this.data.video)||void 0===n?void 0:n.sendOn:a,opBy:c}))}},n=t=>{var r,i,s,n;if("share"in t){const{deviceOn:o,sendOn:a,opBy:c}=t.share;(!h(o)&&o!==(null===(r=this.data.share)||void 0===r?void 0:r.deviceOn)||!h(a)&&a!==(null===(i=this.data.share)||void 0===i?void 0:i.sendOn))&&(v({share:t.share},this.data),this.emitter.emit(e.MeEvent.SHARECHANGE,{deviceOn:h(o)?null===(s=this.data.share)||void 0===s?void 0:s.deviceOn:o,sendOn:h(a)?null===(n=this.data.share)||void 0===n?void 0:n.sendOn:a,opBy:c}))}},o=t=>{t.displayName&&t.displayName!==this.data.displayName&&(v({displayName:t.displayName},this.data),this.emitter.emit(e.MeEvent.DISPLAYNAMECHANGE,t.displayName))},a=t=>{"isHandUp"in t&&t.isHandUp!==this.data.isHandUp&&(v({isHandUp:t.isHandUp},this.data),this.emitter.emit(e.MeEvent.HANDUPCHANGE,t.isHandUp))},c=t=>{"isSpotlightVideo"in t&&(v({isSpotlightVideo:t.isSpotlightVideo},this.data),this.emitter.emit(e.MeEvent.SPOTLIGHTVIDEOCHANGE,t.isSpotlightVideo))},u=r=>t(this,void 0,void 0,(function*(){"isInLobby"in r&&r.isInLobby!==this.data.isInLobby&&(v({isInLobby:r.isInLobby},this.data),yield N(this.ctx),!1===r.isInLobby&&(this.data.isUpdatedUserState=!1,this.emitter.emit(e.MeEvent.UPDATE_USER_STATE,{data:this.data,event:"inLobbyChange"})),this.emitter.emit(e.MeEvent.LOBBYCHANGE,r.isInLobby))})),d=t=>{if(!t.barrage)return;let r=null;if(!t.barrage.wordsDisplayStatus)return r=null,delete t.barrage,this.data.barrage=r||void 0,void this.emitter.emit(e.MeEvent.BARRAGECHANGE,r);r={content:t.barrage.content,contentType:t.barrage.contentType,type:t.barrage.type,duration:t.barrage.duration,position:t.barrage.position};const{role:i}=this.data;t.barrage.receiver&&(i===e.ROLE.HOST||i===e.ROLE.COHOST?r=t.barrage.receiver.host?r:null:i===e.ROLE.ATTENDEE?r=t.barrage.receiver.attendee?r:null:i===e.ROLE.AUDIENCE&&(r=t.barrage.receiver.audience?r:null),delete t.barrage,this.data.barrage=r||void 0,this.emitter.emit(e.MeEvent.BARRAGECHANGE,r))},l=t=>{"leave"in t&&!0===t.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),S(this.ctx),B(this.ctx),this.emitter.emit(e.MeEvent.LEAVE,t.resultInfo),this.ctx.state=e.STATE.CLOSE,this.ctx.emitter.emit(e.EVENT.STATE,{state:this.ctx.state,reason:t.resultInfo}))},p=e=>{r(e),i(e),s(e),n(e),o(e),a(e),u(e),c(e),d(e),l(e)};this.ctx.emitter.on(e.MeEvent.INIT,(t=>{v(t,this.data),this.data.isUpdatedUserState=!1,this.emitter.emit(e.MeEvent.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on(e.MeEvent.UPDATE,(e=>{p(e),v(e,this.data)})),this.ctx.emitter.on("me",(e=>t(this,void 0,void 0,(function*(){const{state:t,body:r={users:[]}}=e;if("delete"===t){const e=r.users[0];return e.leave=!0,void l(e)}const i=r.users.find((e=>e.userID===this.data.userID));i&&(p(i),v(i,this.data))})))),this.ctx.emitter.on("setUserVideo",(t=>{this.emitter.emit(e.MeEvent.SETVIDEO,t.body)})),this.ctx.emitter.on("setUserAudio",(t=>{this.emitter.emit(e.MeEvent.SETAUDIO,t.body)})),this.ctx.emitter.on("meetingState",(e=>{const{body:t={}}=e;if("ended"===t.state){l({leave:!0,resultInfo:t.resultInfo})}}))}updateUserState(t,r=!1){if(!r){const{role:r,initialMediaState:i}=this.data;t.audio.sendOn=t.audio.sendOn&&i.audio.sendOn,t.video.sendOn=t.video.sendOn&&i.video.sendOn,r===e.ROLE.AUDIENCE&&(t.audio.sendOn=!1,t.video.sendOn=!1)}const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,v(t,this.data),this.ctx.request.post(`${i}/meetings/${s}/updateUserState`,t)}}function N(e){return t(this,void 0,void 0,(function*(){const t=A(e),{meetingID:r,sessionID:i}=e.config.request;"undefined"!=typeof Worker&&e.worker?(yield w(t,e),e.worker.postMessage({topics:t,meetingID:r,sessionID:i,rePolling:!0})):(S(e),yield _(e))}))}class C extends T{constructor(e){super(e,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(e=>{const{body:t,state:r}=e;if(t&&t.users){if("full"===r)return this.data.callRecordUsers=t.users.map((e=>(e.displayNamePinyin=C.setDisplayNamePinyinProp?C.setDisplayNamePinyinProp(e.displayName||""):e.displayName,e))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);t.users.forEach((e=>{const t=this.data.callRecordUsers.findIndex((t=>e.inviteTransID===t.inviteTransID));"update"===r&&-1!==t?v(e,this.data.callRecordUsers[t]):"update"===r&&-1===t&&(e.displayNamePinyin=C.setDisplayNamePinyinProp?C.setDisplayNamePinyinProp(e.displayName||""):e.displayName,this.data.callRecordUsers.push(e))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}/meetings/${r}/invite`,e)}mailTemplate(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${t}/mailTemplate`,{params:{meetingID:r},headers:{language:e.language}})}}class R extends T{constructor(e){super(e,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:t,endpointType:r}=this.ctx.modules.me.data;return r===e.ENDPOINT_TYPE.SUPERVISION?["interactive","broadcast"]:t===e.ROLE.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const t=(t,{event:r,state:i})=>{if(t.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:s={}}=t;if("delete"!==i||"delete"===i&&[901357,901358,901352,901351,901350,901349].includes(s.bizCode||-1))return void this.ctx.emitter.emit(e.MeEvent.UPDATE,t);let n=!1;switch(r){case"interactiveUsers":t.isInLobby||(n=!0);break;case"broadcastUsers":t.isInLobby||t.role!==e.ROLE.AUDIENCE||(n=!0);break;case"lobbyUsers":t.isInLobby&&(n=!0)}const o={};n&&(o.leave=!0),this.ctx.emitter.emit(e.MeEvent.UPDATE,Object.assign(Object.assign({},t),o))},r=({updateUsers:e,state:r,sourceKey:i})=>{if("full"===r)return this.data[i]=e.map((e=>(e.displayNamePinyin=R.setDisplayNamePinyinProp?R.setDisplayNamePinyinProp(e.displayName):e.displayName,t(e,{event:i,state:r}),e))),this.emitter.emit(`${i}Change`,{users:this.data[i],isFull:!0}),this.data[i];void 0===this.data[i]&&(this.data[i]=[]);const{data:s,emitter:n}=this;return e.forEach((e=>{const o=s[i].findIndex((t=>e.userID===t.userID));if("delete"===r&&-1!==o){const[t]=this.data[i].splice(o,1);n.emit(`${i}Delete`,{user:t,resultInfo:e.resultInfo})}else"update"===r&&-1!==o?(this.updateUserProps(e,this.data[i][o]),v(e,this.data[i][o]),this.emitter.emit(`${i}Update`,{user:s[i][o]})):"update"===r&&-1===o&&(e.displayNamePinyin=R.setDisplayNamePinyinProp?R.setDisplayNamePinyinProp(e.displayName):e.displayName,s[i].push(e),this.emitter.emit(`${i}Add`,{user:e,resultInfo:e.resultInfo}));t(e,{event:i,state:r})})),this.emitter.emit(`${i}Change`,{users:this.data[i],isFull:!1}),this.data[i]};this.ctx.emitter.on("interactiveUsers",(e=>{const{state:t,body:i}=e;r({updateUsers:i.users,state:t,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(e=>{const{state:t,body:i}=e;r({updateUsers:i.users,state:t,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(e=>{const{state:t,body:i}=e;r({updateUsers:i.users,state:t,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(e=>{const{state:t,body:i}=e;r({updateUsers:i.users,state:t,sourceKey:"advCtrlUsers"})}))}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(e,t){e.displayName&&e.displayName!==t.displayName&&(e.displayNamePinyin=R.setDisplayNamePinyinProp?R.setDisplayNamePinyinProp(e.displayName):e.displayName)}setAudio(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${e}/audio`,t)}setVideo(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${e}/video`,t)}setShare(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${e}/share`,t)}setWhiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${e}/whiteboard`,t)}handUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${e}/handUp`,t)}setRole(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${e}/role`,t)}rename(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${e}/displayName`,t)}remove(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}/meetings/${r}/users/${e}/remove`)}replyHandUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${e}/replyHandUp`,t)}fecc(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${e}/fecc`,t)}lobbyState(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${e}/lobbyState`,t)}allowLocalRecord(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${e}/allowLocalRecord`,t)}whiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${i}/users/${e}/whiteboard`,t)}callStats(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${t}/meetings/${r}/users/${e}/callStats`)}replyAllHandUp(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}/meetings/${t}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}/meetings/${t}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}/meetings/${t}/lobby/refuseAll`)}}function k(t){const i=function(t){const{baseURL:i,modules:s,worker:n,singleton:o}=t;s.findIndex((e=>e===P))<0&&s.push(P),s.findIndex((e=>e===$))<0&&s.push($);const a={config:{baseURL:i,modules:s,singleton:o||!1,request:{cancelToken:u.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1"},location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:n,emitter:r(),request:new c({baseURL:i,beforeRequest:e=>{e.headers["X-Y-Request-Id"]=g()},error:t=>{a.emitter.emit(e.EVENT.REQUEST_ERROR,t)}}),modules:{},state:e.STATE.CLOSE,status:{polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}}};return a}(t);return i.worker&&("undefined"!=typeof Worker?i.worker.postMessage({baseURL:i.config.baseURL}):console.error("The current environment does not support worker")),function(e,t){if(!p(e))return void console.error("The modules parameter requires an array type");e.forEach((e=>{const r=new e(t);t.modules[r.moduleName]=r}))}(i.config.modules,i),i.emitter.on(e.EVENT.STATE,(({state:t})=>{t===e.STATE.CLOSE&&Object.keys(i.modules).forEach((e=>{i.modules[e].cleanup()}))})),Object.assign({config:i.config,request:i.request,get state(){return i.state},on:i.emitter.on,off:i.emitter.off,join:L(i),leave:M(i),end:H(i)},i.modules)}function L(r){return function(i){var s;return t(this,void 0,void 0,(function*(){const t=`${null===(s=i.endpointType)||void 0===s?void 0:s.toLocaleUpperCase()}${g()}_${((e=new Date,t)=>{const r={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));for(const i in r)new RegExp("("+i+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?r[i]:("00"+r[i]).substr((""+r[i]).length)));return t})(new Date,"MMddHHmmss")}_${i.meetingNum}`;r.request.setDefaultHeader("X-Y-Session-Id",t);const{prefix:n}=r.config.request,o=yield r.request.get(`${n.ctrl}/credential`,{params:{meetingNum:i.meetingNum,pwd:i.pwd,url:i.url,mobileCode:i.mobileCode,mobile:i.mobile,regEmail:i.regEmail,accEmail:i.accEmail,tk:i.tk,displayName:i.displayName},headers:{"X-Y-Endpoint-Type":i.endpointType,"X-Y-Endpoint-Id":t}}),{credential:a="",location:c=""}=o&&o.data||{};if(!a)return o;r.config.request.location=c,delete i.pwd,delete i.url;const u=yield r.request.post(`${n.ctrl}/join?meetingNum=${i.meetingNum}&credential=${a}`,i,{headers:{"X-Y-Endpoint-Type":i.endpointType,"X-Y-Endpoint-Id":t}});if(u&&u.data&&u.ret>-1){const{meetingID:i="",ctrlID:s="",user:n={},mediaContent:a={},initialMediaState:d={},tk:l=""}=u.data;if(r.config.request.sessionID=t,r.config.request.meetingID=i,r.config.request.ctrlID=s,r.config.request.userID=n.userID,r.config.request.voteTk=l,r.request.setDefaultHeader("X-Y-Location",c),r.request.setDefaultHeader("X-Y-Ctrl-Id",s),r.emitter.emit(e.MeEvent.INIT,Object.assign(Object.assign({},n),{mediaContent:a,initialMediaState:d})),r.state=e.STATE.JOINED,r.emitter.emit(e.EVENT.STATE,{state:r.state}),"undefined"!=typeof Worker&&r.worker){const e=A(r);yield w(e,r),r.status.keepalive.running=!0,j(r),r.worker.postMessage({topics:e,meetingID:i,sessionID:t,status:!0}),r.worker.onmessage=e=>{console.log("[Polling]",e.data),r.emitter.emit(e.data.event,e.data)}}else yield _(r);u.data=Object.assign(Object.assign({},u.data),o.data)}return u}))}}function M(e){return function(r){return t(this,void 0,void 0,(function*(){r||(r={bizCode:901359});const{prefix:t,meetingID:i}=e.config.request,s=yield e.request.post(`${t.ctrl}/meetings/${i}/leave`,r);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),S(e),B(e),V(e),s}))}}function H(e){return function(){return t(this,void 0,void 0,(function*(){const{prefix:t,meetingID:r}=e.config.request,i=yield e.request.post(`${t.ctrl}/meetings/${r}/end`);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),S(e),B(e),V(e),i}))}}function V(t){t.state!==e.STATE.CLOSE&&(t.config.request.location="",t.config.request.meetingID="",t.config.request.ctrlID="",t.config.request.sessionID="",t.config.request.userID=-1,t.config.request.voteTk="",t.status={polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},t.request.setDefaultHeader("X-Y-Location",""),t.request.setDefaultHeader("X-Y-Ctrl-Id",""),t.request.setDefaultHeader("X-Y-Session-Id",""),t.state=e.STATE.CLOSE,t.emitter.emit(e.EVENT.STATE,{state:t.state}))}class G{constructor(e){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=k(e)}static getInstance(e){return this.instance?this.instance:this.instance=new G(e)}}function B(e){if(e.config.singleton){const{baseURL:t,modules:r,singleton:i}=e.config,s={baseURL:t,modules:r,worker:e.worker,singleton:i},n=G.getInstance(s);n&&(n.meeting=k(s))}}return Object.defineProperty(G,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),e.Chat=class extends T{constructor(e){super(e,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(e=>{const{body:t}=e;this.emitter.emit("chatMsg",t)}))}msg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}/meetings/${r}/chat/msg`,e)}))}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}/meetings/${r}/chat/historyMsg`,e)}))}},e.Info=$,e.Invite=C,e.LiveStream=class extends T{constructor(e){super(e,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(e=>{var t;const{state:r,body:i,stime:s}=e;if(i){if(s&&(this.data.jetlag=s),"full"===r){const{liveStreams:e=[]}=i;if(!e.length)return;this.data.status=[],this.data.liveStreams=e.map((e=>(e.requesting="starting"===e.status,this.data.status.push({platform:e.platform||"",status:(e.requesting?"stopped":e.status)||""}),e)));return v({status:this.data.status,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),i.liveStreams||(this.data.resultInfo={}),null===(t=i.liveStreams)||void 0===t||t.forEach((e=>{this.data.resultInfo=e.resultInfo||{};let t=this.data.liveStreams.findIndex((t=>t.platform===e.platform));-1===t?(e.requesting="starting"===e.status,this.data.liveStreams.push(e)):(e.requesting="starting"===e.status,e=Object.assign(Object.assign({},this.data.liveStreams[t]),e),this.data.liveStreams.splice(t,1,e)),t=this.data.status.findIndex((t=>t.platform===e.platform)),-1===t?this.data.status.push({platform:e.platform||"",status:e.requesting?"stopped":e.status||""}):this.data.status.splice(t,1,{platform:this.data.status[t].platform||"",status:e.requesting?this.data.status[t].status||"stopped":e.status||""})})),this.data}}))}setStatus(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${r}/liveStream/status`,e)}))}liveStreamDescription(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${r}/liveStream/description`,e)}))}liveStreamSetting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${r}/liveStream/setting`,e)}))}},e.Me=P,e.Recording=class extends T{constructor(e){super(e,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(e=>{const{state:t,body:r,stime:i}=e;if(r)return i&&(this.data.jetlag=i),this.data.isPracticeSession="started"===r.status&&this.data.status===r.status&&0===r.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),r),"starting"===r.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=r.status||this.data.status),this.data.resultInfo=r.resultInfo||{},["full","update"].includes(t)?(r.recordUsers&&(this.data.recording.recordUsers=r.recordUsers),this.data):void 0}))}history(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.get(`${e}meetings/${t}/recording/history`)}))}status(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/status`,e)}))}layout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/status`,e)}))}designatedUsers(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/designatedUsers`,e)}))}participantAdd(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/recording/participant/add`,e)}))}participantDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/recording/participant/delete`,e)}))}getTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getTemplates`,{params:e})}))}getByIds(e){return t(this,void 0,void 0,(function*(){const{prefix:{user:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/subject/getByIds`,e)}))}recordLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/layout`,e)}))}},e.Setting=class extends T{constructor(e){super(e,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(e=>{const{state:t,body:r}=e;["full","update"].includes(t)&&v(r,this.data)}))}setting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${r}/setting`,e)}))}muteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}/meetings/${t}/muteAll`)}))}unmuteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}/meetings/${t}/unmuteAll`)}))}},e.SpotlightVideo=class extends T{constructor(e){super(e,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(t=>{const{body:r}=t;if(!r||!r.userIDs)return;this.data.userIDs=r.userIDs;r.userIDs.findIndex((e=>e===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(e.MeEvent.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(e.MeEvent.UPDATE,{isSpotlightVideo:!1})}))}spotlight(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}/meetings/${r}/view/spotlight`,e)}},e.Users=R,e.View=class extends T{constructor(e){super(e,"view")}_topic(){return["hostAttendee","audience","advCtrl"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((e=>{this.ctx.emitter.on(e,(t=>{"personalView"!==e?this.updateLayout(t,e):this.updatePersonalLayouts(t)}))}))}updateLayout(e,t){const{event:r,body:i}=e;i&&("meetingView"===r?Object.keys(i).forEach((e=>{this.data[e]=i[e]})):this.data[t]=i)}updatePersonalLayouts(e){const{state:t,body:r}=e;"full"!==t&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),r.personalLayouts.forEach((e=>{const{subscriber:r={userID:-1}}=e,i=r.userID||r.subjectID||-1;"full"===t||"update"===t||e.templateStatus?this.data.personalLayouts[i]=e:delete this.data.personalLayouts[i]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/hostLayout`,e)}))}attendeeLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/attendeeLayout`,e)}))}audienceLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/audienceLayout`,e)}))}personalLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/personalLayout`,e)}))}personalLayoutDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/personalLayout/delete`,e)}))}virtualClassLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/virtualClass/layout`,e)}))}closeVirtualClass(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/view/virtualClass/close`)}))}getVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/layout/template/info`,{params:e})}))}addVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/layout/template/add`,e)}))}editVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/layout/template/edit`,e)}))}getTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getTemplates`,{params:e})}))}editTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/edit`,e)}))}addTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/add`,e)}))}deleteTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/delete`,e)}))}getDefaultTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getDefaultTemplates`,{params:e})}))}changeDefaultTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/changeDefaultTemplate`,e)}))}perspectiveBind(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/perspective/bind`,e)}))}},e.Vote=class extends T{constructor(e){super(e,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(e=>{const{body:t}=e,{voteID:r}=t;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[r]=t,this.emitter.emit("voteChange",this.data.vote)}))}getVotes(e){const{prefix:{vote:t},meetingID:r,voteTk:i}=this.ctx.config.request;return e.tk=e.tk||i,this.ctx.request.get(`${t}/meetings/${r}/votes`,{params:e})}getVote(e){const{prefix:{vote:t},meetingID:r,voteTk:i}=this.ctx.config.request;return e.tk=e.tk||i,this.ctx.request.get(`${t}/meetings/${r}/vote`,{params:e})}getMeVote(e){const{prefix:{vote:t},meetingID:r,voteTk:i}=this.ctx.config.request;return e.tk=e.tk||i,this.ctx.request.get(`${t}/meetings/${r}/vote/me`,{params:e})}voteStatus(e,t){const{prefix:{vote:r},meetingID:i,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.post(`${r}/meetings/${i}/vote/status?tk=${e.tk}&voteID=${e.voteID}`,t)}voteSubmit(e,t){const{prefix:{vote:r},meetingID:i,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.post(`${r}/meetings/${i}/vote/submit?tk=${e.tk}&voteID=${e.voteID}`,t)}voteAdd(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}/personal/vote/add`,e)}voteEdit(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}/personal/vote/edit`,e)}voteDelete(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}/personal/vote/delete`,e)}voteInProgress(e){const{prefix:{vote:t},meetingID:r,voteTk:i}=this.ctx.config.request;return this.ctx.request.get(`${t}/meetings/${r}/vote/inProgress`,{params:{tk:e&&e.tk||i}})}},e.Words=class extends T{constructor(e){super(e,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(t=>{this.data.timer&&clearTimeout(this.data.timer);const{state:r,body:i}=t;if(!i)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data});"full"===r&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),this.data.barrageRecord=[{content:i.content,time:(new Date).getTime(),durationType:i.durationType,duration:1e3*i.duration},...this.data.barrageRecord],i.wordsDisplayStatus=!0,-1!==i.duration&&(this.data.timer=setTimeout((()=>{i.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=i.wordsDisplayStatus,this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data})}),1e3*i.duration)),v(i,this.data),this.emitter.emit("barrageRecordChange",this.data.barrageRecord),this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(e.MeEvent.ROLECHANGE,(()=>this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data})))}barrage(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${r}/barrage`,e)}))}deleteBarrage(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}/meetings/${t}/deleteBarrage`)}))}},e.createMeeting=function(e){return e.singleton?G.getInstance(e).meeting:k(e)},e.reset=B,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
1
+ var YlinkSDKMeeting=function(e){"use strict";function t(e,t,i,s){return new(i||(i=Promise))((function(r,n){function o(e){try{c(s.next(e))}catch(t){n(t)}}function a(e){try{c(s.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))}function i(e){return{all:e=e||new Map,on:function(t,i){var s=e.get(t);s?s.push(i):e.set(t,[i])},off:function(t,i){var s=e.get(t);s&&(i?s.splice(s.indexOf(i)>>>0,1):e.set(t,[]))},emit:function(t,i){var s=e.get(t);s&&s.slice().map((function(e){e(i)})),(s=e.get("*"))&&s.slice().map((function(e){e(t,i)}))}}}var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}};!function(e,t){var i="__lodash_hash_undefined__",r=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",h="[object Promise]",f="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",b="[object ArrayBuffer]",x="[object DataView]",E="[object Float32Array]",q="[object Float64Array]",I="[object Int8Array]",D="[object Int16Array]",O="[object Int32Array]",T="[object Uint8Array]",$="[object Uint8ClampedArray]",_="[object Uint16Array]",w="[object Uint32Array]",S=/\w*$/,A=/^\[object .+?Constructor\]$/,U=/^(?:0|[1-9]\d*)$/,j={};j[n]=j["[object Array]"]=j[b]=j[x]=j[o]=j[a]=j[E]=j[q]=j[I]=j[D]=j[O]=j[d]=j[l]=j[p]=j[f]=j[m]=j[g]=j[v]=j[T]=j[$]=j[_]=j[w]=!0,j["[object Error]"]=j[c]=j[y]=!1;var P="object"==typeof self&&self&&self.Object===Object&&self,C="object"==typeof s&&s&&s.Object===Object&&s||P||Function("return this")(),N=t&&!t.nodeType&&t,R=N&&e&&!e.nodeType&&e,k=R&&R.exports===N;function L(e,t){return e.set(t[0],t[1]),e}function M(e,t){return e.add(t),e}function H(e,t,i,s){var r=-1,n=e?e.length:0;for(s&&n&&(i=e[++r]);++r<n;)i=t(i,e[r],r,e);return i}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(i){}return t}function G(e){var t=-1,i=Array(e.size);return e.forEach((function(e,s){i[++t]=[s,e]})),i}function B(e,t){return function(i){return e(t(i))}}function Q(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i}var Y,F=Array.prototype,W=Function.prototype,X=Object.prototype,z=C["__core-js_shared__"],J=(Y=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Y:"",K=W.toString,Z=X.hasOwnProperty,ee=X.toString,te=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ie=k?C.Buffer:void 0,se=C.Symbol,re=C.Uint8Array,ne=B(Object.getPrototypeOf,Object),oe=Object.create,ae=X.propertyIsEnumerable,ce=F.splice,ue=Object.getOwnPropertySymbols,de=ie?ie.isBuffer:void 0,le=B(Object.keys,Object),pe=Re(C,"DataView"),he=Re(C,"Map"),fe=Re(C,"Promise"),me=Re(C,"Set"),ge=Re(C,"WeakMap"),ve=Re(Object,"create"),ye=Ve(pe),be=Ve(he),xe=Ve(fe),Ee=Ve(me),qe=Ve(ge),Ie=se?se.prototype:void 0,De=Ie?Ie.valueOf:void 0;function Oe(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var s=e[t];this.set(s[0],s[1])}}function Te(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var s=e[t];this.set(s[0],s[1])}}function $e(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var s=e[t];this.set(s[0],s[1])}}function _e(e){this.__data__=new Te(e)}function we(e,t){var i=Be(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Qe(e)}(e)&&Z.call(e,"callee")&&(!ae.call(e,"callee")||ee.call(e)==n)}(e)?function(e,t){for(var i=-1,s=Array(e);++i<e;)s[i]=t(i);return s}(e.length,String):[],s=i.length,r=!!s;for(var o in e)!t&&!Z.call(e,o)||r&&("length"==o||Me(o,s))||i.push(o);return i}function Se(e,t,i){var s=e[t];Z.call(e,t)&&Ge(s,i)&&(void 0!==i||t in e)||(e[t]=i)}function Ae(e,t){for(var i=e.length;i--;)if(Ge(e[i][0],t))return i;return-1}function Ue(e,t,i,s,r,h,y){var A;if(s&&(A=h?s(e,r,h,y):s(e)),void 0!==A)return A;if(!We(e))return e;var U=Be(e);if(U){if(A=function(e){var t=e.length,i=e.constructor(t);t&&"string"==typeof e[0]&&Z.call(e,"index")&&(i.index=e.index,i.input=e.input);return i}(e),!t)return function(e,t){var i=-1,s=e.length;t||(t=Array(s));for(;++i<s;)t[i]=e[i];return t}(e,A)}else{var P=Le(e),C=P==c||P==u;if(Ye(e))return function(e,t){if(t)return e.slice();var i=new e.constructor(e.length);return e.copy(i),i}(e,t);if(P==p||P==n||C&&!h){if(V(e))return h?e:{};if(A=function(e){return"function"!=typeof e.constructor||He(e)?{}:(t=ne(e),We(t)?oe(t):{});var t}(C?{}:e),!t)return function(e,t){return Ce(e,ke(e),t)}(e,function(e,t){return e&&Ce(t,Xe(t),e)}(A,e))}else{if(!j[P])return h?e:{};A=function(e,t,i,s){var r=e.constructor;switch(t){case b:return Pe(e);case o:case a:return new r(+e);case x:return function(e,t){var i=t?Pe(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}(e,s);case E:case q:case I:case D:case O:case T:case $:case _:case w:return function(e,t){var i=t?Pe(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}(e,s);case d:return function(e,t,i){return H(t?i(G(e),!0):G(e),L,new e.constructor)}(e,s,i);case l:case g:return new r(e);case f:return function(e){var t=new e.constructor(e.source,S.exec(e));return t.lastIndex=e.lastIndex,t}(e);case m:return function(e,t,i){return H(t?i(Q(e),!0):Q(e),M,new e.constructor)}(e,s,i);case v:return n=e,De?Object(De.call(n)):{}}var n}(e,P,Ue,t)}}y||(y=new _e);var N=y.get(e);if(N)return N;if(y.set(e,A),!U)var R=i?function(e){return function(e,t,i){var s=t(e);return Be(e)?s:function(e,t){for(var i=-1,s=t.length,r=e.length;++i<s;)e[r+i]=t[i];return e}(s,i(e))}(e,Xe,ke)}(e):Xe(e);return function(e,t){for(var i=-1,s=e?e.length:0;++i<s&&!1!==t(e[i],i,e););}(R||e,(function(r,n){R&&(r=e[n=r]),Se(A,n,Ue(r,t,i,s,n,e,y))})),A}function je(e){return!(!We(e)||(t=e,J&&J in t))&&(Fe(e)||V(e)?te:A).test(Ve(e));var t}function Pe(e){var t=new e.constructor(e.byteLength);return new re(t).set(new re(e)),t}function Ce(e,t,i,s){i||(i={});for(var r=-1,n=t.length;++r<n;){var o=t[r],a=s?s(i[o],e[o],o,i,e):void 0;Se(i,o,void 0===a?e[o]:a)}return i}function Ne(e,t){var i,s,r=e.__data__;return("string"==(s=typeof(i=t))||"number"==s||"symbol"==s||"boolean"==s?"__proto__"!==i:null===i)?r["string"==typeof t?"string":"hash"]:r.map}function Re(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return je(i)?i:void 0}Oe.prototype.clear=function(){this.__data__=ve?ve(null):{}},Oe.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Oe.prototype.get=function(e){var t=this.__data__;if(ve){var s=t[e];return s===i?void 0:s}return Z.call(t,e)?t[e]:void 0},Oe.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Z.call(t,e)},Oe.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?i:t,this},Te.prototype.clear=function(){this.__data__=[]},Te.prototype.delete=function(e){var t=this.__data__,i=Ae(t,e);return!(i<0)&&(i==t.length-1?t.pop():ce.call(t,i,1),!0)},Te.prototype.get=function(e){var t=this.__data__,i=Ae(t,e);return i<0?void 0:t[i][1]},Te.prototype.has=function(e){return Ae(this.__data__,e)>-1},Te.prototype.set=function(e,t){var i=this.__data__,s=Ae(i,e);return s<0?i.push([e,t]):i[s][1]=t,this},$e.prototype.clear=function(){this.__data__={hash:new Oe,map:new(he||Te),string:new Oe}},$e.prototype.delete=function(e){return Ne(this,e).delete(e)},$e.prototype.get=function(e){return Ne(this,e).get(e)},$e.prototype.has=function(e){return Ne(this,e).has(e)},$e.prototype.set=function(e,t){return Ne(this,e).set(e,t),this},_e.prototype.clear=function(){this.__data__=new Te},_e.prototype.delete=function(e){return this.__data__.delete(e)},_e.prototype.get=function(e){return this.__data__.get(e)},_e.prototype.has=function(e){return this.__data__.has(e)},_e.prototype.set=function(e,t){var i=this.__data__;if(i instanceof Te){var s=i.__data__;if(!he||s.length<199)return s.push([e,t]),this;i=this.__data__=new $e(s)}return i.set(e,t),this};var ke=ue?B(ue,Object):function(){return[]},Le=function(e){return ee.call(e)};function Me(e,t){return!!(t=null==t?r:t)&&("number"==typeof e||U.test(e))&&e>-1&&e%1==0&&e<t}function He(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||X)}function Ve(e){if(null!=e){try{return K.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Ge(e,t){return e===t||e!=e&&t!=t}(pe&&Le(new pe(new ArrayBuffer(1)))!=x||he&&Le(new he)!=d||fe&&Le(fe.resolve())!=h||me&&Le(new me)!=m||ge&&Le(new ge)!=y)&&(Le=function(e){var t=ee.call(e),i=t==p?e.constructor:void 0,s=i?Ve(i):void 0;if(s)switch(s){case ye:return x;case be:return d;case xe:return h;case Ee:return m;case qe:return y}return t});var Be=Array.isArray;function Qe(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!Fe(e)}var Ye=de||function(){return!1};function Fe(e){var t=We(e)?ee.call(e):"";return t==c||t==u}function We(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function Xe(e){return Qe(e)?we(e):function(e){if(!He(e))return le(e);var t=[];for(var i in Object(e))Z.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e)}e.exports=function(e){return Ue(e,!0,!0)}}(r,r.exports);var n=r.exports;const o=e=>({get(t,i,s){if("__isProxy"===i)return!0;const r=Reflect.get(t,i);return Array.isArray(r)?r:"object"==typeof r&&null!==r?r.__isProxy?r:new Proxy(r,o(e)):r},set(t,i,s,r){const o=t[i];s=f(s)&&s.__isProxy?n(s):s;const a=Reflect.set(t,i,s,r);return((e,t)=>e!==t&&(e==e||t==t))(s,o)&&e.emit(`${b(i)}Change`,s),a}}),a=e=>encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class c{constructor(e){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=e.baseURL,this._beforeRequest=e.beforeRequest,this._errorHandler=e.error}_request(e){const{url:t="",timeout:i=6e4}=e;let{headers:s={}}=e;return e.url=this.baseURL.replace(/\/+$/,"")+"/"+((e,t)=>{if(!t)return e;const i=[];Object.keys(t).forEach((e=>{const s=t[e];if(null==s)return;let r;Array.isArray(s)?(r=s,e+="[]"):r=[s],r.forEach((t=>{null!==t&&"object"==typeof t&&(t=JSON.stringify(t)),i.push(`${a(e)}=${a(t)}`)}))}));const s=i.join("&");if(s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e})(t.replace(/^\/+/,""),e.params),s=Object.assign(s,this._defaultHeaders),Object.keys(s).forEach((e=>{"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(s["Content-Type"]=s[e],delete s[e])})),m(e.data)&&(s&&!s["Content-Type"]&&(s["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=s,e.timeout=i,this._beforeRequest&&this._beforeRequest(e),"undefined"!=typeof wx?l(e):d(e)}setDefaultHeader(e,t){e in this._defaultHeaders&&(""===t||null===t)?delete this._defaultHeaders[e]:this._defaultHeaders[e]=t}get(e,t){return this._errorHandler?this._request(Object.assign(t||{},{url:e,method:"GET"})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(t||{},{url:e,method:"GET"}))}post(e,t,i){return this._errorHandler?this._request(Object.assign(i||{},{url:e,method:"POST",data:t})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(i||{},{url:e,method:"POST",data:t}))}}class u{constructor(e){let t;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=e,t(this.reason))}))}static source(){let e;const t=new u((t=>{e=t}));return{cancel:e,token:t}}}const d=e=>new Promise(((t,i)=>{const{data:s=null,url:r,method:n="GET",headers:o,cancelToken:a,withResDate:c}=e;let u=new XMLHttpRequest;u.open(n.toUpperCase(),r,!0),u.timeout=e.timeout;const d=()=>{if(u){if(u.status>=200&&u.status<300)try{const e=JSON.parse(u.responseText);c&&(e.responseDate=new Date(u.getResponseHeader("Date")).getTime()),t(e)}catch(e){i(new Error("E_JSON_PARSE"+u.responseText))}else i({url:r,statusCode:u.status});u=null}};"onloadend"in u?u.onloadend=d:u.onreadystatechange=()=>{u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=()=>{u&&(i({url:r,statusCode:u.status,type:"request abort"}),u=null)},u.onerror=()=>{i(new Error("Network Error")),u=null},u.ontimeout=()=>{i(new Error("timeout of "+e.timeout+"ms exceeded")),u=null},"setRequestHeader"in u&&Object.keys(o).forEach((e=>{null===s&&"content-type"===e.toLowerCase()?delete o[e]:u.setRequestHeader(e,o[e])})),a&&a.promise.then((e=>{u&&(u.abort(),i(e),u=null)})),u.send(s)})),l=e=>new Promise(((t,i)=>{const{data:s=null,url:r,method:n="GET",headers:o,cancelToken:a}=e,c=wx.request({url:r,data:s,method:n.toUpperCase(),timeout:e.timeout,header:o,success(e){e.statusCode>=200&&e.statusCode<300?t(e.data):i({url:r,statusCode:e.statusCode})},fail(e){i("request:fail abort"===e.errMsg&&a&&a.reason||e)}});a&&a.promise.then((()=>{c&&c.abort()}))})),p=Array.isArray,h=e=>null==e,f=e=>"object"==typeof e&&null!==e,m=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},g=()=>{const e=[],t="0123456789abcdef";for(let i=0;i<36;i++)e[i]=t.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";return e.join("").split("-").join("")},v=(e,t)=>e?(Object.entries(e).forEach((e=>{const[i,s]=[e[0],e[1]];if(null!==s)return f(s)&&!p(s)?(t[i]||(t[i]={}),void(t[i]=v(s,t[i]))):void(t[i]=s)})),t):t,y=/-(\w)/g,b=e=>e.replace(y,((e,t)=>t?t.toUpperCase():"")),{hasOwnProperty:x}=Object.prototype,E=(e,t)=>x.call(e,t),q=(e,t=new Map)=>{if(t.get(e))return t.get(e);if(!(e instanceof Object))return e;let i;i=e instanceof Array?[]:e instanceof Function?()=>e():e instanceof RegExp?new RegExp(e.source,e.flags):e instanceof Date?new Date(e):{},t.set(e,i);for(const s in e)E(e,s)&&(i[s]=q(e[s],t));return i};var I,D,O,T,$,_;e.EVENT=void 0,(I=e.EVENT||(e.EVENT={})).REQUEST_ERROR="requestError",I.STATE="state",I.FAILED="failed",e.STATE=void 0,(D=e.STATE||(e.STATE={}))[D.CLOSE=0]="CLOSE",D[D.JOINED=1]="JOINED",D[D.READY=2]="READY",e.ENDPOINT_TYPE=void 0,(O=e.ENDPOINT_TYPE||(e.ENDPOINT_TYPE={})).WEBAPP="webApp",O.WEBCTRL="webCtrl",O.WECHATMP="weChatMP",O.SUPERVISION="supervision",O.BIGSCREEN="bigScreen",O.DESKTOP="desktop",O.MOBILE="mobile",O.VCS="vcs",O.SIP="sip",O.H323="h323",O.PSTN="pstn",e.ROLE=void 0,(T=e.ROLE||(e.ROLE={})).HOST="host",T.COHOST="coHost",T.ATTENDEE="attendee",T.AUDIENCE="audience",e.RECORD_STATUS=void 0,($=e.RECORD_STATUS||(e.RECORD_STATUS={})).STARTED="started",$.PAUSED="paused",$.STARTING="starting",$.STOPPED="stopped";class w{constructor(e,t){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"on",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"off",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=t,this.ctx=e,this.emitter=i(),this.on=this.emitter.on,this.off=this.emitter.off,this.data=new Proxy({},o(this.emitter)),this._bindOn()}cleanup(){this.emitter.all=new Map,this.data=new Proxy({},o(this.emitter))}reactive(e){if(f(e)){const t=new Map,i=(e,s)=>{Object.keys(e).forEach((r=>{!1===s&&r in this.data&&(e[r]=this.data[r]);const n=t=>e[r]=t,o=`${b(r)}Change`;this.emitter.on(o,n),t.set(o,n),f(e[r])&&!p(e[r])&&i(e[r],!0)}))};i(e,!1),e._destory=()=>{t.forEach(((e,t)=>{this.emitter.off(t,e)}))}}else console.warn("Parameter is not an object!");return e}}class S extends w{constructor(e){super(e,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(e=>{const{state:t,body:i}=e;("full"===t||"update"===t)&&v(i,this.data)})),this.ctx.emitter.on("participantCount",(e=>{const{body:t}=e;v({participantCount:t},this.data)}))}subject(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/info/subject`,e)}))}practiceSession(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/info/practiceSession`)}))}shareInfo(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/shareInfo`,{params:e})}meetings(e){if(!e)return Promise.reject();const{prefix:{ctrl:t}}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings`,{params:e})}}function A(e){const t=[],{isInLobby:i}=e.modules.me.data;return i?(t.push("lobbyMember"),t):(Object.keys(e.modules).forEach((i=>{const s=e.modules[i]._topic();s&&(Array.isArray(s)?s.forEach((e=>{t.includes(e)||t.push(e)})):t.includes(s)||t.push(s))})),t)}function U(i,s){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=s.config.request,n=yield s.request.post(`${t}meetings/${r}/subscribe`,{topics:i}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((e=>{console.log("[subscribe]",e),s.emitter.emit(e.event,e)})),s.state!==e.STATE.READY&&(s.state=e.STATE.READY,s.emitter.emit(e.EVENT.STATE,{state:s.state}))}))}function j(e,i,s){return t(this,void 0,void 0,(function*(){const{inboxes:r,clientID:n,meetingID:o,cancelToken:a,status:c}=i;yield(()=>t(this,void 0,void 0,(function*(){const t=yield e.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:r},{cancelToken:a,withResDate:!0});if(!t||!t.data)return;const{data:i={}}=t;Object.keys(i).forEach((e=>{const t=r.find((t=>t.name===e));if(t){if(t.seqId=i[e].maxSeqId,!i[e].items)return;i[e].items.forEach((e=>{const t=JSON.parse(e.content);["liveStream","recording"].includes(t.event)&&(t.stime=e.stime),s(t)}))}}))})))(),c.running&&(c.timer=setTimeout((()=>{c.running&&j(e,i,s)}),200))}))}function P(e){return t(this,void 0,void 0,(function*(){const i=A(e),{clientID:s,meetingID:r}=e.config.request,n=yield function(e,i){return t(this,void 0,void 0,(function*(){const{topics:t,clientID:s,meetingID:r}=i,n=yield e.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:s,meetingId:r},inboxes:t}),o=[];return n.data&&Object.keys(n.data).forEach((e=>{o.push({name:e,seqId:n.data[e].maxSeqId,limit:200})})),o}))}(e.request,{topics:i,clientID:s,meetingID:r});yield U(i,e),e.status.polling.running=!0,e.status.keepalive.running=!0,j(e.request,{inboxes:n,clientID:s,meetingID:r,cancelToken:e.config.request.cancelToken.token,status:e.status.polling},(t=>{e.emitter.emit(t.event,t)})),N(e)}))}function C(e){e.status.polling.running=!1,e.status.keepalive.running=!1,e.status.polling.timer&&(clearTimeout(e.status.polling.timer),e.status.polling.timer=null),e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null),e.config.request.cancelToken.cancel(),e.config.request.cancelToken=u.source()}function N(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:i},meetingID:s,userID:r}=e.config.request;e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null),yield(()=>t(this,void 0,void 0,(function*(){const t=yield e.request.post(`${i}meetings/${s}/users/${r}/keepalive`,{},{cancelToken:e.config.request.cancelToken.token});if(!t||!t.data)return;const{data:n={}}=t,o=n.interval||"";o&&(e.status.keepalive.interval=o)})))(),e.status.keepalive.running&&(e.status.keepalive.timer=setTimeout((()=>{e.status.keepalive.running&&N(e)}),1e3*e.status.keepalive.interval))}))}e.MeEvent=void 0,(_=e.MeEvent||(e.MeEvent={})).INIT="meInit",_.UPDATE="meUpdate",_.UPDATE_USER_STATE="updateUserState",_.ROLECHANGE="meRoleChange",_.AUDIOCHANGE="meAudioChange",_.HANDUPCHANGE="meHandupChange",_.SETAUDIO="setAudio",_.VIDEOCHANGE="meVideoChange",_.SETVIDEO="setVideo",_.SHARECHANGE="meShareChange",_.DISPLAYNAMECHANGE="meDisplayNameChange",_.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",_.LOBBYCHANGE="meLobbyChange",_.BARRAGECHANGE="meBarrageChange",_.LEAVE="leave";class R extends w{constructor(e){super(e,"me")}_topic(){return""}_bindOn(){const i=i=>t(this,void 0,void 0,(function*(){"role"in i&&i.role!==this.data.role&&(i.role!==e.ROLE.AUDIENCE&&this.data.role!==e.ROLE.AUDIENCE||(yield k(this.ctx),this.data.isUpdatedUserState=!1,this.emitter.emit(e.MeEvent.UPDATE_USER_STATE,{data:this.data,event:"roleChange"})),v({role:i.role},this.data),this.emitter.emit(e.MeEvent.ROLECHANGE,i.role),this.ctx.emitter.emit(e.MeEvent.ROLECHANGE,i.role))})),s=t=>{var i,s,r,n;if("audio"in t){const{deviceOn:o,sendOn:a,opBy:c}=t.audio;(!h(o)&&o!==(null===(i=this.data.audio)||void 0===i?void 0:i.deviceOn)||!h(a)&&a!==(null===(s=this.data.audio)||void 0===s?void 0:s.sendOn))&&(v({audio:t.audio},this.data),this.emitter.emit(e.MeEvent.AUDIOCHANGE,{deviceOn:h(o)?null===(r=this.data.audio)||void 0===r?void 0:r.deviceOn:o,sendOn:h(a)?null===(n=this.data.audio)||void 0===n?void 0:n.sendOn:a,opBy:c}))}},r=t=>{var i,s,r,n;if("video"in t){const{deviceOn:o,sendOn:a,opBy:c}=t.video;(!h(o)&&o!==(null===(i=this.data.video)||void 0===i?void 0:i.deviceOn)||!h(a)&&a!==(null===(s=this.data.video)||void 0===s?void 0:s.sendOn))&&(v({video:t.video},this.data),this.emitter.emit(e.MeEvent.VIDEOCHANGE,{deviceOn:h(o)?null===(r=this.data.video)||void 0===r?void 0:r.deviceOn:o,sendOn:h(a)?null===(n=this.data.video)||void 0===n?void 0:n.sendOn:a,opBy:c}))}},n=t=>{var i,s,r,n;if("share"in t){const{deviceOn:o,sendOn:a,opBy:c}=t.share;(!h(o)&&o!==(null===(i=this.data.share)||void 0===i?void 0:i.deviceOn)||!h(a)&&a!==(null===(s=this.data.share)||void 0===s?void 0:s.sendOn))&&(v({share:t.share},this.data),this.emitter.emit(e.MeEvent.SHARECHANGE,{deviceOn:h(o)?null===(r=this.data.share)||void 0===r?void 0:r.deviceOn:o,sendOn:h(a)?null===(n=this.data.share)||void 0===n?void 0:n.sendOn:a,opBy:c}))}},o=t=>{t.displayName&&t.displayName!==this.data.displayName&&(v({displayName:t.displayName},this.data),this.emitter.emit(e.MeEvent.DISPLAYNAMECHANGE,t.displayName))},a=t=>{"isHandUp"in t&&t.isHandUp!==this.data.isHandUp&&(v({isHandUp:t.isHandUp},this.data),this.emitter.emit(e.MeEvent.HANDUPCHANGE,t.isHandUp))},c=t=>{"isSpotlightVideo"in t&&(v({isSpotlightVideo:t.isSpotlightVideo},this.data),this.emitter.emit(e.MeEvent.SPOTLIGHTVIDEOCHANGE,t.isSpotlightVideo))},u=i=>t(this,void 0,void 0,(function*(){"isInLobby"in i&&i.isInLobby!==this.data.isInLobby&&(v({isInLobby:i.isInLobby},this.data),yield k(this.ctx),!1===i.isInLobby&&(this.data.isUpdatedUserState=!1,this.emitter.emit(e.MeEvent.UPDATE_USER_STATE,{data:this.data,event:"inLobbyChange"})),this.emitter.emit(e.MeEvent.LOBBYCHANGE,i.isInLobby))})),d=t=>{if(!t.barrage)return;let i=null;if(!t.barrage.wordsDisplayStatus)return i=null,delete t.barrage,this.data.barrage=i||void 0,void this.emitter.emit(e.MeEvent.BARRAGECHANGE,i);i={content:t.barrage.content,contentType:t.barrage.contentType,type:t.barrage.type,duration:t.barrage.duration,position:t.barrage.position};const{role:s}=this.data;t.barrage.receiver&&(s===e.ROLE.HOST||s===e.ROLE.COHOST?i=t.barrage.receiver.host?i:null:s===e.ROLE.ATTENDEE?i=t.barrage.receiver.attendee?i:null:s===e.ROLE.AUDIENCE&&(i=t.barrage.receiver.audience?i:null),delete t.barrage,this.data.barrage=i||void 0,this.emitter.emit(e.MeEvent.BARRAGECHANGE,i))},l=t=>{"leave"in t&&!0===t.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),C(this.ctx),F(this.ctx),this.emitter.emit(e.MeEvent.LEAVE,t.resultInfo),this.ctx.cleanup(t.resultInfo))},p=e=>{i(e),s(e),r(e),n(e),o(e),a(e),u(e),c(e),d(e),l(e)};this.ctx.emitter.on(e.MeEvent.INIT,(t=>{v(t,this.data),this.data.isUpdatedUserState=!1,this.emitter.emit(e.MeEvent.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on(e.MeEvent.UPDATE,(e=>{p(e),v(e,this.data)})),this.ctx.emitter.on("me",(e=>t(this,void 0,void 0,(function*(){const{state:t,body:i={users:[]}}=e;if("delete"===t){const e=i.users[0];return e.leave=!0,void l(e)}const s=i.users.find((e=>e.userID===this.data.userID));s&&(p(s),v(s,this.data))})))),this.ctx.emitter.on("setUserVideo",(t=>{this.emitter.emit(e.MeEvent.SETVIDEO,t.body)})),this.ctx.emitter.on("setUserAudio",(t=>{this.emitter.emit(e.MeEvent.SETAUDIO,t.body)})),this.ctx.emitter.on("meetingState",(e=>{const{body:t={}}=e;if("ended"===t.state){l({leave:!0,resultInfo:t.resultInfo})}}))}updateUserState(t,i=!1){if(!i){const{role:i,initialMediaState:s}=this.data;t.audio.sendOn=t.audio.sendOn&&s.audio.sendOn,t.video.sendOn=t.video.sendOn&&s.video.sendOn,i===e.ROLE.AUDIENCE&&(t.audio.sendOn=!1,t.video.sendOn=!1)}const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,v(t,this.data),this.ctx.request.post(`${s}meetings/${r}/updateUserState`,t)}}function k(e){return t(this,void 0,void 0,(function*(){const t=A(e),{meetingID:i,clientID:s}=e.config.request;"undefined"!=typeof Worker&&e.worker?(yield U(t,e),e.worker.postMessage({topics:t,meetingID:i,clientID:s,rePolling:!0})):(C(e),yield P(e))}))}class L extends w{constructor(e){super(e,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(e=>{const{body:t,state:i}=e;if(t&&t.users){if("full"===i)return this.data.callRecordUsers=t.users.map((e=>(e.displayNamePinyin=L.setDisplayNamePinyinProp?L.setDisplayNamePinyinProp(e.displayName||""):e.displayName,e))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);t.users.forEach((e=>{const t=this.data.callRecordUsers.findIndex((t=>e.inviteTransID===t.inviteTransID));"update"===i&&-1!==t?v(e,this.data.callRecordUsers[t]):"update"===i&&-1===t&&(e.displayNamePinyin=L.setDisplayNamePinyinProp?L.setDisplayNamePinyinProp(e.displayName||""):e.displayName,this.data.callRecordUsers.push(e))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/invite`,e)}mailTemplate(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}mailTemplate`,{params:{meetingID:i},headers:{language:e.language}})}}class M extends w{constructor(e){super(e,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:t,endpointType:i}=this.ctx.modules.me.data;return i===e.ENDPOINT_TYPE.SUPERVISION?["interactive","broadcast"]:t===e.ROLE.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const t=(t,{event:i,state:s})=>{if(t.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:r={}}=t;if("delete"!==s||"delete"===s&&[901357,901358,901352,901351,901350,901349].includes(r.bizCode||-1))return void this.ctx.emitter.emit(e.MeEvent.UPDATE,t);let n=!1;switch(i){case"interactiveUsers":t.isInLobby||(n=!0);break;case"broadcastUsers":t.isInLobby||t.role!==e.ROLE.AUDIENCE||(n=!0);break;case"lobbyUsers":t.isInLobby&&(n=!0)}const o={};n&&(o.leave=!0),this.ctx.emitter.emit(e.MeEvent.UPDATE,Object.assign(Object.assign({},t),o))},i=({updateUsers:e,state:i,sourceKey:s})=>{if("full"===i)return this.data[s]=e.map((e=>(e.displayNamePinyin=M.setDisplayNamePinyinProp?M.setDisplayNamePinyinProp(e.displayName):e.displayName,t(e,{event:s,state:i}),e))),this.emitter.emit(`${s}Change`,{users:this.data[s],isFull:!0}),this.data[s];void 0===this.data[s]&&(this.data[s]=[]);const{data:r,emitter:n}=this;return e.forEach((e=>{const o=r[s].findIndex((t=>e.userID===t.userID));if("delete"===i&&-1!==o){const[t]=this.data[s].splice(o,1);n.emit(`${s}Delete`,{user:t,resultInfo:e.resultInfo})}else if("update"===i&&-1!==o){const t=this.data[s][o];this.updateUserProps(e,t),v(e,t),this.data[s][o]=q(t),this.emitter.emit(`${s}Update`,{user:this.data[s][o]})}else"update"===i&&-1===o&&(e.displayNamePinyin=M.setDisplayNamePinyinProp?M.setDisplayNamePinyinProp(e.displayName):e.displayName,r[s].push(e),this.emitter.emit(`${s}Add`,{user:e,resultInfo:e.resultInfo}));t(e,{event:s,state:i})})),this.emitter.emit(`${s}Change`,{users:this.data[s],isFull:!1}),this.data[s]};this.ctx.emitter.on("interactiveUsers",(e=>{const{state:t,body:s}=e;i({updateUsers:s.users,state:t,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(e=>{const{state:t,body:s}=e;i({updateUsers:s.users,state:t,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(e=>{const{state:t,body:s}=e;i({updateUsers:s.users,state:t,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(e=>{const{state:t,body:s}=e;i({updateUsers:s.users,state:t,sourceKey:"advCtrlUsers"})}))}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(e,t){e.displayName&&e.displayName!==t.displayName&&(e.displayNamePinyin=M.setDisplayNamePinyinProp?M.setDisplayNamePinyinProp(e.displayName):e.displayName)}setAudio(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/audio`,t)}setVideo(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/video`,t)}setShare(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/share`,t)}setWhiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}users/${e}/whiteboard`,t)}handUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/handUp`,t)}setRole(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/role`,t)}rename(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/displayName`,t)}remove(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/users/${e}/remove`)}replyHandUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}users/${e}/replyHandUp`,t)}fecc(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/fecc`,t)}lobbyState(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/lobbyState`,t)}allowLocalRecord(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/allowLocalRecord`,t)}whiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/whiteboard`,t)}callStats(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/users/${e}/callStats`)}replyAllHandUp(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/refuseAll`)}}function H(t){const{baseURL:s,modules:r,worker:n,singleton:o}=t;r.findIndex((e=>e===R))<0&&r.push(R),r.findIndex((e=>e===S))<0&&r.push(S);const a=`${g()}_${((e=new Date,t)=>{const i={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));for(const s in i)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[s]:("00"+i[s]).substr((""+i[s]).length)));return t})(new Date,"MMddHHmmss")}`,d={config:{baseURL:s,modules:r,singleton:o||!1,request:{cancelToken:u.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1"},clientID:a,location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:n,emitter:i(),request:new c({baseURL:s,beforeRequest:e=>{e.headers["X-Y-Request-Id"]=g()},error:t=>{d.emitter.emit(e.EVENT.REQUEST_ERROR,t)}}),modules:{},state:e.STATE.CLOSE,status:{polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},cleanup:t=>{d.state!==e.STATE.CLOSE&&(d.config.request.location="",d.config.request.meetingID="",d.config.request.ctrlID="",d.config.request.sessionID="",d.config.request.userID=-1,d.config.request.voteTk="",d.status={polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},d.request.setDefaultHeader("X-Y-Location",""),d.request.setDefaultHeader("X-Y-Ctrl-Id",""),d.request.setDefaultHeader("X-Y-Session-Id",""),d.state=e.STATE.CLOSE,d.emitter.emit(e.EVENT.STATE,{state:d.state,reason:t}))}};return d}function V(t){const i=H(t);return i.worker&&("undefined"!=typeof Worker?i.worker.postMessage({baseURL:i.config.baseURL}):console.error("The current environment does not support worker")),function(e,t){if(!p(e))return void console.error("The modules parameter requires an array type");e.forEach((e=>{const i=new e(t);t.modules[i.moduleName]=i}))}(i.config.modules,i),i.emitter.on(e.EVENT.STATE,(({state:t})=>{t===e.STATE.CLOSE&&Object.keys(i.modules).forEach((e=>{i.modules[e].cleanup()}))})),Object.assign({config:i.config,request:i.request,get state(){return i.state},on:i.emitter.on,off:i.emitter.off,join:G(i),leave:B(i),end:Q(i)},i.modules)}function G(i){return function(s){var r;return t(this,void 0,void 0,(function*(){const{clientID:t}=i.config.request,n=`${null===(r=s.endpointType)||void 0===r?void 0:r.toLocaleUpperCase()}${t}_${s.meetingNum}`;i.config.request.sessionID=n,i.request.setDefaultHeader("X-Y-Session-Id",n);const{prefix:o}=i.config.request,a=yield i.request.get(`${o.ctrl}credential`,{params:{meetingNum:s.meetingNum,pwd:s.pwd,url:s.url,mobileCode:s.mobileCode,mobile:s.mobile,regEmail:s.regEmail,accEmail:s.accEmail,tk:s.tk,displayName:s.displayName},headers:{"X-Y-Endpoint-Type":s.endpointType}}),{credential:c="",location:u=""}=a&&a.data||{};if(!c)return i.emitter.emit(e.EVENT.FAILED,{bizCode:a.bizCode,data:a.data}),a;i.config.request.location=u,i.request.setDefaultHeader("X-Y-Location",u),delete s.pwd,delete s.url;const d=yield i.request.post(`${o.ctrl}join?meetingNum=${s.meetingNum}&credential=${c}`,s,{headers:{"X-Y-Endpoint-Type":s.endpointType,"X-Y-Endpoint-Id":t}});if(!d||d&&d.ret<=-1)return i.emitter.emit(e.EVENT.FAILED,{bizCode:d.bizCode,data:d.data}),d;const{meetingID:l="",ctrlID:p="",user:h={},mediaContent:f={},initialMediaState:m={},tk:g=""}=d.data;if(i.config.request.meetingID=l,i.config.request.ctrlID=p,i.config.request.userID=h.userID,i.config.request.voteTk=g,i.request.setDefaultHeader("X-Y-Ctrl-Id",p),i.emitter.emit(e.MeEvent.INIT,Object.assign(Object.assign({},h),{mediaContent:f,initialMediaState:m})),i.state=e.STATE.JOINED,i.emitter.emit(e.EVENT.STATE,{state:i.state}),"undefined"!=typeof Worker&&i.worker){const e=A(i);yield U(e,i),i.status.keepalive.running=!0,N(i),i.worker.postMessage({topics:e,meetingID:l,clientID:t,status:!0}),i.worker.onmessage=e=>{console.log("[Polling]",e.data),i.emitter.emit(e.data.event,e.data)}}else yield P(i);return d.data=Object.assign(Object.assign({},d.data),a.data),d}))}}function B(e){return function(i){return t(this,void 0,void 0,(function*(){i||(i={resultInfo:{bizCode:901359}});const{prefix:t,meetingID:s}=e.config.request,r=yield e.request.post(`${t.ctrl}meetings/${s}/leave`,i);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),C(e),F(e),e.cleanup(),r}))}}function Q(e){return function(){return t(this,void 0,void 0,(function*(){const{prefix:t,meetingID:i}=e.config.request,s=yield e.request.post(`${t.ctrl}meetings/${i}/end`);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),C(e),F(e),e.cleanup(),s}))}}class Y{constructor(e){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=V(e)}static getInstance(e){return this.instance?this.instance:this.instance=new Y(e)}}function F(e){if(e.config.singleton){const{baseURL:t,modules:i,singleton:s}=e.config,r={baseURL:t,modules:i,worker:e.worker,singleton:s},n=Y.getInstance(r);n&&(n.meeting=V(r))}}return Object.defineProperty(Y,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),e.Chat=class extends w{constructor(e){super(e,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(e=>{const{body:t}=e;this.emitter.emit("chatMsg",t)}))}msg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/chat/msg`,e)}))}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/chat/historyMsg`,e)}))}},e.Info=S,e.Invite=L,e.LiveStream=class extends w{constructor(e){super(e,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(e=>{var t;const{state:i,body:s,stime:r}=e;if(s){if(r&&(this.data.jetlag=r),"full"===i){const{liveStreams:e=[]}=s;if(!e.length)return;this.data.status=[],this.data.liveStreams=e.map((e=>(e.requesting="starting"===e.status,this.data.status.push({platform:e.platform||"",status:(e.requesting?"stopped":e.status)||""}),e)));return v({status:this.data.status,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),s.liveStreams||(this.data.resultInfo={}),null===(t=s.liveStreams)||void 0===t||t.forEach((e=>{this.data.resultInfo=e.resultInfo||{};let t=this.data.liveStreams.findIndex((t=>t.platform===e.platform));-1===t?(e.requesting="starting"===e.status,this.data.liveStreams.push(e)):(e.requesting="starting"===e.status,e=Object.assign(Object.assign({},this.data.liveStreams[t]),e),this.data.liveStreams.splice(t,1,e)),t=this.data.status.findIndex((t=>t.platform===e.platform)),-1===t?this.data.status.push({platform:e.platform||"",status:e.requesting?"stopped":e.status||""}):this.data.status.splice(t,1,{platform:this.data.status[t].platform||"",status:e.requesting?this.data.status[t].status||"stopped":e.status||""})})),this.data}}))}setStatus(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/liveStream/status`,e)}))}liveStreamDescription(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/liveStream/description`,e)}))}liveStreamSetting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/liveStream/setting`,e)}))}},e.Me=R,e.Qa=class extends w{constructor(e){super(e,"qa"),this.data={questions:new Map,topSort:0}}_topic(){return"qa"}_bindOn(){this.ctx.emitter.on("qa",(e=>{const{body:t}=e;f(t)&&!p(t)?this.qaUpdate(this.data.questions,t):t.forEach((e=>this.qaUpdate(this.data.questions,e)))}))}qaUpdate(e,t){let i=e.get(t.question.id);const{clientID:s}=this.ctx.config.request;switch(t.command){case"addQuestion":i=this.createQuestion(t.question),e.set(t.question.id,i),this.emitter.emit("QuestionAdd",{question:i,selfSent:i.sender.endpointID===s});break;case"dismissQuestion":if(!i)break;i.sender.endpointID!==s?i.status="close":i.isTop=!1,this.emitter.emit("QuestionUpdate",{question:i}),e.set(t.question.id,i);break;case"reopenQuestion":i?(i.status="open",i.isTop=t.question.isTop,e.set(t.question.id,i)):(i=this.createQuestion(t.question),e.set(t.question.id,i)),this.emitter.emit("QuestionUpdate",{question:i});break;case"updateQuestion":i?e.set(t.question.id,Object.assign(Object.assign(Object.assign({},i),t.question),{topSort:t.question.isTop?this.data.topSort++:0})):(i=this.createQuestion(t.question),e.set(t.question.id,i)),this.emitter.emit("QuestionUpdate",{question:i});break;case"deleteQuestion":if(!i)break;i.sender.endpointID!==s?e.delete(t.question.id):(i.status="delete",i.isTop=!1,i.answers.clear(),e.set(t.question.id,i)),this.emitter.emit("QuestionDelete",{question:i});break;case"answerQuestion":i?i.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)):(i=this.createQuestion(t.question),i.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)),e.set(t.question.id,i)),this.emitter.emit("QuestionDelete",{question:i});break;case"deleteAnswer":i&&(i.answers.delete(t.answer.id),this.emitter.emit("QuestionDelete",{question:i}))}this.emitter.emit("QuestionChange",{questions:this.data.questions})}createQuestion(e){return{isAnonymous:e.isAnonymous,isTop:e.isTop,id:e.id,content:e.content,sender:e.sender,timestamp:e.timestamp||-1,status:e.status||"open",answers:new Map,topSort:0}}createQuestionAnswer(e){return{isPrivate:e.isPrivate,content:e.content,id:e.id,sender:e.sender,timestamp:e.timestamp||-1}}qa(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/qa`,e)}))}},e.Recording=class extends w{constructor(e){super(e,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(e=>{const{state:t,body:i,stime:s}=e;if(i)return s&&(this.data.jetlag=s),this.data.isPracticeSession="started"===i.status&&this.data.status===i.status&&0===i.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),i),"starting"===i.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=i.status||this.data.status),this.data.resultInfo=i.resultInfo||{},["full","update"].includes(t)?(i.recordUsers&&(this.data.recording.recordUsers=i.recordUsers),this.data):void 0}))}history(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.get(`${e}meetings/${t}/recording/history`)}))}status(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/recording/status`,e)}))}layout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/recording/status`,e)}))}designatedUsers(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/recording/designatedUsers`,e)}))}participantAdd(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/recording/participant/add`,e)}))}participantDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/recording/participant/delete`,e)}))}getTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getTemplates`,{params:e})}))}getByIds(e){return t(this,void 0,void 0,(function*(){const{prefix:{user:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/subject/getByIds`,e)}))}recordLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/recording/layout`,e)}))}},e.Setting=class extends w{constructor(e){super(e,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(e=>{const{state:t,body:i}=e;["full","update"].includes(t)&&v(i,this.data)}))}setting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/setting`,e)}))}muteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/muteAll`)}))}unmuteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/unmuteAll`)}))}},e.SpotlightVideo=class extends w{constructor(e){super(e,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(t=>{const{body:i}=t;if(!i||!i.userIDs)return;this.data.userIDs=i.userIDs;i.userIDs.findIndex((e=>e===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(e.MeEvent.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(e.MeEvent.UPDATE,{isSpotlightVideo:!1})}))}spotlight(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/view/spotlight`,e)}},e.Users=M,e.View=class extends w{constructor(e){super(e,"view")}_topic(){return["hostAttendee","audience","advCtrl"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((e=>{this.ctx.emitter.on(e,(t=>{"personalView"!==e?this.updateLayout(t,e):this.updatePersonalLayouts(t)}))}))}updateLayout(e,t){const{event:i,body:s}=e;s&&("meetingView"===i?Object.keys(s).forEach((e=>{this.data[e]=s[e]})):this.data[t]=s)}updatePersonalLayouts(e){const{state:t,body:i}=e;"full"!==t&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),i.personalLayouts.forEach((e=>{const{subscriber:i={userID:-1}}=e,s=i.userID||i.subjectID||-1;"full"===t||"update"===t||e.templateStatus?this.data.personalLayouts[s]=e:delete this.data.personalLayouts[s]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/hostLayout`,e)}))}attendeeLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/attendeeLayout`,e)}))}audienceLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/audienceLayout`,e)}))}personalLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/personalLayout`,e)}))}personalLayoutDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/personalLayout/delete`,e)}))}virtualClassLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/virtualClass/layout`,e)}))}closeVirtualClass(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/view/virtualClass/close`)}))}getVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/layout/template/info`,{params:e})}))}addVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/layout/template/add`,e)}))}editVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/layout/template/edit`,e)}))}getTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getTemplates`,{params:e})}))}editTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/edit`,e)}))}addTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/add`,e)}))}deleteTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/delete`,e)}))}getDefaultTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getDefaultTemplates`,{params:e})}))}changeDefaultTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/changeDefaultTemplate`,e)}))}perspectiveBind(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/perspective/bind`,e)}))}},e.Vote=class extends w{constructor(e){super(e,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(e=>{const{body:t}=e,{voteID:i}=t;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[i]=t,this.emitter.emit("voteChange",this.data.vote)}))}getVotes(e){const{prefix:{vote:t},meetingID:i,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}meetings/${i}/votes`,{params:e})}getVote(e){const{prefix:{vote:t},meetingID:i,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}meetings/${i}/vote`,{params:e})}getMeVote(e){const{prefix:{vote:t},meetingID:i,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}meetings/${i}/vote/me`,{params:e})}voteStatus(e,t){const{prefix:{vote:i},meetingID:s,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.post(`${i}meetings/${s}/vote/status?tk=${e.tk}&voteID=${e.voteID}`,t)}voteSubmit(e,t){const{prefix:{vote:i},meetingID:s,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.post(`${i}meetings/${s}/vote/submit?tk=${e.tk}&voteID=${e.voteID}`,t)}voteAdd(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/add`,e)}voteEdit(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/edit`,e)}voteDelete(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/delete`,e)}voteInProgress(e){const{prefix:{vote:t},meetingID:i,voteTk:s}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/vote/inProgress`,{params:{tk:e&&e.tk||s}})}},e.Words=class extends w{constructor(e){super(e,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(t=>{this.data.timer&&clearTimeout(this.data.timer);const{state:i,body:s}=t;if(!s)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data});"full"===i&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),this.data.barrageRecord=[{content:s.content,time:(new Date).getTime(),durationType:s.durationType,duration:1e3*s.duration},...this.data.barrageRecord],s.wordsDisplayStatus=!0,-1!==s.duration&&(this.data.timer=setTimeout((()=>{s.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=s.wordsDisplayStatus,this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data})}),1e3*s.duration)),v(s,this.data),this.emitter.emit("barrageRecordChange",this.data.barrageRecord),this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(e.MeEvent.ROLECHANGE,(()=>this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data})))}barrage(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/barrage`,e)}))}deleteBarrage(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/deleteBarrage`)}))}},e.createMeeting=function(e){return e.singleton?Y.getInstance(e).meeting:V(e)},e.reset=F,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
@@ -1 +1 @@
1
- "use strict";function e(e,t,n,s){return new(n||(n=Promise))((function(r,o){function a(e){try{u(s.next(e))}catch(t){o(t)}}function i(e){try{u(s.throw(e))}catch(t){o(t)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,i)}u((s=s.apply(e,t||[])).next())}))}const t=e=>encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class n{constructor(e){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=e.baseURL,this._beforeRequest=e.beforeRequest,this._errorHandler=e.error}_request(e){const{url:n="",timeout:s=6e4}=e;let{headers:i={}}=e;return e.url=this.baseURL.replace(/\/+$/,"")+"/"+((e,n)=>{if(!n)return e;const s=[];Object.keys(n).forEach((e=>{const r=n[e];if(null==r)return;let o;Array.isArray(r)?(o=r,e+="[]"):o=[r],o.forEach((n=>{null!==n&&"object"==typeof n&&(n=JSON.stringify(n)),s.push(`${t(e)}=${t(n)}`)}))}));const r=s.join("&");if(r){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e})(n.replace(/^\/+/,""),e.params),i=Object.assign(i,this._defaultHeaders),Object.keys(i).forEach((e=>{"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(i["Content-Type"]=i[e],delete i[e])})),a(e.data)&&(i&&!i["Content-Type"]&&(i["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=i,e.timeout=s,this._beforeRequest&&this._beforeRequest(e),"undefined"!=typeof wx?o(e):r(e)}setDefaultHeader(e,t){e in this._defaultHeaders&&(""===t||null===t)?delete this._defaultHeaders[e]:this._defaultHeaders[e]=t}get(e,t){return this._errorHandler?this._request(Object.assign(t||{},{url:e,method:"GET"})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(t||{},{url:e,method:"GET"}))}post(e,t,n){return this._errorHandler?this._request(Object.assign(n||{},{url:e,method:"POST",data:t})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(n||{},{url:e,method:"POST",data:t}))}}class s{constructor(e){let t;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=e,t(this.reason))}))}static source(){let e;const t=new s((t=>{e=t}));return{cancel:e,token:t}}}const r=e=>new Promise(((t,n)=>{const{data:s=null,url:r,method:o="GET",headers:a,cancelToken:i,withResDate:u}=e;let c=new XMLHttpRequest;c.open(o.toUpperCase(),r,!0),c.timeout=e.timeout;const l=()=>{if(c){if(c.status>=200&&c.status<300)try{const e=JSON.parse(c.responseText);u&&(e.responseDate=new Date(c.getResponseHeader("Date")).getTime()),t(e)}catch(e){n(new Error("E_JSON_PARSE"+c.responseText))}else n({url:r,statusCode:c.status});c=null}};"onloadend"in c?c.onloadend=l:c.onreadystatechange=()=>{c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(l)},c.onabort=()=>{c&&(n({url:r,statusCode:c.status,type:"request abort"}),c=null)},c.onerror=()=>{n(new Error("Network Error")),c=null},c.ontimeout=()=>{n(new Error("timeout of "+e.timeout+"ms exceeded")),c=null},"setRequestHeader"in c&&Object.keys(a).forEach((e=>{null===s&&"content-type"===e.toLowerCase()?delete a[e]:c.setRequestHeader(e,a[e])})),i&&i.promise.then((e=>{c&&(c.abort(),n(e),c=null)})),c.send(s)})),o=e=>new Promise(((t,n)=>{const{data:s=null,url:r,method:o="GET",headers:a,cancelToken:i}=e,u=wx.request({url:r,data:s,method:o.toUpperCase(),timeout:e.timeout,header:a,success(e){e.statusCode>=200&&e.statusCode<300?t(e.data):n({url:r,statusCode:e.statusCode})},fail(e){n("request:fail abort"===e.errMsg&&i&&i.reason||e)}});i&&i.promise.then((()=>{u&&u.abort()}))})),a=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype};function i(t,n,s){return e(this,void 0,void 0,(function*(){const{inboxes:r,sessionID:o,meetingID:a,cancelToken:u,status:c}=n;yield(()=>e(this,void 0,void 0,(function*(){const e=yield t.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:o,meetingId:a},inboxes:r},{cancelToken:u,withResDate:!0});if(!e||!e.data)return;const{data:n={}}=e;Object.keys(n).forEach((e=>{const t=r.find((t=>t.name===e));if(t){if(t.seqId=n[e].maxSeqId,!n[e].items)return;n[e].items.forEach((e=>{const t=JSON.parse(e.content);["liveStream","recording"].includes(t.event)&&(t.stime=e.stime),s(t)}))}}))})))(),c.running&&(c.timer=setTimeout((()=>{c.running&&i(t,n,s)}),200))}))}const u=self;let c,l=s.source(),d="",h=[],p="",f="";const b={running:!1,timer:null};function m(){return e(this,void 0,void 0,(function*(){c=new n({baseURL:d});const t=yield function(t,n){return e(this,void 0,void 0,(function*(){const{topics:e,sessionID:s,meetingID:r}=n,o=yield t.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:s,meetingId:r},inboxes:e}),a=[];return o.data&&Object.keys(o.data).forEach((e=>{a.push({name:e,seqId:o.data[e].maxSeqId,limit:200})})),a}))}(c,{topics:h,sessionID:p,meetingID:f});b.running=!0,i(c,{inboxes:t,sessionID:p,meetingID:f,cancelToken:l.token,status:b},(e=>{u.postMessage(e)}))}))}function g(){b.running=!1,b.timer&&(clearTimeout(b.timer),b.timer=null),l.cancel(),l=s.source()}u.addEventListener("message",(e=>{"baseURL"in e.data&&(d=e.data.baseURL),"topics"in e.data&&(h=e.data.topics),"sessionID"in e.data&&(p=e.data.sessionID),"meetingID"in e.data&&(f=e.data.meetingID),"rePolling"in e.data&&(g(),m()),"status"in e.data&&(e.data.status?m():g())}),!1);
1
+ "use strict";function e(e,t,n,r){return new(n||(n=Promise))((function(s,a){function o(e){try{c(r.next(e))}catch(t){a(t)}}function i(e){try{c(r.throw(e))}catch(t){a(t)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,i)}c((r=r.apply(e,t||[])).next())}))}const t=e=>encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class n{constructor(e){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=e.baseURL,this._beforeRequest=e.beforeRequest,this._errorHandler=e.error}_request(e){const{url:n="",timeout:r=6e4}=e;let{headers:i={}}=e;return e.url=this.baseURL.replace(/\/+$/,"")+"/"+((e,n)=>{if(!n)return e;const r=[];Object.keys(n).forEach((e=>{const s=n[e];if(null==s)return;let a;Array.isArray(s)?(a=s,e+="[]"):a=[s],a.forEach((n=>{null!==n&&"object"==typeof n&&(n=JSON.stringify(n)),r.push(`${t(e)}=${t(n)}`)}))}));const s=r.join("&");if(s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e})(n.replace(/^\/+/,""),e.params),i=Object.assign(i,this._defaultHeaders),Object.keys(i).forEach((e=>{"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(i["Content-Type"]=i[e],delete i[e])})),o(e.data)&&(i&&!i["Content-Type"]&&(i["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=i,e.timeout=r,this._beforeRequest&&this._beforeRequest(e),"undefined"!=typeof wx?a(e):s(e)}setDefaultHeader(e,t){e in this._defaultHeaders&&(""===t||null===t)?delete this._defaultHeaders[e]:this._defaultHeaders[e]=t}get(e,t){return this._errorHandler?this._request(Object.assign(t||{},{url:e,method:"GET"})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(t||{},{url:e,method:"GET"}))}post(e,t,n){return this._errorHandler?this._request(Object.assign(n||{},{url:e,method:"POST",data:t})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(n||{},{url:e,method:"POST",data:t}))}}class r{constructor(e){let t;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=e,t(this.reason))}))}static source(){let e;const t=new r((t=>{e=t}));return{cancel:e,token:t}}}const s=e=>new Promise(((t,n)=>{const{data:r=null,url:s,method:a="GET",headers:o,cancelToken:i,withResDate:c}=e;let u=new XMLHttpRequest;u.open(a.toUpperCase(),s,!0),u.timeout=e.timeout;const l=()=>{if(u){if(u.status>=200&&u.status<300)try{const e=JSON.parse(u.responseText);c&&(e.responseDate=new Date(u.getResponseHeader("Date")).getTime()),t(e)}catch(e){n(new Error("E_JSON_PARSE"+u.responseText))}else n({url:s,statusCode:u.status});u=null}};"onloadend"in u?u.onloadend=l:u.onreadystatechange=()=>{u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(l)},u.onabort=()=>{u&&(n({url:s,statusCode:u.status,type:"request abort"}),u=null)},u.onerror=()=>{n(new Error("Network Error")),u=null},u.ontimeout=()=>{n(new Error("timeout of "+e.timeout+"ms exceeded")),u=null},"setRequestHeader"in u&&Object.keys(o).forEach((e=>{null===r&&"content-type"===e.toLowerCase()?delete o[e]:u.setRequestHeader(e,o[e])})),i&&i.promise.then((e=>{u&&(u.abort(),n(e),u=null)})),u.send(r)})),a=e=>new Promise(((t,n)=>{const{data:r=null,url:s,method:a="GET",headers:o,cancelToken:i}=e,c=wx.request({url:s,data:r,method:a.toUpperCase(),timeout:e.timeout,header:o,success(e){e.statusCode>=200&&e.statusCode<300?t(e.data):n({url:s,statusCode:e.statusCode})},fail(e){n("request:fail abort"===e.errMsg&&i&&i.reason||e)}});i&&i.promise.then((()=>{c&&c.abort()}))})),o=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype};function i(t,n,r){return e(this,void 0,void 0,(function*(){const{inboxes:s,clientID:a,meetingID:o,cancelToken:c,status:u}=n;yield(()=>e(this,void 0,void 0,(function*(){const e=yield t.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:a,meetingId:o},inboxes:s},{cancelToken:c,withResDate:!0});if(!e||!e.data)return;const{data:n={}}=e;Object.keys(n).forEach((e=>{const t=s.find((t=>t.name===e));if(t){if(t.seqId=n[e].maxSeqId,!n[e].items)return;n[e].items.forEach((e=>{const t=JSON.parse(e.content);["liveStream","recording"].includes(t.event)&&(t.stime=e.stime),r(t)}))}}))})))(),u.running&&(u.timer=setTimeout((()=>{u.running&&i(t,n,r)}),200))}))}const c=self;let u,l=r.source(),d="",h=[],p="",f="";const b={running:!1,timer:null};function m(){return e(this,void 0,void 0,(function*(){u=new n({baseURL:d});const t=yield function(t,n){return e(this,void 0,void 0,(function*(){const{topics:e,clientID:r,meetingID:s}=n,a=yield t.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:r,meetingId:s},inboxes:e}),o=[];return a.data&&Object.keys(a.data).forEach((e=>{o.push({name:e,seqId:a.data[e].maxSeqId,limit:200})})),o}))}(u,{topics:h,clientID:p,meetingID:f});b.running=!0,i(u,{inboxes:t,clientID:p,meetingID:f,cancelToken:l.token,status:b},(e=>{c.postMessage(e)}))}))}function g(){b.running=!1,b.timer&&(clearTimeout(b.timer),b.timer=null),l.cancel(),l=r.source()}c.addEventListener("message",(e=>{"baseURL"in e.data&&(d=e.data.baseURL),"topics"in e.data&&(h=e.data.topics),"clientID"in e.data&&(p=e.data.clientID),"meetingID"in e.data&&(f=e.data.meetingID),"rePolling"in e.data&&(g(),m()),"status"in e.data&&(e.data.status?m():g())}),!1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ylink-sdk/meeting",
3
- "version": "0.2.0-beta.1",
3
+ "version": "0.2.0-beta.4",
4
4
  "description": "Meeting control of yealink",
5
5
  "main": "index.js",
6
6
  "module": "dist/meeting.esm.prod.js",