@ylink-sdk/meeting 0.1.13 → 0.2.0-beta.0
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.
- package/README.md +1 -1
- package/dist/meeting.cjs.prod.js +1 -0
- package/dist/meeting.d.ts +1915 -0
- package/dist/meeting.esm.prod.js +1 -0
- package/dist/meeting.global.prod.js +1 -0
- package/dist/worker/polling.worker.prod.js +1 -0
- package/index.js +3 -0
- package/package.json +17 -46
- package/LICENSE +0 -21
- package/dist/index.d.ts +0 -161
- package/dist/types/ctrl.d.ts +0 -1026
- package/dist/types/data.d.ts +0 -737
- package/dist/types/enums.d.ts +0 -240
- package/dist/ylink-sdk-meeting.es.js +0 -1
- package/dist/ylink-sdk-meeting.umd.js +0 -1
package/README.md
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";function t(t,r,s,i){return new(s||(s=Promise))((function(n,o){function a(t){try{u(i.next(t))}catch(e){o(e)}}function c(t){try{u(i.throw(t))}catch(e){o(e)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof s?e:new s((function(t){t(e)}))).then(a,c)}u((i=i.apply(t,r||[])).next())}))}function e(t){return{all:t=t||new Map,on:function(e,r){var s=t.get(e);s?s.push(r):t.set(e,[r])},off:function(e,r){var s=t.get(e);s&&(r?s.splice(s.indexOf(r)>>>0,1):t.set(e,[]))},emit:function(e,r){var s=t.get(e);s&&s.slice().map((function(t){t(r)})),(s=t.get("*"))&&s.slice().map((function(t){t(e,r)}))}}}Object.defineProperty(exports,"__esModule",{value:!0});var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},s={exports:{}};!function(t,e){var s="__lodash_hash_undefined__",i=9007199254740991,n="[object Arguments]",o="[object Boolean]",a="[object Date]",c="[object Function]",u="[object GeneratorFunction]",d="[object Map]",l="[object Number]",p="[object Object]",h="[object Promise]",f="[object RegExp]",m="[object Set]",g="[object String]",v="[object Symbol]",x="[object WeakMap]",y="[object ArrayBuffer]",b="[object DataView]",E="[object Float32Array]",I="[object Float64Array]",q="[object Int8Array]",D="[object Int16Array]",O="[object Int32Array]",T="[object Uint8Array]",_="[object Uint8ClampedArray]",$="[object Uint16Array]",S="[object Uint32Array]",A=/\w*$/,w=/^\[object .+?Constructor\]$/,j=/^(?:0|[1-9]\d*)$/,P={};P[n]=P["[object Array]"]=P[y]=P[b]=P[o]=P[a]=P[E]=P[I]=P[q]=P[D]=P[O]=P[d]=P[l]=P[p]=P[f]=P[m]=P[g]=P[v]=P[T]=P[_]=P[$]=P[S]=!0,P["[object Error]"]=P[c]=P[x]=!1;var U="object"==typeof self&&self&&self.Object===Object&&self,N="object"==typeof r&&r&&r.Object===Object&&r||U||Function("return this")(),R=e&&!e.nodeType&&e,C=R&&t&&!t.nodeType&&t,k=C&&C.exports===R;function L(t,e){return t.set(e[0],e[1]),t}function M(t,e){return t.add(e),t}function H(t,e,r,s){var i=-1,n=t?t.length:0;for(s&&n&&(r=t[++i]);++i<n;)r=e(r,t[i],i,t);return r}function V(t){var r=!1;if(null!=t&&"function"!=typeof t.toString)try{r=!!(t+"")}catch(e){}return r}function G(t){var e=-1,r=Array(t.size);return t.forEach((function(t,s){r[++e]=[s,t]})),r}function B(t,e){return function(r){return t(e(r))}}function Y(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}var W,X=Array.prototype,F=Function.prototype,J=Object.prototype,K=N["__core-js_shared__"],z=(W=/[^.]+$/.exec(K&&K.keys&&K.keys.IE_PROTO||""))?"Symbol(src)_1."+W:"",Q=F.toString,Z=J.hasOwnProperty,tt=J.toString,et=RegExp("^"+Q.call(Z).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),rt=k?N.Buffer:void 0,st=N.Symbol,it=N.Uint8Array,nt=B(Object.getPrototypeOf,Object),ot=Object.create,at=J.propertyIsEnumerable,ct=X.splice,ut=Object.getOwnPropertySymbols,dt=rt?rt.isBuffer:void 0,lt=B(Object.keys,Object),pt=Nt(N,"DataView"),ht=Nt(N,"Map"),ft=Nt(N,"Promise"),mt=Nt(N,"Set"),gt=Nt(N,"WeakMap"),vt=Nt(Object,"create"),xt=Mt(pt),yt=Mt(ht),bt=Mt(ft),Et=Mt(mt),It=Mt(gt),qt=st?st.prototype:void 0,Dt=qt?qt.valueOf:void 0;function Ot(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var s=t[e];this.set(s[0],s[1])}}function Tt(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var s=t[e];this.set(s[0],s[1])}}function _t(t){var e=-1,r=t?t.length:0;for(this.clear();++e<r;){var s=t[e];this.set(s[0],s[1])}}function $t(t){this.__data__=new Tt(t)}function St(t,e,r){var s=t[e];Z.call(t,e)&&Ht(s,r)&&(void 0!==r||e in t)||(t[e]=r)}function At(t,e){for(var r=t.length;r--;)if(Ht(t[r][0],e))return r;return-1}function wt(t,e,r,s,i,h,x){var w;if(s&&(w=h?s(t,i,h,x):s(t)),void 0!==w)return w;if(!Wt(t))return t;var j=Vt(t);if(j){if(w=function(t){var e=t.length,r=t.constructor(e);return e&&"string"==typeof t[0]&&Z.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!e)return function(t,e){var r=-1,s=t.length;for(e||(e=Array(s));++r<s;)e[r]=t[r];return e}(t,w)}else{var U=Ct(t),N=U==c||U==u;if(Bt(t))return function(t,e){if(e)return t.slice();var r=new t.constructor(t.length);return t.copy(r),r}(t,e);if(U==p||U==n||N&&!h){if(V(t))return h?t:{};if(w=function(t){return"function"!=typeof t.constructor||Lt(t)?{}:Wt(e=nt(t))?ot(e):{};var e}(N?{}:t),!e)return function(t,e){return Pt(t,Rt(t),e)}(t,function(t,e){return t&&Pt(e,Xt(e),t)}(w,t))}else{if(!P[U])return h?t:{};w=function(t,e,r,s){var i=t.constructor;switch(e){case y:return jt(t);case o:case a:return new i(+t);case b:return function(t,e){var r=e?jt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,s);case E:case I:case q:case D:case O:case T:case _:case $:case S:return function(t,e){var r=e?jt(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}(t,s);case d:return function(t,e,r){return H(e?r(G(t),!0):G(t),L,new t.constructor)}(t,s,r);case l:case g:return new i(t);case f:return function(t){var e=new t.constructor(t.source,A.exec(t));return e.lastIndex=t.lastIndex,e}(t);case m:return function(t,e,r){return H(e?r(Y(t),!0):Y(t),M,new t.constructor)}(t,s,r);case v:return Dt?Object(Dt.call(t)):{}}}(t,U,wt,e)}}x||(x=new $t);var R=x.get(t);if(R)return R;if(x.set(t,w),!j)var C=r?function(t){return function(t,e,r){var s=e(t);return Vt(t)?s:function(t,e){for(var r=-1,s=e.length,i=t.length;++r<s;)t[i+r]=e[r];return t}(s,r(t))}(t,Xt,Rt)}(t):Xt(t);return function(t,e){for(var r=-1,s=t?t.length:0;++r<s&&!1!==e(t[r],r););}(C||t,(function(i,n){C&&(i=t[n=i]),St(w,n,wt(i,e,r,s,n,t,x))})),w}function jt(t){var e=new t.constructor(t.byteLength);return new it(e).set(new it(t)),e}function Pt(t,e,r,s){r||(r={});for(var i=-1,n=e.length;++i<n;){var o=e[i],a=s?s(r[o],t[o],o,r,t):void 0;St(r,o,void 0===a?t[o]:a)}return r}function Ut(t,e){var r,s,i=t.__data__;return("string"==(s=typeof(r=e))||"number"==s||"symbol"==s||"boolean"==s?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function Nt(t,e){var r=function(t,e){return null==t?void 0:t[e]}(t,e);return function(t){return!(!Wt(t)||(e=t,z&&z in e))&&(Yt(t)||V(t)?et:w).test(Mt(t));var e}(r)?r:void 0}Ot.prototype.clear=function(){this.__data__=vt?vt(null):{}},Ot.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},Ot.prototype.get=function(t){var e=this.__data__;if(vt){var r=e[t];return r===s?void 0:r}return Z.call(e,t)?e[t]:void 0},Ot.prototype.has=function(t){var e=this.__data__;return vt?void 0!==e[t]:Z.call(e,t)},Ot.prototype.set=function(t,e){return this.__data__[t]=vt&&void 0===e?s:e,this},Tt.prototype.clear=function(){this.__data__=[]},Tt.prototype.delete=function(t){var e=this.__data__,r=At(e,t);return!(r<0||(r==e.length-1?e.pop():ct.call(e,r,1),0))},Tt.prototype.get=function(t){var e=this.__data__,r=At(e,t);return r<0?void 0:e[r][1]},Tt.prototype.has=function(t){return At(this.__data__,t)>-1},Tt.prototype.set=function(t,e){var r=this.__data__,s=At(r,t);return s<0?r.push([t,e]):r[s][1]=e,this},_t.prototype.clear=function(){this.__data__={hash:new Ot,map:new(ht||Tt),string:new Ot}},_t.prototype.delete=function(t){return Ut(this,t).delete(t)},_t.prototype.get=function(t){return Ut(this,t).get(t)},_t.prototype.has=function(t){return Ut(this,t).has(t)},_t.prototype.set=function(t,e){return Ut(this,t).set(t,e),this},$t.prototype.clear=function(){this.__data__=new Tt},$t.prototype.delete=function(t){return this.__data__.delete(t)},$t.prototype.get=function(t){return this.__data__.get(t)},$t.prototype.has=function(t){return this.__data__.has(t)},$t.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Tt){var s=r.__data__;if(!ht||s.length<199)return s.push([t,e]),this;r=this.__data__=new _t(s)}return r.set(t,e),this};var Rt=ut?B(ut,Object):function(){return[]},Ct=function(t){return tt.call(t)};function kt(t,e){return!!(e=null==e?i:e)&&("number"==typeof t||j.test(t))&&t>-1&&t%1==0&&t<e}function Lt(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||J)}function Mt(t){if(null!=t){try{return Q.call(t)}catch(r){}try{return t+""}catch(r){}}return""}function Ht(t,e){return t===e||t!=t&&e!=e}(pt&&Ct(new pt(new ArrayBuffer(1)))!=b||ht&&Ct(new ht)!=d||ft&&Ct(ft.resolve())!=h||mt&&Ct(new mt)!=m||gt&&Ct(new gt)!=x)&&(Ct=function(t){var e=tt.call(t),r=e==p?t.constructor:void 0,s=r?Mt(r):void 0;if(s)switch(s){case xt:return b;case yt:return d;case bt:return h;case Et:return m;case It:return x}return e});var Vt=Array.isArray;function Gt(t){return null!=t&&function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=i}(t.length)&&!Yt(t)}var Bt=dt||function(){return!1};function Yt(t){var e=Wt(t)?tt.call(t):"";return e==c||e==u}function Wt(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function Xt(t){return Gt(t)?function(t,e){var r=Vt(t)||function(t){return function(t){return function(t){return!!t&&"object"==typeof t}(t)&&Gt(t)}(t)&&Z.call(t,"callee")&&(!at.call(t,"callee")||tt.call(t)==n)}(t)?function(t,e){for(var r=-1,s=Array(t);++r<t;)s[r]=e(r);return s}(t.length,String):[],s=r.length,i=!!s;for(var o in t)!e&&!Z.call(t,o)||i&&("length"==o||kt(o,s))||r.push(o);return r}(t):function(t){if(!Lt(t))return lt(t);var e=[];for(var r in Object(t))Z.call(t,r)&&"constructor"!=r&&e.push(r);return e}(t)}t.exports=function(t){return wt(t,!0,!0)}}(s,s.exports);var i=s.exports;const n=t=>({get(e,r,s){if("__isProxy"===r)return!0;const i=Reflect.get(e,r);return Array.isArray(i)?i:"object"==typeof i&&null!==i?i.__isProxy?i:new Proxy(i,n(t)):i},set(e,r,s,n){const o=e[r];s=h(s)&&s.__isProxy?i(s):s;const a=Reflect.set(e,r,s,n);return((t,e)=>t!==e&&(t==t||e==e))(s,o)&&t.emit(`${x(r)}Change`,s),a}}),o=t=>encodeURIComponent(t).replace(/%40/g,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]");class a{constructor(t){Object.defineProperty(this,"baseURL",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_defaultHeaders",{enumerable:!0,configurable:!0,writable:!0,value:{}}),Object.defineProperty(this,"_beforeRequest",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_errorHandler",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseURL=t.baseURL,this._beforeRequest=t.beforeRequest,this._errorHandler=t.error}_request(t){const{url:e="",timeout:r=6e4}=t;let{headers:s={}}=t;return t.url=this.baseURL.replace(/\/+$/,"")+"/"+((t,e)=>{if(!e)return t;const r=[];Object.keys(e).forEach((t=>{const s=e[t];if(null==s)return;let i;Array.isArray(s)?(i=s,t+="[]"):i=[s],i.forEach((e=>{null!==e&&"object"==typeof e&&(e=JSON.stringify(e)),r.push(`${o(t)}=${o(e)}`)}))}));const s=r.join("&");if(s){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t})(e.replace(/^\/+/,""),t.params),s=Object.assign(s,this._defaultHeaders),Object.keys(s).forEach((t=>{"Content-Type"!==t&&t.toUpperCase()==="Content-Type".toUpperCase()&&(s["Content-Type"]=s[t],delete s[t])})),f(t.data)&&(s&&!s["Content-Type"]&&(s["Content-Type"]="application/json;charset=utf-8"),t.data=JSON.stringify(t.data)),t.headers=s,t.timeout=r,this._beforeRequest&&this._beforeRequest(t),"undefined"!=typeof wx?d(t):u(t)}setDefaultHeader(t,e){!(t in this._defaultHeaders)||""!==e&&null!==e?this._defaultHeaders[t]=e:delete this._defaultHeaders[t]}get(t,e){return this._errorHandler?this._request(Object.assign(e||{},{url:t,method:"GET"})).catch((t=>{throw this._errorHandler&&this._errorHandler(t),t})):this._request(Object.assign(e||{},{url:t,method:"GET"}))}post(t,e,r){return this._errorHandler?this._request(Object.assign(r||{},{url:t,method:"POST",data:e})).catch((t=>{throw this._errorHandler&&this._errorHandler(t),t})):this._request(Object.assign(r||{},{url:t,method:"POST",data:e}))}}class c{constructor(t){let e;Object.defineProperty(this,"promise",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.promise=new Promise((t=>{e=t})),t((t=>{this.reason||(this.reason=t,e(this.reason))}))}static source(){let t;const e=new c((e=>{t=e}));return{cancel:t,token:e}}}const u=t=>new Promise(((e,r)=>{const{data:s=null,url:i,method:n="GET",headers:o,cancelToken:a,withResDate:c}=t;let u=new XMLHttpRequest;u.open(n.toUpperCase(),i,!0),u.timeout=t.timeout;const d=()=>{if(u){if(u.status>=200&&u.status<300)try{const t=JSON.parse(u.responseText);c&&(t.responseDate=new Date(u.getResponseHeader("Date")).getTime()),e(t)}catch(t){r(new Error("E_JSON_PARSE"+u.responseText))}else r({url:i,statusCode:u.status});u=null}};"onloadend"in u?u.onloadend=d:u.onreadystatechange=()=>{u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(d)},u.onabort=()=>{u&&(r({url:i,statusCode:u.status,type:"request abort"}),u=null)},u.onerror=()=>{r(new Error("Network Error")),u=null},u.ontimeout=()=>{r(new Error("timeout of "+t.timeout+"ms exceeded")),u=null},"setRequestHeader"in u&&Object.keys(o).forEach((t=>{null===s&&"content-type"===t.toLowerCase()?delete o[t]:u.setRequestHeader(t,o[t])})),a&&a.promise.then((t=>{u&&(u.abort(),r(t),u=null)})),u.send(s)})),d=t=>new Promise(((e,r)=>{const{data:s=null,url:i,method:n="GET",headers:o,cancelToken:a}=t,c=wx.request({url:i,data:s,method:n.toUpperCase(),timeout:t.timeout,header:o,success(t){t.statusCode>=200&&t.statusCode<300?e(t.data):r({url:i,statusCode:t.statusCode})},fail(t){r("request:fail abort"===t.errMsg&&a&&a.reason||t)}});a&&a.promise.then((()=>{c&&c.abort()}))})),l=Array.isArray,p=t=>null==t,h=t=>"object"==typeof t&&null!==t,f=t=>{if("[object Object]"!==Object.prototype.toString.call(t))return!1;const e=Object.getPrototypeOf(t);return null===e||e===Object.prototype},m=()=>{const t=[],e="0123456789abcdef";for(let r=0;r<36;r++)t[r]=e.substr(Math.floor(16*Math.random()),1);return t[14]="4",t[19]=e.substr(3&t[19]|8,1),t[8]=t[13]=t[18]=t[23]="-",t.join("").split("-").join("")},g=(t,e)=>t?(Object.entries(t).forEach((t=>{const[r,s]=[t[0],t[1]];if(null!==s)return h(s)&&!l(s)?(e[r]||(e[r]={}),void(e[r]=g(s,e[r]))):void(e[r]=s)})),e):e,v=/-(\w)/g,x=t=>t.replace(v,((t,e)=>e?e.toUpperCase():""));var y,b,E,I,q,D;exports.EVENT=void 0,(y=exports.EVENT||(exports.EVENT={})).REQUEST_ERROR="requestError",y.STATE="state",exports.STATE=void 0,(b=exports.STATE||(exports.STATE={}))[b.CLOSE=0]="CLOSE",b[b.JOINED=1]="JOINED",b[b.READY=2]="READY",exports.ENDPOINT_TYPE=void 0,(E=exports.ENDPOINT_TYPE||(exports.ENDPOINT_TYPE={})).WEBAPP="webApp",E.WEBCTRL="webCtrl",E.WECHATMP="weChatMP",E.SUPERVISION="supervision",E.BIGSCREEN="bigScreen",E.DESKTOP="desktop",E.MOBILE="mobile",E.VCS="vcs",E.SIP="sip",E.H323="h323",E.PSTN="pstn",exports.ROLE=void 0,(I=exports.ROLE||(exports.ROLE={})).HOST="host",I.COHOST="coHost",I.ATTENDEE="attendee",I.AUDIENCE="audience",exports.RECORD_STATUS=void 0,(q=exports.RECORD_STATUS||(exports.RECORD_STATUS={})).STARTED="started",q.PAUSED="paused",q.STARTING="starting",q.STOPPED="stopped";class O{constructor(t,r){Object.defineProperty(this,"moduleName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ctx",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.moduleName=r,this.ctx=t,this.emitter=e(),this.data=new Proxy({},n(this.emitter)),this._bindOn()}reactive(t){if(h(t)){const e=new Map,r=(t,s)=>{Object.keys(t).forEach((i=>{!1===s&&i in this.data&&(t[i]=this.data[i]);const n=e=>t[i]=e,o=`${x(i)}Change`;this.emitter.on(o,n),e.set(o,n),h(t[i])&&!l(t[i])&&r(t[i],!0)}))};r(t,!1),t._destory=()=>{e.forEach(((t,e)=>{this.emitter.off(e,t)}))}}else console.warn("Parameter is not an object!");return t}on(t,e){return this.emitter.on(t,e)}off(t,e){return this.emitter.off(t,e)}}class T extends O{constructor(t){super(t,"info")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingInfo",(t=>{const{state:e,body:r}=t;("full"===e||"update"===e)&&g(r,this.data)})),this.ctx.emitter.on("participantCount",(t=>{const{body:e}=t;g({participantCount:e},this.data)}))}subject(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${r}/info/subject`,e)}))}practiceSession(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${e}/info/practiceSession`)}))}}function _(e){return t(this,void 0,void 0,(function*(){const r=$(e),{sessionID:s,meetingID:i}=e.config.request,n=yield function(e,r){return t(this,void 0,void 0,(function*(){const{topics:t,sessionID:s,meetingID:i}=r,n=yield e.post("/ypush/api/v1/meeting-control/inbox",{basic:{tenantId:100,clientId:s,meetingId:i},inboxes:t}),o=[];return n.data&&Object.keys(n.data).forEach((t=>{o.push({name:t,seqId:n.data[t].maxSeqId,limit:200})})),o}))}(e.request,{topics:r,sessionID:s,meetingID:i});yield A(r,e),e.status.polling.running=!0,e.status.keepalive.running=!0,w(e.request,{inboxes:n,sessionID:s,meetingID:i,cancelToken:e.config.request.cancelToken.token,status:e.status.polling},(t=>{e.emitter.emit(t.event,t)})),j(e)}))}function $(t){const e=[],{isInLobby:r}=t.modules.me.data;return r?(e.push("lobbyMember"),e):(Object.keys(t.modules).forEach((r=>{const s=t.modules[r]._topic();s&&(Array.isArray(s)?s.forEach((t=>{e.includes(t)||e.push(t)})):e.includes(s)||e.push(s))})),e)}function S(t){t.status.polling.running=!1,t.status.keepalive.running=!1,t.status.polling.timer&&(clearTimeout(t.status.polling.timer),t.status.polling.timer=null),t.status.keepalive.timer&&(clearTimeout(t.status.keepalive.timer),t.status.keepalive.timer=null),t.config.request.cancelToken.cancel(),t.config.request.cancelToken=c.source()}function A(e,r){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:s}=r.config.request,i=yield r.request.post(`${t}/meetings/${s}/subscribe`,{topics:e}),n=i&&i.data&&i.data.eventMsgs;n&&n.forEach((t=>{console.log("[subscribe]",t),r.emitter.emit(t.event,t)})),r.state=exports.STATE.READY,r.emitter.emit(exports.EVENT.STATE,{state:r.state})}))}function w(e,r,s){return t(this,void 0,void 0,(function*(){const{inboxes:i,sessionID:n,meetingID:o,cancelToken:a,status:c}=r;yield(()=>t(this,void 0,void 0,(function*(){const t=yield e.post("/ypush/api/v1/meeting-control/polling",{basic:{tenantId:100,clientId:n,meetingId:o},inboxes:i},{cancelToken:a,withResDate:!0});if(!t||!t.data)return;const{data:r={}}=t;Object.keys(r).forEach((t=>{const e=i.find((e=>e.name===t));if(e){if(e.seqId=r[t].maxSeqId,!r[t].items)return;r[t].items.forEach((t=>{const e=JSON.parse(t.content);["liveStream","recording"].includes(e.event)&&(e.stime=t.stime),s(e)}))}}))})))(),c.running&&(c.timer=setTimeout((()=>{c.running&&w(e,r,s)}),200))}))}function j(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:r},meetingID:s,userID:i}=e.config.request;e.status.keepalive.timer&&(clearTimeout(e.status.keepalive.timer),e.status.keepalive.timer=null),yield(()=>t(this,void 0,void 0,(function*(){const t=yield e.request.post(`${r}/meetings/${s}/users/${i}/keepalive`,{},{cancelToken:e.config.request.cancelToken.token});if(!t||!t.data)return;const{data:n={}}=t,o=n.interval||"";o&&(e.status.keepalive.interval=o)})))(),e.status.keepalive.running&&(e.status.keepalive.timer=setTimeout((()=>{e.status.keepalive.running&&j(e)}),1e3*e.status.keepalive.interval))}))}exports.MeEvent=void 0,(D=exports.MeEvent||(exports.MeEvent={})).INIT="meInit",D.UPDATE="meUpdate",D.UPDATE_USER_STATE="updateUserState",D.ROLECHANGE="meRoleChange",D.AUDIOCHANGE="meAudioChange",D.HANDUPCHANGE="meHandupChange",D.SETAUDIO="setAudio",D.VIDEOCHANGE="meVideoChange",D.SETVIDEO="setVideo",D.SHARECHANGE="meShareChange",D.DISPLAYNAMECHANGE="meDisplayNameChange",D.SPOTLIGHTVIDEOCHANGE="meSpotlightVideoChange",D.LOBBYCHANGE="meLobbyChange",D.BARRAGECHANGE="meBarrageChange",D.LEAVE="leave";class P extends O{constructor(t){super(t,"me")}_topic(){return""}_bindOn(){const e=e=>t(this,void 0,void 0,(function*(){"role"in e&&e.role!==this.data.role&&(e.role!==exports.ROLE.AUDIENCE&&this.data.role!==exports.ROLE.AUDIENCE||(yield U(this.ctx),this.data.isUpdatedUserState=!1,this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,this.data)),g({role:e.role},this.data),this.emitter.emit(exports.MeEvent.ROLECHANGE,e.role),this.ctx.emitter.emit(exports.MeEvent.ROLECHANGE,e.role))})),r=t=>{var e,r,s,i;if("audio"in t){const{deviceOn:n,sendOn:o,opBy:a}=t.audio;(!p(n)&&n!==(null===(e=this.data.audio)||void 0===e?void 0:e.deviceOn)||!p(o)&&o!==(null===(r=this.data.audio)||void 0===r?void 0:r.sendOn))&&(g({audio:t.audio},this.data),this.emitter.emit(exports.MeEvent.AUDIOCHANGE,{deviceOn:p(n)?null===(s=this.data.audio)||void 0===s?void 0:s.deviceOn:n,sendOn:p(o)?null===(i=this.data.audio)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},s=t=>{var e,r,s,i;if("video"in t){const{deviceOn:n,sendOn:o,opBy:a}=t.video;(!p(n)&&n!==(null===(e=this.data.video)||void 0===e?void 0:e.deviceOn)||!p(o)&&o!==(null===(r=this.data.video)||void 0===r?void 0:r.sendOn))&&(g({video:t.video},this.data),this.emitter.emit(exports.MeEvent.VIDEOCHANGE,{deviceOn:p(n)?null===(s=this.data.video)||void 0===s?void 0:s.deviceOn:n,sendOn:p(o)?null===(i=this.data.video)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},i=t=>{var e,r,s,i;if("share"in t){const{deviceOn:n,sendOn:o,opBy:a}=t.share;(!p(n)&&n!==(null===(e=this.data.share)||void 0===e?void 0:e.deviceOn)||!p(o)&&o!==(null===(r=this.data.share)||void 0===r?void 0:r.sendOn))&&(g({share:t.share},this.data),this.emitter.emit(exports.MeEvent.SHARECHANGE,{deviceOn:p(n)?null===(s=this.data.share)||void 0===s?void 0:s.deviceOn:n,sendOn:p(o)?null===(i=this.data.share)||void 0===i?void 0:i.sendOn:o,opBy:a}))}},n=t=>{t.displayName&&t.displayName!==this.data.displayName&&(g({displayName:t.displayName},this.data),this.emitter.emit(exports.MeEvent.DISPLAYNAMECHANGE,t.displayName))},o=t=>{"isHandUp"in t&&t.isHandUp!==this.data.isHandUp&&(g({isHandUp:t.isHandUp},this.data),this.emitter.emit(exports.MeEvent.HANDUPCHANGE,t.isHandUp))},a=t=>{"isSpotlightVideo"in t&&(g({isSpotlightVideo:t.isSpotlightVideo},this.data),this.emitter.emit(exports.MeEvent.SPOTLIGHTVIDEOCHANGE,t.isSpotlightVideo))},c=e=>t(this,void 0,void 0,(function*(){"isInLobby"in e&&e.isInLobby!==this.data.isInLobby&&(g({isInLobby:e.isInLobby},this.data),yield U(this.ctx),!1===e.isInLobby&&(this.data.isUpdatedUserState=!1,this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,this.data)),this.emitter.emit(exports.MeEvent.LOBBYCHANGE,e.isInLobby))})),u=t=>{if(!t.barrage)return;let e=null;if(!t.barrage.wordsDisplayStatus)return e=null,delete t.barrage,this.data.barrage=e||void 0,void this.emitter.emit(exports.MeEvent.BARRAGECHANGE,e);e={content:t.barrage.content,contentType:t.barrage.contentType,type:t.barrage.type,duration:t.barrage.duration,position:t.barrage.position};const{role:r}=this.data;t.barrage.receiver&&(r===exports.ROLE.HOST||r===exports.ROLE.COHOST?e=t.barrage.receiver.host?e:null:r===exports.ROLE.ATTENDEE?e=t.barrage.receiver.attendee?e:null:r===exports.ROLE.AUDIENCE&&(e=t.barrage.receiver.audience?e:null),delete t.barrage,this.data.barrage=e||void 0,this.emitter.emit(exports.MeEvent.BARRAGECHANGE,e))},d=t=>{"leave"in t&&!0===t.leave&&("undefined"!=typeof Worker&&this.ctx.worker&&this.ctx.worker.postMessage({status:!1}),console.warn("handleLeave"),S(this.ctx),G(this.ctx),this.emitter.emit(exports.MeEvent.LEAVE,t.resultInfo),this.ctx.state=exports.STATE.CLOSE,this.ctx.emitter.emit(exports.EVENT.STATE,{state:this.ctx.state,reason:t.resultInfo}))},l=t=>{e(t),r(t),s(t),i(t),n(t),o(t),c(t),a(t),u(t),d(t)};this.ctx.emitter.on(exports.MeEvent.INIT,(t=>{g(t,this.data),this.data.isUpdatedUserState=!1,this.emitter.emit(exports.MeEvent.UPDATE_USER_STATE,this.data)})),this.ctx.emitter.on(exports.MeEvent.UPDATE,(t=>{l(t),g(t,this.data)})),this.ctx.emitter.on("me",(e=>t(this,void 0,void 0,(function*(){const{state:t,body:r={users:[]}}=e;if("delete"===t){const t=r.users[0];t.leave=!0,d(t)}else{const t=r.users.find((t=>t.userID===this.data.userID));t&&(l(t),g(t,this.data))}})))),this.ctx.emitter.on("setUserVideo",(t=>{this.emitter.emit(exports.MeEvent.SETVIDEO,t.body)})),this.ctx.emitter.on("setUserAudio",(t=>{this.emitter.emit(exports.MeEvent.SETAUDIO,t.body)})),this.ctx.emitter.on("meetingState",(t=>{const{body:e={}}=t;if("ended"===e.state){d({leave:!0,resultInfo:e.resultInfo})}}))}updateUserState(t,e=!1){if(!e){const{role:e,initialMediaState:r}=this.data;t.audio.sendOn=t.audio.sendOn&&r.audio.sendOn,t.video.sendOn=t.video.sendOn&&r.video.sendOn,e===exports.ROLE.AUDIENCE&&(t.audio.sendOn=!1,t.video.sendOn=!1)}const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.data.isUpdatedUserState=!0,g(t,this.data),this.ctx.request.post(`${r}/meetings/${s}/updateUserState`,t)}}function U(e){return t(this,void 0,void 0,(function*(){const t=$(e),{meetingID:r,sessionID:s}=e.config.request;"undefined"!=typeof Worker&&e.worker?e.worker.postMessage({topics:t,meetingID:r,sessionID:s,rePolling:!0}):(S(e),yield _(e))}))}class N extends O{constructor(t){super(t,"invite")}_topic(){return"advCtrl"}_bindOn(){this.ctx.emitter.on("callRecord",(t=>{const{body:e,state:r}=t;if(e&&e.users){if("full"===r)return this.data.callRecordUsers=e.users.map((t=>(t.displayNamePinyin=N.setDisplayNamePinyinProp?N.setDisplayNamePinyinProp(t.displayName||""):t.displayName,t))),void this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers);e.users.forEach((t=>{const e=this.data.callRecordUsers.findIndex((e=>t.inviteTransID===e.inviteTransID));"update"===r&&-1!==e?g(t,this.data.callRecordUsers[e]):"update"===r&&-1===e&&(t.displayNamePinyin=N.setDisplayNamePinyinProp?N.setDisplayNamePinyinProp(t.displayName||""):t.displayName,this.data.callRecordUsers.push(t))})),this.emitter.emit("callRecordUsersChange",this.data.callRecordUsers)}}))}invite(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}/meetings/${r}/invite`,t)}}class R extends O{constructor(t){super(t,"users")}_topic(){const{role:t,endpointType:e}=this.ctx.modules.me.data;return e===exports.ENDPOINT_TYPE.SUPERVISION?["interactive","broadcast"]:t===exports.ROLE.AUDIENCE?"interactive":["interactive","broadcast","lobby"]}_bindOn(){const t=(t,e)=>{if(t.userID===this.ctx.modules.me.data.userID){const r={};"delete"===e&&(r.leave=!0),this.ctx.emitter.emit(exports.MeEvent.UPDATE,Object.assign(Object.assign({},t),r))}},e=({updateUsers:e,state:r,sourceKey:s})=>{if("full"===r)return this.data[s]=e.map((e=>(e.displayNamePinyin=R.setDisplayNamePinyinProp?R.setDisplayNamePinyinProp(e.displayName):e.displayName,t(e,r),e))),this.emitter.emit(`${s}Change`,this.data[s]),this.emitter.emit(`${s}FullUpdate`,this.data[s]),this.data[s];void 0===this.data[s]&&(this.data[s]=[]);const{data:i,emitter:n}=this;return e.forEach((e=>{const o=i[s].findIndex((t=>e.userID===t.userID));if("delete"===r&&-1!==o){const[t]=this.data[s].splice(o,1);n.emit(`${s}Delete`,{user:t,resultInfo:e.resultInfo})}else"update"===r&&-1!==o?(this.updateUserProps(e,this.data[s][o]),g(e,this.data[s][o]),this.emitter.emit(`${s}Update`,{user:i[s][o]})):"update"===r&&-1===o&&(e.displayNamePinyin=R.setDisplayNamePinyinProp?R.setDisplayNamePinyinProp(e.displayName):e.displayName,i[s].push(e),this.emitter.emit(`${s}Add`,{user:e,resultInfo:e.resultInfo}));t(e,r)})),this.emitter.emit(`${s}Change`,this.data[s]),this.data[s]};this.ctx.emitter.on("interactiveUsers",(t=>{const{state:r,body:s}=t;e({updateUsers:s.users,state:r,sourceKey:"interactiveUsers"})})),this.ctx.emitter.on("lobbyUsers",(t=>{const{state:r,body:s}=t;e({updateUsers:s.users,state:r,sourceKey:"lobbyUsers"})})),this.ctx.emitter.on("broadcastUsers",(t=>{const{state:r,body:s}=t;e({updateUsers:s.users,state:r,sourceKey:"broadcastUsers"})})),this.ctx.emitter.on("advCtrlUsers",(t=>{const{state:r,body:s}=t;e({updateUsers:s.users,state:r,sourceKey:"advCtrlUsers"})}))}updateUserProps(t,e){t.displayName&&t.displayName!==e.displayName&&(t.displayNamePinyin=R.setDisplayNamePinyinProp?R.setDisplayNamePinyinProp(t.displayName):t.displayName)}setAudio(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${t}/audio`,e)}setVideo(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${t}/video`,e)}setShare(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${t}/share`,e)}setWhiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${t}/whiteboard`,e)}handUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${t}/handUp`,e)}setRole(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${t}/role`,e)}rename(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${t}/displayName`,e)}remove(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}/meetings/${r}/users/${t}/remove`)}replyHandUp(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${t}/replyHandUp`,e)}fecc(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${t}/fecc`,e)}lobbyState(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${t}/lobbyState`,e)}allowLocalRecord(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${t}/allowLocalRecord`,e)}whiteboard(t,e){if(!t||!e)return Promise.reject();const{prefix:{ctrl:r},meetingID:s}=this.ctx.config.request;return this.ctx.request.post(`${r}/meetings/${s}/users/${t}/whiteboard`,e)}callStats(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.get(`${e}/meetings/${r}/users/${t}/callStats`)}replyAllHandUp(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}/meetings/${e}/replyAllHandUp`)}admitAll(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}/meetings/${e}/lobby/admitAll`)}refuseAll(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return this.ctx.request.post(`${t}/meetings/${e}/lobby/refuseAll`)}}class C{constructor(t){Object.defineProperty(this,"meeting",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.meeting=L(t)}static getInstance(t){return this.instance?this.instance:this.instance=new C(t)}}Object.defineProperty(C,"instance",{enumerable:!0,configurable:!0,writable:!0,value:null});const k=t=>{t.state!==exports.STATE.CLOSE&&(t.state=exports.STATE.CLOSE,t.emitter.emit(exports.EVENT.STATE,{state:t.state}))};function L(t){const{baseURL:r,modules:s,worker:i,singleton:n}=t;s.findIndex((t=>t===P))<0&&s.push(P),s.findIndex((t=>t===T))<0&&s.push(T);const o={config:{baseURL:r,modules:s,singleton:n||!1,request:{cancelToken:c.source(),prefix:{ctrl:"/meeting-ctrl/api/v1/",conference:"/conference-manager/api/v1/",user:"/user-manager/api/v1/",vote:"/vote/api/v1"},location:"",meetingID:"",ctrlID:"",sessionID:"",userID:0,voteTk:""}},worker:i,emitter:e(),request:new a({baseURL:r,beforeRequest:t=>{t.headers["X-Y-Request-Id"]=m()},error:t=>{o.emitter.emit(exports.EVENT.REQUEST_ERROR,t)}}),modules:{},state:exports.STATE.CLOSE,status:{polling:{running:!1,timer:null},keepalive:{running:!1,timer:null,interval:20}}};return o.worker&&("undefined"!=typeof Worker?o.worker.postMessage({baseURL:r}):console.error("The current environment does not support worker")),function(t,e){if(!l(t))return void console.error("The modules parameter requires an array type");t.forEach((t=>{const r=new t(e);e.modules[r.moduleName]=r}))}(s,o),Object.assign({config:o.config,request:o.request,get state(){return o.state},on:o.emitter.on,off:o.emitter.off,join:M(o),leave:H(o),end:V(o)},o.modules)}function M(e){return function(r){var s;return t(this,void 0,void 0,(function*(){const t=`${null===(s=r.endpointType)||void 0===s?void 0:s.toLocaleUpperCase()}${m()}_${((t=new Date,e)=>{const r={"M+":t.getMonth()+1,"d+":t.getDate(),"h+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),"q+":Math.floor((t.getMonth()+3)/3),S:t.getMilliseconds()};/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(t.getFullYear()+"").substr(4-RegExp.$1.length)));for(const s in r)new RegExp("("+s+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?r[s]:("00"+r[s]).substr((""+r[s]).length)));return e})(new Date,"MMddHHmmss")}_${r.meetingNum}`;e.request.setDefaultHeader("X-Y-Session-Id",t);const{prefix:i}=e.config.request,n=yield e.request.get(`${i.ctrl}/credential`,{params:{meetingNum:r.meetingNum,pwd:r.pwd,url:r.url,mobileCode:r.mobileCode,mobile:r.mobile,regEmail:r.regEmail,accEmail:r.accEmail,tk:r.tk,displayName:r.displayName},headers:{"X-Y-Endpoint-Type":r.endpointType,"X-Y-Endpoint-Id":t}}),{credential:o="",location:a=""}=n&&n.data||{};if(!o)return n;e.config.request.location=a,delete r.pwd,delete r.url;const c=yield e.request.post(`${i.ctrl}/join?meetingNum=${r.meetingNum}&credential=${o}`,r,{headers:{"X-Y-Endpoint-Type":r.endpointType,"X-Y-Endpoint-Id":t}});if(c&&c.data&&c.ret>-1){const{meetingID:r="",ctrlID:s="",user:i={},mediaContent:o={},initialMediaState:u={},tk:d=""}=c.data;if(e.config.request.sessionID=t,e.config.request.meetingID=r,e.config.request.ctrlID=s,e.config.request.userID=i.userID,e.config.request.voteTk=d,e.request.setDefaultHeader("X-Y-Location",a),e.request.setDefaultHeader("X-Y-Ctrl-Id",s),e.emitter.emit(exports.MeEvent.INIT,Object.assign(Object.assign({},i),{mediaContent:o,initialMediaState:u})),e.state=exports.STATE.JOINED,e.emitter.emit(exports.EVENT.STATE,{state:e.state}),"undefined"!=typeof Worker&&e.worker){const s=$(e);yield A(s,e),e.status.keepalive.running=!0,j(e),e.worker.postMessage({topics:s,meetingID:r,sessionID:t,status:!0}),e.worker.onmessage=t=>{console.log("[Polling]",t.data),e.emitter.emit(t.data.event,t.data)}}else yield _(e);c.data=Object.assign(Object.assign({},c.data),n.data)}return c}))}}function H(e){return function(r){return t(this,void 0,void 0,(function*(){r||(r={bizCode:901359});const{prefix:t,meetingID:s}=e.config.request,i=yield e.request.post(`${t.ctrl}/meetings/${s}/leave`,r);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),S(e),G(e),k(e),i}))}}function V(e){return function(){return t(this,void 0,void 0,(function*(){const{prefix:t,meetingID:r}=e.config.request,s=yield e.request.post(`${t.ctrl}/meetings/${r}/end`);return"undefined"!=typeof Worker&&e.worker&&e.worker.postMessage({status:!1}),S(e),G(e),k(e),s}))}}function G(t){if(t.config.singleton){const{baseURL:e,modules:r,singleton:s}=t.config,i={baseURL:e,modules:r,worker:t.worker,singleton:s},n=C.getInstance(i);n&&(n.meeting=L(i))}}exports.Chat=class extends O{constructor(t){super(t,"chat")}_topic(){return"chat"}_bindOn(){this.ctx.emitter.on("chatMsg",(t=>{const{body:e}=t;this.emitter.emit("chatMsg",e)}))}msg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}/meetings/${r}/chat/msg`,e)}))}historyMsg(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${t}/meetings/${r}/chat/historyMsg`,e)}))}},exports.Info=T,exports.Invite=N,exports.LiveStream=class extends O{constructor(t){super(t,"liveStream")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("liveStream",(t=>{var e;const{state:r,body:s,stime:i}=t;if(s){if(i&&(this.data.jetlag=i),"full"===r){const{liveStreams:t=[]}=s;if(!t.length)return;this.data.status=[],this.data.liveStreams=t.map((t=>(t.requesting="starting"===t.status,this.data.status.push({platform:t.platform||"",status:(t.requesting?"stopped":t.status)||""}),t)));return g({status:this.data.status,resultInfo:{}},this.data),this.data}return void 0===this.data.liveStreams&&(this.data.liveStreams=[]),s.liveStreams||(this.data.resultInfo={}),null===(e=s.liveStreams)||void 0===e||e.forEach((t=>{this.data.resultInfo=t.resultInfo||{};let e=this.data.liveStreams.findIndex((e=>e.platform===t.platform));-1===e?(t.requesting="starting"===t.status,this.data.liveStreams.push(t)):(t.requesting="starting"===t.status,t=Object.assign(Object.assign({},this.data.liveStreams[e]),t),this.data.liveStreams.splice(e,1,t)),e=this.data.status.findIndex((e=>e.platform===t.platform)),-1===e?this.data.status.push({platform:t.platform||"",status:t.requesting?"stopped":t.status||""}):this.data.status.splice(e,1,{platform:this.data.status[e].platform||"",status:t.requesting?this.data.status[e].status||"stopped":t.status||""})})),this.data}}))}setStatus(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${r}/liveStream/status`,e)}))}liveStreamDescription(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${r}/liveStream/description`,e)}))}liveStreamSetting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${r}/liveStream/setting`,e)}))}},exports.Me=P,exports.Recording=class extends O{constructor(t){super(t,"recording")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("recording",(t=>{const{state:e,body:r,stime:s}=t;if(r)return s&&(this.data.jetlag=s),this.data.isPracticeSession="started"===r.status&&this.data.status===r.status&&0===r.duration,this.data.recording=Object.assign(Object.assign({},this.data.recording||{}),r),"starting"===r.status?this.data.recording.requesting=!0:(this.data.recording.requesting=!1,this.data.status=r.status||this.data.status),this.data.resultInfo=r.resultInfo||{},["full","update"].includes(e)?(r.recordUsers&&(this.data.recording.recordUsers=r.recordUsers),this.data):void 0}))}history(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.get(`${t}meetings/${e}/recording/history`)}))}status(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/status`,e)}))}layout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/status`,e)}))}designatedUsers(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/designatedUsers`,e)}))}participantAdd(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/recording/participant/add`,e)}))}participantDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/recording/participant/delete`,e)}))}getTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getTemplates`,{params:e})}))}getByIds(e){return t(this,void 0,void 0,(function*(){const{prefix:{user:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/subject/getByIds`,e)}))}recordLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/recording/layout`,e)}))}},exports.Setting=class extends O{constructor(t){super(t,"setting")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingSetting",(t=>{const{state:e,body:r}=t;["full","update"].includes(e)&&g(r,this.data)}))}setting(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${r}/setting`,e)}))}muteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${e}/muteAll`)}))}unmuteAll(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${e}/unmuteAll`)}))}},exports.SpotlightVideo=class extends O{constructor(t){super(t,"spotlightVideo")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("spotlightVideo",(t=>{const{body:e}=t;if(!e||!e.userIDs)return;this.data.userIDs=e.userIDs;e.userIDs.findIndex((t=>t===this.ctx.modules.me.data.userID))>-1?this.ctx.emitter.emit(exports.MeEvent.UPDATE,{isSpotlightVideo:!0}):this.ctx.modules.me.data.isSpotlightVideo&&this.ctx.emitter.emit(exports.MeEvent.UPDATE,{isSpotlightVideo:!1})}))}spotlight(t){if(!t)return Promise.reject();const{prefix:{ctrl:e},meetingID:r}=this.ctx.config.request;return this.ctx.request.post(`${e}/meetings/${r}/view/spotlight`,t)}},exports.Users=R,exports.View=class extends O{constructor(t){super(t,"view")}_topic(){return["hostAttendee","audience","advCtrl"]}_bindOn(){["hostLayout","attendeeLayout","audienceLayout","meetingView","personalView"].forEach((t=>{this.ctx.emitter.on(t,(e=>{"personalView"!==t?this.updateLayout(e,t):this.updatePersonalLayouts(e)}))}))}updateLayout(t,e){const{event:r,body:s}=t;s&&("meetingView"===r?Object.keys(s).forEach((t=>{this.data[t]=s[t]})):this.data[e]=s)}updatePersonalLayouts(t){const{state:e,body:r}=t;"full"!==e&&void 0!==this.data.personalLayouts||(this.data.personalLayouts={}),r.personalLayouts.forEach((t=>{const{subscriber:r={userID:-1}}=t,s=r.userID||r.subjectID||-1;"full"===e||"update"===e||t.templateStatus?this.data.personalLayouts[s]=t: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:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/hostLayout`,e)}))}attendeeLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/attendeeLayout`,e)}))}audienceLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/audienceLayout`,e)}))}personalLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/personalLayout`,e)}))}personalLayoutDelete(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/personalLayout/delete`,e)}))}virtualClassLayout(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${r}/view/virtualClass/layout`,e)}))}closeVirtualClass(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}meetings/${e}/view/virtualClass/close`)}))}getVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/layout/template/info`,{params:e})}))}addVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/layout/template/add`,e)}))}editVirtualClassTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/layout/template/edit`,e)}))}getTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getTemplates`,{params:e})}))}editTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/edit`,e)}))}addTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/add`,e)}))}deleteTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/delete`,e)}))}getDefaultTemplates(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.get(`${t}personal/vmr/layout/template/getDefaultTemplates`,{params:e})}))}changeDefaultTemplate(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/layout/template/changeDefaultTemplate`,e)}))}perspectiveBind(e){return t(this,void 0,void 0,(function*(){const{prefix:{conference:t}}=this.ctx.config.request;return yield this.ctx.request.post(`${t}personal/vmr/perspective/bind`,e)}))}},exports.Vote=class extends O{constructor(t){super(t,"vote")}_topic(){return"vote"}_bindOn(){this.ctx.emitter.on("vote",(t=>{const{body:e}=t,{voteID:r}=e;void 0===this.data.vote&&(this.data.vote={}),this.data.vote[r]=e,this.emitter.emit("voteChange",this.data.vote)}))}getVotes(t){const{prefix:{vote:e},meetingID:r,voteTk:s}=this.ctx.config.request;return t.tk=t.tk||s,this.ctx.request.get(`${e}/meetings/${r}/votes`,{params:t})}getVote(t){const{prefix:{vote:e},meetingID:r,voteTk:s}=this.ctx.config.request;return t.tk=t.tk||s,this.ctx.request.get(`${e}/meetings/${r}/vote`,{params:t})}getMeVote(t){const{prefix:{vote:e},meetingID:r,voteTk:s}=this.ctx.config.request;return t.tk=t.tk||s,this.ctx.request.get(`${e}/meetings/${r}/vote/me`,{params:t})}voteStatus(t,e){const{prefix:{vote:r},meetingID:s,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.post(`${r}/meetings/${s}/vote/status?tk=${t.tk}&voteID=${t.voteID}`,e)}voteSubmit(t,e){const{prefix:{vote:r},meetingID:s,voteTk:i}=this.ctx.config.request;return t.tk=t.tk||i,this.ctx.request.post(`${r}/meetings/${s}/vote/submit?tk=${t.tk}&voteID=${t.voteID}`,e)}voteAdd(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}/personal/vote/add`,t)}voteEdit(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}/personal/vote/edit`,t)}voteDelete(t){const{prefix:{conference:e}}=this.ctx.config.request;return this.ctx.request.post(`${e}/personal/vote/delete`,t)}},exports.Words=class extends O{constructor(t){super(t,"words")}_topic(){return"meeting"}_bindOn(){this.ctx.emitter.on("meetingBarrage",(t=>{this.data.timer&&clearTimeout(this.data.timer);const{state:e,body:r}=t;if(!r)return this.data.wordsDisplayStatus=!1,void this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data});"full"===e&&(this.data.barrageRecord||(this.data.barrageRecord=[]),this.data.barrageRecord.length>=10&&this.data.barrageRecord.pop(),this.data.barrageRecord=[{content:r.content,time:(new Date).getTime(),durationType:r.durationType,duration:1e3*r.duration},...this.data.barrageRecord],r.wordsDisplayStatus=!0,-1!==r.duration&&(this.data.timer=setTimeout((()=>{r.wordsDisplayStatus=!1,this.data.timer=null,this.data.wordsDisplayStatus=r.wordsDisplayStatus,this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})}),1e3*r.duration)),g(r,this.data),this.emitter.emit("barrageRecordChange",this.data.barrageRecord),this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data}))})),this.ctx.emitter.on(exports.MeEvent.ROLECHANGE,(()=>this.ctx.emitter.emit(exports.MeEvent.UPDATE,{barrage:this.data})))}barrage(e){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:r}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${r}/barrage`,e)}))}deleteBarrage(){return t(this,void 0,void 0,(function*(){const{prefix:{ctrl:t},meetingID:e}=this.ctx.config.request;return yield this.ctx.request.post(`${t}/meetings/${e}/deleteBarrage`)}))}},exports.createMeeting=function(t){return t.singleton?C.getInstance(t).meeting:L(t)},exports.reset=G;
|