2023-03-06 17:57:39 +08:00

2 lines
176 KiB
JavaScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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