@ylink-sdk/meeting 0.3.0-beta.2 → 0.4.0-beta.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
- "use strict";function e(e,t,r,s){return new(r||(r=Promise))((function(i,n){function o(e){try{c(s.next(e))}catch(t){n(t)}}function a(e){try{c(s.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))}function t(e){return{all:e=e||new Map,on:function(t,r){var s=e.get(t);s?s.push(r):e.set(t,[r])},off:function(t,r){var s=e.get(t);s&&(r?s.splice(s.indexOf(r)>>>0,1):e.set(t,[]))},emit:function(t,r){var s=e.get(t);s&&s.slice().map((function(e){e(r)})),(s=e.get("*"))&&s.slice().map((function(e){e(t,r)}))}}}Object.defineProperty(exports,"__esModule",{value:!0});var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s={exports:{}};!function(e,t){var s="__lodash_hash_undefined__",i=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",h="[object Promise]",f="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",x="[object WeakMap]",y="[object ArrayBuffer]",b="[object DataView]",E="[object Float32Array]",q="[object Float64Array]",I="[object Int8Array]",D="[object Int16Array]",O="[object Int32Array]",T="[object Uint8Array]",$="[object Uint8ClampedArray]",_="[object Uint16Array]",A="[object Uint32Array]",S=/\w*$/,w=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,U={};U[n]=U["[object Array]"]=U[y]=U[b]=U[o]=U[a]=U[E]=U[q]=U[I]=U[D]=U[O]=U[d]=U[l]=U[p]=U[f]=U[m]=U[g]=U[v]=U[T]=U[$]=U[_]=U[A]=!0,U["[object Error]"]=U[c]=U[x]=!1;var N="object"==typeof self&&self&&self.Object===Object&&self,j="object"==typeof r&&r&&r.Object===Object&&r||N||Function("return this")(),k=t&&!t.nodeType&&t,C=k&&e&&!e.nodeType&&e,R=C&&C.exports===k;function L(e,t){return e.set(t[0],t[1]),e}function M(e,t){return e.add(t),e}function H(e,t,r,s){var i=-1,n=e?e.length:0;for(s&&n&&(r=e[++i]);++i<n;)r=t(r,e[i],i,e);return r}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(r){}return t}function B(e){var t=-1,r=Array(e.size);return e.forEach((function(e,s){r[++t]=[s,e]})),r}function G(e,t){return function(r){return e(t(r))}}function Y(e){var t=-1,r=Array(e.size);return e.forEach((function(e){r[++t]=e})),r}var Q,W=Array.prototype,F=Function.prototype,z=Object.prototype,X=j["__core-js_shared__"],J=(Q=/[^.]+$/.exec(X&&X.keys&&X.keys.IE_PROTO||""))?"Symbol(src)_1."+Q:"",K=F.toString,Z=z.hasOwnProperty,ee=z.toString,te=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),re=R?j.Buffer:void 0,se=j.Symbol,ie=j.Uint8Array,ne=G(Object.getPrototypeOf,Object),oe=Object.create,ae=z.propertyIsEnumerable,ce=W.splice,ue=Object.getOwnPropertySymbols,de=re?re.isBuffer:void 0,le=G(Object.keys,Object),pe=Ce(j,"DataView"),he=Ce(j,"Map"),fe=Ce(j,"Promise"),me=Ce(j,"Set"),ge=Ce(j,"WeakMap"),ve=Ce(Object,"create"),xe=Ve(pe),ye=Ve(he),be=Ve(fe),Ee=Ve(me),qe=Ve(ge),Ie=se?se.prototype:void 0,De=Ie?Ie.valueOf:void 0;function Oe(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}function Te(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}function $e(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var s=e[t];this.set(s[0],s[1])}}function _e(e){this.__data__=new Te(e)}function Ae(e,t){var r=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 r=-1,s=Array(e);++r<e;)s[r]=t(r);return s}(e.length,String):[],s=r.length,i=!!s;for(var o in e)!t&&!Z.call(e,o)||i&&("length"==o||Me(o,s))||r.push(o);return r}function Se(e,t,r){var s=e[t];Z.call(e,t)&&Be(s,r)&&(void 0!==r||t in e)||(e[t]=r)}function we(e,t){for(var r=e.length;r--;)if(Be(e[r][0],t))return r;return-1}function Pe(e,t,r,s,i,h,x){var w;if(s&&(w=h?s(e,i,h,x):s(e)),void 0!==w)return w;if(!Fe(e))return e;var P=Ge(e);if(P){if(w=function(e){var t=e.length,r=e.constructor(t);t&&"string"==typeof e[0]&&Z.call(e,"index")&&(r.index=e.index,r.input=e.input);return r}(e),!t)return function(e,t){var r=-1,s=e.length;t||(t=Array(s));for(;++r<s;)t[r]=e[r];return t}(e,w)}else{var N=Le(e),j=N==c||N==u;if(Qe(e))return function(e,t){if(t)return e.slice();var r=new e.constructor(e.length);return e.copy(r),r}(e,t);if(N==p||N==n||j&&!h){if(V(e))return h?e:{};if(w=function(e){return"function"!=typeof e.constructor||He(e)?{}:(t=ne(e),Fe(t)?oe(t):{});var t}(j?{}:e),!t)return function(e,t){return je(e,Re(e),t)}(e,function(e,t){return e&&je(t,ze(t),e)}(w,e))}else{if(!U[N])return h?e:{};w=function(e,t,r,s){var i=e.constructor;switch(t){case y:return Ne(e);case o:case a:return new i(+e);case b:return function(e,t){var r=t?Ne(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,s);case E:case q:case I:case D:case O:case T:case $:case _:case A:return function(e,t){var r=t?Ne(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,s);case d:return function(e,t,r){return H(t?r(B(e),!0):B(e),L,new e.constructor)}(e,s,r);case l:case g:return new i(e);case f:return function(e){var t=new e.constructor(e.source,S.exec(e));return t.lastIndex=e.lastIndex,t}(e);case m:return function(e,t,r){return H(t?r(Y(e),!0):Y(e),M,new e.constructor)}(e,s,r);case v:return n=e,De?Object(De.call(n)):{}}var n}(e,N,Pe,t)}}x||(x=new _e);var k=x.get(e);if(k)return k;if(x.set(e,w),!P)var C=r?function(e){return function(e,t,r){var s=t(e);return Ge(e)?s:function(e,t){for(var r=-1,s=t.length,i=e.length;++r<s;)e[i+r]=t[r];return e}(s,r(e))}(e,ze,Re)}(e):ze(e);return function(e,t){for(var r=-1,s=e?e.length:0;++r<s&&!1!==t(e[r],r,e););}(C||e,(function(i,n){C&&(i=e[n=i]),Se(w,n,Pe(i,t,r,s,n,e,x))})),w}function Ue(e){return!(!Fe(e)||(t=e,J&&J in t))&&(We(e)||V(e)?te:w).test(Ve(e));var t}function Ne(e){var t=new e.constructor(e.byteLength);return new ie(t).set(new ie(e)),t}function je(e,t,r,s){r||(r={});for(var i=-1,n=t.length;++i<n;){var o=t[i],a=s?s(r[o],e[o],o,r,e):void 0;Se(r,o,void 0===a?e[o]:a)}return r}function ke(e,t){var r,s,i=e.__data__;return("string"==(s=typeof(r=t))||"number"==s||"symbol"==s||"boolean"==s?"__proto__"!==r:null===r)?i["string"==typeof t?"string":"hash"]:i.map}function Ce(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return Ue(r)?r:void 0}Oe.prototype.clear=function(){this.__data__=ve?ve(null):{}},Oe.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Oe.prototype.get=function(e){var t=this.__data__;if(ve){var r=t[e];return r===s?void 0:r}return Z.call(t,e)?t[e]:void 0},Oe.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Z.call(t,e)},Oe.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?s:t,this},Te.prototype.clear=function(){this.__data__=[]},Te.prototype.delete=function(e){var t=this.__data__,r=we(t,e);return!(r<0)&&(r==t.length-1?t.pop():ce.call(t,r,1),!0)},Te.prototype.get=function(e){var t=this.__data__,r=we(t,e);return r<0?void 0:t[r][1]},Te.prototype.has=function(e){return we(this.__data__,e)>-1},Te.prototype.set=function(e,t){var r=this.__data__,s=we(r,e);return s<0?r.push([e,t]):r[s][1]=t,this},$e.prototype.clear=function(){this.__data__={hash:new Oe,map:new(he||Te),string:new Oe}},$e.prototype.delete=function(e){return 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},_e.prototype.clear=function(){this.__data__=new Te},_e.prototype.delete=function(e){return this.__data__.delete(e)},_e.prototype.get=function(e){return this.__data__.get(e)},_e.prototype.has=function(e){return this.__data__.has(e)},_e.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Te){var s=r.__data__;if(!he||s.length<199)return s.push([e,t]),this;r=this.__data__=new $e(s)}return r.set(e,t),this};var Re=ue?G(ue,Object):function(){return[]},Le=function(e){return ee.call(e)};function Me(e,t){return!!(t=null==t?i:t)&&("number"==typeof e||P.test(e))&&e>-1&&e%1==0&&e<t}function He(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||z)}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)))!=b||he&&Le(new he)!=d||fe&&Le(fe.resolve())!=h||me&&Le(new me)!=m||ge&&Le(new ge)!=x)&&(Le=function(e){var t=ee.call(e),r=t==p?e.constructor:void 0,s=r?Ve(r):void 0;if(s)switch(s){case xe:return b;case ye:return d;case be:return h;case Ee:return m;case qe:return x}return t});var Ge=Array.isArray;function Ye(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=i}(e.length)&&!We(e)}var Qe=de||function(){return!1};function We(e){var t=Fe(e)?ee.call(e):"";return t==c||t==u}function Fe(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function ze(e){return Ye(e)?Ae(e):function(e){if(!He(e))return le(e);var t=[];for(var r in Object(e))Z.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}e.exports=function(e){return Pe(e,!0,!0)}}(s,s.exports);var i=s.exports;const n=e=>({get(t,r,s){if("__isProxy"===r)return!0;const i=Reflect.get(t,r);return Array.isArray(i)?i:"object"==typeof i&&null!==i?i.__isProxy?i:new Proxy(i,n(e)):i},set(t,r,s,n){const o=t[r];s=h(s)&&s.__isProxy?i(s):s;const a=Reflect.set(t,r,s,n);return((e,t)=>e!==t&&(e==e||t==t))(s,o)&&e.emit(`${y(r)}Change`,s),a}}),o=e=>encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class a{constructor(e){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=e.baseURL,this._beforeRequest=e.beforeRequest,this._errorHandler=e.error}_request(e){const{timeout:t=18e5}=e;let{headers:r={}}=e;return e.url=I(this.baseURL,e.url||""),e.url=((e,t)=>{if(!t)return e;const r=[];Object.keys(t).forEach((e=>{const s=t[e];if(null==s)return;let i;Array.isArray(s)?(i=s,e+="[]"):i=[s],i.forEach((t=>{null!==t&&"object"==typeof t&&(t=JSON.stringify(t)),r.push(`${o(e)}=${o(t)}`)}))}));const s=r.join("&");if(s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e})(e.url,e.params),r=Object.assign(r,this._defaultHeaders),Object.keys(r).forEach((e=>{"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(r["Content-Type"]=r[e],delete r[e])})),f(e.data)&&(e.data=e.data.buffer),m(e.data)&&(r&&!r["Content-Type"]&&(r["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=r,e.timeout=t,this._beforeRequest&&this._beforeRequest(e),"undefined"!=typeof wx&&void 0!==wx.request?d(e):u(e)}setDefaultHeader(e,t){e in this._defaultHeaders&&(""===t||null===t)?delete this._defaultHeaders[e]:this._defaultHeaders[e]=t}get(e,t){return this._errorHandler?this._request(Object.assign(t||{},{url:e,method:"GET"})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(t||{},{url:e,method:"GET"}))}post(e,t,r){return this._errorHandler?this._request(Object.assign(r||{},{url:e,method:"POST",data:t})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(r||{},{url:e,method:"POST",data:t}))}}class c{constructor(e){let t;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=e,t(this.reason))}))}static source(){let e;const t=new c((t=>{e=t}));return{cancel:e,token:t}}}const u=e=>new Promise(((t,r)=>{const{data:s=null,url:i,method:n="GET",headers:o,cancelToken:a}=e;let c=new XMLHttpRequest;c.open(n.toUpperCase(),i,!0),c.timeout=e.timeout;const u=()=>{if(c){if(c.status>=200&&c.status<300)try{const e=JSON.parse(c.responseText);t(e)}catch(e){r(new Error("E_JSON_PARSE"+c.responseText))}else r({url:i,statusCode:c.status});c=null}};"onloadend"in c?c.onloadend=u:c.onreadystatechange=()=>{c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(u)},c.onabort=()=>{c&&(r({url:i,statusCode:c.status,type:"request abort"}),c=null)},c.onerror=()=>{r(new Error("Network Error")),c=null},c.ontimeout=()=>{r(new Error("timeout of "+e.timeout+"ms exceeded")),c=null},"setRequestHeader"in c&&Object.keys(o).forEach((e=>{null===s&&"content-type"===e.toLowerCase()?delete o[e]:c.setRequestHeader(e,o[e])})),a&&a.promise.then((e=>{c&&(c.abort(),r(e),c=null)})),c.send(s)})),d=e=>new Promise(((t,r)=>{const{data:s=null,url:i,method:n="GET",headers:o,cancelToken:a}=e,c=wx.request({url:i,data:s,method:n.toUpperCase(),timeout:e.timeout,header:o,success(e){e.statusCode>=200&&e.statusCode<300?t(e.data):r({url:i,statusCode:e.statusCode})},fail(e){r("request:fail abort"===e.errMsg&&a&&a.reason||e)}});a&&a.promise.then((()=>{c&&c.abort()}))})),l=Array.isArray,p=e=>null==e,h=e=>"object"==typeof e&&null!==e,f=e=>{let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer,t},m=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},g=()=>{const e=[],t="0123456789abcdef";for(let r=0;r<36;r++)e[r]=t.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";return e.join("").split("-").join("")},v=(e,t)=>e?(Object.entries(e).forEach((e=>{const[r,s]=[e[0],e[1]];if(null!==s)return h(s)&&!l(s)?(t[r]||(t[r]={}),void(t[r]=v(s,t[r]))):void(t[r]=s)})),t):t,x=/-(\w)/g,y=e=>e.replace(x,((e,t)=>t?t.toUpperCase():"")),{hasOwnProperty:b}=Object.prototype,E=(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 r;r=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,r);for(const s in e)E(e,s)&&(r[s]=q(e[s],t));return r},I=(e,t)=>e&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)?((e,t)=>t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e)(e,t):t;var D,O,T,$,_;exports.EVENT=void 0,(D=exports.EVENT||(exports.EVENT={})).REQUEST_ERROR="requestError",D.STATE="state",D.FAILED="failed",exports.STATE=void 0,(O=exports.STATE||(exports.STATE={}))[O.CLOSE=0]="CLOSE",O[O.JOINED=1]="JOINED",O[O.READY=2]="READY",exports.ENDPOINT_TYPE=void 0,(T=exports.ENDPOINT_TYPE||(exports.ENDPOINT_TYPE={})).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",T.MEETING_TOUCH="meetingTouch",exports.ROLE=void 0,($=exports.ROLE||(exports.ROLE={})).HOST="host",$.COHOST="coHost",$.ATTENDEE="attendee",$.AUDIENCE="audience",exports.RECORD_STATUS=void 0,(_=exports.RECORD_STATUS||(exports.RECORD_STATUS={})).STARTED="started",_.PAUSED="paused",_.STARTING="starting",_.STOPPED="stopped";class A{constructor(e,r){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"on",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"off",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=r,this.ctx=e,this.emitter=t(),this.on=this.emitter.on,this.off=this.emitter.off,this.data=new Proxy({},n(this.emitter)),this._bindOn()}cleanup(){this.emitter.all=new Map,this.data=new Proxy({},n(this.emitter))}reactive(e){if(!h(e))return console.warn("Parameter is not an object!"),e;const t=new Map,r=(e,s)=>{Object.keys(e).forEach((i=>{!1===s&&i in this.data&&(e[i]=this.data[i]);const n=t=>e[i]=t,o=`${y(i)}Change`;this.emitter.on(o,n),t.set(o,n),h(e[i])&&!l(e[i])&&r(e[i],!0)}))};return r(e,!1),e._destory=()=>{t.forEach(((e,t)=>{this.emitter.off(t,e)}))},e}}class S extends A{constructor(e){super(e,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(e=>{const{state:t,body:r}=e;("full"===t||"update"===t)&&v(r,this.data)})),this.ctx.emitter.on("participantCount",(e=>{const{body:t}=e;v({participantCount:t},this.data)}))}subject(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/info/subject`,t)}))}practiceSession(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/info/practiceSession`)}))}shareInfo(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${r}/shareInfo`,{params:e})}meetings(e){if(!e)return Promise.reject();const{prefix:{ctrl:t}}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings`,{params:e})}mailTemplate(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${t}mailTemplate`,{params:{meetingID:r},headers:{language:e.language}})}}function w(e){const t=[],{isInLobby:r}=e.modules.me.data;return r?(t.push("lobbyMember"),t):(Object.keys(e.modules).forEach((r=>{const s=e.modules[r]._topic();s&&(Array.isArray(s)?s.forEach((e=>{t.includes(e)||t.push(e)})):t.includes(s)||t.push(s))})),t)}function P(t,r){return e(this,void 0,void 0,(function*(){const{meetingID:e,clientID:s}=r.config.request,i=yield r.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:s,meetingId:e},inboxes:t}),n=[];return i.data&&Object.keys(i.data).forEach((e=>{n.push({name:e,seqId:i.data[e].maxSeqId,limit:200})})),n}))}function U(t,r){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:s,clientID:i}=r.config.request,n=yield r.request.post(`${e}meetings/${s}/subscribe`,{endpointID:i,topics:t}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((e=>{r.emitter.emit(e.event,e)}))}))}function N(t,r,s){return e(this,void 0,void 0,(function*(){const{inboxes:i,clientID:n,meetingID:o,cancelToken:a,status:c}=r;if(yield(()=>e(this,void 0,void 0,(function*(){let e;try{e=yield t.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:i},{cancelToken:a})}catch(d){return c.attempts++,void console.error(d)}if(!e)return console.error("polling error: ","response is null"),void c.attempts++;const{data:r={},bizCode:u,error:d}=e;if(u&&900408!==u)return console.error("polling error: ",JSON.stringify(d)),void c.attempts++;c.attempts=0,r&&Object.keys(r).forEach((e=>{const t=i.find((t=>t.name===e));t&&(t.seqId=r[e].maxSeqId,r[e].items&&r[e].items.forEach((e=>{const t=JSON.parse(e.content);["liveStream","recording"].includes(t.event)&&(t.stime=e.stime),t.pollingSeqId=e.seqId,s(t)})))}))})))(),!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?M(c.attempts):0;c.timer=setTimeout((()=>{c.running&&N(t,r,s)}),u)}))}const j=(t,r)=>e(void 0,void 0,void 0,(function*(){const{meetingID:e,clientID:s}=r.config.request;r.status.polling.running=!0,N(r.request,{inboxes:t,clientID:s,meetingID:e,cancelToken:r.config.request.cancelToken.token,status:r.status.polling,onError:e=>{r.emitter.emit("pollError",e)}},(e=>{r.emitter.emit(e.event,e)}))}));function k(e){e.status.polling.running=!1,e.status.polling.attempts=0,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,r){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:s},meetingID:i,userID:n}=t.config.request;if(t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null),yield(()=>e(this,void 0,void 0,(function*(){let e;try{e=yield t.request.post(`${s}meetings/${i}/users/${n}/keepalive`,{},{cancelToken:t.config.request.cancelToken.token})}catch(a){return t.status.keepalive.attempts++,void console.error(a)}if(!e||!e.data)return;const{data:r={},bizCode:o,error:a}=e;if(900200!==o&&900408!==o&&901323!==o)return t.status.keepalive.attempts++,void console.error("keepalive ",o,a);const c=r.interval||"";c?(t.status.keepalive.interval=c,t.status.keepalive.attempts=0):console.error("keepalive ",o,a)})))(),!t.status.keepalive.running)return;if(t.status.keepalive.attempts>L)return console.error("keepalive Max Attempts"),void(r&&r({message:"Max Attempts"}));const o=t.status.keepalive.attempts?M(t.status.keepalive.attempts):1e3*t.status.keepalive.interval;t.status.keepalive.timer=setTimeout((()=>{t.status.keepalive.running&&C(t,r)}),o)}))}const R=e=>{e.status.keepalive.running=!1,e.status.keepalive.attempts=0,e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null)},L=5,M=e=>{console.log(`computeNextTimeout attempts: ${e}`);let t=Math.floor(Math.random()*Math.pow(2,e)+1);return t<2&&(t=2),t>30&&(t=30),1e3*t};var H;exports.MeEvent=void 0,(H=exports.MeEvent||(exports.MeEvent={})).INIT="meInit",H.UPDATE="meUpdate",H.UPDATE_USER_STATE="updateUserState",H.ROLECHANGE="meRoleChange",H.AUDIOCHANGE="meAudioChange",H.HANDUPCHANGE="meHandupChange",H.SETAUDIO="setAudio",H.VIDEOCHANGE="meVideoChange",H.SETVIDEO="setVideo",H.SHARECHANGE="meShareChange",H.DISPLAYNAMECHANGE="meDisplayNameChange",H.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",H.LOBBYCHANGE="meLobbyChange",H.BARRAGECHANGE="meBarrageChange",H.LEAVE="leave";class V extends A{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;v({role:t.role},this.data),t.role!==exports.ROLE.AUDIENCE&&e!==exports.ROLE.AUDIENCE||(yield this.rePolling("roleChange")),this.emitter.emit(exports.MeEvent.ROLECHANGE,t.role),this.ctx.emitter.emit(exports.MeEvent.ROLECHANGE,t.role)}})),r=e=>{var t,r,s,i,n,o;if("audio"in e){const{deviceOn:a,sendOn:c,recvOn:u,opBy:d}=e.audio;(!p(a)&&a!==(null===(t=this.data.audio)||void 0===t?void 0:t.deviceOn)||!p(c)&&c!==(null===(r=this.data.audio)||void 0===r?void 0:r.sendOn)||!p(u)&&c!==(null===(s=this.data.audio)||void 0===s?void 0:s.recvOn)||!p(d))&&(v({audio:e.audio},this.data),this.emitter.emit(exports.MeEvent.AUDIOCHANGE,{deviceOn:p(a)?null===(i=this.data.audio)||void 0===i?void 0:i.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}))}},s=e=>{var t,r,s,i,n,o;if("video"in e){const{deviceOn:a,sendOn:c,opBy:u,blocked:d}=e.video;(!p(a)&&a!==(null===(t=this.data.video)||void 0===t?void 0:t.deviceOn)||!p(c)&&c!==(null===(r=this.data.video)||void 0===r?void 0:r.sendOn)||!p(d)&&d!==(null===(s=this.data.video)||void 0===s?void 0:s.blocked))&&(v({video:e.video},this.data),this.emitter.emit(exports.MeEvent.VIDEOCHANGE,{deviceOn:p(a)?null===(i=this.data.video)||void 0===i?void 0:i.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}))}},i=e=>{var t,r,s,i;if("share"in e){const{deviceOn:n,sendOn:o,opBy:a}=e.share;(!p(n)&&n!==(null===(t=this.data.share)||void 0===t?void 0:t.deviceOn)||!p(o)&&o!==(null===(r=this.data.share)||void 0===r?void 0:r.sendOn))&&(v({share:e.share},this.data),this.emitter.emit(exports.MeEvent.SHARECHANGE,{deviceOn:p(n)?null===(s=this.data.share)||void 0===s?void 0:s.deviceOn:n,sendOn:p(o)?null===(i=this.data.share)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},n=e=>{e.displayName&&e.displayName!==this.data.displayName&&(v({displayName:e.displayName},this.data),this.emitter.emit(exports.MeEvent.DISPLAYNAMECHANGE,e.displayName))},o=e=>{"isHandUp"in e&&e.isHandUp!==this.data.isHandUp&&(v({isHandUp:e.isHandUp},this.data),this.emitter.emit(exports.MeEvent.HANDUPCHANGE,e.isHandUp))},a=e=>{"isSpotlightVideo"in e&&(v({isSpotlightVideo:e.isSpotlightVideo},this.data),this.emitter.emit(exports.MeEvent.SPOTLIGHTVIDEOCHANGE,e.isSpotlightVideo))},c=t=>e(this,void 0,void 0,(function*(){if("isInLobby"in t&&t.isInLobby!==this.data.isInLobby){v({isInLobby:t.isInLobby},this.data);const e=!1===t.isInLobby?"inLobbyChange":void 0;yield this.rePolling(e),this.emitter.emit(exports.MeEvent.LOBBYCHANGE,t.isInLobby),this.ctx.emitter.emit(exports.MeEvent.LOBBYCHANGE,t.isInLobby)}})),u=e=>{if(!e.barrage)return;let t=null;if(!e.barrage.wordsDisplayStatus)return t=null,delete e.barrage,this.data.barrage=t||void 0,void this.emitter.emit(exports.MeEvent.BARRAGECHANGE,t);if(!e.barrage.receiver)return;t={content:e.barrage.content,contentType:e.barrage.contentType,type:e.barrage.type,duration:e.barrage.duration,position:e.barrage.position};let{role:r}=this.data;if(this.data.endpointType===exports.ENDPOINT_TYPE.SUPERVISION){const{info:e}=this.ctx.modules;r="webinar"===e.meetingType?exports.ROLE.AUDIENCE:exports.ROLE.ATTENDEE}r===exports.ROLE.HOST||r===exports.ROLE.COHOST?t=e.barrage.receiver.host?t:null:r===exports.ROLE.ATTENDEE?t=e.barrage.receiver.attendee?t:null:r===exports.ROLE.AUDIENCE&&(t=e.barrage.receiver.audience?t:null),delete e.barrage,this.data.barrage=t||void 0,this.emitter.emit(exports.MeEvent.BARRAGECHANGE,t)},d=e=>{"leave"in e&&!0===e.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),k(this.ctx),K(this.ctx),this.emitter.emit(exports.MeEvent.LEAVE,e.resultInfo),this.ctx.cleanup(e.resultInfo))},l=e=>{t(e),r(e),s(e),i(e),n(e),o(e),c(e),a(e),u(e),d(e),(this.data.isInLobby||this.data.role===exports.ROLE.AUDIENCE)&&this.data.share&&this.data.share.sendOn&&i({share:{deviceOn:!0,sendOn:!1,recvOn:!1}})};this.ctx.emitter.on(exports.MeEvent.INIT,(e=>{v(e,this.data),this.data.isUpdatedUserState=!1})),this.ctx.emitter.on(exports.MeEvent.UPDATE,(e=>{l(e),v(e,this.data)})),this.ctx.emitter.on(exports.EVENT.STATE,(({state:e})=>{e===exports.STATE.READY&&this.data.endpointType!==exports.ENDPOINT_TYPE.SUPERVISION&&this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on("me",(t=>e(this,void 0,void 0,(function*(){const{state:e,body:r={users:[]}}=t;if("delete"===e){const e=r.users[0];return e.leave=!0,void d(e)}let s=r.users.find((e=>e.userID===this.data.userID));s||r.users.length&&(s=r.users[0]),s?(l(s),v(s,this.data)):console.warn("me ",e,r)})))),this.ctx.emitter.on("setUserVideo",(e=>{this.emitter.emit(exports.MeEvent.SETVIDEO,e.body)})),this.ctx.emitter.on("setUserAudio",(e=>{this.emitter.emit(exports.MeEvent.SETAUDIO,e.body)})),this.ctx.emitter.on("meetingState",(e=>{const{body:t={}}=e;if("ended"===t.state){d({leave:!0,resultInfo:t.resultInfo})}}))}updateUserState(e,t=!1){if(!t){const{role:t,initialMediaState:r}=this.data;e.audio.sendOn=e.audio.sendOn&&r.audio.sendOn,e.video.sendOn=e.video.sendOn&&r.video.sendOn,t===exports.ROLE.AUDIENCE&&(e.audio.sendOn=!1,e.video.sendOn=!1)}const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,v(e,this.data),this.ctx.request.post(`${r}meetings/${s}/updateUserState`,e)}rePolling(t){return e(this,void 0,void 0,(function*(){const{ctx:e}=this;k(e);const r=w(e),s=yield P(r,e);if(t&&this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data,event:t}),yield U(r,e),"undefined"!=typeof Worker&&e.worker){const{meetingID:t,clientID:i}=e.config.request;e.worker.postMessage({inboxes:s,topics:r,meetingID:t,clientID:i,rePolling:!0})}else yield j(s,e)}))}}class B extends A{constructor(e){super(e,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(e=>{const{body:t,state:r}=e;if(t&&t.users){if("full"===r)return this.data.callRecordUsers=t.users.map((e=>(e.displayNamePinyin=B.setDisplayNamePinyinProp?B.setDisplayNamePinyinProp(e.displayName||""):e.displayName,e))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);this.data.callRecordUsers||(this.data.callRecordUsers=[]),t.users.forEach((e=>{const t=this.data.callRecordUsers.findIndex((t=>e.inviteTransID===t.inviteTransID));"update"===r&&-1!==t?v(e,this.data.callRecordUsers[t]):"update"===r&&-1===t&&(e.displayNamePinyin=B.setDisplayNamePinyinProp?B.setDisplayNamePinyinProp(e.displayName||""):e.displayName,this.data.callRecordUsers.push(e))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/invite`,e)}}class G extends A{constructor(e){super(e,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:e,endpointType:t}=this.ctx.modules.me.data;return t===exports.ENDPOINT_TYPE.SUPERVISION?["interactive","broadcast"]:e===exports.ROLE.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const e=(e,{event:t,state:r})=>{if(e.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:s={}}=e;if("delete"!==r||"delete"===r&&[901357,901358,901352,901351,901350,901349].includes(s.bizCode||-1))return void this.ctx.emitter.emit(exports.MeEvent.UPDATE,e);let i=!1;switch(t){case"interactiveUsers":e.isInLobby||(i=!0);break;case"broadcastUsers":e.isInLobby||e.role!==exports.ROLE.AUDIENCE||(i=!0);break;case"lobbyUsers":e.isInLobby&&(i=!0)}const n={};i&&(n.leave=!0),this.ctx.emitter.emit(exports.MeEvent.UPDATE,Object.assign(Object.assign({},e),n))},t=({updateUsers:t,state:r,sourceKey:s})=>{if("full"===r)return this.data[s]=t.map((t=>(t.displayNamePinyin=G.setDisplayNamePinyinProp?G.setDisplayNamePinyinProp(t.displayName):t.displayName,t.groupIDs=G.setUserGroupIDs?G.setUserGroupIDs(t.groupIDs||[]):t.groupIDs,e(t,{event:s,state:r}),t))),this.emitter.emit(`${s}Change`,{users:this.data[s],isFull:!0}),this.data[s];void 0===this.data[s]&&(this.data[s]=[]);const{data:i,emitter:n}=this;return t.forEach((t=>{const o=i[s].findIndex((e=>t.userID===e.userID));if("delete"===r&&-1!==o){const[e]=this.data[s].splice(o,1);n.emit(`${s}Delete`,{user:e,resultInfo:t.resultInfo})}else if("update"===r&&-1!==o){const e=this.data[s][o];this.updateUserProps(t,e),v(t,e),this.data[s][o]=q(e),this.emitter.emit(`${s}Update`,{user:this.data[s][o]})}else"update"===r&&-1===o&&(t.displayNamePinyin=G.setDisplayNamePinyinProp?G.setDisplayNamePinyinProp(t.displayName):t.displayName,i[s].push(t),this.emitter.emit(`${s}Add`,{user:t,resultInfo:t.resultInfo}));e(t,{event:s,state:r})})),this.emitter.emit(`${s}Change`,{users:this.data[s],isFull:!1}),this.data[s]};this.ctx.emitter.on("interactiveUsers",(e=>{const{state:r,body:s}=e;t({updateUsers:s.users,state:r,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(e=>{const{state:r,body:s}=e;t({updateUsers:s.users,state:r,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(e=>{const{state:r,body:s}=e;t({updateUsers:s.users,state:r,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(e=>{const{state:r,body:s}=e;t({updateUsers:s.users,state:r,sourceKey:"advCtrlUsers"})}))}reactive(e){if(!h(e))return console.warn("Parameter is not an object!"),e;const t=new Map,r=(e,s)=>{Object.keys(e).forEach((i=>{!1===s&&i in this.data&&(e[i]=this.data[i]);const n=t=>e[i]=t.users.map((e=>e)),o=`${y(i)}Change`;this.emitter.on(o,n),t.set(o,n),h(e[i])&&!l(e[i])&&r(e[i],!0)}))};return r(e,!1),e._destory=()=>{t.forEach(((e,t)=>{this.emitter.off(t,e)}))},e}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(e,t){e.displayName&&e.displayName!==t.displayName&&(e.displayNamePinyin=G.setDisplayNamePinyinProp?G.setDisplayNamePinyinProp(e.displayName):e.displayName)}setAudio(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/audio`,t)}setVideo(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/video`,t)}setShare(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/share`,t)}setWhiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}users/${e}/whiteboard`,t)}handUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/handUp`,t)}setRole(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/role`,t)}rename(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/displayName`,t)}remove(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/users/${e}/remove`)}replyHandUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/replyHandUp`,t)}fecc(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/fecc`,t)}lobbyState(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/lobbyState`,t)}allowLocalRecord(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/allowLocalRecord`,t)}whiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/whiteboard`,t)}callStats(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${r}/users/${e}/callStats`)}callStatsReport(e){if(!e.userID)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/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`)}getSendLayout(e){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/users/${e}/sendLayout`)}setSendLayout(e,t){const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/sendLayout`,t)}setSendLayoutEnabled(e,t){const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${s}/users/${e}/sendLayoutEnabled`,t)}}function Y(e){const{baseURL:r,modules:s,worker:i,singleton:n}=e;s.findIndex((e=>e===V))<0&&s.push(V),s.findIndex((e=>e===S))<0&&s.push(S);const o=e.clientID||`${g()}_${((e=new Date,t)=>{const r={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));for(const s in r)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?r[s]:("00"+r[s]).substr((""+r[s]).length)));return t})(new Date,"MMddHHmmss")}`,u={config:{baseURL:r,modules:s,singleton:n||!1,request:{cancelToken:c.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1/"},clientID:o,location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:i,emitter:t(),request:new a({baseURL:r,beforeRequest:e=>{e.headers["X-Y-Request-Id"]=g(),e.timeout=18e5},error:e=>{u.emitter.emit(exports.EVENT.REQUEST_ERROR,e)}}),modules:{},state:exports.STATE.CLOSE,status:{polling:{running:!1,attempts:0,timer:null},keepalive:{running:!1,attempts:0,timer:null,interval:20}},cleanup:e=>{u.state!==exports.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=exports.STATE.CLOSE,u.emitter.emit(exports.EVENT.STATE,{state:u.state,reason:e}))}};return u}function Q(e){const t=Y(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 r=new e(t);t.modules[r.moduleName]=r}))}(t.config.modules,t),t.emitter.on(exports.EVENT.STATE,(({state:e})=>{e===exports.STATE.CLOSE&&Object.keys(t.modules).forEach((e=>{t.modules[e].cleanup()}))})),t.emitter.on("pollError",(()=>{F(t)()})),t.emitter.on("keepaliveError",(()=>{F(t)()})),Object.assign({config:t.config,request:t.request,get state(){return t.state},on:t.emitter.on,off:t.emitter.off,join:W(t),leave:F(t),end:z(t),endMeeting:X(t)},t.modules)}function W(t){return function(r){var s;return e(this,void 0,void 0,(function*(){const{clientID:e}=t.config.request,i=`${null===(s=r.endpointType)||void 0===s?void 0:s.toLocaleUpperCase()}${e}_${r.meetingNum}`;t.config.request.sessionID=i,t.request.setDefaultHeader("X-Y-Session-Id",i);const{prefix:n}=t.config.request,o=yield t.request.get(`${n.ctrl}credential`,{params:{meetingNum: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 t.emitter.emit(exports.EVENT.FAILED,{bizCode:o.bizCode,data:o.data}),o;t.config.request.location=c,t.request.setDefaultHeader("X-Y-Location",c),delete r.pwd,delete r.url;const u={displayName:r.displayName,userAgent:r.userAgent,clientID:e};r.groupIDs&&r.account&&(u.groupIDs=r.groupIDs,u.account=r.account,u.groupName=r.groupName);const d=yield t.request.post(`${n.ctrl}join?meetingNum=${r.meetingNum}&credential=${a}`,u,{headers:{"X-Y-Endpoint-Type":r.endpointType,"X-Y-Endpoint-Id":e}});if(!d||d&&d.ret<=-1)return t.emitter.emit(exports.EVENT.FAILED,{bizCode:d.bizCode,data:d.data}),d;const{meetingID:l="",ctrlID:p="",user:h={},mediaContent:f={},initialMediaState:m={},tk:g=""}=d.data;t.config.request.meetingID=l,t.config.request.ctrlID=p,t.config.request.userID=h.userID,t.config.request.voteTk=g,t.request.setDefaultHeader("X-Y-Ctrl-Id",p),t.emitter.emit(exports.MeEvent.INIT,Object.assign(Object.assign({},h),{mediaContent:f,initialMediaState:m})),t.state=exports.STATE.JOINED,t.emitter.emit(exports.EVENT.STATE,{state:t.state});const v=()=>{t.state!==exports.STATE.READY&&(t.state=exports.STATE.READY,t.emitter.emit(exports.EVENT.STATE,{state:t.state}))},x=w(t),y=yield P(x,t);return yield U(x,t),"undefined"!=typeof Worker&&t.worker?(t.status.polling.running=!0,t.worker.postMessage({topics:x,meetingID:l,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:v()}):(t.status.polling.running=!0,j(y,t),v()),t.status.keepalive.running=!0,C(t,(e=>{t.emitter.emit("keepaliveError",e)})),d.data=Object.assign(Object.assign({},d.data),o.data),d}))}}function F(t){return function(r){return e(this,void 0,void 0,(function*(){r||(r={resultInfo:{bizCode:901359}});const{prefix:e,meetingID:s}=t.config.request;let i;try{i=yield t.request.post(`${e.ctrl}meetings/${s}/leave`,r)}catch(n){console.error(n)}return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),k(t),R(t),K(t),t.cleanup(),i}))}}function z(t){return function(){return e(this,void 0,void 0,(function*(){const{prefix:e,meetingID:r}=t.config.request,s=yield t.request.post(`${e.ctrl}meetings/${r}/end`);return"undefined"!=typeof Worker&&t.worker&&t.worker.postMessage({status:!1}),k(t),R(t),K(t),t.cleanup(),s}))}}function X(t){return function(r){return e(this,void 0,void 0,(function*(){const{prefix:e}=t.config.request;return yield t.request.post(`${e.ctrl}meetingNum/${r}/end`)}))}}class J{constructor(e){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=Q(e)}static getInstance(e){return this.instance?this.instance:this.instance=new J(e)}}function K(e){if(e.config.singleton){const{baseURL:t,modules:r,singleton:s}=e.config,i={baseURL:t,modules:r,worker:e.worker,singleton:s},n=J.getInstance(i);n&&(n.meeting=Q(i))}}Object.defineProperty(J,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),exports.Chat=class extends A{constructor(e){super(e,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(e=>{const{body:t}=e;this.emitter.emit("chatMsg",t)}))}msg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/chat/msg`,t)}))}historyMsg(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/chat/historyMsg`,t)}))}},exports.Info=S,exports.Interpretation=class extends A{constructor(e){super(e,"interpretation"),this.data={status:"stopped",interpreters:[]}}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("interpretation",(e=>{const{body:t,state:r}=e;"full"===r?(this.data.interpreters=t.interpreters,this.data.status=t.status):this.data.status=t.status,this.emitter.emit("interpretationChange",this.data)}))}interpretationStart(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/interpretation/start`,e)}interpretationEnd(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/interpretation/stop`)}},exports.Invite=B,exports.LiveStream=class extends A{constructor(e){super(e,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(e=>{var t;const{state:r,body:s,stime:i}=e;if(s){if(i&&(this.data.jetlag=i),"full"===r){const{liveStreams:e=[]}=s;if(!e.length)return;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 v({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 r=this.data.status.map((e=>e));-1===t?r.push({platform:e.platform||"",status:e.requesting?"stopped":e.status||""}):r.splice(t,1,{platform:r[t].platform||"",status:e.requesting?r[t].status||"stopped":e.status||""}),this.data.status=r})),this.data}}))}setStatus(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/liveStream/status`,t)}))}liveStreamDescription(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/liveStream/description`,t)}))}liveStreamSetting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/liveStream/setting`,t)}))}},exports.Me=V,exports.Qa=class extends A{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 r=e.get(t.question.id);const{clientID:s}=this.ctx.config.request;switch(t.command){case"addQuestion":r=this.createQuestion(t.question),e.set(t.question.id,r),this.emitter.emit("questionAdd",{question:r,selfSent:r.sender.endpointID===s});break;case"dismissQuestion":if(!r)break;r.sender.endpointID!==s?r.status="close":r.isTop=!1,e.set(t.question.id,r),this.emitter.emit("questionUpdate",{question:r});break;case"reopenQuestion":r?(r.status="open",r.isTop=t.question.isTop,e.set(t.question.id,r)):(r=this.createQuestion(t.question),e.set(t.question.id,r)),this.emitter.emit("questionUpdate",{question:r});break;case"updateQuestion":r?(r=Object.assign(Object.assign(Object.assign({},r),t.question),{topSort:t.question.isTop?this.data.topSort++:0}),e.set(t.question.id,r)):(r=this.createQuestion(t.question),e.set(t.question.id,r)),this.emitter.emit("questionUpdate",{question:r});break;case"deleteQuestion":if(!r)break;r.sender.endpointID!==s?e.delete(t.question.id):(r.status="delete",r.isTop=!1,r.answers.clear(),e.set(t.question.id,r)),this.emitter.emit("questionDelete",{question:r});break;case"answerQuestion":r?r.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)):(r=this.createQuestion(t.question),r.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)),e.set(t.question.id,r)),this.emitter.emit("questionUpdate",{question:r});break;case"deleteAnswer":r&&(r.answers.delete(t.answer.id),this.emitter.emit("questionUpdate",{question:r}))}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:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/qa`,t)}))}},exports.Recording=class extends A{constructor(e){super(e,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(e=>{const{state:t,body:r,stime:s}=e;if(r)return s&&(this.data.stime=s),this.data.isPracticeSession="started"===r.status&&this.data.status===r.status&&0===r.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),r),"starting"===r.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=r.status||this.data.status),this.data.resultInfo=r.resultInfo||{},["full","update"].includes(t)?(r.recordUsers&&(this.data.recording.recordUsers=r.recordUsers),this.data):void 0}))}history(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.get(`${e}meetings/${t}/recording/history`)}))}status(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/recording/status`,t)}))}layout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/recording/status`,t)}))}designatedUsers(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/recording/designatedUsers`,t)}))}participantAdd(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/recording/participant/add`,t)}))}participantDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/recording/participant/delete`,t)}))}getTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getTemplates`,{params:t})}))}getByIds(t){return e(this,void 0,void 0,(function*(){const{prefix:{user:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/subject/getByIds`,t)}))}recordLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/recording/layout`,t)}))}},exports.Setting=class extends A{constructor(e){super(e,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(e=>{const{state:t,body:r}=e;["full","update"].includes(t)&&v(r,this.data)}))}setting(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/setting`,t)}))}muteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/muteAll`)}))}unmuteAll(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/unmuteAll`)}))}},exports.SpotlightVideo=class extends A{constructor(e){super(e,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(e=>{const{body:t}=e;if(!t||!t.userIDs)return;this.data.userIDs=t.userIDs;t.userIDs.findIndex((e=>e===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(exports.MeEvent.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(exports.MeEvent.UPDATE,{isSpotlightVideo:!1})}))}spotlight(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/view/spotlight`,e)}},exports.Transcript=class extends A{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:r}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${r}/transcript/historyMsg`,t)}))}},exports.Users=G,exports.View=class extends A{constructor(e){super(e,"view")}_topic(){const{endpointType:e,role:t}=this.ctx.modules.me.data;return e===exports.ENDPOINT_TYPE.WEBCTRL?["hostAttendee","audience","advCtrl"]:t===exports.ROLE.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:r,body:s}=e;s&&("meetingView"===r?Object.keys(s).forEach((e=>{this.data[e]=s[e]})):this.data[t]=s)}updatePersonalLayouts(e){const{state:t,body:r}=e;"full"!==t&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),r.personalLayouts.forEach((e=>{const{subscriber:r={userID:-1}}=e,s=r.userID||r.subjectID||-1;"full"===t||"update"===t||e.templateStatus?this.data.personalLayouts[s]=e:delete this.data.personalLayouts[s]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/hostLayout`,t)}))}attendeeLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/attendeeLayout`,t)}))}audienceLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/audienceLayout`,t)}))}personalLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/personalLayout`,t)}))}personalLayoutDelete(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/personalLayout/delete`,t)}))}virtualClassLayout(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/view/virtualClass/layout`,t)}))}closeVirtualClass(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/view/virtualClass/close`)}))}getVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/layout/template/info`,{params:t})}))}addVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/layout/template/add`,t)}))}editVirtualClassTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/layout/template/edit`,t)}))}getTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getTemplates`,{params:t})}))}editTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/edit`,t)}))}addTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/add`,t)}))}deleteTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/delete`,t)}))}getDefaultTemplates(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.get(`${e}personal/vmr/layout/template/getDefaultTemplates`,{params:t})}))}changeDefaultTemplate(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/layout/template/changeDefaultTemplate`,t)}))}perspectiveBind(t){return e(this,void 0,void 0,(function*(){const{prefix:{conference:e}}=this.ctx.config.request;return yield this.ctx.request.post(`${e}personal/vmr/perspective/bind`,t)}))}},exports.Vote=class extends A{constructor(e){super(e,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(e=>{const{body:t}=e,{voteID:r}=t;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[r]=t,this.emitter.emit("voteChange",{vote:this.data.vote,changeData:t})})),this.ctx.emitter.on(exports.MeEvent.LOBBYCHANGE,(e=>{e&&(this.data.vote={})}))}getVotes(e){const{prefix:{vote:t},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}meetings/${r}/votes`,{params:e})}getVote(e){const{prefix:{vote:t},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}meetings/${r}/vote`,{params:e})}getMeVote(e){const{prefix:{vote:t},meetingID:r,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}meetings/${r}/vote/me`,{params:e})}voteStatus(e,t){const{prefix:{vote:r},meetingID:s,voteTk:i}=this.ctx.config.request;return e.tk=e.tk||i,this.ctx.request.post(`${r}meetings/${s}/vote/status?tk=${e.tk}&voteID=${e.voteID}`,t)}voteSubmit(e,t){const{prefix:{vote:r},meetingID:s,voteTk:i}=this.ctx.config.request;return e.tk=e.tk||i,this.ctx.request.post(`${r}meetings/${s}/vote/submit?tk=${e.tk}&voteID=${e.voteID}`,t)}voteAdd(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/add`,e)}voteEdit(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/edit`,e)}voteDelete(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/delete`,e)}voteInProgress(e){const{prefix:{vote:t},meetingID:r,voteTk:s}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${r}/vote/inProgress`,{params:{tk:e&&e.tk||s}})}},exports.Words=class extends A{constructor(e){super(e,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(e=>{this.data.timer&&clearTimeout(this.data.timer);const{state:t,body:r,pollingSeqId:s}=e;if(!r)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data});"full"===t&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),s&&(this.data.barrageRecord=[{id:s,content:r.content,time:(new Date).getTime(),durationType:r.durationType,duration:1e3*r.duration},...this.data.barrageRecord]),r.wordsDisplayStatus=!0,-1!==r.duration&&(this.data.timer=setTimeout((()=>{r.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=r.wordsDisplayStatus,this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})}),1e3*r.duration)),v(r,this.data),this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(exports.MeEvent.ROLECHANGE,(()=>this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})))}barrage(t){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${r}/barrage`,t)}))}deleteBarrage(){return e(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/deleteBarrage`)}))}},exports.createMeeting=function(e){return e.singleton?J.getInstance(e).meeting:Q(e)},exports.reset=K;
1
+ "use strict";function t(t,e,s,r){return new(s||(s=Promise))((function(i,n){function o(t){try{c(r.next(t))}catch(e){n(e)}}function a(t){try{c(r.throw(t))}catch(e){n(e)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))}function e(t){return{all:t=t||new Map,on:function(e,s){var r=t.get(e);r?r.push(s):t.set(e,[s])},off:function(e,s){var r=t.get(e);r&&(s?r.splice(r.indexOf(s)>>>0,1):t.set(e,[]))},emit:function(e,s){var r=t.get(e);r&&r.slice().map((function(t){t(s)})),(r=t.get("*"))&&r.slice().map((function(t){t(e,s)}))}}}Object.defineProperty(exports,"__esModule",{value:!0});var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}};!function(t,e){var r="__lodash_hash_undefined__",i=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",h="[object Promise]",f="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",x="[object WeakMap]",y="[object ArrayBuffer]",b="[object DataView]",E="[object Float32Array]",q="[object Float64Array]",I="[object Int8Array]",D="[object Int16Array]",O="[object Int32Array]",$="[object Uint8Array]",T="[object Uint8ClampedArray]",_="[object Uint16Array]",A="[object Uint32Array]",S=/\w*$/,w=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,U={};U[n]=U["[object Array]"]=U[y]=U[b]=U[o]=U[a]=U[E]=U[q]=U[I]=U[D]=U[O]=U[d]=U[l]=U[p]=U[f]=U[m]=U[g]=U[v]=U[$]=U[T]=U[_]=U[A]=!0,U["[object Error]"]=U[c]=U[x]=!1;var N="object"==typeof self&&self&&self.Object===Object&&self,j="object"==typeof s&&s&&s.Object===Object&&s||N||Function("return this")(),R=e&&!e.nodeType&&e,L=R&&t&&!t.nodeType&&t,C=L&&L.exports===R;function k(t,e){return t.set(e[0],e[1]),t}function M(t,e){return t.add(e),t}function H(t,e,s,r){var i=-1,n=t?t.length:0;for(r&&n&&(s=t[++i]);++i<n;)s=e(s,t[i],i,t);return s}function V(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(s){}return e}function B(t){var e=-1,s=Array(t.size);return t.forEach((function(t,r){s[++e]=[r,t]})),s}function G(t,e){return function(s){return t(e(s))}}function Y(t){var e=-1,s=Array(t.size);return t.forEach((function(t){s[++e]=t})),s}var Q,J=Array.prototype,W=Function.prototype,F=Object.prototype,z=j["__core-js_shared__"],X=(Q=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Q:"",K=W.toString,Z=F.hasOwnProperty,tt=F.toString,et=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),st=C?j.Buffer:void 0,rt=j.Symbol,it=j.Uint8Array,nt=G(Object.getPrototypeOf,Object),ot=Object.create,at=F.propertyIsEnumerable,ct=J.splice,ut=Object.getOwnPropertySymbols,dt=st?st.isBuffer:void 0,lt=G(Object.keys,Object),pt=Lt(j,"DataView"),ht=Lt(j,"Map"),ft=Lt(j,"Promise"),mt=Lt(j,"Set"),gt=Lt(j,"WeakMap"),vt=Lt(Object,"create"),xt=Vt(pt),yt=Vt(ht),bt=Vt(ft),Et=Vt(mt),qt=Vt(gt),It=rt?rt.prototype:void 0,Dt=It?It.valueOf:void 0;function Ot(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var r=t[e];this.set(r[0],r[1])}}function $t(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var r=t[e];this.set(r[0],r[1])}}function Tt(t){var e=-1,s=t?t.length:0;for(this.clear();++e<s;){var r=t[e];this.set(r[0],r[1])}}function _t(t){this.__data__=new $t(t)}function At(t,e){var s=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 s=-1,r=Array(t);++s<t;)r[s]=e(s);return r}(t.length,String):[],r=s.length,i=!!r;for(var o in t)!e&&!Z.call(t,o)||i&&("length"==o||Mt(o,r))||s.push(o);return s}function St(t,e,s){var r=t[e];Z.call(t,e)&&Bt(r,s)&&(void 0!==s||e in t)||(t[e]=s)}function wt(t,e){for(var s=t.length;s--;)if(Bt(t[s][0],e))return s;return-1}function Pt(t,e,s,r,i,h,x){var w;if(r&&(w=h?r(t,i,h,x):r(t)),void 0!==w)return w;if(!Wt(t))return t;var P=Gt(t);if(P){if(w=function(t){var e=t.length,s=t.constructor(e);e&&"string"==typeof t[0]&&Z.call(t,"index")&&(s.index=t.index,s.input=t.input);return s}(t),!e)return function(t,e){var s=-1,r=t.length;e||(e=Array(r));for(;++s<r;)e[s]=t[s];return e}(t,w)}else{var N=kt(t),j=N==c||N==u;if(Qt(t))return function(t,e){if(e)return t.slice();var s=new t.constructor(t.length);return t.copy(s),s}(t,e);if(N==p||N==n||j&&!h){if(V(t))return h?t:{};if(w=function(t){return"function"!=typeof t.constructor||Ht(t)?{}:(e=nt(t),Wt(e)?ot(e):{});var e}(j?{}:t),!e)return function(t,e){return jt(t,Ct(t),e)}(t,function(t,e){return t&&jt(e,Ft(e),t)}(w,t))}else{if(!U[N])return h?t:{};w=function(t,e,s,r){var i=t.constructor;switch(e){case y:return Nt(t);case o:case a:return new i(+t);case b:return function(t,e){var s=e?Nt(t.buffer):t.buffer;return new t.constructor(s,t.byteOffset,t.byteLength)}(t,r);case E:case q:case I:case D:case O:case $:case T:case _:case A:return function(t,e){var s=e?Nt(t.buffer):t.buffer;return new t.constructor(s,t.byteOffset,t.length)}(t,r);case d:return function(t,e,s){return H(e?s(B(t),!0):B(t),k,new t.constructor)}(t,r,s);case l:case g:return new i(t);case f:return function(t){var e=new t.constructor(t.source,S.exec(t));return e.lastIndex=t.lastIndex,e}(t);case m:return function(t,e,s){return H(e?s(Y(t),!0):Y(t),M,new t.constructor)}(t,r,s);case v:return n=t,Dt?Object(Dt.call(n)):{}}var n}(t,N,Pt,e)}}x||(x=new _t);var R=x.get(t);if(R)return R;if(x.set(t,w),!P)var L=s?function(t){return function(t,e,s){var r=e(t);return Gt(t)?r:function(t,e){for(var s=-1,r=e.length,i=t.length;++s<r;)t[i+s]=e[s];return t}(r,s(t))}(t,Ft,Ct)}(t):Ft(t);return function(t,e){for(var s=-1,r=t?t.length:0;++s<r&&!1!==e(t[s],s,t););}(L||t,(function(i,n){L&&(i=t[n=i]),St(w,n,Pt(i,e,s,r,n,t,x))})),w}function Ut(t){return!(!Wt(t)||(e=t,X&&X in e))&&(Jt(t)||V(t)?et:w).test(Vt(t));var e}function Nt(t){var e=new t.constructor(t.byteLength);return new it(e).set(new it(t)),e}function jt(t,e,s,r){s||(s={});for(var i=-1,n=e.length;++i<n;){var o=e[i],a=r?r(s[o],t[o],o,s,t):void 0;St(s,o,void 0===a?t[o]:a)}return s}function Rt(t,e){var s,r,i=t.__data__;return("string"==(r=typeof(s=e))||"number"==r||"symbol"==r||"boolean"==r?"__proto__"!==s:null===s)?i["string"==typeof e?"string":"hash"]:i.map}function Lt(t,e){var s=function(t,e){return null==t?void 0:t[e]}(t,e);return Ut(s)?s:void 0}Ot.prototype.clear=function(){this.__data__=vt?vt(null):{}},Ot.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},Ot.prototype.get=function(t){var e=this.__data__;if(vt){var s=e[t];return s===r?void 0:s}return Z.call(e,t)?e[t]:void 0},Ot.prototype.has=function(t){var e=this.__data__;return vt?void 0!==e[t]:Z.call(e,t)},Ot.prototype.set=function(t,e){return this.__data__[t]=vt&&void 0===e?r:e,this},$t.prototype.clear=function(){this.__data__=[]},$t.prototype.delete=function(t){var e=this.__data__,s=wt(e,t);return!(s<0)&&(s==e.length-1?e.pop():ct.call(e,s,1),!0)},$t.prototype.get=function(t){var e=this.__data__,s=wt(e,t);return s<0?void 0:e[s][1]},$t.prototype.has=function(t){return wt(this.__data__,t)>-1},$t.prototype.set=function(t,e){var s=this.__data__,r=wt(s,t);return r<0?s.push([t,e]):s[r][1]=e,this},Tt.prototype.clear=function(){this.__data__={hash:new Ot,map:new(ht||$t),string:new Ot}},Tt.prototype.delete=function(t){return Rt(this,t).delete(t)},Tt.prototype.get=function(t){return Rt(this,t).get(t)},Tt.prototype.has=function(t){return Rt(this,t).has(t)},Tt.prototype.set=function(t,e){return Rt(this,t).set(t,e),this},_t.prototype.clear=function(){this.__data__=new $t},_t.prototype.delete=function(t){return this.__data__.delete(t)},_t.prototype.get=function(t){return this.__data__.get(t)},_t.prototype.has=function(t){return this.__data__.has(t)},_t.prototype.set=function(t,e){var s=this.__data__;if(s instanceof $t){var r=s.__data__;if(!ht||r.length<199)return r.push([t,e]),this;s=this.__data__=new Tt(r)}return s.set(t,e),this};var Ct=ut?G(ut,Object):function(){return[]},kt=function(t){return tt.call(t)};function Mt(t,e){return!!(e=null==e?i:e)&&("number"==typeof t||P.test(t))&&t>-1&&t%1==0&&t<e}function Ht(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||F)}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&&kt(new pt(new ArrayBuffer(1)))!=b||ht&&kt(new ht)!=d||ft&&kt(ft.resolve())!=h||mt&&kt(new mt)!=m||gt&&kt(new gt)!=x)&&(kt=function(t){var e=tt.call(t),s=e==p?t.constructor:void 0,r=s?Vt(s):void 0;if(r)switch(r){case xt:return b;case yt:return d;case bt:return h;case Et:return m;case qt:return x}return e});var Gt=Array.isArray;function Yt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}(t.length)&&!Jt(t)}var Qt=dt||function(){return!1};function Jt(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 Ft(t){return Yt(t)?At(t):function(t){if(!Ht(t))return lt(t);var e=[];for(var s in Object(t))Z.call(t,s)&&"constructor"!=s&&e.push(s);return e}(t)}t.exports=function(t){return Pt(t,!0,!0)}}(r,r.exports);var i=r.exports;const n=t=>({get(e,s,r){if("__isProxy"===s)return!0;const i=Reflect.get(e,s);return Array.isArray(i)?i:"object"==typeof i&&null!==i?i.__isProxy?i:new Proxy(i,n(t)):i},set(e,s,r,n){const o=e[s];r=h(r)&&r.__isProxy?i(r):r;const a=Reflect.set(e,s,r,n);return((t,e)=>t!==e&&(t==t||e==e))(r,o)&&t.emit(`${y(s)}Change`,r),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 e=t.timeout||18e5;let s=t.headers||{};return t.url=I(this.baseURL,t.url||""),t.url=((t,e)=>{if(!e)return t;const s=[];Object.keys(e).forEach((t=>{const r=e[t];if(null==r)return;let i;Array.isArray(r)?(i=r,t+="[]"):i=[r],i.forEach((e=>{null!==e&&"object"==typeof e&&(e=JSON.stringify(e)),s.push(`${o(t)}=${o(e)}`)}))}));const r=s.join("&");if(r){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+r}return t})(t.url,t.params),s=Object.assign(s,this._defaultHeaders),Object.keys(s).forEach((t=>{"Content-Type"!==t&&t.toUpperCase()==="Content-Type".toUpperCase()&&(s["Content-Type"]=s[t],delete s[t])})),f(t.data)&&(t.data=t.data.buffer),m(t.data)&&(s&&!s["Content-Type"]&&(s["Content-Type"]="application/json;charset=utf-8"),t.data=JSON.stringify(t.data)),t.headers=s,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,s){return this._errorHandler?this._request(Object.assign(s||{},{url:t,method:"POST",data:e})).catch((t=>{throw this._errorHandler&&this._errorHandler(t),t})):this._request(Object.assign(s||{},{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,s)=>{const{data:r=null,url:i,method:n="GET",headers:o,cancelToken:a}=t;let c=new XMLHttpRequest;c.open(n.toUpperCase(),i,!0),c.timeout=t.timeout;const u=()=>{if(c){if(c.status>=200&&c.status<300)try{const t=JSON.parse(c.responseText);e(t)}catch(t){s(new Error("E_JSON_PARSE"+c.responseText))}else s({url:i,statusCode:c.status});c=null}};"onloadend"in c?c.onloadend=u:c.onreadystatechange=()=>{c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(u)},c.onabort=()=>{c&&(s({url:i,statusCode:c.status,type:"request abort"}),c=null)},c.onerror=()=>{s(new Error("Network Error")),c=null},c.ontimeout=()=>{s(new Error("timeout of "+t.timeout+"ms exceeded")),c=null},"setRequestHeader"in c&&Object.keys(o).forEach((t=>{null===r&&"content-type"===t.toLowerCase()?delete o[t]:c.setRequestHeader(t,o[t])})),a&&a.promise.then((t=>{c&&(c.abort(),s(t),c=null)})),c.send(r)})),d=t=>new Promise(((e,s)=>{const{data:r=null,url:i,method:n="GET",headers:o,cancelToken:a}=t,c=wx.request({url:i,data:r,method:n.toUpperCase(),timeout:t.timeout,header:o,success(t){t.statusCode>=200&&t.statusCode<300?e(t.data):s({url:i,statusCode:t.statusCode})},fail(t){s("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 s=0;s<36;s++)t[s]=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[s,r]=[t[0],t[1]];if(null!==r)return h(r)&&!l(r)?(e[s]||(e[s]={}),void(e[s]=v(r,e[s]))):void(e[s]=r)})),e):e,x=/-(\w)/g,y=t=>t.replace(x,((t,e)=>e?e.toUpperCase():"")),{hasOwnProperty:b}=Object.prototype,E=(t,e)=>b.call(t,e),q=(t,e=new Map)=>{if(e.get(t))return e.get(t);if(!(t instanceof Object))return t;let s;s=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,s);for(const r in t)E(t,r)&&(s[r]=q(t[r],e));return s},I=(t,e)=>t&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)?((t,e)=>e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t)(t,e):e;var D,O,$,T,_;exports.EVENT=void 0,(D=exports.EVENT||(exports.EVENT={})).STATE="state",D.FAILED="failed",D.REQUEST_ERROR="requestError",D.POLLING_ERROR="pollingError",D.KEEPALIVE_ERROR="keepaliveError",exports.STATE=void 0,(O=exports.STATE||(exports.STATE={}))[O.CLOSE=0]="CLOSE",O[O.JOINED=1]="JOINED",O[O.READY=2]="READY",exports.ENDPOINT_TYPE=void 0,($=exports.ENDPOINT_TYPE||(exports.ENDPOINT_TYPE={})).WEBAPP="webApp",$.WEBCTRL="webCtrl",$.WECHATMP="weChatMP",$.SUPERVISION="supervision",$.BIGSCREEN="bigScreen",$.DESKTOP="desktop",$.MOBILE="mobile",$.VCS="vcs",$.SIP="sip",$.H323="h323",$.PSTN="pstn",$.MULTI_STREAM="multiStream",$.MEETING_TOUCH="meetingTouch",exports.ROLE=void 0,(T=exports.ROLE||(exports.ROLE={})).HOST="host",T.COHOST="coHost",T.ATTENDEE="attendee",T.AUDIENCE="audience",exports.RECORD_STATUS=void 0,(_=exports.RECORD_STATUS||(exports.RECORD_STATUS={})).STARTED="started",_.PAUSED="paused",_.STARTING="starting",_.STOPPED="stopped";class A{constructor(t,s){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"on",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"off",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=s,this.ctx=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,s=(t,r)=>{Object.keys(t).forEach((i=>{!1===r&&i in this.data&&(t[i]=this.data[i]);const n=e=>t[i]=e,o=`${y(i)}Change`;this.emitter.on(o,n),e.set(o,n),h(t[i])&&!l(t[i])&&s(t[i],!0)}))};return s(t,!1),t._destory=()=>{e.forEach(((t,e)=>{this.emitter.off(e,t)}))},t}}class S extends A{constructor(t){super(t,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(t=>{const{state:e,body:s}=t;("full"===e||"update"===e)&&v(s,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:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/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:s}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/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:s}=this.ctx.config.request;return this.ctx.request.get(`${e}mailTemplate`,{params:{meetingID:s},headers:{language:t.language}})}}function w(t){const e=[],{isInLobby:s}=t.modules.me.data;return s?(e.push("lobbyMember"),e):(Object.keys(t.modules).forEach((s=>{const r=t.modules[s]._topic();r&&(Array.isArray(r)?r.forEach((t=>{e.includes(t)||e.push(t)})):e.includes(r)||e.push(r))})),e)}function P(e,s){return t(this,void 0,void 0,(function*(){const{meetingID:t,clientID:r}=s.config.request,i=yield s.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:r,meetingId:t},inboxes:e}),n=[];return i.data&&Object.keys(i.data).forEach((t=>{n.push({name:t,seqId:i.data[t].maxSeqId,limit:200})})),n}))}function U(e,s){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r,clientID:i}=s.config.request,n=yield s.request.post(`${t}meetings/${r}/subscribe`,{endpointID:i,topics:e}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((t=>{s.emitter.emit(t.event,t)}))}))}function N(e,s,r){return t(this,void 0,void 0,(function*(){const{inboxes:i,clientID:n,meetingID:o,cancelToken:a,status:c}=s;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:i},{cancelToken:a})}catch(d){return c.attempts++,void console.error(d)}if(!t)return console.error("polling error: ","response is null"),void c.attempts++;const{data:s={},bizCode:u,error:d}=t;if(u&&900408!==u)return console.error("polling error: ",JSON.stringify(d)),void c.attempts++;c.attempts=0,s&&Object.keys(s).forEach((t=>{const e=i.find((e=>e.name===t));e&&(e.seqId=s[t].maxSeqId,s[t].items&&s[t].items.forEach((t=>{const e=JSON.parse(t.content);["liveStream","recording"].includes(e.event)&&(e.stime=t.stime),e.pollingSeqId=t.seqId,r(e)})))}))})))(),!c.running)return;if(c.attempts>k)return console.error("polling Max Attempts"),void(s.onError&&s.onError({message:"polling Max Attempts"}));const u=c.attempts?M(c.attempts):0;c.timer=setTimeout((()=>{c.running&&N(e,s,r)}),u)}))}const j=(e,s)=>t(void 0,void 0,void 0,(function*(){const{meetingID:t,clientID:r}=s.config.request;s.status.polling.running=!0,N(s.request,{inboxes:e,clientID:r,meetingID:t,cancelToken:s.config.request.cancelToken.token,status:s.status.polling,onError:t=>{s.emitter.emit(exports.EVENT.POLLING_ERROR,t)}},(t=>{s.emitter.emit(t.event,t)}))}));function R(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 L(e,s){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:r},meetingID:i,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(`${r}meetings/${i}/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:s={},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=s.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>k)return console.error("keepalive Max Attempts"),void(s&&s({message:"keepalive Max Attempts"}));const o=e.status.keepalive.attempts?M(e.status.keepalive.attempts):1e3*e.status.keepalive.interval;e.status.keepalive.timer=setTimeout((()=>{e.status.keepalive.running&&L(e,s)}),o)}))}const C=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)},k=5,M=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 H;exports.MeEvent=void 0,(H=exports.MeEvent||(exports.MeEvent={})).INIT="meInit",H.UPDATE="meUpdate",H.UPDATE_USER_STATE="updateUserState",H.ROLECHANGE="meRoleChange",H.AUDIOCHANGE="meAudioChange",H.HANDUPCHANGE="meHandupChange",H.SETAUDIO="setAudio",H.VIDEOCHANGE="meVideoChange",H.SETVIDEO="setVideo",H.SHARECHANGE="meShareChange",H.DISPLAYNAMECHANGE="meDisplayNameChange",H.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",H.LOBBYCHANGE="meLobbyChange",H.BARRAGECHANGE="meBarrageChange",H.PERSONALLAYOUTCHANGE="personalLayoutChange",H.LEAVE="leave";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!==exports.ROLE.AUDIENCE&&t!==exports.ROLE.AUDIENCE||(yield this.rePolling("roleChange")),this.emitter.emit(exports.MeEvent.ROLECHANGE,e.role),this.ctx.emitter.emit(exports.MeEvent.ROLECHANGE,e.role)}})),s=t=>{var e,s,r,i,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===(s=this.data.audio)||void 0===s?void 0:s.sendOn)||!p(u)&&c!==(null===(r=this.data.audio)||void 0===r?void 0:r.recvOn)||!p(d))&&(v({audio:t.audio},this.data),this.emitter.emit(exports.MeEvent.AUDIOCHANGE,{deviceOn:p(a)?null===(i=this.data.audio)||void 0===i?void 0:i.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,changeData:Object.assign({},t.audio)}))}},r=t=>{var e,s,r,i,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===(s=this.data.video)||void 0===s?void 0:s.sendOn)||!p(d)&&d!==(null===(r=this.data.video)||void 0===r?void 0:r.blocked))&&(v({video:t.video},this.data),this.emitter.emit(exports.MeEvent.VIDEOCHANGE,{deviceOn:p(a)?null===(i=this.data.video)||void 0===i?void 0:i.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,changeData:Object.assign({},t.video)}))}},i=t=>{var e,s,r,i;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===(s=this.data.share)||void 0===s?void 0:s.sendOn))&&(v({share:t.share},this.data),this.emitter.emit(exports.MeEvent.SHARECHANGE,{deviceOn:p(n)?null===(r=this.data.share)||void 0===r?void 0:r.deviceOn:n,sendOn:p(o)?null===(i=this.data.share)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},n=t=>{t.displayName&&t.displayName!==this.data.displayName&&(v({displayName:t.displayName},this.data),this.emitter.emit(exports.MeEvent.DISPLAYNAMECHANGE,t.displayName))},o=t=>{"isHandUp"in t&&t.isHandUp!==this.data.isHandUp&&(v({isHandUp:t.isHandUp},this.data),this.emitter.emit(exports.MeEvent.HANDUPCHANGE,t.isHandUp))},a=t=>{"isSpotlightVideo"in t&&(v({isSpotlightVideo:t.isSpotlightVideo},this.data),this.emitter.emit(exports.MeEvent.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(exports.MeEvent.LOBBYCHANGE,e.isInLobby),this.ctx.emitter.emit(exports.MeEvent.LOBBYCHANGE,e.isInLobby)}})),u=e=>t(this,void 0,void 0,(function*(){const{event:t,state:s,body:r}=e;"personalLayout"===t&&("full"===s?v({personalLayout:r},this.data):"delete"===s&&(this.data.personalLayout=void 0),console.log(this.data.personalLayout),this.emitter.emit(exports.MeEvent.PERSONALLAYOUTCHANGE,this.data.personalLayout))})),d=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(exports.MeEvent.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:s}=this.data;if(this.data.endpointType===exports.ENDPOINT_TYPE.SUPERVISION){const{info:t}=this.ctx.modules;s="webinar"===t.meetingType?exports.ROLE.AUDIENCE:exports.ROLE.ATTENDEE}s===exports.ROLE.HOST||s===exports.ROLE.COHOST?e=t.barrage.receiver.host?e:null:s===exports.ROLE.ATTENDEE?e=t.barrage.receiver.attendee?e:null:s===exports.ROLE.AUDIENCE&&(e=t.barrage.receiver.audience?e:null),delete t.barrage,this.data.barrage=e||void 0,this.emitter.emit(exports.MeEvent.BARRAGECHANGE,e)},l=t=>{"leave"in t&&!0===t.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),R(this.ctx),K(this.ctx),this.emitter.emit(exports.MeEvent.LEAVE,t.resultInfo),this.ctx.cleanup(t.resultInfo))},h=t=>{e(t),s(t),r(t),i(t),n(t),o(t),c(t),a(t),d(t),l(t),(this.data.isInLobby||this.data.role===exports.ROLE.AUDIENCE)&&this.data.share&&this.data.share.sendOn&&i({share:{deviceOn:!0,sendOn:!1,recvOn:!1}})};this.ctx.emitter.on(exports.MeEvent.INIT,(t=>{v(t,this.data),this.data.isUpdatedUserState=!1})),this.ctx.emitter.on(exports.MeEvent.UPDATE,(t=>{h(t),v(t,this.data)})),this.ctx.emitter.on(exports.EVENT.STATE,(({state:t})=>{t===exports.STATE.READY&&this.data.endpointType!==exports.ENDPOINT_TYPE.SUPERVISION&&this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on("me",(e=>t(this,void 0,void 0,(function*(){const{state:t,body:s={users:[]}}=e;if("delete"===t){const t=s.users[0];return t.leave=!0,void l(t)}let r=s.users.find((t=>t.userID===this.data.userID));r||s.users.length&&(r=s.users[0]),r?(h(r),v(r,this.data)):console.warn("me ",t,s)})))),this.ctx.emitter.on("setUserVideo",(t=>{this.emitter.emit(exports.MeEvent.SETVIDEO,t.body)})),this.ctx.emitter.on("setUserAudio",(t=>{this.emitter.emit(exports.MeEvent.SETAUDIO,t.body)})),this.ctx.emitter.on("meetingState",(t=>{const{body:e={}}=t;if("ended"===e.state){l({leave:!0,resultInfo:e.resultInfo})}})),this.ctx.emitter.on("personalLayout",(t=>{u(t)}))}updateUserState(t,e=!1){if(!e){const{role:e,initialMediaState:s}=this.data;t.audio.sendOn=t.audio.sendOn&&s.audio.sendOn,t.video.sendOn=t.video.sendOn&&s.video.sendOn,e===exports.ROLE.AUDIENCE&&(t.audio.sendOn=!1,t.video.sendOn=!1)}const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,v(t,this.data),this.ctx.request.post(`${s}meetings/${r}/updateUserState`,t)}rePolling(e){return t(this,void 0,void 0,(function*(){const{ctx:t}=this;R(t);const s=w(t),r=yield P(s,t);if(e&&this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,{data:this.data,event:e}),yield U(s,t),"undefined"!=typeof Worker&&t.worker){const{meetingID:e,clientID:i}=t.config.request;t.worker.postMessage({inboxes:r,topics:s,meetingID:e,clientID:i,rePolling:!0})}else yield j(r,t)}))}}class B extends A{constructor(t){super(t,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(t=>{const{body:e,state:s}=t;if(e&&e.users){if("full"===s)return this.data.callRecordUsers=e.users.map((t=>(t.displayNamePinyin=B.setDisplayNamePinyinProp?B.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"===s&&-1!==e?v(t,this.data.callRecordUsers[e]):"update"===s&&-1===e&&(t.displayNamePinyin=B.setDisplayNamePinyinProp?B.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:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/invite`,t)}cancelInvite(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/cancelInvite`,t)}}class G 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===exports.ENDPOINT_TYPE.SUPERVISION?["interactive","broadcast"]:t===exports.ROLE.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const t=(t,{event:e,state:s})=>{if(t.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:r={}}=t;if("delete"!==s||"delete"===s&&[901357,901358,901352,901351,901350,901349].includes(r.bizCode||-1))return void this.ctx.emitter.emit(exports.MeEvent.UPDATE,t);let i=!1;switch(e){case"interactiveUsers":t.isInLobby||(i=!0);break;case"broadcastUsers":t.isInLobby||t.role!==exports.ROLE.AUDIENCE||(i=!0);break;case"lobbyUsers":t.isInLobby&&(i=!0)}const n={};i&&(n.leave=!0),this.ctx.emitter.emit(exports.MeEvent.UPDATE,Object.assign(Object.assign({},t),n))},e=({updateUsers:e,state:s,sourceKey:r})=>{if("full"===s)return this.data[r]=e.map((e=>(e.displayNamePinyin=G.setDisplayNamePinyinProp?G.setDisplayNamePinyinProp(e.displayName):e.displayName,e.groupIDs=G.setUserGroupIDs?G.setUserGroupIDs(e.groupIDs||[]):e.groupIDs,t(e,{event:r,state:s}),e))),this.emitter.emit(`${r}Change`,{users:this.data[r],isFull:!0}),this.data[r];void 0===this.data[r]&&(this.data[r]=[]);const{data:i,emitter:n}=this;return e.forEach((e=>{const o=i[r].findIndex((t=>e.userID===t.userID));if("delete"===s&&-1!==o){const[t]=this.data[r].splice(o,1);n.emit(`${r}Delete`,{user:t,resultInfo:e.resultInfo})}else if("update"===s&&-1!==o){const t=this.data[r][o];this.updateUserProps(e,t),v(e,t),this.data[r][o]=q(t),this.emitter.emit(`${r}Update`,{user:this.data[r][o]})}else"update"===s&&-1===o&&(e.displayNamePinyin=G.setDisplayNamePinyinProp?G.setDisplayNamePinyinProp(e.displayName):e.displayName,i[r].push(e),this.emitter.emit(`${r}Add`,{user:e,resultInfo:e.resultInfo}));t(e,{event:r,state:s})})),this.emitter.emit(`${r}Change`,{users:this.data[r],isFull:!1}),this.data[r]};this.ctx.emitter.on("interactiveUsers",(t=>{const{state:s,body:r}=t;e({updateUsers:r.users,state:s,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(t=>{const{state:s,body:r}=t;e({updateUsers:r.users,state:s,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(t=>{const{state:s,body:r}=t;e({updateUsers:r.users,state:s,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(t=>{const{state:s,body:r}=t;e({updateUsers:r.users,state:s,sourceKey:"advCtrlUsers"})}))}reactive(t){if(!h(t))return console.warn("Parameter is not an object!"),t;const e=new Map,s=(t,r)=>{Object.keys(t).forEach((i=>{!1===r&&i in this.data&&(t[i]=this.data[i]);const n=e=>t[i]=e.users.map((t=>t)),o=`${y(i)}Change`;this.emitter.on(o,n),e.set(o,n),h(t[i])&&!l(t[i])&&s(t[i],!0)}))};return s(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=G.setDisplayNamePinyinProp?G.setDisplayNamePinyinProp(t.displayName):t.displayName)}setAudio(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/audio`,e)}setVideo(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/video`,e)}setShare(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/share`,e)}setWhiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}users/${t}/whiteboard`,e)}handUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/handUp`,e)}setRole(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/role`,e)}rename(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/displayName`,e)}remove(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/remove`)}replyHandUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/replyHandUp`,e)}fecc(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/fecc`,e)}lobbyState(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/lobbyState`,e)}allowLocalRecord(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/allowLocalRecord`,e)}whiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/whiteboard`,e)}callStats(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/users/${t}/callStats`)}callStatsReport(t){if(!t.userID)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/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:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/sendLayout`)}setSendLayout(t,e){const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/sendLayout`,e)}setSendLayoutEnabled(t,e){const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${s}meetings/${r}/users/${t}/sendLayoutEnabled`,e)}pauseAudio(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/pauseAudio`)}resumeAudio(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/users/${t}/resumeAudio`)}modifyRoleBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/modifyRoleBatch `,t)}modifyVideoBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/modifyVideoBatch `,t)}putInLobbyBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/putInLobbyBatch `,t)}removeBatch(t){const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/removeBatch `,t)}}function Y(t){const{baseURL:s,modules:r,worker:i,singleton:n}=t;r.findIndex((t=>t===V))<0&&r.push(V),r.findIndex((t=>t===S))<0&&r.push(S);const o=t.clientID||`${g()}_${((t=new Date,e)=>{const s={"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 r in s)new RegExp("("+r+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?s[r]:("00"+s[r]).substr((""+s[r]).length)));return e})(new Date,"MMddHHmmss")}`,u={config:{baseURL:s,modules:r,singleton:n||!1,request:{cancelToken:c.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1/"},clientID:o,location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:i,emitter:e(),request:new a({baseURL:s,beforeRequest:t=>{t.headers["X-Y-Request-Id"]=g(),t.timeout=18e5},error:t=>{u.emitter.emit(exports.EVENT.REQUEST_ERROR,t)}}),modules:{},state:exports.STATE.CLOSE,status:{polling:{running:!1,attempts:0,timer:null},keepalive:{running:!1,attempts:0,timer:null,interval:20}},cleanup:t=>{u.state!==exports.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",""),Object.keys(u.modules).forEach((t=>{u.modules[t].cleanup()})),u.state=exports.STATE.CLOSE,u.emitter.emit(exports.EVENT.STATE,{state:u.state,reason:t}))}};return u}function Q(t){const e=Y(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 s=new t(e);e.modules[s.moduleName]=s}))}(e.config.modules,e),e.emitter.on(exports.EVENT.POLLING_ERROR,(t=>{W(e)({resultInfo:t})})),e.emitter.on(exports.EVENT.KEEPALIVE_ERROR,(t=>{W(e)({resultInfo:t})})),Object.assign({config:e.config,request:e.request,get state(){return e.state},on:e.emitter.on,off:e.emitter.off,join:J(e),leave:W(e),end:F(e),endMeeting:z(e)},e.modules)}function J(e){return function(s){var r;return t(this,void 0,void 0,(function*(){const{clientID:t}=e.config.request,i=`${null===(r=s.endpointType)||void 0===r?void 0:r.toLocaleUpperCase()}${t}_${s.meetingNum}`;e.config.request.sessionID=i,e.request.setDefaultHeader("X-Y-Session-Id",i);const{prefix:n}=e.config.request,o=yield e.request.get(`${n.ctrl}credential`,{params:{meetingNum:s.meetingNum,pwd:s.pwd,url:s.url,mobileCode:s.mobileCode,mobile:s.mobile,regEmail:s.regEmail,accEmail:s.accEmail,tk:s.tk,displayName:s.displayName,userAgent:s.userAgent},headers:{"X-Y-Endpoint-Type":s.endpointType}}),{credential:a="",location:c=""}=o&&o.data||{};if(!a)return e.emitter.emit(exports.EVENT.FAILED,{bizCode:o.bizCode,data:o.data}),o;e.config.request.location=c,e.request.setDefaultHeader("X-Y-Location",c),delete s.pwd,delete s.url;const u={displayName:s.displayName,userAgent:s.userAgent,clientID:t};s.groupIDs&&s.account&&(u.groupIDs=s.groupIDs,u.account=s.account,u.groupName=s.groupName);const d=yield e.request.post(`${n.ctrl}join?meetingNum=${s.meetingNum}&credential=${a}`,u,{headers:{"X-Y-Endpoint-Type":s.endpointType,"X-Y-Endpoint-Id":t}});if(!d||d&&d.ret<=-1)return e.emitter.emit(exports.EVENT.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(exports.MeEvent.INIT,Object.assign(Object.assign({},h),{mediaContent:f,initialMediaState:m})),e.state=exports.STATE.JOINED,e.emitter.emit(exports.EVENT.STATE,{state:e.state});const v=()=>{e.state!==exports.STATE.READY&&(e.state=exports.STATE.READY,e.emitter.emit(exports.EVENT.STATE,{state:e.state}))},x=w(e),y=yield P(x,e);return yield U(x,e),"undefined"!=typeof Worker&&e.worker?(e.status.polling.running=!0,e.worker.postMessage({topics:x,meetingID:l,clientID:t,inboxes:y,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,j(y,e),v()),e.status.keepalive.running=!0,L(e,(t=>{e.emitter.emit(exports.EVENT.KEEPALIVE_ERROR,t)})),d.data=Object.assign(Object.assign({},d.data),o.data),d}))}}function W(e){return function(s){return t(this,void 0,void 0,(function*(){s||(s={resultInfo:{bizCode:901359}});const{prefix:t,meetingID:r}=e.config.request;let i;try{i=yield e.request.post(`${t.ctrl}meetings/${r}/leave`,s)}catch(n){console.error(n)}return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),R(e),C(e),K(e),e.cleanup(),i}))}}function F(e){return function(){return t(this,void 0,void 0,(function*(){const{prefix:t,meetingID:s}=e.config.request,r=yield e.request.post(`${t.ctrl}meetings/${s}/end`);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),R(e),C(e),K(e),e.cleanup(),r}))}}function z(e){return function(s){return t(this,void 0,void 0,(function*(){const{prefix:t}=e.config.request;return yield e.request.post(`${t.ctrl}meetingNum/${s}/end`)}))}}class X{constructor(t){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=Q(t)}static getInstance(t){return this.instance?this.instance:this.instance=new X(t)}}function K(t){if(t.config.singleton){const{baseURL:e,modules:s,singleton:r}=t.config,i={baseURL:e,modules:s,worker:t.worker,singleton:r},n=X.getInstance(i);n&&(n.meeting=Q(i))}}Object.defineProperty(X,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),exports.Chat=class 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:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/chat/msg`,e)}))}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/chat/historyMsg`,e)}))}},exports.Info=S,exports.Interpretation=class 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:s}=t;"full"===s?(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:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/interpretation/start`,t)}interpretationEnd(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/interpretation/stop`)}},exports.Invite=B,exports.LiveStream=class extends A{constructor(t){super(t,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(t=>{var e;const{state:s,body:r,stime:i}=t;if(r){if(i&&(this.data.jetlag=i),"full"===s){const{liveStreams:t=[]}=r;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=[]),r.liveStreams||(this.data.resultInfo={}),null===(e=r.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 s=this.data.status.map((t=>t));-1===e?s.push({platform:t.platform||"",status:t.requesting?"stopped":t.status||""}):s.splice(e,1,{platform:s[e].platform||"",status:t.requesting?s[e].status||"stopped":t.status||""}),this.data.status=s})),this.data}}))}setStatus(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/liveStream/status`,e)}))}liveStreamDescription(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/liveStream/description`,e)}))}liveStreamSetting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/liveStream/setting`,e)}))}},exports.Me=V,exports.Qa=class 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 s=t.get(e.question.id);const{clientID:r}=this.ctx.config.request;switch(e.command){case"addQuestion":s=this.createQuestion(e.question),t.set(e.question.id,s),this.emitter.emit("questionAdd",{question:s,selfSent:s.sender.endpointID===r});break;case"dismissQuestion":if(!s)break;s.sender.endpointID!==r?s.status="close":s.isTop=!1,t.set(e.question.id,s),this.emitter.emit("questionUpdate",{question:s});break;case"reopenQuestion":s?(s.status="open",s.isTop=e.question.isTop,t.set(e.question.id,s)):(s=this.createQuestion(e.question),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"updateQuestion":s?(s=Object.assign(Object.assign(Object.assign({},s),e.question),{topSort:e.question.isTop?this.data.topSort++:0}),t.set(e.question.id,s)):(s=this.createQuestion(e.question),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"deleteQuestion":if(!s)break;s.sender.endpointID!==r?t.delete(e.question.id):(s.status="delete",s.isTop=!1,s.answers.clear(),t.set(e.question.id,s)),this.emitter.emit("questionDelete",{question:s});break;case"answerQuestion":s?s.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)):(s=this.createQuestion(e.question),s.answers.set(e.answer.id,this.createQuestionAnswer(e.answer)),t.set(e.question.id,s)),this.emitter.emit("questionUpdate",{question:s});break;case"deleteAnswer":s&&(s.answers.delete(e.answer.id),this.emitter.emit("questionUpdate",{question:s}))}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:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/qa`,e)}))}},exports.Recording=class extends A{constructor(t){super(t,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(t=>{const{state:e,body:s,stime:r}=t;if(s)return r&&(this.data.stime=r),this.data.isPracticeSession="started"===s.status&&this.data.status===s.status&&0===s.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),s),"starting"===s.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=s.status||this.data.status),this.data.resultInfo=s.resultInfo||{},["full","update"].includes(e)?(s.recordUsers&&(this.data.recording.recordUsers=s.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:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/recording/status`,e)}))}layout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/recording/status`,e)}))}designatedUsers(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/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:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/recording/layout`,e)}))}},exports.Setting=class extends A{constructor(t){super(t,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(t=>{const{state:e,body:s}=t;["full","update"].includes(e)&&v(s,this.data)}))}setting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/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`)}))}},exports.ShouldJoinUsers=class extends A{constructor(t){super(t,"shouldJoinUsers")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("shouldJoinUsers",(t=>{const{state:e}=t;"update"===e&&this.emitter.emit("shouldJoinUsersChange")}))}modifyUser(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/shouldJoinUser/modify`,t)}getUser(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${e}/attendance/getShouldJoin`)}},exports.SpotlightVideo=class 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(exports.MeEvent.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(exports.MeEvent.UPDATE,{isSpotlightVideo:!1})}))}spotlight(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${s}/view/spotlight`,t)}},exports.Transcript=class extends A{constructor(t){super(t,"transcript")}_topic(){return["transcript","meeting"]}_bindOn(){this.ctx.emitter.on("transcriptMsg",(t=>{const{body:e}=t;this.emitter.emit("transcriptMsg",e)})),this.ctx.emitter.on("asr",(t=>{const{body:e}=t;void 0===this.data.asr&&(this.data.asr={status:"stopped"}),v(e,this.data.asr),this.emitter.emit("asrChange",{asr:this.data.asr,changeData:e})}))}cleanup(){this.emitter.all=new Map}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/transcript/historyMsg`,e)}))}transcriptStatus(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${s}/transcript/status`,e)}))}},exports.Users=G,exports.View=class extends A{constructor(t){super(t,"view")}_topic(){const{endpointType:t,role:e}=this.ctx.modules.me.data;return t===exports.ENDPOINT_TYPE.WEBCTRL?["hostAttendee","audience","advCtrl"]:e===exports.ROLE.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:s,body:r}=t;r&&("meetingView"===s?Object.keys(r).forEach((t=>{this.data[t]=r[t]})):this.data[e]=r)}updatePersonalLayouts(t){const{state:e,body:s}=t;"full"!==e&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),s.personalLayouts.forEach((t=>{const{subscriber:s={userID:-1}}=t,r=s.userID||s.subjectID||-1;"full"===e||"update"===e||t.templateStatus?this.data.personalLayouts[r]=t:delete this.data.personalLayouts[r]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/hostLayout`,e)}))}attendeeLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/attendeeLayout`,e)}))}audienceLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/audienceLayout`,e)}))}personalLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/personalLayout`,e)}))}personalLayoutDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/view/personalLayout/delete`,e)}))}virtualClassLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/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)}))}},exports.Vote=class extends A{constructor(t){super(t,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(t=>{const{body:e}=t,{voteID:s}=e;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[s]=e,this.emitter.emit("voteChange",{vote:this.data.vote,changeData:e})})),this.ctx.emitter.on(exports.MeEvent.LOBBYCHANGE,(t=>{t&&(this.data.vote={})}))}getVotes(t){const{prefix:{vote:e},meetingID:s,voteTk:r}=this.ctx.config.request;return t.tk=t.tk||r,this.ctx.request.get(`${e}meetings/${s}/votes`,{params:t})}getVote(t){const{prefix:{vote:e},meetingID:s,voteTk:r}=this.ctx.config.request;return t.tk=t.tk||r,this.ctx.request.get(`${e}meetings/${s}/vote`,{params:t})}getMeVote(t){const{prefix:{vote:e},meetingID:s,voteTk:r}=this.ctx.config.request;return t.tk=t.tk||r,this.ctx.request.get(`${e}meetings/${s}/vote/me`,{params:t})}voteStatus(t,e){const{prefix:{vote:s},meetingID:r,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.post(`${s}meetings/${r}/vote/status?tk=${t.tk}&voteID=${t.voteID}`,e)}voteSubmit(t,e){const{prefix:{vote:s},meetingID:r,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.post(`${s}meetings/${r}/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:s,voteTk:r}=this.ctx.config.request;return this.ctx.request.get(`${e}meetings/${s}/vote/inProgress`,{params:{tk:t&&t.tk||r}})}},exports.Words=class 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:s,pollingSeqId:r}=t;if(!s)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data});"full"===e&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),r&&(this.data.barrageRecord=[{id:r,content:s.content,time:(new Date).getTime(),durationType:s.durationType,duration:1e3*s.duration},...this.data.barrageRecord]),s.wordsDisplayStatus=!0,-1!==s.duration&&(this.data.timer=setTimeout((()=>{s.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=s.wordsDisplayStatus,this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})}),1e3*s.duration)),v(s,this.data),this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(exports.MeEvent.ROLECHANGE,(()=>this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})))}barrage(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${s}/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`)}))}},exports.createMeeting=function(t){return t.singleton?X.getInstance(t).meeting:Q(t)},exports.reset=K;