import t from"tsignaling-wx";import e from"trtc-wx-sdk";import n from"tim-wx-sdk";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t){for(var e=1;e=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(s&&c){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;C(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},t}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function s(t,e,n,r,i,a,o){try{var s=t[a](o),c=s.value}catch(t){return void n(t)}s.done?e(c):Promise.resolve(c).then(r,i)}function c(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var a=t.apply(e,n);function o(t){s(a,r,i,o,c,"next",t)}function c(t){s(a,r,i,o,c,"throw",t)}o(void 0)}))}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function l(t,e){for(var n=0;n=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function E(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function T(t){var e=g();return function(){var n,r=p(t);if(e){var i=p(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return function(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return E(t)}(this,n)}}function D(t){return function(t){if(Array.isArray(t))return _(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return _(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n0&&K[0]<4?1:+(K[0]+K[1])),!B&&St&&(!(K=St.match(/Edge\/(\d+)/))||K[1]>=74)&&(K=St.match(/Chrome\/(\d+)/))&&(B=+K[1]);var Lt=B,At=Lt,Nt=A,Ut=!!Object.getOwnPropertySymbols&&!Nt((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&At&&At<41})),Mt=Ut&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Pt=_t,jt=gt,Vt=bt,Gt=Object,Ht=Mt?function(t){return"symbol"==typeof t}:function(t){var e=Pt("Symbol");return jt(e)&&Vt(e.prototype,Gt(t))},Ft=String,Kt=function(t){try{return Ft(t)}catch(t){return"Object"}},Bt=gt,zt=Kt,$t=TypeError,Jt=function(t){if(Bt(t))return t;throw $t(zt(t)+" is not a function")},Yt=Jt,qt=ot,Wt=function(t,e){var n=t[e];return qt(n)?void 0:Yt(n)},Xt=j,Qt=gt,Zt=It,te=TypeError,ee={exports:{}},ne=O,re=Object.defineProperty,ie=function(t,e){try{re(ne,t,{value:e,configurable:!0,writable:!0})}catch(n){ne[t]=e}return e},ae=ie,oe="__core-js_shared__",se=O[oe]||ae(oe,{}),ce=se;(ee.exports=function(t,e){return ce[t]||(ce[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.27.2",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.27.2/LICENSE",source:"https://github.com/zloirock/core-js"});var ue=ut,le=Object,he=function(t){return le(ue(t))},fe=he,de=W({}.hasOwnProperty),pe=Object.hasOwn||function(t,e){return de(fe(t),e)},ve=W,ge=0,ye=Math.random(),me=ve(1..toString),Ie=function(t){return"Symbol("+(void 0===t?"":t)+")_"+me(++ge+ye,36)},Ee=O,Te=ee.exports,De=pe,_e=Ie,be=Ut,Ce=Mt,Re=Ee.Symbol,Se=Te("wks"),we=Ce?Re.for||Re:Re&&Re.withoutSetter||_e,xe=function(t){return De(Se,t)||(Se[t]=be&&De(Re,t)?Re[t]:we("Symbol."+t)),Se[t]},ke=j,Oe=It,Le=Ht,Ae=Wt,Ne=function(t,e){var n,r;if("string"===e&&Qt(n=t.toString)&&!Zt(r=Xt(n,t)))return r;if(Qt(n=t.valueOf)&&!Zt(r=Xt(n,t)))return r;if("string"!==e&&Qt(n=t.toString)&&!Zt(r=Xt(n,t)))return r;throw te("Can't convert object to primitive value")},Ue=TypeError,Me=xe("toPrimitive"),Pe=function(t,e){if(!Oe(t)||Le(t))return t;var n,r=Ae(t,Me);if(r){if(void 0===e&&(e="default"),n=ke(r,t,e),!Oe(n)||Le(n))return n;throw Ue("Can't convert object to primitive value")}return void 0===e&&(e="number"),Ne(t,e)},je=Pe,Ve=Ht,Ge=function(t){var e=je(t,"string");return Ve(e)?e:e+""},He=It,Fe=O.document,Ke=He(Fe)&&He(Fe.createElement),Be=function(t){return Ke?Fe.createElement(t):{}},ze=Be,$e=!N&&!A((function(){return 7!=Object.defineProperty(ze("div"),"a",{get:function(){return 7}}).a})),Je=N,Ye=j,qe=V,We=z,Xe=ft,Qe=Ge,Ze=pe,tn=$e,en=Object.getOwnPropertyDescriptor;L.f=Je?en:function(t,e){if(t=Xe(t),e=Qe(e),tn)try{return en(t,e)}catch(t){}if(Ze(t,e))return We(!Ye(qe.f,t,e),t[e])};var nn={},rn=N&&A((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),an=It,on=String,sn=TypeError,cn=function(t){if(an(t))return t;throw sn(on(t)+" is not an object")},un=N,ln=$e,hn=rn,fn=cn,dn=Ge,pn=TypeError,vn=Object.defineProperty,gn=Object.getOwnPropertyDescriptor,yn="enumerable",mn="configurable",In="writable";nn.f=un?hn?function(t,e,n){if(fn(t),e=dn(e),fn(n),"function"==typeof t&&"prototype"===e&&"value"in n&&In in n&&!n[In]){var r=gn(t,e);r&&r[In]&&(t[e]=n.value,n={configurable:mn in n?n[mn]:r[mn],enumerable:yn in n?n[yn]:r[yn],writable:!1})}return vn(t,e,n)}:vn:function(t,e,n){if(fn(t),e=dn(e),fn(n),ln)try{return vn(t,e,n)}catch(t){}if("get"in n||"set"in n)throw pn("Accessors not supported");return"value"in n&&(t[e]=n.value),t};var En=nn,Tn=z,Dn=N?function(t,e,n){return En.f(t,e,Tn(1,n))}:function(t,e,n){return t[e]=n,t},_n={exports:{}},bn=N,Cn=pe,Rn=Function.prototype,Sn=bn&&Object.getOwnPropertyDescriptor,wn=Cn(Rn,"name"),xn={EXISTS:wn,PROPER:wn&&"something"===function(){}.name,CONFIGURABLE:wn&&(!bn||bn&&Sn(Rn,"name").configurable)},kn=gt,On=se,Ln=W(Function.toString);kn(On.inspectSource)||(On.inspectSource=function(t){return Ln(t)});var An,Nn,Un,Mn=On.inspectSource,Pn=gt,jn=O.WeakMap,Vn=Pn(jn)&&/native code/.test(String(jn)),Gn=ee.exports,Hn=Ie,Fn=Gn("keys"),Kn=function(t){return Fn[t]||(Fn[t]=Hn(t))},Bn={},zn=Vn,$n=O,Jn=It,Yn=Dn,qn=pe,Wn=se,Xn=Kn,Qn=Bn,Zn="Object already initialized",tr=$n.TypeError,er=$n.WeakMap;if(zn||Wn.state){var nr=Wn.state||(Wn.state=new er);nr.get=nr.get,nr.has=nr.has,nr.set=nr.set,An=function(t,e){if(nr.has(t))throw tr(Zn);return e.facade=t,nr.set(t,e),e},Nn=function(t){return nr.get(t)||{}},Un=function(t){return nr.has(t)}}else{var rr=Xn("state");Qn[rr]=!0,An=function(t,e){if(qn(t,rr))throw tr(Zn);return e.facade=t,Yn(t,rr,e),e},Nn=function(t){return qn(t,rr)?t[rr]:{}},Un=function(t){return qn(t,rr)}}var ir={set:An,get:Nn,has:Un,enforce:function(t){return Un(t)?Nn(t):An(t,{})},getterFor:function(t){return function(e){var n;if(!Jn(e)||(n=Nn(e)).type!==t)throw tr("Incompatible receiver, "+t+" required");return n}}},ar=W,or=A,sr=gt,cr=pe,ur=N,lr=xn.CONFIGURABLE,hr=Mn,fr=ir.enforce,dr=ir.get,pr=String,vr=Object.defineProperty,gr=ar("".slice),yr=ar("".replace),mr=ar([].join),Ir=ur&&!or((function(){return 8!==vr((function(){}),"length",{value:8}).length})),Er=String(String).split("String"),Tr=_n.exports=function(t,e,n){"Symbol("===gr(pr(e),0,7)&&(e="["+yr(pr(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!cr(t,"name")||lr&&t.name!==e)&&(ur?vr(t,"name",{value:e,configurable:!0}):t.name=e),Ir&&n&&cr(n,"arity")&&t.length!==n.arity&&vr(t,"length",{value:n.arity});try{n&&cr(n,"constructor")&&n.constructor?ur&&vr(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var r=fr(t);return cr(r,"source")||(r.source=mr(Er,"string"==typeof e?e:"")),t};Function.prototype.toString=Tr((function(){return sr(this)&&dr(this).source||hr(this)}),"toString");var Dr=gt,_r=nn,br=_n.exports,Cr=ie,Rr=function(t,e,n,r){r||(r={});var i=r.enumerable,a=void 0!==r.name?r.name:e;if(Dr(n)&&br(n,a,r),r.global)i?t[e]=n:Cr(e,n);else{try{r.unsafe?t[e]&&(i=!0):delete t[e]}catch(t){}i?t[e]=n:_r.f(t,e,{value:n,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return t},Sr={},wr=Math.ceil,xr=Math.floor,kr=Math.trunc||function(t){var e=+t;return(e>0?xr:wr)(e)},Or=function(t){var e=+t;return e!=e||0===e?0:kr(e)},Lr=Or,Ar=Math.max,Nr=Math.min,Ur=function(t,e){var n=Lr(t);return n<0?Ar(n+e,0):Nr(n,e)},Mr=Or,Pr=Math.min,jr=function(t){return t>0?Pr(Mr(t),9007199254740991):0},Vr=jr,Gr=function(t){return Vr(t.length)},Hr=ft,Fr=Ur,Kr=Gr,Br=function(t){return function(e,n,r){var i,a=Hr(e),o=Kr(a),s=Fr(r,o);if(t&&n!=n){for(;o>s;)if((i=a[s++])!=i)return!0}else for(;o>s;s++)if((t||s in a)&&a[s]===n)return t||s||0;return!t&&-1}},zr={includes:Br(!0),indexOf:Br(!1)},$r=pe,Jr=ft,Yr=zr.indexOf,qr=Bn,Wr=W([].push),Xr=function(t,e){var n,r=Jr(t),i=0,a=[];for(n in r)!$r(qr,n)&&$r(r,n)&&Wr(a,n);for(;e.length>i;)$r(r,n=e[i++])&&(~Yr(a,n)||Wr(a,n));return a},Qr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Zr=Xr,ti=Qr.concat("length","prototype");Sr.f=Object.getOwnPropertyNames||function(t){return Zr(t,ti)};var ei={};ei.f=Object.getOwnPropertySymbols;var ni=_t,ri=Sr,ii=ei,ai=cn,oi=W([].concat),si=ni("Reflect","ownKeys")||function(t){var e=ri.f(ai(t)),n=ii.f;return n?oi(e,n(t)):e},ci=pe,ui=si,li=L,hi=nn,fi=A,di=gt,pi=/#|\.prototype\./,vi=function(t,e){var n=yi[gi(t)];return n==Ii||n!=mi&&(di(e)?fi(e):!!e)},gi=vi.normalize=function(t){return String(t).replace(pi,".").toLowerCase()},yi=vi.data={},mi=vi.NATIVE="N",Ii=vi.POLYFILL="P",Ei=vi,Ti=O,Di=L.f,_i=Dn,bi=Rr,Ci=ie,Ri=function(t,e,n){for(var r=ui(e),i=hi.f,a=li.f,o=0;o9007199254740991)throw Oi("Maximum allowed index exceeded");return t},Ai=Ge,Ni=nn,Ui=z,Mi=function(t,e,n){var r=Ai(e);r in t?Ni.f(t,r,Ui(0,n)):t[r]=n},Pi={};Pi[xe("toStringTag")]="z";var ji="[object z]"===String(Pi),Vi=ji,Gi=gt,Hi=tt,Fi=xe("toStringTag"),Ki=Object,Bi="Arguments"==Hi(function(){return arguments}()),zi=Vi?Hi:function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Ki(t),Fi))?n:Bi?Hi(e):"Object"==(r=Hi(e))&&Gi(e.callee)?"Arguments":r},$i=W,Ji=A,Yi=gt,qi=zi,Wi=Mn,Xi=function(){},Qi=[],Zi=_t("Reflect","construct"),ta=/^\s*(?:class|function)\b/,ea=$i(ta.exec),na=!ta.exec(Xi),ra=function(t){if(!Yi(t))return!1;try{return Zi(Xi,Qi,t),!0}catch(t){return!1}},ia=function(t){if(!Yi(t))return!1;switch(qi(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return na||!!ea(ta,Wi(t))}catch(t){return!0}};ia.sham=!0;var aa=!Zi||Ji((function(){var t;return ra(ra.call)||!ra(Object)||!ra((function(){t=!0}))||t}))?ia:ra,oa=ki,sa=aa,ca=It,ua=xe("species"),la=Array,ha=function(t){var e;return oa(t)&&(e=t.constructor,(sa(e)&&(e===la||oa(e.prototype))||ca(e)&&null===(e=e[ua]))&&(e=void 0)),void 0===e?la:e},fa=function(t,e){return new(ha(t))(0===e?0:e)},da=A,pa=Lt,va=xe("species"),ga=function(t){return pa>=51||!da((function(){var e=[];return(e.constructor={})[va]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},ya=wi,ma=A,Ia=ki,Ea=It,Ta=he,Da=Gr,_a=Li,ba=Mi,Ca=fa,Ra=ga,Sa=Lt,wa=xe("isConcatSpreadable"),xa=Sa>=51||!ma((function(){var t=[];return t[wa]=!1,t.concat()[0]!==t})),ka=function(t){if(!Ea(t))return!1;var e=t[wa];return void 0!==e?!!e:Ia(t)};ya({target:"Array",proto:!0,arity:1,forced:!xa||!Ra("concat")},{concat:function(t){var e,n,r,i,a,o=Ta(this),s=Ca(o,0),c=0;for(e=-1,r=arguments.length;e1?arguments[1]:void 0;return Ga?Va(this,t,e)||0:Pa(this,t,e)}});var Ha=Jt,Fa=U,Ka=Aa(Aa.bind),Ba=function(t,e){return Ha(t),void 0===e?t:Fa?Ka(t,e):function(){return t.apply(e,arguments)}},za=Ba,$a=at,Ja=he,Ya=Gr,qa=fa,Wa=W([].push),Xa=function(t){var e=1==t,n=2==t,r=3==t,i=4==t,a=6==t,o=7==t,s=5==t||a;return function(c,u,l,h){for(var f,d,p=Ja(c),v=$a(p),g=za(u,l),y=Ya(v),m=0,I=h||qa,E=e?I(c,y):n||o?I(c,0):void 0;y>m;m++)if((s||m in v)&&(d=g(f=v[m],m,p),t))if(e)E[m]=d;else if(d)switch(t){case 3:return!0;case 5:return f;case 6:return m;case 2:Wa(E,f)}else switch(t){case 4:return!1;case 7:Wa(E,f)}return a?-1:r||i?i:E}},Qa={forEach:Xa(0),map:Xa(1),filter:Xa(2),some:Xa(3),every:Xa(4),find:Xa(5),findIndex:Xa(6),filterReject:Xa(7)},Za=Qa.filter;wi({target:"Array",proto:!0,forced:!ga("filter")},{filter:function(t){return Za(this,t,arguments.length>1?arguments[1]:void 0)}});var to=zi,eo=ji?{}.toString:function(){return"[object "+to(this)+"]"};ji||Rr(Object.prototype,"toString",eo,{unsafe:!0});var no=W,ro=Rr,io=Date.prototype,ao="Invalid Date",oo="toString",so=no(io[oo]),co=no(io.getTime);String(new Date(NaN))!=ao&&ro(io,oo,(function(){var t=co(this);return t==t?so(this):ao}));var uo=Qa.map;wi({target:"Array",proto:!0,forced:!ga("map")},{map:function(t){return uo(this,t,arguments.length>1?arguments[1]:void 0)}});var lo=wi,ho=Date,fo=W(ho.prototype.getTime);lo({target:"Date",stat:!0},{now:function(){return fo(new ho)}});var po=Xr,vo=Qr,go=Object.keys||function(t){return po(t,vo)},yo=N,mo=W,Io=j,Eo=A,To=go,Do=ei,_o=V,bo=he,Co=at,Ro=Object.assign,So=Object.defineProperty,wo=mo([].concat),xo=!Ro||Eo((function(){if(yo&&1!==Ro({b:1},Ro(So({},"a",{enumerable:!0,get:function(){So(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach((function(t){e[t]=t})),7!=Ro({},t)[n]||To(Ro({},e)).join("")!=r}))?function(t,e){for(var n=bo(t),r=arguments.length,i=1,a=Do.f,o=_o.f;r>i;)for(var s,c=Co(arguments[i++]),u=a?wo(To(c),a(c)):To(c),l=u.length,h=0;l>h;)s=u[h++],yo&&!Io(o,c,s)||(n[s]=c[s]);return n}:Ro,ko=xo;wi({target:"Object",stat:!0,arity:2,forced:Object.assign!==ko},{assign:ko});var Oo,Lo,Ao,No,Uo="undefined"!=typeof process&&"process"==tt(process),Mo=gt,Po=String,jo=TypeError,Vo=W,Go=cn,Ho=function(t){if("object"==typeof t||Mo(t))return t;throw jo("Can't set "+Po(t)+" as a prototype")},Fo=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=Vo(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(n,[]),e=n instanceof Array}catch(t){}return function(n,r){return Go(n),Ho(r),e?t(n,r):n.__proto__=r,n}}():void 0),Ko=nn.f,Bo=pe,zo=xe("toStringTag"),$o=function(t,e,n){t&&!n&&(t=t.prototype),t&&!Bo(t,zo)&&Ko(t,zo,{configurable:!0,value:e})},Jo=_t,Yo=nn,qo=N,Wo=xe("species"),Xo=function(t){var e=Jo(t),n=Yo.f;qo&&e&&!e[Wo]&&n(e,Wo,{configurable:!0,get:function(){return this}})},Qo=bt,Zo=TypeError,ts=function(t,e){if(Qo(e,t))return t;throw Zo("Incorrect invocation")},es=aa,ns=Kt,rs=TypeError,is=cn,as=function(t){if(es(t))return t;throw rs(ns(t)+" is not a constructor")},os=ot,ss=xe("species"),cs=U,us=Function.prototype,ls=us.apply,hs=us.call,fs="object"==typeof Reflect&&Reflect.apply||(cs?hs.bind(ls):function(){return hs.apply(ls,arguments)}),ds=_t("document","documentElement"),ps=W([].slice),vs=TypeError,gs=function(t,e){if(ta;a++)if((s=y(t[a]))&&ll(gl,s))return s;return new vl(!1)}r=hl(t,i)}for(c=f?t.next:r.next;!(u=al(c,r)).done;){try{s=y(u.value)}catch(t){dl(r,"throw",t)}if("object"==typeof s&&s&&ll(gl,s))return s}return new vl(!1)},ml=xe("iterator"),Il=!1;try{var El=0,Tl={next:function(){return{done:!!El++}},return:function(){Il=!0}};Tl[ml]=function(){return this},Array.from(Tl,(function(){throw 2}))}catch(t){}var Dl=function(t,e){if(!e&&!Il)return!1;var n=!1;try{var r={};r[ml]=function(){return{next:function(){return{done:n=!0}}}},t(r)}catch(t){}return n},_l=Ic,bl=Uc.CONSTRUCTOR||!Dl((function(t){_l.all(t).then(void 0,(function(){}))})),Cl=j,Rl=Jt,Sl=Mc,wl=mc,xl=yl;wi({target:"Promise",stat:!0,forced:bl},{all:function(t){var e=this,n=Sl.f(e),r=n.resolve,i=n.reject,a=wl((function(){var n=Rl(e.resolve),a=[],o=0,s=1;xl(t,(function(t){var c=o++,u=!1;s++,Cl(n,e,t).then((function(t){u||(u=!0,a[c]=t,--s||r(a))}),i)})),--s||r(a)}));return a.error&&i(a.value),n.promise}});var kl=wi,Ol=Uc.CONSTRUCTOR,Ll=Ic,Al=_t,Nl=gt,Ul=Rr,Ml=Ll&&Ll.prototype;if(kl({target:"Promise",proto:!0,forced:Ol,real:!0},{catch:function(t){return this.then(void 0,t)}}),Nl(Ll)){var Pl=Al("Promise").prototype.catch;Ml.catch!==Pl&&Ul(Ml,"catch",Pl,{unsafe:!0})}var jl=j,Vl=Jt,Gl=Mc,Hl=mc,Fl=yl;wi({target:"Promise",stat:!0,forced:bl},{race:function(t){var e=this,n=Gl.f(e),r=n.reject,i=Hl((function(){var i=Vl(e.resolve);Fl(t,(function(t){jl(i,e,t).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var Kl=j,Bl=Mc;wi({target:"Promise",stat:!0,forced:Uc.CONSTRUCTOR},{reject:function(t){var e=Bl.f(this);return Kl(e.reject,void 0,t),e.promise}});var zl=cn,$l=It,Jl=Mc,Yl=wi,ql=Uc.CONSTRUCTOR,Wl=function(t,e){if(zl(t),$l(e)&&e.constructor===t)return e;var n=Jl.f(t);return(0,n.resolve)(e),n.promise};_t("Promise"),Yl({target:"Promise",stat:!0,forced:ql},{resolve:function(t){return Wl(this,t)}});var Xl="function"==typeof Bun&&Bun&&"string"==typeof Bun.version,Ql=O,Zl=fs,th=gt,eh=Xl,nh=Ct,rh=ps,ih=gs,ah=Ql.Function,oh=/MSIE .\./.test(nh)||eh&&function(){var t=Ql.Bun.version.split(".");return t.length<3||0==t[0]&&(t[1]<3||3==t[1]&&0==t[2])}(),sh=function(t,e){var n=e?2:1;return oh?function(r,i){var a=ih(arguments.length,1)>n,o=th(r)?r:ah(r),s=a?rh(arguments,n):[],c=a?function(){Zl(o,this,s)}:o;return e?t(c,i):t(c)}:t},ch=wi,uh=O,lh=sh(uh.setInterval,!0);ch({global:!0,bind:!0,forced:uh.setInterval!==lh},{setInterval:lh});var hh=wi,fh=O,dh=sh(fh.setTimeout,!0);hh({global:!0,bind:!0,forced:fh.setTimeout!==dh},{setTimeout:dh});var ph=zi,vh=String,gh=function(t){if("Symbol"===ph(t))throw TypeError("Cannot convert a Symbol value to a string");return vh(t)},yh=W,mh=Or,Ih=gh,Eh=ut,Th=yh("".charAt),Dh=yh("".charCodeAt),_h=yh("".slice),bh=function(t){return function(e,n){var r,i,a=Ih(Eh(e)),o=mh(n),s=a.length;return o<0||o>=s?t?"":void 0:(r=Dh(a,o))<55296||r>56319||o+1===s||(i=Dh(a,o+1))<56320||i>57343?t?Th(a,o):r:t?_h(a,o,o+2):i-56320+(r-55296<<10)+65536}},Ch={codeAt:bh(!1),charAt:bh(!0)},Rh={},Sh=N,wh=rn,xh=nn,kh=cn,Oh=ft,Lh=go;Rh.f=Sh&&!wh?Object.defineProperties:function(t,e){kh(t);for(var n,r=Oh(e),i=Lh(e),a=i.length,o=0;a>o;)xh.f(t,n=i[o++],r[n]);return t};var Ah,Nh=cn,Uh=Rh,Mh=Qr,Ph=Bn,jh=ds,Vh=Be,Gh="prototype",Hh="script",Fh=Kn("IE_PROTO"),Kh=function(){},Bh=function(t){return"<"+Hh+">"+t+""},zh=function(t){t.write(Bh("")),t.close();var e=t.parentWindow.Object;return t=null,e},$h=function(){try{Ah=new ActiveXObject("htmlfile")}catch(t){}var t,e,n;$h="undefined"!=typeof document?document.domain&&Ah?zh(Ah):(e=Vh("iframe"),n="java"+Hh+":",e.style.display="none",jh.appendChild(e),e.src=String(n),(t=e.contentWindow.document).open(),t.write(Bh("document.F=Object")),t.close(),t.F):zh(Ah);for(var r=Mh.length;r--;)delete $h[Gh][Mh[r]];return $h()};Ph[Fh]=!0;var Jh,Yh,qh,Wh=Object.create||function(t,e){var n;return null!==t?(Kh[Gh]=Nh(t),n=new Kh,Kh[Gh]=null,n[Fh]=t):n=$h(),void 0===e?n:Uh.f(n,e)},Xh=!A((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Qh=pe,Zh=gt,tf=he,ef=Xh,nf=Kn("IE_PROTO"),rf=Object,af=rf.prototype,of=ef?rf.getPrototypeOf:function(t){var e=tf(t);if(Qh(e,nf))return e[nf];var n=e.constructor;return Zh(n)&&e instanceof n?n.prototype:e instanceof rf?af:null},sf=A,cf=gt,uf=It,lf=of,hf=Rr,ff=xe("iterator"),df=!1;[].keys&&("next"in(qh=[].keys())?(Yh=lf(lf(qh)))!==Object.prototype&&(Jh=Yh):df=!0);var pf=!uf(Jh)||sf((function(){var t={};return Jh[ff].call(t)!==t}));pf&&(Jh={}),cf(Jh[ff])||hf(Jh,ff,(function(){return this}));var vf={IteratorPrototype:Jh,BUGGY_SAFARI_ITERATORS:df},gf=vf.IteratorPrototype,yf=Wh,mf=z,If=$o,Ef=Mu,Tf=function(){return this},Df=wi,_f=j,bf=gt,Cf=function(t,e,n,r){var i=e+" Iterator";return t.prototype=yf(gf,{next:mf(+!r,n)}),If(t,i,!1),Ef[i]=Tf,t},Rf=of,Sf=Fo,wf=$o,xf=Dn,kf=Rr,Of=Mu,Lf=xn.PROPER,Af=xn.CONFIGURABLE,Nf=vf.IteratorPrototype,Uf=vf.BUGGY_SAFARI_ITERATORS,Mf=xe("iterator"),Pf="keys",jf="values",Vf="entries",Gf=function(){return this},Hf=function(t,e,n,r,i,a,o){Cf(n,e,r);var s,c,u,l=function(t){if(t===i&&v)return v;if(!Uf&&t in d)return d[t];switch(t){case Pf:case jf:case Vf:return function(){return new n(this,t)}}return function(){return new n(this)}},h=e+" Iterator",f=!1,d=t.prototype,p=d[Mf]||d["@@iterator"]||i&&d[i],v=!Uf&&p||l(i),g="Array"==e&&d.entries||p;if(g&&(s=Rf(g.call(new t)))!==Object.prototype&&s.next&&(Rf(s)!==Nf&&(Sf?Sf(s,Nf):bf(s[Mf])||kf(s,Mf,Gf)),wf(s,h,!0)),Lf&&i==jf&&p&&p.name!==jf&&(Af?xf(d,"name",jf):(f=!0,v=function(){return _f(p,this)})),i)if(c={values:l(jf),keys:a?v:l(Pf),entries:l(Vf)},o)for(u in c)(Uf||f||!(u in d))&&kf(d,u,c[u]);else Df({target:e,proto:!0,forced:Uf||f},c);return d[Mf]!==v&&kf(d,Mf,v,{name:i}),Of[e]=v,c},Ff=function(t,e){return{value:t,done:e}},Kf=Ch.charAt,Bf=gh,zf=ir,$f=Hf,Jf=Ff,Yf="String Iterator",qf=zf.set,Wf=zf.getterFor(Yf);$f(String,"String",(function(t){qf(this,{type:Yf,string:Bf(t),index:0})}),(function(){var t,e=Wf(this),n=e.string,r=e.index;return r>=n.length?Jf(void 0,!0):(t=Kf(n,r),e.index+=t.length,Jf(t,!1))}));var Xf=xe,Qf=Wh,Zf=nn.f,td=Xf("unscopables"),ed=Array.prototype;null==ed[td]&&Zf(ed,td,{configurable:!0,value:Qf(null)});var nd=function(t){ed[td][t]=!0},rd=ft,id=nd,ad=Mu,od=ir,sd=nn.f,cd=Hf,ud=Ff,ld=N,hd="Array Iterator",fd=od.set,dd=od.getterFor(hd),pd=cd(Array,"Array",(function(t,e){fd(this,{type:hd,target:rd(t),index:0,kind:e})}),(function(){var t=dd(this),e=t.target,n=t.kind,r=t.index++;return!e||r>=e.length?(t.target=void 0,ud(void 0,!0)):ud("keys"==n?r:"values"==n?e[r]:[r,e[r]],!1)}),"values"),vd=ad.Arguments=ad.Array;if(id("keys"),id("values"),id("entries"),ld&&"values"!==vd.name)try{sd(vd,"name",{value:"values"})}catch(t){}var gd={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},yd=Be("span").classList,md=yd&&yd.constructor&&yd.constructor.prototype,Id=md===Object.prototype?void 0:md,Ed=O,Td=gd,Dd=Id,_d=pd,bd=Dn,Cd=xe,Rd=Cd("iterator"),Sd=Cd("toStringTag"),wd=_d.values,xd=function(t,e){if(t){if(t[Rd]!==wd)try{bd(t,Rd,wd)}catch(e){t[Rd]=wd}if(t[Sd]||bd(t,Sd,e),Td[e])for(var n in _d)if(t[n]!==_d[n])try{bd(t,n,_d[n])}catch(e){t[n]=_d[n]}}};for(var kd in Td)xd(Ed[kd]&&Ed[kd].prototype,kd);xd(Dd,"DOMTokenList");var Od=wi,Ld=ki,Ad=aa,Nd=It,Ud=Ur,Md=Gr,Pd=ft,jd=Mi,Vd=xe,Gd=ps,Hd=ga("slice"),Fd=Vd("species"),Kd=Array,Bd=Math.max;Od({target:"Array",proto:!0,forced:!Hd},{slice:function(t,e){var n,r,i,a=Pd(this),o=Md(a),s=Ud(t,o),c=Ud(void 0===e?o:e,o);if(Ld(a)&&(n=a.constructor,(Ad(n)&&(n===Kd||Ld(n.prototype))||Nd(n)&&null===(n=n[Fd]))&&(n=void 0),n===Kd||void 0===n))return Gd(a,s,c);for(r=new(void 0===n?Kd:n)(Bd(c-s,0)),i=0;s1?arguments[1]:void 0)};wi({target:"Array",proto:!0,forced:[].forEach!=$d},{forEach:$d});var Jd=O,Yd=gd,qd=Id,Wd=$d,Xd=Dn,Qd=function(t){if(t&&t.forEach!==Wd)try{Xd(t,"forEach",Wd)}catch(e){t.forEach=Wd}};for(var Zd in Yd)Yd[Zd]&&Qd(Jd[Zd]&&Jd[Zd].prototype);Qd(qd);var tp=he,ep=go;wi({target:"Object",stat:!0,forced:A((function(){ep(1)}))},{keys:function(t){return ep(tp(t))}});var np=cn,rp=rl,ip=Ba,ap=j,op=he,sp=function(t,e,n,r){try{return r?e(np(n)[0],n[1]):e(n)}catch(e){rp(t,"throw",e)}},cp=Gu,up=aa,lp=Gr,hp=Mi,fp=Zu,dp=$u,pp=Array,vp=function(t){var e=op(t),n=up(this),r=arguments.length,i=r>1?arguments[1]:void 0,a=void 0!==i;a&&(i=ip(i,r>2?arguments[2]:void 0));var o,s,c,u,l,h,f=dp(e),d=0;if(!f||this===pp&&cp(f))for(o=lp(e),s=n?new this(o):pp(o);o>d;d++)h=a?i(e[d],d):e[d],hp(s,d,h);else for(l=(u=fp(e,f)).next,s=n?new this:[];!(c=ap(l,u)).done;d++)h=a?sp(u,i,[c.value,d],!0):c.value,hp(s,d,h);return s.length=d,s};wi({target:"Array",stat:!0,forced:!Dl((function(t){Array.from(t)}))},{from:vp});var gp={exports:{}},yp={},mp=Ur,Ip=Gr,Ep=Mi,Tp=Array,Dp=Math.max,_p=function(t,e,n){for(var r=Ip(t),i=mp(e,r),a=mp(void 0===n?r:n,r),o=Tp(Dp(a-i,0)),s=0;i1?arguments[1]:void 0);e=e?e.next:n.first;)for(r(e.value,e.key,this);e&&e.removed;)e=e.previous},has:function(t){return!!c(this,t)}}),Dv(a,n?{get:function(t){var e=c(this,t);return e&&e.value},set:function(t,e){return s(this,0===t?0:t,e)}}:{add:function(t){return s(this,t=0===t?0:t,t)}}),kv&&Ev(a,"size",{get:function(){return o(this).size}}),i},setStrong:function(t,e,n){var r=e+" Iterator",i=Av(e),a=Av(r);Sv(t,e,(function(t,e){Lv(this,{type:r,target:t,state:i(t),kind:e,last:void 0})}),(function(){for(var t=a(this),e=t.kind,n=t.last;n&&n.removed;)n=n.previous;return t.target&&(t.last=n=n?n.next:t.state.first)?wv("keys"==e?n.key:"values"==e?n.value:[n.key,n.value],!1):(t.target=void 0,wv(void 0,!0))}),n?"entries":"values",!n,!0),xv(e)}};yv("Set",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),Nv);var Uv=N,Mv=ki,Pv=TypeError,jv=Object.getOwnPropertyDescriptor,Vv=Uv&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}()?function(t,e){if(Mv(t)&&!jv(t,"length").writable)throw Pv("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e},Gv=Kt,Hv=TypeError,Fv=function(t,e){if(!delete t[e])throw Hv("Cannot delete property "+Gv(e)+" of "+Gv(t))},Kv=wi,Bv=he,zv=Ur,$v=Or,Jv=Gr,Yv=Vv,qv=Li,Wv=fa,Xv=Mi,Qv=Fv,Zv=ga("splice"),tg=Math.max,eg=Math.min;Kv({target:"Array",proto:!0,forced:!Zv},{splice:function(t,e){var n,r,i,a,o,s,c=Bv(this),u=Jv(c),l=zv(t,u),h=arguments.length;for(0===h?n=r=0:1===h?(n=0,r=u-l):(n=h-2,r=eg(tg($v(e),0),u-l)),qv(u+n-r),i=Wv(c,r),a=0;au-r+n;a--)Qv(c,a-1)}else if(n>r)for(a=u-r;a>l;a--)s=a+n-1,(o=a+r-1)in c?c[s]=c[o]:Qv(c,s);for(a=0;a= 2.20.1",ERROR_PERMISSION_DENIED:"camera or microphone not authorized",ERROR_GET_DEVICE_LIST_FAIL:"TUICallEngine - Failed to get device list",ERROR_INIT_FAIL:"init is not called, the TUICallEngine API needs to be used after init",ERROR_PARAM_INVALID:"",ERROR_REQUEST_REFUSED:"",ERROR_REQUEST_REPEATED:"TUICallEngine - Consistent with the current call type, please do not switch repeatedly",ERROR_SCENE_NOT_SUPPORTED:"In the current call scene, this function is not supported",ERROR_SIGNALING_SEND_FAIL:"signaling failed to send"},Cg="video",Rg="audio",Sg="normal",wg="reject",xg="timeout",kg="cancel",Og="busyline",Lg="unknown",Ag="SingleCall",Ng="groupCall",Ug="caller",Mg="callee",Pg="\t\n\v\f\r                 \u2028\u2029\ufeff",jg=ut,Vg=gh,Gg=Pg,Hg=W("".replace),Fg="["+Gg+"]",Kg=RegExp("^"+Fg+Fg+"*"),Bg=RegExp(Fg+Fg+"*$"),zg=function(t){return function(e){var n=Vg(jg(e));return 1&t&&(n=Hg(n,Kg,"")),2&t&&(n=Hg(n,Bg,"")),n}},$g={start:zg(1),end:zg(2),trim:zg(3)},Jg=O,Yg=A,qg=W,Wg=gh,Xg=$g.trim,Qg=Pg,Zg=Jg.parseInt,ty=Jg.Symbol,ey=ty&&ty.iterator,ny=/^[+-]?0x/i,ry=qg(ny.exec),iy=8!==Zg(Qg+"08")||22!==Zg(Qg+"0x16")||ey&&!Yg((function(){Zg(Object(ey))}))?function(t,e){var n=Xg(Wg(t));return Zg(n,e>>>0||(ry(ny,n)?16:10))}:Zg;function ay(t){var e=new Date(t);return"".concat(e.getFullYear(),"-")+"".concat(e.getMonth()+1<10?"0".concat(e.getMonth()+1):e.getMonth()+1,"-")+oy(e.getDate()," ")+oy(e.getHours(),":")+oy(e.getMinutes(),":")+oy(e.getSeconds(),"")}function oy(t,e){return"".concat(t<10?"0".concat(t).concat(e):"".concat(t).concat(e))}wi({global:!0,forced:parseInt!=iy},{parseInt:iy});var sy=["inviteID","type"],cy=function(){function t(e){u(this,t),this.TSignaling=e.TSignaling}var e,n,r,o,s,l,f;return h(t,[{key:"handleNewSignaling",value:function(t,e){return i(i({extraInfo:""},t),{},{version:4,businessID:"av_call",platform:"MiniApp",data:i({cmd:mg[t.call_type],room_id:t.room_id,message:""},e)})}},{key:"extractCallingInfoFromMessage",value:function(t){if(!t||"TIMCustomElem"!==t.type)return"";var e=JSON.parse(t.payload.data);if(e.businessID!==lg)return"";switch(e.actionType){case ag:var n=JSON.parse(e.data);return n.call_end>0&&!e.groupID?n.call_end:0!==n.call_end&&n.room_id?"发起通话":"结束群聊";case og:return"取消通话";case sg:return"已接听";case cg:return"拒绝通话";case ug:return"无应答";default:return""}}},{key:"handleError",value:function(t,e){return console.error("".concat("TSignalingClint"," ").concat(e),t),t}},{key:"_handleInviteData",value:function(t){var e=t.type,n=t.roomID,r=t.userIDList,i=t.hangup,a=t.switchMode;if(i)return JSON.stringify(this.handleNewSignaling({version:0,call_type:e,call_end:i.callEnd},{cmd:"hangup"}));if(a){var o={version:0,call_type:e,room_id:n},s={cmd:"switchToVideo"};return a===Ig&&(o.switch_to_audio_call="switch_to_audio_call",s.cmd="switchToAudio"),JSON.stringify(this.handleNewSignaling(o,s))}return JSON.stringify(this.handleNewSignaling({version:0,call_type:e,room_id:n},{userIDs:r}))}},{key:"_handleInviteGroupData",value:function(t){var e=t.type,n=t.roomID,r=t.hangup;return r?JSON.stringify(this.handleNewSignaling({version:0,call_type:e,call_end:r.call_end},{cmd:"hangup"})):JSON.stringify(this.handleNewSignaling({version:0,call_type:e,room_id:n}))}},{key:"invite",value:(f=c(a().mark((function t(e){var n,r,i,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.userID,r=e.offlinePushInfo,i=e.hangup,o=e.switchMode,t.prev=1,t.next=4,this.TSignaling.invite({userID:n,data:this._handleInviteData(e),timeout:i?0:30,offlinePushInfo:r});case 4:return t.abrupt("return",t.sent);case 7:if(t.prev=7,t.t0=t.catch(1),!i){t.next=11;break}return t.abrupt("return",this.handleError(t.t0,"hangup C2C"));case 11:if(!o){t.next=13;break}return t.abrupt("return",this.handleError(t.t0,o));case 13:return t.abrupt("return",this.handleError(t.t0,"invite"));case 14:case"end":return t.stop()}}),t,this,[[1,7]])}))),function(t){return f.apply(this,arguments)})},{key:"inviteGroup",value:(l=c(a().mark((function t(e){var n,r,i,o,s,c;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.groupID,r=e.userIDList,i=e.offlinePushInfo,o=e.hangup,s=e.inCallUserIDs,c=void 0===s?[]:s,t.prev=1,t.next=4,this.TSignaling.inviteInGroup({groupID:n,inviteeList:r,timeout:o?0:30,data:this._handleInviteGroupData(e),offlinePushInfo:i,inCallUserIDs:c});case 4:return t.abrupt("return",t.sent);case 7:if(t.prev=7,t.t0=t.catch(1),!o){t.next=11;break}return t.abrupt("return",this.handleError(t.t0,"hangup group"));case 11:return t.abrupt("return",this.handleError(t.t0,"inviteGroup"));case 12:case"end":return t.stop()}}),t,this,[[1,7]])}))),function(t){return l.apply(this,arguments)})},{key:"accept",value:(s=c(a().mark((function t(e,n){var r,o,s;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.inviteID,o=e.type,s=I(e,sy),t.prev=1,t.next=4,this.TSignaling.accept({inviteID:r,data:JSON.stringify(this.handleNewSignaling(i({version:0,call_type:o},s),n))});case 4:return t.abrupt("return",t.sent);case 7:return t.prev=7,t.t0=t.catch(1),t.abrupt("return",this.handleError(t.t0,"accept"));case 10:case"end":return t.stop()}}),t,this,[[1,7]])}))),function(t,e){return s.apply(this,arguments)})},{key:"reject",value:(o=c(a().mark((function t(e){var n,r,i,o,s;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.inviteID,r=e.type,i=e.lineBusy,o={version:0,call_type:r},s=null,i?(o.line_busy=i,s=JSON.stringify(this.handleNewSignaling(o,{message:"lineBusy"}))):s=JSON.stringify(this.handleNewSignaling(o)),t.prev=4,t.next=7,this.TSignaling.reject({inviteID:n,data:s});case 7:return t.abrupt("return",t.sent);case 10:if(t.prev=10,t.t0=t.catch(4),!i){t.next=14;break}return t.abrupt("return",this.handleError(t.t0,"line_busy"));case 14:return t.abrupt("return",this.handleError(t.t0,"reject"));case 15:case"end":return t.stop()}}),t,this,[[4,10]])}))),function(t){return o.apply(this,arguments)})},{key:"cancel",value:(r=c(a().mark((function t(e){var n,r,i;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.inviteID,r=e.callType,t.prev=1,t.next=4,this.TSignaling.cancel({inviteID:n,data:JSON.stringify(this.handleNewSignaling({version:0,call_type:r}))});case 4:return i=t.sent,t.abrupt("return",i);case 8:return t.prev=8,t.t0=t.catch(1),t.abrupt("return",this.handleError(t.t0,"cancel"));case 11:case"end":return t.stop()}}),t,this,[[1,8]])}))),function(t){return r.apply(this,arguments)})},{key:"hangup",value:(n=c(a().mark((function t(e){var n,r,i,o,s,c,u,l,h,f,d;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.userIDList,r=e.callType,i=e.callEnd,o=void 0===i?0:i,s=e.isGroupCall,c=void 0!==s&&s,u=e.groupID,l=void 0===u?"":u,h={version:0,call_type:r,call_end:o},f={cmd:"hangup"},d=JSON.stringify(this.handleNewSignaling(h,f)),!c||!l){t.next=9;break}return t.next=7,this.TSignaling.inviteInGroup({inviteeList:n,groupID:l,data:d,timeout:0});case 7:t.next=11;break;case 9:return t.next=11,this.TSignaling.invite({userID:n[0],data:d,timeout:0});case 11:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"switchCallMode",value:(e=c(a().mark((function t(e){var n,r,i,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.userID,r=e.callType,i=e.roomID,o=e.mode,t.abrupt("return",this.invite({userID:n,type:r,roomID:i,switchMode:o}));case 2:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"destroyed",value:function(){this.TSignaling=null}},{key:"setLogLevel",value:function(t){this.TSignaling.setLogLevel(t)}}]),t}(),uy=function(){function t(e){u(this,t),this._emitter=e.emitter}return h(t,[{key:"onCallEnd",value:function(t){var e=t.userID,n=t.callEnd,r=t.message,i=t.roomID,a=t.callMediaType,o=t.callRole,s=t.totalTime;this._emitter.emit(rg.CALL_END,{userID:e,callEnd:n,message:r,roomID:i,callMediaType:a,callRole:o,totalTime:s})}},{key:"onInvited",value:function(t){var e=t.sponsor,n=t.inviteeList,r=t.isFromGroup,i=t.inviteData,a=t.inviteID,o=t.userIDList;this._emitter.emit(rg.INVITED,{sponsor:e,inviteeList:n,userIDList:o,isFromGroup:r,inviteID:a,inviteData:i})}},{key:"onLineBusy",value:function(t){var e=t.inviteID,n=t.invitee,r=t.userID;this._emitter.emit(rg.LINE_BUSY,{inviteID:e,invitee:n,userID:r,reason:"line busy"})}},{key:"onReject",value:function(t){var e=t.inviteID,n=t.invitee,r=t.userID;this._emitter.emit(rg.REJECT,{inviteID:e,invitee:n,userID:r,reason:"reject"})}},{key:"onNoResp",value:function(t){var e=t.groupID,n=void 0===e?"":e,r=t.inviteID,i=t.sponsor,a=t.timeoutUserList,o=t.userIDList;this._emitter.emit(rg.NO_RESP,{groupID:n,inviteID:r,sponsor:i,timeoutUserList:a,userIDList:o})}},{key:"onCancel",value:function(t){var e=t.inviteID,n=t.invitee,r=t.userID;this._emitter.emit(rg.CALLING_CANCEL,{inviteID:e,invitee:n,userID:r})}},{key:"onTimeout",value:function(t){var e=t.inviteID,n=t.groupID,r=t.sponsor,i=t.timeoutUserList;this._emitter.emit(rg.CALLING_TIMEOUT,{groupID:n,inviteID:e,sponsor:r,timeoutUserList:i})}},{key:"onUserAccept",value:function(t){var e=t.userID,n=t.userList;this._emitter.emit(rg.USER_ACCEPT,{userID:e,userList:n})}},{key:"onUserEnter",value:function(t){var e=t.userID,n=t.playerList;this._emitter.emit(rg.USER_ENTER,{userID:e,playerList:n})}},{key:"onUserLeave",value:function(t){var e=t.userID,n=t.playerList;this._emitter.emit(rg.USER_LEAVE,{userID:e,playerList:n})}},{key:"onUserUpdate",value:function(t){var e=t.pusher,n=t.playerList;this._emitter.emit(rg.USER_UPDATE,{pusher:e,playerList:n})}},{key:"onSdkReady",value:function(t){this._emitter.emit(rg.SDK_READY,t)}},{key:"onKickedOut",value:function(t){this._emitter.emit(rg.KICKED_OUT,t)}},{key:"onCallMode",value:function(t){this._emitter.emit(rg.CALL_MODE,t)}},{key:"onMessageSentByMe",value:function(t){this._emitter.emit(rg.MESSAGE_SENT_BY_ME,t)}},{key:"destroyed",value:function(){this._emitter=null}}]),t}(),ly="1.4.0";yv("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),Nv);var hy,fy,dy=cn,py=function(){var t=dy(this),e="";return t.hasIndices&&(e+="d"),t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.dotAll&&(e+="s"),t.unicode&&(e+="u"),t.unicodeSets&&(e+="v"),t.sticky&&(e+="y"),e},vy=j,gy=pe,yy=bt,my=py,Iy=RegExp.prototype,Ey=function(t){var e=t.flags;return void 0!==e||"flags"in Iy||gy(t,"flags")||!yy(Iy,t)?e:vy(my,t)},Ty=xn.PROPER,Dy=Rr,_y=cn,by=gh,Cy=A,Ry=Ey,Sy="toString",wy=RegExp.prototype[Sy],xy=Cy((function(){return"/a/b"!=wy.call({source:"a",flags:"b"})})),ky=Ty&&wy.name!=Sy;(xy||ky)&&Dy(RegExp.prototype,Sy,(function(){var t=_y(this);return"/"+by(t.source)+"/"+by(Ry(t))}),{unsafe:!0}),hy="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};for(var Oy=function(){},Ly=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],Ay=Ly.length;Ay;)fy=Ly[Ay],console[fy]||(hy[fy]=Oy),Ay-=1;hy.methods=Ly;var Ny=hy,Uy=A,My=O.RegExp,Py=Uy((function(){var t=My("a","y");return t.lastIndex=2,null!=t.exec("abcd")})),jy=Py||Uy((function(){return!My("a","y").sticky})),Vy={BROKEN_CARET:Py||Uy((function(){var t=My("^r","gy");return t.lastIndex=2,null!=t.exec("str")})),MISSED_STICKY:jy,UNSUPPORTED_Y:Py},Gy=A,Hy=O.RegExp,Fy=Gy((function(){var t=Hy(".","s");return!(t.dotAll&&t.exec("\n")&&"s"===t.flags)})),Ky=A,By=O.RegExp,zy=Ky((function(){var t=By("(?b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$c")})),$y=j,Jy=W,Yy=gh,qy=py,Wy=Vy,Xy=ee.exports,Qy=Wh,Zy=ir.get,tm=Fy,em=zy,nm=Xy("native-string-replace",String.prototype.replace),rm=RegExp.prototype.exec,im=rm,am=Jy("".charAt),om=Jy("".indexOf),sm=Jy("".replace),cm=Jy("".slice),um=function(){var t=/a/,e=/b*/g;return $y(rm,t,"a"),$y(rm,e,"a"),0!==t.lastIndex||0!==e.lastIndex}(),lm=Wy.BROKEN_CARET,hm=void 0!==/()??/.exec("")[1];(um||hm||lm||tm||em)&&(im=function(t){var e,n,r,i,a,o,s,c=this,u=Zy(c),l=Yy(t),h=u.raw;if(h)return h.lastIndex=c.lastIndex,e=$y(im,h,l),c.lastIndex=h.lastIndex,e;var f=u.groups,d=lm&&c.sticky,p=$y(qy,c),v=c.source,g=0,y=l;if(d&&(p=sm(p,"y",""),-1===om(p,"g")&&(p+="g"),y=cm(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==am(l,c.lastIndex-1))&&(v="(?: "+v+")",y=" "+y,g++),n=new RegExp("^(?:"+v+")",p)),hm&&(n=new RegExp("^"+v+"$(?!\\s)",p)),um&&(r=c.lastIndex),i=$y(rm,d?n:c,y),d?i?(i.input=cm(i.input,g),i[0]=cm(i[0],g),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:um&&i&&(c.lastIndex=c.global?i.index+i[0].length:r),hm&&i&&i.length>1&&$y(nm,i[0],n,(function(){for(a=1;a2)if(u=iI(u),43===(e=lI(u,0))||45===e){if(88===(n=lI(u,2))||120===n)return NaN}else if(48===e){switch(lI(u,1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+u}for(o=(a=uI(u,2)).length,s=0;si)return NaN;return parseInt(a,r)}return+u},dI=Jm(aI,!oI(" 0o1")||!oI("0b1")||oI("+0x1")),pI=function(t){return Wm(sI,t)&&Zm((function(){rI(t)}))},vI=function(t){var e=arguments.length<1?0:oI(hI(t));return pI(this)?qm(Object(e),this,vI):e};vI.prototype=sI,dI&&(sI.constructor=vI),Fm({global:!0,constructor:!0,wrap:!0,forced:dI},{Number:vI});dI&&function(t,e){for(var n,r=Km?tI(e):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),i=0;r.length>i;i++)Ym(e,n=r[i])&&!Ym(t,n)&&nI(t,n,eI(e,n))}(zm[aI],oI);var gI=Or,yI=gh,mI=ut,II=RangeError,EI=function(t){var e=yI(mI(this)),n="",r=gI(t);if(r<0||r==1/0)throw II("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(e+=e))1&r&&(n+=e);return n},TI=W,DI=jr,_I=gh,bI=ut,CI=TI(EI),RI=TI("".slice),SI=Math.ceil,wI=function(t){return function(e,n,r){var i,a,o=_I(bI(e)),s=DI(n),c=o.length,u=void 0===r?" ":_I(r);return s<=c||""==u?o:((a=CI(u,SI((i=s-c)/u.length))).length>i&&(a=RI(a,0,i)),t?o+a:a+o)}},xI=W,kI=A,OI={start:wI(!1),end:wI(!0)}.start,LI=RangeError,AI=isFinite,NI=Math.abs,UI=Date.prototype,MI=UI.toISOString,PI=xI(UI.getTime),jI=xI(UI.getUTCDate),VI=xI(UI.getUTCFullYear),GI=xI(UI.getUTCHours),HI=xI(UI.getUTCMilliseconds),FI=xI(UI.getUTCMinutes),KI=xI(UI.getUTCMonth),BI=xI(UI.getUTCSeconds),zI=kI((function(){return"0385-07-25T07:06:39.999Z"!=MI.call(new Date(-50000000000001))}))||!kI((function(){MI.call(new Date(NaN))}))?function(){if(!AI(PI(this)))throw LI("Invalid time value");var t=this,e=VI(t),n=HI(t),r=e<0?"-":e>9999?"+":"";return r+OI(NI(e),r?6:4,0)+"-"+OI(KI(t)+1,2,0)+"-"+OI(jI(t),2,0)+"T"+OI(GI(t),2,0)+":"+OI(FI(t),2,0)+":"+OI(BI(t),2,0)+"."+OI(n,3,0)+"Z"}:MI;wi({target:"Date",proto:!0,forced:Date.prototype.toISOString!==zI},{toISOString:zI});var $I=W,JI=he,YI=Math.floor,qI=$I("".charAt),WI=$I("".replace),XI=$I("".slice),QI=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,ZI=/\$([$&'`]|\d{1,2})/g,tE=fs,eE=j,nE=W,rE=Tm,iE=A,aE=cn,oE=gt,sE=ot,cE=Or,uE=jr,lE=gh,hE=ut,fE=_m,dE=Wt,pE=function(t,e,n,r,i,a){var o=n+t.length,s=r.length,c=ZI;return void 0!==i&&(i=JI(i),c=QI),WI(a,c,(function(a,c){var u;switch(qI(c,0)){case"$":return"$";case"&":return t;case"`":return XI(e,0,n);case"'":return XI(e,o);case"<":u=i[XI(c,1,-1)];break;default:var l=+c;if(0===l)return a;if(l>s){var h=YI(l/10);return 0===h?a:h<=s?void 0===r[h-1]?qI(c,1):r[h-1]+qI(c,1):a}u=r[l-1]}return void 0===u?"":u}))},vE=km,gE=xe("replace"),yE=Math.max,mE=Math.min,IE=nE([].concat),EE=nE([].push),TE=nE("".indexOf),DE=nE("".slice),_E="$0"==="a".replace(/./,"$0"),bE=!!/./[gE]&&""===/./[gE]("a","$0");function CE(t,e){t=t.split("."),e=e.split(".");for(var n=Math.max(t.length,e.length);t.lengtha)return 1;if(i=v&&(p+=DE(o,v,m)+_,v=m+y.length)}return p+DE(o,v)}]}),!!iE((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$")}))||!_E||bE);var RE="TRTC-ROOM",SE=wx||qq;SE||console.error(RE,"不支持当前小程序环境");var wE,xE=SE.getSystemInfoSync(),kE=xE.safeArea;("iOS 13.3"===xE.system||"iPhoneX"===xE.model&&"iOS 13.3.1"===xE.system)&&console.log("use media audio volume type"),console.log(RE,"SystemInfo",xE),"undefined"!=typeof qq?wE=!0:"undefined"!=typeof wx&&(wE=CE(xE.version,"7.0.8")>=0||CE(xE.version,"2.4.0")>=0&&CE(xE.version,"6.0.0")<0&&CE(xE.SDKVersion,"2.10.0")>=0);var OE=wE,LE="undefined"!=typeof uni,AE=/iOS/i.test(xE.system),NE=/Android/i.test(xE.system);/mac/i.test(xE.system);var UE=xE.version,ME=xE.SDKBuild?"".concat(xE.SDKVersion,"-").concat(xE.SDKBuild):xE.SDKVersion;xE.screenHeight,kE.bottom,console.log(RE,"APP_VERSION:",UE," LIB_VERSION:",ME," is new version:",OE);var PE=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"array"===function(t){return Object.prototype.toString.call(t).match(/^\[object (.*)\]$/)[1].toLowerCase()}(t)},jE=function(t){return null!==t&&("number"==typeof t&&!isNaN(t-0)||"object"===o(t)&&t.constructor===Number)},VE=function(t){return"string"==typeof t},GE=function(t){return PE(t)||function(t){return null!==t&&"object"===o(t)}(t)},HE=0;Date.now||(Date.now=function(){return(new Date).getTime()});var FE=function(){0===HE&&(HE=Date.now()-1);var t=Date.now()-HE;return t>4294967295?(HE+=4294967295,Date.now()-HE):t},KE=function(t){return JSON.stringify(t,["message","code"])};function BE(){var t="unknown";return AE&&(t="ios"),NE&&(t="android"),t}var zE=-1,$E=0,JE=1,YE=2,qE=3,WE=$E,XE=new Map;function QE(){var t=new Date;return"TUICallEngine ".concat(t.toLocaleTimeString("en-US",{hour12:!1}),".").concat(function(t){var e;switch(t.toString().length){case 1:e="00".concat(t);break;case 2:e="0".concat(t);break;default:e=t}return e}(t.getMilliseconds()),":")}var ZE={_data:[],_length:0,_visible:!1,arguments2String:function(t){var e;if(1===t.length)e=QE()+t[0];else{e=QE();for(var n=0,r=t.length;n-10?"+0".concat(Math.abs(100*r)):"+".concat(Math.abs(100*r)):r>=10?"-".concat(100*r):"-0".concat(100*r),n.replace("Z",i)),this.startts&&this.endts&&!this.timespan&&(this.timespan=Math.abs(this.endts-this.startts))}},{key:"setEnd",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.endts=Date.now(),e?this._eventStatController.pushIn(this):setTimeout((function(){t._eventStatController.pushIn(t)}),0)}},{key:"setError",value:function(t,e,n){return this.setNetworkType(n),e?(t.code&&this.setCode(t.code),t.message&&this.setMessage(t.message)):(this.setCode(tT),this.setMessage(nT)),this}},{key:"setCode",value:function(t){return"ECONNABORTED"===t&&(this.codeint=103),jE(t)?this.codeint=t:ZE.warn("SSOLogData.setCode value not a number, please check!",t,o(t)),this}},{key:"setMessage",value:function(t){return VE(t)?(this.message=t,this):this}},{key:"setText",value:function(t){return jE(t)?this.text=t.toString():VE(t)&&(this.text=t),this}},{key:"setTalkTime",value:function(t){return this.talktime=t,this}},{key:"setMessageType",value:function(t){return this.msgType=t,this}},{key:"setCallType",value:function(t){return this.calltype=t,this}},{key:"setNetworkType",value:function(t){return void 0===t?ZE.warn("SSOLogData.setNetworkType value is undefined, please check!"):this.networktype=t,this}}],[{key:"bindController",value:function(e){t.prototype._eventStatController=e}}]),t}(),iT={SDK_CONSTRUCT:"sdkConstruct",SDK_READY:"sdkReady",SDK_NOT_READY:"sdkNotReady",LOGIN:"login",LOGOUT:"logout",CALL:"call",GROUP_CALL:"groupCall",ACCEPT:"accept",REJECT:"reject",HANGUP:"hangup",START_REMOTE_VIEW:"startRemoteView",STOP_REMOTE_VIEW:"stopRemoteView",START_LOCAL_VIEW:"startLocalView",STOP_LOCAL_VIEW:"stopLocalView",OPEN_CAMERA:"openCamera",CLOSE_CAMERA:"closeCamera",SET_MIC_MUTE:"setMicMute",SET_VIDEO_QUALITY:"setVideoQuality",SWITCH_TO_AUDIO_CALL:"switchToAudioCall",SWITCH_TO_VIDEO_CALL:"switchToVideoCall",CHANGE_CALL_STATUS:"changeCallStatus",TALK_TIME:"talktime",ERROR:"error",INVITED:"invited",GROUP_CALL_INVITEE_LIST_UPDATE:"group_call_invitee_list_update",USER_ENTER:"user_enter",USER_LEAVE:"user_leave",NO_RESP:"no_resp",LINE_BUSY:"line_busy",CALLING_CANCEL:"calling_cancel",KICKED_OUT:"kicked_out",CALLING_TIMEOUT:"calling_timeout",CALLING_END:"calling_end",USER_VIDEO_AVAILABLE:"user_video_available",USER_AUDIO_AVAILABLE:"user_audio_available",USER_VOICE_VOLUME:"user_voice_volume",CALL_TYPE_CHANGED:"call_type_changed",DEVICED_UPDATED:"deviced_updated",QUALITY_REPORT:"quality_report"},aT=function(){function t(){u(this,t),this._table="timweb-trtccalling",this._report=[]}return h(t,[{key:"pushIn",value:function(t){ZE.debug("SSOLogBody.pushIn",this._report.length,t),this._report.push(t)}},{key:"backfill",value:function(t){var e;PE(t)&&0!==t.length&&(ZE.debug("SSOLogBody.backfill",this._report.length,t.length),(e=this._report).unshift.apply(e,D(t)))}},{key:"getLogsNumInMemory",value:function(){return this._report.length}},{key:"isEmpty",value:function(){return 0===this._report.length}},{key:"_reset",value:function(){this._report.length=0,this._report=[]}},{key:"getTable",value:function(){return this._table}},{key:"getLogsInMemory",value:function(){var t=this._report.slice();return this._reset(),t}}]),t}(),oT={CURRENT:{COMMON:"https://webim.tim.qq.com"},PRODUCTION:{COMMON:"https://webim.tim.qq.com"}},sT={IM_OPEN_STAT:"imopenstat"},cT={TIM_WEB_TRTCCALLING_REPORT:"tweb_trtccalling_report"},uT={imopenstat:"v4"},lT=function(){function t(){u(this,t),this.TAG="trtccalling-ssolog-event",this._reportBody=new aT,this._version=ly,this.MIN_THRESHOLD=20,this.MAX_THRESHOLD=100,this.WAITING_TIME=6e4,this.INTERVAL=2e4,this._timerID=0,this._resetLastReportTime(),this._startReportTimer(),this._retryCount=0,this.MAX_RETRY_COUNT=3}return h(t,[{key:"reportAtOnce",value:function(){ZE.debug("EventStatController.reportAtOnce"),this._report()}},{key:"pushIn",value:function(t){t instanceof rT&&(t.setCommonInfo({SDKAppID:Number(wx.getStorageSync("sdkAppId")),version:this._version,userID:wx.getStorageSync("userId")}),this._reportBody.pushIn(t),this._report())}},{key:"_resetLastReportTime",value:function(){this._lastReportTime=Date.now()}},{key:"_startReportTimer",value:function(){var t=this;this._timerID=setInterval((function(){Date.now()0&&(clearInterval(this._timerID),this._timerID=0)}},{key:"_report",value:function(){var t=this;if(!this._reportBody.isEmpty()){var e=Math.ceil(+new Date/1e3),n=wx.getStorageSync("sdkAppId"),r=this._reportBody.getLogsInMemory(),i={table:this._reportBody.getTable(),report:r},a=oT.CURRENT.COMMON,o=uT.imopenstat,s=sT.IM_OPEN_STAT,c=cT.TIM_WEB_TRTCCALLING_REPORT,u="".concat(a,"/").concat(o,"/").concat(s,"/").concat(c,"/?sdkappid=").concat(n,"&reqtime=").concat(e);wx.request({url:u,method:"POST",data:JSON.stringify(i),header:{"content-type":"application/json"},success:function(e){t._retryCount>0&&(ZE.debug("EventStatController.report retry success"),t._retryCount=0)},fail:function(e){ZE.warn("EventStatController.report, error:".concat(KE(e))),t._reportBody.backfill(r),t._reportBody.getLogsNumInMemory()>t.MAX_THRESHOLD||t._retryCount===t.MAX_RETRY_COUNT||0===t._timerID?t._retryCount=0:t._retryCount+=1}})}}},{key:"reset",value:function(){ZE.log("EventStatController.reset"),this._stopReportTimer(),this._report()}}]),t}(),hT=zr.includes,fT=nd;wi({target:"Array",proto:!0,forced:A((function(){return!Array(1).includes()}))},{includes:function(t){return hT(this,t,arguments.length>1?arguments[1]:void 0)}}),fT("includes");var dT=It,pT=tt,vT=xe("match"),gT=function(t){var e;return dT(t)&&(void 0!==(e=t[vT])?!!e:"RegExp"==pT(t))},yT=gT,mT=TypeError,IT=xe("match"),ET=wi,TT=function(t){if(yT(t))throw mT("The method doesn't accept regular expressions");return t},DT=ut,_T=gh,bT=function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[IT]=!1,"/./"[t](e)}catch(t){}}return!1},CT=W("".indexOf);ET({target:"String",proto:!0,forced:!bT("includes")},{includes:function(t){return!!~CT(_T(DT(this)),_T(TT(t)),arguments.length>1?arguments[1]:void 0)}});var RT=W,ST=Iv,wT=gp.exports.getWeakData,xT=ts,kT=cn,OT=ot,LT=It,AT=yl,NT=pe,UT=ir.set,MT=ir.getterFor,PT=Qa.find,jT=Qa.findIndex,VT=RT([].splice),GT=0,HT=function(t){return t.frozen||(t.frozen=new FT)},FT=function(){this.entries=[]},KT=function(t,e){return PT(t.entries,(function(t){return t[0]===e}))};FT.prototype={get:function(t){var e=KT(this,t);if(e)return e[1]},has:function(t){return!!KT(this,t)},set:function(t,e){var n=KT(this,t);n?n[1]=e:this.entries.push([t,e])},delete:function(t){var e=jT(this.entries,(function(e){return e[0]===t}));return~e&&VT(this.entries,e,1),!!~e}};var BT,zT={getConstructor:function(t,e,n,r){var i=t((function(t,i){xT(t,a),UT(t,{type:e,id:GT++,frozen:void 0}),OT(i)||AT(i,t[r],{that:t,AS_ENTRIES:n})})),a=i.prototype,o=MT(e),s=function(t,e,n){var r=o(t),i=wT(kT(e),!0);return!0===i?HT(r).set(e,n):i[r.id]=n,t};return ST(a,{delete:function(t){var e=o(this);if(!LT(t))return!1;var n=wT(t);return!0===n?HT(e).delete(t):n&&NT(n,e.id)&&delete n[e.id]},has:function(t){var e=o(this);if(!LT(t))return!1;var n=wT(t);return!0===n?HT(e).has(t):n&&NT(n,e.id)}}),ST(a,n?{get:function(t){var e=o(this);if(LT(t)){var n=wT(t);return!0===n?HT(e).get(t):n?n[e.id]:void 0}},set:function(t,e){return s(this,t,e)}}:{add:function(t){return s(this,t,!0)}}),i}},$T=Mp,JT=O,YT=W,qT=Iv,WT=gp.exports,XT=yv,QT=zT,ZT=It,tD=ir.enforce,eD=A,nD=Vn,rD=Object,iD=Array.isArray,aD=rD.isExtensible,oD=rD.isFrozen,sD=rD.isSealed,cD=rD.freeze,uD=rD.seal,lD={},hD={},fD=!JT.ActiveXObject&&"ActiveXObject"in JT,dD=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},pD=XT("WeakMap",dD,QT),vD=pD.prototype,gD=YT(vD.set);if(nD)if(fD){BT=QT.getConstructor(dD,"WeakMap",!0),WT.enable();var yD=YT(vD.delete),mD=YT(vD.has),ID=YT(vD.get);qT(vD,{delete:function(t){if(ZT(t)&&!aD(t)){var e=tD(this);return e.frozen||(e.frozen=new BT),yD(this,t)||e.frozen.delete(t)}return yD(this,t)},has:function(t){if(ZT(t)&&!aD(t)){var e=tD(this);return e.frozen||(e.frozen=new BT),mD(this,t)||e.frozen.has(t)}return mD(this,t)},get:function(t){if(ZT(t)&&!aD(t)){var e=tD(this);return e.frozen||(e.frozen=new BT),mD(this,t)?ID(this,t):e.frozen.get(t)}return ID(this,t)},set:function(t,e){if(ZT(t)&&!aD(t)){var n=tD(this);n.frozen||(n.frozen=new BT),mD(this,t)?gD(this,t,e):n.frozen.set(t,e)}else gD(this,t,e);return this}})}else $T&&eD((function(){var t=cD([]);return gD(new pD,t,1),!oD(t)}))&&qT(vD,{set:function(t,e){var n;return iD(t)&&(oD(t)?n=lD:sD(t)&&(n=hD)),gD(this,t,e),n==lD&&cD(t),n==hD&&uD(t),this}});var ED=Qa.some;wi({target:"Array",proto:!0,forced:!Ua("some")},{some:function(t){return ED(this,t,arguments.length>1?arguments[1]:void 0)}});var TD=Jt,DD=he,_D=at,bD=Gr,CD=TypeError,RD=function(t){return function(e,n,r,i){TD(n);var a=DD(e),o=_D(a),s=bD(a),c=t?s-1:0,u=t?-1:1;if(r<2)for(;;){if(c in o){i=o[c],c+=u;break}if(c+=u,t?c<0:s<=c)throw CD("Reduce of empty array with no initial value")}for(;t?c>=0:s>c;c+=u)c in o&&(i=n(i,o[c],c,a));return i}},SD={left:RD(!1),right:RD(!0)}.left;wi({target:"Array",proto:!0,forced:!Uo&&Lt>79&&Lt<83||!Ua("reduce")},{reduce:function(t){var e=arguments.length;return SD(this,t,e,e>1?arguments[1]:void 0)}});var wD=wi,xD=W,kD=Or,OD=Hm,LD=EI,AD=A,ND=RangeError,UD=String,MD=Math.floor,PD=xD(LD),jD=xD("".slice),VD=xD(1..toFixed),GD=function(t,e,n){return 0===e?n:e%2==1?GD(t,e-1,n*t):GD(t*t,e/2,n)},HD=function(t,e,n){for(var r=-1,i=n;++r<6;)i+=e*t[r],t[r]=i%1e7,i=MD(i/1e7)},FD=function(t,e){for(var n=6,r=0;--n>=0;)r+=t[n],t[n]=MD(r/e),r=r%e*1e7},KD=function(t){for(var e=6,n="";--e>=0;)if(""!==n||0===e||0!==t[e]){var r=UD(t[e]);n=""===n?r:n+PD("0",7-r.length)+r}return n};wD({target:"Number",proto:!0,forced:AD((function(){return"0.000"!==VD(8e-5,3)||"1"!==VD(.9,0)||"1.25"!==VD(1.255,2)||"1000000000000000128"!==VD(0xde0b6b3a7640080,0)}))||!AD((function(){VD({})}))},{toFixed:function(t){var e,n,r,i,a=OD(this),o=kD(t),s=[0,0,0,0,0,0],c="",u="0";if(o<0||o>20)throw ND("Incorrect fraction digits");if(a!=a)return"NaN";if(a<=-1e21||a>=1e21)return UD(a);if(a<0&&(c="-",a=-a),a>1e-21)if(n=(e=function(t){for(var e=0,n=t;n>=4096;)e+=12,n/=4096;for(;n>=2;)e+=1,n/=2;return e}(a*GD(2,69,1))-69)<0?a*GD(2,-e,1):a/GD(2,e,1),n*=4503599627370496,(e=52-e)>0){for(HD(s,0,n),r=o;r>=7;)HD(s,1e7,0),r-=7;for(HD(s,GD(10,r,1),0),r=e-1;r>=23;)FD(s,1<<23),r-=23;FD(s,1<0?c+((i=u.length)<=o?"0."+PD("0",o-i)+u:jD(u,0,i-o)+"."+jD(u,i-o)):c+u}});var BD=O,zD=A,$D=gh,JD=$g.trim,YD=Pg,qD=W("".charAt),WD=BD.parseFloat,XD=BD.Symbol,QD=XD&&XD.iterator,ZD=1/WD(YD+"-0")!=-1/0||QD&&!zD((function(){WD(Object(QD))}))?function(t){var e=JD($D(t)),n=WD(e);return 0===n&&"-"==qD(e,0)?-0:n}:WD;wi({global:!0,forced:parseFloat!=ZD},{parseFloat:ZD});var t_=wi,e_=at,n_=ft,r_=Ua,i_=W([].join);t_({target:"Array",proto:!0,forced:e_!=Object||!r_("join",",")},{join:function(t){return i_(n_(this),void 0===t?",":t)}});var a_=N,o_=xn.EXISTS,s_=W,c_=nn.f,u_=Function.prototype,l_=s_(u_.toString),h_=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,f_=s_(h_.exec);a_&&!o_&&c_(u_,"name",{configurable:!0,get:function(){try{return f_(h_,l_(this))[1]}catch(t){return""}}});var d_=xn.PROPER,p_=A,v_=Pg,g_=$g.trim;wi({target:"String",proto:!0,forced:function(t){return p_((function(){return!!v_[t]()||"​…᠎"!=="​…᠎"[t]()||d_&&v_[t].name!==t}))}("trim")},{trim:function(){return g_(this)}});var y_=nn.f,m_=N,I_=O,E_=W,T_=Ei,D_=ev,__=Dn,b_=Sr.f,C_=bt,R_=gT,S_=gh,w_=Ey,x_=Vy,k_=function(t,e,n){n in t||y_(t,n,{configurable:!0,get:function(){return e[n]},set:function(t){e[n]=t}})},O_=Rr,L_=A,A_=pe,N_=ir.enforce,U_=Xo,M_=Fy,P_=zy,j_=xe("match"),V_=I_.RegExp,G_=V_.prototype,H_=I_.SyntaxError,F_=E_(G_.exec),K_=E_("".charAt),B_=E_("".replace),z_=E_("".indexOf),$_=E_("".slice),J_=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Y_=/a/g,q_=/a/g,W_=new V_(Y_)!==Y_,X_=x_.MISSED_STICKY,Q_=x_.UNSUPPORTED_Y,Z_=m_&&(!W_||X_||M_||P_||L_((function(){return q_[j_]=!1,V_(Y_)!=Y_||V_(q_)==q_||"/a/i"!=V_(Y_,"i")})));if(T_("RegExp",Z_)){for(var tb=function(t,e){var n,r,i,a,o,s,c=C_(G_,this),u=R_(t),l=void 0===e,h=[],f=t;if(!c&&u&&l&&t.constructor===tb)return t;if((u||C_(G_,t))&&(t=t.source,l&&(e=w_(f))),t=void 0===t?"":S_(t),e=void 0===e?"":S_(e),f=t,M_&&"dotAll"in Y_&&(r=!!e&&z_(e,"s")>-1)&&(e=B_(e,/s/g,"")),n=e,X_&&"sticky"in Y_&&(i=!!e&&z_(e,"y")>-1)&&Q_&&(e=B_(e,/y/g,"")),P_&&(a=function(t){for(var e,n=t.length,r=0,i="",a=[],o={},s=!1,c=!1,u=0,l="";r<=n;r++){if("\\"===(e=K_(t,r)))e+=K_(t,++r);else if("]"===e)s=!1;else if(!s)switch(!0){case"["===e:s=!0;break;case"("===e:F_(J_,$_(t,r+1))&&(r+=2,c=!0),i+=e,u++;continue;case">"===e&&c:if(""===l||A_(o,l))throw new H_("Invalid capture group name");o[l]=!0,a[a.length]=[l,u],c=!1,l="";continue}c?l+=e:i+=e}return[i,a]}(t),t=a[0],h=a[1]),o=D_(V_(t,e),c?this:G_,tb),(r||i||h.length)&&(s=N_(o),r&&(s.dotAll=!0,s.raw=tb(function(t){for(var e,n=t.length,r=0,i="",a=!1;r<=n;r++)"\\"!==(e=K_(t,r))?a||"."!==e?("["===e?a=!0:"]"===e&&(a=!1),i+=e):i+="[\\s\\S]":i+=e+K_(t,++r);return i}(t),n)),i&&(s.sticky=!0),h.length&&(s.groups=h)),t!==f)try{__(o,"source",""===f?"(?:)":f)}catch(t){}return o},eb=b_(V_),nb=0;eb.length>nb;)k_(tb,V_,eb[nb++]);G_.constructor=tb,tb.prototype=G_,O_(I_,"RegExp",tb,{constructor:!0})}U_("RegExp");var rb=_n.exports,ib=nn,ab=N,ob=function(t,e,n){return n.get&&rb(n.get,e,{getter:!0}),n.set&&rb(n.set,e,{setter:!0}),ib.f(t,e,n)},sb=py,cb=A,ub=O.RegExp,lb=ub.prototype;ab&&cb((function(){var t=!0;try{ub(".","d")}catch(e){t=!1}var e={},n="",r=t?"dgimsy":"gimsy",i=function(t,r){Object.defineProperty(e,t,{get:function(){return n+=r,!0}})},a={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var o in t&&(a.hasIndices="d"),a)i(o,a[o]);return Object.getOwnPropertyDescriptor(lb,"flags").get.call(e)!==r||n!==r}))&&ob(lb,"flags",{configurable:!0,get:sb});var hb=_p,fb=Math.floor,db=function(t,e){var n=t.length,r=fb(n/2);return n<8?pb(t,e):vb(t,db(hb(t,0,r),e),db(hb(t,r),e),e)},pb=function(t,e){for(var n,r,i=t.length,a=1;a0;)t[r]=t[--r];r!==a++&&(t[r]=n)}return t},vb=function(t,e,n,r){for(var i=e.length,a=n.length,o=0,s=0;o3)){if(Ab)return!0;if(Ub)return Ub<603;var t,e,n,r,i="";for(t=65;t<76;t++){switch(e=String.fromCharCode(t),t){case 66:case 69:case 70:case 72:n=3;break;case 68:case 71:n=4;break;default:n=2}for(r=0;r<47;r++)Mb.push({k:e+r,v:n})}for(Mb.sort((function(t,e){return e.v-t.v})),r=0;rwb(n)?1:-1}}(t)),n=Rb(i),r=0;ro&&(r=e.tooLong||this.tooLong||"is too long (maximum is %{count} characters)",u.push(i.format(r,{count:o}))),u.length>0?e.message||u:void 0):e.message||this.notValid||"has an incorrect length"}},numericality:function(t,e,n,r,a){if(i.isDefined(t)){var o,s,c=[],u={greaterThan:function(t,e){return t>e},greaterThanOrEqualTo:function(t,e){return t>=e},equalTo:function(t,e){return t===e},lessThan:function(t,e){return to&&(n=e.tooLate||e.message||this.tooLate||"must be no later than %{date}",n=i.format(n,{date:this.format(o,e),value:this.format(t,e)}),r.push(n)),r.length?i.unique(r):void 0)}}),{parse:null,format:null}),date:function(t,e){return e=i.extend({},e,{dateOnly:!0}),i.validators.datetime.call(i.validators.datetime,t,e)},format:function(t,e){(i.isString(e)||e instanceof RegExp)&&(e={pattern:e});var n,r=(e=i.extend({},this.options,e)).message||this.message||"is invalid",a=e.pattern;if(i.isDefined(t))return i.isString(t)?(i.isString(a)&&(a=new RegExp(e.pattern,e.flags)),(n=a.exec(t))&&n[0].length==t.length?void 0:r):r},inclusion:function(t,e){if(i.isDefined(t)&&(i.isArray(e)&&(e={within:e}),e=i.extend({},this.options,e),!i.contains(e.within,t))){var n=e.message||this.message||"^%{value} is not included in the list";return i.format(n,{value:t})}},exclusion:function(t,e){if(i.isDefined(t)&&(i.isArray(e)&&(e={within:e}),e=i.extend({},this.options,e),i.contains(e.within,t))){var n=e.message||this.message||"^%{value} is restricted";return i.isString(e.within[t])&&(t=e.within[t]),i.format(n,{value:t})}},email:i.extend((function(t,e){var n=(e=i.extend({},this.options,e)).message||this.message||"is not a valid email";if(i.isDefined(t))return i.isString(t)&&this.PATTERN.exec(t)?void 0:n}),{PATTERN:/^(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])$/i}),equality:function(t,e,n,r,a){if(i.isDefined(t)){i.isString(e)&&(e={attribute:e});var o=(e=i.extend({},this.options,e)).message||this.message||"is not equal to %{attribute}";if(i.isEmpty(e.attribute)||!i.isString(e.attribute))throw new Error("The attribute must be a non empty string");var s=i.getDeepObjectValue(r,e.attribute),c=e.comparator||function(t,e){return t===e},u=e.prettify||a&&a.prettify||i.prettify;return c(t,s,e,n,r)?void 0:i.format(o,{attribute:u(e.attribute)})}},url:function(t,e){if(i.isDefined(t)){var n=(e=i.extend({},this.options,e)).message||this.message||"is not a valid url",r=e.schemes||this.schemes||["http","https"],a=e.allowLocal||this.allowLocal||!1,o=e.allowDataUrl||this.allowDataUrl||!1;if(!i.isString(t))return n;var s="^(?:(?:"+r.join("|")+")://)(?:\\S+(?::\\S*)?@)?(?:",c="(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";return a?c+="?":s+="(?!(?:10|127)(?:\\.\\d{1,3}){3})(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})",s+="(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*"+c+")(?::\\d{2,5})?(?:[/?#]\\S*)?$",o&&(s="(?:"+s+")|(?:^data:(?:\\w+\\/[-+.\\w]+(?:;[\\w=]+)*)?(?:;base64)?,[A-Za-z0-9-_.!~\\*'();\\/?:@&=+$,%]*$)"),new RegExp(s,"i").exec(t)?void 0:n}},type:i.extend((function(t,e,n,r,a){if(i.isString(e)&&(e={type:e}),i.isDefined(t)){var o,s=i.extend({},this.options,e),c=s.type;if(!i.isDefined(c))throw new Error("No type was specified");if(o=i.isFunction(c)?c:this.types[c],!i.isFunction(o))throw new Error("validate.validators.type.types."+c+" must be a function.");if(!o(t,s,n,r,a)){var u=e.message||this.messages[c]||this.message||s.message||(i.isFunction(c)?"must be of the correct type":"must be of type %{type}");return i.isFunction(u)&&(u=u(t,e,n,r,a)),i.format(u,{attribute:i.prettify(n),type:c})}}}),{types:{object:function(t){return i.isObject(t)&&!i.isArray(t)},array:i.isArray,integer:i.isInteger,number:i.isNumber,string:i.isString,date:i.isDate,boolean:i.isBoolean},messages:{}})},r.formatters={detailed:function(t){return t},flat:i.flattenErrorsToArray,grouped:function(t){var e;for(e in t=i.groupErrorsByAttribute(t))t[e]=i.flattenErrorsToArray(t[e]);return t},constraint:function(t){var e;for(e in t=i.groupErrorsByAttribute(t))t[e]=t[e].map((function(t){return t.validator})).sort();return t}},r.exposeModule(r,this,t,e,n)}).call(x,Kb.exports,Kb,null);var Bb=Kb.exports,zb="number",$b="string",Jb="object",Yb="function",qb="array",Wb={createInstance:{sdkAppID:{presence:!0,type:zb},tim:{type:Jb}},destroyInstance:{},init:{userID:{presence:!0,type:$b},userSig:{presence:!0,type:$b}},on:{eventCode:{presence:!0,type:$b},handler:{presence:!0,type:Yb},context:{presence:!0,type:Jb}},off:{eventCode:{presence:!0,type:$b},handler:{presence:!0,type:Yb}},call:{userID:{presence:!0,type:$b},type:{presence:!0,type:zb}},groupCall:{groupID:{presence:!0,type:$b},type:{presence:!0,type:zb},userIDList:{presence:!0,type:qb}},joinInGroupCall:{groupID:{presence:!0,type:$b},type:{presence:!0,type:zb},roomID:{presence:!0,type:zb}},inviteUser:{userIDList:{presence:!0,type:qb}},accept:{},reject:{},hangup:{},switchCallMediaType:{type:{presence:!0,type:zb}},openCamera:{},closeCamera:{},switchCamera:{},openMicrophone:{},closeMicrophone:{},selectAudioPlaybackDevice:{type:{presence:!0,type:$b}},setSelfInfo:{nickName:{presence:!0,type:$b},avatar:{presence:!0,type:$b}}},Xb={createInstance:"",destroyInstance:"",init:"",on:"",off:"",call:[ig.IDLE],groupCall:[ig.IDLE],accept:[ig.CALLING],reject:[ig.CALLING],hangup:[ig.CALLING,ig.CONNECTED],switchCallMediaType:[ig.CALLING,ig.CONNECTED],joinInGroupCall:[ig.IDLE],inviteUser:[ig.CALLING,ig.CONNECTED],openCamera:[ig.CALLING,ig.CONNECTED],closeCamera:[ig.CALLING,ig.CONNECTED],switchCamera:[ig.CALLING,ig.CONNECTED],openMicrophone:[ig.CALLING,ig.CONNECTED],closeMicrophone:[ig.CALLING,ig.CONNECTED],selectAudioPlaybackDevice:[ig.CALLING,ig.CONNECTED],setSelfInfo:""},Qb={createInstance:!1,destroyInstance:!0,init:!1,on:!0,off:!0,call:!0,groupCall:!0,joinInGroupCall:!0,inviteUser:!0,accept:!0,reject:!0,hangup:!0,switchCallMediaType:!0,openCamera:!0,closeCamera:!0,switchCamera:!0,openMicrophone:!0,closeMicrophone:!0,selectAudioPlaybackDevice:!0,setSelfInfo:!0},Zb=function(t){d(n,m(Error));var e=T(n);function n(t,r,i){var a;return u(this,n),f(E(a=e.call(this,r)),"code",void 0),f(E(a),"message",void 0),f(E(a),"data",void 0),a.code=t,a.message=r,a.data=i,a}return h(n,null,[{key:"error",value:function(t,e,r){return r?new n(t,e,r):new n(t,e)}}]),n}();Bb.validators.type.types.function=function(t){return t instanceof Function};var tC=function(){function t(){u(this,t),f(this,"paramsMatchedRule",Wb),f(this,"statusMatchedRule",Xb),f(this,"requireInit",Qb)}return h(t,[{key:"getParamsMatchedRule",value:function(t){return this.paramsMatchedRule[t]}},{key:"getStatusMatchedRule",value:function(t){return this.statusMatchedRule[t]}},{key:"getInitReadyRule",value:function(t){return this.requireInit[t]}}]),t}(),eC=function(){function t(){u(this,t)}return h(t,[{key:"notify",value:function(t,e,n){throw Zb.error(e,"[TUICallEngine:".concat(t.api,",").concat(e,"]").concat(n))}}]),t}(),nC=h((function t(e){u(this,t),f(this,"api",""),f(this,"attributes",{}),f(this,"callStatus",""),f(this,"capabilityCode",void 0),f(this,"checkDevicePermissions",void 0),f(this,"checkMicrophonePermissions",void 0),f(this,"checkCameraPermissions",void 0),f(this,"initReady",void 0),this.api=e.api,this.attributes=e.attributes,this.callStatus=e.callStatus,this.capabilityCode=e.capabilityCode,this.checkDevicePermissions=e.checkDevicePermissions,this.checkMicrophonePermissions=e.checkMicrophonePermissions,this.checkCameraPermissions=e.checkCameraPermissions,this.initReady=e.initReady})),rC=new WeakMap,iC=function(){function t(){u(this,t),w(this,rC,{writable:!0,value:void 0}),R(this,rC,[])}var e;return h(t,[{key:"addAlertHandler",value:function(t){C(this,rC).push(t)}},{key:"check",value:(e=c(a().mark((function t(e,n){var r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=0;case 1:if(!(r1&&void 0!==r[1]?r[1]:{},!e.capabilityCode){t.next=14;break}return t.prev=2,t.next=5,n.tim.callExperimentalAPI("isCommercialAbilityEnabled",e.capabilityCode);case 5:!1===t.sent.data.enabled&&this.notification.notify(e,_g.ERROR_PACKAGE_NOT_SUPPORTED,bg.ERROR_PACKAGE_NOT_SUPPORTED),t.next=14;break;case 9:t.prev=9,t.t0=t.catch(2),wx.$TUICallEngine._callDataReport.setCodeAndMessage(_g.ERROR_PACKAGE_NOT_SUPPORTED,JSON.stringify(t.t0)),wx.$TUICallEngine._callDataReport.uploadToKibana(),2905===t.t0.code?this.notification.notify(e,_g.ERROR_TIM_VERSION_OUTDATED,bg.ERROR_TIM_VERSION_OUTDATED):this.notification.notify(e,_g.ERROR_PACKAGE_NOT_SUPPORTED,bg.ERROR_PACKAGE_NOT_SUPPORTED);case 14:case"end":return t.stop()}}),t,this,[[2,9]])}))),function(t){return e.apply(this,arguments)})}]),r}(),uC=function(t){d(r,aC);var e,n=T(r);function r(t,e){return u(this,r),n.call(this,t,e)}return h(r,[{key:"check",value:(e=c(a().mark((function t(e,n){var r=this;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.checkDevicePermissions){t.next=5;break}return wx.authorize({scope:"scope.record"}),wx.authorize({scope:"scope.camera"}),t.next=5,wx.getSetting().then((function(t){t.authSetting["scope.camera"]&&t.authSetting["scope.record"]||r.notification.notify(e,_g.ERROR_PERMISSION_DENIED,bg.ERROR_PERMISSION_DENIED)}));case 5:if(!e.checkMicrophonePermissions){t.next=9;break}return wx.authorize({scope:"scope.record"}),t.next=9,wx.getSetting().then((function(t){t.authSetting["scope.record"]||r.notification.notify(e,_g.ERROR_PERMISSION_DENIED,bg.ERROR_PERMISSION_DENIED)}));case 9:if(!e.checkCameraPermissions){t.next=13;break}return wx.authorize({scope:"scope.camera"}),t.next=13,wx.getSetting().then((function(t){t.authSetting["scope.camera"]||r.notification.notify(e,_g.ERROR_PERMISSION_DENIED,bg.ERROR_PERMISSION_DENIED)}));case 13:case"end":return t.stop()}}),t)}))),function(t,n){return e.apply(this,arguments)})}]),r}(),lC=function(t){d(n,aC);var e=T(n);function n(t,r){return u(this,n),e.call(this,t,r)}return h(n,[{key:"check",value:function(t,e){void 0!==t.initReady&&this.rule.getInitReadyRule(t.api)!==t.initReady&&this.notification.notify(t,_g.ERROR_INIT_FAIL,bg.ERROR_INIT_FAIL)}}]),n}(),hC=function(){function t(){u(this,t),f(this,"alertRule",void 0),f(this,"notification",void 0),f(this,"alert",void 0)}return h(t,[{key:"initializeBeans",value:function(){this.alertRule=new tC,this.notification=new eC,this.alert=new iC,this.alert.addAlertHandler(new oC(this.alertRule,this.notification)),this.alert.addAlertHandler(new lC(this.alertRule,this.notification)),this.alert.addAlertHandler(new cC(this.alertRule,this.notification)),this.alert.addAlertHandler(new uC(this.alertRule,this.notification)),this.alert.addAlertHandler(new sC(this.alertRule,this.notification))}},{key:"getAlert",value:function(){return this.alert}}],[{key:"getInstance",value:function(){return this.instance||(this.instance=new t,this.instance.initializeBeans()),this.instance}}]),t}();f(hC,"instance",void 0);var fC=W,dC=Jt,pC=It,vC=pe,gC=ps,yC=U,mC=Function,IC=fC([].concat),EC=fC([].join),TC={},DC=function(t,e,n){if(!vC(TC,e)){for(var r=[],i=0;i1)){t.next=16;break}return t.abrupt("return");case 16:if(s){t.next=22;break}return this.TRTCCallingDelegate.onCallEnd(u),t.next=20,this._resetTUICallEngine();case 20:case 31:t.next=45;break;case 22:if(this.deleteHandledInviteeList([n]),this.data.playerList=this.data.playerList.filter((function(t){return t.userID!==n})),d=this.getHandledInviteeList(),p=this.getUnHandledInviteeList(),!c){t.next=33;break}if(1!==d.length||0!==p.length){t.next=31;break}return this.TRTCCallingDelegate.onCallEnd(u),t.next=31,this._resetTUICallEngine();case 33:if(r!==ig.CALLING){t.next=40;break}if(-1!==o.indexOf(this.getUserID())&&this.TRTCCallingDelegate.onUserLeave({userID:n,playerList:this.data.playerList}),0!==d.length||1!==p.length){t.next=40;break}return this.TRTCCallingDelegate.onCancel({inviteID:this.data.invitation.inviteID,invitee:this.getUserID(),userID:this.getUserID()}),t.next=40,this._resetTUICallEngine();case 40:if(r!==ig.CONNECTED){t.next=45;break}if(1!==d.length||0!==p.length){t.next=45;break}return this.TRTCCallingDelegate.onCallEnd(u),t.next=45,this._resetTUICallEngine();case 45:case"end":return t.stop()}}),t,this)}))),function(t){return B.apply(this,arguments)})},{key:"handleSwitchCallModeTSignaling",value:(K=c(a().mark((function t(e,n){var r,i,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={inviteID:e,type:n.call_type},i={cmd:"switchToVideo"},n.call_type===hg.VIDEO&&(r.switch_to_audio_call="switch_to_audio_call",i.cmd="switchToAudio"),t.next=5,this.TSignalingClient.accept(r,i);case 5:o=t.sent,this.setSwitchCallModeStatus(!1),this.handleCallMode(n.call_type,o);case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return K.apply(this,arguments)})},{key:"judgeSwitchCallMode",value:function(t){return t.switch_to_audio_call&&"switch_to_audio_call"===t.switch_to_audio_call||t.data&&"switchToAudio"===t.data.cmd||t.data&&"switchToVideo"===t.data.cmd}},{key:"handleCallMode",value:function(t,e){ZE.log("".concat(RC,".handleCallMode - type"),t);var n=t!==hg.VIDEO;this.setPusherAttributesHandler({enableCamera:n}),n?(this.data.config.type=hg.VIDEO,this.data.invitation.type=hg.VIDEO):(this.data.config.type=hg.AUDIO,this.data.invitation.type=hg.AUDIO),this.TRTCCallingDelegate.onCallMode({type:this.data.config.type,message:e.data.message}),this.setSwitchCallModeStatus(!0)}},{key:"handleInvitedSignal",value:function(t){var e=t.inviter,n=t.inviteeList,r=t.isGroupCall,a=t.groupID,o=t.inviteID,s=t.inviteData,c=t.inCallUserIDs,u=void 0===c?[]:c;this.data.remoteID=e,this.data.config.type=s.call_type,this.data.invitation.inviteID=o,this.data.invitation.inviter=e,this.data.invitation.type=s.call_type,this.data.invitation.roomID=s.room_id,this.data.isInviter=!1,this.data.isGroupCall=r,this.addHandledInviteeList([e]),this.addUnHandledInviteeList([].concat(D(n),D(u))),this.addAcceptedUserList(o,[e]),this.addInviterInviteId(o,[e].concat(D(n)));var l=u.filter((function(t){return-1===n.indexOf(t)}));r&&(this.data.groupID=a),this.changeCallStatus(ig.CALLING),ZE.log("".concat(RC," NEW_INVITATION_RECEIVED invitation: "),this.data.callStatus,this.data.invitation);var h={sponsor:e,inviteeList:n,userIDList:[].concat(D(n),D(l)),isFromGroup:r,inviteID:o,groupID:a,inviteData:{version:s.version,callType:s.call_type,roomID:s.room_id}};this.setPusherAttributesHandler({enableCamera:this.data.config.type===hg.VIDEO}),wx.createLivePusherContext().startPreview();var f=this.getCallDataReport().getCallData();f=i(i({},f),{},{userId:this.getUserID(),roomID:s.room_id,inviteID:o,callRole:pg,callType:s.call_type,inviteeList:n}),this.getCallDataReport().setCallData(f),this.TRTCCallingDelegate.onInvited(h)}},{key:"addInviterInviteId",value:function(t,e){0!==e.length&&(0===(this.data._inviterInviteID[t]||[]).length?this.data._inviterInviteID[t]=e:this.data._inviterInviteID[t]=[].concat(D(this.data._inviterInviteID[t]),D(e)))}},{key:"handleInviteeAccepted",value:(F=c(a().mark((function t(e){var n,r,i,o,s;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(ZE.log("".concat(RC," onInviteeAccepted - params:"),e),n=JSON.parse(e.data.data),r=e.data.invitee,i=e.data.inviteID,-1!==this.getTotalInviterInviteIdList().indexOf(i)){t.next=6;break}return t.abrupt("return");case 6:if(this.data.callStatus!==ig.IDLE){t.next=8;break}return t.abrupt("return");case 8:if(this.isGroupCall()||!this.judgeSwitchCallMode(n)||this.data.switchCallModeStatus){t.next=11;break}return this.handleCallMode(this.data.invitation.type),t.abrupt("return");case 11:if(o=this.getCallStatus(),r!==this.getUserID()||o!==ig.CALLING){t.next=17;break}return this.TRTCCallingDelegate.onCancel({inviteID:this.data.invitation.inviteID,invitee:r,userID:r}),t.next=16,this._resetTUICallEngine();case 16:return t.abrupt("return");case 17:return this.isInviter()&&this.data.callStatus===ig.CALLING&&this.changeCallStatus(ig.CONNECTED),this.getCallDataReport().setCallAcceptTime((new Date).getTime()),this.addHandledInviteeList([r]),this.deleteUnHandledInviteeList([r]),this.addAcceptedUserList(i,[r]),t.next=24,this.getUserProfile(this.data.unHandledInviteeList.map((function(t){return{userID:t}})));case 24:s=t.sent,this.TRTCCallingDelegate.onUserAccept({userID:r,userList:s});case 26:case"end":return t.stop()}}),t,this)}))),function(t){return F.apply(this,arguments)})},{key:"handleInviteeRejected",value:(H=c(a().mark((function t(e){var n,r,i,o,s,c,u,l,h,f,d,p,v,g,y;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(ZE.log("".concat(RC," onInviteeRejected - params"),e),r=e.data.inviteID,this.isGroupCall()||this.getSwitchCallModeStatus()||-1===this.getAudioVideoSwitchIdList().indexOf(r)){t.next=6;break}return ZE.log("".concat(RC,".onInviteeRejected - Audio and video switching is not available")),this.setSwitchCallModeStatus(!0),t.abrupt("return");case 6:if(i=e.data.invitee,o=e.data.inviter,s=this.getUserID(),c=this.getCallStatus(),u=JSON.parse(e.data.data),-1!==this.getInviterInviteIdList().indexOf(r)){t.next=14;break}return this.deleteUnHandledInviteeList([i]),t.abrupt("return");case 14:if(c!==ig.IDLE){t.next=16;break}return t.abrupt("return");case 16:if(s!==i||c!==ig.CALLING){t.next=21;break}return this.TRTCCallingDelegate.onCancel({inviteID:this.data.invitation.inviteID,invitee:i,userID:i}),t.next=20,this._resetTUICallEngine();case 20:return t.abrupt("return");case 21:if(l=this.isGroupCall(),h=this.isInviter(),this.deleteUnHandledInviteeList([i]),f=this.getUnHandledInviteeList(),d=this.getHandledInviteeList(),p={inviteID:this.data.invitation.inviteID,invitee:s,userID:s},v={inviteID:this.data.invitation.inviteID,invitee:i,userID:i},g=this.data.invitation,c!==ig.CONNECTED){t.next=32;break}if(-1===d.indexOf(i)){t.next=32;break}return t.abrupt("return");case 32:if(!("line_busy"===u.line_busy||""===u.line_busy||null!=u&&null!==(n=u.data)&&void 0!==n&&n.message&&"lineBusy"===u.data.message)){t.next=46;break}if(o===g.inviter&&this.TRTCCallingDelegate.onLineBusy({inviteID:this.data.invitation.inviteID,invitee:i,userID:i}),l){t.next=40;break}return this.TRTCCallingDelegate.onCancel(p),t.next=38,this._resetTUICallEngine();case 38:t.next=44;break;case 40:if(0!==f.length||1!==d.length){t.next=44;break}return this.TRTCCallingDelegate.onCancel(p),t.next=44,this._resetTUICallEngine();case 44:case 51:t.next=72;break;case 46:if(l){t.next=53;break}return this.TRTCCallingDelegate.onReject(v),this.TRTCCallingDelegate.onCancel(p),t.next=51,this._resetTUICallEngine();case 53:if(this.TRTCCallingDelegate.onReject(v),c!==ig.CALLING){t.next=66;break}if(!h){t.next=62;break}if(0!==f.length||1!==d.length){t.next=60;break}return this.TRTCCallingDelegate.onCancel(p),t.next=60,this._resetTUICallEngine();case 60:t.next=66;break;case 62:if(1!==f.length||0!==d.length){t.next=66;break}return this.TRTCCallingDelegate.onCancel(p),t.next=66,this._resetTUICallEngine();case 66:if(c!==ig.CONNECTED){t.next=72;break}if(0!==f.length||1!==d.length){t.next=72;break}return y={roomID:this.getRoomID(),callMediaType:this.getCallType(),callRole:pg,totalTime:Math.round((Date.now()-this.data.startTalkTime)/1e3),callEnd:Math.round((Date.now()-this.data.startTalkTime)/1e3),message:"",userID:i},this.TRTCCallingDelegate.onCallEnd(y),t.next=72,this._resetTUICallEngine();case 72:case"end":return t.stop()}}),t,this)}))),function(t){return H.apply(this,arguments)})},{key:"handleInvitationCancelled",value:(G=c(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.data.invitation.inviteID===e.data.inviteID){t.next=2;break}return t.abrupt("return");case 2:if(this.data.callStatus!==ig.IDLE){t.next=4;break}return t.abrupt("return");case 4:if(-1!==this.getInviterInviteIdList().indexOf(e.data.inviteID)){t.next=6;break}return t.abrupt("return");case 6:return ZE.log(RC,"onInvitationCancelled","inviteID:".concat(e.data.inviteID," inviter:").concat(e.data.inviter," data:").concat(e.data.data)),this.TRTCCallingDelegate.onCancel({inviteID:this.data.invitation.inviteID,invitee:e.data.inviter,userID:e.data.inviter}),t.next=10,this._resetTUICallEngine();case 10:case"end":return t.stop()}}),t,this)}))),function(t){return G.apply(this,arguments)})},{key:"handleInvitationTimeout",value:(V=c(a().mark((function t(e){var n,r,i,o,s,c,u,l,h,f,d,p,v,g,y;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.data,i=r.inviter,o=r.inviteeList,s=void 0===o?[]:o,c=r.inviteID,u=this.getUserID(),l=this.isGroupCall(),h=this.isInviter(),f=this.getCallStatus(),this.deleteUnHandledInviteeList(s),ZE.warn("".concat(RC,".onInvitationTimeout - params:"),e,"currentUserID:".concat(u," isInviter:").concat(h," isGroupCall:").concat(l," \n currentCallStatus:").concat(f," inviteID:").concat(null==this||null===(n=this._newInvitationData)||void 0===n?void 0:n.inviteID)),-1!==this.getInviterInviteIdList().indexOf(c)){t.next=9;break}return t.abrupt("return");case 9:if(f!==ig.IDLE){t.next=11;break}return t.abrupt("return");case 11:if(d=this.getHandledInviteeList(),p=this.getUnHandledInviteeList(),v={groupID:this.data.groupID,inviteID:this.data.invitation.inviteID,sponsor:i,timeoutUserList:s,userIDList:s},g={inviteID:this.data.invitation.inviteID,invitee:u,userID:u},l){t.next=21;break}return h?(this.TRTCCallingDelegate.onNoResp(v),this.TRTCCallingDelegate.onCancel(g)):this.TRTCCallingDelegate.onCancel(g),t.next=19,this._resetTUICallEngine();case 19:t.next=44;break;case 21:if(f!==ig.CALLING){t.next=37;break}if(!h){t.next=30;break}if(this.TRTCCallingDelegate.onNoResp(v),0!==p.length){t.next=28;break}return this.TRTCCallingDelegate.onCancel(g),t.next=28,this._resetTUICallEngine();case 28:t.next=37;break;case 30:if(-1!==s.indexOf(u)){t.next=34;break}this.TRTCCallingDelegate.onNoResp(v),t.next=37;break;case 34:return this.TRTCCallingDelegate.onCancel(g),t.next=37,this._resetTUICallEngine();case 37:if(f!==ig.CONNECTED){t.next=44;break}if(this.TRTCCallingDelegate.onNoResp(v),1!==d.length||0!==p.length){t.next=44;break}return y={roomID:this.getRoomID(),callMediaType:this.getCallType(),callRole:this.isInviter()?dg:pg,totalTime:Math.round((Date.now()-this.data.startTalkTime)/1e3),callEnd:Math.round((Date.now()-this.data.startTalkTime)/1e3),message:"",userID:this.getUserID()},this.TRTCCallingDelegate.onCallEnd(y),t.next=44,this._resetTUICallEngine();case 44:case"end":return t.stop()}}),t,this)}))),function(t){return V.apply(this,arguments)})},{key:"handleSDKReady",value:function(){var t=this;ZE.log(RC,"TSignaling SDK ready"),this.TSignalingResolve(),this.TRTCCallingDelegate.onSdkReady({message:"SDK ready"}),this.tim.getMyProfile().then((function(e){t.data.localUser=e.data})).catch((function(t){ZE.warn("getMyProfile error:",t)}))}},{key:"handleKickedOut",value:function(){this.hangup(),this.TRTCCallingDelegate.onKickedOut({message:"kicked out"})}},{key:"_addTSignalingEvent",value:function(){wx.$TSignaling.on(t.EVENT.NEW_INVITATION_RECEIVED,this.handleNewInvitationReceived,this),wx.$TSignaling.on(t.EVENT.INVITEE_ACCEPTED,this.handleInviteeAccepted,this),wx.$TSignaling.on(t.EVENT.INVITEE_REJECTED,this.handleInviteeRejected,this),wx.$TSignaling.on(t.EVENT.INVITATION_CANCELLED,this.handleInvitationCancelled,this),wx.$TSignaling.on(t.EVENT.INVITATION_TIMEOUT,this.handleInvitationTimeout,this),wx.$TSignaling.on(t.EVENT.SDK_READY,this.handleSDKReady,this),wx.$TSignaling.on(t.EVENT.KICKED_OUT,this.handleKickedOut,this),t.EVENT.MESSAGE_SENT_BY_ME&&wx.$TSignaling.on(t.EVENT.MESSAGE_SENT_BY_ME,this.onMessageSentByMe,this)}},{key:"_removeTSignalingEvent",value:function(){wx.$TSignaling.off(t.EVENT.NEW_INVITATION_RECEIVED,this.handleNewInvitationReceived),wx.$TSignaling.off(t.EVENT.INVITEE_ACCEPTED,this.handleInviteeAccepted),wx.$TSignaling.off(t.EVENT.INVITEE_REJECTED,this.handleInviteeRejected),wx.$TSignaling.off(t.EVENT.INVITATION_CANCELLED,this.handleInvitationCancelled),wx.$TSignaling.off(t.EVENT.INVITATION_TIMEOUT,this.handleInvitationTimeout),wx.$TSignaling.off(t.EVENT.SDK_READY,this.handleSDKReady),wx.$TSignaling.off(t.EVENT.KICKED_OUT,this.handleKickedOut),t.EVENT.MESSAGE_SENT_BY_ME&&wx.$TSignaling.off(t.EVENT.MESSAGE_SENT_BY_ME,this.onMessageSentByMe,this)}},{key:"onRemoteUserJoin",value:(j=c(a().mark((function t(e){var n,r,i,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.data,r=n.userID,i=n.userList,o=n.playerList,ZE.log(RC,"REMOTE_USER_JOIN",e,r),this.addHandledInviteeList([r]),this.deleteUnHandledInviteeList([r]),this.changeCallStatus(ig.CONNECTED),!(o.length>0)){t.next=11;break}return t.next=8,this.getUserProfile(o);case 8:t.t0=t.sent,t.next=12;break;case 11:t.t0=this.data.playerList;case 12:this.data.playerList=t.t0,this.data.startTalkTime||(this.data.startTalkTime=Date.now()),this.TRTCCallingDelegate.onUserEnter({userID:e.data.userID,playerList:this.data.playerList}),ZE.log(RC,"REMOTE_USER_JOIN","playerList:",this.data.playerList,"userList:",i);case 16:case"end":return t.stop()}}),t,this)}))),function(t){return j.apply(this,arguments)})},{key:"onRemoteUserLeave",value:(P=c(a().mark((function t(e){var n,r,i,o,s,c,u,l,h;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.data.userID,ZE.log(RC,"REMOTE_USER_LEAVE",e,e.data.userID),this.deleteHandledInviteeList([n]),this.data.playerList=this.data.playerList.filter((function(t){return t.userID!==n})),this.TRTCCallingDelegate.onUserLeave({userID:n,playerList:this.data.playerList}),this.getCallDataReport().setExitRoomTime((new Date).getTime()),this.data.isGroupCall){t.next=16;break}return t.next=9,this.TSignalingClient.hangup({userIDList:[n],callType:this.data.config.type,callEnd:Math.round((Date.now()-this.data.startTalkTime)/1e3)});case 9:return r=this.isInviter()?dg:pg,i={roomID:this.getRoomID(),callMediaType:this.getCallType(),callRole:r,totalTime:Math.round((Date.now()-this.data.startTalkTime)/1e3),callEnd:Math.round((Date.now()-this.data.startTalkTime)/1e3),message:"",userID:this.getUserID()},this.TRTCCallingDelegate.onCallEnd(i),ZE.log(RC,"REMOTE_USER_LEAVE","playerList:"),t.next=15,this._resetTUICallEngine();case 15:return t.abrupt("return");case 16:if(o=this.getHandledInviteeList(),s=this.getUnHandledInviteeList(),c=this.getUserID(),u=this.isInviter()?dg:pg,1!==o.length||o[0]!==c||0!==s.length){t.next=26;break}return l=Math.round((Date.now()-this.data.startTalkTime)/1e3),h={roomID:this.getRoomID(),callMediaType:this.getCallType(),callRole:u,totalTime:l,userID:c,callEnd:l,message:""},this.TRTCCallingDelegate.onCallEnd(h),t.next=26,this._resetTUICallEngine();case 26:case"end":return t.stop()}}),t,this)}))),function(t){return P.apply(this,arguments)})},{key:"onLocalNetStateUpdate",value:function(t){var e=t.data.pusher.netStatus;ZE.log(RC,"onLocalNetStateUpdate",e),this.data.pusher=t.data.pusher,this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList})}},{key:"onRemoteNetStateUpdate",value:(M=c(a().mark((function t(e){var n;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=e.data.playerList,ZE.log(RC,"onRemoteNetStateUpdate",n),this.data.playerList=this._updateUserProfile(this.data.playerList,n),this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList});case 4:case"end":return t.stop()}}),t,this)}))),function(t){return M.apply(this,arguments)})},{key:"onError",value:function(t){ZE.log(RC,"onError",t)}},{key:"onRemoteVideoAdd",value:function(t){ZE.log("* room REMOTE_VIDEO_ADD",t);var e=t.data.player;this.setPlayerAttributesHandler(e,{muteVideo:!1})}},{key:"onRemoteVideoRemove",value:function(t){ZE.log("* room REMOTE_VIDEO_REMOVE",t);var e=t.data.player;this.setPlayerAttributesHandler(e,{muteVideo:!0})}},{key:"onRemoteAudioAdd",value:(U=c(a().mark((function t(e){var n;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return ZE.log("* room REMOTE_AUDIO_ADD",e),t.next=3,this.getUserProfile([e.data.player]);case 3:n=t.sent,this.setPlayerAttributesHandler(n[0],{muteAudio:!1});case 5:case"end":return t.stop()}}),t,this)}))),function(t){return U.apply(this,arguments)})},{key:"onRemoteAudioRemove",value:function(t){ZE.log("* room REMOTE_AUDIO_REMOVE",t);var e=t.data.player;this.setPlayerAttributesHandler(e,{muteAudio:!0})}},{key:"onRemoteAudioVolumeUpdate",value:(N=c(a().mark((function t(e){var n;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:ZE.log("* room REMOTE_AUDIO_VOLUME_UPDATE",e),n=e.data.playerList,this.data.playerList=this._updateUserProfile(this.data.playerList,n),this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList});case 4:case"end":return t.stop()}}),t,this)}))),function(t){return N.apply(this,arguments)})},{key:"onLocalAudioVolumeUpdate",value:function(t){var e=t.data.pusher;this.data.pusher=e,this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList})}},{key:"onMessageSentByMe",value:function(t){this.TRTCCallingDelegate.onMessageSentByMe(t)}},{key:"_addTRTCEvent",value:function(){this.TRTC.on(this.TRTC.EVENT.REMOTE_USER_JOIN,this.onRemoteUserJoin,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_USER_LEAVE,this.onRemoteUserLeave,this),this.TRTC.on(this.TRTC.EVENT.LOCAL_NET_STATE_UPDATE,this.onLocalNetStateUpdate,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_NET_STATE_UPDATE,this.onRemoteNetStateUpdate,this),this.TRTC.on(this.TRTC.EVENT.ERROR,this.onError,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_VIDEO_ADD,this.onRemoteVideoAdd,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_VIDEO_REMOVE,this.onRemoteVideoRemove,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_AUDIO_ADD,this.onRemoteAudioAdd,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_AUDIO_REMOVE,this.onRemoteAudioRemove,this),this.TRTC.on(this.TRTC.EVENT.REMOTE_AUDIO_VOLUME_UPDATE,this.onRemoteAudioVolumeUpdate,this),this.TRTC.on(this.TRTC.EVENT.LOCAL_AUDIO_VOLUME_UPDATE,this.onLocalAudioVolumeUpdate,this)}},{key:"_removeTRTCEvent",value:function(){this.TRTC.off(this.TRTC.EVENT.REMOTE_USER_JOIN,this.onRemoteUserJoin),this.TRTC.off(this.TRTC.EVENT.REMOTE_USER_LEAVE,this.onRemoteUserLeave),this.TRTC.off(this.TRTC.EVENT.LOCAL_NET_STATE_UPDATE,this.onLocalNetStateUpdate),this.TRTC.off(this.TRTC.EVENT.REMOTE_NET_STATE_UPDATE,this.onRemoteNetStateUpdate),this.TRTC.off(this.TRTC.EVENT.ERROR,this.onError),this.TRTC.off(this.TRTC.EVENT.REMOTE_VIDEO_ADD,this.onRemoteVideoAdd),this.TRTC.off(this.TRTC.EVENT.REMOTE_VIDEO_REMOVE,this.onRemoteVideoRemove),this.TRTC.off(this.TRTC.EVENT.REMOTE_AUDIO_ADD,this.onRemoteAudioAdd),this.TRTC.off(this.TRTC.EVENT.REMOTE_AUDIO_REMOVE,this.onRemoteAudioRemove),this.TRTC.off(this.TRTC.EVENT.REMOTE_AUDIO_VOLUME_UPDATE,this.onRemoteAudioVolumeUpdate),this.TRTC.off(this.TRTC.EVENT.LOCAL_AUDIO_VOLUME_UPDATE,this.onLocalAudioVolumeUpdate)}},{key:"initTRTC",value:function(){var t=this.TRTC.createPusher({beautyLevel:5});this.data.pusher=t.pusherAttributes}},{key:"enterRoom",value:function(t){this._addTRTCEvent();var e=t.roomID,n=Object.assign(this.data.config,{roomID:e,enableMic:!0,autopush:!0,enableAgc:!0,enableAns:!0,enableCamera:t.callType===hg.VIDEO});this.data.enterRoomStatus=!0,this.data.pusher=this.TRTC.enterRoom(n),wx.createLivePusherContext().startPreview(),this.TRTC.getPusherInstance().start()}},{key:"exitRoom",value:(A=c(a().mark((function t(){var e;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.TRTC.getPusherInstance().stop();case 2:return t.next=4,this.TRTC.exitRoom();case 4:e=t.sent,this.data.pusher=e.pusher,this.data.playerList=e.playerList,this.data.unHandledInviteeList=[],this.data.enterRoomStatus=!1,this.initTRTC(),this._removeTRTCEvent();case 11:case"end":return t.stop()}}),t,this)}))),function(){return A.apply(this,arguments)})},{key:"setPusherAttributesHandler",value:function(t){this.data.pusher=this.TRTC.setPusherAttributes(t),this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList})}},{key:"setPlayerAttributesHandler",value:(L=c(a().mark((function t(e,n){var r;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=this.TRTC.setPlayerAttributes(e.streamID,n),ZE.warn("setPlayerAttributesHandler",r),this.data.playerList=r.length>0?this._updateUserProfile(this.data.playerList,r):this.data.playerList,this.data.playerList.length>0&&0===r.length&&(this.data.playerList[0].hasAudio=!1,this.data.playerList[0].hasVideo=!1),this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList});case 5:case"end":return t.stop()}}),t,this)}))),function(t,e){return L.apply(this,arguments)})},{key:"_mutePlayerAudio",value:function(t){var e=t.currentTarget.dataset.value;e.hasAudio&&e.muteAudio?this.setPlayerAttributesHandler(e,{muteAudio:!1}):!e.hasAudio||e.muteAudio||this.setPlayerAttributesHandler(e,{muteAudio:!0})}},{key:"_mutePlayerVideo",value:function(t){var e=t.currentTarget.dataset.value;e.hasVideo&&e.muteVideo?this.setPlayerAttributesHandler(e,{muteVideo:!1}):!e.hasVideo||e.muteVideo||this.setPlayerAttributesHandler(e,{muteVideo:!0})}},{key:"_pusherAudioHandler",value:function(){this.data.pusher.enableMic?(this.setPusherAttributesHandler({enableMic:!1}),this.TRTC.getPusherInstance().setMICVolume({volume:0})):(this.setPusherAttributesHandler({enableMic:!0}),this.TRTC.getPusherInstance().setMICVolume({volume:100}))}},{key:"_pusherVideoHandler",value:function(){this.data.pusher.enableCamera?this.setPusherAttributesHandler({enableCamera:!1}):this.setPusherAttributesHandler({enableCamera:!0})}},{key:"init",value:(O=c(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return hC.getInstance().getAlert().checkSync(new nC({api:"init",attributes:e})),t.next=3,this.login(e);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t,this)}))),function(t){return O.apply(this,arguments)})},{key:"login",value:(k=c(a().mark((function t(e){var n=this;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.data.config.userID=e.userID,this.data.config.userSig=e.userSig,t.abrupt("return",new Promise((function(t,r){wx.$TSignaling.login({userID:e.userID,userSig:e.userSig}).then((function(r){return ZE.log(RC,"login","IM login success",r),wx.setStorageSync("userId","".concat(e.userID)),n._callDataReport.setUserID(e.userID),n._initReady=!0,n._resetTUICallEngine(),n._addTSignalingEvent(),n.initTRTC(),n.TSignalingResolve=t,r.data.repeatLogin&&t(null),null}))})));case 3:case"end":return t.stop()}}),t,this)}))),function(t){return k.apply(this,arguments)})},{key:"logout",value:(x=c(a().mark((function t(){var e=this;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.data.callStatus!==ig.CALLING&&this.data.callStatus!==ig.CONNECTED){t.next=8;break}if(!this.isInviter()){t.next=6;break}return t.next=4,this.hangup();case 4:t.next=8;break;case 6:return t.next=8,this.reject();case 8:return t.next=10,this._resetTUICallEngine();case 10:wx.$TSignaling.logout({userID:this.data.config.userID,userSig:this.data.config.userSig}).then((function(t){return ZE.log(RC,"logout","IM logout success"),e._removeTSignalingEvent(),e._removeTRTCEvent(),t})).catch((function(t){throw ZE.error(RC,"logout","IM logout failure"),new Error(t)}));case 11:case"end":return t.stop()}}),t,this)}))),function(){return x.apply(this,arguments)})},{key:"on",value:function(t,e,n){hC.getInstance().getAlert().checkSync(new nC({api:"on",attributes:{eventCode:t,handler:e,context:n},initReady:this._initReady})),this._emitter.on(t,e,n)}},{key:"off",value:function(t,e){hC.getInstance().getAlert().checkSync(new nC({api:"off",attributes:{eventCode:t,handler:e}})),this._emitter.off(t,e)}},{key:"call",value:(w=c(a().mark((function t(e){var n,r,o,s,c,u;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.userID,r=e.type,t.next=3,hC.getInstance().getAlert().check(new nC({api:"call",attributes:e,initReady:this._initReady,callStatus:this.data.callStatus,capabilityCode:Dg.BASE,checkMicrophonePermissions:!0,checkCameraPermissions:r===hg.VIDEO}),{tim:this.tim});case 3:if(this.getUserID()!==n){t.next=6;break}throw ZE.log("".concat(RC,".call failed. Called id can't be yourself. userId:").concat(this.getUserID(),", inviteeId:").concat(n)),new Error("".concat(RC,".call failed. Called id can't be yourself. userId:").concat(this.getUserID(),", inviteeId:").concat(n));case 6:return this._callDataReport.setAbilityBit(!0),this._callDataReport.setCallScene(Ag),t.prev=8,o=Math.floor(2147483646*Math.random()+1),this.enterRoom({roomID:o,callType:r}),this._callDataReport.setEnterRoomTime((new Date).getTime()),s=i(i({},s=this._callDataReport.getCallData()),{},{userId:n,roomID:o,callRole:dg,callType:r,inviteeList:[n]}),this._callDataReport.setCallData(s),t.next=17,this.TSignalingClient.invite(i({roomID:o},e));case 17:if(c=t.sent,this._callDataReport.setSendSignalingTime((new Date).getTime()),ZE.log("".concat(RC," call(userID: ").concat(n,", type: ").concat(r,") success, ").concat(c)),u="callType: ".concat(r+1,",\n conversationType: ").concat(c.data.message.conversationType,",\n userId:{ ").concat(c.data.message.from," } invite userId:{ ").concat(c.data.message.to," }"),0!==c.code){t.next=26;break}this._callDataReport.setInviteID(c.inviteID),this._setInterfaceUpLoad(iT.CALL).setCallType(r+1).setText("".concat(u," succeeded")).setEnd(),t.next=31;break;case 26:return this._callDataReport.setCodeAndMessage(c.code,c.message),this._callDataReport.uploadToKibana(),this._setInterfaceUpLoad(iT.CALL).setCallType(r+1).setText("".concat(u," failed")).setEnd(),t.next=31,this._resetTUICallEngine();case 31:return this.data.config.type=r,this.data.invitation.inviteID=c.inviteID,this.data.invitation.inviter=this.data.config.userID,this.data.invitation.type=r,this.data.invitation.roomID=o,this.data.isInviter=!0,this.data.remoteID=n,this.changeCallStatus(ig.CALLING),this.addInviterInviteId(c.inviteID,[this.data.config.userID,n]),this.addUnHandledInviteeList([n]),this.addHandledInviteeList([this.getUserID()]),t.abrupt("return",{data:c.data,pusher:this.data.pusher});case 45:t.prev=45,t.t0=t.catch(8),this._callDataReport.setCodeAndMessage(eT,JSON.stringify(t.t0)),this._callDataReport.uploadToKibana(),ZE.log("".concat(RC," call(userID:").concat(n,",type:").concat(r,") failed', error: ").concat(t.t0));case 50:case"end":return t.stop()}}),t,this,[[8,45]])}))),function(t){return w.apply(this,arguments)})},{key:"groupCall",value:(S=c(a().mark((function t(e){var n,r,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.type,t.next=3,hC.getInstance().getAlert().check(new nC({api:"groupCall",attributes:e,initReady:this._initReady,callStatus:this.data.callStatus,capabilityCode:Dg.PRO,checkMicrophonePermissions:!0,checkCameraPermissions:n===hg.VIDEO}),{tim:this.tim});case 3:return this._callDataReport.setCallScene(Ng),r=this.data.roomID||Math.floor(2147483646*Math.random()+1),this.enterRoom({roomID:r,callType:n}),t.prev=6,t.next=9,this.TSignalingClient.inviteGroup(i({roomID:r},e));case 9:return o=t.sent,this.data.config.type=e.type,this.data.invitation.inviteID=o.inviteID,this.data.invitation.inviter=this.data.config.userID,this.data.invitation.type=n,this.data.invitation.roomID=r,this.data.isInviter=!0,this.data.isGroupCall=!0,this.data.groupID=e.groupID,this.addUnHandledInviteeList(e.userIDList),this.addHandledInviteeList([this.getUserID()]),this.changeCallStatus(ig.CALLING),this.addInviterInviteId(o.inviteID,[this.data.config.userID].concat(D(e.userIDList))),ZE.log(RC,"inviteInGroup OK",o),t.abrupt("return",{data:o.data,pusher:this.data.pusher});case 26:t.prev=26,t.t0=t.catch(6),ZE.log(RC,"inviteInGroup failed",t.t0);case 29:case"end":return t.stop()}}),t,this,[[6,26]])}))),function(t){return S.apply(this,arguments)})},{key:"joinInGroupCall",value:(R=c(a().mark((function t(e){var n,r,i;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.roomID,r=e.type,i=e.groupID,t.next=3,hC.getInstance().getAlert().check(new nC({api:"joinInGroupCall",attributes:e,initReady:this._initReady,capabilityCode:Dg.PRO,checkMicrophonePermissions:!0,checkCameraPermissions:r===hg.VIDEO}),{tim:this.tim});case 3:return t.prev=3,this.data.config.type=r,this.data.invitation.type=r,ZE.log("".concat(RC,".joinInGroupCall roomID:").concat(n,",type:").concat(r,",userID:").concat(this.getUserID())),this.changeCallStatus(ig.CALLING),this.addHandledInviteeList([this.getUserID()]),this.data.groupID=i,this.data.roomID=n,this.data.isGroupCall=!0,this.data.isInviter=!1,this.enterRoom({roomID:n,callType:r}),t.abrupt("return",this.data.pusher);case 17:return t.prev=17,t.t0=t.catch(3),t.next=21,this._resetTUICallEngine();case 21:throw new Error("".concat(RC,".joinInGroupCall failed error: ").concat(t.t0));case 22:case"end":return t.stop()}}),t,this,[[3,17]])}))),function(t){return R.apply(this,arguments)})},{key:"inviteUser",value:(C=c(a().mark((function t(e){var n,r,i,o,s,c,u,l,h=this;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,hC.getInstance().getAlert().check(new nC({api:"inviteUser",attributes:e,initReady:this._initReady,capabilityCode:Dg.PRO,checkMicrophonePermissions:!0,checkCameraPermissions:this.data.config.type===hg.VIDEO}),{tim:this.tim});case 2:if(n=e.userIDList,r=void 0===n?[]:n,this.isGroupCall()){t.next=6;break}throw ZE.error("".concat(RC,".inviteUser - groupID:").concat(this.data.groupID,", roomID:").concat(this.data.roomID,", type:").concat(this.data.callType)),new Error("".concat(RC,".inviteUser - groupID:").concat(this.data.groupID,", roomID:").concat(this.data.roomID,", type:").concat(this.data.callType));case 6:if(this.isInviter()||this.data.callStatus===ig.CONNECTED){t.next=9;break}throw ZE.error("".concat(RC,".inviteUser - current status:").concat(this.data.callStatus," not support")),new Error("".concat(RC,".inviteUser - current status:").concat(this.data.callStatus," not support"));case 9:if(0!==r.length){t.next=12;break}throw ZE.error("".concat(RC,".inviteUser - userIDList is empty")),new Error("".concat(RC,".inviteUser - userIDList is empty"));case 12:if(i=this.getHandledInviteeList(),o=this.getUnHandledInviteeList(),s=[].concat(D(i),D(o)),0!==(c=r.filter((function(t){return-1===s.indexOf(t)}))).length){t.next=19;break}return ZE.error("".concat(RC,".inviteUser failed - userIDList in call list. userIDList:").concat(JSON.stringify(r))),t.abrupt("return",Promise.reject("".concat(RC,".inviteUser failed - userIDList in call list. userIDList:").concat(JSON.stringify(r))));case 19:return r=c,t.prev=20,u=this.data.handledInviteeList.filter((function(t){return t!==h.getUserID()})),t.next=24,this.TSignalingClient.inviteGroup({groupID:this.data.groupID,userIDList:r,type:this.data.invitation.type,roomID:this.data.roomID,timeout:this.data.callTimeout,inCallUserIDs:[].concat(D(this.data.unHandledInviteeList),D(u))});case 24:if(l=t.sent,ZE.log("inviteUser res",l),0!==l.code){t.next=30;break}return this.addUnHandledInviteeList(r),this.addInviterInviteId(l.inviteID,[this.data.config.userID].concat(D(r))),t.abrupt("return",l);case 30:t.next=35;break;case 32:throw t.prev=32,t.t0=t.catch(20),new Error("".concat(RC,".inviteUser failed, userId:").concat(this.getUserID(),", inviteeIdList:").concat(r,", error: ").concat(t.t0));case 35:case"end":return t.stop()}}),t,this,[[20,32]])}))),function(t){return C.apply(this,arguments)})},{key:"accept",value:(b=c(a().mark((function t(){var e=this;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,hC.getInstance().getAlert().check(new nC({api:"accept",initReady:this._initReady,callStatus:this.data.callStatus,checkDevicePermissions:!0}));case 2:return t.abrupt("return",new Promise((function(t,n){ZE.log(RC,"accept() inviteID: ",e.data.invitation.inviteID),e.data.callStatus===ig.CALLING&&(e.data.config.type!==hg.VIDEO||e.data.isGroupCall?e.handleAccept(t,n):wx.createLivePusherContext().stopPreview({success:function(){var r=setTimeout(c(a().mark((function i(){return a().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:clearTimeout(r),e.handleAccept(t,n);case 2:case"end":return i.stop()}}),i)}))),0)}}))})));case 3:case"end":return t.stop()}}),t,this)}))),function(){return b.apply(this,arguments)})},{key:"handleAccept",value:(_=c(a().mark((function t(e,n){var r,i;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._callDataReport.setEnterRoomTime((new Date).getTime()),this.enterRoom({roomID:this.data.invitation.roomID,callType:this.data.config.type}),r=this.data.invitation.inviteID,this.changeCallStatus(ig.CONNECTED),t.next=6,this.TSignalingClient.accept({inviteID:r,type:this.data.config.type});case 6:0===(i=t.sent).code?(ZE.log(RC,"accept OK"),this.addHandledInviteeList([this.getUserID()]),this.deleteUnHandledInviteeList([this.getUserID()]),this.addAcceptedUserList(r,[this.getUserID()]),e({message:i.data.message,pusher:this.data.pusher})):(this.isGroupCall()&&(this._callDataReport.setCodeAndMessage(eT,JSON.stringify(i.data.message)),this._callDataReport.uploadToKibana()),ZE.error(RC,"accept failed",i),n(i));case 8:case"end":return t.stop()}}),t,this)}))),function(t,e){return _.apply(this,arguments)})},{key:"reject",value:(T=c(a().mark((function t(){var e;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,hC.getInstance().getAlert().checkSync(new nC({api:"reject",callStatus:this.data.callStatus,initReady:this._initReady}));case 2:if(!this.data.invitation.inviteID){t.next=11;break}return t.next=5,this.TSignalingClient.reject({inviteID:this.data.invitation.inviteID,type:this.data.config.type});case 5:return e=t.sent,ZE.log(RC,"reject OK",e),this.TRTCCallingDelegate.onCancel({inviteID:this.data.invitation.inviteID,invitee:this.getUserID(),userID:this.getUserID()}),t.next=10,this._resetTUICallEngine();case 10:return t.abrupt("return",e);case 11:return ZE.warn("".concat(RC," 未收到邀请,无法拒绝")),t.abrupt("return","未收到邀请,无法拒绝");case 13:case"end":return t.stop()}}),t,this)}))),function(){return T.apply(this,arguments)})},{key:"hangup",value:(E=c(a().mark((function t(){var e,n,r,i,o,s,c,u,l,h,f,d,p,v,g,y,m,I=this;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,hC.getInstance().getAlert().checkSync(new nC({api:"hangup",callStatus:this.data.callStatus,initReady:this._initReady}));case 2:if(ZE.warn("".concat(RC,". - callStatus:").concat(this.data.callStatus," _inviterInviteID:").concat(JSON.stringify(this.data.invitation))),this.data.callStatus!==ig.IDLE){t.next=5;break}throw new Error("".concat(RC,".hangup failed. current status:").concat(this.data.callStatus));case 5:if(this.data.callStatus!==ig.CALLING||0!==this.getInviterInviteIdList().length){t.next=7;break}throw new Error("".concat(RC,".call/groupCall incomplete。please wait cancel"));case 7:if(e=this.isGroupCall(),n=this.isInviter(),r=this.getUserID(),i=Math.round((Date.now()-this.data.startTalkTime)/1e3),o=this.getCallType(),c=this.getInviterInviteIdList(),this.data.callStatus!==ig.CONNECTED){t.next=28;break}if(t.prev=14,0!==c.length){t.next=21;break}return u=this.isInviter()?dg:pg,l={roomID:this.getRoomID(),callMediaType:o,callRole:u,totalTime:i,callEnd:i,message:"",userID:r},this.TRTCCallingDelegate.onCallEnd(l),t.next=21,this._resetTUICallEngine();case 21:t.next=28;break;case 23:return t.prev=23,t.t0=t.catch(14),t.next=27,this._resetTUICallEngine();case 27:throw new Error(t.t0);case 28:if(h=this.getHandledInviteeList(),f=this.getUnHandledInviteeList(),t.prev=30,e){t.next=48;break}if(!n){t.next=46;break}if(1!==f.length){t.next=42;break}return t.next=36,this.cancel();case 36:return s=t.sent,this.TRTCCallingDelegate.onCancel({inviteID:this.data.invitation.inviteID,invitee:r,userID:r}),t.next=40,this._resetTUICallEngine();case 40:t.next=44;break;case 42:return t.next=44,this._resetTUICallEngine();case 44:t.next=46;break;case 46:t.next=77;break;case 48:if(d=this.getCallStatus(),p={callType:this.getCallType(),isGroupCall:this.isGroupCall(),groupID:this.data.groupID,userIDList:[].concat(D(h.filter((function(t){return t!==r}))),D(f)),callEnd:Math.round((Date.now()-this.data.startTalkTime)/1e3)},!n){t.next=68;break}if(d!==ig.CALLING){t.next=58;break}return t.next=54,this.cancel(this.getInviterInviteIdList());case 54:return s=t.sent,this.TRTCCallingDelegate.onCancel({inviteID:this.data.invitation.inviteID,invitee:r,userID:r}),t.next=58,this._resetTUICallEngine();case 58:if(d!==ig.CONNECTED){t.next=66;break}v=a().mark((function t(){var e,n,i,o,u,l;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=c[g],n=I.getInviterInviteIdUserList(e),!((i=I.getAcceptedUserList(e)).length>0)){t.next=12;break}return o=i.filter((function(t){return-1!==h.indexOf(t)})),u=n.filter((function(t){return-1!==f.indexOf(t)})),p.userIDList=[].concat(D(o),D(u)).filter((function(t){return t!==r})),ZE.warn("inviter emit hangup signal, notify userIDList:".concat(JSON.stringify(p.userIDList))),t.next=9,I.TSignalingClient.hangup(p);case 9:s=t.sent,t.next=19;break;case 12:if(l=I.getUnHandledInviteeList(),!(n.filter((function(t){return-1!==l.indexOf(t)})).length>0)){t.next=19;break}return ZE.warn("inviter emit cancel signal, userIdList:".concat(n)),t.next=18,I.cancel([e]);case 18:s=t.sent;case 19:case"end":return t.stop()}}),t)})),g=0;case 61:if(!(g0)){t.next=12;break}return o=i.filter((function(t){return-1!==h.indexOf(t)})),u=n.filter((function(t){return-1!==f.indexOf(t)})),p.userIDList=[].concat(D(o),D(u)).filter((function(t){return t!==r})),ZE.warn("invitee emit hangup signal, notify userIDList:".concat(JSON.stringify(p.userIDList))),t.next=9,I.TSignalingClient.hangup(p);case 9:s=t.sent,t.next=19;break;case 12:if(l=I.getUnHandledInviteeList(),!(n.filter((function(t){return-1!==l.indexOf(t)})).length>0)){t.next=19;break}return ZE.warn("invitee emit cancel signal, inviteID:".concat(e)),t.next=18,I.cancel([e]);case 18:s=t.sent;case 19:case"end":return t.stop()}}),t)})),m=0;case 70:if(!(m=3600?(r=parseInt(o/3600)<10?"0".concat(parseInt(o/3600)):parseInt(o/3600),i=parseInt(o%60/60)<10?"0".concat(parseInt(o%60/60)):parseInt(o%60/60),(a=o%3600<10?"0".concat(o%3600):o%3600)>60&&(i=parseInt(a/60)<10?"0".concat(parseInt(a/60)):parseInt(a/60),a=a%60<10?"0".concat(a%60):a%60),n="".concat(r,":").concat(i,":").concat(a)):o>=60&&o<3600?(i=parseInt(o/60)<10?"0".concat(parseInt(o/60)):parseInt(o/60),a=o%60<10?"0".concat(o%60):o%60,n="00:".concat(i,":").concat(a)):o<60&&(a=o<10?"0".concat(o):o,n="00:00:".concat(a)),n),e.data.chatTimeNum+=1,e.data.pusher.chatTime=e.data.chatTime,e.data.pusher.chatTimeNum=e.data.chatTimeNum,e.TRTCCallingDelegate.onUserUpdate({pusher:e.data.pusher,playerList:e.data.playerList})}),1e3);break;case ig.IDLE:clearInterval(this.data.timer),this.data.timer=null,this.data.chatTime="00:00:00",this.data.chatTimeNum=0}}},{key:"_resetTUICallEngine",value:(m=c(a().mark((function t(e,n){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(ZE.log(RC," _resetTUICallEngine()",this.data.enterRoomStatus),!this.data.enterRoomStatus){t.next=4;break}return t.next=4,this.exitRoom(e,n);case 4:this.changeCallStatus(ig.IDLE),this.data.config.type=hg.AUDIO,this.initData();case 7:case"end":return t.stop()}}),t,this)}))),function(t,e){return m.apply(this,arguments)})},{key:"startRemoteView",value:(y=c(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.data.playerList.forEach((function(t){if(t.userID===e)return t.muteVideo=!1,void ZE.log("".concat(RC,", startRemoteView(").concat(e,")"))}));case 1:case"end":return t.stop()}}),t,this)}))),function(t){return y.apply(this,arguments)})},{key:"stopRemoteView",value:function(t){this.data.playerList.forEach((function(e){if(e.userID===t)return e.muteVideo=!0,void ZE.log("".concat(RC,", stopRemoteView(").concat(t,")"))}))}},{key:"openCamera",value:function(){hC.getInstance().getAlert().checkSync(new nC({api:"openCamera",callStatus:this.data.callStatus,initReady:this._initReady})),this.data.pusher.enableCamera||this._pusherVideoHandler(),ZE.log("".concat(RC,", openCamera() pusher: ").concat(this.data.pusher))}},{key:"closeCamera",value:function(){hC.getInstance().getAlert().checkSync(new nC({api:"closeCamera",callStatus:this.data.callStatus,initReady:this._initReady})),this.data.pusher.enableCamera&&this._pusherVideoHandler(),ZE.log("".concat(RC,", closeCamera() pusher: ").concat(this.data.pusher))}},{key:"switchCamera",value:function(){if(hC.getInstance().getAlert().checkSync(new nC({api:"switchCamera",callStatus:this.data.callStatus,initReady:this._initReady})),this.data.callStatus!==ig.CONNECTED){var t="front"===this.data.pusher.frontCamera?"back":"front";this.setPusherAttributesHandler({frontCamera:t}),wx.createLivePusherContext().switchCamera()}else this.TRTC.getPusherInstance().switchCamera();ZE.log("".concat(RC,", switchCamera(), frontCamera").concat(this.data.pusher.frontCamera))}},{key:"openMicrophone",value:function(){hC.getInstance().getAlert().checkSync(new nC({api:"openMicrophone",callStatus:this.data.callStatus,initReady:this._initReady})),this.data.pusher.enableMic||this._pusherAudioHandler(),ZE.log("".concat(RC,", openMicrophone() pusher: ").concat(this.data.pusher))}},{key:"closeMicrophone",value:function(){hC.getInstance().getAlert().checkSync(new nC({api:"closeMicrophone",callStatus:this.data.callStatus,initReady:this._initReady})),this.data.pusher.enableMic&&this._pusherAudioHandler(),ZE.log("".concat(RC,", closeMicrophone() pusher: ").concat(this.data.pusher))}},{key:"selectAudioPlaybackDevice",value:function(t){hC.getInstance().getAlert().checkSync(new nC({api:"selectAudioPlaybackDevice",callStatus:this.data.callStatus,attributes:{type:t},initReady:this._initReady}));var e=!1;switch(t){case"speaker":e=!0;break;case"ear":e=!1}return this.setHandsFree(e)}},{key:"setHandsFree",value:function(t){return this.data.soundMode=t?"speaker":"ear",ZE.log("".concat(RC,", setHandsFree() result: ").concat(this.data.soundMode)),this.data.soundMode}},{key:"switchAudioCall",value:(g=c(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.isGroupCall()){t.next=3;break}return ZE.warn("".concat(RC,".switchToAudioCall is not applicable to groupCall.")),t.abrupt("return");case 3:if(this.data.invitation.type!==hg.AUDIO){t.next=6;break}return ZE.warn("".concat(RC," Now the call mode is audio call.")),t.abrupt("return");case 6:if(this.data.switchCallModeStatus){t.next=9;break}return ZE.warn("".concat(RC," audio and video call switching.")),t.abrupt("return");case 9:return this.setSwitchCallModeStatus(!1),this.setPusherAttributesHandler({enableCamera:!1}),t.abrupt("return",this.TSignalingClient.switchCallMode({userID:this.data.unHandledInviteeList[0]||this.data.playerList[0].userID,callType:this.data.invitation.type,roomID:this.data.invitation.roomID,mode:Ig}));case 12:case"end":return t.stop()}}),t,this)}))),function(){return g.apply(this,arguments)})},{key:"switchCallMediaType",value:(v=c(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,hC.getInstance().getAlert().check(new nC({api:"switchCallMediaType",attributes:{type:e},callStatus:this.data.callStatus,initReady:this._initReady}));case 2:if(!this.isGroupCall()){t.next=5;break}return ZE.warn("".concat(RC,".switchToAudioCall is not applicable to groupCall.")),t.abrupt("return");case 5:if(this.data.switchCallModeStatus){t.next=8;break}return ZE.warn("".concat(RC," audio and video call switching.")),t.abrupt("return");case 8:t.t0=e,t.next=t.t0===hg.AUDIO?11:t.t0===hg.VIDEO?14:16;break;case 11:return this.setSwitchCallModeStatus(!1),this.setPusherAttributesHandler({enableCamera:!1}),t.abrupt("return",this.TSignalingClient.switchCallMode({userID:this.data.unHandledInviteeList[0]||this.data.playerList[0].userID,callType:this.data.invitation.type,roomID:this.data.invitation.roomID,mode:Ig}));case 14:throw ZE.warn("".concat(RC," Audio switching Video is not supported yet")),new Error("".concat(RC," Audio switching Video is not supported yet"));case 16:case"end":return t.stop()}}),t,this)}))),function(t){return v.apply(this,arguments)})},{key:"setSwitchCallModeStatus",value:function(t){this.data.switchCallModeStatus=t}},{key:"switchVideoCall",value:(p=c(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.isGroupCall()){t.next=3;break}return ZE.warn("".concat(RC,".switchToVideoCall is not applicable to groupCall.")),t.abrupt("return");case 3:if(this.data.invitation.type!==hg.VIDEO){t.next=6;break}return ZE.warn("".concat(RC," Now the call mode is video call.")),t.abrupt("return");case 6:if(this.data.switchCallModeStatus){t.next=9;break}return ZE.warn("".concat(RC," audio and video call switching.")),t.abrupt("return");case 9:return this.setSwitchCallModeStatus(!1),this.setPusherAttributesHandler({enableCamera:!0}),t.abrupt("return",this.TSignalingClient.switchCallMode({userID:this.data.playerList[0].userID,callType:this.data.invitation.type,roomID:this.data.invitation.roomID,mode:Eg}));case 12:case"end":return t.stop()}}),t,this)}))),function(){return p.apply(this,arguments)})},{key:"setSoundMode",value:function(t){var e=!1,n=!1;switch(t||(n=!0,t=this.data.soundMode),t){case"speaker":e=!0;break;case"ear":e=!1}return this.setHandsFree(n?!e:e)}},{key:"_hangUp",value:function(){this.hangup()}},{key:"_pusherStateChangeHandler",value:function(t){this.TRTC.pusherEventHandler(t)}},{key:"_playerStateChange",value:function(t){this._emitter.emit(rg.REMOTE_STATE_UPDATE,t)}},{key:"_playerAudioVolumeNotify",value:function(t){this.data.playerList.length>0&&this.TRTC.playerAudioVolumeNotify(t)}},{key:"_pusherAudioVolumeNotify",value:function(t){this.TRTC.pusherAudioVolumeNotify(t)}},{key:"_updateUserProfile",value:function(t,e){return 0===e.length||0===t.length?e:e.map((function(e){var n=e,r=t.filter((function(t){return t.userID===e.userID}));return n.avatar=r[0]&&r[0].avatar?r[0].avatar:"",n.nick=r[0]&&r[0].nick?r[0].nick:"",n}))}},{key:"_getUserProfile",value:function(t){var e=this;this.tim.getUserProfile({userIDList:t}).then((function(t){ZE.log("getUserProfile success",t),ZE.log(t.data),e.data.remoteUsers=t.data})).catch((function(t){ZE.warn("getUserProfile error:",t)}))}},{key:"getUserProfile",value:(d=c(a().mark((function t(e){var n,r,i,o,s=arguments;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=s.length>1&&void 0!==s[1]?s[1]:"array",0!==e.length){t.next=3;break}return t.abrupt("return",[]);case 3:return r=e.map((function(t){return t.userID})),t.next=6,this.tim.getUserProfile({userIDList:r});case 6:i=t.sent,o=null,t.t0=n,t.next="array"===t.t0?11:"map"===t.t0?13:16;break;case 11:return o=e.map((function(t,e){return t.avatar=i.data[e].avatar,t.nick=i.data[e].nick,t})),t.abrupt("break",16);case 13:return o={},e.forEach((function(t,e){t.avatar=i.data[e].avatar,t.nick=i.data[e].nick,o[t.userID]=t})),t.abrupt("break",16);case 16:return t.abrupt("return",o);case 17:case"end":return t.stop()}}),t,this)}))),function(t){return d.apply(this,arguments)})},{key:"setSelfInfo",value:function(t,e){return hC.getInstance().getAlert().checkSync(new nC({api:"setSelfInfo",attributes:{nickName:t,avatar:e},initReady:this._initReady})),this.tim.updateMyProfile({nick:t,avatar:e})}},{key:"_pusherNetStatus",value:function(t){this.TRTC.pusherNetStatusHandler(t)}},{key:"_playNetStatus",value:function(t){this.TRTC.playerNetStatus(t)}},{key:"_toggleViewSize",value:function(t){var e=t.currentTarget.dataset.screen;return ZE.log("get screen",e,t),1===this.data.playerList.length&&e!==this.data.screen&&this.data.invitation.type===hg.VIDEO&&(this.data.screen=e),this.data.screen}},{key:"getTim",value:function(){return this.tim}},{key:"_setInterfaceUpLoad",value:function(t){return ZE.time(t),new rT(t)}},{key:"destroyed",value:(l=c(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.data.callStatus!==ig.CALLING&&this.data.callStatus!==ig.CONNECTED||(this.isInviter()?this.hangup():this.reject()),this._resetTUICallEngine(),this._removeTSignalingEvent(),this._removeTRTCEvent(),this._timExternal){t.next=7;break}return t.next=7,this.logout();case 7:this._initReady=!1;case 8:case"end":return t.stop()}}),t,this)}))),function(){return l.apply(this,arguments)})},{key:"checkDevicePermissions",value:(s=c(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise(function(){var t=c(a().mark((function t(e,n){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:wx.getSetting&&wx.getSetting()||e(),wx.authorize({scope:"scope.record"}),wx.authorize({scope:"scope.camera"}),wx.getSetting().then((function(t){ZE.log("getSetting",t),t.authSetting["scope.camera"]&&t.authSetting["scope.record"]?e():n("camera or record not authorized")}));case 4:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()));case 1:case"end":return t.stop()}}),t)}))),function(){return s.apply(this,arguments)})},{key:"callExperimentalAPI",value:(o=c(a().mark((function t(e){var n=this;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise(function(){var t=c(a().mark((function t(r,i){var o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,n.tim.callExperimentalAPI("isCommercialAbilityEnabled",e);case 3:(o=t.sent).data.enabled?r(o):i("The package you purchased does not support this ability"),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),2905===t.t0.code?i("tim version is too old, Please upgrade version >= 2.20.1"):i("The package you purchased does not support this ability");case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,n){return t.apply(this,arguments)}}()));case 1:case"end":return t.stop()}}),t)}))),function(t){return o.apply(this,arguments)})}],[{key:"createInstance",value:function(t){return hC.getInstance().getAlert().checkSync(new nC({api:"createInstance",attributes:t})),r.instance||(r.instance=new r(t)),r.instance.initData(),r.instance}}]),r}();f(SC,"instance",null),f(SC,"AUDIO_PLAYBACK_DEVICE",Tg),f(SC,"MEDIA_TYPE",hg),f(SC,"EVENT",rg),f(SC,"STATUS",ig);export{Tg as AUDIO_PLAYBACK_DEVICE,rg as EVENT,hg as MEDIA_TYPE,ig as STATUS,SC as TUICallEngine,SC as default};