@ylink-sdk/meeting 0.2.0-beta.9 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
var YlinkSDKMeeting=function(e){"use strict";function t(e,t,i,s){return new(i||(i=Promise))((function(r,n){function o(e){try{c(s.next(e))}catch(t){n(t)}}function a(e){try{c(s.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(o,a)}c((s=s.apply(e,t||[])).next())}))}function i(e){return{all:e=e||new Map,on:function(t,i){var s=e.get(t);s?s.push(i):e.set(t,[i])},off:function(t,i){var s=e.get(t);s&&(i?s.splice(s.indexOf(i)>>>0,1):e.set(t,[]))},emit:function(t,i){var s=e.get(t);s&&s.slice().map((function(e){e(i)})),(s=e.get("*"))&&s.slice().map((function(e){e(t,i)}))}}}var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r={exports:{}};!function(e,t){var i="__lodash_hash_undefined__",r=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",h="[object Promise]",f="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",b="[object ArrayBuffer]",x="[object DataView]",E="[object Float32Array]",q="[object Float64Array]",I="[object Int8Array]",D="[object Int16Array]",T="[object Int32Array]",O="[object Uint8Array]",$="[object Uint8ClampedArray]",_="[object Uint16Array]",S="[object Uint32Array]",w=/\w*$/,A=/^\[object .+?Constructor\]$/,P=/^(?:0|[1-9]\d*)$/,j={};j[n]=j["[object Array]"]=j[b]=j[x]=j[o]=j[a]=j[E]=j[q]=j[I]=j[D]=j[T]=j[d]=j[l]=j[p]=j[f]=j[m]=j[g]=j[v]=j[O]=j[$]=j[_]=j[S]=!0,j["[object Error]"]=j[c]=j[y]=!1;var U="object"==typeof self&&self&&self.Object===Object&&self,N="object"==typeof s&&s&&s.Object===Object&&s||U||Function("return this")(),C=t&&!t.nodeType&&t,R=C&&e&&!e.nodeType&&e,k=R&&R.exports===C;function L(e,t){return e.set(t[0],t[1]),e}function M(e,t){return e.add(t),e}function H(e,t,i,s){var r=-1,n=e?e.length:0;for(s&&n&&(i=e[++r]);++r<n;)i=t(i,e[r],r,e);return i}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(i){}return t}function B(e){var t=-1,i=Array(e.size);return e.forEach((function(e,s){i[++t]=[s,e]})),i}function G(e,t){return function(i){return e(t(i))}}function Y(e){var t=-1,i=Array(e.size);return e.forEach((function(e){i[++t]=e})),i}var Q,W=Array.prototype,F=Function.prototype,X=Object.prototype,z=N["__core-js_shared__"],J=(Q=/[^.]+$/.exec(z&&z.keys&&z.keys.IE_PROTO||""))?"Symbol(src)_1."+Q:"",K=F.toString,Z=X.hasOwnProperty,ee=X.toString,te=RegExp("^"+K.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ie=k?N.Buffer:void 0,se=N.Symbol,re=N.Uint8Array,ne=G(Object.getPrototypeOf,Object),oe=Object.create,ae=X.propertyIsEnumerable,ce=W.splice,ue=Object.getOwnPropertySymbols,de=ie?ie.isBuffer:void 0,le=G(Object.keys,Object),pe=Re(N,"DataView"),he=Re(N,"Map"),fe=Re(N,"Promise"),me=Re(N,"Set"),ge=Re(N,"WeakMap"),ve=Re(Object,"create"),ye=Ve(pe),be=Ve(he),xe=Ve(fe),Ee=Ve(me),qe=Ve(ge),Ie=se?se.prototype:void 0,De=Ie?Ie.valueOf:void 0;function Te(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var s=e[t];this.set(s[0],s[1])}}function Oe(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var s=e[t];this.set(s[0],s[1])}}function $e(e){var t=-1,i=e?e.length:0;for(this.clear();++t<i;){var s=e[t];this.set(s[0],s[1])}}function _e(e){this.__data__=new Oe(e)}function Se(e,t){var i=Ge(e)||function(e){return function(e){return function(e){return!!e&&"object"==typeof e}(e)&&Ye(e)}(e)&&Z.call(e,"callee")&&(!ae.call(e,"callee")||ee.call(e)==n)}(e)?function(e,t){for(var i=-1,s=Array(e);++i<e;)s[i]=t(i);return s}(e.length,String):[],s=i.length,r=!!s;for(var o in e)!t&&!Z.call(e,o)||r&&("length"==o||Me(o,s))||i.push(o);return i}function we(e,t,i){var s=e[t];Z.call(e,t)&&Be(s,i)&&(void 0!==i||t in e)||(e[t]=i)}function Ae(e,t){for(var i=e.length;i--;)if(Be(e[i][0],t))return i;return-1}function Pe(e,t,i,s,r,h,y){var A;if(s&&(A=h?s(e,r,h,y):s(e)),void 0!==A)return A;if(!Fe(e))return e;var P=Ge(e);if(P){if(A=function(e){var t=e.length,i=e.constructor(t);t&&"string"==typeof e[0]&&Z.call(e,"index")&&(i.index=e.index,i.input=e.input);return i}(e),!t)return function(e,t){var i=-1,s=e.length;t||(t=Array(s));for(;++i<s;)t[i]=e[i];return t}(e,A)}else{var U=Le(e),N=U==c||U==u;if(Qe(e))return function(e,t){if(t)return e.slice();var i=new e.constructor(e.length);return e.copy(i),i}(e,t);if(U==p||U==n||N&&!h){if(V(e))return h?e:{};if(A=function(e){return"function"!=typeof e.constructor||He(e)?{}:(t=ne(e),Fe(t)?oe(t):{});var t}(N?{}:e),!t)return function(e,t){return Ne(e,ke(e),t)}(e,function(e,t){return e&&Ne(t,Xe(t),e)}(A,e))}else{if(!j[U])return h?e:{};A=function(e,t,i,s){var r=e.constructor;switch(t){case b:return Ue(e);case o:case a:return new r(+e);case x:return function(e,t){var i=t?Ue(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.byteLength)}(e,s);case E:case q:case I:case D:case T:case O:case $:case _:case S:return function(e,t){var i=t?Ue(e.buffer):e.buffer;return new e.constructor(i,e.byteOffset,e.length)}(e,s);case d:return function(e,t,i){return H(t?i(B(e),!0):B(e),L,new e.constructor)}(e,s,i);case l:case g:return new r(e);case f:return function(e){var t=new e.constructor(e.source,w.exec(e));return t.lastIndex=e.lastIndex,t}(e);case m:return function(e,t,i){return H(t?i(Y(e),!0):Y(e),M,new e.constructor)}(e,s,i);case v:return n=e,De?Object(De.call(n)):{}}var n}(e,U,Pe,t)}}y||(y=new _e);var C=y.get(e);if(C)return C;if(y.set(e,A),!P)var R=i?function(e){return function(e,t,i){var s=t(e);return Ge(e)?s:function(e,t){for(var i=-1,s=t.length,r=e.length;++i<s;)e[r+i]=t[i];return e}(s,i(e))}(e,Xe,ke)}(e):Xe(e);return function(e,t){for(var i=-1,s=e?e.length:0;++i<s&&!1!==t(e[i],i,e););}(R||e,(function(r,n){R&&(r=e[n=r]),we(A,n,Pe(r,t,i,s,n,e,y))})),A}function je(e){return!(!Fe(e)||(t=e,J&&J in t))&&(We(e)||V(e)?te:A).test(Ve(e));var t}function Ue(e){var t=new e.constructor(e.byteLength);return new re(t).set(new re(e)),t}function Ne(e,t,i,s){i||(i={});for(var r=-1,n=t.length;++r<n;){var o=t[r],a=s?s(i[o],e[o],o,i,e):void 0;we(i,o,void 0===a?e[o]:a)}return i}function Ce(e,t){var i,s,r=e.__data__;return("string"==(s=typeof(i=t))||"number"==s||"symbol"==s||"boolean"==s?"__proto__"!==i:null===i)?r["string"==typeof t?"string":"hash"]:r.map}function Re(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return je(i)?i:void 0}Te.prototype.clear=function(){this.__data__=ve?ve(null):{}},Te.prototype.delete=function(e){return this.has(e)&&delete this.__data__[e]},Te.prototype.get=function(e){var t=this.__data__;if(ve){var s=t[e];return s===i?void 0:s}return Z.call(t,e)?t[e]:void 0},Te.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Z.call(t,e)},Te.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?i:t,this},Oe.prototype.clear=function(){this.__data__=[]},Oe.prototype.delete=function(e){var t=this.__data__,i=Ae(t,e);return!(i<0)&&(i==t.length-1?t.pop():ce.call(t,i,1),!0)},Oe.prototype.get=function(e){var t=this.__data__,i=Ae(t,e);return i<0?void 0:t[i][1]},Oe.prototype.has=function(e){return Ae(this.__data__,e)>-1},Oe.prototype.set=function(e,t){var i=this.__data__,s=Ae(i,e);return s<0?i.push([e,t]):i[s][1]=t,this},$e.prototype.clear=function(){this.__data__={hash:new Te,map:new(he||Oe),string:new Te}},$e.prototype.delete=function(e){return Ce(this,e).delete(e)},$e.prototype.get=function(e){return Ce(this,e).get(e)},$e.prototype.has=function(e){return Ce(this,e).has(e)},$e.prototype.set=function(e,t){return Ce(this,e).set(e,t),this},_e.prototype.clear=function(){this.__data__=new Oe},_e.prototype.delete=function(e){return this.__data__.delete(e)},_e.prototype.get=function(e){return this.__data__.get(e)},_e.prototype.has=function(e){return this.__data__.has(e)},_e.prototype.set=function(e,t){var i=this.__data__;if(i instanceof Oe){var s=i.__data__;if(!he||s.length<199)return s.push([e,t]),this;i=this.__data__=new $e(s)}return i.set(e,t),this};var ke=ue?G(ue,Object):function(){return[]},Le=function(e){return ee.call(e)};function Me(e,t){return!!(t=null==t?r: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||X)}function Ve(e){if(null!=e){try{return K.call(e)}catch(t){}try{return e+""}catch(t){}}return""}function Be(e,t){return e===t||e!=e&&t!=t}(pe&&Le(new pe(new ArrayBuffer(1)))!=x||he&&Le(new he)!=d||fe&&Le(fe.resolve())!=h||me&&Le(new me)!=m||ge&&Le(new ge)!=y)&&(Le=function(e){var t=ee.call(e),i=t==p?e.constructor:void 0,s=i?Ve(i):void 0;if(s)switch(s){case ye:return x;case be:return d;case xe:return h;case Ee:return m;case qe:return y}return t});var Ge=Array.isArray;function Ye(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=r}(e.length)&&!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 Xe(e){return Ye(e)?Se(e):function(e){if(!He(e))return le(e);var t=[];for(var i in Object(e))Z.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e)}e.exports=function(e){return Pe(e,!0,!0)}}(r,r.exports);var n=r.exports;const o=e=>({get(t,i,s){if("__isProxy"===i)return!0;const r=Reflect.get(t,i);return Array.isArray(r)?r:"object"==typeof r&&null!==r?r.__isProxy?r:new Proxy(r,o(e)):r},set(t,i,s,r){const o=t[i];s=f(s)&&s.__isProxy?n(s):s;const a=Reflect.set(t,i,s,r);return((e,t)=>e!==t&&(e==e||t==t))(s,o)&&e.emit(`${b(i)}Change`,s),a}}),a=e=>encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class c{constructor(e){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=e.baseURL,this._beforeRequest=e.beforeRequest,this._errorHandler=e.error}_request(e){const{url:t="",timeout:i=6e4}=e;let{headers:s={}}=e;return e.url=this.baseURL.replace(/\/+$/,"")+"/"+((e,t)=>{if(!t)return e;const i=[];Object.keys(t).forEach((e=>{const s=t[e];if(null==s)return;let r;Array.isArray(s)?(r=s,e+="[]"):r=[s],r.forEach((t=>{null!==t&&"object"==typeof t&&(t=JSON.stringify(t)),i.push(`${a(e)}=${a(t)}`)}))}));const s=i.join("&");if(s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e})(t.replace(/^\/+/,""),e.params),s=Object.assign(s,this._defaultHeaders),Object.keys(s).forEach((e=>{"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(s["Content-Type"]=s[e],delete s[e])})),m(e.data)&&(s&&!s["Content-Type"]&&(s["Content-Type"]="application/json;charset=utf-8"),e.data=JSON.stringify(e.data)),e.headers=s,e.timeout=i,this._beforeRequest&&this._beforeRequest(e),"undefined"!=typeof wx?l(e):d(e)}setDefaultHeader(e,t){e in this._defaultHeaders&&(""===t||null===t)?delete this._defaultHeaders[e]:this._defaultHeaders[e]=t}get(e,t){return this._errorHandler?this._request(Object.assign(t||{},{url:e,method:"GET"})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(t||{},{url:e,method:"GET"}))}post(e,t,i){return this._errorHandler?this._request(Object.assign(i||{},{url:e,method:"POST",data:t})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(i||{},{url:e,method:"POST",data:t}))}}class u{constructor(e){let t;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=e,t(this.reason))}))}static source(){let e;const t=new u((t=>{e=t}));return{cancel:e,token:t}}}const d=e=>new Promise(((t,i)=>{const{data:s=null,url:r,method:n="GET",headers:o,cancelToken:a,withResDate:c}=e;let u=new XMLHttpRequest;u.open(n.toUpperCase(),r,!0),u.timeout=e.timeout;const d=()=>{if(u){if(u.status>=200&&u.status<300)try{const e=JSON.parse(u.responseText);c&&(e.responseDate=new Date(u.getResponseHeader("Date")).getTime()),t(e)}catch(e){i(new Error("E_JSON_PARSE"+u.responseText))}else i({url:r,statusCode:u.status});u=null}};"onloadend"in u?u.onloadend=d:u.onreadystatechange=()=>{u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=()=>{u&&(i({url:r,statusCode:u.status,type:"request abort"}),u=null)},u.onerror=()=>{i(new Error("Network Error")),u=null},u.ontimeout=()=>{i(new Error("timeout of "+e.timeout+"ms exceeded")),u=null},"setRequestHeader"in u&&Object.keys(o).forEach((e=>{null===s&&"content-type"===e.toLowerCase()?delete o[e]:u.setRequestHeader(e,o[e])})),a&&a.promise.then((e=>{u&&(u.abort(),i(e),u=null)})),u.send(s)})),l=e=>new Promise(((t,i)=>{const{data:s=null,url:r,method:n="GET",headers:o,cancelToken:a}=e,c=wx.request({url:r,data:s,method:n.toUpperCase(),timeout:e.timeout,header:o,success(e){e.statusCode>=200&&e.statusCode<300?t(e.data):i({url:r,statusCode:e.statusCode})},fail(e){i("request:fail abort"===e.errMsg&&a&&a.reason||e)}});a&&a.promise.then((()=>{c&&c.abort()}))})),p=Array.isArray,h=e=>null==e,f=e=>"object"==typeof e&&null!==e,m=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},g=()=>{const e=[],t="0123456789abcdef";for(let i=0;i<36;i++)e[i]=t.substr(Math.floor(16*Math.random()),1);e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-";return e.join("").split("-").join("")},v=(e,t)=>e?(Object.entries(e).forEach((e=>{const[i,s]=[e[0],e[1]];if(null!==s)return f(s)&&!p(s)?(t[i]||(t[i]={}),void(t[i]=v(s,t[i]))):void(t[i]=s)})),t):t,y=/-(\w)/g,b=e=>e.replace(y,((e,t)=>t?t.toUpperCase():"")),{hasOwnProperty:x}=Object.prototype,E=(e,t)=>x.call(e,t),q=(e,t=new Map)=>{if(t.get(e))return t.get(e);if(!(e instanceof Object))return e;let i;i=e instanceof Array?[]:e instanceof Function?()=>e():e instanceof RegExp?new RegExp(e.source,e.flags):e instanceof Date?new Date(e):{},t.set(e,i);for(const s in e)E(e,s)&&(i[s]=q(e[s],t));return i};var I,D,T,O,$;e.EVENT=void 0,(I=e.EVENT||(e.EVENT={})).REQUEST_ERROR="requestError",I.STATE="state",I.FAILED="failed",e.STATE=void 0,(D=e.STATE||(e.STATE={}))[D.CLOSE=0]="CLOSE",D[D.JOINED=1]="JOINED",D[D.READY=2]="READY",e.ENDPOINT_TYPE=void 0,(T=e.ENDPOINT_TYPE||(e.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",e.ROLE=void 0,(O=e.ROLE||(e.ROLE={})).HOST="host",O.COHOST="coHost",O.ATTENDEE="attendee",O.AUDIENCE="audience",e.RECORD_STATUS=void 0,($=e.RECORD_STATUS||(e.RECORD_STATUS={})).STARTED="started",$.PAUSED="paused",$.STARTING="starting",$.STOPPED="stopped";class _{constructor(e,t){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"on",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"off",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=t,this.ctx=e,this.emitter=i(),this.on=this.emitter.on,this.off=this.emitter.off,this.data=new Proxy({},o(this.emitter)),this._bindOn()}cleanup(){this.emitter.all=new Map,this.data=new Proxy({},o(this.emitter))}reactive(e){if(f(e)){const t=new Map,i=(e,s)=>{Object.keys(e).forEach((r=>{!1===s&&r in this.data&&(e[r]=this.data[r]);const n=t=>e[r]=t,o=`${b(r)}Change`;this.emitter.on(o,n),t.set(o,n),f(e[r])&&!p(e[r])&&i(e[r],!0)}))};i(e,!1),e._destory=()=>{t.forEach(((e,t)=>{this.emitter.off(t,e)}))}}else console.warn("Parameter is not an object!");return e}}class S extends _{constructor(e){super(e,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(e=>{const{state:t,body:i}=e;("full"===t||"update"===t)&&v(i,this.data)})),this.ctx.emitter.on("participantCount",(e=>{const{body:t}=e;v({participantCount:t},this.data)}))}subject(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/info/subject`,e)}))}practiceSession(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/info/practiceSession`)}))}shareInfo(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/shareInfo`,{params:e})}meetings(e){if(!e)return Promise.reject();const{prefix:{ctrl:t}}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings`,{params:e})}mailTemplate(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}mailTemplate`,{params:{meetingID:i},headers:{language:e.language}})}}function w(e){const t=[],{isInLobby:i}=e.modules.me.data;return i?(t.push("lobbyMember"),t):(Object.keys(e.modules).forEach((i=>{const s=e.modules[i]._topic();s&&(Array.isArray(s)?s.forEach((e=>{t.includes(e)||t.push(e)})):t.includes(s)||t.push(s))})),t)}function A(e,i){return t(this,void 0,void 0,(function*(){const{meetingID:t,clientID:s}=i.config.request,r=yield i.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:s,meetingId:t},inboxes:e}),n=[];return r.data&&Object.keys(r.data).forEach((e=>{n.push({name:e,seqId:r.data[e].maxSeqId,limit:200})})),n}))}function P(e,i){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s,clientID:r}=i.config.request,n=yield i.request.post(`${t}meetings/${s}/subscribe`,{endpointID:r,topics:e}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((e=>{console.log("[subscribe]",e),i.emitter.emit(e.event,e)}))}))}function j(e,i,s){return t(this,void 0,void 0,(function*(){const{inboxes:r,clientID:n,meetingID:o,cancelToken:a,status:c}=i;yield(()=>t(this,void 0,void 0,(function*(){const t=yield e.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:r},{cancelToken:a,withResDate:!0});if(!t||!t.data)return;const{data:i={}}=t;Object.keys(i).forEach((e=>{const t=r.find((t=>t.name===e));if(t){if(t.seqId=i[e].maxSeqId,!i[e].items)return;i[e].items.forEach((e=>{const t=JSON.parse(e.content);["liveStream","recording"].includes(t.event)&&(t.stime=e.stime),s(t)}))}}))})))(),c.running&&(c.timer=setTimeout((()=>{c.running&&j(e,i,s)}),200))}))}const U=(e,i)=>t(void 0,void 0,void 0,(function*(){const{meetingID:t,clientID:s}=i.config.request;i.status.polling.running=!0,j(i.request,{inboxes:e,clientID:s,meetingID:t,cancelToken:i.config.request.cancelToken.token,status:i.status.polling},(e=>{i.emitter.emit(e.event,e)}))}));function N(e){e.status.polling.running=!1,e.status.polling.timer&&(clearTimeout(e.status.polling.timer),e.status.polling.timer=null),e.config.request.cancelToken.cancel(),e.config.request.cancelToken=u.source()}function C(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:i},meetingID:s,userID:r}=e.config.request;e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null),yield(()=>t(this,void 0,void 0,(function*(){const t=yield e.request.post(`${i}meetings/${s}/users/${r}/keepalive`,{},{cancelToken:e.config.request.cancelToken.token});if(!t||!t.data)return;const{data:n={}}=t,o=n.interval||"";o&&(e.status.keepalive.interval=o)})))(),e.status.keepalive.running&&(e.status.keepalive.timer=setTimeout((()=>{e.status.keepalive.running&&C(e)}),1e3*e.status.keepalive.interval))}))}const R=e=>{e.status.keepalive.running=!1,e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null)};var k;e.MeEvent=void 0,(k=e.MeEvent||(e.MeEvent={})).INIT="meInit",k.UPDATE="meUpdate",k.UPDATE_USER_STATE="updateUserState",k.ROLECHANGE="meRoleChange",k.AUDIOCHANGE="meAudioChange",k.HANDUPCHANGE="meHandupChange",k.SETAUDIO="setAudio",k.VIDEOCHANGE="meVideoChange",k.SETVIDEO="setVideo",k.SHARECHANGE="meShareChange",k.DISPLAYNAMECHANGE="meDisplayNameChange",k.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",k.LOBBYCHANGE="meLobbyChange",k.BARRAGECHANGE="meBarrageChange",k.LEAVE="leave";class L extends _{constructor(e){super(e,"me")}_topic(){return""}_bindOn(){const i=i=>t(this,void 0,void 0,(function*(){if("role"in i&&i.role!==this.data.role){const t=this.data.role;v({role:i.role},this.data),i.role!==e.ROLE.AUDIENCE&&t!==e.ROLE.AUDIENCE||(yield this.rePolling("roleChange")),this.emitter.emit(e.MeEvent.ROLECHANGE,i.role),this.ctx.emitter.emit(e.MeEvent.ROLECHANGE,i.role)}})),s=t=>{var i,s,r,n;if("audio"in t){const{deviceOn:o,sendOn:a,opBy:c}=t.audio;(!h(o)&&o!==(null===(i=this.data.audio)||void 0===i?void 0:i.deviceOn)||!h(a)&&a!==(null===(s=this.data.audio)||void 0===s?void 0:s.sendOn)||!h(c))&&(v({audio:t.audio},this.data),this.emitter.emit(e.MeEvent.AUDIOCHANGE,{deviceOn:h(o)?null===(r=this.data.audio)||void 0===r?void 0:r.deviceOn:o,sendOn:h(a)?null===(n=this.data.audio)||void 0===n?void 0:n.sendOn:a,opBy:c}))}},r=t=>{var i,s,r,n;if("video"in t){const{deviceOn:o,sendOn:a,opBy:c}=t.video;(!h(o)&&o!==(null===(i=this.data.video)||void 0===i?void 0:i.deviceOn)||!h(a)&&a!==(null===(s=this.data.video)||void 0===s?void 0:s.sendOn))&&(v({video:t.video},this.data),this.emitter.emit(e.MeEvent.VIDEOCHANGE,{deviceOn:h(o)?null===(r=this.data.video)||void 0===r?void 0:r.deviceOn:o,sendOn:h(a)?null===(n=this.data.video)||void 0===n?void 0:n.sendOn:a,opBy:c}))}},n=t=>{var i,s,r,n;if("share"in t){const{deviceOn:o,sendOn:a,opBy:c}=t.share;(!h(o)&&o!==(null===(i=this.data.share)||void 0===i?void 0:i.deviceOn)||!h(a)&&a!==(null===(s=this.data.share)||void 0===s?void 0:s.sendOn))&&(v({share:t.share},this.data),this.emitter.emit(e.MeEvent.SHARECHANGE,{deviceOn:h(o)?null===(r=this.data.share)||void 0===r?void 0:r.deviceOn:o,sendOn:h(a)?null===(n=this.data.share)||void 0===n?void 0:n.sendOn:a,opBy:c}))}},o=t=>{t.displayName&&t.displayName!==this.data.displayName&&(v({displayName:t.displayName},this.data),this.emitter.emit(e.MeEvent.DISPLAYNAMECHANGE,t.displayName))},a=t=>{"isHandUp"in t&&t.isHandUp!==this.data.isHandUp&&(v({isHandUp:t.isHandUp},this.data),this.emitter.emit(e.MeEvent.HANDUPCHANGE,t.isHandUp))},c=t=>{"isSpotlightVideo"in t&&(v({isSpotlightVideo:t.isSpotlightVideo},this.data),this.emitter.emit(e.MeEvent.SPOTLIGHTVIDEOCHANGE,t.isSpotlightVideo))},u=i=>t(this,void 0,void 0,(function*(){if("isInLobby"in i&&i.isInLobby!==this.data.isInLobby){v({isInLobby:i.isInLobby},this.data);const t=!1===i.isInLobby?"inLobbyChange":void 0;yield this.rePolling(t),this.emitter.emit(e.MeEvent.LOBBYCHANGE,i.isInLobby),this.ctx.emitter.emit(e.MeEvent.LOBBYCHANGE,i.isInLobby)}})),d=t=>{if(!t.barrage)return;let i=null;if(!t.barrage.wordsDisplayStatus)return i=null,delete t.barrage,this.data.barrage=i||void 0,void this.emitter.emit(e.MeEvent.BARRAGECHANGE,i);i={content:t.barrage.content,contentType:t.barrage.contentType,type:t.barrage.type,duration:t.barrage.duration,position:t.barrage.position};const{role:s}=this.data;t.barrage.receiver&&(s===e.ROLE.HOST||s===e.ROLE.COHOST?i=t.barrage.receiver.host?i:null:s===e.ROLE.ATTENDEE?i=t.barrage.receiver.attendee?i:null:s===e.ROLE.AUDIENCE&&(i=t.barrage.receiver.audience?i:null),delete t.barrage,this.data.barrage=i||void 0,this.emitter.emit(e.MeEvent.BARRAGECHANGE,i))},l=t=>{"leave"in t&&!0===t.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),N(this.ctx),X(this.ctx),this.emitter.emit(e.MeEvent.LEAVE,t.resultInfo),this.ctx.cleanup(t.resultInfo))},p=e=>{i(e),s(e),r(e),n(e),o(e),a(e),u(e),c(e),d(e),l(e)};this.ctx.emitter.on(e.MeEvent.INIT,(e=>{v(e,this.data),this.data.isUpdatedUserState=!1})),this.ctx.emitter.on(e.MeEvent.UPDATE,(e=>{p(e),v(e,this.data)})),this.ctx.emitter.on(e.EVENT.STATE,(({state:t})=>{t===e.STATE.READY&&this.data.endpointType!==e.ENDPOINT_TYPE.SUPERVISION&&this.emitter.emit(e.MeEvent.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on("me",(e=>t(this,void 0,void 0,(function*(){const{state:t,body:i={users:[]}}=e;if("delete"===t){const e=i.users[0];return e.leave=!0,void l(e)}const s=i.users.find((e=>e.userID===this.data.userID));s&&(p(s),v(s,this.data))})))),this.ctx.emitter.on("setUserVideo",(t=>{this.emitter.emit(e.MeEvent.SETVIDEO,t.body)})),this.ctx.emitter.on("setUserAudio",(t=>{this.emitter.emit(e.MeEvent.SETAUDIO,t.body)})),this.ctx.emitter.on("meetingState",(e=>{const{body:t={}}=e;if("ended"===t.state){l({leave:!0,resultInfo:t.resultInfo})}}))}updateUserState(t,i=!1){if(!i){const{role:i,initialMediaState:s}=this.data;t.audio.sendOn=t.audio.sendOn&&s.audio.sendOn,t.video.sendOn=t.video.sendOn&&s.video.sendOn,i===e.ROLE.AUDIENCE&&(t.audio.sendOn=!1,t.video.sendOn=!1)}const{prefix:{ctrl:s},meetingID:r}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,v(t,this.data),this.ctx.request.post(`${s}meetings/${r}/updateUserState`,t)}rePolling(i){return t(this,void 0,void 0,(function*(){const{ctx:t}=this;N(t);const s=w(t),r=yield A(s,t);if(i&&this.emitter.emit(e.MeEvent.UPDATE_USER_STATE,{data:this.data,event:i}),yield P(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 U(r,t)}))}}class M extends _{constructor(e){super(e,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(e=>{const{body:t,state:i}=e;if(t&&t.users){if("full"===i)return this.data.callRecordUsers=t.users.map((e=>(e.displayNamePinyin=M.setDisplayNamePinyinProp?M.setDisplayNamePinyinProp(e.displayName||""):e.displayName,e))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);t.users.forEach((e=>{const t=this.data.callRecordUsers.findIndex((t=>e.inviteTransID===t.inviteTransID));"update"===i&&-1!==t?v(e,this.data.callRecordUsers[t]):"update"===i&&-1===t&&(e.displayNamePinyin=M.setDisplayNamePinyinProp?M.setDisplayNamePinyinProp(e.displayName||""):e.displayName,this.data.callRecordUsers.push(e))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/invite`,e)}}class H extends _{constructor(e){super(e,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:t,endpointType:i}=this.ctx.modules.me.data;return i===e.ENDPOINT_TYPE.SUPERVISION?["interactive","broadcast"]:t===e.ROLE.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const t=(t,{event:i,state:s})=>{if(t.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:r={}}=t;if("delete"!==s||"delete"===s&&[901357,901358,901352,901351,901350,901349].includes(r.bizCode||-1))return void this.ctx.emitter.emit(e.MeEvent.UPDATE,t);let n=!1;switch(i){case"interactiveUsers":t.isInLobby||(n=!0);break;case"broadcastUsers":t.isInLobby||t.role!==e.ROLE.AUDIENCE||(n=!0);break;case"lobbyUsers":t.isInLobby&&(n=!0)}const o={};n&&(o.leave=!0),this.ctx.emitter.emit(e.MeEvent.UPDATE,Object.assign(Object.assign({},t),o))},i=({updateUsers:e,state:i,sourceKey:s})=>{if("full"===i)return this.data[s]=e.map((e=>(e.displayNamePinyin=H.setDisplayNamePinyinProp?H.setDisplayNamePinyinProp(e.displayName):e.displayName,t(e,{event:s,state:i}),e))),this.emitter.emit(`${s}Change`,{users:this.data[s],isFull:!0}),this.data[s];void 0===this.data[s]&&(this.data[s]=[]);const{data:r,emitter:n}=this;return e.forEach((e=>{const o=r[s].findIndex((t=>e.userID===t.userID));if("delete"===i&&-1!==o){const[t]=this.data[s].splice(o,1);n.emit(`${s}Delete`,{user:t,resultInfo:e.resultInfo})}else if("update"===i&&-1!==o){const t=this.data[s][o];this.updateUserProps(e,t),v(e,t),this.data[s][o]=q(t),this.emitter.emit(`${s}Update`,{user:this.data[s][o]})}else"update"===i&&-1===o&&(e.displayNamePinyin=H.setDisplayNamePinyinProp?H.setDisplayNamePinyinProp(e.displayName):e.displayName,r[s].push(e),this.emitter.emit(`${s}Add`,{user:e,resultInfo:e.resultInfo}));t(e,{event:s,state:i})})),this.emitter.emit(`${s}Change`,{users:this.data[s],isFull:!1}),this.data[s]};this.ctx.emitter.on("interactiveUsers",(e=>{const{state:t,body:s}=e;i({updateUsers:s.users,state:t,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(e=>{const{state:t,body:s}=e;i({updateUsers:s.users,state:t,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(e=>{const{state:t,body:s}=e;i({updateUsers:s.users,state:t,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(e=>{const{state:t,body:s}=e;i({updateUsers:s.users,state:t,sourceKey:"advCtrlUsers"})}))}cleanup(){this.emitter.all=new Map,this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}updateUserProps(e,t){e.displayName&&e.displayName!==t.displayName&&(e.displayNamePinyin=H.setDisplayNamePinyinProp?H.setDisplayNamePinyinProp(e.displayName):e.displayName)}setAudio(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/audio`,t)}setVideo(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/video`,t)}setShare(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/share`,t)}setWhiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}users/${e}/whiteboard`,t)}handUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/handUp`,t)}setRole(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/role`,t)}rename(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/displayName`,t)}remove(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/users/${e}/remove`)}replyHandUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}users/${e}/replyHandUp`,t)}fecc(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/fecc`,t)}lobbyState(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/lobbyState`,t)}allowLocalRecord(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/allowLocalRecord`,t)}whiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${i}meetings/${s}/users/${e}/whiteboard`,t)}callStats(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/users/${e}/callStats`)}callStatsReport(e){if(!e.userID)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/users/${e.userID}/callStats/report`,e)}replyAllHandUp(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return this.ctx.request.post(`${e}meetings/${t}/lobby/refuseAll`)}}function V(t){const{baseURL:s,modules:r,worker:n,singleton:o}=t;r.findIndex((e=>e===L))<0&&r.push(L),r.findIndex((e=>e===S))<0&&r.push(S);const a=`${g()}_${((e=new Date,t)=>{const i={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));for(const s in i)new RegExp("("+s+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?i[s]:("00"+i[s]).substr((""+i[s]).length)));return t})(new Date,"MMddHHmmss")}`,d={config:{baseURL:s,modules:r,singleton:o||!1,request:{cancelToken:u.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1/"},clientID:a,location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:n,emitter:i(),request:new c({baseURL:s,beforeRequest:e=>{e.headers["X-Y-Request-Id"]=g()},error:t=>{d.emitter.emit(e.EVENT.REQUEST_ERROR,t)}}),modules:{},state:e.STATE.CLOSE,status:{polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},cleanup:t=>{d.state!==e.STATE.CLOSE&&(d.worker&&d.worker.terminate(),d.config.request.location="",d.config.request.meetingID="",d.config.request.ctrlID="",d.config.request.sessionID="",d.config.request.userID=-1,d.config.request.voteTk="",d.status={polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}},d.request.setDefaultHeader("X-Y-Location",""),d.request.setDefaultHeader("X-Y-Ctrl-Id",""),d.request.setDefaultHeader("X-Y-Session-Id",""),d.state=e.STATE.CLOSE,d.emitter.emit(e.EVENT.STATE,{state:d.state,reason:t}))}};return d}function B(t){const i=V(t);return i.worker&&("undefined"!=typeof Worker?i.worker.postMessage({baseURL:i.config.baseURL}):console.error("The current environment does not support worker")),function(e,t){if(!p(e))return void console.error("The modules parameter requires an array type");e.forEach((e=>{const i=new e(t);t.modules[i.moduleName]=i}))}(i.config.modules,i),i.emitter.on(e.EVENT.STATE,(({state:t})=>{t===e.STATE.CLOSE&&Object.keys(i.modules).forEach((e=>{i.modules[e].cleanup()}))})),Object.assign({config:i.config,request:i.request,get state(){return i.state},on:i.emitter.on,off:i.emitter.off,join:G(i),leave:Y(i),end:Q(i),endMeeting:W(i)},i.modules)}function G(i){return function(s){var r;return t(this,void 0,void 0,(function*(){const{clientID:t}=i.config.request,n=`${null===(r=s.endpointType)||void 0===r?void 0:r.toLocaleUpperCase()}${t}_${s.meetingNum}`;i.config.request.sessionID=n,i.request.setDefaultHeader("X-Y-Session-Id",n);const{prefix:o}=i.config.request,a=yield i.request.get(`${o.ctrl}credential`,{params:{meetingNum:s.meetingNum,pwd:s.pwd,url:s.url,mobileCode:s.mobileCode,mobile:s.mobile,regEmail:s.regEmail,accEmail:s.accEmail,tk:s.tk,displayName:s.displayName},headers:{"X-Y-Endpoint-Type":s.endpointType}}),{credential:c="",location:u=""}=a&&a.data||{};if(!c)return i.emitter.emit(e.EVENT.FAILED,{bizCode:a.bizCode,data:a.data}),a;i.config.request.location=u,i.request.setDefaultHeader("X-Y-Location",u),delete s.pwd,delete s.url;const d=yield i.request.post(`${o.ctrl}join?meetingNum=${s.meetingNum}&credential=${c}`,s,{headers:{"X-Y-Endpoint-Type":s.endpointType,"X-Y-Endpoint-Id":t}});if(!d||d&&d.ret<=-1)return i.emitter.emit(e.EVENT.FAILED,{bizCode:d.bizCode,data:d.data}),d;const{meetingID:l="",ctrlID:p="",user:h={},mediaContent:f={},initialMediaState:m={},tk:g=""}=d.data;i.config.request.meetingID=l,i.config.request.ctrlID=p,i.config.request.userID=h.userID,i.config.request.voteTk=g,i.request.setDefaultHeader("X-Y-Ctrl-Id",p),i.emitter.emit(e.MeEvent.INIT,Object.assign(Object.assign({},h),{mediaContent:f,initialMediaState:m})),i.state=e.STATE.JOINED,i.emitter.emit(e.EVENT.STATE,{state:i.state});const v=()=>{i.state!==e.STATE.READY&&(i.state=e.STATE.READY,i.emitter.emit(e.EVENT.STATE,{state:i.state}))},y=w(i),b=yield A(y,i);return yield P(y,i),"undefined"!=typeof Worker&&i.worker?(i.status.polling.running=!0,i.worker.postMessage({topics:y,meetingID:l,clientID:t,inboxes:b,status:!0}),i.worker.onmessage=e=>{"pollingStarted"!==e.data?"pollingStopped"!==e.data?(console.log("[Polling]",e.data),i.emitter.emit(e.data.event,e.data)):i.status.polling.running=!1:v()}):(i.status.polling.running=!0,U(b,i),v()),i.status.keepalive.running=!0,C(i),d.data=Object.assign(Object.assign({},d.data),a.data),d}))}}function Y(e){return function(i){return t(this,void 0,void 0,(function*(){i||(i={resultInfo:{bizCode:901359}});const{prefix:t,meetingID:s}=e.config.request,r=yield e.request.post(`${t.ctrl}meetings/${s}/leave`,i);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),N(e),R(e),X(e),e.cleanup(),r}))}}function Q(e){return function(){return t(this,void 0,void 0,(function*(){const{prefix:t,meetingID:i}=e.config.request,s=yield e.request.post(`${t.ctrl}meetings/${i}/end`);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),N(e),R(e),X(e),e.cleanup(),s}))}}function W(e){return function(i){return t(this,void 0,void 0,(function*(){const{prefix:t}=e.config.request;return yield e.request.post(`${t.ctrl}meetingNum/${i}/end`)}))}}class F{constructor(e){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=B(e)}static getInstance(e){return this.instance?this.instance:this.instance=new F(e)}}function X(e){if(e.config.singleton){const{baseURL:t,modules:i,singleton:s}=e.config,r={baseURL:t,modules:i,worker:e.worker,singleton:s},n=F.getInstance(r);n&&(n.meeting=B(r))}}return Object.defineProperty(F,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),e.Chat=class extends _{constructor(e){super(e,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(e=>{const{body:t}=e;this.emitter.emit("chatMsg",t)}))}msg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/chat/msg`,e)}))}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/chat/historyMsg`,e)}))}},e.Info=S,e.Invite=M,e.LiveStream=class extends _{constructor(e){super(e,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(e=>{var t;const{state:i,body:s,stime:r}=e;if(s){if(r&&(this.data.jetlag=r),"full"===i){const{liveStreams:e=[]}=s;if(!e.length)return;const t=[];this.data.liveStreams=e.map((e=>(e.requesting="starting"===e.status,t.push({platform:e.platform||"",status:(e.requesting?"stopped":e.status)||""}),e)));return 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 i=this.data.status.map((e=>e));-1===t?i.push({platform:e.platform||"",status:e.requesting?"stopped":e.status||""}):i.splice(t,1,{platform:i[t].platform||"",status:e.requesting?i[t].status||"stopped":e.status||""}),this.data.status=i})),this.data}}))}setStatus(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/liveStream/status`,e)}))}liveStreamDescription(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/liveStream/description`,e)}))}liveStreamSetting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/liveStream/setting`,e)}))}},e.Me=L,e.Qa=class extends _{constructor(e){super(e,"qa"),this.data={questions:new Map,topSort:0}}_topic(){return"qa"}_bindOn(){this.ctx.emitter.on("qa",(e=>{const{body:t}=e;f(t)&&!p(t)?this.qaUpdate(this.data.questions,t):t.forEach((e=>this.qaUpdate(this.data.questions,e)))}))}cleanup(){this.data={questions:new Map,topSort:0}}qaUpdate(e,t){let i=e.get(t.question.id);const{clientID:s}=this.ctx.config.request;switch(t.command){case"addQuestion":i=this.createQuestion(t.question),e.set(t.question.id,i),this.emitter.emit("questionAdd",{question:i,selfSent:i.sender.endpointID===s});break;case"dismissQuestion":if(!i)break;i.sender.endpointID!==s?i.status="close":i.isTop=!1,e.set(t.question.id,i),this.emitter.emit("questionUpdate",{question:i});break;case"reopenQuestion":i?(i.status="open",i.isTop=t.question.isTop,e.set(t.question.id,i)):(i=this.createQuestion(t.question),e.set(t.question.id,i)),this.emitter.emit("questionUpdate",{question:i});break;case"updateQuestion":i?(i=Object.assign(Object.assign(Object.assign({},i),t.question),{topSort:t.question.isTop?this.data.topSort++:0}),e.set(t.question.id,i)):(i=this.createQuestion(t.question),e.set(t.question.id,i)),this.emitter.emit("questionUpdate",{question:i});break;case"deleteQuestion":if(!i)break;i.sender.endpointID!==s?e.delete(t.question.id):(i.status="delete",i.isTop=!1,i.answers.clear(),e.set(t.question.id,i)),this.emitter.emit("questionDelete",{question:i});break;case"answerQuestion":i?i.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)):(i=this.createQuestion(t.question),i.answers.set(t.answer.id,this.createQuestionAnswer(t.answer)),e.set(t.question.id,i)),this.emitter.emit("questionUpdate",{question:i});break;case"deleteAnswer":i&&(i.answers.delete(t.answer.id),this.emitter.emit("questionUpdate",{question:i}))}this.emitter.emit("questionChange",{questions:this.data.questions})}createQuestion(e){return{isAnonymous:e.isAnonymous,isTop:e.isTop,id:e.id,content:e.content,sender:e.sender,timestamp:e.timestamp||-1,status:e.status||"open",answers:new Map,topSort:0}}createQuestionAnswer(e){return{isPrivate:e.isPrivate,content:e.content,id:e.id,sender:e.sender,timestamp:e.timestamp||-1}}qa(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/qa`,e)}))}},e.Recording=class extends _{constructor(e){super(e,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(e=>{const{state:t,body:i,stime:s}=e;if(i)return s&&(this.data.jetlag=s),this.data.isPracticeSession="started"===i.status&&this.data.status===i.status&&0===i.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),i),"starting"===i.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=i.status||this.data.status),this.data.resultInfo=i.resultInfo||{},["full","update"].includes(t)?(i.recordUsers&&(this.data.recording.recordUsers=i.recordUsers),this.data):void 0}))}history(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.get(`${e}meetings/${t}/recording/history`)}))}status(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/recording/status`,e)}))}layout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/recording/status`,e)}))}designatedUsers(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/recording/designatedUsers`,e)}))}participantAdd(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/recording/participant/add`,e)}))}participantDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/recording/participant/delete`,e)}))}getTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getTemplates`,{params:e})}))}getByIds(e){return t(this,void 0,void 0,(function*(){const{prefix:{user:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/subject/getByIds`,e)}))}recordLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/recording/layout`,e)}))}},e.Setting=class extends _{constructor(e){super(e,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(e=>{const{state:t,body:i}=e;["full","update"].includes(t)&&v(i,this.data)}))}setting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/setting`,e)}))}muteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/muteAll`)}))}unmuteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/unmuteAll`)}))}},e.SpotlightVideo=class extends _{constructor(e){super(e,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(t=>{const{body:i}=t;if(!i||!i.userIDs)return;this.data.userIDs=i.userIDs;i.userIDs.findIndex((e=>e===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(e.MeEvent.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(e.MeEvent.UPDATE,{isSpotlightVideo:!1})}))}spotlight(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/view/spotlight`,e)}},e.Transcript=class extends _{constructor(e){super(e,"transcript")}_topic(){return"transcript"}_bindOn(){this.ctx.emitter.on("transcriptMsg",(e=>{const{body:t}=e;this.emitter.emit("transcriptMsg",t)}))}cleanup(){this.emitter.all=new Map}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${i}/transcript/historyMsg`,e)}))}},e.Users=H,e.View=class extends _{constructor(e){super(e,"view")}_topic(){const{endpointType:t,role:i}=this.ctx.modules.me.data;return t===e.ENDPOINT_TYPE.WEBCTRL?["hostAttendee","audience","advCtrl"]:i===e.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:i,body:s}=e;s&&("meetingView"===i?Object.keys(s).forEach((e=>{this.data[e]=s[e]})):this.data[t]=s)}updatePersonalLayouts(e){const{state:t,body:i}=e;"full"!==t&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),i.personalLayouts.forEach((e=>{const{subscriber:i={userID:-1}}=e,s=i.userID||i.subjectID||-1;"full"===t||"update"===t||e.templateStatus?this.data.personalLayouts[s]=e:delete this.data.personalLayouts[s]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/hostLayout`,e)}))}attendeeLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/attendeeLayout`,e)}))}audienceLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/audienceLayout`,e)}))}personalLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/personalLayout`,e)}))}personalLayoutDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/personalLayout/delete`,e)}))}virtualClassLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/view/virtualClass/layout`,e)}))}closeVirtualClass(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/view/virtualClass/close`)}))}getVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/layout/template/info`,{params:e})}))}addVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/layout/template/add`,e)}))}editVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/layout/template/edit`,e)}))}getTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getTemplates`,{params:e})}))}editTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/edit`,e)}))}addTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/add`,e)}))}deleteTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/delete`,e)}))}getDefaultTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getDefaultTemplates`,{params:e})}))}changeDefaultTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/changeDefaultTemplate`,e)}))}perspectiveBind(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/perspective/bind`,e)}))}},e.Vote=class extends _{constructor(e){super(e,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(e=>{const{body:t}=e,{voteID:i}=t;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[i]=t,this.emitter.emit("voteChange",{vote:this.data.vote,changeData:t})})),this.ctx.emitter.on(e.MeEvent.LOBBYCHANGE,(e=>{e&&(this.data.vote={})}))}getVotes(e){const{prefix:{vote:t},meetingID:i,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}meetings/${i}/votes`,{params:e})}getVote(e){const{prefix:{vote:t},meetingID:i,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}meetings/${i}/vote`,{params:e})}getMeVote(e){const{prefix:{vote:t},meetingID:i,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.get(`${t}meetings/${i}/vote/me`,{params:e})}voteStatus(e,t){const{prefix:{vote:i},meetingID:s,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.post(`${i}meetings/${s}/vote/status?tk=${e.tk}&voteID=${e.voteID}`,t)}voteSubmit(e,t){const{prefix:{vote:i},meetingID:s,voteTk:r}=this.ctx.config.request;return e.tk=e.tk||r,this.ctx.request.post(`${i}meetings/${s}/vote/submit?tk=${e.tk}&voteID=${e.voteID}`,t)}voteAdd(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/add`,e)}voteEdit(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/edit`,e)}voteDelete(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/delete`,e)}voteInProgress(e){const{prefix:{vote:t},meetingID:i,voteTk:s}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${i}/vote/inProgress`,{params:{tk:e&&e.tk||s}})}},e.Words=class extends _{constructor(e){super(e,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(t=>{this.data.timer&&clearTimeout(this.data.timer);const{state:i,body:s}=t;if(!s)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data});"full"===i&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),this.data.barrageRecord=[{content:s.content,time:(new Date).getTime(),durationType:s.durationType,duration:1e3*s.duration},...this.data.barrageRecord],s.wordsDisplayStatus=!0,-1!==s.duration&&(this.data.timer=setTimeout((()=>{s.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=s.wordsDisplayStatus,this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data})}),1e3*s.duration)),v(s,this.data),this.emitter.emit("barrageRecordChange",this.data.barrageRecord),this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(e.MeEvent.ROLECHANGE,(()=>this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data})))}barrage(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${i}/barrage`,e)}))}deleteBarrage(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/deleteBarrage`)}))}},e.createMeeting=function(e){return e.singleton?F.getInstance(e).meeting:B(e)},e.reset=X,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|
|
1
|
+
var YlinkSDKMeeting=function(e){"use strict";function t(e,t,r,i){return new(r||(r=Promise))((function(s,n){function o(e){try{c(i.next(e))}catch(t){n(t)}}function a(e){try{c(i.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))}function r(e){return{all:e=e||new Map,on:function(t,r){var i=e.get(t);i?i.push(r):e.set(t,[r])},off:function(t,r){var i=e.get(t);i&&(r?i.splice(i.indexOf(r)>>>0,1):e.set(t,[]))},emit:function(t,r){var i=e.get(t);i&&i.slice().map((function(e){e(r)})),(i=e.get("*"))&&i.slice().map((function(e){e(t,r)}))}}}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s={exports:{}};!function(e,t){var r="__lodash_hash_undefined__",s=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",h="[object Promise]",f="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",y="[object WeakMap]",b="[object ArrayBuffer]",x="[object DataView]",E="[object Float32Array]",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[b]=U[x]=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[y]=!1;var j="object"==typeof self&&self&&self.Object===Object&&self,N="object"==typeof i&&i&&i.Object===Object&&i||j||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,i){var s=-1,n=e?e.length:0;for(i&&n&&(r=e[++s]);++s<n;)r=t(r,e[s],s,e);return r}function V(e){var t=!1;if(null!=e&&"function"!=typeof e.toString)try{t=!!(e+"")}catch(r){}return t}function B(e){var t=-1,r=Array(e.size);return e.forEach((function(e,i){r[++t]=[i,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=N["__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?N.Buffer:void 0,ie=N.Symbol,se=N.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(N,"DataView"),he=Ce(N,"Map"),fe=Ce(N,"Promise"),me=Ce(N,"Set"),ge=Ce(N,"WeakMap"),ve=Ce(Object,"create"),ye=Ve(pe),be=Ve(he),xe=Ve(fe),Ee=Ve(me),qe=Ve(ge),Ie=ie?ie.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 i=e[t];this.set(i[0],i[1])}}function Te(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function $e(e){var t=-1,r=e?e.length:0;for(this.clear();++t<r;){var i=e[t];this.set(i[0],i[1])}}function _e(e){this.__data__=new Te(e)}function 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,i=Array(e);++r<e;)i[r]=t(r);return i}(e.length,String):[],i=r.length,s=!!i;for(var o in e)!t&&!Z.call(e,o)||s&&("length"==o||Me(o,i))||r.push(o);return r}function Se(e,t,r){var i=e[t];Z.call(e,t)&&Be(i,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,i,s,h,y){var w;if(i&&(w=h?i(e,s,h,y):i(e)),void 0!==w)return w;if(!Fe(e))return e;var 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,i=e.length;t||(t=Array(i));for(;++r<i;)t[r]=e[r];return t}(e,w)}else{var j=Le(e),N=j==c||j==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(j==p||j==n||N&&!h){if(V(e))return h?e:{};if(w=function(e){return"function"!=typeof e.constructor||He(e)?{}:(t=ne(e),Fe(t)?oe(t):{});var t}(N?{}:e),!t)return function(e,t){return Ne(e,Re(e),t)}(e,function(e,t){return e&&Ne(t,ze(t),e)}(w,e))}else{if(!U[j])return h?e:{};w=function(e,t,r,i){var s=e.constructor;switch(t){case b:return je(e);case o:case a:return new s(+e);case x:return function(e,t){var r=t?je(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,i);case E:case q:case I:case D:case O:case T:case $:case _:case A:return function(e,t){var r=t?je(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}(e,i);case d:return function(e,t,r){return H(t?r(B(e),!0):B(e),L,new e.constructor)}(e,i,r);case l:case g:return new s(e);case f:return function(e){var t=new e.constructor(e.source,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,i,r);case v:return n=e,De?Object(De.call(n)):{}}var n}(e,j,Pe,t)}}y||(y=new _e);var k=y.get(e);if(k)return k;if(y.set(e,w),!P)var C=r?function(e){return function(e,t,r){var i=t(e);return Ge(e)?i:function(e,t){for(var r=-1,i=t.length,s=e.length;++r<i;)e[s+r]=t[r];return e}(i,r(e))}(e,ze,Re)}(e):ze(e);return function(e,t){for(var r=-1,i=e?e.length:0;++r<i&&!1!==t(e[r],r,e););}(C||e,(function(s,n){C&&(s=e[n=s]),Se(w,n,Pe(s,t,r,i,n,e,y))})),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 je(e){var t=new e.constructor(e.byteLength);return new se(t).set(new se(e)),t}function Ne(e,t,r,i){r||(r={});for(var s=-1,n=t.length;++s<n;){var o=t[s],a=i?i(r[o],e[o],o,r,e):void 0;Se(r,o,void 0===a?e[o]:a)}return r}function ke(e,t){var r,i,s=e.__data__;return("string"==(i=typeof(r=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==r:null===r)?s["string"==typeof t?"string":"hash"]:s.map}function 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 i=t[e];return i===r?void 0:i}return Z.call(t,e)?t[e]:void 0},Oe.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:Z.call(t,e)},Oe.prototype.set=function(e,t){return this.__data__[e]=ve&&void 0===t?r:t,this},Te.prototype.clear=function(){this.__data__=[]},Te.prototype.delete=function(e){var t=this.__data__,r=we(t,e);return!(r<0)&&(r==t.length-1?t.pop():ce.call(t,r,1),!0)},Te.prototype.get=function(e){var t=this.__data__,r=we(t,e);return r<0?void 0:t[r][1]},Te.prototype.has=function(e){return we(this.__data__,e)>-1},Te.prototype.set=function(e,t){var r=this.__data__,i=we(r,e);return i<0?r.push([e,t]):r[i][1]=t,this},$e.prototype.clear=function(){this.__data__={hash:new Oe,map:new(he||Te),string:new Oe}},$e.prototype.delete=function(e){return 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 i=r.__data__;if(!he||i.length<199)return i.push([e,t]),this;r=this.__data__=new $e(i)}return r.set(e,t),this};var Re=ue?G(ue,Object):function(){return[]},Le=function(e){return ee.call(e)};function Me(e,t){return!!(t=null==t?s: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)))!=x||he&&Le(new he)!=d||fe&&Le(fe.resolve())!=h||me&&Le(new me)!=m||ge&&Le(new ge)!=y)&&(Le=function(e){var t=ee.call(e),r=t==p?e.constructor:void 0,i=r?Ve(r):void 0;if(i)switch(i){case ye:return x;case be:return d;case xe:return h;case Ee:return m;case qe:return y}return t});var Ge=Array.isArray;function Ye(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=s}(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 n=s.exports;const o=e=>({get(t,r,i){if("__isProxy"===r)return!0;const s=Reflect.get(t,r);return Array.isArray(s)?s:"object"==typeof s&&null!==s?s.__isProxy?s:new Proxy(s,o(e)):s},set(t,r,i,s){const o=t[r];i=f(i)&&i.__isProxy?n(i):i;const a=Reflect.set(t,r,i,s);return((e,t)=>e!==t&&(e==e||t==t))(i,o)&&e.emit(`${x(r)}Change`,i),a}}),a=e=>encodeURIComponent(e).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class c{constructor(e){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=e.baseURL,this._beforeRequest=e.beforeRequest,this._errorHandler=e.error}_request(e){const{timeout:t=18e5}=e;let{headers:r={}}=e;return e.url=D(this.baseURL,e.url||""),e.url=((e,t)=>{if(!t)return e;const r=[];Object.keys(t).forEach((e=>{const i=t[e];if(null==i)return;let s;Array.isArray(i)?(s=i,e+="[]"):s=[i],s.forEach((t=>{null!==t&&"object"==typeof t&&(t=JSON.stringify(t)),r.push(`${a(e)}=${a(t)}`)}))}));const i=r.join("&");if(i){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e})(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])})),m(e.data)&&(e.data=e.data.buffer),g(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?l(e):d(e)}setDefaultHeader(e,t){e in this._defaultHeaders&&(""===t||null===t)?delete this._defaultHeaders[e]:this._defaultHeaders[e]=t}get(e,t){return this._errorHandler?this._request(Object.assign(t||{},{url:e,method:"GET"})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(t||{},{url:e,method:"GET"}))}post(e,t,r){return this._errorHandler?this._request(Object.assign(r||{},{url:e,method:"POST",data:t})).catch((e=>{throw this._errorHandler&&this._errorHandler(e),e})):this._request(Object.assign(r||{},{url:e,method:"POST",data:t}))}}class u{constructor(e){let t;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=e,t(this.reason))}))}static source(){let e;const t=new u((t=>{e=t}));return{cancel:e,token:t}}}const d=e=>new Promise(((t,r)=>{const{data:i=null,url:s,method:n="GET",headers:o,cancelToken:a,withResDate:c}=e;let u=new XMLHttpRequest;u.open(n.toUpperCase(),s,!0),u.timeout=e.timeout;const d=()=>{if(u){if(u.status>=200&&u.status<300)try{const e=JSON.parse(u.responseText);c&&(e.responseDate=new Date(u.getResponseHeader("Date")).getTime()),t(e)}catch(e){r(new Error("E_JSON_PARSE"+u.responseText))}else r({url:s,statusCode:u.status});u=null}};"onloadend"in u?u.onloadend=d:u.onreadystatechange=()=>{u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=()=>{u&&(r({url:s,statusCode:u.status,type:"request abort"}),u=null)},u.onerror=()=>{r(new Error("Network Error")),u=null},u.ontimeout=()=>{r(new Error("timeout of "+e.timeout+"ms exceeded")),u=null},"setRequestHeader"in u&&Object.keys(o).forEach((e=>{null===i&&"content-type"===e.toLowerCase()?delete o[e]:u.setRequestHeader(e,o[e])})),a&&a.promise.then((e=>{u&&(u.abort(),r(e),u=null)})),u.send(i)})),l=e=>new Promise(((t,r)=>{const{data:i=null,url:s,method:n="GET",headers:o,cancelToken:a}=e,c=wx.request({url:s,data:i,method:n.toUpperCase(),timeout:e.timeout,header:o,success(e){e.statusCode>=200&&e.statusCode<300?t(e.data):r({url:s,statusCode:e.statusCode})},fail(e){r("request:fail abort"===e.errMsg&&a&&a.reason||e)}});a&&a.promise.then((()=>{c&&c.abort()}))})),p=Array.isArray,h=e=>null==e,f=e=>"object"==typeof e&&null!==e,m=e=>{let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer,t},g=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},v=()=>{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("")},y=(e,t)=>e?(Object.entries(e).forEach((e=>{const[r,i]=[e[0],e[1]];if(null!==i)return f(i)&&!p(i)?(t[r]||(t[r]={}),void(t[r]=y(i,t[r]))):void(t[r]=i)})),t):t,b=/-(\w)/g,x=e=>e.replace(b,((e,t)=>t?t.toUpperCase():"")),{hasOwnProperty:E}=Object.prototype,q=(e,t)=>E.call(e,t),I=(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 i in e)q(e,i)&&(r[i]=I(e[i],t));return r},D=(e,t)=>e&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)?((e,t)=>t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e)(e,t):t;var O,T,$,_,A;e.EVENT=void 0,(O=e.EVENT||(e.EVENT={})).REQUEST_ERROR="requestError",O.STATE="state",O.FAILED="failed",e.STATE=void 0,(T=e.STATE||(e.STATE={}))[T.CLOSE=0]="CLOSE",T[T.JOINED=1]="JOINED",T[T.READY=2]="READY",e.ENDPOINT_TYPE=void 0,($=e.ENDPOINT_TYPE||(e.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",e.ROLE=void 0,(_=e.ROLE||(e.ROLE={})).HOST="host",_.COHOST="coHost",_.ATTENDEE="attendee",_.AUDIENCE="audience",e.RECORD_STATUS=void 0,(A=e.RECORD_STATUS||(e.RECORD_STATUS={})).STARTED="started",A.PAUSED="paused",A.STARTING="starting",A.STOPPED="stopped";class S{constructor(e,t){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"on",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"off",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=t,this.ctx=e,this.emitter=r(),this.on=this.emitter.on,this.off=this.emitter.off,this.data=new Proxy({},o(this.emitter)),this._bindOn()}cleanup(){this.emitter.all=new Map,this.data=new Proxy({},o(this.emitter))}reactive(e){if(!f(e))return console.warn("Parameter is not an object!"),e;const t=new Map,r=(e,i)=>{Object.keys(e).forEach((s=>{!1===i&&s in this.data&&(e[s]=this.data[s]);const n=t=>e[s]=t,o=`${x(s)}Change`;this.emitter.on(o,n),t.set(o,n),f(e[s])&&!p(e[s])&&r(e[s],!0)}))};return r(e,!1),e._destory=()=>{t.forEach(((e,t)=>{this.emitter.off(t,e)}))},e}}class w extends S{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)&&y(r,this.data)})),this.ctx.emitter.on("participantCount",(e=>{const{body:t}=e;y({participantCount:t},this.data)}))}subject(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/info/subject`,e)}))}practiceSession(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/info/practiceSession`)}))}shareInfo(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${r}/shareInfo`,{params:e})}meetings(e){if(!e)return Promise.reject();const{prefix:{ctrl:t}}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings`,{params:e})}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 P(e){const t=[],{isInLobby:r}=e.modules.me.data;return r?(t.push("lobbyMember"),t):(Object.keys(e.modules).forEach((r=>{const i=e.modules[r]._topic();i&&(Array.isArray(i)?i.forEach((e=>{t.includes(e)||t.push(e)})):t.includes(i)||t.push(i))})),t)}function U(e,r){return t(this,void 0,void 0,(function*(){const{meetingID:t,clientID:i}=r.config.request,s=yield r.request.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:i,meetingId:t},inboxes:e}),n=[];return s.data&&Object.keys(s.data).forEach((e=>{n.push({name:e,seqId:s.data[e].maxSeqId,limit:200})})),n}))}function j(e,r){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:i,clientID:s}=r.config.request,n=yield r.request.post(`${t}meetings/${i}/subscribe`,{endpointID:s,topics:e}),o=n&&n.data&&n.data.eventMsgs;o&&o.forEach((e=>{r.emitter.emit(e.event,e)}))}))}function N(e,r,i){return t(this,void 0,void 0,(function*(){const{inboxes:s,clientID:n,meetingID:o,cancelToken:a,status:c}=r;if(yield(()=>t(this,void 0,void 0,(function*(){let t;try{t=yield e.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:s},{cancelToken:a,withResDate:!0})}catch(d){return c.attempts++,void console.error(d)}if(!t)return console.error("polling error: ","response is null"),void c.attempts++;const{data:r={},bizCode:u,error:d}=t;if(u&&900408!==u)return console.error("polling error: ",JSON.stringify(d)),void c.attempts++;c.attempts=0,r&&Object.keys(r).forEach((e=>{const t=s.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,i(t)})))}))})))(),!c.running)return;if(c.attempts>M)return console.error("polling Max Attempts"),void(r.onError&&r.onError({message:"Max Attempts"}));const u=c.attempts?H(c.attempts):0;c.timer=setTimeout((()=>{c.running&&N(e,r,i)}),u)}))}const k=(e,r)=>t(void 0,void 0,void 0,(function*(){const{meetingID:t,clientID:i}=r.config.request;r.status.polling.running=!0,N(r.request,{inboxes:e,clientID:i,meetingID:t,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 C(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=u.source()}function R(e,r){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:i},meetingID:s,userID:n}=e.config.request;if(e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null),yield(()=>t(this,void 0,void 0,(function*(){let t;try{t=yield e.request.post(`${i}meetings/${s}/users/${n}/keepalive`,{},{cancelToken:e.config.request.cancelToken.token})}catch(a){return e.status.keepalive.attempts++,void console.error(a)}if(!t||!t.data)return;const{data:r={},bizCode:o,error:a}=t;if(900200!==o&&900408!==o&&901323!==o)return e.status.keepalive.attempts++,void console.error("keepalive ",o,a);const c=r.interval||"";c?(e.status.keepalive.interval=c,e.status.keepalive.attempts=0):console.error("keepalive ",o,a)})))(),!e.status.keepalive.running)return;if(e.status.keepalive.attempts>M)return console.error("keepalive Max Attempts"),void(r&&r({message:"Max Attempts"}));const o=e.status.keepalive.attempts?H(e.status.keepalive.attempts):1e3*e.status.keepalive.interval;e.status.keepalive.timer=setTimeout((()=>{e.status.keepalive.running&&R(e,r)}),o)}))}const L=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)},M=5,H=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 V;e.MeEvent=void 0,(V=e.MeEvent||(e.MeEvent={})).INIT="meInit",V.UPDATE="meUpdate",V.UPDATE_USER_STATE="updateUserState",V.ROLECHANGE="meRoleChange",V.AUDIOCHANGE="meAudioChange",V.HANDUPCHANGE="meHandupChange",V.SETAUDIO="setAudio",V.VIDEOCHANGE="meVideoChange",V.SETVIDEO="setVideo",V.SHARECHANGE="meShareChange",V.DISPLAYNAMECHANGE="meDisplayNameChange",V.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",V.LOBBYCHANGE="meLobbyChange",V.BARRAGECHANGE="meBarrageChange",V.LEAVE="leave";class B extends S{constructor(e){super(e,"me")}_topic(){return""}_bindOn(){const r=r=>t(this,void 0,void 0,(function*(){if("role"in r&&r.role!==this.data.role){const t=this.data.role;y({role:r.role},this.data),r.role!==e.ROLE.AUDIENCE&&t!==e.ROLE.AUDIENCE||(yield this.rePolling("roleChange")),this.emitter.emit(e.MeEvent.ROLECHANGE,r.role),this.ctx.emitter.emit(e.MeEvent.ROLECHANGE,r.role)}})),i=t=>{var r,i,s,n,o,a;if("audio"in t){const{deviceOn:c,sendOn:u,recvOn:d,opBy:l}=t.audio;(!h(c)&&c!==(null===(r=this.data.audio)||void 0===r?void 0:r.deviceOn)||!h(u)&&u!==(null===(i=this.data.audio)||void 0===i?void 0:i.sendOn)||!h(d)&&u!==(null===(s=this.data.audio)||void 0===s?void 0:s.recvOn)||!h(l))&&(y({audio:t.audio},this.data),this.emitter.emit(e.MeEvent.AUDIOCHANGE,{deviceOn:h(c)?null===(n=this.data.audio)||void 0===n?void 0:n.deviceOn:c,sendOn:h(u)?null===(o=this.data.audio)||void 0===o?void 0:o.sendOn:u,recvOn:h(u)?null===(a=this.data.audio)||void 0===a?void 0:a.recvOn:d,opBy:l}))}},s=t=>{var r,i,s,n,o,a;if("video"in t){const{deviceOn:c,sendOn:u,opBy:d,blocked:l}=t.video;(!h(c)&&c!==(null===(r=this.data.video)||void 0===r?void 0:r.deviceOn)||!h(u)&&u!==(null===(i=this.data.video)||void 0===i?void 0:i.sendOn)||!h(l)&&l!==(null===(s=this.data.video)||void 0===s?void 0:s.blocked))&&(y({video:t.video},this.data),this.emitter.emit(e.MeEvent.VIDEOCHANGE,{deviceOn:h(c)?null===(n=this.data.video)||void 0===n?void 0:n.deviceOn:c,sendOn:h(u)?null===(o=this.data.video)||void 0===o?void 0:o.sendOn:u,blocked:h(u)?null===(a=this.data.video)||void 0===a?void 0:a.blocked:l,opBy:d}))}},n=t=>{var r,i,s,n;if("share"in t){const{deviceOn:o,sendOn:a,opBy:c}=t.share;(!h(o)&&o!==(null===(r=this.data.share)||void 0===r?void 0:r.deviceOn)||!h(a)&&a!==(null===(i=this.data.share)||void 0===i?void 0:i.sendOn))&&(y({share:t.share},this.data),this.emitter.emit(e.MeEvent.SHARECHANGE,{deviceOn:h(o)?null===(s=this.data.share)||void 0===s?void 0:s.deviceOn:o,sendOn:h(a)?null===(n=this.data.share)||void 0===n?void 0:n.sendOn:a,opBy:c}))}},o=t=>{t.displayName&&t.displayName!==this.data.displayName&&(y({displayName:t.displayName},this.data),this.emitter.emit(e.MeEvent.DISPLAYNAMECHANGE,t.displayName))},a=t=>{"isHandUp"in t&&t.isHandUp!==this.data.isHandUp&&(y({isHandUp:t.isHandUp},this.data),this.emitter.emit(e.MeEvent.HANDUPCHANGE,t.isHandUp))},c=t=>{"isSpotlightVideo"in t&&(y({isSpotlightVideo:t.isSpotlightVideo},this.data),this.emitter.emit(e.MeEvent.SPOTLIGHTVIDEOCHANGE,t.isSpotlightVideo))},u=r=>t(this,void 0,void 0,(function*(){if("isInLobby"in r&&r.isInLobby!==this.data.isInLobby){y({isInLobby:r.isInLobby},this.data);const t=!1===r.isInLobby?"inLobbyChange":void 0;yield this.rePolling(t),this.emitter.emit(e.MeEvent.LOBBYCHANGE,r.isInLobby),this.ctx.emitter.emit(e.MeEvent.LOBBYCHANGE,r.isInLobby)}})),d=t=>{if(!t.barrage)return;let r=null;if(!t.barrage.wordsDisplayStatus)return r=null,delete t.barrage,this.data.barrage=r||void 0,void this.emitter.emit(e.MeEvent.BARRAGECHANGE,r);if(!t.barrage.receiver)return;r={content:t.barrage.content,contentType:t.barrage.contentType,type:t.barrage.type,duration:t.barrage.duration,position:t.barrage.position};let{role:i}=this.data;if(this.data.endpointType===e.ENDPOINT_TYPE.SUPERVISION){const{info:t}=this.ctx.modules;i="webinar"===t.meetingType?e.ROLE.AUDIENCE:e.ROLE.ATTENDEE}i===e.ROLE.HOST||i===e.ROLE.COHOST?r=t.barrage.receiver.host?r:null:i===e.ROLE.ATTENDEE?r=t.barrage.receiver.attendee?r:null:i===e.ROLE.AUDIENCE&&(r=t.barrage.receiver.audience?r:null),delete t.barrage,this.data.barrage=r||void 0,this.emitter.emit(e.MeEvent.BARRAGECHANGE,r)},l=t=>{"leave"in t&&!0===t.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),C(this.ctx),Z(this.ctx),this.emitter.emit(e.MeEvent.LEAVE,t.resultInfo),this.ctx.cleanup(t.resultInfo))},p=t=>{r(t),i(t),s(t),n(t),o(t),a(t),u(t),c(t),d(t),l(t),(this.data.isInLobby||this.data.role===e.ROLE.AUDIENCE)&&this.data.share&&this.data.share.sendOn&&n({share:{deviceOn:!0,sendOn:!1,recvOn:!1}})};this.ctx.emitter.on(e.MeEvent.INIT,(e=>{y(e,this.data),this.data.isUpdatedUserState=!1})),this.ctx.emitter.on(e.MeEvent.UPDATE,(e=>{p(e),y(e,this.data)})),this.ctx.emitter.on(e.EVENT.STATE,(({state:t})=>{t===e.STATE.READY&&this.data.endpointType!==e.ENDPOINT_TYPE.SUPERVISION&&this.emitter.emit(e.MeEvent.UPDATE_USER_STATE,{data:this.data})})),this.ctx.emitter.on("me",(e=>t(this,void 0,void 0,(function*(){const{state:t,body:r={users:[]}}=e;if("delete"===t){const e=r.users[0];return e.leave=!0,void l(e)}let i=r.users.find((e=>e.userID===this.data.userID));i||r.users.length&&(i=r.users[0]),i?(p(i),y(i,this.data)):console.warn("me ",t,r)})))),this.ctx.emitter.on("setUserVideo",(t=>{this.emitter.emit(e.MeEvent.SETVIDEO,t.body)})),this.ctx.emitter.on("setUserAudio",(t=>{this.emitter.emit(e.MeEvent.SETAUDIO,t.body)})),this.ctx.emitter.on("meetingState",(e=>{const{body:t={}}=e;if("ended"===t.state){l({leave:!0,resultInfo:t.resultInfo})}}))}updateUserState(t,r=!1){if(!r){const{role:r,initialMediaState:i}=this.data;t.audio.sendOn=t.audio.sendOn&&i.audio.sendOn,t.video.sendOn=t.video.sendOn&&i.video.sendOn,r===e.ROLE.AUDIENCE&&(t.audio.sendOn=!1,t.video.sendOn=!1)}const{prefix:{ctrl:i},meetingID:s}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,y(t,this.data),this.ctx.request.post(`${i}meetings/${s}/updateUserState`,t)}rePolling(r){return t(this,void 0,void 0,(function*(){const{ctx:t}=this;C(t);const i=P(t),s=yield U(i,t);if(r&&this.emitter.emit(e.MeEvent.UPDATE_USER_STATE,{data:this.data,event:r}),yield j(i,t),"undefined"!=typeof Worker&&t.worker){const{meetingID:e,clientID:r}=t.config.request;t.worker.postMessage({inboxes:s,topics:i,meetingID:e,clientID:r,rePolling:!0})}else yield k(s,t)}))}}class G extends S{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=G.setDisplayNamePinyinProp?G.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?y(e,this.data.callRecordUsers[t]):"update"===r&&-1===t&&(e.displayNamePinyin=G.setDisplayNamePinyinProp?G.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 Y extends S{constructor(e){super(e,"users"),this.data={interactiveUsers:[],broadcastUsers:[],lobbyUsers:[],advCtrlUsers:[]}}_topic(){const{role:t,endpointType:r}=this.ctx.modules.me.data;return r===e.ENDPOINT_TYPE.SUPERVISION?["interactive","broadcast"]:t===e.ROLE.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const t=(t,{event:r,state:i})=>{if(t.userID!==this.ctx.modules.me.data.userID)return;const{resultInfo:s={}}=t;if("delete"!==i||"delete"===i&&[901357,901358,901352,901351,901350,901349].includes(s.bizCode||-1))return void this.ctx.emitter.emit(e.MeEvent.UPDATE,t);let n=!1;switch(r){case"interactiveUsers":t.isInLobby||(n=!0);break;case"broadcastUsers":t.isInLobby||t.role!==e.ROLE.AUDIENCE||(n=!0);break;case"lobbyUsers":t.isInLobby&&(n=!0)}const o={};n&&(o.leave=!0),this.ctx.emitter.emit(e.MeEvent.UPDATE,Object.assign(Object.assign({},t),o))},r=({updateUsers:e,state:r,sourceKey:i})=>{if("full"===r)return this.data[i]=e.map((e=>(e.displayNamePinyin=Y.setDisplayNamePinyinProp?Y.setDisplayNamePinyinProp(e.displayName):e.displayName,t(e,{event:i,state:r}),e))),this.emitter.emit(`${i}Change`,{users:this.data[i],isFull:!0}),this.data[i];void 0===this.data[i]&&(this.data[i]=[]);const{data:s,emitter:n}=this;return e.forEach((e=>{const o=s[i].findIndex((t=>e.userID===t.userID));if("delete"===r&&-1!==o){const[t]=this.data[i].splice(o,1);n.emit(`${i}Delete`,{user:t,resultInfo:e.resultInfo})}else if("update"===r&&-1!==o){const t=this.data[i][o];this.updateUserProps(e,t),y(e,t),this.data[i][o]=I(t),this.emitter.emit(`${i}Update`,{user:this.data[i][o]})}else"update"===r&&-1===o&&(e.displayNamePinyin=Y.setDisplayNamePinyinProp?Y.setDisplayNamePinyinProp(e.displayName):e.displayName,s[i].push(e),this.emitter.emit(`${i}Add`,{user:e,resultInfo:e.resultInfo}));t(e,{event:i,state:r})})),this.emitter.emit(`${i}Change`,{users:this.data[i],isFull:!1}),this.data[i]};this.ctx.emitter.on("interactiveUsers",(e=>{const{state:t,body:i}=e;r({updateUsers:i.users,state:t,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(e=>{const{state:t,body:i}=e;r({updateUsers:i.users,state:t,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(e=>{const{state:t,body:i}=e;r({updateUsers:i.users,state:t,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(e=>{const{state:t,body:i}=e;r({updateUsers:i.users,state:t,sourceKey:"advCtrlUsers"})}))}reactive(e){if(!f(e))return console.warn("Parameter is not an object!"),e;const t=new Map,r=(e,i)=>{Object.keys(e).forEach((s=>{!1===i&&s in this.data&&(e[s]=this.data[s]);const n=t=>e[s]=t.users.map((e=>e)),o=`${x(s)}Change`;this.emitter.on(o,n),t.set(o,n),f(e[s])&&!p(e[s])&&r(e[s],!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=Y.setDisplayNamePinyinProp?Y.setDisplayNamePinyinProp(e.displayName):e.displayName)}setAudio(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${i}/users/${e}/audio`,t)}setVideo(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${i}/users/${e}/video`,t)}setShare(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${i}/users/${e}/share`,t)}setWhiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${i}users/${e}/whiteboard`,t)}handUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${i}/users/${e}/handUp`,t)}setRole(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${i}/users/${e}/role`,t)}rename(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${i}/users/${e}/displayName`,t)}remove(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/users/${e}/remove`)}replyHandUp(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${i}/users/${e}/replyHandUp`,t)}fecc(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${i}/users/${e}/fecc`,t)}lobbyState(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${i}/users/${e}/lobbyState`,t)}allowLocalRecord(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${i}/users/${e}/allowLocalRecord`,t)}whiteboard(e,t){if(!e||!t)return Promise.reject();const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${i}/users/${e}/whiteboard`,t)}callStats(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${r}/users/${e}/callStats`)}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:i}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${i}/users/${e}/sendLayout`,t)}setSendLayoutEnabled(e,t){const{prefix:{ctrl:r},meetingID:i}=this.ctx.config.request;return this.ctx.request.post(`${r}meetings/${i}/users/${e}/sendLayoutEnabled`,t)}}function Q(t){const{baseURL:i,modules:s,worker:n,singleton:o}=t;s.findIndex((e=>e===B))<0&&s.push(B),s.findIndex((e=>e===w))<0&&s.push(w);const a=t.clientID||`${v()}_${((e=new Date,t)=>{const r={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length)));for(const i in r)new RegExp("("+i+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?r[i]:("00"+r[i]).substr((""+r[i]).length)));return t})(new Date,"MMddHHmmss")}`,d={config:{baseURL:i,modules:s,singleton:o||!1,request:{cancelToken:u.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1/"},clientID:a,location:"",meetingID:"",ctrlID:"",sessionID:"",userID:-1,voteTk:""}},worker:n,emitter:r(),request:new c({baseURL:i,beforeRequest:e=>{e.headers["X-Y-Request-Id"]=v(),e.timeout=18e5},error:t=>{d.emitter.emit(e.EVENT.REQUEST_ERROR,t)}}),modules:{},state:e.STATE.CLOSE,status:{polling:{running:!1,attempts:0,timer:null},keepalive:{running:!1,attempts:0,timer:null,interval:20}},cleanup:t=>{d.state!==e.STATE.CLOSE&&(d.worker&&d.worker.terminate(),d.config.request.location="",d.config.request.meetingID="",d.config.request.ctrlID="",d.config.request.sessionID="",d.config.request.userID=-1,d.config.request.voteTk="",d.status={polling:{running:!1,attempts:0,timer:null},keepalive:{running:!1,attempts:0,timer:null,interval:20}},d.request.setDefaultHeader("X-Y-Location",""),d.request.setDefaultHeader("X-Y-Ctrl-Id",""),d.request.setDefaultHeader("X-Y-Session-Id",""),d.state=e.STATE.CLOSE,d.emitter.emit(e.EVENT.STATE,{state:d.state,reason:t}))}};return d}function W(t){const r=Q(t);return r.worker&&("undefined"!=typeof Worker?r.worker.postMessage({baseURL:r.config.baseURL}):console.error("The current environment does not support worker")),function(e,t){if(!p(e))return void console.error("The modules parameter requires an array type");e.forEach((e=>{const r=new e(t);t.modules[r.moduleName]=r}))}(r.config.modules,r),r.emitter.on(e.EVENT.STATE,(({state:t})=>{t===e.STATE.CLOSE&&Object.keys(r.modules).forEach((e=>{r.modules[e].cleanup()}))})),r.emitter.on("pollError",(()=>{z(r)()})),r.emitter.on("keepaliveError",(()=>{z(r)()})),Object.assign({config:r.config,request:r.request,get state(){return r.state},on:r.emitter.on,off:r.emitter.off,join:F(r),leave:z(r),end:X(r),endMeeting:J(r)},r.modules)}function F(r){return function(i){var s;return t(this,void 0,void 0,(function*(){const{clientID:t}=r.config.request,n=`${null===(s=i.endpointType)||void 0===s?void 0:s.toLocaleUpperCase()}${t}_${i.meetingNum}`;r.config.request.sessionID=n,r.request.setDefaultHeader("X-Y-Session-Id",n);const{prefix:o}=r.config.request,a=yield r.request.get(`${o.ctrl}credential`,{params:{meetingNum:i.meetingNum,pwd:i.pwd,url:i.url,mobileCode:i.mobileCode,mobile:i.mobile,regEmail:i.regEmail,accEmail:i.accEmail,tk:i.tk,displayName:i.displayName,userAgent:i.userAgent},headers:{"X-Y-Endpoint-Type":i.endpointType}}),{credential:c="",location:u=""}=a&&a.data||{};if(!c)return r.emitter.emit(e.EVENT.FAILED,{bizCode:a.bizCode,data:a.data}),a;r.config.request.location=u,r.request.setDefaultHeader("X-Y-Location",u),delete i.pwd,delete i.url;const d={displayName:i.displayName,userAgent:i.userAgent,clientID:t};i.groupIDs&&i.account&&(d.groupIDs=i.groupIDs,d.account=i.account,d.groupName=i.groupName);const l=yield r.request.post(`${o.ctrl}join?meetingNum=${i.meetingNum}&credential=${c}`,d,{headers:{"X-Y-Endpoint-Type":i.endpointType,"X-Y-Endpoint-Id":t}});if(!l||l&&l.ret<=-1)return r.emitter.emit(e.EVENT.FAILED,{bizCode:l.bizCode,data:l.data}),l;const{meetingID:p="",ctrlID:h="",user:f={},mediaContent:m={},initialMediaState:g={},tk:v=""}=l.data;r.config.request.meetingID=p,r.config.request.ctrlID=h,r.config.request.userID=f.userID,r.config.request.voteTk=v,r.request.setDefaultHeader("X-Y-Ctrl-Id",h),r.emitter.emit(e.MeEvent.INIT,Object.assign(Object.assign({},f),{mediaContent:m,initialMediaState:g})),r.state=e.STATE.JOINED,r.emitter.emit(e.EVENT.STATE,{state:r.state});const y=()=>{r.state!==e.STATE.READY&&(r.state=e.STATE.READY,r.emitter.emit(e.EVENT.STATE,{state:r.state}))},b=P(r),x=yield U(b,r);return yield j(b,r),"undefined"!=typeof Worker&&r.worker?(r.status.polling.running=!0,r.worker.postMessage({topics:b,meetingID:p,clientID:t,inboxes:x,status:!0}),r.worker.onmessage=e=>{"pollingStarted"!==e.data?"pollingStopped"!==e.data?(console.log("[Polling]",e.data),r.emitter.emit(e.data.event,e.data)):r.status.polling.running=!1:y()}):(r.status.polling.running=!0,k(x,r),y()),r.status.keepalive.running=!0,R(r,(e=>{r.emitter.emit("keepaliveError",e)})),l.data=Object.assign(Object.assign({},l.data),a.data),l}))}}function z(e){return function(r){return t(this,void 0,void 0,(function*(){r||(r={resultInfo:{bizCode:901359}});const{prefix:t,meetingID:i}=e.config.request;let s;try{s=yield e.request.post(`${t.ctrl}meetings/${i}/leave`,r)}catch(n){console.error(n)}return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),C(e),L(e),Z(e),e.cleanup(),s}))}}function X(e){return function(){return t(this,void 0,void 0,(function*(){const{prefix:t,meetingID:r}=e.config.request,i=yield e.request.post(`${t.ctrl}meetings/${r}/end`);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),C(e),L(e),Z(e),e.cleanup(),i}))}}function J(e){return function(r){return t(this,void 0,void 0,(function*(){const{prefix:t}=e.config.request;return yield e.request.post(`${t.ctrl}meetingNum/${r}/end`)}))}}class K{constructor(e){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=W(e)}static getInstance(e){return this.instance?this.instance:this.instance=new K(e)}}function Z(e){if(e.config.singleton){const{baseURL:t,modules:r,singleton:i}=e.config,s={baseURL:t,modules:r,worker:e.worker,singleton:i},n=K.getInstance(s);n&&(n.meeting=W(s))}}return Object.defineProperty(K,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null}),e.Chat=class extends S{constructor(e){super(e,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(e=>{const{body:t}=e;this.emitter.emit("chatMsg",t)}))}msg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/chat/msg`,e)}))}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/chat/historyMsg`,e)}))}},e.Info=w,e.Interpretation=class extends S{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`)}},e.Invite=G,e.LiveStream=class extends S{constructor(e){super(e,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(e=>{var t;const{state:r,body:i,stime:s}=e;if(i){if(s&&(this.data.jetlag=s),"full"===r){const{liveStreams:e=[]}=i;if(!e.length)return;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 y({status:t,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),i.liveStreams||(this.data.resultInfo={}),null===(t=i.liveStreams)||void 0===t||t.forEach((e=>{this.data.resultInfo=e.resultInfo||{};let t=this.data.liveStreams.findIndex((t=>t.platform===e.platform));-1===t?(e.requesting="starting"===e.status,this.data.liveStreams.push(e)):(e.requesting="starting"===e.status,e=Object.assign(Object.assign({},this.data.liveStreams[t]),e),this.data.liveStreams.splice(t,1,e)),t=this.data.status.findIndex((t=>t.platform===e.platform));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(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/liveStream/status`,e)}))}liveStreamDescription(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/liveStream/description`,e)}))}liveStreamSetting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/liveStream/setting`,e)}))}},e.Me=B,e.Qa=class extends S{constructor(e){super(e,"qa"),this.data={questions:new Map,topSort:0}}_topic(){return"qa"}_bindOn(){this.ctx.emitter.on("qa",(e=>{const{body:t}=e;f(t)&&!p(t)?this.qaUpdate(this.data.questions,t):t.forEach((e=>this.qaUpdate(this.data.questions,e)))}))}cleanup(){this.data={questions:new Map,topSort:0}}qaUpdate(e,t){let r=e.get(t.question.id);const{clientID:i}=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===i});break;case"dismissQuestion":if(!r)break;r.sender.endpointID!==i?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!==i?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(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/qa`,e)}))}},e.Recording=class extends S{constructor(e){super(e,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(e=>{const{state:t,body:r,stime:i}=e;if(r)return i&&(this.data.stime=i),this.data.isPracticeSession="started"===r.status&&this.data.status===r.status&&0===r.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),r),"starting"===r.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=r.status||this.data.status),this.data.resultInfo=r.resultInfo||{},["full","update"].includes(t)?(r.recordUsers&&(this.data.recording.recordUsers=r.recordUsers),this.data):void 0}))}history(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.get(`${e}meetings/${t}/recording/history`)}))}status(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/status`,e)}))}layout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/status`,e)}))}designatedUsers(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/designatedUsers`,e)}))}participantAdd(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/recording/participant/add`,e)}))}participantDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/recording/participant/delete`,e)}))}getTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getTemplates`,{params:e})}))}getByIds(e){return t(this,void 0,void 0,(function*(){const{prefix:{user:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/subject/getByIds`,e)}))}recordLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/layout`,e)}))}},e.Setting=class extends S{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)&&y(r,this.data)}))}setting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/setting`,e)}))}muteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/muteAll`)}))}unmuteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/unmuteAll`)}))}},e.SpotlightVideo=class extends S{constructor(e){super(e,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(t=>{const{body:r}=t;if(!r||!r.userIDs)return;this.data.userIDs=r.userIDs;r.userIDs.findIndex((e=>e===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(e.MeEvent.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(e.MeEvent.UPDATE,{isSpotlightVideo:!1})}))}spotlight(e){if(!e)return Promise.reject();const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/view/spotlight`,e)}},e.Transcript=class extends S{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(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}meetings/${r}/transcript/historyMsg`,e)}))}},e.Users=Y,e.View=class extends S{constructor(e){super(e,"view")}_topic(){const{endpointType:t,role:r}=this.ctx.modules.me.data;return t===e.ENDPOINT_TYPE.WEBCTRL?["hostAttendee","audience","advCtrl"]:r===e.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:i}=e;i&&("meetingView"===r?Object.keys(i).forEach((e=>{this.data[e]=i[e]})):this.data[t]=i)}updatePersonalLayouts(e){const{state:t,body:r}=e;"full"!==t&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),r.personalLayouts.forEach((e=>{const{subscriber:r={userID:-1}}=e,i=r.userID||r.subjectID||-1;"full"===t||"update"===t||e.templateStatus?this.data.personalLayouts[i]=e:delete this.data.personalLayouts[i]})),this.emitter.emit("personalLayoutsChange",this.data.personalLayouts)}hostLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/hostLayout`,e)}))}attendeeLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/attendeeLayout`,e)}))}audienceLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/audienceLayout`,e)}))}personalLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/personalLayout`,e)}))}personalLayoutDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/personalLayout/delete`,e)}))}virtualClassLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/virtualClass/layout`,e)}))}closeVirtualClass(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/view/virtualClass/close`)}))}getVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/layout/template/info`,{params:e})}))}addVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/layout/template/add`,e)}))}editVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/layout/template/edit`,e)}))}getTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getTemplates`,{params:e})}))}editTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/edit`,e)}))}addTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/add`,e)}))}deleteTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/delete`,e)}))}getDefaultTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getDefaultTemplates`,{params:e})}))}changeDefaultTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/changeDefaultTemplate`,e)}))}perspectiveBind(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/perspective/bind`,e)}))}},e.Vote=class extends S{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(e.MeEvent.LOBBYCHANGE,(e=>{e&&(this.data.vote={})}))}getVotes(e){const{prefix:{vote:t},meetingID:r,voteTk:i}=this.ctx.config.request;return e.tk=e.tk||i,this.ctx.request.get(`${t}meetings/${r}/votes`,{params:e})}getVote(e){const{prefix:{vote:t},meetingID:r,voteTk:i}=this.ctx.config.request;return e.tk=e.tk||i,this.ctx.request.get(`${t}meetings/${r}/vote`,{params:e})}getMeVote(e){const{prefix:{vote:t},meetingID:r,voteTk:i}=this.ctx.config.request;return e.tk=e.tk||i,this.ctx.request.get(`${t}meetings/${r}/vote/me`,{params:e})}voteStatus(e,t){const{prefix:{vote:r},meetingID:i,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.post(`${r}meetings/${i}/vote/status?tk=${e.tk}&voteID=${e.voteID}`,t)}voteSubmit(e,t){const{prefix:{vote:r},meetingID:i,voteTk:s}=this.ctx.config.request;return e.tk=e.tk||s,this.ctx.request.post(`${r}meetings/${i}/vote/submit?tk=${e.tk}&voteID=${e.voteID}`,t)}voteAdd(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/add`,e)}voteEdit(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/edit`,e)}voteDelete(e){const{prefix:{conference:t}}=this.ctx.config.request;return this.ctx.request.post(`${t}personal/vote/delete`,e)}voteInProgress(e){const{prefix:{vote:t},meetingID:r,voteTk:i}=this.ctx.config.request;return this.ctx.request.get(`${t}meetings/${r}/vote/inProgress`,{params:{tk:e&&e.tk||i}})}},e.Words=class extends S{constructor(e){super(e,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(t=>{this.data.timer&&clearTimeout(this.data.timer);const{state:r,body:i,pollingSeqId:s}=t;if(!i)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data});"full"===r&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),s&&(this.data.barrageRecord=[{id:s,content:i.content,time:(new Date).getTime(),durationType:i.durationType,duration:1e3*i.duration},...this.data.barrageRecord]),i.wordsDisplayStatus=!0,-1!==i.duration&&(this.data.timer=setTimeout((()=>{i.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=i.wordsDisplayStatus,this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data})}),1e3*i.duration)),y(i,this.data),this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(e.MeEvent.ROLECHANGE,(()=>this.ctx.emitter.emit(e.MeEvent.UPDATE,{barrage:this.data})))}barrage(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/barrage`,e)}))}deleteBarrage(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:e},meetingID:t}=this.ctx.config.request;return yield this.ctx.request.post(`${e}meetings/${t}/deleteBarrage`)}))}},e.createMeeting=function(e){return e.singleton?K.getInstance(e).meeting:W(e)},e.reset=Z,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=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 t{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(t){const{
|
|
1
|
+
"use strict";const e=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 t{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(t){const{timeout:r=18e5}=t;let{headers:l={}}=t;return t.url=i(this.baseURL,t.url||""),t.url=((t,r)=>{if(!r)return t;const n=[];Object.keys(r).forEach((t=>{const s=r[t];if(null==s)return;let o;Array.isArray(s)?(o=s,t+="[]"):o=[s],o.forEach((r=>{null!==r&&"object"==typeof r&&(r=JSON.stringify(r)),n.push(`${e(t)}=${e(r)}`)}))}));const s=n.join("&");if(s){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t})(t.url,t.params),l=Object.assign(l,this._defaultHeaders),Object.keys(l).forEach((e=>{"Content-Type"!==e&&e.toUpperCase()==="Content-Type".toUpperCase()&&(l["Content-Type"]=l[e],delete l[e])})),o(t.data)&&(t.data=t.data.buffer),a(t.data)&&(l&&!l["Content-Type"]&&(l["Content-Type"]="application/json;charset=utf-8"),t.data=JSON.stringify(t.data)),t.headers=l,t.timeout=r,this._beforeRequest&&this._beforeRequest(t),"undefined"!=typeof wx&&void 0!==wx.request?s(t):n(t)}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 r{constructor(e){let t;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((e=>{t=e})),e((e=>{this.reason||(this.reason=e,t(this.reason))}))}static source(){let e;const t=new r((t=>{e=t}));return{cancel:e,token:t}}}const n=e=>new Promise(((t,r)=>{const{data:n=null,url:s,method:o="GET",headers:a,cancelToken:i,withResDate:l}=e;let u=new XMLHttpRequest;u.open(o.toUpperCase(),s,!0),u.timeout=e.timeout;const c=()=>{if(u){if(u.status>=200&&u.status<300)try{const e=JSON.parse(u.responseText);l&&(e.responseDate=new Date(u.getResponseHeader("Date")).getTime()),t(e)}catch(e){r(new Error("E_JSON_PARSE"+u.responseText))}else r({url:s,statusCode:u.status});u=null}};"onloadend"in u?u.onloadend=c:u.onreadystatechange=()=>{u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(c)},u.onabort=()=>{u&&(r({url:s,statusCode:u.status,type:"request abort"}),u=null)},u.onerror=()=>{r(new Error("Network Error")),u=null},u.ontimeout=()=>{r(new Error("timeout of "+e.timeout+"ms exceeded")),u=null},"setRequestHeader"in u&&Object.keys(a).forEach((e=>{null===n&&"content-type"===e.toLowerCase()?delete a[e]:u.setRequestHeader(e,a[e])})),i&&i.promise.then((e=>{u&&(u.abort(),r(e),u=null)})),u.send(n)})),s=e=>new Promise(((t,r)=>{const{data:n=null,url:s,method:o="GET",headers:a,cancelToken:i}=e,l=wx.request({url:s,data:n,method:o.toUpperCase(),timeout:e.timeout,header:a,success(e){e.statusCode>=200&&e.statusCode<300?t(e.data):r({url:s,statusCode:e.statusCode})},fail(e){r("request:fail abort"===e.errMsg&&i&&i.reason||e)}});i&&i.promise.then((()=>{l&&l.abort()}))})),o=e=>{let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer,t},a=e=>{if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype},i=(e,t)=>e&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(t)?((e,t)=>t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e)(e,t):t;function l(e,t,r,n){return new(r||(r=Promise))((function(s,o){function a(e){try{l(n.next(e))}catch(t){o(t)}}function i(e){try{l(n.throw(e))}catch(t){o(t)}}function l(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,i)}l((n=n.apply(e,t||[])).next())}))}function u(e,t,r){return l(this,void 0,void 0,(function*(){const{inboxes:n,clientID:s,meetingID:o,cancelToken:a,status:i}=t;if(yield(()=>l(this,void 0,void 0,(function*(){let t;try{t=yield e.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:s,meetingId:o},inboxes:n},{cancelToken:a,withResDate:!0})}catch(c){return i.attempts++,void console.error(c)}if(!t)return console.error("polling error: ","response is null"),void i.attempts++;const{data:l={},bizCode:u,error:c}=t;if(u&&900408!==u)return console.error("polling error: ",JSON.stringify(c)),void i.attempts++;i.attempts=0,l&&Object.keys(l).forEach((e=>{const t=n.find((t=>t.name===e));t&&(t.seqId=l[e].maxSeqId,l[e].items&&l[e].items.forEach((e=>{const t=JSON.parse(e.content);["liveStream","recording"].includes(t.event)&&(t.stime=e.stime),t.pollingSeqId=e.seqId,r(t)})))}))})))(),!i.running)return;if(i.attempts>c)return console.error("polling Max Attempts"),void(t.onError&&t.onError({message:"Max Attempts"}));const p=i.attempts?d(i.attempts):0;i.timer=setTimeout((()=>{i.running&&u(e,t,r)}),p)}))}const c=5,d=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},p=self;let f,h=r.source(),m="",b="",g="";const y={running:!1,attempts:0,timer:null};function w(e){f=new t({baseURL:m}),y.running=!0,u(f,{inboxes:e,clientID:b,meetingID:g,cancelToken:h.token,status:y},(e=>{p.postMessage(e)})),p.postMessage("pollingStarted")}function O(){y.running=!1,y.timer&&(clearTimeout(y.timer),y.timer=null),h.cancel(),h=r.source(),p.postMessage("pollingStopped")}p.addEventListener("message",(e=>{"baseURL"in e.data&&(m=e.data.baseURL),"clientID"in e.data&&(b=e.data.clientID),"meetingID"in e.data&&(g=e.data.meetingID);const{inboxes:t=[]}=e.data;"rePolling"in e.data&&(O(),w(t)),"status"in e.data&&(e.data.status?w(t):O())}),!1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ylink-sdk/meeting",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Meeting control of yealink",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "dist/meeting.esm.prod.js",
|
|
@@ -25,6 +25,6 @@
|
|
|
25
25
|
"workers": ["polling.worker.ts"]
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@ylink-sdk/shared": "
|
|
28
|
+
"@ylink-sdk/shared": "0.2.0-beta.2"
|
|
29
29
|
}
|
|
30
30
|
}
|