@ylink-sdk/meeting 0.2.0-beta.9 → 0.2.2

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
- 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]",$="[object Int16Array]",E="[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[$]=U[E]=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 B(e){var t=-1,i=Array(e.size);return e.forEach((function(e,s){i[++t]=[s,e]})),i}function G(e,t){return function(i){return e(t(i))}}function Y(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i}var Q,F=Array.prototype,W=Function.prototype,X=Object.prototype,z=C["__core-js_shared__"],J=(Q=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Q:"",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=G(Object.getPrototypeOf,Object),oe=Object.create,ae=X.propertyIsEnumerable,ce=F.splice,ue=Object.getOwnPropertySymbols,de=ie?ie.isBuffer:void 0,le=G(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,$e=De?De.valueOf:void 0;function Ee(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=Ge(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 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)&&Be(s,i)&&(void 0!==i||t in e)||(e[t]=i)}function Se(e,t){for(var i=e.length;i--;)if(Be(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=Ge(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(Qe(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 $:case E: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(B(e),!0):B(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(Y(e),!0):Y(e),H,new e.constructor)}(e,s,i);case v:return n=e,$e?Object($e.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 Ge(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}Ee.prototype.clear=function(){this.__data__=ve?ve(null):{}},Ee.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Ee.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},Ee.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Z.call(t,e)},Ee.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 Ee,map:new(he||Oe),string:new Ee}},_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?G(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 Be(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 Ge=Array.isArray;function Ye(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!Fe(e)}var Qe=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 Ye(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"}($||($={})),function(e){e.HOST="host",e.COHOST="coHost",e.ATTENDEE="attendee",e.AUDIENCE="audience"}(E||(E={})),function(e){e.STARTED="started",e.PAUSED="paused",e.STARTING="starting",e.STOPPED="stopped"}(O||(O={}));class _{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 w extends _{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})}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}})}}function T(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 A(t,i){return e(this,void 0,void 0,(function*(){const{meetingID:e,clientID:s}=i.config.request,r=yield i.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:s,meetingId:e},inboxes:t}),n=[];return r.data&&Object.keys(r.data).forEach((e=>{n.push({name:e,seqId:r.data[e].maxSeqId,limit:200})})),n}))}function S(t,i){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s,clientID:r}=i.config.request,n=yield i.request.post(`${e}meetings/${s}/subscribe`,{endpointID:r,topics:t}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((e=>{console.log("[subscribe]",e),i.emitter.emit(e.event,e)}))}))}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))}))}const U=(t,i)=>e(void 0,void 0,void 0,(function*(){const{meetingID:e,clientID:s}=i.config.request;i.status.polling.running=!0,j(i.request,{inboxes:t,clientID:s,meetingID:e,cancelToken:i.config.request.cancelToken.token,status:i.status.polling},(e=>{i.emitter.emit(e.event,e)}))}));function P(e){e.status.polling.running=!1,e.status.polling.timer&&(clearTimeout(e.status.polling.timer),e.status.polling.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))}))}const k=e=>{e.status.keepalive.running=!1,e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null)};var N;!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"}(N||(N={}));class R extends _{constructor(e){super(e,"me")}_topic(){return""}_bindOn(){const t=t=>e(this,void 0,void 0,(function*(){if("role"in t&&t.role!==this.data.role){const e=this.data.role;g({role:t.role},this.data),t.role!==E.AUDIENCE&&e!==E.AUDIENCE||(yield this.rePolling("roleChange")),this.emitter.emit(N.ROLECHANGE,t.role),this.ctx.emitter.emit(N.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)||!p(a))&&(g({audio:e.audio},this.data),this.emitter.emit(N.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(N.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(N.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(N.DISPLAYNAMECHANGE,e.displayName))},o=e=>{"isHandUp"in e&&e.isHandUp!==this.data.isHandUp&&(g({isHandUp:e.isHandUp},this.data),this.emitter.emit(N.HANDUPCHANGE,e.isHandUp))},a=e=>{"isSpotlightVideo"in e&&(g({isSpotlightVideo:e.isSpotlightVideo},this.data),this.emitter.emit(N.SPOTLIGHTVIDEOCHANGE,e.isSpotlightVideo))},c=t=>e(this,void 0,void 0,(function*(){if("isInLobby"in t&&t.isInLobby!==this.data.isInLobby){g({isInLobby:t.isInLobby},this.data);const e=!1===t.isInLobby?"inLobbyChange":void 0;yield this.rePolling(e),this.emitter.emit(N.LOBBYCHANGE,t.isInLobby),this.ctx.emitter.emit(N.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(N.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===E.HOST||i===E.COHOST?t=e.barrage.receiver.host?t:null:i===E.ATTENDEE?t=e.barrage.receiver.attendee?t:null:i===E.AUDIENCE&&(t=e.barrage.receiver.audience?t:null),delete e.barrage,this.data.barrage=t||void 0,this.emitter.emit(N.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),ne(this.ctx),this.emitter.emit(N.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(N.INIT,(e=>{g(e,this.data),this.data.isUpdatedUserState=!1})),this.ctx.emitter.on(N.UPDATE,(e=>{l(e),g(e,this.data)})),this.ctx.emitter.on(I.STATE,(({state:e})=>{e===D.READY&&this.data.endpointType!==$.SUPERVISION&&this.emitter.emit(N.UPDATE_USER_STATE,{data: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(N.SETVIDEO,e.body)})),this.ctx.emitter.on("setUserAudio",(e=>{this.emitter.emit(N.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===E.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)}rePolling(t){return e(this,void 0,void 0,(function*(){const{ctx:e}=this;P(e);const i=T(e),s=yield A(i,e);if(t&&this.emitter.emit(N.UPDATE_USER_STATE,{data:this.data,event:t}),yield S(i,e),"undefined"!=typeof Worker&&e.worker){const{meetingID:t,clientID:r}=e.config.request;e.worker.postMessage({inboxes:s,topics:i,meetingID:t,clientID:r,rePolling:!0})}else yield U(s,e)}))}}class L 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: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 H extends _{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=H.setDisplayNamePinyinProp?H.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=H.setDisplayNamePinyinProp?H.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)}}class M extends _{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;const t=[];this.data.liveStreams=e.map((e=>(e.requesting="starting"===e.status,t.push({platform:e.platform||"",status:(e.requesting?"stopped":e.status)||""}),e)));return g({status:t,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));const i=this.data.status.map((e=>e));-1===t?i.push({platform:e.platform||"",status:e.requesting?"stopped":e.status||""}):i.splice(t,1,{platform:i[t].platform||"",status:e.requesting?i[t].status||"stopped":e.status||""}),this.data.status=i})),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 V 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)))}))}cleanup(){this.data={questions:new Map,topSort:0}}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,e.set(t.question.id,i),this.emitter.emit("questionUpdate",{question: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?(i=Object.assign(Object.assign(Object.assign({},i),t.question),{topSort:t.question.isTop?this.data.topSort++:0}),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"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("questionUpdate",{question:i});break;case"deleteAnswer":i&&(i.answers.delete(t.answer.id),this.emitter.emit("questionUpdate",{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 B extends _{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 _{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 Y 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(N.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(N.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 _{constructor(e){super(e,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:e,endpointType:t}=this.ctx.modules.me.data;return t===$.SUPERVISION?["interactive","broadcast"]:e===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(N.UPDATE,e);let r=!1;switch(t){case"interactiveUsers":e.isInLobby||(r=!0);break;case"broadcastUsers":e.isInLobby||e.role!==E.AUDIENCE||(r=!0);break;case"lobbyUsers":e.isInLobby&&(r=!0)}const n={};r&&(n.leave=!0),this.ctx.emitter.emit(N.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`)}callStatsReport(e){if(!e.userID)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/users/${e.userID}/callStats/report`,e)}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 F extends _{constructor(e){super(e,"view")}_topic(){const{endpointType:e,role:t}=this.ctx.modules.me.data;return e===$.WEBCTRL?["hostAttendee","audience","advCtrl"]:t===E.AUDIENCE?["audience"]:["hostAttendee","audience"]}_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 W extends _{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",{vote:this.data.vote,changeData:t})})),this.ctx.emitter.on(N.LOBBYCHANGE,(e=>{e&&(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 X 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:i}=e;if(!i)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(N.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(N.UPDATE,{barrage:this.data})}),1e3*i.duration)),g(i,this.data),this.emitter.emit("barrageRecordChange",this.data.barrageRecord),this.ctx.emitter.emit(N.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(N.ROLECHANGE,(()=>this.ctx.emitter.emit(N.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`)}))}}class z extends _{constructor(e){super(e,"transcript")}_topic(){return"transcript"}_bindOn(){this.ctx.emitter.on("transcriptMsg",(e=>{const{body:t}=e;this.emitter.emit("transcriptMsg",t)}))}cleanup(){this.emitter.all=new Map}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}/transcript/historyMsg`,t)}))}}function J(e){const{baseURL:i,modules:s,worker:r,singleton:n}=e;s.findIndex((e=>e===R))<0&&s.push(R),s.findIndex((e=>e===w))<0&&s.push(w);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.worker&&u.worker.terminate(),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 K(e){const t=J(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:Z(t),leave:ee(t),end:te(t),endMeeting:ie(t)},t.modules)}function Z(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;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(N.INIT,Object.assign(Object.assign({},p),{mediaContent:h,initialMediaState:f})),t.state=D.JOINED,t.emitter.emit(I.STATE,{state:t.state});const g=()=>{t.state!==D.READY&&(t.state=D.READY,t.emitter.emit(I.STATE,{state:t.state}))},v=T(t),y=yield A(v,t);return yield S(v,t),"undefined"!=typeof Worker&&t.worker?(t.status.polling.running=!0,t.worker.postMessage({topics:v,meetingID:d,clientID:e,inboxes:y,status:!0}),t.worker.onmessage=e=>{"pollingStarted"!==e.data?"pollingStopped"!==e.data?(console.log("[Polling]",e.data),t.emitter.emit(e.data.event,e.data)):t.status.polling.running=!1:g()}):(t.status.polling.running=!0,U(y,t),g()),t.status.keepalive.running=!0,C(t),u.data=Object.assign(Object.assign({},u.data),o.data),u}))}}function ee(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),k(t),ne(t),t.cleanup(),r}))}}function te(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),k(t),ne(t),t.cleanup(),s}))}}function ie(t){return function(i){return e(this,void 0,void 0,(function*(){const{prefix:e}=t.config.request;return yield t.request.post(`${e.ctrl}meetingNum/${i}/end`)}))}}class se{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 se(e)}}function re(e){return e.singleton?se.getInstance(e).meeting:K(e)}function ne(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=se.getInstance(r);n&&(n.meeting=K(r))}}Object.defineProperty(se,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null});export{L as Chat,$ as ENDPOINT_TYPE,I as EVENT,w as Info,H as Invite,M as LiveStream,R as Me,N as MeEvent,V as Qa,O as RECORD_STATUS,E as ROLE,B as Recording,D as STATE,G as Setting,Y as SpotlightVideo,z as Transcript,Q as Users,F as View,W as Vote,X as Words,re as createMeeting,ne as reset};
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]",q="[object Float32Array]",I="[object Float64Array]",D="[object Int8Array]",E="[object Int16Array]",$="[object Int32Array]",O="[object Uint8Array]",_="[object Uint8ClampedArray]",w="[object Uint16Array]",A="[object Uint32Array]",T=/\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[A]=!0,U["[object Error]"]=U[c]=U[y]=!1;var P="object"==typeof self&&self&&self.Object===Object&&self,k="object"==typeof r&&r&&r.Object===Object&&r||P||Function("return this")(),C=e&&!e.nodeType&&e,N=C&&t&&!t.nodeType&&t,R=N&&N.exports===C;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 B(t){var e=-1,r=Array(t.size);return t.forEach((function(t,i){r[++e]=[i,t]})),r}function G(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 Q,F=Array.prototype,W=Function.prototype,z=Object.prototype,X=k["__core-js_shared__"],J=(Q=/[^.]+$/.exec(X&&X.keys&&X.keys.IE_PROTO||""))?"Symbol(src)_1."+Q:"",K=W.toString,Z=z.hasOwnProperty,tt=z.toString,et=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=R?k.Buffer:void 0,it=k.Symbol,st=k.Uint8Array,nt=G(Object.getPrototypeOf,Object),ot=Object.create,at=z.propertyIsEnumerable,ct=F.splice,ut=Object.getOwnPropertySymbols,dt=rt?rt.isBuffer:void 0,lt=G(Object.keys,Object),pt=Nt(k,"DataView"),ht=Nt(k,"Map"),ft=Nt(k,"Promise"),mt=Nt(k,"Set"),gt=Nt(k,"WeakMap"),vt=Nt(Object,"create"),yt=Vt(pt),bt=Vt(ht),xt=Vt(ft),qt=Vt(mt),It=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 wt(t){this.__data__=new Ot(t)}function At(t,e){var r=Gt(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 Tt(t,e,r){var i=t[e];Z.call(t,e)&&Bt(i,r)&&(void 0!==r||e in t)||(t[e]=r)}function St(t,e){for(var r=t.length;r--;)if(Bt(t[r][0],e))return r;return-1}function jt(t,e,r,i,s,h,y){var S;if(i&&(S=h?i(t,s,h,y):i(t)),void 0!==S)return S;if(!Wt(t))return t;var j=Gt(t);if(j){if(S=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,S)}else{var P=Lt(t),k=P==c||P==u;if(Qt(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||k&&!h){if(V(t))return h?t:{};if(S=function(t){return"function"!=typeof t.constructor||Mt(t)?{}:(e=nt(t),Wt(e)?ot(e):{});var e}(k?{}:t),!e)return function(t,e){return kt(t,Rt(t),e)}(t,function(t,e){return t&&kt(e,zt(e),t)}(S,t))}else{if(!U[P])return h?t:{};S=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 q:case I:case D:case E:case $:case O:case _:case w:case A: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(B(t),!0):B(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,T.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 wt);var C=y.get(t);if(C)return C;if(y.set(t,S),!j)var N=r?function(t){return function(t,e,r){var i=e(t);return Gt(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,zt,Rt)}(t):zt(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]),Tt(S,n,jt(s,e,r,i,n,t,y))})),S}function Ut(t){return!(!Wt(t)||(e=t,J&&J in e))&&(Ft(t)||V(t)?et:S).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 kt(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;Tt(r,o,void 0===a?t[o]:a)}return r}function Ct(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=St(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=St(e,t);return r<0?void 0:e[r][1]},Ot.prototype.has=function(t){return St(this.__data__,t)>-1},Ot.prototype.set=function(t,e){var r=this.__data__,i=St(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 Ct(this,t).delete(t)},_t.prototype.get=function(t){return Ct(this,t).get(t)},_t.prototype.has=function(t){return Ct(this,t).has(t)},_t.prototype.set=function(t,e){return Ct(this,t).set(t,e),this},wt.prototype.clear=function(){this.__data__=new Ot},wt.prototype.delete=function(t){return this.__data__.delete(t)},wt.prototype.get=function(t){return this.__data__.get(t)},wt.prototype.has=function(t){return this.__data__.has(t)},wt.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?G(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||z)}function Vt(t){if(null!=t){try{return K.call(t)}catch(e){}try{return t+""}catch(e){}}return""}function Bt(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 qt:return m;case It:return y}return e});var Gt=Array.isArray;function Yt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=s}(t.length)&&!Ft(t)}var Qt=dt||function(){return!1};function Ft(t){var e=Wt(t)?tt.call(t):"";return e==c||e==u}function Wt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function zt(t){return Yt(t)?At(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(`${b(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{timeout:e=18e5}=t;let{headers:r={}}=t;return t.url=D(this.baseURL,t.url||""),t.url=((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})(t.url,t.params),r=Object.assign(r,this._defaultHeaders),Object.keys(r).forEach((t=>{"Content-Type"!==t&&t.toUpperCase()==="Content-Type".toUpperCase()&&(r["Content-Type"]=r[t],delete r[t])})),f(t.data)&&(t.data=t.data.buffer),m(t.data)&&(r&&!r["Content-Type"]&&(r["Content-Type"]="application/json;charset=utf-8"),t.data=JSON.stringify(t.data)),t.headers=r,t.timeout=e,this._beforeRequest&&this._beforeRequest(t),"undefined"!=typeof wx&&void 0!==wx.request?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=>{let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&t.buffer instanceof ArrayBuffer,e},m=t=>{if("[object Object]"!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype},g=()=>{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("")},v=(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]=v(i,e[r]))):void(e[r]=i)})),e):e,y=/-(\w)/g,b=t=>t.replace(y,((t,e)=>e?e.toUpperCase():"")),{hasOwnProperty:x}=Object.prototype,q=(t,e)=>x.call(t,e),I=(t,e=new Map)=>{if(e.get(t))return e.get(t);if(!(t instanceof Object))return t;let r;r=t instanceof Array?[]:t instanceof Function?()=>t():t instanceof RegExp?new RegExp(t.source,t.flags):t instanceof Date?new Date(t):{},e.set(t,r);for(const i in t)q(t,i)&&(r[i]=I(t[i],e));return r},D=(t,e)=>t&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)?((t,e)=>e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t)(t,e):e;var E,$,O,_,w;!function(t){t.REQUEST_ERROR="requestError",t.STATE="state",t.FAILED="failed"}(E||(E={})),function(t){t[t.CLOSE=0]="CLOSE",t[t.JOINED=1]="JOINED",t[t.READY=2]="READY"}($||($={})),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",t.MULTI_STREAM="multiStream"}(O||(O={})),function(t){t.HOST="host",t.COHOST="coHost",t.ATTENDEE="attendee",t.AUDIENCE="audience"}(_||(_={})),function(t){t.STARTED="started",t.PAUSED="paused",t.STARTING="starting",t.STOPPED="stopped"}(w||(w={}));class A{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))return console.warn("Parameter is not an object!"),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=`${b(s)}Change`;this.emitter.on(o,n),e.set(o,n),h(t[s])&&!l(t[s])&&r(t[s],!0)}))};return r(t,!1),t._destory=()=>{e.forEach(((t,e)=>{this.emitter.off(e,t)}))},t}}class T extends A{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)&&v(r,this.data)})),this.ctx.emitter.on("participantCount",(t=>{const{body:e}=t;v({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})}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}})}}function S(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 j(e,r){return t(this,void 0,void 0,(function*(){const{meetingID:t,clientID:i}=r.config.request,s=yield r.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:i,meetingId:t},inboxes:e}),n=[];return s.data&&Object.keys(s.data).forEach((t=>{n.push({name:t,seqId:s.data[t].maxSeqId,limit:200})})),n}))}function U(e,r){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i,clientID:s}=r.config.request,n=yield r.request.post(`${t}meetings/${i}/subscribe`,{endpointID:s,topics:e}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((t=>{r.emitter.emit(t.event,t)}))}))}function P(e,r,i){return t(this,void 0,void 0,(function*(){const{inboxes:s,clientID:n,meetingID:o,cancelToken:a,status:c}=r;if(yield(()=>t(this,void 0,void 0,(function*(){let t;try{t=yield e.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:s},{cancelToken:a,withResDate:!0})}catch(d){return c.attempts++,void console.error(d)}if(!t)return console.error("polling error: ","response is null"),void c.attempts++;const{data:r={},bizCode:u,error:d}=t;if(u&&900408!==u)return console.error("polling error: ",JSON.stringify(d)),void c.attempts++;c.attempts=0,r&&Object.keys(r).forEach((t=>{const e=s.find((e=>e.name===t));e&&(e.seqId=r[t].maxSeqId,r[t].items&&r[t].items.forEach((t=>{const e=JSON.parse(t.content);["liveStream","recording"].includes(e.event)&&(e.stime=t.stime),e.pollingSeqId=t.seqId,i(e)})))}))})))(),!c.running)return;if(c.attempts>L)return console.error("polling Max Attempts"),void(r.onError&&r.onError({message:"Max Attempts"}));const u=c.attempts?H(c.attempts):0;c.timer=setTimeout((()=>{c.running&&P(e,r,i)}),u)}))}const k=(e,r)=>t(void 0,void 0,void 0,(function*(){const{meetingID:t,clientID:i}=r.config.request;r.status.polling.running=!0,P(r.request,{inboxes:e,clientID:i,meetingID:t,cancelToken:r.config.request.cancelToken.token,status:r.status.polling,onError:t=>{r.emitter.emit("pollError",t)}},(t=>{r.emitter.emit(t.event,t)}))}));function C(t){t.status.polling.running=!1,t.status.polling.attempts=0,t.status.polling.timer&&(clearTimeout(t.status.polling.timer),t.status.polling.timer=null),t.config.request.cancelToken.cancel(),t.config.request.cancelToken=c.source()}function N(e,r){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:i},meetingID:s,userID:n}=e.config.request;if(e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null),yield(()=>t(this,void 0,void 0,(function*(){let t;try{t=yield e.request.post(`${i}meetings/${s}/users/${n}/keepalive`,{},{cancelToken:e.config.request.cancelToken.token})}catch(a){return e.status.keepalive.attempts++,void console.error(a)}if(!t||!t.data)return;const{data:r={},bizCode:o,error:a}=t;if(900200!==o&&900408!==o&&901323!==o)return e.status.keepalive.attempts++,void console.error("keepalive ",o,a);const c=r.interval||"";c?(e.status.keepalive.interval=c,e.status.keepalive.attempts=0):console.error("keepalive ",o,a)})))(),!e.status.keepalive.running)return;if(e.status.keepalive.attempts>L)return console.error("keepalive Max Attempts"),void(r&&r({message:"Max Attempts"}));const o=e.status.keepalive.attempts?H(e.status.keepalive.attempts):1e3*e.status.keepalive.interval;e.status.keepalive.timer=setTimeout((()=>{e.status.keepalive.running&&N(e,r)}),o)}))}const R=t=>{t.status.keepalive.running=!1,t.status.keepalive.attempts=0,t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null)},L=5,H=t=>{console.log(`computeNextTimeout attempts: ${t}`);let e=Math.floor(Math.random()*Math.pow(2,t)+1);return e<2&&(e=2),e>30&&(e=30),1e3*e};var M;!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"}(M||(M={}));class V extends A{constructor(t){super(t,"me")}_topic(){return""}_bindOn(){const e=e=>t(this,void 0,void 0,(function*(){if("role"in e&&e.role!==this.data.role){const t=this.data.role;v({role:e.role},this.data),e.role!==_.AUDIENCE&&t!==_.AUDIENCE||(yield this.rePolling("roleChange")),this.emitter.emit(M.ROLECHANGE,e.role),this.ctx.emitter.emit(M.ROLECHANGE,e.role)}})),r=t=>{var e,r,i,s,n,o;if("audio"in t){const{deviceOn:a,sendOn:c,recvOn:u,opBy:d}=t.audio;(!p(a)&&a!==(null===(e=this.data.audio)||void 0===e?void 0:e.deviceOn)||!p(c)&&c!==(null===(r=this.data.audio)||void 0===r?void 0:r.sendOn)||!p(u)&&c!==(null===(i=this.data.audio)||void 0===i?void 0:i.recvOn)||!p(d))&&(v({audio:t.audio},this.data),this.emitter.emit(M.AUDIOCHANGE,{deviceOn:p(a)?null===(s=this.data.audio)||void 0===s?void 0:s.deviceOn:a,sendOn:p(c)?null===(n=this.data.audio)||void 0===n?void 0:n.sendOn:c,recvOn:p(c)?null===(o=this.data.audio)||void 0===o?void 0:o.recvOn:u,opBy:d}))}},i=t=>{var e,r,i,s,n,o;if("video"in t){const{deviceOn:a,sendOn:c,opBy:u,blocked:d}=t.video;(!p(a)&&a!==(null===(e=this.data.video)||void 0===e?void 0:e.deviceOn)||!p(c)&&c!==(null===(r=this.data.video)||void 0===r?void 0:r.sendOn)||!p(d)&&d!==(null===(i=this.data.video)||void 0===i?void 0:i.blocked))&&(v({video:t.video},this.data),this.emitter.emit(M.VIDEOCHANGE,{deviceOn:p(a)?null===(s=this.data.video)||void 0===s?void 0:s.deviceOn:a,sendOn:p(c)?null===(n=this.data.video)||void 0===n?void 0:n.sendOn:c,blocked:p(c)?null===(o=this.data.video)||void 0===o?void 0:o.blocked:d,opBy:u}))}},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))&&(v({share:t.share},this.data),this.emitter.emit(M.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&&(v({displayName:t.displayName},this.data),this.emitter.emit(M.DISPLAYNAMECHANGE,t.displayName))},o=t=>{"isHandUp"in t&&t.isHandUp!==this.data.isHandUp&&(v({isHandUp:t.isHandUp},this.data),this.emitter.emit(M.HANDUPCHANGE,t.isHandUp))},a=t=>{"isSpotlightVideo"in t&&(v({isSpotlightVideo:t.isSpotlightVideo},this.data),this.emitter.emit(M.SPOTLIGHTVIDEOCHANGE,t.isSpotlightVideo))},c=e=>t(this,void 0,void 0,(function*(){if("isInLobby"in e&&e.isInLobby!==this.data.isInLobby){v({isInLobby:e.isInLobby},this.data);const t=!1===e.isInLobby?"inLobbyChange":void 0;yield this.rePolling(t),this.emitter.emit(M.LOBBYCHANGE,e.isInLobby),this.ctx.emitter.emit(M.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(M.BARRAGECHANGE,e);if(!t.barrage.receiver)return;e={content:t.barrage.content,contentType:t.barrage.contentType,type:t.barrage.type,duration:t.barrage.duration,position:t.barrage.position};let{role:r}=this.data;if(this.data.endpointType===O.SUPERVISION){const{info:t}=this.ctx.modules;r="webinar"===t.meetingType?_.AUDIENCE:_.ATTENDEE}r===_.HOST||r===_.COHOST?e=t.barrage.receiver.host?e:null:r===_.ATTENDEE?e=t.barrage.receiver.attendee?e:null:r===_.AUDIENCE&&(e=t.barrage.receiver.audience?e:null),delete t.barrage,this.data.barrage=e||void 0,this.emitter.emit(M.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"),C(this.ctx),dt(this.ctx),this.emitter.emit(M.LEAVE,t.resultInfo),this.ctx.cleanup(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.data.isInLobby||this.data.role===_.AUDIENCE)&&this.data.share&&this.data.share.sendOn&&s({share:{deviceOn:!0,sendOn:!1,recvOn:!1}})};this.ctx.emitter.on(M.INIT,(t=>{v(t,this.data),this.data.isUpdatedUserState=!1})),this.ctx.emitter.on(M.UPDATE,(t=>{l(t),v(t,this.data)})),this.ctx.emitter.on(E.STATE,(({state:t})=>{t===$.READY&&this.data.endpointType!==O.SUPERVISION&&this.emitter.emit(M.UPDATE_USER_STATE,{data: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)}let i=r.users.find((t=>t.userID===this.data.userID));i||r.users.length&&(i=r.users[0]),i?(l(i),v(i,this.data)):console.warn("me ",t,r)})))),this.ctx.emitter.on("setUserVideo",(t=>{this.emitter.emit(M.SETVIDEO,t.body)})),this.ctx.emitter.on("setUserAudio",(t=>{this.emitter.emit(M.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===_.AUDIENCE&&(t.audio.sendOn=!1,t.video.sendOn=!1)}const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,v(t,this.data),this.ctx.request.post(`${r}meetings/${i}/updateUserState`,t)}rePolling(e){return t(this,void 0,void 0,(function*(){const{ctx:t}=this;C(t);const r=S(t),i=yield j(r,t);if(e&&this.emitter.emit(M.UPDATE_USER_STATE,{data:this.data,event:e}),yield U(r,t),"undefined"!=typeof Worker&&t.worker){const{meetingID:e,clientID:s}=t.config.request;t.worker.postMessage({inboxes:i,topics:r,meetingID:e,clientID:s,rePolling:!0})}else yield k(i,t)}))}}class B extends A{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 G extends A{constructor(t){super(t,"interpretation"),this.data={status:"stopped",interpreters:[]}}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("interpretation",(t=>{const{body:e,state:r}=t;"full"===r?(this.data.interpreters=e.interpreters,this.data.status=e.status):this.data.status=e.status,this.emitter.emit("interpretationChange",this.data)}))}interpretationStart(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/interpretation/start`,t)}interpretationEnd(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/interpretation/stop`)}}class Y extends A{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=Y.setDisplayNamePinyinProp?Y.setDisplayNamePinyinProp(t.displayName||""):t.displayName,t))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);this.data.callRecordUsers||(this.data.callRecordUsers=[]),e.users.forEach((t=>{const e=this.data.callRecordUsers.findIndex((e=>t.inviteTransID===e.inviteTransID));"update"===r&&-1!==e?v(t,this.data.callRecordUsers[e]):"update"===r&&-1===e&&(t.displayNamePinyin=Y.setDisplayNamePinyinProp?Y.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)}}class Q extends A{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;const e=[];this.data.liveStreams=t.map((t=>(t.requesting="starting"===t.status,e.push({platform:t.platform||"",status:(t.requesting?"stopped":t.status)||""}),t)));return v({status:e,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));const r=this.data.status.map((t=>t));-1===e?r.push({platform:t.platform||"",status:t.requesting?"stopped":t.status||""}):r.splice(e,1,{platform:r[e].platform||"",status:t.requesting?r[e].status||"stopped":t.status||""}),this.data.status=r})),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 F extends A{constructor(t){super(t,"qa"),this.data={questions:new Map,topSort:0}}_topic(){return"qa"}_bindOn(){this.ctx.emitter.on("qa",(t=>{const{body:e}=t;h(e)&&!l(e)?this.qaUpdate(this.data.questions,e):e.forEach((t=>this.qaUpdate(this.data.questions,t)))}))}cleanup(){this.data={questions:new Map,topSort:0}}qaUpdate(t,e){let r=t.get(e.question.id);const{clientID:i}=this.ctx.config.request;switch(e.command){case"addQuestion":r=this.createQuestion(e.question),t.set(e.question.id,r),this.emitter.emit("questionAdd",{question:r,selfSent:r.sender.endpointID===i});break;case"dismissQuestion":if(!r)break;r.sender.endpointID!==i?r.status="close":r.isTop=!1,t.set(e.question.id,r),this.emitter.emit("questionUpdate",{question:r});break;case"reopenQuestion":r?(r.status="open",r.isTop=e.question.isTop,t.set(e.question.id,r)):(r=this.createQuestion(e.question),t.set(e.question.id,r)),this.emitter.emit("questionUpdate",{question:r});break;case"updateQuestion":r?(r=Object.assign(Object.assign(Object.assign({},r),e.question),{topSort:e.question.isTop?this.data.topSort++:0}),t.set(e.question.id,r)):(r=this.createQuestion(e.question),t.set(e.question.id,r)),this.emitter.emit("questionUpdate",{question:r});break;case"deleteQuestion":if(!r)break;r.sender.endpointID!==i?t.delete(e.question.id):(r.status="delete",r.isTop=!1,r.answers.clear(),t.set(e.question.id,r)),this.emitter.emit("questionDelete",{question:r});break;case"answerQuestion":r?r.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)):(r=this.createQuestion(e.question),r.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)),t.set(e.question.id,r)),this.emitter.emit("questionUpdate",{question:r});break;case"deleteAnswer":r&&(r.answers.delete(e.answer.id),this.emitter.emit("questionUpdate",{question:r}))}this.emitter.emit("questionChange",{questions:this.data.questions})}createQuestion(t){return{isAnonymous:t.isAnonymous,isTop:t.isTop,id:t.id,content:t.content,sender:t.sender,timestamp:t.timestamp||-1,status:t.status||"open",answers:new Map,topSort:0}}createQuestionAnswer(t){return{isPrivate:t.isPrivate,content:t.content,id:t.id,sender:t.sender,timestamp:t.timestamp||-1}}qa(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}/qa`,e)}))}}class W extends A{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.stime=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 z extends A{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)&&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: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 X extends A{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(M.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(M.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 J extends A{constructor(t){super(t,"transcript")}_topic(){return"transcript"}_bindOn(){this.ctx.emitter.on("transcriptMsg",(t=>{const{body:e}=t;this.emitter.emit("transcriptMsg",e)}))}cleanup(){this.emitter.all=new Map}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}/transcript/historyMsg`,e)}))}}class K extends A{constructor(t){super(t,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:t,endpointType:e}=this.ctx.modules.me.data;return e===O.SUPERVISION?["interactive","broadcast"]:t===_.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(M.UPDATE,t);let s=!1;switch(e){case"interactiveUsers":t.isInLobby||(s=!0);break;case"broadcastUsers":t.isInLobby||t.role!==_.AUDIENCE||(s=!0);break;case"lobbyUsers":t.isInLobby&&(s=!0)}const n={};s&&(n.leave=!0),this.ctx.emitter.emit(M.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=K.setDisplayNamePinyinProp?K.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 if("update"===r&&-1!==o){const t=this.data[i][o];this.updateUserProps(e,t),v(e,t),this.data[i][o]=I(t),this.emitter.emit(`${i}Update`,{user:this.data[i][o]})}else"update"===r&&-1===o&&(e.displayNamePinyin=K.setDisplayNamePinyinProp?K.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"})}))}reactive(t){if(!h(t))return console.warn("Parameter is not an object!"),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.users.map((t=>t)),o=`${b(s)}Change`;this.emitter.on(o,n),e.set(o,n),h(t[s])&&!l(t[s])&&r(t[s],!0)}))};return r(t,!1),t._destory=()=>{e.forEach(((t,e)=>{this.emitter.off(e,t)}))},t}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(t,e){t.displayName&&t.displayName!==e.displayName&&(t.displayNamePinyin=K.setDisplayNamePinyinProp?K.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`)}callStatsReport(t){if(!t.userID)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/users/${t.userID}/callStats/report`,t)}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`)}getSendLayout(t){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/users/${t}/sendLayout`)}setSendLayout(t,e){const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${i}/users/${t}/sendLayout`,e)}setSendLayoutEnabled(t,e){const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${i}/users/${t}/sendLayoutEnabled`,e)}}class Z extends A{constructor(t){super(t,"view")}_topic(){const{endpointType:t,role:e}=this.ctx.modules.me.data;return t===O.WEBCTRL?["hostAttendee","audience","advCtrl"]:e===_.AUDIENCE?["audience"]:["hostAttendee","audience"]}_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 tt extends A{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",{vote:this.data.vote,changeData:e})})),this.ctx.emitter.on(M.LOBBYCHANGE,(t=>{t&&(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 et extends A{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,pollingSeqId:i}=t;if(!r)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(M.UPDATE,{barrage:this.data});"full"===e&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),i&&(this.data.barrageRecord=[{id:i,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(M.UPDATE,{barrage:this.data})}),1e3*r.duration)),v(r,this.data),this.ctx.emitter.emit(M.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(M.ROLECHANGE,(()=>this.ctx.emitter.emit(M.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 rt(t){const{baseURL:r,modules:i,worker:s,singleton:n}=t;i.findIndex((t=>t===V))<0&&i.push(V),i.findIndex((t=>t===T))<0&&i.push(T);const o=t.clientID||`${g()}_${((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")}`,u={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/"},clientID:o,location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:s,emitter:e(),request:new a({baseURL:r,beforeRequest:t=>{t.headers["X-Y-Request-Id"]=g(),t.timeout=18e5},error:t=>{u.emitter.emit(E.REQUEST_ERROR,t)}}),modules:{},state:$.CLOSE,status:{polling:{running:!1,attempts:0,timer:null},keepalive:{running:!1,attempts:0,timer:null,interval:20}},cleanup:t=>{u.state!==$.CLOSE&&(u.worker&&u.worker.terminate(),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,attempts:0,timer:null},keepalive:{running:!1,attempts:0,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=$.CLOSE,u.emitter.emit(E.STATE,{state:u.state,reason:t}))}};return u}function it(t){const e=rt(t);return e.worker&&("undefined"!=typeof Worker?e.worker.postMessage({baseURL:e.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}))}(e.config.modules,e),e.emitter.on(E.STATE,(({state:t})=>{t===$.CLOSE&&Object.keys(e.modules).forEach((t=>{e.modules[t].cleanup()}))})),e.emitter.on("pollError",(()=>{nt(e)()})),e.emitter.on("keepaliveError",(()=>{nt(e)()})),Object.assign({config:e.config,request:e.request,get state(){return e.state},on:e.emitter.on,off:e.emitter.off,join:st(e),leave:nt(e),end:ot(e),endMeeting:at(e)},e.modules)}function st(e){return function(r){var i;return t(this,void 0,void 0,(function*(){const{clientID:t}=e.config.request,s=`${null===(i=r.endpointType)||void 0===i?void 0:i.toLocaleUpperCase()}${t}_${r.meetingNum}`;e.config.request.sessionID=s,e.request.setDefaultHeader("X-Y-Session-Id",s);const{prefix:n}=e.config.request,o=yield e.request.get(`${n.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,userAgent:r.userAgent},headers:{"X-Y-Endpoint-Type":r.endpointType}}),{credential:a="",location:c=""}=o&&o.data||{};if(!a)return e.emitter.emit(E.FAILED,{bizCode:o.bizCode,data:o.data}),o;e.config.request.location=c,e.request.setDefaultHeader("X-Y-Location",c),delete r.pwd,delete r.url;const u={displayName:r.displayName,userAgent:r.userAgent,clientID:t};r.groupIDs&&r.account&&(u.groupIDs=r.groupIDs,u.account=r.account,u.groupName=r.groupName);const d=yield e.request.post(`${n.ctrl}join?meetingNum=${r.meetingNum}&credential=${a}`,u,{headers:{"X-Y-Endpoint-Type":r.endpointType,"X-Y-Endpoint-Id":t}});if(!d||d&&d.ret<=-1)return e.emitter.emit(E.FAILED,{bizCode:d.bizCode,data:d.data}),d;const{meetingID:l="",ctrlID:p="",user:h={},mediaContent:f={},initialMediaState:m={},tk:g=""}=d.data;e.config.request.meetingID=l,e.config.request.ctrlID=p,e.config.request.userID=h.userID,e.config.request.voteTk=g,e.request.setDefaultHeader("X-Y-Ctrl-Id",p),e.emitter.emit(M.INIT,Object.assign(Object.assign({},h),{mediaContent:f,initialMediaState:m})),e.state=$.JOINED,e.emitter.emit(E.STATE,{state:e.state});const v=()=>{e.state!==$.READY&&(e.state=$.READY,e.emitter.emit(E.STATE,{state:e.state}))},y=S(e),b=yield j(y,e);return yield U(y,e),"undefined"!=typeof Worker&&e.worker?(e.status.polling.running=!0,e.worker.postMessage({topics:y,meetingID:l,clientID:t,inboxes:b,status:!0}),e.worker.onmessage=t=>{"pollingStarted"!==t.data?"pollingStopped"!==t.data?(console.log("[Polling]",t.data),e.emitter.emit(t.data.event,t.data)):e.status.polling.running=!1:v()}):(e.status.polling.running=!0,k(b,e),v()),e.status.keepalive.running=!0,N(e,(t=>{e.emitter.emit("keepaliveError",t)})),d.data=Object.assign(Object.assign({},d.data),o.data),d}))}}function nt(e){return function(r){return t(this,void 0,void 0,(function*(){r||(r={resultInfo:{bizCode:901359}});const{prefix:t,meetingID:i}=e.config.request;let s;try{s=yield e.request.post(`${t.ctrl}meetings/${i}/leave`,r)}catch(n){console.error(n)}return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),C(e),R(e),dt(e),e.cleanup(),s}))}}function ot(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}),C(e),R(e),dt(e),e.cleanup(),i}))}}function at(e){return function(r){return t(this,void 0,void 0,(function*(){const{prefix:t}=e.config.request;return yield e.request.post(`${t.ctrl}meetingNum/${r}/end`)}))}}class ct{constructor(t){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=it(t)}static getInstance(t){return this.instance?this.instance:this.instance=new ct(t)}}function ut(t){return t.singleton?ct.getInstance(t).meeting:it(t)}function dt(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=ct.getInstance(s);n&&(n.meeting=it(s))}}Object.defineProperty(ct,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null});export{B as Chat,O as ENDPOINT_TYPE,E as EVENT,T as Info,G as Interpretation,Y as Invite,Q as LiveStream,V as Me,M as MeEvent,F as Qa,w as RECORD_STATUS,_ as ROLE,W as Recording,$ as STATE,z as Setting,X as SpotlightVideo,J as Transcript,K as Users,Z as View,tt as Vote,et as Words,ut as createMeeting,dt as reset};