10 lines
232 KiB
JavaScript
10 lines
232 KiB
JavaScript
import t from"trtc-wx-sdk";import*as e from"@tencentcloud/chat";function n(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 r(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){f(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function i(){i=function(){return e};var t,e={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(t,e,n){t[e]=n.value},o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",c=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag";function u(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,n){return t[e]=n}}function h(t,e,n,r){var i=e&&e.prototype instanceof I?e:I,o=Object.create(i.prototype),s=new k(r||[]);return a(o,"_invoke",{value:w(t,n,s)}),o}function f(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var d="suspendedStart",p="suspendedYield",v="executing",g="completed",y={};function I(){}function m(){}function _(){}var E={};u(E,s,(function(){return this}));var T=Object.getPrototypeOf,C=T&&T(T(O([])));C&&C!==n&&r.call(C,s)&&(E=C);var b=_.prototype=I.prototype=Object.create(E);function D(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function R(t,e){function n(i,a,o,s){var c=f(t[i],t,a);if("throw"!==c.type){var l=c.arg,u=l.value;return u&&"object"==typeof u&&r.call(u,"__await")?e.resolve(u.__await).then((function(t){n("next",t,o,s)}),(function(t){n("throw",t,o,s)})):e.resolve(u).then((function(t){l.value=t,o(l)}),(function(t){return n("throw",t,o,s)}))}s(c.arg)}var i;a(this,"_invoke",{value:function(t,r){function a(){return new e((function(e,i){n(t,r,e,i)}))}return i=i?i.then(a,a):a()}})}function w(e,n,r){var i=d;return function(a,o){if(i===v)throw new Error("Generator is already running");if(i===g){if("throw"===a)throw o;return{value:t,done:!0}}for(r.method=a,r.arg=o;;){var s=r.delegate;if(s){var c=S(s,r);if(c){if(c===y)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=g,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=v;var l=f(e,n,r);if("normal"===l.type){if(i=r.done?g:p,l.arg===y)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(i=g,r.method="throw",r.arg=l.arg)}}}function S(e,n){var r=n.method,i=e.iterator[r];if(i===t)return n.delegate=null,"throw"===r&&e.iterator.return&&(n.method="return",n.arg=t,S(e,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var a=f(i,e.iterator,n.arg);if("throw"===a.type)return n.method="throw",n.arg=a.arg,n.delegate=null,y;var o=a.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,y):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function O(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function n(){for(;++i<e.length;)if(r.call(e,i))return n.value=e[i],n.done=!1,n;return n.value=t,n.done=!0,n};return a.next=a}}throw new TypeError(typeof e+" is not iterable")}return m.prototype=_,a(b,"constructor",{value:_,configurable:!0}),a(_,"constructor",{value:m,configurable:!0}),m.displayName=u(_,l,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===m||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,u(t,l,"GeneratorFunction")),t.prototype=Object.create(b),t},e.awrap=function(t){return{__await:t}},D(R.prototype),u(R.prototype,c,(function(){return this})),e.AsyncIterator=R,e.async=function(t,n,r,i,a){void 0===a&&(a=Promise);var o=new R(h(t,n,r,i),a);return e.isGeneratorFunction(n)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},D(b),u(b,l,"Generator"),u(b,s,(function(){return this})),u(b,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},e.values=O,k.prototype={constructor:k,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(L),!e)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var n=this;function i(r,i){return s.type="throw",s.arg=e,n.next=r,i&&(n.method="next",n.arg=t),!!i}for(var a=this.tryEntries.length-1;a>=0;--a){var o=this.tryEntries[a],s=o.completion;if("root"===o.tryLoc)return i("end");if(o.tryLoc<=this.prev){var c=r.call(o,"catchLoc"),l=r.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return i(o.catchLoc,!0);if(this.prev<o.finallyLoc)return i(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return i(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return i(o.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var a=i;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var o=a?a.completion:{};return o.type=t,o.arg=e,a?(this.method="next",this.next=a.finallyLoc,y):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),L(n),y}},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;L(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,r){return this.delegate={iterator:O(e),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=t),y}},e}function a(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var r=n.call(t,e||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}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 l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,a(r.key),r)}}function h(t,e,n){return e&&u(t.prototype,e),n&&u(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function f(t,e,n){return(e=a(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function d(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e)}function p(t){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},p(t)}function v(t,e){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},v(t,e)}function g(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function y(t,e,n){return y=g()?Reflect.construct.bind():function(t,e,n){var r=[null];r.push.apply(r,e);var i=new(Function.bind.apply(t,r));return n&&v(i,n.prototype),i},y.apply(null,arguments)}function I(t){var e="function"==typeof Map?new Map:void 0;return I=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return y(t,arguments,p(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),v(n,t)},I(t)}function m(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n,r,i={},a=Object.keys(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(r=0;r<a.length;r++)n=a[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function _(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function E(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 _(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 E(this,n)}}function C(t){return function(t){if(Array.isArray(t))return b(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 b(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 b(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 b(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function D(t,e){return function(t,e){if(e.get)return e.get.call(t);return e.value}(t,w(t,e,"get"))}function R(t,e,n){return function(t,e,n){if(e.set)e.set.call(t,n);else{if(!e.writable)throw new TypeError("attempted to set read only private field");e.value=n}}(t,w(t,e,"set"),n),n}function w(t,e,n){if(!e.has(t))throw new TypeError("attempted to "+n+" private field on non-instance");return e.get(t)}function S(t,e,n){!function(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}(t,e),e.set(t,n)}var x="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function L(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var k=function(t){return t&&t.Math===Math&&t},O=k("object"==typeof globalThis&&globalThis)||k("object"==typeof window&&window)||k("object"==typeof self&&self)||k("object"==typeof x&&x)||k("object"==typeof x&&x)||function(){return this}()||Function("return this")(),A={},N=function(t){try{return!!t()}catch(t){return!0}},U=!N((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),P=!N((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})),M=P,j=Function.prototype.call,V=M?j.bind(j):function(){return j.apply(j,arguments)},G={},H={}.propertyIsEnumerable,B=Object.getOwnPropertyDescriptor,F=B&&!H.call({1:2},1);G.f=F?function(t){var e=B(this,t);return!!e&&e.enumerable}:H;var K,z,J=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},W=P,q=Function.prototype,Y=q.call,$=W&&q.bind.bind(Y,Y),X=W?$:function(t){return function(){return Y.apply(t,arguments)}},Q=X,Z=Q({}.toString),tt=Q("".slice),et=function(t){return tt(Z(t),8,-1)},nt=N,rt=et,it=Object,at=X("".split),ot=nt((function(){return!it("z").propertyIsEnumerable(0)}))?function(t){return"String"===rt(t)?at(t,""):it(t)}:it,st=function(t){return null==t},ct=st,lt=TypeError,ut=function(t){if(ct(t))throw new lt("Can't call method on "+t);return t},ht=ot,ft=ut,dt=function(t){return ht(ft(t))},pt="object"==typeof document&&document.all,vt=void 0===pt&&void 0!==pt?function(t){return"function"==typeof t||t===pt}:function(t){return"function"==typeof t},gt=vt,yt=function(t){return"object"==typeof t?null!==t:gt(t)},It=O,mt=vt,_t=function(t,e){return arguments.length<2?(n=It[t],mt(n)?n:void 0):It[t]&&It[t][e];var n},Et=X({}.isPrototypeOf),Tt="undefined"!=typeof navigator&&String(navigator.userAgent)||"",Ct=O,bt=Tt,Dt=Ct.process,Rt=Ct.Deno,wt=Dt&&Dt.versions||Rt&&Rt.version,St=wt&&wt.v8;St&&(z=(K=St.split("."))[0]>0&&K[0]<4?1:+(K[0]+K[1])),!z&&bt&&(!(K=bt.match(/Edge\/(\d+)/))||K[1]>=74)&&(K=bt.match(/Chrome\/(\d+)/))&&(z=+K[1]);var xt=z,Lt=xt,kt=N,Ot=O.String,At=!!Object.getOwnPropertySymbols&&!kt((function(){var t=Symbol("symbol detection");return!Ot(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&Lt&&Lt<41})),Nt=At&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Ut=_t,Pt=vt,Mt=Et,jt=Object,Vt=Nt?function(t){return"symbol"==typeof t}:function(t){var e=Ut("Symbol");return Pt(e)&&Mt(e.prototype,jt(t))},Gt=String,Ht=function(t){try{return Gt(t)}catch(t){return"Object"}},Bt=vt,Ft=Ht,Kt=TypeError,zt=function(t){if(Bt(t))return t;throw new Kt(Ft(t)+" is not a function")},Jt=zt,Wt=st,qt=function(t,e){var n=t[e];return Wt(n)?void 0:Jt(n)},Yt=V,$t=vt,Xt=yt,Qt=TypeError,Zt={exports:{}},te=O,ee=Object.defineProperty,ne=function(t,e){try{ee(te,t,{value:e,configurable:!0,writable:!0})}catch(n){te[t]=e}return e},re=ne,ie="__core-js_shared__",ae=O[ie]||re(ie,{}),oe=ae;(Zt.exports=function(t,e){return oe[t]||(oe[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.35.0",mode:"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.35.0/LICENSE",source:"https://github.com/zloirock/core-js"});var se=ut,ce=Object,le=function(t){return ce(se(t))},ue=le,he=X({}.hasOwnProperty),fe=Object.hasOwn||function(t,e){return he(ue(t),e)},de=X,pe=0,ve=Math.random(),ge=de(1..toString),ye=function(t){return"Symbol("+(void 0===t?"":t)+")_"+ge(++pe+ve,36)},Ie=O,me=Zt.exports,_e=fe,Ee=ye,Te=At,Ce=Nt,be=Ie.Symbol,De=me("wks"),Re=Ce?be.for||be:be&&be.withoutSetter||Ee,we=function(t){return _e(De,t)||(De[t]=Te&&_e(be,t)?be[t]:Re("Symbol."+t)),De[t]},Se=V,xe=yt,Le=Vt,ke=qt,Oe=function(t,e){var n,r;if("string"===e&&$t(n=t.toString)&&!Xt(r=Yt(n,t)))return r;if($t(n=t.valueOf)&&!Xt(r=Yt(n,t)))return r;if("string"!==e&&$t(n=t.toString)&&!Xt(r=Yt(n,t)))return r;throw new Qt("Can't convert object to primitive value")},Ae=TypeError,Ne=we("toPrimitive"),Ue=function(t,e){if(!xe(t)||Le(t))return t;var n,r=ke(t,Ne);if(r){if(void 0===e&&(e="default"),n=Se(r,t,e),!xe(n)||Le(n))return n;throw new Ae("Can't convert object to primitive value")}return void 0===e&&(e="number"),Oe(t,e)},Pe=Ue,Me=Vt,je=function(t){var e=Pe(t,"string");return Me(e)?e:e+""},Ve=yt,Ge=O.document,He=Ve(Ge)&&Ve(Ge.createElement),Be=function(t){return He?Ge.createElement(t):{}},Fe=Be,Ke=!U&&!N((function(){return 7!==Object.defineProperty(Fe("div"),"a",{get:function(){return 7}}).a})),ze=U,Je=V,We=G,qe=J,Ye=dt,$e=je,Xe=fe,Qe=Ke,Ze=Object.getOwnPropertyDescriptor;A.f=ze?Ze:function(t,e){if(t=Ye(t),e=$e(e),Qe)try{return Ze(t,e)}catch(t){}if(Xe(t,e))return qe(!Je(We.f,t,e),t[e])};var tn={},en=U&&N((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),nn=yt,rn=String,an=TypeError,on=function(t){if(nn(t))return t;throw new an(rn(t)+" is not an object")},sn=U,cn=Ke,ln=en,un=on,hn=je,fn=TypeError,dn=Object.defineProperty,pn=Object.getOwnPropertyDescriptor,vn="enumerable",gn="configurable",yn="writable";tn.f=sn?ln?function(t,e,n){if(un(t),e=hn(e),un(n),"function"==typeof t&&"prototype"===e&&"value"in n&&yn in n&&!n[yn]){var r=pn(t,e);r&&r[yn]&&(t[e]=n.value,n={configurable:gn in n?n[gn]:r[gn],enumerable:vn in n?n[vn]:r[vn],writable:!1})}return dn(t,e,n)}:dn:function(t,e,n){if(un(t),e=hn(e),un(n),cn)try{return dn(t,e,n)}catch(t){}if("get"in n||"set"in n)throw new fn("Accessors not supported");return"value"in n&&(t[e]=n.value),t};var In=tn,mn=J,_n=U?function(t,e,n){return In.f(t,e,mn(1,n))}:function(t,e,n){return t[e]=n,t},En={exports:{}},Tn=U,Cn=fe,bn=Function.prototype,Dn=Tn&&Object.getOwnPropertyDescriptor,Rn=Cn(bn,"name"),wn={EXISTS:Rn,PROPER:Rn&&"something"===function(){}.name,CONFIGURABLE:Rn&&(!Tn||Tn&&Dn(bn,"name").configurable)},Sn=vt,xn=ae,Ln=X(Function.toString);Sn(xn.inspectSource)||(xn.inspectSource=function(t){return Ln(t)});var kn,On,An,Nn=xn.inspectSource,Un=vt,Pn=O.WeakMap,Mn=Un(Pn)&&/native code/.test(String(Pn)),jn=Zt.exports,Vn=ye,Gn=jn("keys"),Hn=function(t){return Gn[t]||(Gn[t]=Vn(t))},Bn={},Fn=Mn,Kn=O,zn=yt,Jn=_n,Wn=fe,qn=ae,Yn=Hn,$n=Bn,Xn="Object already initialized",Qn=Kn.TypeError,Zn=Kn.WeakMap;if(Fn||qn.state){var tr=qn.state||(qn.state=new Zn);tr.get=tr.get,tr.has=tr.has,tr.set=tr.set,kn=function(t,e){if(tr.has(t))throw new Qn(Xn);return e.facade=t,tr.set(t,e),e},On=function(t){return tr.get(t)||{}},An=function(t){return tr.has(t)}}else{var er=Yn("state");$n[er]=!0,kn=function(t,e){if(Wn(t,er))throw new Qn(Xn);return e.facade=t,Jn(t,er,e),e},On=function(t){return Wn(t,er)?t[er]:{}},An=function(t){return Wn(t,er)}}var nr={set:kn,get:On,has:An,enforce:function(t){return An(t)?On(t):kn(t,{})},getterFor:function(t){return function(e){var n;if(!zn(e)||(n=On(e)).type!==t)throw new Qn("Incompatible receiver, "+t+" required");return n}}},rr=X,ir=N,ar=vt,or=fe,sr=U,cr=wn.CONFIGURABLE,lr=Nn,ur=nr.enforce,hr=nr.get,fr=String,dr=Object.defineProperty,pr=rr("".slice),vr=rr("".replace),gr=rr([].join),yr=sr&&!ir((function(){return 8!==dr((function(){}),"length",{value:8}).length})),Ir=String(String).split("String"),mr=En.exports=function(t,e,n){"Symbol("===pr(fr(e),0,7)&&(e="["+vr(fr(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!or(t,"name")||cr&&t.name!==e)&&(sr?dr(t,"name",{value:e,configurable:!0}):t.name=e),yr&&n&&or(n,"arity")&&t.length!==n.arity&&dr(t,"length",{value:n.arity});try{n&&or(n,"constructor")&&n.constructor?sr&&dr(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var r=ur(t);return or(r,"source")||(r.source=gr(Ir,"string"==typeof e?e:"")),t};Function.prototype.toString=mr((function(){return ar(this)&&hr(this).source||lr(this)}),"toString");var _r=vt,Er=tn,Tr=En.exports,Cr=ne,br=function(t,e,n,r){r||(r={});var i=r.enumerable,a=void 0!==r.name?r.name:e;if(_r(n)&&Tr(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:Er.f(t,e,{value:n,enumerable:!1,configurable:!r.nonConfigurable,writable:!r.nonWritable})}return t},Dr={},Rr=Math.ceil,wr=Math.floor,Sr=Math.trunc||function(t){var e=+t;return(e>0?wr:Rr)(e)},xr=function(t){var e=+t;return e!=e||0===e?0:Sr(e)},Lr=xr,kr=Math.max,Or=Math.min,Ar=function(t,e){var n=Lr(t);return n<0?kr(n+e,0):Or(n,e)},Nr=xr,Ur=Math.min,Pr=function(t){return t>0?Ur(Nr(t),9007199254740991):0},Mr=Pr,jr=function(t){return Mr(t.length)},Vr=dt,Gr=Ar,Hr=jr,Br=function(t){return function(e,n,r){var i,a=Vr(e),o=Hr(a),s=Gr(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}},Fr={includes:Br(!0),indexOf:Br(!1)},Kr=fe,zr=dt,Jr=Fr.indexOf,Wr=Bn,qr=X([].push),Yr=function(t,e){var n,r=zr(t),i=0,a=[];for(n in r)!Kr(Wr,n)&&Kr(r,n)&&qr(a,n);for(;e.length>i;)Kr(r,n=e[i++])&&(~Jr(a,n)||qr(a,n));return a},$r=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Xr=Yr,Qr=$r.concat("length","prototype");Dr.f=Object.getOwnPropertyNames||function(t){return Xr(t,Qr)};var Zr={};Zr.f=Object.getOwnPropertySymbols;var ti=_t,ei=Dr,ni=Zr,ri=on,ii=X([].concat),ai=ti("Reflect","ownKeys")||function(t){var e=ei.f(ri(t)),n=ni.f;return n?ii(e,n(t)):e},oi=fe,si=ai,ci=A,li=tn,ui=N,hi=vt,fi=/#|\.prototype\./,di=function(t,e){var n=vi[pi(t)];return n===yi||n!==gi&&(hi(e)?ui(e):!!e)},pi=di.normalize=function(t){return String(t).replace(fi,".").toLowerCase()},vi=di.data={},gi=di.NATIVE="N",yi=di.POLYFILL="P",Ii=di,mi=O,_i=A.f,Ei=_n,Ti=br,Ci=ne,bi=function(t,e,n){for(var r=si(e),i=li.f,a=ci.f,o=0;o<r.length;o++){var s=r[o];oi(t,s)||n&&oi(n,s)||i(t,s,a(e,s))}},Di=Ii,Ri=function(t,e){var n,r,i,a,o,s=t.target,c=t.global,l=t.stat;if(n=c?mi:l?mi[s]||Ci(s,{}):(mi[s]||{}).prototype)for(r in e){if(a=e[r],i=t.dontCallGetSet?(o=_i(n,r))&&o.value:n[r],!Di(c?r:s+(l?".":"#")+r,t.forced)&&void 0!==i){if(typeof a==typeof i)continue;bi(a,i)}(t.sham||i&&i.sham)&&Ei(a,"sham",!0),Ti(n,r,a,t)}},wi=et,Si=Array.isArray||function(t){return"Array"===wi(t)},xi=TypeError,Li=function(t){if(t>9007199254740991)throw xi("Maximum allowed index exceeded");return t},ki=je,Oi=tn,Ai=J,Ni=function(t,e,n){var r=ki(e);r in t?Oi.f(t,r,Ai(0,n)):t[r]=n},Ui={};Ui[we("toStringTag")]="z";var Pi="[object z]"===String(Ui),Mi=Pi,ji=vt,Vi=et,Gi=we("toStringTag"),Hi=Object,Bi="Arguments"===Vi(function(){return arguments}()),Fi=Mi?Vi: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=Hi(t),Gi))?n:Bi?Vi(e):"Object"===(r=Vi(e))&&ji(e.callee)?"Arguments":r},Ki=X,zi=N,Ji=vt,Wi=Fi,qi=Nn,Yi=function(){},$i=[],Xi=_t("Reflect","construct"),Qi=/^\s*(?:class|function)\b/,Zi=Ki(Qi.exec),ta=!Qi.test(Yi),ea=function(t){if(!Ji(t))return!1;try{return Xi(Yi,$i,t),!0}catch(t){return!1}},na=function(t){if(!Ji(t))return!1;switch(Wi(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ta||!!Zi(Qi,qi(t))}catch(t){return!0}};na.sham=!0;var ra=!Xi||zi((function(){var t;return ea(ea.call)||!ea(Object)||!ea((function(){t=!0}))||t}))?na:ea,ia=Si,aa=ra,oa=yt,sa=we("species"),ca=Array,la=function(t){var e;return ia(t)&&(e=t.constructor,(aa(e)&&(e===ca||ia(e.prototype))||oa(e)&&null===(e=e[sa]))&&(e=void 0)),void 0===e?ca:e},ua=function(t,e){return new(la(t))(0===e?0:e)},ha=N,fa=xt,da=we("species"),pa=function(t){return fa>=51||!ha((function(){var e=[];return(e.constructor={})[da]=function(){return{foo:1}},1!==e[t](Boolean).foo}))},va=Ri,ga=N,ya=Si,Ia=yt,ma=le,_a=jr,Ea=Li,Ta=Ni,Ca=ua,ba=pa,Da=xt,Ra=we("isConcatSpreadable"),wa=Da>=51||!ga((function(){var t=[];return t[Ra]=!1,t.concat()[0]!==t})),Sa=function(t){if(!Ia(t))return!1;var e=t[Ra];return void 0!==e?!!e:ya(t)};va({target:"Array",proto:!0,arity:1,forced:!wa||!ba("concat")},{concat:function(t){var e,n,r,i,a,o=ma(this),s=Ca(o,0),c=0;for(e=-1,r=arguments.length;e<r;e++)if(Sa(a=-1===e?o:arguments[e]))for(i=_a(a),Ea(c+i),n=0;n<i;n++,c++)n in a&&Ta(s,c,a[n]);else Ea(c+1),Ta(s,c++,a);return s.length=c,s}});var xa=X,La=br,ka=Date.prototype,Oa="Invalid Date",Aa="toString",Na=xa(ka[Aa]),Ua=xa(ka.getTime);String(new Date(NaN))!==Oa&&La(ka,Aa,(function(){var t=Ua(this);return t==t?Na(this):Oa}));var Pa=Yr,Ma=$r,ja=Object.keys||function(t){return Pa(t,Ma)},Va=le,Ga=ja;Ri({target:"Object",stat:!0,forced:N((function(){Ga(1)}))},{keys:function(t){return Ga(Va(t))}});var Ha=et,Ba=X,Fa=function(t){if("Function"===Ha(t))return Ba(t)},Ka=N,za=function(t,e){var n=[][t];return!!n&&Ka((function(){n.call(null,e||function(){return 1},1)}))},Ja=Ri,Wa=Fr.indexOf,qa=za,Ya=Fa([].indexOf),$a=!!Ya&&1/Ya([1],1,-0)<0;Ja({target:"Array",proto:!0,forced:$a||!qa("indexOf")},{indexOf:function(t){var e=arguments.length>1?arguments[1]:void 0;return $a?Ya(this,t,e)||0:Wa(this,t,e)}});var Xa=zt,Qa=P,Za=Fa(Fa.bind),to=function(t,e){return Xa(t),void 0===e?t:Qa?Za(t,e):function(){return t.apply(e,arguments)}},eo=to,no=ot,ro=le,io=jr,ao=ua,oo=X([].push),so=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,l,u,h){for(var f,d,p=ro(c),v=no(p),g=io(v),y=eo(l,u),I=0,m=h||ao,_=e?m(c,g):n||o?m(c,0):void 0;g>I;I++)if((s||I in v)&&(d=y(f=v[I],I,p),t))if(e)_[I]=d;else if(d)switch(t){case 3:return!0;case 5:return f;case 6:return I;case 2:oo(_,f)}else switch(t){case 4:return!1;case 7:oo(_,f)}return a?-1:r||i?i:_}},co={forEach:so(0),map:so(1),filter:so(2),some:so(3),every:so(4),find:so(5),findIndex:so(6),filterReject:so(7)},lo=co.filter;Ri({target:"Array",proto:!0,forced:!pa("filter")},{filter:function(t){return lo(this,t,arguments.length>1?arguments[1]:void 0)}});var uo=Fi,ho=Pi?{}.toString:function(){return"[object "+uo(this)+"]"};Pi||br(Object.prototype,"toString",ho,{unsafe:!0});var fo=co.map;Ri({target:"Array",proto:!0,forced:!pa("map")},{map:function(t){return fo(this,t,arguments.length>1?arguments[1]:void 0)}});var po=co.forEach,vo=za("forEach")?[].forEach:function(t){return po(this,t,arguments.length>1?arguments[1]:void 0)};Ri({target:"Array",proto:!0,forced:[].forEach!==vo},{forEach:vo});var go={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},yo=Be("span").classList,Io=yo&&yo.constructor&&yo.constructor.prototype,mo=Io===Object.prototype?void 0:Io,_o=O,Eo=go,To=mo,Co=vo,bo=_n,Do=function(t){if(t&&t.forEach!==Co)try{bo(t,"forEach",Co)}catch(e){t.forEach=Co}};for(var Ro in Eo)Eo[Ro]&&Do(_o[Ro]&&_o[Ro].prototype);Do(To);var wo=Ri,So=Date,xo=X(So.prototype.getTime);wo({target:"Date",stat:!0},{now:function(){return xo(new So)}});var Lo={},ko=U,Oo=en,Ao=tn,No=on,Uo=dt,Po=ja;Lo.f=ko&&!Oo?Object.defineProperties:function(t,e){No(t);for(var n,r=Uo(e),i=Po(e),a=i.length,o=0;a>o;)Ao.f(t,n=i[o++],r[n]);return t};var Mo,jo=_t("document","documentElement"),Vo=on,Go=Lo,Ho=$r,Bo=Bn,Fo=jo,Ko=Be,zo="prototype",Jo="script",Wo=Hn("IE_PROTO"),qo=function(){},Yo=function(t){return"<"+Jo+">"+t+"</"+Jo+">"},$o=function(t){t.write(Yo("")),t.close();var e=t.parentWindow.Object;return t=null,e},Xo=function(){try{Mo=new ActiveXObject("htmlfile")}catch(t){}var t,e,n;Xo="undefined"!=typeof document?document.domain&&Mo?$o(Mo):(e=Ko("iframe"),n="java"+Jo+":",e.style.display="none",Fo.appendChild(e),e.src=String(n),(t=e.contentWindow.document).open(),t.write(Yo("document.F=Object")),t.close(),t.F):$o(Mo);for(var r=Ho.length;r--;)delete Xo[zo][Ho[r]];return Xo()};Bo[Wo]=!0;var Qo=Object.create||function(t,e){var n;return null!==t?(qo[zo]=Vo(t),n=new qo,qo[zo]=null,n[Wo]=t):n=Xo(),void 0===e?n:Go.f(n,e)},Zo=we,ts=Qo,es=tn.f,ns=Zo("unscopables"),rs=Array.prototype;void 0===rs[ns]&&es(rs,ns,{configurable:!0,value:ts(null)});var is=function(t){rs[ns][t]=!0},as=Ri,os=co.find,ss=is,cs="find",ls=!0;cs in[]&&Array(1)[cs]((function(){ls=!1})),as({target:"Array",proto:!0,forced:ls},{find:function(t){return os(this,t,arguments.length>1?arguments[1]:void 0)}}),ss(cs);var us=U,hs=X,fs=V,ds=N,ps=ja,vs=Zr,gs=G,ys=le,Is=ot,ms=Object.assign,_s=Object.defineProperty,Es=hs([].concat),Ts=!ms||ds((function(){if(us&&1!==ms({b:1},ms(_s({},"a",{enumerable:!0,get:function(){_s(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var t={},e={},n=Symbol("assign detection"),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach((function(t){e[t]=t})),7!==ms({},t)[n]||ps(ms({},e)).join("")!==r}))?function(t,e){for(var n=ys(t),r=arguments.length,i=1,a=vs.f,o=gs.f;r>i;)for(var s,c=Is(arguments[i++]),l=a?Es(ps(c),a(c)):ps(c),u=l.length,h=0;u>h;)s=l[h++],us&&!fs(o,c,s)||(n[s]=c[s]);return n}:ms,Cs=Ts;Ri({target:"Object",stat:!0,arity:2,forced:Object.assign!==Cs},{assign:Cs});var bs,Ds,Rs,ws,Ss="process"===et(O.process),xs=X,Ls=zt,ks=yt,Os=function(t){return ks(t)||null===t},As=String,Ns=TypeError,Us=function(t,e,n){try{return xs(Ls(Object.getOwnPropertyDescriptor(t,e)[n]))}catch(t){}},Ps=on,Ms=function(t){if(Os(t))return t;throw new Ns("Can't set "+As(t)+" as a prototype")},js=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,n={};try{(t=Us(Object.prototype,"__proto__","set"))(n,[]),e=n instanceof Array}catch(t){}return function(n,r){return Ps(n),Ms(r),e?t(n,r):n.__proto__=r,n}}():void 0),Vs=tn.f,Gs=fe,Hs=we("toStringTag"),Bs=function(t,e,n){t&&!n&&(t=t.prototype),t&&!Gs(t,Hs)&&Vs(t,Hs,{configurable:!0,value:e})},Fs=En.exports,Ks=tn,zs=function(t,e,n){return n.get&&Fs(n.get,e,{getter:!0}),n.set&&Fs(n.set,e,{setter:!0}),Ks.f(t,e,n)},Js=_t,Ws=zs,qs=U,Ys=we("species"),$s=function(t){var e=Js(t);qs&&e&&!e[Ys]&&Ws(e,Ys,{configurable:!0,get:function(){return this}})},Xs=Et,Qs=TypeError,Zs=function(t,e){if(Xs(e,t))return t;throw new Qs("Incorrect invocation")},tc=ra,ec=Ht,nc=TypeError,rc=on,ic=function(t){if(tc(t))return t;throw new nc(ec(t)+" is not a constructor")},ac=st,oc=we("species"),sc=P,cc=Function.prototype,lc=cc.apply,uc=cc.call,hc="object"==typeof Reflect&&Reflect.apply||(sc?uc.bind(lc):function(){return uc.apply(lc,arguments)}),fc=X([].slice),dc=TypeError,pc=function(t,e){if(t<e)throw new dc("Not enough arguments");return t},vc=/(?:ipad|iphone|ipod).*applewebkit/i.test(Tt),gc=O,yc=hc,Ic=to,mc=vt,_c=fe,Ec=N,Tc=jo,Cc=fc,bc=Be,Dc=pc,Rc=vc,wc=Ss,Sc=gc.setImmediate,xc=gc.clearImmediate,Lc=gc.process,kc=gc.Dispatch,Oc=gc.Function,Ac=gc.MessageChannel,Nc=gc.String,Uc=0,Pc={},Mc="onreadystatechange";Ec((function(){bs=gc.location}));var jc=function(t){if(_c(Pc,t)){var e=Pc[t];delete Pc[t],e()}},Vc=function(t){return function(){jc(t)}},Gc=function(t){jc(t.data)},Hc=function(t){gc.postMessage(Nc(t),bs.protocol+"//"+bs.host)};Sc&&xc||(Sc=function(t){Dc(arguments.length,1);var e=mc(t)?t:Oc(t),n=Cc(arguments,1);return Pc[++Uc]=function(){yc(e,void 0,n)},Ds(Uc),Uc},xc=function(t){delete Pc[t]},wc?Ds=function(t){Lc.nextTick(Vc(t))}:kc&&kc.now?Ds=function(t){kc.now(Vc(t))}:Ac&&!Rc?(ws=(Rs=new Ac).port2,Rs.port1.onmessage=Gc,Ds=Ic(ws.postMessage,ws)):gc.addEventListener&&mc(gc.postMessage)&&!gc.importScripts&&bs&&"file:"!==bs.protocol&&!Ec(Hc)?(Ds=Hc,gc.addEventListener("message",Gc,!1)):Ds=Mc in bc("script")?function(t){Tc.appendChild(bc("script"))[Mc]=function(){Tc.removeChild(this),jc(t)}}:function(t){setTimeout(Vc(t),0)});var Bc={set:Sc,clear:xc},Fc=O,Kc=U,zc=Object.getOwnPropertyDescriptor,Jc=function(){this.head=null,this.tail=null};Jc.prototype={add:function(t){var e={item:t,next:null},n=this.tail;n?n.next=e:this.head=e,this.tail=e},get:function(){var t=this.head;if(t)return null===(this.head=t.next)&&(this.tail=null),t.item}};var Wc,qc,Yc,$c,Xc,Qc=Jc,Zc=/ipad|iphone|ipod/i.test(Tt)&&"undefined"!=typeof Pebble,tl=/web0s(?!.*chrome)/i.test(Tt),el=O,nl=function(t){if(!Kc)return Fc[t];var e=zc(Fc,t);return e&&e.value},rl=to,il=Bc.set,al=Qc,ol=vc,sl=Zc,cl=tl,ll=Ss,ul=el.MutationObserver||el.WebKitMutationObserver,hl=el.document,fl=el.process,dl=el.Promise,pl=nl("queueMicrotask");if(!pl){var vl=new al,gl=function(){var t,e;for(ll&&(t=fl.domain)&&t.exit();e=vl.get();)try{e()}catch(t){throw vl.head&&Wc(),t}t&&t.enter()};ol||ll||cl||!ul||!hl?!sl&&dl&&dl.resolve?(($c=dl.resolve(void 0)).constructor=dl,Xc=rl($c.then,$c),Wc=function(){Xc(gl)}):ll?Wc=function(){fl.nextTick(gl)}:(il=rl(il,el),Wc=function(){il(gl)}):(qc=!0,Yc=hl.createTextNode(""),new ul(gl).observe(Yc,{characterData:!0}),Wc=function(){Yc.data=qc=!qc}),pl=function(t){vl.head||Wc(),vl.add(t)}}var yl=pl,Il=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}},ml=O.Promise,_l="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,El=!_l&&!Ss&&"object"==typeof window&&"object"==typeof document,Tl=O,Cl=ml,bl=vt,Dl=Ii,Rl=Nn,wl=we,Sl=El,xl=_l,Ll=xt;Cl&&Cl.prototype;var kl=wl("species"),Ol=!1,Al=bl(Tl.PromiseRejectionEvent),Nl=Dl("Promise",(function(){var t=Rl(Cl),e=t!==String(Cl);if(!e&&66===Ll)return!0;if(!Ll||Ll<51||!/native code/.test(t)){var n=new Cl((function(t){t(1)})),r=function(t){t((function(){}),(function(){}))};if((n.constructor={})[kl]=r,!(Ol=n.then((function(){}))instanceof r))return!0}return!e&&(Sl||xl)&&!Al})),Ul={CONSTRUCTOR:Nl,REJECTION_EVENT:Al,SUBCLASSING:Ol},Pl={},Ml=zt,jl=TypeError,Vl=function(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw new jl("Bad Promise constructor");e=t,n=r})),this.resolve=Ml(e),this.reject=Ml(n)};Pl.f=function(t){return new Vl(t)};var Gl,Hl,Bl,Fl=Ri,Kl=Ss,zl=O,Jl=V,Wl=br,ql=js,Yl=Bs,$l=$s,Xl=zt,Ql=vt,Zl=yt,tu=Zs,eu=function(t,e){var n,r=rc(t).constructor;return void 0===r||ac(n=rc(r)[oc])?e:ic(n)},nu=Bc.set,ru=yl,iu=function(t,e){try{1===arguments.length?console.error(t):console.error(t,e)}catch(t){}},au=Il,ou=Qc,su=nr,cu=ml,lu=Pl,uu="Promise",hu=Ul.CONSTRUCTOR,fu=Ul.REJECTION_EVENT,du=Ul.SUBCLASSING,pu=su.getterFor(uu),vu=su.set,gu=cu&&cu.prototype,yu=cu,Iu=gu,mu=zl.TypeError,_u=zl.document,Eu=zl.process,Tu=lu.f,Cu=Tu,bu=!!(_u&&_u.createEvent&&zl.dispatchEvent),Du="unhandledrejection",Ru=function(t){var e;return!(!Zl(t)||!Ql(e=t.then))&&e},wu=function(t,e){var n,r,i,a=e.value,o=1===e.state,s=o?t.ok:t.fail,c=t.resolve,l=t.reject,u=t.domain;try{s?(o||(2===e.rejection&&Ou(e),e.rejection=1),!0===s?n=a:(u&&u.enter(),n=s(a),u&&(u.exit(),i=!0)),n===t.promise?l(new mu("Promise-chain cycle")):(r=Ru(n))?Jl(r,n,c,l):c(n)):l(a)}catch(t){u&&!i&&u.exit(),l(t)}},Su=function(t,e){t.notified||(t.notified=!0,ru((function(){for(var n,r=t.reactions;n=r.get();)wu(n,t);t.notified=!1,e&&!t.rejection&&Lu(t)})))},xu=function(t,e,n){var r,i;bu?((r=_u.createEvent("Event")).promise=e,r.reason=n,r.initEvent(t,!1,!0),zl.dispatchEvent(r)):r={promise:e,reason:n},!fu&&(i=zl["on"+t])?i(r):t===Du&&iu("Unhandled promise rejection",n)},Lu=function(t){Jl(nu,zl,(function(){var e,n=t.facade,r=t.value;if(ku(t)&&(e=au((function(){Kl?Eu.emit("unhandledRejection",r,n):xu(Du,n,r)})),t.rejection=Kl||ku(t)?2:1,e.error))throw e.value}))},ku=function(t){return 1!==t.rejection&&!t.parent},Ou=function(t){Jl(nu,zl,(function(){var e=t.facade;Kl?Eu.emit("rejectionHandled",e):xu("rejectionhandled",e,t.value)}))},Au=function(t,e,n){return function(r){t(e,r,n)}},Nu=function(t,e,n){t.done||(t.done=!0,n&&(t=n),t.value=e,t.state=2,Su(t,!0))},Uu=function(t,e,n){if(!t.done){t.done=!0,n&&(t=n);try{if(t.facade===e)throw new mu("Promise can't be resolved itself");var r=Ru(e);r?ru((function(){var n={done:!1};try{Jl(r,e,Au(Uu,n,t),Au(Nu,n,t))}catch(e){Nu(n,e,t)}})):(t.value=e,t.state=1,Su(t,!1))}catch(e){Nu({done:!1},e,t)}}};if(hu&&(Iu=(yu=function(t){tu(this,Iu),Xl(t),Jl(Gl,this);var e=pu(this);try{t(Au(Uu,e),Au(Nu,e))}catch(t){Nu(e,t)}}).prototype,(Gl=function(t){vu(this,{type:uu,done:!1,notified:!1,parent:!1,reactions:new ou,rejection:!1,state:0,value:void 0})}).prototype=Wl(Iu,"then",(function(t,e){var n=pu(this),r=Tu(eu(this,yu));return n.parent=!0,r.ok=!Ql(t)||t,r.fail=Ql(e)&&e,r.domain=Kl?Eu.domain:void 0,0===n.state?n.reactions.add(r):ru((function(){wu(r,n)})),r.promise})),Hl=function(){var t=new Gl,e=pu(t);this.promise=t,this.resolve=Au(Uu,e),this.reject=Au(Nu,e)},lu.f=Tu=function(t){return t===yu||undefined===t?new Hl(t):Cu(t)},Ql(cu)&&gu!==Object.prototype)){Bl=gu.then,du||Wl(gu,"then",(function(t,e){var n=this;return new yu((function(t,e){Jl(Bl,n,t,e)})).then(t,e)}),{unsafe:!0});try{delete gu.constructor}catch(t){}ql&&ql(gu,Iu)}Fl({global:!0,constructor:!0,wrap:!0,forced:hu},{Promise:yu}),Yl(yu,uu,!1),$l(uu);var Pu={},Mu=Pu,ju=we("iterator"),Vu=Array.prototype,Gu=function(t){return void 0!==t&&(Mu.Array===t||Vu[ju]===t)},Hu=Fi,Bu=qt,Fu=st,Ku=Pu,zu=we("iterator"),Ju=function(t){if(!Fu(t))return Bu(t,zu)||Bu(t,"@@iterator")||Ku[Hu(t)]},Wu=V,qu=zt,Yu=on,$u=Ht,Xu=Ju,Qu=TypeError,Zu=function(t,e){var n=arguments.length<2?Xu(t):e;if(qu(n))return Yu(Wu(n,t));throw new Qu($u(t)+" is not iterable")},th=V,eh=on,nh=qt,rh=function(t,e,n){var r,i;eh(t);try{if(!(r=nh(t,"return"))){if("throw"===e)throw n;return n}r=th(r,t)}catch(t){i=!0,r=t}if("throw"===e)throw n;if(i)throw r;return eh(r),n},ih=to,ah=V,oh=on,sh=Ht,ch=Gu,lh=jr,uh=Et,hh=Zu,fh=Ju,dh=rh,ph=TypeError,vh=function(t,e){this.stopped=t,this.result=e},gh=vh.prototype,yh=function(t,e,n){var r,i,a,o,s,c,l,u=n&&n.that,h=!(!n||!n.AS_ENTRIES),f=!(!n||!n.IS_RECORD),d=!(!n||!n.IS_ITERATOR),p=!(!n||!n.INTERRUPTED),v=ih(e,u),g=function(t){return r&&dh(r,"normal",t),new vh(!0,t)},y=function(t){return h?(oh(t),p?v(t[0],t[1],g):v(t[0],t[1])):p?v(t,g):v(t)};if(f)r=t.iterator;else if(d)r=t;else{if(!(i=fh(t)))throw new ph(sh(t)+" is not iterable");if(ch(i)){for(a=0,o=lh(t);o>a;a++)if((s=y(t[a]))&&uh(gh,s))return s;return new vh(!1)}r=hh(t,i)}for(c=f?t.next:r.next;!(l=ah(c,r)).done;){try{s=y(l.value)}catch(t){dh(r,"throw",t)}if("object"==typeof s&&s&&uh(gh,s))return s}return new vh(!1)},Ih=we("iterator"),mh=!1;try{var _h=0,Eh={next:function(){return{done:!!_h++}},return:function(){mh=!0}};Eh[Ih]=function(){return this},Array.from(Eh,(function(){throw 2}))}catch(t){}var Th=function(t,e){try{if(!e&&!mh)return!1}catch(t){return!1}var n=!1;try{var r={};r[Ih]=function(){return{next:function(){return{done:n=!0}}}},t(r)}catch(t){}return n},Ch=ml,bh=Ul.CONSTRUCTOR||!Th((function(t){Ch.all(t).then(void 0,(function(){}))})),Dh=V,Rh=zt,wh=Pl,Sh=Il,xh=yh;Ri({target:"Promise",stat:!0,forced:bh},{all:function(t){var e=this,n=wh.f(e),r=n.resolve,i=n.reject,a=Sh((function(){var n=Rh(e.resolve),a=[],o=0,s=1;xh(t,(function(t){var c=o++,l=!1;s++,Dh(n,e,t).then((function(t){l||(l=!0,a[c]=t,--s||r(a))}),i)})),--s||r(a)}));return a.error&&i(a.value),n.promise}});var Lh=Ri,kh=Ul.CONSTRUCTOR,Oh=ml,Ah=_t,Nh=vt,Uh=br,Ph=Oh&&Oh.prototype;if(Lh({target:"Promise",proto:!0,forced:kh,real:!0},{catch:function(t){return this.then(void 0,t)}}),Nh(Oh)){var Mh=Ah("Promise").prototype.catch;Ph.catch!==Mh&&Uh(Ph,"catch",Mh,{unsafe:!0})}var jh=V,Vh=zt,Gh=Pl,Hh=Il,Bh=yh;Ri({target:"Promise",stat:!0,forced:bh},{race:function(t){var e=this,n=Gh.f(e),r=n.reject,i=Hh((function(){var i=Vh(e.resolve);Bh(t,(function(t){jh(i,e,t).then(n.resolve,r)}))}));return i.error&&r(i.value),n.promise}});var Fh=Pl;Ri({target:"Promise",stat:!0,forced:Ul.CONSTRUCTOR},{reject:function(t){var e=Fh.f(this);return(0,e.reject)(t),e.promise}});var Kh=on,zh=yt,Jh=Pl,Wh=Ri,qh=Ul.CONSTRUCTOR,Yh=function(t,e){if(Kh(t),zh(e)&&e.constructor===t)return e;var n=Jh.f(t);return(0,n.resolve)(e),n.promise};_t("Promise"),Wh({target:"Promise",stat:!0,forced:qh},{resolve:function(t){return Yh(this,t)}});var $h="function"==typeof Bun&&Bun&&"string"==typeof Bun.version,Xh=O,Qh=hc,Zh=vt,tf=$h,ef=Tt,nf=fc,rf=pc,af=Xh.Function,of=/MSIE .\./.test(ef)||tf&&function(){var t=Xh.Bun.version.split(".");return t.length<3||"0"===t[0]&&(t[1]<3||"3"===t[1]&&"0"===t[2])}(),sf=function(t,e){var n=e?2:1;return of?function(r,i){var a=rf(arguments.length,1)>n,o=Zh(r)?r:af(r),s=a?nf(arguments,n):[],c=a?function(){Qh(o,this,s)}:o;return e?t(c,i):t(c)}:t},cf=Ri,lf=O,uf=sf(lf.setInterval,!0);cf({global:!0,bind:!0,forced:lf.setInterval!==uf},{setInterval:uf});var hf=Ri,ff=O,df=sf(ff.setTimeout,!0);hf({global:!0,bind:!0,forced:ff.setTimeout!==df},{setTimeout:df});var pf,vf,gf,yf=Fi,If=String,mf=function(t){if("Symbol"===yf(t))throw new TypeError("Cannot convert a Symbol value to a string");return If(t)},_f=X,Ef=xr,Tf=mf,Cf=ut,bf=_f("".charAt),Df=_f("".charCodeAt),Rf=_f("".slice),wf=function(t){return function(e,n){var r,i,a=Tf(Cf(e)),o=Ef(n),s=a.length;return o<0||o>=s?t?"":void 0:(r=Df(a,o))<55296||r>56319||o+1===s||(i=Df(a,o+1))<56320||i>57343?t?bf(a,o):r:t?Rf(a,o,o+2):i-56320+(r-55296<<10)+65536}},Sf={codeAt:wf(!1),charAt:wf(!0)},xf=!N((function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})),Lf=fe,kf=vt,Of=le,Af=xf,Nf=Hn("IE_PROTO"),Uf=Object,Pf=Uf.prototype,Mf=Af?Uf.getPrototypeOf:function(t){var e=Of(t);if(Lf(e,Nf))return e[Nf];var n=e.constructor;return kf(n)&&e instanceof n?n.prototype:e instanceof Uf?Pf:null},jf=N,Vf=vt,Gf=yt,Hf=Mf,Bf=br,Ff=we("iterator"),Kf=!1;[].keys&&("next"in(gf=[].keys())?(vf=Hf(Hf(gf)))!==Object.prototype&&(pf=vf):Kf=!0);var zf=!Gf(pf)||jf((function(){var t={};return pf[Ff].call(t)!==t}));zf&&(pf={}),Vf(pf[Ff])||Bf(pf,Ff,(function(){return this}));var Jf={IteratorPrototype:pf,BUGGY_SAFARI_ITERATORS:Kf},Wf=Jf.IteratorPrototype,qf=Qo,Yf=J,$f=Bs,Xf=Pu,Qf=function(){return this},Zf=Ri,td=V,ed=vt,nd=function(t,e,n,r){var i=e+" Iterator";return t.prototype=qf(Wf,{next:Yf(+!r,n)}),$f(t,i,!1),Xf[i]=Qf,t},rd=Mf,id=js,ad=Bs,od=_n,sd=br,cd=Pu,ld=wn.PROPER,ud=wn.CONFIGURABLE,hd=Jf.IteratorPrototype,fd=Jf.BUGGY_SAFARI_ITERATORS,dd=we("iterator"),pd="keys",vd="values",gd="entries",yd=function(){return this},Id=function(t,e,n,r,i,a,o){nd(n,e,r);var s,c,l,u=function(t){if(t===i&&v)return v;if(!fd&&t&&t in d)return d[t];switch(t){case pd:case vd:case gd:return function(){return new n(this,t)}}return function(){return new n(this)}},h=e+" Iterator",f=!1,d=t.prototype,p=d[dd]||d["@@iterator"]||i&&d[i],v=!fd&&p||u(i),g="Array"===e&&d.entries||p;if(g&&(s=rd(g.call(new t)))!==Object.prototype&&s.next&&(rd(s)!==hd&&(id?id(s,hd):ed(s[dd])||sd(s,dd,yd)),ad(s,h,!0)),ld&&i===vd&&p&&p.name!==vd&&(ud?od(d,"name",vd):(f=!0,v=function(){return td(p,this)})),i)if(c={values:u(vd),keys:a?v:u(pd),entries:u(gd)},o)for(l in c)(fd||f||!(l in d))&&sd(d,l,c[l]);else Zf({target:e,proto:!0,forced:fd||f},c);return d[dd]!==v&&sd(d,dd,v,{name:i}),cd[e]=v,c},md=function(t,e){return{value:t,done:e}},_d=Sf.charAt,Ed=mf,Td=nr,Cd=Id,bd=md,Dd="String Iterator",Rd=Td.set,wd=Td.getterFor(Dd);Cd(String,"String",(function(t){Rd(this,{type:Dd,string:Ed(t),index:0})}),(function(){var t,e=wd(this),n=e.string,r=e.index;return r>=n.length?bd(void 0,!0):(t=_d(n,r),e.index+=t.length,bd(t,!1))}));var Sd=dt,xd=is,Ld=Pu,kd=nr,Od=tn.f,Ad=Id,Nd=md,Ud=U,Pd="Array Iterator",Md=kd.set,jd=kd.getterFor(Pd),Vd=Ad(Array,"Array",(function(t,e){Md(this,{type:Pd,target:Sd(t),index:0,kind:e})}),(function(){var t=jd(this),e=t.target,n=t.index++;if(!e||n>=e.length)return t.target=void 0,Nd(void 0,!0);switch(t.kind){case"keys":return Nd(n,!1);case"values":return Nd(e[n],!1)}return Nd([n,e[n]],!1)}),"values"),Gd=Ld.Arguments=Ld.Array;if(xd("keys"),xd("values"),xd("entries"),Ud&&"values"!==Gd.name)try{Od(Gd,"name",{value:"values"})}catch(t){}var Hd=O,Bd=go,Fd=mo,Kd=Vd,zd=_n,Jd=Bs,Wd=we("iterator"),qd=Kd.values,Yd=function(t,e){if(t){if(t[Wd]!==qd)try{zd(t,Wd,qd)}catch(e){t[Wd]=qd}if(Jd(t,e,!0),Bd[e])for(var n in Kd)if(t[n]!==Kd[n])try{zd(t,n,Kd[n])}catch(e){t[n]=Kd[n]}}};for(var $d in Bd)Yd(Hd[$d]&&Hd[$d].prototype,$d);Yd(Fd,"DOMTokenList");var Xd=Ri,Qd=Si,Zd=ra,tp=yt,ep=Ar,np=jr,rp=dt,ip=Ni,ap=we,op=fc,sp=pa("slice"),cp=ap("species"),lp=Array,up=Math.max;Xd({target:"Array",proto:!0,forced:!sp},{slice:function(t,e){var n,r,i,a=rp(this),o=np(a),s=ep(t,o),c=ep(void 0===e?o:e,o);if(Qd(a)&&(n=a.constructor,(Zd(n)&&(n===lp||Qd(n.prototype))||tp(n)&&null===(n=n[cp]))&&(n=void 0),n===lp||void 0===n))return op(a,s,c);for(r=new(void 0===n?lp:n)(up(c-s,0)),i=0;s<c;s++,i++)s in a&&ip(r,i,a[s]);return r.length=i,r}});var hp=on,fp=rh,dp=to,pp=V,vp=le,gp=function(t,e,n,r){try{return r?e(hp(n)[0],n[1]):e(n)}catch(e){fp(t,"throw",e)}},yp=Gu,Ip=ra,mp=jr,_p=Ni,Ep=Zu,Tp=Ju,Cp=Array,bp=function(t){var e=vp(t),n=Ip(this),r=arguments.length,i=r>1?arguments[1]:void 0,a=void 0!==i;a&&(i=dp(i,r>2?arguments[2]:void 0));var o,s,c,l,u,h,f=Tp(e),d=0;if(!f||this===Cp&&yp(f))for(o=mp(e),s=n?new this(o):Cp(o);o>d;d++)h=a?i(e[d],d):e[d],_p(s,d,h);else for(u=(l=Ep(e,f)).next,s=n?new this:[];!(c=pp(u,l)).done;d++)h=a?gp(l,i,[c.value,d],!0):c.value,_p(s,d,h);return s.length=d,s};Ri({target:"Array",stat:!0,forced:!Th((function(t){Array.from(t)}))},{from:bp});var Dp={exports:{}},Rp={},wp=et,Sp=dt,xp=Dr.f,Lp=fc,kp="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Rp.f=function(t){return kp&&"Window"===wp(t)?function(t){try{return xp(t)}catch(t){return Lp(kp)}}(t):xp(Sp(t))};var Op=N((function(){if("function"==typeof ArrayBuffer){var t=new ArrayBuffer(8);Object.isExtensible(t)&&Object.defineProperty(t,"a",{value:8})}})),Ap=N,Np=yt,Up=et,Pp=Op,Mp=Object.isExtensible,jp=Ap((function(){Mp(1)}))||Pp?function(t){return!!Np(t)&&((!Pp||"ArrayBuffer"!==Up(t))&&(!Mp||Mp(t)))}:Mp,Vp=!N((function(){return Object.isExtensible(Object.preventExtensions({}))})),Gp=Ri,Hp=X,Bp=Bn,Fp=yt,Kp=fe,zp=tn.f,Jp=Dr,Wp=Rp,qp=jp,Yp=Vp,$p=!1,Xp=ye("meta"),Qp=0,Zp=function(t){zp(t,Xp,{value:{objectID:"O"+Qp++,weakData:{}}})},tv=Dp.exports={enable:function(){tv.enable=function(){},$p=!0;var t=Jp.f,e=Hp([].splice),n={};n[Xp]=1,t(n).length&&(Jp.f=function(n){for(var r=t(n),i=0,a=r.length;i<a;i++)if(r[i]===Xp){e(r,i,1);break}return r},Gp({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Wp.f}))},fastKey:function(t,e){if(!Fp(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!Kp(t,Xp)){if(!qp(t))return"F";if(!e)return"E";Zp(t)}return t[Xp].objectID},getWeakData:function(t,e){if(!Kp(t,Xp)){if(!qp(t))return!0;if(!e)return!1;Zp(t)}return t[Xp].weakData},onFreeze:function(t){return Yp&&$p&&qp(t)&&!Kp(t,Xp)&&Zp(t),t}};Bp[Xp]=!0;var ev=vt,nv=yt,rv=js,iv=function(t,e,n){var r,i;return rv&&ev(r=e.constructor)&&r!==n&&nv(i=r.prototype)&&i!==n.prototype&&rv(t,i),t},av=Ri,ov=O,sv=X,cv=Ii,lv=br,uv=Dp.exports,hv=yh,fv=Zs,dv=vt,pv=st,vv=yt,gv=N,yv=Th,Iv=Bs,mv=iv,_v=function(t,e,n){var r=-1!==t.indexOf("Map"),i=-1!==t.indexOf("Weak"),a=r?"set":"add",o=ov[t],s=o&&o.prototype,c=o,l={},u=function(t){var e=sv(s[t]);lv(s,t,"add"===t?function(t){return e(this,0===t?0:t),this}:"delete"===t?function(t){return!(i&&!vv(t))&&e(this,0===t?0:t)}:"get"===t?function(t){return i&&!vv(t)?void 0:e(this,0===t?0:t)}:"has"===t?function(t){return!(i&&!vv(t))&&e(this,0===t?0:t)}:function(t,n){return e(this,0===t?0:t,n),this})};if(cv(t,!dv(o)||!(i||s.forEach&&!gv((function(){(new o).entries().next()})))))c=n.getConstructor(e,t,r,a),uv.enable();else if(cv(t,!0)){var h=new c,f=h[a](i?{}:-0,1)!==h,d=gv((function(){h.has(1)})),p=yv((function(t){new o(t)})),v=!i&&gv((function(){for(var t=new o,e=5;e--;)t[a](e,e);return!t.has(-0)}));p||((c=e((function(t,e){fv(t,s);var n=mv(new o,t,c);return pv(e)||hv(e,n[a],{that:n,AS_ENTRIES:r}),n}))).prototype=s,s.constructor=c),(d||v)&&(u("delete"),u("has"),r&&u("get")),(v||f)&&u(a),i&&s.clear&&delete s.clear}return l[t]=c,av({global:!0,constructor:!0,forced:c!==o},l),Iv(c,t),i||n.setStrong(c,t,r),c},Ev=br,Tv=function(t,e,n){for(var r in e)Ev(t,r,e[r],n);return t},Cv=Qo,bv=zs,Dv=Tv,Rv=to,wv=Zs,Sv=st,xv=yh,Lv=Id,kv=md,Ov=$s,Av=U,Nv=Dp.exports.fastKey,Uv=nr.set,Pv=nr.getterFor,Mv={getConstructor:function(t,e,n,r){var i=t((function(t,i){wv(t,a),Uv(t,{type:e,index:Cv(null),first:void 0,last:void 0,size:0}),Av||(t.size=0),Sv(i)||xv(i,t[r],{that:t,AS_ENTRIES:n})})),a=i.prototype,o=Pv(e),s=function(t,e,n){var r,i,a=o(t),s=c(t,e);return s?s.value=n:(a.last=s={index:i=Nv(e,!0),key:e,value:n,previous:r=a.last,next:void 0,removed:!1},a.first||(a.first=s),r&&(r.next=s),Av?a.size++:t.size++,"F"!==i&&(a.index[i]=s)),t},c=function(t,e){var n,r=o(t),i=Nv(e);if("F"!==i)return r.index[i];for(n=r.first;n;n=n.next)if(n.key===e)return n};return Dv(a,{clear:function(){for(var t=o(this),e=t.first;e;)e.removed=!0,e.previous&&(e.previous=e.previous.next=void 0),e=e.next;t.first=t.last=void 0,t.index=Cv(null),Av?t.size=0:this.size=0},delete:function(t){var e=this,n=o(e),r=c(e,t);if(r){var i=r.next,a=r.previous;delete n.index[r.index],r.removed=!0,a&&(a.next=i),i&&(i.previous=a),n.first===r&&(n.first=i),n.last===r&&(n.last=a),Av?n.size--:e.size--}return!!r},forEach:function(t){for(var e,n=o(this),r=Rv(t,arguments.length>1?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)}}),Av&&bv(a,"size",{configurable:!0,get:function(){return o(this).size}}),i},setStrong:function(t,e,n){var r=e+" Iterator",i=Pv(e),a=Pv(r);Lv(t,e,(function(t,e){Uv(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)?kv("keys"===e?n.key:"values"===e?n.value:[n.key,n.value],!1):(t.target=void 0,kv(void 0,!0))}),n?"entries":"values",!n,!0),Ov(e)}};_v("Set",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),Mv);var jv=U,Vv=Si,Gv=TypeError,Hv=Object.getOwnPropertyDescriptor,Bv=jv&&!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(Vv(t)&&!Hv(t,"length").writable)throw new Gv("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e},Fv=Ht,Kv=TypeError,zv=Ri,Jv=le,Wv=Ar,qv=xr,Yv=jr,$v=Bv,Xv=Li,Qv=ua,Zv=Ni,tg=function(t,e){if(!delete t[e])throw new Kv("Cannot delete property "+Fv(e)+" of "+Fv(t))},eg=pa("splice"),ng=Math.max,rg=Math.min;zv({target:"Array",proto:!0,forced:!eg},{splice:function(t,e){var n,r,i,a,o,s,c=Jv(this),l=Yv(c),u=Wv(t,l),h=arguments.length;for(0===h?n=r=0:1===h?(n=0,r=l-u):(n=h-2,r=rg(ng(qv(e),0),l-u)),Xv(l+n-r),i=Qv(c,r),a=0;a<r;a++)(o=u+a)in c&&Zv(i,a,c[o]);if(i.length=r,n<r){for(a=u;a<l-r;a++)s=a+n,(o=a+r)in c?c[s]=c[o]:tg(c,s);for(a=l;a>l-r+n;a--)tg(c,a-1)}else if(n>r)for(a=l-r;a>u;a--)s=a+n-1,(o=a+r-1)in c?c[s]=c[o]:tg(c,s);for(a=0;a<n;a++)c[a+u]=arguments[a+2];return $v(c,l-r+n),i}});var ig=function(){function t(){l(this,t)}return h(t,[{key:"on",value:function(t,e,n){"function"==typeof e?(this._stores=this._stores||{},(this._stores[t]=this._stores[t]||[]).push({cb:e,ctx:n})):console.error("listener must be a function")}},{key:"emit",value:function(t){this._stores=this._stores||{};var e,n=this._stores[t];if(n){n=n.slice(0),(e=[].slice.call(arguments,1))[0]={eventCode:t,data:e[0]};for(var r=0,i=n.length;r<i;r++)n[r].cb.apply(n[r].ctx,e)}}},{key:"off",value:function(t,e){if(this._stores=this._stores||{},arguments.length){var n=this._stores[t];if(n)if(1!==arguments.length){for(var r=0,i=n.length;r<i;r++)if(n[r].cb===e){n.splice(r,1);break}}else delete this._stores[t]}else this._stores={}}}]),t}(),ag={INVITED:"INVITED",ON_CALL_RECEIVED:"onCallReceived",GROUP_CALL_INVITEE_LIST_UPDATE:"GROUP_CALL_INVITEE_LIST_UPDATE",USER_ENTER:"USER_ENTER",USER_LEAVE:"USER_LEAVE",USER_ACCEPT:"USER_ACCEPT",USER_UPDATE:"USER_UPDATE",REJECT:"REJECT",NO_RESP:"NO_RESP",LINE_BUSY:"LINE_BUSY",CALLING_CANCEL:"CALLING_CANCEL",ON_CALL_CANCELED:"onCallCancelled",CALLING_TIMEOUT:"CALLING_TIMEOUT",ON_CALL_BEGIN:"onCallBegin",CALL_END:"CALL_END",USER_VIDEO_AVAILABLE:"USER_VIDEO_AVAILABLE",USER_AUDIO_AVAILABLE:"USER_AUDIO_AVAILABLE",USER_VOICE_VOLUME:"USER_VOICE_VOLUME",SDK_READY:"SDK_READY",KICKED_OUT:"KICKED_OUT",CALL_MODE:"CALL_MODE",HANG_UP:"HANG_UP",MESSAGE_SENT_BY_ME:"onMessageSentByMe",ERROR:"ERROR"},og={IDLE:"idle",CALLING:"calling",CONNECTED:"connected"},sg=1,cg=2,lg=3,ug=4,hg=5,fg=1,dg={AUDIO:1,VIDEO:2},pg="",vg="inviter",gg="invitee",yg=0,Ig=1,mg=2,_g=["","audioCall","videoCall"],Eg="audio",Tg="video",Cg={EAR:"ear",SPEAKER:"speaker"},bg={BASE:Math.pow(2,16),PRO:Math.pow(2,17),ULTIMATE:Math.pow(2,18)},Dg=2147483647,Rg={DEFAULT:"default",VIDEO:"video",AUDIO:"audio",ON_ERROR:"onError",MAIN:"main",RTC:"rtc",LIVE:"live",SMALL:"small",BIG:"big",AUXILIARY:"auxiliary",NUMBER:"number",STRING:"string",INVITER:"inviter",INVITEE:"invitee",VIDEO_INPUT:"videoinput",AUDIO_INPUT:"audioinput",LOCAL:"local",REMOTE:"remote",TRTC:"TRTC",WXMINIPROGRAM:"wxminiprogram",NORMAL:"normal",REJECT:"reject",IGNORE:"ignore",TIMEOUT:"timeout",RIC:"ric",RAF:"raf",INTERVAL:"interval",CANCEL:"cancel",BUSYLINE:"busyline",UNKNOWN:"unknown",SINGLE_CALL:"SingleCall",GROUP_CALL:"groupCall",CALLER:"caller",CALLEE:"callee",DEVTOOLS:"devtools",AV_CALL:"av_call",CALLKIT_RECORDS_SVR:"callkit_records_svr",SINGLE:"single",GROUP:"group",START_CALL:"start_call",RECEIVE_CALL:"receive_call",CALL_ACCEPTED:"call_accepted",ACCEPT_CALL:"accept_call",CALL_MISSED:"call_missed",NOT_ANSWER_CALL:"not_answer_call",CALL_REJECTED:"call_rejected",REJECT_CALL:"reject_call",CALL_BUSY:"call_busy",IGNORE_CALL:"ignore_call",CANCEL_CALL:"cancel_call",CALL_CANCELED:"call_canceled",CALL_FAILED:"call_failed",CALL_END:"call_end",CALL_INTERRUPTED:"call_interrupted",INVITE_USER:"invite_user",JOIN_IN_GROUP_CALL:"join_in_group_call",EVENT_REPORT:"event_report",HEART_BEAT:"heartbeat",CALLING:"calling",MINI_PROGRAM:"miniProgram",BANNED:"banned",WAITING:"waiting",CONNECTED:"connected"},wg={MIC_TITLE:"麦克风权限授权",MIC_CONTENT:"使用语音通话,需要在设置中对麦克风进行授权允许",CAMERA_TITLE:"麦克风、摄像头权限授权",CAMERA_CONTENT:"使用视频通话,需要在设置中对麦克风、摄像头进行授权允许",CONFIRM_TEXT:"去设置"},Sg="微信开发者工具不支持原生推拉流组件(即 <live-pusher> 和 <live-player> 标签),请使用真机调试或者扫码预览。",xg={RECORD:"scope.record",CAMERA:"scope.camera"},Lg="",kg="call_wait",Og="call_accept",Ag={"":og.IDLE,call_wait:og.CALLING,call_accept:og.CONNECTED},Ng="https://buy.cloud.tencent.com/avc?addRavLicense=1",Ug="https://buy.tencentcloud.com/avc?addRavLicense=1",Pg=1,Mg=9,jg=17,Vg=18,Gg=21,Hg=15,Bg="\t\n\v\f\r \u2028\u2029\ufeff",Fg=ut,Kg=mf,zg=Bg,Jg=X("".replace),Wg=RegExp("^["+zg+"]+"),qg=RegExp("(^|[^"+zg+"])["+zg+"]+$"),Yg=function(t){return function(e){var n=Kg(Fg(e));return 1&t&&(n=Jg(n,Wg,"")),2&t&&(n=Jg(n,qg,"$1")),n}},$g={start:Yg(1),end:Yg(2),trim:Yg(3)},Xg=O,Qg=N,Zg=X,ty=mf,ey=$g.trim,ny=Bg,ry=Xg.parseInt,iy=Xg.Symbol,ay=iy&&iy.iterator,oy=/^[+-]?0x/i,sy=Zg(oy.exec),cy=8!==ry(ny+"08")||22!==ry(ny+"0x16")||ay&&!Qg((function(){ry(Object(ay))}))?function(t,e){var n=ey(ty(t));return ry(n,e>>>0||(sy(oy,n)?16:10))}:ry;function ly(t){var e=new Date(t);return"".concat(e.getFullYear(),"-")+"".concat(e.getMonth()+1<10?"0".concat(e.getMonth()+1):e.getMonth()+1,"-")+uy(e.getDate()," ")+uy(e.getHours(),":")+uy(e.getMinutes(),":")+uy(e.getSeconds(),"")}function uy(t,e){return"".concat(t<10?"0".concat(t).concat(e):"".concat(t).concat(e))}Ri({global:!0,forced:parseInt!==cy},{parseInt:cy});var hy={exports:{}};self;var fy=L(hy.exports=(()=>(()=>{var t={530:function(t,e,n){var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)},i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function o(t){try{c(r.next(t))}catch(t){a(t)}}function s(t){try{c(r.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}c((r=r.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(e,"__esModule",{value:!0});var o,s=n(928),c=n(434),l=n(757),u=n(150),h=n(758),f=n(23);!function(t){t[t.DEBUG=0]="DEBUG",t[t.INFO=1]="INFO",t[t.WARING=2]="WARING",t[t.ERROR=3]="ERROR"}(o||(o={}));var d={metric:!0,context:!0},p=function(t,e,n){return void 0===n&&(n=0),(0,s.isPlainObject)(t)?(0,s.isPlainObject)(e)?(Object.keys(e).forEach((function(r){var i=t[r],a=e[r];t[r]=d[r]&&0===n?p(i,a,1):a})),t):t:(0,s.isPlainObject)(e)?e:{}},v={clsConfig:{endpoint:"",topicId:""}},g=function(){function t(t){var e=this;this.url="",this.uploadChannel="",this.sendPipe=null,this.sendEsPipe=null,this._logLevel=o.INFO,this._getReportDataList=[];var n=t||v,r=n.clsConfig,s=n.esConfig,c=r.endpoint,d=r.topicId;this.esConfig=s,this.endpoint=c,this.topicId=d;var p=this.buildUploadUrl();this.url=p,this.initPageUnloadMonitor(),this.sendPipe=(0,l.createPipeline)([(0,f.createThrottlePipe)(this,5),(0,u.formatClsLog)(),(0,h.limitLengthPipe)(),function(t){return i(e,void 0,void 0,(function(){var e,n,r=this;return a(this,(function(o){return e=0,n=function(){return i(r,void 0,void 0,(function(){var r;return a(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.send({url:p,data:t})];case 1:return i.sent(),[3,3];case 2:return r=i.sent(),e<=2?(e++,setTimeout((function(){n()}),1e3)):console.debug(r),[3,3];case 3:return[2]}}))}))},n(),[2]}))}))}])}return t.prototype.initPageUnloadMonitor=function(){var t=this,e=this;!(0,s.isMiniProgram)()&&document&&"function"==typeof document.addEventListener&&document.addEventListener("visibilitychange",(function(){if("hidden"===document.visibilityState){var n=t.getCommonReportData(),r=p(n,{level:o.WARING,method:"PAGE_UNLOAD",type:"event"});if(e.esConfig)try{var s=e.esConfig,c=s.url,d=s.table;(0,l.createPipeline)([(0,f.createThrottlePipe)(e,1),(0,u.formatESLog)({table:d}),(0,h.limitLengthPipe)(),function(e){return i(t,void 0,void 0,(function(){var t;return a(this,(function(n){try{t=new Blob([JSON.stringify(e)],{type:"application/x-www-form-urlencoded"}),null===navigator||void 0===navigator||navigator.sendBeacon(c,t)}catch(t){console.debug(t)}return[2]}))}))}])(r)}catch(t){console.debug(t)}}}))},t.prototype.updateEsConfig=function(t){var e=this;try{if(t){this.esConfig=t;var n=t.url,r=t.table;n&&r&&(this.uploadChannel=n,this.sendEsPipe=(0,l.createPipeline)([(0,f.createThrottlePipe)(this,5),(0,u.formatESLog)({table:r}),(0,h.limitLengthPipe)(),function(t){return i(e,void 0,void 0,(function(){var e,r,o=this;return a(this,(function(s){return e=0,r=function(){return i(o,void 0,void 0,(function(){var i;return a(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.send({url:n,data:t})];case 1:return a.sent(),[3,3];case 2:return i=a.sent(),e<=2?(e++,setTimeout((function(){r()}),1e3)):console.debug(i),[3,3];case 3:return[2]}}))}))},r(),[2]}))}))}]))}}catch(t){console.debug(t)}},t.prototype.updateGetReportData=function(t){"function"==typeof t&&this._getReportDataList.push(t)},t.prototype.setLogLevel=function(t){"number"!=typeof t&&(t=o.INFO),this._logLevel=t},t.prototype.createLogFunc=function(t){var e=this;return function(n,r){e.log(n,r,{level:t})}},t.prototype.buildUploadUrl=function(){return this.endpoint&&this.topicId?"".concat(this.endpoint,"/tracklog?topic_id=").concat(this.topicId):""},t.prototype.info=function(t,e){this.log(t,e,{level:o.INFO})},t.prototype.debug=function(t,e){this.log(t,e,{level:o.DEBUG})},t.prototype.warn=function(t,e){this.log(t,e,{level:o.WARING})},t.prototype.error=function(t,e){this.log(t,e,{level:o.ERROR})},t.prototype.log=function(t,e,n){try{var i=n||{},a=i.level;if(i.topicId,this._logLevel<=a){var o=this.getCommonReportData(),s=p(o,r({level:a,method:t},e));this.sendPipe(s),"function"==typeof this.sendEsPipe&&this.sendEsPipe(s)}}catch(t){console.debug(t)}},t.prototype.getCommonReportData=function(){for(var t={},e=0;e<this._getReportDataList.length;e++)t=p(t,this._getReportDataList[e]());return t},t.prototype.send=function(t){return i(this,void 0,void 0,(function(){var e,n,r,i;return a(this,(function(a){switch(a.label){case 0:n=(e=t||{}).url,r=e.data,a.label=1;case 1:return a.trys.push([1,4,,5]),n?[4,(0,c.request)({url:n,data:r,method:"post"})]:[3,3];case 2:a.sent(),a.label=3;case 3:return[3,5];case 4:throw i=a.sent(),console.debug(i),new Error(i);case 5:return[2]}}))}))},t}();e.default=g},314:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatClsLog=void 0;var r=n(928);e.formatClsLog=function(){return function(t,e){try{e({logs:null==t?void 0:t.map((function(t){var e={};return Object.keys(t).forEach((function(n){if((0,r.isPlainObject)(t[n]))try{e[n]=(0,r.stringifyPlus)(t[n])}catch(t){console.debug(t)}else"time"===n&&(e[n]=new Date(t[n]).toISOString()),e[n]=t[n]+""})),{contents:e,time:t.time}})),source:""})}catch(t){console.debug(t)}}}},597:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatESLog=void 0;var r=n(928);e.formatESLog=function(t){var e=t.table;return function(t,n){try{var i=null==t?void 0:t.map((function(t){var e={};return Object.keys(t).forEach((function(n){if((0,r.isPlainObject)(t[n]))try{e[n]=(0,r.stringifyPlus)(t[n])}catch(t){console.debug(t)}else e[n]="level"===n?t[n]+"":"time"===n?new Date(t[n]).toISOString():t[n]})),e}));n({table:e,report:i})}catch(t){console.debug(t)}}}},150:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.formatClsLog=e.formatESLog=void 0;var r=n(314);Object.defineProperty(e,"formatClsLog",{enumerable:!0,get:function(){return r.formatClsLog}});var i=n(597);Object.defineProperty(e,"formatESLog",{enumerable:!0,get:function(){return i.formatESLog}})},757:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createPipeline=void 0;var r=n(928);e.createPipeline=function(t){if(!t||!t.reduce||!t.length)throw new TypeError("createPipeline need at least one function param");return 1===t.length?function(e,n){t[0](e,n||r.noop)}:t.reduce((function(t,e){return function(n,i){return void 0===i&&(i=r.noop),t(n,(function(t){return null==e?void 0:e(t,i)}))}}))}},758:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.limitLengthPipe=e.MAX_LOG_LENGTH=void 0;var r=n(928);e.MAX_LOG_LENGTH=102400,e.limitLengthPipe=function(){return function(t,n){try{var i=(t=t||{}).logs,a=void 0===i?[]:i;t.logs=null==a?void 0:a.map((function(t){var n=e.MAX_LOG_LENGTH,i=t.contents;return Object.keys(i).forEach((function(t){var e=i[t];try{e&&e.length>n&&(i[t]=null==e?void 0:e.substring(0,n))}catch(a){console.debug("size of content > limitSize"),i[t]=(0,r.stringifyPlus)(e).substring(0,n)}})),t})),n(t)}catch(t){console.debug(t)}}}},23:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.createThrottlePipe=void 0,e.createThrottlePipe=function(t,e){var n,r=[];return function(i,a){if(Array.isArray(i)?r=r.concat(i):r.push(i),e&&r.length>=e||t.sendNow&&r.length>0)return a(r.splice(0,r.length)),void(n&&clearTimeout(n));n&&clearTimeout(n),n=setTimeout((function(){n=null,r.length>0&&a(r.splice(0,r.length))}),t.delay||1e3)}}},434:function(t,e,n){var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)},i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function o(t){try{c(r.next(t))}catch(t){a(t)}}function s(t){try{c(r.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}c((r=r.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}},o=this&&this.__rest||function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n};Object.defineProperty(e,"__esModule",{value:!0}),e.request=void 0;var s=n(147),c=n(310),l=n(928);e.request=function(t){return i(void 0,void 0,void 0,(function(){var e=t.url,n=t.data,i=t.header,u=void 0===i?{}:i,h=t.method,f=void 0===h?"GET":h,d=t.dataType,p=t.responseType,v=o(t,["url","data","header","method","dataType","responseType"]);return a(this,(function(t){return(0,l.isBrowser)()?[2,(0,c.requestXHR)(e,n,{headers:u,method:f,responseType:p,dataType:d})]:(0,l.isMiniProgram)()?[2,(0,s.requestWeapp)(r({url:e,data:n,header:u,method:f,dataType:d,responseType:p},v))]:(console.debug("unsupport env"),[2])}))}))}},147:function(t,e,n){var r=this&&this.__assign||function(){return r=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},r.apply(this,arguments)},i=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function o(t){try{c(r.next(t))}catch(t){a(t)}}function s(t){try{c(r.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}c((r=r.apply(t,e||[])).next())}))},a=this&&this.__generator||function(t,e){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.requestWeapp=void 0;var o=n(690),s=0;e.requestWeapp=function(t){return i(this,void 0,void 0,(function(){var e;return a(this,(function(n){switch(n.label){case 0:n.trys.push([0,5,6,7]),n.label=1;case 1:return s>=2?[4,(0,o.startBlocking)()]:[3,3];case 2:return n.sent(),[3,1];case 3:return s++,[4,new Promise((function(e,n){wx.request(r(r({},t),{success:function(t){e(t)},fail:function(t){n(t)}}))}))];case 4:return[2,n.sent()];case 5:return e=n.sent(),[2,Promise.reject(e)];case 6:return s--,(0,o.resolveFirstBlock)(),[7];case 7:return[2]}}))}))}},310:function(t,e,n){var r=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(i,a){function o(t){try{c(r.next(t))}catch(t){a(t)}}function s(t){try{c(r.throw(t))}catch(t){a(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,s)}c((r=r.apply(t,e||[])).next())}))},i=this&&this.__generator||function(t,e){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((i=(i=o.trys).length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};Object.defineProperty(e,"__esModule",{value:!0}),e.requestXHR=void 0;var a=n(580),o=n(690),s=0;function c(t,e,n){n.status?e(new Error("Request failed with status code "+n.status)):t(n)}e.default=c,e.requestXHR=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n={}),r(this,void 0,void 0,(function(){var l,u=this;return i(this,(function(h){switch(h.label){case 0:return h.trys.push([0,2,3,4]),[4,new Promise((function(l,h){return r(u,void 0,void 0,(function(){var r,u,f,d,p,v;return i(this,(function(i){switch(i.label){case 0:return s>=2?[4,(0,o.startBlocking)()]:[3,2];case 1:return i.sent(),[3,0];case 2:return s++,r=n.method,u=n.headers,f=void 0===u?{}:u,d=n.responseType,p=void 0===d?"json":d,r=(r||"get").toUpperCase(),Object.assign(f,{"Content-type":"application/json"}),(v=new window.XMLHttpRequest).responseType=p,v.timeout=1e4,v.onreadystatechange=function(){4===v.readyState&&(200===v.status?l({data:v.response}):h({code:v.status,msg:v.statusText}))},v.ontimeout=function(t){h({code:v.status,msg:v.statusText})},v.onloadend=function(){v&&(c((function(t){l(t)}),(function(t){h(t)}),{status:v.status,statusText:v.statusText}),v=null)},v.onabort=function(){v&&(h(new Error("Request aborted")),v=null)},v.onerror=function(){h(new Error("Network Error")),v=null},"GET"===r?t="url".concat(-1===t.indexOf("?")?"?":"&").concat(a.default.stringify(e)):"POST"===r&&(e=JSON.stringify(e)),v.open(r,t,!0),Object.keys(f).forEach((function(t){v.setRequestHeader(t,f[t])})),v.send("POST"===r?e:null),[2]}}))}))}))];case 1:return[2,h.sent()];case 2:throw l=h.sent(),new Error(l);case 3:return s--,(0,o.resolveFirstBlock)(),[7];case 4:return[2]}}))}))}},928:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.date2ISOString=e.stringifyPlus=e.noop=e.isBrowser=e.isMiniProgram=e.isPlainObject=e.appendParams=void 0,e.appendParams=function(t,n){void 0===n&&(n={});var r=[];return Object.keys(n).forEach((function(t){var i=n[t];if(void 0!==i){if((0,e.isPlainObject)(i))try{i=JSON.stringify(i)}catch(t){}r.push("".concat(t,"=").concat(encodeURIComponent(i)))}})),r.length?(t.indexOf("?")>-1?"".concat(t,"&"):"".concat(t,"?"))+r.join("&"):t},e.isPlainObject=function(t){if("object"!=typeof t||null===t)return!1;var e=Object.getPrototypeOf(t);if(null===e)return!0;for(var n=e;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return e===n},e.isMiniProgram=function(){try{return!(!(null===wx||void 0===wx?void 0:wx.request)||!(null===wx||void 0===wx?void 0:wx.connectSocket))}catch(t){return!1}},e.isBrowser=function(){try{return!(0,e.isMiniProgram)()&&"undefined"!=typeof window&&void 0!==window.document}catch(t){return!1}},e.noop=function(){};var n=function(){var t=new WeakSet;return function(e,n){if(n instanceof Error)return"Error.message: ".concat(n.message," \n Error.stack: ").concat(n.stack);if("object"==typeof n&&null!==n){if(t.has(n))return"[Circular ".concat(e||"root","]");t.add(n)}return n}};e.stringifyPlus=function(t){if("string"==typeof t)return t;try{return t instanceof Error?(JSON.stringify(t,n())||"undefined").replace(/"/gim,""):JSON.stringify(t,n())||"undefined"}catch(t){return"error happen when aegis stringify: \n ".concat(t.message," \n ").concat(t.stack)}},e.date2ISOString=function(){var t,e=new Date,n=e.toISOString(),r=e.getTimezoneOffset()/60;return t=r<0?r>-10?"+0".concat(Math.abs(100*r)):"+".concat(Math.abs(100*r)):r>=10?"-".concat(100*r):"-0".concat(100*r),n.replace("Z",t)}},580:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0});var r=n(928);e.default={stringify:function(t){return t?Object.keys(t).map((function(e){var n=t[e];if((0,r.isPlainObject)(n))n=JSON.stringify(n);else{if("string"!=typeof n&&"number"!=typeof n)return"";n=+n}return encodeURIComponent(e)+"="+encodeURIComponent(n)})).filter((function(t){return t.length>0})).join("&"):""}}},690:(t,e)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.startBlocking=e.resolveFirstBlock=void 0;var n=[];e.startBlocking=function(){var t,e=new Promise((function(e){t=e}));return n.push({promise:e,resolve:t}),e},e.resolveFirstBlock=function(){n.length&&(n[0].resolve(),n.shift())}}},e={};function n(r){var i=e[r];if(void 0!==i)return i.exports;var a=e[r]={exports:{}};return t[r].call(a.exports,a,a.exports,n),a.exports}var r={};return(()=>{var t=r;Object.defineProperty(t,"__esModule",{value:!0});var e=n(530),i={debug:console.debug,info:console.info,warn:console.warn,error:console.error,updateGetReportData:function(t){console.debug(t)}},a=null;t.default=function(t){if(!a){var n=t||{},r=n.clsConfig,o=(n.esConfig,r.endpoint),s=r.topicId;if(!o||!s)return console.debug("endpoint and topicId must not be null"),i;a=new e.default(t)}return a}})(),r})())()),dy=U,py=wn.EXISTS,vy=X,gy=zs,yy=Function.prototype,Iy=vy(yy.toString),my=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,_y=vy(my.exec);dy&&!py&&gy(yy,"name",{configurable:!0,get:function(){try{return _y(my,Iy(this))[1]}catch(t){return""}}});var Ey={UNKNOWN:65535,NO_NETWORK:2805,FAILURE_SWITCH_TO_AUDIO:60001,FAILURE_SWITCH_TO_VIDEO:60002,ERROR_PACKAGE_NOT_PURCHASED:-1001,ERROR_PACKAGE_NOT_SUPPORTED:-1002,ERROR_TIM_VERSION_OUTDATED:-1003,ERROR_PERMISSION_DENIED:-1101,ERROR_GET_DEVICE_LIST_FAIL:-1102,ERROR_INIT_FAIL:-1201,ERROR_PARAM_INVALID:-1202,ERROR_REQUEST_REFUSED:-1203,ERROR_REQUEST_REPEATED:-1204,ERROR_SCENE_NOT_SUPPORTED:-1205,ERROR_SIGNALING_SEND_FAIL:-1401,ERROR_INVALID_INVITEID:8010,ERROR_INVALID_SEND_FAIL:8021,ERROR_BLACKLIST:20007},Ty="未连接到网络",Cy="You do not have TUICallKit package, please open the free experience in the console: https://console.intl.cloud.tencent.com/im/detail or purchase the official package: ${purchaseAddress}",by="The package you purchased does not support this ability. You can refer to here to purchase: ${purchaseAddress}",Dy="TIM SDK version is too old. Please upgrade version",Ry="init is not complete, this API needs to be used after init. To solve the problem, please go to: https://cloud.tencent.com/document/product/647/78769#3a61f42b-e06f-49af-88bf-362d40025887",wy="The API is support use in the state of. Please go to: https://cloud.tencent.com/document/product/647/78769#5e65043d-e3dc-4bd3-8220-3ac7694dfa42",Sy={NO_NETWORK:"未连接到网络",FAILURE_SWITCH_TO_AUDIO:"切换语音通话失败",FAILURE_SWITCH_TO_VIDEO:"切换视频通话失败",ERROR_NULL:"成功",ERROR_PACKAGE_NOT_PURCHASED:"您的应用还未开通音视频通话(TUICallKit)能力,您可以去控制台申请免费体验: https://console.cloud.tencent.com/im/detail 或购买通话能力套餐包: ${purchaseAddress}",ERROR_PACKAGE_NOT_SUPPORTED:"您暂不支持使用该能力,请前往如下购买页购买开通: ${purchaseAddress}",ERROR_TIM_VERSION_OUTDATED:"TIM SDK 版本太旧,请升级版本",ERROR_PERMISSION_DENIED:"摄像头/麦克风权限被拒绝。解决方案请前往: https://cloud.tencent.com/document/product/647/78770",ERROR_GET_DEVICE_LIST_FAIL:"获取设备列表失败",ERROR_INIT_FAIL:"TUICallEngine init 未完成,需要在 init 完成后使用此 API。解决方案请前往: https://cloud.tencent.com/document/product/647/78769#3a61f42b-e06f-49af-88bf-362d40025887",ERROR_REQUEST_REFUSED:"当前通话状态无法使用该API。解决方案请前往: https://cloud.tencent.com/document/product/647/78769#5e65043d-e3dc-4bd3-8220-3ac7694dfa42",ERROR_REQUEST_REPEATED:"当前方法正在执行中,请勿重复调用",ERROR_REQUEST_REPEATED_SWITCH:"与当前通话类型一致,请勿重复切换",ERROR_SCENE_NOT_SUPPORTED:"当前通话场景不支持该功能",ERROR_SIGNALING_SEND_FAIL:"信令发送失败",ERROR_INVALID_INVITEID:"inviteID 无效或邀请已处理。解决方案请前往: https://cloud.tencent.com/document/product/647/84363#e97ea97b-7812-42ed-89b7-2a3840ac0e3f",ERROR_INVALID_SEND_FAIL:"消息发送失败,常见原因:被叫用户 userID 或群 groupID 不存在。解决方案请前往: https://cloud.tencent.com/document/product/647/84363#661be1b0-f649-4199-a343-958c3f4f4bbb",ERROR_PARAM_INVALID:"参数错误"},xy=function(t){for(var e=0,n=Object.keys(Ey);e<n.length;e++){var r=n[e];if(Ey[r]===t)return r}return"UNKNOWN"},Ly=function(t){for(var e=0,n=Object.keys(Sy);e<n.length;e++){var r=n[e];if(Ey[r]===t)return Sy[r]}return"UNKNOWN"},ky=function(t){d(n,I(Error));var e=T(n);function n(t){var r,i=t.message,a=t.code,o=void 0===a?Ey.UNKNOWN:a;return l(this,n),(r=o===Ey.ERROR_INVALID_SEND_FAIL?e.call(this,"".concat(Ly(o))+" <".concat(xy(o),": ").concat(o,">")):e.call(this,"".concat(i).concat(Ly(o))+" <".concat(xy(o),": ").concat(o,">"))).code=o,r.name="TUICallEngineError",r.message_=i,E(r)}return h(n,[{key:"getCode",value:function(){return this.code}}]),n}(),Oy=["inviteID","type"],Ay=function(){function t(e){l(this,t),f(this,"_tuiCallEngine",null),this._tuiCallEngine=e.tuiCallEngine,this._chat=e.chat,this._logger=fy()}var e,n,a,o,s,u,d;return h(t,[{key:"handleNewSignaling",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return this._logger.info("TSignaling.handleNewSignaling.start",{text:{data:{data:t,params:e,userData:n}},type:"api"}),r(r({userData:n||""},t),{},{version:4,businessID:"av_call",platform:"MiniApp",data:r({cmd:_g[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!==fg)return"";switch(e.actionType){case sg:var n=JSON.parse(e.data);return n.call_end>0&&!e.groupID?n.call_end:0!==n.call_end&&n.room_id?"发起通话":"结束群聊";case cg:return"取消通话";case lg:return"已接听";case ug:return"拒绝通话";case hg:return"无应答";default:return""}}},{key:"handleError",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.code,n=void 0===e?"":e,r=t.message;if(n)throw new ky({message:void 0===r?"":r,code:n})}},{key:"_handleInviteData",value:function(t){var e=t.type,n=t.roomID,r=t.userIDList,i=t.hangup,a=t.switchMode,o=t.userData;if(i)return JSON.stringify(this.handleNewSignaling({version:0,call_type:e,call_end:i.callEnd},{cmd:"hangup"}));if(a){var s={version:0,call_type:e,room_id:n},c={cmd:"switchToVideo"};return a===Eg&&(s.switch_to_audio_call="switch_to_audio_call",c.cmd="switchToAudio"),JSON.stringify(this.handleNewSignaling(s,c))}var l=this.handleNewSignaling({version:0,call_type:e,room_id:n},{userIDs:r},o);return this._tuiCallEngine.setInitialInviteData(l),JSON.stringify(l)}},{key:"_handleInviteGroupData",value:function(t){var e=t.type,n=t.roomID,r=t.hangup,i=t.userData;return r?JSON.stringify(this.handleNewSignaling({version:0,call_type:e,call_end:r.call_end},{cmd:"hangup"},i)):JSON.stringify(this.handleNewSignaling({version:0,call_type:e,room_id:n}))}},{key:"invite",value:(d=c(i().mark((function t(e){var n,r,a,o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("TSignaling.invite.start",{text:{data:{params:e}},type:"api"}),n=e.userID,r=e.offlinePushInfo,a=e.hangup,o=e.switchMode,t.prev=2,t.next=5,this._chat.invite({userID:n,data:this._handleInviteData(e),timeout:a?0:30,offlinePushInfo:r});case 5:return t.abrupt("return",t.sent);case 8:if(t.prev=8,t.t0=t.catch(2),this._logger.error("TSignaling.invite.fail",{text:{data:{hangup:a,switchMode:o},error:t.t0},type:"api"}),!a){t.next=13;break}return t.abrupt("return",this.handleError(t.t0,"hangup C2C"));case 13:if(!o){t.next=15;break}return t.abrupt("return",this.handleError(t.t0,o));case 15:return t.abrupt("return",this.handleError(t.t0,"invite"));case 16:case"end":return t.stop()}}),t,this,[[2,8]])}))),function(t){return d.apply(this,arguments)})},{key:"inviteGroup",value:(u=c(i().mark((function t(e){var n,r,a,o,s,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("TSignaling.inviteGroup.start",{text:{data:{params:e}},type:"api"}),n=e.groupID,r=e.userIDList,a=e.offlinePushInfo,o=e.hangup,s=e.inCallUserIDs,c=void 0===s?[]:s,t.prev=2,t.next=5,this._chat.inviteInGroup({groupID:n,inviteeList:r,timeout:o?0:30,data:this._handleInviteGroupData(e),offlinePushInfo:a,inCallUserIDs:c});case 5:return t.abrupt("return",t.sent);case 8:if(t.prev=8,t.t0=t.catch(2),this._logger.error("TSignaling.inviteGroup.fail",{text:{data:{hangup:o},error:t.t0},type:"api"}),!o){t.next=13;break}return t.abrupt("return",this.handleError(t.t0,"hangup group"));case 13:return t.abrupt("return",this.handleError(t.t0,"inviteGroup"));case 14:case"end":return t.stop()}}),t,this,[[2,8]])}))),function(t){return u.apply(this,arguments)})},{key:"accept",value:(s=c(i().mark((function t(e,n){var a,o,s;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("TSignaling.accept.start",{text:{data:{params:e,supportParams:n}},type:"api"}),a=e.inviteID,o=e.type,s=m(e,Oy),t.prev=2,t.next=5,this._chat.accept({inviteID:a,data:JSON.stringify(this.handleNewSignaling(r({version:0,call_type:o},s),n))});case 5:return t.abrupt("return",t.sent);case 8:return t.prev=8,t.t0=t.catch(2),this._logger.error("TSignaling.accept.fail",{text:{error:t.t0},type:"api"}),t.abrupt("return",this.handleError(t.t0,"accept"));case 12:case"end":return t.stop()}}),t,this,[[2,8]])}))),function(t,e){return s.apply(this,arguments)})},{key:"reject",value:(o=c(i().mark((function t(e){var n,r,a,o,s;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("TSignaling.reject.start",{text:{data:{params:e}},type:"api"}),n=e.inviteID,r=e.type,a=e.lineBusy,o={version:0,call_type:r},s=null,a?(o.line_busy=a,s=JSON.stringify(this.handleNewSignaling(o,{message:"lineBusy"}))):s=JSON.stringify(this.handleNewSignaling(o)),t.prev=5,t.next=8,this._chat.reject({inviteID:n,data:s});case 8:return t.abrupt("return",t.sent);case 11:if(t.prev=11,t.t0=t.catch(5),this._logger.error("TSignaling.reject.fail",{text:{error:t.t0},type:"api"}),!a){t.next=16;break}return t.abrupt("return",this.handleError(t.t0,"line_busy"));case 16:return t.abrupt("return",this.handleError(t.t0,"reject"));case 17:case"end":return t.stop()}}),t,this,[[5,11]])}))),function(t){return o.apply(this,arguments)})},{key:"cancel",value:(a=c(i().mark((function t(e){var n,r,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("TSignaling.cancel.start",{text:{data:{params:e}},type:"api"}),n=e.inviteID,r=e.callType,t.prev=2,t.next=5,this._chat.cancel({inviteID:n,data:JSON.stringify(this.handleNewSignaling({version:0,call_type:r}))});case 5:return a=t.sent,t.abrupt("return",a);case 9:return t.prev=9,t.t0=t.catch(2),this._logger.error("TSignaling.cancel.fail",{text:{error:t.t0},type:"api"}),t.abrupt("return",this.handleError(t.t0,"cancel"));case 13:case"end":return t.stop()}}),t,this,[[2,9]])}))),function(t){return a.apply(this,arguments)})},{key:"hangup",value:(n=c(i().mark((function t(e){var n,r,a,o,s,c,l,u,h,f,d;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("TSignaling.hangup.start",{text:{data:{params:e}},type:"api"}),n=e.userIDList,r=e.callType,a=e.callEnd,o=void 0===a?0:a,s=e.isGroupCall,c=void 0!==s&&s,l=e.groupID,u=void 0===l?"":l,h={version:0,call_type:r,call_end:o},f={cmd:"hangup"},d=JSON.stringify(this.handleNewSignaling(h,f)),!c||!u){t.next=10;break}return t.next=8,this._chat.inviteInGroup({inviteeList:n,groupID:u,data:d,timeout:0});case 8:t.next=12;break;case 10:return t.next=12,this._chat.invite({userID:n[0],data:d,timeout:0});case 12:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"switchCallMode",value:(e=c(i().mark((function t(e){var n,r,a,o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("TSignaling.switchCallMode.start",{text:{data:{params:e}},type:"api"}),n=e.userID,r=e.callType,a=e.roomID,o=e.mode,t.abrupt("return",this.invite({userID:n,type:r,roomID:a,switchMode:o}));case 3:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})},{key:"destroyed",value:function(){this._logger.info("TSignaling.destroyed.start",{type:"api"}),this._chat=null}},{key:"setLogLevel",value:function(t){this._chat.setLogLevel(t)}}]),t}(),Ny=function(){function t(e){l(this,t),this._emitter=e.emitter,this._logger=fy()}return h(t,[{key:"onError",value:function(t){this._logger.error("TUICallEvent.onError",{text:{error:t},type:"event"}),this._emitter.emit(ag.ERROR,t)}},{key:"onCallBegin",value:function(t){this._logger.info("TUICallEvent.onCallBegin",{text:{data:t},type:"event"}),this._emitter.emit(ag.ON_CALL_BEGIN,t)}},{key:"onCallEnd",value:function(t){this._logger.info("TUICallEvent.onCallEnd",{text:{data:t},type:"event"});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(ag.CALL_END,{userID:e,callEnd:n,message:r,roomID:i,callMediaType:a,callRole:o,totalTime:s})}},{key:"onInvited",value:function(t){this._logger.info("TUICallEvent.onInvited",{text:{data:t},type:"event"}),this._emitter.emit(ag.INVITED,t),this._emitter.emit(ag.ON_CALL_RECEIVED,t)}},{key:"onLineBusy",value:function(t){this._logger.info("TUICallEvent.onLineBusy",{text:{data:t},type:"event"});var e=t.inviteID,n=t.invitee,r=t.userID;this._emitter.emit(ag.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(ag.REJECT,{inviteID:e,invitee:n,userID:r,reason:"reject"})}},{key:"onNoResp",value:function(t){this._logger.info("TUICallEvent.onNoResp",{text:{data:t},type:"event"});var e=t.groupID,n=void 0===e?"":e,r=t.inviteID,i=t.sponsor,a=t.timeoutUserList,o=t.userIDList;this._emitter.emit(ag.NO_RESP,{groupID:n,inviteID:r,sponsor:i,timeoutUserList:a,userIDList:o})}},{key:"onCancel",value:function(t){this._emitter.emit(ag.CALLING_CANCEL,t),this._emitter.emit(ag.ON_CALL_CANCELED,t)}},{key:"onTimeout",value:function(t){this._logger.info("TUICallEvent.onTimeout",{text:{data:t},type:"event"});var e=t.inviteID,n=t.groupID,r=t.sponsor,i=t.timeoutUserList;this._emitter.emit(ag.CALLING_TIMEOUT,{groupID:n,inviteID:e,sponsor:r,timeoutUserList:i})}},{key:"onUserAccept",value:function(t){this._logger.info("TUICallEvent.onUserAccept",{text:{data:t},type:"event"});var e=t.userID,n=t.userList;this._emitter.emit(ag.USER_ACCEPT,{userID:e,userList:n})}},{key:"onUserEnter",value:function(t){this._logger.info("TUICallEvent.onUserEnter",{text:{data:t},type:"event"});var e=t.userID,n=t.playerList;this._emitter.emit(ag.USER_ENTER,{userID:e,playerList:n})}},{key:"onUserLeave",value:function(t){this._logger.info("TUICallEvent.onUserLeave",{text:{data:t},type:"event"});var e=t.userID,n=t.playerList;this._emitter.emit(ag.USER_LEAVE,{userID:e,playerList:n})}},{key:"onUserUpdate",value:function(t){var e=t.pusher,n=t.playerList;this._emitter.emit(ag.USER_UPDATE,{pusher:e,playerList:n})}},{key:"onSdkReady",value:function(t){this._logger.info("TUICallEvent.onSdkReady",{text:{data:t},type:"event"}),this._emitter.emit(ag.SDK_READY,t)}},{key:"onKickedOut",value:function(t){this._logger.info("TUICallEvent.onKickedOut",{text:{data:t},type:"event"}),this._emitter.emit(ag.KICKED_OUT,t)}},{key:"onCallMode",value:function(t){this._logger.info("TUICallEvent.onCallMode",{text:{data:t},type:"event"}),this._emitter.emit(ag.CALL_MODE,t)}},{key:"onMessageSentByMe",value:function(t){this._logger.info("TUICallEvent.onMessageSentByMe",{text:{data:t},type:"event"}),this._emitter.emit(ag.MESSAGE_SENT_BY_ME,t)}},{key:"destroyed",value:function(){this._logger.info("TUICallEvent.destroyed",{type:"api"}),this._emitter=null}}]),t}(),Uy="2.1.3";_v("Map",(function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}}),Mv);var Py=on,My=function(){var t=Py(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},jy=V,Vy=fe,Gy=Et,Hy=My,By=RegExp.prototype,Fy=wn.PROPER,Ky=br,zy=on,Jy=mf,Wy=N,qy=function(t){var e=t.flags;return void 0!==e||"flags"in By||Vy(t,"flags")||!Gy(By,t)?e:jy(Hy,t)},Yy="toString",$y=RegExp.prototype,Xy=$y[Yy],Qy=Wy((function(){return"/a/b"!==Xy.call({source:"a",flags:"b"})})),Zy=Fy&&Xy.name!==Yy;(Qy||Zy)&&Ky($y,Yy,(function(){var t=zy(this);return"/"+Jy(t.source)+"/"+Jy(qy(t))}),{unsafe:!0});var tI,eI,nI=jp;Ri({target:"Object",stat:!0,forced:Object.isExtensible!==nI},{isExtensible:nI}),tI="undefined"!=typeof console?console:"undefined"!=typeof global&&global.console?global.console:"undefined"!=typeof window&&window.console?window.console:{};for(var rI=function(){},iI=["assert","clear","count","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],aI=iI.length-1;aI;)eI=iI[aI],console[eI]||(tI[eI]=rI),aI-=1;Object.isExtensible(tI)&&(tI.methods=iI);var oI,sI,cI=tI,lI=N,uI=O.RegExp,hI=lI((function(){var t=uI("a","y");return t.lastIndex=2,null!==t.exec("abcd")})),fI=hI||lI((function(){return!uI("a","y").sticky})),dI={BROKEN_CARET:hI||lI((function(){var t=uI("^r","gy");return t.lastIndex=2,null!==t.exec("str")})),MISSED_STICKY:fI,UNSUPPORTED_Y:hI},pI=N,vI=O.RegExp,gI=pI((function(){var t=vI(".","s");return!(t.dotAll&&t.test("\n")&&"s"===t.flags)})),yI=N,II=O.RegExp,mI=yI((function(){var t=II("(?<a>b)","g");return"b"!==t.exec("b").groups.a||"bc"!=="b".replace(t,"$<a>c")})),_I=V,EI=X,TI=mf,CI=My,bI=dI,DI=Zt.exports,RI=Qo,wI=nr.get,SI=gI,xI=mI,LI=DI("native-string-replace",String.prototype.replace),kI=RegExp.prototype.exec,OI=kI,AI=EI("".charAt),NI=EI("".indexOf),UI=EI("".replace),PI=EI("".slice),MI=(sI=/b*/g,_I(kI,oI=/a/,"a"),_I(kI,sI,"a"),0!==oI.lastIndex||0!==sI.lastIndex),jI=bI.BROKEN_CARET,VI=void 0!==/()??/.exec("")[1];(MI||VI||jI||SI||xI)&&(OI=function(t){var e,n,r,i,a,o,s,c=this,l=wI(c),u=TI(t),h=l.raw;if(h)return h.lastIndex=c.lastIndex,e=_I(OI,h,u),c.lastIndex=h.lastIndex,e;var f=l.groups,d=jI&&c.sticky,p=_I(CI,c),v=c.source,g=0,y=u;if(d&&(p=UI(p,"y",""),-1===NI(p,"g")&&(p+="g"),y=PI(u,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==AI(u,c.lastIndex-1))&&(v="(?: "+v+")",y=" "+y,g++),n=new RegExp("^(?:"+v+")",p)),VI&&(n=new RegExp("^"+v+"$(?!\\s)",p)),MI&&(r=c.lastIndex),i=_I(kI,d?n:c,y),d?i?(i.input=PI(i.input,g),i[0]=PI(i[0],g),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:MI&&i&&(c.lastIndex=c.global?i.index+i[0].length:r),VI&&i&&i.length>1&&_I(LI,i[0],n,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(i[a]=void 0)})),i&&f)for(i.groups=o=RI(null),a=0;a<f.length;a++)o[(s=f[a])[0]]=i[s[1]];return i});var GI=OI;Ri({target:"RegExp",proto:!0,forced:/./.exec!==GI},{exec:GI});var HI=Fa,BI=br,FI=GI,KI=N,zI=we,JI=_n,WI=zI("species"),qI=RegExp.prototype,YI=function(t,e,n,r){var i=zI(t),a=!KI((function(){var e={};return e[i]=function(){return 7},7!==""[t](e)})),o=a&&!KI((function(){var e=!1,n=/a/;return"split"===t&&((n={}).constructor={},n.constructor[WI]=function(){return n},n.flags="",n[i]=/./[i]),n.exec=function(){return e=!0,null},n[i](""),!e}));if(!a||!o||n){var s=HI(/./[i]),c=e(i,""[t],(function(t,e,n,r,i){var o=HI(t),c=e.exec;return c===FI||c===qI.exec?a&&!i?{done:!0,value:s(e,n,r)}:{done:!0,value:o(n,e,r)}:{done:!1}}));BI(String.prototype,t,c[0]),BI(qI,i,c[1])}r&&JI(qI[i],"sham",!0)},$I=Sf.charAt,XI=function(t,e,n){return e+(n?$I(t,e).length:1)},QI=V,ZI=on,tm=vt,em=et,nm=GI,rm=TypeError,im=function(t,e){var n=t.exec;if(tm(n)){var r=QI(n,t,e);return null!==r&&ZI(r),r}if("RegExp"===em(t))return QI(nm,t,e);throw new rm("RegExp#exec called on incompatible receiver")},am=V,om=on,sm=st,cm=Pr,lm=mf,um=ut,hm=qt,fm=XI,dm=im;YI("match",(function(t,e,n){return[function(e){var n=um(this),r=sm(e)?void 0:hm(e,t);return r?am(r,e,n):new RegExp(e)[t](lm(n))},function(t){var r=om(this),i=lm(t),a=n(e,r,i);if(a.done)return a.value;if(!r.global)return dm(r,i);var o=r.unicode;r.lastIndex=0;for(var s,c=[],l=0;null!==(s=dm(r,i));){var u=lm(s[0]);c[l]=u,""===u&&(r.lastIndex=fm(i,cm(r.lastIndex),o)),l++}return 0===l?null:c}]})),Ri({target:"Array",stat:!0},{isArray:Si});var pm=O,vm=X(1..valueOf),gm=Ri,ym=U,Im=O,mm=pm,_m=X,Em=Ii,Tm=fe,Cm=iv,bm=Et,Dm=Vt,Rm=Ue,wm=N,Sm=Dr.f,xm=A.f,Lm=tn.f,km=vm,Om=$g.trim,Am="Number",Nm=Im[Am];mm[Am];var Um=Nm.prototype,Pm=Im.TypeError,Mm=_m("".slice),jm=_m("".charCodeAt),Vm=function(t){var e,n,r,i,a,o,s,c,l=Rm(t,"number");if(Dm(l))throw new Pm("Cannot convert a Symbol value to a number");if("string"==typeof l&&l.length>2)if(l=Om(l),43===(e=jm(l,0))||45===e){if(88===(n=jm(l,2))||120===n)return NaN}else if(48===e){switch(jm(l,1)){case 66:case 98:r=2,i=49;break;case 79:case 111:r=8,i=55;break;default:return+l}for(o=(a=Mm(l,2)).length,s=0;s<o;s++)if((c=jm(a,s))<48||c>i)return NaN;return parseInt(a,r)}return+l},Gm=Em(Am,!Nm(" 0o1")||!Nm("0b1")||Nm("+0x1")),Hm=function(t){var e,n=arguments.length<1?0:Nm(function(t){var e=Rm(t,"number");return"bigint"==typeof e?e:Vm(e)}(t));return bm(Um,e=this)&&wm((function(){km(e)}))?Cm(Object(n),this,Hm):n};Hm.prototype=Um,Gm&&(Um.constructor=Hm),gm({global:!0,constructor:!0,wrap:!0,forced:Gm},{Number:Hm});Gm&&function(t,e){for(var n,r=ym?Sm(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++)Tm(e,n=r[i])&&!Tm(t,n)&&Lm(t,n,xm(e,n))}(mm[Am],Nm);var Bm=xr,Fm=mf,Km=ut,zm=RangeError,Jm=function(t){var e=Fm(Km(this)),n="",r=Bm(t);if(r<0||r===1/0)throw new zm("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(e+=e))1&r&&(n+=e);return n},Wm=X,qm=Pr,Ym=mf,$m=ut,Xm=Wm(Jm),Qm=Wm("".slice),Zm=Math.ceil,t_=function(t){return function(e,n,r){var i,a,o=Ym($m(e)),s=qm(n),c=o.length,l=void 0===r?" ":Ym(r);return s<=c||""===l?o:((a=Xm(l,Zm((i=s-c)/l.length))).length>i&&(a=Qm(a,0,i)),t?o+a:a+o)}},e_=X,n_=N,r_={start:t_(!1),end:t_(!0)}.start,i_=RangeError,a_=isFinite,o_=Math.abs,s_=Date.prototype,c_=s_.toISOString,l_=e_(s_.getTime),u_=e_(s_.getUTCDate),h_=e_(s_.getUTCFullYear),f_=e_(s_.getUTCHours),d_=e_(s_.getUTCMilliseconds),p_=e_(s_.getUTCMinutes),v_=e_(s_.getUTCMonth),g_=e_(s_.getUTCSeconds),y_=n_((function(){return"0385-07-25T07:06:39.999Z"!==c_.call(new Date(-50000000000001))}))||!n_((function(){c_.call(new Date(NaN))}))?function(){if(!a_(l_(this)))throw new i_("Invalid time value");var t=this,e=h_(t),n=d_(t),r=e<0?"-":e>9999?"+":"";return r+r_(o_(e),r?6:4,0)+"-"+r_(v_(t)+1,2,0)+"-"+r_(u_(t),2,0)+"T"+r_(f_(t),2,0)+":"+r_(p_(t),2,0)+":"+r_(g_(t),2,0)+"."+r_(n,3,0)+"Z"}:c_;Ri({target:"Date",proto:!0,forced:Date.prototype.toISOString!==y_},{toISOString:y_});var I_=X,m_=le,__=Math.floor,E_=I_("".charAt),T_=I_("".replace),C_=I_("".slice),b_=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,D_=/\$([$&'`]|\d{1,2})/g,R_=hc,w_=V,S_=X,x_=YI,L_=N,k_=on,O_=vt,A_=st,N_=xr,U_=Pr,P_=mf,M_=ut,j_=XI,V_=qt,G_=function(t,e,n,r,i,a){var o=n+t.length,s=r.length,c=D_;return void 0!==i&&(i=m_(i),c=b_),T_(a,c,(function(a,c){var l;switch(E_(c,0)){case"$":return"$";case"&":return t;case"`":return C_(e,0,n);case"'":return C_(e,o);case"<":l=i[C_(c,1,-1)];break;default:var u=+c;if(0===u)return a;if(u>s){var h=__(u/10);return 0===h?a:h<=s?void 0===r[h-1]?E_(c,1):r[h-1]+E_(c,1):a}l=r[u-1]}return void 0===l?"":l}))},H_=im,B_=we("replace"),F_=Math.max,K_=Math.min,z_=S_([].concat),J_=S_([].push),W_=S_("".indexOf),q_=S_("".slice),Y_="$0"==="a".replace(/./,"$0"),$_=!!/./[B_]&&""===/./[B_]("a","$0");x_("replace",(function(t,e,n){var r=$_?"$":"$0";return[function(t,n){var r=M_(this),i=A_(t)?void 0:V_(t,B_);return i?w_(i,t,r,n):w_(e,P_(r),t,n)},function(t,i){var a=k_(this),o=P_(t);if("string"==typeof i&&-1===W_(i,r)&&-1===W_(i,"$<")){var s=n(e,a,o,i);if(s.done)return s.value}var c=O_(i);c||(i=P_(i));var l,u=a.global;u&&(l=a.unicode,a.lastIndex=0);for(var h,f=[];null!==(h=H_(a,o))&&(J_(f,h),u);){""===P_(h[0])&&(a.lastIndex=j_(o,U_(a.lastIndex),l))}for(var d,p="",v=0,g=0;g<f.length;g++){for(var y,I=P_((h=f[g])[0]),m=F_(K_(N_(h.index),o.length),0),_=[],E=1;E<h.length;E++)J_(_,void 0===(d=h[E])?d:String(d));var T=h.groups;if(c){var C=z_([I],_,m,o);void 0!==T&&J_(C,T),y=P_(R_(i,void 0,C))}else y=G_(I,o,m,_,T,i);m>=v&&(p+=q_(o,v,m)+y,v=m+I.length)}return p+q_(o,v)}]}),!!L_((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}))||!Y_||$_);var X_,Q_=yt,Z_=et,tE=we("match"),eE=function(t){var e;return Q_(t)&&(void 0!==(e=t[tE])?!!e:"RegExp"===Z_(t))},nE=TypeError,rE=function(t){if(eE(t))throw new nE("The method doesn't accept regular expressions");return t},iE=we("match"),aE=function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[iE]=!1,"/./"[t](e)}catch(t){}}return!1},oE=Ri,sE=Fa,cE=A.f,lE=Pr,uE=mf,hE=rE,fE=ut,dE=aE,pE=sE("".slice),vE=Math.min,gE=dE("startsWith");function yE(t,e){t=t.split("."),e=e.split(".");for(var n=Math.max(t.length,e.length);t.length<n;)t.push("0");for(;e.length<n;)e.push("0");for(var r=0;r<n;r++){var i=parseInt(t[r],10),a=parseInt(e[r],10);if(i>a)return 1;if(i<a)return-1}return 0}oE({target:"String",proto:!0,forced:!!(gE||(X_=cE(String.prototype,"startsWith"),!X_||X_.writable))&&!gE},{startsWith:function(t){var e=uE(fE(this));hE(t);var n=lE(vE(arguments.length>1?arguments[1]:void 0,e.length)),r=uE(t);return pE(e,n,n+r.length)===r}});var IE="TRTC-ROOM",mE=wx||qq;mE||console.error(IE,"不支持当前小程序环境");var _E,EE=mE.getSystemInfoSync(),TE=EE.safeArea;("iOS 13.3"===EE.system||"iPhoneX"===EE.model&&"iOS 13.3.1"===EE.system)&&console.log("use media audio volume type"),console.log(IE,"SystemInfo",EE),"undefined"!=typeof qq?_E=!0:"undefined"!=typeof wx&&(_E=yE(EE.version,"7.0.8")>=0||yE(EE.version,"2.4.0")>=0&&yE(EE.version,"6.0.0")<0&&yE(EE.SDKVersion,"2.10.0")>=0);var CE=_E,bE="undefined"!=typeof uni,DE=/iOS/i.test(EE.system),RE=/Android/i.test(EE.system);/mac/i.test(EE.system);var wE=EE.version,SE=EE.SDKBuild?"".concat(EE.SDKVersion,"-").concat(EE.SDKBuild):EE.SDKVersion;EE.screenHeight,TE.bottom,console.log(IE,"APP_VERSION:",wE," LIB_VERSION:",SE," is new version:",CE);var xE=function(t){return"function"==typeof Array.isArray?Array.isArray(t):"array"===function(t){return Object.prototype.toString.call(t).match(/^\[object (.*)\]$/)[1].toLowerCase()}(t)},LE=function(t){return null!==t&&("number"==typeof t&&!isNaN(t-0)||"object"===o(t)&&t.constructor===Number)},kE=function(t){return"string"==typeof t},OE=function(t){return null!==t&&"object"===o(t)},AE=function(t){return void 0===t},NE=function(t){return o(t)===Rg.FUNCTION},UE=0;Date.now||(Date.now=function(){return(new Date).getTime()});var PE=function(){0===UE&&(UE=Date.now()-1);var t=Date.now()-UE;return t>4294967295?(UE+=4294967295,Date.now()-UE):t},ME=function(t){return t instanceof Error},jE=function(t){return JSON.stringify(t,["message","code"])};function VE(){var t="unknown";return DE&&(t="ios"),RE&&(t="android"),t}function GE(t){return HE.apply(this,arguments)}function HE(){return(HE=c(i().mark((function t(e){var n,r,a,o,s,c,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=2;break}return t.abrupt("return",!1);case 2:return n=e.microphone,r=void 0!==n&&n,a=e.camera,o=void 0!==a&&a,t.prev=3,t.next=6,wx.getSetting();case 6:if(s=t.sent,c=s.authSetting[xg.RECORD],l=s.authSetting[xg.CAMERA],!r||!o){t.next=11;break}return t.abrupt("return",c&&l);case 11:if(!r){t.next=13;break}return t.abrupt("return",c);case 13:if(!o){t.next=15;break}return t.abrupt("return",l);case 15:return t.abrupt("return",!1);case 18:return t.prev=18,t.t0=t.catch(3),t.abrupt("return",!1);case 21:case"end":return t.stop()}}),t,null,[[3,18]])})))).apply(this,arguments)}function BE(t){return t===Rg.AV_CALL}function FE(){return performance&&performance.now?Math.floor(performance.now()):Date.now()}function KE(t){var e=String(t);return e.startsWith("14")||e.startsWith("16")||e.startsWith("17")}function zE(t){var e=KE(t)?Ng:Ug;return"".concat(e,"&position=").concat(t,"®ionId=").concat(function(t){return t>=2e7&&t<3e7||t>=172e7&&t<173e7?Mg:t>=3e7&&t<4e7||t>=173e7&&t<174e7?Vg:t>=4e7&&t<5e7||t>=174e7&&t<175e7?jg:t>=5e7&&t<6e7||t>=175e7&&t<176e7?Gg:t>=7e7&&t<8e7||t>=177e7&&t<178e7?Hg:Pg}(t))}var JE=0,WE=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 YE={_data:[],_length:0,_visible:!1,arguments2String:function(t){var e,n;if(1===t.length)e=qE()+t[0];else{e=qE();for(var r=0,i=t.length;r<i;r++)n=t[r],xE(n)||OE(n)?ME(t[r])?e+=jE(t[r]):e+=JSON.stringify(t[r]):e+=t[r],e+=" "}return e},debug:function(){if(JE<=-1){var t=this.arguments2String(arguments);YE.record(t,"debug"),cI.debug(t)}},log:function(){if(JE<=0){var t=this.arguments2String(arguments);YE.record(t,"log"),cI.log(t)}},info:function(){if(JE<=1){var t=this.arguments2String(arguments);YE.record(t,"info"),cI.info(t)}},warn:function(){if(JE<=2){var t=this.arguments2String(arguments);YE.record(t,"warn"),cI.warn(t)}},error:function(){if(JE<=3){var t=this.arguments2String(arguments);YE.record(t,"error"),cI.error(t)}},time:function(t){WE.set(t,PE())},timeEnd:function(t){if(WE.has(t)){var e=PE()-WE.get(t);return WE.delete(t),e}return cI.warn("未找到对应label: ".concat(t,", 请在调用 logger.timeEnd 前,调用 logger.time")),0},setLevel:function(t){t<4&&cI.log("".concat(qE(),"set level from ").concat(JE," to ").concat(t)),JE=t},getLevel:function(){return JE},record:function(t,e){1100===YE._length&&(YE._data.splice(0,100),YE._length=1e3),YE._length+=1,YE._data.push("".concat(t," [").concat(e,"] \n"))},getLog:function(){return YE._data}},$E=function(){function t(e){l(this,t),this.sdkappid="",this.version="",this.userid="",this.platform="",this.useragent="",this.method=e,this.codeint=1,this.calltype=1,this.talktime=0,this.message="",this.text="",this.startts=Date.now(),this.endts=0,this.timespan=0,this.time="",this.networktype="",this.host=VE()}return h(t,[{key:"setCommonInfo",value:function(t){var e,n,r,i,a=t.SDKAppID,o=t.version,s=t.userID,c=t.platform,l=t.scene;this.sdkappid=a,this.version="".concat(o),this.userid=s,this.platform=c,this.scene=l,this.time=(e=new Date,n=e.toISOString(),r=e.getTimezoneOffset()/60,i="",i=r<0?r>-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(Ey.NO_NETWORK),this.setMessage(Ty)),this}},{key:"setCode",value:function(t){return"ECONNABORTED"===t&&(this.codeint=103),LE(t)?this.codeint=t:YE.warn("SSOLogData.setCode value not a number, please check!",t,o(t)),this}},{key:"setMessage",value:function(t){return kE(t)?(this.message=t,this):this}},{key:"setText",value:function(t){return LE(t)?this.text=t.toString():kE(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 AE(t)?YE.warn("SSOLogData.setNetworkType value is undefined, please check!"):this.networktype=t,this}}],[{key:"bindController",value:function(e){t.prototype._eventStatController=e}}]),t}(),XE="sdkConstruct",QE="quality_report",ZE=function(){function t(){l(this,t),this._table="timweb-trtccalling",this._report=[]}return h(t,[{key:"pushIn",value:function(t){YE.debug("SSOLogBody.pushIn",this._report.length,t),this._report.push(t)}},{key:"backfill",value:function(t){var e;xE(t)&&0!==t.length&&(YE.debug("SSOLogBody.backfill",this._report.length,t.length),(e=this._report).unshift.apply(e,C(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}(),tT={CURRENT:{COMMON:"https://webim.tim.qq.com"},PRODUCTION:{COMMON:"https://webim.tim.qq.com"}},eT={IM_OPEN_STAT:"imopenstat"},nT={TIM_WEB_TRTCCALLING_REPORT:"tweb_trtccalling_report"},rT={imopenstat:"v4"},iT=function(){function t(){l(this,t),this.TAG="trtccalling-ssolog-event",this._reportBody=new ZE,this._version=Uy,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(){YE.debug("EventStatController.reportAtOnce"),this._report()}},{key:"pushIn",value:function(t){t instanceof $E&&(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()<t._lastReportTime+t.WAITING_TIME||t._reportBody.isEmpty()||t._report()}),this.INTERVAL)}},{key:"_stopReportTimer",value:function(){this._timerID>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=tT.CURRENT.COMMON,o=rT.imopenstat,s=eT.IM_OPEN_STAT,c=nT.TIM_WEB_TRTCCALLING_REPORT,l="".concat(a,"/").concat(o,"/").concat(s,"/").concat(c,"/?sdkappid=").concat(n,"&reqtime=").concat(e);wx.request({url:l,method:"POST",data:JSON.stringify(i),header:{"content-type":"application/json"},success:function(e){t._retryCount>0&&(YE.debug("EventStatController.report retry success"),t._retryCount=0)},fail:function(e){YE.warn("EventStatController.report, error:".concat(jE(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(){YE.log("EventStatController.reset"),this._stopReportTimer(),this._report()}}]),t}(),aT=Fr.includes,oT=is;Ri({target:"Array",proto:!0,forced:N((function(){return!Array(1).includes()}))},{includes:function(t){return aT(this,t,arguments.length>1?arguments[1]:void 0)}}),oT("includes");var sT=Ri,cT=rE,lT=ut,uT=mf,hT=aE,fT=X("".indexOf);sT({target:"String",proto:!0,forced:!hT("includes")},{includes:function(t){return!!~fT(uT(lT(this)),uT(cT(t)),arguments.length>1?arguments[1]:void 0)}});var dT=X,pT=Tv,vT=Dp.exports.getWeakData,gT=Zs,yT=on,IT=st,mT=yt,_T=yh,ET=fe,TT=nr.set,CT=nr.getterFor,bT=co.find,DT=co.findIndex,RT=dT([].splice),wT=0,ST=function(t){return t.frozen||(t.frozen=new xT)},xT=function(){this.entries=[]},LT=function(t,e){return bT(t.entries,(function(t){return t[0]===e}))};xT.prototype={get:function(t){var e=LT(this,t);if(e)return e[1]},has:function(t){return!!LT(this,t)},set:function(t,e){var n=LT(this,t);n?n[1]=e:this.entries.push([t,e])},delete:function(t){var e=DT(this.entries,(function(e){return e[0]===t}));return~e&&RT(this.entries,e,1),!!~e}};var kT,OT={getConstructor:function(t,e,n,r){var i=t((function(t,i){gT(t,a),TT(t,{type:e,id:wT++,frozen:void 0}),IT(i)||_T(i,t[r],{that:t,AS_ENTRIES:n})})),a=i.prototype,o=CT(e),s=function(t,e,n){var r=o(t),i=vT(yT(e),!0);return!0===i?ST(r).set(e,n):i[r.id]=n,t};return pT(a,{delete:function(t){var e=o(this);if(!mT(t))return!1;var n=vT(t);return!0===n?ST(e).delete(t):n&&ET(n,e.id)&&delete n[e.id]},has:function(t){var e=o(this);if(!mT(t))return!1;var n=vT(t);return!0===n?ST(e).has(t):n&&ET(n,e.id)}}),pT(a,n?{get:function(t){var e=o(this);if(mT(t)){var n=vT(t);return!0===n?ST(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}},AT=Vp,NT=O,UT=X,PT=Tv,MT=Dp.exports,jT=_v,VT=OT,GT=yt,HT=nr.enforce,BT=N,FT=Mn,KT=Object,zT=Array.isArray,JT=KT.isExtensible,WT=KT.isFrozen,qT=KT.isSealed,YT=KT.freeze,$T=KT.seal,XT=!NT.ActiveXObject&&"ActiveXObject"in NT,QT=function(t){return function(){return t(this,arguments.length?arguments[0]:void 0)}},ZT=jT("WeakMap",QT,VT),tC=ZT.prototype,eC=UT(tC.set);if(FT)if(XT){kT=VT.getConstructor(QT,"WeakMap",!0),MT.enable();var nC=UT(tC.delete),rC=UT(tC.has),iC=UT(tC.get);PT(tC,{delete:function(t){if(GT(t)&&!JT(t)){var e=HT(this);return e.frozen||(e.frozen=new kT),nC(this,t)||e.frozen.delete(t)}return nC(this,t)},has:function(t){if(GT(t)&&!JT(t)){var e=HT(this);return e.frozen||(e.frozen=new kT),rC(this,t)||e.frozen.has(t)}return rC(this,t)},get:function(t){if(GT(t)&&!JT(t)){var e=HT(this);return e.frozen||(e.frozen=new kT),rC(this,t)?iC(this,t):e.frozen.get(t)}return iC(this,t)},set:function(t,e){if(GT(t)&&!JT(t)){var n=HT(this);n.frozen||(n.frozen=new kT),rC(this,t)?eC(this,t,e):n.frozen.set(t,e)}else eC(this,t,e);return this}})}else AT&&BT((function(){var t=YT([]);return eC(new ZT,t,1),!WT(t)}))&&PT(tC,{set:function(t,e){var n;return zT(t)&&(WT(t)?n=YT:qT(t)&&(n=$T)),eC(this,t,e),n&&n(t),this}});var aC={exports:{}};
|
||
/*!
|
||
* validate.js 0.13.1
|
||
*
|
||
* (c) 2013-2019 Nicklas Ansman, 2013 Wrapp
|
||
* Validate.js may be freely distributed under the MIT license.
|
||
* For all details and documentation:
|
||
* http://validatejs.org/
|
||
*/(function(t,e,n){var r=function(t,e,n){n=i.extend({},i.options,n);var a=i.runValidations(t,e,n);if(a.some((function(t){return i.isPromise(t.error)})))throw new Error("Use validate.async if you want support for promises");return r.processValidationResults(a,n)},i=r;i.extend=function(t){return[].slice.call(arguments,1).forEach((function(e){for(var n in e)t[n]=e[n]})),t},i.extend(r,{version:{major:0,minor:13,patch:1,metadata:null,toString:function(){var t=i.format("%{major}.%{minor}.%{patch}",i.version);return i.isEmpty(i.version.metadata)||(t+="+"+i.version.metadata),t}},Promise:"undefined"!=typeof Promise?Promise:null,EMPTY_STRING_REGEXP:/^\s*$/,runValidations:function(t,e,n){var r,a,o,s,c,l,u,h=[];for(r in(i.isDomElement(t)||i.isJqueryElement(t))&&(t=i.collectFormValues(t)),e)for(a in o=i.getDeepObjectValue(t,r),s=i.result(e[r],o,t,r,n,e)){if(!(c=i.validators[a]))throw u=i.format("Unknown validator %{name}",{name:a}),new Error(u);l=s[a],(l=i.result(l,o,t,r,n,e))&&h.push({attribute:r,value:o,validator:a,globalOptions:n,attributes:t,options:l,error:c.call(c,o,l,r,t,n)})}return h},processValidationResults:function(t,e){t=i.pruneEmptyErrors(t,e),t=i.expandMultipleErrors(t,e),t=i.convertErrorMessages(t,e);var n=e.format||"grouped";if("function"!=typeof i.formatters[n])throw new Error(i.format("Unknown format %{format}",e));return t=i.formatters[n](t),i.isEmpty(t)?void 0:t},async:function(t,e,n){var r=(n=i.extend({},i.async.options,n)).wrapErrors||function(t){return t};!1!==n.cleanAttributes&&(t=i.cleanAttributes(t,e));var a=i.runValidations(t,e,n);return new i.Promise((function(o,s){i.waitForResults(a).then((function(){var c=i.processValidationResults(a,n);c?s(new r(c,n,t,e)):o(t)}),(function(t){s(t)}))}))},single:function(t,e,n){return n=i.extend({},i.single.options,n,{format:"flat",fullMessages:!1}),i({single:t},{single:e},n)},waitForResults:function(t){return t.reduce((function(t,e){return i.isPromise(e.error)?t.then((function(){return e.error.then((function(t){e.error=t||null}))})):t}),new i.Promise((function(t){t()})))},result:function(t){var e=[].slice.call(arguments,1);return"function"==typeof t&&(t=t.apply(null,e)),t},isNumber:function(t){return"number"==typeof t&&!isNaN(t)},isFunction:function(t){return"function"==typeof t},isInteger:function(t){return i.isNumber(t)&&t%1==0},isBoolean:function(t){return"boolean"==typeof t},isObject:function(t){return t===Object(t)},isDate:function(t){return t instanceof Date},isDefined:function(t){return null!=t},isPromise:function(t){return!!t&&i.isFunction(t.then)},isJqueryElement:function(t){return t&&i.isString(t.jquery)},isDomElement:function(t){return!!t&&!(!t.querySelectorAll||!t.querySelector)&&(!(!i.isObject(document)||t!==document)||("object"==typeof HTMLElement?t instanceof HTMLElement:t&&"object"==typeof t&&null!==t&&1===t.nodeType&&"string"==typeof t.nodeName))},isEmpty:function(t){var e;if(!i.isDefined(t))return!0;if(i.isFunction(t))return!1;if(i.isString(t))return i.EMPTY_STRING_REGEXP.test(t);if(i.isArray(t))return 0===t.length;if(i.isDate(t))return!1;if(i.isObject(t)){for(e in t)return!1;return!0}return!1},format:i.extend((function(t,e){return i.isString(t)?t.replace(i.format.FORMAT_REGEXP,(function(t,n,r){return"%"===n?"%{"+r+"}":String(e[r])})):t}),{FORMAT_REGEXP:/(%?)%\{([^\}]+)\}/g}),prettify:function(t){return i.isNumber(t)?100*t%1==0?""+t:parseFloat(Math.round(100*t)/100).toFixed(2):i.isArray(t)?t.map((function(t){return i.prettify(t)})).join(", "):i.isObject(t)?i.isDefined(t.toString)?t.toString():JSON.stringify(t):(t=""+t).replace(/([^\s])\.([^\s])/g,"$1 $2").replace(/\\+/g,"").replace(/[_-]/g," ").replace(/([a-z])([A-Z])/g,(function(t,e,n){return e+" "+n.toLowerCase()})).toLowerCase()},stringifyValue:function(t,e){return(e&&e.prettify||i.prettify)(t)},isString:function(t){return"string"==typeof t},isArray:function(t){return"[object Array]"==={}.toString.call(t)},isHash:function(t){return i.isObject(t)&&!i.isArray(t)&&!i.isFunction(t)},contains:function(t,e){return!!i.isDefined(t)&&(i.isArray(t)?-1!==t.indexOf(e):e in t)},unique:function(t){return i.isArray(t)?t.filter((function(t,e,n){return n.indexOf(t)==e})):t},forEachKeyInKeypath:function(t,e,n){if(i.isString(e)){var r,a="",o=!1;for(r=0;r<e.length;++r)switch(e[r]){case".":o?(o=!1,a+="."):(t=n(t,a,!1),a="");break;case"\\":o?(o=!1,a+="\\"):o=!0;break;default:o=!1,a+=e[r]}return n(t,a,!0)}},getDeepObjectValue:function(t,e){if(i.isObject(t))return i.forEachKeyInKeypath(t,e,(function(t,e){if(i.isObject(t))return t[e]}))},collectFormValues:function(t,e){var n,r,a,o,s,c,l={};if(i.isJqueryElement(t)&&(t=t[0]),!t)return l;for(e=e||{},o=t.querySelectorAll("input[name], textarea[name]"),n=0;n<o.length;++n)if(a=o.item(n),!i.isDefined(a.getAttribute("data-ignored"))){var u=a.name.replace(/\./g,"\\\\.");c=i.sanitizeFormValue(a.value,e),"number"===a.type?c=c?+c:null:"checkbox"===a.type?a.attributes.value?a.checked||(c=l[u]||null):c=a.checked:"radio"===a.type&&(a.checked||(c=l[u]||null)),l[u]=c}for(o=t.querySelectorAll("select[name]"),n=0;n<o.length;++n)if(a=o.item(n),!i.isDefined(a.getAttribute("data-ignored"))){if(a.multiple)for(r in c=[],a.options)(s=a.options[r])&&s.selected&&c.push(i.sanitizeFormValue(s.value,e));else{var h=void 0!==a.options[a.selectedIndex]?a.options[a.selectedIndex].value:"";c=i.sanitizeFormValue(h,e)}l[a.name]=c}return l},sanitizeFormValue:function(t,e){return e.trim&&i.isString(t)&&(t=t.trim()),!1!==e.nullify&&""===t?null:t},capitalize:function(t){return i.isString(t)?t[0].toUpperCase()+t.slice(1):t},pruneEmptyErrors:function(t){return t.filter((function(t){return!i.isEmpty(t.error)}))},expandMultipleErrors:function(t){var e=[];return t.forEach((function(t){i.isArray(t.error)?t.error.forEach((function(n){e.push(i.extend({},t,{error:n}))})):e.push(t)})),e},convertErrorMessages:function(t,e){var n=[],r=(e=e||{}).prettify||i.prettify;return t.forEach((function(t){var a=i.result(t.error,t.value,t.attribute,t.options,t.attributes,t.globalOptions);i.isString(a)?("^"===a[0]?a=a.slice(1):!1!==e.fullMessages&&(a=i.capitalize(r(t.attribute))+" "+a),a=a.replace(/\\\^/g,"^"),a=i.format(a,{value:i.stringifyValue(t.value,e)}),n.push(i.extend({},t,{error:a}))):n.push(t)})),n},groupErrorsByAttribute:function(t){var e={};return t.forEach((function(t){var n=e[t.attribute];n?n.push(t):e[t.attribute]=[t]})),e},flattenErrorsToArray:function(t){return t.map((function(t){return t.error})).filter((function(t,e,n){return n.indexOf(t)===e}))},cleanAttributes:function(t,e){function n(t,e,n){return i.isObject(t[e])?t[e]:t[e]=!!n||{}}return i.isObject(e)&&i.isObject(t)?function t(e,n){if(!i.isObject(e))return e;var r,a,o=i.extend({},e);for(a in e)r=n[a],i.isObject(r)?o[a]=t(o[a],r):r||delete o[a];return o}(t,e=function(t){var e,r={};for(e in t)t[e]&&i.forEachKeyInKeypath(r,e,n);return r}(e)):{}},exposeModule:function(t,e,n,r,i){n?(r&&r.exports&&(n=r.exports=t),n.validate=t):(e.validate=t,t.isFunction(i)&&i.amd&&i([],(function(){return t})))},warn:function(t){"undefined"!=typeof console&&console.warn&&console.warn("[validate.js] "+t)},error:function(t){"undefined"!=typeof console&&console.error&&console.error("[validate.js] "+t)}}),r.validators={presence:function(t,e){if(!1!==(e=i.extend({},this.options,e)).allowEmpty?!i.isDefined(t):i.isEmpty(t))return e.message||this.message||"can't be blank"},length:function(t,e,n){if(i.isDefined(t)){var r,a=(e=i.extend({},this.options,e)).is,o=e.maximum,s=e.minimum,c=[],l=(t=(e.tokenizer||function(t){return t})(t)).length;return i.isNumber(l)?(i.isNumber(a)&&l!==a&&(r=e.wrongLength||this.wrongLength||"is the wrong length (should be %{count} characters)",c.push(i.format(r,{count:a}))),i.isNumber(s)&&l<s&&(r=e.tooShort||this.tooShort||"is too short (minimum is %{count} characters)",c.push(i.format(r,{count:s}))),i.isNumber(o)&&l>o&&(r=e.tooLong||this.tooLong||"is too long (maximum is %{count} characters)",c.push(i.format(r,{count:o}))),c.length>0?e.message||c: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=[],l={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 t<e},lessThanOrEqualTo:function(t,e){return t<=e},divisibleBy:function(t,e){return t%e==0}},u=(e=i.extend({},this.options,e)).prettify||a&&a.prettify||i.prettify;if(i.isString(t)&&e.strict){var h="^-?(0|[1-9]\\d*)";if(e.onlyInteger||(h+="(\\.\\d+)?"),h+="$",!new RegExp(h).test(t))return e.message||e.notValid||this.notValid||this.message||"must be a valid number"}if(!0!==e.noStrings&&i.isString(t)&&!i.isEmpty(t)&&(t=+t),!i.isNumber(t))return e.message||e.notValid||this.notValid||this.message||"is not a number";if(e.onlyInteger&&!i.isInteger(t))return e.message||e.notInteger||this.notInteger||this.message||"must be an integer";for(o in l)if(s=e[o],i.isNumber(s)&&!l[o](t,s)){var f="not"+i.capitalize(o),d=e[f]||this[f]||this.message||"must be %{type} %{count}";c.push(i.format(d,{count:s,type:u(o)}))}return e.odd&&t%2!=1&&c.push(e.notOdd||this.notOdd||this.message||"must be odd"),e.even&&t%2!=0&&c.push(e.notEven||this.notEven||this.message||"must be even"),c.length?e.message||c:void 0}},datetime:i.extend((function(t,e){if(!i.isFunction(this.parse)||!i.isFunction(this.format))throw new Error("Both the parse and format functions needs to be set to use the datetime/date validator");if(i.isDefined(t)){var n,r=[],a=(e=i.extend({},this.options,e)).earliest?this.parse(e.earliest,e):NaN,o=e.latest?this.parse(e.latest,e):NaN;return t=this.parse(t,e),isNaN(t)||e.dateOnly&&t%864e5!=0?(n=e.notValid||e.message||this.notValid||"must be a valid date",i.format(n,{value:arguments[0]})):(!isNaN(a)&&t<a&&(n=e.tooEarly||e.message||this.tooEarly||"must be no earlier than %{date}",n=i.format(n,{value:this.format(t,e),date:this.format(a,e)}),r.push(n)),!isNaN(o)&&t>o&&(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},l=e.prettify||a&&a.prettify||i.prettify;return c(t,s,e,n,r)?void 0:i.format(o,{attribute:l(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 l=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(l)&&(l=l(t,e,n,r,a)),i.format(l,{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,aC.exports,aC,null);var oC=aC.exports,sC="number",cC="string",lC="object",uC="function",hC="array",fC={createInstance:{sdkAppID:{presence:!0,type:sC},tim:{type:lC}},destroyInstance:{},init:{userID:{presence:!0,type:cC},userSig:{presence:!0,type:cC}},on:{eventCode:{presence:!0,type:cC},handler:{presence:!0,type:uC},context:{presence:!0,type:lC}},off:{eventCode:{presence:!0,type:cC},handler:{presence:!0,type:uC}},call:{userID:{presence:!0,type:cC},type:{presence:!0,type:sC},roomID:{presence:!1,type:sC,numericality:{onlyInteger:!0,greaterThan:0,lessThanOrEqualTo:Dg}}},groupCall:{groupID:{presence:!0,type:cC},type:{presence:!0,type:sC},userIDList:{presence:!0,type:hC},roomID:{presence:!1,type:sC,numericality:{onlyInteger:!0,greaterThan:0,lessThanOrEqualTo:Dg}}},joinInGroupCall:{groupID:{presence:!0,type:cC},type:{presence:!0,type:sC},roomID:{presence:!0,type:sC}},inviteUser:{userIDList:{presence:!0,type:hC}},accept:{},reject:{},hangup:{},switchCallMediaType:{type:{presence:!0,type:sC}},openCamera:{},closeCamera:{},switchCamera:{},openMicrophone:{},closeMicrophone:{},selectAudioPlaybackDevice:{type:{presence:!0,type:cC}},setSelfInfo:{nickName:{presence:!0,type:cC},avatar:{presence:!0,type:cC}},setBeautyLevel:{level:{presence:!0,type:sC,numericality:{onlyInteger:!0,greaterThan:-1,lessThanOrEqualTo:9}}},enableMultiDeviceAbility:{enable:{presence:!0,type:"boolean"}}},dC={createInstance:"",destroyInstance:"",init:"",on:"",off:"",call:[og.IDLE],groupCall:[og.IDLE],accept:[og.CALLING],reject:[og.CALLING],hangup:[og.CALLING,og.CONNECTED],switchCallMediaType:[og.CALLING,og.CONNECTED],joinInGroupCall:[og.IDLE],inviteUser:[og.CALLING,og.CONNECTED],openCamera:[og.CALLING,og.CONNECTED],closeCamera:[og.CALLING,og.CONNECTED],switchCamera:[og.CALLING,og.CONNECTED],openMicrophone:[og.CALLING,og.CONNECTED],closeMicrophone:[og.CALLING,og.CONNECTED],selectAudioPlaybackDevice:[og.CALLING,og.CONNECTED],setSelfInfo:"",setBeautyLevel:""},pC={createInstance:!1,destroyInstance:!0,init:!1,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,setBeautyLevel:!1,enableMultiDeviceAbility:!0},vC=function(t){d(n,I(Error));var e=T(n);function n(t,r,i){var a;return l(this,n),f(_(a=e.call(this,r)),"code",void 0),f(_(a),"message",void 0),f(_(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}();function gC(t){var e=KE(t)?"".concat(Sy.ERROR_PACKAGE_NOT_PURCHASED):"".concat(Cy);return e=e.replace("${purchaseAddress}",zE(t))}oC.validators.type.types.function=function(t){return t instanceof Function};var yC=function(){function t(){l(this,t),f(this,"paramsMatchedRule",fC),f(this,"statusMatchedRule",dC),f(this,"requireInit",pC)}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}(),IC=function(){function t(){l(this,t),this._logger=fy()}return h(t,[{key:"notify",value:function(t,e,n,r){throw this._logger.error("check:".concat(t.api),{text:{data:t,error:{code:e,message:n}}}),vC.error(e,"[TUICallEngine:".concat(t.api,", ").concat(e,"] ").concat(n," ").concat(r))}}]),t}(),mC=h((function t(e){l(this,t),f(this,"api",""),f(this,"attributes",{}),f(this,"callStatus",""),f(this,"capabilityCode",void 0),f(this,"initReady",void 0),this.api=e.api,this.attributes=e.attributes,this.callStatus=e.callStatus,this.capabilityCode=e.capabilityCode,this.initReady=e.initReady,this.sdkAppID=e.sdkAppID})),_C=new WeakMap,EC=function(){function t(){l(this,t),S(this,_C,{writable:!0,value:void 0}),R(this,_C,[])}var e;return h(t,[{key:"addAlertHandler",value:function(t){D(this,_C).push(t)}},{key:"check",value:(e=c(i().mark((function t(e,n){var r;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=0;case 1:if(!(r<D(this,_C).length)){t.next=7;break}return t.next=4,D(this,_C)[r].check(e,n);case 4:r++,t.next=1;break;case 7:case"end":return t.stop()}}),t,this)}))),function(t,n){return e.apply(this,arguments)})},{key:"checkSync",value:function(t,e){for(var n=0;n<D(this,_C).length;n++)D(this,_C)[n].check(t,e)}}]),t}(),TC=function(){function t(e,n){l(this,t),f(this,"rule",void 0),f(this,"notification",void 0),this.rule=e,this.notification=n}var e;return h(t,[{key:"check",value:(e=c(i().mark((function t(e){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return");case 1:case"end":return t.stop()}}),t)}))),function(t){return e.apply(this,arguments)})}]),t}(),CC=function(t){d(n,TC);var e=T(n);function n(t,r){return l(this,n),e.call(this,t,r)}return h(n,[{key:"check",value:function(t){var e=this.rule.getParamsMatchedRule(t.api);if(e&&t.attributes){var n=oC(t.attributes,e);if(void 0!==n)for(var r=0,i=Object.keys(n);r<i.length;r++){var a=i[r];Object.prototype.hasOwnProperty.call(n,a)&&this.notification.notify(t,Ey.ERROR_PARAM_INVALID,n[a])}}}}]),n}(),bC=function(t){d(n,TC);var e=T(n);function n(t,r){return l(this,n),e.call(this,t,r)}return h(n,[{key:"check",value:function(t){if(t.callStatus){var e=this.rule.getStatusMatchedRule(t.api);e&&!e.includes(t.callStatus)&&this.notification.notify(t,Ey.ERROR_REQUEST_REFUSED,wy,Sy.ERROR_REQUEST_REFUSED)}}}]),n}(),DC=function(t){d(r,TC);var e,n=T(r);function r(t,e){return l(this,r),n.call(this,t,e)}return h(r,[{key:"check",value:(e=c(i().mark((function t(e){var n,r,a,o=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=o.length>1&&void 0!==o[1]?o[1]:{},!e.capabilityCode){t.next=19;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,Ey.ERROR_PACKAGE_NOT_SUPPORTED,by,Sy.ERROR_PACKAGE_NOT_SUPPORTED),t.next=19;break;case 9:if(t.prev=9,t.t0=t.catch(2),2905!==t.t0.code){t.next=15;break}this.notification.notify(e,Ey.ERROR_TIM_VERSION_OUTDATED,Dy,Sy.ERROR_TIM_VERSION_OUTDATED),t.next=19;break;case 15:throw r=null,a=0,e.capabilityCode===bg.PRO?(r="".concat((i=e.sdkAppID,s=void 0,s=KE(i)?"".concat(Sy.ERROR_PACKAGE_NOT_SUPPORTED):"".concat(by),s=s.replace("${purchaseAddress}",zE(i)))," <ERROR_PACKAGE_NOT_SUPPORTED: ").concat(Ey.ERROR_PACKAGE_NOT_SUPPORTED,">"),a=Ey.ERROR_PACKAGE_NOT_SUPPORTED):(r="".concat(gC(e.sdkAppID)," <ERROR_PACKAGE_NOT_PURCHASED: ").concat(Ey.ERROR_PACKAGE_NOT_PURCHASED,">"),a=Ey.ERROR_PACKAGE_NOT_PURCHASED),new vC(a,r);case 19:case"end":return t.stop()}var i,s}),t,this,[[2,9]])}))),function(t){return e.apply(this,arguments)})}]),r}(),RC=function(t){d(n,TC);var e=T(n);function n(t,r){return l(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,Ey.ERROR_INIT_FAIL,Ry,Sy.ERROR_INIT_FAIL)}}]),n}(),wC=function(){function t(){l(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 yC,this.notification=new IC,this.alert=new EC,this.alert.addAlertHandler(new CC(this.alertRule,this.notification)),this.alert.addAlertHandler(new RC(this.alertRule,this.notification)),this.alert.addAlertHandler(new DC(this.alertRule,this.notification)),this.alert.addAlertHandler(new bC(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(wC,"instance",void 0);var SC=X,xC=zt,LC=yt,kC=fe,OC=fc,AC=P,NC=Function,UC=SC([].concat),PC=SC([].join),MC={},jC=AC?NC.bind:function(t){var e=xC(this),n=e.prototype,r=OC(arguments,1),i=function(){var n=UC(r,OC(arguments));return this instanceof i?function(t,e,n){if(!kC(MC,e)){for(var r=[],i=0;i<e;i++)r[i]="a["+i+"]";MC[e]=NC("C,a","return new C("+PC(r,",")+")")}return MC[e](t,n)}(e,n.length,n):e.apply(t,n)};return LC(n)&&(i.prototype=n),i};function VC(t){var e=Rg.UNKNOWN;switch(t){case Ig:e=Rg.AUDIO;break;case mg:e=Rg.VIDEO}return e}function GC(t){var e=t;return e===vg?e=Rg.CALLER:e===gg&&(e=Rg.CALLEE),e}Ri({target:"Function",proto:!0,forced:Function.bind!==jC},{bind:jC});var HC=function(){function t(e){l(this,t),f(this,"_eventStatController",void 0),f(this,"_callData",void 0),f(this,"_ssoLog",void 0),this._eventStatController=new iT,$E.bindController(this._eventStatController),this.initializeCallData(e),this._ssoLog=new $E(QE)}return h(t,[{key:"setCallData",value:function(t){this._callData=t}},{key:"getCallData",value:function(){return this._callData}},{key:"setInviteID",value:function(t){this._callData.inviteID=t}},{key:"setTotalTime",value:function(t){this._callData.totalTime="".concat(t)}},{key:"setAbilityBit",value:function(t){this._callData.abilityBit=!!t}},{key:"setEnterRoomTime",value:function(t){this._callData.enterRoomTime=ly(t)}},{key:"setSendSignalingTime",value:function(t){this._callData.sendSignalingTime=ly(t)}},{key:"setCallAcceptTime",value:function(t){this._callData.callAcceptTime=ly(t)}},{key:"setExitRoomTime",value:function(t){this._callData.exitRoomTime=ly(t)}},{key:"setCallEndTime",value:function(t){this._callData.callEndTime=ly(t)}},{key:"setCodeAndMessage",value:function(t,e){this._callData.code=t||0,this._callData.message=e||""}},{key:"setCallScene",value:function(t){this._callData.callScene=t||""}},{key:"getResult",value:function(){return this._callData.result}},{key:"setResult",value:function(t){this._callData.result=t||""}},{key:"setUserID",value:function(t){this._callData.userID=t||""}},{key:"packageCallDataToKibana",value:function(){var t=VC(this._callData.callType),e=GC(this._callData.callRole);return"".concat("CallData{version='").concat(this._callData.version,", platform=").concat(this._callData.platform,", framework=").concat(this._callData.framework,", sdk_app_id=").concat(this._callData.sdkAppId,", user_id=").concat(this._callData.userID,", room_id=").concat(this._callData.roomID,", invite_id=").concat(this._callData.inviteID,", invitee_list=").concat(this._callData.inviteeList,", media_type=").concat(t,", role=").concat(e,", call_scene=").concat(this._callData.callScene,", result=").concat(this._callData.result,", total_time=").concat(this._callData.totalTime,", total_score=").concat(this._callData.totalScore,", ability_bit=").concat(this._callData.abilityBit,", enter_room=").concat(this._callData.enterRoomTime,", send_signaling=").concat(this._callData.sendSignalingTime,", call_accept=").concat(this._callData.callAcceptTime,", exit_room=").concat(this._callData.exitRoomTime,", call_end=").concat(this._callData.callEndTime,", code=").concat(this._callData.code,", message=").concat(this._callData.message,", network=").concat(this._callData.network,", audio=").concat(this._callData.audio,", video=").concat(this._callData.video,"}")}},{key:"initializeCallData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.version,n=void 0===e?"":e,r=t.sdkAppId,i=void 0===r?0:r,a=t.userID,o=void 0===a?"":a,s=VE(),c=bE?"uniminiprogram":"wxminiprogram";this._callData={version:n,platform:s,framework:c,sdkAppId:i,userID:o,roomID:0,inviteID:"",callRole:pg,callScene:"",callType:yg,inviteeList:[],result:Rg.UNKNOWN,totalTime:0,totalScore:0,code:0,message:"",abilityBit:!1,enterRoomTime:"",sendSignalingTime:"",callAcceptTime:"",exitRoomTime:"",callEndTime:"",network:0,audio:0,video:0}}},{key:"reset",value:function(){this.initializeCallData(),this._ssoLog=null}},{key:"clearCallDataAfterUpload",value:function(){var t=this.getCallData(),e=t.version,n=t.sdkAppId,r=t.userID;this.initializeCallData({version:e,sdkAppId:n,userID:r})}},{key:"uploadToKibana",value:function(){try{this._ssoLog.setText(this.packageCallDataToKibana()).setEnd(),this.clearCallDataAfterUpload()}catch(t){}}}]),t}(),BC=function(){function t(e,n){l(this,t),f(this,"_eventEmitter",void 0),f(this,"_callDataReport",void 0),this._eventEmitter=e.emitter,this._callDataReport=n,this.registerListener()}return h(t,[{key:"registerListener",value:function(){this._eventEmitter.on(ag.CALL_END,this.onCallEnd.bind(this)),this._eventEmitter.on(ag.CALLING_CANCEL,this.onCallingCancel.bind(this)),this._eventEmitter.on(ag.NO_RESP,this.onNoResponse.bind(this)),this._eventEmitter.on(ag.LINE_BUSY,this.onLineBusy.bind(this)),this._eventEmitter.on(ag.REJECT,this.onReject.bind(this))}},{key:"removeLister",value:function(){this._eventEmitter.off(ag.CALL_END,this.onCallEnd.bind(this)),this._eventEmitter.off(ag.CALLING_CANCEL,this.onCallingCancel.bind(this)),this._eventEmitter.off(ag.NO_RESP,this.onNoResponse.bind(this)),this._eventEmitter.off(ag.LINE_BUSY,this.onLineBusy.bind(this)),this._eventEmitter.off(ag.REJECT,this.onReject.bind(this))}},{key:"onCallEnd",value:function(t){var e=t.data.totalTime,n=void 0===e?0:e;this._callDataReport.setTotalTime(n),this._callDataReport.setCallEndTime((new Date).getTime()),this._callDataReport.setResult(Rg.NORMAL),this._callDataReport.setCodeAndMessage(),this._callDataReport.uploadToKibana()}},{key:"onCallingCancel",value:function(){this._callDataReport.getResult()||this._callDataReport.setResult(Rg.CANCEL),this._callDataReport.setCodeAndMessage(),this._callDataReport.uploadToKibana()}},{key:"onNoResponse",value:function(){this._callDataReport.setResult(Rg.TIMEOUT)}},{key:"onLineBusy",value:function(){this._callDataReport.setResult(Rg.BUSYLINE)}},{key:"onReject",value:function(){this._callDataReport.setResult(Rg.REJECT)}}]),t}();function FC(t){return KC.apply(this,arguments)}function KC(){return KC=c(i().mark((function t(e){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e===dg.AUDIO||e===dg.VIDEO){t.next=2;break}return t.abrupt("return");case 2:return t.abrupt("return",new Promise(function(){var t=c(i().mark((function t(n,r){var a,o,s,c,l,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a={microphone:!0,camera:e===dg.VIDEO},t.next=3,GE(a);case 3:if((o=t.sent)||e!==dg.AUDIO){t.next=16;break}return t.prev=5,t.next=8,wx.authorize({scope:xg.RECORD});case 8:t.next=16;break;case 10:t.prev=10,t.t0=t.catch(5),s=wg.MIC_TITLE,c=wg.MIC_CONTENT,zC(s,c),r();case 16:if(o||e!==dg.VIDEO){t.next=30;break}return t.prev=17,t.next=20,wx.authorize({scope:xg.RECORD});case 20:return t.next=22,wx.authorize({scope:xg.CAMERA});case 22:t.next=30;break;case 24:t.prev=24,t.t1=t.catch(17),l=wg.CAMERA_TITLE,u=wg.CAMERA_CONTENT,zC(l,u),r();case 30:n();case 31:case"end":return t.stop()}}),t,null,[[5,10],[17,24]])})));return function(e,n){return t.apply(this,arguments)}}()));case 3:case"end":return t.stop()}}),t)}))),KC.apply(this,arguments)}function zC(t,e){wx.showModal({title:t,content:e,confirmText:wg.CONFIRM_TEXT,success:function(t){t.confirm&&wx.openSetting()}})}var JC=Ri,WC=X,qC=xr,YC=vm,$C=Jm,XC=N,QC=RangeError,ZC=String,tb=Math.floor,eb=WC($C),nb=WC("".slice),rb=WC(1..toFixed),ib=function(t,e,n){return 0===e?n:e%2==1?ib(t,e-1,n*t):ib(t*t,e/2,n)},ab=function(t,e,n){for(var r=-1,i=n;++r<6;)i+=e*t[r],t[r]=i%1e7,i=tb(i/1e7)},ob=function(t,e){for(var n=6,r=0;--n>=0;)r+=t[n],t[n]=tb(r/e),r=r%e*1e7},sb=function(t){for(var e=6,n="";--e>=0;)if(""!==n||0===e||0!==t[e]){var r=ZC(t[e]);n=""===n?r:n+eb("0",7-r.length)+r}return n};JC({target:"Number",proto:!0,forced:XC((function(){return"0.000"!==rb(8e-5,3)||"1"!==rb(.9,0)||"1.25"!==rb(1.255,2)||"1000000000000000128"!==rb(0xde0b6b3a7640080,0)}))||!XC((function(){rb({})}))},{toFixed:function(t){var e,n,r,i,a=YC(this),o=qC(t),s=[0,0,0,0,0,0],c="",l="0";if(o<0||o>20)throw new QC("Incorrect fraction digits");if(a!=a)return"NaN";if(a<=-1e21||a>=1e21)return ZC(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*ib(2,69,1))-69)<0?a*ib(2,-e,1):a/ib(2,e,1),n*=4503599627370496,(e=52-e)>0){for(ab(s,0,n),r=o;r>=7;)ab(s,1e7,0),r-=7;for(ab(s,ib(10,r,1),0),r=e-1;r>=23;)ob(s,1<<23),r-=23;ob(s,1<<r),ab(s,1,1),ob(s,2),l=sb(s)}else ab(s,0,n),ab(s,1<<-e,0),l=sb(s)+eb("0",o);return l=o>0?c+((i=l.length)<=o?"0."+eb("0",o-i)+l:nb(l,0,i-o)+"."+nb(l,i-o)):c+l}});var cb=function(){function t(){l(this,t)}return h(t,null,[{key:"generateTaskID",value:function(){return this.currentTaskID+=1}},{key:"run",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Rg.TIMEOUT,e=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;n=r(r({},t===Rg.INTERVAL?{delay:2e3,count:0,backgroundTask:!0}:t===Rg.RAF?{fps:60,delay:16.6,count:0,backgroundTask:!0}:{delay:2e3,count:0,backgroundTask:!0}),n),OE(e)&&(n=r(r({},n),e)),NE(t)&&(e=t,t=Rg.TIMEOUT);var i=r({taskID:this.generateTaskID(),loopCount:0,intervalID:null,timeoutID:null,rafID:null,taskName:t,callback:e},n);return this.taskMap.set(i.taskID,i),this[t](i),i.taskID}},{key:"interval",value:function(t){var e=this;return t.intervalID=setInterval((function(){t.callback(),t.loopCount+=1,e.isBreakLoop(t)}),t.delay)}},{key:"timeout",value:function(t){var e=this;return t.timeoutID=setTimeout((function n(){if(t.callback(),t.loopCount+=1,!e.isBreakLoop(t))return t.timeoutID=setTimeout(n,t.delay)}),t.delay)}},{key:"raf",value:function(t){var e=this;t.delay=(1e3/t.fps).toFixed(2);var n,r=FE(),i=function i(){if(document.hidden&&t.backgroundTask){if(n=FE()-r,r=FE(),t.callback(),t.loopCount+=1,e.isBreakLoop(t))return;return t.timeoutID=setTimeout(i,t.delay-Math.floor(n%t.delay))}if((n=FE()-r)>=t.delay&&(r=FE()-Math.floor(n%t.delay),t.callback(),t.loopCount+=1),!e.isBreakLoop(t))return t.rafID=requestAnimationFrame(i)};if(t.rafID=requestAnimationFrame(i),t.backgroundTask){var a=function(){if(document.hidden){var e=FE()-r;e>=t.delay?i():t.timeoutID=setTimeout(i,t.delay-e)}};document.addEventListener("visibilitychange",a),t.onVisibilitychange=a,document.hidden&&a()}return t.taskID}},{key:"hasTask",value:function(t){return this.taskMap.has(t)}},{key:"clearTask",value:function(t){if(!this.taskMap.has(t))return!0;var e=this.taskMap.get(t),n=e.intervalID,r=e.timeoutID,i=e.onVisibilitychange;return n&&clearInterval(n),r&&clearTimeout(r),i&&document.removeEventListener("visibilitychange",i),this.taskMap.delete(t),!0}},{key:"isBreakLoop",value:function(t){return!this.taskMap.has(t.taskID)||0!==t.count&&t.loopCount>=t.count&&(this.clearTask(t.taskID),!0)}}]),t}();f(cb,"taskMap",new Map),f(cb,"currentTaskID",1);var lb={serviceCommand:"".concat(Rg.CALLKIT_RECORDS_SVR,".*")},ub="sendTRTCCustomData",hb=function(){function t(e){l(this,t),f(this,"_callRecordData",void 0),f(this,"_tim",void 0),f(this,"_heartbeat",void 0),f(this,"_lastHeartBeatTime",void 0),f(this,"_bodyStatus",void 0),this._tim=e.tim,this._heartbeat=-1,this._lastHeartBeatTime=-1,this._bodyStatus=Rg.WAITING,this.initializeCallData(e)}var e,n,a,o;return h(t,[{key:"getCallRecordData",value:function(){return this._callRecordData}},{key:"initializeCallData",value:function(t){var e=t||{},n=e.version,r=void 0===n?"":n,i=e.userID,a=void 0===i?"":i,o={name:EE.platform,version:EE.version},s={version:1,command:Rg.EVENT_REPORT,sdk_version:r,seq:0,os_name:Rg.MINI_PROGRAM,os_version:o.version||"",device_name:o.name||"",framework:Rg.MINI_PROGRAM,call_type:"",media_type:"",client_ts:0,role:pg,user_id:a,room_id:"",call_id:""};this._callRecordData={head:s,body:{event_type:"",code:0,message:"",invitee_list:[]}}}},{key:"reset",value:function(){this.initializeCallData()}},{key:"_setCallType",value:function(t){t&&(this._callRecordData.head=r(r({},this._callRecordData.head),{},{call_type:t}))}},{key:"_setMediaType",value:function(t){t&&(this._callRecordData.head=r(r({},this._callRecordData.head),{},{media_type:VC(t)}))}},{key:"_setCallRole",value:function(t){t&&(this._callRecordData.head=r(r({},this._callRecordData.head),{},{role:t}))}},{key:"_setUserID",value:function(t){t&&(this._callRecordData.head=r(r({},this._callRecordData.head),{},{user_id:t}))}},{key:"_setRoomID",value:function(t){t&&(this._callRecordData.head=r(r({},this._callRecordData.head),{},{room_id:"".concat(t)}))}},{key:"_setInviteID",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";t&&(this._callRecordData.head=r(r({},this._callRecordData.head),{},{call_id:t}))}},{key:"_setEventType",value:function(t){t&&(this._callRecordData.body=r(r({},this._callRecordData.body),{},{event_type:t}))}},{key:"_setInviteeList",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this._callRecordData.body=r(r({},this._callRecordData.body),{},{invitee_list:t})}},{key:"_setSeq",value:function(){var t=this.getCallRecordData().head.seq;this._callRecordData.head=r(r({},this._callRecordData.head),{},{seq:t+1})}},{key:"setBodyStatus",value:function(t){if(t){var e=Rg.WAITING;switch(t){case og.CALLING:e=Rg.WAITING;break;case og.CONNECTED:e=Rg.CALLING}this._bodyStatus=e}}},{key:"eventUpload",value:(o=c(i().mark((function t(e){var n,a,o,s,c,l,u,h,f,d,p,v,g,y,I;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a=e.eventType,o=e.callType,s=e.mediaType,c=e.callRole,l=e.userID,u=e.roomID,h=e.inviteID,f=e.inviteeList,d=void 0===f?[]:f,a){t.next=3;break}return t.abrupt("return");case 3:return this._callRecordData.head=r(r({},this._callRecordData.head),{},{command:Rg.EVENT_REPORT,client_ts:Math.floor(Date.now()/1e3)}),this._setCallType(o),this._setMediaType(s),this._setCallRole(c),this._setUserID(l),this._setRoomID(u),this._setInviteID(h),this._setEventType(a),this._setInviteeList(d),this._setSeq(),p=this.getCallRecordData(),v=p.head,g=p.body,y={head:r(r({},v),{},{role:GC(v.role)}),body:g},I=r(r({},lb),{},{data:JSON.stringify(y)}),t.next=18,null==this||null===(n=this._tim)||void 0===n?void 0:n.callExperimentalAPI(ub,I);case 18:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)})},{key:"eventUploadNotSave",value:(a=c(i().mark((function t(e){var n,a,o,s,c,l,u,h,f,d,p,v;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return a=e.eventType,o=e.callType,s=e.mediaType,c=e.callRole,l=e.roomID,u=e.inviteID,this._setSeq(),h=this.getCallRecordData(),f=h.head,d=h.body,p={head:r(r({},f),{},{role:GC(c),call_id:u,call_type:o,media_type:VC(s),room_id:"".concat(l),client_ts:Math.floor(Date.now()/1e3)}),body:r(r({},d),{},{event_type:a})},v=r(r({},lb),{},{data:JSON.stringify(p)}),t.next=7,null==this||null===(n=this._tim)||void 0===n?void 0:n.callExperimentalAPI(ub,v);case 7:case"end":return t.stop()}}),t,this)}))),function(t){return a.apply(this,arguments)})},{key:"heartBeatUpload",value:(n=c(i().mark((function t(){var e,n,a,o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._setSeq(),n=this._callRecordData.head,a={head:r(r({},n),{},{role:GC(n.role),clientTs:Date.now(),command:Rg.HEART_BEAT}),body:{status:this._bodyStatus}},o=r(r({},lb),{},{data:a}),t.next=6,null==this||null===(e=this._tim)||void 0===e?void 0:e.callExperimentalAPI(ub,o);case 6:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"startHeartbeat",value:function(){-1===this._heartbeat&&(YE.info("start heart beat..."),this.heartBeatUpload(),this._heartbeat=cb.run(Rg.TIMEOUT,this.doHeartbeat.bind(this),{delay:2e3,count:0,backgroundTask:!0}))}},{key:"stopHeartbeat",value:function(){-1!==this._heartbeat&&(YE.info("stop heart beat"),cb.clearTask(this._heartbeat),this._heartbeat=-1,this._lastHeartBeatTime=-1,this._bodyStatus=Rg.WAITING)}},{key:"doHeartbeat",value:(e=c(i().mark((function t(){var e;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.heartBeatUpload(),e=Date.now(),this._lastHeartBeatTime>0&&e-this._lastHeartBeatTime>1e4&&YE.warn("heartbeat took ".concat(e-this._lastHeartBeatTime)),this._lastHeartBeatTime=e;case 4:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})}]),t}(),fb=function(){function t(e,n){l(this,t),f(this,"_eventEmitter",void 0),f(this,"_callRecordDataReport",void 0),f(this,"_isCallAccepted",void 0),this._eventEmitter=e,this._callRecordDataReport=n,this._isCallAccepted=!1,this.registerListener()}return h(t,[{key:"registerListener",value:function(){this._eventEmitter.on(ag.ON_CALL_RECEIVED,this.onCallReceived.bind(this)),this._eventEmitter.on(ag.USER_ACCEPT,this.onCallAccepted.bind(this)),this._eventEmitter.on(ag.CALL_END,this.onCallEnd.bind(this)),this._eventEmitter.on(ag.CALLING_CANCEL,this.onCallingCancel.bind(this)),this._eventEmitter.on(ag.NO_RESP,this.onNoResponse.bind(this)),this._eventEmitter.on(ag.LINE_BUSY,this.onLineBusy.bind(this)),this._eventEmitter.on(ag.REJECT,this.onReject.bind(this))}},{key:"removeLister",value:function(){this._eventEmitter.off(ag.ON_CALL_RECEIVED,this.onCallReceived),this._eventEmitter.off(ag.USER_ACCEPT,this.onCallAccepted),this._eventEmitter.off(ag.CALL_END,this.onCallEnd),this._eventEmitter.off(ag.CALLING_CANCEL,this.onCallingCancel),this._eventEmitter.off(ag.NO_RESP,this.onNoResponse),this._eventEmitter.off(ag.LINE_BUSY,this.onLineBusy),this._eventEmitter.off(ag.REJECT,this.onReject)}},{key:"onCallReceived",value:function(){this._callRecordDataReport.startHeartbeat()}},{key:"onCallAccepted",value:function(){var t=this._callRecordDataReport.getCallRecordData().head;if((null==t?void 0:t.role)===Rg.INVITER){if(this._isCallAccepted&&t.call_type===Rg.GROUP)return;this._isCallAccepted=!0;var e={eventType:Rg.CALL_ACCEPTED};this._callRecordDataReport.eventUpload(e),this._callRecordDataReport.setBodyStatus(og.CONNECTED)}}},{key:"onCallEnd",value:function(){var t={eventType:Rg.CALL_END};this._isCallAccepted=!1,this._callRecordDataReport.eventUpload(t),this._callRecordDataReport.stopHeartbeat()}},{key:"onCallingCancel",value:function(t){var e=this._callRecordDataReport.getCallRecordData().head,n=e.role===Rg.INVITER?Rg.CANCEL_CALL:Rg.CALL_CANCELED;this._isCallAccepted=!1;var r=(t.data||{}).reason;((void 0===r?"":r)===Rg.NORMAL||e.role===Rg.INVITER&&e.call_type===Rg.GROUP)&&this._callRecordDataReport.eventUpload({eventType:n}),this._callRecordDataReport.stopHeartbeat()}},{key:"onNoResponse",value:function(){this._uploadInC2C(Rg.TIMEOUT)}},{key:"onLineBusy",value:function(){this._uploadInC2C(Rg.BUSYLINE)}},{key:"onReject",value:function(){this._uploadInC2C(Rg.REJECT)}},{key:"_uploadInC2C",value:function(t){var e=this._callRecordDataReport.getCallRecordData().head;if((null==e?void 0:e.call_type)===Rg.SINGLE){var n="";switch(t){case Rg.TIMEOUT:n=e.role===Rg.INVITER?Rg.CALL_MISSED:Rg.NOT_ANSWER_CALL;break;case Rg.REJECT:n=e.role===Rg.INVITER&&Rg.CALL_REJECTED;break;case Rg.BUSYLINE:n=e.role===Rg.INVITER?Rg.CALL_BUSY:Rg.NOT_ANSWER_CALL;break;default:return}this._callRecordDataReport.eventUpload({eventType:n})}}}]),t}(),db="TUICallEngine",pb=fy({clsConfig:{endpoint:"https://ap-nanjing.cls.tencentcs.com",topicId:"a1310e66-a3f5-4572-a1c3-7a327a27496d"}}),vb=function(){function n(r){l(this,n),f(this,"_initReady",!1),f(this,"_timExternal",!1),f(this,"_initialCallId",""),f(this,"_beautyLevel",4),f(this,"_isEnableMultiDeviceAbility",!1),f(this,"_loginResolveList",[]),this.data={config:{sdkAppID:r.sdkAppID,userID:"",userSig:"",type:1}},this.initData(),this.EVENT=ag,this.MEDIA_TYPE=dg,this.CALL_TYPE=dg,this._emitter=new ig,this.TRTC=new t(this,{TUIScene:"TUICallKit"});var i="TUICallKit";try{(wx&&wx._isTIMCallKit||wx&&wx.getStorageSync&&wx.getStorageSync("_isTIMCallKit")||getApp&&getApp()&&getApp().globalData&&getApp().globalData._isTIMCallKit)&&(i="TIMCallKit")}catch(t){console.error(t)}wx.TUIScene=i,this._callDataReport=new HC({version:Uy,sdkAppId:r.sdkAppID}),this._dataReportObserver=new BC({emitter:this._emitter},this._callDataReport),this._initLogger(r),r.tim?(this._chat=r.tim,this._timExternal=!0,NE(r.tim.addSignalingListener)||(this._logger.info("".concat(db,".constructor.start"),{text:{data:r},type:"api"}),YE.error("".concat(db,".constructor.start, you need to pass in an instance of @tencentcloud/chat, \n please use @tencentcloud/chat instead of tim-js-sdk. 需要传入 @tencentcloud/chat 的实例")))):wx.$TIM?(this._chat=wx.$TIM,this._timExternal=!0):this._chat=e.create({SDKAppID:r.sdkAppID}),this._callRecordReport=new hb({version:Uy,tim:this._chat}),this._recordReportObserver=new fb(this._emitter,this._callRecordReport),wx.getSystemInfoSync().platform===Rg.DEVTOOLS&&YE.warn("".concat(Sg)),wx.setStorageSync("sdkAppId",r.sdkAppID),this.TSignalingClient=new Ay({chat:this._chat,tuiCallEngine:this}),this.TRTCCallingDelegate=new Ny({emitter:this._emitter}),this._eventStatController=new iT;var a=new $E(XE);$E.bindController(this._eventStatController),a.setText("version=".concat(Uy)).setEnd(),this._logger.info("".concat(db,".constructor.start"),{text:{data:r},type:"api"}),YE.info("【".concat(db,"】 SDK Version:").concat(Uy,", SDKAppID:").concat(r.sdkAppID))}var a,o,s,u,d,p,v,g,y,I,m,_,E,T,b,D,R,w,S,x,L,k,O,A,N,U,P,M,j,V,G,H,B,F,K,z,J,W,q,Y,$,X,Q;return h(n,[{key:"destroyInstance",value:function(){if(n.instance){this._callDataReport&&this._callDataReport.reset&&this._callDataReport.reset(),this._dataReportObserver&&this._dataReportObserver.reset&&this._dataReportObserver.removeLister(),this._callRecordReport&&this._callRecordReport.reset(),this._recordReportObserver&&this._recordReportObserver.removeLister(),n.instance.destroyed(),n.instance=null;try{wx.removeStorageSync("sdkAppId"),wx.removeStorageSync("userId")}catch(t){console.error(t)}}}},{key:"_initLogger",value:function(t){var e=this;wx.getSystemInfo({success:function(t){var e=t.brand,n=t.model,r=t.language,i=t.platform,a=t.version;pb.updateGetReportData((function(){return{useragent:{brand:e,model:n,language:r,platform:i,version:a}}}))}}),this._logger=pb,this._logger.updateGetReportData((function(){return{app:"TUICallEngine-mini",version:Uy,platform:Rg.MINI_PROGRAM,sdkappid:t.sdkAppID,time:+new Date,userid:e.getUserID(),callinfo:{roomid:e.getRoomID(),inviteid:e.getInitialCallId(),callrole:e.isInviter()?Rg.INVITER:Rg.INVITEE,groupid:e.getGroupID(),calltype:e.getCallType(),handledInviteeList:e.getHandledInviteeList(),unHandledInviteeList:e.getUnHandledInviteeList()},callkitversion:t.callkitVersion||Rg.UNKNOWN,framework:t.frameWork||Rg.UNKNOWN,isfromchat:t.chat?"true":"false"}}))}},{key:"setLogLevel",value:function(t){"number"!=typeof t||isNaN(t)?YE.error("".concat(db,",setLogLevel parameter must be a number(0~4)")):(YE.setLevel(t),this.TSignalingClient.setLogLevel(t),this.TRTC.setLogLevel(t))}},{key:"initData",value:function(){var t={callStatus:og.IDLE,soundMode:this.data.config.type===dg.AUDIO?Cg.EAR:Cg.SPEAKER,active:!1,invitation:{inviteID:"",inviter:"",type:"",roomID:""},startTalkTime:0,localUser:null,remoteUsers:[],remoteID:"",timer:null,chatTimeNum:0,chatTime:"00:00:00",screen:"pusher",pusher:{},playerList:[],isInviter:!0,unHandledInviteeList:[],handledInviteeList:[],_inviterInviteID:{},_audioVideoSwitchIdList:[],_acceptedUserObject:{},isGroupCall:!1,groupID:"",switchCallModeStatus:!0,enterRoomStatus:!1,devicePermission:!1,_initialInviteData:{}};this.setIsEnableMultiDeviceAbility(!1),this.data=r(r({},this.data),t)}},{key:"handleNewInvitationReceived",value:(Q=c(i().mark((function t(e){var n,a,o,s,c,l,u,h,f,d,p,v,g,y;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=this.getCallStatus(),this._logger.info("TSignaling.NEW_INVITATION_RECEIVED",{text:{data:r(r({},e),{},{currentCallStatus:o})},type:"event"}),YE.log("".concat(db,".onNewInvitationReceived - params:"),e,"currentCallStatus:".concat(o)),s=e.data,c=s.inviter,l=s.inviteeList,u=s.data,h=s.inviteID,f=s.groupID,this.setInitialInviteData(JSON.parse(u)),BE((d=JSON.parse(u)).businessID)){t.next=8;break}return t.abrupt("return");case 8:if(p=(null==d||null===(n=d.data)||void 0===n?void 0:n.initialCallId)||"",this.getUserID()!==c){t.next=11;break}return t.abrupt("return");case 11:if((v=!!f)||null==d||!d.consumed){t.next=14;break}return t.abrupt("return");case 14:if(g={inviter:c,inviteeList:l,inviteID:h,isGroupCall:v,inviteData:d,groupID:f,initialCallId:p,currentCallStatus:o,inCallUserIDs:(null==d?void 0:d.inCallUserIDs)||[]},"hangup"!==(null==d||null===(a=d.data)||void 0===a?void 0:a.cmd)){t.next=22;break}if(YE.log("".concat(db,".hangup - params:"),c,d,this.getHandledInviteeList(),this.getUnHandledInviteeList(),o,v),o!==og.IDLE){t.next=19;break}return t.abrupt("return");case 19:return t.next=21,this.handleHangupSignal(g);case 21:return t.abrupt("return");case 22:if(v||!this.judgeSwitchCallMode(d)){t.next=28;break}if(o===og.IDLE||d.room_id!==this.data.invitation.roomID){t.next=27;break}return t.next=26,this.handleSwitchCallModeTSignaling(h,d);case 26:this.addAudioVideoSwitchIdList(h);case 27:return t.abrupt("return");case 28:if(o===og.IDLE){t.next=33;break}return t.next=31,this.TSignalingClient.reject({inviteID:h,type:u.call_type,lineBusy:"line_busy"});case 31:return this.getCallRecordReport().eventUploadNotSave({inviteID:p||h,callRole:Rg.INVITEE,eventType:Rg.IGNORE_CALL,roomID:d.room_id,mediaType:d.call_type,callType:f?Rg.GROUP:Rg.SINGLE}),t.abrupt("return");case 33:return t.next=35,this.getSelfIMCallStatus([this.getUserID()]);case 35:if((y=t.sent)===og.IDLE){t.next=39;break}return this._logger.error("".concat(db,".onNewInvitationReceived"),{text:{data:{params:e,customStatus:y}},type:"event"}),t.abrupt("return");case 39:return t.next=41,this.setSelfIMCallStatus(og.CALLING);case 41:this.handleInvitedSignal(g);case 42:case"end":return t.stop()}}),t,this)}))),function(t){return Q.apply(this,arguments)})},{key:"handleHangupSignal",value:(X=c(i().mark((function t(e){var n,a,o,s,c,l,u,h,f,d,p,v,g;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.inviter,a=e.currentCallStatus,o=e.inviteData,s=e.inviteeList,c=this.isGroupCall(),l=this.isInviter(),a!==og.CALLING){t.next=11;break}if(u=this.getUnHandledInviteeList(),h=this.getHandledInviteeList(),-1!==u.indexOf(n)&&this.deleteUnHandledInviteeList([n]),-1!==h.indexOf(n)){t.next=9;break}return t.abrupt("return");case 9:t.next=15;break;case 11:if(this.deleteHandledInviteeList([n]),!(-1===(f=this.getHandledInviteeList()).indexOf(n)&&f.length>1)){t.next=15;break}return t.abrupt("return");case 15:if(d=this.generateCallEndData({totalTime:o.call_end||0}),c){t.next=22;break}return this.TRTCCallingDelegate.onCallEnd(d),t.next=20,this._resetTUICallEngine();case 20:case 31:t.next=46;break;case 22:if(this.deleteHandledInviteeList([n]),this.data.playerList=this.data.playerList.filter((function(t){return t.userID!==n})),p=this.getHandledInviteeList(),v=this.getUnHandledInviteeList(),!l){t.next=33;break}if(1!==p.length||0!==v.length){t.next=31;break}return this.TRTCCallingDelegate.onCallEnd(d),t.next=31,this._resetTUICallEngine();case 33:if(a!==og.CALLING){t.next=41;break}if(-1!==s.indexOf(this.getUserID())&&this.TRTCCallingDelegate.onUserLeave({userID:n,playerList:this.data.playerList}),0!==p.length||1!==v.length){t.next=41;break}return g=this.generateEventData(),this.TRTCCallingDelegate.onCancel(r(r({inviteID:this.data.invitation.inviteID,invitee:this.getUserID(),userID:this.getUserID()},g),{},{reason:Rg.NORMAL})),t.next=41,this._resetTUICallEngine();case 41:if(a!==og.CONNECTED){t.next=46;break}if(1!==p.length||0!==v.length){t.next=46;break}return this.TRTCCallingDelegate.onCallEnd(d),t.next=46,this._resetTUICallEngine();case 46:case"end":return t.stop()}}),t,this)}))),function(t){return X.apply(this,arguments)})},{key:"handleSwitchCallModeTSignaling",value:($=c(i().mark((function t(e,n){var r,a,o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r={inviteID:e,type:n.call_type},a={cmd:"switchToVideo"},n.call_type===dg.VIDEO&&(r.switch_to_audio_call="switch_to_audio_call",a.cmd="switchToAudio"),t.next=5,this.TSignalingClient.accept(r,a);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 $.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){YE.log("".concat(db,".handleCallMode - type"),t);var n=t!==dg.VIDEO;this.setPusherAttributesHandler({enableCamera:n}),n?(this.data.config.type=dg.VIDEO,this.data.invitation.type=dg.VIDEO):(this.data.config.type=dg.AUDIO,this.data.invitation.type=dg.AUDIO),this.TRTCCallingDelegate.onCallMode({type:this.data.config.type,message:e.data.message}),this.setSwitchCallModeStatus(!0)}},{key:"handleInvitedSignal",value:(Y=c(i().mark((function t(e){var n,a,o,s,c,l,u,h,f,d,p,v,g,y,I;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.inviter,a=e.inviteeList,o=e.isGroupCall,s=e.groupID,c=e.inviteID,l=e.inviteData,u=e.inCallUserIDs,h=void 0===u?[]:u,f=e.initialCallId,d=void 0===f?"":f,this.data.remoteID=n,this.data.config.type=l.call_type,this.data.invitation.inviteID=c,this.data.invitation.inviter=n,this.data.invitation.type=l.call_type,this.data.invitation.roomID=l.room_id,this.data.isInviter=!1,this.data.isGroupCall=o,this.data.roomID=l.room_id,this.addHandledInviteeList([n]),this.addUnHandledInviteeList([].concat(C(a),C(h))),this.addAcceptedUserList(c,[n]),this.addInviterInviteId(c,[n].concat(C(a))),this.setInitialCallId(d),p=h.filter((function(t){return-1===a.indexOf(t)})),o&&(this.data.groupID=s),this.changeCallStatus(og.CALLING),YE.log("".concat(db," NEW_INVITATION_RECEIVED invitation: "),this.data.callStatus,this.data.invitation),v={sponsor:n,inviteeList:a,userIDList:[].concat(C(a),C(p)),isFromGroup:o,inviteID:c,groupID:s,inviteData:{version:l.version,callType:l.call_type,roomID:l.room_id},userData:l.userData,calleeIdList:a,callMediaType:l.call_type},this.setPusherAttributesHandler({enableCamera:this.data.config.type===dg.VIDEO}),g=r(r({},g=this.getCallDataReport().getCallData()),{},{userId:this.getUserID(),roomID:l.room_id,inviteID:c,callRole:gg,callType:l.call_type,inviteeList:a}),y={eventType:Rg.RECEIVE_CALL,callType:s?Rg.GROUP:Rg.SINGLE,mediaType:l.call_type,callRole:Rg.INVITEE,userID:this.getUserID(),roomID:l.room_id,inviteID:d||c},this.getCallRecordReport().eventUpload(y),this.getCallDataReport().setCallData(g),I=this.generateEventData()||{},this.TRTCCallingDelegate.onInvited(r(r({},I),v)),t.next=30,GE({camera:!0});case 30:this.data.devicePermission=t.sent,this.data.devicePermission&&this.data.config.type===dg.VIDEO&&wx.createLivePusherContext().startPreview();case 32:case"end":return t.stop()}}),t,this)}))),function(t){return Y.apply(this,arguments)})},{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(C(this.data._inviterInviteID[t]),C(e)))}},{key:"handleInviteeAccepted",value:(q=c(i().mark((function t(e){var n,a,o,s,c,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("TSignaling.INVITEE_ACCEPTED",{text:{data:r(r({},e),{},{currentCallStatus:this.data.callStatus}),type:"event"}}),YE.log("".concat(db," onInviteeAccepted - params:"),e),BE(null==(n=JSON.parse(e.data.data))?void 0:n.businessID)){t.next=5;break}return t.abrupt("return");case 5:if(a=e.data.invitee,o=e.data.inviteID,-1!==this.getTotalInviterInviteIdList().indexOf(o)){t.next=9;break}return t.abrupt("return");case 9:if(this.data.callStatus!==og.IDLE){t.next=11;break}return t.abrupt("return");case 11:if(this.isGroupCall()||!this.judgeSwitchCallMode(n)||this.data.switchCallModeStatus){t.next=14;break}return this.handleCallMode(this.data.invitation.type),t.abrupt("return");case 14:if(s=this.getCallStatus(),a!==this.getUserID()||s!==og.CALLING){t.next=21;break}return c=this.generateEventData(),this.TRTCCallingDelegate.onCancel(r({inviteID:this.data.invitation.inviteID,invitee:a,userID:a},c)),t.next=20,this._resetTUICallEngine();case 20:return t.abrupt("return");case 21:return this.isInviter()&&this.data.callStatus===og.CALLING&&this.changeCallStatus(og.CONNECTED),this.getCallDataReport().setCallAcceptTime((new Date).getTime()),this.addHandledInviteeList([a]),this.deleteUnHandledInviteeList([a]),this.addAcceptedUserList(o,[a]),t.next=28,this.getUserProfile(this.data.unHandledInviteeList.map((function(t){return{userID:t}})));case 28:l=t.sent,this.TRTCCallingDelegate.onUserAccept({userID:a,userList:l});case 30:case"end":return t.stop()}}),t,this)}))),function(t){return q.apply(this,arguments)})},{key:"handleInviteeRejected",value:(W=c(i().mark((function t(e){var n,a,o,s,c,l,u,h,f,d,p,v,g,y,I,m;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("TSignaling.INVITEE_REJECTED",{text:{data:e},type:"event"}),YE.log("".concat(db," onInviteeRejected - params"),e),a=e.data.inviteID,BE(null==(o=JSON.parse(e.data.data))?void 0:o.businessID)){t.next=6;break}return t.abrupt("return");case 6:if(this.isGroupCall()||this.getSwitchCallModeStatus()||-1===this.getAudioVideoSwitchIdList().indexOf(a)){t.next=10;break}return YE.log("".concat(db,".onInviteeRejected - Audio and video switching is not available")),this.setSwitchCallModeStatus(!0),t.abrupt("return");case 10:if(s=e.data.invitee,c=e.data.inviter,l=this.getUserID(),u=this.getCallStatus(),-1!==this.getInviterInviteIdList().indexOf(a)){t.next=19;break}if(!this.isInviter()||-1===this.getInviterInviteIdUserList().indexOf(s)){t.next=17;break}return t.abrupt("return");case 17:return this.deleteUnHandledInviteeList([s]),t.abrupt("return");case 19:if(u!==og.IDLE){t.next=21;break}return t.abrupt("return");case 21:if(h=this.generateEventData(),l!==s||u!==og.CALLING){t.next=27;break}return this.TRTCCallingDelegate.onCancel(r({inviteID:this.data.invitation.inviteID,invitee:s,userID:s},h)),t.next=26,this._resetTUICallEngine();case 26:return t.abrupt("return");case 27:if(f=this.isGroupCall(),d=this.isInviter(),this.deleteUnHandledInviteeList([s]),p=this.getUnHandledInviteeList(),v=this.getHandledInviteeList(),g=r({inviteID:this.data.invitation.inviteID,invitee:l,userID:l},h),y={inviteID:this.data.invitation.inviteID,invitee:s,userID:s},I=this.data.invitation,u!==og.CONNECTED){t.next=38;break}if(-1===v.indexOf(s)){t.next=38;break}return t.abrupt("return");case 38:if(!("line_busy"===o.line_busy||""===o.line_busy||null!=o&&null!==(n=o.data)&&void 0!==n&&n.message&&"lineBusy"===o.data.message)){t.next=52;break}if(c===I.inviter&&this.TRTCCallingDelegate.onLineBusy({inviteID:this.data.invitation.inviteID,invitee:s,userID:s}),f){t.next=46;break}return this.TRTCCallingDelegate.onCancel(r(r({},g),{},{reason:Rg.BUSYLINE})),t.next=44,this._resetTUICallEngine();case 44:t.next=50;break;case 46:if(0!==p.length||1!==v.length){t.next=50;break}return this.TRTCCallingDelegate.onCancel(r(r({},g),{},{reason:Rg.BUSYLINE})),t.next=50,this._resetTUICallEngine();case 50:case 57:t.next=78;break;case 52:if(f){t.next=59;break}return this.TRTCCallingDelegate.onReject(y),this.TRTCCallingDelegate.onCancel(r(r({},g),{},{reason:Rg.REJECT})),t.next=57,this._resetTUICallEngine();case 59:if(this.TRTCCallingDelegate.onReject(y),u!==og.CALLING){t.next=72;break}if(!d){t.next=68;break}if(0!==p.length||1!==v.length){t.next=66;break}return this.TRTCCallingDelegate.onCancel(r(r({},g),{},{reason:Rg.REJECT})),t.next=66,this._resetTUICallEngine();case 66:t.next=72;break;case 68:if(1!==p.length||0!==v.length){t.next=72;break}return this.TRTCCallingDelegate.onCancel(r(r({},g),{},{reason:Rg.REJECT})),t.next=72,this._resetTUICallEngine();case 72:if(u!==og.CONNECTED){t.next=78;break}if(0!==p.length||1!==v.length){t.next=78;break}return m=this.generateCallEndData(),this.TRTCCallingDelegate.onCallEnd(m),t.next=78,this._resetTUICallEngine();case 78:case"end":return t.stop()}}),t,this)}))),function(t){return W.apply(this,arguments)})},{key:"handleInvitationCancelled",value:(J=c(i().mark((function t(e){var n,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("TSignaling.INVITATION_CANCELLED",{text:{data:e,type:"event"}}),this.data.invitation.inviteID===e.data.inviteID){t.next=3;break}return t.abrupt("return");case 3:if(BE(null==(n=JSON.parse(e.data.data))?void 0:n.businessID)){t.next=6;break}return t.abrupt("return");case 6:if(this.data.callStatus!==og.IDLE){t.next=8;break}return t.abrupt("return");case 8:if(-1!==this.getInviterInviteIdList().indexOf(e.data.inviteID)){t.next=10;break}return t.abrupt("return");case 10:return YE.log(db,"onInvitationCancelled","inviteID:".concat(e.data.inviteID," inviter:").concat(e.data.inviter," data:").concat(e.data.data)),a=this.generateEventData(),this.TRTCCallingDelegate.onCancel(r(r({inviteID:this.data.invitation.inviteID,invitee:e.data.inviter,userID:e.data.inviter},a),{},{reason:Rg.NORMAL})),t.next=15,this._resetTUICallEngine();case 15:case"end":return t.stop()}}),t,this)}))),function(t){return J.apply(this,arguments)})},{key:"handleInvitationTimeout",value:(z=c(i().mark((function t(e){var n,a,o,s,c,l,u,h,f,d,p,v,g,y,I,m,_,E;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("TSignaling.INVITATION_TIMEOUT",{text:{data:e,type:"event"}}),a=e.data,o=a.inviter,s=a.inviteeList,c=void 0===s?[]:s,l=a.inviteID,u=this.getUserID(),h=this.isGroupCall(),f=this.isInviter(),d=this.getCallStatus(),this.deleteUnHandledInviteeList(c),YE.warn("".concat(db,".onInvitationTimeout - params:"),e,"currentUserID:".concat(u," isInviter:").concat(f," isGroupCall:").concat(h," \n currentCallStatus:").concat(d," inviteID:").concat(null==this||null===(n=this._newInvitationData)||void 0===n?void 0:n.inviteID)),-1!==this.getInviterInviteIdList().indexOf(l)){t.next=10;break}return t.abrupt("return");case 10:if(d!==og.IDLE){t.next=12;break}return t.abrupt("return");case 12:if(p=this.getHandledInviteeList(),v=this.getUnHandledInviteeList(),g={groupID:this.data.groupID,inviteID:this.data.invitation.inviteID,sponsor:o,timeoutUserList:c,userIDList:c},y=this.generateEventData(),I=r(r({inviteID:this.data.invitation.inviteID,invitee:u,userID:u},y),{},{reason:Rg.TIMEOUT}),h){t.next=23;break}return f?(this.TRTCCallingDelegate.onNoResp(g),this.TRTCCallingDelegate.onCancel(I)):(this.TRTCCallingDelegate.onCancel(I),m=this.getCallRecordReport().getCallRecordData().head,this.getCallRecordReport().eventUpload(r(r({},m),{},{eventType:Rg.NOT_ANSWER_CALL,inviteID:this.getInitialCallId()}))),t.next=21,this._resetTUICallEngine();case 21:t.next=48;break;case 23:if(d!==og.CALLING){t.next=41;break}if(!f){t.next=32;break}if(this.TRTCCallingDelegate.onNoResp(g),0!==v.length){t.next=30;break}return this.TRTCCallingDelegate.onCancel(I),t.next=30,this._resetTUICallEngine();case 30:t.next=41;break;case 32:if(-1!==c.indexOf(u)){t.next=36;break}this.TRTCCallingDelegate.onNoResp(g),t.next=39;break;case 36:return this.TRTCCallingDelegate.onCancel(I),t.next=39,this._resetTUICallEngine();case 39:_=this.getCallRecordReport().getCallRecordData().head,this.getCallRecordReport().eventUpload(r(r({},_),{},{eventType:Rg.NOT_ANSWER_CALL,inviteID:this.getInitialCallId()}));case 41:if(d!==og.CONNECTED){t.next=48;break}if(this.TRTCCallingDelegate.onNoResp(g),1!==p.length||0!==v.length){t.next=48;break}return E=this.generateCallEndData(),this.TRTCCallingDelegate.onCallEnd(E),t.next=48,this._resetTUICallEngine();case 48:case"end":return t.stop()}}),t,this)}))),function(t){return z.apply(this,arguments)})},{key:"handleSDKReady",value:(K=c(i().mark((function t(){var e=this;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("ChatSdkEvent.SDK_READY",{text:{type:"event"}}),YE.log(db,"TSignaling SDK ready"),this._loginResolveList.forEach((function(t){return t.resolve(t.value)})),this._loginResolveList=[],this.TRTCCallingDelegate.onSdkReady({message:"SDK ready"}),t.next=7,this.setSelfIMCallStatus(og.IDLE);case 7:this._chat.getMyProfile().then((function(t){e.data.localUser=t.data})).catch((function(t){YE.warn("getMyProfile error:",t)}));case 9:case"end":return t.stop()}}),t,this)}))),function(){return K.apply(this,arguments)})},{key:"handleKickedOut",value:(F=c(i().mark((function t(){var e,n,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("ChatSdkEvent.KICKED_OUT",{text:{type:"event"}}),this.getCallStatus()!==og.CONNECTED){t.next=6;break}return e=this.generateCallEndData(),this.TRTCCallingDelegate.onCallEnd(e),t.next=6,this._resetTUICallEngine();case 6:if(this.getCallStatus()!==og.CALLING){t.next=14;break}return n=this.getUserID(),a=this.generateEventData(),this.TRTCCallingDelegate.onCancel(r(r({inviteID:this.data.invitation.inviteID,invitee:n,userID:n},a),{},{reason:Rg.BANNED})),t.next=12,this.cancel();case 12:return t.next=14,this._resetTUICallEngine();case 14:this._initReady=!1,this.TRTCCallingDelegate.onKickedOut({message:"kicked out"});case 16:case"end":return t.stop()}}),t,this)}))),function(){return F.apply(this,arguments)})},{key:"_addTSignalingEvent",value:function(){var t,n,r,i,a,o=e.EVENT,s=e.TSignaling;null===(t=this._chat)||void 0===t||t.addSignalingListener(s.NEW_INVITATION_RECEIVED,this.handleNewInvitationReceived,this),null===(n=this._chat)||void 0===n||n.addSignalingListener(s.INVITEE_ACCEPTED,this.handleInviteeAccepted,this),null===(r=this._chat)||void 0===r||r.addSignalingListener(s.INVITEE_REJECTED,this.handleInviteeRejected,this),null===(i=this._chat)||void 0===i||i.addSignalingListener(s.INVITATION_CANCELLED,this.handleInvitationCancelled,this),null===(a=this._chat)||void 0===a||a.addSignalingListener(s.INVITATION_TIMEOUT,this.handleInvitationTimeout,this),this._chat.on(o.SDK_READY,this.handleSDKReady,this),this._chat.on(o.KICKED_OUT,this.handleKickedOut,this),this._chat.on(o.USER_STATUS_UPDATED,this.onUserStatusUpdated,this)}},{key:"_removeTSignalingEvent",value:function(){var t,n,r,i,a,o=e.EVENT,s=e.TSignaling;null===(t=this._chat)||void 0===t||t.removeSignalingListener(s.NEW_INVITATION_RECEIVED,this.handleNewInvitationReceived),null===(n=this._chat)||void 0===n||n.removeSignalingListener(s.INVITEE_ACCEPTED,this.handleInviteeAccepted),null===(r=this._chat)||void 0===r||r.removeSignalingListener(s.INVITEE_REJECTED,this.handleInviteeRejected),null===(i=this._chat)||void 0===i||i.removeSignalingListener(s.INVITATION_CANCELLED,this.handleInvitationCancelled),null===(a=this._chat)||void 0===a||a.removeSignalingListener(s.INVITATION_TIMEOUT,this.handleInvitationTimeout),this._chat.off(o.SDK_READY,this.handleSDKReady),this._chat.off(o.KICKED_OUT,this.handleKickedOut),this._chat.off(o.USER_STATUS_UPDATED,this.onUserStatusUpdated)}},{key:"onLocalJoin",value:function(){var t=this.generateEventData();this.TRTCCallingDelegate.onCallBegin(t)}},{key:"onRemoteUserJoin",value:(B=c(i().mark((function t(e){var n,r,a,o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.data,r=n.userID,a=n.userList,o=n.playerList,YE.log(db,"REMOTE_USER_JOIN",e,r),this.getCallStatus()===og.CONNECTED||!this.isInviter()){t.next=5;break}return t.next=5,this.setSelfIMCallStatus(og.CONNECTED);case 5:if(this.addHandledInviteeList([r]),this.deleteUnHandledInviteeList([r]),this.changeCallStatus(og.CONNECTED),!(o.length>0)){t.next=14;break}return t.next=11,this.getUserProfile(o);case 11:t.t0=t.sent,t.next=15;break;case 14:t.t0=this.data.playerList;case 15:this.data.playerList=t.t0,this.data.startTalkTime||(this.data.startTalkTime=Date.now()),this.TRTCCallingDelegate.onUserEnter({userID:e.data.userID,playerList:this.data.playerList}),YE.log(db,"REMOTE_USER_JOIN","playerList:",this.data.playerList,"userList:",a);case 19:case"end":return t.stop()}}),t,this)}))),function(t){return B.apply(this,arguments)})},{key:"onRemoteUserLeave",value:(H=c(i().mark((function t(e){var n,r,a,o,s,c;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.getCallStatus()!==og.IDLE){t.next=2;break}return t.abrupt("return");case 2:if(n=e.data.userID,YE.log(db,"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=17;break}return t.next=11,this.TSignalingClient.hangup({userIDList:[n],callType:this.data.config.type,callEnd:this.generateCallTotalTime()});case 11:return r=this.generateCallEndData(),this.TRTCCallingDelegate.onCallEnd(r),YE.log(db,"REMOTE_USER_LEAVE","playerList:"),t.next=16,this._resetTUICallEngine();case 16:return t.abrupt("return");case 17:if(a=this.getHandledInviteeList(),o=this.getUnHandledInviteeList(),s=this.getUserID(),1!==a.length||a[0]!==s||0!==o.length){t.next=25;break}return c=this.generateCallEndData(),this.TRTCCallingDelegate.onCallEnd(c),t.next=25,this._resetTUICallEngine();case 25:case"end":return t.stop()}}),t,this)}))),function(t){return H.apply(this,arguments)})},{key:"onLocalNetStateUpdate",value:function(t){var e=t.data.pusher.netStatus;YE.log(db,"onLocalNetStateUpdate",e),this.data.pusher=t.data.pusher,this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList})}},{key:"onRemoteNetStateUpdate",value:(G=c(i().mark((function t(e){var n;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=e.data.playerList,YE.log(db,"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 G.apply(this,arguments)})},{key:"onUserStatusUpdated",value:(V=c(i().mark((function t(e){var n,r,a,o=this;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("".concat(db,".onUserStatusUpdated"),{text:{data:e},type:"event"}),n=(e.data||[]).find((function(t){return t.userID===o.getUserID()}))){t.next=4;break}return t.abrupt("return");case 4:if(r=Ag[n.customStatus],(a=this.getCallStatus())===og.IDLE){t.next=10;break}if(r===a){t.next=10;break}return t.next=10,this.setSelfIMCallStatus(a);case 10:case"end":return t.stop()}}),t,this)}))),function(t){return V.apply(this,arguments)})},{key:"onError",value:function(t){YE.warn(db,"onError",t),this.TRTCCallingDelegate.onError(t)}},{key:"onRemoteVideoAdd",value:function(t){YE.log("* room REMOTE_VIDEO_ADD",t);var e=t.data.player;this.setPlayerAttributesHandler(e,{muteVideo:!1})}},{key:"onRemoteVideoRemove",value:function(t){YE.log("* room REMOTE_VIDEO_REMOVE",t);var e=t.data.player;this.setPlayerAttributesHandler(e,{muteVideo:!0})}},{key:"onRemoteAudioAdd",value:(j=c(i().mark((function t(e){var n;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return YE.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 j.apply(this,arguments)})},{key:"onRemoteAudioRemove",value:function(t){YE.log("* room REMOTE_AUDIO_REMOVE",t);var e=t.data.player;this.setPlayerAttributesHandler(e,{muteAudio:!0})}},{key:"onRemoteAudioVolumeUpdate",value:(M=c(i().mark((function t(e){var n;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:YE.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 M.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.LOCAL_JOIN,this.onLocalJoin,this),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.LOCAL_JOIN,this.onLocalJoin),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(){this._logger.info("".concat(db,".initTRTC.start"),{type:"api"});var t=this.TRTC.createPusher();this.setBeautyLevel(this._beautyLevel),this.data.pusher=t.pusherAttributes}},{key:"enterRoom",value:function(t){var e=+new Date;this._logger.info("".concat(db,".enterRoom.start"),{text:{data:t},type:"api"}),this._addTRTCEvent();var n=t.roomID,i=Object.assign(this.data.config,{roomID:n,enableMic:!0,autopush:!0,enableAgc:!0,enableAns:!0,enableCamera:t.callType===dg.VIDEO});this.data.enterRoomStatus=!0,this.data.pusher=this.TRTC.enterRoom(i);var a=+new Date;this._logger.info("".concat(db,".enterRoom.success"),{text:{data:r(r({},t),{},{cost:a-e})},type:"api"}),wx.createLivePusherContext().startPreview(),this.getCurrentPusherInstance().start()}},{key:"setBeautyLevel",value:function(t){wC.getInstance().getAlert().checkSync(new mC({api:"setBeautyLevel",attributes:{level:t}})),this._beautyLevel=t,this._initReady&&this.setPusherAttributesHandler({beautyLevel:this._beautyLevel})}},{key:"exitRoom",value:(P=c(i().mark((function t(){var e;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(db,".exitRoom.start"),{type:"api"}),t.next=3,this.getCurrentPusherInstance().stop();case 3:return t.next=5,this.TRTC.exitRoom();case 5: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 12:case"end":return t.stop()}}),t,this)}))),function(){return P.apply(this,arguments)})},{key:"setPusherAttributesHandler",value:function(t){this._logger.info("".concat(db,".setPusherAttributesHandler.start"),{text:{data:t},type:"api"}),this.data.pusher=this.TRTC.setPusherAttributes(t),this.TRTCCallingDelegate.onUserUpdate({pusher:this.data.pusher,playerList:this.data.playerList})}},{key:"setPlayerAttributesHandler",value:(U=c(i().mark((function t(e,n){var r;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this._logger.info("".concat(db,".setPlayerAttributesHandler.start"),{text:{data:n},type:"api"}),r=this.TRTC.setPlayerAttributes(e.streamID,n),YE.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 6:case"end":return t.stop()}}),t,this)}))),function(t,e){return U.apply(this,arguments)})},{key:"_mutePlayerAudio",value:function(t){this._logger.info("".concat(db,"._mutePlayerAudio.start"),{text:{data:t},type:"api"});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){this._logger.info("".concat(db,"._mutePlayerVideo.start"),{text:{data:t},type:"api"});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._logger.info("".concat(db,"._pusherAudioHandler.start"),{type:"api",text:{data:{enableMic:this.data.pusher.enableMic}}}),this.data.pusher.enableMic?(this.setPusherAttributesHandler({enableMic:!1}),this.getCurrentPusherInstance().setMICVolume({volume:0})):(this.setPusherAttributesHandler({enableMic:!0}),this.getCurrentPusherInstance().setMICVolume({volume:100}))}},{key:"_pusherVideoHandler",value:function(){this._logger.info("".concat(db,"._pusherVideoHandler.start"),{type:"api",text:{data:{enableCamera:this.data.pusher.enableCamera}}}),this.data.pusher.enableCamera?this.setPusherAttributesHandler({enableCamera:!1}):this.setPusherAttributesHandler({enableCamera:!0})}},{key:"init",value:(N=c(i().mark((function t(e){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return wC.getInstance().getAlert().checkSync(new mC({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 N.apply(this,arguments)})},{key:"login",value:(A=c(i().mark((function t(e){var n=this;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.updateGetReportData((function(){return{userid:e.userID}})),this._logger.info("".concat(db,".login.start"),{type:"api",text:{data:r(r({},e),{},{userSig:""})}}),this.data.config.userID=e.userID,this.data.config.userSig=e.userSig,t.abrupt("return",new Promise((function(t,r){n._chat.login({userID:e.userID,userSig:e.userSig}).then((function(r){var i;wx.setStorageSync("userId","".concat(e.userID)),n._callDataReport.setUserID(e.userID),n._initReady=!0,n._resetTUICallEngine(),n._addTSignalingEvent(),n.initTRTC(),null!==(i=r.data)&&void 0!==i&&i.repeatLogin&&(n._logger.info("".concat(db,".login.success"),{text:{error:"The TIM login status has been inherited into Call"},type:"api"}),YE.info("".concat(db,".login - success: The TIM login status has been inherited into Call. IM 登录状态已成功被 Call 继承。")),n._chat.isReady()&&n.TRTCCallingDelegate.onSdkReady({message:"SDK ready"}),t()),n._loginResolveList.push({resolve:t,value:r})})).catch((function(e){var i=e||{},a=i.code,o=i.message;2024===a||2025===a?(n._logger.warn("".concat(db,".login.fail"),{text:{error:"".concat(a,", ").concat(o)},type:"api"}),YE.warn("".concat(db,".login failed: ").concat(a,", ").concat(o,".")),n._loginResolveList.push({resolve:t,value:{code:0,message:"success"}})):(n._logger.error("".concat(db,".login.fail"),{text:{error:"".concat(a,", ").concat(o)},type:"api"}),r(e))}))})));case 5:case"end":return t.stop()}}),t,this)}))),function(t){return A.apply(this,arguments)})},{key:"logout",value:(O=c(i().mark((function t(){var e,n,r;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("".concat(db,".logout.start"),{type:"api",text:{data:{userID:this.data.config.userID,initReady:this._initReady}}}),this._initReady){t.next=3;break}return t.abrupt("return");case 3:return this._loginResolveList=[],e=this.data.config,n=e.userID,r=e.userSig,t.prev=5,t.next=8,this._chat.logout({userID:n,userSig:r});case 8:YE.log(db,"logout","IM logout success"),t.next=15;break;case 11:t.prev=11,t.t0=t.catch(5),this._logger.error("".concat(db,".logout.fail"),{type:"api",text:{error:t.t0}}),YE.error(db,"logout","IM logout failure");case 15:case"end":return t.stop()}}),t,this,[[5,11]])}))),function(){return O.apply(this,arguments)})},{key:"on",value:function(t,e,n){wC.getInstance().getAlert().checkSync(new mC({api:"on",attributes:{eventCode:t,handler:e,context:n}})),this._emitter.on(t,e,n)}},{key:"off",value:function(t,e){wC.getInstance().getAlert().checkSync(new mC({api:"off",attributes:{eventCode:t,handler:e}})),this._emitter.off(t,e)}},{key:"call",value:(k=c(i().mark((function t(e){var n,a,o,s,c,l,u;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(db,".call.start"),{type:"api",text:{data:e}}),n=e.userID,a=e.type,t.next=4,wC.getInstance().getAlert().check(new mC({api:"call",attributes:e,initReady:this._initReady,callStatus:this.data.callStatus,capabilityCode:bg.BASE,sdkAppID:this.data.config.sdkAppID}),{tim:this._chat});case 4:return t.prev=4,t.next=7,FC(a);case 7:t.next=13;break;case 9:return t.prev=9,t.t0=t.catch(4),this._logger.error("".concat(db,".call.fail"),{text:{error:t.t0},type:"api"}),t.abrupt("return");case 13:if(this.getUserID()!==n){t.next=17;break}throw this._logger.error("".concat(db,".call.fail"),{text:{error:"Called id can not be yourself. userId:".concat(this.getUserID(),", inviteeId:").concat(n)},type:"api"}),YE.log("".concat(db,".call failed. Called id can't be yourself. userId:").concat(this.getUserID(),", inviteeId:").concat(n)),new Error("".concat(db,".call failed. Called id can't be yourself. userId:").concat(this.getUserID(),", inviteeId:").concat(n));case 17:return t.next=19,this.getSelfIMCallStatus([this.getUserID()]);case 19:if((o=t.sent)===og.IDLE){t.next=23;break}throw this._logger.error("".concat(db,".call.failed"),{text:{data:{params:e,customStatus:o}},type:"api"}),new ky({message:"".concat(db,"<call>:failed ").concat(wy,". customStatus: ").concat(o),code:Ey.ERROR_REQUEST_REFUSED});case 23:return this._callDataReport.setAbilityBit(!0),this._callDataReport.setCallScene(Rg.SINGLE_CALL),s={callType:Rg.SINGLE,mediaType:a,inviteeList:[n]},t.prev=26,c=e.roomID||Math.floor(2147483646*Math.random()+1),this.data.roomID=c,this.data.config.type=a,this.data.invitation.inviter=this.data.config.userID,this.data.invitation.type=a,this.data.invitation.roomID=c,this.data.isInviter=!0,this.data.remoteID=n,this.changeCallStatus(og.CALLING),t.next=38,this.TSignalingClient.invite(r(r({},e),{},{roomID:c}));case 38:if(l=t.sent,this.enterRoom({roomID:c,callType:a}),this._callDataReport.setEnterRoomTime((new Date).getTime()),u=r(r({},u=this._callDataReport.getCallData()),{},{userId:n,roomID:c,callRole:vg,callType:a,inviteeList:[n]}),this._callDataReport.setCallData(u),this._callDataReport.setSendSignalingTime((new Date).getTime()),YE.log("".concat(db," call(userID: ").concat(n,", type: ").concat(a,") success, ").concat(l)),0!==l.code){t.next=57;break}this.data.invitation.inviteID=l.inviteID,this.addInviterInviteId(l.inviteID,[this.data.config.userID,n]),this.addUnHandledInviteeList([n]),this.addHandledInviteeList([this.getUserID()]),this._callDataReport.setInviteID(l.inviteID),this.setInitialCallId(l.inviteID),this._callRecordUpload(r({eventType:Rg.START_CALL},s)),this._callRecordReport.startHeartbeat(),t.next=63;break;case 57:return this._callDataReport.setCodeAndMessage(l.code,l.message),this._callDataReport.uploadToKibana(),this._callRecordUpload(r({eventType:Rg.CALL_FAILED},s)),this._logger.error("".concat(db,".call.fail"),{text:{error:l},type:"api"}),t.next=63,this._resetTUICallEngine();case 63:return t.abrupt("return",{data:l.data,pusher:this.data.pusher});case 66:return t.prev=66,t.t1=t.catch(26),t.t1.code===Ey.ERROR_BLACKLIST?(this.TRTCCallingDelegate.onError(Ey.ERROR_BLACKLIST,t.t1.message),this._callDataReport.setCodeAndMessage(Ey.ERROR_BLACKLIST,t.t1.message)):this._callDataReport.setCodeAndMessage(Ey.UNKNOWN,JSON.stringify(t.t1)),this._callDataReport.uploadToKibana(),this._callRecordUpload(r({eventType:Rg.CALL_FAILED},s)),this._logger.error("".concat(db,".call.fail"),{text:{error:t.t1},type:"api"}),YE.error("".concat(db," call(userID:").concat(n,",type:").concat(a,") failed', error: ").concat(t.t1)),t.next=75,this._resetTUICallEngine();case 75:throw new Error(t.t1);case 76:case"end":return t.stop()}}),t,this,[[4,9],[26,66]])}))),function(t){return k.apply(this,arguments)})},{key:"groupCall",value:(L=c(i().mark((function t(e){var n,a,o,s,c,l;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(db,".groupCall.start"),{type:"api",text:{data:e}}),n=e.type,a=e.userIDList,t.next=4,wC.getInstance().getAlert().check(new mC({api:"groupCall",attributes:e,initReady:this._initReady,callStatus:this.data.callStatus,capabilityCode:bg.PRO,sdkAppID:this.data.config.sdkAppID}),{tim:this._chat});case 4:return t.prev=4,t.next=7,FC(n);case 7:t.next=13;break;case 9:return t.prev=9,t.t0=t.catch(4),this._logger.error("".concat(db,".groupCall.fail"),{type:"api",text:{error:t.t0}}),t.abrupt("return");case 13:if(-1===a.indexOf(this.getUserID())){t.next=16;break}throw this._logger.error("".concat(db,".groupCall.fail"),{type:"api",text:{error:"Called list can not contain yourself"}}),new Error("".concat(db,".groupCall failed. Called list can't contain yourself. userID:").concat(this.getUserID(),", inviteeIDList:").concat(a));case 16:return t.next=18,this.getSelfIMCallStatus([this.getUserID()]);case 18:if((o=t.sent)===og.IDLE){t.next=22;break}throw this._logger.error("".concat(db,".groupCall.failed"),{text:{data:{params:e,customStatus:o}},type:"api"}),new ky({message:"".concat(db,"<groupCall>:failed ").concat(wy,". customStatus: ").concat(o),code:Ey.ERROR_REQUEST_REFUSED});case 22:return this._callDataReport.setCallScene(Rg.GROUP_CALL),s=e.roomID||Math.floor(2147483646*Math.random()+1),this.enterRoom({roomID:s,callType:n}),c={callType:Rg.GROUP,mediaType:n,inviteeList:e.userIDList},this.data.config.type=e.type,this.data.invitation.inviter=this.data.config.userID,this.data.invitation.type=n,this.data.invitation.roomID=s,this.data.isInviter=!0,this.data.isGroupCall=!0,this.data.groupID=e.groupID,this.changeCallStatus(og.CALLING),t.prev=34,t.next=37,this.TSignalingClient.inviteGroup(r(r({},e),{},{roomID:s}));case 37:return l=t.sent,this.data.config.type=e.type,this.data.invitation.inviteID=l.inviteID,this.data.invitation.inviter=this.data.config.userID,this.data.invitation.type=n,this.data.invitation.roomID=s,this.data.isInviter=!0,this.data.isGroupCall=!0,this.data.groupID=e.groupID,this.data.roomID=s,this.addUnHandledInviteeList(e.userIDList),this.addHandledInviteeList([this.getUserID()]),this.addInviterInviteId(l.inviteID,[this.data.config.userID].concat(C(e.userIDList))),this.setInitialCallId(l.inviteID),this._callRecordUpload(r({eventType:Rg.START_CALL},c)),this._callRecordReport.startHeartbeat(),YE.log(db,"groupCall OK",l),t.abrupt("return",{data:l.data,pusher:this.data.pusher});case 57:return t.prev=57,t.t1=t.catch(34),this._logger.error("".concat(db,".groupCall.fail"),{text:{error:t.t1},type:"api"}),YE.error(db,"groupCall failed",t.t1),this._callRecordUpload(r({eventType:Rg.CALL_FAILED},c)),t.next=64,this._resetTUICallEngine();case 64:throw new Error(t.t1);case 65:case"end":return t.stop()}}),t,this,[[4,9],[34,57]])}))),function(t){return L.apply(this,arguments)})},{key:"joinInGroupCall",value:(x=c(i().mark((function t(e){var n,r,a,o,s;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(db,".joinInGroupCall.start"),{text:{data:e},type:"api"}),n=e.roomID,r=e.type,a=e.groupID,t.next=4,wC.getInstance().getAlert().check(new mC({api:"joinInGroupCall",attributes:e,initReady:this._initReady,capabilityCode:bg.PRO,sdkAppID:this.data.config.sdkAppID}),{tim:this._chat});case 4:return t.next=6,this.getSelfIMCallStatus([this.getUserID()]);case 6:if((o=t.sent)===og.IDLE){t.next=10;break}throw this._logger.error("".concat(db,".joinInGroupCall.failed"),{text:{data:{params:e,customStatus:o}},type:"api"}),new ky({message:"".concat(db,"<joinInGroupCall>:failed ").concat(wy,". customStatus: ").concat(o),code:Ey.ERROR_REQUEST_REFUSED});case 10:return t.prev=10,t.next=13,FC(r);case 13:t.next=19;break;case 15:return t.prev=15,t.t0=t.catch(10),this._logger.error("".concat(db,".joinInGroupCall.fail"),{text:{error:t.t0},type:"api"}),t.abrupt("return");case 19:return t.prev=19,this.data.config.type=r,this.data.invitation.type=r,YE.log("".concat(db,".joinInGroupCall roomID:").concat(n,",type:").concat(r,",userID:").concat(this.getUserID())),this.changeCallStatus(og.CALLING),this.addHandledInviteeList([this.getUserID()]),this.data.groupID=a,this.data.roomID=n,this.data.isGroupCall=!0,this.data.isInviter=!1,this.enterRoom({roomID:n,callType:r}),t.next=32,this.setSelfIMCallStatus(og.CONNECTED);case 32:return this.changeCallStatus(og.CONNECTED),this.getCallRecordReport().setBodyStatus(og.CONNECTED),s={eventType:Rg.JOIN_IN_GROUP_CALL,callType:Rg.GROUP,mediaType:this._callType},this._callRecordUpload(s),this._callRecordReport.startHeartbeat(),t.abrupt("return",this.data.pusher);case 40:return t.prev=40,t.t1=t.catch(19),this._logger.error("".concat(db,".joinInGroupCall.fail"),{text:{error:t.t1},type:"api"}),t.next=45,this._resetTUICallEngine();case 45:throw new Error("".concat(db,".joinInGroupCall failed error: ").concat(t.t1));case 46:case"end":return t.stop()}}),t,this,[[10,15],[19,40]])}))),function(t){return x.apply(this,arguments)})},{key:"inviteUser",value:(S=c(i().mark((function t(e){var n,r,a,o,s,c,l,u,h,f=this;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(db,".inviteUser.start"),{text:{data:e},type:"api"}),t.next=3,wC.getInstance().getAlert().check(new mC({api:"inviteUser",attributes:e,initReady:this._initReady,capabilityCode:bg.PRO,sdkAppID:this.data.config.sdkAppID}),{tim:this._chat});case 3:if(n=e.userIDList,r=void 0===n?[]:n,this.isGroupCall()){t.next=8;break}throw this._logger.error("".concat(db,".inviteUser.fail"),{text:{error:"".concat(db,".inviteUser - groupID:").concat(this.data.groupID,", roomID:").concat(this.data.roomID,", type:").concat(this.data.callType)},type:"api"}),YE.error("".concat(db,".inviteUser - groupID:").concat(this.data.groupID,", roomID:").concat(this.data.roomID,", type:").concat(this.data.callType)),new Error("".concat(db,".inviteUser - groupID:").concat(this.data.groupID,", roomID:").concat(this.data.roomID,", type:").concat(this.data.callType));case 8:if(this.isInviter()||this.data.callStatus===og.CONNECTED){t.next=12;break}throw this._logger.error("".concat(db,".inviteUser.fail"),{text:{error:"".concat(db,".inviteUser - current status:").concat(this.data.callStatus," not support")},type:"api"}),YE.error("".concat(db,".inviteUser - current status:").concat(this.data.callStatus," not support")),new Error("".concat(db,".inviteUser - current status:").concat(this.data.callStatus," not support"));case 12:if(0!==r.length){t.next=16;break}throw this._logger.error("".concat(db,".inviteUser.fail"),{text:{error:"userIDList is empty"},type:"api"}),YE.error("".concat(db,".inviteUser - userIDList is empty")),new Error("".concat(db,".inviteUser - userIDList is empty"));case 16:if(a=this.getHandledInviteeList(),o=this.getUnHandledInviteeList(),s=[].concat(C(a),C(o)),0!==(c=r.filter((function(t){return-1===s.indexOf(t)}))).length){t.next=24;break}return this._logger.error("".concat(db,".inviteUser.fail"),{text:{data:{userIDList:r},error:"userIDList in call list"},type:"api"}),YE.error("".concat(db,".inviteUser failed - userIDList in call list. userIDList:").concat(JSON.stringify(r))),t.abrupt("return",Promise.reject("".concat(db,".inviteUser failed - userIDList in call list. userIDList:").concat(JSON.stringify(r))));case 24:return r=c,t.prev=25,l=this.data.handledInviteeList.filter((function(t){return t!==f.getUserID()})),t.next=29,this.TSignalingClient.inviteGroup({groupID:this.data.groupID,userIDList:r,type:this.data.invitation.type,roomID:this.data.roomID,timeout:this.data.callTimeout,inCallUserIDs:[].concat(C(this.data.unHandledInviteeList),C(l)),initialCallId:this.getInitialCallId()});case 29:if(u=t.sent,YE.log("inviteUser res",u),0!==u.code){t.next=38;break}return this.addUnHandledInviteeList(r),this.addInviterInviteId(u.inviteID,[this.data.config.userID].concat(C(r))),h={eventType:Rg.INVITE_USER,callType:Rg.GROUP,mediaType:this._callType,inviteeList:r},this._callRecordUpload(h),this._callRecordReport.startHeartbeat(),t.abrupt("return",u);case 38:t.next=44;break;case 40:throw t.prev=40,t.t0=t.catch(25),this._logger.error("".concat(db,".inviteUser.fail"),{text:{error:t.t0},type:"api"}),new Error("".concat(db,".inviteUser failed, userId:").concat(this.getUserID(),", inviteeIdList:").concat(r,", error: ").concat(t.t0));case 44:case"end":return t.stop()}}),t,this,[[25,40]])}))),function(t){return S.apply(this,arguments)})},{key:"accept",value:(w=c(i().mark((function t(){var e=this;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(db,".accept.start"),{type:"api"}),t.next=3,wC.getInstance().getAlert().check(new mC({api:"accept",initReady:this._initReady,callStatus:this.data.callStatus,sdkAppID:this.data.config.sdkAppID}));case 3:return t.prev=3,t.next=6,FC(this.data.config.type);case 6:t.next=12;break;case 8:return t.prev=8,t.t0=t.catch(3),this._logger.error("".concat(db,".accept.fail"),{text:{error:t.t0},type:"api"}),t.abrupt("return");case 12:return t.abrupt("return",new Promise((function(t,n){if(YE.log(db,"accept() inviteID: ",e.data.invitation.inviteID),e.data.config.type!==dg.VIDEO||e.data.isGroupCall)e.handleAccept(t,n);else if(e.data.devicePermission){wx.createLivePusherContext().stopPreview();var r=setTimeout(c(i().mark((function a(){return i().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:clearTimeout(r),e.handleAccept(t,n);case 2:case"end":return i.stop()}}),a)}))),0)}else e.handleAccept(t,n)})));case 13:case"end":return t.stop()}}),t,this,[[3,8]])}))),function(){return w.apply(this,arguments)})},{key:"handleAccept",value:(R=c(i().mark((function t(e,n){var r,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(db,".handleAccept.start"),{type:"api"}),this._callDataReport.setEnterRoomTime((new Date).getTime()),this.enterRoom({roomID:this.data.invitation.roomID,callType:this.data.config.type}),r=this.data.invitation.inviteID,t.next=6,this.modifyInvitation(r);case 6:return t.next=8,this.TSignalingClient.accept({inviteID:r,type:this.data.config.type});case 8:if(0!==(a=t.sent).code){t.next=22;break}return YE.log(db,"accept OK"),t.next=13,this.setSelfIMCallStatus(og.CONNECTED);case 13:this.addHandledInviteeList([this.getUserID()]),this.deleteUnHandledInviteeList([this.getUserID()]),this.addAcceptedUserList(r,[this.getUserID()]),this._callRecordUpload({eventType:Rg.ACCEPT_CALL}),e({message:a.data.message,pusher:this.data.pusher}),this.changeCallStatus(og.CONNECTED),this.getCallRecordReport().setBodyStatus(og.CONNECTED),t.next=27;break;case 22:this.isGroupCall()&&(this._callDataReport.setCodeAndMessage(Ey.NOT_MEDIA_ACCESS,JSON.stringify(a.data.message)),this._callDataReport.uploadToKibana()),this._logger.error("".concat(db,".accept.fail"),{text:{error:a},type:"api"}),YE.error(db,"accept failed",a),n(a),this._resetTUICallEngine();case 27:case"end":return t.stop()}}),t,this)}))),function(t,e){return R.apply(this,arguments)})},{key:"reject",value:(D=c(i().mark((function t(){var e,n,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(db,".reject.start"),{text:{data:{invitation:this.data.invitation,type:this.data.config.type}},type:"api"}),t.next=3,wC.getInstance().getAlert().checkSync(new mC({api:"reject",callStatus:this.data.callStatus,initReady:this._initReady}));case 3:if(!(e=this.data.invitation.inviteID)){t.next=17;break}return t.next=7,this.modifyInvitation(e);case 7:return t.next=9,this.TSignalingClient.reject({inviteID:e,type:this.data.config.type});case 9:return n=t.sent,YE.log(db,"reject OK",n),a=this.generateEventData(),this.TRTCCallingDelegate.onCancel(r(r({inviteID:e,invitee:this.getUserID(),userID:this.getUserID()},a),{},{reason:Rg.REJECT})),this._callRecordUpload({eventType:Rg.REJECT_CALL}),t.next=16,this._resetTUICallEngine();case 16:return t.abrupt("return",n);case 17:return this._logger.error("".concat(db,".reject.fail"),{text:{error:"未收到邀请,无法拒绝"},type:"api"}),YE.warn("".concat(db," 未收到邀请,无法拒绝")),t.abrupt("return","未收到邀请,无法拒绝");case 20:case"end":return t.stop()}}),t,this)}))),function(){return D.apply(this,arguments)})},{key:"hangup",value:(b=c(i().mark((function t(){var e,n,a,o,s,c,l,u,h,f,d,p,v,g,y,I,m,_,E=this;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(db,".hangup.start"),{text:{data:{isGroupCall:this.isGroupCall(),isInviter:this.isInviter(),currentUserID:this.getUserID(),totalTime:this.generateCallTotalTime(),callType:this.getCallType()}},type:"api"}),t.next=3,wC.getInstance().getAlert().checkSync(new mC({api:"hangup",callStatus:this.data.callStatus,initReady:this._initReady}));case 3:if(YE.warn("".concat(db,". - callStatus:").concat(this.data.callStatus," _inviterInviteID:").concat(JSON.stringify(this.data.invitation))),this.data.callStatus!==og.IDLE){t.next=7;break}throw this._logger.error("".concat(db,".hangup.fail"),{text:{data:{currentStatus:this.data.callStatus},error:"hangup failed. current status:"},type:"api"}),new Error("".concat(db,".hangup failed. current status:").concat(this.data.callStatus));case 7:if(this.data.callStatus!==og.CALLING||0!==this.getInviterInviteIdList().length){t.next=10;break}throw this._logger.error("".concat(db,".hangup.fail"),{text:{error:"call/groupCall incomplete。please wait cancel"},type:"api"}),new Error("".concat(db,".call/groupCall incomplete。please wait cancel"));case 10:if(e=this.isGroupCall(),n=this.isInviter(),a=this.getUserID(),o=this.generateCallTotalTime(),s=this.getCallType(),l=this.getInviterInviteIdList(),this.data.callStatus!==og.CONNECTED){t.next=31;break}if(t.prev=17,0!==l.length){t.next=23;break}return u=this.generateCallEndData({callMediaType:s,totalTime:o}),this.TRTCCallingDelegate.onCallEnd(u),t.next=23,this._resetTUICallEngine();case 23:t.next=31;break;case 25:return t.prev=25,t.t0=t.catch(17),t.next=29,this._resetTUICallEngine();case 29:throw this._logger.error("".concat(db,".hangup.fail"),{text:{error:t.t0},type:"api"}),new Error(t.t0);case 31:if(h=this.getHandledInviteeList(),f=this.getUnHandledInviteeList(),d=this.generateEventData(),t.prev=34,e){t.next=53;break}if(p=this.generateCallEndData(),!n){t.next=48;break}if(1!==f.length){t.next=45;break}return t.next=41,this.cancel();case 41:c=t.sent,this.TRTCCallingDelegate.onCancel(r(r({inviteID:this.data.invitation.inviteID,invitee:a,userID:a},d),{},{reason:Rg.NORMAL})),t.next=46;break;case 45:this.TRTCCallingDelegate.onCallEnd(p);case 46:t.next=49;break;case 48:this.TRTCCallingDelegate.onCallEnd(p);case 49:return t.next=51,this._resetTUICallEngine();case 51:t.next=82;break;case 53:if(v=this.getCallStatus(),g={callType:this.getCallType(),isGroupCall:this.isGroupCall(),groupID:this.data.groupID,userIDList:[].concat(C(h.filter((function(t){return t!==a}))),C(f)),callEnd:this.generateCallTotalTime()},!n){t.next=73;break}if(v!==og.CALLING){t.next=63;break}return t.next=59,this.cancel(this.getInviterInviteIdList());case 59:return c=t.sent,this.TRTCCallingDelegate.onCancel(r(r({inviteID:this.data.invitation.inviteID,invitee:a,userID:a},d),{},{reason:Rg.NORMAL})),t.next=63,this._resetTUICallEngine();case 63:if(v!==og.CONNECTED){t.next=71;break}y=i().mark((function t(){var e,n,r,o,s,u,d;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=l[I],n=E.getInviterInviteIdUserList(e),!((r=E.getAcceptedUserList(e)).length>0)){t.next=22;break}if(o=r.filter((function(t){return-1!==h.indexOf(t)})),s=n.filter((function(t){return-1!==f.indexOf(t)})),g.userIDList=[].concat(C(o),C(s)).filter((function(t){return t!==a})),YE.warn("inviter emit hangup signal, notify userIDList:".concat(JSON.stringify(g.userIDList))),0===g.userIDList.length){t.next=13;break}return t.next=10,E.TSignalingClient.hangup(g);case 10:c=t.sent,t.next=18;break;case 13:if(!(h.length>1)){t.next=18;break}return g.userIDList=h.filter((function(t){return t!==a})),t.next=17,E.TSignalingClient.hangup(g);case 17:c=t.sent;case 18:u=E.generateCallEndData(),E.TRTCCallingDelegate.onCallEnd(u),t.next=29;break;case 22:if(d=E.getUnHandledInviteeList(),!(n.filter((function(t){return-1!==d.indexOf(t)})).length>0)){t.next=29;break}return YE.warn("inviter emit cancel signal, userIdList:".concat(n)),t.next=28,E.cancel([e]);case 28:c=t.sent;case 29:case"end":return t.stop()}}),t)})),I=0;case 66:if(!(I<l.length)){t.next=71;break}return t.delegateYield(y(),"t1",68);case 68:I++,t.next=66;break;case 71:t.next=80;break;case 73:m=i().mark((function t(){var e,n,r,o,s,u,d;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=l[_],n=E.getInviterInviteIdUserList(e),!((r=E.getAcceptedUserList(e)).length>0)){t.next=22;break}if(o=r.filter((function(t){return-1!==h.indexOf(t)})),s=n.filter((function(t){return-1!==f.indexOf(t)})),g.userIDList=[].concat(C(o),C(s)).filter((function(t){return t!==a})),YE.warn("invitee emit hangup signal, notify userIDList:".concat(JSON.stringify(g.userIDList))),0===g.userIDList.length){t.next=13;break}return t.next=10,E.TSignalingClient.hangup(g);case 10:c=t.sent,t.next=18;break;case 13:if(!(h.length>1)){t.next=18;break}return g.userIDList=h.filter((function(t){return t!==a})),t.next=17,E.TSignalingClient.hangup(g);case 17:c=t.sent;case 18:u=E.generateCallEndData(),E.TRTCCallingDelegate.onCallEnd(u),t.next=29;break;case 22:if(d=E.getUnHandledInviteeList(),!(n.filter((function(t){return-1!==d.indexOf(t)})).length>0)){t.next=29;break}return YE.warn("invitee emit cancel signal, inviteID:".concat(e)),t.next=28,E.cancel([e]);case 28:c=t.sent;case 29:case"end":return t.stop()}}),t)})),_=0;case 75:if(!(_<l.length)){t.next=80;break}return t.delegateYield(m(),"t2",77);case 77:_++,t.next=75;break;case 80:return t.next=82,this._resetTUICallEngine();case 82:return t.abrupt("return",c);case 85:throw t.prev=85,t.t3=t.catch(34),this._logger.error("".concat(db,".hangup.fail"),{text:{error:t.t3},type:"api"}),YE.warn("".concat(db,".hangup failed, error: ").concat(t.t3)),new Error("".concat(db,".hangup failed, error: ").concat(t.t3));case 90:case"end":return t.stop()}}),t,this,[[17,25],[34,85]])}))),function(){return b.apply(this,arguments)})},{key:"cancel",value:(T=c(i().mark((function t(e){var n,r,a,o,s;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(db,".cancel.start"),{text:{data:{inviteIDList:e}},type:"api"}),YE.log("_cancel _inviterInviteID",this.data_inviterInviteID),n=[],t.prev=3,0===(e||[]).length&&(e=this.getInviterInviteIdList().slice(0,1)),t.next=7,this.modifyInvitation(e[0]);case 7:r=0;case 8:if(!(r<e.length)){t.next=17;break}return a=e[r],t.next=12,this.TSignalingClient.cancel({inviteID:a,callType:this.data.invitation.type});case 12:o=t.sent,n.push(o);case 14:r++,t.next=8;break;case 17:t.next=23;break;case 19:throw t.prev=19,t.t0=t.catch(3),this._logger.error("".concat(db,".cancel.fail"),{text:{error:t.t0},type:"api"}),new Error("".concat(db,"._cancel failed, error: ").concat(t.t0));case 23:return s="cancel ".concat(JSON.stringify(n)," succeeded"),YE.log("".concat(db,"._cancel ").concat(s)),t.abrupt("return",n);case 26:case"end":return t.stop()}}),t,this,[[3,19]])}))),function(t){return T.apply(this,arguments)})},{key:"getRoomID",value:function(){return this.data.invitation.roomID}},{key:"getCallType",value:function(){return this.data.invitation.type}},{key:"getGroupID",value:function(){return this.data.groupID}},{key:"isGroupCall",value:function(){return this.data.isGroupCall}},{key:"getUserID",value:function(){return this.data.config.userID}},{key:"isInviter",value:function(){return this.data.isInviter}},{key:"getHandledInviteeList",value:function(){return this.data.handledInviteeList||[]}},{key:"getCallDataReport",value:function(){return this._callDataReport}},{key:"getCallRecordReport",value:function(){return this._callRecordReport}},{key:"getUnHandledInviteeList",value:function(){return this.data.unHandledInviteeList||[]}},{key:"getCallStatus",value:function(){return this.data.callStatus}},{key:"setInitialInviteData",value:function(t){this._initialInviteData=t}},{key:"modifyInvitation",value:(E=c(i().mark((function t(e){var n;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.isGroupCall()){t.next=2;break}return t.abrupt("return");case 2:return n=r(r({},this._initialInviteData),{},{consumed:!0}),t.prev=3,t.next=6,this._chat.modifyInvitation({inviteID:e,data:JSON.stringify(n)});case 6:t.next=11;break;case 8:t.prev=8,t.t0=t.catch(3),YE.error("".concat(db," modifyInvitation fail ").concat(t.t0));case 11:case"end":return t.stop()}}),t,this,[[3,8]])}))),function(t){return E.apply(this,arguments)})},{key:"getInviterInviteID",value:function(t){return this.data._inviterInviteID[t]||[]}},{key:"addAcceptedUserList",value:function(t,e){var n=this;if(0!==e.length)if(t)0===(this.data._acceptedUserObject[t]||[]).length?this.data._acceptedUserObject[t]=e:e.forEach((function(e){-1===n.data._acceptedUserObject[t].indexOf(e)&&n.data._acceptedUserObject[t].push(e)}));else for(var r=this.getInviterInviteIdList(),i=function(){var t=r[a],i=n.getInviterInviteIdUserList(t),o=e.filter((function(t){return-1!==i.indexOf(t)}));0===(n._acceptedUserObject[t]||[]).length?n.data._acceptedUserObject[t]=o:o.forEach((function(e){-1===n.data._acceptedUserObject[t].indexOf(e)&&n.data._acceptedUserObject[t].push(e)}))},a=0;a<r.length;a++)i()}},{key:"getAcceptedUserList",value:function(t){return this.data._acceptedUserObject[t]||[]}},{key:"getInviterInviteIdList",value:function(){return Object.keys(this.data._inviterInviteID||{})}},{key:"getTotalInviterInviteIdList",value:function(){var t=this.getInviterInviteIdList();return[].concat(C(this.data._audioVideoSwitchIdList),C(t))}},{key:"getInviterInviteIdUserList",value:function(t){var e=this,n=[];return t?n=this.data._inviterInviteID[t]||[]:this.getInviterInviteIdList().forEach((function(t){n=[].concat(C(n),C(e.getInviterInviteIdUserList(t)))})),n}},{key:"addAudioVideoSwitchIdList",value:function(t){t&&this.data._audioVideoSwitchIdList.push(t)}},{key:"getAudioVideoSwitchIdList",value:function(){return this.data._audioVideoSwitchIdList||[]}},{key:"addUnHandledInviteeList",value:function(t){var e=this;0!==t.length&&(t.forEach((function(t){-1===e.data.unHandledInviteeList.indexOf(t)&&e.data.unHandledInviteeList.push(t)})),this.data.unHandledInviteeList=Array.from(new Set(this.data.unHandledInviteeList)))}},{key:"deleteUnHandledInviteeList",value:function(t){var e=this;0!==t.length&&t.forEach((function(t){e.data.unHandledInviteeList=e.data.unHandledInviteeList.filter((function(e){return e!==t}))}))}},{key:"addHandledInviteeList",value:function(t){var e=this;0!==t.length&&(t.forEach((function(t){-1===e.data.handledInviteeList.indexOf(t)&&e.data.handledInviteeList.push(t)})),this.data.handledInviteeList=Array.from(new Set(this.data.handledInviteeList)))}},{key:"deleteHandledInviteeList",value:function(t){var e=this;0!==t.length&&t.forEach((function(t){e.data.handledInviteeList=e.data.handledInviteeList.filter((function(e){return e!==t}))}))}},{key:"getSwitchCallModeStatus",value:function(){return this.data.switchCallModeStatus}},{key:"changeCallStatus",value:function(t){var e=this;switch(this._logger.info("".concat(db,".changeCallStatus.start"),{text:{data:{status:t}},type:"api"}),YE.log("进入callStatus",t),this.data.callStatus=t,t){case og.CONNECTED:if(this.data.timer)return;this.data.timer=setInterval((function(){var t,n,r,i,a,o;e.data.chatTime=(t=e.data.chatTimeNum,(o=t)>=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 og.IDLE:clearInterval(this.data.timer),this.data.timer=null,this.data.chatTime="00:00:00",this.data.chatTimeNum=0}}},{key:"_resetTUICallEngine",value:(_=c(i().mark((function t(e,n){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.getCallStatus()===og.IDLE){t.next=5;break}if(this.data.callStatus=og.IDLE,!this.getIsLogin()){t.next=5;break}return t.next=5,this.setSelfIMCallStatus(og.IDLE);case 5:if(this._logger.info("".concat(db,"._resetTUICallEngine.start"),{text:{data:{callEnd:e,type:n}},type:"api"}),this.changeCallStatus(og.IDLE),YE.log(db," _resetTUICallEngine()",this.data.enterRoomStatus),!this.data.enterRoomStatus){t.next=11;break}return t.next=11,this.exitRoom(e,n);case 11:this.data.config.type=dg.AUDIO,this._initialCallId="",this.initData();case 14:case"end":return t.stop()}}),t,this)}))),function(t,e){return _.apply(this,arguments)})},{key:"startRemoteView",value:(m=c(i().mark((function t(e){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this._logger.info("".concat(db,".startRemoteView.start"),{text:{data:{userID:e}},type:"api"}),this.data.playerList.forEach((function(t){if(t.userID===e)return t.muteVideo=!1,void YE.log("".concat(db,", startRemoteView(").concat(e,")"))}));case 2:case"end":return t.stop()}}),t,this)}))),function(t){return m.apply(this,arguments)})},{key:"stopRemoteView",value:function(t){this._logger.info("".concat(db,".stopRemoteView.start"),{text:{data:{userID:t}},type:"api"}),this.data.playerList.forEach((function(e){if(e.userID===t)return e.muteVideo=!0,void YE.log("".concat(db,", stopRemoteView(").concat(t,")"))}))}},{key:"openCamera",value:function(){this._logger.info("".concat(db,".openCamera.start"),{text:{data:{enableCamera:this.data.pusher.enableCamera}},type:"api"}),wC.getInstance().getAlert().checkSync(new mC({api:"openCamera",callStatus:this.data.callStatus,initReady:this._initReady})),this.data.pusher.enableCamera||this._pusherVideoHandler(),YE.log("".concat(db,", openCamera() pusher: ").concat(this.data.pusher))}},{key:"closeCamera",value:function(){this._logger.info("".concat(db,".closeCamera.start"),{text:{data:{enableCamera:this.data.pusher.enableCamera}},type:"api"}),wC.getInstance().getAlert().checkSync(new mC({api:"closeCamera",callStatus:this.data.callStatus,initReady:this._initReady})),this.data.pusher.enableCamera&&this._pusherVideoHandler(),YE.log("".concat(db,", closeCamera() pusher: ").concat(this.data.pusher))}},{key:"switchCamera",value:function(){this._logger.info("".concat(db,".switchCamera.start"),{text:{data:{frontCamera:this.data.pusher.frontCamera}},type:"api"}),wC.getInstance().getAlert().checkSync(new mC({api:"switchCamera",callStatus:this.data.callStatus,initReady:this._initReady})),this.getCurrentPusherInstance().switchCamera(),YE.log("".concat(db,", switchCamera(), frontCamera").concat(this.data.pusher.frontCamera))}},{key:"openMicrophone",value:function(){this._logger.info("".concat(db,".openMicrophone.start"),{text:{data:{enableMic:this.data.pusher.enableMic}},type:"api"}),wC.getInstance().getAlert().checkSync(new mC({api:"openMicrophone",callStatus:this.data.callStatus,initReady:this._initReady})),this.data.pusher.enableMic||this._pusherAudioHandler(),YE.log("".concat(db,", openMicrophone() pusher: ").concat(this.data.pusher))}},{key:"closeMicrophone",value:function(){this._logger.info("".concat(db,".closeMicrophone.start"),{text:{data:{enableMic:this.data.pusher.enableMic}},type:"api"}),wC.getInstance().getAlert().checkSync(new mC({api:"closeMicrophone",callStatus:this.data.callStatus,initReady:this._initReady})),this.data.pusher.enableMic&&this._pusherAudioHandler(),YE.log("".concat(db,", closeMicrophone() pusher: ").concat(this.data.pusher))}},{key:"selectAudioPlaybackDevice",value:function(t){this._logger.info("".concat(db,".selectAudioPlaybackDevice.start"),{text:{data:{type:t}},type:"api"}),wC.getInstance().getAlert().checkSync(new mC({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",YE.log("".concat(db,", setHandsFree() result: ").concat(this.data.soundMode)),this.data.soundMode}},{key:"switchAudioCall",value:(I=c(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("".concat(db,".switchAudioCall.start"),{type:"api"}),!this.isGroupCall()){t.next=5;break}return this._logger.error("".concat(db,".switchAudioCall.fail"),{text:{error:"switchToAudioCall is not applicable to groupCall"},type:"api"}),YE.warn("".concat(db,".switchToAudioCall is not applicable to groupCall.")),t.abrupt("return");case 5:if(this.data.invitation.type!==dg.AUDIO){t.next=9;break}return this._logger.error("".concat(db,".switchAudioCall.fail"),{text:{error:"the call mode is audio call"},type:"api"}),YE.warn("".concat(db," Now the call mode is audio call.")),t.abrupt("return");case 9:if(this.data.switchCallModeStatus){t.next=13;break}return this._logger.error("".concat(db,".switchAudioCall.fail"),{text:{error:"audio and video call switching"},type:"api"}),YE.warn("".concat(db," audio and video call switching.")),t.abrupt("return");case 13: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:Eg}));case 16:case"end":return t.stop()}}),t,this)}))),function(){return I.apply(this,arguments)})},{key:"switchCallMediaType",value:(y=c(i().mark((function t(e){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(db,".closeMicrophone.start"),{text:{data:{type:e}},type:"api"}),t.next=3,wC.getInstance().getAlert().check(new mC({api:"switchCallMediaType",attributes:{type:e},callStatus:this.data.callStatus,initReady:this._initReady,sdkAppID:this.data.config.sdkAppID}));case 3:if(!this.isGroupCall()){t.next=7;break}throw this._logger.error("".concat(db,".switchAudioCall.fail"),{text:{error:"switchToAudioCall is not applicable to groupCall"},type:"api"}),YE.error("".concat(db,".switchToAudioCall is not applicable to groupCall.")),new ky(Ey.ERROR_SCENE_NOT_SUPPORTED,"".concat(db,".switchToAudioCall is not applicable to groupCall."));case 7:if(this.data.switchCallModeStatus){t.next=11;break}return this._logger.error("".concat(db,".switchAudioCall.fail"),{text:{error:"audio and video call switching"},type:"api"}),YE.warn("".concat(db," audio and video call switching.")),t.abrupt("return");case 11:t.t0=e,t.next=t.t0===dg.AUDIO?14:t.t0===dg.VIDEO?17:20;break;case 14: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:Eg}));case 17:throw this._logger.error("".concat(db,".switchAudioCall.fail"),{text:{error:"Audio switching Video is not supported yet"},type:"api"}),YE.warn("".concat(db," Audio switching Video is not supported yet")),new Error("".concat(db," Audio switching Video is not supported yet"));case 20:case"end":return t.stop()}}),t,this)}))),function(t){return y.apply(this,arguments)})},{key:"setSwitchCallModeStatus",value:function(t){this.data.switchCallModeStatus=t}},{key:"switchVideoCall",value:(g=c(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("".concat(db,".switchVideoCall.start"),{type:"api"}),!this.isGroupCall()){t.next=5;break}return this._logger.error("".concat(db,".switchAudioCall.fail"),{text:{error:"switchToAudioCall is not applicable to groupCall"},type:"api"}),YE.warn("".concat(db,".switchToVideoCall is not applicable to groupCall.")),t.abrupt("return");case 5:if(this.data.invitation.type!==dg.VIDEO){t.next=9;break}return this._logger.error("".concat(db,".switchAudioCall.fail"),{text:{error:"Now the call mode is video call"},type:"api"}),YE.warn("".concat(db," Now the call mode is video call.")),t.abrupt("return");case 9:if(this.data.switchCallModeStatus){t.next=13;break}return this._logger.error("".concat(db,".switchAudioCall.fail"),{text:{error:"audio and video call switching"},type:"api"}),YE.warn("".concat(db," audio and video call switching.")),t.abrupt("return");case 13: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:Tg}));case 16:case"end":return t.stop()}}),t,this)}))),function(){return g.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:"getCurrentPusherInstance",value:function(){return this.TRTC.getPusherInstance().context=wx.createLivePusherContext(),this.TRTC.getPusherInstance()}},{key:"_pusherStateChangeHandler",value:function(t){this.TRTC.pusherEventHandler(t)}},{key:"_playerStateChange",value:function(t){this._emitter.emit(ag.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._chat.getUserProfile({userIDList:t}).then((function(t){YE.log("getUserProfile success",t),YE.log(t.data),e.data.remoteUsers=t.data})).catch((function(t){YE.warn("getUserProfile error:",t)}))}},{key:"getUserProfile",value:(v=c(i().mark((function t(e){var n,r,a,o,s=arguments;return i().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._chat.getUserProfile({userIDList:r});case 6:a=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=a.data[e].avatar,t.nick=a.data[e].nick,t})),t.abrupt("break",16);case 13:return o={},e.forEach((function(t,e){t.avatar=a.data[e].avatar,t.nick=a.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 v.apply(this,arguments)})},{key:"setSelfInfo",value:function(t,e){return this._logger.info("".concat(db,".setSelfInfo.start"),{text:{data:{nickName:t,avatar:e}},type:"api"}),wC.getInstance().getAlert().checkSync(new mC({api:"setSelfInfo",attributes:{nickName:t,avatar:e},initReady:this._initReady})),this._chat.updateMyProfile({nick:t,avatar:e})}},{key:"deviceCheck",value:(p=c(i().mark((function t(e){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",GE(e));case 1:case"end":return t.stop()}}),t)}))),function(t){return p.apply(this,arguments)})},{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 YE.log("get screen",e,t),1===this.data.playerList.length&&e!==this.data.screen&&this.data.invitation.type===dg.VIDEO&&(this.data.screen=e),this.data.screen}},{key:"getTim",value:function(){return this._chat}},{key:"destroyed",value:(d=c(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("".concat(db,".destroyed.start"),{type:"api"}),this.getCallStatus()===og.IDLE){t.next=4;break}return t.next=4,this.handleExceptionExit();case 4:if(this._resetTUICallEngine(),this._removeTSignalingEvent(),this._removeTRTCEvent(),this._timExternal){t.next=10;break}return t.next=10,this.logout();case 10:this._initReady=!1;case 11:case"end":return t.stop()}}),t,this)}))),function(){return d.apply(this,arguments)})},{key:"handleExceptionExit",value:(u=c(i().mark((function t(){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._logger.info("".concat(db,".handleExceptionExit.start"),{text:{data:{callStatus:this.getCallStatus()}},type:"api"}),t.prev=1,this.getCallStatus()!==og.CALLING){t.next=10;break}if(!this.isInviter()){t.next=8;break}return t.next=6,this.hangup();case 6:t.next=10;break;case 8:return t.next=10,this.reject();case 10:if(this.getCallStatus()!==og.CONNECTED){t.next=13;break}return t.next=13,this.hangup();case 13:t.next=18;break;case 15:t.prev=15,t.t0=t.catch(1),this._logger.error("".concat(db,".handleExceptionExit.fail"),{text:{data:{error:t.t0}},type:"api"});case 18:case"end":return t.stop()}}),t,this,[[1,15]])}))),function(){return u.apply(this,arguments)})},{key:"_callRecordUpload",value:function(t){var e=r(r({},t),{},{callRole:this.isInviter()?Rg.INVITER:Rg.INVITEE,userID:this.getUserID(),roomID:this.getRoomID(),inviteID:this.getInitialCallId()});this._callRecordReport.eventUpload(e)}},{key:"generateCallEndData",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.roomId,n=t.callMediaType,r=t.callRole,i=t.totalTime,a=t.userId;return e=e||this.getRoomID(),n=n||this.getCallType(),r||(r=this.isInviter()?vg:gg),{roomID:e,callMediaType:n,callRole:r,totalTime:i=AE(i)?this.generateCallTotalTime():i,userID:a=a||this.getUserID(),callEnd:i,message:t.message||""}}},{key:"generateEventData",value:function(){return{callID:this.getInviterInviteIdList()[0],roomID:this.getRoomID(),callRole:this.isInviter()?Rg.INVITER:Rg.INVITEE,callMediaType:this.getCallType()}}},{key:"enableMultiDeviceAbility",value:(s=c(i().mark((function t(e){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._logger.info("".concat(db,".enableMultiDeviceAbility.start"),{text:{data:{enable:e}},type:"api"}),t.next=3,wC.getInstance().getAlert().check(new mC({api:"enableMultiDeviceAbility",attributes:{enable:e},initReady:this._initReady,capabilityCode:bg.PRO,sdkAppID:this.data.config.sdkAppID}),{tim:this._chat});case 3:this.setIsEnableMultiDeviceAbility(e);case 4:case"end":return t.stop()}}),t,this)}))),function(t){return s.apply(this,arguments)})},{key:"setInitialCallId",value:function(t){this._initialCallId=t}},{key:"getInitialCallId",value:function(){return this._initialCallId}},{key:"getConnectStartTime",value:function(){return this.data.startTalkTime}},{key:"getIsLogin",value:function(){return this._initReady}},{key:"setIsEnableMultiDeviceAbility",value:function(t){this._isEnableMultiDeviceAbility=!!t}},{key:"getIsEnableMultiDeviceAbility",value:function(){return this._isEnableMultiDeviceAbility}},{key:"generateCallTotalTime",value:function(){return 0===this.getConnectStartTime()?0:Math.round((Date.now()-this.getConnectStartTime())/1e3)}},{key:"setSelfIMCallStatus",value:(o=c(i().mark((function t(e){var n,r,a;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=this.getIsEnableMultiDeviceAbility(),this._logger.info("".concat(db,".setSelfIMCallStatus.start"),{text:{data:{callStatus:e,isEnableMultiDeviceAbility:n}},type:"api"}),n){t.next=4;break}return t.abrupt("return");case 4:if(this._chat&&e&&this.getIsLogin()){t.next=6;break}return t.abrupt("return");case 6:r=Lg,t.prev=7,t.t0=e,t.next=t.t0===og.CALLING?11:t.t0===og.CONNECTED?13:15;break;case 11:return r=kg,t.abrupt("break",15);case 13:return r=Og,t.abrupt("break",15);case 15:return t.next=17,null===(a=this._chat)||void 0===a?void 0:a.setSelfStatus({customStatus:r});case 17:t.next=22;break;case 19:t.prev=19,t.t1=t.catch(7),this._logger.error("".concat(db,".setSelfIMCallStatus.fail"),{text:{error:t.t1},type:"api"});case 22:case"end":return t.stop()}}),t,this,[[7,19]])}))),function(t){return o.apply(this,arguments)})},{key:"getSelfIMCallStatus",value:(a=c(i().mark((function t(){var e,n,r,a,o,s,c,l,u=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=u.length>0&&void 0!==u[0]?u[0]:[],n=og.IDLE,this.getIsEnableMultiDeviceAbility()){t.next=4;break}return t.abrupt("return",n);case 4:if(t.prev=4,this._logger.info("".concat(db,".getSelfIMCallStatus.start"),{text:{data:e},type:"api"}),this._chat&&0!==e.length&&this.getIsLogin()){t.next=8;break}return t.abrupt("return",n);case 8:return t.next=10,null===(r=this._chat)||void 0===r?void 0:r.getUserStatus({userIDList:e});case 10:if(0!==(a=t.sent).code){t.next=21;break}o=a.data||{},s=o.successUserList,c=(void 0===s?[]:s)[0]||{},l=c.customStatus,t.t0=l,t.next=t.t0===kg?17:t.t0===Og?19:21;break;case 17:return n=og.CALLING,t.abrupt("break",21);case 19:return n=og.CONNECTED,t.abrupt("break",21);case 21:t.next=26;break;case 23:t.prev=23,t.t1=t.catch(4),this._logger.error("".concat(db,".getSelfIMCallStatus.fail"),{text:{error:t.t1},type:"api"});case 26:return t.abrupt("return",n);case 27:case"end":return t.stop()}}),t,this,[[4,23]])}))),function(){return a.apply(this,arguments)})}],[{key:"createInstance",value:function(t){return pb.updateEsConfig({url:"".concat("https://webim.tim.qq.com/v4/imopenstat/tweb_trtccalling_report","?sdkappid=").concat(null==t?void 0:t.sdkAppID),table:"timweb-trtccalling"}),wC.getInstance().getAlert().checkSync(new mC({api:"createInstance",attributes:t})),n.instance||(n.instance=new n(t)),n.instance.initData(),n.instance}}]),n}();f(vb,"instance",null),f(vb,"AUDIO_PLAYBACK_DEVICE",Cg),f(vb,"MEDIA_TYPE",dg),f(vb,"EVENT",ag),f(vb,"STATUS",og);export{Cg as AUDIO_PLAYBACK_DEVICE,ag as EVENT,dg as MEDIA_TYPE,og as STATUS,vb as TUICallEngine,vb as default};
|