omnirtc-web 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es-omnirtc-web.js +37 -0
- package/dist/omnirtc-web.js +37 -0
- package/package.json +57 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
function e(e){this.message=e}e.prototype=new Error,e.prototype.name="InvalidCharacterError";var t="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(t){var r=String(t).replace(/=+$/,"");if(r.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,i,o=0,a=0,s="";i=r.charAt(a++);~i&&(n=o%4?64*n+i:i,o++%4)?s+=String.fromCharCode(255&n>>(-2*o&6)):0)i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(i);return s};var r=function(e){var r=e.replace(/-/g,"+").replace(/_/g,"/");switch(r.length%4){case 0:break;case 2:r+="==";break;case 3:r+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(t(e).replace(/(.)/g,(function(e,t){var r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r})))}(r)}catch(e){return t(r)}};function n(e){this.message=e}n.prototype=new Error,n.prototype.name="InvalidTokenError";var i=function(e,t){if("string"!=typeof e)throw new n("Invalid token specified");var i=!0===(t=t||{}).header?0:1;try{return JSON.parse(r(e.split(".")[i]))}catch(e){throw new n("Invalid token specified: "+e.message)}};i.InvalidTokenError=n;var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function s(e,t,r){return e(r={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&r.path)}},r.exports),r.exports}var c=s((function(e){var t,r,n=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(e){t=i}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var s,c=[],u=!1,d=-1;function l(){u&&s&&(u=!1,s.length?c=s.concat(c):d=-1,c.length&&p())}function p(){if(!u){var e=a(l);u=!0;for(var t=c.length;t;){for(s=c,c=[];++d<t;)s&&s[d].run();d=-1,t=c.length}s=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function h(){}n.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];c.push(new f(e,t)),1!==c.length||u||a(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=h,n.addListener=h,n.once=h,n.off=h,n.removeListener=h,n.removeAllListeners=h,n.emit=h,n.prependListener=h,n.prependOnceListener=h,n.listeners=function(e){return[]},n.binding=function(e){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(e){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}})),u=s((function(e){function t(r){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})),d=a(u),l=s((function(e){e.exports=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e},e.exports.__esModule=!0,e.exports.default=e.exports})),p=s((function(e){function t(){return"undefined"!=typeof Reflect&&Reflect.get?(e.exports=t=Reflect.get,e.exports.__esModule=!0,e.exports.default=e.exports):(e.exports=t=function(e,t,r){var n=l(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},e.exports.__esModule=!0,e.exports.default=e.exports),t.apply(this,arguments)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})),f=a(p),h=s((function(e){e.exports=function(e){if(Array.isArray(e))return e},e.exports.__esModule=!0,e.exports.default=e.exports})),A=s((function(e){e.exports=function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(e){s=!0,i=e}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}},e.exports.__esModule=!0,e.exports.default=e.exports})),v=s((function(e){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n},e.exports.__esModule=!0,e.exports.default=e.exports})),g=s((function(e){e.exports=function(e,t){if(e){if("string"==typeof e)return v(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?v(e,t):void 0}},e.exports.__esModule=!0,e.exports.default=e.exports})),m=s((function(e){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.__esModule=!0,e.exports.default=e.exports})),E=a(s((function(e){e.exports=function(e,t){return h(e)||A(e,t)||g(e,t)||m()},e.exports.__esModule=!0,e.exports.default=e.exports}))),_=s((function(e){function t(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}e.exports=function(e){return function(){var r=this,n=arguments;return new Promise((function(i,o){var a=e.apply(r,n);function s(e){t(a,i,o,s,c,"next",e)}function c(e){t(a,i,o,s,c,"throw",e)}s(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports})),y=a(_),I=s((function(e){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports})),S=a(I),b=s((function(e){function t(r,n){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r,n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})),C=s((function(e){e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")},e.exports.__esModule=!0,e.exports.default=e.exports})),w=s((function(e){e.exports=function(){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(e){return!1}},e.exports.__esModule=!0,e.exports.default=e.exports})),R=s((function(e){function t(r,n,i){return w()?(e.exports=t=Reflect.construct,e.exports.__esModule=!0,e.exports.default=e.exports):(e.exports=t=function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&b(i,r.prototype),i},e.exports.__esModule=!0,e.exports.default=e.exports),t.apply(null,arguments)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})),T=a(s((function(e){function t(r){var n="function"==typeof Map?new Map:void 0;return e.exports=t=function(e){if(null===e||!C(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return R(e,arguments,u(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),b(t,e)},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}))),k=a(s((function(e){e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&b(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports}))),O=s((function(e){function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})),D=a(O),N=s((function(e){var t=O.default;e.exports=function(e,r){if(r&&("object"===t(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return I(e)},e.exports.__esModule=!0,e.exports.default=e.exports})),x=a(N),P=s((function(e){e.exports=function(e){if(Array.isArray(e))return v(e)},e.exports.__esModule=!0,e.exports.default=e.exports})),L=s((function(e){e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.__esModule=!0,e.exports.default=e.exports})),B=s((function(e){e.exports=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.")},e.exports.__esModule=!0,e.exports.default=e.exports})),M=a(s((function(e){e.exports=function(e){return P(e)||L(e)||g(e)||B()},e.exports.__esModule=!0,e.exports.default=e.exports}))),U=a(s((function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports}))),Q=s((function(e){function t(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports})),F=a(Q),j=a(s((function(e){e.exports=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},e.exports.__esModule=!0,e.exports.default=e.exports}))),V=s((function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i=t&&t.prototype instanceof v?t:v,o=Object.create(i.prototype),a=new T(n||[]);return o._invoke=function(e,t,r){var n=l;return function(i,o){if(n===f)throw new Error("Generator is already running");if(n===h){if("throw"===i)throw o;return O()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=C(a,r);if(s){if(s===A)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=f;var c=d(e,t,r);if("normal"===c.type){if(n=r.done?h:p,c.arg===A)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=h,r.method="throw",r.arg=c.arg)}}}(e,r,a),o}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l="suspendedStart",p="suspendedYield",f="executing",h="completed",A={};function v(){}function g(){}function m(){}var E={};c(E,o,(function(){return this}));var _=Object.getPrototypeOf,y=_&&_(_(k([])));y&&y!==r&&n.call(y,o)&&(E=y);var I=m.prototype=v.prototype=Object.create(E);function S(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function r(i,o,a,s){var c=d(e[i],e,o);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"===D(l)&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,a,s)}),(function(e){r("throw",e,a,s)})):t.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return r("throw",e,a,s)}))}s(c.arg)}var i;this._invoke=function(e,n){function o(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(o,o):o()}}function C(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,C(e,r),"throw"===r.method))return A;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return A}var i=d(n,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,A;var o=i.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,A):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,A)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function k(e){if(e){var r=e[o];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:O}}function O(){return{value:t,done:!0}}return g.prototype=m,c(I,"constructor",m),c(m,"constructor",g),g.displayName=c(m,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,c(e,s,"GeneratorFunction")),e.prototype=Object.create(I),e},e.awrap=function(e){return{__await:e}},S(b.prototype),c(b.prototype,a,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new b(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},S(I),c(I,s,"Generator"),c(I,o,(function(){return this})),c(I,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=k,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(R),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function i(n,i){return s.type="throw",s.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){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 o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,A):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),A},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),R(r),A}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;R(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:k(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),A}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"===("undefined"==typeof globalThis?"undefined":D(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}})),G=V;function K(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return H(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return H(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){throw e})),f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e){s=!0,o=e})),f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function H(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function W(e){var t=function(){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(e){return!1}}();return function(){var r,n=d(e);if(t){var i=d(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return x(this,r)}}var Y=s((function(e,t){e.exports=function(){var e,t,r,n,i,a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==o?o:"undefined"!=typeof self?self:{},s=function(e){return e&&e.Math==Math&&e},u=s("object"==("undefined"==typeof globalThis?"undefined":D(globalThis))&&globalThis)||s("object"==("undefined"==typeof window?"undefined":D(window))&&window)||s("object"==("undefined"==typeof self?"undefined":D(self))&&self)||s("object"==D(a)&&a)||function(){return this}()||Function("return this")(),l={},p=function(e){try{return!!e()}catch(e){return!0}},h=!p((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),A=!p((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),v=A,g=Function.prototype.call,m=v?g.bind(g):function(){return g.apply(g,arguments)},_={},I={}.propertyIsEnumerable,b=Object.getOwnPropertyDescriptor,C=b&&!I.call({1:2},1);_.f=C?function(e){var t=b(this,e);return!!t&&t.enumerable}:I;var w,R,O=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},N=A,P=Function.prototype,L=P.bind,B=P.call,Q=N&&L.bind(B,B),V=N?function(e){return e&&Q(e)}:function(e){return e&&function(){return B.apply(e,arguments)}},H=V,Y=H({}.toString),q=H("".slice),J=function(e){return q(Y(e),8,-1)},z=V,X=p,Z=J,$=u.Object,ee=z("".split),te=X((function(){return!$("z").propertyIsEnumerable(0)}))?function(e){return"String"==Z(e)?ee(e,""):$(e)}:$,re=u.TypeError,ne=function(e){if(null==e)throw re("Can't call method on "+e);return e},ie=te,oe=ne,ae=function(e){return ie(oe(e))},se=function(e){return"function"==typeof e},ce=se,ue=function(e){return"object"==D(e)?null!==e:ce(e)},de=u,le=se,pe=function(e){return le(e)?e:void 0},fe=function(e,t){return arguments.length<2?pe(de[e]):de[e]&&de[e][t]},he=V({}.isPrototypeOf),Ae=fe("navigator","userAgent")||"",ve=u,ge=Ae,me=ve.process,Ee=ve.Deno,_e=me&&me.versions||Ee&&Ee.version,ye=_e&&_e.v8;ye&&(R=(w=ye.split("."))[0]>0&&w[0]<4?1:+(w[0]+w[1])),!R&&ge&&(!(w=ge.match(/Edge\/(\d+)/))||w[1]>=74)&&(w=ge.match(/Chrome\/(\d+)/))&&(R=+w[1]);var Ie=R,Se=Ie,be=p,Ce=!!Object.getOwnPropertySymbols&&!be((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Se&&Se<41})),we=Ce&&!Symbol.sham&&"symbol"==D(Symbol.iterator),Re=fe,Te=se,ke=he,Oe=we,De=u.Object,Ne=Oe?function(e){return"symbol"==D(e)}:function(e){var t=Re("Symbol");return Te(t)&&ke(t.prototype,De(e))},xe=u.String,Pe=function(e){try{return xe(e)}catch(e){return"Object"}},Le=se,Be=Pe,Me=u.TypeError,Ue=function(e){if(Le(e))return e;throw Me(Be(e)+" is not a function")},Qe=Ue,Fe=function(e,t){var r=e[t];return null==r?void 0:Qe(r)},je=m,Ve=se,Ge=ue,Ke=u.TypeError,He={exports:{}},We=u,Ye=Object.defineProperty,qe=function(e,t){try{Ye(We,e,{value:t,configurable:!0,writable:!0})}catch(r){We[e]=t}return t},Je=qe,ze="__core-js_shared__",Xe=u[ze]||Je(ze,{}),Ze=Xe;(He.exports=function(e,t){return Ze[e]||(Ze[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.20.3",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.20.3/LICENSE",source:"https://github.com/zloirock/core-js"});var $e=ne,et=u.Object,tt=function(e){return et($e(e))},rt=tt,nt=V({}.hasOwnProperty),it=Object.hasOwn||function(e,t){return nt(rt(e),t)},ot=V,at=0,st=Math.random(),ct=ot(1..toString),ut=function(e){return"Symbol("+(void 0===e?"":e)+")_"+ct(++at+st,36)},dt=u,lt=He.exports,pt=it,ft=ut,ht=Ce,At=we,vt=lt("wks"),gt=dt.Symbol,mt=gt&>.for,Et=At?gt:gt&>.withoutSetter||ft,_t=function(e){if(!pt(vt,e)||!ht&&"string"!=typeof vt[e]){var t="Symbol."+e;ht&&pt(gt,e)?vt[e]=gt[e]:vt[e]=At&&mt?mt(t):Et(t)}return vt[e]},yt=m,It=ue,St=Ne,bt=Fe,Ct=function(e,t){var r,n;if("string"===t&&Ve(r=e.toString)&&!Ge(n=je(r,e)))return n;if(Ve(r=e.valueOf)&&!Ge(n=je(r,e)))return n;if("string"!==t&&Ve(r=e.toString)&&!Ge(n=je(r,e)))return n;throw Ke("Can't convert object to primitive value")},wt=_t,Rt=u.TypeError,Tt=wt("toPrimitive"),kt=function(e,t){if(!It(e)||St(e))return e;var r,n=bt(e,Tt);if(n){if(void 0===t&&(t="default"),r=yt(n,e,t),!It(r)||St(r))return r;throw Rt("Can't convert object to primitive value")}return void 0===t&&(t="number"),Ct(e,t)},Ot=Ne,Dt=function(e){var t=kt(e,"string");return Ot(t)?t:t+""},Nt=ue,xt=u.document,Pt=Nt(xt)&&Nt(xt.createElement),Lt=function(e){return Pt?xt.createElement(e):{}},Bt=Lt,Mt=!h&&!p((function(){return 7!=Object.defineProperty(Bt("div"),"a",{get:function(){return 7}}).a})),Ut=h,Qt=m,Ft=_,jt=O,Vt=ae,Gt=Dt,Kt=it,Ht=Mt,Wt=Object.getOwnPropertyDescriptor;l.f=Ut?Wt:function(e,t){if(e=Vt(e),t=Gt(t),Ht)try{return Wt(e,t)}catch(e){}if(Kt(e,t))return jt(!Qt(Ft.f,e,t),e[t])};var Yt={},qt=h&&p((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Jt=u,zt=ue,Xt=Jt.String,Zt=Jt.TypeError,$t=function(e){if(zt(e))return e;throw Zt(Xt(e)+" is not an object")},er=h,tr=Mt,rr=qt,nr=$t,ir=Dt,or=u.TypeError,ar=Object.defineProperty,sr=Object.getOwnPropertyDescriptor,cr="enumerable",ur="configurable",dr="writable";Yt.f=er?rr?function(e,t,r){if(nr(e),t=ir(t),nr(r),"function"==typeof e&&"prototype"===t&&"value"in r&&dr in r&&!r.writable){var n=sr(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:ur in r?r.configurable:n.configurable,enumerable:cr in r?r.enumerable:n.enumerable,writable:!1})}return ar(e,t,r)}:ar:function(e,t,r){if(nr(e),t=ir(t),nr(r),tr)try{return ar(e,t,r)}catch(e){}if("get"in r||"set"in r)throw or("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var lr=Yt,pr=O,fr=h?function(e,t,r){return lr.f(e,t,pr(1,r))}:function(e,t,r){return e[t]=r,e},hr={exports:{}},Ar=se,vr=Xe,gr=V(Function.toString);Ar(vr.inspectSource)||(vr.inspectSource=function(e){return gr(e)});var mr,Er,_r,yr=vr.inspectSource,Ir=se,Sr=yr,br=u.WeakMap,Cr=Ir(br)&&/native code/.test(Sr(br)),wr=He.exports,Rr=ut,Tr=wr("keys"),kr=function(e){return Tr[e]||(Tr[e]=Rr(e))},Or={},Dr=Cr,Nr=u,xr=V,Pr=ue,Lr=fr,Br=it,Mr=Xe,Ur=kr,Qr=Or,Fr="Object already initialized",jr=Nr.TypeError,Vr=Nr.WeakMap;if(Dr||Mr.state){var Gr=Mr.state||(Mr.state=new Vr),Kr=xr(Gr.get),Hr=xr(Gr.has),Wr=xr(Gr.set);mr=function(e,t){if(Hr(Gr,e))throw new jr(Fr);return t.facade=e,Wr(Gr,e,t),t},Er=function(e){return Kr(Gr,e)||{}},_r=function(e){return Hr(Gr,e)}}else{var Yr=Ur("state");Qr[Yr]=!0,mr=function(e,t){if(Br(e,Yr))throw new jr(Fr);return t.facade=e,Lr(e,Yr,t),t},Er=function(e){return Br(e,Yr)?e[Yr]:{}},_r=function(e){return Br(e,Yr)}}var qr={set:mr,get:Er,has:_r,enforce:function(e){return _r(e)?Er(e):mr(e,{})},getterFor:function(e){return function(t){var r;if(!Pr(t)||(r=Er(t)).type!==e)throw jr("Incompatible receiver, "+e+" required");return r}}},Jr=h,zr=it,Xr=Function.prototype,Zr=Jr&&Object.getOwnPropertyDescriptor,$r=zr(Xr,"name"),en={EXISTS:$r,PROPER:$r&&"something"===function(){}.name,CONFIGURABLE:$r&&(!Jr||Jr&&Zr(Xr,"name").configurable)},tn=u,rn=se,nn=it,on=fr,an=qe,sn=yr,cn=en.CONFIGURABLE,un=qr.get,dn=qr.enforce,ln=String(String).split("String");(hr.exports=function(e,t,r,n){var i,o=!!n&&!!n.unsafe,a=!!n&&!!n.enumerable,s=!!n&&!!n.noTargetGet,c=n&&void 0!==n.name?n.name:t;rn(r)&&("Symbol("===String(c).slice(0,7)&&(c="["+String(c).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!nn(r,"name")||cn&&r.name!==c)&&on(r,"name",c),(i=dn(r)).source||(i.source=ln.join("string"==typeof c?c:""))),e!==tn?(o?!s&&e[t]&&(a=!0):delete e[t],a?e[t]=r:on(e,t,r)):a?e[t]=r:an(t,r)})(Function.prototype,"toString",(function(){return rn(this)&&un(this).source||sn(this)}));var pn={},fn=Math.ceil,hn=Math.floor,An=function(e){var t=+e;return t!=t||0===t?0:(t>0?hn:fn)(t)},vn=An,gn=Math.max,mn=Math.min,En=function(e,t){var r=vn(e);return r<0?gn(r+t,0):mn(r,t)},_n=An,yn=Math.min,In=function(e){return e>0?yn(_n(e),9007199254740991):0},Sn=In,bn=function(e){return Sn(e.length)},Cn=ae,wn=En,Rn=bn,Tn=function(e){return function(t,r,n){var i,o=Cn(t),a=Rn(o),s=wn(n,a);if(e&&r!=r){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},kn={includes:Tn(!0),indexOf:Tn(!1)},On=it,Dn=ae,Nn=kn.indexOf,xn=Or,Pn=V([].push),Ln=function(e,t){var r,n=Dn(e),i=0,o=[];for(r in n)!On(xn,r)&&On(n,r)&&Pn(o,r);for(;t.length>i;)On(n,r=t[i++])&&(~Nn(o,r)||Pn(o,r));return o},Bn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Mn=Ln,Un=Bn.concat("length","prototype");pn.f=Object.getOwnPropertyNames||function(e){return Mn(e,Un)};var Qn={};Qn.f=Object.getOwnPropertySymbols;var Fn=fe,jn=pn,Vn=Qn,Gn=$t,Kn=V([].concat),Hn=Fn("Reflect","ownKeys")||function(e){var t=jn.f(Gn(e)),r=Vn.f;return r?Kn(t,r(e)):t},Wn=it,Yn=Hn,qn=l,Jn=Yt,zn=function(e,t,r){for(var n=Yn(t),i=Jn.f,o=qn.f,a=0;a<n.length;a++){var s=n[a];Wn(e,s)||r&&Wn(r,s)||i(e,s,o(t,s))}},Xn=p,Zn=se,$n=/#|\.prototype\./,ei=function(e,t){var r=ri[ti(e)];return r==ii||r!=ni&&(Zn(t)?Xn(t):!!t)},ti=ei.normalize=function(e){return String(e).replace($n,".").toLowerCase()},ri=ei.data={},ni=ei.NATIVE="N",ii=ei.POLYFILL="P",oi=ei,ai=u,si=l.f,ci=fr,ui=hr.exports,di=qe,li=zn,pi=oi,fi=function(e,t){var r,n,i,o,a,s=e.target,c=e.global,u=e.stat;if(r=c?ai:u?ai[s]||di(s,{}):(ai[s]||{}).prototype)for(n in t){if(o=t[n],i=e.noTargetGet?(a=si(r,n))&&a.value:r[n],!pi(c?n:s+(u?".":"#")+n,e.forced)&&void 0!==i){if(D(o)==D(i))continue;li(o,i)}(e.sham||i&&i.sham)&&ci(o,"sham",!0),ui(r,n,o,e)}},hi=u.Promise,Ai=hr.exports,vi=function(e,t,r){for(var n in t)Ai(e,n,t[n],r);return e},gi=u,mi=se,Ei=gi.String,_i=gi.TypeError,yi=V,Ii=$t,Si=function(e){if("object"==D(e)||mi(e))return e;throw _i("Can't set "+Ei(e)+" as a prototype")},bi=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=yi(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return Ii(r),Si(n),t?e(r,n):r.__proto__=n,r}}():void 0),Ci=Yt.f,wi=it,Ri=_t("toStringTag"),Ti=function(e,t,r){e&&!r&&(e=e.prototype),e&&!wi(e,Ri)&&Ci(e,Ri,{configurable:!0,value:t})},ki=fe,Oi=Yt,Di=h,Ni=_t("species"),xi=function(e){var t=ki(e),r=Oi.f;Di&&t&&!t[Ni]&&r(t,Ni,{configurable:!0,get:function(){return this}})},Pi=he,Li=u.TypeError,Bi=function(e,t){if(Pi(t,e))return e;throw Li("Incorrect invocation")},Mi=Ue,Ui=A,Qi=V(V.bind),Fi=function(e,t){return Mi(e),void 0===t?e:Ui?Qi(e,t):function(){return e.apply(t,arguments)}},ji={},Vi=ji,Gi=_t("iterator"),Ki=Array.prototype,Hi=function(e){return void 0!==e&&(Vi.Array===e||Ki[Gi]===e)},Wi={};Wi[_t("toStringTag")]="z";var Yi=u,qi="[object z]"===String(Wi),Ji=se,zi=J,Xi=_t("toStringTag"),Zi=Yi.Object,$i="Arguments"==zi(function(){return arguments}()),eo=qi?zi:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=Zi(e),Xi))?r:$i?zi(t):"Object"==(n=zi(t))&&Ji(t.callee)?"Arguments":n},to=eo,ro=Fe,no=ji,io=_t("iterator"),oo=function(e){if(null!=e)return ro(e,io)||ro(e,"@@iterator")||no[to(e)]},ao=m,so=Ue,co=$t,uo=Pe,lo=oo,po=u.TypeError,fo=function(e,t){var r=arguments.length<2?lo(e):t;if(so(r))return co(ao(r,e));throw po(uo(e)+" is not iterable")},ho=m,Ao=$t,vo=Fe,go=Fi,mo=m,Eo=$t,_o=Pe,yo=Hi,Io=bn,So=he,bo=fo,Co=oo,wo=function(e,t,r){var n,i;Ao(e);try{if(!(n=vo(e,"return"))){if("throw"===t)throw r;return r}n=ho(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return Ao(n),r},Ro=u.TypeError,To=function(e,t){this.stopped=e,this.result=t},ko=To.prototype,Oo=_t("iterator"),Do=!1;try{var No=0,xo={next:function(){return{done:!!No++}},return:function(){Do=!0}};xo[Oo]=function(){return this},Array.from(xo,(function(){throw 2}))}catch(a){}var Po=function(e,t){if(!t&&!Do)return!1;var r=!1;try{var n={};n[Oo]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},Lo=V,Bo=p,Mo=se,Uo=eo,Qo=yr,Fo=function(){},jo=[],Vo=fe("Reflect","construct"),Go=/^\s*(?:class|function)\b/,Ko=Lo(Go.exec),Ho=!Go.exec(Fo),Wo=function(e){if(!Mo(e))return!1;try{return Vo(Fo,jo,e),!0}catch(e){return!1}},Yo=function(e){if(!Mo(e))return!1;switch(Uo(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ho||!!Ko(Go,Qo(e))}catch(e){return!0}};Yo.sham=!0;var qo,Jo,zo,Xo,Zo=!Vo||Bo((function(){var e;return Wo(Wo.call)||!Wo(Object)||!Wo((function(){e=!0}))||e}))?Yo:Wo,$o=Zo,ea=Pe,ta=u.TypeError,ra=function(e){if($o(e))return e;throw ta(ea(e)+" is not a constructor")},na=$t,ia=ra,oa=_t("species"),aa=function(e,t){var r,n=na(e).constructor;return void 0===n||null==(r=na(n)[oa])?t:ia(r)},sa=A,ca=Function.prototype,ua=ca.apply,da=ca.call,la="object"==("undefined"==typeof Reflect?"undefined":D(Reflect))&&Reflect.apply||(sa?da.bind(ua):function(){return da.apply(ua,arguments)}),pa=fe("document","documentElement"),fa=V([].slice),ha=/(?:ipad|iphone|ipod).*applewebkit/i.test(Ae),Aa="process"==J(u.process),va=u,ga=la,ma=Fi,Ea=se,_a=it,ya=p,Ia=pa,Sa=fa,ba=Lt,Ca=ha,wa=Aa,Ra=va.setImmediate,Ta=va.clearImmediate,ka=va.process,Oa=va.Dispatch,Da=va.Function,Na=va.MessageChannel,xa=va.String,Pa=0,La={},Ba="onreadystatechange";try{qo=va.location}catch(a){}var Ma=function(e){if(_a(La,e)){var t=La[e];delete La[e],t()}},Ua=function(e){return function(){Ma(e)}},Qa=function(e){Ma(e.data)},Fa=function(e){va.postMessage(xa(e),qo.protocol+"//"+qo.host)};Ra&&Ta||(Ra=function(e){var t=Sa(arguments,1);return La[++Pa]=function(){ga(Ea(e)?e:Da(e),void 0,t)},Jo(Pa),Pa},Ta=function(e){delete La[e]},wa?Jo=function(e){ka.nextTick(Ua(e))}:Oa&&Oa.now?Jo=function(e){Oa.now(Ua(e))}:Na&&!Ca?(Xo=(zo=new Na).port2,zo.port1.onmessage=Qa,Jo=ma(Xo.postMessage,Xo)):va.addEventListener&&Ea(va.postMessage)&&!va.importScripts&&qo&&"file:"!==qo.protocol&&!ya(Fa)?(Jo=Fa,va.addEventListener("message",Qa,!1)):Jo=Ba in ba("script")?function(e){Ia.appendChild(ba("script")).onreadystatechange=function(){Ia.removeChild(this),Ma(e)}}:function(e){setTimeout(Ua(e),0)});var ja,Va,Ga,Ka,Ha,Wa,Ya,qa,Ja={set:Ra,clear:Ta},za=u,Xa=/ipad|iphone|ipod/i.test(Ae)&&void 0!==za.Pebble,Za=/web0s(?!.*chrome)/i.test(Ae),$a=u,es=Fi,ts=l.f,rs=Ja.set,ns=ha,is=Xa,os=Za,as=Aa,ss=$a.MutationObserver||$a.WebKitMutationObserver,cs=$a.document,us=$a.process,ds=$a.Promise,ls=ts($a,"queueMicrotask"),ps=ls&&ls.value;ps||(ja=function(){var e,t;for(as&&(e=us.domain)&&e.exit();Va;){t=Va.fn,Va=Va.next;try{t()}catch(e){throw Va?Ka():Ga=void 0,e}}Ga=void 0,e&&e.enter()},ns||as||os||!ss||!cs?!is&&ds&&ds.resolve?((Ya=ds.resolve(void 0)).constructor=ds,qa=es(Ya.then,Ya),Ka=function(){qa(ja)}):as?Ka=function(){us.nextTick(ja)}:(rs=es(rs,$a),Ka=function(){rs(ja)}):(Ha=!0,Wa=cs.createTextNode(""),new ss(ja).observe(Wa,{characterData:!0}),Ka=function(){Wa.data=Ha=!Ha}));var fs=ps||function(e){var t={fn:e,next:void 0};Ga&&(Ga.next=t),Va||(Va=t,Ka()),Ga=t},hs={},As=Ue,vs=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n})),this.resolve=As(t),this.reject=As(r)};hs.f=function(e){return new vs(e)};var gs=$t,ms=ue,Es=hs,_s=function(e,t){if(gs(e),ms(t)&&t.constructor===e)return t;var r=Es.f(e);return(0,r.resolve)(t),r.promise},ys=u,Is=function(){this.head=null,this.tail=null};Is.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var Ss,bs,Cs,ws,Rs=Is,Ts="object"==("undefined"==typeof window?"undefined":D(window)),ks=fi,Os=u,Ds=fe,Ns=m,xs=hi,Ps=hr.exports,Ls=vi,Bs=bi,Ms=Ti,Us=xi,Qs=Ue,Fs=se,js=ue,Vs=Bi,Gs=yr,Ks=function(e,t,r){var n,i,o,a,s,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),p=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),h=go(t,d),A=function(e){return n&&wo(n,"normal",e),new To(!0,e)},v=function(e){return l?(Eo(e),f?h(e[0],e[1],A):h(e[0],e[1])):f?h(e,A):h(e)};if(p)n=e;else{if(!(i=Co(e)))throw Ro(_o(e)+" is not iterable");if(yo(i)){for(o=0,a=Io(e);a>o;o++)if((s=v(e[o]))&&So(ko,s))return s;return new To(!1)}n=bo(e,i)}for(c=n.next;!(u=mo(c,n)).done;){try{s=v(u.value)}catch(e){wo(n,"throw",e)}if("object"==D(s)&&s&&So(ko,s))return s}return new To(!1)},Hs=Po,Ws=aa,Ys=Ja.set,qs=fs,Js=_s,zs=function(e,t){var r=ys.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},Xs=hs,Zs=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},$s=Rs,ec=qr,tc=oi,rc=Ts,nc=Aa,ic=Ie,oc=_t("species"),ac="Promise",sc=ec.getterFor(ac),cc=ec.set,uc=ec.getterFor(ac),dc=xs&&xs.prototype,lc=xs,pc=dc,fc=Os.TypeError,hc=Os.document,Ac=Os.process,vc=Xs.f,gc=vc,mc=!!(hc&&hc.createEvent&&Os.dispatchEvent),Ec=Fs(Os.PromiseRejectionEvent),_c="unhandledrejection",yc=!1,Ic=tc(ac,(function(){var e=Gs(lc),t=e!==String(lc);if(!t&&66===ic)return!0;if(ic>=51&&/native code/.test(e))return!1;var r=new lc((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};return(r.constructor={})[oc]=n,!(yc=r.then((function(){}))instanceof n)||!t&&rc&&!Ec})),Sc=Ic||!Hs((function(e){lc.all(e).catch((function(){}))})),bc=function(e){var t;return!(!js(e)||!Fs(t=e.then))&&t},Cc=function(e,t){var r,n,i,o=t.value,a=1==t.state,s=a?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&Oc(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?u(fc("Promise-chain cycle")):(n=bc(r))?Ns(n,r,c,u):c(r)):u(o)}catch(e){d&&!i&&d.exit(),u(e)}},wc=function(e,t){e.notified||(e.notified=!0,qs((function(){for(var r,n=e.reactions;r=n.get();)Cc(r,e);e.notified=!1,t&&!e.rejection&&Tc(e)})))},Rc=function(e,t,r){var n,i;mc?((n=hc.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),Os.dispatchEvent(n)):n={promise:t,reason:r},!Ec&&(i=Os["on"+e])?i(n):e===_c&&zs("Unhandled promise rejection",r)},Tc=function(e){Ns(Ys,Os,(function(){var t,r=e.facade,n=e.value;if(kc(e)&&(t=Zs((function(){nc?Ac.emit("unhandledRejection",n,r):Rc(_c,r,n)})),e.rejection=nc||kc(e)?2:1,t.error))throw t.value}))},kc=function(e){return 1!==e.rejection&&!e.parent},Oc=function(e){Ns(Ys,Os,(function(){var t=e.facade;nc?Ac.emit("rejectionHandled",t):Rc("rejectionhandled",t,e.value)}))},Dc=function(e,t,r){return function(n){e(t,n,r)}},Nc=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,wc(e,!0))},xc=function e(t,r,n){if(!t.done){t.done=!0,n&&(t=n);try{if(t.facade===r)throw fc("Promise can't be resolved itself");var i=bc(r);i?qs((function(){var n={done:!1};try{Ns(i,r,Dc(e,n,t),Dc(Nc,n,t))}catch(e){Nc(n,e,t)}})):(t.value=r,t.state=1,wc(t,!1))}catch(r){Nc({done:!1},r,t)}}};if(Ic&&(pc=(lc=function(e){Vs(this,pc),Qs(e),Ns(Ss,this);var t=sc(this);try{e(Dc(xc,t),Dc(Nc,t))}catch(e){Nc(t,e)}}).prototype,(Ss=function(e){cc(this,{type:ac,done:!1,notified:!1,parent:!1,reactions:new $s,rejection:!1,state:0,value:void 0})}).prototype=Ls(pc,{then:function(e,t){var r=uc(this),n=vc(Ws(this,lc));return r.parent=!0,n.ok=!Fs(e)||e,n.fail=Fs(t)&&t,n.domain=nc?Ac.domain:void 0,0==r.state?r.reactions.add(n):qs((function(){Cc(n,r)})),n.promise},catch:function(e){return this.then(void 0,e)}}),bs=function(){var e=new Ss,t=sc(e);this.promise=e,this.resolve=Dc(xc,t),this.reject=Dc(Nc,t)},Xs.f=vc=function(e){return e===lc||e===Cs?new bs(e):gc(e)},Fs(xs)&&dc!==Object.prototype)){ws=dc.then,yc||(Ps(dc,"then",(function(e,t){var r=this;return new lc((function(e,t){Ns(ws,r,e,t)})).then(e,t)}),{unsafe:!0}),Ps(dc,"catch",pc.catch,{unsafe:!0}));try{delete dc.constructor}catch(a){}Bs&&Bs(dc,pc)}ks({global:!0,wrap:!0,forced:Ic},{Promise:lc}),Ms(lc,ac,!1),Us(ac),Cs=Ds(ac),ks({target:ac,stat:!0,forced:Ic},{reject:function(e){var t=vc(this);return Ns(t.reject,void 0,e),t.promise}}),ks({target:ac,stat:!0,forced:Ic},{resolve:function(e){return Js(this,e)}}),ks({target:ac,stat:!0,forced:Sc},{all:function(e){var t=this,r=vc(t),n=r.resolve,i=r.reject,o=Zs((function(){var r=Qs(t.resolve),o=[],a=0,s=1;Ks(e,(function(e){var c=a++,u=!1;s++,Ns(r,t,e).then((function(e){u||(u=!0,o[c]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise},race:function(e){var t=this,r=vc(t),n=r.reject,i=Zs((function(){var i=Qs(t.resolve);Ks(e,(function(e){Ns(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var Pc=fi,Lc=fe,Bc=la,Mc=V,Uc=p,Qc=u.Array,Fc=Lc("JSON","stringify"),jc=Mc(/./.exec),Vc=Mc("".charAt),Gc=Mc("".charCodeAt),Kc=Mc("".replace),Hc=Mc(1..toString),Wc=/[\uD800-\uDFFF]/g,Yc=/^[\uD800-\uDBFF]$/,qc=/^[\uDC00-\uDFFF]$/,Jc=function(e,t,r){var n=Vc(r,t-1),i=Vc(r,t+1);return jc(Yc,e)&&!jc(qc,i)||jc(qc,e)&&!jc(Yc,n)?"\\u"+Hc(Gc(e,0),16):e},zc=Uc((function(){return'"\\udf06\\ud834"'!==Fc("\udf06\ud834")||'"\\udead"'!==Fc("\udead")}));Fc&&Pc({target:"JSON",stat:!0,forced:zc},{stringify:function(e,t,r){for(var n=0,i=arguments.length,o=Qc(i);n<i;n++)o[n]=arguments[n];var a=Bc(Fc,null,o);return"string"==typeof a?Kc(a,Wc,Jc):a}});var Xc=function(e){try{return!!e()}catch(e){return!0}},Zc=!Xc((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),$c=Zc,eu=Function.prototype,tu=eu.bind,ru=eu.call,nu=$c&&tu.bind(ru,ru),iu=$c?function(e){return e&&nu(e)}:function(e){return e&&function(){return ru.apply(e,arguments)}},ou=iu({}.isPrototypeOf),au=function(e){return e&&e.Math==Math&&e},su=au("object"==("undefined"==typeof globalThis?"undefined":D(globalThis))&&globalThis)||au("object"==("undefined"==typeof window?"undefined":D(window))&&window)||au("object"==("undefined"==typeof self?"undefined":D(self))&&self)||au("object"==D(a)&&a)||function(){return this}()||Function("return this")(),cu=Zc,uu=Function.prototype,du=uu.apply,lu=uu.call,pu="object"==("undefined"==typeof Reflect?"undefined":D(Reflect))&&Reflect.apply||(cu?lu.bind(du):function(){return lu.apply(du,arguments)}),fu=function(e){return"function"==typeof e},hu={},Au=!Xc((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),vu=Zc,gu=Function.prototype.call,mu=vu?gu.bind(gu):function(){return gu.apply(gu,arguments)},Eu={},_u={}.propertyIsEnumerable,yu=Object.getOwnPropertyDescriptor,Iu=yu&&!_u.call({1:2},1);Eu.f=Iu?function(e){var t=yu(this,e);return!!t&&t.enumerable}:_u;var Su,bu,Cu=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},wu=iu,Ru=wu({}.toString),Tu=wu("".slice),ku=function(e){return Tu(Ru(e),8,-1)},Ou=iu,Du=Xc,Nu=ku,xu=su.Object,Pu=Ou("".split),Lu=Du((function(){return!xu("z").propertyIsEnumerable(0)}))?function(e){return"String"==Nu(e)?Pu(e,""):xu(e)}:xu,Bu=su.TypeError,Mu=function(e){if(null==e)throw Bu("Can't call method on "+e);return e},Uu=Lu,Qu=Mu,Fu=function(e){return Uu(Qu(e))},ju=fu,Vu=function(e){return"object"==D(e)?null!==e:ju(e)},Gu={},Ku=Gu,Hu=su,Wu=fu,Yu=function(e){return Wu(e)?e:void 0},qu=function(e,t){return arguments.length<2?Yu(Ku[e])||Yu(Hu[e]):Ku[e]&&Ku[e][t]||Hu[e]&&Hu[e][t]},Ju=qu("navigator","userAgent")||"",zu=su,Xu=Ju,Zu=zu.process,$u=zu.Deno,ed=Zu&&Zu.versions||$u&&$u.version,td=ed&&ed.v8;td&&(bu=(Su=td.split("."))[0]>0&&Su[0]<4?1:+(Su[0]+Su[1])),!bu&&Xu&&(!(Su=Xu.match(/Edge\/(\d+)/))||Su[1]>=74)&&(Su=Xu.match(/Chrome\/(\d+)/))&&(bu=+Su[1]);var rd=bu,nd=rd,id=Xc,od=!!Object.getOwnPropertySymbols&&!id((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&nd&&nd<41})),ad=od&&!Symbol.sham&&"symbol"==D(Symbol.iterator),sd=qu,cd=fu,ud=ou,dd=ad,ld=su.Object,pd=dd?function(e){return"symbol"==D(e)}:function(e){var t=sd("Symbol");return cd(t)&&ud(t.prototype,ld(e))},fd=su.String,hd=function(e){try{return fd(e)}catch(e){return"Object"}},Ad=fu,vd=hd,gd=su.TypeError,md=function(e){if(Ad(e))return e;throw gd(vd(e)+" is not a function")},Ed=md,_d=function(e,t){var r=e[t];return null==r?void 0:Ed(r)},yd=mu,Id=fu,Sd=Vu,bd=su.TypeError,Cd={exports:{}},wd=su,Rd=Object.defineProperty,Td=function(e,t){try{Rd(wd,e,{value:t,configurable:!0,writable:!0})}catch(r){wd[e]=t}return t},kd="__core-js_shared__",Od=su[kd]||Td(kd,{}),Dd=Od;(Cd.exports=function(e,t){return Dd[e]||(Dd[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.20.3",mode:"pure",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.20.3/LICENSE",source:"https://github.com/zloirock/core-js"});var Nd=Mu,xd=su.Object,Pd=function(e){return xd(Nd(e))},Ld=Pd,Bd=iu({}.hasOwnProperty),Md=Object.hasOwn||function(e,t){return Bd(Ld(e),t)},Ud=iu,Qd=0,Fd=Math.random(),jd=Ud(1..toString),Vd=function(e){return"Symbol("+(void 0===e?"":e)+")_"+jd(++Qd+Fd,36)},Gd=su,Kd=Cd.exports,Hd=Md,Wd=Vd,Yd=od,qd=ad,Jd=Kd("wks"),zd=Gd.Symbol,Xd=zd&&zd.for,Zd=qd?zd:zd&&zd.withoutSetter||Wd,$d=function(e){if(!Hd(Jd,e)||!Yd&&"string"!=typeof Jd[e]){var t="Symbol."+e;Yd&&Hd(zd,e)?Jd[e]=zd[e]:Jd[e]=qd&&Xd?Xd(t):Zd(t)}return Jd[e]},el=mu,tl=Vu,rl=pd,nl=_d,il=function(e,t){var r,n;if("string"===t&&Id(r=e.toString)&&!Sd(n=yd(r,e)))return n;if(Id(r=e.valueOf)&&!Sd(n=yd(r,e)))return n;if("string"!==t&&Id(r=e.toString)&&!Sd(n=yd(r,e)))return n;throw bd("Can't convert object to primitive value")},ol=$d,al=su.TypeError,sl=ol("toPrimitive"),cl=function(e,t){if(!tl(e)||rl(e))return e;var r,n=nl(e,sl);if(n){if(void 0===t&&(t="default"),r=el(n,e,t),!tl(r)||rl(r))return r;throw al("Can't convert object to primitive value")}return void 0===t&&(t="number"),il(e,t)},ul=pd,dl=function(e){var t=cl(e,"string");return ul(t)?t:t+""},ll=Vu,pl=su.document,fl=ll(pl)&&ll(pl.createElement),hl=function(e){return fl?pl.createElement(e):{}},Al=hl,vl=!Au&&!Xc((function(){return 7!=Object.defineProperty(Al("div"),"a",{get:function(){return 7}}).a})),gl=Au,ml=mu,El=Eu,_l=Cu,yl=Fu,Il=dl,Sl=Md,bl=vl,Cl=Object.getOwnPropertyDescriptor;hu.f=gl?Cl:function(e,t){if(e=yl(e),t=Il(t),bl)try{return Cl(e,t)}catch(e){}if(Sl(e,t))return _l(!ml(El.f,e,t),e[t])};var wl=Xc,Rl=fu,Tl=/#|\.prototype\./,kl=function(e,t){var r=Dl[Ol(e)];return r==xl||r!=Nl&&(Rl(t)?wl(t):!!t)},Ol=kl.normalize=function(e){return String(e).replace(Tl,".").toLowerCase()},Dl=kl.data={},Nl=kl.NATIVE="N",xl=kl.POLYFILL="P",Pl=kl,Ll=md,Bl=Zc,Ml=iu(iu.bind),Ul=function(e,t){return Ll(e),void 0===t?e:Bl?Ml(e,t):function(){return e.apply(t,arguments)}},Ql={},Fl=Au&&Xc((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),jl=su,Vl=Vu,Gl=jl.String,Kl=jl.TypeError,Hl=function(e){if(Vl(e))return e;throw Kl(Gl(e)+" is not an object")},Wl=Au,Yl=vl,ql=Fl,Jl=Hl,zl=dl,Xl=su.TypeError,Zl=Object.defineProperty,$l=Object.getOwnPropertyDescriptor,ep="enumerable",tp="configurable",rp="writable";Ql.f=Wl?ql?function(e,t,r){if(Jl(e),t=zl(t),Jl(r),"function"==typeof e&&"prototype"===t&&"value"in r&&rp in r&&!r.writable){var n=$l(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:tp in r?r.configurable:n.configurable,enumerable:ep in r?r.enumerable:n.enumerable,writable:!1})}return Zl(e,t,r)}:Zl:function(e,t,r){if(Jl(e),t=zl(t),Jl(r),Yl)try{return Zl(e,t,r)}catch(e){}if("get"in r||"set"in r)throw Xl("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var np=Ql,ip=Cu,op=Au?function(e,t,r){return np.f(e,t,ip(1,r))}:function(e,t,r){return e[t]=r,e},ap=su,sp=pu,cp=iu,up=fu,dp=hu.f,lp=Pl,pp=Gu,fp=Ul,hp=op,Ap=Md,vp=function(e){var t=function t(r,n,i){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,i)}return sp(e,this,arguments)};return t.prototype=e.prototype,t},gp=function(e,t){var r,n,i,o,a,s,c,u,d=e.target,l=e.global,p=e.stat,f=e.proto,h=l?ap:p?ap[d]:(ap[d]||{}).prototype,A=l?pp:pp[d]||hp(pp,d,{})[d],v=A.prototype;for(i in t)r=!lp(l?i:d+(p?".":"#")+i,e.forced)&&h&&Ap(h,i),a=A[i],r&&(s=e.noTargetGet?(u=dp(h,i))&&u.value:h[i]),o=r&&s?s:t[i],r&&D(a)==D(o)||(c=e.bind&&r?fp(o,ap):e.wrap&&r?vp(o):f&&up(o)?cp(o):o,(e.sham||o&&o.sham||a&&a.sham)&&hp(c,"sham",!0),hp(A,i,c),f&&(Ap(pp,n=d+"Prototype")||hp(pp,n,{}),hp(pp[n],i,o),e.real&&v&&!v[i]&&hp(v,i,o)))},mp=Math.ceil,Ep=Math.floor,_p=function(e){var t=+e;return t!=t||0===t?0:(t>0?Ep:mp)(t)},yp=_p,Ip=Math.min,Sp=function(e){return e>0?Ip(yp(e),9007199254740991):0},bp=function(e){return Sp(e.length)},Cp=md,wp=Pd,Rp=Lu,Tp=bp,kp=su.TypeError,Op=function(e){return function(t,r,n,i){Cp(r);var o=wp(t),a=Rp(o),s=Tp(o),c=e?s-1:0,u=e?-1:1;if(n<2)for(;;){if(c in a){i=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw kp("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(i=r(i,a[c],c,o));return i}},Dp={left:Op(!1),right:Op(!0)},Np=Xc,xp=function(e,t){var r=[][e];return!!r&&Np((function(){r.call(null,t||function(){throw 1},1)}))},Pp="process"==ku(su.process),Lp=Dp.left,Bp=rd,Mp=Pp;gp({target:"Array",proto:!0,forced:!xp("reduce")||!Mp&&Bp>79&&Bp<83},{reduce:function(e){var t=arguments.length;return Lp(this,e,t,t>1?arguments[1]:void 0)}});var Up=Gu,Qp=function(e){return Up[e+"Prototype"]},Fp=Qp("Array").reduce,jp=ou,Vp=Fp,Gp=Array.prototype,Kp=function(e){var t=e.reduce;return e===Gp||jp(Gp,e)&&t===Gp.reduce?Vp:t},Hp=Kp,Wp=eo,Yp=u.String,qp=function(e){if("Symbol"===Wp(e))throw TypeError("Cannot convert a Symbol value to a string");return Yp(e)},Jp=$t,zp=function(){var e=Jp(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},Xp=p,Zp=u.RegExp,$p=Xp((function(){var e=Zp("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),ef=$p||Xp((function(){return!Zp("a","y").sticky})),tf={BROKEN_CARET:$p||Xp((function(){var e=Zp("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:ef,UNSUPPORTED_Y:$p},rf={},nf=Ln,of=Bn,af=Object.keys||function(e){return nf(e,of)},sf=h,cf=qt,uf=Yt,df=$t,lf=ae,pf=af;rf.f=sf&&!cf?Object.defineProperties:function(e,t){df(e);for(var r,n=lf(t),i=pf(t),o=i.length,a=0;o>a;)uf.f(e,r=i[a++],n[r]);return e};var ff,hf=$t,Af=rf,vf=Bn,gf=Or,mf=pa,Ef=Lt,_f=kr("IE_PROTO"),yf=function(){},If=function(e){return"<script>"+e+"<\/script>"},Sf=function(e){e.write(If("")),e.close();var t=e.parentWindow.Object;return e=null,t},bf=function(){try{ff=new ActiveXObject("htmlfile")}catch(e){}var e,t;bf="undefined"!=typeof document?document.domain&&ff?Sf(ff):((t=Ef("iframe")).style.display="none",mf.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(If("document.F=Object")),e.close(),e.F):Sf(ff);for(var r=vf.length;r--;)delete bf.prototype[vf[r]];return bf()};gf[_f]=!0;var Cf=Object.create||function(e,t){var r;return null!==e?(yf.prototype=hf(e),r=new yf,yf.prototype=null,r[_f]=e):r=bf(),void 0===t?r:Af.f(r,t)},wf=p,Rf=u.RegExp,Tf=wf((function(){var e=Rf(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),kf=p,Of=u.RegExp,Df=kf((function(){var e=Of("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Nf=m,xf=V,Pf=qp,Lf=zp,Bf=tf,Mf=He.exports,Uf=Cf,Qf=qr.get,Ff=Tf,jf=Df,Vf=Mf("native-string-replace",String.prototype.replace),Gf=RegExp.prototype.exec,Kf=Gf,Hf=xf("".charAt),Wf=xf("".indexOf),Yf=xf("".replace),qf=xf("".slice),Jf=function(){var e=/a/,t=/b*/g;return Nf(Gf,e,"a"),Nf(Gf,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),zf=Bf.BROKEN_CARET,Xf=void 0!==/()??/.exec("")[1];(Jf||Xf||zf||Ff||jf)&&(Kf=function(e){var t,r,n,i,o,a,s,c=this,u=Qf(c),d=Pf(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=Nf(Kf,l,d),c.lastIndex=l.lastIndex,t;var p=u.groups,f=zf&&c.sticky,h=Nf(Lf,c),A=c.source,v=0,g=d;if(f&&(h=Yf(h,"y",""),-1===Wf(h,"g")&&(h+="g"),g=qf(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Hf(d,c.lastIndex-1))&&(A="(?: "+A+")",g=" "+g,v++),r=new RegExp("^(?:"+A+")",h)),Xf&&(r=new RegExp("^"+A+"$(?!\\s)",h)),Jf&&(n=c.lastIndex),i=Nf(Gf,f?r:c,g),f?i?(i.input=qf(i.input,v),i[0]=qf(i[0],v),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:Jf&&i&&(c.lastIndex=c.global?i.index+i[0].length:n),Xf&&i&&i.length>1&&Nf(Vf,i[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&p)for(i.groups=a=Uf(null),o=0;o<p.length;o++)a[(s=p[o])[0]]=i[s[1]];return i});var Zf=Kf;fi({target:"RegExp",proto:!0,forced:/./.exec!==Zf},{exec:Zf});var $f=Cf,eh=Yt,th=_t("unscopables"),rh=Array.prototype;null==rh[th]&&eh.f(rh,th,{configurable:!0,value:$f(null)});var nh,ih,oh,ah=!p((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),sh=u,ch=it,uh=se,dh=tt,lh=ah,ph=kr("IE_PROTO"),fh=sh.Object,hh=fh.prototype,Ah=lh?fh.getPrototypeOf:function(e){var t=dh(e);if(ch(t,ph))return t[ph];var r=t.constructor;return uh(r)&&t instanceof r?r.prototype:t instanceof fh?hh:null},vh=p,gh=se,mh=Ah,Eh=hr.exports,_h=_t("iterator"),yh=!1;[].keys&&("next"in(oh=[].keys())?(ih=mh(mh(oh)))!==Object.prototype&&(nh=ih):yh=!0),(null==nh||vh((function(){var e={};return nh[_h].call(e)!==e})))&&(nh={}),gh(nh[_h])||Eh(nh,_h,(function(){return this}));var Ih={IteratorPrototype:nh,BUGGY_SAFARI_ITERATORS:yh},Sh=Ih.IteratorPrototype,bh=Cf,Ch=O,wh=Ti,Rh=ji,Th=function(){return this},kh=fi,Oh=m,Dh=en,Nh=se,xh=function(e,t,r,n){var i=t+" Iterator";return e.prototype=bh(Sh,{next:Ch(+!n,r)}),wh(e,i,!1),Rh[i]=Th,e},Ph=Ah,Lh=bi,Bh=Ti,Mh=fr,Uh=hr.exports,Qh=ji,Fh=Dh.PROPER,jh=Dh.CONFIGURABLE,Vh=Ih.IteratorPrototype,Gh=Ih.BUGGY_SAFARI_ITERATORS,Kh=_t("iterator"),Hh="keys",Wh="values",Yh="entries",qh=function(){return this},Jh=ae,zh=function(e){rh[th][e]=!0},Xh=ji,Zh=qr,$h=Yt.f,eA=function(e,t,r,n,i,o,a){xh(r,t,n);var s,c,u,d=function(e){if(e===i&&A)return A;if(!Gh&&e in f)return f[e];switch(e){case Hh:case Wh:case Yh:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",p=!1,f=e.prototype,h=f[Kh]||f["@@iterator"]||i&&f[i],A=!Gh&&h||d(i),v="Array"==t&&f.entries||h;if(v&&(s=Ph(v.call(new e)))!==Object.prototype&&s.next&&(Ph(s)!==Vh&&(Lh?Lh(s,Vh):Nh(s[Kh])||Uh(s,Kh,qh)),Bh(s,l,!0)),Fh&&i==Wh&&h&&h.name!==Wh&&(jh?Mh(f,"name",Wh):(p=!0,A=function(){return Oh(h,this)})),i)if(c={values:d(Wh),keys:o?A:d(Hh),entries:d(Yh)},a)for(u in c)(Gh||p||!(u in f))&&Uh(f,u,c[u]);else kh({target:t,proto:!0,forced:Gh||p},c);return f[Kh]!==A&&Uh(f,Kh,A,{name:i}),Qh[t]=A,c},tA=h,rA="Array Iterator",nA=Zh.set,iA=Zh.getterFor(rA),oA=eA(Array,"Array",(function(e,t){nA(this,{type:rA,target:Jh(e),index:0,kind:t})}),(function(){var e=iA(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:t[n],done:!1}:{value:[n,t[n]],done:!1}}),"values"),aA=Xh.Arguments=Xh.Array;if(zh("keys"),zh("values"),zh("entries"),tA&&"values"!==aA.name)try{$h(aA,"name",{value:"values"})}catch(a){}var sA=Lt("span").classList,cA=sA&&sA.constructor&&sA.constructor.prototype,uA=cA===Object.prototype?void 0:cA,dA=u,lA={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},pA=uA,fA=oA,hA=fr,AA=_t,vA=AA("iterator"),gA=AA("toStringTag"),mA=fA.values,EA=function(e,t){if(e){if(e[vA]!==mA)try{hA(e,vA,mA)}catch(t){e[vA]=mA}if(e[gA]||hA(e,gA,t),lA[t])for(var r in fA)if(e[r]!==fA[r])try{hA(e,r,fA[r])}catch(t){e[r]=fA[r]}}};for(var _A in lA)EA(dA[_A]&&dA[_A].prototype,_A);EA(pA,"DOMTokenList");var yA=se,IA=ue,SA=bi,bA=function(e,t,r){var n,i;return SA&&yA(n=t.constructor)&&n!==r&&IA(i=n.prototype)&&i!==r.prototype&&SA(e,i),e},CA=qp,wA=function(e,t){return void 0===e?arguments.length<2?"":t:CA(e)},RA=ue,TA=fr,kA=V("".replace),OA=String(Error("zxcasd").stack),DA=/\n\s*at [^:]*:[^\n]*/,NA=DA.test(OA),xA=function(e,t){if(NA&&"string"==typeof e)for(;t--;)e=kA(e,DA,"");return e},PA=O,LA=!p((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",PA(1,7)),7!==e.stack)})),BA=fe,MA=it,UA=fr,QA=he,FA=bi,jA=zn,VA=bA,GA=wA,KA=function(e,t){RA(t)&&"cause"in t&&TA(e,"cause",t.cause)},HA=xA,WA=LA,YA=fi,qA=la,JA=function(e,t,r,n){var i=n?2:1,o=e.split("."),a=o[o.length-1],s=BA.apply(null,o);if(s){var c=s.prototype;if(MA(c,"cause")&&delete c.cause,!r)return s;var u=BA("Error"),d=t((function(e,t){var r=GA(n?t:e,void 0),o=n?new s(e):new s;return void 0!==r&&UA(o,"message",r),WA&&UA(o,"stack",HA(o.stack,2)),this&&QA(c,this)&&VA(o,this,d),arguments.length>i&&KA(o,arguments[i]),o}));d.prototype=c,"Error"!==a&&(FA?FA(d,u):jA(d,u,{name:!0})),jA(d,s);try{c.name!==a&&UA(c,"name",a),c.constructor=d}catch(e){}return d}},zA="WebAssembly",XA=u.WebAssembly,ZA=7!==Error("e",{cause:7}).cause,$A=function(e,t){var r={};r[e]=JA(e,t,ZA),YA({global:!0,forced:ZA},r)},ev=function(e,t){if(XA&&XA[e]){var r={};r[e]=JA("WebAssembly."+e,t,ZA),YA({target:zA,stat:!0,forced:ZA},r)}};$A("Error",(function(e){return function(t){return qA(e,this,arguments)}})),$A("EvalError",(function(e){return function(t){return qA(e,this,arguments)}})),$A("RangeError",(function(e){return function(t){return qA(e,this,arguments)}})),$A("ReferenceError",(function(e){return function(t){return qA(e,this,arguments)}})),$A("SyntaxError",(function(e){return function(t){return qA(e,this,arguments)}})),$A("TypeError",(function(e){return function(t){return qA(e,this,arguments)}})),$A("URIError",(function(e){return function(t){return qA(e,this,arguments)}})),ev("CompileError",(function(e){return function(t){return qA(e,this,arguments)}})),ev("LinkError",(function(e){return function(t){return qA(e,this,arguments)}})),ev("RuntimeError",(function(e){return function(t){return qA(e,this,arguments)}}));var tv=!0,rv=!0;function nv(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function iv(e,t,r){if(e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);var o=function(e){var t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,o),i.apply(this,[e,o])};var o=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);var n=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get:function(){return this["_on"+t]},set:function(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}}function ov(e){return"boolean"!=typeof e?new Error("Argument type: "+D(e)+". Please use a boolean."):(tv=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function av(e){return"boolean"!=typeof e?new Error("Argument type: "+D(e)+". Please use a boolean."):(rv=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function sv(){if("object"==("undefined"==typeof window?"undefined":D(window))){if(tv)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function cv(e,t){rv&&console.warn(e+" is deprecated, please use "+t+" instead.")}function uv(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var r=e.navigator;if(r.mozGetUserMedia)t.browser="firefox",t.version=nv(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=nv(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(r.mediaDevices&&r.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=nv(r.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=nv(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function dv(e){return"[object Object]"===Object.prototype.toString.call(e)}function lv(e){var t;return dv(e)?Hp(t=Object.keys(e)).call(t,(function(t,r){var n=dv(e[r]),i=n?lv(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,j({},r,i))}),{}):e}function pv(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;var o=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((function(t){e.forEach((function(r){r.type===n&&r.trackId===t.id&&function e(t,r,n){r&&!n.has(r.id)&&(n.set(r.id,r),Object.keys(r).forEach((function(i){i.endsWith("Id")?e(t,t.get(r[i]),n):i.endsWith("Ids")&&r[i].forEach((function(r){e(t,t.get(r),n)}))})))}(e,r,i)}))})),i}var fv=Cd.exports,hv=Vd,Av=fv("keys"),vv=function(e){return Av[e]||(Av[e]=hv(e))},gv=!Xc((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),mv=su,Ev=Md,_v=fu,yv=Pd,Iv=gv,Sv=vv("IE_PROTO"),bv=mv.Object,Cv=bv.prototype,wv=Iv?bv.getPrototypeOf:function(e){var t=yv(e);if(Ev(t,Sv))return t[Sv];var r=t.constructor;return _v(r)&&t instanceof r?r.prototype:t instanceof bv?Cv:null},Rv=su,Tv=fu,kv=Rv.String,Ov=Rv.TypeError,Dv=iu,Nv=Hl,xv=function(e){if("object"==D(e)||Tv(e))return e;throw Ov("Can't set "+kv(e)+" as a prototype")},Pv=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Dv(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return Nv(r),xv(n),t?e(r,n):r.__proto__=n,r}}():void 0),Lv={},Bv=_p,Mv=Math.max,Uv=Math.min,Qv=function(e,t){var r=Bv(e);return r<0?Mv(r+t,0):Uv(r,t)},Fv=Fu,jv=Qv,Vv=bp,Gv=function(e){return function(t,r,n){var i,o=Fv(t),a=Vv(o),s=jv(n,a);if(e&&r!=r){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},Kv={includes:Gv(!0),indexOf:Gv(!1)},Hv={},Wv=Md,Yv=Fu,qv=Kv.indexOf,Jv=Hv,zv=iu([].push),Xv=function(e,t){var r,n=Yv(e),i=0,o=[];for(r in n)!Wv(Jv,r)&&Wv(n,r)&&zv(o,r);for(;t.length>i;)Wv(n,r=t[i++])&&(~qv(o,r)||zv(o,r));return o},Zv=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],$v=Xv,eg=Zv.concat("length","prototype");Lv.f=Object.getOwnPropertyNames||function(e){return $v(e,eg)};var tg={};tg.f=Object.getOwnPropertySymbols;var rg=qu,ng=Lv,ig=tg,og=Hl,ag=iu([].concat),sg=rg("Reflect","ownKeys")||function(e){var t=ng.f(og(e)),r=ig.f;return r?ag(t,r(e)):t},cg=Md,ug=sg,dg=hu,lg=Ql,pg={},fg=Xv,hg=Zv,Ag=Object.keys||function(e){return fg(e,hg)},vg=Au,gg=Fl,mg=Ql,Eg=Hl,_g=Fu,yg=Ag;pg.f=vg&&!gg?Object.defineProperties:function(e,t){Eg(e);for(var r,n=_g(t),i=yg(t),o=i.length,a=0;o>a;)mg.f(e,r=i[a++],n[r]);return e};var Ig,Sg=qu("document","documentElement"),bg=Hl,Cg=pg,wg=Zv,Rg=Hv,Tg=Sg,kg=hl,Og=vv("IE_PROTO"),Dg=function(){},Ng=function(e){return"<script>"+e+"<\/script>"},xg=function(e){e.write(Ng("")),e.close();var t=e.parentWindow.Object;return e=null,t},Pg=function(){try{Ig=new ActiveXObject("htmlfile")}catch(e){}var e,t;Pg="undefined"!=typeof document?document.domain&&Ig?xg(Ig):((t=kg("iframe")).style.display="none",Tg.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Ng("document.F=Object")),e.close(),e.F):xg(Ig);for(var r=wg.length;r--;)delete Pg.prototype[wg[r]];return Pg()};Rg[Og]=!0;var Lg=Object.create||function(e,t){var r;return null!==e?(Dg.prototype=bg(e),r=new Dg,Dg.prototype=null,r[Og]=e):r=Pg(),void 0===t?r:Cg.f(r,t)},Bg=iu("".replace),Mg=String(Error("zxcasd").stack),Ug=/\n\s*at [^:]*:[^\n]*/,Qg=Ug.test(Mg),Fg=Vu,jg=op,Vg={},Gg=Vg,Kg=$d("iterator"),Hg=Array.prototype,Wg=function(e){return void 0!==e&&(Gg.Array===e||Hg[Kg]===e)},Yg={};Yg[$d("toStringTag")]="z";var qg="[object z]"===String(Yg),Jg=su,zg=qg,Xg=fu,Zg=ku,$g=$d("toStringTag"),em=Jg.Object,tm="Arguments"==Zg(function(){return arguments}()),rm=zg?Zg:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=em(e),$g))?r:tm?Zg(t):"Object"==(n=Zg(t))&&Xg(t.callee)?"Arguments":n},nm=rm,im=_d,om=Vg,am=$d("iterator"),sm=function(e){if(null!=e)return im(e,am)||im(e,"@@iterator")||om[nm(e)]},cm=mu,um=md,dm=Hl,lm=hd,pm=sm,fm=su.TypeError,hm=function(e,t){var r=arguments.length<2?pm(e):t;if(um(r))return dm(cm(r,e));throw fm(lm(e)+" is not iterable")},Am=mu,vm=Hl,gm=_d,mm=function(e,t,r){var n,i;vm(e);try{if(!(n=gm(e,"return"))){if("throw"===t)throw r;return r}n=Am(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return vm(n),r},Em=Ul,_m=mu,ym=Hl,Im=hd,Sm=Wg,bm=bp,Cm=ou,wm=hm,Rm=sm,Tm=mm,km=su.TypeError,Om=function(e,t){this.stopped=e,this.result=t},Dm=Om.prototype,Nm=function(e,t,r){var n,i,o,a,s,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),p=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),h=Em(t,d),A=function(e){return n&&Tm(n,"normal",e),new Om(!0,e)},v=function(e){return l?(ym(e),f?h(e[0],e[1],A):h(e[0],e[1])):f?h(e,A):h(e)};if(p)n=e;else{if(!(i=Rm(e)))throw km(Im(e)+" is not iterable");if(Sm(i)){for(o=0,a=bm(e);a>o;o++)if((s=v(e[o]))&&Cm(Dm,s))return s;return new Om(!1)}n=wm(e,i)}for(c=n.next;!(u=_m(c,n)).done;){try{s=v(u.value)}catch(e){Tm(n,"throw",e)}if("object"==D(s)&&s&&Cm(Dm,s))return s}return new Om(!1)},xm=rm,Pm=su.String,Lm=function(e){if("Symbol"===xm(e))throw TypeError("Cannot convert a Symbol value to a string");return Pm(e)},Bm=Lm,Mm=Cu,Um=!Xc((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Mm(1,7)),7!==e.stack)})),Qm=gp,Fm=su,jm=ou,Vm=wv,Gm=Pv,Km=function(e,t,r){for(var n=ug(t),i=lg.f,o=dg.f,a=0;a<n.length;a++){var s=n[a];cg(e,s)||r&&cg(r,s)||i(e,s,o(t,s))}},Hm=Lg,Wm=op,Ym=Cu,qm=function(e,t){if(Qg&&"string"==typeof e)for(;t--;)e=Bg(e,Ug,"");return e},Jm=function(e,t){Fg(t)&&"cause"in t&&jg(e,"cause",t.cause)},zm=Nm,Xm=function(e,t){return void 0===e?arguments.length<2?"":t:Bm(e)},Zm=Um,$m=$d("toStringTag"),eE=Fm.Error,tE=[].push,rE=function(e,t){var r,n=arguments.length>2?arguments[2]:void 0,i=jm(nE,this);Gm?r=Gm(new eE,i?Vm(this):nE):(r=i?this:Hm(nE),Wm(r,$m,"Error")),void 0!==t&&Wm(r,"message",Xm(t)),Zm&&Wm(r,"stack",qm(r.stack,1)),Jm(r,n);var o=[];return zm(e,tE,{that:o}),Wm(r,"errors",o),r};Gm?Gm(rE,eE):Km(rE,eE,{name:!0});var nE=rE.prototype=Hm(eE.prototype,{constructor:Ym(1,rE),message:Ym(1,""),name:Ym(1,"AggregateError")});Qm({global:!0},{AggregateError:rE});var iE=fu,oE=Od,aE=iu(Function.toString);iE(oE.inspectSource)||(oE.inspectSource=function(e){return aE(e)});var sE,cE,uE,dE=oE.inspectSource,lE=fu,pE=dE,fE=su.WeakMap,hE=lE(fE)&&/native code/.test(pE(fE)),AE=su,vE=iu,gE=Vu,mE=op,EE=Md,_E=Od,yE=vv,IE=Hv,SE="Object already initialized",bE=AE.TypeError,CE=AE.WeakMap;if(hE||_E.state){var wE=_E.state||(_E.state=new CE),RE=vE(wE.get),TE=vE(wE.has),kE=vE(wE.set);sE=function(e,t){if(TE(wE,e))throw new bE(SE);return t.facade=e,kE(wE,e,t),t},cE=function(e){return RE(wE,e)||{}},uE=function(e){return TE(wE,e)}}else{var OE=yE("state");IE[OE]=!0,sE=function(e,t){if(EE(e,OE))throw new bE(SE);return t.facade=e,mE(e,OE,t),t},cE=function(e){return EE(e,OE)?e[OE]:{}},uE=function(e){return EE(e,OE)}}var DE,NE,xE,PE={set:sE,get:cE,has:uE,enforce:function(e){return uE(e)?cE(e):sE(e,{})},getterFor:function(e){return function(t){var r;if(!gE(t)||(r=cE(t)).type!==e)throw bE("Incompatible receiver, "+e+" required");return r}}},LE=Au,BE=Md,ME=Function.prototype,UE=LE&&Object.getOwnPropertyDescriptor,QE=BE(ME,"name"),FE={EXISTS:QE,PROPER:QE&&"something"===function(){}.name,CONFIGURABLE:QE&&(!LE||LE&&UE(ME,"name").configurable)},jE=op,VE=function(e,t,r,n){n&&n.enumerable?e[t]=r:jE(e,t,r)},GE=Xc,KE=fu,HE=Lg,WE=wv,YE=VE,qE=$d("iterator"),JE=!1;[].keys&&("next"in(xE=[].keys())?(NE=WE(WE(xE)))!==Object.prototype&&(DE=NE):JE=!0);var zE=null==DE||GE((function(){var e={};return DE[qE].call(e)!==e}));KE((DE=zE?{}:HE(DE))[qE])||YE(DE,qE,(function(){return this}));var XE={IteratorPrototype:DE,BUGGY_SAFARI_ITERATORS:JE},ZE=rm,$E=qg?{}.toString:function(){return"[object "+ZE(this)+"]"},e_=qg,t_=Ql.f,r_=op,n_=Md,i_=$E,o_=$d("toStringTag"),a_=function(e,t,r,n){if(e){var i=r?e:e.prototype;n_(i,o_)||t_(i,o_,{configurable:!0,value:t}),n&&!e_&&r_(i,"toString",i_)}},s_=XE.IteratorPrototype,c_=Lg,u_=Cu,d_=a_,l_=Vg,p_=function(){return this},f_=function(e,t,r,n){var i=t+" Iterator";return e.prototype=c_(s_,{next:u_(+!n,r)}),d_(e,i,!1,!0),l_[i]=p_,e},h_=gp,A_=mu,v_=f_,g_=wv,m_=a_,E_=VE,__=Vg,y_=FE.PROPER,I_=XE.BUGGY_SAFARI_ITERATORS,S_=$d("iterator"),b_="keys",C_="values",w_="entries",R_=function(){return this},T_=function(e,t,r,n,i,o,a){v_(r,t,n);var s,c,u,d=function(e){if(e===i&&A)return A;if(!I_&&e in f)return f[e];switch(e){case b_:case C_:case w_:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",p=!1,f=e.prototype,h=f[S_]||f["@@iterator"]||i&&f[i],A=!I_&&h||d(i),v="Array"==t&&f.entries||h;if(v&&(s=g_(v.call(new e)))!==Object.prototype&&s.next&&(m_(s,l,!0,!0),__[l]=R_),y_&&i==C_&&h&&h.name!==C_&&(p=!0,A=function(){return A_(h,this)}),i)if(c={values:d(C_),keys:o?A:d(b_),entries:d(w_)},a)for(u in c)(I_||p||!(u in f))&&E_(f,u,c[u]);else h_({target:t,proto:!0,forced:I_||p},c);return a&&f[S_]!==A&&E_(f,S_,A,{name:i}),__[t]=A,c},k_=Fu,O_=Vg,D_=PE,N_=T_,x_="Array Iterator",P_=D_.set,L_=D_.getterFor(x_);N_(Array,"Array",(function(e,t){P_(this,{type:x_,target:k_(e),index:0,kind:t})}),(function(){var e=L_(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:t[n],done:!1}:{value:[n,t[n]],done:!1}}),"values"),O_.Arguments=O_.Array;var B_=su.Promise,M_=VE,U_=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:M_(e,n,t[n],r);return e},Q_=qu,F_=Ql,j_=Au,V_=$d("species"),G_=ou,K_=su.TypeError,H_=function(e,t){if(G_(t,e))return e;throw K_("Incorrect invocation")},W_=$d("iterator"),Y_=!1;try{var q_=0,J_={next:function(){return{done:!!q_++}},return:function(){Y_=!0}};J_[W_]=function(){return this},Array.from(J_,(function(){throw 2}))}catch(a){}var z_=iu,X_=Xc,Z_=fu,$_=rm,ey=dE,ty=function(){},ry=[],ny=qu("Reflect","construct"),iy=/^\s*(?:class|function)\b/,oy=z_(iy.exec),ay=!iy.exec(ty),sy=function(e){if(!Z_(e))return!1;try{return ny(ty,ry,e),!0}catch(e){return!1}},cy=function(e){if(!Z_(e))return!1;switch($_(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ay||!!oy(iy,ey(e))}catch(e){return!0}};cy.sham=!0;var uy,dy,ly,py,fy=!ny||X_((function(){var e;return sy(sy.call)||!sy(Object)||!sy((function(){e=!0}))||e}))?cy:sy,hy=fy,Ay=hd,vy=su.TypeError,gy=Hl,my=function(e){if(hy(e))return e;throw vy(Ay(e)+" is not a constructor")},Ey=$d("species"),_y=function(e,t){var r,n=gy(e).constructor;return void 0===n||null==(r=gy(n)[Ey])?t:my(r)},yy=iu([].slice),Iy=/(?:ipad|iphone|ipod).*applewebkit/i.test(Ju),Sy=su,by=pu,Cy=Ul,wy=fu,Ry=Md,Ty=Xc,ky=Sg,Oy=yy,Dy=hl,Ny=Iy,xy=Pp,Py=Sy.setImmediate,Ly=Sy.clearImmediate,By=Sy.process,My=Sy.Dispatch,Uy=Sy.Function,Qy=Sy.MessageChannel,Fy=Sy.String,jy=0,Vy={},Gy="onreadystatechange";try{uy=Sy.location}catch(a){}var Ky=function(e){if(Ry(Vy,e)){var t=Vy[e];delete Vy[e],t()}},Hy=function(e){return function(){Ky(e)}},Wy=function(e){Ky(e.data)},Yy=function(e){Sy.postMessage(Fy(e),uy.protocol+"//"+uy.host)};Py&&Ly||(Py=function(e){var t=Oy(arguments,1);return Vy[++jy]=function(){by(wy(e)?e:Uy(e),void 0,t)},dy(jy),jy},Ly=function(e){delete Vy[e]},xy?dy=function(e){By.nextTick(Hy(e))}:My&&My.now?dy=function(e){My.now(Hy(e))}:Qy&&!Ny?(py=(ly=new Qy).port2,ly.port1.onmessage=Wy,dy=Cy(py.postMessage,py)):Sy.addEventListener&&wy(Sy.postMessage)&&!Sy.importScripts&&uy&&"file:"!==uy.protocol&&!Ty(Yy)?(dy=Yy,Sy.addEventListener("message",Wy,!1)):dy=Gy in Dy("script")?function(e){ky.appendChild(Dy("script")).onreadystatechange=function(){ky.removeChild(this),Ky(e)}}:function(e){setTimeout(Hy(e),0)});var qy,Jy,zy,Xy,Zy,$y,eI,tI,rI={set:Py,clear:Ly},nI=su,iI=/ipad|iphone|ipod/i.test(Ju)&&void 0!==nI.Pebble,oI=/web0s(?!.*chrome)/i.test(Ju),aI=su,sI=Ul,cI=hu.f,uI=rI.set,dI=Iy,lI=iI,pI=oI,fI=Pp,hI=aI.MutationObserver||aI.WebKitMutationObserver,AI=aI.document,vI=aI.process,gI=aI.Promise,mI=cI(aI,"queueMicrotask"),EI=mI&&mI.value;EI||(qy=function(){var e,t;for(fI&&(e=vI.domain)&&e.exit();Jy;){t=Jy.fn,Jy=Jy.next;try{t()}catch(e){throw Jy?Xy():zy=void 0,e}}zy=void 0,e&&e.enter()},dI||fI||pI||!hI||!AI?!lI&&gI&&gI.resolve?((eI=gI.resolve(void 0)).constructor=gI,tI=sI(eI.then,eI),Xy=function(){tI(qy)}):fI?Xy=function(){vI.nextTick(qy)}:(uI=sI(uI,aI),Xy=function(){uI(qy)}):(Zy=!0,$y=AI.createTextNode(""),new hI(qy).observe($y,{characterData:!0}),Xy=function(){$y.data=Zy=!Zy}));var _I=EI||function(e){var t={fn:e,next:void 0};zy&&(zy.next=t),Jy||(Jy=t,Xy()),zy=t},yI={},II=md,SI=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n})),this.resolve=II(t),this.reject=II(r)};yI.f=function(e){return new SI(e)};var bI=Hl,CI=Vu,wI=yI,RI=function(e,t){if(bI(e),CI(t)&&t.constructor===e)return t;var r=wI.f(e);return(0,r.resolve)(t),r.promise},TI=su,kI=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},OI=function(){this.head=null,this.tail=null};OI.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var DI,NI,xI,PI="object"==("undefined"==typeof window?"undefined":D(window)),LI=gp,BI=su,MI=qu,UI=mu,QI=B_,FI=U_,jI=a_,VI=function(e){var t=Q_(e),r=F_.f;j_&&t&&!t[V_]&&r(t,V_,{configurable:!0,get:function(){return this}})},GI=md,KI=fu,HI=Vu,WI=H_,YI=dE,qI=Nm,JI=function(e,t){if(!t&&!Y_)return!1;var r=!1;try{var n={};n[W_]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},zI=_y,XI=rI.set,ZI=_I,$I=RI,eS=function(e,t){var r=TI.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},tS=yI,rS=kI,nS=OI,iS=PE,oS=Pl,aS=PI,sS=Pp,cS=rd,uS=$d("species"),dS="Promise",lS=iS.getterFor(dS),pS=iS.set,fS=iS.getterFor(dS),hS=QI&&QI.prototype,AS=QI,vS=hS,gS=BI.TypeError,mS=BI.document,ES=BI.process,_S=tS.f,yS=_S,IS=!!(mS&&mS.createEvent&&BI.dispatchEvent),SS=KI(BI.PromiseRejectionEvent),bS="unhandledrejection",CS=oS(dS,(function(){var e=YI(AS),t=e!==String(AS);if(!t&&66===cS)return!0;if(!vS.finally)return!0;if(cS>=51&&/native code/.test(e))return!1;var r=new AS((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};return(r.constructor={})[uS]=n,!(r.then((function(){}))instanceof n)||!t&&aS&&!SS})),wS=CS||!JI((function(e){AS.all(e).catch((function(){}))})),RS=function(e){var t;return!(!HI(e)||!KI(t=e.then))&&t},TS=function(e,t){var r,n,i,o=t.value,a=1==t.state,s=a?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&xS(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?u(gS("Promise-chain cycle")):(n=RS(r))?UI(n,r,c,u):c(r)):u(o)}catch(e){d&&!i&&d.exit(),u(e)}},kS=function(e,t){e.notified||(e.notified=!0,ZI((function(){for(var r,n=e.reactions;r=n.get();)TS(r,e);e.notified=!1,t&&!e.rejection&&DS(e)})))},OS=function(e,t,r){var n,i;IS?((n=mS.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),BI.dispatchEvent(n)):n={promise:t,reason:r},!SS&&(i=BI["on"+e])?i(n):e===bS&&eS("Unhandled promise rejection",r)},DS=function(e){UI(XI,BI,(function(){var t,r=e.facade,n=e.value;if(NS(e)&&(t=rS((function(){sS?ES.emit("unhandledRejection",n,r):OS(bS,r,n)})),e.rejection=sS||NS(e)?2:1,t.error))throw t.value}))},NS=function(e){return 1!==e.rejection&&!e.parent},xS=function(e){UI(XI,BI,(function(){var t=e.facade;sS?ES.emit("rejectionHandled",t):OS("rejectionhandled",t,e.value)}))},PS=function(e,t,r){return function(n){e(t,n,r)}},LS=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,kS(e,!0))},BS=function e(t,r,n){if(!t.done){t.done=!0,n&&(t=n);try{if(t.facade===r)throw gS("Promise can't be resolved itself");var i=RS(r);i?ZI((function(){var n={done:!1};try{UI(i,r,PS(e,n,t),PS(LS,n,t))}catch(e){LS(n,e,t)}})):(t.value=r,t.state=1,kS(t,!1))}catch(r){LS({done:!1},r,t)}}};CS&&(vS=(AS=function(e){WI(this,vS),GI(e),UI(DI,this);var t=lS(this);try{e(PS(BS,t),PS(LS,t))}catch(e){LS(t,e)}}).prototype,(DI=function(e){pS(this,{type:dS,done:!1,notified:!1,parent:!1,reactions:new nS,rejection:!1,state:0,value:void 0})}).prototype=FI(vS,{then:function(e,t){var r=fS(this),n=_S(zI(this,AS));return r.parent=!0,n.ok=!KI(e)||e,n.fail=KI(t)&&t,n.domain=sS?ES.domain:void 0,0==r.state?r.reactions.add(n):ZI((function(){TS(n,r)})),n.promise},catch:function(e){return this.then(void 0,e)}}),NI=function(){var e=new DI,t=lS(e);this.promise=e,this.resolve=PS(BS,t),this.reject=PS(LS,t)},tS.f=_S=function(e){return e===AS||e===xI?new NI(e):yS(e)}),LI({global:!0,wrap:!0,forced:CS},{Promise:AS}),jI(AS,dS,!1,!0),VI(dS),xI=MI(dS),LI({target:dS,stat:!0,forced:CS},{reject:function(e){var t=_S(this);return UI(t.reject,void 0,e),t.promise}}),LI({target:dS,stat:!0,forced:!0},{resolve:function(e){return $I(this===xI?AS:this,e)}}),LI({target:dS,stat:!0,forced:wS},{all:function(e){var t=this,r=_S(t),n=r.resolve,i=r.reject,o=rS((function(){var r=GI(t.resolve),o=[],a=0,s=1;qI(e,(function(e){var c=a++,u=!1;s++,UI(r,t,e).then((function(e){u||(u=!0,o[c]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise},race:function(e){var t=this,r=_S(t),n=r.reject,i=rS((function(){var i=GI(t.resolve);qI(e,(function(e){UI(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var MS=mu,US=md,QS=yI,FS=kI,jS=Nm;gp({target:"Promise",stat:!0},{allSettled:function(e){var t=this,r=QS.f(t),n=r.resolve,i=r.reject,o=FS((function(){var r=US(t.resolve),i=[],o=0,a=1;jS(e,(function(e){var s=o++,c=!1;a++,MS(r,t,e).then((function(e){c||(c=!0,i[s]={status:"fulfilled",value:e},--a||n(i))}),(function(e){c||(c=!0,i[s]={status:"rejected",reason:e},--a||n(i))}))})),--a||n(i)}));return o.error&&i(o.value),r.promise}});var VS=md,GS=qu,KS=mu,HS=yI,WS=kI,YS=Nm,qS="No one promise resolved";gp({target:"Promise",stat:!0},{any:function(e){var t=this,r=GS("AggregateError"),n=HS.f(t),i=n.resolve,o=n.reject,a=WS((function(){var n=VS(t.resolve),a=[],s=0,c=1,u=!1;YS(e,(function(e){var d=s++,l=!1;c++,KS(n,t,e).then((function(e){l||u||(u=!0,i(e))}),(function(e){l||u||(l=!0,a[d]=e,--c||o(new r(a,qS)))}))})),--c||o(new r(a,qS))}));return a.error&&o(a.value),n.promise}});var JS=B_,zS=qu,XS=fu,ZS=_y,$S=RI;gp({target:"Promise",proto:!0,real:!0,forced:!!JS&&Xc((function(){JS.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=ZS(this,zS("Promise")),r=XS(e);return this.then(r?function(r){return $S(t,e()).then((function(){return r}))}:e,r?function(r){return $S(t,e()).then((function(){throw r}))}:e)}});var eb=iu,tb=_p,rb=Lm,nb=Mu,ib=eb("".charAt),ob=eb("".charCodeAt),ab=eb("".slice),sb=function(e){return function(t,r){var n,i,o=rb(nb(t)),a=tb(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=ob(o,a))<55296||n>56319||a+1===s||(i=ob(o,a+1))<56320||i>57343?e?ib(o,a):n:e?ab(o,a,a+2):i-56320+(n-55296<<10)+65536}},cb={codeAt:sb(!1),charAt:sb(!0)},ub=cb.charAt,db=Lm,lb=PE,pb=T_,fb="String Iterator",hb=lb.set,Ab=lb.getterFor(fb);pb(String,"String",(function(e){hb(this,{type:fb,string:db(e),index:0})}),(function(){var e,t=Ab(this),r=t.string,n=t.index;return n>=r.length?{value:void 0,done:!0}:(e=ub(r,n),t.index+=e.length,{value:e,done:!1})}));var vb=Gu.Promise,gb={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},mb=su,Eb=rm,_b=op,yb=Vg,Ib=$d("toStringTag");for(var Sb in gb){var bb=mb[Sb],Cb=bb&&bb.prototype;Cb&&Eb(Cb)!==Ib&&_b(Cb,Ib,Sb),yb[Sb]=yb.Array}var wb=vb,Rb=wb,Tb=Aa,kb=h,Ob=p,Db=$t,Nb=Cf,xb=wA,Pb=Error.prototype.toString,Lb=Ob((function(){if(kb){var e=Nb(Object.defineProperty({},"name",{get:function(){return this===e}}));if("true"!==Pb.call(e))return!0}return"2: 1"!==Pb.call({message:1,name:2})||"Error"!==Pb.call({})}))?function(){var e=Db(this),t=xb(e.name,"Error"),r=xb(e.message);return t?r?t+": "+r:t:r}:Pb,Bb={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}},Mb=fi,Ub=function(e){try{if(Tb)return Function('return require("'+e+'")')()}catch(e){}},Qb=fe,Fb=p,jb=Cf,Vb=O,Gb=Yt.f,Kb=rf.f,Hb=hr.exports,Wb=it,Yb=Bi,qb=$t,Jb=Lb,zb=wA,Xb=Bb,Zb=xA,$b=qr,eC=h,tC="DOMException",rC="DATA_CLONE_ERR",nC=Qb("Error"),iC=Qb(tC)||function(){try{(new(Qb("MessageChannel")||Ub("worker_threads").MessageChannel)).port1.postMessage(new WeakMap)}catch(e){if(e.name==rC&&25==e.code)return e.constructor}}(),oC=iC&&iC.prototype,aC=nC.prototype,sC=$b.set,cC=$b.getterFor(tC),uC="stack"in nC(tC),dC=function(e){return Wb(Xb,e)&&Xb[e].m?Xb[e].c:0},lC=function(){Yb(this,pC);var e=arguments.length,t=zb(e<1?void 0:arguments[0]),r=zb(e<2?void 0:arguments[1],"Error"),n=dC(r);if(sC(this,{type:tC,name:r,message:t,code:n}),eC||(this.name=r,this.message=t,this.code=n),uC){var i=nC(t);i.name=tC,Gb(this,"stack",Vb(1,Zb(i.stack,1)))}},pC=lC.prototype=jb(aC),fC=function(e){return{enumerable:!0,configurable:!0,get:e}},hC=function(e){return fC((function(){return cC(this)[e]}))};eC&&Kb(pC,{name:hC("name"),message:hC("message"),code:hC("code")}),Gb(pC,"constructor",Vb(1,lC));var AC=Fb((function(){return!(new iC instanceof nC)})),vC=AC||Fb((function(){return aC.toString!==Jb||"2: 1"!==String(new iC(1,2))})),gC=AC||Fb((function(){return 25!==new iC(1,"DataCloneError").code}));AC||25!==iC.DATA_CLONE_ERR||oC.DATA_CLONE_ERR,Mb({global:!0,forced:AC},{DOMException:AC?lC:iC});var mC=Qb(tC),EC=mC.prototype;for(var _C in vC&&iC===mC&&Hb(EC,"toString",Jb),gC&&eC&&iC===mC&&Gb(EC,"code",fC((function(){return dC(qb(this).name)}))),Xb)if(Wb(Xb,_C)){var yC=Xb[_C],IC=yC.s,SC=Vb(6,yC.c);Wb(mC,IC)||Gb(mC,IC,SC),Wb(EC,IC)||Gb(EC,IC,SC)}var bC=fi,CC=fe,wC=O,RC=Yt.f,TC=it,kC=Bi,OC=bA,DC=wA,NC=Bb,xC=xA,PC="DOMException",LC=CC("Error"),BC=CC(PC),MC=function e(){kC(this,UC);var t=arguments.length,r=DC(t<1?void 0:arguments[0]),n=DC(t<2?void 0:arguments[1],"Error"),i=new BC(r,n),o=LC(r);return o.name=PC,RC(i,"stack",wC(1,xC(o.stack,1))),OC(i,this,e),i},UC=MC.prototype=BC.prototype,QC="stack"in LC(PC),FC="stack"in new BC(1,2),jC=QC&&!FC;bC({global:!0,forced:jC},{DOMException:jC?MC:BC});var VC=CC(PC),GC=VC.prototype;if(GC.constructor!==VC)for(var KC in RC(GC,"constructor",wC(1,VC)),NC)if(TC(NC,KC)){var HC=NC[KC],WC=HC.s;TC(VC,WC)||RC(VC,WC,wC(6,HC.c))}var YC="DOMException";Ti(fe(YC),YC);var qC=V,JC=hr.exports,zC=Zf,XC=p,ZC=_t,$C=fr,ew=ZC("species"),tw=RegExp.prototype,rw=V,nw=An,iw=qp,ow=ne,aw=rw("".charAt),sw=rw("".charCodeAt),cw=rw("".slice),uw=function(e){return function(t,r){var n,i,o=iw(ow(t)),a=nw(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=sw(o,a))<55296||n>56319||a+1===s||(i=sw(o,a+1))<56320||i>57343?e?aw(o,a):n:e?cw(o,a,a+2):i-56320+(n-55296<<10)+65536}},dw=(uw(!1),uw(!0)),lw=V,pw=tt,fw=Math.floor,hw=lw("".charAt),Aw=lw("".replace),vw=lw("".slice),gw=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,mw=/\$([$&'`]|\d{1,2})/g,Ew=m,_w=$t,yw=se,Iw=J,Sw=Zf,bw=u.TypeError,Cw=la,ww=m,Rw=V,Tw=function(e,t,r,n){var i=ZC(e),o=!XC((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!XC((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[ew]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!a||r){var s=qC(/./[i]),c=t(i,""[e],(function(e,t,r,n,i){var a=qC(e),c=t.exec;return c===zC||c===tw.exec?o&&!i?{done:!0,value:s(t,r,n)}:{done:!0,value:a(r,t,n)}:{done:!1}}));JC(String.prototype,e,c[0]),JC(tw,i,c[1])}n&&$C(tw[i],"sham",!0)},kw=p,Ow=$t,Dw=se,Nw=An,xw=In,Pw=qp,Lw=ne,Bw=function(e,t,r){return t+(r?dw(e,t).length:1)},Mw=Fe,Uw=function(e,t,r,n,i,o){var a=r+e.length,s=n.length,c=mw;return void 0!==i&&(i=pw(i),c=gw),Aw(o,c,(function(o,c){var u;switch(hw(c,0)){case"$":return"$";case"&":return e;case"`":return vw(t,0,r);case"'":return vw(t,a);case"<":u=i[vw(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=fw(d/10);return 0===l?o:l<=s?void 0===n[l-1]?hw(c,1):n[l-1]+hw(c,1):o}u=n[d-1]}return void 0===u?"":u}))},Qw=function(e,t){var r=e.exec;if(yw(r)){var n=Ew(r,e,t);return null!==n&&_w(n),n}if("RegExp"===Iw(e))return Ew(Sw,e,t);throw bw("RegExp#exec called on incompatible receiver")},Fw=_t("replace"),jw=Math.max,Vw=Math.min,Gw=Rw([].concat),Kw=Rw([].push),Hw=Rw("".indexOf),Ww=Rw("".slice),Yw="$0"==="a".replace(/./,"$0"),qw=!!/./[Fw]&&""===/./[Fw]("a","$0");Tw("replace",(function(e,t,r){var n=qw?"$":"$0";return[function(e,r){var n=Lw(this),i=null==e?void 0:Mw(e,Fw);return i?ww(i,e,n,r):ww(t,Pw(n),e,r)},function(e,i){var o=Ow(this),a=Pw(e);if("string"==typeof i&&-1===Hw(i,n)&&-1===Hw(i,"$<")){var s=r(t,o,a,i);if(s.done)return s.value}var c=Dw(i);c||(i=Pw(i));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var p=Qw(o,a);if(null===p)break;if(Kw(l,p),!u)break;""===Pw(p[0])&&(o.lastIndex=Bw(a,xw(o.lastIndex),d))}for(var f,h="",A=0,v=0;v<l.length;v++){for(var g=Pw((p=l[v])[0]),m=jw(Vw(Nw(p.index),a.length),0),E=[],_=1;_<p.length;_++)Kw(E,void 0===(f=p[_])?f:String(f));var y=p.groups;if(c){var I=Gw([g],E,m,a);void 0!==y&&Kw(I,y);var S=Pw(Cw(i,void 0,I))}else S=Uw(g,a,m,E,y,i);m>=A&&(h+=Ww(a,A,m)+S,A=m+g.length)}return h+Ww(a,A)}]}),!!kw((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!Yw||qw);var Jw=ue,zw=J,Xw=_t("match"),Zw=h,$w=u,eR=V,tR=oi,rR=bA,nR=fr,iR=Yt.f,oR=pn.f,aR=he,sR=function(e){var t;return Jw(e)&&(void 0!==(t=e[Xw])?!!t:"RegExp"==zw(e))},cR=qp,uR=zp,dR=tf,lR=hr.exports,pR=p,fR=it,hR=qr.enforce,AR=xi,vR=Tf,gR=Df,mR=_t("match"),ER=$w.RegExp,_R=ER.prototype,yR=$w.SyntaxError,IR=eR(uR),SR=eR(_R.exec),bR=eR("".charAt),CR=eR("".replace),wR=eR("".indexOf),RR=eR("".slice),TR=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,kR=/a/g,OR=/a/g,DR=new ER(kR)!==kR,NR=dR.MISSED_STICKY,xR=dR.UNSUPPORTED_Y,PR=Zw&&(!DR||NR||vR||gR||pR((function(){return OR[mR]=!1,ER(kR)!=kR||ER(OR)==OR||"/a/i"!=ER(kR,"i")})));if(tR("RegExp",PR)){for(var LR=function e(t,r){var n,i,o,a,s,c,u=aR(_R,this),d=sR(t),l=void 0===r,p=[],f=t;if(!u&&d&&l&&t.constructor===e)return t;if((d||aR(_R,t))&&(t=t.source,l&&(r="flags"in f?f.flags:IR(f))),t=void 0===t?"":cR(t),r=void 0===r?"":cR(r),f=t,vR&&"dotAll"in kR&&(i=!!r&&wR(r,"s")>-1)&&(r=CR(r,/s/g,"")),n=r,NR&&"sticky"in kR&&(o=!!r&&wR(r,"y")>-1)&&xR&&(r=CR(r,/y/g,"")),gR&&(t=(a=function(e){for(var t,r=e.length,n=0,i="",o=[],a={},s=!1,c=!1,u=0,d="";n<=r;n++){if("\\"===(t=bR(e,n)))t+=bR(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:SR(TR,RR(e,n+1))&&(n+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===d||fR(a,d))throw new yR("Invalid capture group name");a[d]=!0,o[o.length]=[d,u],c=!1,d="";continue}c?d+=t:i+=t}return[i,o]}(t))[0],p=a[1]),s=rR(ER(t,r),u?this:_R,e),(i||o||p.length)&&(c=hR(s),i&&(c.dotAll=!0,c.raw=e(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=bR(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+bR(e,++n);return i}(t),n)),o&&(c.sticky=!0),p.length&&(c.groups=p)),t!==f)try{nR(s,"source",""===f?"(?:)":f)}catch(t){}return s},BR=function(e){e in LR||iR(LR,e,{configurable:!0,get:function(){return ER[e]},set:function(t){ER[e]=t}})},MR=oR(ER),UR=0;MR.length>UR;)BR(MR[UR++]);_R.constructor=LR,LR.prototype=_R,lR($w,"RegExp",LR)}AR("RegExp");var QR=u,FR=h,jR=Tf,VR=J,GR=Yt.f,KR=qr.get,HR=RegExp.prototype,WR=QR.TypeError;FR&&jR&&GR(HR,"dotAll",{configurable:!0,get:function(){if(this!==HR){if("RegExp"===VR(this))return!!KR(this).dotAll;throw WR("Incompatible receiver, RegExp required")}}});var YR=sv;function qR(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!=D(e)||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach((function(r){if("require"!==r&&"advanced"!==r&&"mediaSource"!==r){var n="object"==D(e[r])?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];var o={};"number"==typeof n.ideal?(o[i("min",r)]=n.ideal,t.optional.push(o),(o={})[i("max",r)]=n.ideal,t.optional.push(o)):(o[i("",r)]=n.ideal,t.optional.push(o))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",r)]=n.exact):["min","max"].forEach((function(e){void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,r)]=n[e])}))}})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==D(e.audio)){var o=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};o((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"==D(e.video)){var a=e.video.facingMode;a=a&&("object"==D(a)?a:{ideal:a});var s,c=t.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||c)&&(delete e.video.facingMode,"environment"===a.exact||"environment"===a.ideal?s=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(s=["front"]),s))return r.mediaDevices.enumerateDevices().then((function(t){var r=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return s.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!r&&t.length&&s.includes("back")&&(r=t[t.length-1]),r&&(e.video.deviceId=a.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),YR("chrome: "+JSON.stringify(e)),i(e)}));e.video=n(e.video)}return YR("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){i(e,(function(e){r.webkitGetUserMedia(e,t,(function(e){n&&n(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){var a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return i(e,(function(e){return a(e).then((function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((function(e){e.stop()})),new DOMException("","NotFoundError");return t}),(function(e){return Rb.reject(o(e))}))}))}}}}function JR(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function zR(e){if("object"==D(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var r=this;return this._ontrackpoly||(this._ontrackpoly=function(t){t.stream.addEventListener("addtrack",(function(n){var i;i=e.RTCPeerConnection.prototype.getReceivers?r.getReceivers().find((function(e){return e.track&&e.track.id===n.track.id})):{track:n.track};var o=new Event("track");o.track=n.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],r.dispatchEvent(o)})),t.stream.getTracks().forEach((function(n){var i;i=e.RTCPeerConnection.prototype.getReceivers?r.getReceivers().find((function(e){return e.track&&e.track.id===n.id})):{track:n};var o=new Event("track");o.track=n,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],r.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else iv(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function XR(e){if("object"==D(e)&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};var r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){var i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach((function(e){r._senders.push(t(r,e))}))};var o=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){var r=t._senders.find((function(t){return t.track===e}));r&&t._senders.splice(t._senders.indexOf(r),1)}))}}else if("object"==D(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var a=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=a.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function ZR(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=Array.prototype.slice.call(arguments),n=r[0],i=r[1],o=r[2];if(arguments.length>0&&"function"==typeof n)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof n))return t.apply(this,[]);var a=function(e){var t={};return e.result().forEach((function(e){var r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){r[t]=e.stat(t)})),t[r.id]=r})),t},s=function(e){return new Map(Object.keys(e).map((function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){i(s(a(e)))};return t.apply(this,[c,n])}return new Rb((function(r,n){t.apply(e,[function(e){r(s(a(e)))},n])})).then(i,o)}}}function $R(e){if("object"==D(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return pv(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=n.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),iv(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return pv(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,r,n,o=arguments[0];return this.getSenders().forEach((function(e){e.track===o&&(t?n=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===o&&(r?n=!0:r=e),e.track===o})),n||t&&r?Rb.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Rb.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}}}function eT(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){if(t.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var n=this.getSenders();r.apply(this,arguments);var i=this.getSenders().filter((function(e){return-1===n.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(i)};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((function(r){var n=t._shimmedLocalStreams[r].indexOf(e);-1!==n&&t._shimmedLocalStreams[r].splice(n,1),1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]})),i.apply(this,arguments)}}function tT(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return eT(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=r.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var r=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){if(r.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var i=new e.MediaStream(t.getTracks());this._streams[t.id]=i,this._reverseStreams[i.id]=t,t=i}n.apply(this,[t])};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){var n=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find((function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var o=this.getSenders().find((function(e){return e.track===t}));if(o)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var a=this._streams[r.id];if(a)a.addTrack(t),Rb.resolve().then((function(){n.dispatchEvent(new Event("negotiationneeded"))}));else{var s=new e.MediaStream([t]);this._streams[r.id]=s,this._reverseStreams[s.id]=r,this.addStream(s)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=j({},t,(function(){var e=this,t=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[function(r){var n=s(e,r);t[0].apply(null,[n])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):r.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=n[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=c(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=a.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,r=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(e._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{},Object.keys(this._streams).forEach((function(n){r._streams[n].getTracks().find((function(t){return e.track===t}))&&(t=r._streams[n])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function s(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}function c(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}}function rT(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=j({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}))}function nT(e,t){iv(e,"negotiationneeded",(function(e){var r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var iT=Object.freeze({__proto__:null,shimMediaStream:JR,shimOnTrack:zR,shimGetSendersWithDtmf:XR,shimGetStats:ZR,shimSenderReceiverGetStats:$R,shimAddTrackRemoveTrackWithNative:eT,shimAddTrackRemoveTrack:tT,shimPeerConnection:rT,fixNegotiationNeeded:nT,shimGetUserMedia:qR,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((function(t){var n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),oT={exports:{}};!function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){var r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((function(e){return 0===e.indexOf(r)}))},t.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:r[t[n]]=t[n+1]}return r},t.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,r={},n=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<n.length;i++)r[(t=n[i].trim().split("="))[0].trim()]=t[1];return r},t.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var n=[];Object.keys(e.parameters).forEach((function(t){e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.getIceParameters=function(e,r){var n=t.splitLines(e);return{usernameFragment:(n=n.concat(t.splitLines(r))).filter((function(e){return 0===e.indexOf("a=ice-ufrag:")}))[0].substr(12),password:n.filter((function(e){return 0===e.indexOf("a=ice-pwd:")}))[0].substr(10)}},t.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},t.parseRtpParameters=function(e){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=t.splitLines(e)[0].split(" "),i=3;i<n.length;i++){var o=n[i],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=t.parseRtpMap(a),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){r.headerExtensions.push(t.parseExtmap(e))})),r},t.writeRtpDescription=function(e,r){var n="";n+="m="+e+" ",n+=r.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=r.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((function(e){n+=t.writeRtpMap(e),n+=t.writeFmtp(e),n+=t.writeRtcpFb(e)}));var i=0;return r.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),n+="a=rtcp-mux\r\n",r.headerExtensions&&r.headerExtensions.forEach((function(e){n+=t.writeExtmap(e)})),n},t.parseRtpEncodingParameters=function(e){var r,n=[],i=t.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),a=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(r=u[0][1]),i.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&r&&(t.rtx={ssrc:r}),n.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},n.push(t))}})),0===n.length&&c&&n.push({ssrc:c});var d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,n.forEach((function(e){e.maxBitrate=d}))),n},t.parseRtcpParameters=function(e){var r={},n=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];n&&(r.cname=n.value,r.ssrc=n.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=i.length>0,r.compound=0===i.length;var o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.parseMsid=function(e){var r,n=t.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(r=n[0].substr(7).split(" "))[0],track:r[1]};var i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return i.length>0?{stream:(r=i[0].value.split(" "))[0],track:r[1]}:void 0},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,n){var i=void 0!==r?r:2;return"v=0\r\no="+(n||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.writeMediaSection=function(e,r,n,i){var o=t.writeRtpDescription(e.kind,r);if(o+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":"active"),o+="a=mid:"+e.mid+"\r\n",e.direction?o+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";o+="a="+a,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+a,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+a,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+t.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+t.localCName+"\r\n"),o},t.getDirection=function(e,r){for(var n=t.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){var r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var r=t.splitLines(e),n=0;n<r.length;n++)if(r[n].length<2||"="!==r[n].charAt(1))return!1;return!0},e.exports=t}(oT);var aT=oT.exports;function sT(e,t,r,n,i){var o=aT.writeRtpDescription(e.kind,t);if(o+=aT.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=aT.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":i||"active"),o+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=a;var s="msid:"+(n?n.id:"-")+" "+a+"\r\n";o+="a="+s,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+s,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+s,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+aT.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+aT.localCName+"\r\n"),o}function cT(e,t){var r={codecs:[],headerExtensions:[],fecMechanisms:[]},n=function(e,t){e=parseInt(e,10);for(var r=0;r<t.length;r++)if(t[r].payloadType===e||t[r].preferredPayloadType===e)return t[r]},i=function(e,t,r,i){var o=n(e.parameters.apt,r),a=n(t.parameters.apt,i);return o&&a&&o.name.toLowerCase()===a.name.toLowerCase()};return e.codecs.forEach((function(n){for(var o=0;o<t.codecs.length;o++){var a=t.codecs[o];if(n.name.toLowerCase()===a.name.toLowerCase()&&n.clockRate===a.clockRate){if("rtx"===n.name.toLowerCase()&&n.parameters&&a.parameters.apt&&!i(n,a,e.codecs,t.codecs))continue;(a=JSON.parse(JSON.stringify(a))).numChannels=Math.min(n.numChannels,a.numChannels),r.codecs.push(a),a.rtcpFeedback=a.rtcpFeedback.filter((function(e){for(var t=0;t<n.rtcpFeedback.length;t++)if(n.rtcpFeedback[t].type===e.type&&n.rtcpFeedback[t].parameter===e.parameter)return!0;return!1}));break}}})),e.headerExtensions.forEach((function(e){for(var n=0;n<t.headerExtensions.length;n++){var i=t.headerExtensions[n];if(e.uri===i.uri){r.headerExtensions.push(i);break}}})),r}function uT(e,t,r){return-1!=={offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[t][e].indexOf(r)}function dT(e,t){var r=e.getRemoteCandidates().find((function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type}));return r||e.addRemoteCandidate(t),!r}function lT(e,t){var r=new Error(t);return r.name=e,r.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],r}var pT=function(e,t){function r(t,r){r.addTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function n(t,r,n,i){var o=new Event("track");o.track=r,o.receiver=n,o.transceiver={receiver:n},o.streams=i,e.setTimeout((function(){t._dispatchEvent("track",o)}))}var i=function(r){var n=this,i=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach((function(e){n[e]=i[e].bind(i)})),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",r=JSON.parse(JSON.stringify(r||{})),this.usingBundle="max-bundle"===r.bundlePolicy,"negotiate"===r.rtcpMuxPolicy)throw lT("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(r.rtcpMuxPolicy||(r.rtcpMuxPolicy="require"),r.iceTransportPolicy){case"all":case"relay":break;default:r.iceTransportPolicy="all"}switch(r.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:r.bundlePolicy="balanced"}if(r.iceServers=function(e,t){var r=!1;return(e=JSON.parse(JSON.stringify(e))).filter((function(e){if(e&&(e.urls||e.url)){var n=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var i="string"==typeof n;return i&&(n=[n]),n=n.filter((function(e){return 0!==e.indexOf("turn:")||-1===e.indexOf("transport=udp")||-1!==e.indexOf("turn:[")||r?0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp"):(r=!0,!0)})),delete e.url,e.urls=i?n[0]:n,!!n.length}}))}(r.iceServers||[],t),this._iceGatherers=[],r.iceCandidatePoolSize)for(var o=r.iceCandidatePoolSize;o>0;o--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:r.iceServers,gatherPolicy:r.iceTransportPolicy}));else r.iceCandidatePoolSize=0;this._config=r,this.transceivers=[],this._sdpSessionId=aT.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(i.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(i.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),i.prototype.onicecandidate=null,i.prototype.onaddstream=null,i.prototype.ontrack=null,i.prototype.onremovestream=null,i.prototype.onsignalingstatechange=null,i.prototype.oniceconnectionstatechange=null,i.prototype.onconnectionstatechange=null,i.prototype.onicegatheringstatechange=null,i.prototype.onnegotiationneeded=null,i.prototype.ondatachannel=null,i.prototype._dispatchEvent=function(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},i.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},i.prototype.getConfiguration=function(){return this._config},i.prototype.getLocalStreams=function(){return this.localStreams},i.prototype.getRemoteStreams=function(){return this.remoteStreams},i.prototype._createTransceiver=function(e,t){var r=this.transceivers.length>0,n={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&r)n.iceTransport=this.transceivers[0].iceTransport,n.dtlsTransport=this.transceivers[0].dtlsTransport;else{var i=this._createIceAndDtlsTransports();n.iceTransport=i.iceTransport,n.dtlsTransport=i.dtlsTransport}return t||this.transceivers.push(n),n},i.prototype.addTrack=function(t,r){if(this._isClosed)throw lT("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var n;if(this.transceivers.find((function(e){return e.track===t})))throw lT("InvalidAccessError","Track already exists.");for(var i=0;i<this.transceivers.length;i++)this.transceivers[i].track||this.transceivers[i].kind!==t.kind||(n=this.transceivers[i]);return n||(n=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(r)&&this.localStreams.push(r),n.track=t,n.stream=r,n.rtpSender=new e.RTCRtpSender(t,n.dtlsTransport),n.rtpSender},i.prototype.addStream=function(e){var r=this;if(t>=15025)e.getTracks().forEach((function(t){r.addTrack(t,e)}));else{var n=e.clone();e.getTracks().forEach((function(e,t){var r=n.getTracks()[t];e.addEventListener("enabled",(function(e){r.enabled=e.enabled}))})),n.getTracks().forEach((function(e){r.addTrack(e,n)}))}},i.prototype.removeTrack=function(t){if(this._isClosed)throw lT("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var r=this.transceivers.find((function(e){return e.rtpSender===t}));if(!r)throw lT("InvalidAccessError","Sender was not created by this connection.");var n=r.stream;r.rtpSender.stop(),r.rtpSender=null,r.track=null,r.stream=null,-1===this.transceivers.map((function(e){return e.stream})).indexOf(n)&&this.localStreams.indexOf(n)>-1&&this.localStreams.splice(this.localStreams.indexOf(n),1),this._maybeFireNegotiationNeeded()},i.prototype.removeStream=function(e){var t=this;e.getTracks().forEach((function(e){var r=t.getSenders().find((function(t){return t.track===e}));r&&t.removeTrack(r)}))},i.prototype.getSenders=function(){return this.transceivers.filter((function(e){return!!e.rtpSender})).map((function(e){return e.rtpSender}))},i.prototype.getReceivers=function(){return this.transceivers.filter((function(e){return!!e.rtpReceiver})).map((function(e){return e.rtpReceiver}))},i.prototype._createIceGatherer=function(t,r){var n=this;if(r&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var i=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(i,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var r=!e.candidate||0===Object.keys(e.candidate).length;i.state=r?"completed":"gathering",null!==n.transceivers[t].bufferedCandidateEvents&&n.transceivers[t].bufferedCandidateEvents.push(e)},i.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),i},i.prototype._gather=function(t,r){var n=this,i=this.transceivers[r].iceGatherer;if(!i.onlocalcandidate){var o=this.transceivers[r].bufferedCandidateEvents;this.transceivers[r].bufferedCandidateEvents=null,i.removeEventListener("localcandidate",this.transceivers[r].bufferCandidates),i.onlocalcandidate=function(e){if(!(n.usingBundle&&r>0)){var o=new Event("icecandidate");o.candidate={sdpMid:t,sdpMLineIndex:r};var a=e.candidate,s=!a||0===Object.keys(a).length;if(s)"new"!==i.state&&"gathering"!==i.state||(i.state="completed");else{"new"===i.state&&(i.state="gathering"),a.component=1,a.ufrag=i.getLocalParameters().usernameFragment;var c=aT.writeCandidate(a);o.candidate=Object.assign(o.candidate,aT.parseCandidate(c)),o.candidate.candidate=c,o.candidate.toJSON=function(){return{candidate:o.candidate.candidate,sdpMid:o.candidate.sdpMid,sdpMLineIndex:o.candidate.sdpMLineIndex,usernameFragment:o.candidate.usernameFragment}}}var u=aT.getMediaSections(n._localDescription.sdp);u[o.candidate.sdpMLineIndex]+=s?"a=end-of-candidates\r\n":"a="+o.candidate.candidate+"\r\n",n._localDescription.sdp=aT.getDescription(n._localDescription.sdp)+u.join("");var d=n.transceivers.every((function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state}));"gathering"!==n.iceGatheringState&&(n.iceGatheringState="gathering",n._emitGatheringStateChange()),s||n._dispatchEvent("icecandidate",o),d&&(n._dispatchEvent("icecandidate",new Event("icecandidate")),n.iceGatheringState="complete",n._emitGatheringStateChange())}},e.setTimeout((function(){o.forEach((function(e){i.onlocalcandidate(e)}))}),0)}},i.prototype._createIceAndDtlsTransports=function(){var t=this,r=new e.RTCIceTransport(null);r.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var n=new e.RTCDtlsTransport(r);return n.ondtlsstatechange=function(){t._updateConnectionState()},n.onerror=function(){Object.defineProperty(n,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:r,dtlsTransport:n}},i.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var r=this.transceivers[e].iceTransport;r&&(delete r.onicestatechange,delete this.transceivers[e].iceTransport);var n=this.transceivers[e].dtlsTransport;n&&(delete n.ondtlsstatechange,delete n.onerror,delete this.transceivers[e].dtlsTransport)},i.prototype._transceive=function(e,r,n){var i=cT(e.localCapabilities,e.remoteCapabilities);r&&e.rtpSender&&(i.encodings=e.sendEncodingParameters,i.rtcp={cname:aT.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(i.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(i)),n&&e.rtpReceiver&&i.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach((function(e){delete e.rtx})),e.recvEncodingParameters.length?i.encodings=e.recvEncodingParameters:i.encodings=[{}],i.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(i.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(i.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(i))},i.prototype.setLocalDescription=function(e){var t,r,n=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(lT("TypeError",'Unsupported type "'+e.type+'"'));if(!uT("setLocalDescription",e.type,n.signalingState)||n._isClosed)return Promise.reject(lT("InvalidStateError","Can not set local "+e.type+" in state "+n.signalingState));if("offer"===e.type)t=aT.splitSections(e.sdp),r=t.shift(),t.forEach((function(e,t){var r=aT.parseRtpParameters(e);n.transceivers[t].localCapabilities=r})),n.transceivers.forEach((function(e,t){n._gather(e.mid,t)}));else if("answer"===e.type){t=aT.splitSections(n._remoteDescription.sdp),r=t.shift();var i=aT.matchPrefix(r,"a=ice-lite").length>0;t.forEach((function(e,t){var o=n.transceivers[t],a=o.iceGatherer,s=o.iceTransport,c=o.dtlsTransport,u=o.localCapabilities,d=o.remoteCapabilities;if(!(aT.isRejected(e)&&0===aT.matchPrefix(e,"a=bundle-only").length||o.rejected)){var l=aT.getIceParameters(e,r),p=aT.getDtlsParameters(e,r);i&&(p.role="server"),n.usingBundle&&0!==t||(n._gather(o.mid,t),"new"===s.state&&s.start(a,l,i?"controlling":"controlled"),"new"===c.state&&c.start(p));var f=cT(u,d);n._transceive(o,f.codecs.length>0,!1)}}))}return n._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?n._updateSignalingState("have-local-offer"):n._updateSignalingState("stable"),Promise.resolve()},i.prototype.setRemoteDescription=function(i){var o=this;if(-1===["offer","answer"].indexOf(i.type))return Promise.reject(lT("TypeError",'Unsupported type "'+i.type+'"'));if(!uT("setRemoteDescription",i.type,o.signalingState)||o._isClosed)return Promise.reject(lT("InvalidStateError","Can not set remote "+i.type+" in state "+o.signalingState));var a={};o.remoteStreams.forEach((function(e){a[e.id]=e}));var s=[],c=aT.splitSections(i.sdp),u=c.shift(),d=aT.matchPrefix(u,"a=ice-lite").length>0,l=aT.matchPrefix(u,"a=group:BUNDLE ").length>0;o.usingBundle=l;var p=aT.matchPrefix(u,"a=ice-options:")[0];return o.canTrickleIceCandidates=!!p&&p.substr(14).split(" ").indexOf("trickle")>=0,c.forEach((function(n,c){var p=aT.splitLines(n),f=aT.getKind(n),h=aT.isRejected(n)&&0===aT.matchPrefix(n,"a=bundle-only").length,A=p[0].substr(2).split(" ")[2],v=aT.getDirection(n,u),g=aT.parseMsid(n),m=aT.getMid(n)||aT.generateIdentifier();if(h||"application"===f&&("DTLS/SCTP"===A||"UDP/DTLS/SCTP"===A))o.transceivers[c]={mid:m,kind:f,protocol:A,rejected:!0};else{var E,_,y,I,S,b,C,w,R;!h&&o.transceivers[c]&&o.transceivers[c].rejected&&(o.transceivers[c]=o._createTransceiver(f,!0));var T,k,O=aT.parseRtpParameters(n);h||(T=aT.getIceParameters(n,u),(k=aT.getDtlsParameters(n,u)).role="client"),C=aT.parseRtpEncodingParameters(n);var D=aT.parseRtcpParameters(n),N=aT.matchPrefix(n,"a=end-of-candidates",u).length>0,x=aT.matchPrefix(n,"a=candidate:").map((function(e){return aT.parseCandidate(e)})).filter((function(e){return 1===e.component}));if(("offer"===i.type||"answer"===i.type)&&!h&&l&&c>0&&o.transceivers[c]&&(o._disposeIceAndDtlsTransports(c),o.transceivers[c].iceGatherer=o.transceivers[0].iceGatherer,o.transceivers[c].iceTransport=o.transceivers[0].iceTransport,o.transceivers[c].dtlsTransport=o.transceivers[0].dtlsTransport,o.transceivers[c].rtpSender&&o.transceivers[c].rtpSender.setTransport(o.transceivers[0].dtlsTransport),o.transceivers[c].rtpReceiver&&o.transceivers[c].rtpReceiver.setTransport(o.transceivers[0].dtlsTransport)),"offer"!==i.type||h)"answer"!==i.type||h||(_=(E=o.transceivers[c]).iceGatherer,y=E.iceTransport,I=E.dtlsTransport,S=E.rtpReceiver,b=E.sendEncodingParameters,w=E.localCapabilities,o.transceivers[c].recvEncodingParameters=C,o.transceivers[c].remoteCapabilities=O,o.transceivers[c].rtcpParameters=D,x.length&&"new"===y.state&&(!d&&!N||l&&0!==c?x.forEach((function(e){dT(E.iceTransport,e)})):y.setRemoteCandidates(x)),l&&0!==c||("new"===y.state&&y.start(_,T,"controlling"),"new"===I.state&&I.start(k)),!cT(E.localCapabilities,E.remoteCapabilities).codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&E.sendEncodingParameters[0].rtx&&delete E.sendEncodingParameters[0].rtx,o._transceive(E,"sendrecv"===v||"recvonly"===v,"sendrecv"===v||"sendonly"===v),!S||"sendrecv"!==v&&"sendonly"!==v?delete E.rtpReceiver:(R=S.track,g?(a[g.stream]||(a[g.stream]=new e.MediaStream),r(R,a[g.stream]),s.push([R,S,a[g.stream]])):(a.default||(a.default=new e.MediaStream),r(R,a.default),s.push([R,S,a.default]))));else{(E=o.transceivers[c]||o._createTransceiver(f)).mid=m,E.iceGatherer||(E.iceGatherer=o._createIceGatherer(c,l)),x.length&&"new"===E.iceTransport.state&&(!N||l&&0!==c?x.forEach((function(e){dT(E.iceTransport,e)})):E.iceTransport.setRemoteCandidates(x)),w=e.RTCRtpReceiver.getCapabilities(f),t<15019&&(w.codecs=w.codecs.filter((function(e){return"rtx"!==e.name}))),b=E.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var P,L=!1;"sendrecv"===v||"sendonly"===v?(L=!E.rtpReceiver,S=E.rtpReceiver||new e.RTCRtpReceiver(E.dtlsTransport,f),L&&(R=S.track,g&&"-"===g.stream||(g?(a[g.stream]||(a[g.stream]=new e.MediaStream,Object.defineProperty(a[g.stream],"id",{get:function(){return g.stream}})),Object.defineProperty(R,"id",{get:function(){return g.track}}),P=a[g.stream]):(a.default||(a.default=new e.MediaStream),P=a.default)),P&&(r(R,P),E.associatedRemoteMediaStreams.push(P)),s.push([R,S,P]))):E.rtpReceiver&&E.rtpReceiver.track&&(E.associatedRemoteMediaStreams.forEach((function(t){var r=t.getTracks().find((function(e){return e.id===E.rtpReceiver.track.id}));r&&function(t,r){r.removeTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}(r,t)})),E.associatedRemoteMediaStreams=[]),E.localCapabilities=w,E.remoteCapabilities=O,E.rtpReceiver=S,E.rtcpParameters=D,E.sendEncodingParameters=b,E.recvEncodingParameters=C,o._transceive(o.transceivers[c],!1,L)}}})),void 0===o._dtlsRole&&(o._dtlsRole="offer"===i.type?"active":"passive"),o._remoteDescription={type:i.type,sdp:i.sdp},"offer"===i.type?o._updateSignalingState("have-remote-offer"):o._updateSignalingState("stable"),Object.keys(a).forEach((function(t){var r=a[t];if(r.getTracks().length){if(-1===o.remoteStreams.indexOf(r)){o.remoteStreams.push(r);var i=new Event("addstream");i.stream=r,e.setTimeout((function(){o._dispatchEvent("addstream",i)}))}s.forEach((function(e){var t=e[0],i=e[1];r.id===e[2].id&&n(o,t,i,[r])}))}})),s.forEach((function(e){e[2]||n(o,e[0],e[1],[])})),e.setTimeout((function(){o&&o.transceivers&&o.transceivers.forEach((function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))}))}),4e3),Promise.resolve()},i.prototype.close=function(){this.transceivers.forEach((function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()})),this._isClosed=!0,this._updateSignalingState("closed")},i.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},i.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout((function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}}),0))},i.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++})),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var r=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",r)}},i.prototype._updateConnectionState=function(){var e,t={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&e.dtlsTransport&&!e.rejected&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)})),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var r=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",r)}},i.prototype.createOffer=function(){var r=this;if(r._isClosed)return Promise.reject(lT("InvalidStateError","Can not call createOffer after close"));var n=r.transceivers.filter((function(e){return"audio"===e.kind})).length,i=r.transceivers.filter((function(e){return"video"===e.kind})).length,o=arguments[0];if(o){if(o.mandatory||o.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==o.offerToReceiveAudio&&(n=!0===o.offerToReceiveAudio?1:!1===o.offerToReceiveAudio?0:o.offerToReceiveAudio),void 0!==o.offerToReceiveVideo&&(i=!0===o.offerToReceiveVideo?1:!1===o.offerToReceiveVideo?0:o.offerToReceiveVideo)}for(r.transceivers.forEach((function(e){"audio"===e.kind?--n<0&&(e.wantReceive=!1):"video"===e.kind&&--i<0&&(e.wantReceive=!1)}));n>0||i>0;)n>0&&(r._createTransceiver("audio"),n--),i>0&&(r._createTransceiver("video"),i--);var a=aT.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.transceivers.forEach((function(n,i){var o=n.track,a=n.kind,s=n.mid||aT.generateIdentifier();n.mid=s,n.iceGatherer||(n.iceGatherer=r._createIceGatherer(i,r.usingBundle));var c=e.RTCRtpSender.getCapabilities(a);t<15019&&(c.codecs=c.codecs.filter((function(e){return"rtx"!==e.name}))),c.codecs.forEach((function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),n.remoteCapabilities&&n.remoteCapabilities.codecs&&n.remoteCapabilities.codecs.forEach((function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)}))})),c.headerExtensions.forEach((function(e){(n.remoteCapabilities&&n.remoteCapabilities.headerExtensions||[]).forEach((function(t){e.uri===t.uri&&(e.id=t.id)}))}));var u=n.sendEncodingParameters||[{ssrc:1001*(2*i+1)}];o&&t>=15019&&"video"===a&&!u[0].rtx&&(u[0].rtx={ssrc:u[0].ssrc+1}),n.wantReceive&&(n.rtpReceiver=new e.RTCRtpReceiver(n.dtlsTransport,a)),n.localCapabilities=c,n.sendEncodingParameters=u})),"max-compat"!==r._config.bundlePolicy&&(a+="a=group:BUNDLE "+r.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),a+="a=ice-options:trickle\r\n",r.transceivers.forEach((function(e,t){a+=sT(e,e.localCapabilities,"offer",e.stream,r._dtlsRole),a+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===r.iceGatheringState||0!==t&&r.usingBundle||(e.iceGatherer.getLocalCandidates().forEach((function(e){e.component=1,a+="a="+aT.writeCandidate(e)+"\r\n"})),"completed"===e.iceGatherer.state&&(a+="a=end-of-candidates\r\n"))}));var s=new e.RTCSessionDescription({type:"offer",sdp:a});return Promise.resolve(s)},i.prototype.createAnswer=function(){var r=this;if(r._isClosed)return Promise.reject(lT("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==r.signalingState&&"have-local-pranswer"!==r.signalingState)return Promise.reject(lT("InvalidStateError","Can not call createAnswer in signalingState "+r.signalingState));var n=aT.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.usingBundle&&(n+="a=group:BUNDLE "+r.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),n+="a=ice-options:trickle\r\n";var i=aT.getMediaSections(r._remoteDescription.sdp).length;r.transceivers.forEach((function(e,o){if(!(o+1>i)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?n+="m=application 0 DTLS/SCTP 5000\r\n":n+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?n+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(n+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(n+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var a;e.stream&&("audio"===e.kind?a=e.stream.getAudioTracks()[0]:"video"===e.kind&&(a=e.stream.getVideoTracks()[0]),a&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1}));var s=cT(e.localCapabilities,e.remoteCapabilities);!s.codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,n+=sT(e,s,"answer",e.stream,r._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(n+="a=rtcp-rsize\r\n")}}));var o=new e.RTCSessionDescription({type:"answer",sdp:n});return Promise.resolve(o)},i.prototype.addIceCandidate=function(e){var t,r=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise((function(n,i){if(!r._remoteDescription)return i(lT("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var o=e.sdpMLineIndex;if(e.sdpMid)for(var a=0;a<r.transceivers.length;a++)if(r.transceivers[a].mid===e.sdpMid){o=a;break}var s=r.transceivers[o];if(!s)return i(lT("OperationError","Can not add ICE candidate"));if(s.rejected)return n();var c=Object.keys(e.candidate).length>0?aT.parseCandidate(e.candidate):{};if("tcp"===c.protocol&&(0===c.port||9===c.port))return n();if(c.component&&1!==c.component)return n();if((0===o||o>0&&s.iceTransport!==r.transceivers[0].iceTransport)&&!dT(s.iceTransport,c))return i(lT("OperationError","Can not add ICE candidate"));var u=e.candidate.trim();0===u.indexOf("a=")&&(u=u.substr(2)),(t=aT.getMediaSections(r._remoteDescription.sdp))[o]+="a="+(c.type?u:"end-of-candidates")+"\r\n",r._remoteDescription.sdp=aT.getDescription(r._remoteDescription.sdp)+t.join("")}else for(var d=0;d<r.transceivers.length&&(r.transceivers[d].rejected||(r.transceivers[d].iceTransport.addRemoteCandidate({}),(t=aT.getMediaSections(r._remoteDescription.sdp))[d]+="a=end-of-candidates\r\n",r._remoteDescription.sdp=aT.getDescription(r._remoteDescription.sdp)+t.join(""),!r.usingBundle));d++);n()}))},i.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var r=null;if(this.transceivers.forEach((function(e){e.rtpSender&&e.rtpSender.track===t?r=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(r=e.rtpReceiver)})),!r)throw lT("InvalidAccessError","Invalid selector.");return r.getStats()}var n=[];return this.transceivers.forEach((function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach((function(t){e[t]&&n.push(e[t].getStats())}))})),Promise.all(n).then((function(e){var t=new Map;return e.forEach((function(e){e.forEach((function(e){t.set(e.id,e)}))})),t}))},["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach((function(t){var r=e[t];if(r&&r.prototype&&r.prototype.getStats){var n=r.prototype.getStats;r.prototype.getStats=function(){return n.apply(this).then((function(e){var t=new Map;return Object.keys(e).forEach((function(r){var n;e[r].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(n=e[r]).type]||n.type,t.set(r,e[r])})),t}))}}}));var o=["createOffer","createAnswer"];return o.forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?t.apply(this,[arguments[2]]).then((function(t){"function"==typeof e[0]&&e[0].apply(null,[t])}),(function(t){"function"==typeof e[1]&&e[1].apply(null,[t])})):t.apply(this,arguments)}})),(o=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)}),(function(t){"function"==typeof e[2]&&e[2].apply(null,[t])})):t.apply(this,arguments)}})),["getStats"].forEach((function(e){var t=i.prototype[e];i.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)})):t.apply(this,arguments)}})),i};function fT(e){var t=e&&e.navigator,r=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return r(e).catch((function(e){return Rb.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString:function(){return this.name}}}(e))}))}}function hT(e){"getDisplayMedia"in e.navigator&&e.navigator.mediaDevices&&(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)))}function AT(e,t){if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){var r=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set:function(e){r.set.call(this,e);var t=new Event("enabled");t.enabled=e,this.dispatchEvent(t)}})}e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)&&Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);var n=pT(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=function(e,t){var r=!1;return(e=JSON.parse(JSON.stringify(e))).filter((function(e){if(e&&(e.urls||e.url)){var t=e.urls||e.url;e.url&&!e.urls&&cv("RTCIceServer.url","RTCIceServer.urls");var n="string"==typeof t;return n&&(t=[t]),t=t.filter((function(e){if(0===e.indexOf("stun:"))return!1;var t=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return t&&!r?(r=!0,!0):t&&!r})),delete e.url,e.urls=n?t[0]:t,!!t.length}}))}(e.iceServers,t.version),sv("ICE servers after filtering:",e.iceServers)),new n(e)},e.RTCPeerConnection.prototype=n.prototype}function vT(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}var gT=Object.freeze({__proto__:null,shimPeerConnection:AT,shimReplaceTrack:vT,shimGetUserMedia:fT,shimGetDisplayMedia:hT}),mT=fi,ET=hi,_T=p,yT=fe,IT=se,ST=aa,bT=_s,CT=hr.exports;if(mT({target:"Promise",proto:!0,real:!0,forced:!!ET&&_T((function(){ET.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=ST(this,yT("Promise")),r=IT(e);return this.then(r?function(r){return bT(t,e()).then((function(){return r}))}:e,r?function(r){return bT(t,e()).then((function(){throw r}))}:e)}}),IT(ET)){var wT=yT("Promise").prototype.finally;ET.prototype.finally!==wT&&CT(ET.prototype,"finally",wT,{unsafe:!0})}function RT(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){cv("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},o=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"==D(e)&&"object"==D(e.audio)&&(e=JSON.parse(JSON.stringify(e)),i(e.audio,"autoGainControl","mozAutoGainControl"),i(e.audio,"noiseSuppression","mozNoiseSuppression")),o(e)},n&&n.prototype.getSettings){var a=n.prototype.getSettings;n.prototype.getSettings=function(){var e=a.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var s=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"==D(e)&&(e=JSON.parse(JSON.stringify(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}}function TT(e){"object"==D(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function kT(e,t){if("object"==D(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=j({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}));var r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),i=e[0],o=e[1],a=e[2];return n.apply(this,[i||null]).then((function(e){if(t.version<53&&!o)try{e.forEach((function(e){e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach((function(t,n){e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function OT(e){if("object"==D(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Rb.resolve(new Map)}}}function DT(e){if("object"==D(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r}),iv(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function NT(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;cv("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function xT(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function PT(e){if("object"==D(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],r=e&&"sendEncodings"in e;r&&e.sendEncodings.forEach((function(e){if("rid"in e&&!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var n=t.apply(this,arguments);if(r){var i=n.sender,o=i.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e.sendEncodings,i.sendEncodings=e.sendEncodings,this.setParametersPromises.push(i.setParameters(o).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return n})}}function LT(e){if("object"==D(e)&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function BT(e){if("object"==D(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=arguments,r=this;return this.setParametersPromises&&this.setParametersPromises.length?Rb.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}function MT(e){if("object"==D(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=arguments,r=this;return this.setParametersPromises&&this.setParametersPromises.length?Rb.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}var UT=Object.freeze({__proto__:null,shimOnTrack:TT,shimPeerConnection:kT,shimSenderGetStats:OT,shimReceiverGetStats:DT,shimRemoveStream:NT,shimRTCDataChannel:xT,shimAddTransceiver:PT,shimGetParameters:LT,shimCreateOffer:BT,shimCreateAnswer:MT,shimGetUserMedia:RT,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){var n=new DOMException("getDisplayMedia without video constraints is undefined");return n.name="NotFoundError",n.code=8,Rb.reject(n)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}});function QT(e){if("object"==D(e)&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(n){return t.call(r,n,e)})),e.getVideoTracks().forEach((function(n){return t.call(r,n,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var r=this,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return i&&i.forEach((function(e){r._localStreams?r._localStreams.includes(e)||r._localStreams.push(e):r._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var r=this._localStreams.indexOf(e);if(-1!==r){this._localStreams.splice(r,1);var n=e.getTracks();this.getSenders().forEach((function(e){n.includes(e.track)&&t.removeTrack(e)}))}})}}function FT(e){if("object"==D(e)&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){var t=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(e){if(t._remoteStreams||(t._remoteStreams=[]),!t._remoteStreams.includes(e)){t._remoteStreams.push(e);var r=new Event("addstream");r.stream=e,t.dispatchEvent(r)}}))})}});var t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((function(t){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}}))}),t.apply(e,arguments)}}}function jT(e){if("object"==D(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Rb.resolve()):i},t.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Rb.resolve()):i};var s=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),Rb.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),Rb.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){var n=a.apply(this,[e]);return r?(n.then(t,r),Rb.resolve()):n},t.addIceCandidate=s}}function VT(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var r=t.mediaDevices,n=r.getUserMedia.bind(r);t.mediaDevices.getUserMedia=function(e){return n(GT(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function GT(e){return e&&void 0!==e.video?Object.assign({},e,{video:lv(e.video)}):e}function KT(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var n=[],i=0;i<e.iceServers.length;i++){var o=e.iceServers[i];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(cv("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,n.push(o)):n.push(e.iceServers[i])}e.iceServers=n}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function HT(e){"object"==D(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function WT(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var r=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveAudio||r||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var n=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video")}return t.apply(this,arguments)}}function YT(e){"object"!=D(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var qT=Object.freeze({__proto__:null,shimLocalStreamsAPI:QT,shimRemoteStreamsAPI:FT,shimCallbacksAPI:jT,shimGetUserMedia:VT,shimConstraints:GT,shimRTCIceServerUrls:KT,shimTrackEventTransceiver:HT,shimCreateOfferLegacy:WT,shimAudioContext:YT}),JT="\t\n\v\f\r \u2028\u2029\ufeff",zT=Mu,XT=Lm,ZT=iu("".replace),$T="[\t\n\v\f\r \u2028\u2029\ufeff]",ek=RegExp("^"+$T+$T+"*"),tk=RegExp($T+$T+"*$"),rk=function(e){return function(t){var r=XT(zT(t));return 1&e&&(r=ZT(r,ek,"")),2&e&&(r=ZT(r,tk,"")),r}},nk={start:rk(1),end:rk(2),trim:rk(3)},ik=FE.PROPER,ok=Xc,ak=JT,sk=nk.trim;gp({target:"String",proto:!0,forced:function(e){return ok((function(){return!!ak[e]()||"
"!=="
"[e]()||ik&&ak[e].name!==e}))}("trim")},{trim:function(){return sk(this)}});var ck=Qp("String").trim,uk=ou,dk=ck,lk=String.prototype,pk=function(e){var t=e.trim;return"string"==typeof e||e===lk||uk(lk,e)&&t===lk.trim?dk:t},fk=m;fi({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return fk(URL.prototype.toString,this)}});var hk={exports:{}};!function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return pk(e).call(e).split("\n").map((function(e){return pk(e).call(e)}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){var r;return pk(r=t>0?"m="+e:e).call(r)+"\r\n"}))},t.getDescription=function(e){var r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){var r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((function(e){return 0===e.indexOf(r)}))},t.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:r[t[n]]=t[n+1]}return r},t.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,r={},n=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<n.length;i++){var o,a;t=pk(o=n[i]).call(o).split("="),r[pk(a=t[0]).call(a)]=t[1]}return r},t.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var n=[];Object.keys(e.parameters).forEach((function(t){e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==D(e.keyParams)?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){var n=t.matchPrefix(e+r,"a=ice-ufrag:")[0],i=t.matchPrefix(e+r,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substr(12),password:i.substr(10)}:null},t.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},t.parseRtpParameters=function(e){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=t.splitLines(e)[0].split(" "),i=3;i<n.length;i++){var o=n[i],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=t.parseRtpMap(a),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){r.headerExtensions.push(t.parseExtmap(e))})),r},t.writeRtpDescription=function(e,r){var n="";n+="m="+e+" ",n+=r.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=r.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((function(e){n+=t.writeRtpMap(e),n+=t.writeFmtp(e),n+=t.writeRtcpFb(e)}));var i=0;return r.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),n+="a=rtcp-mux\r\n",r.headerExtensions&&r.headerExtensions.forEach((function(e){n+=t.writeExtmap(e)})),n},t.parseRtpEncodingParameters=function(e){var r,n=[],i=t.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),a=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(r=u[0][1]),i.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&r&&(t.rtx={ssrc:r}),n.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},n.push(t))}})),0===n.length&&c&&n.push({ssrc:c});var d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,n.forEach((function(e){e.maxBitrate=d}))),n},t.parseRtcpParameters=function(e){var r={},n=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];n&&(r.cname=n.value,r.ssrc=n.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=i.length>0,r.compound=0===i.length;var o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.parseMsid=function(e){var r,n=t.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(r=n[0].substr(7).split(" "))[0],track:r[1]};var i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return i.length>0?{stream:(r=i[0].value.split(" "))[0],track:r[1]}:void 0},t.parseSctpDescription=function(e){var r,n=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(r=parseInt(i[0].substr(19),10)),isNaN(r)&&(r=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:n.fmt,maxMessageSize:r};if(t.matchPrefix(e,"a=sctpmap:").length>0){var a=t.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(a[0],10),protocol:a[1],maxMessageSize:r}}},t.writeSctpDescription=function(e,t){var r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,n){var i=void 0!==r?r:2;return"v=0\r\no="+(n||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.writeMediaSection=function(e,r,n,i){var o=t.writeRtpDescription(e.kind,r);if(o+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===n?"actpass":"active"),o+="a=mid:"+e.mid+"\r\n",e.direction?o+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var a="msid:"+i.id+" "+e.rtpSender.track.id+"\r\n";o+="a="+a,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+a,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+a,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+t.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+t.localCName+"\r\n"),o},t.getDirection=function(e,r){for(var n=t.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){var r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var r=t.splitLines(e),n=0;n<r.length;n++)if(r[n].length<2||"="!==r[n].charAt(1))return!1;return!0},e.exports=t}(hk);var Ak=hk.exports;function vk(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==D(e)&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var r=new t(e),n=Ak.parseCandidate(e.candidate),i=Object.assign(r,n);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,iv(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function gk(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var r=function(e){if(!e||!e.sdp)return!1;var t=Ak.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=Ak.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},n=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var r=parseInt(t[1],10);return r!=r?-1:r},i=function(e){var r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r},o=function(e,r){var n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);var i=Ak.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76&&"plan-b"===this.getConfiguration().sdpSemantics&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0}),r(arguments[0])){var e,s=n(arguments[0]),c=i(s),u=o(arguments[0],s);e=0===c&&0===u?Number.POSITIVE_INFINITY:0===c||0===u?Math.max(c,u):Math.min(c,u);var d={};Object.defineProperty(d,"maxMessageSize",{get:function(){return e}}),this._sctp=d}return a.apply(this,arguments)}}}function mk(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return r(e,this),e},iv(e,"datachannel",(function(e){return r(e.channel,e.target),e}))}function r(e,t){var r=e.send;e.send=function(){var n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}}function Ek(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(e){var r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}}function _k(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var n=t.sdp.split("\n").filter((function(e){return"a=extmap-allow-mixed"!==pk(e).call(e)})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return r.apply(this,arguments)}}}function yk(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Rb.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Rb.resolve())})}}var Ik,Sk,bk=Object.freeze({__proto__:null,shimRTCIceCandidate:vk,shimMaxMessageSize:gk,shimSendThrowTypeError:mk,shimConnectionState:Ek,removeExtmapAllowMixed:_k,shimAddIceCandidateNullOrEmpty:yk});!function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).window,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0},r=sv,n=uv(e),i={browserDetails:n,commonShim:bk,extractVersion:nv,disableLog:ov,disableWarnings:av};switch(n.browser){case"chrome":if(!iT||!rT||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),i;if(null===n.version)return r("Chrome shim can not determine version, not shimming."),i;r("adapter.js shimming chrome."),i.browserShim=iT,yk(e,n),qR(e,n),JR(e),rT(e,n),zR(e),tT(e,n),XR(e),ZR(e),$R(e),nT(e,n),vk(e),Ek(e),gk(e,n),mk(e),_k(e,n);break;case"firefox":if(!UT||!kT||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),i;r("adapter.js shimming firefox."),i.browserShim=UT,yk(e,n),RT(e,n),kT(e,n),TT(e),NT(e),OT(e),DT(e),xT(e),PT(e),LT(e),BT(e),MT(e),vk(e),Ek(e),gk(e,n),mk(e);break;case"edge":if(!gT||!AT||!t.shimEdge)return r("MS edge shim is not included in this adapter release."),i;r("adapter.js shimming edge."),i.browserShim=gT,fT(e),hT(e),AT(e,n),vT(e),gk(e,n),mk(e);break;case"safari":if(!qT||!t.shimSafari)return r("Safari shim is not included in this adapter release."),i;r("adapter.js shimming safari."),i.browserShim=qT,yk(e,n),KT(e),WT(e),jT(e),QT(e),FT(e),HT(e),VT(e),YT(e),vk(e),gk(e,n),mk(e),_k(e,n);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window}),function(e){e.WIN_10="Windows 10",e.WIN_81="Windows 8.1",e.WIN_8="Windows 8",e.WIN_7="Windows 7",e.WIN_VISTA="Windows Vista",e.WIN_SERVER_2003="Windows Server 2003",e.WIN_XP="Windows XP",e.WIN_2000="Windows 2000",e.ANDROID="Android",e.OPEN_BSD="Open BSD",e.SUN_OS="Sun OS",e.LINUX="Linux",e.IOS="iOS",e.MAC_OS="Mac OS",e.QNX="QNX",e.UNIX="UNIX",e.BEOS="BeOS",e.OS_2="OS/2",e.SEARCH_BOT="Search Bot"}(Ik||(Ik={})),function(e){e.CHROME="Chrome",e.SAFARI="Safari",e.EDGE="Edge",e.FIREFOX="Firefox",e.OPERA="OPR",e.QQ="QQBrowser",e.WECHAT="MicroMessenger"}(Sk||(Sk={}));var Ck={exports:{}};
|
|
2
|
+
/*!@license
|
|
3
|
+
* UAParser.js v0.7.28
|
|
4
|
+
* Lightweight JavaScript-based User-Agent string parser
|
|
5
|
+
* https://github.com/faisalman/ua-parser-js
|
|
6
|
+
*
|
|
7
|
+
* Copyright © 2012-2021 Faisal Salman <f@faisalman.com>
|
|
8
|
+
* Licensed under MIT License
|
|
9
|
+
*/!function(e,t){!function(r,n){var i="function",o="object",a="string",s="model",c="name",u="type",d="vendor",l="version",p="architecture",f="console",h="mobile",A="tablet",v="smarttv",g="wearable",m="embedded",E={extend:function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r},has:function(e,t){return D(e)===a&&-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()},major:function(e){return D(e)===a?e.replace(/[^\d\.]/g,"").split(".")[0]:n},trim:function(e,t){return e=e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),void 0===t?e:e.substring(0,255)}},_={rgx:function(e,t){for(var r,a,s,c,u,d,l=0;l<t.length&&!u;){var p=t[l],f=t[l+1];for(r=a=0;r<p.length&&!u;)if(u=p[r++].exec(e))for(s=0;s<f.length;s++)d=u[++a],D(c=f[s])===o&&c.length>0?2==c.length?D(c[1])==i?this[c[0]]=c[1].call(this,d):this[c[0]]=c[1]:3==c.length?D(c[1])!==i||c[1].exec&&c[1].test?this[c[0]]=d?d.replace(c[1],c[2]):n:this[c[0]]=d?c[1].call(this,d,c[2]):n:4==c.length&&(this[c[0]]=d?c[3].call(this,d.replace(c[1],c[2])):n):this[c]=d||n;l+=2}},str:function(e,t){for(var r in t)if(D(t[r])===o&&t[r].length>0){for(var i=0;i<t[r].length;i++)if(E.has(t[r][i],e))return"?"===r?n:r}else if(E.has(t[r],e))return"?"===r?n:r;return e}},y={browser:{oldSafari:{version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}},oldEdge:{version:{.1:"12.",21:"13.",31:"14.",39:"15.",41:"16.",42:"17.",44:"18."}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"}}}},I={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[l,[c,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[l,[c,"Edge"]],[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]{3,6})\b.+version\/([\w\.-]+)/i,/(opera)(?:.+version\/|[\/\s]+)([\w\.]+)/i],[c,l],[/opios[\/\s]+([\w\.]+)/i],[l,[c,"Opera Mini"]],[/\sopr\/([\w\.]+)/i],[l,[c,"Opera"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]*)/i,/(avant\s|iemobile|slim)(?:browser)?[\/\s]?([\w\.]*)/i,/(ba?idubrowser)[\/\s]?([\w\.]+)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon)\/([\w\.-]+)/i,/(rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([\w\.]+)/i,/(weibo)__([\d\.]+)/i],[c,l],[/(?:[\s\/]uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i],[l,[c,"UCBrowser"]],[/(?:windowswechat)?\sqbcore\/([\w\.]+)\b.*(?:windowswechat)?/i],[l,[c,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[l,[c,"WeChat"]],[/konqueror\/([\w\.]+)/i],[l,[c,"Konqueror"]],[/trident.+rv[:\s]([\w\.]{1,9})\b.+like\sgecko/i],[l,[c,"IE"]],[/yabrowser\/([\w\.]+)/i],[l,[c,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[c,/(.+)/,"$1 Secure Browser"],l],[/focus\/([\w\.]+)/i],[l,[c,"Firefox Focus"]],[/opt\/([\w\.]+)/i],[l,[c,"Opera Touch"]],[/coc_coc_browser\/([\w\.]+)/i],[l,[c,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[l,[c,"Dolphin"]],[/coast\/([\w\.]+)/i],[l,[c,"Opera Coast"]],[/xiaomi\/miuibrowser\/([\w\.]+)/i],[l,[c,"MIUI Browser"]],[/fxios\/([\w\.-]+)/i],[l,[c,"Firefox"]],[/(qihu|qhbrowser|qihoobrowser|360browser)/i],[[c,"360 Browser"]],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[[c,/(.+)/,"$1 Browser"],l],[/(comodo_dragon)\/([\w\.]+)/i],[[c,/_/g," "],l],[/\s(electron)\/([\w\.]+)\ssafari/i,/(tesla)(?:\sqtcarbrowser|\/(20[12]\d\.[\w\.-]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/\s]?([\w\.]+)/i],[c,l],[/(MetaSr)[\/\s]?([\w\.]+)/i,/(LBBROWSER)/i],[c],[/;fbav\/([\w\.]+);/i],[l,[c,"Facebook"]],[/FBAN\/FBIOS|FB_IAB\/FB4A/i],[[c,"Facebook"]],[/safari\s(line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/\s]([\w\.-]+)/i],[c,l],[/\bgsa\/([\w\.]+)\s.*safari\//i],[l,[c,"GSA"]],[/headlesschrome(?:\/([\w\.]+)|\s)/i],[l,[c,"Chrome Headless"]],[/\swv\).+(chrome)\/([\w\.]+)/i],[[c,"Chrome WebView"],l],[/droid.+\sversion\/([\w\.]+)\b.+(?:mobile\ssafari|safari)/i],[l,[c,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i],[c,l],[/version\/([\w\.]+)\s.*mobile\/\w+\s(safari)/i],[l,[c,"Mobile Safari"]],[/version\/([\w\.]+)\s.*(mobile\s?safari|safari)/i],[l,c],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[c,[l,_.str,y.browser.oldSafari.version]],[/(webkit|khtml)\/([\w\.]+)/i],[c,l],[/(navigator|netscape)\/([\w\.-]+)/i],[[c,"Netscape"],l],[/ile\svr;\srv:([\w\.]+)\).+firefox/i],[l,[c,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([\w\.-]+)$/i,/(firefox)\/([\w\.]+)\s[\w\s\-]+\/[\w\.]+$/i,/(mozilla)\/([\w\.]+)\s.+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]*)/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[c,l]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[[p,"amd64"]],[/(ia32(?=;))/i],[[p,E.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[[p,"ia32"]],[/\b(aarch64|armv?8e?l?)\b/i],[[p,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[p,"armhf"]],[/windows\s(ce|mobile);\sppc;/i],[[p,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[[p,/ower/,"",E.lowerize]],[/(sun4\w)[;\)]/i],[[p,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?:64|(?=v(?:[1-7]|[5-7]1)l?|;|eabi))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[p,E.lowerize]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus\s10)/i],[s,[d,"Samsung"],[u,A]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy\snexus)/i,/\ssamsung[\s-]([\w-]+)/i,/sec-(sgh\w+)/i],[s,[d,"Samsung"],[u,h]],[/\((ip(?:hone|od)[\s\w]*);/i],[s,[d,"Apple"],[u,h]],[/\((ipad);[\w\s\),;-]+apple/i,/applecoremedia\/[\w\.]+\s\((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[s,[d,"Apple"],[u,A]],[/\b((?:agr|ags[23]|bah2?|sht?)-a?[lw]\d{2})/i],[s,[d,"Huawei"],[u,A]],[/d\/huawei([\w\s-]+)[;\)]/i,/\b(nexus\s6p|vog-[at]?l\d\d|ane-[at]?l[x\d]\d|eml-a?l\d\da?|lya-[at]?l\d[\dc]|clt-a?l\d\di?|ele-l\d\d)/i,/\b(\w{2,4}-[atu][ln][01259][019])[;\)\s]/i],[s,[d,"Huawei"],[u,h]],[/\b(poco[\s\w]+)(?:\sbuild|\))/i,/\b;\s(\w+)\sbuild\/hm\1/i,/\b(hm[\s\-_]?note?[\s_]?(?:\d\w)?)\sbuild/i,/\b(redmi[\s\-_]?(?:note|k)?[\w\s_]+)(?:\sbuild|\))/i,/\b(mi[\s\-_]?(?:a\d|one|one[\s_]plus|note lte)?[\s_]?(?:\d?\w?)[\s_]?(?:plus)?)\sbuild/i],[[s,/_/g," "],[d,"Xiaomi"],[u,h]],[/\b(mi[\s\-_]?(?:pad)(?:[\w\s_]+))(?:\sbuild|\))/i],[[s,/_/g," "],[d,"Xiaomi"],[u,A]],[/;\s(\w+)\sbuild.+\soppo/i,/\s(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007)\b/i],[s,[d,"OPPO"],[u,h]],[/\svivo\s(\w+)(?:\sbuild|\))/i,/\s(v[12]\d{3}\w?[at])(?:\sbuild|;)/i],[s,[d,"Vivo"],[u,h]],[/\s(rmx[12]\d{3})(?:\sbuild|;)/i],[s,[d,"Realme"],[u,h]],[/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?:?(\s4g)?)\b[\w\s]+build\//i,/\smot(?:orola)?[\s-](\w*)/i,/((?:moto[\s\w\(\)]+|xt\d{3,4}|nexus\s6)(?=\sbuild|\)))/i],[s,[d,"Motorola"],[u,h]],[/\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],[s,[d,"Motorola"],[u,A]],[/((?=lg)?[vl]k\-?\d{3})\sbuild|\s3\.[\s\w;-]{10}lg?-([06cv9]{3,4})/i],[s,[d,"LG"],[u,A]],[/(lm-?f100[nv]?|nexus\s[45])/i,/lg[e;\s\/-]+((?!browser|netcast)\w+)/i,/\blg(\-?[\d\w]+)\sbuild/i],[s,[d,"LG"],[u,h]],[/(ideatab[\w\-\s]+)/i,/lenovo\s?(s(?:5000|6000)(?:[\w-]+)|tab(?:[\s\w]+)|yt[\d\w-]{6}|tb[\d\w-]{6})/i],[s,[d,"Lenovo"],[u,A]],[/(?:maemo|nokia).*(n900|lumia\s\d+)/i,/nokia[\s_-]?([\w\.-]*)/i],[[s,/_/g," "],[d,"Nokia"],[u,h]],[/droid.+;\s(pixel\sc)[\s)]/i],[s,[d,"Google"],[u,A]],[/droid.+;\s(pixel[\s\daxl]{0,6})(?:\sbuild|\))/i],[s,[d,"Google"],[u,h]],[/droid.+\s([c-g]\d{4}|so[-l]\w+|xq-a\w[4-7][12])(?=\sbuild\/|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[s,[d,"Sony"],[u,h]],[/sony\stablet\s[ps]\sbuild\//i,/(?:sony)?sgp\w+(?:\sbuild\/|\))/i],[[s,"Xperia Tablet"],[d,"Sony"],[u,A]],[/\s(kb2005|in20[12]5|be20[12][59])\b/i,/\ba000(1)\sbuild/i,/\boneplus\s(a\d{4})[\s)]/i],[s,[d,"OnePlus"],[u,h]],[/(alexa)webm/i,/(kf[a-z]{2}wi)(\sbuild\/|\))/i,/(kf[a-z]+)(\sbuild\/|\)).+silk\//i],[s,[d,"Amazon"],[u,A]],[/(sd|kf)[0349hijorstuw]+(\sbuild\/|\)).+silk\//i],[[s,"Fire Phone"],[d,"Amazon"],[u,h]],[/\((playbook);[\w\s\),;-]+(rim)/i],[s,d,[u,A]],[/((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10;\s(\w+)/i],[s,[d,"BlackBerry"],[u,h]],[/(?:\b|asus_)(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus\s7|padfone|p00[cj])/i],[s,[d,"ASUS"],[u,A]],[/\s(z[es]6[027][01][km][ls]|zenfone\s\d\w?)\b/i],[s,[d,"ASUS"],[u,h]],[/(nexus\s9)/i],[s,[d,"HTC"],[u,A]],[/(htc)[;_\s-]{1,2}([\w\s]+(?=\)|\sbuild)|\w+)/i,/(zte)-(\w*)/i,/(alcatel|geeksphone|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i],[d,[s,/_/g," "],[u,h]],[/droid[x\d\.\s;]+\s([ab][1-7]\-?[0178a]\d\d?)/i],[s,[d,"Acer"],[u,A]],[/droid.+;\s(m[1-5]\snote)\sbuild/i,/\bmz-([\w-]{2,})/i],[s,[d,"Meizu"],[u,h]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]*)/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i,/(microsoft);\s(lumia[\s\w]+)/i,/(lenovo)[_\s-]?([\w-]+)/i,/linux;.+(jolla);/i,/droid.+;\s(oppo)\s?([\w\s]+)\sbuild/i],[d,s,[u,h]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i,/[;\/]\s?(le[\s\-]+pan)[\s\-]+(\w{1,9})\sbuild/i,/[;\/]\s?(trinity)[\-\s]*(t\d{3})\sbuild/i,/\b(gigaset)[\s\-]+(q\w{1,9})\sbuild/i,/\b(vodafone)\s([\w\s]+)(?:\)|\sbuild)/i],[d,s,[u,A]],[/\s(surface\sduo)\s/i],[s,[d,"Microsoft"],[u,A]],[/droid\s[\d\.]+;\s(fp\du?)\sbuild/i],[s,[d,"Fairphone"],[u,h]],[/\s(u304aa)\sbuild/i],[s,[d,"AT&T"],[u,h]],[/sie-(\w*)/i],[s,[d,"Siemens"],[u,h]],[/[;\/]\s?(rct\w+)\sbuild/i],[s,[d,"RCA"],[u,A]],[/[;\/\s](venue[\d\s]{2,7})\sbuild/i],[s,[d,"Dell"],[u,A]],[/[;\/]\s?(q(?:mv|ta)\w+)\sbuild/i],[s,[d,"Verizon"],[u,A]],[/[;\/]\s(?:barnes[&\s]+noble\s|bn[rt])([\w\s\+]*)\sbuild/i],[s,[d,"Barnes & Noble"],[u,A]],[/[;\/]\s(tm\d{3}\w+)\sbuild/i],[s,[d,"NuVision"],[u,A]],[/;\s(k88)\sbuild/i],[s,[d,"ZTE"],[u,A]],[/;\s(nx\d{3}j)\sbuild/i],[s,[d,"ZTE"],[u,h]],[/[;\/]\s?(gen\d{3})\sbuild.*49h/i],[s,[d,"Swiss"],[u,h]],[/[;\/]\s?(zur\d{3})\sbuild/i],[s,[d,"Swiss"],[u,A]],[/[;\/]\s?((zeki)?tb.*\b)\sbuild/i],[s,[d,"Zeki"],[u,A]],[/[;\/]\s([yr]\d{2})\sbuild/i,/[;\/]\s(dragon[\-\s]+touch\s|dt)(\w{5})\sbuild/i],[[d,"Dragon Touch"],s,[u,A]],[/[;\/]\s?(ns-?\w{0,9})\sbuild/i],[s,[d,"Insignia"],[u,A]],[/[;\/]\s?((nxa|Next)-?\w{0,9})\sbuild/i],[s,[d,"NextBook"],[u,A]],[/[;\/]\s?(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05]))\sbuild/i],[[d,"Voice"],s,[u,h]],[/[;\/]\s?(lvtel\-)?(v1[12])\sbuild/i],[[d,"LvTel"],s,[u,h]],[/;\s(ph-1)\s/i],[s,[d,"Essential"],[u,h]],[/[;\/]\s?(v(100md|700na|7011|917g).*\b)\sbuild/i],[s,[d,"Envizen"],[u,A]],[/[;\/]\s?(trio[\s\w\-\.]+)\sbuild/i],[s,[d,"MachSpeed"],[u,A]],[/[;\/]\s?tu_(1491)\sbuild/i],[s,[d,"Rotor"],[u,A]],[/(shield[\w\s]+)\sbuild/i],[s,[d,"Nvidia"],[u,A]],[/(sprint)\s(\w+)/i],[d,s,[u,h]],[/(kin\.[onetw]{3})/i],[[s,/\./g," "],[d,"Microsoft"],[u,h]],[/droid\s[\d\.]+;\s(cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[s,[d,"Zebra"],[u,A]],[/droid\s[\d\.]+;\s(ec30|ps20|tc[2-8]\d[kx])\)/i],[s,[d,"Zebra"],[u,h]],[/\s(ouya)\s/i,/(nintendo)\s([wids3utch]+)/i],[d,s,[u,f]],[/droid.+;\s(shield)\sbuild/i],[s,[d,"Nvidia"],[u,f]],[/(playstation\s[345portablevi]+)/i],[s,[d,"Sony"],[u,f]],[/[\s\(;](xbox(?:\sone)?(?!;\sxbox))[\s\);]/i],[s,[d,"Microsoft"],[u,f]],[/smart-tv.+(samsung)/i],[d,[u,v]],[/hbbtv.+maple;(\d+)/i],[[s,/^/,"SmartTV"],[d,"Samsung"],[u,v]],[/(?:linux;\snetcast.+smarttv|lg\snetcast\.tv-201\d)/i],[[d,"LG"],[u,v]],[/(apple)\s?tv/i],[d,[s,"Apple TV"],[u,v]],[/crkey/i],[[s,"Chromecast"],[d,"Google"],[u,v]],[/droid.+aft([\w])(\sbuild\/|\))/i],[s,[d,"Amazon"],[u,v]],[/\(dtv[\);].+(aquos)/i],[s,[d,"Sharp"],[u,v]],[/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i],[[d,E.trim],[s,E.trim],[u,v]],[/[\s\/\(](android\s|smart[-\s]?|opera\s)tv[;\)\s]/i],[[u,v]],[/((pebble))app\/[\d\.]+\s/i],[d,s,[u,g]],[/droid.+;\s(glass)\s\d/i],[s,[d,"Google"],[u,g]],[/droid\s[\d\.]+;\s(wt63?0{2,3})\)/i],[s,[d,"Zebra"],[u,g]],[/(tesla)(?:\sqtcarbrowser|\/20[12]\d\.[\w\.-]+)/i],[d,[u,m]],[/droid .+?; ([^;]+?)(?: build|\) applewebkit).+? mobile safari/i],[s,[u,h]],[/droid .+?;\s([^;]+?)(?: build|\) applewebkit).+?(?! mobile) safari/i],[s,[u,A]],[/\s(tablet|tab)[;\/]/i,/\s(mobile)(?:[;\/]|\ssafari)/i],[[u,E.lowerize]],[/(android[\w\.\s\-]{0,9});.+build/i],[s,[d,"Generic"]],[/(phone)/i],[[u,h]]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[l,[c,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[l,[c,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[c,l],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[l,c]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[c,l],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s\w]*)/i,/(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)(?!.+xbox)/i],[c,[l,_.str,y.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[c,"Windows"],[l,_.str,y.os.windows.version]],[/ip[honead]{2,4}\b(?:.*os\s([\w]+)\slike\smac|;\sopera)/i,/cfnetwork\/.+darwin/i],[[l,/_/g,"."],[c,"iOS"]],[/(mac\sos\sx)\s?([\w\s\.]*)/i,/(macintosh|mac(?=_powerpc)\s)(?!.+haiku)/i],[[c,"Mac OS"],[l,/_/g,"."]],[/(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|sailfish|contiki)[\/\s-]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/\s]([\w\.]+)/i,/\((series40);/i],[c,l],[/\(bb(10);/i],[l,[c,"BlackBerry"]],[/(?:symbian\s?os|symbos|s60(?=;)|series60)[\/\s-]?([\w\.]*)/i],[l,[c,"Symbian"]],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[c,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[l,[c,"webOS"]],[/crkey\/([\d\.]+)/i],[l,[c,"Chromecast"]],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[c,"Chromium OS"],l],[/(nintendo|playstation)\s([wids345portablevuch]+)/i,/(xbox);\s+xbox\s([^\);]+)/i,/(mint)[\/\s\(\)]?(\w*)/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?=\slinux)|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus|raspbian)(?:\sgnu\/linux)?(?:\slinux)?[\/\s-]?(?!chrom|package)([\w\.-]*)/i,/(hurd|linux)\s?([\w\.]*)/i,/(gnu)\s?([\w\.]*)/i,/\s([frentopc-]{0,4}bsd|dragonfly)\s?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku)\s(\w+)/i],[c,l],[/(sunos)\s?([\w\.\d]*)/i],[[c,"Solaris"],l],[/((?:open)?solaris)[\/\s-]?([\w\.]*)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms|fuchsia)/i,/(unix)\s?([\w\.]*)/i],[c,l]]},S=function e(t,i){if("object"==D(t)&&(i=t,t=n),!(this instanceof e))return new e(t,i).getResult();var o=t||(void 0!==r&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),s=i?E.extend(I,i):I;return this.getBrowser=function(){var e={name:n,version:n};return _.rgx.call(e,o,s.browser),e.major=E.major(e.version),e},this.getCPU=function(){var e={architecture:n};return _.rgx.call(e,o,s.cpu),e},this.getDevice=function(){var e={vendor:n,model:n,type:n};return _.rgx.call(e,o,s.device),e},this.getEngine=function(){var e={name:n,version:n};return _.rgx.call(e,o,s.engine),e},this.getOS=function(){var e={name:n,version:n};return _.rgx.call(e,o,s.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return o},this.setUA=function(e){return o=D(e)===a&&e.length>255?E.trim(e,255):e,this},this.setUA(o),this};S.VERSION="0.7.28",S.BROWSER={NAME:c,MAJOR:"major",VERSION:l},S.CPU={ARCHITECTURE:p},S.DEVICE={MODEL:s,VENDOR:d,TYPE:u,CONSOLE:f,MOBILE:h,SMARTTV:v,TABLET:A,WEARABLE:g,EMBEDDED:m},S.ENGINE={NAME:c,VERSION:l},S.OS={NAME:c,VERSION:l},e.exports&&(t=e.exports=S),t.UAParser=S;var b=void 0!==r&&(r.jQuery||r.Zepto);if(b&&!b.ua){var C=new S;b.ua=C.getResult(),b.ua.get=function(){return C.getUA()},b.ua.set=function(e){C.setUA(e);var t=C.getResult();for(var r in t)b.ua[r]=t[r]}}}("object"==("undefined"==typeof window?"undefined":D(window))?window:a)}(Ck,Ck.exports);var wk=new Ck.exports,Rk=wk.getResult();function Tk(e){return e&&wk.setUA(e),{name:kk(Rk=wk.getResult()),version:Ok(Rk),os:Dk(Rk),osVersion:Rk.os.version}}function kk(e){if("Blink"===e.engine.name&&"WeChat"!==e.browser.name)return Sk.CHROME;switch(e.browser.name){case"Chrome Headless":case"Chrome":case"Chromium":return Sk.CHROME;case"Safari":case"Mobile Safari":return Sk.SAFARI;case"Edge":return Sk.EDGE;case"Firefox":return Sk.FIREFOX;case"QQBrowser":return Sk.QQ;case"Opera":return Sk.OPERA;case"WeChat":return Sk.WECHAT;default:return e.browser.name||""}}function Ok(e){return("Blink"===e.engine.name?e.engine.version||"":e.browser.version||"").split(".")[0]}function Dk(e){return"Windows"===e.os.name?e.os.version?e.os.name+" "+e.os.version:e.os.name:e.os.name||""}function Nk(){return Tk().os}function xk(){var e=Tk();return!!("WebKit"===Rk.engine.name&&e.os===Ik.MAC_OS&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0&&e.name!==Sk.SAFARI||Qk()&&e.name!==Sk.SAFARI)}function Pk(){var e=Tk();if(xk()){if(e.os===Ik.MAC_OS)return!0;if(e.os===Ik.IOS){var t=Rk.os.version&&Rk.os.version.split(".");if(t&&14===Number(t[0])&&t[1]&&Number(t[1])>=3)return!0;if(t&&Number(t[0])>14)return!0}}return!1}function Lk(){return"WebKit"===Rk.engine.name}function Bk(){return Tk().name===Sk.CHROME}function Mk(){return Tk().name===Sk.SAFARI}function Uk(){return Tk().name===Sk.FIREFOX}function Qk(){return Tk().os===Ik.IOS}function Fk(){var e=Tk();if(e.os!==Ik.IOS||!e.osVersion)return!1;var t=e.osVersion.split(".");return 15===Number(t[0])}function jk(){var e=Tk();if(e.os!==Ik.IOS||!e.osVersion)return!1;var t=e.osVersion.split(".");return 15===Number(t[0])&&0===Number(t[1])}function Vk(){var e=Tk();if(e.os!==Ik.IOS||!e.osVersion)return!1;var t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=1}function Gk(){var e=Tk();if(e.os!==Ik.IOS||!e.osVersion)return!1;var t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=2}function Kk(){return Mk()&&navigator.maxTouchPoints>0}function Hk(){return Tk().name===Sk.WECHAT}function Wk(){return window.navigator.appVersion&&null!==window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)&&window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)[1]<=35}function Yk(){var e=Tk();return e.name!==Sk.EDGE&&e.name!==Sk.SAFARI&&!!navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]./i)}function qk(){return Tk().os===Ik.ANDROID}var Jk={exports:{}},zk=gp,Xk=Au,Zk=Ql.f;zk({target:"Object",stat:!0,forced:Object.defineProperty!==Zk,sham:!Xk},{defineProperty:Zk});var $k=Gu.Object,eO=Jk.exports=function(e,t,r){return $k.defineProperty(e,t,r)};$k.defineProperty.sham&&(eO.sham=!0);var tO=Jk.exports;function rO(e,t,r){return t in e?tO(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var nO={exports:{}},iO=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}},oO=iO,aO=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},sO=Object.prototype.toString;function cO(e){return"[object Array]"===sO.call(e)}function uO(e){return null!==e&&"object"==D(e)}function dO(e){return"[object Function]"===sO.call(e)}function lO(e,t){if(null!=e)if("object"!=D(e)&&(e=[e]),cO(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}var pO={isArray:cO,isArrayBuffer:function(e){return"[object ArrayBuffer]"===sO.call(e)},isBuffer:aO,isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:uO,isUndefined:function(e){return void 0===e},isDate:function(e){return"[object Date]"===sO.call(e)},isFile:function(e){return"[object File]"===sO.call(e)},isBlob:function(e){return"[object Blob]"===sO.call(e)},isFunction:dO,isStream:function(e){return uO(e)&&dO(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&"undefined"!=typeof window&&"undefined"!=typeof document},forEach:lO,merge:function e(){var t={};function r(r,n){"object"==D(t[n])&&"object"==D(r)?t[n]=e(t[n],r):t[n]=r}for(var n=0,i=arguments.length;n<i;n++)lO(arguments[n],r);return t},deepMerge:function e(){var t={};function r(r,n){"object"==D(t[n])&&"object"==D(r)?t[n]=e(t[n],r):t[n]="object"==D(r)?e({},r):r}for(var n=0,i=arguments.length;n<i;n++)lO(arguments[n],r);return t},extend:function(e,t,r){return lO(t,(function(t,n){e[n]=r&&"function"==typeof t?oO(t,r):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}},fO=pO;function hO(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var AO=function(e,t,r){if(!t)return e;var n;if(r)n=r(t);else if(fO.isURLSearchParams(t))n=t.toString();else{var i=[];fO.forEach(t,(function(e,t){null!=e&&(fO.isArray(e)?t+="[]":e=[e],fO.forEach(e,(function(e){fO.isDate(e)?e=e.toISOString():fO.isObject(e)&&(e=JSON.stringify(e)),i.push(hO(t)+"="+hO(e))})))})),n=i.join("&")}if(n){var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e},vO=pO;function gO(){this.handlers=[]}gO.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},gO.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},gO.prototype.forEach=function(e){vO.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var mO=gO,EO=pO,_O=function(e){return!(!e||!e.__CANCEL__)},yO=pO,IO=function(e,t,r,n,i){return e.config=t,r&&(e.code=r),e.request=n,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e},SO=function(e,t,r,n,i){var o=new Error(e);return IO(o,t,r,n,i)},bO=SO,CO=pO,wO=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],RO=pO,TO=RO.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=RO.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0},kO=pO,OO=kO.isStandardBrowserEnv()?{write:function(e,t,r,n,i,o){var a=[];a.push(e+"="+encodeURIComponent(t)),kO.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),kO.isString(n)&&a.push("path="+n),kO.isString(i)&&a.push("domain="+i),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},DO=pO,NO=function(e,t,r){var n=r.config.validateStatus;!n||n(r.status)?e(r):t(bO("Request failed with status code "+r.status,r.config,null,r.request,r))},xO=AO,PO=function(e){var t,r,n,i={};return e?(CO.forEach(e.split("\n"),(function(e){if(n=e.indexOf(":"),t=CO.trim(e.substr(0,n)).toLowerCase(),r=CO.trim(e.substr(n+1)),t){if(i[t]&&wO.indexOf(t)>=0)return;i[t]="set-cookie"===t?(i[t]?i[t]:[]).concat([r]):i[t]?i[t]+", "+r:r}})),i):i},LO=TO,BO=SO,MO=function(e){return new Promise((function(t,r){var n=e.data,i=e.headers;DO.isFormData(n)&&delete i["Content-Type"];var o=new XMLHttpRequest;if(e.auth){var a=e.auth.username||"",s=e.auth.password||"";i.Authorization="Basic "+btoa(a+":"+s)}if(o.open(e.method.toUpperCase(),xO(e.url,e.params,e.paramsSerializer),!0),o.timeout=e.timeout,o.onreadystatechange=function(){if(o&&4===o.readyState&&(0!==o.status||o.responseURL&&0===o.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in o?PO(o.getAllResponseHeaders()):null,i={data:e.responseType&&"text"!==e.responseType?o.response:o.responseText,status:o.status,statusText:o.statusText,headers:n,config:e,request:o};NO(t,r,i),o=null}},o.onabort=function(){o&&(r(BO("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){r(BO("Network Error",e,null,o)),o=null},o.ontimeout=function(){r(BO("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",o)),o=null},DO.isStandardBrowserEnv()){var c=OO,u=(e.withCredentials||LO(e.url))&&e.xsrfCookieName?c.read(e.xsrfCookieName):void 0;u&&(i[e.xsrfHeaderName]=u)}if("setRequestHeader"in o&&DO.forEach(i,(function(e,t){void 0===n&&"content-type"===t.toLowerCase()?delete i[t]:o.setRequestHeader(t,e)})),e.withCredentials&&(o.withCredentials=!0),e.responseType)try{o.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&o.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&o.upload&&o.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){o&&(o.abort(),r(e),o=null)})),void 0===n&&(n=null),o.send(n)}))},UO=pO,QO=function(e,t){yO.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))},FO={"Content-Type":"application/x-www-form-urlencoded"};function jO(e,t){!UO.isUndefined(e)&&UO.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var VO,GO={adapter:((void 0!==c&&"[object process]"===Object.prototype.toString.call(c)||"undefined"!=typeof XMLHttpRequest)&&(VO=MO),VO),transformRequest:[function(e,t){return QO(t,"Accept"),QO(t,"Content-Type"),UO.isFormData(e)||UO.isArrayBuffer(e)||UO.isBuffer(e)||UO.isStream(e)||UO.isFile(e)||UO.isBlob(e)?e:UO.isArrayBufferView(e)?e.buffer:UO.isURLSearchParams(e)?(jO(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):UO.isObject(e)?(jO(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};UO.forEach(["delete","get","head"],(function(e){GO.headers[e]={}})),UO.forEach(["post","put","patch"],(function(e){GO.headers[e]=UO.merge(FO)}));var KO=GO,HO=pO,WO=function(e,t,r){return EO.forEach(r,(function(r){e=r(e,t)})),e},YO=_O,qO=KO,JO=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)},zO=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e};function XO(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var ZO=pO,$O=function(e,t){t=t||{};var r={};return ZO.forEach(["url","method","params","data"],(function(e){void 0!==t[e]&&(r[e]=t[e])})),ZO.forEach(["headers","auth","proxy"],(function(n){ZO.isObject(t[n])?r[n]=ZO.deepMerge(e[n],t[n]):void 0!==t[n]?r[n]=t[n]:ZO.isObject(e[n])?r[n]=ZO.deepMerge(e[n]):void 0!==e[n]&&(r[n]=e[n])})),ZO.forEach(["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"],(function(n){void 0!==t[n]?r[n]=t[n]:void 0!==e[n]&&(r[n]=e[n])})),r},eD=pO,tD=AO,rD=mO,nD=function(e){return XO(e),e.baseURL&&!JO(e.url)&&(e.url=zO(e.baseURL,e.url)),e.headers=e.headers||{},e.data=WO(e.data,e.headers,e.transformRequest),e.headers=HO.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),HO.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||qO.adapter)(e).then((function(t){return XO(e),t.data=WO(t.data,t.headers,e.transformResponse),t}),(function(t){return YO(t)||(XO(e),t&&t.response&&(t.response.data=WO(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},iD=$O;function oD(e){this.defaults=e,this.interceptors={request:new rD,response:new rD}}oD.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=iD(this.defaults,e)).method=e.method?e.method.toLowerCase():"get";var t=[nD,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},oD.prototype.getUri=function(e){return e=iD(this.defaults,e),tD(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},eD.forEach(["delete","get","head","options"],(function(e){oD.prototype[e]=function(t,r){return this.request(eD.merge(r||{},{method:e,url:t}))}})),eD.forEach(["post","put","patch"],(function(e){oD.prototype[e]=function(t,r,n){return this.request(eD.merge(n||{},{method:e,url:t,data:r}))}}));var aD=oD;function sD(e){this.message=e}sD.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},sD.prototype.__CANCEL__=!0;var cD=sD,uD=cD;function dD(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new uD(e),t(r.reason))}))}dD.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},dD.source=function(){var e;return{token:new dD((function(t){e=t})),cancel:e}};var lD=dD,pD=pO,fD=iO,hD=aD,AD=$O;function vD(e){var t=new hD(e),r=fD(hD.prototype.request,t);return pD.extend(r,hD.prototype,t),pD.extend(r,t),r}var gD=vD(KO);gD.Axios=hD,gD.create=function(e){return vD(AD(gD.defaults,e))},gD.Cancel=cD,gD.CancelToken=lD,gD.isCancel=_O,gD.all=function(e){return Promise.all(e)},gD.spread=function(e){return function(t){return e.apply(null,t)}},nO.exports=gD,nO.exports.default=gD;var mD,ED=nO.exports,_D=function(){function e(t){U(this,e),rO(this,"logger",void 0),rO(this,"prefixLists",[]),this.logger=t}return F(e,[{key:"debug",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=this.logger).debug.apply(e,M(this.prefixLists).concat(r))}},{key:"info",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=this.logger).info.apply(e,M(this.prefixLists).concat(r))}},{key:"warning",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=this.logger).warning.apply(e,M(this.prefixLists).concat(r))}},{key:"error",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];(e=this.logger).error.apply(e,M(this.prefixLists).concat(r))}},{key:"prefix",value:function(e){return this.prefixLists.push(e),this}},{key:"popPrefix",value:function(){return this.prefixLists.pop(),this}}]),e}(),yD=function(){function e(){U(this,e),rO(this,"_events",{}),rO(this,"addListener",this.on)}return F(e,[{key:"getListeners",value:function(e){return this._events[e]?this._events[e].map((function(e){return e.listener})):[]}},{key:"on",value:function(e,t){this._events[e]||(this._events[e]=[]);var r=this._events[e];-1===this._indexOfListener(r,t)&&r.push({listener:t,once:!1})}},{key:"once",value:function(e,t){this._events[e]||(this._events[e]=[]);var r=this._events[e];-1===this._indexOfListener(r,t)&&r.push({listener:t,once:!0})}},{key:"off",value:function(e,t){if(this._events[e]){var r=this._events[e],n=this._indexOfListener(r,t);-1!==n&&r.splice(n,1),0===this._events[e].length&&delete this._events[e]}}},{key:"removeAllListeners",value:function(e){e?delete this._events[e]:this._events={}}},{key:"emit",value:function(e){this._events[e]||(this._events[e]=[]);for(var t=this._events[e].map((function(e){return e})),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var o=0;o<t.length;o+=1){var a=t[o];a.once&&this.off(e,a.listener),a.listener.apply(this,n||[])}}},{key:"_indexOfListener",value:function(e,t){for(var r=e.length;r--;)if(e[r].listener===t)return r;return-1}}]),e}(),ID=new(function(e){k(r,e);var t=W(r);function r(){return U(this,r),t.apply(this,arguments)}return F(r,[{key:"reportLogUploadError",value:function(e){this.emit("REPORT_LOG_UPLOAD",e)}}]),r}(yD));!function(e){e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.UNEXPECTED_RESPONSE="UNEXPECTED_RESPONSE",e.TIMEOUT="TIMEOUT",e.INVALID_PARAMS="INVALID_PARAMS",e.NOT_READABLE="NOT_READABLE",e.NOT_SUPPORTED="NOT_SUPPORTED",e.INVALID_OPERATION="INVALID_OPERATION",e.OPERATION_ABORTED="OPERATION_ABORTED",e.WEB_SECURITY_RESTRICT="WEB_SECURITY_RESTRICT",e.EXCHANGE_SDP_FAILED="EXCHANGE_SDP_FAILED",e.NETWORK_ERROR="NETWORK_ERROR",e.NETWORK_TIMEOUT="NETWORK_TIMEOUT",e.NETWORK_RESPONSE_ERROR="NETWORK_RESPONSE_ERROR",e.API_INVOKE_TIMEOUT="API_INVOKE_TIMEOUT",e.ENUMERATE_DEVICES_FAILED="ENUMERATE_DEVICES_FAILED",e.DEVICE_NOT_FOUND="DEVICE_NOT_FOUND",e.ELECTRON_IS_NULL="ELECTRON_IS_NULL",e.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR="ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR",e.CHROME_PLUGIN_NO_RESPONSE="CHROME_PLUGIN_NO_RESPONSE",e.CHROME_PLUGIN_NOT_INSTALL="CHROME_PLUGIN_NOT_INSTALL",e.MEDIA_OPTION_INVALID="MEDIA_OPTION_INVALID",e.PERMISSION_DENIED="PERMISSION_DENIED",e.CONSTRAINT_NOT_SATISFIED="CONSTRAINT_NOT_SATISFIED",e.TRACK_IS_DISABLED="TRACK_IS_DISABLED",e.GET_VIDEO_ELEMENT_VISIBLE_ERROR="GET_VIDEO_ELEMENT_VISIBLE_ERROR",e.SHARE_AUDIO_NOT_ALLOWED="SHARE_AUDIO_NOT_ALLOWED",e.LOW_STREAM_ENCODING_ERROR="LOW_STREAM_ENCODING_ERROR",e.SET_ENCODING_PARAMETER_ERROR="SET_ENCODING_PARAMETER_ERROR",e.TRACK_STATE_UNREACHABLE="TRACK_STATE_UNREACHABLE",e.INVALID_UINT_UID_FROM_STRING_UID="INVALID_UINT_UID_FROM_STRING_UID",e.CAN_NOT_GET_PROXY_SERVER="CAN_NOT_GET_PROXY_SERVER",e.CAN_NOT_GET_GATEWAY_SERVER="CAN_NOT_GET_GATEWAY_SERVER",e.VOID_GATEWAY_ADDRESS="VOID_GATEWAY_ADDRESS",e.UID_CONFLICT="UID_CONFLICT",e.MULTI_UNILBS_RESPONSE_ERROR="MULTI_UNILBS_RESPONSE_ERROR",e.UPDATE_TICKET_FAILED="UPDATE_TICKET_FAILED",e.INVALID_LOCAL_TRACK="INVALID_LOCAL_TRACK",e.INVALID_TRACK="INVALID_TRACK",e.SENDER_NOT_FOUND="SENDER_NOT_FOUND",e.CREATE_OFFER_FAILED="CREATE_OFFER_FAILED",e.SET_ANSWER_FAILED="SET_ANSWER_FAILED",e.ICE_FAILED="ICE_FAILED",e.PC_CLOSED="PC_CLOSED",e.SENDER_REPLACE_FAILED="SENDER_REPLACE_FAILED",e.GET_LOCAL_CAPABILITIES_FAILED="GET_LOCAL_CAPABILITIES_FAILED",e.GET_LOCAL_CONNECTION_PARAMS_FAILED="GET_LOCAL_CONNECTION_PARAMS_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.GATEWAY_P2P_LOST="GATEWAY_P2P_LOST",e.NO_ICE_CANDIDATE="NO_ICE_CANDIDATE",e.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS="CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS",e.EXIST_DISABLED_VIDEO_TRACK="EXIST_DISABLED_VIDEO_TRACK",e.INVALID_REMOTE_USER="INVALID_REMOTE_USER",e.REMOTE_USER_IS_NOT_PUBLISHED="REMOTE_USER_IS_NOT_PUBLISHED",e.CUSTOM_REPORT_SEND_FAILED="CUSTOM_REPORT_SEND_FAILED",e.CUSTOM_REPORT_FREQUENCY_TOO_HIGH="CUSTOM_REPORT_FREQUENCY_TOO_HIGH",e.FETCH_AUDIO_FILE_FAILED="FETCH_AUDIO_FILE_FAILED",e.READ_LOCAL_AUDIO_FILE_ERROR="READ_LOCAL_AUDIO_FILE_ERROR",e.DECODE_AUDIO_FILE_FAILED="DECODE_AUDIO_FILE_FAILED",e.WS_ABORT="WS_ABORT",e.WS_DISCONNECT="WS_DISCONNECT",e.WS_ERR="WS_ERR",e.LIVE_STREAMING_TASK_CONFLICT="LIVE_STREAMING_TASK_CONFLICT",e.LIVE_STREAMING_INVALID_ARGUMENT="LIVE_STREAMING_INVALID_ARGUMENT",e.LIVE_STREAMING_INTERNAL_SERVER_ERROR="LIVE_STREAMING_INTERNAL_SERVER_ERROR",e.LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED="LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED",e.LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED="LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED",e.LIVE_STREAMING_CDN_ERROR="LIVE_STREAMING_CDN_ERROR",e.LIVE_STREAMING_INVALID_RAW_STREAM="LIVE_STREAMING_INVALID_RAW_STREAM",e.LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT="LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT",e.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE="LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE",e.LIVE_STREAMING_WARN_FREQUENT_REQUEST="LIVE_STREAMING_WARN_FREQUENT_REQUEST",e.WEBGL_INTERNAL_ERROR="WEBGL_INTERNAL_ERROR",e.BEAUTY_PROCESSOR_INTERNAL_ERROR="BEAUTY_PROCESSOR_INTERNAL_ERROR",e.CROSS_CHANNEL_WAIT_STATUS_ERROR="CROSS_CHANNEL_WAIT_STATUS_ERROR",e.CROSS_CHANNEL_FAILED_JOIN_SRC="CROSS_CHANNEL_FAILED_JOIN_SEC",e.CROSS_CHANNEL_FAILED_JOIN_DEST="CROSS_CHANNEL_FAILED_JOIN_DEST",e.CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST="CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST",e.CROSS_CHANNEL_SERVER_ERROR_RESPONSE="CROSS_CHANNEL_SERVER_ERROR_RESPONSE",e.METADATA_OUT_OF_RANGE="METADATA_OUT_OF_RANGE",e.LOCAL_AEC_ERROR="LOCAL_AEC_ERROR",e.INVALID_PLUGIN="INVALID_PLUGIN",e.DISCONNECT_P2P="DISCONNECT_P2P",e.INIT_WEBSOCKET_TIMEOUT="INIT_WEBSOCKET_TIMEOUT"}(mD||(mD={}));var SD=function(e){k(r,e);var t=W(r);function r(e){var n;U(this,r);var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",o=arguments.length>2?arguments[2]:void 0;return n=t.call(this,i),rO(S(n),"code",void 0),rO(S(n),"message",void 0),rO(S(n),"data",void 0),rO(S(n),"name","AgoraRTCException"),n.code=e,n.message="AgoraRTCError ".concat(n.code,": ").concat(i),n.data=o,n}return F(r,[{key:"toString",value:function(){return this.data?"data: ".concat(JSON.stringify(this.data),"\n").concat(this.stack):"".concat(this.stack)}},{key:"print",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"error";return"error"===e&&ND.error(this.toString()),"warning"===e&&ND.warning(this.toString()),this}},{key:"throw",value:function(){throw this.print(),this}}]),r}(T(Error)),bD={timeout:500,timeoutFactor:1.5,maxRetryCount:1/0,maxRetryTimeout:1e4};function CD(e,t){var r=Math.floor(t.timeout*Math.pow(t.timeoutFactor,e));return Math.min(t.maxRetryTimeout,r)}function wD(e,t,r,n){var i=Object.assign({},bD,n),o=i.timeout,a=function(){var e=y(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,function(e){return new Rb((function(t){window.setTimeout(t,e)}))}(o);case 2:o*=i.timeoutFactor,o=Math.min(i.maxRetryTimeout,o);case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),s=!1,c=new Rb(function(){var n=y(G.mark((function n(o,c){var u,d;return G.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:t=t||function(){return!1},r=r||function(){return!0},u=0;case 2:if(!(u<i.maxRetryCount)){n.next=28;break}if(!s){n.next=5;break}return n.abrupt("return",c(new SD(mD.OPERATION_ABORTED)));case 5:return n.prev=5,n.next=8,e();case 8:if(d=n.sent,t(d,u)){n.next=11;break}return n.abrupt("return",o(d));case 11:if(u+1!==i.maxRetryCount){n.next=13;break}return n.abrupt("return",o(d));case 13:return n.next=15,a();case 15:n.next=25;break;case 17:if(n.prev=17,n.t0=n.catch(5),r(n.t0,u)){n.next=21;break}return n.abrupt("return",c(n.t0));case 21:if(u+1!==i.maxRetryCount){n.next=23;break}return n.abrupt("return",c(n.t0));case 23:return n.next=25,a();case 25:u+=1,n.next=2;break;case 28:case"end":return n.stop()}}),n,null,[[5,17]])})));return function(e,t){return n.apply(this,arguments)}}());return c.cancel=function(){return s=!0},c}function RD(){var e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}var TD,kD={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4},OD=Date.now(),DD=function(e){for(var t in kD)if(Object.prototype.hasOwnProperty.call(kD,t)&&kD[t]===e)return t;return"DEFAULT"},ND=new(function(){function e(){var t=this;U(this,e),rO(this,"proxyServerURL",void 0),rO(this,"logLevel",kD.DEBUG),rO(this,"uploadState","collecting"),rO(this,"uploadLogWaitingList",[]),rO(this,"uploadLogUploadingList",[]),rO(this,"uploadErrorCount",0),rO(this,"currentLogID",0),rO(this,"url",void 0),rO(this,"extLog",(function(e,r){t.appendLogToWaitingList(e,r)}))}return F(e,[{key:"debug",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=[kD.DEBUG].concat(t);this.log.apply(this,n)}},{key:"info",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=[kD.INFO].concat(t);this.log.apply(this,n)}},{key:"warning",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=[kD.WARNING].concat(t);this.log.apply(this,n)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=[kD.ERROR].concat(t);this.log.apply(this,n)}},{key:"upload",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=[kD.DEBUG].concat(t);this.uploadLog.apply(this,n)}},{key:"setLogLevel",value:function(e){e=Math.min(Math.max(0,e),4),this.logLevel=e}},{key:"enableLogUpload",value:function(){vN("UPLOAD_LOG",!0)}},{key:"disableLogUpload",value:function(){vN("UPLOAD_LOG",!1),this.uploadLogUploadingList=[],this.uploadLogWaitingList=[]}},{key:"setProxyServer",value:function(e){this.proxyServerURL=e}},{key:"prefix",value:function(e){return new _D(this).prefix(e)}},{key:"log",value:function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];if(Date.now()-OD<100)setTimeout((function(){e.log.apply(e,r)}),Date.now()-OD);else{var i=Math.max(0,Math.min(4,r[0]));if(r[0]=RD()+" Agora-SDK [".concat(DD(i),"]:"),this.appendLogToWaitingList(i,r),!(i<this.logLevel)){var o=RD()+" %cAgora-SDK [".concat(DD(i),"]:"),a=[];if(!gN("USE_NEW_LOG"))switch(i){case kD.DEBUG:a=[o,"color: #64B5F6;"].concat(r.slice(1)),console.log.apply(console,a);break;case kD.INFO:a=[o,"color: #1E88E5; font-weight: bold;"].concat(r.slice(1)),console.log.apply(console,a);break;case kD.WARNING:a=[o,"color: #FB8C00; font-weight: bold;"].concat(r.slice(1)),console.warn.apply(console,a);break;case kD.ERROR:a=[o,"color: #B00020; font-weight: bold;"].concat(r.slice(1)),console.error.apply(console,a)}}}}},{key:"uploadLog",value:function(){for(var e=this,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];if(Date.now()-OD<100)setTimeout((function(){e.uploadLog.apply(e,r)}),Date.now()-OD);else{var i=Math.max(0,Math.min(4,r[0]));r[0]=RD()+" Agora-SDK [".concat(DD(i),"]:"),this.appendLogToWaitingList(i,r)}}},{key:"appendLogToWaitingList",value:function(e){if(gN("UPLOAD_LOG")){for(var t="",r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];n.forEach((function(e){"object"==D(e)&&(e=JSON.stringify(e)),t+="".concat(e," ")})),this.uploadLogWaitingList.push({payload_str:t,log_level:e,log_item_id:this.currentLogID++}),"uploading"===this.uploadState&&0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}}},{key:"startUpload",value:function(){this.uploadState="uploading",0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}},{key:"uploadLogs",value:function(){var e=y(G.mark((function e(){var t,r,n=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.uploadLogUploadingList,r={sdk_version:oN,process_id:gN("PROCESS_ID"),payload:JSON.stringify(t)},e.abrupt("return",wD(y(G.mark((function e(){var t,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ED.post(n.url||(n.proxyServerURL?"https://".concat(n.proxyServerURL,"/ls/?h=").concat(gN("LOG_UPLOAD_SERVER"),"&p=443&d=upload/v1"):"https://".concat(gN("LOG_UPLOAD_SERVER"),"/upload/v1")),r,{responseType:"text"});case 2:if("OK"===(t=e.sent).data){e.next=6;break}throw(i=new Error("unexpected upload log response")).response=t,i;case 6:case"end":return e.stop()}}),e)}))),(function(){return n.uploadLogUploadingList=[],!1}),(function(e){return e.response?ID.reportLogUploadError({status:e.response.status,data:e.response.data,headers:e.response.headers,message:e.message}):e.request?ID.reportLogUploadError({status:e.request.status,message:e.message}):ID.reportLogUploadError({status:-1,message:e.message}),!0}),{timeout:2e3,maxRetryTimeout:2e4}));case 2:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"uploadLogInterval",value:function(){var e=this;0===this.uploadLogUploadingList.length&&0===this.uploadLogWaitingList.length||(0===this.uploadLogUploadingList.length&&(this.uploadLogUploadingList=this.uploadLogWaitingList.splice(0,10)),this.uploadLogs().then((function(){e.uploadErrorCount=0,e.uploadLogWaitingList.length>0&&window.setTimeout((function(){return e.uploadLogInterval()}),3e3)})).catch((function(t){e.uploadErrorCount+=1,e.uploadErrorCount<2?window.setTimeout((function(){return e.uploadLogInterval()}),200):window.setTimeout((function(){return e.uploadLogInterval()}),1e3)})))}}]),e}()),xD={debug:console.log,info:console.log,warning:console.warn,error:console.error},PD={debug:"color: #64B5F6;",info:"color: #1E88E5; font-weight: bold;",warning:"color: #FB8C00; font-weight: bold;",error:"color: #B00020; font-weight: bold;"},LD={debug:0,info:1,warning:2,error:3},BD=[],MD=0,UD=0,QD=!1;function FD(){var e=new Date;return[e.getTime(),e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()]}function jD(e){if(gN("UPLOAD_LOG")){var t;switch(e.type){case Ax.MISC:t=[e.timestamp,e.level,e.type,e.module,e.instanceId,[e.msg]];break;case Ax.INTERNAL_EVENT:case Ax.PUBLIC_EVENT:case Ax.WEB_EVENT:t=[e.timestamp,e.level,e.type,e.module,e.instanceId,[e.event,e.msg]];break;case Ax.INTERNAL_API:case Ax.PUBLIC_API:case Ax.WEB_API:t=[e.timestamp,e.level,e.type,e.module,e.instanceId,[e.api,e.args,e.result]]}BD.push(t)}}function VD(e,t){var r,n=FD(),i=E(n,2),o=i[0],a=i[1],s="warning",c="".concat(a," %cAgora-SDK [").concat(s,"] [INTERNAL API]:"),u=(r={},j(r,Ax.WEB_API,"logWebAPI"),j(r,Ax.PUBLIC_API,"logPublicAPI"),j(r,Ax.INTERNAL_API,"logInternalAPI"),j(r,Ax.WEB_EVENT,"logWebEvent"),j(r,Ax.PUBLIC_EVENT,"logPublicEvent"),j(r,Ax.INTERNAL_EVENT,"logInternalEvent"),j(r,Ax.MISC,"logMisc"),r)[e],d=[c,PD.warning,"Log.".concat(u),t];gN("USE_NEW_LOG")&&(KD(s)&&xD.warning.apply(console,d),jD({timestamp:o,level:s,module:"Log",instanceId:void 0,type:Ax.INTERNAL_API,api:u,args:void 0,result:t.toString()}))}function GD(e){if(Array.isArray(e)){var t=E(e,2),r=t[0];return r||(r="Global"),{module:r,instanceId:t[1]}}var n,i;if("string"!=typeof e.__moduleName)throw new Error("Cannot get __moduleName from log instance.");n=e.__moduleName;try{i=e.__instanceId}catch(e){throw new Error("Cannot get __instanceId from log instance.")}return{module:n,instanceId:i}}function KD(e){return LD[e]>=UD}function HD(e,t,r,n,i,o){if(e===Ax.PUBLIC_API||e===Ax.WEB_API||e===Ax.INTERNAL_API)try{var a,s=GD(r),c=s.module,u=s.instanceId;i=i&&JSON.stringify(i),o=o instanceof Error?o.toString():o&&JSON.stringify(o);var d=FD(),l=E(d,2),p=l[0],f=l[1],h=["".concat(f," %cAgora-SDK [").concat(t,"] [").concat((a={},j(a,Ax.PUBLIC_API,"PUBLIC API"),j(a,Ax.WEB_API,"WEB API"),j(a,Ax.INTERNAL_API,"INTERNAL API"),a)[e],"]:"),PD[t],"".concat(c).concat(u?"<".concat(u,">"):"",".").concat(n),i,o];gN("USE_NEW_LOG")&&(KD(t)&&xD[t].apply(console,h),jD({timestamp:p,level:t,module:c,instanceId:u,type:e,api:n,args:i,result:o}))}catch(t){VD(e,t)}}function WD(e,t,r,n,i){if(e===Ax.WEB_EVENT||e===Ax.INTERNAL_EVENT||e===Ax.PUBLIC_EVENT)try{var o,a=GD(r),s=a.module,c=a.instanceId;"string"!=typeof i&&(i=i instanceof Error?i.toString():JSON.stringify(i));var u=FD(),d=E(u,2),l=d[0],p=d[1],f=["".concat(p," %cAgora-SDK [").concat(t,"] [").concat((o={},j(o,Ax.WEB_EVENT,"WEB EVENT"),j(o,Ax.PUBLIC_EVENT,"PUBLIC EVENT"),j(o,Ax.INTERNAL_EVENT,"INTERNAL EVENT"),o)[e],"]:"),PD[t],"".concat(s).concat(c?"<".concat(c,">"):"",".on(").concat(n,")"),i||""];gN("USE_NEW_LOG")&&(KD(t)&&xD[t].apply(console,f),jD({timestamp:l,level:t,module:s,instanceId:c,type:e,event:n,msg:i}))}catch(t){VD(e,t)}}function YD(e){TD=e}function qD(e,t,r){try{var n=GD(t),i=n.module,o=n.instanceId,a=FD(),s=E(a,2),c=s[0],u=s[1],d=["".concat(u," %cAgora-SDK [").concat(e,"] [MISC]:"),PD[e],"".concat(i).concat(o?"<".concat(o,">"):""),'"'.concat(r,'"')];gN("USE_NEW_LOG")&&(KD(e)&&xD[e].apply(console,d),jD({timestamp:c,level:e,module:i,instanceId:o,type:Ax.MISC,msg:r}))}catch(e){ZD("warning",["log"],"logMisc",void 0,e)}}function JD(e,t,r,n){WD(Ax.INTERNAL_EVENT,e,t,r,n)}function zD(e,t,r,n){WD(Ax.PUBLIC_EVENT,e,t,r,n)}function XD(e,t,r,n){WD(Ax.WEB_EVENT,e,t,r,n)}function ZD(e,t,r,n,i){HD(Ax.INTERNAL_API,e,t,r,n,i)}function $D(e,t,r,n,i){HD(Ax.WEB_API,e,t,r,n,i)}function eN(e,t,r,n,i){HD(Ax.PUBLIC_API,e,t,r,n,i)}function tN(e,t){return function(r){return function(r){k(i,r);var n=W(i);function i(){return U(this,i),n.apply(this,arguments)}return F(i,[{key:"__moduleName",get:function(){return e}},{key:"__instanceId",get:function(){if(t){if("function"==typeof this[t])return this[t]();var e=t.split(".");return e.length>0?Hp(e).call(e,(function(e,t){try{return e?e[t]:e}catch(e){return}}),this):this[t]}}}]),i}(r)}}function rN(e){return nN.apply(this,arguments)}function nN(){return nN=y(G.mark((function e(t){var r,n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t||!QD){e.next=2;break}return e.abrupt("return");case 2:if(QD=!0,gN("UPLOAD_LOG")){e.next=4;break}return e.abrupt("return",void setTimeout((function(){return rN(!0)}),5e3));case 4:if(0!==BD.length){e.next=6;break}return e.abrupt("return",void setTimeout((function(){return rN(!0)}),3e3));case 6:return r=BD.slice(0,10),n={sdk_version:oN,log_version:gN("LOG_VERSION"),process_id:gN("PROCESS_ID"),index:MD,logs:JSON.stringify(r)},e.next=9,wD(y(G.mark((function e(){var t;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ED.post(TD?"https://".concat(TD,"/ls/?h=").concat(gN("LOG_UPLOAD_SERVER"),"&p=443&d=upload/v1"):"https://".concat(gN("LOG_UPLOAD_SERVER"),"/upload/v1"),n,{responseType:"text"});case 2:if("OK"===(t=e.sent).data){e.next=5;break}throw new Error("Log service response error ".concat(t.data));case 5:return e.abrupt("return",t);case 6:case"end":return e.stop()}}),e)}))),void 0,void 0,{timeout:3e3,maxRetryTimeout:1e4});case 9:BD.splice(0,10),MD+=r.length,setTimeout((function(){return rN(!0)}),3e3);case 12:case"end":return e.stop()}}),e)}))),nN.apply(this,arguments)}var iN="v4.11.0-0-g961abf54(3/31/2022, 5:02:17 PM)",oN=function(e){if(e.match(/[0-9]+\.[0-9]+\.[0-9]+$/))return e;var t=e.match(/([0-9]+\.[0-9]+\.[0-9]+)\-alpha\.([0-9]+)/);if(t&&t[1]&&t[2]){var r=t[1],n=t[2];return"".concat(r,".").concat(n)}var i=e.match(/([0-9]+\.[0-9]+\.[0-9]+)\-special\.([0-9]+)/);if(i&&i[1]&&i[2]){var o=i[1],a=i[2];return"".concat(o,".").concat(100*(Number(a)+1))}return"4.0.0.999"}("4.11.0"),aN=function(){try{return!0===JSON.parse("true")}catch(e){return!0}}(),sN={username:"test",password:"111111",turnServerURL:"",tcpport:3433,udpport:3478,forceturn:!1},cN={"90p":yN(160,90),"90p_1":yN(160,90),"120p":yN(160,120,15,30,65),"120p_1":yN(160,120,15,30,65),"120p_3":yN(120,120,15,30,50),"120p_4":yN(212,120),"180p":yN(320,180,15,30,140),"180p_1":yN(320,180,15,30,140),"180p_3":yN(180,180,15,30,100),"180p_4":yN(240,180,15,30,120),"240p":yN(320,240,15,40,200),"240p_1":yN(320,240,15,40,200),"240p_3":yN(240,240,15,40,140),"240p_4":yN(424,240,15,40,220),"360p":yN(640,360,15,80,400),"360p_1":yN(640,360,15,80,400),"360p_3":yN(360,360,15,80,260),"360p_4":yN(640,360,30,80,600),"360p_6":yN(360,360,30,80,400),"360p_7":yN(480,360,15,80,320),"360p_8":yN(480,360,30,80,490),"360p_9":yN(640,360,15,80,800),"360p_10":yN(640,360,24,80,800),"360p_11":yN(640,360,24,80,1e3),"480p":yN(640,480,15,100,500),"480p_1":yN(640,480,15,100,500),"480p_2":yN(640,480,30,100,1e3),"480p_3":yN(480,480,15,100,400),"480p_4":yN(640,480,30,100,750),"480p_6":yN(480,480,30,100,600),"480p_8":yN(848,480,15,100,610),"480p_9":yN(848,480,30,100,930),"480p_10":yN(640,480,10,100,400),"720p":yN(1280,720,15,120,1130),"720p_1":yN(1280,720,15,120,1130),"720p_2":yN(1280,720,30,120,2e3),"720p_3":yN(1280,720,30,120,1710),"720p_5":yN(960,720,15,120,910),"720p_6":yN(960,720,30,120,1380),"1080p":yN(1920,1080,15,120,2080),"1080p_1":yN(1920,1080,15,120,2080),"1080p_2":yN(1920,1080,30,120,3e3),"1080p_3":yN(1920,1080,30,120,3150),"1080p_5":yN(1920,1080,60,120,4780),"1440p":yN(2560,1440,30,120,4850),"1440p_1":yN(2560,1440,30,120,4850),"1440p_2":yN(2560,1440,60,120,7350),"4k":yN(3840,2160,30,120,8910),"4k_1":yN(3840,2160,30,120,8910),"4k_3":yN(3840,2160,60,120,13500)},uN={"480p":IN(640,480,5),"480p_1":IN(640,480,5),"480p_2":IN(640,480,30),"480p_3":IN(640,480,15),"720p":IN(1280,720,5),"720p_1":IN(1280,720,5),"720p_2":IN(1280,720,30),"720p_3":IN(1280,720,15),"1080p":IN(1920,1080,5),"1080p_1":IN(1920,1080,5),"1080p_2":IN(1920,1080,30),"1080p_3":IN(1920,1080,15)},dN={"1SL1TL":SN(1,1),"3SL3TL":SN(3,3),"2SL3TL":SN(2,3)};function lN(e){return"string"==typeof e?Object.assign({},cN[e]):e}function pN(e){return"string"==typeof e?Object.assign({},uN[e]):e}function fN(e){return"string"==typeof e?Object.assign({},dN[e]):e}var hN={speech_low_quality:_N(16e3,!1),speech_standard:_N(32e3,!1,18),music_standard:_N(48e3,!1),standard_stereo:_N(48e3,!0,56),high_quality:_N(48e3,!1,128),high_quality_stereo:_N(48e3,!0,192)};function AN(e){return"string"==typeof e?Object.assign({},hN[e]):e}function vN(e,t,r){Object.keys(mN).includes(e)&&(!r&&Object.keys(EN).includes(e)||(mN[e]=t))}function gN(e){return mN[e]}var mN={PROCESS_ID:"",ENCRYPT_AES:!0,AREAS:["CHINA","GLOBAL"],WEBCS_DOMAIN:["webrtc2-ap-web-1.agora.io","webrtc2-2.ap.sd-rtn.com"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-ap-web-3.agora.io","webrtc2-4.ap.sd-rtn.com"],PROXY_CS:["ap-proxy-1.agora.io","ap-proxy-2.agora.io"],CDS_AP:["cds-ap-web-1.agora.io","cds-web-2.ap.sd-rtn.com","cds-ap-web-3.agora.io","cds-web-4.ap.sd-rtn.com"],ACCOUNT_REGISTER:["sua-ap-web-1.agora.io","sua-web-2.ap.sd-rtn.com","sua-ap-web-3.agora.io","sua-web-4.ap.sd-rtn.com"],UAP_AP:["uap-ap-web-1.agora.io","uap-web-2.ap.sd-rtn.com","uap-ap-web-3.agora.io","uap-web-4.ap.sd-rtn.com"],LOG_UPLOAD_SERVER:"logservice.agora.io",EVENT_REPORT_DOMAIN:"statscollector-1.agora.io",EVENT_REPORT_BACKUP_DOMAIN:"web-2.statscollector.sd-rtn.com",GATEWAY_ADDRESS:[],GATEWAY_WSS_ADDRESS:"",LIVE_STREAMING_ADDRESS:"",HTTP_CONNECT_TIMEOUT:5e3,SIGNAL_REQUEST_TIMEOUT:1e4,REPORT_STATS:!0,UPLOAD_LOG:!1,NOT_REPORT_EVENT:[],SUBSCRIBE_TCC:!0,PING_PONG_TIME_OUT:10,WEBSOCKET_TIMEOUT_MIN:1e4,EVENT_REPORT_SEND_INTERVAL:3e3,CONFIG_DISTRIBUTE_INTERVAL:3e5,CANDIDATE_TIMEOUT:5e3,SHOW_REPORT_INVOKER_LOG:!1,JOIN_EXTEND:"",PUB_EXTEND:"",SUB_EXTEND:"",FORCE_TURN:!1,TURN_ENABLE_TCP:!0,TURN_ENABLE_UDP:!0,MAX_UPLOAD_CACHE:50,UPLOAD_CACHE_INTERVAL:2e3,AJAX_REQUEST_CONCURRENT:3,REPORT_APP_SCENARIO:void 0,GATEWAY_DOMAINS:["edge.agora.io","edge.sd-rtn.com"],WORKER_DOMAIN:"edge.agora.io",TURN_DOMAIN:"edge.agora.io",EVENT_REPORT_RETRY:!0,CHROME_FORCE_PLAN_B:!1,AUDIO_SOURCE_VOLUME_UPDATE_INTERVAL:400,AUDIO_SOURCE_AVG_VOLUME_DURATION:3e3,AUDIO_VOLUME_INDICATION_INTERVAL:2e3,VOLUME_VOICE_WEIGHT:10,NORMAL_EVENT_QUEUE_CAPACITY:100,CUSTOM_REPORT:!0,CUSTOM_REPORT_LIMIT:20,PROXY_SERVER_TYPE2:"webnginx-proxy.agora.io",PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.sd-rtn.com","webrtc-cloud-proxy.agora.io"],CUSTOM_PUB_ANSWER_MODIFIER:null,CUSTOM_SUB_ANSWER_MODIFIER:null,CUSTOM_PUB_OFFER_MODIFIER:null,CUSTOM_SUB_OFFER_MODIFIER:null,DSCP_TYPE:"high",REMOVE_NEW_CODECS:!0,FRAGEMENT_LENGTH:3,WEBSOCKET_COMPRESS:!1,SIMULCAST:!1,PRELOAD_MEDIA_COUNT:0,USE_RTX:!1,CHECK_VIDEO_VISIBLE_INTERVAL:3e4,ENUMERATE_DEVICES_INTERVAL:!1,ENUMERATE_DEVICES_INTERVAL_TIME:1e4,USE_NEW_TOKEN:!1,JOIN_WITH_FALLBACK_SIGNAL_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY_FORCE:!1,JOIN_WITH_FALLBACK_PROXY_PENDING_DURATION:2e3,USE_TURN_SERVER_OF_GATEWAY:!1,H264_PROFILE_LEVEL_ID:"",USE_NEW_LOG:!1,LOG_VERSION:3,MEDIA_DEVICE_CONSTRAINTS:null,ENCRYPT_PROXY_USERNAME_AND_PSW:!0,SDP_LOGGING:!1,REMOTE_AUDIO_TRACK_USES_WEB_AUDIO:!1,LOCAL_AUDIO_TRACK_USES_WEB_AUDIO:!0,BITRATE_ADAPTER_TYPE:"STANDARD_BITRATE",AI_DENOISER_PARAMETERS:{},ADJUST_3A_FROM_PLUGINS:!0,RAISE_H264_BASELINE_PRIORITY:!0,FILTER_SEND_H264_BASELINE:!1,ENABLE_PUBLISHED_USER_LIST:!0,MAX_SUBSCRIPTION:50,ACCOUNT_REGISTER_RETRY_TIMEOUT:1,ACCOUNT_REGISTER_RETRY_RATIO:2,ACCOUNT_REGISTER_RETRY_TIMEOUT_MAX:6e4,ACCOUNT_REGISTER_RETRY_COUNT_MAX:1e5,AUDIO_CONTEXT:null,WEBCS_BACKUP_CONNECT_TIMEOUT:6e3,PLAYER_STATE_DEFER:2e3,SIGNAL_REQUEST_WATCH_INTERVAL:1e3,FILEPATH_LENMAX:255,DUALSTREAM_OPERATION_CHECK:!0,MEDIA_ELEMENT_EXISTS_DEPTH:3,SHIM_CANDIDATE:!1,LEAVE_MSG_TIMEOUT:2e3,STATS_FILTER:{transportId:!0,googTrackId:!0}},EN={};function _N(e,t,r){return{sampleRate:e,stereo:t,bitrate:r}}function yN(e,t,r,n,i){return{width:e,height:t,frameRate:r,bitrateMin:n,bitrateMax:i}}function IN(e,t,r,n,i){return{width:{max:e},height:{max:t},frameRate:r,bitrateMin:n,bitrateMax:i}}function SN(e,t){return{numSpatialLayers:e,numTemporalLayers:t}}aN||(mN.WEBCS_DOMAIN=["ap-web-1-oversea.agora.io","ap-web-1-north-america.agora.io"],mN.WEBCS_DOMAIN_BACKUP_LIST=["ap-web-2-oversea.agora.io","ap-web-2-north-america.agora.io"],mN.PROXY_CS=["proxy-ap-web-oversea.agora.io","proxy-ap-web-america.agora.io"],mN.CDS_AP=["cds-ap-web-oversea.agora.io","cds-ap-web-america.agora.io","cds-ap-web-america2.agora.io"],mN.ACCOUNT_REGISTER=["sua-ap-web-oversea.agora.io","sua-ap-web-america.agora.io","sua-ap-web-america2.agora.io"],mN.UAP_AP=["uap-ap-web-oversea.agora.io","uap-ap-web-america.agora.io","uap-ap-web-america2.agora.io"],mN.LOG_UPLOAD_SERVER="logservice-oversea.agora.io",mN.EVENT_REPORT_DOMAIN="statscollector-1-oversea.agora.io",mN.EVENT_REPORT_BACKUP_DOMAIN="statscollector-2-oversea.agora.io",mN.PROXY_SERVER_TYPE3="webrtc-cloud-proxy.agora.io",mN.AREAS=["NORTH_AMERICA","OVERSEA"]);var bN=[[0,1,2,3,4,5,5],[0,2,2,3,4,5,5],[0,3,3,3,4,5,5],[0,4,4,4,4,5,5],[0,5,5,5,5,5,5]],CN=[],wN=[],RN=dl,TN=Ql,kN=Cu,ON=function(e,t,r){var n=RN(t);n in e?TN.f(e,n,kN(0,r)):e[n]=r},DN=Qv,NN=bp,xN=ON,PN=su.Array,LN=Math.max,BN=function(e,t,r){for(var n=NN(e),i=DN(t,n),o=DN(void 0===r?n:r,n),a=PN(LN(o-i,0)),s=0;i<o;i++,s++)xN(a,s,e[i]);return a.length=s,a},MN=BN,UN=Math.floor,QN=function e(t,r){var n=t.length,i=UN(n/2);return n<8?FN(t,r):jN(t,e(MN(t,0,i),r),e(MN(t,i),r),r)},FN=function(e,t){for(var r,n,i=e.length,o=1;o<i;){for(n=o,r=e[o];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==o++&&(e[n]=r)}return e},jN=function(e,t,r,n){for(var i=t.length,o=r.length,a=0,s=0;a<i||s<o;)e[a+s]=a<i&&s<o?n(t[a],r[s])<=0?t[a++]:r[s++]:a<i?t[a++]:r[s++];return e},VN=QN,GN=Ju.match(/firefox\/(\d+)/i),KN=!!GN&&+GN[1],HN=/MSIE|Trident/.test(Ju),WN=Ju.match(/AppleWebKit\/(\d+)\./),YN=!!WN&&+WN[1],qN=gp,JN=iu,zN=md,XN=Pd,ZN=bp,$N=Lm,ex=Xc,tx=VN,rx=xp,nx=KN,ix=HN,ox=rd,ax=YN,sx=[],cx=JN(sx.sort),ux=JN(sx.push),dx=ex((function(){sx.sort(void 0)})),lx=ex((function(){sx.sort(null)})),px=rx("sort"),fx=!ex((function(){if(ox)return ox<70;if(!(nx&&nx>3)){if(ix)return!0;if(ax)return ax<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)sx.push({k:t+n,v:r})}for(sx.sort((function(e,t){return t.v-e.v})),n=0;n<sx.length;n++)t=sx[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));qN({target:"Array",proto:!0,forced:dx||!lx||!px||!fx},{sort:function(e){void 0!==e&&zN(e);var t=XN(this);if(fx)return void 0===e?cx(t):cx(t,e);var r,n,i=[],o=ZN(t);for(n=0;n<o;n++)n in t&&ux(i,t[n]);for(tx(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:$N(t)>$N(r)?1:-1}}(e)),r=i.length,n=0;n<r;)t[n]=i[n++];for(;n<o;)delete t[n++];return t}});var hx,Ax,vx,gx=Qp("Array").sort,mx=ou,Ex=gx,_x=Array.prototype,yx=function(e){var t=e.sort;return e===_x||mx(_x,e)&&t===_x.sort?Ex:t};function Ix(e,t){if("boolean"!=typeof e)throw new SD(mD.INVALID_PARAMS,"Invalid ".concat(t,": The value is of the boolean type."))}function Sx(e,t,r){if(!r.includes(e))throw new SD(mD.INVALID_PARAMS,"".concat(t," can only be set as ").concat(JSON.stringify(r)))}function bx(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e4;if(e<r||e>n||(!(arguments.length>4&&void 0!==arguments[4])||arguments[4])&&!Dx(e))throw new SD(mD.INVALID_PARAMS,"invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"))}function Cx(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:255,i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];if(null==e)throw new SD(mD.INVALID_PARAMS,"".concat(t||"param"," cannot be empty"));if(!Ox(e,r,n,i))throw new SD(mD.INVALID_PARAMS,"Invalid ".concat(t||"string param",": Length of the string: [").concat(r,",").concat(n,"].").concat(i?" ASCII characters only.":""))}function wx(e,t){if(!Array.isArray(e))throw new SD(mD.INVALID_PARAMS,"".concat(t," should be an array"))}function Rx(e){if("string"!=typeof e||!/^[a-zA-Z0-9 \!\#\$\%\&\(\)\+\-\:\;\<\=\.\>\?\@\[\]\^\_\{\}\|\~\,]{1,64}$/.test(e))throw ND.error("Invalid Channel Name ".concat(e)),new SD(mD.INVALID_PARAMS,"The length must be within 64 bytes. The supported characters: a-z,A-Z,0-9,space,!, #, $, %, &, (, ), +, -, :, ;, <, =, ., >, ?, @, [, ], ^, _, {, }, |, ~, ,")}function Tx(e){if(!("number"==typeof(t=e)&&Math.floor(t)===t&&0<=t&&t<=4294967295||Ox(e,1,255)))throw ND.error("Invalid UID ".concat(e," ").concat(D(e))),new SD(mD.INVALID_PARAMS,"[String uid] Length of the string: [1,255]. ASCII characters only. [Number uid] The value range is [0,10000]");var t;"string"==typeof e&&ND.warning("You input a string as the user ID, to ensure better end-user experience, Agora highly suggests not using a string as the user ID.")}function kx(e){return null==e}function Ox(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:255,n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return"string"==typeof e&&e.length<=r&&e.length>=t&&(!n||Nx(e))}function Dx(e){return"number"==typeof e&&e%1==0}function Nx(e){if("string"!=typeof e)return!1;for(var t=0;t<e.length;t+=1){var r=e.charCodeAt(t);if(r<0||r>255)return!1}return!0}!function(e){e.FREE="free",e.UPLOADING="uploading"}(hx||(hx={})),function(e){e[e.MISC=0]="MISC",e[e.INTERNAL_EVENT=1]="INTERNAL_EVENT",e[e.PUBLIC_EVENT=2]="PUBLIC_EVENT",e[e.WEB_EVENT=3]="WEB_EVENT",e[e.INTERNAL_API=4]="INTERNAL_API",e[e.WEB_API=5]="WEB_API",e[e.PUBLIC_API=6]="PUBLIC_API"}(Ax||(Ax={})),function(e){e.NONE="none",e.INIT="init",e.CANPLAY="canplay",e.PLAYING="playing",e.PAUSED="paused",e.SUSPEND="suspend",e.STALLED="stalled",e.WAITING="waiting",e.ERROR="error",e.DESTROYED="destroyed",e.ABORT="abort",e.ENDED="ended",e.EMPTIED="emptied",e.LOADEDDATA="loadeddata"}(vx||(vx={}));var xx={uninit:100,none:110,init:120,loadeddata:130,canplay:200,playing:210,paused:220,suspend:300,stalled:310,waiting:320,error:330,destroyed:340,abort:350,ended:360,emptied:370};function Px(e){return Cx(e.reportId,"params.reportId",0,100,!1),Cx(e.category,"params.category",0,100,!1),Cx(e.event,"params.event",0,100,!1),Cx(e.label,"params.label",0,100,!1),bx(e.value,"params.value",Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,!1),!0}var Lx,Bx,Mx,Ux,Qx,Fx,jx,Vx,Gx,Kx,Hx,Wx,Yx,qx,Jx,zx,Xx,Zx,$x,eP,tP,rP,nP,iP={sid:"",lts:0,success:null,cname:null,uid:null,peer:null,cid:null,elapse:null,extend:null,vid:0};function oP(e){return bx(e.timeout,"config.timeout",0,1e5),bx(e.timeoutFactor,"config.timeoutFactor",0,100,!1),bx(e.maxRetryCount,"config.maxRetryConfig",0,1/0),bx(e.maxRetryTimeout,"config.maxRetryTimeout",0,1/0),!0}function aP(e){return Sx(e.codec,"config.codec",["vp8","vp9","av1","h264"]),Sx(e.mode,"config.mode",["rtc","live"]),void 0!==e.audioCodec&&Sx(e.audioCodec,"config.audioCodec",["opus","pcmu","pcma","g722"]),void 0!==e.proxyServer&&Cx(e.proxyServer,"config.proxyServer",1,1e4),void 0!==e.turnServer&&cP(e.turnServer),void 0!==e.httpRetryConfig&&oP(e.httpRetryConfig),void 0!==e.websocketRetryConfig&&oP(e.websocketRetryConfig),!0}function sP(e){if(!Array.isArray(e)||e.length<1)return!1;try{e.forEach((function(e){if(!e.urls)throw Error()}))}catch(e){return!1}return!0}function cP(e){return Cx(e.turnServerURL,"turnServerURL"),Cx(e.username,"username"),Cx(e.password,"password"),e.udpport&&bx(e.udpport,"udpport",1,99999,!0),e.forceturn&&Ix(e.forceturn,"forceturn"),e.security&&Ix(e.security,"security"),e.tcpport&&bx(e.tcpport,"tcpport",1,99999,!0),!0}function uP(e){return void 0!==e.level&&Sx(e.level,"level",[1,2,3]),!0}!function(e){e.PUBLISH="publish",e.SUBSCRIBE="subscribe",e.WS_COMPRESSOR_INIT="ws_compressor_init",e.SESSION_INIT="session_init",e.JOIN_CHOOSE_SERVER="join_choose_server",e.REQ_USER_ACCOUNT="req_user_account",e.JOIN_GATEWAY="join_gateway",e.REJOIN_GATEWAY="rejoin_gateway",e.STREAM_SWITCH="stream_switch",e.REQUEST_PROXY_WORKER_MANAGER="request_proxy_worker_manager",e.REQUEST_PROXY_APPCENTER="request_proxy_appcenter",e.FIRST_VIDEO_RECEIVED="first_video_received",e.FIRST_AUDIO_RECEIVED="first_audio_received",e.FIRST_VIDEO_DECODE="first_video_decode",e.FIRST_AUDIO_DECODE="first_audio_decode",e.ON_ADD_AUDIO_STREAM="on_add_audio_stream",e.ON_ADD_VIDEO_STREAM="on_add_video_stream",e.ON_UPDATE_STREAM="on_update_stream",e.ON_REMOVE_STREAM="on_remove_stream",e.USER_ANALYTICS="req_user_analytics"}(Lx||(Lx={})),function(e){e.SESSION="io.agora.pb.Wrtc.Session",e.JOIN_CHOOSE_SERVER="io.agora.pb.Wrtc.JoinChooseServer",e.REQ_USER_ACCOUNT="io.agora.pb.Wrtc.ReqUserAccount",e.JOIN_GATEWAT="io.agora.pb.Wrtc.JoinGateway",e.RE_JOIN_GATEWAY="io.agora.pb.Wrtc.ReJoinGateway",e.PUBLISH="io.agora.pb.Wrtc.Publish",e.SUBSCRIBE="io.agora.pb.Wrtc.Subscribe",e.WS_COMPRESSOR_INIT="io.agora.pb.Wrtc.WsCompressorInit",e.STREAM_SWITCH="io.agora.pb.Wrtc.StreamSwitch",e.AUDIO_SENDING_STOPPED="io.agora.pb.Wrtc.AudioSendingStopped",e.VIDEO_SENDING_STOPPED="io.agora.pb.Wrtc.VideoSendingStopped",e.REQUEST_PROXY_APPCENTER="io.agora.pb.Wrtc.RequestProxyAppCenter",e.REQUEST_PROXY_WORKER_MANAGER="io.agora.pb.Wrtc.RequestProxyWorkerManager",e.API_INVOKE="io.agora.pb.Wrtc.ApiInvoke",e.FIRST_VIDEO_RECEIVED="io.agora.pb.Wrtc.FirstVideoReceived",e.FIRST_AUDIO_RECEIVED="io.agora.pb.Wrtc.FirstAudioReceived",e.FIRST_VIDEO_DECODE="io.agora.pb.Wrtc.FirstVideoDecode",e.FIRST_AUDIO_DECODE="io.agora.pb.Wrtc.FirstAudioDecode",e.ON_ADD_AUDIO_STREAM="io.agora.pb.Wrtc.OnAddAudioStream",e.ON_ADD_VIDEO_STREAM="io.agora.pb.Wrtc.OnAddVideoStream",e.ON_UPDATE_STREAM="io.agora.pb.Wrtc.OnUpdateStream",e.ON_REMOVE_STREAM="io.agora.pb.Wrtc.OnRemoveStream",e.JOIN_CHANNEL_TIMEOUT="io.agora.pb.Wrtc.JoinChannelTimeout",e.PEER_PUBLISH_STATUS="io.agora.pb.Wrtc.PeerPublishStatus",e.WORKER_EVENT="io.agora.pb.Wrtc.WorkerEvent",e.AP_WORKER_EVENT="io.agora.pb.Wrtc.APWorkerEvent",e.JOIN_WEB_PROXY_AP="io.agora.pb.Wrtc.JoinWebProxyAP",e.WEBSOCKET_QUIT="io.agora.pb.Wrtc.WebSocketQuit",e.USER_ANALYTICS="io.agora.pb.Wrtc.UserAnalytics",e.AUTOPLAY_FAILED="io.agora.pb.Wrtc.AutoplayFailed"}(Bx||(Bx={})),function(e){e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT"}(Mx||(Mx={})),function(e){e.CREATE_CLIENT="createClient",e.CHECK_SYSTEM_REQUIREMENTS="checkSystemRequirements",e.SET_AREA="setArea",e.CHECK_VIDEO_TRACK_IS_ACTIVE="checkVideoTrackIsActive",e.CHECK_AUDIO_TRACK_IS_ACTIVE="checkAudioTrackIsActive",e.CREATE_MIC_AUDIO_TRACK="createMicrophoneAudioTrack",e.CREATE_CUSTOM_AUDIO_TRACK="createCustomAudioTrack",e.CREATE_BUFFER_AUDIO_TRACK="createBufferSourceAudioTrack",e.CREATE_CAM_VIDEO_TRACK="createCameraVideoTrack",e.CREATE_CUSTOM_VIDEO_TRACK="createCustomVideoTrack",e.CREATE_MIC_AND_CAM_TRACKS="createMicrophoneAndCameraTracks",e.CREATE_SCREEN_VIDEO_TRACK="createScreenVideoTrack",e.SET_ENCRYPTION_CONFIG="Client.setEncryptionConfig",e.START_PROXY_SERVER="Client.startProxyServer",e.STOP_PROXY_SERVER="Client.stopProxyServer",e.SET_PROXY_SERVER="Client.setProxyServer",e.SET_TURN_SERVER="Client.setTurnServer",e.SET_CLIENT_ROLE="Client.setClientRole",e.SET_LOW_STREAM_PARAMETER="Client.setLowStreamParameter",e.ENABLE_DUAL_STREAM="Client.enableDualStream",e.DISABLE_DUAL_STREAM="Client.disableDualStream",e.JOIN="Client.join",e.LEAVE="Client.leave",e.PUBLISH="Client.publish",e.UNPUBLISH="Client.unpublish",e.SUBSCRIBE="Client.subscribe",e.MASS_SUBSCRIBE="Client.massSubscribe",e.MASS_UNSUBSCRIBE="Client.massUnsubscribe",e.UNSUBSCRIBE="Client.unsubscribe",e.RENEW_TOKEN="Client.renewToken",e.SET_REMOTE_VIDEO_STREAM_TYPE="Client.setRemoteVideoStreamType",e.SET_STREAM_FALLBACK_OPTION="Client.setStreamFallbackOption",e.ENABLE_AUDIO_VOLUME_INDICATOR="Client.enableAudioVolumeIndicator",e.SEND_CUSTOM_REPORT_MESSAGE="Client.sendCustomReportMessage",e.JOIN_FALLBACK_TO_PROXY="Client._joinFallbackToProxy",e.ON_LIVE_STREAM_WARNING="Client.onLiveStreamWarning",e.ON_LIVE_STREAM_ERROR="Client.onLiveStreamingError",e.START_LIVE_STREAMING="Client.startLiveStreaming",e.SET_LIVE_TRANSCODING="Client.setLiveTranscoding",e.STOP_LIVE_STREAMING="Client.stopLiveStreaming",e.ADD_INJECT_STREAM_URL="Client.addInjectStreamUrl",e.REMOVE_INJECT_STREAM_URL="Client.removeInjectStreamUrl",e.START_CHANNEL_MEDIA_RELAY="Client.startChannelMediaRelay",e.UPDATE_CHANNEL_MEDIA_RELAY="Client.updateChannelMediaRelay",e.STOP_CHANNEL_MEDIA_RELAY="Client.stopChannelMediaRelay",e.REQUEST_CONFIG_DISTRIBUTE="_config-distribute-request",e.SET_CONFIG_DISTRIBUTE="_configDistribute",e.LOCAL_TRACK_SET_MUTED="LocalTrack.setMute",e.LOCAL_AUDIO_TRACK_PLAY="LocalAudioTrack.play",e.LOCAL_AUDIO_TRACK_PLAY_IN_ELEMENT="LocalAudioTrack.playInElement",e.LOCAL_AUDIO_TRACK_STOP="LocalAudioTrack.stop",e.LOCAL_AUDIO_TRACK_SET_VOLUME="LocalAudioTrack.setVolume",e.MIC_AUDIO_TRACK_SET_DEVICE="MicrophoneAudioTrack.setDevice",e.BUFFER_AUDIO_TRACK_START="BufferSourceAudioTrack.startProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_STOP="BufferSourceAudioTrack.stopProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_PAUSE="BufferSourceAudioTrack.pauseProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_RESUME="BufferSourceAudioTrack.resumeProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_SEEK="BufferSourceAudioTrack.seekAudioBuffer",e.LOCAL_VIDEO_TRACK_PLAY="LocalVideoTrack.play",e.LOCAL_VIDEO_TRACK_STOP="LocalVideoTrack.stop",e.LOCAL_VIDEO_TRACK_GET_VIDEO_VISIBLE="LocalVideoTrack.getVideoElementVisibleStatus",e.LOCAL_VIDEO_TRACK_BEAUTY="LocalVideoTrack.setBeautyEffect",e.CAM_VIDEO_TRACK_SET_DEVICE="CameraVideoTrack.setDevice",e.CAM_VIDEO_TRACK_SET_ENCODER_CONFIG="CameraVideoTrack.setEncoderConfiguration",e.REMOTE_VIDEO_TRACK_PLAY="RemoteVideoTrack.play",e.REMOTE_VIDEO_TRACK_STOP="RemoteVideoTrack.stop",e.REMOTE_VIDEO_TRACK_GET_VIDEO_VISIBLE="RemoteVideoTrack.getVideoElementVisibleStatus",e.REMOTE_AUDIO_TRACK_PLAY="RemoteAudioTrack.play",e.REMOTE_AUDIO_TRACK_STOP="RemoteAudioTrack.stop",e.REMOTE_AUDIO_SET_VOLUME="RemoteAudioTrack.setVolume",e.REMOTE_AUDIO_SET_OUTPUT_DEVICE="RemoteAudioTrack.setOutputDevice",e.GET_MEDIA_STREAM_TRACK="Track.getMediaStreamTrack",e.STREAM_TYPE_CHANGE="streamTypeChange",e.CONNECTION_STATE_CHANGE="connectionStateChange",e.LOAD_CONFIG_FROM_LOCALSTORAGE="loadConfigFromLocalStorage"}(Ux||(Ux={})),function(e){e.TRACER="tracer"}(Qx||(Qx={})),function(e){e.IDLE="IDLE",e.INITING="INITING",e.INITEND="INITEND"}(Fx||(Fx={})),function(e){e.STATE_CHANGE="state_change",e.RECORDING_DEVICE_CHANGED="recordingDeviceChanged",e.PLAYOUT_DEVICE_CHANGED="playoutDeviceChanged",e.CAMERA_DEVICE_CHANGED="cameraDeviceChanged"}(jx||(jx={})),function(e){e[e.ACCESS_POINT=101]="ACCESS_POINT",e[e.UNILBS=201]="UNILBS",e[e.STRING_UID_ALLOCATOR=901]="STRING_UID_ALLOCATOR"}(Vx||(Vx={})),function(e){e[e.IIIEGAL_APPID=1]="IIIEGAL_APPID",e[e.IIIEGAL_UID=2]="IIIEGAL_UID",e[e.INTERNAL_ERROR=3]="INTERNAL_ERROR"}(Gx||(Gx={})),function(e){e[e.INVALID_VENDOR_KEY=5]="INVALID_VENDOR_KEY",e[e.INVALID_CHANNEL_NAME=7]="INVALID_CHANNEL_NAME",e[e.INTERNAL_ERROR=8]="INTERNAL_ERROR",e[e.NO_AUTHORIZED=9]="NO_AUTHORIZED",e[e.DYNAMIC_KEY_TIMEOUT=10]="DYNAMIC_KEY_TIMEOUT",e[e.NO_ACTIVE_STATUS=11]="NO_ACTIVE_STATUS",e[e.DYNAMIC_KEY_EXPIRED=13]="DYNAMIC_KEY_EXPIRED",e[e.STATIC_USE_DYNAMIC_KEY=14]="STATIC_USE_DYNAMIC_KEY",e[e.DYNAMIC_USE_STATIC_KEY=15]="DYNAMIC_USE_STATIC_KEY",e[e.USER_OVERLOAD=16]="USER_OVERLOAD",e[e.FORBIDDEN_REGION=18]="FORBIDDEN_REGION",e[e.CANNOT_MEET_AREA_DEMAND=19]="CANNOT_MEET_AREA_DEMAND"}(Kx||(Kx={})),function(e){e[e.NO_FLAG_SET=100]="NO_FLAG_SET",e[e.FLAG_SET_BUT_EMPTY=101]="FLAG_SET_BUT_EMPTY",e[e.INVALID_FALG_SET=102]="INVALID_FALG_SET",e[e.FLAG_SET_BUT_NO_RE=103]="FLAG_SET_BUT_NO_RE",e[e.INVALID_SERVICE_ID=104]="INVALID_SERVICE_ID",e[e.NO_SERVICE_AVAILABLE=200]="NO_SERVICE_AVAILABLE",e[e.NO_SERVICE_AVAILABLE_P2P=201]="NO_SERVICE_AVAILABLE_P2P",e[e.NO_SERVICE_AVAILABLE_VOICE=202]="NO_SERVICE_AVAILABLE_VOICE",e[e.NO_SERVICE_AVAILABLE_WEBRTC=203]="NO_SERVICE_AVAILABLE_WEBRTC",e[e.NO_SERVICE_AVAILABLE_CDS=204]="NO_SERVICE_AVAILABLE_CDS",e[e.NO_SERVICE_AVAILABLE_CDN=205]="NO_SERVICE_AVAILABLE_CDN",e[e.NO_SERVICE_AVAILABLE_TDS=206]="NO_SERVICE_AVAILABLE_TDS",e[e.NO_SERVICE_AVAILABLE_REPORT=207]="NO_SERVICE_AVAILABLE_REPORT",e[e.NO_SERVICE_AVAILABLE_APP_CENTER=208]="NO_SERVICE_AVAILABLE_APP_CENTER",e[e.NO_SERVICE_AVAILABLE_ENV0=209]="NO_SERVICE_AVAILABLE_ENV0",e[e.NO_SERVICE_AVAILABLE_VOET=210]="NO_SERVICE_AVAILABLE_VOET",e[e.NO_SERVICE_AVAILABLE_STRING_UID=211]="NO_SERVICE_AVAILABLE_STRING_UID",e[e.NO_SERVICE_AVAILABLE_WEBRTC_UNILBS=212]="NO_SERVICE_AVAILABLE_WEBRTC_UNILBS",e[e.NO_SERVICE_AVAILABLE_UNILBS_FLV=213]="NO_SERVICE_AVAILABLE_UNILBS_FLV"}(Hx||(Hx={})),function(e){e[e.K_TIMESTAMP_EXPIRED=2]="K_TIMESTAMP_EXPIRED",e[e.K_CHANNEL_PERMISSION_INVALID=3]="K_CHANNEL_PERMISSION_INVALID",e[e.K_CERTIFICATE_INVALID=4]="K_CERTIFICATE_INVALID",e[e.K_CHANNEL_NAME_EMPTY=5]="K_CHANNEL_NAME_EMPTY",e[e.K_CHANNEL_NOT_FOUND=6]="K_CHANNEL_NOT_FOUND",e[e.K_TICKET_INVALID=7]="K_TICKET_INVALID",e[e.K_CHANNEL_CONFLICTED=8]="K_CHANNEL_CONFLICTED",e[e.K_SERVICE_NOT_READY=9]="K_SERVICE_NOT_READY",e[e.K_SERVICE_TOO_HEAVY=10]="K_SERVICE_TOO_HEAVY",e[e.K_UID_BANNED=14]="K_UID_BANNED",e[e.K_IP_BANNED=15]="K_IP_BANNED",e[e.K_CHANNEL_BANNED=16]="K_CHANNEL_BANNED",e[e.WARN_NO_AVAILABLE_CHANNEL=103]="WARN_NO_AVAILABLE_CHANNEL",e[e.WARN_LOOKUP_CHANNEL_TIMEOUT=104]="WARN_LOOKUP_CHANNEL_TIMEOUT",e[e.WARN_LOOKUP_CHANNEL_REJECTED=105]="WARN_LOOKUP_CHANNEL_REJECTED",e[e.WARN_OPEN_CHANNEL_TIMEOUT=106]="WARN_OPEN_CHANNEL_TIMEOUT",e[e.WARN_OPEN_CHANNEL_REJECTED=107]="WARN_OPEN_CHANNEL_REJECTED",e[e.WARN_REQUEST_DEFERRED=108]="WARN_REQUEST_DEFERRED",e[e.ERR_DYNAMIC_KEY_TIMEOUT=109]="ERR_DYNAMIC_KEY_TIMEOUT",e[e.ERR_NO_AUTHORIZED=110]="ERR_NO_AUTHORIZED",e[e.ERR_VOM_SERVICE_UNAVAILABLE=111]="ERR_VOM_SERVICE_UNAVAILABLE",e[e.ERR_NO_CHANNEL_AVAILABLE_CODE=112]="ERR_NO_CHANNEL_AVAILABLE_CODE",e[e.ERR_MASTER_VOCS_UNAVAILABLE=114]="ERR_MASTER_VOCS_UNAVAILABLE",e[e.ERR_INTERNAL_ERROR=115]="ERR_INTERNAL_ERROR",e[e.ERR_NO_ACTIVE_STATUS=116]="ERR_NO_ACTIVE_STATUS",e[e.ERR_INVALID_UID=117]="ERR_INVALID_UID",e[e.ERR_DYNAMIC_KEY_EXPIRED=118]="ERR_DYNAMIC_KEY_EXPIRED",e[e.ERR_STATIC_USE_DYANMIC_KE=119]="ERR_STATIC_USE_DYANMIC_KE",e[e.ERR_DYNAMIC_USE_STATIC_KE=120]="ERR_DYNAMIC_USE_STATIC_KE",e[e.ERR_NO_VOCS_AVAILABLE=2e3]="ERR_NO_VOCS_AVAILABLE",e[e.ERR_NO_VOS_AVAILABLE=2001]="ERR_NO_VOS_AVAILABLE",e[e.ERR_JOIN_CHANNEL_TIMEOUT=2002]="ERR_JOIN_CHANNEL_TIMEOUT",e[e.ERR_REPEAT_JOIN_CHANNEL=2003]="ERR_REPEAT_JOIN_CHANNEL",e[e.ERR_JOIN_BY_MULTI_IP=2004]="ERR_JOIN_BY_MULTI_IP",e[e.ERR_NOT_JOINED=2011]="ERR_NOT_JOINED",e[e.ERR_REPEAT_JOIN_REQUEST=2012]="ERR_REPEAT_JOIN_REQUEST",e[e.ERR_INVALID_VENDOR_KEY=2013]="ERR_INVALID_VENDOR_KEY",e[e.ERR_INVALID_CHANNEL_NAME=2014]="ERR_INVALID_CHANNEL_NAME",e[e.ERR_INVALID_STRINGUID=2015]="ERR_INVALID_STRINGUID",e[e.ERR_TOO_MANY_USERS=2016]="ERR_TOO_MANY_USERS",e[e.ERR_SET_CLIENT_ROLE_TIMEOUT=2017]="ERR_SET_CLIENT_ROLE_TIMEOUT",e[e.ERR_SET_CLIENT_ROLE_NO_PERMISSION=2018]="ERR_SET_CLIENT_ROLE_NO_PERMISSION",e[e.ERR_SET_CLIENT_ROLE_ALREADY_IN_USE=2019]="ERR_SET_CLIENT_ROLE_ALREADY_IN_USE",e[e.ERR_PUBLISH_REQUEST_INVALID=2020]="ERR_PUBLISH_REQUEST_INVALID",e[e.ERR_SUBSCRIBE_REQUEST_INVALID=2021]="ERR_SUBSCRIBE_REQUEST_INVALID",e[e.ERR_NOT_SUPPORTED_MESSAGE=2022]="ERR_NOT_SUPPORTED_MESSAGE",e[e.ERR_ILLEAGAL_PLUGIN=2023]="ERR_ILLEAGAL_PLUGIN",e[e.ERR_REJOIN_TOKEN_INVALID=2024]="ERR_REJOIN_TOKEN_INVALID",e[e.ERR_REJOIN_USER_NOT_JOINED=2025]="ERR_REJOIN_USER_NOT_JOINED",e[e.ERR_INVALID_OPTIONAL_INFO=2027]="ERR_INVALID_OPTIONAL_INFO",e[e.ILLEGAL_AES_PASSWORD=2028]="ILLEGAL_AES_PASSWORD",e[e.ILLEGAL_CLIENT_ROLE_LEVEL=2029]="ILLEGAL_CLIENT_ROLE_LEVEL",e[e.ERR_TOO_MANY_BROADCASTERS=2031]="ERR_TOO_MANY_BROADCASTERS",e[e.ERR_TOO_MANY_SUBSCRIBERS=2032]="ERR_TOO_MANY_SUBSCRIBERS",e[e.ERR_TEST_RECOVER=9e3]="ERR_TEST_RECOVER",e[e.ERR_TEST_TRYNEXT=9001]="ERR_TEST_TRYNEXT",e[e.ERR_TEST_RETRY=9002]="ERR_TEST_RETRY"}(Wx||(Wx={})),function(e){e[e.AUDIENCE_LEVEL_LOW_LATENCY=1]="AUDIENCE_LEVEL_LOW_LATENCY",e[e.AUDIENCE_LEVEL_ULTRA_LOW_LATENCY=2]="AUDIENCE_LEVEL_ULTRA_LOW_LATENCY",e[e.AUDIENCE_LEVEL_SYNC_LATENCY=3]="AUDIENCE_LEVEL_SYNC_LATENCY"}(Yx||(Yx={})),function(e){e.LEAVE="LEAVE",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.UID_BANNED="UID_BANNED",e.IP_BANNED="IP_BANNED",e.CHANNEL_BANNED="CHANNEL_BANNED",e.FALLBACK="FALLBACK"}(qx||(qx={})),function(e){e.CONNECTION_STATE_CHANGE="connection-state-change",e.MEDIA_RECONNECT_START="media-reconnect-start",e.MEDIA_RECONNECT_END="media-reconnect-end",e.IS_USING_CLOUD_PROXY="is-using-cloud-proxy",e.USER_JOINED="user-joined",e.USER_LEAVED="user-left",e.USER_PUBLISHED="user-published",e.USER_UNPUBLISHED="user-unpublished",e.USER_INFO_UPDATED="user-info-updated",e.CLIENT_BANNED="client-banned",e.CHANNEL_MEDIA_RELAY_STATE="channel-media-relay-state",e.CHANNEL_MEDIA_RELAY_EVENT="channel-media-relay-event",e.VOLUME_INDICATOR="volume-indicator",e.CRYPT_ERROR="crypt-error",e.ON_TOKEN_PRIVILEGE_WILL_EXPIRE="token-privilege-will-expire",e.ON_TOKEN_PRIVILEGE_DID_EXPIRE="token-privilege-did-expire",e.NETWORK_QUALITY="network-quality",e.STREAM_TYPE_CHANGED="stream-type-changed",e.STREAM_FALLBACK="stream-fallback",e.RECEIVE_METADATA="receive-metadata",e.STREAM_MESSAGE="stream-message",e.LIVE_STREAMING_ERROR="live-streaming-error",e.LIVE_STREAMING_WARNING="live-streaming-warning",e.INJECT_STREAM_STATUS="stream-inject-status",e.EXCEPTION="exception",e.ERROR="error",e.P2P_LOST="p2p_lost",e.JOIN_FALLBACK_TO_PROXY="join-fallback-to-proxy",e.MEDIA_CONNECTION_TYPE_CHANGE="media-connection-type-change",e.PUBLISHED_USER_LIST="published-user-list"}(Jx||(Jx={})),function(e){e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.MULTI_IP="MULTI_IP",e.TIMEOUT="TIMEOUT",e.OFFLINE="OFFLINE",e.LEAVE="LEAVE",e.P2P_FAILED="P2P_FAILED",e.FALLBACK="FALLBACK"}(zx||(zx={})),function(e){e.CONNECTING="connecting",e.CONNECTED="connected",e.RECONNECTING="reconnecting",e.CLOSED="closed"}(Xx||(Xx={})),function(e){e.WS_CONNECTED="ws_connected",e.WS_RECONNECTING="ws_reconnecting",e.WS_CLOSED="ws_closed",e.WS_RECONNECT_WAITTING_FINISH="ws_reconnect_waitting_finish",e.WS_RECONNECT_CREATE_CONNECTION="ws_reconnect_create_connection",e.ON_BINARY_DATA="on_binary_data",e.REQUEST_RECOVER="request_recover",e.REQUEST_JOIN_INFO="request_join_info",e.REQUEST_REJOIN_INFO="req_rejoin_info",e.IS_P2P_DISCONNECTED="is_p2p_dis",e.DISCONNECT_P2P="dis_p2p",e.ABORT_P2P_EXECUTION="abort_p2p_execution",e.NEED_RENEW_SESSION="need-sid",e.REPORT_JOIN_GATEWAY="report_join_gateway",e.REQUEST_TIMEOUT="request_timeout",e.REQUEST_SUCCESS="request_success",e.JOIN_RESPONSE="join_response"}(Zx||(Zx={})),function(e){e.PING="ping",e.PING_BACK="ping_back",e.JOIN="join_v3",e.REJOIN="rejoin_v3",e.LEAVE="leave",e.SET_CLIENT_ROLE="set_client_role",e.PUBLISH="publish",e.UNPUBLISH="unpublish",e.SUBSCRIBE="subscribe",e.SUBSCRIBE_STREAMS="subscribe_streams",e.UNSUBSCRIBE="unsubscribe",e.UNSUBSCRIBE_STREAMS="unsubscribe_streams",e.SUBSCRIBE_CHANGE="subscribe_change",e.TRAFFIC_STATS="traffic_stats",e.RENEW_TOKEN="renew_token",e.SWITCH_VIDEO_STREAM="switch_video_stream",e.DEFAULT_VIDEO_STREAM="default_video_stream",e.SET_FALLBACK_OPTION="set_fallback_option",e.GATEWAY_INFO="gateway_info",e.CONTROL="control",e.SEND_METADATA="send_metadata",e.DATA_STREAM="data_stream",e.PICK_SVC_LAYER="pick_svc_layer",e.RESTART_ICE="restart_ice",e.CONNECT_PC="connect_pc",e.SET_VIDEO_PROFILE="set_video_profile"}($x||($x={})),function(e){e.PUBLISH_STATS="publish_stats",e.PUBLISH_RELATED_STATS="publish_related_stats",e.SUBSCRIBE_STATS="subscribe_stats",e.SUBSCRIBE_RELATED_STATS="subscribe_related_stats",e.WS_INFLATE_DATA_LENGTH="ws_inflate_data_length",e.DENOISER_STATS="denoiser_stats",e.TRANSPORT_STATS="transport_stats"}(eP||(eP={})),function(e){e.ON_USER_ONLINE="on_user_online",e.ON_USER_OFFLINE="on_user_offline",e.ON_STREAM_FALLBACK_UPDATE="on_stream_fallback_update",e.ON_PUBLISH_STREAM="on_publish_stream",e.ON_UPLINK_STATS="on_uplink_stats",e.ON_P2P_LOST="on_p2p_lost",e.ON_REMOVE_STREAM="on_remove_stream",e.ON_ADD_AUDIO_STREAM="on_add_audio_stream",e.ON_ADD_VIDEO_STREAM="on_add_video_stream",e.ON_TOKEN_PRIVILEGE_WILL_EXPIRE="on_token_privilege_will_expire",e.ON_TOKEN_PRIVILEGE_DID_EXPIRE="on_token_privilege_did_expire",e.ON_USER_BANNED="on_user_banned",e.ON_NOTIFICATION="on_notification",e.ON_CRYPT_ERROR="on_crypt_error",e.MUTE_AUDIO="mute_audio",e.MUTE_VIDEO="mute_video",e.UNMUTE_AUDIO="unmute_audio",e.UNMUTE_VIDEO="unmute_video",e.ON_P2P_OK="on_p2p_ok",e.RECEIVE_METADATA="receive_metadata",e.ON_DATA_STREAM="on_data_stream",e.ENABLE_LOCAL_VIDEO="enable_local_video",e.DISABLE_LOCAL_VIDEO="disable_local_video",e.ENABLE_LOCAL_AUDIO="enable_local_audio",e.DISABLE_LOCAL_AUDIO="disable_local_audio",e.ON_PUBLISHED_USER_LIST="on_published_user_list"}(tP||(tP={})),function(e){e.CONNECTION_STATE_CHANGE="CONNECTION_STATE_CHANGE",e.NEED_ANSWER="NEED_ANSWER",e.NEED_RENEGOTIATE="NEED_RENEGOTIATE",e.P2P_LOST="P2P_LOST",e.GATEWAY_P2P_LOST="GATEWAY_P2P_LOST",e.NEED_UNPUB="NEED_UNPUB",e.NEED_UNSUB="NEED_UNSUB",e.NEED_UPLOAD="NEED_UPLOAD",e.NEED_CONTROL="NEED_CONTROL",e.START_RECONNECT="START_RECONNECT",e.END_RECONNECT="END_RECONNECT",e.NEED_SIGNAL_RTT="NEED_SIGNAL_RTT"}(rP||(rP={})),function(e){e.AUDIO_SOURCE_STATE_CHANGE="audio_source_state_change",e.RECEIVE_TRACK_BUFFER="receive_track_buffer",e.ON_AUDIO_BUFFER="on_audio_buffer",e.UPDATE_SOURCE="update_source"}(nP||(nP={}));var dP,lP,pP,fP={sendVolumeLevel:0,sendBitrate:0,sendBytes:0,sendPackets:0,sendPacketsLost:0,currentPacketLossRate:0},hP={sendBytes:0,sendBitrate:0,sendPackets:0,sendPacketsLost:0,sendResolutionHeight:0,sendResolutionWidth:0,captureResolutionHeight:0,captureResolutionWidth:0,targetSendBitrate:0,totalDuration:0,totalFreezeTime:0,currentPacketLossRate:0},AP={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveLevel:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1},vP={uplinkNetworkQuality:0,downlinkNetworkQuality:0},gP={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,receiveResolutionHeight:0,receiveResolutionWidth:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1};!function(e){e.CONNECTED="websocket:connected",e.RECONNECTING="websocket:reconnecting",e.WILL_RECONNECT="websocket:will_reconnect",e.CLOSED="websocket:closed",e.FAILED="websocket:failed",e.ON_MESSAGE="websocket:on_message",e.REQUEST_NEW_URLS="websocket:request_new_urls",e.RECONNECT_WAITTING_FINISH="websocket:reconnect_waitting_finish",e.RECONNECT_CREATE_CONNECTION="websocket:reconnect_create_connection"}(dP||(dP={})),function(e){e.TRANSCODE="mix_streaming",e.RAW="raw_streaming",e.INJECT="inject_streaming"}(lP||(lP={})),function(e){e[e.INJECT_STREAM_STATUS_START_SUCCESS=0]="INJECT_STREAM_STATUS_START_SUCCESS",e[e.INJECT_STREAM_STATUS_START_ALREADY_EXISTS=1]="INJECT_STREAM_STATUS_START_ALREADY_EXISTS",e[e.INJECT_STREAM_STATUS_START_UNAUTHORIZED=2]="INJECT_STREAM_STATUS_START_UNAUTHORIZED",e[e.INJECT_STREAM_STATUS_START_TIMEOUT=3]="INJECT_STREAM_STATUS_START_TIMEOUT",e[e.INJECT_STREAM_STATUS_START_FAILED=4]="INJECT_STREAM_STATUS_START_FAILED",e[e.INJECT_STREAM_STATUS_STOP_SUCCESS=5]="INJECT_STREAM_STATUS_STOP_SUCCESS",e[e.INJECT_STREAM_STATUS_STOP_NOT_FOUND=6]="INJECT_STREAM_STATUS_STOP_NOT_FOUND",e[e.INJECT_STREAM_STATUS_STOP_UNAUTHORIZED=7]="INJECT_STREAM_STATUS_STOP_UNAUTHORIZED",e[e.INJECT_STREAM_STATUS_STOP_TIMEOUT=8]="INJECT_STREAM_STATUS_STOP_TIMEOUT",e[e.INJECT_STREAM_STATUS_STOP_FAILED=9]="INJECT_STREAM_STATUS_STOP_FAILED",e[e.INJECT_STREAM_STATUS_BROKEN=10]="INJECT_STREAM_STATUS_BROKEN"}(pP||(pP={}));var mP={alpha:1,height:640,width:360,x:0,y:0,zOrder:0,audioChannel:0},EP={x:0,y:0,width:160,height:160,zOrder:255,alpha:1};function _P(e,t){Cx(e.url,"".concat(t,".url"),1,1e3,!1),kx(e.x)||bx(e.x,"".concat(t,".x"),0,1e4),kx(e.y)||bx(e.y,"".concat(t,".y"),0,1e4),kx(e.width)||bx(e.width,"".concat(t,".width"),0,1e4),kx(e.height)||bx(e.height,"".concat(t,".height"),0,1e4),kx(e.zOrder)||bx(e.zOrder,"".concat(t,".zOrder"),0,255),kx(e.alpha)||bx(e.alpha,"".concat(t,".alpha"),0,1,!1)}var yP,IP,SP,bP,CP,wP,RP,TP,kP,OP,DP,NP,xP,PP,LP,BP,MP,UP,QP={audioBitrate:48,audioChannels:1,audioSampleRate:48e3,backgroundColor:0,height:360,lowLatency:!1,videoBitrate:400,videoCodecProfile:100,videoCodecType:1,videoFrameRate:15,videoGop:30,width:640,images:[],userConfigs:[],userConfigExtraInfo:""},FP={audioBitrate:48,audioChannels:2,audioVolume:100,audioSampleRate:48e3,height:0,width:0,videoBitrate:400,videoFramerate:15,videoGop:30};function jP(e){if(!e.channelName)throw new SD(mD.INVALID_PARAMS,"invalid channelName in info");if(!e.uid||"number"!=typeof e.uid)throw new SD(mD.INVALID_PARAMS,"invalid uid in info, uid must be a number");return e.token&&Cx(e.token,"info.token",1,2047),Tx(e.uid),Rx(e.channelName),!0}function VP(e){return Sx(e,"mediaSource",["screen","window","application"]),!0}!function(e){e.WARNING="@live_uap-warning",e.ERROR="@line_uap-error",e.PUBLISH_STREAM_STATUS="@live_uap-publish-status",e.INJECT_STREAM_STATUS="@live_uap-inject-status",e.WORKER_STATUS="@live_uap-worker-status",e.REQUEST_NEW_ADDRESS="@live_uap-request-address"}(yP||(yP={})),function(e){e.REQUEST_WORKER_MANAGER_LIST="@live_req_worker_manager"}(IP||(IP={})),function(e){e[e.LIVE_STREAM_RESPONSE_SUCCEED=200]="LIVE_STREAM_RESPONSE_SUCCEED",e[e.LIVE_STREAM_RESPONSE_ALREADY_EXISTS_STREAM=454]="LIVE_STREAM_RESPONSE_ALREADY_EXISTS_STREAM",e[e.LIVE_STREAM_RESPONSE_TRANSCODING_PARAMETER_ERROR=450]="LIVE_STREAM_RESPONSE_TRANSCODING_PARAMETER_ERROR",e[e.LIVE_STREAM_RESPONSE_BAD_STREAM=451]="LIVE_STREAM_RESPONSE_BAD_STREAM",e[e.LIVE_STREAM_RESPONSE_WM_PARAMETER_ERROR=400]="LIVE_STREAM_RESPONSE_WM_PARAMETER_ERROR",e[e.LIVE_STREAM_RESPONSE_WM_WORKER_NOT_EXIST=404]="LIVE_STREAM_RESPONSE_WM_WORKER_NOT_EXIST",e[e.LIVE_STREAM_RESPONSE_NOT_AUTHORIZED=456]="LIVE_STREAM_RESPONSE_NOT_AUTHORIZED",e[e.LIVE_STREAM_RESPONSE_FAILED_LOAD_IMAGE=457]="LIVE_STREAM_RESPONSE_FAILED_LOAD_IMAGE",e[e.LIVE_STREAM_RESPONSE_REQUEST_TOO_OFTEN=429]="LIVE_STREAM_RESPONSE_REQUEST_TOO_OFTEN",e[e.LIVE_STREAM_RESPONSE_NOT_FOUND_PUBLISH=452]="LIVE_STREAM_RESPONSE_NOT_FOUND_PUBLISH",e[e.LIVE_STREAM_RESPONSE_NOT_SUPPORTED=453]="LIVE_STREAM_RESPONSE_NOT_SUPPORTED",e[e.LIVE_STREAM_RESPONSE_MAX_STREAM_NUM=455]="LIVE_STREAM_RESPONSE_MAX_STREAM_NUM",e[e.LIVE_STREAM_RESPONSE_INTERNAL_SERVER_ERROR=500]="LIVE_STREAM_RESPONSE_INTERNAL_SERVER_ERROR",e[e.LIVE_STREAM_RESPONSE_WORKER_LOST=501]="LIVE_STREAM_RESPONSE_WORKER_LOST",e[e.LIVE_STREAM_RESPONSE_RESOURCE_LIMIT=502]="LIVE_STREAM_RESPONSE_RESOURCE_LIMIT",e[e.LIVE_STREAM_RESPONSE_WORKER_QUIT=503]="LIVE_STREAM_RESPONSE_WORKER_QUIT",e[e.ERROR_FAIL_SEND_MESSAGE=504]="ERROR_FAIL_SEND_MESSAGE",e[e.PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE=30]="PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE",e[e.PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT=31]="PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT",e[e.PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH=32]="PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH",e[e.PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN=33]="PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN"}(SP||(SP={})),function(e){e.CONNECT_FAILED="connect failed",e.CONNECT_TIMEOUT="connect timeout",e.WS_DISCONNECTED="websocket disconnected",e.REQUEST_TIMEOUT="request timeout",e.REQUEST_FAILED="request failed",e.WAIT_STATUS_TIMEOUT="wait status timeout",e.WAIT_STATUS_ERROR="wait status error",e.BAD_STATE="bad state",e.WS_ABORT="ws abort",e.AP_REQUEST_TIMEOUT="AP request timeout",e.AP_JSON_PARSE_ERROR="AP json parse error",e.AP_REQUEST_ERROR="AP request error",e.AP_REQUEST_ABORT="AP request abort"}(bP||(bP={})),function(e){e[e.SetSdkProfile=0]="SetSdkProfile",e[e.SetSourceChannel=1]="SetSourceChannel",e[e.SetSourceUserId=2]="SetSourceUserId",e[e.SetDestChannel=3]="SetDestChannel",e[e.StartPacketTransfer=4]="StartPacketTransfer",e[e.StopPacketTransfer=5]="StopPacketTransfer",e[e.UpdateDestChannel=6]="UpdateDestChannel",e[e.Reconnect=7]="Reconnect",e[e.SetVideoProfile=8]="SetVideoProfile"}(CP||(CP={})),function(e){e.NETWORK_DISCONNECTED="NETWORK_DISCONNECTED",e.NETWORK_CONNECTED="NETWORK_CONNECTED",e.PACKET_JOINED_SRC_CHANNEL="PACKET_JOINED_SRC_CHANNEL",e.PACKET_JOINED_DEST_CHANNEL="PACKET_JOINED_DEST_CHANNEL",e.PACKET_SENT_TO_DEST_CHANNEL="PACKET_SENT_TO_DEST_CHANNEL",e.PACKET_RECEIVED_VIDEO_FROM_SRC="PACKET_RECEIVED_VIDEO_FROM_SRC",e.PACKET_RECEIVED_AUDIO_FROM_SRC="PACKET_RECEIVED_AUDIO_FROM_SRC",e.PACKET_UPDATE_DEST_CHANNEL="PACKET_UPDATE_DEST_CHANNEL",e.PACKET_UPDATE_DEST_CHANNEL_REFUSED="PACKET_UPDATE_DEST_CHANNEL_REFUSED",e.PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE="PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE"}(wP||(wP={})),function(e){e.RELAY_STATE_IDLE="RELAY_STATE_IDLE",e.RELAY_STATE_CONNECTING="RELAY_STATE_CONNECTING",e.RELAY_STATE_RUNNING="RELAY_STATE_RUNNING",e.RELAY_STATE_FAILURE="RELAY_STATE_FAILURE"}(RP||(RP={})),function(e){e.RELAY_OK="RELAY_OK",e.SERVER_CONNECTION_LOST="SERVER_CONNECTION_LOST",e.SRC_TOKEN_EXPIRED="SRC_TOKEN_EXPIRED",e.DEST_TOKEN_EXPIRED="DEST_TOKEN_EXPIRED"}(TP||(TP={})),function(e){e.High="high",e.Low="low",e.Audio="audio",e.Screen="screen",e.ScreenLow="screen_low"}(kP||(kP={})),function(e){e.DISCONNECT="disconnect",e.CONNECTION_STATE_CHANGE="connection-state-change",e.NETWORK_QUALITY="network-quality",e.STREAM_TYPE_CHANGE="stream-type-change",e.IS_P2P_DISCONNECTED="is-p2p-dis",e.DISCONNECT_P2P="dis-p2p",e.REQUEST_NEW_GATEWAY_LIST="req-gate-url",e.NEED_RENEW_SESSION="need-sid",e.REQUEST_P2P_CONNECTION_PARAMS="request-p2p-connection-params",e.JOIN_RESPONSE="join-response"}(OP||(OP={})),function(e){e[e.Nothing=0]="Nothing",e[e.Audio=1]="Audio",e[e.LwoVideo=2]="LwoVideo",e[e.Video=4]="Video",e[e.Data=8]="Data"}(DP||(DP={})),function(e){e.NEED_RENEGOTIATE="@need_renegotiate",e.NEED_REPLACE_TRACK="@need_replace_track",e.NEED_CLOSE="@need_close",e.NEED_ENABLE_TRACK="@need_enable_track",e.NEED_DISABLE_TRACK="@need_disable_track",e.NEED_SESSION_ID="@need_sid",e.SET_OPTIMIZATION_MODE="@set_optimization_mode",e.GET_STATS="@get_stats",e.GET_LOW_VIDEO_TRACK="@get_low_video_track",e.NEED_RESET_REMOTE_SDP="@need_reset_remote_sdp",e.NEED_UPDATE_VIDEO_ENCODER="@need_update_video_encoder",e.NEED_MUTE_TRACK="@need_mute_track",e.NEED_UNMUTE_TRACK="@need_unmute_track"}(NP||(NP={})),function(e){e.SCREEN_TRACK="screen_track",e.LOW_STREAM="low_stream"}(xP||(xP={})),function(e){e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM"}(PP||(PP={})),function(e){e[e.DISABLE=0]="DISABLE",e[e.LOW_STREAM=1]="LOW_STREAM",e[e.AUDIO_ONLY=2]="AUDIO_ONLY"}(LP||(LP={})),function(e){e.SOURCE_STATE_CHANGE="source-state-change",e.TRACK_ENDED="track-ended",e.BEAUTY_EFFECT_OVERLOAD="beauty-effect-overload",e.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",e.CLOSED="closed"}(BP||(BP={})),function(e){e.FIRST_FRAME_DECODED="first-frame-decoded",e.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status"}(MP||(MP={})),function(e){e.CHINA="CHINA",e.ASIA="ASIA",e.NORTH_AMERICA="NORTH_AMERICA",e.EUROPE="EUROPE",e.JAPAN="JAPAN",e.INDIA="INDIA",e.KOREA="KOREA",e.HKMC="HKMC",e.US="US",e.OCEANIA="OCEANIA",e.SOUTH_AMERICA="SOUTH_AMERICA",e.AFRICA="AFRICA",e.OVERSEA="OVERSEA",e.GLOBAL="GLOBAL"}(UP||(UP={}));var GP,KP=[UP.AFRICA,UP.ASIA,UP.CHINA,UP.EUROPE,UP.GLOBAL,UP.INDIA,UP.JAPAN,UP.NORTH_AMERICA,UP.OCEANIA,UP.OVERSEA,UP.SOUTH_AMERICA];!function(e){e.CHINA="CN",e.ASIA="AS",e.NORTH_AMERICA="NA",e.EUROPE="EU",e.JAPAN="JP",e.INDIA="IN",e.KOREA="KR",e.HKMC="HK",e.US="US",e.OCEANIA="OC",e.SOUTH_AMERICA="SA",e.AFRICA="AF",e.OVERSEA="OVERSEA",e.GLOBAL="GLOBAL"}(GP||(GP={}));var HP,WP,YP,qP,JP,zP,XP,ZP,$P={CHINA:{},ASIA:{CODE:GP.ASIA,WEBCS_DOMAIN:["ap-web-1-asia.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-asia.agora.io"],PROXY_CS:["proxy-ap-web-asia.agora.io"],CDS_AP:["cds-ap-web-asia.agora.io","cds-ap-web-asia2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-asia.agora.io","sua-ap-web-asia2.agora.io"],UAP_AP:["uap-ap-web-asia.agora.io","uap-ap-web-asia2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-asia.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-asia.agora.io"],LOG_UPLOAD_SERVER:["logservice-asia.agora.io"],PROXY_SERVER_TYPE3:["southeast-asia.webrtc-cloud-proxy.sd-rtn.com"]},NORTH_AMERICA:{CODE:GP.NORTH_AMERICA,WEBCS_DOMAIN:["ap-web-1-north-america.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-north-america.agora.io"],PROXY_CS:["proxy-ap-web-america.agora.io"],CDS_AP:["cds-ap-web-america.agora.io","cds-ap-web-america2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-america.agora.io","sua-ap-web-america2.agora.io"],UAP_AP:["uap-ap-web-america.agora.io","uap-ap-web-america2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-north-america.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-north-america.agora.io"],LOG_UPLOAD_SERVER:["logservice-north-america.agora.io"],PROXY_SERVER_TYPE3:["east-usa.webrtc-cloud-proxy.sd-rtn.com"]},EUROPE:{CODE:GP.EUROPE,WEBCS_DOMAIN:["ap-web-1-europe.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-europe.agora.io"],PROXY_CS:["proxy-ap-web-europe.agora.io"],CDS_AP:["cds-ap-web-europe.agora.io","cds-ap-web-europe2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-europe.agora.io","sua-ap-web-europe.agora.io"],UAP_AP:["uap-ap-web-europe.agora.io","uap-ap-web-europe2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-europe.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-europe.agora.io"],LOG_UPLOAD_SERVER:["logservice-europe.agora.io"],PROXY_SERVER_TYPE3:["europe.webrtc-cloud-proxy.sd-rtn.com"]},JAPAN:{CODE:GP.JAPAN,WEBCS_DOMAIN:["ap-web-1-japan.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-japan.agora.io"],PROXY_CS:["proxy-ap-web-japan.agora.io"],CDS_AP:["cds-ap-web-japan.agora.io","cds-ap-web-japan2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-japan.agora.io","sua-ap-web-japan2.agora.io"],UAP_AP:["uap-ap-web-japan.agora.io","\tuap-ap-web-japan2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-japan.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-japan.agora.io"],LOG_UPLOAD_SERVER:["logservice-japan.agora.io"],PROXY_SERVER_TYPE3:["japan.webrtc-cloud-proxy.sd-rtn.com"]},INDIA:{CODE:GP.INDIA,WEBCS_DOMAIN:["ap-web-1-india.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-india.agora.io"],PROXY_CS:["proxy-ap-web-india.agora.io"],CDS_AP:["cds-ap-web-india.agora.io","cds-ap-web-india2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-india.agora.io","sua-ap-web-india2.agora.io"],UAP_AP:["uap-ap-web-india.agora.io","uap-ap-web-india2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-india.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-india.agora.io"],LOG_UPLOAD_SERVER:["logservice-india.agora.io"],PROXY_SERVER_TYPE3:["india.webrtc-cloud-proxy.sd-rtn.com"]},KOREA:{CODE:GP.KOREA,WEBCS_DOMAIN:["ap-web-1-korea.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-korea.agora.io"],PROXY_CS:["proxy-ap-web-korea.agora.io"],CDS_AP:["cds-ap-web-korea.agora.io","cds-ap-web-korea2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-korea.agora.io","sua-ap-web-korea2.agora.io"],UAP_AP:["uap-ap-web-korea.agora.io","uap-ap-web-korea2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-korea.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-korea.agora.io"],LOG_UPLOAD_SERVER:["logservice-korea.agora.io"],PROXY_SERVER_TYPE3:["korea.webrtc-cloud-proxy.sd-rtn.com"]},HKMC:{CODE:GP.HKMC,WEBCS_DOMAIN:["ap-web-1-hkmc.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-hkmc.agora.io"],PROXY_CS:["proxy-ap-web-hkmc.agora.io"],CDS_AP:["cds-ap-web-hkmc.agora.io","cds-ap-web-hkmc2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-hkmc.agora.io","sua-ap-web-hkmc2.agora.io"],UAP_AP:["uap-ap-web-hkmc.agora.io","uap-ap-web-hkmc2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-hkmc.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-hkmc.agora.io"],LOG_UPLOAD_SERVER:["logservice-hkmc.agora.io"],PROXY_SERVER_TYPE3:["hkmc.webrtc-cloud-proxy.sd-rtn.com"]},US:{CODE:GP.US,WEBCS_DOMAIN:["ap-web-1-us.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-us.agora.io"],PROXY_CS:["proxy-ap-web-us.agora.io"],CDS_AP:["cds-ap-web-us.agora.io","cds-ap-web-us2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-us.agora.io","sua-ap-web-us2.agora.io"],UAP_AP:["uap-ap-web-us.agora.io","uap-ap-web-us2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-us.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-us.agora.io"],LOG_UPLOAD_SERVER:["logservice-us.agora.io"],PROXY_SERVER_TYPE3:["us.webrtc-cloud-proxy.sd-rtn.com"]},OVERSEA:{CODE:GP.OVERSEA,WEBCS_DOMAIN:["ap-web-1-oversea.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-oversea.agora.io"],PROXY_CS:["proxy-ap-web-oversea.agora.io"],CDS_AP:["cds-ap-web-oversea.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-oversea.agora.io"],UAP_AP:["uap-ap-web-oversea.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-oversea.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-oversea.agora.io"],LOG_UPLOAD_SERVER:["logservice-oversea.agora.io"],PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.agora.io"]},GLOBAL:{CODE:GP.GLOBAL,WEBCS_DOMAIN:["webrtc2-ap-web-1.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-ap-web-3.agora.io"],PROXY_CS:["ap-proxy-1.agora.io","ap-proxy-2.agora.io"],CDS_AP:["cds-ap-web-1.agora.io","cds-ap-web-3.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-1.agora.io","sua-ap-web-3.agora.io"],UAP_AP:["uap-ap-web-1.agora.io","uap-ap-web-3.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2.agora.io"],LOG_UPLOAD_SERVER:["logservice.agora.io"],PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.sd-rtn.com"]},OCEANIA:{CODE:GP.OCEANIA,WEBCS_DOMAIN:["ap-web-1-oceania.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-oceania.agora.io"],PROXY_CS:["proxy-ap-web-oceania.agora.io"],CDS_AP:["cds-ap-web-oceania.agora.io","cds-ap-web-oceania2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-oceania.agora.io","sua-ap-web-oceania2.agora.io"],UAP_AP:["uap-ap-web-oceania.agora.io","uap-ap-web-oceania2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-oceania.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-oceania.agora.io"],LOG_UPLOAD_SERVER:["logservice-oceania.agora.io"],PROXY_SERVER_TYPE3:["oceania.webrtc-cloud-proxy.sd-rtn.com"]},SOUTH_AMERICA:{CODE:GP.SOUTH_AMERICA,WEBCS_DOMAIN:["ap-web-1-south-america.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-south-america.agora.io"],PROXY_CS:["proxy-ap-web-south-america.agora.io"],CDS_AP:["cds-ap-web-south-america.agora.io","cds-ap-web-south-america2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-south-america.agora.io","sua-ap-web-south-america2.agora.io"],UAP_AP:["uap-ap-web-south-america.agora.io","uap-ap-web-south-america2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-south-america.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-south-america.agora.io"],LOG_UPLOAD_SERVER:["logservice-south-america.agora.io"],PROXY_SERVER_TYPE3:["south-america.webrtc-cloud-proxy.sd-rtn.com"]},AFRICA:{CODE:GP.AFRICA,WEBCS_DOMAIN:["ap-web-1-africa.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-africa.agora.io"],PROXY_CS:["proxy-ap-web-africa.agora.io"],CDS_AP:["cds-ap-web-africa.agora.io","cds-ap-web-africa2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-africa.agora.io","sua-ap-web-africa2.agora.io"],UAP_AP:["uap-ap-web-africa.agora.io","uap-ap-web-africa2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-africa.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-africa.agora.io"],LOG_UPLOAD_SERVER:["logservice-south-africa.agora.io"],PROXY_SERVER_TYPE3:["africa.webrtc-cloud-proxy.sd-rtn.com"]}};aN&&($P.CHINA={CODE:GP.CHINA,WEBCS_DOMAIN:["webrtc2-2.ap.sd-rtn.com"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-4.ap.sd-rtn.com"],PROXY_CS:["proxy-web.ap.sd-rtn.com"],CDS_AP:["cds-web-2.ap.sd-rtn.com","cds-web-4.ap.sd-rtn.com"],ACCOUNT_REGISTER:["sua-web-2.ap.sd-rtn.com","sua-web-4.ap.sd-rtn.com"],UAP_AP:["uap-web-2.ap.sd-rtn.com","uap-web-4.ap.sd-rtn.com"],EVENT_REPORT_DOMAIN:["web-3.statscollector.sd-rtn.com"],EVENT_REPORT_BACKUP_DOMAIN:["web-4.statscollector.sd-rtn.com"],LOG_UPLOAD_SERVER:["logservice-china.agora.io"],PROXY_SERVER_TYPE3:["east-cn.webrtc-cloud-proxy.sd-rtn.com"]}),function(e){e.UPDATE_BITRATE_LIMIT="update_bitrate_limit"}(HP||(HP={}));var eL=function(e){k(r,e);var t=W(r);function r(e,n){var i;return U(this,r),i=t.call(this),rO(S(i),"onICEConnectionStateChange",void 0),rO(S(i),"onConnectionStateChange",void 0),rO(S(i),"onDTLSTransportStateChange",void 0),rO(S(i),"onDTLSTransportError",void 0),rO(S(i),"onICETransportStateChange",void 0),rO(S(i),"onFirstAudioReceived",void 0),rO(S(i),"onFirstVideoReceived",void 0),rO(S(i),"onFirstAudioDecoded",void 0),rO(S(i),"onFirstVideoDecoded",void 0),rO(S(i),"onSelectedLocalCandidateChanged",void 0),rO(S(i),"onSelectedRemoteCandidateChanged",void 0),i}return F(r)}(yD);!function(e){e.SEND="sendonly",e.RECV="recvonly",e.SENDRECV="sendrecv",e.INACTIVE="inactive"}(WP||(WP={})),function(e){e.VIDEO="video",e.AUDIO="audio"}(YP||(YP={})),function(e){e.LocalVideoTrack="videoTrack",e.LocalAudioTrack="audioTrack",e.LocalVideoLowTrack="videoLowTrack"}(qP||(qP={})),function(e){e.New="new",e.Connected="connected",e.Reconnecting="reconnecting",e.Disconnected="disconnected"}(JP||(JP={})),function(e){e.StateChange="stateChange",e.IceConnectionStateChange="iceConnectionStateChange",e.RequestMuteLocal="requestMuteLocal",e.RequestUnmuteLocal="requestUnmuteLocal",e.RequestRePublish="requestRePublish",e.RequestReSubscribe="requestReSubscribe",e.RequestUploadStats="requestUploadStats",e.MediaReconnectStart="MediaReconnectStart",e.MediaReconnectEnd="MediaReconnectEnd",e.NeedSignalRTT="NeedSignalRTT",e.RequestRestartICE="RequestRestartIce",e.PeerConnectionStateChange="PeerConnectionStateChange",e.RequestReconnect="RequestReconnect",e.RequestReconnectPC="RequestReconnectPC",e.RequestUnpublishForReconnectPC="RequestUnpublishForReconnectPC",e.P2PLost="P2PLost",e.UpdateVideoEncoder="UpdateVideoEncoder",e.ConnectionTypeChange="ConnectionTypeChange"}(zP||(zP={})),function(e){e.ONLINE="ONLINE",e.OFFLINE="OFFLINE"}(XP||(XP={})),function(e){e.NETWORK_STATE_CHANGE="NETWORK_STATE_CHANGE",e.ONLINE="ONLINE",e.OFFLINE="OFFLINE"}(ZP||(ZP={}));var tL,rL,nL={join:["startJoin","startRequestAp","startJoinGateway","finishJoin"],publish:["startPublish"]};!function(e){e.ON_TRACK="on_track",e.ON_NODE="on_node"}(tL||(tL={})),function(e){e.REQUEST_UPDATE_CONSTRAINTS="request_update_constraints",e.REQUEST_CONSTRAINTS="request_constraints"}(rL||(rL={}));var iL={getDisplayMedia:!1,getStreamFromExtension:!1,supportUnifiedPlan:!1,supportMinBitrate:!1,supportSetRtpSenderParameters:!1,supportDualStream:!0,webAudioMediaStreamDest:!1,supportReplaceTrack:!1,supportWebGL:!1,webAudioWithAEC:!1,supportRequestFrame:!1,supportShareAudio:!1,supportDualStreamEncoding:!1};function oL(){return iL}var aL="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,sL=An,cL=In,uL=u.RangeError,dL=function(e){if(void 0===e)return 0;var t=sL(e),r=cL(t);if(t!==r)throw uL("Wrong length or index");return r},lL=u.Array,pL=Math.abs,fL=Math.pow,hL=Math.floor,AL=Math.log,vL=Math.LN2,gL={pack:function(e,t,r){var n,i,o,a=lL(r),s=8*r-t-1,c=(1<<s)-1,u=c>>1,d=23===t?fL(2,-24)-fL(2,-77):0,l=e<0||0===e&&1/e<0?1:0,p=0;for((e=pL(e))!=e||e===1/0?(i=e!=e?1:0,n=c):(n=hL(AL(e)/vL),e*(o=fL(2,-n))<1&&(n--,o*=2),(e+=n+u>=1?d/o:d*fL(2,1-u))*o>=2&&(n++,o/=2),n+u>=c?(i=0,n=c):n+u>=1?(i=(e*o-1)*fL(2,t),n+=u):(i=e*fL(2,u-1)*fL(2,t),n=0));t>=8;)a[p++]=255&i,i/=256,t-=8;for(n=n<<t|i,s+=t;s>0;)a[p++]=255&n,n/=256,s-=8;return a[--p]|=128*l,a},unpack:function(e,t){var r,n=e.length,i=8*n-t-1,o=(1<<i)-1,a=o>>1,s=i-7,c=n-1,u=e[c--],d=127&u;for(u>>=7;s>0;)d=256*d+e[c--],s-=8;for(r=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)r=256*r+e[c--],s-=8;if(0===d)d=1-a;else{if(d===o)return r?NaN:u?-1/0:1/0;r+=fL(2,t),d-=a}return(u?-1:1)*r*fL(2,d-t)}},mL=tt,EL=En,_L=bn,yL=Dt,IL=Yt,SL=O,bL=En,CL=bn,wL=function(e,t,r){var n=yL(t);n in e?IL.f(e,n,SL(0,r)):e[n]=r},RL=u.Array,TL=Math.max,kL=function(e,t,r){for(var n=CL(e),i=bL(t,n),o=bL(void 0===r?n:r,n),a=RL(TL(o-i,0)),s=0;i<o;i++,s++)wL(a,s,e[i]);return a.length=s,a},OL=u,DL=V,NL=h,xL=aL,PL=en,LL=fr,BL=vi,ML=p,UL=Bi,QL=An,FL=In,jL=dL,VL=gL,GL=Ah,KL=bi,HL=pn.f,WL=Yt.f,YL=function(e){for(var t=mL(this),r=_L(t),n=arguments.length,i=EL(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:EL(o,r);a>i;)t[i++]=e;return t},qL=kL,JL=Ti,zL=PL.PROPER,XL=PL.CONFIGURABLE,ZL=qr.get,$L=qr.set,eB="ArrayBuffer",tB="DataView",rB="Wrong index",nB=OL.ArrayBuffer,iB=nB,oB=iB&&iB.prototype,aB=OL.DataView,sB=aB&&aB.prototype,cB=Object.prototype,uB=OL.Array,dB=OL.RangeError,lB=DL(YL),pB=DL([].reverse),fB=VL.pack,hB=VL.unpack,AB=function(e){return[255&e]},vB=function(e){return[255&e,e>>8&255]},gB=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},mB=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},EB=function(e){return fB(e,23,4)},_B=function(e){return fB(e,52,8)},yB=function(e,t){WL(e.prototype,t,{get:function(){return ZL(this)[t]}})},IB=function(e,t,r,n){var i=jL(r),o=ZL(e);if(i+t>o.byteLength)throw dB(rB);var a=ZL(o.buffer).bytes,s=i+o.byteOffset,c=qL(a,s,s+t);return n?c:pB(c)},SB=function(e,t,r,n,i,o){var a=jL(r),s=ZL(e);if(a+t>s.byteLength)throw dB(rB);for(var c=ZL(s.buffer).bytes,u=a+s.byteOffset,d=n(+i),l=0;l<t;l++)c[u+l]=d[o?l:t-l-1]};if(xL){var bB=zL&&nB.name!==eB;if(ML((function(){nB(1)}))&&ML((function(){new nB(-1)}))&&!ML((function(){return new nB,new nB(1.5),new nB(NaN),bB&&!XL})))bB&&XL&&LL(nB,"name",eB);else{(iB=function(e){return UL(this,oB),new nB(jL(e))}).prototype=oB;for(var CB,wB=HL(nB),RB=0;wB.length>RB;)(CB=wB[RB++])in iB||LL(iB,CB,nB[CB]);oB.constructor=iB}KL&&GL(sB)!==cB&&KL(sB,cB);var TB=new aB(new iB(2)),kB=DL(sB.setInt8);TB.setInt8(0,2147483648),TB.setInt8(1,2147483649),!TB.getInt8(0)&&TB.getInt8(1)||BL(sB,{setInt8:function(e,t){kB(this,e,t<<24>>24)},setUint8:function(e,t){kB(this,e,t<<24>>24)}},{unsafe:!0})}else oB=(iB=function(e){UL(this,oB);var t=jL(e);$L(this,{bytes:lB(uB(t),0),byteLength:t}),NL||(this.byteLength=t)}).prototype,sB=(aB=function(e,t,r){UL(this,sB),UL(e,oB);var n=ZL(e).byteLength,i=QL(t);if(i<0||i>n)throw dB("Wrong offset");if(i+(r=void 0===r?n-i:FL(r))>n)throw dB("Wrong length");$L(this,{buffer:e,byteLength:r,byteOffset:i}),NL||(this.buffer=e,this.byteLength=r,this.byteOffset=i)}).prototype,NL&&(yB(iB,"byteLength"),yB(aB,"buffer"),yB(aB,"byteLength"),yB(aB,"byteOffset")),BL(sB,{getInt8:function(e){return IB(this,1,e)[0]<<24>>24},getUint8:function(e){return IB(this,1,e)[0]},getInt16:function(e){var t=IB(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=IB(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return mB(IB(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return mB(IB(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return hB(IB(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return hB(IB(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){SB(this,1,e,AB,t)},setUint8:function(e,t){SB(this,1,e,AB,t)},setInt16:function(e,t){SB(this,2,e,vB,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){SB(this,2,e,vB,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){SB(this,4,e,gB,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){SB(this,4,e,gB,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){SB(this,4,e,EB,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){SB(this,8,e,_B,t,arguments.length>2?arguments[2]:void 0)}});JL(iB,eB),JL(aB,tB);var OB={ArrayBuffer:iB,DataView:aB},DB=fi,NB=V,xB=p,PB=$t,LB=En,BB=In,MB=aa,UB=OB.ArrayBuffer,QB=OB.DataView,FB=QB.prototype,jB=NB(UB.prototype.slice),VB=NB(FB.getUint8),GB=NB(FB.setUint8);DB({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:xB((function(){return!new UB(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(jB&&void 0===t)return jB(PB(this),e);for(var r=PB(this).byteLength,n=LB(e,r),i=LB(void 0===t?r:t,r),o=new(MB(this,UB))(BB(i-n)),a=new QB(this),s=new QB(o),c=0;n<i;)GB(s,c++,VB(a,n++));return o}});var KB,HB,WB,YB={exports:{}},qB=aL,JB=h,zB=u,XB=se,ZB=ue,$B=it,eM=eo,tM=Pe,rM=fr,nM=hr.exports,iM=Yt.f,oM=he,aM=Ah,sM=bi,cM=_t,uM=ut,dM=zB.Int8Array,lM=dM&&dM.prototype,pM=zB.Uint8ClampedArray,fM=pM&&pM.prototype,hM=dM&&aM(dM),AM=lM&&aM(lM),vM=Object.prototype,gM=zB.TypeError,mM=cM("toStringTag"),EM=uM("TYPED_ARRAY_TAG"),_M=uM("TYPED_ARRAY_CONSTRUCTOR"),yM=qB&&!!sM&&"Opera"!==eM(zB.opera),IM=!1,SM={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},bM={BigInt64Array:8,BigUint64Array:8},CM=function(e){if(!ZB(e))return!1;var t=eM(e);return $B(SM,t)||$B(bM,t)};for(KB in SM)(WB=(HB=zB[KB])&&HB.prototype)?rM(WB,_M,HB):yM=!1;for(KB in bM)(WB=(HB=zB[KB])&&HB.prototype)&&rM(WB,_M,HB);if((!yM||!XB(hM)||hM===Function.prototype)&&(hM=function(){throw gM("Incorrect invocation")},yM))for(KB in SM)zB[KB]&&sM(zB[KB],hM);if((!yM||!AM||AM===vM)&&(AM=hM.prototype,yM))for(KB in SM)zB[KB]&&sM(zB[KB].prototype,AM);if(yM&&aM(fM)!==AM&&sM(fM,AM),JB&&!$B(AM,mM))for(KB in IM=!0,iM(AM,mM,{get:function(){return ZB(this)?this[EM]:void 0}}),SM)zB[KB]&&rM(zB[KB],EM,KB);var wM={NATIVE_ARRAY_BUFFER_VIEWS:yM,TYPED_ARRAY_CONSTRUCTOR:_M,TYPED_ARRAY_TAG:IM&&EM,aTypedArray:function(e){if(CM(e))return e;throw gM("Target is not a typed array")},aTypedArrayConstructor:function(e){if(XB(e)&&(!sM||oM(hM,e)))return e;throw gM(tM(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(JB){if(r)for(var i in SM){var o=zB[i];if(o&&$B(o.prototype,e))try{delete o.prototype[e]}catch(r){try{o.prototype[e]=t}catch(e){}}}AM[e]&&!r||nM(AM,e,r?t:yM&&lM[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(JB){if(sM){if(r)for(n in SM)if((i=zB[n])&&$B(i,e))try{delete i[e]}catch(e){}if(hM[e]&&!r)return;try{return nM(hM,e,r?t:yM&&hM[e]||t)}catch(e){}}for(n in SM)!(i=zB[n])||i[e]&&!r||nM(i,e,t)}},isView:function(e){if(!ZB(e))return!1;var t=eM(e);return"DataView"===t||$B(SM,t)||$B(bM,t)},isTypedArray:CM,TypedArray:hM,TypedArrayPrototype:AM},RM=u,TM=p,kM=Po,OM=wM.NATIVE_ARRAY_BUFFER_VIEWS,DM=RM.ArrayBuffer,NM=RM.Int8Array,xM=!OM||!TM((function(){NM(1)}))||!TM((function(){new NM(-1)}))||!kM((function(e){new NM,new NM(null),new NM(1.5),new NM(e)}),!0)||TM((function(){return 1!==new NM(new DM(2),1,void 0).length})),PM=ue,LM=Math.floor,BM=Number.isInteger||function(e){return!PM(e)&&isFinite(e)&&LM(e)===e},MM=An,UM=u.RangeError,QM=function(e){var t=MM(e);if(t<0)throw UM("The argument can't be less than 0");return t},FM=u.RangeError,jM=function(e,t){var r=QM(e);if(r%t)throw FM("Wrong offset");return r},VM=Fi,GM=m,KM=ra,HM=tt,WM=bn,YM=fo,qM=oo,JM=Hi,zM=wM.aTypedArrayConstructor,XM=J,ZM=u,$M=Array.isArray||function(e){return"Array"==XM(e)},eU=Zo,tU=ue,rU=_t("species"),nU=ZM.Array,iU=function(e){var t;return $M(e)&&(t=e.constructor,(eU(t)&&(t===nU||$M(t.prototype))||tU(t)&&null===(t=t[rU]))&&(t=void 0)),void 0===t?nU:t},oU=Fi,aU=te,sU=tt,cU=bn,uU=function(e,t){return new(iU(e))(0===t?0:t)},dU=V([].push),lU=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,u,d,l){for(var p,f,h=sU(c),A=aU(h),v=oU(u,d),g=cU(A),m=0,E=l||uU,_=t?E(c,g):r||a?E(c,0):void 0;g>m;m++)if((s||m in A)&&(f=v(p=A[m],m,h),e))if(t)_[m]=f;else if(f)switch(e){case 3:return!0;case 5:return p;case 6:return m;case 2:dU(_,p)}else switch(e){case 4:return!1;case 7:dU(_,p)}return o?-1:n||i?i:_}},pU={forEach:lU(0),map:lU(1),filter:lU(2),some:lU(3),every:lU(4),find:lU(5),findIndex:lU(6),filterReject:lU(7)},fU=fi,hU=u,AU=m,vU=h,gU=xM,mU=wM,EU=OB,_U=Bi,yU=O,IU=fr,SU=BM,bU=In,CU=dL,wU=jM,RU=Dt,TU=it,kU=eo,OU=ue,DU=Ne,NU=Cf,xU=he,PU=bi,LU=pn.f,BU=function(e){var t,r,n,i,o,a,s=KM(this),c=HM(e),u=arguments.length,d=u>1?arguments[1]:void 0,l=void 0!==d,p=qM(c);if(p&&!JM(p))for(a=(o=YM(c,p)).next,c=[];!(i=GM(a,o)).done;)c.push(i.value);for(l&&u>2&&(d=VM(d,arguments[2])),r=WM(c),n=new(zM(s))(r),t=0;r>t;t++)n[t]=l?d(c[t],t):c[t];return n},MU=pU.forEach,UU=xi,QU=Yt,FU=l,jU=bA,VU=qr.get,GU=qr.set,KU=QU.f,HU=FU.f,WU=Math.round,YU=hU.RangeError,qU=EU.ArrayBuffer,JU=qU.prototype,zU=EU.DataView,XU=mU.NATIVE_ARRAY_BUFFER_VIEWS,ZU=mU.TYPED_ARRAY_CONSTRUCTOR,$U=mU.TYPED_ARRAY_TAG,eQ=mU.TypedArray,tQ=mU.TypedArrayPrototype,rQ=mU.aTypedArrayConstructor,nQ=mU.isTypedArray,iQ="BYTES_PER_ELEMENT",oQ="Wrong length",aQ=function(e,t){rQ(e);for(var r=0,n=t.length,i=new e(n);n>r;)i[r]=t[r++];return i},sQ=function(e,t){KU(e,t,{get:function(){return VU(this)[t]}})},cQ=function(e){var t;return xU(JU,e)||"ArrayBuffer"==(t=kU(e))||"SharedArrayBuffer"==t},uQ=function(e,t){return nQ(e)&&!DU(t)&&t in e&&SU(+t)&&t>=0},dQ=function(e,t){return t=RU(t),uQ(e,t)?yU(2,e[t]):HU(e,t)},lQ=function(e,t,r){return t=RU(t),!(uQ(e,t)&&OU(r)&&TU(r,"value"))||TU(r,"get")||TU(r,"set")||r.configurable||TU(r,"writable")&&!r.writable||TU(r,"enumerable")&&!r.enumerable?KU(e,t,r):(e[t]=r.value,e)};vU?(XU||(FU.f=dQ,QU.f=lQ,sQ(tQ,"buffer"),sQ(tQ,"byteOffset"),sQ(tQ,"byteLength"),sQ(tQ,"length")),fU({target:"Object",stat:!0,forced:!XU},{getOwnPropertyDescriptor:dQ,defineProperty:lQ}),YB.exports=function(e,t,r){var n=e.match(/\d+$/)[0]/8,i=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=hU[i],c=s,u=c&&c.prototype,d={},l=function(e,t){KU(e,t,{get:function(){return function(e,t){var r=VU(e);return r.view[o](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=VU(e);r&&(i=(i=WU(i))<0?0:i>255?255:255&i),o.view[a](t*n+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};XU?gU&&(c=t((function(e,t,r,i){return _U(e,u),jU(OU(t)?cQ(t)?void 0!==i?new s(t,wU(r,n),i):void 0!==r?new s(t,wU(r,n)):new s(t):nQ(t)?aQ(c,t):AU(BU,c,t):new s(CU(t)),e,c)})),PU&&PU(c,eQ),MU(LU(s),(function(e){e in c||IU(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,r,i){_U(e,u);var o,a,s,d=0,p=0;if(OU(t)){if(!cQ(t))return nQ(t)?aQ(c,t):AU(BU,c,t);o=t,p=wU(r,n);var f=t.byteLength;if(void 0===i){if(f%n)throw YU(oQ);if((a=f-p)<0)throw YU(oQ)}else if((a=bU(i)*n)+p>f)throw YU(oQ);s=a/n}else s=CU(t),o=new qU(a=s*n);for(GU(e,{buffer:o,byteOffset:p,byteLength:a,length:s,view:new zU(o)});d<s;)l(e,d++)})),PU&&PU(c,eQ),u=c.prototype=NU(tQ)),u.constructor!==c&&IU(u,"constructor",c),IU(u,ZU,c),$U&&IU(u,$U,i),d[i]=c,fU({global:!0,forced:c!=s,sham:!XU},d),iQ in c||IU(c,iQ,n),iQ in u||IU(u,iQ,n),UU(i)}):YB.exports=function(){},(0,YB.exports)("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var pQ=bn,fQ=An,hQ=wM.aTypedArray;(0,wM.exportTypedArrayMethod)("at",(function(e){var t=hQ(this),r=pQ(t),n=fQ(e),i=n>=0?n:r+n;return i<0||i>=r?void 0:t[i]}));var AQ=u,vQ=m,gQ=wM,mQ=bn,EQ=jM,_Q=tt,yQ=p,IQ=AQ.RangeError,SQ=AQ.Int8Array,bQ=SQ&&SQ.prototype,CQ=bQ&&bQ.set,wQ=gQ.aTypedArray,RQ=gQ.exportTypedArrayMethod,TQ=!yQ((function(){var e=new Uint8ClampedArray(2);return vQ(CQ,e,{length:1,0:3},1),3!==e[1]})),kQ=TQ&&gQ.NATIVE_ARRAY_BUFFER_VIEWS&&yQ((function(){var e=new SQ(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));RQ("set",(function(e){wQ(this);var t=EQ(arguments.length>1?arguments[1]:void 0,1),r=_Q(e);if(TQ)return vQ(CQ,this,r,t);var n=this.length,i=mQ(r),o=0;if(i+t>n)throw IQ("Wrong length");for(;o<i;)this[t+o]=r[o++]}),!TQ||kQ);var OQ=kL,DQ=Math.floor,NQ=function e(t,r){var n=t.length,i=DQ(n/2);return n<8?xQ(t,r):PQ(t,e(OQ(t,0,i),r),e(OQ(t,i),r),r)},xQ=function(e,t){for(var r,n,i=e.length,o=1;o<i;){for(n=o,r=e[o];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==o++&&(e[n]=r)}return e},PQ=function(e,t,r,n){for(var i=t.length,o=r.length,a=0,s=0;a<i||s<o;)e[a+s]=a<i&&s<o?n(t[a],r[s])<=0?t[a++]:r[s++]:a<i?t[a++]:r[s++];return e},LQ=NQ,BQ=Ae.match(/firefox\/(\d+)/i),MQ=!!BQ&&+BQ[1],UQ=/MSIE|Trident/.test(Ae),QQ=Ae.match(/AppleWebKit\/(\d+)\./),FQ=!!QQ&&+QQ[1],jQ=u,VQ=V,GQ=p,KQ=Ue,HQ=LQ,WQ=wM,YQ=MQ,qQ=UQ,JQ=Ie,zQ=FQ,XQ=jQ.Array,ZQ=WQ.aTypedArray,$Q=WQ.exportTypedArrayMethod,eF=jQ.Uint16Array,tF=eF&&VQ(eF.prototype.sort),rF=!(!tF||GQ((function(){tF(new eF(2),null)}))&&GQ((function(){tF(new eF(2),{})}))),nF=!!tF&&!GQ((function(){if(JQ)return JQ<74;if(YQ)return YQ<67;if(qQ)return!0;if(zQ)return zQ<602;var e,t,r=new eF(516),n=XQ(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(tF(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0}));$Q("sort",(function(e){return void 0!==e&&KQ(e),nF?tF(this,e):HQ(ZQ(this),function(e){return function(t,r){return void 0!==e?+e(t,r)||0:r!=r?-1:t!=t?1:0===t&&0===r?1/t>0&&1/r<0?1:-1:t>r}}(e))}),!nF||rF);var iF,oF=xi,aF="ArrayBuffer",sF=OB.ArrayBuffer;fi({global:!0,forced:u.ArrayBuffer!==sF},{ArrayBuffer:sF}),oF(aF),function(e){e[e.CHOOSE_SERVER=11]="CHOOSE_SERVER",e[e.CLOUD_PROXY=18]="CLOUD_PROXY",e[e.CLOUD_PROXY_5=20]="CLOUD_PROXY_5",e[e.CLOUD_PROXY_FALLBACK=26]="CLOUD_PROXY_FALLBACK"}(iF||(iF={}));var cF=ku,uF=Array.isArray||function(e){return"Array"==cF(e)},dF=su,lF=uF,pF=fy,fF=Vu,hF=$d("species"),AF=dF.Array,vF=function(e){var t;return lF(e)&&(t=e.constructor,(pF(t)&&(t===AF||lF(t.prototype))||fF(t)&&null===(t=t[hF]))&&(t=void 0)),void 0===t?AF:t},gF=function(e,t){return new(vF(e))(0===t?0:t)},mF=Ul,EF=Lu,_F=Pd,yF=bp,IF=gF,SF=iu([].push),bF=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,u,d,l){for(var p,f,h=_F(c),A=EF(h),v=mF(u,d),g=yF(A),m=0,E=l||IF,_=t?E(c,g):r||a?E(c,0):void 0;g>m;m++)if((s||m in A)&&(f=v(p=A[m],m,h),e))if(t)_[m]=f;else if(f)switch(e){case 3:return!0;case 5:return p;case 6:return m;case 2:SF(_,p)}else switch(e){case 4:return!1;case 7:SF(_,p)}return o?-1:n||i?i:_}},CF={forEach:bF(0),map:bF(1),filter:bF(2),some:bF(3),every:bF(4),find:bF(5),findIndex:bF(6),filterReject:bF(7)},wF=CF.forEach,RF=xp("forEach")?[].forEach:function(e){return wF(this,e,arguments.length>1?arguments[1]:void 0)};gp({target:"Array",proto:!0,forced:[].forEach!=RF},{forEach:RF});var TF=Qp("Array").forEach,kF=rm,OF=Md,DF=ou,NF=TF,xF=Array.prototype,PF={DOMTokenList:!0,NodeList:!0},LF=function(e){var t=e.forEach;return e===xF||DF(xF,e)&&t===xF.forEach||OF(PF,kF(e))?NF:t},BF=Pd,MF=Ag;gp({target:"Object",stat:!0,forced:Xc((function(){MF(1)}))},{keys:function(e){return MF(BF(e))}});var UF=Gu.Object.keys,QF=Kp,FF=gp,jF=uF,VF=iu([].reverse),GF=[1,2];FF({target:"Array",proto:!0,forced:String(GF)===String(GF.reverse())},{reverse:function(){return jF(this)&&(this.length=this.length),VF(this)}});var KF=Qp("Array").reverse,HF=ou,WF=KF,YF=Array.prototype,qF=function(e){var t=e.reverse;return e===YF||HF(YF,e)&&t===YF.reverse?WF:t},JF=Xc,zF=rd,XF=$d("species"),ZF=function(e){return zF>=51||!JF((function(){var t=[];return(t.constructor={})[XF]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},$F=gp,ej=su,tj=uF,rj=fy,nj=Vu,ij=Qv,oj=bp,aj=Fu,sj=ON,cj=$d,uj=yy,dj=ZF("slice"),lj=cj("species"),pj=ej.Array,fj=Math.max;$F({target:"Array",proto:!0,forced:!dj},{slice:function(e,t){var r,n,i,o=aj(this),a=oj(o),s=ij(e,a),c=ij(void 0===t?a:t,a);if(tj(o)&&(r=o.constructor,(rj(r)&&(r===pj||tj(r.prototype))||nj(r)&&null===(r=r[lj]))&&(r=void 0),r===pj||void 0===r))return uj(o,s,c);for(n=new(void 0===r?pj:r)(fj(c-s,0)),i=0;s<c;s++,i++)s in o&&sj(n,i,o[s]);return n.length=i,n}});var hj=Qp("Array").slice,Aj=ou,vj=hj,gj=Array.prototype,mj=function(e){var t=e.slice;return e===gj||Aj(gj,e)&&t===gj.slice?vj:t};function Ej(e,t,r,n,i){var o,a,s,c={};return LF(o=UF(n)).call(o,(function(e){c[e]=n[e]})),c.enumerable=!!c.enumerable,c.configurable=!!c.configurable,("value"in c||c.initializer)&&(c.writable=!0),c=QF(a=qF(s=mj(r).call(r)).call(s)).call(a,(function(r,n){return n(e,t,r)||r}),c),i&&void 0!==c.initializer&&(c.value=c.initializer?c.initializer.call(i):void 0,c.initializer=void 0),void 0===c.initializer&&(tO(e,t,c),c=null),c}var _j=Qp("Array").values,yj=rm,Ij=Md,Sj=ou,bj=_j,Cj=Array.prototype,wj={DOMTokenList:!0,NodeList:!0},Rj=function(e){var t=e.values;return e===Cj||Sj(Cj,e)&&t===Cj.values||Ij(wj,yj(e))?bj:t},Tj=Qp("Array").keys,kj=rm,Oj=Md,Dj=ou,Nj=Tj,xj=Array.prototype,Pj={DOMTokenList:!0,NodeList:!0},Lj=function(e){var t=e.keys;return e===xj||Dj(xj,e)&&t===xj.keys||Oj(Pj,kj(e))?Nj:t};function Bj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Mj(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Bj(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Bj(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Uj(e,t,r){return new Rb((function(n,i){t.timeout=t.timeout||gN("HTTP_CONNECT_TIMEOUT"),t.responseType=t.responseType||"json",t.data&&!r?(t.data=JSON.stringify(t.data),qG(t.data)):r&&(t.data.size?t.data.size:t.data instanceof FormData?function(e){var t=0;/DingTalk/i.test(navigator.userAgent)&&e.realFormData&&(e=e.realFormData),e.forEach((function(e){t+="string"==typeof e?qG(e):e.size}))}(t.data):qG(JSON.stringify(t.data))),t.headers=t.headers||{},t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json",t.method="POST",t.url=e,ED.request(t).then((function(e){"string"==typeof e.data?qG(e.data):e.data instanceof ArrayBuffer||e.data instanceof Uint8Array?e.data.byteLength:qG(JSON.stringify(e.data)),n(e.data)})).catch((function(e){ED.isCancel(e)?i(new SD(mD.OPERATION_ABORTED,"cancel token canceled")):"ECONNABORTED"===e.code?i(new SD(mD.NETWORK_TIMEOUT,e.message)):e.response?i(new SD(mD.NETWORK_RESPONSE_ERROR,e.response.status)):i(new SD(mD.NETWORK_ERROR,e.message))}))}))}function Qj(e,t){return Fj.apply(this,arguments)}function Fj(){return Fj=y(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Blob([r.data],{type:"buffer"}),e.next=3,Uj(t,Mj(Mj({},r),{},{data:n,headers:{"Content-Type":"application/octet-stream"}}),!0);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)}))),Fj.apply(this,arguments)}var jj,Vj=new(function(e){k(r,e);var t=W(r);function r(){var e;return U(this,r),e=t.call(this),rO(S(e),"_moduleName","network-indicator"),rO(S(e),"_networkState",XP.ONLINE),rO(S(e),"onlineWaiter",void 0),window.addEventListener("online",(function(){e.networkState=XP.ONLINE})),window.addEventListener("offline",(function(){e.networkState=XP.OFFLINE})),e}return F(r,[{key:"networkState",get:function(){return this._networkState},set:function(e){var t=this;ND.info("[".concat(this._moduleName,"]")+"network state changed, "+this._networkState+" -> "+e),this.emit(ZP.NETWORK_STATE_CHANGE,e,this._networkState),e===XP.ONLINE?this.emit(ZP.ONLINE):e===XP.OFFLINE&&(this.onlineWaiter=new Rb((function(e){t.once(ZP.ONLINE,(function(){t.onlineWaiter=void 0,e(XP.ONLINE)}))})),this.emit(ZP.OFFLINE)),this._networkState=e}}]),r}(yD)),Gj=!1,Kj=new(function(e){k(r,e);var t=W(r);function r(){var e;return U(this,r),e=t.apply(this,arguments),rO(S(e),"onAutoplayFailed",void 0),rO(S(e),"onAudioAutoplayFailed",void 0),e}return F(r)}(yD));function Hj(){var e=Tk();if(!Gj){var t=function t(r){r.preventDefault(),Gj=!1,"Android"!==e.os||"Chrome"!==e.name&&e.name!==Sk.WECHAT?(document.body.removeEventListener("touchstart",t,!0),document.body.removeEventListener("mousedown",t,!0)):document.body.removeEventListener("click",t,!0)};Gj=!0,"Android"!==e.os||"Chrome"!==e.name&&e.name!==Sk.WECHAT?(document.body.addEventListener("touchstart",t,!0),document.body.addEventListener("mousedown",t,!0)):document.body.addEventListener("click",t,!0),ND.info("detect media autoplay failed, document: https://docs.agora.io/cn/Voice/autoplay_policy_web_ng?platform=Web"),Kj.onAutoplayFailed?Kj.onAutoplayFailed():Kj.onAudioAutoplayFailed?ND.warning("AgoraRTC.onAudioAutoplayFailed has been deprecated in favor of AgoraRTC.onAutoplayFailed.\n\n Please refer to the Agora document to migrate the newer API, https://docs.agora.io/en/Voice/autoplay_policy_web_ng?platform=Web ."):ND.warning("We have detected a media autoplay failed event, and found out that you haven't implemented AgoraRTC.onAutoplayFailed callback yet.\n\n It will cause audio/video element not playing automatically on some browsers without user interaction, possibly hurting user experiences.\n\n Please refer to the Agora document to properly handle autoplay failed event, https://docs.agora.io/en/Voice/autoplay_policy_web_ng?platform=Web ."),Kj.emit("autoplay-failed")}}function Wj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Yj(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Wj(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wj(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function qj(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{report:zj};return function(t,r,n){var i=t[r];if("function"==typeof i){var o="AgoraRTCClient"===t.constructor.name?"Client":t.constructor.name;n.value=function(){for(var t=arguments.length,n=new Array(t),a=0;a<t;a++)n[a]=arguments[a];var s=e.report.reportApiInvoke(this._sessionId||null,{name:"".concat(o,".").concat(r),options:n,tag:Qx.TRACER});try{var c=i.apply(this,n);return s.onSuccess(),c}catch(e){throw s.onError(e),e}}}return n}}function Jj(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{report:zj};return function(t,r,n){var i=t[r];if("function"==typeof i){var o="AgoraRTCClient"===t.constructor.name?"Client":t.constructor.name;n.value=y(G.mark((function t(){var n,a,s,c,u,d=arguments;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(n=d.length,a=new Array(n),s=0;s<n;s++)a[s]=d[s];return c=e.report.reportApiInvoke(this._sessionId||null,{name:"".concat(o,".").concat(r),options:a,tag:Qx.TRACER}),t.prev=2,t.next=5,i.apply(this,a);case 5:return u=t.sent,t.abrupt("return",(c.onSuccess(),u));case 9:throw t.prev=9,t.t0=t.catch(2),c.onError(t.t0),t.t0;case 12:case"end":return t.stop()}}),t,this,[[2,9]])})))}return n}}var zj=new(tN("AgoraRTCEventReport")(jj=function(){function e(){var t=this;U(this,e),rO(this,"baseInfoMap",new Map),rO(this,"proxyServer",void 0),rO(this,"clientList",CN),rO(this,"eventUploadTimer",void 0),rO(this,"setSessionIdTimer",void 0),rO(this,"url",void 0),rO(this,"backupUrl",void 0),rO(this,"keyEventUploadPendingItems",[]),rO(this,"normalEventUploadPendingItems",[]),rO(this,"apiInvokeUploadPendingItems",[]),rO(this,"apiInvokeCount",0),rO(this,"ltsList",[]),rO(this,"lastSendNormalEventTime",Date.now()),rO(this,"customReportCounterTimer",void 0),rO(this,"customReportCount",0),rO(this,"extApiInvoke",function(){var e=y(G.mark((function e(r){var n,i,o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=K(r);try{for(n.s();!(i=n.n()).done;)o=i.value,a=Yj(Yj({},o),{},{sid:null,invokeId:++t.apiInvokeCount,tag:Qx.TRACER}),t.sendApiInvoke(a)}catch(e){n.e(e)}finally{n.f()}case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),this.eventUploadTimer=window.setInterval(this.doSend.bind(this),gN("EVENT_REPORT_SEND_INTERVAL")),this.setSessionIdTimer=window.setInterval(this.appendSessionId.bind(this),gN("EVENT_REPORT_SEND_INTERVAL"))}return F(e,[{key:"adjustSessionStartTime",value:function(e){if(!this.baseInfoMap.has(e)&&!this.baseInfoMap.get(e))return ND.error("adjust session ".concat(e," start time, sid is not exist or info is undefined")),void ZD("error",this,"adjustSessionStartTime","adjust session ".concat(e," start time, sid is not exist or info is undefined"));var t=this.baseInfoMap.get(e),r=Date.now(),n=t.startTime;t.startTime=r,ND.debug("rewrite session ".concat(e," startTime: ").concat(r," , ").concat(r-n,"ms")),ZD("debug",this,"adjustSessionStartTime",void 0,"rewrite session ".concat(e," startTime: ").concat(r," , ").concat(r-n,"ms")),this.baseInfoMap.set(e,t)}},{key:"reportApiInvoke",value:function(e,t,r){var n=this;t.timeout=t.timeout||6e4,t.reportResult=void 0===t.reportResult||t.reportResult;var i=Date.now();this.apiInvokeCount+=1;var o=this.apiInvokeCount,a=function(){return{tag:t.tag,invokeId:o,sid:e,name:t.name,apiInvokeTime:i,options:t.options,states:t.states||null}},s=!!gN("SHOW_REPORT_INVOKER_LOG");s&&ND.info("".concat(t.name," start"),t.options);var c=!1;JG(t.timeout).then((function(){c||(n.sendApiInvoke(Yj(Yj({},a()),{},{error:mD.API_INVOKE_TIMEOUT,success:!1})),ND.debug("".concat(t.name," timeout")))}));var u=new SD(mD.UNEXPECTED_ERROR,"".concat(t.name,": this api invoke is end"));return{onSuccess:function(e){var i=function(){if(c)throw u;return c=!0,n.sendApiInvoke(Yj(Yj({},a()),{},{success:!0},t.reportResult&&{result:e})),s&&ND.info("".concat(t.name," onSuccess")),e};return r?AK(i,t.name+"Success",r,(function(){return c=!0})):i()},onError:function(e){var i=function(){if(c)throw e;c=!0,n.sendApiInvoke(Yj(Yj({},a()),{},{success:!1,error:e.toString()})),s&&ND.info("".concat(t.name," onFailure"),e.toString())};return r?AK(i,t.name+"Error",r,(function(){return c=!0})):i()}}}},{key:"sessionInit",value:function(e,t){if(!this.baseInfoMap.has(e)){var r=Date.now(),n=this.createBaseInfo(e,r);n.cname=t.cname;var i=Object.assign({},{willUploadConsoleLog:gN("UPLOAD_LOG"),maxTouchPoints:navigator.maxTouchPoints,areaVersion:aN?"global":"oversea",areas:gN("AREAS")&&gN("AREAS").join(",")},t.extend),o=Date.now(),a=Yj(Yj({},n),{},{eventType:Lx.SESSION_INIT,appid:t.appid,browser:navigator.userAgent,build:iN,lts:o,elapse:o-r,extend:JSON.stringify(i),mode:t.mode,process:gN("PROCESS_ID"),success:!0,version:oN});this.send({type:Bx.SESSION,data:a},!0)}}},{key:"joinChooseServer",value:function(e,t){var r=this.baseInfoMap.get(e);if(r){var n=r.info,i=Date.now(),o=Yj(Yj({},n),{},{eventType:Lx.JOIN_CHOOSE_SERVER,lts:i,eventElapse:i-t.lts,chooseServerAddr:t.csAddr,errorCode:t.ec,elapse:i-r.startTime,success:t.succ,chooseServerAddrList:JSON.stringify(t.serverList),uid:t.uid?parseInt(t.uid):null,cid:t.cid?parseInt(t.cid):null,chooseServerIp:t.csIp||"",opid:t.opid,unilbsServerIds:t.unilbsServerIds,extend:t.extend||void 0});this.send({type:Bx.JOIN_CHOOSE_SERVER,data:o},!0)}}},{key:"reqUserAccount",value:function(e,t){var r=this.baseInfoMap.get(e);if(r){var n=r.info,i=Date.now(),o=Yj(Yj({},n),{},{eventType:Lx.REQ_USER_ACCOUNT,lts:i,success:t.success,serverAddress:t.serverAddr,stringUid:t.stringUid,uid:t.uid,errorCode:t.errorCode,elapse:i-r.startTime,eventElapse:i-t.lts,extend:JSON.stringify(t.extend)});this.send({type:Bx.REQ_USER_ACCOUNT,data:o},!0)}}},{key:"joinGateway",value:function(e,t){var r=this.baseInfoMap.get(e);if(r){var n=r.info;t.vid&&(n.vid=t.vid),n.uid=t.uid,n.cid=t.cid;var i=Date.now(),o=t.firstSuccess,a=t.avoidJoinStartTime,s=t.isProxy,c=t.addr,u=i-(o&&a?a:r.startTime),d=Yj(Yj({},n),{},{eventType:Lx.JOIN_GATEWAY,lts:i,gatewayAddr:t.addr,success:t.succ,errorCode:t.ec,elapse:u,eventElapse:i-t.lts,firstSuccess:o}),l=d.success?1:0;if(t.succ&&(r.lastJoinSuccessTime=i),o)this.send({type:Bx.JOIN_GATEWAT,data:d},!0);else{var p;if(c)if(s){var f=c.match(/h=(\d{1,3}-){3}\d{1,3}/g),h=c.match(/p=[0-9]{1,6}/g);p={isSuccess:l,gatewayIp:f&&f.length?f[0].split("=")[1].replace(/-/g,"."):"",port:h&&h.length?h[0].split("=")[1]:"",isProxy:s?1:0}}else{var A=c.match(/wss:\/\/(\d{1,3}-){3}\d{1,3}/g),v=c.match(/:[0-9]{1,6}/g);p={isSuccess:l,gatewayIp:A&&A.length?A[0].split("//")[1].replace(/-/g,"."):"",port:v&&v.length?v[0].split(":")[1]:"",isProxy:s?1:0}}else p={isSuccess:l,gatewayIp:"",port:"",isProxy:s?1:0};delete d.success,delete d.eventType,delete d.firstSuccess,d.vid=Number(d.vid);var g=Object.assign({},d,p,{eventType:Lx.REJOIN_GATEWAY});this.send({type:Bx.RE_JOIN_GATEWAY,data:g},!0)}}}},{key:"joinChannelTimeout",value:function(e,t){var r=this.baseInfoMap.get(e);if(r){var n=Date.now(),i=Yj(Yj({},r.info),{},{lts:n,timeout:t,elapse:n-r.startTime});this.send({type:Bx.JOIN_CHANNEL_TIMEOUT,data:i},!0)}}},{key:"publish",value:function(e,t){var r=this.baseInfoMap.get(e);if(r){var n=r.info,i=Date.now(),o=Yj(Yj({},n),{},{eventType:Lx.PUBLISH,lts:i,eventElapse:t.eventElapse,elapse:i-r.startTime,success:t.succ,errorCode:t.ec,videoName:t.videoName,audioName:t.audioName,screenName:t.screenName,screenshare:t.screenshare,audio:t.audio,video:t.video,p2pid:t.p2pid,publishRequestid:t.publishRequestid});this.send({type:Bx.PUBLISH,data:o},!0)}}},{key:"subscribe",value:function(e,t,r){var n=this.baseInfoMap.get(e);if(n){var i=n.info,o=Date.now(),a=Yj(Yj({},i),{},{eventType:Lx.SUBSCRIBE,lts:o,eventElapse:t.eventElapse,elapse:o-n.startTime,success:t.succ,errorCode:t.ec,video:t.video,audio:t.audio,subscribeRequestid:t.subscribeRequestid,p2pid:t.p2pid},r&&{extend:JSON.stringify({isMassSubscribe:!0})});"string"==typeof t.peerid?a.peerSuid=t.peerid:a.peer=t.peerid,this.send({type:Bx.SUBSCRIBE,data:a},!0)}}},{key:"wsCompressorInit",value:function(e){var t,r=M(Lj(t=this.baseInfoMap).call(t)),n=r.length?r[0]:"UnableToGetSid",i=this.baseInfoMap.get(n);if(i){var o=i.info,a=Date.now(),s=Yj(Yj({},o),{},{eventType:Lx.WS_COMPRESSOR_INIT,lts:a,eventElapse:e.eventElapse,elapse:a-i.startTime,status:e.status?1:2});this.send({type:Bx.WS_COMPRESSOR_INIT,data:s},!0)}}},{key:"firstRemoteFrame",value:function(e,t,r,n){var i=this.baseInfoMap.get(e);if(i){var o=i.info,a=Date.now(),s=Yj(Yj(Yj({},o),n),{},{elapse:a-i.startTime,eventType:t,lts:a});this.send({type:r,data:s},!0)}}},{key:"onGatewayStream",value:function(e,t,r,n){var i=this.baseInfoMap.get(e);if(i){var o=i.info,a=Date.now(),s=Yj(Yj(Yj({},o),n),{},{eventType:t,lts:a});this.send({type:r,data:s},!0)}}},{key:"streamSwitch",value:function(e,t){var r=this.baseInfoMap.get(e);if(r){var n=r.info,i=Date.now(),o=Yj(Yj({},n),{},{eventType:Lx.STREAM_SWITCH,lts:i,isDual:t.isdual,elapse:i-r.startTime,success:t.succ});this.send({type:Bx.STREAM_SWITCH,data:o},!0)}}},{key:"requestProxyAppCenter",value:function(e,t){var r=this.baseInfoMap.get(e);if(r){var n=r.info,i=Date.now(),o=Yj(Yj({},n),{},{eventType:Lx.REQUEST_PROXY_APPCENTER,lts:i,eventElapse:i-t.lts,elapse:i-r.startTime,APAddr:t.APAddr,workerManagerList:t.workerManagerList,response:t.response,errorCode:t.ec,success:t.succ});this.send({type:Bx.REQUEST_PROXY_APPCENTER,data:o},!0)}}},{key:"requestProxyWorkerManager",value:function(e,t){var r=this.baseInfoMap.get(e);if(r){var n=r.info,i=Date.now(),o=Yj(Yj({},n),{},{eventType:Lx.REQUEST_PROXY_WORKER_MANAGER,lts:i,eventElapse:i-t.lts,elapse:i-r.startTime,workerManagerAddr:t.workerManagerAddr,response:t.response,errorCode:t.ec,success:t.succ});this.send({type:Bx.REQUEST_PROXY_WORKER_MANAGER,data:o},!0)}}},{key:"setProxyServer",value:function(e){this.proxyServer=e,e?ND.debug("reportProxyServerurl: ".concat(e)):ND.debug("disable reportProxyServerurl: ".concat(e)),ZD("debug",this,"setProxyServer",e)}},{key:"peerPublishStatus",value:function(e,t){var r=this.baseInfoMap.get(e);if(r){var n=r.info,i=Date.now(),o=Yj(Yj({},n),{},{subscribeElapse:t.subscribeElapse,peer:t.peer,peerPublishDuration:Math.max(t.audioPublishDuration,t.videoPublishDuration),audiotag:t.audioPublishDuration>0?1:-1,videotag:t.videoPublishDuration>0?1:-1,lts:i,elapse:i-r.startTime,joinChannelSuccessElapse:i-(r.lastJoinSuccessTime||i)});this.send({type:Bx.PEER_PUBLISH_STATUS,data:o},!0)}}},{key:"workerEvent",value:function(e,t){var r=this,n=this.baseInfoMap.get(e);if(n){var i=n.info,o=Date.now();(function(e,t,r){var n=e[t];if(!n||"string"!=typeof n)return[e];e[t]="";for(var i=qG(JSON.stringify(e)),o=0,a=[],s=0,c=0;c<n.length;c++)(s+=n.charCodeAt(c)<=127?1:3)<=r-i||(a[a.length]=YG(YG({},e),{},j({},t,n.substring(o,c))),o=c,s=n.charCodeAt(c)<=127?1:3);return o!==n.length-1&&(a[a.length]=YG(YG({},e),{},j({},t,n.substring(o)))),a})(Yj(Yj(Yj({},i),t),{},{elapse:o-n.startTime,lts:o,productType:"WebRTC"}),"payload",1300).forEach((function(e){return r.send({type:Bx.WORKER_EVENT,data:e},!0)}))}}},{key:"apworkerEvent",value:function(e,t){var r=this.baseInfoMap.get(e);if(r){var n=r.info,i=Date.now(),o=Yj(Yj(Yj({},n),t),{},{elapse:i-r.startTime,lts:i});this.send({type:Bx.AP_WORKER_EVENT,data:o},!0)}}},{key:"joinWebProxyAP",value:function(e,t){var r=this.baseInfoMap.get(e);if(r){var n=r.info,i=Date.now(),o=Yj(Yj(Yj({},n),t),{},{elapse:i-r.startTime,lts:i,extend:t.extend||void 0});this.send({type:Bx.JOIN_WEB_PROXY_AP,data:o},!0)}}},{key:"WebSocketQuit",value:function(e,t){var r=this.baseInfoMap.get(e);if(r){var n=r.info,i=Date.now(),o=Yj(Yj(Yj({},n),t),{},{elapse:i-r.startTime,lts:i});this.send({type:Bx.WEBSOCKET_QUIT,data:o},!0)}}},{key:"sendCustomReportMessage",value:function(){var e=y(G.mark((function e(t,r){var n,i,o=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.customReportCount+=r.length,!(this.customReportCount>gN("CUSTOM_REPORT_LIMIT"))){e.next=2;break}throw new SD(mD.CUSTOM_REPORT_FREQUENCY_TOO_HIGH);case 2:return this.customReportCounterTimer||(this.customReportCounterTimer=window.setInterval((function(){o.customReportCount=0}),5e3)),n=r.map((function(e){return{type:Bx.USER_ANALYTICS,data:Yj({sid:t},e)}})),i={msgType:"EventMessages",sentTs:Math.round(Date.now()/1e3),payloads:n.map((function(e){return JSON.stringify(e)}))},e.prev=4,e.next=7,this.postDataToStatsCollector(i);case 7:e.next=12;break;case 9:throw e.prev=9,e.t0=e.catch(4),ND.error("send custom report message failed",e.t0.toString()),new SD(mD.CUSTOM_REPORT_SEND_FAILED,e.t0.message);case 12:case"end":return e.stop()}}),e,this,[[4,9]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"autoplayFailed",value:function(e,t,r,n){if(e){var i=this.baseInfoMap.get(e);if(i){var o=i.info,a=Date.now(),s=Yj(Yj({},o),{},{vid:void 0===o.vid?0:Number(o.vid),lts:a,elapse:a-i.startTime,cbRegistered:Kj.onAutoplayFailed||Kj.onAudioAutoplayFailed?1:-1,errorMsg:r,mediaType:t,trackId:n,extend:void 0});this.send({type:Bx.AUTOPLAY_FAILED,data:s},!0)}}}},{key:"sendApiInvoke",value:function(e){var t=gN("NOT_REPORT_EVENT");if(e.tag&&t.includes&&t.includes(e.tag))return!1;if(null===e.sid)return this.apiInvokeUploadPendingItems.push(e),!1;var r=this.baseInfoMap.get(e.sid);if(!r)return this.apiInvokeUploadPendingItems.push(e),!1;var n=r.info,i=n.cname,o=n.uid,a=n.cid;e.lts=e.lts||Date.now();var s={invokeId:e.invokeId,sid:e.sid,cname:i,cid:a,uid:o,lts:e.lts,success:e.success,elapse:e.lts-r.startTime,execElapse:e.lts-e.apiInvokeTime,apiName:e.name,options:e.options?JSON.stringify(e.options):void 0,execStates:e.states?JSON.stringify(e.states):void 0,execResult:e.result?JSON.stringify(e.result):void 0,errorCode:e.error?JSON.stringify(e.error):void 0};return this.send({type:Bx.API_INVOKE,data:s},!1),!0}},{key:"appendSessionId",value:function(){var e=this;this.clientList.forEach((function(t){if(t._sessionId)for(var r=e.apiInvokeUploadPendingItems.length,n=0;n<r;n++){var i=e.apiInvokeUploadPendingItems.shift();i&&(i.sid=t._sessionId,e.sendApiInvoke(Object.assign({},i)))}}))}},{key:"send",value:function(e,t){if(t)return this.keyEventUploadPendingItems.push(e),void this.sendItems(this.keyEventUploadPendingItems,!0);this.normalEventUploadPendingItems.push(e),this.normalEventUploadPendingItems.length>gN("NORMAL_EVENT_QUEUE_CAPACITY")&&this.normalEventUploadPendingItems.splice(0,1),this.normalEventUploadPendingItems.length>=10&&this.sendItems(this.normalEventUploadPendingItems,!1)}},{key:"doSend",value:function(){this.keyEventUploadPendingItems.length>0&&this.sendItems(this.keyEventUploadPendingItems,!0),this.normalEventUploadPendingItems.length>0&&Date.now()-this.lastSendNormalEventTime>=5e3&&this.sendItems(this.normalEventUploadPendingItems,!1)}},{key:"sendItems",value:function(e,t){for(var r=this,n=[],i=[];e.length;){var o=e.shift();n.length<20?n.push(o):i.push(o)}e.push.apply(e,i);for(var a=0,s=[].concat(n);a<s.length;a++){var c,u=s[a];-1!==this.ltsList.indexOf(u.data.lts)?(u.data.lts=this.ltsList[this.ltsList.length-1]+1,this.ltsList.push(u.data.lts)):(this.ltsList.push(u.data.lts),yx(c=this.ltsList).call(c,(function(e,t){return e-t})))}t||(this.lastSendNormalEventTime=Date.now());var d={msgType:"EventMessages",sentTs:Math.round(Date.now()/1e3),payloads:n.map((function(e){return JSON.stringify(e)})),vid:function(e){var t=e&&e.data.sid&&r.baseInfoMap.get(e.data.sid);return t&&t.info.vid&&+t.info.vid||0}(n[0])};return n.length&&this.postDataToStatsCollector(d).catch(function(e){return function(n){gN("EVENT_REPORT_RETRY")&&(t?r.keyEventUploadPendingItems=r.keyEventUploadPendingItems.concat(e):(r.normalEventUploadPendingItems=r.normalEventUploadPendingItems.concat(e),r.normalEventUploadPendingItems.length>gN("NORMAL_EVENT_QUEUE_CAPACITY")&&(r.normalEventUploadPendingItems.splice(0,r.normalEventUploadPendingItems.length-gN("NORMAL_EVENT_QUEUE_CAPACITY")),ND.warning("report: drop normal events"))))}}(n)),e}},{key:"postDataToStatsCollector",value:function(){var e=y(G.mark((function e(t){var r,n,i,o,a=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=a.length>1&&void 0!==a[1]&&a[1],e.t0=Vj.networkState===XP.OFFLINE,!e.t0){e.next=5;break}return e.next=5,Rb.race([Vj.onlineWaiter,JG(2*bD.maxRetryTimeout)]);case 5:n=r?"/events/proto-raws":"/events/messages",i=this.url||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(gN("EVENT_REPORT_DOMAIN"),"&p=6443&d=").concat(n):"https://".concat(gN("EVENT_REPORT_DOMAIN"),":6443").concat(n)),o=0;case 8:if(!(o<2)){e.next=29;break}if(1===o&&(i=this.backupUrl||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(gN("EVENT_REPORT_BACKUP_DOMAIN"),"&p=6443&d=").concat(n):"https://".concat(gN("EVENT_REPORT_BACKUP_DOMAIN"),":6443").concat(n))),e.prev=10,!r){e.next=16;break}return e.next=14,Qj(i,{timeout:1e4,data:t});case 14:e.next=18;break;case 16:return e.next=18,Uj(i,{timeout:1e4,data:t});case 18:e.next=25;break;case 20:if(e.prev=20,e.t1=e.catch(10),1!==o){e.next=24;break}throw e.t1;case 24:return e.abrupt("continue",26);case 25:return e.abrupt("return");case 26:o+=1,e.next=8;break;case 29:case"end":return e.stop()}}),e,this,[[10,20]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"createBaseInfo",value:function(e,t){var r=Object.assign({},iP);return r.sid=e,this.baseInfoMap.set(e,{info:r,startTime:t}),r}},{key:"reportResourceTiming",value:function(e,t){var r=performance.getEntriesByName(e),n=r[r.length-1];n&&this.reportApiInvoke(t,{name:"Client.resourceTiming",options:n,tag:Qx.TRACER}).onSuccess()}}]),e}())||jj);ID.on("REPORT_LOG_UPLOAD",(function(e){e.networkState=Vj.networkState,zj.reportApiInvoke(null,{name:"logUploadError",options:e,tag:Qx.TRACER})}));var Xj,Zj,$j,eV=function(e){k(r,e);var t=W(r);function r(e,n){var i;return U(this,r),i=t.call(this),rO(S(i),"trackMediaType",void 0),rO(S(i),"_ID",void 0),rO(S(i),"_hints",[]),rO(S(i),"_isClosed",!1),rO(S(i),"_originMediaStreamTrack",void 0),rO(S(i),"_mediaStreamTrack",void 0),rO(S(i),"_external",{}),i._ID=n||XG(8,"track-"),i._originMediaStreamTrack=e,i._mediaStreamTrack=e,function(e){wN.includes(e)||wN.push(e)}(S(i)),i}return F(r,[{key:"toString",value:function(){return this._ID}},{key:"getTrackId",value:function(){return this._ID}},{key:"getMediaStreamTrack",value:function(e){if(!e){var t=zj.reportApiInvoke(null,{name:Ux.GET_MEDIA_STREAM_TRACK,options:[],tag:Qx.TRACER});this._mediaStreamTrack&&"string"==typeof this._mediaStreamTrack.label?t.onSuccess(this._mediaStreamTrack.label):t.onSuccess("")}return this._mediaStreamTrack}},{key:"getMediaStreamTrackSettings",value:function(){return this.getMediaStreamTrack(!0).getSettings()}},{key:"close",value:function(){this._isClosed=!0,function(e){var t=wN.indexOf(e);-1!==t&&wN.splice(t,1)}(this),this.emit(BP.CLOSED)}}]),r}(yD),tV=1,rV=function(){function e(t){U(this,e),rO(this,"lockingPromise",Rb.resolve()),rO(this,"locks",0),rO(this,"name",""),rO(this,"lockId",void 0),this.lockId=tV++,t&&(this.name=t),ND.debug("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}return F(e,[{key:"isLocked",get:function(){return this.locks>0}},{key:"lock",value:function(e){var t,r=this;this.locks+=1,ND.debug("[lock-".concat(this.name,"-").concat(this.lockId,"] is locked, current queue ").concat(this.locks,". ").concat("string"==typeof e?e:""));var n=new Rb((function(n){t=function(){r.locks-=1,ND.debug("[lock-".concat(r.name,"-").concat(r.lockId,"] is not locked, current queue ").concat(r.locks,". ").concat("string"==typeof e?e:"")),n()}})),i=this.lockingPromise.then((function(){return t}));return this.lockingPromise=this.lockingPromise.then((function(){return n})),i}}]),e}();function nV(e,t){return function(r,n,i){var o=r[n];if("function"!=typeof o)throw new Error("Cannot use mutex on object property.");return i.value=y(G.mark((function r(){var i,a,s,c,u,d=arguments;return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(i=this[t]){r.next=3;break}throw new Error("mutex property key ".concat(t," doesn't exist on ").concat(e));case 3:return r.next=5,i.lock("From ".concat(e,".").concat(n));case 5:for(a=r.sent,r.prev=6,s=d.length,c=new Array(s),u=0;u<s;u++)c[u]=d[u];return r.next=10,o.apply(this,c);case 10:return r.abrupt("return",r.sent);case 11:return r.prev=11,a(),r.finish(11);case 14:case"end":return r.stop()}}),r,this,[[6,,11,14]])}))),i}}var iV=function(e){k(r,e);var t=W(r);function r(e,n){var i;return U(this,r),i=t.call(this,e,n),rO(S(i),"_enabled",!0),rO(S(i),"_muted",!1),rO(S(i),"_isClosed",!1),rO(S(i),"_trackProcessors",[]),rO(S(i),"_enabledMutex",void 0),rO(S(i),"processor",void 0),rO(S(i),"processorContext",void 0),rO(S(i),"_handleTrackEnded",(function(){i.onTrackEnded()})),i._enabledMutex=new rV("".concat(n)),e.addEventListener("ended",i._handleTrackEnded),i}return F(r,[{key:"muted",get:function(){return this._muted}},{key:"enabled",get:function(){return this._enabled}},{key:"getTrackLabel",value:function(){return this._originMediaStreamTrack.label}},{key:"close",value:function(){this._isClosed||(this.stop(),this._trackProcessors.forEach((function(e){return e.destroy()})),this._trackProcessors=[],this._originMediaStreamTrack.stop(),this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack.stop(),this._mediaStreamTrack=null),this._originMediaStreamTrack=null,this._enabledMutex=null,ND.debug("[".concat(this.getTrackId(),"] close")),ZD("debug",this,"close"),this.emit(NP.NEED_CLOSE),f(d(r.prototype),"close",this).call(this))}},{key:"_registerTrackProcessor",value:function(){var e=y(G.mark((function e(t){var r,n=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(-1===this._trackProcessors.indexOf(t)){e.next=2;break}return e.abrupt("return");case 2:if(r=this._trackProcessors[this._trackProcessors.length-1],this._trackProcessors.push(t),t.onOutputChange=y(G.mark((function e(){var r;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.output||n._originMediaStreamTrack,n._mediaStreamTrack=r,n._updatePlayerSource(),e.next=5,nK(n,NP.NEED_REPLACE_TRACK,n);case 5:case"end":return e.stop()}}),e)}))),!r){e.next=11;break}return r.onOutputChange=y(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=r.output,!e.t0){e.next=4;break}return e.next=4,t.setInput(r.output);case 4:case"end":return e.stop()}}),e)}))),e.next=9,t.setInput(r.output||r.input||this._originMediaStreamTrack);case 9:e.next=13;break;case 11:return e.next=13,t.setInput(this._originMediaStreamTrack);case 13:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"_getOutputFromProcessors",value:function(){if(0===this._trackProcessors.length)return this._originMediaStreamTrack;var e=this._trackProcessors[this._trackProcessors.length-1];return e.output||e.input||this._originMediaStreamTrack}},{key:"_updateOriginMediaStreamTrack",value:function(){var e=y(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t===this._originMediaStreamTrack){e.next=13;break}if(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),r&&this._originMediaStreamTrack.stop(),t.addEventListener("ended",this._handleTrackEnded),this._originMediaStreamTrack=t,!(this._trackProcessors.length>0)){e.next=8;break}return e.next=4,this._trackProcessors[0].setInput(t);case 4:n=this._getOutputFromProcessors(),this._mediaStreamTrack=n,e.next=9;break;case 8:this._mediaStreamTrack=this._originMediaStreamTrack;case 9:return this._updatePlayerSource(),e.next=12,nK(this,NP.NEED_REPLACE_TRACK,this);case 12:this.processor&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this.processorContext});case 13:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"_getDefaultPlayerConfig",value:function(){return{}}},{key:"onTrackEnded",value:function(){ND.debug("[".concat(this.getTrackId(),"] track ended")),XD("debug",["MediaStreamTrack",this.getTrackId()],"ended"),this.emit(BP.TRACK_ENDED)}},{key:"stateCheck",value:function(e,t){if(ND.debug("check track state, [muted: ".concat(this._muted,", enabled: ").concat(this._enabled,"] to [").concat(e,": ").concat(t,"]")),ZD("debug",this,"stateCheck",{stateName:e,state:t,muted:this._muted,enabled:this._enabled}),Ix(t,e),this._enabled&&this._muted&&"enabled"===e&&!1===t)throw new SD(mD.TRACK_STATE_UNREACHABLE,"cannot set enabled while the track is muted").print();if(!this._enabled&&!this._muted&&"muted"===e&&!0===t)throw new SD(mD.TRACK_STATE_UNREACHABLE,"cannot set muted while the track is disabled").print()}},{key:"getProcessorStats",value:function(){return this.processorContext.gatherStats()}}]),r}(eV);!function(e){e.IOS_15_INTERRUPTION_START="ios15-interruption-start",e.IOS_15_INTERRUPTION_END="ios15-interruption-end",e.IOS_INTERRUPTION_START="ios-interruption-start",e.IOS_INTERRUPTION_END="ios-interruption-end",e.STATE_CHANGE="state-change"}(Xj||(Xj={})),function(e){e.AUDIO_CONTEXT_CREATED="audio_context_created"}(Zj||(Zj={})),function(e){e.AIDenoiser="AIDenoiser"}($j||($j={}));var oV={audioContextInitOptions:{}},aV=new(function(e){k(r,e);var t=W(r);function r(){var e;return U(this,r),e=t.call(this),rO(S(e),"registeredPlugins",[]),e}return F(r,[{key:"setOptions",value:function(e,t){oV[e]&&(oV[e]=t)}},{key:"getOptions",value:function(e){return oV[e]}},{key:"installPlugin",value:function(e){e instanceof Object&&e.name&&this.registeredPlugins.push(e.name)}}]),r}(yD)),sV=window.AudioContext||window.webkitAudioContext,cV=null,uV=new(function(e){k(r,e);var t=W(r);function r(){var e;return U(this,r),e=t.apply(this,arguments),rO(S(e),"prevState",void 0),rO(S(e),"curState",void 0),rO(S(e),"interruptDetectorTrack",void 0),rO(S(e),"onLocalAudioTrackMute",(function(){ND.info("ios15-interruption-start"),JD("info",["WebAudio"],"ios15-interruption-start"),e.emit(Xj.IOS_15_INTERRUPTION_START)})),rO(S(e),"onLocalAudioTrackUnmute",y(G.mark((function t(){return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(ND.info("ios15-interruption-end"),JD("info",["WebAudio"],"ios15-interruption-end"),"running"===e.curState&&!e.duringInterruption){t.next=6;break}ND.info("ios15-interruption-end-canceled"),t.next=11;break;case 6:if(t.t0=cV,!t.t0){t.next=10;break}return t.next=10,cV.suspend();case 10:e.emit(Xj.IOS_15_INTERRUPTION_END);case 11:case"end":return t.stop()}}),t)})))),e}return F(r,[{key:"duringInterruption",get:function(){return"running"===this.prevState&&"interrupted"===this.curState}},{key:"bindInterruptDetectorTrack",value:function(e){ND.debug("webaudio bindInterruptDetectorTrack ".concat(e.getTrackId())),ZD("debug",["WebAudio"],"bindInterruptDetectorTrack",e.getTrackId()),this.interruptDetectorTrack||(this.interruptDetectorTrack=e,this.interruptDetectorTrack._mediaStreamTrack.onmute=this.onLocalAudioTrackMute,this.interruptDetectorTrack._mediaStreamTrack.onunmute=this.onLocalAudioTrackUnmute)}},{key:"unbindInterruptDetectorTrack",value:function(e){ND.debug("webaudio unbindInterruptDetectorTrack ".concat(e.getTrackId())),ZD("debug",["WebAudio"],"unbindInterruptDetectorTrack",e.getTrackId()),this.interruptDetectorTrack&&this.interruptDetectorTrack===e&&(this.interruptDetectorTrack._mediaStreamTrack&&(this.interruptDetectorTrack._mediaStreamTrack.onmute=null,this.interruptDetectorTrack._mediaStreamTrack.onunmute=null),this.interruptDetectorTrack=void 0)}}]),r}(yD));function dV(){if(!sV)return ND.error("your browser is not support web audio"),void qD("error",["WebAudio"],"your browser is not support web audio");ND.info("create audio context"),$D("info",["WebAudio"],"WebAudioContext");var e,t=aV.getOptions("audioContextInitOptions");ND.debug("audio content init option:",JSON.stringify(t)),cV=new sV(t),aV.emit(Zj.AUDIO_CONTEXT_CREATED,cV),uV.curState=cV.state,cV.onstatechange=function(){uV.prevState=uV.curState,uV.curState=cV?cV.state:void 0,(Qk()||Kk())&&"running"===uV.prevState&&"interrupted"===uV.curState&&(ND.info("ios-interruption-start"),JD("info",["AudioState"],"ios-interruption-start"),uV.emit(Xj.IOS_INTERRUPTION_START)),(Qk()||Kk())&&"interrupted"===uV.prevState&&"running"===uV.curState&&(ND.info("ios-interruption-end"),JD("info",["AudioState"],"ios-interruption-end"),uV.emit(Xj.IOS_INTERRUPTION_END)),uV.prevState!==uV.curState&&(ND.debug("AudioContext State Change","".concat(uV.prevState,"=>").concat(uV.curState)),XD("debug",["AudioContext",void 0],"statechange","".concat(uV.prevState,"=>").concat(uV.curState)),uV.emit(Xj.STATE_CHANGE))},(e=y(G.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f,h,A,v,g;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:A=function(){p(!0)},h=function(){n.removeEventListener("playing",h),n.removeEventListener("abort",h),n.removeEventListener("error",h),a=!1,p(!1)},f=function(e){if(o!==e){o=e;for(var t=0,n=r;t<n.length;t++){var i=n[t];e?window.addEventListener(i,A,{capture:!0,passive:!0}):window.removeEventListener(i,A,{capture:!0,passive:!0})}}},p=function(e){if(!a)if(n.paused)if(e){f(!1),a=!0;var t=void 0;try{(t=n.play())?t.then(h,h):(n.addEventListener("playing",h),n.addEventListener("abort",h),n.addEventListener("error",h))}catch(e){h()}}else f(!0);else f(!1)},l=function(){s(!0)},d=function(){s(!1)},u=function(){s(!0)},c=function(e){if(i!==e){i=e;for(var t=0,n=r;t<n.length;t+=1){var o=n[t];e?window.addEventListener(o,l,{capture:!0,passive:!0}):window.removeEventListener(o,l,{capture:!0,passive:!0})}}},s=function(e){"running"===t.state?c(!1):Qk()||Kk()?"suspended"===t.state&&(c(!0),e&&t.resume().then(d,d)):"closed"!==t.state&&(c(!0),e&&t.resume().then(d,d))},r=["click","contextmenu","auxclick","dblclick","mousedown","mouseup","touchend","keydown","keyup"],i=!1,o=!1,a=!1,Qk()&&(v=t.createMediaStreamDestination(),(g=document.createElement("div")).innerHTML="<audio x-webkit-airplay='deny'></audio>",(n=g.children.item(0)).controls=!1,n.disableRemotePlayback=!0,n.preload="auto",n.srcObject=v.stream,p(!0)),uV.on(Xj.STATE_CHANGE,u),s(!1);case 13:case"end":return e.stop()}}),e)}))),function(t){return e.apply(this,arguments)})(cV)}function lV(){if(!cV){if(dV(),!cV)throw new SD(mD.NOT_SUPPORTED,"can not create audio context");return cV}return cV}function pV(e){if(!function(){if(null!==fV)return fV;var e=lV(),t=e.createBufferSource(),r=e.createGain(),n=e.createGain();t.connect(r),t.connect(n),t.disconnect(r);var i=!1;try{t.disconnect(r)}catch(e){i=!0}return t.disconnect(),fV=i,i}()){ZD("debug",["WebAudio"],"polyfillAudioNode");var t=e.connect,r=e.disconnect;e.connect=function(r,n,i){return e._inputNodes||(e._inputNodes=[]),e._inputNodes.includes(r)||(r instanceof AudioNode?(e._inputNodes.push(r),t.call(e,r,n,i)):t.call(e,r,n)),e},e.disconnect=function(n,i,o){r.call(e),n?aK(e._inputNodes,n):e._inputNodes=[];var a,s=K(e._inputNodes);try{for(s.s();!(a=s.n()).done;){var c=a.value;t.call(e,c)}}catch(e){s.e(e)}finally{s.f()}}}}var fV=null;function hV(e,t){var r=1/t,n=lV(),i=n.createGain();i.gain.value=0,i.connect(n.destination);var o=!1,a=function t(){if(o)i=null;else{var a=n.createOscillator();a.onended=t,a.connect(i),a.start(0),a.stop(n.currentTime+r),e(n.currentTime)}};return a(),function(){o=!0}}var AV=ND.prefix("[inject-node]"),vV=function(){function e(){U(this,e),rO(this,"nodeLists",[]),rO(this,"prevNode",void 0),rO(this,"nextNode",void 0)}return F(e,[{key:"firstNode",get:function(){return this.nodeLists[0]}},{key:"lastNode",get:function(){return this.nodeLists[this.nodeLists.length-1]}},{key:"isActive",get:function(){return!!this.nodeLists.length}},{key:"isConnected",get:function(){return!(!this.prevNode||!this.nextNode)}},{key:"connect",value:function(e,t){var r=this;AV.debug("connect audio node, current list:"+this.nodeLists.length),this.nodeLists.length?(this.prevNode&&this.prevNode.disconnect(),e.connect(this.firstNode),this.nextNode&&this.lastNode&&this.lastNode.disconnect(),this.lastNode.connect(t),this.nodeLists.forEach((function(e,t){var n=r.nodeLists[t+1];n&&e.connect(n)}))):e.connect(t),this.nextNode=t,this.prevNode=e}},{key:"disconnect",value:function(){var e;AV.debug("disconnect audio node, current list:"+this.nodeLists.length),this.nodeLists.forEach((function(e){e.disconnect()})),null===(e=this.prevNode)||void 0===e||e.disconnect(),this.prevNode=void 0,this.nextNode=void 0}},{key:"addNode",value:function(e){AV.debug("add node in inject node, current list:",this.nodeLists.length),this.prevNode&&this.nextNode?(this.firstNode||(AV.debug("new node is the first node"),this.prevNode.disconnect(),this.prevNode.connect(e),e.connect(this.nextNode)),this.nextNode&&this.lastNode&&(this.lastNode.disconnect(this.nextNode),this.lastNode.connect(e),e.connect(this.nextNode)),this.nodeLists.push(e)):AV.debug("add node is called before inject node connected")}},{key:"removeNode",value:function(e){AV.debug("remove node in inject node, current list:",this.nodeLists.length);var t=this.nodeLists.indexOf(e);if(-1!==t){var r=this.nodeLists[t+1],n=this.nodeLists[t-1];0===t&&this.prevNode&&this.nextNode&&(this.prevNode.disconnect(e),r?this.prevNode.connect(r):this.prevNode.connect(this.nextNode)),t===this.nodeLists.length-1&&this.nextNode&&n&&(n.disconnect(e),n.connect(this.nextNode)),0!==t&&t!==this.nodeLists.length-1&&(n.disconnect(e),n.connect(r)),AV.debug("remove node in inject node success, current list:",this.nodeLists.length)}else AV.debug("$[inject-node] cannot find the node to be removed")}}]),e}(),gV=function(e){k(r,e);var t=W(r);function r(){var e;return U(this,r),e=t.call(this),rO(S(e),"outputNode",void 0),rO(S(e),"outputTrack",void 0),rO(S(e),"isPlayed",!1),rO(S(e),"sourceNode",void 0),rO(S(e),"analyserNode",void 0),rO(S(e),"context",void 0),rO(S(e),"audioBufferNode",void 0),rO(S(e),"destNode",void 0),rO(S(e),"injectNode",void 0),rO(S(e),"audioOutputLevel",0),rO(S(e),"_processedNode",void 0),rO(S(e),"playNode",void 0),rO(S(e),"isDestroyed",!1),rO(S(e),"onNoAudioInput",void 0),rO(S(e),"isNoAudioInput",!1),rO(S(e),"_noAudioInputCount",0),e.context=lV(),e.playNode=e.context.destination,e.outputNode=e.context.createGain(),pV(e.outputNode),e.analyserNode=e.context.createAnalyser(),e.analyserNode.smoothingTimeConstant=.4,e.analyserNode.fftSize=2048,e.injectNode=new vV,e}return F(r,[{key:"processSourceNode",get:function(){return this.sourceNode}},{key:"processedNode",get:function(){return this._processedNode},set:function(e){var t;if(!this.isDestroyed&&this._processedNode!==e){try{var r;null===(r=this.sourceNode)||void 0===r||r.disconnect(this.outputNode)}catch(e){}null===(t=this._processedNode)||void 0===t||t.disconnect(),this._processedNode=e,this.connect()}}},{key:"startGetAudioBuffer",value:function(e){var t=this;this.audioBufferNode||(this.audioBufferNode=this.context.createScriptProcessor(e),this.outputNode.connect(this.audioBufferNode),this.audioBufferNode.connect(this.context.destination),this.audioBufferNode.onaudioprocess=function(e){t.emit(nP.ON_AUDIO_BUFFER,function(e){for(var t=0;t<e.outputBuffer.numberOfChannels;t+=1)for(var r=e.outputBuffer.getChannelData(t),n=0;n<r.length;n+=1)r[n]=0;return e.inputBuffer}(e))})}},{key:"stopGetAudioBuffer",value:function(){this.audioBufferNode&&(this.audioBufferNode.onaudioprocess=null,this.outputNode.disconnect(this.audioBufferNode),this.audioBufferNode=void 0)}},{key:"createOutputTrack",value:function(){if(!oL().webAudioMediaStreamDest)throw new SD(mD.NOT_SUPPORTED,"your browser is not support audio processor");return this.destNode&&this.outputTrack||(this.destNode=this.context.createMediaStreamDestination(),this.outputNode.connect(this.destNode),this.outputTrack=this.destNode.stream.getAudioTracks()[0]),this.outputTrack}},{key:"play",value:function(e){"running"!==this.context.state&&cK((function(){uV.emit("autoplay-failed")})),this.isPlayed=!0,this.playNode=e||this.context.destination,this.outputNode.connect(this.playNode)}},{key:"stop",value:function(){if(this.isPlayed)try{this.outputNode.disconnect(this.playNode)}catch(e){}this.isPlayed=!1}},{key:"getAccurateVolumeLevel",value:function(){if(!this.context||Qk()||Kk()||"running"!==this.context.state&&this.context.resume(),!this.analyserNode)return 0;var e=new Uint8Array(this.analyserNode.frequencyBinCount);this.analyserNode.getByteFrequencyData(e);for(var t=0,r=0;r<e.length;r++)t+=r<64?Math.abs(10*e[r]):Math.abs(6*e[r]/15);return t/e.length/255}},{key:"checkHasAudioInput",value:function(){var e=y(G.mark((function e(){var t,r,n,i,o=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!((t=o.length>0&&void 0!==o[0]?o[0]:0)>5)){e.next=3;break}return e.abrupt("return",(this.isNoAudioInput=!0,this.onNoAudioInput&&this.onNoAudioInput(),!1));case 3:if(Qk()||Kk()?"suspended"===this.context.state&&this.context.resume():"running"!==this.context.state&&this.context.resume(),this.analyserNode){e.next=5;break}return e.abrupt("return",!1);case 5:for(r=new Uint8Array(this.analyserNode.frequencyBinCount),this.analyserNode.getByteFrequencyData(r),n=!1,i=0;i<r.length;i++)0!==r[i]&&(n=!0);if(!n){e.next=13;break}e.t0=(this.isNoAudioInput=!1,!0),e.next=21;break;case 13:return e.next=15,JG(200);case 15:return e.next=17,this.checkHasAudioInput(t?t+1:1);case 17:if(e.t1=e.sent,!e.t1){e.next=20;break}e.t1=n;case 20:e.t0=e.t1;case 21:return e.abrupt("return",e.t0);case 22:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"getAudioVolume",value:function(){return this.outputNode.gain.value}},{key:"setVolume",value:function(e){this.outputNode.gain.setValueAtTime(e,this.context.currentTime)}},{key:"destroy",value:function(){this.disconnect(),this.stop(),this.isDestroyed=!0,this.onNoAudioInput=void 0}},{key:"injectAudioNode",value:function(e){this.injectNode.addNode(e)}},{key:"removeAudioNode",value:function(e){this.injectNode.removeNode(e)}},{key:"disconnect",value:function(){var e,t;null===(e=this.processedNode)||void 0===e||e.disconnect(),null===(t=this.sourceNode)||void 0===t||t.disconnect(),this.outputNode&&this.outputNode.disconnect()}},{key:"connect",value:function(){var e;this.processedNode?null===(e=this.processedNode)||void 0===e||e.connect(this.outputNode):this.sourceNode&&this.sourceNode.connect(this.outputNode),this.outputNode.connect(this.analyserNode)}}]),r}(yD),mV=function(e){k(r,e);var t=W(r);function r(e,n){var i,o;if(U(this,r),i=t.call(this),rO(S(i),"sourceNode",void 0),rO(S(i),"track",void 0),rO(S(i),"audioElement",void 0),rO(S(i),"isCurrentTrackCloned",!1),rO(S(i),"isRemoteTrack",!1),rO(S(i),"rebuildWebAudio",y(G.mark((function e(){var t,r,n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ND.debug("ready to rebuild web audio, state:",i.context.state),e.t0=i.isNoAudioInput,!e.t0){e.next=5;break}return e.next=5,i.checkHasAudioInput();case 5:if(i.isNoAudioInput&&!i.isDestroyed){e.next=7;break}return e.abrupt("return",(document.body.removeEventListener("click",i.rebuildWebAudio,!0),void ND.debug("rebuild web audio success, current volume status",i.getAccurateVolumeLevel())));case 7:i.context.resume().then((function(){return ND.info("resume success")})),ND.debug("rebuild web audio because of ios 12 bugs"),i.disconnect(),t=i.track,i.track=i.track.clone(),i.isCurrentTrackCloned?t.stop():i.isCurrentTrackCloned=!0,r=new MediaStream([i.track]),i.sourceNode=i.context.createMediaStreamSource(r),pV(i.sourceNode),i.analyserNode=i.context.createAnalyser(),n=i.outputNode.gain.value,i.outputNode=i.context.createGain(),i.outputNode.gain.setValueAtTime(n,i.context.currentTime),pV(i.outputNode),i.emit(nP.UPDATE_SOURCE),i.connect(),i.audioElement.srcObject=r,i.isPlayed&&i.play(i.playNode),i.checkHasAudioInput();case 14:case"end":return e.stop()}}),e)})))),"audio"!==e.kind)throw new SD(mD.UNEXPECTED_ERROR);i.track=e;var a=new MediaStream([i.track]);i.isRemoteTrack=!!n,i.sourceNode=i.context.createMediaStreamSource(a),pV(i.sourceNode),i.connect(),i.audioElement=document.createElement("audio"),i.audioElement.srcObject=a;var s=Tk();return n&&s.os===Ik.IOS&&Number(null===(o=s.osVersion)||void 0===o?void 0:o.split(".")[0])<15&&(uV.on(Xj.STATE_CHANGE,(function(){"suspended"===i.context.state?document.body.addEventListener("click",i.rebuildWebAudio,!0):"running"===i.context.state&&i.rebuildWebAudio()})),i.checkHasAudioInput().then((function(e){e||document.body.addEventListener("click",i.rebuildWebAudio,!0)}))),x(i)}return F(r,[{key:"isFreeze",get:function(){return!1}},{key:"updateTrack",value:function(e){this.sourceNode.disconnect(),this.track=e,this.isCurrentTrackCloned=!1;var t=new MediaStream([e]);this.sourceNode=this.context.createMediaStreamSource(t),pV(this.sourceNode),this.processedNode||this.sourceNode.connect(this.outputNode),this.emit(nP.UPDATE_SOURCE),this.audioElement.srcObject=t}},{key:"destroy",value:function(){this.audioElement.srcObject=null,this.audioElement.remove(),uV.off("state-change",this.rebuildWebAudio),f(d(r.prototype),"destroy",this).call(this)}}]),r}(gV);function EV(e,t){return _V.apply(this,arguments)}function _V(){return _V=y(G.mark((function e(t,r){var n,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=function(e,t){return e?"number"!=typeof e?e.max||e.exact||e.ideal||e.min||t:e:t},i={audio:!1,video:{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxHeight:n(r.height,1080),maxWidth:n(r.width,1920)}}},r.frameRate&&"number"!=typeof r.frameRate?(i.video.mandatory.maxFrameRate=r.frameRate.max,i.video.mandatory.minFrameRate=r.frameRate.min):"number"==typeof r.frameRate&&(i.video.mandatory.maxFrameRate=r.frameRate),e.next=4,navigator.mediaDevices.getUserMedia(i);case 4:return e.abrupt("return",e.sent);case 5:case"end":return e.stop()}}),e)}))),_V.apply(this,arguments)}function yV(e){return IV.apply(this,arguments)}function IV(){return IV=y(G.mark((function e(t){var r,n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,SV(t.mediaSource);case 2:return r=e.sent,e.next=5,function(e){return new Rb((function(t,r){var n=document.createElement("div");n.innerText="share screen",n.setAttribute("style","text-align: center; height: 25px; line-height: 25px; border-radius: 4px 4px 0 0; background: #D4D2D4; border-bottom: solid 1px #B9B8B9;");var i=document.createElement("div");i.setAttribute("style","width: 100%; height: 500px; padding: 15px 25px ; box-sizing: border-box;");var o=document.createElement("div");o.innerText="Agora Web Screensharing wants to share the contents of your screen with webdemo.agorabeckon.com. Choose what you'd like to share.",o.setAttribute("style","height: 12%;");var a=document.createElement("div");a.setAttribute("style","width: 100%; height: 80%; background: #FFF; border: solid 1px #CBCBCB; display: flex; flex-wrap: wrap; justify-content: space-around; overflow-y: scroll; padding: 0 15px; box-sizing: border-box;");var s=document.createElement("div");s.setAttribute("style","text-align: right; padding: 16px 0;");var c=document.createElement("button");c.innerHTML="cancel",c.setAttribute("style","width: 85px;"),c.onclick=function(){document.body.removeChild(u);var e=new Error("NotAllowedError");e.name="NotAllowedError",r(e)},s.appendChild(c),i.appendChild(o),i.appendChild(a),i.appendChild(s);var u=document.createElement("div");u.setAttribute("style","position: fixed; z-index: 99999999; top: 50%; left: 50%; width: 620px; height: 525px; background: #ECECEC; border-radius: 4px; -webkit-transform: translate(-50%,-50%); transform: translate(-50%,-50%);"),u.appendChild(n),u.appendChild(i),document.body.appendChild(u),e.map((function(e){if(e.id){var r=document.createElement("div");r.setAttribute("style","width: 30%; height: 160px; padding: 20px 0; text-align: center;box-sizing: content-box;");var n=e.thumbnail;n.getSize().width>1920&&(n=n.resize({width:1920})),r.innerHTML='<div style="height: 120px; display: table-cell; vertical-align: middle;"><img style="width: 100%; background: #333333; box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.2);" src='+n.toDataURL()+' /></div><span style="\theight: 40px; line-height: 40px; display: inline-block; width: 70%; word-break: keep-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">'+e.name.replace(/[\u00A0-\u9999<>\&]/g,(function(e){return"&#"+e.charCodeAt(0)+";"}))+"</span>",r.onclick=function(){document.body.removeChild(u),t(e.id)},a.appendChild(r)}}))}))}(r);case 5:return n=e.sent,e.next=8,EV(n,t);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e)}))),IV.apply(this,arguments)}function SV(e){return bV.apply(this,arguments)}function bV(){return bV=y(G.mark((function e(t){var r,n,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=["window","screen"],"application"!==t&&"window"!==t||(r=["window"]),"screen"===t&&(r=["screen"]),n=wV()){e.next=5;break}throw new SD(mD.ELECTRON_IS_NULL);case 5:i=null;try{i=n.desktopCapturer.getSources({types:r})}catch(e){i=null}return i&&i.then||(i=new Rb((function(e,t){n.desktopCapturer.getSources({types:r},(function(r,n){r?t(r):e(n)}))}))),e.prev=8,e.next=11,i;case 11:return e.abrupt("return",e.sent);case 14:throw e.prev=14,e.t0=e.catch(8),new SD(mD.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR,e.t0.toString());case 17:case"end":return e.stop()}}),e,null,[[8,14]])}))),bV.apply(this,arguments)}var CV=null;function wV(){if(CV)return CV;try{return CV=window.require("electron")}catch(e){return null}}var RV=new rV("safari"),TV=!1,kV=!1;function OV(e,t){return DV.apply(this,arguments)}function DV(){return DV=y(G.mark((function e(t,r){var n,i,o;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:n=0,i=null;case 1:if(!(n<2)){e.next=24;break}return e.prev=2,e.next=5,NV(t,r,n>0);case 5:return i=e.sent,e.abrupt("break",24);case 9:if(e.prev=9,e.t0=e.catch(2),!(e.t0 instanceof SD)){e.next=13;break}throw ND.error("[".concat(r,"] ").concat(e.t0.toString())),ZD("error",[],"getLocalStream",{config:t,id:r},e.t0.toString()),e.t0;case 13:if((o=PV(e.t0.name||e.t0.code||e.t0,e.t0.message)).code!==mD.MEDIA_OPTION_INVALID){e.next=21;break}return ND.debug("[".concat(r,"] detect media option invalid, retry")),qD("debug",[],"[".concat(r,"] detect media option invalid, retry")),n+=1,e.next=20,JG(500);case 20:return e.abrupt("continue",22);case 21:throw ND.error("[".concat(r,"] ").concat(o.toString())),ZD("error",[],"getLocalStream",{config:t,id:r},o.toString()),o;case 22:e.next=1;break;case 24:if(i){e.next=26;break}throw new SD(mD.UNEXPECTED_ERROR,"can not find stream after getUserMedia");case 26:return e.abrupt("return",i);case 27:case"end":return e.stop()}}),e,null,[[2,9]])}))),DV.apply(this,arguments)}function NV(e,t,r){return xV.apply(this,arguments)}function xV(){return xV=y(G.mark((function e(t,r,n){var i,o,a,s,c,u,d,l,p,f,h;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){e.next=2;break}throw new SD(mD.NOT_SUPPORTED,"can not find getUserMedia");case 2:if(n&&(t.video&&(delete t.video.width,delete t.video.height),t.screen&&(delete t.screen.width,delete t.screen.height)),i=oL(),o=new MediaStream,t.audioSource&&o.addTrack(t.audioSource),t.videoSource&&o.addTrack(t.videoSource),t.audio||t.video||t.screen){e.next=6;break}return e.abrupt("return",(ND.debug("Using Video Source/ Audio Source"),qD("debug",[],"Using Video Source/ Audio Source"),o));case 6:if(!t.screen){e.next=64;break}if(!wV()){e.next=25;break}if(!t.screen.sourceId){e.next=17;break}return e.t0=LV,e.t1=o,e.next=13,EV(t.screen.sourceId,t.screen);case 13:e.t2=e.sent,(0,e.t0)(e.t1,e.t2),e.next=23;break;case 17:return e.t3=LV,e.t4=o,e.next=21,yV(t.screen);case 21:e.t5=e.sent,(0,e.t3)(e.t4,e.t5);case 23:e.next=64;break;case 25:if(!(Bk()&&t.screen.extensionId&&t.screen.mandatory)){e.next=41;break}if(i.getStreamFromExtension){e.next=28;break}throw new SD(mD.NOT_SUPPORTED,"This browser does not support screen sharing");case 28:return ND.debug("[".concat(r,'] Screen access on chrome stable, looking for extension"')),qD("debug",[],"[".concat(r,'] Screen access on chrome stable, looking for extension"')),e.next=31,u=t.screen.extensionId,d=r,new Rb((function(e,t){try{chrome.runtime.sendMessage(u,{getStream:!0},(function(r){if(!r||!r.streamId)return ND.error("[".concat(d,"] No response from Chrome Plugin. Plugin not installed properly"),r),ZD("error",[],"getSourceIdFromExtension",{extensionId:u,streamId:d},"No response from Chrome Plugin. Plugin not installed properly, ".concat(r)),void t(new SD(mD.CHROME_PLUGIN_NO_RESPONSE,"No response from Chrome Plugin. Plugin not installed properly"));e(r.streamId)}))}catch(e){ND.error("[".concat(d,"] AgoraRTC screensharing plugin is not accessible(").concat(u,")"),e.toString()),ZD("error",[],"getSourceIdFromExtension",{extensionId:u,streamId:d},"AgoraRTC screensharing plugin is not accessible(".concat(u,"), ").concat(e.toString())),t(new SD(mD.CHROME_PLUGIN_NOT_INSTALL))}}));case 31:return a=e.sent,t.screen.mandatory.chromeMediaSourceId=a,e.t6=LV,e.t7=o,e.next=37,navigator.mediaDevices.getUserMedia({video:{mandatory:t.screen.mandatory}});case 37:e.t8=e.sent,(0,e.t6)(e.t7,e.t8),e.next=64;break;case 41:if(!i.getDisplayMedia){e.next=53;break}return t.screen.mediaSource&&VP(t.screen.mediaSource),s={width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate,displaySurface:"screen"===t.screen.mediaSource?"monitor":t.screen.mediaSource},ND.debug("[".concat(r,"] getDisplayMedia:"),JSON.stringify({video:s,audio:!!t.screenAudio})),$D("debug",["mediaDevices",r],"getDisplayMedia",{video:s,audio:!!t.screenAudio,trackId:r}),e.t9=LV,e.t10=o,e.next=49,navigator.mediaDevices.getDisplayMedia({video:s,audio:!!t.screenAudio});case 49:e.t11=e.sent,(0,e.t9)(e.t10,e.t11),e.next=64;break;case 53:if(Uk()){e.next=55;break}throw ND.error("[".concat(r,"] This browser does not support screenSharing")),new SD(mD.NOT_SUPPORTED,"This browser does not support screen sharing");case 55:return t.screen.mediaSource&&VP(t.screen.mediaSource),c={video:{mediaSource:t.screen.mediaSource,width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate}},ND.debug("[".concat(r,"] getUserMedia: ").concat(JSON.stringify(c))),$D("debug",["mediaDevices",r],"getUserMedia",c),e.t12=LV,e.t13=o,e.next=62,navigator.mediaDevices.getUserMedia(c);case 62:e.t14=e.sent,(0,e.t12)(e.t13,e.t14);case 64:if(t.video||t.audio){e.next=66;break}return e.abrupt("return",o);case 66:if(l={video:t.video,audio:t.audio},p=gN("MEDIA_DEVICE_CONSTRAINTS"))try{"string"==typeof p&&(p=JSON.parse(p)),l=function e(t,r){if(!gK(t)||!gK(r))return r;if(Array.isArray(t)&&!Array.isArray(r)||!Array.isArray(t)&&Array.isArray(r))return r;if(Array.isArray(r)&&Array.isArray(t)){for(var n=M(t),i=0;i<r.length;i++)n[i]=e(t[i],r[i]);return n}var o=YG({},t);for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(Object.prototype.hasOwnProperty.call(t,a)?o[a]=e(t[a],r[a]):o[a]=r[a]);return o}(l,p),qD("debug",["mediaDevices",r],"merge configConstraints ".concat(JSON.stringify(p)))}catch(e){}if(ND.debug("[".concat(r,"] GetUserMedia"),JSON.stringify(l)),$D("debug",["mediaDevices",r],"getUserMedia",l),Tk(),h=null,e.t15=Mk()||Qk()||xk(),!e.t15){e.next=75;break}return e.next=74,RV.lock();case 74:h=e.sent;case 75:return e.prev=75,e.next=78,navigator.mediaDevices.getUserMedia(l);case 78:f=e.sent,e.next=84;break;case 81:throw e.prev=81,e.t16=e.catch(75),h&&h(),e.t16;case 84:return e.abrupt("return",(l.audio&&(TV=!0),l.video&&(kV=!0),LV(o,f),h&&h(),o));case 85:case"end":return e.stop()}}),e,null,[[75,81]])}))),xV.apply(this,arguments)}function PV(e,t){switch(e){case"Starting video failed":case"OverconstrainedError":case"TrackStartError":return new SD(mD.MEDIA_OPTION_INVALID,"".concat(e,": ").concat(t));case"NotFoundError":case"DevicesNotFoundError":return new SD(mD.DEVICE_NOT_FOUND,"".concat(e,": ").concat(t));case"NotSupportedError":return new SD(mD.NOT_SUPPORTED,"".concat(e,": ").concat(t));case"NotReadableError":return new SD(mD.NOT_READABLE,"".concat(e,": ").concat(t));case"InvalidStateError":case"NotAllowedError":case"PERMISSION_DENIED":case"PermissionDeniedError":return new SD(mD.PERMISSION_DENIED,"".concat(e,": ").concat(t));case"ConstraintNotSatisfiedError":return new SD(mD.CONSTRAINT_NOT_SATISFIED,"".concat(e,": ").concat(t));default:return ND.error("getUserMedia unexpected error",e),ZD("error",[],"handleGetUserMediaError",void 0,e),new SD(mD.UNEXPECTED_ERROR,"".concat(e,": ").concat(t))}}function LV(e,t){var r=e.getVideoTracks()[0],n=e.getAudioTracks()[0],i=t.getVideoTracks()[0],o=t.getAudioTracks()[0];o&&(n&&e.removeTrack(n),e.addTrack(o)),i&&(r&&e.removeTrack(r),e.addTrack(i))}var BV,MV,UV,QV,FV,jV,VV,GV,KV,HV,WV,YV,qV,JV,zV,XV,ZV,$V,eG,tG,rG,nG,iG,oG,aG,sG,cG,uG,dG,lG=new(function(e){k(r,e);var t=W(r);function r(){var e;return U(this,r),e=t.call(this),rO(S(e),"_state",Fx.IDLE),rO(S(e),"isAccessMicrophonePermission",!1),rO(S(e),"isAccessCameraPermission",!1),rO(S(e),"lastAccessMicrophonePermission",!1),rO(S(e),"lastAccessCameraPermission",!1),rO(S(e),"checkdeviceMatched",!1),rO(S(e),"deviceInfoMap",new Map),e.init().then((function(){navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",e.updateDevicesInfo.bind(S(e))),window.setInterval((function(){(gN("ENUMERATE_DEVICES_INTERVAL")||qk()&&Yk())&&e.updateDevicesInfo()}),gN("ENUMERATE_DEVICES_INTERVAL_TIME"))})).catch((function(e){return ND.error(e.toString())})),e}return F(r,[{key:"state",get:function(){return this._state},set:function(e){e!==this._state&&(this.emit(jx.STATE_CHANGE,e),this._state=e)}},{key:"enumerateDevices",value:function(){var e=y(G.mark((function e(t,r){var n,i,o,a,s,c,u,d,l,p,f,h,A=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=A.length>2&&void 0!==A[2]&&A[2],navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices){e.next=3;break}return e.abrupt("return",new SD(mD.NOT_SUPPORTED,"enumerateDevices() not supported.").throw());case 3:return e.next=5,navigator.mediaDevices.enumerateDevices();case 5:if(i=e.sent,o=this.checkMediaDeviceInfoIsOk(i),a=!this.isAccessMicrophonePermission&&t,s=!this.isAccessCameraPermission&&r,o.audio&&(a=!1),o.video&&(s=!1),c=null,u=null,d=null,n||!a&&!s){e.next=65;break}if(!RV.isLocked){e.next=18;break}return ND.debug("[device manager] wait GUM lock"),e.next=15,RV.lock();case 15:e.t0=e.sent,(0,e.t0)(),ND.debug("[device manager] GUM unlock");case 18:if(TV&&(a=!1,this.isAccessMicrophonePermission=!0),kV&&(s=!1,this.isAccessCameraPermission=!0),ND.debug("[device manager] check media device permissions",t,r,a,s),!a||!s){e.next=34;break}return e.prev=19,e.next=22,navigator.mediaDevices.getUserMedia({audio:!0,video:!0});case 22:d=e.sent,e.next=31;break;case 25:if(e.prev=25,e.t1=e.catch(19),(l=PV(e.t1.name||e.t1.code||e.t1,e.t1.message)).code!==mD.PERMISSION_DENIED){e.next=30;break}throw l;case 30:ND.warning("getUserMedia failed in getDevices",l);case 31:this.isAccessCameraPermission=!0,this.isAccessMicrophonePermission=!0,e.next=64;break;case 34:if(!a){e.next=50;break}return e.prev=35,e.next=38,navigator.mediaDevices.getUserMedia({audio:t});case 38:c=e.sent,e.next=47;break;case 41:if(e.prev=41,e.t2=e.catch(35),(p=PV(e.t2.name||e.t2.code||e.t2,e.t2.message)).code!==mD.PERMISSION_DENIED){e.next=46;break}throw p;case 46:ND.warning("getUserMedia failed in getDevices",p);case 47:this.isAccessMicrophonePermission=!0,e.next=64;break;case 50:if(!s){e.next=64;break}return e.prev=51,e.next=54,navigator.mediaDevices.getUserMedia({video:r});case 54:u=e.sent,e.next=63;break;case 57:if(e.prev=57,e.t3=e.catch(51),(f=PV(e.t3.name||e.t3.code||e.t3,e.t3.message)).code!==mD.PERMISSION_DENIED){e.next=62;break}throw f;case 62:ND.warning("getUserMedia failed in getDevices",f);case 63:this.isAccessCameraPermission=!0;case 64:ND.debug("[device manager] mic permission",t,"cam permission",r);case 65:return e.prev=65,e.next=68,navigator.mediaDevices.enumerateDevices();case 68:return h=e.sent,e.abrupt("return",(c&&c.getTracks().forEach((function(e){return e.stop()})),u&&u.getTracks().forEach((function(e){return e.stop()})),d&&d.getTracks().forEach((function(e){return e.stop()})),c=null,u=null,d=null,h));case 72:return e.prev=72,e.t4=e.catch(65),c&&c.getTracks().forEach((function(e){return e.stop()})),u&&u.getTracks().forEach((function(e){return e.stop()})),d&&d.getTracks().forEach((function(e){return e.stop()})),c=null,u=null,d=null,e.abrupt("return",new SD(mD.ENUMERATE_DEVICES_FAILED,e.t4.toString()).throw());case 76:case"end":return e.stop()}}),e,this,[[19,25],[35,41],[51,57],[65,72]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"getRecordingDevices",value:function(){var e=y(G.mark((function e(){var t,r=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]&&r[0],e.next=3,this.enumerateDevices(!0,!1,t);case 3:return e.abrupt("return",e.sent.filter((function(e){return"audioinput"===e.kind})));case 4:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"getCamerasDevices",value:function(){var e=y(G.mark((function e(){var t,r=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]&&r[0],e.next=3,this.enumerateDevices(!1,!0,t);case 3:return e.abrupt("return",e.sent.filter((function(e){return"videoinput"===e.kind})));case 4:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"getSpeakers",value:function(){var e=y(G.mark((function e(){var t,r=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]&&r[0],e.next=3,this.enumerateDevices(!0,!1,t);case 3:return e.abrupt("return",e.sent.filter((function(e){return"audiooutput"===e.kind})));case 4:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"searchDeviceIdByName",value:function(e){var t=null;return this.deviceInfoMap.forEach((function(r){r.device.label===e&&(t=r.device.deviceId)})),t}},{key:"getDeviceById",value:function(){var e=y(G.mark((function e(t){var r;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.enumerateDevices(!0,!0,!0);case 2:if(r=e.sent.find((function(e){return e.deviceId===t}))){e.next=5;break}throw new SD(mD.DEVICE_NOT_FOUND,"deviceId: ".concat(t));case 5:return e.abrupt("return",r);case 6:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"init",value:function(){var e=y(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.state=Fx.INITING,e.prev=1,e.next=4,this.updateDevicesInfo();case 4:this.state=Fx.INITEND,e.next=11;break;case 7:throw e.prev=7,e.t0=e.catch(1),ND.warning("Device Detection functionality cannot start properly.",e.t0.toString()),this.state=Fx.IDLE,("boolean"==typeof isSecureContext?isSecureContext:"https:"===location.protocol||"file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname||"::1"===location.hostname)||new SD(mD.WEB_SECURITY_RESTRICT,"Your context is limited by web security, please try using https protocol or localhost.").throw(),e.t0;case 11:case"end":return e.stop()}}),e,this,[[1,7]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"updateDevicesInfo",value:function(){var e=y(G.mark((function e(){var t,r,n,i,o,a,s=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.enumerateDevices(!0,!0,!0);case 2:if(t=e.sent,r=Date.now(),n=[],t[0]&&t[0].label&&!1===this.checkdeviceMatched&&(this.checkdeviceMatched=!0,i=t.find((function(e){return"audioinput"===e.kind&&"default"===e.deviceId})),o=t.find((function(e){return"audiooutput"===e.kind&&"default"===e.deviceId})),i&&o?o.groupId===i.groupId?ND.debug("[device-check] default input ".concat(i.label," and output ").concat(o.label," is the same group")):ND.warning("[device-check] default input ".concat(i.label," and output ").concat(o.label," is not the same group")):ND.debug("[device-check] default input or output not found")),a=this.checkMediaDeviceInfoIsOk(t),t.forEach((function(e){if(e.deviceId){var t=s.deviceInfoMap.get("".concat(e.kind,"_").concat(e.deviceId));if("ACTIVE"!==(t?t.state:"INACTIVE")){var i={initAt:r,updateAt:r,device:e,state:"ACTIVE"};s.deviceInfoMap.set("".concat(e.kind,"_").concat(e.deviceId),i),n.push(i)}t&&(t.updateAt=r)}})),this.deviceInfoMap.forEach((function(e,t){"ACTIVE"===e.state&&e.updateAt!==r&&(e.state="INACTIVE",n.push(e))})),this.state===Fx.INITEND){e.next=9;break}return e.abrupt("return",(a.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),void(a.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0))));case 9:n.forEach((function(e){switch(e.device.kind){case"audioinput":s.lastAccessMicrophonePermission&&s.isAccessMicrophonePermission&&s.emit(jx.RECORDING_DEVICE_CHANGED,e);break;case"videoinput":s.lastAccessCameraPermission&&s.isAccessCameraPermission&&s.emit(jx.CAMERA_DEVICE_CHANGED,e);break;case"audiooutput":s.lastAccessMicrophonePermission&&s.isAccessMicrophonePermission&&s.emit(jx.PLAYOUT_DEVICE_CHANGED,e)}})),a.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),a.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0);case 10:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"checkMediaDeviceInfoIsOk",value:function(e){var t,r=e.filter((function(e){return"audioinput"===e.kind})),n=e.filter((function(e){return"videoinput"===e.kind})),i={audio:!1,video:!1},o=K(r);try{for(o.s();!(t=o.n()).done;){var a=t.value;if(a.label&&a.deviceId){i.audio=!0;break}}}catch(e){o.e(e)}finally{o.f()}var s,c=K(n);try{for(c.s();!(s=c.n()).done;){var u=s.value;if(u.label&&u.deviceId){i.video=!0;break}}}catch(e){c.e(e)}finally{c.f()}return i}}]),r}(yD)),pG=tN("AudioElementPlayCenter")(BV=function(){function e(){var t=this;U(this,e),rO(this,"onAutoplayFailed",void 0),rO(this,"elementMap",new Map),rO(this,"elementStateMap",new Map),rO(this,"elementsNeedToResume",[]),rO(this,"sinkIdMap",new Map),rO(this,"autoResumeAfterInterruption",(function(){Array.from(t.elementMap.entries()).forEach((function(e){var r=E(e,2),n=r[0],i=r[1],o=t.elementStateMap.get(n),a=i.srcObject.getAudioTracks()[0];Fk()?a&&"live"===a.readyState&&"running"===uV.curState&&(ND.debug("auto resume after interruption for iOS 15"),qD("debug",["AudioElementPlayCenter",n],"auto resume after interruption for iOS15"),i.pause(),i.play()):o&&"paused"===o&&a&&"live"===a.readyState&&"running"===uV.curState&&(ND.debug("auto resume after interruption for iOS"),qD("debug",["AudioElementPlayCenter",n],"auto resume after interruption for iOS"),i.play())}))})),rO(this,"autoResumeAfterInterruptionOnIOS15",(function(){Array.from(t.elementMap.entries()).forEach((function(e){var t=E(e,2),r=t[0],n=t[1],i=n.srcObject.getAudioTracks()[0];i&&"live"===i.readyState&&(ND.debug("auto resume after interruption inside autoResumeAfterInterruptionOnIOS15"),ZD("debug",["AudioElementPlayCenter",r],"autoResumeAfterInterruptionOnIOS15"),n.pause(),n.play())}))})),this.autoResumeAudioElement(),uV.on(Xj.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),uV.on(Xj.IOS_15_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15),uV.on(Xj.STATE_CHANGE,(function(){Qk()&&"suspended"===uV.prevState&&"running"===uV.curState&&t.autoResumeAfterInterruption()}))}return F(e,[{key:"setSinkID",value:function(){var e=y(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.elementMap.get(t),this.sinkIdMap.set(t,r),!n){e.next=10;break}return e.prev=2,e.next=5,n.setSinkId(r);case 5:e.next=10;break;case 7:throw e.prev=7,e.t0=e.catch(2),new SD(mD.PERMISSION_DENIED,"can not set sink id: "+e.t0.toString());case 10:case"end":return e.stop()}}),e,this,[[2,7]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"play",value:function(e,t,r,n){var i=this;if(!this.elementMap.has(t)){var o=document.createElement("audio");o.autoplay=!0,o.srcObject=new MediaStream([e]),this.bindAudioElementEvents(t,o),this.elementMap.set(t,o),this.elementStateMap.set(t,vx.INIT),this.setVolume(t,r);var a=this.sinkIdMap.get(t);if(a)try{o.setSinkId(a).catch((function(e){ND.warning("[".concat(t,"] set sink id failed"),e.toString()),$D("warning",["HTMLAudioElement",t],"setSinkId",e.toString())}))}catch(e){ND.warning("[".concat(t,"] set sink id failed"),e.toString())}var s=o.play();s&&s.then&&s.catch((function(e){n&&zj.autoplayFailed(n,"audio",e.message,t),ND.warning("audio element play warning",e.toString()),$D("warning",["HTMLAudioElement",t],"play",e.toString()),i.elementMap.has(t)&&"NotAllowedError"===e.name&&(ND.warning("detected audio element autoplay failed"),ZD("warning",["AudioElementPlayCenter",t],"play",e.toString()),i.elementsNeedToResume.push(o),cK((function(){i.onAutoplayFailed&&i.onAutoplayFailed(),Hj()})))}))}}},{key:"updateTrack",value:function(e,t){var r=this.elementMap.get(e);r&&(r.srcObject=new MediaStream([t]))}},{key:"isPlaying",value:function(e){return this.elementMap.has(e)}},{key:"setVolume",value:function(e,t){var r=this.elementMap.get(e);r&&(t=Math.max(0,Math.min(100,t)),r.volume=t/100)}},{key:"stop",value:function(e){var t=this.elementMap.get(e);if(this.sinkIdMap.delete(e),t){var r=this.elementsNeedToResume.indexOf(t);this.elementsNeedToResume.splice(r,1),t.srcObject=null,t.remove(),this.elementMap.delete(e),this.elementStateMap.delete(e)}}},{key:"bindAudioElementEvents",value:function(e,t){var r=this;fG.forEach((function(n){t.addEventListener(n,(function(t){var n=r.elementStateMap.get(e),i="pause"===t.type?"paused":t.type;ND.debug("[".concat(e,"] audio-element-status change ").concat(n," => ").concat(i)),XD("debug",["HTMLAudioElement",e],"statusChange","".concat(n," => ").concat(i)),r.elementStateMap.set(e,i)}))}))}},{key:"getPlayerState",value:function(e){return this.elementStateMap.get(e)||"uninit"}},{key:"autoResumeAudioElement",value:function(){var e=this,t=function(){e.elementsNeedToResume.forEach((function(e){e.play().then((function(e){ND.debug("Auto resume audio element success"),ZD("debug",["AudioElementPlayCenter"],"autoResumeAudioElement")})).catch((function(e){ND.warning("Auto resume audio element failed!",e),ZD("warning",["AudioElementPlayCenter"],"autoResumeAudioElement",e.toString())}))})),e.elementsNeedToResume=[]};new Rb((function(e){document.body?e():window.addEventListener("load",(function(){return e()}))})).then((function(){var e=Tk();"Android"!==e.os||"Chrome"!==e.name&&e.name!==Sk.WECHAT?(document.body.addEventListener("touchstart",t,!0),document.body.addEventListener("mousedown",t,!0)):document.body.addEventListener("click",t,!0)}))}}]),e}())||BV,fG=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended"],hG=new pG;function AG(){return function(e,t,r){var n=e[t];"function"==typeof n&&(r.value=function(){this._isClosed&&new SD(mD.INVALID_OPERATION,"[".concat(this.getTrackId(),"] cannot operate a closed track")).print("warning");for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var i=n.apply(this,t);return i instanceof Rb?new Rb((function(e,t){i.then(e).catch(t)})):i})}}function vG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function gG(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vG(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vG(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var mG=(MV=tN("LocalAudioTrack","getTrackId"),UV=AG(),QV=nV("LocalAudioTrack","_enabledMutex"),FV=AG(),jV=nV("LocalAudioTrack","_enabledMutex"),VV=AG(),GV=Jj({report:zj}),KV=AG(),HV=AG(),WV=AG(),YV=AG(),MV((Ej((JV=function(e){k(r,e);var t=W(r);function r(e,n,i){var o;return U(this,r),o=t.call(this,e,i),rO(S(o),"trackMediaType","audio"),rO(S(o),"_encoderConfig",void 0),rO(S(o),"_source",void 0),rO(S(o),"_enabled",!0),rO(S(o),"_volume",100),rO(S(o),"_useAudioElement",!1),rO(S(o),"_bypassWebAudio",!1),rO(S(o),"processor",void 0),rO(S(o),"processorContext",void 0),rO(S(o),"processorDestination",void 0),o._encoderConfig=n,o._source=new mV(e),gN("LOCAL_AUDIO_TRACK_USES_WEB_AUDIO")||(o._useAudioElement=!0),o.processorContext=new SG(o._source.context,o.getTrackId()),o.processorDestination=new IG(o.processorContext),o.bindProcessorDestinationEvents(),o._source.on(nP.UPDATE_SOURCE,(function(){o.processor&&o.processor.updateInput({node:o._source.processSourceNode,context:o.processorContext})})),o}return F(r,[{key:"isPlaying",get:function(){return this._useAudioElement?hG.isPlaying(this.getTrackId()):this._source.isPlayed}},{key:"setVolume",value:function(e){var t=this;bx(e,"volume",0,1e3);var r=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.LOCAL_AUDIO_TRACK_SET_VOLUME,options:[this.getTrackId(),e]},300);this._volume=e,this._source.setVolume(e/100),this._useAudioElement&&hG.setVolume(this.getTrackId(),e);try{if(this._bypassWebAudio)return ND.debug("[".concat(this.getTrackId(),"] setVolume returned because no pass through WebAudio.")),void r.onSuccess();var n=this._source.createOutputTrack();this._mediaStreamTrack!==n&&(this._mediaStreamTrack=n,nK(this,NP.NEED_REPLACE_TRACK,this).then((function(){ND.debug("[".concat(t.getTrackId(),"] replace web audio track success")),qD("debug",t,"replace web audio track success")})).catch((function(e){ND.warning("[".concat(t.getTrackId(),"] replace web audio track failed"),e),qD("warning",t,"replace web audio track failed ".concat(e.toString()))})))}catch(e){}r.onSuccess()}},{key:"getVolumeLevel",value:function(){return this._source.getAccurateVolumeLevel()}},{key:"setPlaybackDevice",value:function(){var e=y(G.mark((function e(t){var r;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.REMOTE_AUDIO_SET_OUTPUT_DEVICE,options:[this.getTrackId(),t]}),this._useAudioElement){e.next=3;break}throw new SD(mD.NOT_SUPPORTED,"your browser does not support setting the audio output device");case 3:return e.prev=3,e.next=6,hG.setSinkID(this.getTrackId(),t);case 6:e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(3),r.onError(e.t0),e.t0;case 11:r.onSuccess();case 12:case"end":return e.stop()}}),e,this,[[3,8]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"setEnabled",value:function(){var e=y(G.mark((function e(t,r,n){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n){e.next=4;break}if(t!==this._enabled){e.next=3;break}return e.abrupt("return");case 3:this.stateCheck("enabled",t);case 4:if(ND.info("[".concat(this.getTrackId(),"] start setEnabled"),t),ZD("info",this,"setEnabled",t),!t){e.next=19;break}return this._originMediaStreamTrack.enabled=!0,e.prev=6,n||(this._enabled=!0),e.next=10,nK(this,NP.NEED_ENABLE_TRACK,this);case 10:ND.info("[".concat(this.getTrackId(),"] setEnabled to ").concat(t," success")),ZD("info",this,"setEnabled",t,"success"),e.next=17;break;case 14:throw e.prev=14,e.t0=e.catch(6),n||(this._enabled=!1),ND.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.t0.toString()),ZD("error",this,"setEnabled",t,e.t0.toString()),e.t0;case 17:e.next=28;break;case 19:return this._originMediaStreamTrack.enabled=!1,n||(this._enabled=!1),e.prev=20,e.next=23,nK(this,NP.NEED_DISABLE_TRACK,this);case 23:e.next=28;break;case 25:throw e.prev=25,e.t1=e.catch(20),n||(this._enabled=!0),ND.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.t1.toString()),ZD("info",this,"setEnabled",t,e.t1.toString()),e.t1;case 28:case"end":return e.stop()}}),e,this,[[6,14],[20,25]])})));function t(t,r,n){return e.apply(this,arguments)}return t}()},{key:"setMuted",value:function(){var e=y(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=t!==this._muted,!e.t0){e.next=14;break}if(this.stateCheck("muted",t),this._muted=t,this._mediaStreamTrack.enabled=!t,ND.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(t)),ZD("debug",this,"setMuted",t),!t){e.next=12;break}return e.next=10,nK(this,NP.NEED_MUTE_TRACK,this);case 10:e.next=14;break;case 12:return e.next=14,nK(this,NP.NEED_UNMUTE_TRACK,this);case 14:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"getStats",value:function(){var e=this;return lK((function(){ND.warning("[deprecated] LocalAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalAudioStats instead"),qD("warning",e,"LocalAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalAudioStats instead")}),"localAudioTrackGetStatsWarning"),iK(this,NP.GET_STATS)||gG({},fP)}},{key:"setAudioFrameCallback",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners(nP.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(nP.ON_AUDIO_BUFFER),this._source.on(nP.ON_AUDIO_BUFFER,(function(t){return e(t)}))}},{key:"play",value:function(){var e=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.LOCAL_AUDIO_TRACK_PLAY,options:[this.getTrackId()]});ND.debug("[".concat(this.getTrackId(),"] start audio playback")),ZD("debug",this,"play"),this._useAudioElement?(ND.debug("[".concat(this.getTrackId(),"] start audio playback in element")),qD("debug",this,"start audio playback in element"),hG.play(this._mediaStreamTrack,this.getTrackId(),this._volume)):this._source.play(),e.onSuccess()}},{key:"stop",value:function(){var e=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.LOCAL_AUDIO_TRACK_STOP,options:[this.getTrackId()]});ND.debug("[".concat(this.getTrackId(),"] stop audio playback")),ZD("debug",this,"stop"),this._useAudioElement?hG.stop(this.getTrackId()):this._source.stop(),e.onSuccess()}},{key:"close",value:function(){f(d(r.prototype),"close",this).call(this),this.unbindProcessorDestinationEvents(),this.unbindProcessorContextEvents(),this.unpipe(),this.processorDestination._source&&this.processorDestination._source.unpipe(),this._source.destroy()}},{key:"_updatePlayerSource",value:function(){ND.debug("[".concat(this.getTrackId(),"] update player source track")),ZD("debug",this,"_updatePlayerSource"),this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&hG.updateTrack(this.getTrackId(),this._mediaStreamTrack)}},{key:"_updateOriginMediaStreamTrack",value:function(){var e=y(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this._originMediaStreamTrack!==t,!e.t0){e.next=15;break}if(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),t.addEventListener("ended",this._handleTrackEnded),r&&this._originMediaStreamTrack.stop(),this._originMediaStreamTrack=t,this.processor&&this.processor.updateInput({track:t,context:this.processorContext}),this._mediaStreamTrack===this._source.outputTrack){e.next=14;break}return this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),e.next=12,nK(this,NP.NEED_REPLACE_TRACK,this);case 12:e.next=15;break;case 14:this._source.updateTrack(this._originMediaStreamTrack);case 15:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"renewMediaStreamTrack",value:function(e){return Rb.resolve(void 0)}},{key:"pipe",value:function(e){if(this._bypassWebAudio)throw new SD(mD.INVALID_OPERATION,"Can not process AudioTrack when bypassWebAudio set to true.");if(this.processor===e)return e;if(e._source)throw new SD(mD.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,node:this._source.processSourceNode,context:this.processorContext}),e}},{key:"unpipe",value:function(){var e;if(this.processor){var t=this.processor;null===(e=this._source.processSourceNode)||void 0===e||e.disconnect(),this.processor._source=!1,this.processor=void 0,t.reset()}}},{key:"bindProcessorDestinationEvents",value:function(){var e=this;this.processorDestination.on(tL.ON_TRACK,function(){var t=y(G.mark((function t(r){return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!r){t.next=9;break}if(t.t0=r!==e._mediaStreamTrack,!t.t0){t.next=7;break}return e._mediaStreamTrack=r,e._updatePlayerSource(),t.next=7,nK(e,NP.NEED_REPLACE_TRACK,e);case 7:t.next=15;break;case 9:if(t.t1=e._mediaStreamTrack!==e._originMediaStreamTrack,!t.t1){t.next=15;break}return e._mediaStreamTrack=e._originMediaStreamTrack,e._updatePlayerSource(),t.next=15,nK(e,NP.NEED_REPLACE_TRACK,e);case 15:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),this.processorDestination.on(tL.ON_NODE,(function(t){e._source.processedNode=t}))}},{key:"unbindProcessorDestinationEvents",value:function(){this.processorDestination.removeAllListeners(tL.ON_TRACK),this.processorDestination.removeAllListeners(tL.ON_NODE)}},{key:"unbindProcessorContextEvents",value:function(){this.processorContext.removeAllListeners(rL.REQUEST_UPDATE_CONSTRAINTS),this.processorContext.removeAllListeners(rL.REQUEST_CONSTRAINTS)}}]),r}(iV)).prototype,"setPlaybackDevice",[UV],Object.getOwnPropertyDescriptor(JV.prototype,"setPlaybackDevice"),JV.prototype),Ej(JV.prototype,"setEnabled",[QV,FV],Object.getOwnPropertyDescriptor(JV.prototype,"setEnabled"),JV.prototype),Ej(JV.prototype,"setMuted",[jV,VV,GV],Object.getOwnPropertyDescriptor(JV.prototype,"setMuted"),JV.prototype),Ej(JV.prototype,"getStats",[KV],Object.getOwnPropertyDescriptor(JV.prototype,"getStats"),JV.prototype),Ej(JV.prototype,"setAudioFrameCallback",[HV],Object.getOwnPropertyDescriptor(JV.prototype,"setAudioFrameCallback"),JV.prototype),Ej(JV.prototype,"play",[WV],Object.getOwnPropertyDescriptor(JV.prototype,"play"),JV.prototype),Ej(JV.prototype,"stop",[YV],Object.getOwnPropertyDescriptor(JV.prototype,"stop"),JV.prototype),qV=JV))||qV),EG=(zV=tN("MicrophoneAudioTrack","getTrackId"),XV=AG(),ZV=nV("MicrophoneAudioTrack","_enabledMutex"),$V=AG(),zV((Ej((tG=function(e){k(r,e);var t=W(r);function r(e,n,i,o){var a;return U(this,r),a=t.call(this,e,n.encoderConfig?AN(n.encoderConfig):{},o),rO(S(a),"_config",void 0),rO(S(a),"_deviceName","default"),rO(S(a),"_constraints",void 0),rO(S(a),"_originalConstraints",void 0),rO(S(a),"_enabled",!0),eN("info",S(a),"constructor",{trackId:o,deviceId:e.label,constraints:i}),a._config=n,a._constraints=i,a._originalConstraints=i,a._deviceName=e.label,"boolean"==typeof n.bypassWebAudio&&(a._bypassWebAudio=n.bypassWebAudio),Fk()&&uV.bindInterruptDetectorTrack(S(a)),a.bindProcessorContextEvents(),a}return F(r,[{key:"setDevice",value:function(){var e=y(G.mark((function e(t){var r,n,i,o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.MIC_AUDIO_TRACK_SET_DEVICE,options:[this.getTrackId(),t]}),ND.info("[".concat(this.getTrackId(),"] start set device to ").concat(t)),ZD("info",this,"setDevice",t),!this._enabled){e.next=37;break}return e.prev=2,e.next=5,lG.getDeviceById(t);case 5:return n=e.sent,(i={}).audio=gG({},this._constraints),i.audio.deviceId={exact:t},this._originMediaStreamTrack.stop(),o=null,e.prev=9,e.next=12,OV(i,this.getTrackId());case 12:o=e.sent,e.next=25;break;case 15:return e.prev=15,e.t0=e.catch(9),ND.error("[".concat(this.getTrackId(),"] setDevice failed"),e.t0.toString()),ZD("error",this,"setDevice",t,e.t0.toString()),e.next=21,OV({video:this._constraints},this.getTrackId());case 21:return o=e.sent,e.next=24,this._updateOriginMediaStreamTrack(o.getAudioTracks()[0],!1);case 24:throw e.t0;case 25:return e.next=27,this._updateOriginMediaStreamTrack(o.getAudioTracks()[0],!1);case 27:this._deviceName=n.label,this._config.microphoneId=t,this._constraints.deviceId={exact:t},e.next=35;break;case 32:throw e.prev=32,e.t1=e.catch(2),r.onError(e.t1),ND.error("[".concat(this.getTrackId(),"] setDevice error"),e.t1.toString()),ZD("error",this,"setDevice",t,e.t1.toString()),e.t1;case 35:e.next=47;break;case 37:return e.prev=37,e.next=40,lG.getDeviceById(t);case 40:a=e.sent,this._deviceName=a.label,this._config.microphoneId=t,this._constraints.deviceId={exact:t},e.next=47;break;case 44:throw e.prev=44,e.t2=e.catch(37),r.onError(e.t2),ND.error("[".concat(this.getTrackId(),"] setDevice error"),e.t2.toString()),ZD("error",this,"setDevice",t,e.t2.toString()),e.t2;case 47:r.onSuccess(),ND.info("[".concat(this.getTrackId(),"] set device to ").concat(t," success")),ZD("info",this,"setDevice",t,"success");case 48:case"end":return e.stop()}}),e,this,[[2,32],[9,15],[37,44]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"setEnabled",value:function(){var e=y(G.mark((function e(t,n,i){var o,a,s;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n){e.next=6;break}return ND.debug("[".concat(this.getTrackId,"] setEnabled false (do not close microphone)")),qD("debug",this,"setEnabled false (do not close microphone)"),e.next=5,f(d(r.prototype),"setEnabled",this).call(this,t);case 5:return e.abrupt("return",e.sent);case 6:if(i){e.next=10;break}if(t!==this._enabled){e.next=9;break}return e.abrupt("return");case 9:this.stateCheck("enabled",t);case 10:if(ND.info("[".concat(this.getTrackId(),"] start setEnabled"),t),ZD("info",this,"setEnabled",t),t){e.next=21;break}return this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop(),i||(this._enabled=!1),e.prev=12,e.next=15,nK(this,NP.NEED_DISABLE_TRACK,this);case 15:e.next=20;break;case 17:throw e.prev=17,e.t0=e.catch(12),ND.error("[".concat(this.getTrackId(),"] setEnabled false failed"),e.t0.toString()),ZD("error",this,"setEnabled",t,e.t0.toString()),e.t0;case 20:return e.abrupt("return");case 21:return o=gG({},this._constraints),(a=lG.searchDeviceIdByName(this._deviceName))&&!o.deviceId&&(o.deviceId=a),e.prev=23,i||(this._enabled=!0),e.next=27,OV({audio:this._constraints},this.getTrackId());case 27:return s=e.sent,e.next=30,this._updateOriginMediaStreamTrack(s.getAudioTracks()[0],!1);case 30:return e.next=32,nK(this,NP.NEED_ENABLE_TRACK,this);case 32:e.next=37;break;case 34:throw e.prev=34,e.t1=e.catch(23),i||(this._enabled=!1),ND.error("[".concat(this.getTrackId(),"] setEnabled true failed"),e.t1.toString()),ZD("error",this,"setEnabled",t,e.t1.toString()),e.t1;case 37:ND.info("[".concat(this.getTrackId(),"] setEnabled success")),ZD("info",this,"setEnabled",t,"success");case 38:case"end":return e.stop()}}),e,this,[[12,17],[23,34]])})));function t(t,r,n){return e.apply(this,arguments)}return t}()},{key:"close",value:function(){f(d(r.prototype),"close",this).call(this),Fk()&&uV.unbindInterruptDetectorTrack(this)}},{key:"onTrackEnded",value:function(){var e=this;if((Qk()||Kk())&&this._enabled&&!this._isClosed&&uV.duringInterruption){var t=function(){var r=y(G.mark((function r(){return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(uV.off(Xj.IOS_INTERRUPTION_END,t),r.t0=e._enabled&&!e._isClosed,!r.t0){r.next=9;break}return ND.debug("[".concat(e.getTrackId(),"] try capture microphone media device for interrupted iOS device.")),qD("debug",e,"try capture microphone media device for interrupted iOS device"),r.next=7,e.setEnabled(!1);case 7:return r.next=9,e.setEnabled(!0);case 9:case"end":return r.stop()}}),r)})));return function(){return r.apply(this,arguments)}}();uV.on(Xj.IOS_INTERRUPTION_END,t)}else ND.debug("[".concat(this.getTrackId(),"] track ended")),XD("debug",["MediaStreamTrack",this.getTrackId()],"ended"),this.emit(BP.TRACK_ENDED)}},{key:"renewMediaStreamTrack",value:function(){var e=y(G.mark((function e(t){var r,n,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t||this._constraints,(n=lG.searchDeviceIdByName(this._deviceName))&&!r.deviceId&&(r.deviceId=n),this._constraints=r,this._originMediaStreamTrack.stop(),e.next=4,OV({audio:this._constraints},this.getTrackId());case 4:return i=e.sent,e.next=7,this._updateOriginMediaStreamTrack(i.getAudioTracks()[0],!0);case 7:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"bindProcessorContextEvents",value:function(){var e=this;this.processorContext.on(rL.REQUEST_UPDATE_CONSTRAINTS,function(){var t=y(G.mark((function t(r,n,i){var o;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,o=Object.assign.apply(Object,[{},e._originalConstraints].concat(M(r))),t.next=4,e.renewMediaStreamTrack(o);case 4:n(),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),i(t.t0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,r,n){return t.apply(this,arguments)}}()),this.processorContext.on(rL.REQUEST_CONSTRAINTS,function(){var t=y(G.mark((function t(r){return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r(e._originMediaStreamTrack.getSettings());case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}}]),r}(mG)).prototype,"setDevice",[XV],Object.getOwnPropertyDescriptor(tG.prototype,"setDevice"),tG.prototype),Ej(tG.prototype,"setEnabled",[ZV,$V],Object.getOwnPropertyDescriptor(tG.prototype,"setEnabled"),tG.prototype),eG=tG))||eG),_G=(rG=tN("BufferSourceAudioTrack","getTrackId"),nG=AG(),iG=AG(),oG=AG(),aG=AG(),sG=AG(),rG((Ej((uG=function(e){k(r,e);var t=W(r);function r(e,n,i,o){var a;U(this,r),a=t.call(this,n.createOutputTrack(),i,o),rO(S(a),"source",void 0),rO(S(a),"_bufferSource",void 0),eN("info",S(a),"constructor",{trackId:o}),a.source=e,a._bufferSource=n,a._bufferSource.on(nP.AUDIO_SOURCE_STATE_CHANGE,(function(e){a.emit(BP.SOURCE_STATE_CHANGE,e)}));try{a._mediaStreamTrack=a._source.createOutputTrack()}catch(e){}return a}return F(r,[{key:"currentState",get:function(){return this._bufferSource.currentState}},{key:"duration",get:function(){return this._bufferSource.duration}},{key:"getCurrentTime",value:function(){return this._bufferSource.currentTime}},{key:"startProcessAudioBuffer",value:function(e){var t=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.BUFFER_AUDIO_TRACK_START,options:[this.getTrackId(),e,this.duration]});e&&this._bufferSource.updateOptions(e),this._bufferSource.startProcessAudioBuffer(),t.onSuccess()}},{key:"pauseProcessAudioBuffer",value:function(){var e=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.BUFFER_AUDIO_TRACK_PAUSE,options:[this.getTrackId()]});this._bufferSource.pauseProcessAudioBuffer(),e.onSuccess()}},{key:"seekAudioBuffer",value:function(e){var t=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.BUFFER_AUDIO_TRACK_SEEK,options:[this.getTrackId()]});this._bufferSource.seekAudioBuffer(e),t.onSuccess()}},{key:"resumeProcessAudioBuffer",value:function(){var e=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.BUFFER_AUDIO_TRACK_RESUME,options:[this.getTrackId()]});this._bufferSource.resumeProcessAudioBuffer(),e.onSuccess()}},{key:"stopProcessAudioBuffer",value:function(){var e=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.BUFFER_AUDIO_TRACK_STOP,options:[this.getTrackId()]});this._bufferSource.stopProcessAudioBuffer(),e.onSuccess()}}]),r}(mG)).prototype,"startProcessAudioBuffer",[nG],Object.getOwnPropertyDescriptor(uG.prototype,"startProcessAudioBuffer"),uG.prototype),Ej(uG.prototype,"pauseProcessAudioBuffer",[iG],Object.getOwnPropertyDescriptor(uG.prototype,"pauseProcessAudioBuffer"),uG.prototype),Ej(uG.prototype,"seekAudioBuffer",[oG],Object.getOwnPropertyDescriptor(uG.prototype,"seekAudioBuffer"),uG.prototype),Ej(uG.prototype,"resumeProcessAudioBuffer",[aG],Object.getOwnPropertyDescriptor(uG.prototype,"resumeProcessAudioBuffer"),uG.prototype),Ej(uG.prototype,"stopProcessAudioBuffer",[sG],Object.getOwnPropertyDescriptor(uG.prototype,"stopProcessAudioBuffer"),uG.prototype),cG=uG))||cG),yG=tN("MixingAudioTrack","getTrackId")(dG=function(e){k(r,e);var t=W(r);function r(){var e;U(this,r);var n=lV().createMediaStreamDestination();e=t.call(this,n.stream.getAudioTracks()[0],void 0,XG(8,"track-mix-")),rO(S(e),"trackList",void 0),rO(S(e),"destNode",void 0);try{e._mediaStreamTrack=e._source.createOutputTrack()}catch(n){}return e.destNode=n,e.trackList=[],e}return F(r,[{key:"isActive",get:function(){var e,t=K(this.trackList);try{for(t.s();!(e=t.n()).done;){var r=e.value;if(r._enabled&&!r._isClosed&&!r.muted)return!0}}catch(e){t.e(e)}finally{t.f()}return!1}},{key:"hasAudioTrack",value:function(e){return-1!==this.trackList.indexOf(e)}},{key:"addAudioTrack",value:function(e){if(-1!==this.trackList.indexOf(e))return ND.debug("track ".concat(e.getTrackId()," is already added")),void qD("debug",this,"track already added");ND.debug("add ".concat(e.getTrackId()," to mixing track")),ZD("debug",this,"addAudioTrack",e.getTrackId()),e._source.outputNode.connect(this.destNode),this.trackList.push(e),this.updateEncoderConfig()}},{key:"removeAudioTrack",value:function(e){if(-1!==this.trackList.indexOf(e)){ND.debug("remove ".concat(e.getTrackId()," from mixing track")),ZD("debug",this,"removeAudioTrack",e.getTrackId());try{e._source.outputNode.disconnect(this.destNode)}catch(e){}aK(this.trackList,e),this.updateEncoderConfig()}}},{key:"updateEncoderConfig",value:function(){var e={};this.trackList.forEach((function(t){t._encoderConfig&&((t._encoderConfig.bitrate||0)>(e.bitrate||0)&&(e.bitrate=t._encoderConfig.bitrate),(t._encoderConfig.sampleRate||0)>(e.sampleRate||0)&&(e.sampleRate=t._encoderConfig.sampleRate),(t._encoderConfig.sampleSize||0)>(e.sampleSize||0)&&(e.sampleSize=t._encoderConfig.sampleSize),t._encoderConfig.stereo&&(e.stereo=!0))})),this._encoderConfig=e}}]),r}(mG))||dG,IG=function(e){k(r,e);var t=W(r);function r(e){var n;return U(this,r),n=t.call(this),rO(S(n),"name","AudioProcessorDestination"),rO(S(n),"ID","0"),rO(S(n),"inputTrack",void 0),rO(S(n),"inputNode",void 0),rO(S(n),"audioProcessorContext",void 0),rO(S(n),"_source",void 0),n.audioProcessorContext=e,n}return F(r,[{key:"kind",get:function(){return"audio"}},{key:"enabled",get:function(){return!0}},{key:"pipe",value:function(){throw new SD(mD.NOT_SUPPORTED,"AudioProcessorDestination cannot pipe to any other Processor")}},{key:"unpipe",value:function(){throw new SD(mD.NOT_SUPPORTED,"VideoProcessor cannot unpipe to any other Processor")}},{key:"enable",value:function(){}},{key:"disable",value:function(){}},{key:"reset",value:function(){this.inputTrack=void 0,this.inputNode=void 0,this.emit(tL.ON_TRACK,void 0),this.emit(tL.ON_NODE,void 0)}},{key:"updateInput",value:function(e){if(e.context!==this.audioProcessorContext)throw new Error("ProcessorContext passed to VideoTrack.processorDestination doesn't match it's belonging VideoTrack's context.\n Probably you are making pipeline like this: audioTrack1.pipe(processor).pipe(audioTrack2.processorDestination).");e.track&&this.inputTrack!==e.track&&(this.inputTrack=e.track,this.emit(tL.ON_TRACK,this.inputTrack)),e.node&&this.inputNode!==e.node&&(this.inputNode=e.node,this.emit(tL.ON_NODE,this.inputNode))}}]),r}(yD),SG=function(e){k(r,e);var t=W(r);function r(e,n){var i;return U(this,r),i=t.call(this),rO(S(i),"constraintsMap",new Map),rO(S(i),"statsRegistry",[]),rO(S(i),"audioContext",void 0),rO(S(i),"trackId",void 0),i.audioContext=e,i.trackId=n,i}return F(r,[{key:"getConstraints",value:function(){var e=y(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",rK(this,rL.REQUEST_CONSTRAINTS));case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"getAudioContext",value:function(){return this.audioContext}},{key:"requestApplyConstraints",value:function(){var e=y(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(ND.info("processor ".concat(r.name," requestApplyConstraints for ").concat(this.trackId)),t&&this.constraintsMap.set(r,t),nK(this,rL.REQUEST_UPDATE_CONSTRAINTS,Array.from(Rj(n=this.constraintsMap).call(n)))));case 1:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"requestRevertConstraints",value:function(){var e=y(G.mark((function e(t){var r;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.constraintsMap.has(t)){e.next=2;break}return e.abrupt("return",(this.constraintsMap.delete(t),nK(this,rL.REQUEST_UPDATE_CONSTRAINTS,Array.from(Rj(r=this.constraintsMap).call(r)))));case 2:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"registerStats",value:function(e,t,r){this.statsRegistry.find((function(r){return r.processorID===e.ID&&r.processorName===e.name&&r.type===t}))||this.statsRegistry.push({processorName:e.name,processorID:e.ID,type:t,cb:r})}},{key:"unregisterStats",value:function(e,t){}},{key:"gatherStats",value:function(){return this.statsRegistry.map((function(e){return{processorID:e.processorID,processorName:e.processorName,type:e.type,stats:(0,e.cb)()}}))}}]),r}(yD),bG=function(e){k(r,e);var t=W(r);function r(){var e;return U(this,r),e=t.apply(this,arguments),rO(S(e),"resultStorage",new Map),e}return F(r,[{key:"setLocalAudioStats",value:function(e,t,r){this.record("AUDIO_INPUT_LEVEL_TOO_LOW",e,this.checkAudioInputLevel(r,t)),this.record("SEND_AUDIO_BITRATE_TOO_LOW",e,this.checkSendAudioBitrate(r,t))}},{key:"setLocalVideoStats",value:function(e,t,r){this.record("SEND_VIDEO_BITRATE_TOO_LOW",e,this.checkSendVideoBitrate(r,t)),this.record("FRAMERATE_INPUT_TOO_LOW",e,this.checkFramerateInput(r,t)),this.record("FRAMERATE_SENT_TOO_LOW",e,this.checkFramerateSent(r))}},{key:"setRemoteAudioStats",value:function(e,t){var r=e.getUserId();this.record("AUDIO_OUTPUT_LEVEL_TOO_LOW",r,this.checkAudioOutputLevel(t))}},{key:"setRemoteVideoStats",value:function(e,t){var r=e.getUserId();this.record("RECV_VIDEO_DECODE_FAILED",r,this.checkVideoDecode(t))}},{key:"record",value:function(e,t,r){this.resultStorage.has(e)||this.resultStorage.set(e,{result:[],isPrevNormal:!0});var n=this.resultStorage.get(e);if(n&&(n.result.push(r),n.result.length>=5)){var i=n.result.includes(!0);n.isPrevNormal&&!i&&this.emit("exception",CG[e],e,t),!n.isPrevNormal&&i&&this.emit("exception",CG[e]+2e3,e+"_RECOVER",t),n.isPrevNormal=i,n.result=[]}}},{key:"checkAudioOutputLevel",value:function(e){return!(e.receiveBitrate>0&&0===e.receiveLevel)}},{key:"checkAudioInputLevel",value:function(e,t){return t instanceof yG&&!t.isActive||!!t.muted||0!==e.sendVolumeLevel}},{key:"checkFramerateInput",value:function(e,t){var r=null;t._encoderConfig&&t._encoderConfig.frameRate&&(r=MG(t._encoderConfig.frameRate));var n=e.captureFrameRate;return!r||!n||!(r>10&&n<5||r<10&&r>=5&&n<=1)}},{key:"checkFramerateSent",value:function(e){return!(e.captureFrameRate&&e.sendFrameRate&&e.captureFrameRate>5&&e.sendFrameRate<=1)}},{key:"checkSendVideoBitrate",value:function(e,t){return!!t.muted||0!==e.sendBitrate}},{key:"checkSendAudioBitrate",value:function(e,t){return t instanceof yG&&!t.isActive||!!t.muted||0!==e.sendBitrate}},{key:"checkVideoDecode",value:function(e){return 0===e.receiveBitrate||0!==e.decodeFrameRate}}]),r}(yD),CG={FRAMERATE_INPUT_TOO_LOW:1001,FRAMERATE_SENT_TOO_LOW:1002,SEND_VIDEO_BITRATE_TOO_LOW:1003,RECV_VIDEO_DECODE_FAILED:1005,AUDIO_INPUT_LEVEL_TOO_LOW:2001,AUDIO_OUTPUT_LEVEL_TOO_LOW:2002,SEND_AUDIO_BITRATE_TOO_LOW:2003},wG=new(function(){function e(){U(this,e)}return F(e,[{key:"markSubscribeStart",value:function(e,t){performance.mark("agora-web-sdk/".concat(e,"/subscribe-").concat(t))}},{key:"markPublishStart",value:function(e,t){performance.mark("agora-web-sdk/".concat(e,"/publish-").concat(t))}},{key:"measureFromSubscribeStart",value:function(e,t){var r=performance.getEntriesByName("agora-web-sdk/".concat(e,"/subscribe-").concat(t));if(r.length>0){var n=r[r.length-1];return Math.round(performance.now()-n.startTime)}return 0}},{key:"measureFromPublishStart",value:function(e,t){var r=performance.getEntriesByName("agora-web-sdk/".concat(e,"/publish-").concat(t));if(r.length>0){var n=r[r.length-1];return Math.round(performance.now()-n.startTime)}return 0}}]),e}());function RG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function TG(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?RG(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):RG(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var kG=function(){function e(t){var r=this;U(this,e),rO(this,"store",void 0),rO(this,"onStatsException",void 0),rO(this,"onUploadPublishDuration",void 0),rO(this,"localStats",new Map),rO(this,"remoteStats",new Map),rO(this,"updateStatsInterval",void 0),rO(this,"trafficStats",void 0),rO(this,"trafficStatsPeerList",[]),rO(this,"uplinkStats",void 0),rO(this,"exceptionMonitor",void 0),rO(this,"p2pChannel",void 0),rO(this,"updateStats",(function(){r.p2pChannel&&(r.updateRemoteStats(r.p2pChannel),r.updateLocalStats(r.p2pChannel))})),this.store=t,this.updateStatsInterval=window.setInterval(this.updateStats,1e3),this.exceptionMonitor=new bG,this.exceptionMonitor.on("exception",(function(e,t,n){r.onStatsException&&r.onStatsException(e,t,n)}))}return F(e,[{key:"reset",value:function(){this.localStats=new Map,this.remoteStats=new Map,this.trafficStats=void 0,this.trafficStatsPeerList=[],this.uplinkStats=void 0}},{key:"getLocalAudioTrackStats",value:function(){return this.localStats.get(qP.LocalAudioTrack)||TG({},fP)}},{key:"getLocalVideoTrackStats",value:function(){return this.localStats.get(qP.LocalVideoTrack)||TG({},hP)}},{key:"getRemoteAudioTrackStats",value:function(e){var t=this,r=function(e,r){if(!t.trafficStats)return r;var n=t.trafficStats.peer_delay.find((function(t){return t.peer_uid===e}));return n&&(r.publishDuration=n.B_ppad+(Date.now()-t.trafficStats.timestamp)),r},n={};if(e){var i,o=null===(i=this.remoteStats.get(e))||void 0===i?void 0:i.audioStats;o&&(n[e]=r(e,o))}else Array.from(this.remoteStats.entries()).forEach((function(e){var t=E(e,2),i=t[0],o=t[1].audioStats;o&&(n[i]=r(i,o))}));return n}},{key:"getRemoteNetworkQualityStats",value:function(e){var t={};if(e){var r,n=null===(r=this.remoteStats.get(e))||void 0===r?void 0:r.networkStats;n&&(t[e]=n)}else Array.from(this.remoteStats.entries()).forEach((function(e){var r=E(e,2),n=r[0],i=r[1].networkStats;i&&(t[n]=i)}));return t}},{key:"getRemoteVideoTrackStats",value:function(e){var t=this,r=function(e,r){if(!t.trafficStats)return r;var n=t.trafficStats.peer_delay.find((function(t){return t.peer_uid===e}));return n&&(r.publishDuration=n.B_ppvd+(Date.now()-t.trafficStats.timestamp)),r},n={};if(e){var i,o=null===(i=this.remoteStats.get(e))||void 0===i?void 0:i.videoStats;o&&(n[e]=r(e,o))}else Array.from(this.remoteStats.entries()).forEach((function(e){var t=E(e,2),i=t[0],o=t[1].videoStats;o&&(n[i]=r(i,o))}));return n}},{key:"getRTCStats",value:function(){var e=0,t=0,r=0,n=0,i=this.localStats.get(qP.LocalAudioTrack);i&&(e+=i.sendBytes,t+=i.sendBitrate);var o=this.localStats.get(qP.LocalVideoTrack);o&&(e+=o.sendBytes,t+=o.sendBitrate);var a=this.localStats.get(qP.LocalVideoLowTrack);a&&(e+=a.sendBytes,t+=a.sendBitrate),this.remoteStats.forEach((function(e){var t=e.audioStats,i=e.videoStats;t&&(r+=t.receiveBytes,n+=t.receiveBitrate),i&&(r+=i.receiveBytes,n+=i.receiveBitrate)}));var s=1;return this.trafficStats&&(s+=this.trafficStats.peer_delay.length),{Duration:0,UserCount:s,SendBitrate:t,SendBytes:e,RecvBytes:r,RecvBitrate:n,OutgoingAvailableBandwidth:this.uplinkStats?this.uplinkStats.B_uab/1e3:0,RTT:this.trafficStats?2*this.trafficStats.B_acd:0}}},{key:"addLocalStats",value:function(e){this.localStats.set(e,void 0)}},{key:"removeLocalStats",value:function(e){e?this.localStats.delete(e):this.localStats.clear()}},{key:"addRemoteStats",value:function(e){this.remoteStats.set(e,{})}},{key:"removeRemoteStats",value:function(e){e?this.remoteStats.delete(e):this.remoteStats.clear()}},{key:"addP2PChannel",value:function(e){this.p2pChannel=e}},{key:"updateTrafficStats",value:function(e){var t=this;e.peer_delay=e.peer_delay.filter((function(e){return void 0!==e.B_ppad||void 0!==e.B_ppvd})),e.peer_delay.filter((function(e){return-1===t.trafficStatsPeerList.indexOf(e.peer_uid)})).forEach((function(e){var r,n=null===(r=t.p2pChannel)||void 0===r?void 0:r.getRemoteMedia(e.peer_uid),i=null!=n&&n.videoSSRC?wG.measureFromSubscribeStart(t.store.clientId,n.videoSSRC):0,o=null!=n&&n.audioSSRC?wG.measureFromSubscribeStart(t.store.clientId,n.audioSSRC):0;void 0!==e.B_ppad&&void 0!==e.B_ppvd&&(t.onUploadPublishDuration&&t.onUploadPublishDuration(e.peer_uid,e.B_ppad,e.B_ppvd,i>o?i:o),t.trafficStatsPeerList.push(e.peer_uid))})),this.trafficStats=e}},{key:"updateUplinkStats",value:function(e){this.uplinkStats&&this.uplinkStats.B_fir!==e.B_fir&&ND.debug("[".concat(this.store.clientId,"]: Period fir changes to ").concat(e.B_fir)),this.uplinkStats=e}},{key:"isLocalVideoFreeze",value:function(e){return!(!e.inputFrame||!e.sentFrame)&&e.inputFrame.frameRate>5&&e.sentFrame.frameRate<3}},{key:"updateLocalStats",value:function(e){var t=this;Array.from(this.localStats.entries()).forEach((function(r){var n=E(r,2),i=n[0],o=n[1];switch(i){case qP.LocalVideoTrack:case qP.LocalVideoLowTrack:var a=o,s=TG({},hP),c=e.getStats(),u=e.getLocalMedia(i);if(c){var d=c.videoSend.find((function(e){return e.ssrc===(null==u?void 0:u.ssrcs[0].ssrcId)}));if(d){var l=e.getLocalVideoSize(),p=e.getEncoderConfig(qP.LocalVideoTrack);"H264"!==d.codec&&"VP8"!==d.codec&&"VP9"!==d.codec&&"AV1X"!==d.codec&&"AV1"!==d.codec||(s.codecType=d.codec),s.sendBytes=d.bytes,s.sendBitrate=a?8*Math.max(0,s.sendBytes-a.sendBytes):0,d.inputFrame?(s.captureFrameRate=d.inputFrame.frameRate,s.captureResolutionHeight=d.inputFrame.height,s.captureResolutionWidth=d.inputFrame.width):l&&(s.captureResolutionWidth=l.width,s.captureResolutionHeight=l.height),d.sentFrame?(s.sendFrameRate=d.sentFrame.frameRate,s.sendResolutionHeight=d.sentFrame.height,s.sendResolutionWidth=d.sentFrame.width):l&&(s.sendResolutionWidth=l.width,s.sendResolutionHeight=l.height),d.avgEncodeMs&&(s.encodeDelay=d.avgEncodeMs),p&&p.bitrateMax&&(s.targetSendBitrate=1e3*p.bitrateMax),s.sendPackets=d.packets,s.sendPacketsLost=d.packetsLost,s.totalDuration=a?a.totalDuration+1:1,s.totalFreezeTime=a?a.totalFreezeTime:0,t.isLocalVideoFreeze(d)&&(s.totalFreezeTime+=1)}t.trafficStats&&(s.sendPacketsLost=t.trafficStats.B_pvlr4/100)}t.localStats.set(i,s),s&&u&&t.exceptionMonitor.setLocalVideoStats(t.store.uid,u.track,s);break;case qP.LocalAudioTrack:var f=o,h=TG({},fP),A=e.getStats(),v=e.getLocalMedia(i);if(A){var g=A.audioSend.find((function(e){return e.ssrc===(null==v?void 0:v.ssrcs[0].ssrcId)}));if(g){if("opus"!==g.codec&&"aac"!==g.codec&&"PCMU"!==g.codec&&"PCMA"!==g.codec&&"G722"!==g.codec||(h.codecType=g.codec),g.inputLevel)h.sendVolumeLevel=Math.round(32767*g.inputLevel);else{var m=e.getLocalAudioVolume();m&&(h.sendVolumeLevel=Math.round(32767*m))}h.sendBytes=g.bytes,h.sendPackets=g.packets,h.sendPacketsLost=g.packetsLost,h.sendBitrate=f?8*Math.max(0,h.sendBytes-f.sendBytes):0}}t.trafficStats&&(h.sendPacketsLost=t.trafficStats.B_pvlr4/100),t.localStats.set(qP.LocalAudioTrack,h),h&&v&&t.exceptionMonitor.setLocalAudioStats(t.store.uid,v.track,h)}}))}},{key:"updateRemoteStats",value:function(t){var r=this;Array.from(this.remoteStats.entries()).forEach((function(n){var i=E(n,2),o=i[0],a=i[1],s=a.videoStats,c=a.audioStats,u=s,d=a.videoPcStats,l=TG({},AP),p=TG({},gP),f=TG({},vP),h=t.getRemoteMedia(o),A=h.audioTrack,v=h.videoTrack,g=h.audioSSRC,m=h.videoSSRC,_=t.getStats(),y=null==_?void 0:_.audioRecv.find((function(e){return e.ssrc===g})),I=null==_?void 0:_.videoRecv.find((function(e){return e.ssrc===m})),S=r.trafficStats&&r.trafficStats.peer_delay.find((function(e){return e.peer_uid===o}));if(y&&("opus"!==y.codec&&"aac"!==y.codec&&"PCMU"!==y.codec&&"PCMA"!==y.codec&&"G722"!==y.codec||(l.codecType=y.codec),y.outputLevel?l.receiveLevel=Math.round(32767*y.outputLevel):A&&(l.receiveLevel=Math.round(32767*A.getVolumeLevel())),l.receiveBytes=y.bytes,l.receivePackets=y.packets,l.receivePacketsLost=y.packetsLost,l.packetLossRate=l.receivePacketsLost/(l.receivePackets+l.receivePacketsLost),l.receiveBitrate=c?8*Math.max(0,l.receiveBytes-c.receiveBytes):0,l.totalDuration=c?c.totalDuration+1:1,l.totalFreezeTime=c?c.totalFreezeTime:0,l.freezeRate=l.totalFreezeTime/l.totalDuration,l.receiveDelay=y.jitterBufferMs,l.totalDuration>10&&e.isRemoteAudioFreeze(A)&&(l.totalFreezeTime+=1)),I){"H264"!==I.codec&&"VP8"!==I.codec&&"VP9"!==I.codec&&"AV1X"!==I.codec&&"AV1"!==I.codec||(p.codecType=I.codec),p.receiveBytes=I.bytes,p.receiveBitrate=u?8*Math.max(0,p.receiveBytes-u.receiveBytes):0,p.decodeFrameRate=I.decodeFrameRate<0?0:I.decodeFrameRate,p.renderFrameRate=I.decodeFrameRate<0?0:I.decodeFrameRate,I.outputFrame&&(p.renderFrameRate=I.outputFrame.frameRate),I.receivedFrame?(p.receiveFrameRate=I.receivedFrame.frameRate,p.receiveResolutionHeight=I.receivedFrame.height,p.receiveResolutionWidth=I.receivedFrame.width):v&&(p.receiveResolutionHeight=v._videoHeight||0,p.receiveResolutionWidth=v._videoWidth||0),void 0!==I.framesRateFirefox&&(p.receiveFrameRate=Math.round(I.framesRateFirefox)),p.receivePackets=I.packets,p.receivePacketsLost=I.packetsLost,p.packetLossRate=p.receivePacketsLost/(p.receivePackets+p.receivePacketsLost),p.totalDuration=u?u.totalDuration+1:1,p.totalFreezeTime=u?u.totalFreezeTime:0,p.receiveDelay=I.jitterBufferMs||0;var b=!!m&&t.getRemoteVideoIsReady(m);v&&b&&e.isRemoteVideoFreeze(v,I,d)&&(p.totalFreezeTime+=1),p.freezeRate=p.totalFreezeTime/p.totalDuration}S&&(l.end2EndDelay=S.B_ad,p.end2EndDelay=S.B_vd,l.transportDelay=S.B_ed,p.transportDelay=S.B_ed,l.currentPacketLossRate=S.B_ealr4/100,p.currentPacketLossRate=S.B_evlr4/100,f.uplinkNetworkQuality=S.B_punq?S.B_punq:0,f.downlinkNetworkQuality=S.B_pdnq?S.B_pdnq:0),r.remoteStats.set(o,{audioStats:l,videoStats:p,videoPcStats:I,networkStats:f}),A&&r.exceptionMonitor.setRemoteAudioStats(A,l),v&&r.exceptionMonitor.setRemoteVideoStats(v,p)}))}}],[{key:"isRemoteVideoFreeze",value:function(e,t,r){if(!e)return!1;var n=!!r&&t.framesDecodeFreezeTime>r.framesDecodeFreezeTime,i=!r||t.framesDecodeCount>r.framesDecodeCount;return n||!i}},{key:"isRemoteAudioFreeze",value:function(e){return!!e&&e._isFreeze()}}]),e}();function OG(e){return(new TextEncoder).encode(e)}var DG=function(){var e=y(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=function(e,t){var r="";return new Uint8Array(e).forEach((function(e){r+=e.toString(t).padStart(2,"0")})),r},e.next=3,crypto.subtle.digest("SHA-256",OG(t));case 3:return e.t1=e.sent,e.abrupt("return",(0,e.t0)(e.t1,16));case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function NG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function xG(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?NG(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):NG(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function PG(e){if(!e.address||!e.tcp)throw new SD(mD.UNEXPECTED_RESPONSE,"Invalid address format ".concat(e));return e.address.match(/^[\.\:\d]+$/)?"".concat(e.address.replace(/[^\d]/g,"-"),".edge.agora.io"):(ND.info("Cannot recognized as IP address ".concat(e.address,". Used As Host instead")),"".concat(e.address,":").concat(e.tcp))}function LG(e){return e.match(/^[\.\:\d]+$/)?"".concat(e.replace(/[^\d]/g,"-"),".").concat(gN("TURN_DOMAIN")):(ND.info("Cannot recognized as IP address ".concat(e,". Used As Host instead")),e)}function BG(e,t){var r=gN("GATEWAY_DOMAINS"),n=r[1]&&-1!==t.indexOf(r[1])?1:0;return e.addresses=e.addresses||[],{gatewayAddrs:e.addresses.map((function(e){return e.domain_prefix?{address:"".concat(e.domain_prefix,".").concat(r[n++%r.length],":").concat(e.port)}:e.ip.match(/^[\.\:\d]+$/)?{ip:e.ip,port:e.port,address:"".concat(e.ip.replace(/[^\d]/g,"-"),".").concat(r[n++%r.length],":").concat(e.port)}:(ND.info("Cannot recognized as IP address ".concat(e.ip,". Used As Host instead")),{ip:e.ip,port:e.port,address:"".concat(e.ip,":").concat(e.port)})})),uid:e.uid,cid:e.cid,vid:e.detail&&e.detail[8],uni_lbs_ip:e.detail&&e.detail[1],res:e,csIp:e.detail&&e.detail[502]}}function MG(e){return"number"==typeof e?e:e.exact||e.ideal||e.max||e.min||0}function UG(e){var t=e._encoderConfig;if(!t)return{};var r={resolution:t.width&&t.height?"".concat(MG(t.width),"x").concat(MG(t.height)):void 0,maxVideoBW:t.bitrateMax,minVideoBW:t.bitrateMin};return"number"==typeof t.frameRate?(r.maxFrameRate=t.frameRate,r.minFrameRate=t.frameRate):t.frameRate&&(r.maxFrameRate=t.frameRate.max||t.frameRate.ideal||t.frameRate.exact||t.frameRate.min,r.minFrameRate=t.frameRate.min||t.frameRate.ideal||t.frameRate.exact||t.frameRate.max),r}function QG(e,t,r){var n,i=t.videoSend.find((function(t){return t.ssrc===e}));if(!i)return null;var o=null==r||null===(n=r.videoSend.find((function(t){return t.ssrc===e})))||void 0===n?void 0:n.inputFrame,a={id:XG(10,""),timestamp:new Date(t.timestamp).toISOString(),mediaType:"video",type:"ssrc",ssrc:i.ssrc.toString()};return i.inputFrame&&(o&&i.inputFrame.height===o.height||(a.A_fhi=i.inputFrame.height?i.inputFrame.height.toString():"0"),o&&i.inputFrame.width===o.width||(a.A_fwi=i.inputFrame.width?i.inputFrame.width.toString():"0"),o&&i.inputFrame.frameRate===o.frameRate||(a.A_fri=i.inputFrame.frameRate?i.inputFrame.frameRate.toString():"0")),a}function FG(e){return e>=0&&e<.17?1:e>=.17&&e<.36?2:e>=.36&&e<.59?3:e>=.59&&e<=1?4:e>1?5:0}function jG(e,t){var r,n,i=void 0;switch(t){case iF.CHOOSE_SERVER:r=4096,n="choose server";break;case iF.CLOUD_PROXY:r=1048576,n="proxy";break;case iF.CLOUD_PROXY_5:r=4194304,n="proxy5";break;case iF.CLOUD_PROXY_FALLBACK:r=4194310,n="proxy fallback";break;default:throw new SD(mD.UNEXPECTED_ERROR,"multi unlibs response transformer get unknown service id",{csIp:e.detail&&e.detail[502],retry:!1})}if(e.response_body.forEach((function(t){t.buffer&&t.buffer.flag===r&&(i={code:t.buffer.code,addresses:(t.buffer.edges_services||[]).map((function(e){return xG(xG({},e),{},{ticket:t.buffer.cert})})),server_ts:e.enter_ts,uid:t.buffer.uid,cid:t.buffer.cid,cname:t.buffer.cname,detail:xG(xG({},t.buffer.detail),e.detail),flag:t.buffer.flag,opid:e.opid})})),!i)throw new SD(mD.MULTI_UNILBS_RESPONSE_ERROR,"cannot parse response ".concat(n," from multi unilbs response"),{csIp:e.detail&&e.detail[502]});return i}function VG(e,t){return GG.apply(this,arguments)}function GG(){return GG=y(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Rb.all(t.addresses.map(function(){var e=y(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=LG(t.ip),e.t1=t.port,e.t2=t.port,e.t3=r&&gN("ENCRYPT_PROXY_USERNAME_AND_PSW")&&window.isSecureContext?r.toString():sN.username,!(r&&gN("ENCRYPT_PROXY_USERNAME_AND_PSW")&&window.isSecureContext)){e.next=10;break}return e.next=7,DG(r.toString());case 7:e.t4=e.sent,e.next=11;break;case 10:e.t4=sN.password;case 11:return e.t5=e.t4,e.abrupt("return",{address:e.t0,tcpport:e.t1,udpport:e.t2,username:e.t3,password:e.t5});case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),GG.apply(this,arguments)}function KG(e,t){var r=t._videoHeight||t.getMediaStreamTrack(!0).getSettings().height;return r?r/MG(e.height):4}function HG(e){var t=e.candidateType,r=e.relayProtocol,n=e.type,i=e.address,o=e.port,a=e.protocol;return"local-candidate"===n?{candidateType:t,relayProtocol:r,protocol:a}:{candidateType:t,relayProtocol:r,address:i,port:o,protocol:a}}function WG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function YG(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?WG(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):WG(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function qG(e){return window.TextEncoder?(new TextEncoder).encode(e).length:e.length}function JG(e){return new Rb((function(t){window.setTimeout(t,e)}))}function zG(e){var t=new SD(mD.TIMEOUT,"timeout");return new Rb((function(r,n){window.setTimeout((function(){return n(t)}),e)}))}function XG(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7,t=arguments.length>1?arguments[1]:void 0,r=Math.random().toString(16).substr(2,e).toLowerCase();return r.length===e?"".concat(t).concat(r):"".concat(t).concat(r)+XG(e-r.length,"")}function ZG(){return XG(32,"").toUpperCase()}var $G=function(){};function eK(e){return new Rb((function(t,r){var n=!1,i=document.createElement("video");i.setAttribute("autoplay",""),i.setAttribute("muted",""),i.muted=!0,i.autoplay=!0,i.setAttribute("playsinline",""),i.setAttribute("style","position: fixed; top: 0; left: 0; width: 1px; height: 1px"),document.body.appendChild(i);var o=Qk()?"canplay":"playing";i.addEventListener(o,(function(){var e=i.videoWidth,r=i.videoHeight;!e&&Uk()||(n=!0,i.srcObject=null,i.remove(),t([e,r]))})),i.srcObject=new MediaStream([e]),i.play().catch($G),setTimeout((function(){n||(i.srcObject=null,i.remove(),t([i.videoWidth,i.videoHeight]))}),4e3)}))}function tK(e){return Rb.all(e.map((function(e){return e.then((function(e){throw e}),(function(e){return e}))}))).then((function(e){throw e}),(function(e){return e}))}function rK(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return 0===e.getListeners(t).length?Rb.reject(new SD(mD.UNEXPECTED_ERROR,"can not emit promise")):new Rb((function(r,i){e.emit.apply(e,[t].concat(n,[r,i]))}))}function nK(e,t){if(0===e.getListeners(t).length)return Rb.resolve();for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return rK.apply(void 0,[e,t].concat(n))}function iK(e,t){if(0===e.getListeners(t).length)return null;for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return oK.apply(void 0,[e,t].concat(n))}function oK(e,t){for(var r=null,n=null,i=arguments.length,o=new Array(i>2?i-2:0),a=2;a<i;a++)o[a-2]=arguments[a];if(e.emit.apply(e,[t].concat(o,[function(e){r=e},function(e){n=e}])),null!==n)throw n;if(null===r)throw new SD(mD.UNEXPECTED_ERROR,"handler is not sync");return r}function aK(e,t){var r=e.indexOf(t);-1!==r&&e.splice(r,1)}function sK(e){var t=[];return e.forEach((function(e){-1===t.indexOf(e)&&t.push(e)})),t}function cK(e){Rb.resolve().then(e)}function uK(e){return JSON.parse(JSON.stringify(e))}var dK={};function lK(e,t){dK[t]||(dK[t]=!0,e())}function pK(e){for(var t=window.atob(e),r=new Uint8Array(new ArrayBuffer(t.length)),n=0;n<t.length;n+=1)r[n]=t.charCodeAt(n);return r}function fK(e){for(var t="",r=0;r<e.length;r+=1)t+=String.fromCharCode(e[r]);return window.btoa(t)}var hK=new(function(){function e(){U(this,e),rO(this,"fnMap",new Map)}return F(e,[{key:"throttleByKey",value:function(e,t,r,n){for(var i=this,o=arguments.length,a=new Array(o>4?o-4:0),s=4;s<o;s++)a[s-4]=arguments[s];if(this.fnMap.has(t)){var c=this.fnMap.get(t);if(c.threshold!==r){c.fn.apply(c,M(c.args)),clearTimeout(c.timer);var u=window.setTimeout((function(){var e=i.fnMap.get(t);e&&e.fn.apply(e,M(e.args)),i.fnMap.delete(t)}),r);this.fnMap.set(t,{fn:e,threshold:r,timer:u,args:a,skipFn:n})}else c.skipFn&&c.skipFn.apply(c,M(c.args)),this.fnMap.set(t,YG(YG({},c),{},{fn:e,args:a,skipFn:n}))}else{var d=window.setTimeout((function(){var e=i.fnMap.get(t);e&&e.fn.apply(e,M(e.args)),i.fnMap.delete(t)}),r);this.fnMap.set(t,{fn:e,threshold:r,timer:d,args:a,skipFn:n})}}}]),e}()),AK=hK.throttleByKey.bind(hK),vK=function(){var e=y(G.mark((function e(t){var r,n,i,o,a,s,c,u,d,l;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.fragementLength,n=t.referenceList,i=t.asyncMapHandler,o=t.allFailedhandler,a=t.promisesCollector,s=0,c=r,d=0,l=function(){var e=y(G.mark((function e(){var t;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=function(){var e=s*c,t=e+c;return n.slice(e,t).map(i)}(),a&&a.push.apply(a,M(t)),e.prev=2,e.next=5,tK(t);case 5:u=e.sent,e.next=15;break;case 8:if(e.prev=8,e.t0=e.catch(2),s++,(d+=c)>=n.length){e.next=14;break}return e.next=13,l();case 13:return e.abrupt("return",void e.sent);case 14:o(e.t0);case 15:t.forEach((function(e){return e.cancel()}));case 16:case"end":return e.stop()}}),e,null,[[2,8]])})));return function(){return e.apply(this,arguments)}}(),e.next=6,l();case 6:return e.abrupt("return",u);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}();function gK(e){return"object"==D(e)&&null!==e&&!(e instanceof RegExp)}var mK=Xc,EK=$d("iterator"),_K=!mK((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r="";return e.pathname="c%20d",t.forEach((function(e,n){t.delete("b"),r+=n+e})),!e.toJSON||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[EK]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==r||"x"!==new URL("http://x",void 0).host})),yK=Au,IK=iu,SK=mu,bK=Xc,CK=Ag,wK=tg,RK=Eu,TK=Pd,kK=Lu,OK=Object.assign,DK=Object.defineProperty,NK=IK([].concat),xK=!OK||bK((function(){if(yK&&1!==OK({b:1},OK(DK({},"a",{enumerable:!0,get:function(){DK(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=OK({},e)[r]||CK(OK({},t)).join("")!=n}))?function(e,t){for(var r=TK(e),n=arguments.length,i=1,o=wK.f,a=RK.f;n>i;)for(var s,c=kK(arguments[i++]),u=o?NK(CK(c),o(c)):CK(c),d=u.length,l=0;d>l;)s=u[l++],yK&&!SK(a,c,s)||(r[s]=c[s]);return r}:OK,PK=Hl,LK=mm,BK=Ul,MK=mu,UK=Pd,QK=function(e,t,r,n){try{return n?t(PK(r)[0],r[1]):t(r)}catch(t){LK(e,"throw",t)}},FK=Wg,jK=fy,VK=bp,GK=ON,KK=hm,HK=sm,WK=su.Array,YK=iu,qK=2147483647,JK=/[^\0-\u007E]/,zK=/[.\u3002\uFF0E\uFF61]/g,XK="Overflow: input needs wider integers to process",ZK=su.RangeError,$K=YK(zK.exec),eH=Math.floor,tH=String.fromCharCode,rH=YK("".charCodeAt),nH=YK([].join),iH=YK([].push),oH=YK("".replace),aH=YK("".split),sH=YK("".toLowerCase),cH=function(e){return e+22+75*(e<26)},uH=function(e,t,r){var n=0;for(e=r?eH(e/700):e>>1,e+=eH(e/t);e>455;)e=eH(e/35),n+=36;return eH(n+36*e/(e+38))},dH=function(e){var t,r,n=[],i=(e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=rH(e,r++);if(i>=55296&&i<=56319&&r<n){var o=rH(e,r++);56320==(64512&o)?iH(t,((1023&i)<<10)+(1023&o)+65536):(iH(t,i),r--)}else iH(t,i)}return t}(e)).length,o=128,a=0,s=72;for(t=0;t<e.length;t++)(r=e[t])<128&&iH(n,tH(r));var c=n.length,u=c;for(c&&iH(n,"-");u<i;){var d=qK;for(t=0;t<e.length;t++)(r=e[t])>=o&&r<d&&(d=r);var l=u+1;if(d-o>eH((qK-a)/l))throw ZK(XK);for(a+=(d-o)*l,o=d,t=0;t<e.length;t++){if((r=e[t])<o&&++a>qK)throw ZK(XK);if(r==o){for(var p=a,f=36;;){var h=f<=s?1:f>=s+26?26:f-s;if(p<h)break;var A=p-h,v=36-h;iH(n,tH(cH(h+A%v))),p=eH(A/v),f+=36}iH(n,tH(cH(p))),s=uH(a,l,u==c),a=0,u++}}a++,o++}return nH(n,"")},lH=su.TypeError,pH=gp,fH=su,hH=qu,AH=mu,vH=iu,gH=_K,mH=VE,EH=U_,_H=a_,yH=f_,IH=PE,SH=H_,bH=fu,CH=Md,wH=Ul,RH=rm,TH=Hl,kH=Vu,OH=Lm,DH=Lg,NH=Cu,xH=hm,PH=sm,LH=function(e,t){if(e<t)throw lH("Not enough arguments");return e},BH=VN,MH=$d("iterator"),UH="URLSearchParams",QH="URLSearchParamsIterator",FH=IH.set,jH=IH.getterFor(UH),VH=IH.getterFor(QH),GH=hH("fetch"),KH=hH("Request"),HH=hH("Headers"),WH=KH&&KH.prototype,YH=HH&&HH.prototype,qH=fH.RegExp,JH=fH.TypeError,zH=fH.decodeURIComponent,XH=fH.encodeURIComponent,ZH=vH("".charAt),$H=vH([].join),eW=vH([].push),tW=vH("".replace),rW=vH([].shift),nW=vH([].splice),iW=vH("".split),oW=vH("".slice),aW=/\+/g,sW=Array(4),cW=function(e){return sW[e-1]||(sW[e-1]=qH("((?:%[\\da-f]{2}){"+e+"})","gi"))},uW=function(e){try{return zH(e)}catch(t){return e}},dW=function(e){var t=tW(e,aW," "),r=4;try{return zH(t)}catch(e){for(;r;)t=tW(t,cW(r--),uW);return t}},lW=/[!'()~]|%20/g,pW={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},fW=function(e){return pW[e]},hW=function(e){return tW(XH(e),lW,fW)},AW=yH((function(e,t){FH(this,{type:QH,iterator:xH(jH(e).entries),kind:t})}),"Iterator",(function(){var e=VH(this),t=e.kind,r=e.iterator.next(),n=r.value;return r.done||(r.value="keys"===t?n.key:"values"===t?n.value:[n.key,n.value]),r}),!0),vW=function(e){this.entries=[],this.url=null,void 0!==e&&(kH(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===ZH(e,0)?oW(e,1):e:OH(e)))};vW.prototype={type:UH,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,c=PH(e);if(c)for(r=(t=xH(e,c)).next;!(n=AH(r,t)).done;){if(o=(i=xH(TH(n.value))).next,(a=AH(o,i)).done||(s=AH(o,i)).done||!AH(o,i).done)throw JH("Expected sequence with length 2");eW(this.entries,{key:OH(a.value),value:OH(s.value)})}else for(var u in e)CH(e,u)&&eW(this.entries,{key:u,value:OH(e[u])})},parseQuery:function(e){if(e)for(var t,r,n=iW(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=iW(t,"="),eW(this.entries,{key:dW(rW(r)),value:dW($H(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],eW(r,hW(e.key)+"="+hW(e.value));return $H(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var gW=function(){SH(this,mW),FH(this,new vW(arguments.length>0?arguments[0]:void 0))},mW=gW.prototype;if(EH(mW,{append:function(e,t){LH(arguments.length,2);var r=jH(this);eW(r.entries,{key:OH(e),value:OH(t)}),r.updateURL()},delete:function(e){LH(arguments.length,1);for(var t=jH(this),r=t.entries,n=OH(e),i=0;i<r.length;)r[i].key===n?nW(r,i,1):i++;t.updateURL()},get:function(e){LH(arguments.length,1);for(var t=jH(this).entries,r=OH(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){LH(arguments.length,1);for(var t=jH(this).entries,r=OH(e),n=[],i=0;i<t.length;i++)t[i].key===r&&eW(n,t[i].value);return n},has:function(e){LH(arguments.length,1);for(var t=jH(this).entries,r=OH(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){LH(arguments.length,1);for(var r,n=jH(this),i=n.entries,o=!1,a=OH(e),s=OH(t),c=0;c<i.length;c++)(r=i[c]).key===a&&(o?nW(i,c--,1):(o=!0,r.value=s));o||eW(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=jH(this);BH(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=jH(this).entries,n=wH(e,arguments.length>1?arguments[1]:void 0),i=0;i<r.length;)n((t=r[i++]).value,t.key,this)},keys:function(){return new AW(this,"keys")},values:function(){return new AW(this,"values")},entries:function(){return new AW(this,"entries")}},{enumerable:!0}),mH(mW,MH,mW.entries,{name:"entries"}),mH(mW,"toString",(function(){return jH(this).serialize()}),{enumerable:!0}),_H(gW,UH),pH({global:!0,forced:!gH},{URLSearchParams:gW}),!gH&&bH(HH)){var EW=vH(YH.has),_W=vH(YH.set),yW=function(e){if(kH(e)){var t,r=e.body;if(RH(r)===UH)return t=e.headers?new HH(e.headers):new HH,EW(t,"content-type")||_W(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),DH(e,{body:NH(0,OH(r)),headers:NH(0,t)})}return e};if(bH(GH)&&pH({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return GH(e,arguments.length>1?yW(arguments[1]):{})}}),bH(KH)){var IW=function(e){return SH(this,WH),new KH(e,arguments.length>1?yW(arguments[1]):{})};WH.constructor=IW,IW.prototype=WH,pH({global:!0,forced:!0},{Request:IW})}}var SW,bW={URLSearchParams:gW,getState:jH},CW=gp,wW=Au,RW=_K,TW=su,kW=Ul,OW=iu,DW=pg.f,NW=VE,xW=H_,PW=Md,LW=xK,BW=function(e){var t=UK(e),r=jK(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=BK(i,n>2?arguments[2]:void 0));var a,s,c,u,d,l,p=HK(t),f=0;if(!p||this==WK&&FK(p))for(a=VK(t),s=r?new this(a):WK(a);a>f;f++)l=o?i(t[f],f):t[f],GK(s,f,l);else for(d=(u=KK(t,p)).next,s=r?new this:[];!(c=MK(d,u)).done;f++)l=o?QK(u,i,[c.value,f],!0):c.value,GK(s,f,l);return s.length=f,s},MW=BN,UW=cb.codeAt,QW=function(e){var t,r,n=[],i=aH(oH(sH(e),zK,"."),".");for(t=0;t<i.length;t++)r=i[t],iH(n,$K(JK,r)?"xn--"+dH(r):r);return nH(n,".")},FW=Lm,jW=a_,VW=bW,GW=PE,KW=GW.set,HW=GW.getterFor("URL"),WW=VW.URLSearchParams,YW=VW.getState,qW=TW.URL,JW=TW.TypeError,zW=TW.parseInt,XW=Math.floor,ZW=Math.pow,$W=OW("".charAt),eY=OW(/./.exec),tY=OW([].join),rY=OW(1..toString),nY=OW([].pop),iY=OW([].push),oY=OW("".replace),aY=OW([].shift),sY=OW("".split),cY=OW("".slice),uY=OW("".toLowerCase),dY=OW([].unshift),lY="Invalid scheme",pY="Invalid host",fY="Invalid port",hY=/[a-z]/i,AY=/[\d+-.a-z]/i,vY=/\d/,gY=/^0x/i,mY=/^[0-7]+$/,EY=/^\d+$/,_Y=/^[\da-f]+$/i,yY=/[\0\t\n\r #%/:<>?@[\\\]^|]/,IY=/[\0\t\n\r #/:<>?@[\\\]^|]/,SY=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,bY=/[\t\n\r]/g,CY=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)dY(t,e%256),e=XW(e/256);return tY(t,".")}if("object"==D(e)){for(t="",n=function(e){for(var t=null,r=1,n=null,i=0,o=0;o<8;o++)0!==e[o]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=o),++i);return i>r&&(t=n,r=i),t}(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=rY(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},wY={},RY=LW({},wY,{" ":1,'"':1,"<":1,">":1,"`":1}),TY=LW({},RY,{"#":1,"?":1,"{":1,"}":1}),kY=LW({},TY,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),OY=function(e,t){var r=UW(e,0);return r>32&&r<127&&!PW(t,e)?e:encodeURIComponent(e)},DY={ftp:21,file:null,http:80,https:443,ws:80,wss:443},NY=function(e,t){var r;return 2==e.length&&eY(hY,$W(e,0))&&(":"==(r=$W(e,1))||!t&&"|"==r)},xY=function(e){var t;return e.length>1&&NY(cY(e,0,2))&&(2==e.length||"/"===(t=$W(e,2))||"\\"===t||"?"===t||"#"===t)},PY=function(e){return"."===e||"%2e"===uY(e)},LY={},BY={},MY={},UY={},QY={},FY={},jY={},VY={},GY={},KY={},HY={},WY={},YY={},qY={},JY={},zY={},XY={},ZY={},$Y={},eq={},tq={},rq=function e(t,r,n){var i,o,a,s=FW(t);if(r){if(o=this.parse(s))throw JW(o);this.searchParams=null}else{if(void 0!==n&&(i=new e(n,!0)),o=this.parse(s,null,i))throw JW(o);(a=YW(new WW)).bindURL(this),this.searchParams=a}};rq.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,c=this,u=t||LY,d=0,l="",p=!1,f=!1,h=!1;for(e=FW(e),t||(c.scheme="",c.username="",c.password="",c.host=null,c.port=null,c.path=[],c.query=null,c.fragment=null,c.cannotBeABaseURL=!1,e=oY(e,SY,"")),e=oY(e,bY,""),n=BW(e);d<=n.length;){switch(i=n[d],u){case LY:if(!i||!eY(hY,i)){if(t)return lY;u=MY;continue}l+=uY(i),u=BY;break;case BY:if(i&&(eY(AY,i)||"+"==i||"-"==i||"."==i))l+=uY(i);else{if(":"!=i){if(t)return lY;l="",u=MY,d=0;continue}if(t&&(c.isSpecial()!=PW(DY,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&DY[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=qY:c.isSpecial()&&r&&r.scheme==c.scheme?u=UY:c.isSpecial()?u=VY:"/"==n[d+1]?(u=QY,d++):(c.cannotBeABaseURL=!0,iY(c.path,""),u=$Y)}break;case MY:if(!r||r.cannotBeABaseURL&&"#"!=i)return lY;if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=MW(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=tq;break}u="file"==r.scheme?qY:FY;continue;case UY:if("/"!=i||"/"!=n[d+1]){u=FY;continue}u=GY,d++;break;case QY:if("/"==i){u=KY;break}u=ZY;continue;case FY:if(c.scheme=r.scheme,i==SW)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=MW(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())u=jY;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=MW(r.path),c.query="",u=eq;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=MW(r.path),c.path.length--,u=ZY;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=MW(r.path),c.query=r.query,c.fragment="",u=tq}break;case jY:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=ZY;continue}u=KY}else u=GY;break;case VY:if(u=GY,"/"!=i||"/"!=$W(l,d+1))continue;d++;break;case GY:if("/"!=i&&"\\"!=i){u=KY;continue}break;case KY:if("@"==i){p&&(l="%40"+l),p=!0,o=BW(l);for(var A=0;A<o.length;A++){var v=o[A];if(":"!=v||h){var g=OY(v,kY);h?c.password+=g:c.username+=g}else h=!0}l=""}else if(i==SW||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(p&&""==l)return"Invalid authority";d-=BW(l).length+1,l="",u=HY}else l+=i;break;case HY:case WY:if(t&&"file"==c.scheme){u=zY;continue}if(":"!=i||f){if(i==SW||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return pY;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=XY,t)return;continue}"["==i?f=!0:"]"==i&&(f=!1),l+=i}else{if(""==l)return pY;if(a=c.parseHost(l))return a;if(l="",u=YY,t==WY)return}break;case YY:if(!eY(vY,i)){if(i==SW||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var m=zW(l,10);if(m>65535)return fY;c.port=c.isSpecial()&&m===DY[c.scheme]?null:m,l=""}if(t)return;u=XY;continue}return fY}l+=i;break;case qY:if(c.scheme="file","/"==i||"\\"==i)u=JY;else{if(!r||"file"!=r.scheme){u=ZY;continue}if(i==SW)c.host=r.host,c.path=MW(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=MW(r.path),c.query="",u=eq;else{if("#"!=i){xY(tY(MW(n,d),""))||(c.host=r.host,c.path=MW(r.path),c.shortenPath()),u=ZY;continue}c.host=r.host,c.path=MW(r.path),c.query=r.query,c.fragment="",u=tq}}break;case JY:if("/"==i||"\\"==i){u=zY;break}r&&"file"==r.scheme&&!xY(tY(MW(n,d),""))&&(NY(r.path[0],!0)?iY(c.path,r.path[0]):c.host=r.host),u=ZY;continue;case zY:if(i==SW||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&NY(l))u=ZY;else if(""==l){if(c.host="",t)return;u=XY}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=XY}continue}l+=i;break;case XY:if(c.isSpecial()){if(u=ZY,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=SW&&(u=ZY,"/"!=i))continue}else c.fragment="",u=tq;else c.query="",u=eq;break;case ZY:if(i==SW||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=uY(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||iY(c.path,"")):PY(l)?"/"==i||"\\"==i&&c.isSpecial()||iY(c.path,""):("file"==c.scheme&&!c.path.length&&NY(l)&&(c.host&&(c.host=""),l=$W(l,0)+":"),iY(c.path,l)),l="","file"==c.scheme&&(i==SW||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)aY(c.path);"?"==i?(c.query="",u=eq):"#"==i&&(c.fragment="",u=tq)}else l+=OY(i,TY);break;case $Y:"?"==i?(c.query="",u=eq):"#"==i?(c.fragment="",u=tq):i!=SW&&(c.path[0]+=OY(i,wY));break;case eq:t||"#"!=i?i!=SW&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":OY(i,wY)):(c.fragment="",u=tq);break;case tq:i!=SW&&(c.fragment+=OY(i,RY))}d++}},parseHost:function(e){var t,r,n;if("["==$W(e,0)){if("]"!=$W(e,e.length-1))return pY;if(!(t=function(e){var t,r,n,i,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,p=function(){return $W(e,l)};if(":"==p()){if(":"!=$W(e,1))return;l+=2,d=++u}for(;p();){if(8==u)return;if(":"!=p()){for(t=r=0;r<4&&eY(_Y,p());)t=16*t+zW(p(),16),l++,r++;if("."==p()){if(0==r)return;if(l-=r,u>6)return;for(n=0;p();){if(i=null,n>0){if(!("."==p()&&n<4))return;l++}if(!eY(vY,p()))return;for(;eY(vY,p());){if(o=zW(p(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;l++}c[u]=256*c[u]+i,2!=++n&&4!=n||u++}if(4!=n)return;break}if(":"==p()){if(l++,!p())return}else if(p())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(a=u-d,u=7;0!=u&&a>0;)s=c[u],c[u--]=c[d+a-1],c[d+--a]=s;else if(8!=u)return;return c}(cY(e,1,-1))))return pY;this.host=t}else if(this.isSpecial()){if(e=QW(e),eY(yY,e))return pY;if(null===(t=function(e){var t,r,n,i,o,a,s,c=sY(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=c[n]))return e;if(o=10,i.length>1&&"0"==$W(i,0)&&(o=eY(gY,i)?16:8,i=cY(i,8==o?1:2)),""===i)a=0;else{if(!eY(10==o?EY:8==o?mY:_Y,i))return e;a=zW(i,o)}iY(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=ZW(256,5-t))return null}else if(a>255)return null;for(s=nY(r),n=0;n<r.length;n++)s+=r[n]*ZW(256,3-n);return s}(e)))return pY;this.host=t}else{if(eY(IY,e))return pY;for(t="",r=BW(e),n=0;n<r.length;n++)t+=OY(r[n],wY);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return PW(DY,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&NY(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,u=t+":";return null!==i?(u+="//",e.includesCredentials()&&(u+=r+(n?":"+n:"")+"@"),u+=CY(i),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+tY(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw JW(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new nq(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+CY(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(FW(e)+":",LY)},getUsername:function(){return this.username},setUsername:function(e){var t=BW(FW(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=OY(t[r],kY)}},getPassword:function(){return this.password},setPassword:function(e){var t=BW(FW(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=OY(t[r],kY)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?CY(e):CY(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,HY)},getHostname:function(){var e=this.host;return null===e?"":CY(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,WY)},getPort:function(){var e=this.port;return null===e?"":FW(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=FW(e))?this.port=null:this.parse(e,YY))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+tY(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,XY))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=FW(e))?this.query=null:("?"==$W(e,0)&&(e=cY(e,1)),this.query="",this.parse(e,eq)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=FW(e))?("#"==$W(e,0)&&(e=cY(e,1)),this.fragment="",this.parse(e,tq)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var nq=function(e){var t=xW(this,iq),r=KW(t,new rq(e,!1,arguments.length>1?arguments[1]:void 0));wW||(t.href=r.serialize(),t.origin=r.getOrigin(),t.protocol=r.getProtocol(),t.username=r.getUsername(),t.password=r.getPassword(),t.host=r.getHost(),t.hostname=r.getHostname(),t.port=r.getPort(),t.pathname=r.getPathname(),t.search=r.getSearch(),t.searchParams=r.getSearchParams(),t.hash=r.getHash())},iq=nq.prototype,oq=function(e,t){return{get:function(){return HW(this)[e]()},set:t&&function(e){return HW(this)[t](e)},configurable:!0,enumerable:!0}};if(wW&&DW(iq,{href:oq("serialize","setHref"),origin:oq("getOrigin"),protocol:oq("getProtocol","setProtocol"),username:oq("getUsername","setUsername"),password:oq("getPassword","setPassword"),host:oq("getHost","setHost"),hostname:oq("getHostname","setHostname"),port:oq("getPort","setPort"),pathname:oq("getPathname","setPathname"),search:oq("getSearch","setSearch"),searchParams:oq("getSearchParams"),hash:oq("getHash","setHash")}),NW(iq,"toJSON",(function(){return HW(this).serialize()}),{enumerable:!0}),NW(iq,"toString",(function(){return HW(this).serialize()}),{enumerable:!0}),qW){var aq=qW.createObjectURL,sq=qW.revokeObjectURL;aq&&NW(nq,"createObjectURL",kW(aq,qW)),sq&&NW(nq,"revokeObjectURL",kW(sq,qW))}jW(nq,"URL"),CW({global:!0,forced:!RW,sham:!wW},{URL:nq});var cq=Gu.URL,uq=(j(n={},Vx.ACCESS_POINT,(j(e={},Hx.NO_FLAG_SET,{desc:"flag is zero",retry:!1}),j(e,Hx.FLAG_SET_BUT_EMPTY,{desc:"flag is empty",retry:!1}),j(e,Hx.INVALID_FALG_SET,{desc:"invalid flag",retry:!1}),j(e,Hx.FLAG_SET_BUT_NO_RE,{desc:"flag set unilbs but no request",retry:!1}),j(e,Hx.INVALID_SERVICE_ID,{desc:"invalid service id",retry:!1}),j(e,Hx.NO_SERVICE_AVAILABLE,{desc:"no service available",retry:!0}),j(e,Hx.NO_SERVICE_AVAILABLE_P2P,{desc:"no unilbs p2p service available",retry:!0}),j(e,Hx.NO_SERVICE_AVAILABLE_VOET,{desc:"no unilbs voice service available",retry:!0}),j(e,Hx.NO_SERVICE_AVAILABLE_WEBRTC,{desc:"no unilbs webrtc service available",retry:!0}),j(e,Hx.NO_SERVICE_AVAILABLE_CDS,{desc:"no cds service available",retry:!0}),j(e,Hx.NO_SERVICE_AVAILABLE_CDN,{desc:"no cdn dispatcher service available",retry:!0}),j(e,Hx.NO_SERVICE_AVAILABLE_TDS,{desc:"no tds service available",retry:!0}),j(e,Hx.NO_SERVICE_AVAILABLE_REPORT,{desc:"no unilbs report service available",retry:!0}),j(e,Hx.NO_SERVICE_AVAILABLE_APP_CENTER,{desc:"no app center service available",retry:!0}),j(e,Hx.NO_SERVICE_AVAILABLE_ENV0,{desc:"no unilbs sig env0 service available",retry:!0}),j(e,Hx.NO_SERVICE_AVAILABLE_VOET,{desc:"no unilbs voet service available",retry:!0}),j(e,Hx.NO_SERVICE_AVAILABLE_STRING_UID,{desc:"no string uid service available",retry:!0}),j(e,Hx.NO_SERVICE_AVAILABLE_WEBRTC_UNILBS,{desc:"no webrtc unilbs service available",retry:!0}),e)),j(n,Vx.UNILBS,(j(t={},Kx.INVALID_VENDOR_KEY,{desc:"invalid vendor key, can not find appid",retry:!1}),j(t,Kx.INVALID_CHANNEL_NAME,{desc:"invalid channel name",retry:!1}),j(t,Kx.INTERNAL_ERROR,{desc:"unilbs internal error",retry:!1}),j(t,Kx.NO_AUTHORIZED,{desc:"invalid token, authorized failed",retry:!1}),j(t,Kx.DYNAMIC_KEY_TIMEOUT,{desc:"dynamic key or token timeout",retry:!1}),j(t,Kx.NO_ACTIVE_STATUS,{desc:"no active status",retry:!1}),j(t,Kx.DYNAMIC_KEY_EXPIRED,{desc:"dynamic key expired",retry:!1}),j(t,Kx.STATIC_USE_DYNAMIC_KEY,{desc:"static use dynamic key",retry:!1}),j(t,Kx.DYNAMIC_USE_STATIC_KEY,{desc:"dynamic use static key",retry:!1}),j(t,Kx.USER_OVERLOAD,{desc:"amount of users over load",retry:!1}),j(t,Kx.FORBIDDEN_REGION,{desc:"the request is forbidden in this area",retry:!1}),j(t,Kx.CANNOT_MEET_AREA_DEMAND,{desc:"unable to allocate services in this area",retry:!1}),t)),j(n,Vx.STRING_UID_ALLOCATOR,(j(r={},Gx.IIIEGAL_APPID,{desc:"invalid appid",retry:!1}),j(r,Gx.IIIEGAL_UID,{desc:"invalid string uid",retry:!1}),j(r,Gx.INTERNAL_ERROR,{desc:"string uid allocator internal error",retry:!0}),r)),n);function dq(e){var t=uq[Math.floor(e/1e4)];if(!t)return{desc:"unkonw error",retry:!1};var r=t[e%1e4];if(!r){if(Math.floor(e/1e4)===Vx.ACCESS_POINT){var n=e%1e4;if("1"===n.toString()[0])return{desc:e.toString(),retry:!1};if("2"===n.toString()[0])return{desc:e.toString(),retry:!0}}return{desc:"unkonw error",retry:!1}}return r}var lq=(j(i={},Wx.K_TIMESTAMP_EXPIRED,{desc:"K_TIMESTAMP_EXPIRED",action:"failed"}),j(i,Wx.K_CHANNEL_PERMISSION_INVALID,{desc:"K_CHANNEL_PERMISSION_INVALID",action:"failed"}),j(i,Wx.K_CERTIFICATE_INVALID,{desc:"K_CERTIFICATE_INVALID",action:"failed"}),j(i,Wx.K_CHANNEL_NAME_EMPTY,{desc:"K_CHANNEL_NAME_EMPTY",action:"failed"}),j(i,Wx.K_CHANNEL_NOT_FOUND,{desc:"K_CHANNEL_NOT_FOUND",action:"failed"}),j(i,Wx.K_TICKET_INVALID,{desc:"K_TICKET_INVALID",action:"failed"}),j(i,Wx.K_CHANNEL_CONFLICTED,{desc:"K_CHANNEL_CONFLICTED",action:"failed"}),j(i,Wx.K_SERVICE_NOT_READY,{desc:"K_SERVICE_NOT_READY",action:"tryNext"}),j(i,Wx.K_SERVICE_TOO_HEAVY,{desc:"K_SERVICE_TOO_HEAVY",action:"tryNext"}),j(i,Wx.K_UID_BANNED,{desc:"K_UID_BANNED",action:"failed"}),j(i,Wx.K_IP_BANNED,{desc:"K_IP_BANNED",action:"failed"}),j(i,Wx.ERR_INVALID_VENDOR_KEY,{desc:"ERR_INVALID_VENDOR_KEY",action:"failed"}),j(i,Wx.ERR_INVALID_CHANNEL_NAME,{desc:"ERR_INVALID_CHANNEL_NAME",action:"failed"}),j(i,Wx.WARN_NO_AVAILABLE_CHANNEL,{desc:"WARN_NO_AVAILABLE_CHANNEL",action:"failed"}),j(i,Wx.WARN_LOOKUP_CHANNEL_TIMEOUT,{desc:"WARN_LOOKUP_CHANNEL_TIMEOUT",action:"tryNext"}),j(i,Wx.WARN_LOOKUP_CHANNEL_REJECTED,{desc:"WARN_LOOKUP_CHANNEL_REJECTED",action:"failed"}),j(i,Wx.WARN_OPEN_CHANNEL_TIMEOUT,{desc:"WARN_OPEN_CHANNEL_TIMEOUT",action:"tryNext"}),j(i,Wx.WARN_OPEN_CHANNEL_REJECTED,{desc:"WARN_OPEN_CHANNEL_REJECTED",action:"failed"}),j(i,Wx.WARN_REQUEST_DEFERRED,{desc:"WARN_REQUEST_DEFERRED",action:"failed"}),j(i,Wx.ERR_DYNAMIC_KEY_TIMEOUT,{desc:"ERR_DYNAMIC_KEY_TIMEOUT",action:"failed"}),j(i,Wx.ERR_NO_AUTHORIZED,{desc:"ERR_NO_AUTHORIZED",action:"failed"}),j(i,Wx.ERR_VOM_SERVICE_UNAVAILABLE,{desc:"ERR_VOM_SERVICE_UNAVAILABLE",action:"tryNext"}),j(i,Wx.ERR_NO_CHANNEL_AVAILABLE_CODE,{desc:"ERR_NO_CHANNEL_AVAILABLE_CODE",action:"failed"}),j(i,Wx.ERR_MASTER_VOCS_UNAVAILABLE,{desc:"ERR_MASTER_VOCS_UNAVAILABLE",action:"tryNext"}),j(i,Wx.ERR_INTERNAL_ERROR,{desc:"ERR_INTERNAL_ERROR",action:"tryNext"}),j(i,Wx.ERR_NO_ACTIVE_STATUS,{desc:"ERR_NO_ACTIVE_STATUS",action:"failed"}),j(i,Wx.ERR_INVALID_UID,{desc:"ERR_INVALID_UID",action:"failed"}),j(i,Wx.ERR_DYNAMIC_KEY_EXPIRED,{desc:"ERR_DYNAMIC_KEY_EXPIRED",action:"failed"}),j(i,Wx.ERR_STATIC_USE_DYANMIC_KE,{desc:"ERR_STATIC_USE_DYANMIC_KE",action:"failed"}),j(i,Wx.ERR_DYNAMIC_USE_STATIC_KE,{desc:"ERR_DYNAMIC_USE_STATIC_KE",action:"failed"}),j(i,Wx.ERR_NO_VOCS_AVAILABLE,{desc:"ERR_NO_VOCS_AVAILABLE",action:"tryNext"}),j(i,Wx.ERR_NO_VOS_AVAILABLE,{desc:"ERR_NO_VOS_AVAILABLE",action:"tryNext"}),j(i,Wx.ERR_JOIN_CHANNEL_TIMEOUT,{desc:"ERR_JOIN_CHANNEL_TIMEOUT",action:"tryNext"}),j(i,Wx.ERR_JOIN_BY_MULTI_IP,{desc:"ERR_JOIN_BY_MULTI_IP",action:"recover"}),j(i,Wx.ERR_NOT_JOINED,{desc:"ERR_NOT_JOINED",action:"failed"}),j(i,Wx.ERR_REPEAT_JOIN_REQUEST,{desc:"ERR_REPEAT_JOIN_REQUEST",action:"quit"}),j(i,Wx.ERR_REPEAT_JOIN_CHANNEL,{desc:"ERR_REPEAT_JOIN_CHANNEL",action:"quit"}),j(i,Wx.ERR_INVALID_VENDOR_KEY,{desc:"ERR_INVALID_VENDOR_KEY",action:"failed"}),j(i,Wx.ERR_INVALID_CHANNEL_NAME,{desc:"ERR_INVALID_CHANNEL_NAME",action:"failed"}),j(i,Wx.ERR_INVALID_STRINGUID,{desc:"ERR_INVALID_STRINGUID",action:"failed"}),j(i,Wx.ERR_TOO_MANY_USERS,{desc:"ERR_TOO_MANY_USERS",action:"tryNext"}),j(i,Wx.ERR_SET_CLIENT_ROLE_TIMEOUT,{desc:"ERR_SET_CLIENT_ROLE_TIMEOUT",action:"failed"}),j(i,Wx.ERR_SET_CLIENT_ROLE_NO_PERMISSION,{desc:"ERR_SET_CLIENT_ROLE_TIMEOUT",action:"failed"}),j(i,Wx.ERR_SET_CLIENT_ROLE_ALREADY_IN_USE,{desc:"ERR_SET_CLIENT_ROLE_ALREADY_IN_USE",action:"success"}),j(i,Wx.ERR_PUBLISH_REQUEST_INVALID,{desc:"ERR_PUBLISH_REQUEST_INVALID",action:"failed"}),j(i,Wx.ERR_SUBSCRIBE_REQUEST_INVALID,{desc:"ERR_SUBSCRIBE_REQUEST_INVALID",action:"failed"}),j(i,Wx.ERR_NOT_SUPPORTED_MESSAGE,{desc:"ERR_NOT_SUPPORTED_MESSAGE",action:"failed"}),j(i,Wx.ERR_ILLEAGAL_PLUGIN,{desc:"ERR_ILLEAGAL_PLUGIN",action:"failed"}),j(i,Wx.ILLEGAL_CLIENT_ROLE_LEVEL,{desc:"ILLEGAL_CLIENT_ROLE_LEVEL",action:"failed"}),j(i,Wx.ERR_REJOIN_TOKEN_INVALID,{desc:"ERR_REJOIN_TOKEN_INVALID",action:"failed"}),j(i,Wx.ERR_REJOIN_USER_NOT_JOINED,{desc:"ERR_REJOIN_NOT_JOINED",action:"failed"}),j(i,Wx.ERR_INVALID_OPTIONAL_INFO,{desc:"ERR_INVALID_OPTIONAL_INFO",action:"quit"}),j(i,Wx.ERR_TEST_RECOVER,{desc:"ERR_TEST_RECOVER",action:"recover"}),j(i,Wx.ERR_TEST_TRYNEXT,{desc:"ERR_TEST_TRYNEXT",action:"recover"}),j(i,Wx.ERR_TEST_RETRY,{desc:"ERR_TEST_RETRY",action:"recover"}),j(i,Wx.ILLEGAL_AES_PASSWORD,{desc:"ERR_TEST_RETRY",action:"failed"}),j(i,Wx.ERR_TOO_MANY_BROADCASTERS,{desc:"ERR_TOO_MANY_BROADCASTERS",action:"failed"}),j(i,Wx.ERR_TOO_MANY_SUBSCRIBERS,{desc:"ERR_TOO_MANY_SUBSCRIBERS",action:"failed"}),i);function pq(e){return lq[e]||{desc:"UNKNOW_ERROR_".concat(e),action:"failed"}}var fq={exports:{}};!function(e,t){e.exports=function(){var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{DataViewIndexOutOfBoundsError:function(){return V},DecodeError:function(){return E},Decoder:function(){return H},EXT_TIMESTAMP:function(){return _},Encoder:function(){return O},ExtData:function(){return g},ExtensionCodec:function(){return R},decode:function(){return Y},decodeArrayStream:function(){return te},decodeAsync:function(){return ee},decodeMulti:function(){return q},decodeMultiStream:function(){return re},decodeStream:function(){return ne},decodeTimestampExtension:function(){return C},decodeTimestampToTimeSpec:function(){return b},encode:function(){return x},encodeDateToTimeSpec:function(){return I},encodeTimeSpecToTimestamp:function(){return y},encodeTimestampExtension:function(){return S}});var r=4294967295;function n(e,t,r){var n=Math.floor(r/4294967296),i=r;e.setUint32(t,n),e.setUint32(t+4,i)}function i(e,t){return 4294967296*e.getInt32(t)+e.getUint32(t+4)}var o=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a},a=function(e,t){for(var r=0,n=t.length,i=e.length;r<n;r++,i++)e[i]=t[r];return e},s="undefined"!=typeof TextEncoder&&"undefined"!=typeof TextDecoder;function u(e){for(var t=e.length,r=0,n=0;n<t;){var i=e.charCodeAt(n++);if(0!=(4294967168&i))if(0==(4294965248&i))r+=2;else{if(i>=55296&&i<=56319&&n<t){var o=e.charCodeAt(n);56320==(64512&o)&&(++n,i=((1023&i)<<10)+(1023&o)+65536)}r+=0==(4294901760&i)?3:4}else r++}return r}var d=s?new TextEncoder:void 0,l=s?void 0!==c?200:0:r,p=(null==d?void 0:d.encodeInto)?function(e,t,r){d.encodeInto(e,t.subarray(r))}:function(e,t,r){t.set(d.encode(e),r)};function f(e,t,r){for(var n=t,i=n+r,s=[],c="";n<i;){var u=e[n++];if(0==(128&u))s.push(u);else if(192==(224&u)){var d=63&e[n++];s.push((31&u)<<6|d)}else if(224==(240&u)){d=63&e[n++];var l=63&e[n++];s.push((31&u)<<12|d<<6|l)}else if(240==(248&u)){var p=(7&u)<<18|(d=63&e[n++])<<12|(l=63&e[n++])<<6|63&e[n++];p>65535&&(p-=65536,s.push(p>>>10&1023|55296),p=56320|1023&p),s.push(p)}else s.push(u);s.length>=4096&&(c+=String.fromCharCode.apply(String,a([],o(s))),s.length=0)}return s.length>0&&(c+=String.fromCharCode.apply(String,a([],o(s)))),c}var h,A=s?new TextDecoder:null,v=s?void 0!==c?200:0:r,g=function(e,t){this.type=e,this.data=t},m=(h=function(e){function t(t,r){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(e,t){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)})),function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),E=function(e){function t(r){var n=e.call(this,r)||this,i=Object.create(t.prototype);return Object.setPrototypeOf(n,i),Object.defineProperty(n,"name",{configurable:!0,enumerable:!1,value:t.name}),n}return m(t,e),t}(Error),_=-1;function y(e){var t,r=e.sec,i=e.nsec;if(r>=0&&i>=0&&r<=17179869183){if(0===i&&r<=4294967295){var o=new Uint8Array(4);return(t=new DataView(o.buffer)).setUint32(0,r),o}var a=r/4294967296,s=4294967295&r;return o=new Uint8Array(8),(t=new DataView(o.buffer)).setUint32(0,i<<2|3&a),t.setUint32(4,s),o}return o=new Uint8Array(12),(t=new DataView(o.buffer)).setUint32(0,i),n(t,4,r),o}function I(e){var t=e.getTime(),r=Math.floor(t/1e3),n=1e6*(t-1e3*r),i=Math.floor(n/1e9);return{sec:r+i,nsec:n-1e9*i}}function S(e){return e instanceof Date?y(I(e)):null}function b(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:var r=t.getUint32(0);return{sec:4294967296*(3&r)+t.getUint32(4),nsec:r>>>2};case 12:return{sec:i(t,4),nsec:t.getUint32(0)};default:throw new E("Unrecognized data size for timestamp (expected 4, 8, or 12): "+e.length)}}function C(e){var t=b(e);return new Date(1e3*t.sec+t.nsec/1e6)}var w={type:_,encode:S,decode:C},R=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(w)}return e.prototype.register=function(e){var t=e.type,r=e.encode,n=e.decode;if(t>=0)this.encoders[t]=r,this.decoders[t]=n;else{var i=1+t;this.builtInEncoders[i]=r,this.builtInDecoders[i]=n}},e.prototype.tryToEncode=function(e,t){for(var r=0;r<this.builtInEncoders.length;r++)if(null!=(n=this.builtInEncoders[r])&&null!=(i=n(e,t)))return new g(-1-r,i);for(r=0;r<this.encoders.length;r++){var n,i;if(null!=(n=this.encoders[r])&&null!=(i=n(e,t)))return new g(r,i)}return e instanceof g?e:null},e.prototype.decode=function(e,t,r){var n=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return n?n(e,t,r):new g(t,e)},e.defaultCodec=new e,e}();function T(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer?new Uint8Array(e):Uint8Array.from(e)}var k=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},O=function(){function e(e,t,r,n,i,o,a,s){void 0===e&&(e=R.defaultCodec),void 0===t&&(t=void 0),void 0===r&&(r=100),void 0===n&&(n=2048),void 0===i&&(i=!1),void 0===o&&(o=!1),void 0===a&&(a=!1),void 0===s&&(s=!1),this.extensionCodec=e,this.context=t,this.maxDepth=r,this.initialBufferSize=n,this.sortKeys=i,this.forceFloat32=o,this.ignoreUndefined=a,this.forceIntegerToFloat=s,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}return e.prototype.getUint8Array=function(){return this.bytes.subarray(0,this.pos)},e.prototype.reinitializeState=function(){this.pos=0},e.prototype.encode=function(e){return this.reinitializeState(),this.doEncode(e,1),this.getUint8Array()},e.prototype.doEncode=function(e,t){if(t>this.maxDepth)throw new Error("Too deep objects in depth "+t);null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.encodeObject(e,t)},e.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength<t&&this.resizeBuffer(2*t)},e.prototype.resizeBuffer=function(e){var t=new ArrayBuffer(e),r=new Uint8Array(t),n=new DataView(t);r.set(this.bytes),this.view=n,this.bytes=r},e.prototype.encodeNil=function(){this.writeU8(192)},e.prototype.encodeBoolean=function(e){!1===e?this.writeU8(194):this.writeU8(195)},e.prototype.encodeNumber=function(e){Number.isSafeInteger(e)&&!this.forceIntegerToFloat?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},e.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error("Too long string: "+e+" bytes in UTF-8");this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){if(e.length>l){var t=u(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),p(e,this.bytes,this.pos),this.pos+=t}else t=u(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,r){for(var n=e.length,i=r,o=0;o<n;){var a=e.charCodeAt(o++);if(0!=(4294967168&a)){if(0==(4294965248&a))t[i++]=a>>6&31|192;else{if(a>=55296&&a<=56319&&o<n){var s=e.charCodeAt(o);56320==(64512&s)&&(++o,a=((1023&a)<<10)+(1023&s)+65536)}0==(4294901760&a)?(t[i++]=a>>12&15|224,t[i++]=a>>6&63|128):(t[i++]=a>>18&7|240,t[i++]=a>>12&63|128,t[i++]=a>>6&63|128)}t[i++]=63&a|128}else t[i++]=a}}(e,this.bytes,this.pos),this.pos+=t},e.prototype.encodeObject=function(e,t){var r=this.extensionCodec.tryToEncode(e,this.context);if(null!=r)this.encodeExtension(r);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=D(e))throw new Error("Unrecognized object: "+Object.prototype.toString.apply(e));this.encodeMap(e,t)}},e.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large binary: "+t);this.writeU8(198),this.writeU32(t)}var r=T(e);this.writeU8a(r)},e.prototype.encodeArray=function(e,t){var r,n,i=e.length;if(i<16)this.writeU8(144+i);else if(i<65536)this.writeU8(220),this.writeU16(i);else{if(!(i<4294967296))throw new Error("Too large array: "+i);this.writeU8(221),this.writeU32(i)}try{for(var o=k(e),a=o.next();!a.done;a=o.next()){var s=a.value;this.doEncode(s,t+1)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},e.prototype.countWithoutUndefined=function(e,t){var r,n,i=0;try{for(var o=k(t),a=o.next();!a.done;a=o.next())void 0!==e[a.value]&&i++}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},e.prototype.encodeMap=function(e,t){var r,n,i=Object.keys(e);this.sortKeys&&i.sort();var o=this.ignoreUndefined?this.countWithoutUndefined(e,i):i.length;if(o<16)this.writeU8(128+o);else if(o<65536)this.writeU8(222),this.writeU16(o);else{if(!(o<4294967296))throw new Error("Too large map object: "+o);this.writeU8(223),this.writeU32(o)}try{for(var a=k(i),s=a.next();!s.done;s=a.next()){var c=s.value,u=e[c];this.ignoreUndefined&&void 0===u||(this.encodeString(c),this.doEncode(u,t+1))}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}},e.prototype.encodeExtension=function(e){var t=e.data.length;if(1===t)this.writeU8(212);else if(2===t)this.writeU8(213);else if(4===t)this.writeU8(214);else if(8===t)this.writeU8(215);else if(16===t)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large extension object: "+t);this.writeU8(201),this.writeU32(t)}this.writeI8(e.type),this.writeU8a(e.data)},e.prototype.writeU8=function(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++},e.prototype.writeU8a=function(e){var t=e.length;this.ensureBufferSizeToWrite(t),this.bytes.set(e,this.pos),this.pos+=t},e.prototype.writeI8=function(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++},e.prototype.writeU16=function(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2},e.prototype.writeI16=function(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2},e.prototype.writeU32=function(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4},e.prototype.writeI32=function(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4},e.prototype.writeF32=function(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4},e.prototype.writeF64=function(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8},e.prototype.writeU64=function(e){this.ensureBufferSizeToWrite(8),function(e,t,r){var n=r/4294967296,i=r;e.setUint32(t,n),e.setUint32(t+4,i)}(this.view,this.pos,e),this.pos+=8},e.prototype.writeI64=function(e){this.ensureBufferSizeToWrite(8),n(this.view,this.pos,e),this.pos+=8},e}(),N={};function x(e,t){return void 0===t&&(t=N),new O(t.extensionCodec,t.context,t.maxDepth,t.initialBufferSize,t.sortKeys,t.forceFloat32,t.ignoreUndefined,t.forceIntegerToFloat).encode(e)}function P(e){return(e<0?"-":"")+"0x"+Math.abs(e).toString(16).padStart(2,"0")}var L=function(){function e(e,t){void 0===e&&(e=16),void 0===t&&(t=16),this.maxKeyLength=e,this.maxLengthPerKey=t,this.hit=0,this.miss=0,this.caches=[];for(var r=0;r<this.maxKeyLength;r++)this.caches.push([])}return e.prototype.canBeCached=function(e){return e>0&&e<=this.maxKeyLength},e.prototype.find=function(e,t,r){var n,i,o=this.caches[r-1];try{e:for(var a=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(o),s=a.next();!s.done;s=a.next()){for(var c=s.value,u=c.bytes,d=0;d<r;d++)if(u[d]!==e[t+d])continue e;return c.str}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return null},e.prototype.store=function(e,t){var r=this.caches[e.length-1],n={bytes:e,str:t};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=n:r.push(n)},e.prototype.decode=function(e,t,r){var n=this.find(e,t,r);if(null!=n)return this.hit++,n;this.miss++;var i=f(e,t,r),o=Uint8Array.prototype.slice.call(e,t,t+r);return this.store(o,i),i},e}(),B=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},M=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise((function(n,i){!function(e,t,r,n){Promise.resolve(n).then((function(t){e({value:t,done:r})}),t)}(n,i,(t=e[r](t)).done,t.value)}))}}},U=function e(t){return this instanceof e?(this.v=t,this):new e(t)},Q=function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(e,t||[]),o=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(e){i[e]&&(n[e]=function(t){return new Promise((function(r,n){o.push([e,t,r,n])>1||s(e,t)}))})}function s(e,t){try{(r=i[e](t)).value instanceof U?Promise.resolve(r.value.v).then(c,u):d(o[0][2],r)}catch(e){d(o[0][3],e)}var r}function c(e){s("next",e)}function u(e){s("throw",e)}function d(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}},F=new DataView(new ArrayBuffer(0)),j=new Uint8Array(F.buffer),V=function(){try{F.getInt8(0)}catch(e){return e.constructor}throw new Error("never reached")}(),G=new V("Insufficient data"),K=new L,H=function(){function e(e,t,n,i,o,a,s,c){void 0===e&&(e=R.defaultCodec),void 0===t&&(t=void 0),void 0===n&&(n=r),void 0===i&&(i=r),void 0===o&&(o=r),void 0===a&&(a=r),void 0===s&&(s=r),void 0===c&&(c=K),this.extensionCodec=e,this.context=t,this.maxStrLength=n,this.maxBinLength=i,this.maxArrayLength=o,this.maxMapLength=a,this.maxExtLength=s,this.keyDecoder=c,this.totalPos=0,this.pos=0,this.view=F,this.bytes=j,this.headByte=-1,this.stack=[]}return e.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=-1,this.stack.length=0},e.prototype.setBuffer=function(e){this.bytes=T(e),this.view=function(e){if(e instanceof ArrayBuffer)return new DataView(e);var t=T(e);return new DataView(t.buffer,t.byteOffset,t.byteLength)}(this.bytes),this.pos=0},e.prototype.appendBuffer=function(e){if(-1!==this.headByte||this.hasRemaining(1)){var t=this.bytes.subarray(this.pos),r=T(e),n=new Uint8Array(t.length+r.length);n.set(t),n.set(r,t.length),this.setBuffer(n)}else this.setBuffer(e)},e.prototype.hasRemaining=function(e){return this.view.byteLength-this.pos>=e},e.prototype.createExtraByteError=function(e){var t=this.view,r=this.pos;return new RangeError("Extra "+(t.byteLength-r)+" of "+t.byteLength+" byte(s) found at buffer["+e+"]")},e.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},e.prototype.decodeMulti=function(e){return B(this,(function(t){switch(t.label){case 0:this.reinitializeState(),this.setBuffer(e),t.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))},e.prototype.decodeAsync=function(e){var t,r,n,i,o,a,s,c;return o=this,a=void 0,c=function(){var o,a,s,c,u,d,l,p;return B(this,(function(f){switch(f.label){case 0:o=!1,f.label=1;case 1:f.trys.push([1,6,7,12]),t=M(e),f.label=2;case 2:return[4,t.next()];case 3:if((r=f.sent()).done)return[3,5];if(s=r.value,o)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s);try{a=this.doDecodeSync(),o=!0}catch(e){if(!(e instanceof V))throw e}this.totalPos+=this.pos,f.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return c=f.sent(),n={error:c},[3,12];case 7:return f.trys.push([7,,10,11]),r&&!r.done&&(i=t.return)?[4,i.call(t)]:[3,9];case 8:f.sent(),f.label=9;case 9:return[3,11];case 10:if(n)throw n.error;return[7];case 11:return[7];case 12:if(o){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,a]}throw d=(u=this).headByte,l=u.pos,p=u.totalPos,new RangeError("Insufficient data in parsing "+P(d)+" at "+p+" ("+l+" in the current buffer)")}}))},new((s=void 0)||(s=Promise))((function(e,t){function r(e){try{i(c.next(e))}catch(e){t(e)}}function n(e){try{i(c.throw(e))}catch(e){t(e)}}function i(t){var i;t.done?e(t.value):(i=t.value,i instanceof s?i:new s((function(e){e(i)}))).then(r,n)}i((c=c.apply(o,a||[])).next())}))},e.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},e.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},e.prototype.decodeMultiAsync=function(e,t){return Q(this,arguments,(function(){var r,n,i,o,a,s,c,u,d;return B(this,(function(l){switch(l.label){case 0:r=t,n=-1,l.label=1;case 1:l.trys.push([1,13,14,19]),i=M(e),l.label=2;case 2:return[4,U(i.next())];case 3:if((o=l.sent()).done)return[3,12];if(a=o.value,t&&0===n)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a),r&&(n=this.readArraySize(),r=!1,this.complete()),l.label=4;case 4:l.trys.push([4,9,,10]),l.label=5;case 5:return[4,U(this.doDecodeSync())];case 6:return[4,l.sent()];case 7:return l.sent(),0==--n?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((s=l.sent())instanceof V))throw s;return[3,10];case 10:this.totalPos+=this.pos,l.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return c=l.sent(),u={error:c},[3,19];case 14:return l.trys.push([14,,17,18]),o&&!o.done&&(d=i.return)?[4,U(d.call(i))]:[3,16];case 15:l.sent(),l.label=16;case 16:return[3,18];case 17:if(u)throw u.error;return[7];case 18:return[7];case 19:return[2]}}))}))},e.prototype.doDecodeSync=function(){e:for(;;){var e=this.readHeadByte(),t=void 0;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){if(0!=(n=e-128)){this.pushMapState(n),this.complete();continue e}t={}}else if(e<160){if(0!=(n=e-144)){this.pushArrayState(n),this.complete();continue e}t=[]}else{var r=e-160;t=this.decodeUtf8String(r,0)}else if(192===e)t=null;else if(194===e)t=!1;else if(195===e)t=!0;else if(202===e)t=this.readF32();else if(203===e)t=this.readF64();else if(204===e)t=this.readU8();else if(205===e)t=this.readU16();else if(206===e)t=this.readU32();else if(207===e)t=this.readU64();else if(208===e)t=this.readI8();else if(209===e)t=this.readI16();else if(210===e)t=this.readI32();else if(211===e)t=this.readI64();else if(217===e)r=this.lookU8(),t=this.decodeUtf8String(r,1);else if(218===e)r=this.lookU16(),t=this.decodeUtf8String(r,2);else if(219===e)r=this.lookU32(),t=this.decodeUtf8String(r,4);else if(220===e){if(0!==(n=this.readU16())){this.pushArrayState(n),this.complete();continue e}t=[]}else if(221===e){if(0!==(n=this.readU32())){this.pushArrayState(n),this.complete();continue e}t=[]}else if(222===e){if(0!==(n=this.readU16())){this.pushMapState(n),this.complete();continue e}t={}}else if(223===e){if(0!==(n=this.readU32())){this.pushMapState(n),this.complete();continue e}t={}}else if(196===e){var n=this.lookU8();t=this.decodeBinary(n,1)}else if(197===e)n=this.lookU16(),t=this.decodeBinary(n,2);else if(198===e)n=this.lookU32(),t=this.decodeBinary(n,4);else if(212===e)t=this.decodeExtension(1,0);else if(213===e)t=this.decodeExtension(2,0);else if(214===e)t=this.decodeExtension(4,0);else if(215===e)t=this.decodeExtension(8,0);else if(216===e)t=this.decodeExtension(16,0);else if(199===e)n=this.lookU8(),t=this.decodeExtension(n,1);else if(200===e)n=this.lookU16(),t=this.decodeExtension(n,2);else{if(201!==e)throw new E("Unrecognized type byte: "+P(e));n=this.lookU32(),t=this.decodeExtension(n,4)}this.complete();for(var i=this.stack;i.length>0;){var o=i[i.length-1];if(0===o.type){if(o.array[o.position]=t,o.position++,o.position!==o.size)continue e;i.pop(),t=o.array}else{if(1===o.type){if("string"!=(a=D(t))&&"number"!==a)throw new E("The type of key must be string or number but "+D(t));if("__proto__"===t)throw new E("The key __proto__ is not allowed");o.key=t,o.type=2;continue e}if(o.map[o.key]=t,o.readCount++,o.readCount!==o.size){o.key=null,o.type=1;continue e}i.pop(),t=o.map}}return t}var a},e.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},e.prototype.complete=function(){this.headByte=-1},e.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new E("Unrecognized array type byte: "+P(e))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new E("Max length exceeded: map length ("+e+") > maxMapLengthLength ("+this.maxMapLength+")");this.stack.push({type:1,size:e,key:null,readCount:0,map:{}})},e.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new E("Max length exceeded: array length ("+e+") > maxArrayLength ("+this.maxArrayLength+")");this.stack.push({type:0,size:e,array:new Array(e),position:0})},e.prototype.decodeUtf8String=function(e,t){var r;if(e>this.maxStrLength)throw new E("Max length exceeded: UTF-8 byte length ("+e+") > maxStrLength ("+this.maxStrLength+")");if(this.bytes.byteLength<this.pos+t+e)throw G;var n,i=this.pos+t;return n=this.stateIsMapKey()&&(null===(r=this.keyDecoder)||void 0===r?void 0:r.canBeCached(e))?this.keyDecoder.decode(this.bytes,i,e):e>v?function(e,t,r){var n=e.subarray(t,t+r);return A.decode(n)}(this.bytes,i,e):f(this.bytes,i,e),this.pos+=t+e,n},e.prototype.stateIsMapKey=function(){return this.stack.length>0&&1===this.stack[this.stack.length-1].type},e.prototype.decodeBinary=function(e,t){if(e>this.maxBinLength)throw new E("Max length exceeded: bin length ("+e+") > maxBinLength ("+this.maxBinLength+")");if(!this.hasRemaining(e+t))throw G;var r=this.pos+t,n=this.bytes.subarray(r,r+e);return this.pos+=t+e,n},e.prototype.decodeExtension=function(e,t){if(e>this.maxExtLength)throw new E("Max length exceeded: ext length ("+e+") > maxExtLength ("+this.maxExtLength+")");var r=this.view.getInt8(this.pos+t),n=this.decodeBinary(e,t+1);return this.extensionCodec.decode(n,r,this.context)},e.prototype.lookU8=function(){return this.view.getUint8(this.pos)},e.prototype.lookU16=function(){return this.view.getUint16(this.pos)},e.prototype.lookU32=function(){return this.view.getUint32(this.pos)},e.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},e.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},e.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},e.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},e.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},e.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},e.prototype.readU64=function(){var e,t,r=(e=this.view,t=this.pos,4294967296*e.getUint32(t)+e.getUint32(t+4));return this.pos+=8,r},e.prototype.readI64=function(){var e=i(this.view,this.pos);return this.pos+=8,e},e.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},e.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},e}(),W={};function Y(e,t){return void 0===t&&(t=W),new H(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decode(e)}function q(e,t){return void 0===t&&(t=W),new H(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeMulti(e)}var J=function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},z=function e(t){return this instanceof e?(this.v=t,this):new e(t)},X=function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(e,t||[]),o=[];return n={},a("next"),a("throw"),a("return"),n[Symbol.asyncIterator]=function(){return this},n;function a(e){i[e]&&(n[e]=function(t){return new Promise((function(r,n){o.push([e,t,r,n])>1||s(e,t)}))})}function s(e,t){try{(r=i[e](t)).value instanceof z?Promise.resolve(r.value.v).then(c,u):d(o[0][2],r)}catch(e){d(o[0][3],e)}var r}function c(e){s("next",e)}function u(e){s("throw",e)}function d(e,t){e(t),o.shift(),o.length&&s(o[0][0],o[0][1])}};function Z(e){if(null==e)throw new Error("Assertion Failure: value must not be null nor undefined")}function $(e){return null!=e[Symbol.asyncIterator]?e:function(e){return X(this,arguments,(function(){var t,r,n,i;return J(this,(function(o){switch(o.label){case 0:t=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,z(t.read())];case 3:return r=o.sent(),n=r.done,i=r.value,n?[4,z(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return Z(i),[4,z(i)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}(e)}function ee(e,t){return void 0===t&&(t=W),r=this,n=void 0,o=function(){var r;return function(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}(this,(function(n){return r=$(e),[2,new H(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeAsync(r)]}))},new((i=void 0)||(i=Promise))((function(e,t){function a(e){try{c(o.next(e))}catch(e){t(e)}}function s(e){try{c(o.throw(e))}catch(e){t(e)}}function c(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(a,s)}c((o=o.apply(r,n||[])).next())}));var r,n,i,o}function te(e,t){void 0===t&&(t=W);var r=$(e);return new H(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeArrayStream(r)}function re(e,t){void 0===t&&(t=W);var r=$(e);return new H(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeStream(r)}function ne(e,t){return void 0===t&&(t=W),re(e,t)}return t}()}(fq),(0,YB.exports)("Int8",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,YB.exports)("Int16",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,YB.exports)("Int32",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,YB.exports)("Uint16",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,YB.exports)("Uint32",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,YB.exports)("Float32",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,YB.exports)("Float64",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var hq,Aq,vq=function(){return function(e){var t=window.atob(e).split("").map((function(e){return e.charCodeAt(0)}));return new Uint8Array(t,0,t.length/Uint8Array.BYTES_PER_ELEMENT)}("AGFzbQEAAAABMAlgA39/fwF/YAF/AGACf38AYAF/AX9gAn9/AX9gA39/fwBgBH9/f38AYAABf2AAAAI6AgNlbnYWZW1zY3JpcHRlbl9yZXNpemVfaGVhcAADA2VudhVlbXNjcmlwdGVuX21lbWNweV9iaWcAAAMjIggAAAAAAQEDAQEEBAQEAQEGAQYCBQUAAgAHAwEDAAIHAQMEBQFwAQYGBQYBAYACgAIGCQF/AUHQ48ACCweUAQoGbWVtb3J5AgARX193YXNtX2NhbGxfY3RvcnMAAhlfX2luZGlyZWN0X2Z1bmN0aW9uX3RhYmxlAQAGbWFsbG9jABwEZnJlZQAdEF9fZXJybm9fbG9jYXRpb24AGwx6bGliQ29tcHJlc3MAGglzdGFja1NhdmUAIQxzdGFja1Jlc3RvcmUAIgpzdGFja0FsbG9jACMJCwEAQQELBRgZDA0PCq6FAiIDAAELpQcBBH8gAEH//wNxIQMgAEEQdiEEQQEhACACQQFGBEAgAyABLQAAaiIAQfH/A2sgACAAQfD/A0sbIgAgBGoiA0EQdCIEQYCAPGogBCADQfD/A0sbIAByDwsgAQR/IAJBEE8EQAJAAkACQCACQa8rSwRAA0AgAkGwK2shAkHbAiEFIAEhAANAIAMgAC0AAGoiAyAEaiADIAAtAAFqIgNqIAMgAC0AAmoiA2ogAyAALQADaiIDaiADIAAtAARqIgNqIAMgAC0ABWoiA2ogAyAALQAGaiIDaiADIAAtAAdqIgNqIAMgAC0ACGoiA2ogAyAALQAJaiIDaiADIAAtAApqIgNqIAMgAC0AC2oiA2ogAyAALQAMaiIDaiADIAAtAA1qIgNqIAMgAC0ADmoiA2ogAyAALQAPaiIDaiEEIABBEGohACAFQQFrIgUNAAsgBEHx/wNwIQQgA0Hx/wNwIQMgAUGwK2ohASACQa8rSw0ACyACRQ0DIAJBEEkNAQsDQCADIAEtAABqIgAgBGogACABLQABaiIAaiAAIAEtAAJqIgBqIAAgAS0AA2oiAGogACABLQAEaiIAaiAAIAEtAAVqIgBqIAAgAS0ABmoiAGogACABLQAHaiIAaiAAIAEtAAhqIgBqIAAgAS0ACWoiAGogACABLQAKaiIAaiAAIAEtAAtqIgBqIAAgAS0ADGoiAGogACABLQANaiIAaiAAIAEtAA5qIgBqIAAgAS0AD2oiA2ohBCABQRBqIQEgAkEQayICQQ9LDQALIAJFDQELIAJBAWshBiACQQNxIgUEQCABIQADQCACQQFrIQIgAyAALQAAaiIDIARqIQQgAEEBaiIBIQAgBUEBayIFDQALCyAGQQNJDQADQCADIAEtAABqIgAgAS0AAWoiBSABLQACaiIGIAEtAANqIgMgBiAFIAAgBGpqamohBCABQQRqIQEgAkEEayICDQALCyAEQfH/A3AhBCADQfH/A3AhAwsgBEEQdCADcg8LAkAgAkUNACACQQFrIQYgAkEDcSIFBEAgASEAA0AgAkEBayECIAMgAC0AAGoiAyAEaiEEIABBAWoiASEAIAVBAWsiBQ0ACwsgBkEDSQ0AA0AgAyABLQAAaiIAIAEtAAFqIgUgAS0AAmoiBiABLQADaiIDIAYgBSAAIARqampqIQQgAUEEaiEBIAJBBGsiAg0ACwsgBEHx/wNwQRB0IANB8f8DayADIANB8P8DSxtyBSAACwsKACAAIAEgAhADC4UJAQJ/IAFFBEBBAA8LIABBf3MhAAJAIAJFDQAgAUEDcUUNACABLQAAIABB/wFxc0ECdEGACGooAgAgAEEIdnMhACACQQFrIgRBACABQQFqIgNBA3EbRQRAIAMhASAEIQIMAQsgAS0AASAAQf8BcXNBAnRBgAhqKAIAIABBCHZzIQAgAUECaiEDAkAgAkECayIERQ0AIANBA3FFDQAgAS0AAiAAQf8BcXNBAnRBgAhqKAIAIABBCHZzIQAgAUEDaiEDAkAgAkEDayIERQ0AIANBA3FFDQAgAS0AAyAAQf8BcXNBAnRBgAhqKAIAIABBCHZzIQAgAkEEayECIAFBBGohAQwCCyADIQEgBCECDAELIAMhASAEIQILIAJBH0sEQANAIAEoAhwgASgCGCABKAIUIAEoAhAgASgCDCABKAIIIAEoAgQgASgCACAAcyIAQQZ2QfwHcUGAGGooAgAgAEH/AXFBAnRBgCBqKAIAcyAAQQ52QfwHcUGAEGooAgBzIABBFnZB/AdxQYAIaigCAHNzIgBBBnZB/AdxQYAYaigCACAAQf8BcUECdEGAIGooAgBzIABBDnZB/AdxQYAQaigCAHMgAEEWdkH8B3FBgAhqKAIAc3MiAEEGdkH8B3FBgBhqKAIAIABB/wFxQQJ0QYAgaigCAHMgAEEOdkH8B3FBgBBqKAIAcyAAQRZ2QfwHcUGACGooAgBzcyIAQQZ2QfwHcUGAGGooAgAgAEH/AXFBAnRBgCBqKAIAcyAAQQ52QfwHcUGAEGooAgBzIABBFnZB/AdxQYAIaigCAHNzIgBBBnZB/AdxQYAYaigCACAAQf8BcUECdEGAIGooAgBzIABBDnZB/AdxQYAQaigCAHMgAEEWdkH8B3FBgAhqKAIAc3MiAEEGdkH8B3FBgBhqKAIAIABB/wFxQQJ0QYAgaigCAHMgAEEOdkH8B3FBgBBqKAIAcyAAQRZ2QfwHcUGACGooAgBzcyIAQQZ2QfwHcUGAGGooAgAgAEH/AXFBAnRBgCBqKAIAcyAAQQ52QfwHcUGAEGooAgBzIABBFnZB/AdxQYAIaigCAHNzIgBBBnZB/AdxQYAYaigCACAAQf8BcUECdEGAIGooAgBzIABBDnZB/AdxQYAQaigCAHMgAEEWdkH8B3FBgAhqKAIAcyEAIAFBIGohASACQSBrIgJBH0sNAAsLIAJBA0sEQANAIAEoAgAgAHMiAEEGdkH8B3FBgBhqKAIAIABB/wFxQQJ0QYAgaigCAHMgAEEOdkH8B3FBgBBqKAIAcyAAQRZ2QfwHcUGACGooAgBzIQAgAUEEaiEBIAJBBGsiAkEDSw0ACwsCQCACRQ0AIAJBAXEEfyABLQAAIABB/wFxc0ECdEGACGooAgAgAEEIdnMhACABQQFqIQEgAkEBawUgAgshAyACQQFGDQADQCABLQABIAEtAAAgAEH/AXFzQQJ0QYAIaigCACAAQQh2cyIAQf8BcXNBAnRBgAhqKAIAIABBCHZzIQAgAUECaiEBIANBAmsiAw0ACwsgAEF/cwsKACAAIAEgAhAFC9wEAQN/AkBByN8ALQAAQTFHDQAgAEUNACAAQQA2AhggACgCICIBRQRAIABBADYCKCAAQQE2AiBBASEBCyAAKAIkRQRAIABBAjYCJAsgACgCKEEBQcQtIAERAAAiAUUNACAAIAE2AhwgAUEPNgIwIAFBADYCHCABQQA2AhggAUEqNgIEIAEgADYCACABQQs2AlAgAUGAgAI2AiwgAUH//wE2AjQgAUGAEDYCTCABQQQ2AlggAUH/DzYCVCABIAAoAihBgIACQQIgACgCIBEAADYCOCABIAAoAiggASgCLEECIAAoAiARAAA2AkAgACgCKCABKAJMQQIgACgCIBEAACECIAFBADYCwC0gASACNgJEIAFBgAg2ApwtIAEgACgCKEGACEEEIAAoAiARAAAiAjYCCCABIAEoApwtIgNBAnQ2AgwCQAJAIAEoAjhFDQAgASgCQEUNACACRQ0AIAEoAkQNAQsgAUGaBTYCBCAAQbjfACgCADYCGCAAEAgPCyABQQA2AogBIAFBCTYChAEgAUEIOgAkIAEgAiADQQNsajYCmC0gASACIANBfnFqNgKkLSAAEAkNACAAKAIcIgAgACgCLEEBdDYCPCAAKAJEIgEgACgCTEEBdEECayIDakEAOwEAIAEgAxAgIABBADYCtC0gAEKAgICAIDcCdCAAQgA3AmggAEKAgICAIDcCXCAAQQA2AkggACAAKAKEAUEMbCIBQYTIAGovAQA2ApABIAAgAUGAyABqLwEANgKMASAAIAFBgsgAai8BADYCgAEgACABQYbIAGovAQA2AnwLC6kCAQN/AkAgAEUNACAAKAIgRQ0AIAAoAiQiA0UNACAAKAIcIgFFDQAgASgCACAARw0AAkACQCABKAIEIgJBOWsOOQECAgICAgICAgICAgECAgIBAgICAgICAgICAgICAgICAgIBAgICAgICAgICAgIBAgICAgICAgICAQALIAJBmgVGDQAgAkEqRw0BCwJ/An8CfyABKAIIIgIEQCAAKAIoIAIgAxECACAAKAIcIQELIAEoAkQiAgsEQCAAKAIoIAIgACgCJBECACAAKAIcIQELIAEoAkAiAgsEQCAAKAIoIAIgACgCJBECACAAKAIcIQELIAEoAjgiAgsEQCAAKAIoIAIgACgCJBECACAAKAIcIQELIAAoAiggASAAKAIkEQIAIABBADYCHAsLlgIBA39BfiECAkAgAEUNACAAKAIgRQ0AIAAoAiRFDQAgACgCHCIBRQ0AIAEoAgAgAEcNAAJAAkAgASgCBCIDQTlrDjkBAgICAgICAgICAgIBAgICAQICAgICAgICAgICAgICAgICAQICAgICAgICAgICAQICAgICAgICAgEACyADQZoFRg0AIANBKkcNAQsgAEECNgIsIABBADYCCCAAQgA3AhQgAUEANgIUIAEgASgCCDYCECABKAIYIgJBf0wEQCABQQAgAmsiAjYCGAsgAUE5QSpB8QAgAhsgAkECRhs2AgQgAAJ/IAJBAkYEQEEAQQBBABAGDAELQQBBAEEAEAQLNgIwQQAhAiABQQA2AiggARAQCyACC9wIAQt/IAAoAiwiB0GGAmshCyAAKAJ0IQUgByEBA0AgACgCPCAFayAAKAJsIghrIQYgASALaiAITQRAIAAoAjgiASABIAdqIAcgBmsQHxogACAAKAJwIAdrNgJwIAAgACgCbCAHayIINgJsIAAgACgCXCAHazYCXCAAKAJMIgRBAWshCiAAKAJEIARBAXRqIQMgACgCLCEBIARBA3EiAgRAA0AgA0ECayIDQQAgAy8BACIFIAFrIgkgBSAJSRs7AQAgBEEBayEEIAJBAWsiAg0ACwsgCkEDTwRAA0AgA0ECayICQQAgAi8BACICIAFrIgUgAiAFSRs7AQAgA0EEayICQQAgAi8BACICIAFrIgUgAiAFSRs7AQAgA0EGayICQQAgAi8BACICIAFrIgUgAiAFSRs7AQAgA0EIayIDQQAgAy8BACICIAFrIgUgAiAFSRs7AQAgBEEEayIEDQALCyABQQFrIQogACgCQCABQQF0aiEDIAEhBCABQQNxIgIEQANAIANBAmsiA0EAIAMvAQAiBSABayIJIAUgCUkbOwEAIARBAWshBCACQQFrIgINAAsLIApBA08EQANAIANBAmsiAkEAIAIvAQAiAiABayIFIAIgBUkbOwEAIANBBGsiAkEAIAIvAQAiAiABayIFIAIgBUkbOwEAIANBBmsiAkEAIAIvAQAiAiABayIFIAIgBUkbOwEAIANBCGsiA0EAIAMvAQAiAiABayIFIAIgBUkbOwEAIARBBGsiBA0ACwsgBiAHaiEGCwJAIAAoAgAiASgCBCIERQ0AIAAoAnQhAiAGIAQgBCAGSxsiAwRAIAAoAjghBSABIAQgA2s2AgQgBSAIaiACaiABKAIAIAMQHyEEAkACQAJAIAEoAhwoAhhBAWsOAgABAgsgASABKAIwIAQgAxAENgIwDAELIAEgASgCMCAEIAMQBjYCMAsgASABKAIAIANqNgIAIAEgASgCCCADajYCCCAAKAJ0IQILIAAgAiADaiIFNgJ0AkAgACgCtC0iAyAFakEDSQ0AIAAgACgCOCIJIAAoAmwgA2siAWoiBC0AACICNgJIIAAgACgCVCIIIAQtAAEgAiAAKAJYIgZ0c3EiBDYCSANAIANFDQEgACABIAlqLQACIAQgBnRzIAhxIgQ2AkggACgCQCAAKAI0IAFxQQF0aiAAKAJEIARBAXRqIgIvAQA7AQAgAiABOwEAIAAgA0EBayIDNgK0LSABQQFqIQEgAyAFakECSw0ACwsgBUGFAksNACAAKAIAKAIERQ0AIAAoAiwhAQwBCwsCQCAAKAI8IgQgACgCwC0iAU0NACAAKAJ0IAAoAmxqIgMgAUsEQCAAKAI4IANqIAQgA2siAUGCAiABQYICSRsiARAgIAAgASADajYCwC0PCyADQYICaiIDIAFNDQAgACgCOCABaiAEIAFrIgQgAyABayIBIAEgBEsbIgEQICAAIAAoAsAtIAFqNgLALQsLsSwBCn8CQCAARQ0AIAAoAiBFDQAgACgCJEUNACAAKAIcIgFFDQAgASgCACAARw0AAkACQCABKAIEIgNBOWsOOQECAgICAgICAgICAgECAgIBAgICAgICAgICAgICAgICAgIBAgICAgICAgICAgIBAgICAgICAgICAQALIANBmgVGDQAgA0EqRw0BCwJAAkAgACgCDEUNACAAKAIEIgIEQCAAKAIARQ0BCyADQZoFRw0BCyAAQbDfACgCADYCGA8LIAAoAhBFBEAgAEG83wAoAgA2AhgPCyABKAIoIQUgAUEDNgIoAkAgASgCFARAIAEQEwJAIAAoAhAiAyABKAIUIgQgAyAESRsiAkUNACAAKAIMIAEoAhAgAhAfGiAAIAAoAgwgAmo2AgwgASABKAIQIAJqNgIQIAAgACgCFCACajYCFCAAIAAoAhAgAmsiAzYCECABIAEoAhQgAmsiBDYCFCAEDQAgASABKAIINgIQQQAhBAsgAwRAIAEoAgQhAwwCCyABQX82AigPCyACDQAgBUEBdEF3QQAgBUEEShtqQQZIDQAgAEG83wAoAgA2AhgPCwJAAkACQAJAAn8CQAJAAkACQAJAAkAgA0EqRwRAIANBmgVHDQEgACgCBEUNAiAAQbzfACgCADYCGA8LIAEoAjBBDHRBgPABayEDQQAhAgJAIAEoAogBQQFKDQAgASgChAEiBUECSA0AQcAAIQIgBUEGSA0AQYABQcABIAVBBkYbIQILIAEgBEEBajYCFCABKAIIIARqIAIgA3IiAkEgciACIAEoAmwbIgJBCHY6AAAgASABKAIUIgNBAWo2AhQgAyABKAIIaiACQR9wIAJyQR9zOgAAIAEoAmwEQCAAKAIwIQIgASABKAIUIgNBAWo2AhQgAyABKAIIaiACQRh2OgAAIAEgASgCFCIDQQFqNgIUIAMgASgCCGogAkEQdjoAACAAKAIwIQIgASABKAIUIgNBAWo2AhQgAyABKAIIaiACQQh2OgAAIAEgASgCFCIDQQFqNgIUIAMgASgCCGogAjoAAAsgAEEAQQBBABAENgIwIAFB8QA2AgQgACgCHCICEBMCQCAAKAIQIgMgAigCFCIEIAMgBEkbIgNFDQAgACgCDCACKAIQIAMQHxogACAAKAIMIANqNgIMIAIgAigCECADajYCECAAIAAoAhQgA2o2AhQgACAAKAIQIANrNgIQIAIgAigCFCADayIDNgIUIAMNACACIAIoAgg2AhALIAEoAhQNBCABKAIEIQMLAkACQAJAAkACQAJAAkAgA0E5RgR/IABBAEEAQQAQBjYCMCABIAEoAhQiAkEBajYCFCACIAEoAghqQR86AAAgASABKAIUIgJBAWo2AhQgAiABKAIIakGLAToAACABIAEoAhQiAkEBajYCFCACIAEoAghqQQg6AAAgASgCHCICDQIgASABKAIUIgJBAWo2AhQgAiABKAIIakEAOgAAIAEgASgCFCICQQFqNgIUIAIgASgCCGpBADoAACABIAEoAhQiAkEBajYCFCACIAEoAghqQQA6AAAgASABKAIUIgJBAWo2AhQgAiABKAIIakEAOgAAIAEgASgCFCICQQFqNgIUIAIgASgCCGpBADoAAEECIQIgASgChAEiA0EJRwRAQQQgASgCiAFBAUpBAnQgA0ECSBshAgsgASABKAIUIgNBAWo2AhQgAyABKAIIaiACOgAAIAEgASgCFCICQQFqNgIUIAIgASgCCGpBAzoAACABQfEANgIEIAAoAhwiAhATAkAgACgCECIDIAIoAhQiBCADIARJGyIDRQ0AIAAoAgwgAigCECADEB8aIAAgACgCDCADajYCDCACIAIoAhAgA2o2AhAgACAAKAIUIANqNgIUIAAgACgCECADazYCECACIAIoAhQgA2siAzYCFCADDQAgAiACKAIINgIQCyABKAIUDQEgASgCBAUgAwtBxQBrDiMCBgYGAwYGBgYGBgYGBgYGBgYGBgYGBAYGBgYGBgYGBgYGBQYLIAFBfzYCKA8LIAIoAiQhAyACKAIcIQQgAigCECEFIAIoAiwhBiACKAIAIQggASABKAIUIgdBAWo2AhRBAiECIAcgASgCCGogBkEAR0EBdCAIQQBHciAFQQBHQQJ0ciAEQQBHQQN0ciADQQBHQQR0cjoAACABKAIcKAIEIQMgASABKAIUIgRBAWo2AhQgBCABKAIIaiADOgAAIAEoAhwoAgQhAyABIAEoAhQiBEEBajYCFCAEIAEoAghqIANBCHY6AAAgASgCHC8BBiEDIAEgASgCFCIEQQFqNgIUIAQgASgCCGogAzoAACABKAIcLQAHIQMgASABKAIUIgRBAWo2AhQgBCABKAIIaiADOgAAIAEoAoQBIgNBCUcEQEEEIAEoAogBQQFKQQJ0IANBAkgbIQILIAEgASgCFCIDQQFqNgIUIAMgASgCCGogAjoAACABKAIcKAIMIQIgASABKAIUIgNBAWo2AhQgAyABKAIIaiACOgAAIAEoAhwiAigCEAR/IAIoAhQhAiABIAEoAhQiA0EBajYCFCADIAEoAghqIAI6AAAgASgCHCgCFCECIAEgASgCFCIDQQFqNgIUIAMgASgCCGogAkEIdjoAACABKAIcBSACCygCLARAIAAgACgCMCABKAIIIAEoAhQQBjYCMAsgAUHFADYCBCABQQA2AiALIAEoAhwiBCgCECIDBEAgASgCFCICIAQvARQgASgCICIGayIFaiABKAIMIgRLBEADQCABKAIIIAJqIAMgBmogBCACayIEEB8aIAEgASgCDCIDNgIUAkAgAiADTw0AIAEoAhwoAixFDQAgACAAKAIwIAEoAgggAmogAyACaxAGNgIwCyABIAEoAiAgBGo2AiAgACgCHCICEBMCQCAAKAIQIgMgAigCFCIGIAMgBkkbIgNFDQAgACgCDCACKAIQIAMQHxogACAAKAIMIANqNgIMIAIgAigCECADajYCECAAIAAoAhQgA2o2AhQgACAAKAIQIANrNgIQIAIgAigCFCADayIDNgIUIAMNACACIAIoAgg2AhALIAEoAhQEQCABQX82AigPCyABKAIgIQYgASgCHCgCECEDQQAhAiAFIARrIgUgASgCDCIESw0ACwsgASgCCCACaiADIAZqIAUQHxogASABKAIUIAVqIgM2AhQCQCACIANPDQAgASgCHCgCLEUNACAAIAAoAjAgASgCCCACaiADIAJrEAY2AjALIAFBADYCIAsgAUHJADYCBAsgASgCHCgCHARAIAEoAhQiAiEFA0ACQCACIAEoAgxHDQACQCACIAVNDQAgASgCHCgCLEUNACAAIAAoAjAgASgCCCAFaiACIAVrEAY2AjALIAAoAhwiAhATAkAgACgCECIDIAIoAhQiBCADIARJGyIDRQ0AIAAoAgwgAigCECADEB8aIAAgACgCDCADajYCDCACIAIoAhAgA2o2AhAgACAAKAIUIANqNgIUIAAgACgCECADazYCECACIAIoAhQgA2siAzYCFCADDQAgAiACKAIINgIQC0EAIQJBACEFIAEoAhRFDQAgAUF/NgIoDwsgASgCHCgCHCEDIAEgASgCICIEQQFqNgIgIAMgBGotAAAhAyABIAJBAWo2AhQgASgCCCACaiADOgAAIAMEQCABKAIUIQIMAQsLAkAgASgCHCgCLEUNACABKAIUIgIgBU0NACAAIAAoAjAgASgCCCAFaiACIAVrEAY2AjALIAFBADYCIAsgAUHbADYCBAsCQCABKAIcKAIkRQ0AIAEoAhQiAiEFA0ACQCACIAEoAgxHDQACQCACIAVNDQAgASgCHCgCLEUNACAAIAAoAjAgASgCCCAFaiACIAVrEAY2AjALIAAoAhwiAhATAkAgACgCECIDIAIoAhQiBCADIARJGyIDRQ0AIAAoAgwgAigCECADEB8aIAAgACgCDCADajYCDCACIAIoAhAgA2o2AhAgACAAKAIUIANqNgIUIAAgACgCECADazYCECACIAIoAhQgA2siAzYCFCADDQAgAiACKAIINgIQC0EAIQJBACEFIAEoAhRFDQAgAUF/NgIoDwsgASgCHCgCJCEDIAEgASgCICIEQQFqNgIgIAMgBGotAAAhAyABIAJBAWo2AhQgASgCCCACaiADOgAAIAMEQCABKAIUIQIMAQsLIAEoAhwoAixFDQAgASgCFCICIAVNDQAgACAAKAIwIAEoAgggBWogAiAFaxAGNgIwCyABQecANgIECyABKAIcKAIsBEAgASgCDCABKAIUIgJBAmpJBEAgACgCHCICEBMCQCAAKAIQIgMgAigCFCIEIAMgBEkbIgNFDQAgACgCDCACKAIQIAMQHxogACAAKAIMIANqNgIMIAIgAigCECADajYCECAAIAAoAhQgA2o2AhQgACAAKAIQIANrNgIQIAIgAigCFCADayIDNgIUIAMNACACIAIoAgg2AhALIAEoAhQNBUEAIQILIAAoAjAhAyABIAJBAWo2AhQgASgCCCACaiADOgAAIAAoAjAhAiABIAEoAhQiA0EBajYCFCADIAEoAghqIAJBCHY6AAAgAEEAQQBBABAGNgIwCyABQfEANgIEIAAoAhwiAhATAkAgACgCECIDIAIoAhQiBCADIARJGyIDRQ0AIAAoAgwgAigCECADEB8aIAAgACgCDCADajYCDCACIAIoAhAgA2o2AhAgACAAKAIUIANqNgIUIAAgACgCECADazYCECACIAIoAhQgA2siAzYCFCADDQAgAiACKAIINgIQCyABKAIURQ0AIAFBfzYCKA8LIAAoAgQNAQsgASgCdA0AIAEoAgRBmgVGDQgLIAEoAoQBIgJFBEAgAUEDEAwMBAsCQAJAIAEoAogBQQJrDgIAAQQLA0ACQAJAIAEoAnQNACABEAogASgCdA0AIAFBADYCtC0MAQsgAUEANgJgIAEoAjggASgCbGotAAAhAiABKAKkLSABKAKgLSIDQQF0akEAOwEAIAEgA0EBajYCoC0gAyABKAKYLWogAjoAACABIAJBAnRqQZQBaiICIAIvAQBBAWo7AQAgASABKAJ0QQFrNgJ0IAEgASgCbEEBaiICNgJsIAEoAqAtIAEoApwtQQFrRw0BIAEgASgCXCIEQQBOBH8gASgCOCAEagVBAAsgAiAEa0EAEBQgASABKAJsNgJcIAEoAgAiAigCHCIDEBMCQCACKAIQIgQgAygCFCIFIAQgBUkbIgRFDQAgAigCDCADKAIQIAQQHxogAiACKAIMIARqNgIMIAMgAygCECAEajYCECACIAIoAhQgBGo2AhQgAiACKAIQIARrNgIQIAMgAygCFCAEayICNgIUIAINACADIAMoAgg2AhALIAEoAgAoAhANAQwHCwsgASgCoC1FDQcgASABKAJcIgNBAE4EfyABKAI4IANqBUEACyABKAJsIANrQQAQFCABIAEoAmw2AlwgASgCACICKAIcIgMQEwJAIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgASgCACgCEEUNBQwHCwNAAkACQAJAIAEoAnQiAkGDAk8EQCABQQA2AmAMAQsgARAKIAEoAnQiAgRAIAFBADYCYCACQQJLDQEgASgCbCEDDAILIAFBADYCtC0gASgCoC1FDQogASABKAJcIgNBAE4EfyABKAI4IANqBUEACyABKAJsIANrQQAQFCABIAEoAmw2AlwgASgCACICKAIcIgMQEwJAIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgASgCACgCEEUNCAwKCyABKAJsIgNFBEBBACEDDAELIAEoAjggA2oiBkEBayIFLQAAIgQgBi0AAEcNACAEIAUtAAJHDQAgBCAFLQADRw0AIAZBggJqIQlBfyEIAkACQAJAAkACQAJAA0AgBiAIaiIFLQAEIARGBEAgBCAFLQAFRw0CIAQgBS0ABkcNAyAEIAUtAAdHDQQgBCAGIAhBCGoiCmoiBy0AAEcNByAEIAUtAAlHDQUgBCAFLQAKRw0GIAVBC2ohByAIQfYBSg0HIAohCCAEIActAABGDQEMBwsLIAVBBGohBwwFCyAFQQVqIQcMBAsgBUEGaiEHDAMLIAVBB2ohBwwCCyAFQQlqIQcMAQsgBUEKaiEHCyABIAIgByAJa0GCAmoiBCACIARJGyICNgJgIAJBA0kNACABKAKkLSABKAKgLSIDQQF0akEBOwEAIAEgA0EBajYCoC0gAyABKAKYLWogAkEDayICOgAAIAJB/wFxQYDNAGotAABBAnQgAWpBmAlqIgIgAi8BAEEBajsBACABQYDJAC0AAEECdGpBiBNqIgIgAi8BAEEBajsBACABKAJgIQIgAUEANgJgIAEgASgCdCACazYCdCABIAIgASgCbGoiAjYCbCABKAKgLSABKAKcLUEBa0cNAgwBCyABKAI4IANqLQAAIQIgASgCpC0gASgCoC0iA0EBdGpBADsBACABIANBAWo2AqAtIAMgASgCmC1qIAI6AAAgASACQQJ0akGUAWoiAiACLwEAQQFqOwEAIAEgASgCdEEBazYCdCABIAEoAmxBAWoiAjYCbCABKAKgLSABKAKcLUEBa0cNAQsgASABKAJcIgRBAE4EfyABKAI4IARqBUEACyACIARrQQAQFCABIAEoAmw2AlwgASgCACICKAIcIgMQEwJAIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgASgCACgCEA0ACwwECyABQX82AigPCyABQX82AigPCyABQQMgAkEMbEGIyABqKAIAEQQACyICQX5xQQJGBEAgAUGaBTYCBAsgAkF9cQ0BCyAAKAIQDQMgAUF/NgIoDwsgAkEBRw0BCyABQQBBAEEAEBIgASgCRCICIAEoAkxBAXRBAmsiA2pBADsBACACIAMQICABKAJ0RQRAIAFBADYCtC0gAUEANgJcIAFBADYCbAsgACgCHCICEBMCQCAAKAIQIgQgAigCFCIDIAMgBEsbIgNFDQAgACgCDCACKAIQIAMQHxogACAAKAIMIANqNgIMIAIgAigCECADajYCECAAIAAoAhQgA2o2AhQgACAAKAIQIANrIgQ2AhAgAiACKAIUIANrIgM2AhQgAw0AIAIgAigCCDYCEAsgBA0AIAFBfzYCKAsLC7YNAQt/IAAoAgAiBCgCBCEJQQEhCAJAIAQoAhAiAyAAKAK8LUEqakEDdSICSQ0AIAAoAiwiBSAAKAIMQQVrIgYgBSAGSRshCiABQQRHIQsDQCAKIAMgAmsiAyAAKAJsIAAoAlxrIgYgBCgCBGoiAkH//wMgAkH//wNJGyIFIAMgBUkbIgNLBEAgAiADRw0CIAFFDQIgCyADRXENAgsgAEEAQQAgAUEERiACIANGcSIHEBIgACgCFCAAKAIIakEEayADOgAAIAAoAhQgACgCCGpBA2sgA0EIdjoAACAAKAIUIAAoAghqQQJrIANBf3MiAjoAACAAKAIUIAAoAghqQQFrIAJBCHY6AAAgACgCACICKAIcIgQQEwJAIAIoAhAiBSAEKAIUIgwgBSAMSRsiBUUNACACKAIMIAQoAhAgBRAfGiACIAIoAgwgBWo2AgwgBCAEKAIQIAVqNgIQIAIgAigCFCAFajYCFCACIAIoAhAgBWs2AhAgBCAEKAIUIAVrIgI2AhQgAg0AIAQgBCgCCDYCEAsCfyAGBEAgACgCACgCDCAAKAI4IAAoAlxqIAMgBiADIAZJGyICEB8aIAAoAgAiBCAEKAIMIAJqNgIMIAQgBCgCECACazYCECAEIAQoAhQgAmo2AhQgACAAKAJcIAJqNgJcIAMgAmshAwsgAwsEQCAAKAIAIgIoAgwhBSADIAIoAgQiBiADIAZJGyIEBEAgAiAGIARrNgIEIAUgAigCACAEEB8hBQJAAkACQCACKAIcKAIYQQFrDgIAAQILIAIgAigCMCAFIAQQBDYCMAwBCyACIAIoAjAgBSAEEAY2AjALIAIgAigCACAEajYCACACIAIoAgggBGo2AgggACgCACICKAIMIQULIAIgAyAFajYCDCACIAIoAhAgA2s2AhAgAiACKAIUIANqNgIUCyAAKAIAIQQgBwRAQQAhCAwCCyAEKAIQIgMgACgCvC1BKmpBA3UiAk8NAAsLAkAgCSAEKAIEayIDRQRAIAAoAmwhAgwBCwJAIAAoAiwiAiADTQRAIABBAjYCsC0gACgCOCAEKAIAIAJrIAIQHxogACAAKAIsIgQ2AmwgBCECDAELAkAgACgCPCAAKAJsIgRrIANLDQAgACAEIAJrIgQ2AmwgACgCOCIFIAIgBWogBBAfGiAAKAKwLSICQQFLDQAgACACQQFqNgKwLQsgACgCOCAAKAJsaiAAKAIAKAIAIANrIAMQHxogACAAKAJsIANqIgI2AmwgACgCLCEECyAAIAI2AlwgACAEIAAoArQtIgVrIgQgAyADIARLGyAFajYCtC0LIAIgACgCwC1LBEAgACACNgLALQtBAyEDAkAgCEUNACAAKAIAIgQoAgQhAwJAAkAgAUF7cUUNACADDQBBASEDIAIgACgCXEYNAiAAKAI8IAJBf3NqIQVBACEDDAELIAMgACgCPCACQX9zaiIFTQ0AIAAoAlwiByAAKAIsIgZIDQAgACACIAZrIgM2AmwgACAHIAZrNgJcIAAoAjgiAiACIAZqIAMQHxogACgCsC0iA0EBTQRAIAAgA0EBajYCsC0LIAAoAiwgBWohBSAAKAIAIgQoAgQhAwsCQCADIAUgAyAFSRsiAkUEQCAAKAJsIQMMAQsgACgCbCEFIAAoAjghBiAEIAMgAms2AgQgBSAGaiAEKAIAIAIQHyEDAkACQAJAIAQoAhwoAhhBAWsOAgABAgsgBCAEKAIwIAMgAhAENgIwDAELIAQgBCgCMCADIAIQBjYCMAsgBCAEKAIAIAJqNgIAIAQgBCgCCCACajYCCCAAIAAoAmwgAmoiAzYCbAsgAyAAKALALUsEQCAAIAM2AsAtCyADIAAoAlwiBmsiBCAAKAIsIgMgACgCDCAAKAK8LUEqakEDdWsiAkH//wMgAkH//wNJGyICIAIgA0sbSQRAQQAhAyABRQ0BIAFBBEYgBEEAR3JFDQEgAiAESQ0BIAAoAgAoAgQNAQtBACEFIAAgACgCOCAGaiACIAQgAiAESRsiAwJ/IAFBBEYEQCAAKAIAKAIERSACIARPcSEFCyAFCxASIAAgACgCXCADajYCXCAAKAIAIgAoAhwiAxATAkAgACgCECICIAMoAhQiBCACIARJGyICRQ0AIAAoAgwgAygCECACEB8aIAAgACgCDCACajYCDCADIAMoAhAgAmo2AhAgACAAKAIUIAJqNgIUIAAgACgCECACazYCECADIAMoAhQgAmsiADYCFCAADQAgAyADKAIINgIQC0ECQQAgBRshAwsgAwu5CwENfwJAA0ACQAJAIAAoAnRBhQJNBEAgABAKIAAoAnQhAgJAIAENACACQYYCTw0AQQAPCyACRQ0EIAJBA0kNAQsgACAAKAJUIAAoAmwiAiAAKAI4ai0AAiAAKAJIIAAoAlh0c3EiAzYCSCAAKAJAIAIgACgCNHFBAXRqIAAoAkQgA0EBdGoiBC8BACIDOwEAIAQgAjsBACADRQ0AIAAoAixBhgJrIAIgA2tJDQAgACAAIAMQDiICNgJgDAELIAAoAmAhAgsCQCACQQNPBEAgACgCpC0gACgCoC0iA0EBdGogACgCbCAAKAJwayIEOwEAIAAgA0EBajYCoC0gAyAAKAKYLWogAkEDayICOgAAIAJB/wFxQYDNAGotAABBAnQgAGpBmAlqIgIgAi8BAEEBajsBACAAIARBAWtB//8DcSICIAJBB3ZBgAJqIAJBgAJJG0GAyQBqLQAAQQJ0akGIE2oiAiACLwEAQQFqOwEAIAAgACgCdCAAKAJgIgJrIgM2AnQgACgCnC1BAWshBiAAKAKgLSEHAkAgA0EDSQ0AIAIgACgCgAFLDQAgACACQQFrIgM2AmAgACgCSCEEIAAoAmwhAiAAKAI0IQggACgCQCEJIAAoAkQhCiAAKAJUIQsgACgCOCEMIAAoAlghDQNAIAAgAiIFQQFqIgI2AmwgACAFIAxqLQADIAQgDXRzIAtxIgQ2AkggCSACIAhxQQF0aiAKIARBAXRqIg4vAQA7AQAgDiACOwEAIAAgA0EBayIDNgJgIAMNAAsgACAFQQJqIgI2AmwgBiAHRw0DDAILIABBADYCYCAAIAAoAmwgAmoiAjYCbCAAIAAoAjggAmoiAy0AACIENgJIIAAgACgCVCADLQABIAQgACgCWHRzcTYCSCAGIAdHDQIMAQsgACgCOCAAKAJsai0AACECIAAoAqQtIAAoAqAtIgNBAXRqQQA7AQAgACADQQFqNgKgLSADIAAoApgtaiACOgAAIAAgAkECdGpBlAFqIgIgAi8BAEEBajsBACAAIAAoAnRBAWs2AnQgACAAKAJsQQFqIgI2AmwgACgCoC0gACgCnC1BAWtHDQELQQAhAyAAIAAoAlwiBEEATgR/IAAoAjggBGoFIAMLIAIgBGtBABAUIAAgACgCbDYCXCAAKAIAIgIoAhwiAxATAkAgAigCECIEIAMoAhQiBSAEIAVJGyIERQ0AIAIoAgwgAygCECAEEB8aIAIgAigCDCAEajYCDCADIAMoAhAgBGo2AhAgAiACKAIUIARqNgIUIAIgAigCECAEazYCECADIAMoAhQgBGsiAjYCFCACDQAgAyADKAIINgIQCyAAKAIAKAIQDQALQQAPCyAAIAAoAmwiAkECIAJBAkkbNgK0LSABQQRGBEBBACEDIAAgACgCXCIEQQBOBH8gACgCOCAEagUgAwsgAiAEa0EBEBQgACAAKAJsNgJcIAAoAgAiAigCHCIDEBMCQCACKAIQIgQgAygCFCIFIAQgBUkbIgRFDQAgAigCDCADKAIQIAQQHxogAiACKAIMIARqNgIMIAMgAygCECAEajYCECACIAIoAhQgBGo2AhQgAiACKAIQIARrNgIQIAMgAygCFCAEayICNgIUIAINACADIAMoAgg2AhALQQNBAiAAKAIAKAIQGw8LAkAgACgCoC1FDQBBACEDIAAgACgCXCIEQQBOBH8gACgCOCAEagUgAwsgAiAEa0EAEBQgACAAKAJsNgJcIAAoAgAiAigCHCIDEBMCQCACKAIQIgQgAygCFCIFIAQgBUkbIgRFDQAgAigCDCADKAIQIAQQHxogAiACKAIMIARqNgIMIAMgAygCECAEajYCECACIAIoAhQgBGo2AhQgAiACKAIQIARrNgIQIAMgAygCFCAEayICNgIUIAINACADIAMoAgg2AhALIAAoAgAoAhANAEEADwtBAQukBAEQfyAAKAJ8IgMgA0ECdiAAKAJ4IgQgACgCjAFJGyEJQQAgACgCbCIDIAAoAixrQYYCaiICIAIgA0sbIQwgACgCdCIHIAAoApABIgIgAiAHSxshDSAAKAI4Ig4gA2oiBUGCAmohDyAEIAVqIgMtAAAhCiADQQFrLQAAIQsgACgCNCEQIAAoAkAhEQNAAkACQCABIA5qIgMgBGoiAi0AACAKRw0AIAJBAWstAAAgC0cNACADLQAAIAUtAABHDQBBAiEGIAMtAAEgBS0AAUcNAAJAAkACQAJAAkACQAJAA0AgBSAGaiICLQABIAMtAANHDQYgAi0AAiADLQAERw0FIAItAAMgAy0ABUcNBCACLQAEIAMtAAZHDQMgAi0ABSADLQAHRw0CIAItAAYgAy0ACEcNASACLQAHIAMtAAlGBEAgBkH5AUshCCAFIAZBCGoiBmohAiAIDQggAy0ACiEIIANBCGohAyACLQAAIAhGDQEMCAsLIAJBB2ohAgwGCyACQQZqIQIMBQsgAkEFaiECDAQLIAJBBGohAgwDCyACQQNqIQIMAgsgAkECaiECDAELIAJBAWohAgsgAiAPayICQYICaiIDIARMDQAgACABNgJwIAMgDU4EQCADIQQMAgsgAyAFai0AACEKIAIgBWotAIECIQsgAyEECyAJQQFrIglFDQAgDCARIAEgEHFBAXRqLwEAIgFJDQELCyAHIAQgBCAHSxsL3Q4BB38DQAJAAkACQCAAKAJ0QYUCSw0AIAAQCiAAKAJ0IQICQCABDQAgAkGGAk8NAEEADwsgAkUNAiACQQJLDQAgACAAKAJgIgI2AnggACAAKAJwNgJkQQIhAyAAQQI2AmAMAQtBAiEDIAAgACgCVCAAKAJsIgIgACgCOGotAAIgACgCSCAAKAJYdHNxIgQ2AkggACgCQCACIAAoAjRxQQF0aiAAKAJEIARBAXRqIgUvAQAiBDsBACAFIAI7AQAgACAAKAJgIgI2AnggACAAKAJwNgJkIABBAjYCYCAERQ0AAkAgAiAAKAKAAU8NACAAKAIsQYYCayAAKAJsIARrSQ0AIAAgACAEEA4iAzYCYCADQQVLDQAgACgCiAFBAUcEQCADQQNHDQFBAyEDIAAoAmwgACgCcGtBgSBJDQELQQIhAyAAQQI2AmALIAAoAnghAgsCQCACQQNJDQAgAiADSQ0AIAAoAnQhBCAAKAKkLSAAKAKgLSIDQQF0aiAAKAJsIgUgACgCZEF/c2oiBjsBACAAIANBAWo2AqAtIAMgACgCmC1qIAJBA2siAjoAACACQf8BcUGAzQBqLQAAQQJ0IABqQZgJaiICIAIvAQBBAWo7AQAgACAGQQFrQf//A3EiAiACQQd2QYACaiACQYACSRtBgMkAai0AAEECdGpBiBNqIgIgAi8BAEEBajsBACAAIAAoAngiAkECayIDNgJ4IAAgACgCdCACa0EBajYCdCAEIAVqQQNrIQUgACgCnC1BAWshByAAKAJsIQIgACgCoC0hCANAIAAgAiIEQQFqIgI2AmwgAiAFTQRAIAAgACgCVCAEIAAoAjhqLQADIAAoAkggACgCWHRzcSIGNgJIIAAoAkAgACgCNCACcUEBdGogACgCRCAGQQF0aiIGLwEAOwEAIAYgAjsBAAsgACADQQFrIgM2AnggAw0ACyAAQQI2AmAgAEEANgJoIAAgBEECaiICNgJsIAcgCEcNAkEAIQMgACAAKAJcIgRBAE4EfyAAKAI4IARqBSADCyACIARrQQAQFCAAIAAoAmw2AlwgACgCACICKAIcIgMQEwJAIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgACgCACgCEA0CQQAPCyAAKAJoBEAgACgCbCAAKAI4akEBay0AACECIAAoAqQtIAAoAqAtIgNBAXRqQQA7AQAgACADQQFqNgKgLSADIAAoApgtaiACOgAAIAAgAkECdGpBlAFqIgIgAi8BAEEBajsBAAJAIAAoAqAtIAAoApwtQQFrRw0AQQAhAyAAIAAoAlwiAkEATgR/IAAoAjggAmoFIAMLIAAoAmwgAmtBABAUIAAgACgCbDYCXCAAKAIAIgIoAhwiAxATIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgACAAKAJsQQFqNgJsIAAgACgCdEEBazYCdCAAKAIAKAIQDQJBAA8FIABBATYCaCAAIAAoAmxBAWo2AmwgACAAKAJ0QQFrNgJ0DAILAAsLIAAoAmgEQCAAKAJsIAAoAjhqQQFrLQAAIQIgACgCpC0gACgCoC0iA0EBdGpBADsBACAAIANBAWo2AqAtIAMgACgCmC1qIAI6AAAgACACQQJ0akGUAWoiAiACLwEAQQFqOwEAIABBADYCaAsgACAAKAJsIgJBAiACQQJJGzYCtC0gAUEERgRAQQAhAyAAIAAoAlwiBEEATgR/IAAoAjggBGoFIAMLIAIgBGtBARAUIAAgACgCbDYCXCAAKAIAIgIoAhwiAxATAkAgAigCECIEIAMoAhQiBSAEIAVJGyIERQ0AIAIoAgwgAygCECAEEB8aIAIgAigCDCAEajYCDCADIAMoAhAgBGo2AhAgAiACKAIUIARqNgIUIAIgAigCECAEazYCECADIAMoAhQgBGsiAjYCFCACDQAgAyADKAIINgIQC0EDQQIgACgCACgCEBsPCwJAIAAoAqAtRQ0AQQAhAyAAIAAoAlwiBEEATgR/IAAoAjggBGoFIAMLIAIgBGtBABAUIAAgACgCbDYCXCAAKAIAIgIoAhwiAxATAkAgAigCECIEIAMoAhQiBSAEIAVJGyIERQ0AIAIoAgwgAygCECAEEB8aIAIgAigCDCAEajYCDCADIAMoAhAgBGo2AhAgAiACKAIUIARqNgIUIAIgAigCECAEazYCECADIAMoAhQgBGsiAjYCFCACDQAgAyADKAIINgIQCyAAKAIAKAIQDQBBAA8LQQELYQAgAEEANgK8LSAAQQA7AbgtIABBuBZqQajPADYCACAAIABB/BRqNgKwFiAAQawWakGUzwA2AgAgACAAQYgTajYCpBYgAEGgFmpBgM8ANgIAIAAgAEGUAWo2ApgWIAAQEQvwBAEDfyAAQZQBaiECA0AgAiABQQJ0IgNqQQA7AQAgAiADQQRyakEAOwEAIAFBAmoiAUGeAkcNAAsgAEEAOwH8FCAAQQA7AYgTIABBxBVqQQA7AQAgAEHAFWpBADsBACAAQbwVakEAOwEAIABBuBVqQQA7AQAgAEG0FWpBADsBACAAQbAVakEAOwEAIABBrBVqQQA7AQAgAEGoFWpBADsBACAAQaQVakEAOwEAIABBoBVqQQA7AQAgAEGcFWpBADsBACAAQZgVakEAOwEAIABBlBVqQQA7AQAgAEGQFWpBADsBACAAQYwVakEAOwEAIABBiBVqQQA7AQAgAEGEFWpBADsBACAAQYAVakEAOwEAIABB/BNqQQA7AQAgAEH4E2pBADsBACAAQfQTakEAOwEAIABB8BNqQQA7AQAgAEHsE2pBADsBACAAQegTakEAOwEAIABB5BNqQQA7AQAgAEHgE2pBADsBACAAQdwTakEAOwEAIABB2BNqQQA7AQAgAEHUE2pBADsBACAAQdATakEAOwEAIABBzBNqQQA7AQAgAEHIE2pBADsBACAAQcQTakEAOwEAIABBwBNqQQA7AQAgAEG8E2pBADsBACAAQbgTakEAOwEAIABBtBNqQQA7AQAgAEGwE2pBADsBACAAQawTakEAOwEAIABBqBNqQQA7AQAgAEGkE2pBADsBACAAQaATakEAOwEAIABBnBNqQQA7AQAgAEGYE2pBADsBACAAQZQTakEAOwEAIABBkBNqQQA7AQAgAEGME2pBADsBACAAQgA3AqwtIABBlAlqQQE7AQAgAEEANgKoLSAAQQA2AqAtC7IDAQJ/IAAgAC8BuC0gA0H//wNxIgUgACgCvC0iBHRyIgM7AbgtAkACQAJ/IARBDk4EQCAAIAAoAhQiBEEBajYCFCAEIAAoAghqIAM6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAAQbktai0AADoAACAAIAVBECAAKAK8LSIEa3YiAzsBuC0gBEENawwBCyAEQQNqCyIEQQlOBEAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiADOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGohBCAAQbktai0AACEDDAELIARBAUgNASAAIAAoAhQiBEEBajYCFCAEIAAoAghqIQQLIAQgAzoAAAsgAEEANgK8LSAAQQA7AbgtIAAgACgCFCIDQQFqNgIUIAMgACgCCGogAjoAACAAIAAoAhQiA0EBajYCFCADIAAoAghqIAJBCHY6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiACQX9zIgM6AAAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiADQQh2OgAAIAAoAgggACgCFGogASACEB8aIAAgACgCFCACajYCFAusAQEBfwJAIAACfyAAKAK8LSIBQRBGBEAgACAAKAIUIgFBAWo2AhQgASAAKAIIaiAALQC4LToAACAAIAAoAhQiAUEBajYCFCABIAAoAghqIABBuS1qLQAAOgAAIABBADsBuC1BAAwBCyABQQhIDQEgACAAKAIUIgFBAWo2AhQgASAAKAIIaiAALQC4LToAACAAIABBuS1qLQAAOwG4LSAAKAK8LUEIaws2ArwtCwuhEwENfwJ/AkACQAJAIAAoAoQBQQFOBEAgACgCACIGKAIsQQJHDQNB/4D/n38hBANAAkAgBEEBcUUNACAAIAVBAnRqLwGUAUUNAEEAIQQMBAsCQCAEQQJxRQ0AIAAgBUECdEEEcmovAZQBRQ0AQQAhBAwECyAEQQJ2IQQgBUECaiIFQSBHDQALDAELIAJBBWoiBQwDCwJAIAAvAbgBDQAgAC8BvAENACAALwHIAQ0AQSAhBQNAIAAgBUECdCIEai8BlAENASAAIARBBHJqLwGUAQ0BIAAgBEEIcmovAZQBDQEgACAEQQxyai8BlAENAUEAIQQgBUEEaiIFQYACRw0ACwwBC0EBIQQLIAYgBDYCLAsgACAAQZgWahAVIAAgAEGkFmoQFSAALwGWASEEIAAgAEGcFmooAgAiCkECdGpB//8DOwGaASAKQQBOBEBBB0GKASAEGyEJQQRBAyAEGyELIABBwBVqIQ4gAEHEFWohDyAAQbwVaiEQQX8hDANAIAQhBSAAIAgiDUEBaiIIQQJ0ai8BlgEhBAJAAkAgB0EBaiIGIAlODQAgBCAFRw0AIAYhBwwBCwJ/IAYgC0gEQCAAIAVBAnRqQfwUaiIHLwEAIAZqDAELIAUEQCAFIAxHBEAgACAFQQJ0akH8FGoiBiAGLwEAQQFqOwEACyAQIgcvAQBBAWoMAQsgB0EJTARAIA4iBy8BAEEBagwBCyAPIgcvAQBBAWoLIQYgByAGOwEAQQAhBwJ/IARFBEBBAyELQYoBDAELQQNBBCAEIAVGIgYbIQtBBkEHIAYbCyEJIAUhDAsgCiANRw0ACwsgAEGKE2ovAQAhBCAAIABBqBZqKAIAIgpBAnRqQY4TakH//wM7AQBBACEHIApBAE4EQEEHQYoBIAQbIQlBBEEDIAQbIQsgAEHAFWohDiAAQcQVaiEPIABBvBVqIRBBfyEMQQAhCANAIAQhBSAAIAgiDUEBaiIIQQJ0akGKE2ovAQAhBAJAAkAgB0EBaiIGIAlODQAgBCAFRw0AIAYhBwwBCwJ/IAYgC0gEQCAAIAVBAnRqQfwUaiIHLwEAIAZqDAELIAUEQCAFIAxHBEAgACAFQQJ0akH8FGoiBiAGLwEAQQFqOwEACyAQIgcvAQBBAWoMAQsgB0EJTARAIA4iBy8BAEEBagwBCyAPIgcvAQBBAWoLIQYgByAGOwEAQQAhBwJ/IARFBEBBAyELQYoBDAELQQNBBCAEIAVGIgYbIQtBBkEHIAYbCyEJIAUhDAsgCiANRw0ACwsgACAAQbAWahAVIAAgACgCqC0Cf0ESIABBuhVqLwEADQAaQREgAEGCFWovAQANABpBECAAQbYVai8BAA0AGkEPIABBhhVqLwEADQAaQQ4gAEGyFWovAQANABpBDSAAQYoVai8BAA0AGkEMIABBrhVqLwEADQAaQQsgAEGOFWovAQANABpBCiAAQaoVai8BAA0AGkEJIABBkhVqLwEADQAaQQggAEGmFWovAQANABpBByAAQZYVai8BAA0AGkEGIABBohVqLwEADQAaQQUgAEGaFWovAQANABpBBCAAQZ4Vai8BAA0AGkEDQQIgAEH+FGovAQAbCyIIQQNsaiIEQRFqNgKoLSAEQRtqQQN2IgQgACgCrC1BCmpBA3YiBSAEIAVJGwshBAJAAkAgAUUNACACQQRqIARLDQAgACABIAIgAxASDAELIAAoArwtIQYCQCAEIAVHBEAgACgCiAFBBEcNAQsgACAALwG4LSADQQJqQf//A3EiBCAGdHIiBTsBuC0gAAJ/IAZBDk4EQCAAIAAoAhQiBkEBajYCFCAGIAAoAghqIAU6AAAgACAAKAIUIgVBAWo2AhQgBSAAKAIIaiAAQbktai0AADoAACAAIARBECAAKAK8LSIFa3Y7AbgtIAVBDWsMAQsgBkEDags2ArwtIABBwM8AQcDYABAWDAELIAAvAbgtIANBBGpB//8DcSIHIAZ0ciEFAkAgBkEOTgRAIAAgBTsBuC0gACAAKAIUIgRBAWo2AhQgBCAAKAIIaiAFOgAAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogAEG5LWotAAA6AAAgACgCvC0iBUENayEEIAdBECAFa3YhBQwBCyAGQQNqIQQLIAAgBDYCvC0gAEGcFmooAgAiCkGA/gNqQf//A3EiByAEdCEGIABBqBZqKAIAIQkCfyAEQQxOBEAgACAFIAZyIgQ7AbgtIAAgACgCFCIFQQFqNgIUIAUgACgCCGogBDoAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIABBuS1qLQAAOgAAIAAoArwtIgVBC2shBCAHQRAgBWt2DAELIARBBWohBCAFIAZyCyEFIAAgBDYCvC0gCUH//wNxIgcgBHQhBgJ/IARBDE4EQCAAIAUgBnIiBDsBuC0gACAAKAIUIgVBAWo2AhQgBSAAKAIIaiAEOgAAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogAEG5LWotAAA6AAAgACgCvC0iBUELayEEIAdBECAFa3YMAQsgBEEFaiEEIAUgBnILIQUgACAENgK8LSAIQf3/A2pB//8DcSIHIAR0IQYCfyAEQQ1OBEAgACAFIAZyIgQ7AbgtIAAgACgCFCIFQQFqNgIUIAUgACgCCGogBDoAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIABBuS1qLQAAOgAAIAAoArwtIgVBDGshBCAHQRAgBWt2DAELIARBBGohBCAFIAZyCyEGIAAgBDYCvC1BACEFIABBuS1qIQ0DQCAAIAYgACAFQZDcAGotAABBAnRqQf4Uai8BACIHIAR0ciIGOwG4LSAAAn8gBEEOTgRAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogBjoAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIA0tAAA6AAAgACAHQRAgACgCvC0iBGt2IgY7AbgtIARBDWsMAQsgBEEDagsiBDYCvC0gBSAIRyEHIAVBAWohBSAHDQALIAAgAEGUAWoiBCAKEBcgACAAQYgTaiIFIAkQFyAAIAQgBRAWCyAAEBEgAwRAAkACfyAAKAK8LSIEQQlOBEAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiAALQC4LToAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIQQgAEG5LWotAAAMAQsgBEEBSA0BIAAgACgCFCIEQQFqNgIUIAQgACgCCGohBCAALQC4LQshBSAEIAU6AAALIABBADYCvC0gAEEAOwG4LQsLsRUBFX8jAEEgayEKIAEoAgAhCSABKAIIIgIoAgAhBSACKAIMIQ0gAEKAgICA0McANwLQKEF/IRACQCANQQBKBEBBACECA0ACQCAJIAJBAnRqIgMvAQAEQCAAIAAoAtAoQQFqIgM2AtAoIAAgA0ECdGpB3BZqIAI2AgAgACACakHYKGpBADoAACACIRAMAQsgA0EAOwECCyACQQFqIgIgDUcNAAsgACgC0CgiBEEBSg0BCwNAIAAgBEEBaiICNgLQKCAAIAJBAnRqQdwWaiAQQQFqIgNBACAQQQJIIgQbIgI2AgAgCSACQQJ0IgdqQQE7AQAgACACakHYKGpBADoAACAAIAAoAqgtQQFrNgKoLSAFBEAgACAAKAKsLSAFIAdqLwECazYCrC0LIAMgECAEGyEQIAAoAtAoIgRBAkgNAAsLIAEgEDYCBCAEQQF2IQgDQCAAIAhBAnRqQdwWaigCACELAkAgCCICQQF0IgMgBEoNACAAIAtqQdgoaiEPIAkgC0ECdGohBiAIIQUDQAJAIAMgBE4EQCADIQIMAQsgCSAAQdwWaiICIANBAXIiBEECdGooAgAiDkECdGovAQAiByAJIAIgA0ECdGooAgAiDEECdGovAQAiAk8EQCACIAdHBEAgAyECDAILIAMhAiAAQdgoaiIDIA5qLQAAIAMgDGotAABLDQELIAQhAgsgBi8BACIEIAkgACACQQJ0akHcFmooAgAiA0ECdGovAQAiB0kEQCAFIQIMAgsCQCAEIAdHDQAgDy0AACAAIANqQdgoai0AAEsNACAFIQIMAgsgACAFQQJ0akHcFmogAzYCACACIQUgAkEBdCIDIAAoAtAoIgRMDQALCyAAIAJBAnRqQdwWaiALNgIAIAhBAk4EQCAIQQFrIQggACgC0CghBAwBCwsgACgC0CghAwNAIA0hCCAAIANBAWsiBDYC0CggACgC4BYhCyAAIAAgA0ECdGpB3BZqKAIAIg02AuAWQQEhAgJAIANBA0gNACAAIA1qQdgoaiEPQQIhAyAJIA1BAnRqIQZBASEFA0ACQCADIAROBEAgAyECDAELIAkgAEHcFmoiAiADQQFyIgRBAnRqKAIAIg5BAnRqLwEAIgcgCSACIANBAnRqKAIAIgxBAnRqLwEAIgJPBEAgAiAHRwRAIAMhAgwCCyADIQIgAEHYKGoiAyAOai0AACADIAxqLQAASw0BCyAEIQILIAYvAQAiBCAJIAAgAkECdGpB3BZqKAIAIgNBAnRqLwEAIgdJBEAgBSECDAILAkAgBCAHRw0AIA8tAAAgACADakHYKGotAABLDQAgBSECDAILIAAgBUECdGpB3BZqIAM2AgAgAiEFIAJBAXQiAyAAKALQKCIETA0ACwtBAiEDIABB3BZqIgYgAkECdGogDTYCACAAIAAoAtQoQQFrIgQ2AtQoIAAoAuAWIQIgBiAEQQJ0aiALNgIAIAAgACgC1ChBAWsiBDYC1CggBiAEQQJ0aiACNgIAIAkgCEECdGoiDiAJIAJBAnRqIgQvAQAgCSALQQJ0aiIFLwEAajsBACAAQdgoaiIMIAhqIg8gAiAMai0AACICIAsgDGotAAAiByACIAdLG0EBajoAACAEIAg7AQIgBSAIOwECIAAgCDYC4BZBASEFQQEhAgJAIAAoAtAoIgRBAkgNAANAAn8gAyADIARODQAaIAkgBiADQQFyIgRBAnRqKAIAIgtBAnRqLwEAIgIgCSAGIANBAnRqKAIAIg1BAnRqLwEAIgdPBEAgAyACIAdHDQEaIAMgCyAMai0AACAMIA1qLQAASw0BGgsgBAshAiAOLwEAIgQgCSAAIAJBAnRqQdwWaigCACIDQQJ0ai8BACIHSQRAIAUhAgwCCwJAIAQgB0cNACAPLQAAIAAgA2pB2ChqLQAASw0AIAUhAgwCCyAAIAVBAnRqQdwWaiADNgIAIAIhBSACQQF0IgMgACgC0CgiBEwNAAsLIAhBAWohDSAAIAJBAnRqQdwWaiAINgIAIAAoAtAoIgNBAUoNAAsgACAAKALUKEEBayICNgLUKCAAQdwWaiIDIAJBAnRqIAAoAuAWNgIAIAEoAgQhByABKAIIIgIoAhAhBiACKAIIIREgAigCBCETIAIoAgAhEiABKAIAIQwgAEHUFmoiAUIANwEAIABBzBZqIhRCADcBACAAQcQWaiIVQgA3AQAgAEG8FmoiFkIANwEAQQAhCCAMIAMgACgC1ChBAnRqKAIAQQJ0akEAOwECAkAgACgC1CgiAkG7BEoNACACQQFqIQJBACEOA0AgDCAAIAJBAnRqQdwWaigCACIEQQJ0Ig1qIgUgDCAFLwECQQJ0ai8BAiIDQQFqIAYgAyAGSBsiDzsBAiADIAZOIQMCQCAEIAdKDQAgACAPQQF0akG8FmoiCyALLwEAQQFqOwEAQQAhCyAEIBFOBEAgEyAEIBFrQQJ0aigCACELCyAAIAAoAqgtIAUvAQAiBCALIA9qbGo2AqgtIBJFDQAgACAAKAKsLSALIA0gEmovAQJqIARsajYCrC0LIAMgDmohDiACQQFqIgJBvQRHDQALIA5FDQAgACAGQQF0akG8FmohDwNAIAYhAgNAIAAgAiIDQQFrIgJBAXRqQbwWaiIELwEAIgVFDQALIAQgBUEBazsBACAAIANBAXRqQbwWaiICIAIvAQBBAmo7AQAgDyAPLwEAQQFrIgI7AQAgDkECSiEDIA5BAmshDiADDQALIAZFDQBBvQQhBQNAIAJB//8DcSEDIAUhAgNAIAMEQCAAIAJBAWsiAkECdGpB3BZqKAIAIgQgB0oNASAMIARBAnRqIgQvAQIiBSAGRwRAIAAgACgCqC0gBC8BACAGIAVrbGo2AqgtIAQgBjsBAgsgA0EBayEDIAIhBQwBCwsgBkEBayIGRQ0BIAAgBkEBdGpBvBZqLwEAIQIMAAsACyAKIBYvAQBBAXQiAjsBAiAKIAIgAEG+FmovAQBqQQF0IgI7AQQgCiACIABBwBZqLwEAakEBdCICOwEGIAogAiAAQcIWai8BAGpBAXQiAjsBCCAKIAIgFS8BAGpBAXQiAjsBCiAKIAIgAEHGFmovAQBqQQF0IgI7AQwgCiACIABByBZqLwEAakEBdCICOwEOIAogAiAAQcoWai8BAGpBAXQiAjsBECAKIAIgFC8BAGpBAXQiAjsBEiAKIAIgAEHOFmovAQBqQQF0IgI7ARQgCiACIABB0BZqLwEAakEBdCICOwEWIAogAiAAQdIWai8BAGpBAXQiAjsBGCAKIAEvAQAgAmpBAXQiAjsBGiAKIABB1hZqLwEAIAJqQQF0IgI7ARwgCiACIABB2BZqLwEAakEBdDsBHiAQQQBOBEADQCAJIAhBAnRqIgcvAQIiBARAIAogBEEBdGoiACAALwEAIgBBAWo7AQAgBEEDcSEDQQAhAiAEQQFrQQNPBEAgBEH8/wNxIQUDQCAAQQN2QQFxIABBAnZBAXEgAEECcSACIABBAXFyQQJ0cnJBAXRyIgRBAXQhAiAAQQR2IQAgBUEEayIFDQALCyADBEADQCACIABBAXFyIgRBAXQhAiAAQQF2IQAgA0EBayIDDQALCyAHIAQ7AQALIAggEEchACAIQQFqIQggAA0ACwsL2QgBCn8CQCAAKAKgLUUEQCAAKAK8LSEDDAELIABBuS1qIQgDQCAEQQFqIQogACgCmC0gBGotAAAhBQJAIAACfyAAKAKkLSAEQQF0ai8BACIHRQRAIAEgBUECdGoiAy8BAiEEIAAgAC8BuC0gAy8BACIFIAAoArwtIgN0ciIHOwG4LUEQIARrIANIBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAHOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAVBECAAKAK8LSIDa3Y7AbgtIAMgBGpBEGsMAgsgAyAEagwBCyAFQYDNAGotAAAiC0ECdCIJQYAIciABaiIDLwEGIQQgACAALwG4LSADLwEEIgwgACgCvC0iBnRyIgM7AbgtIAACf0EQIARrIAZIBEAgACAAKAIUIgZBAWo2AhQgBiAAKAIIaiADOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAxBECAAKAK8LSIGa3YiAzsBuC0gBCAGakEQawwBCyAEIAZqCyIENgK8LSALQQhrQRNNBEAgACADIAUgCUGw3ABqKAIAa0H//wNxIgYgBHRyIgM7AbgtIAACf0EQIAlBwNkAaigCACIFayAESARAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogAzoAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIAgtAAA6AAAgACAGQRAgACgCvC0iBGt2IgM7AbgtIAQgBWpBEGsMAQsgBCAFagsiBDYCvC0LIAIgB0EBayIFIAVBB3ZBgAJqIAVBgAJJG0GAyQBqLQAAIgtBAnQiCWoiBi8BAiEHIAAgAyAGLwEAIgwgBHRyIgY7AbgtIAACf0EQIAdrIARIBEAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiAGOgAAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogCC0AADoAACAAIAxBECAAKAK8LSIEa3YiBjsBuC0gBCAHakEQawwBCyAEIAdqCyIDNgK8LSALQQRJDQEgACAGIAUgCUGw3QBqKAIAa0H//wNxIgUgA3RyIgc7AbgtQRAgCUHA2gBqKAIAIgRrIANIBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAHOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAVBECAAKAK8LSIDa3Y7AbgtIAMgBGpBEGsMAQsgAyAEagsiAzYCvC0LIAoiBCAAKAKgLUkNAAsLIAFBgghqLwEAIQQgACAALwG4LSABLwGACCIKIAN0ciIFOwG4LUEQIARrIANIBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAFOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogAEG5LWotAAA6AAAgACAKQRAgACgCvC0iA2t2OwG4LSAAIAMgBGpBEGs2ArwtDwsgACADIARqNgK8LQuXCwEMfyACQQBOBEBBBEEDIAEvAQIiChshBkEHQYoBIAobIQMgAEG5LWohCEF/IQcDQCAKIQkgASALIgxBAWoiC0ECdGovAQIhCgJAAkAgBUEBaiIEIANODQAgCSAKRw0AIAQhBQwBCwJAIAQgBkgEQCAAIAlBAnRqIgVB/BRqIQ0gBUH+FGohDiAAKAK8LSEFA0AgDi8BACEDIAAgAC8BuC0gDS8BACIGIAV0ciIHOwG4LSAAAn9BECADayAFSARAIAAgACgCFCIFQQFqNgIUIAUgACgCCGogBzoAACAAIAAoAhQiBUEBajYCFCAFIAAoAghqIAgtAAA6AAAgACAGQRAgACgCvC0iBWt2OwG4LSADIAVqQRBrDAELIAMgBWoLIgU2ArwtIARBAWsiBA0ACwwBCyAAAn8gCQRAAkAgByAJRgRAIAAoArwtIQMgBCEFDAELIAAgCUECdGoiBEH+FGovAQAhAyAAIAAvAbgtIARB/BRqLwEAIgYgACgCvC0iBHRyIgc7AbgtIAACf0EQIANrIARIBEAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiAHOgAAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogCC0AADoAACAAIAZBECAAKAK8LSIEa3Y7AbgtIAMgBGpBEGsMAQsgAyAEagsiAzYCvC0LIAAvAbgtIAAvAbwVIgcgA3RyIQQCQEEQIAAvAb4VIgZrIANIBEAgACAEOwG4LSAAIAAoAhQiA0EBajYCFCADIAAoAghqIAQ6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAILQAAOgAAIAYgACgCvC0iBGpBEGshAyAHQRAgBGt2IQQMAQsgAyAGaiEDCyAAIAM2ArwtIAAgBCAFQf3/A2pB//8DcSIFIAN0ciIEOwG4LSADQQ9OBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAEOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAVBECAAKAK8LSIDa3Y7AbgtIANBDmsMAgsgA0ECagwBCyAFQQlMBEAgAC8BuC0gAC8BwBUiByAAKAK8LSIDdHIhBAJAQRAgAC8BwhUiBmsgA0gEQCAAIAQ7AbgtIAAgACgCFCIDQQFqNgIUIAMgACgCCGogBDoAACAAIAAoAhQiA0EBajYCFCADIAAoAghqIAgtAAA6AAAgBiAAKAK8LSIEakEQayEDIAdBECAEa3YhBAwBCyADIAZqIQMLIAAgAzYCvC0gACAEIAVB/v8DakH//wNxIgUgA3RyIgQ7AbgtIANBDk4EQCAAIAAoAhQiA0EBajYCFCADIAAoAghqIAQ6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAILQAAOgAAIAAgBUEQIAAoArwtIgNrdjsBuC0gA0ENawwCCyADQQNqDAELIAAvAbgtIAAvAcQVIgcgACgCvC0iA3RyIQQCQEEQIAAvAcYVIgZrIANIBEAgACAEOwG4LSAAIAAoAhQiA0EBajYCFCADIAAoAghqIAQ6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAILQAAOgAAIAYgACgCvC0iBGpBEGshAyAHQRAgBGt2IQQMAQsgAyAGaiEDCyAAIAM2ArwtIAAgBCAFQfb/A2pB//8DcSIFIAN0ciIEOwG4LSADQQpOBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAEOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAVBECAAKAK8LSIDa3Y7AbgtIANBCWsMAQsgA0EHags2ArwtC0EAIQUCfyAKRQRAQYoBIQNBAwwBC0EGQQcgCSAKRiIEGyEDQQNBBCAEGwshBiAJIQcLIAIgDEcNAAsLCwkAIAEgAmwQHAsGACABEB0LXwEBfyMAQUBqIgMkACADQQA2AjAgA0IANwMoIAMgADYCCCADIAI2AhQgAyABNgIMIAMgAUEDbDYCGCADQQhqEAcgA0EIahALIANBCGoQCCADKAIcIQEgA0FAayQAIAELBgBB1N8AC6QuAQx/IwBBEGsiDCQAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIABB9AFNBEBB2N8AKAIAIgZBECAAQQtqQXhxIABBC0kbIgRBA3YiAXYiAEEDcQRAIABBf3NBAXEgAWoiAkEDdCIDQYjgAGooAgAiAUEIaiEAAkAgASgCCCIEIANBgOAAaiIDRgRAQdjfACAGQX4gAndxNgIADAELIAQgAzYCDCADIAQ2AggLIAEgAkEDdCICQQNyNgIEIAEgAmoiASABKAIEQQFyNgIEDA0LIARB4N8AKAIAIghNDQEgAARAAkAgACABdEECIAF0IgBBACAAa3JxIgBBACAAa3FBAWsiACAAQQx2QRBxIgB2IgFBBXZBCHEiAiAAciABIAJ2IgBBAnZBBHEiAXIgACABdiIAQQF2QQJxIgFyIAAgAXYiAEEBdkEBcSIBciAAIAF2aiICQQN0IgNBiOAAaigCACIBKAIIIgAgA0GA4ABqIgNGBEBB2N8AIAZBfiACd3EiBjYCAAwBCyAAIAM2AgwgAyAANgIICyABQQhqIQAgASAEQQNyNgIEIAEgBGoiAyACQQN0IgUgBGsiAkEBcjYCBCABIAVqIAI2AgAgCARAIAhBA3YiBUEDdEGA4ABqIQRB7N8AKAIAIQECfyAGQQEgBXQiBXFFBEBB2N8AIAUgBnI2AgAgBAwBCyAEKAIICyEFIAQgATYCCCAFIAE2AgwgASAENgIMIAEgBTYCCAtB7N8AIAM2AgBB4N8AIAI2AgAMDQtB3N8AKAIAIglFDQEgCUEAIAlrcUEBayIAIABBDHZBEHEiAHYiAUEFdkEIcSICIAByIAEgAnYiAEECdkEEcSIBciAAIAF2IgBBAXZBAnEiAXIgACABdiIAQQF2QQFxIgFyIAAgAXZqQQJ0QYjiAGooAgAiAygCBEF4cSAEayEBIAMhAgNAAkAgAigCECIARQRAIAIoAhQiAEUNAQsgACgCBEF4cSAEayICIAEgASACSyICGyEBIAAgAyACGyEDIAAhAgwBCwsgAyAEaiILIANNDQIgAygCGCEKIAMgAygCDCIFRwRAIAMoAggiAEHo3wAoAgBJGiAAIAU2AgwgBSAANgIIDAwLIANBFGoiAigCACIARQRAIAMoAhAiAEUNBCADQRBqIQILA0AgAiEHIAAiBUEUaiICKAIAIgANACAFQRBqIQIgBSgCECIADQALIAdBADYCAAwLC0F/IQQgAEG/f0sNACAAQQtqIgBBeHEhBEHc3wAoAgAiCEUNAEEfIQcgBEH///8HTQRAIABBCHYiACAAQYD+P2pBEHZBCHEiAHQiASABQYDgH2pBEHZBBHEiAXQiAiACQYCAD2pBEHZBAnEiAnRBD3YgACABciACcmsiAEEBdCAEIABBFWp2QQFxckEcaiEHC0EAIARrIQECQAJAAkAgB0ECdEGI4gBqKAIAIgJFBEBBACEADAELQQAhACAEQQBBGSAHQQF2ayAHQR9GG3QhAwNAAkAgAigCBEF4cSAEayIGIAFPDQAgAiEFIAYiAQ0AQQAhASACIQAMAwsgACACKAIUIgYgBiACIANBHXZBBHFqKAIQIgJGGyAAIAYbIQAgA0EBdCEDIAINAAsLIAAgBXJFBEBBAiAHdCIAQQAgAGtyIAhxIgBFDQMgAEEAIABrcUEBayIAIABBDHZBEHEiAHYiAkEFdkEIcSIDIAByIAIgA3YiAEECdkEEcSICciAAIAJ2IgBBAXZBAnEiAnIgACACdiIAQQF2QQFxIgJyIAAgAnZqQQJ0QYjiAGooAgAhAAsgAEUNAQsDQCAAKAIEQXhxIARrIgYgAUkhAyAGIAEgAxshASAAIAUgAxshBSAAKAIQIgIEfyACBSAAKAIUCyIADQALCyAFRQ0AIAFB4N8AKAIAIARrTw0AIAQgBWoiByAFTQ0BIAUoAhghCSAFIAUoAgwiA0cEQCAFKAIIIgBB6N8AKAIASRogACADNgIMIAMgADYCCAwKCyAFQRRqIgIoAgAiAEUEQCAFKAIQIgBFDQQgBUEQaiECCwNAIAIhBiAAIgNBFGoiAigCACIADQAgA0EQaiECIAMoAhAiAA0ACyAGQQA2AgAMCQsgBEHg3wAoAgAiAE0EQEHs3wAoAgAhAQJAIAAgBGsiAkEQTwRAQeDfACACNgIAQezfACABIARqIgM2AgAgAyACQQFyNgIEIAAgAWogAjYCACABIARBA3I2AgQMAQtB7N8AQQA2AgBB4N8AQQA2AgAgASAAQQNyNgIEIAAgAWoiACAAKAIEQQFyNgIECyABQQhqIQAMCwsgBEHk3wAoAgAiA0kEQEHk3wAgAyAEayIBNgIAQfDfAEHw3wAoAgAiACAEaiICNgIAIAIgAUEBcjYCBCAAIARBA3I2AgQgAEEIaiEADAsLQQAhACAEQS9qIggCf0Gw4wAoAgAEQEG44wAoAgAMAQtBvOMAQn83AgBBtOMAQoCggICAgAQ3AgBBsOMAIAxBDGpBcHFB2KrVqgVzNgIAQcTjAEEANgIAQZTjAEEANgIAQYAgCyIBaiIGQQAgAWsiB3EiBSAETQ0KQZDjACgCACIBBEBBiOMAKAIAIgIgBWoiCSACTQ0LIAEgCUkNCwtBlOMALQAAQQRxDQUCQAJAQfDfACgCACIBBEBBmOMAIQADQCABIAAoAgAiAk8EQCACIAAoAgRqIAFLDQMLIAAoAggiAA0ACwtBABAeIgNBf0YNBiAFIQZBtOMAKAIAIgBBAWsiASADcQRAIAUgA2sgASADakEAIABrcWohBgsgBCAGTw0GIAZB/v///wdLDQZBkOMAKAIAIgAEQEGI4wAoAgAiASAGaiICIAFNDQcgACACSQ0HCyAGEB4iACADRw0BDAgLIAYgA2sgB3EiBkH+////B0sNBSAGEB4iAyAAKAIAIAAoAgRqRg0EIAMhAAsCQCAEQTBqIAZNDQAgAEF/Rg0AQbjjACgCACIBIAggBmtqQQAgAWtxIgFB/v///wdLBEAgACEDDAgLIAEQHkF/RwRAIAEgBmohBiAAIQMMCAtBACAGaxAeGgwFCyAAIQMgAEF/Rw0GDAQLAAtBACEFDAcLQQAhAwwFCyADQX9HDQILQZTjAEGU4wAoAgBBBHI2AgALIAVB/v///wdLDQEgBRAeIgNBABAeIgBPDQEgA0F/Rg0BIABBf0YNASAAIANrIgYgBEEoak0NAQtBiOMAQYjjACgCACAGaiIANgIAQYzjACgCACAASQRAQYzjACAANgIACwJAAkACQEHw3wAoAgAiAQRAQZjjACEAA0AgAyAAKAIAIgIgACgCBCIFakYNAiAAKAIIIgANAAsMAgtB6N8AKAIAIgBBACAAIANNG0UEQEHo3wAgAzYCAAtBACEAQZzjACAGNgIAQZjjACADNgIAQfjfAEF/NgIAQfzfAEGw4wAoAgA2AgBBpOMAQQA2AgADQCAAQQN0IgFBiOAAaiABQYDgAGoiAjYCACABQYzgAGogAjYCACAAQQFqIgBBIEcNAAtB5N8AIAZBKGsiAEF4IANrQQdxQQAgA0EIakEHcRsiAWsiAjYCAEHw3wAgASADaiIBNgIAIAEgAkEBcjYCBCAAIANqQSg2AgRB9N8AQcDjACgCADYCAAwCCyABIANPDQAgASACSQ0AIAAoAgxBCHENACAAIAUgBmo2AgRB8N8AIAFBeCABa0EHcUEAIAFBCGpBB3EbIgBqIgI2AgBB5N8AQeTfACgCACAGaiIDIABrIgA2AgAgAiAAQQFyNgIEIAEgA2pBKDYCBEH03wBBwOMAKAIANgIADAELQejfACgCACADSwRAQejfACADNgIACyADIAZqIQJBmOMAIQACQAJAAkACQAJAAkADQCACIAAoAgBHBEAgACgCCCIADQEMAgsLIAAtAAxBCHFFDQELQZjjACEAA0AgASAAKAIAIgJPBEAgAiAAKAIEaiICIAFLDQMLIAAoAgghAAwACwALIAAgAzYCACAAIAAoAgQgBmo2AgQgA0F4IANrQQdxQQAgA0EIakEHcRtqIgcgBEEDcjYCBCACQXggAmtBB3FBACACQQhqQQdxG2oiBiAHayAEayECIAQgB2ohBCABIAZGBEBB8N8AIAQ2AgBB5N8AQeTfACgCACACaiIANgIAIAQgAEEBcjYCBAwDCyAGQezfACgCAEYEQEHs3wAgBDYCAEHg3wBB4N8AKAIAIAJqIgA2AgAgBCAAQQFyNgIEIAAgBGogADYCAAwDCyAGKAIEIgBBA3FBAUYEQCAAQXhxIQgCQCAAQf8BTQRAIAYoAggiASAAQQN2IgVBA3RBgOAAakYaIAEgBigCDCIARgRAQdjfAEHY3wAoAgBBfiAFd3E2AgAMAgsgASAANgIMIAAgATYCCAwBCyAGKAIYIQkCQCAGIAYoAgwiA0cEQCAGKAIIIgAgAzYCDCADIAA2AggMAQsCQCAGQRRqIgAoAgAiAQ0AIAZBEGoiACgCACIBDQBBACEDDAELA0AgACEFIAEiA0EUaiIAKAIAIgENACADQRBqIQAgAygCECIBDQALIAVBADYCAAsgCUUNAAJAIAYgBigCHCIBQQJ0QYjiAGoiACgCAEYEQCAAIAM2AgAgAw0BQdzfAEHc3wAoAgBBfiABd3E2AgAMAgsgCUEQQRQgCSgCECAGRhtqIAM2AgAgA0UNAQsgAyAJNgIYIAYoAhAiAARAIAMgADYCECAAIAM2AhgLIAYoAhQiAEUNACADIAA2AhQgACADNgIYCyAGIAhqIQYgAiAIaiECCyAGIAYoAgRBfnE2AgQgBCACQQFyNgIEIAIgBGogAjYCACACQf8BTQRAIAJBA3YiAUEDdEGA4ABqIQACf0HY3wAoAgAiAkEBIAF0IgFxRQRAQdjfACABIAJyNgIAIAAMAQsgACgCCAshASAAIAQ2AgggASAENgIMIAQgADYCDCAEIAE2AggMAwtBHyEAIAJB////B00EQCACQQh2IgAgAEGA/j9qQRB2QQhxIgB0IgEgAUGA4B9qQRB2QQRxIgF0IgMgA0GAgA9qQRB2QQJxIgN0QQ92IAAgAXIgA3JrIgBBAXQgAiAAQRVqdkEBcXJBHGohAAsgBCAANgIcIARCADcCECAAQQJ0QYjiAGohAQJAQdzfACgCACIDQQEgAHQiBXFFBEBB3N8AIAMgBXI2AgAgASAENgIAIAQgATYCGAwBCyACQQBBGSAAQQF2ayAAQR9GG3QhACABKAIAIQMDQCADIgEoAgRBeHEgAkYNAyAAQR12IQMgAEEBdCEAIAEgA0EEcWpBEGoiBSgCACIDDQALIAUgBDYCACAEIAE2AhgLIAQgBDYCDCAEIAQ2AggMAgtB5N8AIAZBKGsiAEF4IANrQQdxQQAgA0EIakEHcRsiBWsiBzYCAEHw3wAgAyAFaiIFNgIAIAUgB0EBcjYCBCAAIANqQSg2AgRB9N8AQcDjACgCADYCACABIAJBJyACa0EHcUEAIAJBJ2tBB3EbakEvayIAIAAgAUEQakkbIgVBGzYCBCAFQaDjACkCADcCECAFQZjjACkCADcCCEGg4wAgBUEIajYCAEGc4wAgBjYCAEGY4wAgAzYCAEGk4wBBADYCACAFQRhqIQADQCAAQQc2AgQgAEEIaiEDIABBBGohACACIANLDQALIAEgBUYNAyAFIAUoAgRBfnE2AgQgASAFIAFrIgZBAXI2AgQgBSAGNgIAIAZB/wFNBEAgBkEDdiICQQN0QYDgAGohAAJ/QdjfACgCACIDQQEgAnQiAnFFBEBB2N8AIAIgA3I2AgAgAAwBCyAAKAIICyECIAAgATYCCCACIAE2AgwgASAANgIMIAEgAjYCCAwEC0EfIQAgAUIANwIQIAZB////B00EQCAGQQh2IgAgAEGA/j9qQRB2QQhxIgB0IgIgAkGA4B9qQRB2QQRxIgJ0IgMgA0GAgA9qQRB2QQJxIgN0QQ92IAAgAnIgA3JrIgBBAXQgBiAAQRVqdkEBcXJBHGohAAsgASAANgIcIABBAnRBiOIAaiECAkBB3N8AKAIAIgNBASAAdCIFcUUEQEHc3wAgAyAFcjYCACACIAE2AgAgASACNgIYDAELIAZBAEEZIABBAXZrIABBH0YbdCEAIAIoAgAhAwNAIAMiAigCBEF4cSAGRg0EIABBHXYhAyAAQQF0IQAgAiADQQRxakEQaiIFKAIAIgMNAAsgBSABNgIAIAEgAjYCGAsgASABNgIMIAEgATYCCAwDCyABKAIIIgAgBDYCDCABIAQ2AgggBEEANgIYIAQgATYCDCAEIAA2AggLIAdBCGohAAwFCyACKAIIIgAgATYCDCACIAE2AgggAUEANgIYIAEgAjYCDCABIAA2AggLQeTfACgCACIAIARNDQBB5N8AIAAgBGsiATYCAEHw3wBB8N8AKAIAIgAgBGoiAjYCACACIAFBAXI2AgQgACAEQQNyNgIEIABBCGohAAwDC0HU3wBBMDYCAEEAIQAMAgsCQCAJRQ0AAkAgBSgCHCICQQJ0QYjiAGoiACgCACAFRgRAIAAgAzYCACADDQFB3N8AIAhBfiACd3EiCDYCAAwCCyAJQRBBFCAJKAIQIAVGG2ogAzYCACADRQ0BCyADIAk2AhggBSgCECIABEAgAyAANgIQIAAgAzYCGAsgBSgCFCIARQ0AIAMgADYCFCAAIAM2AhgLAkAgAUEPTQRAIAUgASAEaiIAQQNyNgIEIAAgBWoiACAAKAIEQQFyNgIEDAELIAUgBEEDcjYCBCAHIAFBAXI2AgQgASAHaiABNgIAIAFB/wFNBEAgAUEDdiIBQQN0QYDgAGohAAJ/QdjfACgCACICQQEgAXQiAXFFBEBB2N8AIAEgAnI2AgAgAAwBCyAAKAIICyEBIAAgBzYCCCABIAc2AgwgByAANgIMIAcgATYCCAwBC0EfIQAgAUH///8HTQRAIAFBCHYiACAAQYD+P2pBEHZBCHEiAHQiAiACQYDgH2pBEHZBBHEiAnQiBCAEQYCAD2pBEHZBAnEiBHRBD3YgACACciAEcmsiAEEBdCABIABBFWp2QQFxckEcaiEACyAHIAA2AhwgB0IANwIQIABBAnRBiOIAaiECAkACQCAIQQEgAHQiBHFFBEBB3N8AIAQgCHI2AgAgAiAHNgIAIAcgAjYCGAwBCyABQQBBGSAAQQF2ayAAQR9GG3QhACACKAIAIQQDQCAEIgIoAgRBeHEgAUYNAiAAQR12IQQgAEEBdCEAIAIgBEEEcWpBEGoiAygCACIEDQALIAMgBzYCACAHIAI2AhgLIAcgBzYCDCAHIAc2AggMAQsgAigCCCIAIAc2AgwgAiAHNgIIIAdBADYCGCAHIAI2AgwgByAANgIICyAFQQhqIQAMAQsCQCAKRQ0AAkAgAygCHCICQQJ0QYjiAGoiACgCACADRgRAIAAgBTYCACAFDQFB3N8AIAlBfiACd3E2AgAMAgsgCkEQQRQgCigCECADRhtqIAU2AgAgBUUNAQsgBSAKNgIYIAMoAhAiAARAIAUgADYCECAAIAU2AhgLIAMoAhQiAEUNACAFIAA2AhQgACAFNgIYCwJAIAFBD00EQCADIAEgBGoiAEEDcjYCBCAAIANqIgAgACgCBEEBcjYCBAwBCyADIARBA3I2AgQgCyABQQFyNgIEIAEgC2ogATYCACAIBEAgCEEDdiIEQQN0QYDgAGohAkHs3wAoAgAhAAJ/QQEgBHQiBCAGcUUEQEHY3wAgBCAGcjYCACACDAELIAIoAggLIQQgAiAANgIIIAQgADYCDCAAIAI2AgwgACAENgIIC0Hs3wAgCzYCAEHg3wAgATYCAAsgA0EIaiEACyAMQRBqJAAgAAvMDAEHfwJAIABFDQAgAEEIayICIABBBGsoAgAiAUF4cSIAaiEFAkAgAUEBcQ0AIAFBA3FFDQEgAiACKAIAIgFrIgJB6N8AKAIASQ0BIAAgAWohACACQezfACgCAEcEQCABQf8BTQRAIAIoAggiBCABQQN2IgdBA3RBgOAAakYaIAQgAigCDCIBRgRAQdjfAEHY3wAoAgBBfiAHd3E2AgAMAwsgBCABNgIMIAEgBDYCCAwCCyACKAIYIQYCQCACIAIoAgwiA0cEQCACKAIIIgEgAzYCDCADIAE2AggMAQsCQCACQRRqIgEoAgAiBA0AIAJBEGoiASgCACIEDQBBACEDDAELA0AgASEHIAQiA0EUaiIBKAIAIgQNACADQRBqIQEgAygCECIEDQALIAdBADYCAAsgBkUNAQJAIAIgAigCHCIEQQJ0QYjiAGoiASgCAEYEQCABIAM2AgAgAw0BQdzfAEHc3wAoAgBBfiAEd3E2AgAMAwsgBkEQQRQgBigCECACRhtqIAM2AgAgA0UNAgsgAyAGNgIYIAIoAhAiAQRAIAMgATYCECABIAM2AhgLIAIoAhQiAUUNASADIAE2AhQgASADNgIYDAELIAUoAgQiAUEDcUEDRw0AQeDfACAANgIAIAUgAUF+cTYCBCACIABBAXI2AgQgACACaiAANgIADwsgAiAFTw0AIAUoAgQiAUEBcUUNAAJAIAFBAnFFBEAgBUHw3wAoAgBGBEBB8N8AIAI2AgBB5N8AQeTfACgCACAAaiIANgIAIAIgAEEBcjYCBCACQezfACgCAEcNA0Hg3wBBADYCAEHs3wBBADYCAA8LIAVB7N8AKAIARgRAQezfACACNgIAQeDfAEHg3wAoAgAgAGoiADYCACACIABBAXI2AgQgACACaiAANgIADwsgAUF4cSAAaiEAAkAgAUH/AU0EQCAFKAIIIgQgAUEDdiIHQQN0QYDgAGpGGiAEIAUoAgwiAUYEQEHY3wBB2N8AKAIAQX4gB3dxNgIADAILIAQgATYCDCABIAQ2AggMAQsgBSgCGCEGAkAgBSAFKAIMIgNHBEAgBSgCCCIBQejfACgCAEkaIAEgAzYCDCADIAE2AggMAQsCQCAFQRRqIgEoAgAiBA0AIAVBEGoiASgCACIEDQBBACEDDAELA0AgASEHIAQiA0EUaiIBKAIAIgQNACADQRBqIQEgAygCECIEDQALIAdBADYCAAsgBkUNAAJAIAUgBSgCHCIEQQJ0QYjiAGoiASgCAEYEQCABIAM2AgAgAw0BQdzfAEHc3wAoAgBBfiAEd3E2AgAMAgsgBkEQQRQgBigCECAFRhtqIAM2AgAgA0UNAQsgAyAGNgIYIAUoAhAiAQRAIAMgATYCECABIAM2AhgLIAUoAhQiAUUNACADIAE2AhQgASADNgIYCyACIABBAXI2AgQgACACaiAANgIAIAJB7N8AKAIARw0BQeDfACAANgIADwsgBSABQX5xNgIEIAIgAEEBcjYCBCAAIAJqIAA2AgALIABB/wFNBEAgAEEDdiIBQQN0QYDgAGohAAJ/QdjfACgCACIEQQEgAXQiAXFFBEBB2N8AIAEgBHI2AgAgAAwBCyAAKAIICyEBIAAgAjYCCCABIAI2AgwgAiAANgIMIAIgATYCCA8LQR8hASACQgA3AhAgAEH///8HTQRAIABBCHYiASABQYD+P2pBEHZBCHEiAXQiBCAEQYDgH2pBEHZBBHEiBHQiAyADQYCAD2pBEHZBAnEiA3RBD3YgASAEciADcmsiAUEBdCAAIAFBFWp2QQFxckEcaiEBCyACIAE2AhwgAUECdEGI4gBqIQQCQAJAAkBB3N8AKAIAIgNBASABdCIFcUUEQEHc3wAgAyAFcjYCACAEIAI2AgAgAiAENgIYDAELIABBAEEZIAFBAXZrIAFBH0YbdCEBIAQoAgAhAwNAIAMiBCgCBEF4cSAARg0CIAFBHXYhAyABQQF0IQEgBCADQQRxakEQaiIFKAIAIgMNAAsgBSACNgIAIAIgBDYCGAsgAiACNgIMIAIgAjYCCAwBCyAEKAIIIgAgAjYCDCAEIAI2AgggAkEANgIYIAIgBDYCDCACIAA2AggLQfjfAEH43wAoAgBBAWsiAkF/IAIbNgIACwtVAQJ/QdDfACgCACIBIABBA2pBfHEiAmohAAJAIAJBAU5BACAAIAFNGw0APwBBEHQgAEkEQCAAEABFDQELQdDfACAANgIAIAEPC0HU3wBBMDYCAEF/C4IEAQN/IAJBgARPBEAgACABIAIQARogAA8LIAAgAmohAwJAIAAgAXNBA3FFBEACQCACQQFIBEAgACECDAELIABBA3FFBEAgACECDAELIAAhAgNAIAIgAS0AADoAACABQQFqIQEgAkEBaiICIANPDQEgAkEDcQ0ACwsCQCADQXxxIgRBwABJDQAgAiAEQUBqIgVLDQADQCACIAEoAgA2AgAgAiABKAIENgIEIAIgASgCCDYCCCACIAEoAgw2AgwgAiABKAIQNgIQIAIgASgCFDYCFCACIAEoAhg2AhggAiABKAIcNgIcIAIgASgCIDYCICACIAEoAiQ2AiQgAiABKAIoNgIoIAIgASgCLDYCLCACIAEoAjA2AjAgAiABKAI0NgI0IAIgASgCODYCOCACIAEoAjw2AjwgAUFAayEBIAJBQGsiAiAFTQ0ACwsgAiAETw0BA0AgAiABKAIANgIAIAFBBGohASACQQRqIgIgBEkNAAsMAQsgA0EESQRAIAAhAgwBCyAAIANBBGsiBEsEQCAAIQIMAQsgACECA0AgAiABLQAAOgAAIAIgAS0AAToAASACIAEtAAI6AAIgAiABLQADOgADIAFBBGohASACQQRqIgIgBE0NAAsLIAIgA0kEQANAIAIgAS0AADoAACABQQFqIQEgAkEBaiICIANHDQALCyAAC9YCAQJ/AkAgAUUNACAAIAFqIgJBAWtBADoAACAAQQA6AAAgAUEDSQ0AIAJBAmtBADoAACAAQQA6AAEgAkEDa0EAOgAAIABBADoAAiABQQdJDQAgAkEEa0EAOgAAIABBADoAAyABQQlJDQAgAEEAIABrQQNxIgNqIgJBADYCACACIAEgA2tBfHEiA2oiAUEEa0EANgIAIANBCUkNACACQQA2AgggAkEANgIEIAFBCGtBADYCACABQQxrQQA2AgAgA0EZSQ0AIAJBADYCGCACQQA2AhQgAkEANgIQIAJBADYCDCABQRBrQQA2AgAgAUEUa0EANgIAIAFBGGtBADYCACABQRxrQQA2AgAgAyACQQRxQRhyIgNrIgFBIEkNACACIANqIQIDQCACQgA3AxggAkIANwMQIAJCADcDCCACQgA3AwAgAkEgaiECIAFBIGsiAUEfSw0ACwsLBAAjAAsGACAAJAALEAAjACAAa0FwcSIAJAAgAAsLvVYIAEGECAvxQJYwB3csYQ7uulEJmRnEbQeP9GpwNaVj6aOVZJ4yiNsOpLjceR7p1eCI2dKXK0y2Cb18sX4HLbjnkR2/kGQQtx3yILBqSHG5895BvoR91Noa6+TdbVG11PTHhdODVphsE8Coa2R6+WL97Mllik9cARTZbAZjYz0P+vUNCI3IIG47XhBpTORBYNVycWei0eQDPEfUBEv9hQ3Sa7UKpfqotTVsmLJC1sm720D5vKzjbNgydVzfRc8N1txZPdGrrDDZJjoA3lGAUdfIFmHQv7X0tCEjxLNWmZW6zw+lvbieuAIoCIgFX7LZDMYk6Quxh3xvLxFMaFirHWHBPS1mtpBB3HYGcdsBvCDSmCoQ1e+JhbFxH7W2BqXkv58z1LjooskHeDT5AA+OqAmWGJgO4bsNan8tPW0Il2xkkQFcY+b0UWtrYmFsHNgwZYVOAGLy7ZUGbHulARvB9AiCV8QP9cbZsGVQ6bcS6ri+i3yIufzfHd1iSS3aFfN804xlTNT7WGGyTc5RtTp0ALyj4jC71EGl30rXldg9bcTRpPv01tNq6WlD/NluNEaIZ63QuGDacy0EROUdAzNfTAqqyXwN3TxxBVCqQQInEBALvoYgDMkltWhXs4VvIAnUZrmf5GHODvneXpjJ2SkimNCwtKjXxxc9s1mBDbQuO1y9t61susAgg7jttrO/mgzitgOa0rF0OUfV6q930p0VJtsEgxbccxILY+OEO2SUPmptDahaanoLzw7knf8JkyeuAAqxngd9RJMP8NKjCIdo8gEe/sIGaV1XYvfLZ2WAcTZsGecGa252G9T+4CvTiVp62hDMSt1nb9+5+fnvvo5DvrcX1Y6wYOij1tZ+k9GhxMLYOFLy30/xZ7vRZ1e8pt0GtT9LNrJI2isN2EwbCq/2SgM2YHoEQcPvYN9V32eo745uMXm+aUaMs2HLGoNmvKDSbyU24mhSlXcMzANHC7u5FgIiLyYFVb47usUoC72yklq0KwRqs1yn/9fCMc/QtYue2Swdrt5bsMJkmybyY+yco2p1CpNtAqkGCZw/Ng7rhWcHchNXAAWCSr+VFHq44q4rsXs4G7YMm47Skg2+1eW379x8Id/bC9TS04ZC4tTx+LPdaG6D2h/NFr6BWya59uF3sG93R7cY5loIiHBqD//KOwZmXAsBEf+eZY9prmL40/9rYUXPbBZ44gqg7tIN11SDBE7CswM5YSZnp/cWYNBNR2lJ23duPkpq0a7cWtbZZgvfQPA72DdTrrypxZ673n/Pskfp/7UwHPK9vYrCusowk7NTpqO0JAU20LqTBtfNKVfeVL9n2SMuemazuEphxAIbaF2UK28qN74LtKGODMMb3wVaje8CLQAAAABBMRsZgmI2MsNTLSsExWxkRfR3fYanWlbHlkFPCIrZyEm7wtGK6O/6y9n04wxPtaxNfq61ji2Dns8cmIdREsJKECPZU9Nw9HiSQe9hVdeuLhTmtTfXtZgcloSDBVmYG4IYqQCb2/otsJrLNqldXXfmHGxs/98/QdSeDlrNoiSEleMVn4wgRrKnYXepvqbh6PHn0PPoJIPew2Wyxdqqrl1d659GRCjMa29p/XB2rmsxOe9aKiAsCQcLbTgcEvM2Rt+yB13GcVRw7TBla/T38yq7tsIxonWRHIk0oAeQ+7yfF7qNhA553qklOO+yPP9583O+SOhqfRvFQTwq3lgFT3nwRH5i6YctT8LGHFTbAYoVlEC7Do2D6COmwtk4vw3FoDhM9Lshj6eWCs6WjRMJAMxcSDHXRYti+m7KU+F3VF27uhVsoKPWP42Ilw6WkVCY194RqczH0vrh7JPL+vVc12JyHeZ5a961VECfhE9ZWBIOFhkjFQ/acDgkm0EjPadr/WXmWuZ8JQnLV2Q40E6jrpEB4p+KGCHMpzNg/bwqr+Ekre7QP7QtgxKfbLIJhqskSMnqFVPQKUZ++2h3ZeL2eT8vt0gkNnQbCR01KhIE8rxTS7ONSFJw3mV5Me9+YP7z5ue/wv3+fJHQ1T2gy8z6NoqDuweRmnhUvLE5ZaeoS5iDOwqpmCLJ+rUJiMuuEE9d718ObPRGzT/ZbYwOwnRDElrzAiNB6sFwbMGAQXfYR9c2lwbmLY7FtQClhIQbvBqKQXFbu1pomOh3Q9nZbFoeTy0VX342DJwtGyfdHAA+EgCYuVMxg6CQYq6L0VO1khbF9N1X9O/ElKfC79WW2fbpvAeuqI0ct2veMZwq7yqF7XlryqxIcNNvG134LipG4eE23magB8V/Y1ToVCJl803l87ICpMKpG2eRhDAmoJ8puK7F5Pmf3v06zPPWe/3oz7xrqYD9WrKZPgmfsn84hKuwJBws8RUHNTJGKh5zdzEHtOFwSPXQa1E2g0Z6d7JdY07X+ssP5uHSzLXM+Y2E1+BKEpavCyONtshwoJ2JQbuERl0jAwdsOBrEPxUxhQ4OKEKYT2cDqVR+wPp5VYHLYkwfxTiBXvQjmJ2nDrPclhWqGwBU5VoxT/yZYmLX2FN5zhdP4UlWfvpQlS3Xe9QczGITio0tUruWNJHoux/Q2aAG7PN+Xq3CZUdukUhsL6BTdeg2EjqpBwkjalQkCCtlPxHkeaeWpUi8j2YbkaQnKoq94LzL8qGN0Oti3v3AI+/m2b3hvBT80KcNP4OKJn6ykT+5JNBw+BXLaTtG5kJ6d/1btWtl3PRafsU3CVPudjhI97GuCbjwnxKhM8w/inL9JJMAAAAAN2rCAW7UhANZvkYC3KgJB+vCywayfI0EhRZPBbhREw6PO9EP1oWXDeHvVQxk+RoJU5PYCAotngo9R1wLcKMmHEfJ5B0ed6IfKR1gHqwLLxubYe0awt+rGPW1aRnI8jUS/5j3E6YmsRGRTHMQFFo8FSMw/hR6jrgWTeR6F+BGTTjXLI85jpLJO7n4Czo87kQ/C4SGPlI6wDxlUAI9WBdeNm99nDc2w9o1AakYNIS/VzGz1ZUw6mvTMt0BETOQ5Wskp4+pJf4x7yfJWy0mTE1iI3snoCIimeYgFfMkISi0eCof3rorRmD8KXEKPij0HHEtw3azLJrI9S6tojcvwI2acPfnWHGuWR5zmTPcchwlk3crT1F2cvEXdEWb1XV43Il+T7ZLfxYIDX0hYs98pHSAeZMeQnjKoAR6/crGe7AuvGyHRH5t3vo4b+mQ+m5shrVrW+x3agJSMWg1OPNpCH+vYj8VbWNmqythUcHpYNTXpmXjvWRkugMiZo1p4Gcgy9dIF6EVSU4fU0t5dZFK/GPeT8sJHE6St1pMpd2YTZiaxEav8AZH9k5ARcEkgkREMs1Bc1gPQCrmSUIdjItDUGjxVGcCM1U+vHVXCda3VozA+FO7qjpS4hR8UNV+vlHoOeJa31MgW4btZlmxh6RYNJHrXQP7KVxaRW9ebS+tX4AbNeG3cffg7s+x4tmlc+Ncszzma9n+5zJnuOUFDXrkOEom7w8g5O5WnqLsYfRg7eTiL+jTiO3pijar671caerwuBP9x9LR/J5sl/6pBlX/LBAa+ht62PtCxJ75da5c+EjpAPN/g8LyJj2E8BFXRvGUQQn0oyvL9fqVjffN/0/2YF142Vc3utgOifzaOeM+27z1cd6Ln7Pf0iH13eVLN9zYDGvX72ap1rbY79SBsi3VBKRi0DPOoNFqcObTXRok0hD+XsUnlJzEfiraxklAGMfMVlfC+zyVw6KC08GV6BHAqK9Ny5/Fj8rGe8nI8RELyXQHRMxDbYbNGtPAzy25As5Alq+Rd/xtkC5CK5IZKOmTnD6mlqtUZJfy6iKVxYDglPjHvJ/PrX6elhM4nKF5+p0kb7WYEwV3mUq7MZt90fOaMDWJjQdfS4xe4Q2OaYvPj+ydgIrb90KLgkkEibUjxoiIZJqDvw5YguawHoDR2tyBVMyThGOmUYU6GBeHDXLVhqDQ4qmXuiCozgRmqvlupKt8eOuuSxIprxKsb60lxq2sGIHxpy/rM6Z2VXWkQT+3pcQp+KDzQzqhqv18o52XvqLQc8S15xkGtL6nQLaJzYK3DNvNsjuxD7NiD0mxVWWLsGgi17tfSBW6BvZTuDGckbm0it68g+AcvdpeWr/tNJi+AAAAAGVnvLiLyAmq7q+1EleXYo8y8N433F9rJbk4153vKLTFik8IfWTgvW8BhwHXuL/WSt3YavIzd9/gVhBjWJ9XGVD6MKXoFJ8Q+nH4rELIwHvfrafHZ0MIcnUmb87NcH+tlRUYES37t6Q/ntAYhyfozxpCj3OirCDGsMlHegg+rzKgW8iOGLVnOwrQAIeyaThQLwxf7Jfi8FmFh5flPdGHhmW04DrdWk+Pzz8oM3eGEOTq43dYUg3Y7UBov1H4ofgr8MSfl0gqMCJaT1ee4vZvSX+TCPXHfadA1RjA/G1O0J81K7cjjcUYlp+gfyonGUf9unwgQQKSj/QQ9+hIqD1YFJtYP6gjtpAdMdP3oYlqz3YUD6jKrOEHf76EYMMG0nCgXrcXHOZZuKn0PN8VTIXnwtHggH5pDi/Le2tId8OiDw3Lx2ixcynHBGFMoLjZ9ZhvRJD/0/x+UGbuGzfaVk0nuQ4oQAW2xu+wpKOIDBwasNuBf9dnOZF40iv0H26TA/cmO2aQmoOIPy+R7ViTKVRgRLQxB/gM36hNHrrP8abs35L+ibguRmcXm1QCcCfsu0jwcd4vTMkwgPnbVedFY5ygP2v5x4PTF2g2wXIPinnLN13krlDhXED/VE4lmOj2c4iLrhbvNxb4QIIEnSc+vCQf6SFBeFWZr9fgi8qwXDM7tlntXtHlVbB+UEfVGez/bCE7YglGh9rn6TLIgo6OcNSe7Six+VGQX1bkgjoxWDqDCY+n5m4zHwjBhg1tpjq1pOFAvcGG/AUvKUkXSk71r/N2IjKWEZ6KeL4rmB3ZlyBLyfR4Lq5IwMAB/dKlZkFqHF6W93k5Kk+Xlp9d8vEj5QUZa01gftf1jtFi5+u23l9SjgnCN+m1etlGAGi8IbzQ6jHfiI9WYzBh+dYiBJ5qmr2mvQfYwQG/Nm60rVMJCBWaTnId/ynOpRGGe7d04ccPzdkQkqi+rCpGERk4I3algHVmxtgQAXpg/q7PcpvJc8oi8aRXR5YY76k5rf3MXhFFBu5NdmOJ8c6NJkTc6EH4ZFF5L/k0HpNB2rEmU7/WmuvpxvmzjKFFC2IO8BkHaUyhvlGbPNs2J4Q1mZKWUP4uLpm5VCb83uieEnFdjHcW4TTOLjapq0mKEUXmPwMggYO7dpHg4xP2XFv9WelJmD5V8SEGgmxEYT7Uqs6Lxs+pN344QX/WXSbDbrOJdnzW7srEb9YdWQqxoeHkHhTzgXmoS9dpyxOyDnerXKHCuTnGfgGA/qmc5ZkVJAs2oDZuURyOpxZmhsJx2j4s3m8sSbnTlPCBBAmV5rixe0kNox4usRtIPtJDLVlu+8P22+mmkWdRH6mwzHrODHSUYblm8QYF3gAAAAB3BzCW7g5hLJkJUboHbcQZcGr0j+ljpTWeZJWjDtuIMnncuKTg1ekel9LZiAm2TCt+sXy957gtB5C/HZEdtxBkarAg8vO5cUiEvkHeGtrUfW3d5Ov01LVRg9OFxxNsmFZka6jA/WL5eoplyewUAVxPYwZs2foPPWONCA31O24gyExpEF7VYEHkomdxcjwD5NFLBNRH0g2F/aUKtWs1taj6QrKYbNu7ydasvPlAMths40XfXHXc1g3Pq9E9WSbZMKxR3gA6yNdRgL/QYRYhtPS1VrPEI8+6lZm4vaUPKAK4nl8FiAjGDNmysQvpJC9vfIdYaEwRwWEdq7ZmLT123EGQAdtxBpjSILzv1RAqcbGFiQa2tR+fv+Sl6LjUM3gHyaIPAPk0lgmojuEOmBh/ag27CG09LZFkbJfmY1wBa2tR9BxsYWKFZTDY8mIATmwGle0bAaV7ggj0wfUPxFdlsNnGErfpUIu+uOr8uYh8Yt0d3xXaLUmM03zz+9RMZU2yYVg6tVHOo7wAdNS7MOJK36VBPdiV16TRxG3T1vT7Q2npajRu2fytZ4hG2mC40EQELXMzAx3lqgpMX90NfMlQBXE8JwJBqr4LEBDJDCCGV2i1JSBvhbO5ZtQJzmHkn17e+Q4p2cmYsNCYIsfXqLRZsz0XLrQNgbe9XDvAumyt7biDIJq/s7YDtuIMdLHSmurVRzmd0nevBNsmFXPcFoPjYwsSlGQ7hA1taj56alqo5A7PC5MJ/50KAK4nfQeesfAPk0SHCKPSHgHyaGkGwv73YlddgGVnyxlsNnFuawbn/tQbdonTK+AQ2npaZ91KzPm532+Ovu/5F7e+Q2CwjtXW1qPoodGTfjjYwsRP3/JS0btn8aa8V2c/tQbdSLI2S9gNK9qvChtMNgNK9kEEemDfYO/DqGffVTFuju9Gab55y2GzjLxmgxolb9KgUmjiNswMd5W7C0cDIgIWuVUFJi/Fuju+sr0LKCu0WpJcs2oEwtf/p7XQzzEs2Z6LW96uHZtkwrDsY/ImdWqjnAJtkwqcCQap6w42P3IHZ4UFAFcTlb9KguK4ehR7sSuuDLYbOJLSjpvl1b4NfNzvtwvb3yGG09LU8dTiQmjds/gf2oNugb4Wzfa5JltvsHfhGLdHd4gIWub/D2pwZgY7yhEBC1yPZZ7/+GKuaWFr/9MWbM9FoArieNcN0u5OBINUOQOzwqdnJmHQYBb3SWlHTT5ud9uu0WpK2dZa3EDfC2Y32DvwqbyuU967nsVHss9/MLX/6b298hzKusKKU7OTMCS0o6a60DYFzdcGk1TeVykj2We/s2Z6LsRhSrhdaBsCKm8rlLQLvjfDDI6hWgXfGy0C740AAAAAGRsxQTI2YoIrLVPDZGzFBH139EVWWqeGT0GWx8jZigjRwrtJ+u/oiuP02custU8Mta5+TZ6DLY6HmBzPSsISUVPZIxB49HDTYe9Bki6u11U3teYUHJi11wWDhJaCG5hZmwCpGLAt+tupNsua5nddXf9sbBzUQT/fzVoOnpWEJKKMnxXjp7JGIL6pd2Hx6OGm6PPQ58PegyTaxbJlXV2uqkRGn+tva8wodnD9aTkxa64gKlrvCwcJLBIcOG3fRjbzxl0Hsu1wVHH0a2Uwuyrz96IxwraJHJF1kAegNBefvPsOhI26JaneeTyy7zhz83n/auhIvkHFG31Y3io88HlPBelifkTCTy2H21QcxpQVigGNDrtApiPog7842cI4oMUNIbv0TAqWp48TjZbOXMwACUXXMUhu+mKLd+FTyrq7XVSjoGwViI0/1pGWDpfe15hQx8ypEezh+tL1+suTcmLXXGt55h1AVLXeWU+EnxYOElgPFSMZJDhw2j0jQZtl/WunfOZa5lfLCSVO0DhkAZGuoxiKn+Izp8whKrz9YK0k4a+0P9DunxKDLYYJsmzJSCSr0FMV6vt+RiniZXdoLz959jYkSLcdCRt0BBIqNUtTvPJSSI2zeWXecGB+7zHn5vP+/v3Cv9XQkXzMy6A9g4o2+pqRB7uxvFR4qKdlOTuDmEsimKkKCbX6yRCuy4hf711PRvRsDm3ZP810wg6M81oSQ+pBIwLBbHDB2HdBgJc210eOLeYGpQC1xbwbhIRxQYoaaFq7W0N36JhabNnZFS1PHgw2fl8nGy2cPgAc3bmYABKggzFTi65ikJK1U9Hd9MUWxO/0V+/Cp5T22ZbVrge86bccjaicMd5rhSrvKspree3TcEis+F0bb+FGKi5m3jbhf8UHoFToVGNN82UiArLz5RupwqQwhJFnKZ+gJuTFrrj93p/51vPMOs/o/XuAqWu8mbJa/bKfCT6rhDh/LBwksDUHFfEeKkYyBzF3c0hw4bRRa9D1ekaDNmNdsnfL+tdO0uHmD/nMtczg14SNr5YSSraNIwudoHDIhLtBiQMjXUYaOGwHMRU/xCgODoVnT5hCflSpA1V5+sBMYsuBgTjFH5gj9F6zDqedqhWW3OVUABv8TzFa12Jimc55U9hJ4U8XUPp+VnvXLZVizBzULY2KEzSWu1Ifu+iRBqDZ0F5+8+xHZcKtbEiRbnVToC86EjboIwkHqQgkVGoRP2Urlqd55I+8SKWkkRtmvYoqJ/LLvODr0I2hwP3eYtnm7yMUvOG9DafQ/CaKgz8/kbJ+cNAkuWnLFfhC5kY7W/13etxla7XFflr07lMJN/dIOHa4Ca6xoRKf8Io/zDOTJP1yAAAAAAHCajcDhNRuAka+WQcJqNwGy8LrBI18sgVPFoUOE1G4D9E7jw2XhdYMVe/hCRr5ZAjYk1MKni0KC1xHPRwmo3Ad5MlHH6J3Hh5gHSkbLwusGu1hmxir38IZabX1EjXyyBP3mP8RsSamEHNMkRU8WhQU/jAjFriOehd65E04TUbgOY8s1zvJko46C/i5P0TuPD6GhAs8wDpSPQJQZTZeF1g3nH1vNdrDNjQYqQExV7+EMJXVszLTa+ozEQHdJGvlkCWpj6cn7zH+Ji1bySNiTUwioCd7IOaZIiEk8xUqeLQoK7reHyn8YEYoPgpxLXEc9CyzdsMu9ciaLzeirXCajcBxWOf3cx5ZrnLcM5l3kyUcdlFPK3QX8XJ11ZtFfonceH9Ltk99DQgWfM9iIXmAdKR4Qh6TegSgynvGyv1svC6wbX5Eh284+t5u+pDpa7WGbGp37FtoMVICafM4NWKvfwhjbRU/YSurZmDpwVFlptfUZGS942YiA7pn4GmNSNfLIEkVoRdLUx9OSpF1eU/eY/xOHAnLTFq3kk2Y3aVGxJqYRwbwr0VATvZEgiTBQc0yREAPWHNCSeYqQ4uMHVTxaFBVMwJnV3W8Pla31glT+MCMUjqqu1B8FOJRvn7VWuI56FsgU99ZZu2GWKSHsV3rkTRcKfsDXm9FWl+tL23hNRuA4Pdxt+Kxz+7jc6XZ5jyzXOf+2WvluGcy5HoNBe8mSjju5CAP7KKeVu1g9GHoL+Lk6e2I0+urNorqaVy9/RO48PzR0sf+l2ye/1UGqfoaECz72Hob+Z7EQvhcrnXzAOlI8sKDf/CEPSbxRlcR9AlBlPXLK6P3jZX69k//zdl4XWDYujdX2vyJDts+4znecfW837Ofi931IdLcN0vl12sM2NapZu/U79i21S2ygdBipATRoM4z0+ZwatIkGl3FXv4QxJyUJ8baKn7HGEBJwldWzMOVPPvB04KiwBHolctNr6jKj8WfyMl7xskLEfHMRAd0zYZtQ8/A0xrOArktka+WQJBt/HeSK0Iuk+koGZamPpyXZFSrlSLq8pTggMWfvMf4nn6tz5w4E5ad+nmhmLVvJJl3BRObMbtKmvPRfY2JNTCMS18Hjg3hXo/Pi2mKgJ3si0L324kESYKIxiO1g5pkiIJYDr+AHrDmgdza0YSTzFSFUaZjhxcYOobVcg2p4tCgqCC6l6pmBM6rpG75rut4fK8pEkutb6wSrK3GJafxgRimM+svpHVVdqW3P0Gg+CnEoTpD86N8/aqivpedtcRz0LQGGee2QKe+t4LNibLN2wyzD7E7sUkPYrCLZVW71yJouhVIX7hT9ga5kZwxvN6KtL0c4IO/Wl7avpg07QAAAAC4vGdlqgnIixK1r+6PYpdXN97wMiVrX9yd1zi5xbQo730IT4pvveBk1wGHAUrWv7jyatjd4N93M1hjEFZQGVef6KUw+voQnxRCrPhx33vAyGfHp611cghDzc5vJpWtf3AtERgVP6S3+4cY0J4az+gnonOPQrDGIKwIekfJoDKvPhiOyFsKO2e1socA0C9QOGmX7F8MhVnw4j3ll4dlhofR3TrgtM+PT1p3Myg/6uQQhlJYd+NA7dgN+FG/aPAr+KFIl5/EWiIwKuKeV09/SW/2x/UIk9VAp31t/MAYNZ/QTo0jtyuflhjFJyp/oLr9RxkCQSB8EPSPkqhI6PebFFg9I6g/WDEdkLaJoffTFHbPaqzKqA++fwfhBsNghF6gcNLmHBe39Km4WUwV3zzRwueFaX6A4HvLLw7Dd0hryw0PonOxaMdhBMcp2bigTERvmPX80/+Q7mZQflbaNxsOuSdNtgVAKKSw78YcDIijgduwGjln138r0niRk24f9Dsm9wODmpBmkS8/iCmTWO20RGBUDPgHMR5NqN+m8c+6/pLf7EYuuIlUmxdn7CdwAnHwSLvJTC/e2/mAMGNF51VrP6Cc04PH+cE2aBd5ig9y5F03y1zhUK5OVP9A9uiYJa6LiHMWN+8WBIJA+Lw+J50h6R8kmVV4QYvg168zXLDK7Vm2O1Xl0V5HUH6w/+wZ1WI7IWzah0YJyDLp53COjoIo7Z7UkFH5sYLkVl86WDE6p48Jgx8zbuYNhsEItTqmbb1A4aQF/IbBF0kpL6/1TkoyInbzip4Rlpgrvnggl9kdePTJS8BIri7S/QHAakFmpfeWXhxPKjl5XZ+Wl+Uj8fJNaxkF9dd+YOdi0Y5f3rbrwgmOUnq16TdoAEbZ0LwhvIjfMeowY1aPItb5YZpqngQHvaa9vwHB2K20bjYVCAlTHXJOmqXOKf+3e4YRD8fhdJIQ2c0qrL6oOBkRRoCldiPYxmZ1YHoBEHLPrv7Kc8mbV6TxIu8Ylkf9rTmpRRFezHZN7gbO8Ylj3EQmjWT4Qej5L3lRQZMeNFMmsdrrmta/s/nG6QtFoYwZ8A5ioUxpBzybUb6EJzbblpKZNS4u/lAmVLmZnuje/IxdcRI04RZ3qTYuzhGKSasDP+ZFu4OBIOPgkXZbXPYTSelZ/fFVPphsggYh1D5hRMaLzqp+N6nP1n9BOG7DJl18domzxMru1lkd1m/hobEK8xQe5EuoeYETy2nXq3cOsrnCoVwBfsY5nKn+gCQVmeU2oDYLjhxRboZmFqc+2nHCLG/eLJTTuUkJBIHwsbjmlaMNSXsbsS4eQ9I+SPtuWS3p2/bDUWeRpsywqR90DM56ZrlhlN4FBvEAAAAAAAAAAAMAAAAEAAQACAAEAAQAAAAEAAUAEAAIAAQAAAAEAAYAIAAgAAQAAAAEAAQAEAAQAAUAAAAIABAAIAAgAAUAAAAIABAAgACAAAUAAAAIACAAgAAAAQUAAAAgAIAAAgEABAUAAAAgAAIBAgEAEAUAQYHJAAu2EAECAwQEBQUGBgYGBwcHBwgICAgICAgICQkJCQkJCQkKCgoKCgoKCgoKCgoKCgoKCwsLCwsLCwsLCwsLCwsLCwwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDwAAEBESEhMTFBQUFBUVFRUWFhYWFhYWFhcXFxcXFxcXGBgYGBgYGBgYGBgYGBgYGBkZGRkZGRkZGRkZGRkZGRkaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHB0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0AAQIDBAUGBwgICQkKCgsLDAwMDA0NDQ0ODg4ODw8PDxAQEBAQEBAQERERERERERESEhISEhISEhMTExMTExMTFBQUFBQUFBQUFBQUFBQUFBUVFRUVFRUVFRUVFRUVFRUWFhYWFhYWFhYWFhYWFhYWFxcXFxcXFxcXFxcXFxcXFxgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxscwCcAAMAsAAABAQAAHgEAAA8AAABALAAAQC0AAAAAAAAeAAAADwAAAAAAAADALQAAAAAAABMAAAAHAAAAAAAAAAwACACMAAgATAAIAMwACAAsAAgArAAIAGwACADsAAgAHAAIAJwACABcAAgA3AAIADwACAC8AAgAfAAIAPwACAACAAgAggAIAEIACADCAAgAIgAIAKIACABiAAgA4gAIABIACACSAAgAUgAIANIACAAyAAgAsgAIAHIACADyAAgACgAIAIoACABKAAgAygAIACoACACqAAgAagAIAOoACAAaAAgAmgAIAFoACADaAAgAOgAIALoACAB6AAgA+gAIAAYACACGAAgARgAIAMYACAAmAAgApgAIAGYACADmAAgAFgAIAJYACABWAAgA1gAIADYACAC2AAgAdgAIAPYACAAOAAgAjgAIAE4ACADOAAgALgAIAK4ACABuAAgA7gAIAB4ACACeAAgAXgAIAN4ACAA+AAgAvgAIAH4ACAD+AAgAAQAIAIEACABBAAgAwQAIACEACAChAAgAYQAIAOEACAARAAgAkQAIAFEACADRAAgAMQAIALEACABxAAgA8QAIAAkACACJAAgASQAIAMkACAApAAgAqQAIAGkACADpAAgAGQAIAJkACABZAAgA2QAIADkACAC5AAgAeQAIAPkACAAFAAgAhQAIAEUACADFAAgAJQAIAKUACABlAAgA5QAIABUACACVAAgAVQAIANUACAA1AAgAtQAIAHUACAD1AAgADQAIAI0ACABNAAgAzQAIAC0ACACtAAgAbQAIAO0ACAAdAAgAnQAIAF0ACADdAAgAPQAIAL0ACAB9AAgA/QAIABMACQATAQkAkwAJAJMBCQBTAAkAUwEJANMACQDTAQkAMwAJADMBCQCzAAkAswEJAHMACQBzAQkA8wAJAPMBCQALAAkACwEJAIsACQCLAQkASwAJAEsBCQDLAAkAywEJACsACQArAQkAqwAJAKsBCQBrAAkAawEJAOsACQDrAQkAGwAJABsBCQCbAAkAmwEJAFsACQBbAQkA2wAJANsBCQA7AAkAOwEJALsACQC7AQkAewAJAHsBCQD7AAkA+wEJAAcACQAHAQkAhwAJAIcBCQBHAAkARwEJAMcACQDHAQkAJwAJACcBCQCnAAkApwEJAGcACQBnAQkA5wAJAOcBCQAXAAkAFwEJAJcACQCXAQkAVwAJAFcBCQDXAAkA1wEJADcACQA3AQkAtwAJALcBCQB3AAkAdwEJAPcACQD3AQkADwAJAA8BCQCPAAkAjwEJAE8ACQBPAQkAzwAJAM8BCQAvAAkALwEJAK8ACQCvAQkAbwAJAG8BCQDvAAkA7wEJAB8ACQAfAQkAnwAJAJ8BCQBfAAkAXwEJAN8ACQDfAQkAPwAJAD8BCQC/AAkAvwEJAH8ACQB/AQkA/wAJAP8BCQAAAAcAQAAHACAABwBgAAcAEAAHAFAABwAwAAcAcAAHAAgABwBIAAcAKAAHAGgABwAYAAcAWAAHADgABwB4AAcABAAHAEQABwAkAAcAZAAHABQABwBUAAcANAAHAHQABwADAAgAgwAIAEMACADDAAgAIwAIAKMACABjAAgA4wAIAAAABQAQAAUACAAFABgABQAEAAUAFAAFAAwABQAcAAUAAgAFABIABQAKAAUAGgAFAAYABQAWAAUADgAFAB4ABQABAAUAEQAFAAkABQAZAAUABQAFABUABQANAAUAHQAFAAMABQATAAUACwAFABsABQAHAAUAFwAFAEHg2QALTQEAAAABAAAAAQAAAAEAAAACAAAAAgAAAAIAAAACAAAAAwAAAAMAAAADAAAAAwAAAAQAAAAEAAAABAAAAAQAAAAFAAAABQAAAAUAAAAFAEHQ2gALZQEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAUAAAAGAAAABgAAAAcAAAAHAAAACAAAAAgAAAAJAAAACQAAAAoAAAAKAAAACwAAAAsAAAAMAAAADAAAAA0AAAANAEGA3AALIwIAAAADAAAABwAAAAAAAAAQERIACAcJBgoFCwQMAw0CDgEPAEG03AALaQEAAAACAAAAAwAAAAQAAAAFAAAABgAAAAcAAAAIAAAACgAAAAwAAAAOAAAAEAAAABQAAAAYAAAAHAAAACAAAAAoAAAAMAAAADgAAABAAAAAUAAAAGAAAABwAAAAgAAAAKAAAADAAAAA4ABBtN0AC5oCAQAAAAIAAAADAAAABAAAAAYAAAAIAAAADAAAABAAAAAYAAAAIAAAADAAAABAAAAAYAAAAIAAAADAAAAAAAEAAIABAAAAAgAAAAMAAAAEAAAABgAAAAgAAAAMAAAAEAAAABgAAAAgAAAAMAAAAEAAAABgAABuZWVkIGRpY3Rpb25hcnkAc3RyZWFtIGVuZAAAZmlsZSBlcnJvcgBzdHJlYW0gZXJyb3IAZGF0YSBlcnJvcgBpbnN1ZmZpY2llbnQgbWVtb3J5AGJ1ZmZlciBlcnJvcgBpbmNvbXBhdGlibGUgdmVyc2lvbgAAAAAoLwAAOC8AAEMvAABELwAATy8AAFwvAABnLwAAey8AAIgvAABDLwAAMS4yLjExAEHQ3wALA9AxUA==")};function gq(){return mq.apply(this,arguments)}function mq(){return mq=y(G.mark((function e(){var t,r,n,i,o,a,s,u,d,l,p,f,h,A,v,g,m,E,_,I,S,b,C,w,R,T,k,O,N,x,P;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(P=function(e){function r(){k||(k=!0,t.calledRun=!0,u||(C(g),C(m),t.onRuntimeInitialized&&t.onRuntimeInitialized(),function(){if(t.postRun)for("function"==typeof t.postRun&&(t.postRun=[t.postRun]);t.postRun.length;)e=t.postRun.shift(),E.unshift(e);var e;C(E)}()))}_>0||(function(){if(t.preRun)for("function"==typeof t.preRun&&(t.preRun=[t.preRun]);t.preRun.length;)e=t.preRun.shift(),v.unshift(e);var e;C(v)}(),_>0||(t.setStatus?(t.setStatus("Running..."),setTimeout((function(){setTimeout((function(){t.setStatus("")}),1),r()}),1)):r()))},C=function(e){for(;e.length>0;){var r=e.shift();if("function"!=typeof r){var n=r.func;"number"==typeof n?void 0===r.arg?A.get(n)():A.get(n)(r.arg):n(void 0===r.arg?null:r.arg)}else r(t)}},S=function(e){throw t.onAbort&&t.onAbort(e),s(e+=""),u=!0,e="abort("+e+"). Build with -s ASSERTIONS=1 for more info.",new WebAssembly.RuntimeError(e)},l=function(e,t,r,n,i){var o={string:function(e){var t=0;if(null!=e&&0!==e){var r=1+(e.length<<2);!function(e,t,r){!function(e,t,r,n){if(!(n>0))return 0;for(var i=r+n-1,o=0;o<e.length;++o){var a=e.charCodeAt(o);if(a>=55296&&a<=57343&&(a=65536+((1023&a)<<10)|1023&e.charCodeAt(++o)),a<=127){if(r>=i)break;t[r++]=a}else if(a<=2047){if(r+1>=i)break;t[r++]=192|a>>6,t[r++]=128|63&a}else if(a<=65535){if(r+2>=i)break;t[r++]=224|a>>12,t[r++]=128|a>>6&63,t[r++]=128|63&a}else{if(r+3>=i)break;t[r++]=240|a>>18,t[r++]=128|a>>12&63,t[r++]=128|a>>6&63,t[r++]=128|63&a}}t[r]=0}(e,h,t,r)}(e,t=x(r),r)}return t},array:function(e){var t,r,n=x(e.length);return t=e,r=n,f.set(t,r),n}},a=d(e),s=[],c=0;if(n)for(var u=0;u<n.length;u++){var l=o[r[u]];l?(0===c&&(c=O()),s[u]=l(n[u])):s[u]=n[u]}var A=a.apply(null,s);return A=function(e){return"string"===t?(r=e)?function(e,t,r){for(var n=t+r,i=t,o="";e[i]&&!(i>=n);)++i;if(i-t>16&&e.subarray&&p)return p.decode(e.subarray(t,i));for(;t<i;){var a=e[t++];if(128&a){var s=63&e[t++];if(192!=(224&a)){var c=63&e[t++];if((a=224==(240&a)?(15&a)<<12|s<<6|c:(7&a)<<18|s<<12|c<<6|63&e[t++])<65536)o+=String.fromCharCode(a);else{var u=a-65536;o+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else o+=String.fromCharCode((31&a)<<6|s)}else o+=String.fromCharCode(a)}return o}(h,r,n):"":"boolean"===t?Boolean(e):e;var r,n}(A),0!==c&&N(c),A},d=function(e){var r=t["_"+e];return r||S("Assertion failed: Cannot call unknown function "+e+", make sure it is exported"),r},!hq){e.next=7;break}return e.abrupt("return",hq);case 7:for(r in n={},t={})Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);for(r in i=!1,o=!1,i="object"==("undefined"==typeof window?"undefined":D(window)),o="function"==typeof importScripts,"object"==(void 0===c?"undefined":D(c))&&"object"==D(c.versions)&&c.versions.node,a="",(i||o)&&(o?a=self.location.href:"undefined"!=typeof document&&document.currentScript&&(a=document.currentScript.src),a=0!==a.indexOf("blob:")?a.substr(0,a.lastIndexOf("/")+1):""),t.print||console.log.bind(console),s=t.printErr||console.warn.bind(console),n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r]);return n=null,t.arguments,t.thisProgram,t.quit,t.wasmBinary,t.noExitRuntime,"object"!=("undefined"==typeof WebAssembly?"undefined":D(WebAssembly))&&S("no native wasm support detected"),u=!1,p="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0,"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le"),t.INITIAL_MEMORY,v=[],m=[],E=[],(g=[]).push({func:function(){R()}}),_=0,I=null,t.preloadedImages={},t.preloadedAudios={},(b="deflate.wasm").startsWith("data:application/octet-stream;base64,")||(b=function(e){return t.locateFile?t.locateFile(e,a):a+e}(b)),w={emscripten_memcpy_big:function(e,t,r){h.copyWithin(e,t,t+r)},emscripten_resize_heap:function(e){S("OOM")}},e.next=29,y(G.mark((function e(){var r,n,i,o;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=function(e){return new Rb((function(e,t){e(vq().buffer)})).then((function(e){return WebAssembly.instantiate(e,r)})).then(e,(function(e){s("failed to asynchronously prepare wasm: "+e),S(e)}))},i=function(e){n(e.instance)},n=function(e,r){var n,i=e.exports;t.asm=i,n=t.asm.memory.buffer,t.HEAP8=f=new Int8Array(n),t.HEAP16=new Int16Array(n),t.HEAP32=new Int32Array(n),t.HEAPU8=h=new Uint8Array(n),t.HEAPU16=new Uint16Array(n),t.HEAPU32=new Uint32Array(n),t.HEAPF32=new Float32Array(n),t.HEAPF64=new Float64Array(n),A=t.asm.__indirect_function_table,function(e){if(_--,t.monitorRunDependencies&&t.monitorRunDependencies(_),0==_&&I){var r=I;I=null,r()}}()},r={env:w,wasi_snapshot_preview1:w},_++,t.monitorRunDependencies&&t.monitorRunDependencies(_),!t.instantiateWasm){e.next=12;break}return e.prev=5,e.abrupt("return",t.instantiateWasm(r,n));case 9:return e.prev=9,e.t0=e.catch(5),e.abrupt("return",(s("Module.instantiateWasm callback failed with error: "+e.t0),!1));case 12:return e.next=14,o(i);case 14:return e.abrupt("return",{});case 15:case"end":return e.stop()}}),e,null,[[5,9]])})))();case 29:if(R=t.___wasm_call_ctors=function(){return(R=t.___wasm_call_ctors=t.asm.__wasm_call_ctors).apply(null,arguments)},T=t._malloc=function(){return(T=t._malloc=t.asm.malloc).apply(null,arguments)},t._free=function(){return(t._free=t.asm.free).apply(null,arguments)},t.___errno_location=function(){return(t.___errno_location=t.asm.__errno_location).apply(null,arguments)},t._zlibCompress=function(){return(t._zlibCompress=t.asm.zlibCompress).apply(null,arguments)},O=t.stackSave=function(){return(O=t.stackSave=t.asm.stackSave).apply(null,arguments)},N=t.stackRestore=function(){return(N=t.stackRestore=t.asm.stackRestore).apply(null,arguments)},x=t.stackAlloc=function(){return(x=t.stackAlloc=t.asm.stackAlloc).apply(null,arguments)},t.ccall=l,t.cwrap=function(e,t,r,n){var i=(r=r||[]).every((function(e){return"number"===e}));return"string"!==t&&i&&!n?d(e):function(){return l(e,t,r,arguments)}},t.allocate=function(e,t){var r;return r=1==t?x(e.length):T(e.length),e.subarray||e.slice?h.set(e,r):h.set(new Uint8Array(e),r),r},I=function e(){k||P(),k||(I=e)},t.run=P,t.preInit)for("function"==typeof t.preInit&&(t.preInit=[t.preInit]);t.preInit.length>0;)t.preInit.pop()();return e.abrupt("return",(P(),hq=t,t));case 34:case"end":return e.stop()}}),e)}))),mq.apply(this,arguments)}var Eq,_q,yq=Uint8Array.BYTES_PER_ELEMENT,Iq={bytesReceived:"br",frameDropped:"fd",frameReceived:"fr",googJitterReceived:"jr",isAudioMute:"am",isFreeze:"fz",mediaType:"mt",packetsLost:"pl",packetsReceived:"pr",peerId:"pid",id:"id",ssrc:"ssrc",timestamp:"ts",type:"tp",frameRateInput:"fi",frameRateSent:"fs",googRtt:"rt",isVideoMute:"vm"},Sq={stats:"sts",state:"st",stream_id:"stid",session_id:"seid",stream_type:"stt",app_id:"aid",channel_key:"ck",channel_name:"cn",sdk_version:"sv",browser:"b",process_id:"pcid",mode:"m",codec:"c",role:"r",has_changed_gateway:"hcg",ap_response:"ar",extends:"es",details:"d",features:"ft",p2p_id:"ppid",sdp:"sdp",audio:"a",video:"v",attributes:"at",hq:"h",lq:"l",stereo:"str",speech:"spe",extend:"e",pingpongElapse:"ppe"},bq={_message:"m",_type:"t",_id:"id"},Cq={join_v2:"j2",publish:"pub",publish_related_stats:"prs",ping:"pi",traffic_stats:"ts",ping_back:"pib",publish_stats:"pubs"},wq=function(){function e(){U(this,e),rO(this,"zlibCompress",void 0)}return F(e,[{key:"init",value:function(){var e=y(G.mark((function e(){var t;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Eq){e.next=5;break}return e.next=3,y(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=Aq,e.t0){e.next=5;break}return e.next=4,gq();case 4:Aq=e.sent;case 5:return e.abrupt("return",{zlibCompress:function(e){for(var t=new Uint8Array(e),r=yq*t.byteLength,n=Aq._malloc(r),i=Aq._malloc(3*r),o=0;o<r;o++)Aq.HEAP8[n/yq+o]=t[o];var a=Aq._zlibCompress(n,r,i),s=new Uint8Array(Aq.HEAP8.slice(i,i+a));return Aq._free(n),Aq._free(i),s}});case 6:case"end":return e.stop()}}),e)})))();case 3:t=e.sent,Eq=t.zlibCompress;case 5:this.zlibCompress=Eq;case 6:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"msgPackCompress",value:function(e){return fq.exports.encode(e)}},{key:"compress",value:function(e){var t=Date.now(),r=this.compressKeyAndValue(JSON.parse(JSON.stringify(e))),n=this.msgPackCompress(r),i=this.zlibCompress(n),o=new Uint8Array([49,49,49,50].concat(M(Array.from(i))));return{origin:Object.assign({},e),originLength:JSON.stringify(e).length,shortKeyAndValue:r,msgpackSer:n,compressed:o,compressedLength:o.length,time:Date.now()-t}}},{key:"compressKeyAndValue",value:function(e){return this._ObjectKeyCompress(this._typeCompress(e))}},{key:"_typeCompress",value:function(e){var t=e._type;if(!t)return e;var r=Cq[t];return e._type=r||t,e}},{key:"_ObjectKeyCompress",value:function(e){var t=e._message;if(t){var r=t.stats;r&&(t.stats=this._statsCompress(r)),e._message=this._messageCompress(t)}return this._reportCompress(e)}},{key:"_statsCompress",value:function(e){return this._keyCompress(e,Iq)}},{key:"_messageCompress",value:function(e){return this._keyCompress(e,Sq)}},{key:"_reportCompress",value:function(e){return this._keyCompress(e,bq)}},{key:"_keyCompress",value:function(e,t){var r={},n=Object.keys(e);return Hp(n).call(n,(function(n,i){var o=e[i];return t[i]?r[t[i]]=o:r[i]=o,r}),r),r}}]),e}(),Rq=function(e){k(r,e);var t=W(r);function r(e){var n;return U(this,r),n=t.call(this),rO(S(n),"lowPriorityQueue",[]),rO(S(n),"highPriorityQueue",[]),rO(S(n),"AgoraWebSocketManager",void 0),n.AgoraWebSocketManager=e,n}return F(r,[{key:"queue",get:function(){return[].concat(M(this.highPriorityQueue),M(this.lowPriorityQueue))}},{key:"reset",value:function(){this.lowPriorityQueue=[],this.highPriorityQueue=[]}},{key:"pushMessage",value:function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]?this.highPriorityQueue.push(e):this.lowPriorityQueue.push(e),this.sendMessage()}},{key:"sendMessage",value:function(){var e=this,t=this.queue.length;setTimeout((function(){e._sendMessage()}),t<5?15*t:60+3*(t-4))}},{key:"_sendMessage",value:function(){if(this.queue.length){var e=this.AgoraWebSocketManager.getConnection();if(e&&1===e.readyState){var t=this.queue.shift();return this.lowPriorityQueue.includes(t)?this.lowPriorityQueue.shift():this.highPriorityQueue.shift(),e.send(t.compressed),t}}}}]),r}(yD);function Tq(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var kq,Oq,Dq=tN("AgoraWebSocketManager","connectionID")(_q=function(e){k(r,e);var t=W(r);function r(e,n){var i;U(this,r);var o=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];i=t.call(this),rO(S(i),"connectionID",0),rO(S(i),"currentURLIndex",0),rO(S(i),"urls",void 0),rO(S(i),"_reconnectMode","tryNext"),rO(S(i),"reconnectReason",void 0),rO(S(i),"_initMutex",new rV("websocket")),rO(S(i),"name",void 0),rO(S(i),"_state","closed"),rO(S(i),"reconnectInterrupter",void 0),rO(S(i),"websocket",void 0),rO(S(i),"retryConfig",void 0),rO(S(i),"reconnectCount",0),rO(S(i),"onlineReconnectListener",void 0),rO(S(i),"compressor",new wq),rO(S(i),"compressorInitStatus","initializing"),rO(S(i),"compress",void 0),rO(S(i),"messageSender",void 0),rO(S(i),"useCompress",void 0),rO(S(i),"tryDoubleDomain",!1),rO(S(i),"wsInflateLength",0),rO(S(i),"wsDeflateLength",0),rO(S(i),"closeEstablishingWs",(function(){})),i.name=e,i.retryConfig=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Tq(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Tq(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},n),i.useCompress=o,i.tryDoubleDomain=a;var s=n.timeout,c=n.timeoutFactor,u=Math.max(300,Math.floor(3*s/5)),d=Math.max(1.2,Math.floor(8*c)/10);XP.ONLINE&&(i.retryConfig.timeout=u,i.retryConfig.timeoutFactor=d),Vj.on(ZP.NETWORK_STATE_CHANGE,(function(e,t){e!==t&&(i.resetReconnectCount("network state change: ".concat(t," -> ").concat(e)),e===XP.ONLINE?(i.retryConfig.timeout=u,i.retryConfig.timeoutFactor=d):(i.retryConfig.timeout=s,i.retryConfig.timeoutFactor=c))}));var l=Date.now();return i.compressor.init().then((function(){i.compressorInitStatus="initialized";var e=Date.now()-l;ND.debug("websocket compressor initialized successfully in ".concat(e,"ms")),ZD("debug",i.compressor,"init",void 0,"websocket compressor initialized successfully in ".concat(e,"ms")),zj.wsCompressorInit({status:!0,ec:null,eventElapse:e}),i.compress=i.compressor.compress.bind(i.compressor)})).catch((function(e){i.compressorInitStatus="failed";var t=e?e.message||e.toString():"Empty Error";ND.debug("websocket compressor failed to initialize because of ".concat(t)),ZD("debug",i.compressor,"init",void 0,"websocket compressor failed to initialize because of ".concat(t)),zj.wsCompressorInit({status:!1,ec:t,eventElapse:1})})),i}return F(r,[{key:"url",get:function(){return this.websocket?this.websocket.url:null}},{key:"reconnectMode",get:function(){return this._reconnectMode},set:function(e){["tryNext","recover"].includes(e)&&this.resetReconnectCount(e),this._reconnectMode=e}},{key:"state",get:function(){return this._state},set:function(e){e!==this._state&&(this._state=e,"reconnecting"===this._state?this.emit(dP.RECONNECTING,this.reconnectReason):"connected"===this._state?this.emit(dP.CONNECTED):"closed"===this._state?this.emit(dP.CLOSED):"failed"===this._state&&this.emit(dP.FAILED))}},{key:"resetReconnectCount",value:function(e){ND.debug("websocket reset reconnect count, reason: "+e),ZD("debug",this,"resetReconnectCount",e,"websocket reset reconnect count, reason: "+e),this.reconnectCount=0}},{key:"getConnection",value:function(){return this.websocket||void 0}},{key:"init",value:function(e){var t=this,r=function(r,n){t.urls=e;var i=t.urls[t.currentURLIndex];t.state="connecting",t.messageSender=new Rq(t),t.createWebSocketConnection(i).then(r).catch(n),t.once(dP.CLOSED,(function(){return n(new SD(mD.WS_DISCONNECT))})),t.once(dP.CONNECTED,(function(){return r()}))};return this._initMutex.lock().then((function(e){return new Rb((function(e,t){r(e,t)})).then((function(){e()})).catch((function(){e()}))}))}},{key:"close",value:function(e,t){if(this.currentURLIndex=0,this.resetReconnectCount("close"),this.reconnectInterrupter&&this.reconnectInterrupter(),this.websocket){this.websocket.onclose=null,this.websocket.onopen=null,this.websocket.onmessage=null;var r=this.websocket;t?setTimeout((function(){return r.close()}),500):r.close(),this.websocket=void 0}this.state=e?"failed":"closed",this.closeEstablishingWs&&this.closeEstablishingWs()}},{key:"reconnect",value:function(e,t){if(!this.websocket)return ND.warning("[".concat(this.name,"] can not reconnect, no websocket")),void ZD("warning",this,"reconnect","can not reconnect, no websocket");void 0!==e&&(this.reconnectMode=e),ND.debug("[".concat(this.name,"] reconnect is triggered initiative")),ZD("debug",this,"reconnect");var r=this.websocket.onclose;this.websocket.onclose=null,this.websocket.close(),r&&r.bind(this.websocket)({code:9999,reason:t})}},{key:"sendMessageWithJSON",value:function(e){var t=JSON.stringify(e);return{compressed:t,compressedLength:t.length,origin:e}}},{key:"sendMessage",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.websocket||this.websocket.readyState!==WebSocket.OPEN)throw new SD(mD.WS_ABORT,"websocket is not ready");try{var r=null;if("initialized"===this.compressorInitStatus&&this.useCompress&&gN("WEBSOCKET_COMPRESS"))try{r=this.compress(e),this.setWsInflateData(r)}catch(t){r=this.sendMessageWithJSON(e)}else r=this.sendMessageWithJSON(e);t?this.websocket.send(r.compressed):this.messageSender.pushMessage(r)}catch(e){throw new SD(mD.WS_ERR,"send websocket message error"+e.toString())}}},{key:"setWsInflateData",value:function(e){this.wsDeflateLength=this.wsDeflateLength+e.originLength,this.wsInflateLength=this.wsInflateLength+e.compressedLength}},{key:"getWsInflateData",value:function(){var e=this.wsInflateLength,t=this.wsDeflateLength;return this.clearWsInflateData(),{wsInflateLength:e,wsDeflateLength:t}}},{key:"clearWsInflateData",value:function(){this.wsInflateLength=0,this.wsDeflateLength=0}},{key:"createWebSocketConnection",value:function(){var e=y(G.mark((function e(t,r){var n=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(this.connectionID+=1,this.connectionID,new Rb((function(e,i){var o=function(){ND.debug("[".concat(n.name,"] websocket opened:"),t),XD("debug",["WebSocket",n.connectionID],"open",t),n.reconnectMode="retry",n.state="connected",n.resetReconnectCount("opened"),e()},a=function(){var t=y(G.mark((function t(r){var o,a;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(ND.debug("[".concat(n.name,"] websocket close ").concat(n.websocket&&n.websocket.url,", code: ").concat(r.code,", reason: ").concat(r.reason,", current mode: ").concat(n.reconnectMode)),XD("debug",["WebSocket",n.connectionID],"close",{code:r.code,reason:r.reason,url:n.websocket&&n.websocket.url,reconnectMode:n.reconnectMode}),!(n.reconnectCount<n.retryConfig.maxRetryCount)){t.next=13;break}return"connected"===n.state&&(n.reconnectReason=r.reason,n.state="reconnecting"),o=iK(n,dP.WILL_RECONNECT,n.reconnectMode)||n.reconnectMode,t.next=5,n.reconnectWithAction(o);case 5:if(a=t.sent,"closed"!==n.state){t.next=8;break}return t.abrupt("return",(ND.debug("[".concat(n.connectionID,"] ws is closed, no need to reconnect")),void qD("debug",n,"ws is closed, no need to reconnect")));case 8:if(a){t.next=10;break}return t.abrupt("return",(i(new SD(mD.WS_DISCONNECT,"websocket reconnect failed: ".concat(r.code))),void n.close(!0)));case 10:e(),t.next=14;break;case 13:i(new SD(mD.WS_DISCONNECT,"websocket close: ".concat(r.code))),n.close();case 14:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),s=function(e){n.emit(dP.ON_MESSAGE,e)};n.websocket&&(n.websocket.onclose=null,n.websocket.close()),gN("GATEWAY_WSS_ADDRESS")&&n.name.startsWith("gateway")&&(t=gN("GATEWAY_WSS_ADDRESS")),ND.debug("[".concat(n.name,"] start connect, url: ").concat(t)),qD("debug",n,"start connect, url: ".concat(t)),n.chooseBestWebsocketConnection(t,!!r).then((function(e){n.websocket=e,o&&o(),e.onclose=a,e.onmessage=s})).catch((function(e){if("closed"!==n.state){if(e instanceof SD&&e.code===mD.WS_ERR){var t=new SD(mD.WS_ERR,"init websocket failed! Error: ".concat(e.toString()));return ND.error("[".concat(n.name,"]").concat(t)),ZD("error",n,"chooseBestWebsocketConnection",void 0,e.toString()),void i(t)}a&&a(e)}else i(new SD(mD.WS_DISCONNECT,"websocket is closed: ".concat(e.toString())))}))}))));case 1:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"reconnectWithAction",value:function(){var e=y(G.mark((function e(t){var r,n,i,o,a,s,c,u=this,d=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!(d.length>1&&void 0!==d[1])||d[1],!(this.reconnectCount>=this.retryConfig.maxRetryCount)){e.next=3;break}return e.abrupt("return",!1);case 3:if(this.urls){e.next=5;break}return e.abrupt("return",!1);case 5:if("closed"!==this.state){e.next=7;break}return e.abrupt("return",!1);case 7:if(this.onlineReconnectListener||Vj.networkState!==XP.OFFLINE||(this.onlineReconnectListener=Vj.onlineWaiter&&Vj.onlineWaiter.then((function(){u.onlineReconnectListener=void 0}))),n=!0,this.reconnectInterrupter=function(){n=!1},!r){e.next=15;break}return i=CD(this.reconnectCount,this.retryConfig),ND.debug("[".concat(this.name,"] wait ").concat(i,"ms to reconnect websocket, mode: ").concat(t)),ZD("debug",this,"reconnectWithAction",{timeout:i,action:t}),e.next=15,Rb.race([JG(i),this.onlineReconnectListener||new Rb((function(){}))]);case 15:if("closed"!==this.state&&n){e.next=17;break}return e.abrupt("return",!1);case 17:if(this.reconnectCount+=1,o=function(){var e=y(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u.emit(dP.RECONNECT_CREATE_CONNECTION,r),e.next=3,u.createWebSocketConnection(t);case 3:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),e.prev=19,"retry"!==t){e.next=27;break}return a=this.urls[this.currentURLIndex],this.emit(dP.RECONNECT_WAITTING_FINISH,t),e.next=25,o(a,t);case 25:case 37:e.next=51;break;case 27:if("tryNext"!==t){e.next=39;break}if(this.currentURLIndex+=1,!(this.currentURLIndex>=this.urls.length)){e.next=32;break}return e.next=31,this.reconnectWithAction("recover",!1);case 31:case 60:return e.abrupt("return",e.sent);case 32:return ND.debug("[".concat(this.name,"] websocket url length: ").concat(this.urls.length," current index: ").concat(this.currentURLIndex)),qD("debug",this,"websocket url length: ".concat(this.urls.length," current index: ").concat(this.currentURLIndex)),s=this.urls[this.currentURLIndex],this.emit(dP.RECONNECT_WAITTING_FINISH,t),e.next=37,o(s,t);case 39:if("recover"!==t){e.next=51;break}return ND.debug("[".concat(this.name,"] request new urls")),qD("debug",this,"request new urls"),this.resetReconnectCount("recover mode"),this.emit(dP.RECONNECT_WAITTING_FINISH,t),e.next=46,rK(this,dP.REQUEST_NEW_URLS);case 46:return this.urls=e.sent,this.currentURLIndex=0,c=this.urls[this.currentURLIndex],e.next=51,o(c,t);case 51:return e.abrupt("return",!0);case 54:return e.prev=54,e.t0=e.catch(19),ND.error("[".concat(this.name,"] reconnect failed"),e.t0.toString()),ZD("error",this,"reconnectWithAction",void 0,e.t0.toString()),e.next=60,this.reconnectWithAction(t,r);case 61:case"end":return e.stop()}}),e,this,[[19,54]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"chooseBestWebsocketConnection",value:function(){var e=y(G.mark((function e(t,r){var n=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Rb((function(e,i){var o=!1,a=[];n.closeEstablishingWs=function(){ND.debug("[choose-best-ws] close establishing websockets"),a.forEach((function(e){e.onclose=null,e.onopen=null,e.onmessage=null,e.close()})),i(new SD(mD.WS_ABORT,"choose best websocket aborted"))};var s,c=gN("GATEWAY_DOMAINS"),u=t.indexOf("?h="),d=c.find((function(e){return-1!==u?t.includes(e,u):t.includes(e)}));ND.debug("[choose-best-ws] currentDomain: ",d,", domains: ",c),ZD("debug",n,"chooseBestWebsocketConnection",{currentDomain:d,domains:c});var l=!n.tryDoubleDomain||r||!d;if(!l&&d){var p=Date.now();try{c.forEach((function(e){var r=-1===u?t.replace(d,e):t.substr(0,u)+t.substr(u).replace(d,e),i=new WebSocket(r);i.binaryType="arraybuffer",a.push(i),ND.debug("[choose-best-ws] ws is connecting:",i.url),qD("debug",n,"ws is connecting: ".concat(i.url))}))}catch(e){for(ND.debug("[choose-best-ws] ws create failed, fallback to single url"),qD("debug",n,"ws create failed, fallback to single url"),a.forEach((function(e){return e.close()}));a.length;)a.pop();l=!0}a.forEach((function(t){t.onopen=function(){if(!o){var r=Date.now()-p;ND.debug("[choose-best-ws] ws open cost ".concat(r,"ms")),a.filter((function(e){return e!==t})).forEach((function(e){ND.debug("[choose-best-ws]close backup websocket: ".concat(e.url)),qD("debug",n,"close backup websocket: ".concat(e.url)),e.close()})),o=!0,e(t)}},t.onclose=function(e){s=e,o||a.find((function(e){return!(e.readyState===WebSocket.CLOSED||e.readyState===WebSocket.CLOSING)}))||(ND.debug("[choose-best-ws] all websocket is closed"),qD("debug",n,"all websocket is closed"),o=!0,i(s))},t.onmessage=function(e){ND.debug("[choose-best-ws]".concat(t.url," onmessage: ").concat(e.data)),qD("debug",n,"".concat(t.url," onmessage: ").concat(e.data))}})),JG(5e3).then((function(){a.forEach((function(e){e.readyState!==WebSocket.OPEN&&e.close()}))}))}if(l){var f;ND.debug("[choose-best-ws] use single url: ",t),qD("debug",n,"use single url: ".concat(t));try{f=new WebSocket(t),a.push(f),f.binaryType="arraybuffer"}catch(e){var h=new SD(mD.WS_ERR,"init websocket failed! Error: ".concat(e.toString()));return ND.error("[".concat(n.name,"]").concat(h)),ZD("error",n,"chooseBestWebsocketConnection",void 0,e.toString()),void i(h)}f.onopen=function(){e(f)},f.onclose=function(e){i(e)},f.onmessage=function(e){ND.debug("[choose-best-ws]".concat(f.url," onmessage: ").concat(e.data)),qD("debug",n,"".concat(f.url," onmessage: ").concat(e.data))},JG(5e3).then((function(){f&&f.readyState!==WebSocket.OPEN&&f.close()}))}})).then((function(e){return n.closeEstablishingWs=void 0,e})).catch((function(e){throw n.closeEstablishingWs=void 0,e})));case 1:case"end":return e.stop()}}),e)})));function t(t,r){return e.apply(this,arguments)}return t}()}]),r}(yD))||_q,Nq=function(){function e(t){U(this,e),rO(this,"input",[]),rO(this,"size",void 0),this.size=t}return F(e,[{key:"add",value:function(e){this.input.push(e),this.input.length>this.size&&this.input.splice(0,1)}},{key:"mean",value:function(){var e;return 0===this.input.length?0:Hp(e=this.input).call(e,(function(e,t){return e+t}))/this.input.length}}]),e}(),xq=tN("AgoraRTCSignal","websocket.connectionID")(kq=function(e){k(r,e);var t=W(r);function r(e){var n;return U(this,r),n=t.call(this),rO(S(n),"_disconnectedReason",void 0),rO(S(n),"_websocketReconnectReason",void 0),rO(S(n),"_connectionState",Xx.CLOSED),rO(S(n),"reconnectToken",void 0),rO(S(n),"websocket",void 0),rO(S(n),"openConnectionTime",void 0),rO(S(n),"clientId",void 0),rO(S(n),"lastMsgTime",Date.now()),rO(S(n),"uploadCache",[]),rO(S(n),"uploadCacheInterval",void 0),rO(S(n),"rttRolling",new Nq(5)),rO(S(n),"pingpongTimer",void 0),rO(S(n),"wsInflateDataTimer",void 0),rO(S(n),"pingpongTimeoutCount",0),rO(S(n),"joinResponse",void 0),rO(S(n),"multiIpOption",void 0),rO(S(n),"initError",void 0),rO(S(n),"spec",void 0),rO(S(n),"onWebsocketMessage",(function(e){if(e.data instanceof ArrayBuffer)n.emit(Zx.ON_BINARY_DATA,e.data);else{var t=JSON.parse(e.data);if(n.lastMsgTime=Date.now(),Object.prototype.hasOwnProperty.call(t,"_id")){var r="res-@".concat(t._id);n.emit(r,t._result,t._message)}else if(Object.prototype.hasOwnProperty.call(t,"_type")&&(n.emit(t._type,t._message),t._type===tP.ON_NOTIFICATION&&n.handleNotification(t._message),t._type===tP.ON_USER_BANNED))switch(t._message.error_code){case 14:n.close(qx.UID_BANNED);break;case 15:n.close(qx.IP_BANNED);break;case 16:n.close(qx.CHANNEL_BANNED)}}})),n.clientId=e.clientId,n.spec=e,n.websocket=new Dq("gateway-".concat(n.clientId),n.spec.retryConfig,!0,!0),n.handleWebsocketEvents(),window.addEventListener("offline",(function(){n.connectionState===Xx.CONNECTED&&n.reconnect("retry",zx.OFFLINE)})),n}return F(r,[{key:"connectionState",get:function(){return this._connectionState},set:function(e){e!==this._connectionState&&(this._connectionState=e,e===Xx.CONNECTED?this.emit(Zx.WS_CONNECTED):e===Xx.RECONNECTING?this.emit(Zx.WS_RECONNECTING,this._websocketReconnectReason):e===Xx.CLOSED&&this.emit(Zx.WS_CLOSED,this._disconnectedReason))}},{key:"currentURLIndex",get:function(){return this.websocket.currentURLIndex}},{key:"url",get:function(){return this.websocket?this.websocket.url:null}},{key:"rtt",get:function(){return this.rttRolling.mean()}},{key:"request",value:function(){var e=y(G.mark((function e(t,r,n,i){var o,a,s,c,u,d,l,p,f,h=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=XG(6,""),a={_id:o,_type:t,_message:r},s=this.websocket.connectionID,c=function(){return new Rb((function(e,r){if(h.connectionState===Xx.CONNECTED)return e();var n=function(){h.off(Zx.WS_CLOSED,i),e()},i=function(){h.off(Zx.WS_CONNECTED,n),r(new SD(mD.WS_ABORT))};h.once(Zx.WS_CONNECTED,n),h.once(Zx.WS_CLOSED,i),t!==$x.PUBLISH&&t!==$x.SUBSCRIBE&&t!==$x.UNSUBSCRIBE&&t!==$x.UNPUBLISH&&t!==$x.CONTROL||h.once(Zx.DISCONNECT_P2P,(function(){r(new SD(mD.DISCONNECT_P2P))})),t===$x.PUBLISH&&h.once(Zx.ABORT_P2P_EXECUTION,(function(){r(new SD(mD.DISCONNECT_P2P))}))}))},e.t0=this.connectionState!==Xx.CONNECTING&&this.connectionState!==Xx.RECONNECTING||t===$x.JOIN||t===$x.REJOIN,e.t0){e.next=5;break}return e.next=5,c();case 5:if(this.websocket.sendMessage(a,!0),!i){e.next=8;break}return e.abrupt("return");case 8:return u=new Rb((function(e,n){var i=!1,a=function(n,o){i=!0,e({isSuccess:"success"===n,message:o||{}}),h.off(Zx.WS_CLOSED,c),h.off(Zx.WS_RECONNECTING,c),h.emit(Zx.REQUEST_SUCCESS,t,r)};h.once("res-@".concat(o),a);var c=function e(){n(new SD(mD.WS_ABORT,"type: ".concat(t))),h.off(Zx.WS_CLOSED,e),h.off(Zx.WS_RECONNECTING,e),h.off("res-@".concat(o),a)};h.once(Zx.WS_CLOSED,c),h.once(Zx.WS_RECONNECTING,c),JG(gN("SIGNAL_REQUEST_TIMEOUT")).then((function(){h.websocket.connectionID!==s||i||(ND.warning("ws request timeout, type: ".concat(t)),qD("warning",h,"ws request timeout, type: ".concat(t)),h.emit(Zx.REQUEST_TIMEOUT,t,r))}))})),d=null,e.prev=10,e.next=13,u;case 13:d=e.sent,e.next=35;break;case 16:if(e.prev=16,e.t1=e.catch(10),this.connectionState!==Xx.CLOSED&&t!==$x.LEAVE){e.next=20;break}throw new SD(mD.WS_ABORT);case 20:if(this.spec.forceWaitGatewayResponse&&!n){e.next=24;break}e.t2=e.t1.throw(),e.next=34;break;case 24:if(t!==$x.JOIN&&t!==$x.REJOIN){e.next=28;break}e.t3=null,e.next=33;break;case 28:return e.next=30,c();case 30:return e.next=32,this.request(t,r);case 32:e.t3=e.sent;case 33:e.t2=e.t3;case 34:return e.abrupt("return",e.t2);case 35:if(!d.isSuccess){e.next=37;break}return e.abrupt("return",d.message);case 37:if(l=Number(d.message.error_code||d.message.code),p=pq(l),f=new SD(mD.UNEXPECTED_RESPONSE,"".concat(p.desc,": ").concat(d.message.error_str),{code:l,data:d.message}),"success"!==p.action){e.next=42;break}e.t4=d.message,e.next=68;break;case 42:if(ND.warning("[".concat(this.websocket.connectionID,"] unexpected response from type ").concat(t,", error_code: ").concat(l,", message: ").concat(p.desc,", action: ").concat(p.action)),qD("warning",this,"unexpected response from type ".concat(t,", error_code: ").concat(l,", message: ").concat(p.desc,", action: ").concat(p.action)),l!==Wx.ERR_TOO_MANY_BROADCASTERS){e.next=48;break}e.t5=t===$x.JOIN||t===$x.REJOIN?(this.initError=f,this.close(),f.throw()):f.throw(),e.next=67;break;case 48:if("failed"!==p.action){e.next=52;break}e.t6=f.throw(),e.next=66;break;case 52:if("quit"!==p.action){e.next=56;break}e.t7=(this.initError=f,this.close(),f.throw()),e.next=65;break;case 56:if(l===Wx.ERR_JOIN_BY_MULTI_IP?(this.multiIpOption=d.message.option,ND.warning("[".concat(this.clientId,"] detect multi ip, recover")),qD("warning",this,"detect multi ip, recover"),this.reconnect("recover",zx.MULTI_IP)):this.reconnect(p.action,zx.SERVER_ERROR),t!==$x.JOIN&&t!==$x.REJOIN){e.next=61;break}e.t8=null,e.next=64;break;case 61:return e.next=63,this.request(t,r);case 63:e.t8=e.sent;case 64:e.t7=e.t8;case 65:e.t6=e.t7;case 66:e.t5=e.t6;case 67:e.t4=e.t5;case 68:return e.abrupt("return",e.t4);case 69:case"end":return e.stop()}}),e,this,[[10,16]])})));function t(t,r,n,i){return e.apply(this,arguments)}return t}()},{key:"waitMessage",value:function(e,t){var r=this;return new Rb((function(n){var i=function i(o){(!t||t(o))&&(r.off(e,i),n(o))};r.on(e,i)}))}},{key:"upload",value:function(e,t){var r=this,n={_type:e,_message:t};try{this.websocket.sendMessage(n)}catch(e){var i=gN("MAX_UPLOAD_CACHE")||50;this.uploadCache.push(n),this.uploadCache.length>i&&this.uploadCache.splice(0,1),this.uploadCache.length>0&&!this.uploadCacheInterval&&(this.uploadCacheInterval=window.setInterval((function(){if(r.connectionState===Xx.CONNECTED){var e=r.uploadCache.splice(0,1)[0];0===r.uploadCache.length&&(window.clearInterval(r.uploadCacheInterval),r.uploadCacheInterval=void 0),r.upload(e._type,e._message)}}),gN("UPLOAD_CACHE_INTERVAL")||2e3))}}},{key:"send",value:function(e,t){var r={_type:e,_message:t};this.websocket.sendMessage(r)}},{key:"init",value:function(e,t){var r=this;return this.initError=void 0,this.multiIpOption=void 0,this.joinResponse=void 0,this.reconnectToken=void 0,this.openConnectionTime=void 0,new Rb((function(n,i){r.once(Zx.WS_CONNECTED,(function(){return n(r.joinResponse)})),r.once(Zx.WS_CLOSED,(function(){return i(r.initError||new SD(mD.WS_ABORT))})),r.connectionState=Xx.CONNECTING,r.websocket.init(e).catch(i),r.wsInflateDataTimer&&window.clearInterval(r.wsInflateDataTimer),r.wsInflateDataTimer=window.setInterval((function(){r.handleWsInflateData()}),2e4),setTimeout((function(){t&&void 0===r.openConnectionTime&&(ND.debug("[".concat(r.clientId,"] init websocket timeout while join with fallback to proxy")),i(new SD(mD.INIT_WEBSOCKET_TIMEOUT)))}),gN("JOIN_WITH_FALLBACK_PROXY_PENDING_DURATION"))}))}},{key:"close",value:function(e){this.pingpongTimer&&(this.pingpongTimeoutCount=0,window.clearInterval(this.pingpongTimer),this.pingpongTimer=void 0),this.wsInflateDataTimer&&(this.handleWsInflateData(),window.clearInterval(this.wsInflateDataTimer),this.wsInflateDataTimer=void 0),this.reconnectToken=void 0,this.joinResponse=void 0,this._disconnectedReason=e||qx.LEAVE,this.connectionState=Xx.CLOSED,ND.debug("[".concat(this.clientId,"] ")+"will close websocket in signal"),this.websocket.close(),e===qx.FALLBACK&&(this.websocket.removeAllListeners(),this.websocket=new Dq("gateway-".concat(this.clientId),this.spec.retryConfig,!0,!0),this.handleWebsocketEvents())}},{key:"join",value:function(){var e=y(G.mark((function e(){var t,r;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.joinResponse){e.next=11;break}return this.emit(Zx.ABORT_P2P_EXECUTION),e.next=4,rK(this,Zx.REQUEST_JOIN_INFO);case 4:return t=e.sent,e.next=7,this.request($x.JOIN,t);case 7:if(r=e.sent){e.next=10;break}return e.abrupt("return",(this.emit(Zx.REPORT_JOIN_GATEWAY,mD.TIMEOUT,this.url||""),!1));case 10:this.joinResponse=r,this.emit(Zx.JOIN_RESPONSE,this.joinResponse),this.reconnectToken=this.joinResponse.rejoin_token;case 11:return e.abrupt("return",(this.connectionState=Xx.CONNECTED,this.pingpongTimer&&window.clearInterval(this.pingpongTimer),this.pingpongTimer=window.setInterval(this.handlePingPong.bind(this),3e3),!0));case 12:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"rejoin",value:function(){var e=y(G.mark((function e(){var t,r,n=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.reconnectToken){e.next=2;break}throw new SD(mD.UNEXPECTED_ERROR,"can not rejoin, no rejoin token");case 2:return(t=oK(this,Zx.REQUEST_REJOIN_INFO)).token=this.reconnectToken,e.next=6,this.request($x.REJOIN,t);case 6:return r=e.sent,e.abrupt("return",!!r&&(this.connectionState=Xx.CONNECTED,this.pingpongTimer&&window.clearInterval(this.pingpongTimer),this.pingpongTimer=window.setInterval(this.handlePingPong.bind(this),3e3),r.peers&&r.peers.forEach((function(e){n.emit(tP.ON_USER_ONLINE,{uid:e.uid}),e.audio_mute?n.emit(tP.MUTE_AUDIO,{uid:e.uid}):n.emit(tP.UNMUTE_AUDIO,{uid:e.uid}),e.video_mute?n.emit(tP.MUTE_VIDEO,{uid:e.uid}):n.emit(tP.UNMUTE_VIDEO,{uid:e.uid}),e.audio_enable_local?n.emit(tP.ENABLE_LOCAL_AUDIO,{uid:e.uid}):n.emit(tP.DISABLE_LOCAL_AUDIO,{uid:e.uid}),e.video_enable_local?n.emit(tP.ENABLE_LOCAL_VIDEO,{uid:e.uid}):n.emit(tP.DISABLE_LOCAL_VIDEO,{uid:e.uid}),e.audio||e.video||n.emit(tP.ON_REMOVE_STREAM,{uid:e.uid,uint_id:e.uint_id}),e.audio&&n.emit(tP.ON_ADD_AUDIO_STREAM,{uid:e.uid,uint_id:e.uint_id,audio:!0,ssrcId:e.audio_ssrc}),e.video&&n.emit(tP.ON_ADD_VIDEO_STREAM,{uid:e.uid,uint_id:e.uint_id,video:!0,ssrcId:e.video_ssrc})})),!0));case 8:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"reconnect",value:function(e,t){this.pingpongTimer&&(this.pingpongTimeoutCount=0,window.clearInterval(this.pingpongTimer),this.pingpongTimer=void 0),this.websocket.reconnect(e,t)}},{key:"handleNotification",value:function(e){ND.debug("[".concat(this.clientId,"] receive notification: "),e),ZD("debug",this,"handleNotification",e);var t=pq(e.code);if("success"!==t.action)return"failed"===t.action?(ND.error("[".concat(this.clientId,"] ignore error: "),t.desc),void qD("error",this,"ignore error: ".concat(t.desc))):"quit"===t.action?("ERR_REPEAT_JOIN_CHANNEL"===t.desc&&this.close(qx.UID_BANNED),void this.close()):void this.reconnect(t.action,zx.SERVER_ERROR)}},{key:"handlePingPong",value:function(){var e=this;if(this.websocket&&"connected"===this.websocket.state){this.pingpongTimeoutCount>0&&this.rttRolling.add(3e3),this.pingpongTimeoutCount+=1;var t=gN("PING_PONG_TIME_OUT"),r=Date.now();this.pingpongTimeoutCount>=t&&(ND.warning("PINGPONG Timeout. Last Socket Message: ".concat(r-this.lastMsgTime,"ms")),qD("warning",this,"PINGPONG Timeout. Last Socket Message: ".concat(r-this.lastMsgTime,"ms")),r-this.lastMsgTime>gN("WEBSOCKET_TIMEOUT_MIN"))?this.reconnect("retry",zx.TIMEOUT):this.request($x.PING,void 0,!0).then((function(){e.pingpongTimeoutCount=0;var t=Date.now()-r;e.rttRolling.add(t),gN("REPORT_STATS")&&e.send($x.PING_BACK,{pingpongElapse:t})})).catch((function(e){}))}}},{key:"handleWsInflateData",value:function(){var e=this.websocket.getWsInflateData(),t=e.wsInflateLength,r=e.wsDeflateLength;0!==t&&0!==r&&this.upload(eP.WS_INFLATE_DATA_LENGTH,{ws_deflate_length:r,ws_inflate_length:t})}},{key:"handleWebsocketEvents",value:function(){var e=this;this.websocket.on(dP.RECONNECT_WAITTING_FINISH,(function(t){e.emit(Zx.WS_RECONNECT_WAITTING_FINISH,t)})),this.websocket.on(dP.RECONNECT_CREATE_CONNECTION,(function(t){e.emit(Zx.WS_RECONNECT_CREATE_CONNECTION,t)})),this.websocket.on(dP.ON_MESSAGE,this.onWebsocketMessage),this.websocket.on(dP.CLOSED,(function(){e.connectionState=Xx.CLOSED})),this.websocket.on(dP.FAILED,(function(){e._disconnectedReason=qx.NETWORK_ERROR,e.connectionState=Xx.CLOSED})),this.websocket.on(dP.RECONNECTING,(function(t){e._websocketReconnectReason=t,e.joinResponse=void 0,e.connectionState===Xx.CONNECTED?e.connectionState=Xx.RECONNECTING:e.connectionState=Xx.CONNECTING})),this.websocket.on(dP.WILL_RECONNECT,(function(t,r){if(oK(e,Zx.IS_P2P_DISCONNECTED)&&"retry"===t)return ND.debug("".concat(e.clientId," reconnect mode is retry, but p2p lost, change to tryNext")),qD("debug",e,"".concat(e.clientId," reconnect mode is retry, but p2p lost, change to tryNext")),e.reconnectToken=void 0,e.emit(Zx.NEED_RENEW_SESSION),e.emit(Zx.DISCONNECT_P2P),r("tryNext");"retry"!==t&&(ND.debug("".concat(e.clientId," websockt will_connect event, renewSession reconnectMode is ").concat(t)),qD("debug",e,"".concat(e.clientId," websockt will_connect event, renewSession reconnectMode is ").concat(t)),e.reconnectToken=void 0,e.emit(Zx.NEED_RENEW_SESSION),e.emit(Zx.DISCONNECT_P2P)),r(t)})),this.websocket.on(dP.CONNECTED,(function(){e.openConnectionTime=Date.now(),e.reconnectToken?e.rejoin().catch((function(t){ND.warning("[".concat(e.clientId,"] rejoin failed ").concat(t)),ZD("warning",e,"rejoin",void 0,t.toString()),e.reconnect("tryNext",zx.SERVER_ERROR)})):e.join().catch((function(t){if(e.emit(Zx.REPORT_JOIN_GATEWAY,t.message||t.code,e.url||""),t instanceof SD&&t.code===mD.UNEXPECTED_RESPONSE&&t.data.code===Wx.ERR_NO_AUTHORIZED)return ND.warning("[".concat(e.clientId,"] reconnect no authorized, recover")),qD("warning",e,"reconnect no authorized, recover"),void e.reconnect("recover",zx.SERVER_ERROR);ND.error("[".concat(e.clientId,"] join gateway request failed"),t.toString()),ZD("error",e,"join",void 0,t.toString()),e.spec.forceWaitGatewayResponse?e.reconnect("tryNext",zx.SERVER_ERROR):(e.initError=t,e.close())}))})),this.websocket.on(dP.REQUEST_NEW_URLS,(function(t,r){rK(e,Zx.REQUEST_RECOVER,e.multiIpOption).then(t).catch(r)}))}}]),r}(yD))||kq;function Pq(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Lq(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Pq(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Pq(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Bq=new Map,Mq=tN("AgoraRTCGateway","store.clientId")(Oq=function(e){k(r,e);var t=W(r);function r(e,n){var i;return U(this,r),i=t.call(this),rO(S(i),"store",void 0),rO(S(i),"joinInfo",void 0),rO(S(i),"key",void 0),rO(S(i),"signal",void 0),rO(S(i),"role",void 0),rO(S(i),"inChannelInfo",{joinAt:null,duration:0}),rO(S(i),"spec",void 0),rO(S(i),"_state","DISCONNECTED"),rO(S(i),"_statsCollector",void 0),rO(S(i),"_disconnectedReason",void 0),rO(S(i),"isSignalRecover",!1),rO(S(i),"hasChangeBGPAddress",!1),rO(S(i),"trafficStatsInterval",void 0),rO(S(i),"networkQualityInterval",void 0),rO(S(i),"_joinGatewayStartTime",0),rO(S(i),"_signalTimeout",!1),rO(S(i),"_clientRoleOptions",void 0),rO(S(i),"_isProactiveJoin",!1),i.store=e,i.spec=n,i.signal=new xq(Lq(Lq({},n),{},{retryConfig:n.websocketRetryConfig})),i._statsCollector=n.statsCollector,i.role=n.role||"audience",i._clientRoleOptions=n.clientRoleOptions,i.handleSignalEvents(),i}return F(r,[{key:"state",get:function(){return this._state},set:function(e){if(e!==this._state){var t=this._state;this._state=e,"DISCONNECTED"===e&&this._disconnectedReason?this.emit(OP.CONNECTION_STATE_CHANGE,e,t,this._disconnectedReason):this.emit(OP.CONNECTION_STATE_CHANGE,e,t)}}},{key:"joinGatewayStartTime",get:function(){return this._joinGatewayStartTime},set:function(e){ND.debug("[".concat(this.store.clientId,"] set joinGatewayStartTime at ").concat(e)),ZD("debug",this,"joinGatewayStartTime",e,"[".concat(this.store.clientId,"] set joinGatewayStartTime at ").concat(e)),this._joinGatewayStartTime=e}},{key:"join",value:function(){var e=y(G.mark((function e(t,r,n){var i,o,a,s,c,u,d=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.store.joinGatewayStart(),"disabled"!==t.cloudProxyServer&&(this.hasChangeBGPAddress=!0),i=Date.now(),(o=Bq.get(t.cname))||(o=new Map,Bq.set(t.cname,o)),this._isProactiveJoin=!0,!o.has(t.uid)){e.next=6;break}throw a=new SD(mD.UID_CONFLICT),zj.joinGateway(t.sid,{lts:i,succ:!1,ec:a.message,addr:null,uid:t.uid,cid:t.cid,firstSuccess:this._isProactiveJoin,avoidJoinStartTime:this.store.avoidJoinStart,isProxy:!!t.proxyServer}),this._isProactiveJoin=!1,a;case 6:return o.set(t.uid,!0),this.joinInfo=t,this.key=r,s=t.proxyServer,c=s?t.gatewayAddrs.map((function(e){var t=e.address.split(":");return"wss://".concat(s,"/ws/?h=").concat(t[0],"&p=").concat(t[1])})):t.gatewayAddrs.map((function(e){return"wss://".concat(e.address)})),u=0,this.joinGatewayStartTime=i,e.prev=10,e.next=13,this.signal.init(c,n);case 13:u=e.sent.uid,e.next=21;break;case 16:if(e.prev=16,e.t0=e.catch(10),!e.t0||e.t0.code!==mD.INIT_WEBSOCKET_TIMEOUT){e.next=20;break}throw ND.warning("[".concat(this.store.clientId,"] User join failed"),e.t0.toString()),e.t0;case 20:throw ND.error("[".concat(this.store.clientId,"] User join failed"),e.t0.toString()),ZD("error",this,"join",void 0,e.t0.toString()),zj.joinGateway(t.sid,{lts:i,succ:!1,ec:e.t0.message,addr:this.signal.url,uid:t.uid,cid:t.cid,firstSuccess:this._isProactiveJoin,avoidJoinStartTime:this.store.avoidJoinStart,isProxy:!!s}),this._isProactiveJoin=!1,o.delete(t.uid),this.signal.close(),e.t0;case 21:return e.abrupt("return",(this.state="CONNECTED",this.inChannelInfo.joinAt=Date.now(),ND.debug("[".concat(this.store.clientId,"] Connected to gateway server")),ZD("debug",this,"join",void 0,"success"),this.trafficStatsInterval=window.setInterval((function(){d.updateTrafficStats().catch((function(e){ND.warning("[".concat(d.store.clientId,"] get traffic stats error"),e.toString()),ZD("warning",d,"trafficStatsInterval",void 0,e.toString())}))}),3e3),this.networkQualityInterval=window.setInterval((function(){navigator&&void 0!==navigator.onLine&&!navigator.onLine?d.emit(OP.NETWORK_QUALITY,{downlinkNetworkQuality:6,uplinkNetworkQuality:6}):d._signalTimeout?d.emit(OP.NETWORK_QUALITY,{downlinkNetworkQuality:5,uplinkNetworkQuality:5}):"CONNECTED"===d.state&&d._statsCollector.trafficStats?d.emit(OP.NETWORK_QUALITY,{uplinkNetworkQuality:FG(d._statsCollector.trafficStats.B_unq),downlinkNetworkQuality:FG(d._statsCollector.trafficStats.B_dnq)}):d.emit(OP.NETWORK_QUALITY,{uplinkNetworkQuality:0,downlinkNetworkQuality:0})}),2e3),this.store.joinGatewayEnd(),u));case 22:case"end":return e.stop()}}),e,this,[[10,16]])})));function t(t,r,n){return e.apply(this,arguments)}return t}()},{key:"leave",value:function(){var e=y(G.mark((function e(){var t,r,n=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>0&&void 0!==n[0]&&n[0],r=n.length>1?n[1]:void 0,"DISCONNECTED"===this.state){e.next=14;break}if(r!==qx.FALLBACK&&(this.state="DISCONNECTING"),e.prev=3,e.t0=t||this.signal.connectionState!==Xx.CONNECTED,e.t0){e.next=8;break}return e.next=8,function(e,t){return t===1/0?e:Rb.race([e,zG(t)])}(this.signal.request($x.LEAVE,void 0,!0),3e3);case 8:e.next=13;break;case 10:e.prev=10,e.t1=e.catch(3),ND.warning("[".concat(this.store.clientId,"] leave request failed, ignore"),e.t1),qD("warning",this,"leave request failed, ignore, ".concat(e.t1.toString()));case 13:this.signal.close(r),r!==qx.FALLBACK&&(this.state="DISCONNECTED"),this.reset();case 14:case"end":return e.stop()}}),e,this,[[3,10]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"publish",value:function(){var e=y(G.mark((function e(t,r,n){var i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("CONNECTED"===this.state||"RECONNECTING"===this.state){e.next=2;break}throw new SD(mD.INVALID_OPERATION,"can not publish when connection state is ".concat(this.state));case 2:return i={state:"offer",p2p_id:this.store.p2pId,ortc:r,mode:this.spec.mode,extend:gN("PUB_EXTEND")},e.prev=3,e.next=6,this.signal.request($x.PUBLISH,i,!0);case 6:return e.abrupt("return",e.sent._message);case 9:if(e.prev=9,e.t0=e.catch(3),!n||!e.t0.data||e.t0.data.code!==Wx.ERR_PUBLISH_REQUEST_INVALID){e.next=17;break}return ND.warning("[".concat(this.store.clientId,"] receive publish error code, retry"),e.t0.toString()),qD("warning",this,"receive publish error code, retry, ".concat(e.t0.toString())),e.next=16,this.tryUnpubBeforeRepub(t,r);case 16:return e.abrupt("return",this.publish(t,r,!1));case 17:throw e.t0;case 18:case"end":return e.stop()}}),e,this,[[3,9]])})));function t(t,r,n){return e.apply(this,arguments)}return t}()},{key:"unpublish",value:function(){var e=y(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,"CONNECTED"===this.state||"RECONNECTING"===this.state){e.next=3;break}throw new SD(mD.INVALID_OPERATION,"can not publish when connection state is ".concat(this.state));case 3:return e.next=5,this.signal.request($x.UNPUBLISH,{stream_id:r,ortc:t},!0);case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),ND.warning("unpublish warning: ",e.t0),ZD("warning",this,"unpublish",void 0,e.t0.toString());case 10:case"end":return e.stop()}}),e,this,[[0,7]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"subscribe",value:function(){var e=y(G.mark((function e(t,r,n){var i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("CONNECTED"===this.state||"RECONNECTING"===this.state){e.next=2;break}throw new SD(mD.INVALID_OPERATION,"can not subscribe when connection state is ".concat(this.state));case 2:return i={stream_id:t,stream_type:r.stream_type,mode:this.spec.mode,codec:this.spec.codec,p2p_id:this.store.p2pId,tcc:!!gN("SUBSCRIBE_TCC"),extend:gN("SUB_EXTEND"),ssrcId:r.ssrcId},e.prev=3,e.next=6,this.signal.request($x.SUBSCRIBE,i,!0);case 6:return e.abrupt("return",e.sent._message);case 9:if(e.prev=9,e.t0=e.catch(3),!n||!e.t0.data||e.t0.data.code!==Wx.ERR_SUBSCRIBE_REQUEST_INVALID){e.next=19;break}return ND.warning("[".concat(this.store.clientId,"] receiver subscribe error code, retry"),e.t0.toString()),qD("warning",this,"receiver subscribe error code, retry"),e.next=16,this.tryUnsubBeforeResub(t,r);case 16:return e.next=18,this.subscribe(t,r,!1);case 18:return e.abrupt("return",e.sent);case 19:throw e.t0;case 20:case"end":return e.stop()}}),e,this,[[3,9]])})));function t(t,r,n){return e.apply(this,arguments)}return t}()},{key:"subscribeAll",value:function(){var e=y(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("CONNECTED"===this.state||"RECONNECTING"===this.state){e.next=2;break}throw new SD(mD.INVALID_OPERATION,"can not massSubscribe when connection state is ".concat(this.state));case 2:return n={p2p_id:this.store.p2pId,users:t,dtx:!1},e.prev=3,e.next=6,this.signal.request($x.SUBSCRIBE_STREAMS,n,!0);case 6:case 18:return e.abrupt("return",e.sent);case 9:if(e.prev=9,e.t0=e.catch(3),!r||!e.t0.data||e.t0.data.code!==Wx.ERR_SUBSCRIBE_REQUEST_INVALID){e.next=19;break}return ND.warning("[".concat(this.store.clientId,"] receiver massSubscribe error code, retry"),e.t0.toString()),qD("warning",this,"receiver massSubscribe error code, retry"),e.next=16,this.tryMassUnsubBeforeResub(t);case 16:return e.next=18,this.subscribeAll(t,!1);case 19:throw e.t0;case 20:case"end":return e.stop()}}),e,this,[[3,9]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"setVideoProfile",value:function(){var e=y(G.mark((function e(t){var r;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=function(e){if(e.bitrateMax&&e.bitrateMin&&e.frameRate&&e.height&&e.width){var t=e.frameRate,r=e.width,n=e.height,i=!0;return"number"!=typeof t&&((t=t.exact||t.ideal||t.max||t.min||0)||(i=!1)),"number"!=typeof r&&((r=r.exact||r.ideal||r.max||r.min||0)||(i=!1)),"number"!=typeof n&&(n=n.exact||n.ideal||n.max||n.min||0,t||(i=!1)),i?{stream_type:0,width:r,height:n,fps:t,start_bps:1e3*e.bitrateMax,min_bps:1e3*e.bitrateMin,target_bps:1e3*e.bitrateMax}:void 0}}(t),e.abrupt("return",r?this.signal.request($x.SET_VIDEO_PROFILE,r):(ND.debug("[".concat(this.store.clientId,"] encoder config is not complete, do not report to gateway")),void qD("debug",this,"encoder config is not complete, do not report to gateway")));case 2:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"unsubscribe",value:function(){var e=y(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.signal.request($x.UNSUBSCRIBE,{p2p_id:this.store.p2pId,ortc:t,stream_id:r},!0);case 3:e.next=8;break;case 5:e.prev=5,e.t0=e.catch(0),ND.warning("unsubscribe warning: ",e.t0),ZD("warning",this,"unsubscribe",void 0,e.t0.toString());case 8:case"end":return e.stop()}}),e,this,[[0,5]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"massUnsubscribe",value:function(){var e=y(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.signal.request($x.UNSUBSCRIBE_STREAMS,t,!0);case 3:e.next=8;break;case 5:e.prev=5,e.t0=e.catch(0),ND.warning("unsubscribeAll warning: ",e.t0),ZD("warning",this,"unsubscribeAll",void 0,e.t0.toString());case 8:case"end":return e.stop()}}),e,this,[[0,5]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"reconnectPC",value:function(){var e=y(G.mark((function e(t){var r,n,i,o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.iceParameters,n=t.dtlsParameters,i=t.rtpCapabilities,e.next=5,this.signal.request($x.CONNECT_PC,{p2p_id:this.store.p2pId,stream_id:this.store.uid,ortc:{iceParameters:r,dtlsParameters:n,rtpCapabilities:i}},!0);case 5:return o=e.sent,a=this.getGatewayIpPort(),e.abrupt("return",{gatewayEstablishParams:o,gatewayIP:null==a?void 0:a.ip,gatewayPort:null==a?void 0:a.port});case 8:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"getGatewayInfo",value:function(){return this.signal.request($x.GATEWAY_INFO)}},{key:"renewToken",value:function(e){return this.signal.request($x.RENEW_TOKEN,e)}},{key:"setClientRole",value:function(){var e=y(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&(this._clientRoleOptions=Object.assign({},r)),"CONNECTED"===this.state){e.next=2;break}return e.abrupt("return",void(this.role=t));case 2:return n=void 0,n="audience"===t?this._clientRoleOptions&&this._clientRoleOptions.level?this._clientRoleOptions.level:2:0,e.next=6,this.signal.request($x.SET_CLIENT_ROLE,{role:t,level:n});case 6:this.role=t;case 7:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"setRemoteVideoStreamType",value:function(){var e=y(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.signal.request($x.SWITCH_VIDEO_STREAM,{stream_id:t,stream_type:r});case 2:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"setDefaultRemoteVideoStreamType",value:function(){var e=y(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.signal.request($x.DEFAULT_VIDEO_STREAM,{stream_type:t});case 2:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"setStreamFallbackOption",value:function(){var e=y(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.signal.request($x.SET_FALLBACK_OPTION,{stream_id:t,fallback_type:r});case 2:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"pickSVCLayer",value:function(){var e=y(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.signal.request($x.PICK_SVC_LAYER,{stream_id:t,spatial_layer:r.spatialLayer,temporal_layer:r.temporalLayer});case 2:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"getInChannelInfo",value:function(){return this.inChannelInfo.joinAt&&(this.inChannelInfo.duration=Date.now()-this.inChannelInfo.joinAt),Lq({},this.inChannelInfo)}},{key:"getGatewayVersion",value:function(){var e=y(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.signal.request($x.GATEWAY_INFO);case 2:return e.abrupt("return",e.sent.version);case 3:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"reset",value:function(){if(this.inChannelInfo.joinAt&&(this.inChannelInfo.duration=Date.now()-this.inChannelInfo.joinAt,this.inChannelInfo.joinAt=null),this.trafficStatsInterval&&(window.clearInterval(this.trafficStatsInterval),this.trafficStatsInterval=void 0),this.joinInfo){var e=Bq.get(this.joinInfo.cname);e&&e.delete(this.joinInfo.uid)}this.joinInfo=void 0,this.key=void 0,this.networkQualityInterval&&(window.clearInterval(this.networkQualityInterval),this.networkQualityInterval=void 0)}},{key:"updateTurnConfigFromSignal",value:function(){if(this.joinInfo){var e=function(e){var t=e.match(/(wss\:\/\/)?([^:]+):(\d+)/);return t?{username:sN.username,password:sN.password,turnServerURL:t[2],tcpport:parseInt(t[3])+30,udpport:parseInt(t[3])+30,forceturn:!1}:null}(("disabled"===this.joinInfo.cloudProxyServer?this.signal.url:this.joinInfo.gatewayAddrs[this.signal.currentURLIndex].address)||"");this.joinInfo.turnServer.serversFromGateway=[],e&&"off"!==this.joinInfo.turnServer.mode&&"disabled"===this.joinInfo.cloudProxyServer&&this.joinInfo.turnServer.serversFromGateway.push(Lq(Lq({},sN),{},{turnServerURL:e.turnServerURL,tcpport:e.tcpport,udpport:e.udpport,username:this.joinInfo.uid.toString(),password:this.joinInfo.token}))}}},{key:"updateTrafficStats",value:function(){var e=y(G.mark((function e(){var t,r=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("CONNECTED"===this.state){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.signal.request($x.TRAFFIC_STATS,void 0,!0);case 4:(t=e.sent).timestamp=Date.now(),t.peer_delay.forEach((function(e){var t=r._statsCollector.trafficStats&&r._statsCollector.trafficStats.peer_delay.find((function(t){return t.peer_uid===e.peer_uid}));t&&t.B_st!==e.B_st&&cK((function(){r.emit(OP.STREAM_TYPE_CHANGE,e.peer_uid,e.B_st)}))})),this._statsCollector.updateTrafficStats(t);case 6:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"getJoinMessage",value:function(e){if(!this.joinInfo||!this.key)throw new SD(mD.UNEXPECTED_ERROR,"can not generate join message, no join info");var t=Object.assign({},this.joinInfo.apResponse),r=gN("REPORT_APP_SCENARIO");if("string"!=typeof r)try{r=JSON.stringify(r)}catch(e){r=void 0}r&&r.length>128&&(r=void 0);var n=Lq({p2p_id:this.store.p2pId,session_id:this.joinInfo.sid,app_id:this.joinInfo.appId,channel_key:this.key,channel_name:this.joinInfo.cname,sdk_version:oN,browser:navigator.userAgent,process_id:gN("PROCESS_ID"),mode:this.spec.mode,codec:this.spec.codec,role:this.role,has_changed_gateway:this.hasChangeBGPAddress,ap_response:t,extend:gN("JOIN_EXTEND"),details:{6:this.joinInfo.stringUid,cservice_map:"proxy3"===this.joinInfo.cloudProxyServer?"1":"proxy5"===this.joinInfo.cloudProxyServer?"2":void 0},features:{rejoin:!0},optionalInfo:this.joinInfo.optionalInfo,appScenario:r,attributes:{userAttributes:{enablePublishedUserList:gN("ENABLE_PUBLISHED_USER_LIST"),maxSubscription:gN("MAX_SUBSCRIPTION")}}},e);return this.joinInfo.stringUid&&(n.string_uid=this.joinInfo.stringUid),this.joinInfo.aesmode&&this.joinInfo.aespassword&&(n.aes_mode=this.joinInfo.aesmode,gN("ENCRYPT_AES")?(n.aes_secret=this.joinInfo.aespassword,n.aes_encrypt=!0):n.aes_secret=this.joinInfo.aespassword,this.joinInfo.aessalt&&(n.aes_salt=this.joinInfo.aessalt)),t.addresses[this.signal.websocket.currentURLIndex]&&(n.ap_response.ticket=t.addresses[this.signal.websocket.currentURLIndex].ticket,delete t.addresses),void 0!==this.joinInfo.defaultVideoStream&&(n.default_video_stream=this.joinInfo.defaultVideoStream),n}},{key:"getRejoinMessage",value:function(){if(!this.joinInfo)throw new SD(mD.UNEXPECTED_ERROR,"can not generate rejoin message, no join info");return{session_id:this.joinInfo.sid,channel_name:this.joinInfo.cname,cid:this.joinInfo.cid,uid:this.joinInfo.uid,vid:Number(this.joinInfo.vid)}}},{key:"handleSignalEvents",value:function(){var e=this;this.signal.on(Zx.WS_RECONNECT_WAITTING_FINISH,(function(t){["tryNext","recover"].includes(t)&&e.joinInfo&&zj.adjustSessionStartTime(e.joinInfo.sid)})),this.signal.on(Zx.WS_RECONNECT_CREATE_CONNECTION,(function(t){e.joinGatewayStartTime=Date.now()})),this.signal.on(Zx.WS_RECONNECTING,(function(t){e.joinInfo&&zj.WebSocketQuit(e.joinInfo.sid,{lts:Date.now(),succ:-1,cname:e.joinInfo.cname,uid:e.joinInfo.uid,cid:e.joinInfo.cid,errorCode:t||zx.NETWORK_ERROR}),e.joinInfo&&(e.state="RECONNECTING",zj.sessionInit(e.joinInfo.sid,{lts:(new Date).getTime(),extend:e.isSignalRecover?{recover:!0}:{rejoin:!0},cname:e.joinInfo.cname,appid:e.joinInfo.appId,mode:e.spec.mode}),e.isSignalRecover=!1,e.joinGatewayStartTime=Date.now())})),this.signal.on(Zx.WS_CLOSED,(function(t){var r;switch(t){case qx.LEAVE:r=zx.LEAVE;break;case qx.UID_BANNED:case qx.IP_BANNED:case qx.CHANNEL_BANNED:case qx.SERVER_ERROR:r=zx.SERVER_ERROR;break;case qx.FALLBACK:r=zx.FALLBACK;break;default:r=zx.NETWORK_ERROR}ND.debug("[signal] websocket closed, reason: ".concat(r||"undefined -> "+zx.NETWORK_ERROR)),JD("debug",e,"ws_closed","reason: ".concat(t)),e.joinInfo&&zj.WebSocketQuit(e.joinInfo.sid,{lts:Date.now(),succ:t===qx.LEAVE?1:-1,cname:e.joinInfo.cname,uid:e.joinInfo.uid,cid:e.joinInfo.cid,errorCode:r}),e._disconnectedReason=t,t!==qx.FALLBACK&&(e.state="DISCONNECTED"),e.reset()})),this.signal.on(Zx.WS_CONNECTED,(function(){if(e.updateTurnConfigFromSignal(),e.state="CONNECTED",e.joinInfo&&("audience"===e.role&&e._clientRoleOptions&&e._clientRoleOptions.level&&(ND.debug("[".concat(e.store.clientId,"] patch to send set client role, role: ").concat(e.role,", mode: ").concat(e.spec.mode,", level: ").concat(e._clientRoleOptions&&e._clientRoleOptions.level)),qD("debug",e,"patch to send set client role, role: ".concat(e.role,", mode: ").concat(e.spec.mode,", level: ").concat(e._clientRoleOptions&&e._clientRoleOptions.level)),e.setClientRole(e.role,e._clientRoleOptions)),zj.joinGateway(e.joinInfo.sid,{lts:e.joinGatewayStartTime,succ:!0,ec:null,vid:e.joinInfo.vid,addr:e.signal.url,uid:e.joinInfo.uid,cid:e.joinInfo.cid,firstSuccess:e._isProactiveJoin,avoidJoinStartTime:e.store.avoidJoinStart,isProxy:!!e.joinInfo.proxyServer}),e._isProactiveJoin=!1,e.joinInfo.useLocalAccessPoint)){var t=e.signal.url&&e.signal.url.match(/wss\:\/\/([^:]+):(\d+)/);if(!t)return ND.error("[".concat(e.store.clientId,"] set local access point after joined failed: ").concat(t)),void qD("error",e,"set local access point after joined failed: ".concat(t));vN("EVENT_REPORT_DOMAIN",t[1]),vN("EVENT_REPORT_BACKUP_DOMAIN",t[1]),vN("LOG_UPLOAD_SERVER","".concat(t[1],":6444"))}})),this.signal.on(tP.ON_UPLINK_STATS,(function(t){e._statsCollector.updateUplinkStats(t)})),this.signal.on(Zx.REQUEST_RECOVER,(function(t,r,n){if(!e.joinInfo)return n(new SD(mD.UNEXPECTED_ERROR,"gateway: can not recover, no join info"));t&&(e.joinInfo.multiIP=t,e.hasChangeBGPAddress=!0),e.isSignalRecover=!0,rK(e,OP.REQUEST_NEW_GATEWAY_LIST).then(r).catch(n)})),this.signal.on(Zx.REQUEST_JOIN_INFO,function(){var t=y(G.mark((function t(r){var n,i,o,a,s;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.updateTurnConfigFromSignal(),t.next=3,rK(e,OP.REQUEST_P2P_CONNECTION_PARAMS,{turnServer:null===(n=e.joinInfo)||void 0===n?void 0:n.turnServer});case 3:i=t.sent,o=i.iceParameters,a=i.dtlsParameters,s=i.rtpCapabilities,r(e.getJoinMessage({ortc:{iceParameters:o,dtlsParameters:a,rtpCapabilities:s,version:"2"}}));case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),this.signal.on(Zx.REQUEST_REJOIN_INFO,(function(t){t(e.getRejoinMessage())})),this.signal.on(Zx.REPORT_JOIN_GATEWAY,(function(t,r){e.joinInfo&&(zj.joinGateway(e.joinInfo.sid,{lts:e.joinGatewayStartTime,succ:!1,ec:t,addr:r,uid:e.joinInfo.uid,cid:e.joinInfo.cid,firstSuccess:e._isProactiveJoin,avoidJoinStartTime:e.store.avoidJoinStart,isProxy:!!e.joinInfo.proxyServer}),e._isProactiveJoin=!1)})),this.signal.on(Zx.IS_P2P_DISCONNECTED,(function(t){t(oK(e,OP.IS_P2P_DISCONNECTED))})),this.signal.on(Zx.DISCONNECT_P2P,(function(){e.emit(OP.DISCONNECT_P2P)})),this.signal.on(Zx.NEED_RENEW_SESSION,(function(){e.emit(OP.NEED_RENEW_SESSION)})),this.signal.on(Zx.REQUEST_SUCCESS,(function(){e._signalTimeout=!1})),this.signal.on(Zx.REQUEST_TIMEOUT,(function(){e._signalTimeout=!0})),this.signal.on(Zx.JOIN_RESPONSE,(function(t){var r=e.getGatewayIpPort();r?e.emit(OP.JOIN_RESPONSE,t,r.ip,r.port):e.emit(OP.JOIN_RESPONSE,t)}))}},{key:"tryUnsubBeforeResub",value:function(){var e=y(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.signal.request($x.UNSUBSCRIBE,{p2p_id:this.store.p2pId,stream_id:t,ortc:[r]},!0);case 3:e.next=8;break;case 5:throw e.prev=5,e.t0=e.catch(0),ND.warning("unsubscribe warning",e.t0),ZD("warning",this,"tryUnsubBeforeResub",t,e.t0.toString()),e.t0;case 8:case"end":return e.stop()}}),e,this,[[0,5]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"tryUnpubBeforeRepub",value:function(){var e=y(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.signal.request($x.UNPUBLISH,{stream_id:t,ortc:r},!0);case 3:e.next=8;break;case 5:throw e.prev=5,e.t0=e.catch(0),ND.warning("unpublish warning: ",e.t0),ZD("warning",this,"tryUnpubBeforeRepub",t,e.t0.toString()),e.t0;case 8:case"end":return e.stop()}}),e,this,[[0,5]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"tryMassUnsubBeforeResub",value:function(){var e=y(G.mark((function e(t){var r;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={users:t.map((function(e){return{stream_id:e.stream_id,stream_type:e.stream_type}}))},e.prev=1,e.next=4,this.signal.request($x.UNSUBSCRIBE_STREAMS,r,!0);case 4:e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(1),ND.warning("massUnsubscribe warning",e.t0),ZD("warning",this,"tryUnsubAllBeforeResub",t.map((function(e){return e.stream_id})),e.t0.toString()),e.t0;case 9:case"end":return e.stop()}}),e,this,[[1,6]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"muteLocal",value:function(){var e=y(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={action:t.find((function(e){return e.stream_type===kP.Audio}))?"mute_local_audio":"mute_local_video",p2p_id:this.store.p2pId,ortc:t,stream_id:r},e.prev=1,e.next=4,this.signal.request($x.CONTROL,n,!0,!0);case 4:e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(1),ND.warning("gateway unmuteLocal warning: ",e.t0),ZD("warning",this,"muteLocal",r,e.t0.toString()),e.t0;case 9:case"end":return e.stop()}}),e,this,[[1,6]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"unmuteLocal",value:function(){var e=y(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={action:t.find((function(e){return e.stream_type===kP.Audio}))?"unmute_local_audio":"unmute_local_video",p2p_id:this.store.p2pId,ortc:t,stream_id:r},e.prev=1,e.next=4,this.signal.request($x.CONTROL,n,!0,!0);case 4:e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(1),ND.warning("gateway muteLocal warning: ",e.t0),ZD("warning",this,"unmuteLocal",r,e.t0.toString()),e.t0;case 9:case"end":return e.stop()}}),e,this,[[1,6]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"uploadStats",value:function(e,t){this.signal.upload(e,t)}},{key:"getSignalRTT",value:function(){return this.signal.rtt}},{key:"restartICE",value:function(){var e=y(G.mark((function e(t){var r,n,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={p2p_id:this.store.p2pId,stream_id:this.store.uid,ortc:t},e.prev=1,e.next=4,this.signal.request($x.RESTART_ICE,r,!0);case 4:return n=e.sent,i=this.getGatewayIpPort(),e.abrupt("return",{restartICEResponse:n,gatewayIP:null==i?void 0:i.ip,gatewayPort:null==i?void 0:i.port});case 9:throw e.prev=9,e.t0=e.catch(1),ND.warning("P2PChannel.restartICE warning: ",e.t0),ZD("warning",this,"restartICE",void 0,e.t0.toString()),e.t0;case 12:case"end":return e.stop()}}),e,this,[[1,9]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"reconnect",value:function(){"CONNECTED"===this.state&&this.signal.reconnect(void 0,zx.P2P_FAILED)}},{key:"getGatewayIpPort",value:function(){var e;if(!gN("GATEWAY_WSS_ADDRESS")&&null!==(e=this.joinInfo)&&void 0!==e&&e.gatewayAddrs){var t=this.joinInfo.gatewayAddrs[this.signal.currentURLIndex];return(t.ip||t.ip6)&&t.port?t.ip6?{ip:t.ip6,port:t.port}:{ip:t.ip,port:t.port}:void 0}}}]),r}(yD))||Oq;/*! formdata-polyfill. MIT License. Jimmy W?rting <https://jimmy.warting.se/opensource> */function Uq(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Qq(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Uq(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Uq(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}!function(){var e;function t(e){var t=0;return function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}var r,n="function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,r){return e==Array.prototype||e==Object.prototype||(e[t]=r.value),e},i=function(e){e=["object"==("undefined"==typeof globalThis?"undefined":D(globalThis))&&globalThis,e,"object"==("undefined"==typeof window?"undefined":D(window))&&window,"object"==("undefined"==typeof self?"undefined":D(self))&&self,"object"==D(a)&&a];for(var t=0;t<e.length;++t){var r=e[t];if(r&&r.Math==Math)return r}throw Error("Cannot find global object")}(this);function o(e,t){if(t)e:{var r=i;e=e.split(".");for(var o=0;o<e.length-1;o++){var a=e[o];if(!(a in r))break e;r=r[a]}(t=t(o=r[e=e[e.length-1]]))!=o&&null!=t&&n(r,e,{configurable:!0,writable:!0,value:t})}}function s(e){return(e={next:e})[Symbol.iterator]=function(){return this},e}function c(e){var r="undefined"!=typeof Symbol&&Symbol.iterator&&e[Symbol.iterator];return r?r.call(e):{next:t(e)}}if(o("Symbol",(function(e){function t(e,t){this.A=e,n(this,"description",{configurable:!0,writable:!0,value:t})}if(e)return e;t.prototype.toString=function(){return this.A};var r="jscomp_symbol_"+(1e9*Math.random()>>>0)+"_",i=0;return function e(n){if(this instanceof e)throw new TypeError("Symbol is not a constructor");return new t(r+(n||"")+"_"+i++,n)}})),o("Symbol.iterator",(function(e){if(e)return e;e=Symbol("Symbol.iterator");for(var r="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),o=0;o<r.length;o++){var a=i[r[o]];"function"==typeof a&&"function"!=typeof a.prototype[e]&&n(a.prototype,e,{configurable:!0,writable:!0,value:function(){return s(t(this))}})}return e})),"function"==typeof Object.setPrototypeOf)r=Object.setPrototypeOf;else{var u;e:{var d={};try{d.__proto__={a:!0},u=d.a;break e}catch(e){}u=!1}r=u?function(e,t){if(e.__proto__=t,e.__proto__!==t)throw new TypeError(e+" is not extensible");return e}:null}var l=r;function p(){this.m=!1,this.j=null,this.v=void 0,this.h=1,this.u=this.C=0,this.l=null}function f(e){if(e.m)throw new TypeError("Generator is already running");e.m=!0}function h(e,t){return e.h=3,{value:t}}function A(e){this.g=new p,this.G=e}function v(e,t,r,n){try{var i=t.call(e.g.j,r);if(!(i instanceof Object))throw new TypeError("Iterator result "+i+" is not an object");if(!i.done)return e.g.m=!1,i;var o=i.value}catch(t){return e.g.j=null,e.g.s(t),g(e)}return e.g.j=null,n.call(e.g,o),g(e)}function g(e){for(;e.g.h;)try{var t=e.G(e.g);if(t)return e.g.m=!1,{value:t.value,done:!1}}catch(t){e.g.v=void 0,e.g.s(t)}if(e.g.m=!1,e.g.l){if(t=e.g.l,e.g.l=null,t.F)throw t.D;return{value:t.return,done:!0}}return{value:void 0,done:!0}}function m(e){this.next=function(t){return e.o(t)},this.throw=function(t){return e.s(t)},this.return=function(t){return function(e,t){f(e.g);var r=e.g.j;return r?v(e,"return"in r?r.return:function(e){return{value:e,done:!0}},t,e.g.return):(e.g.return(t),g(e))}(e,t)},this[Symbol.iterator]=function(){return this}}function E(e,t){return t=new m(new A(t)),l&&e.prototype&&l(t,e.prototype),t}if(p.prototype.o=function(e){this.v=e},p.prototype.s=function(e){this.l={D:e,F:!0},this.h=this.C||this.u},p.prototype.return=function(e){this.l={return:e},this.h=this.u},A.prototype.o=function(e){return f(this.g),this.g.j?v(this,this.g.j.next,e,this.g.o):(this.g.o(e),g(this))},A.prototype.s=function(e){return f(this.g),this.g.j?v(this,this.g.j.throw,e,this.g.o):(this.g.s(e),g(this))},o("Array.prototype.entries",(function(e){return e||function(){return function(e,t){e instanceof String&&(e+="");var r=0,n=!1,i={next:function(){if(!n&&r<e.length){var i=r++;return{value:t(i,e[i]),done:!1}}return n=!0,{done:!0,value:void 0}}};return i[Symbol.iterator]=function(){return i},i}(this,(function(e,t){return[e,t]}))}})),"undefined"!=typeof Blob&&("undefined"==typeof FormData||!FormData.prototype.keys)){var _=function(e,t){for(var r=0;r<e.length;r++)t(e[r])},y=function(e){return e.replace(/\r?\n|\r/g,"\r\n")},I=function(e,t,r){return t instanceof Blob?(r=void 0!==r?String(r+""):"string"==typeof t.name?t.name:"blob",t.name===r&&"[object Blob]"!==Object.prototype.toString.call(t)||(t=new File([t],r)),[String(e),t]):[String(e),String(t)]},S=function(e,t){if(e.length<t)throw new TypeError(t+" argument required, but only "+e.length+" present.")},b="object"==("undefined"==typeof globalThis?"undefined":D(globalThis))?globalThis:"object"==("undefined"==typeof window?"undefined":D(window))?window:"object"==("undefined"==typeof self?"undefined":D(self))?self:this,C=b.FormData,w=b.XMLHttpRequest&&b.XMLHttpRequest.prototype.send,R=b.Request&&b.fetch,T=b.navigator&&b.navigator.sendBeacon,k=b.Element&&b.Element.prototype,O=b.Symbol&&Symbol.toStringTag;O&&(Blob.prototype[O]||(Blob.prototype[O]="Blob"),"File"in b&&!File.prototype[O]&&(File.prototype[O]="File"));try{new File([],"")}catch(e){b.File=function(e,t,r){return e=new Blob(e,r||{}),Object.defineProperties(e,{name:{value:t},lastModified:{value:+(r&&void 0!==r.lastModified?new Date(r.lastModified):new Date)},toString:{value:function(){return"[object File]"}}}),O&&Object.defineProperty(e,O,{value:"File"}),e}}var N=function(e){return e.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22")},x=function(e){this.i=[];var t=this;e&&_(e.elements,(function(e){if(e.name&&!e.disabled&&"submit"!==e.type&&"button"!==e.type&&!e.matches("form fieldset[disabled] *"))if("file"===e.type){var r=e.files&&e.files.length?e.files:[new File([],"",{type:"application/octet-stream"})];_(r,(function(r){t.append(e.name,r)}))}else"select-multiple"===e.type||"select-one"===e.type?_(e.options,(function(r){!r.disabled&&r.selected&&t.append(e.name,r.value)})):"checkbox"===e.type||"radio"===e.type?e.checked&&t.append(e.name,e.value):(r="textarea"===e.type?y(e.value):e.value,t.append(e.name,r))}))};if((e=x.prototype).append=function(e,t,r){S(arguments,2),this.i.push(I(e,t,r))},e.delete=function(e){S(arguments,1);var t=[];e=String(e),_(this.i,(function(r){r[0]!==e&&t.push(r)})),this.i=t},e.entries=function e(){var t,r=this;return E(e,(function(e){if(1==e.h&&(t=0),3!=e.h)return t<r.i.length?e=h(e,r.i[t]):(e.h=0,e=void 0),e;t++,e.h=2}))},e.forEach=function(e,t){S(arguments,1);for(var r=c(this),n=r.next();!n.done;n=r.next()){var i=c(n.value);n=i.next().value,i=i.next().value,e.call(t,i,n,this)}},e.get=function(e){S(arguments,1);var t=this.i;e=String(e);for(var r=0;r<t.length;r++)if(t[r][0]===e)return t[r][1];return null},e.getAll=function(e){S(arguments,1);var t=[];return e=String(e),_(this.i,(function(r){r[0]===e&&t.push(r[1])})),t},e.has=function(e){S(arguments,1),e=String(e);for(var t=0;t<this.i.length;t++)if(this.i[t][0]===e)return!0;return!1},e.keys=function e(){var t,r,n,i=this;return E(e,(function(e){if(1==e.h&&(t=c(i),r=t.next()),3!=e.h)return r.done?void(e.h=0):(n=r.value,h(e,c(n).next().value));r=t.next(),e.h=2}))},e.set=function(e,t,r){S(arguments,2),e=String(e);var n=[],i=I(e,t,r),o=!0;_(this.i,(function(t){t[0]===e?o&&(o=!n.push(i)):n.push(t)})),o&&n.push(i),this.i=n},e.values=function e(){var t,r,n,i,o=this;return E(e,(function(e){if(1==e.h&&(t=c(o),r=t.next()),3!=e.h)return r.done?void(e.h=0):(n=r.value,(i=c(n)).next(),h(e,i.next().value));r=t.next(),e.h=2}))},x.prototype._asNative=function(){for(var e=new C,t=c(this),r=t.next();!r.done;r=t.next()){var n=c(r.value);r=n.next().value,n=n.next().value,e.append(r,n)}return e},x.prototype._blob=function(){var e="----formdata-polyfill-"+Math.random(),t=[],r="--"+e+'\r\nContent-Disposition: form-data; name="';return this.forEach((function(e,n){return"string"==typeof e?t.push(r+N(y(n))+'"\r\n\r\n'+y(e)+"\r\n"):t.push(r+N(y(n))+'"; filename="'+N(e.name)+'"\r\nContent-Type: '+(e.type||"application/octet-stream")+"\r\n\r\n",e,"\r\n")})),t.push("--"+e+"--"),new Blob(t,{type:"multipart/form-data; boundary="+e})},x.prototype[Symbol.iterator]=function(){return this.entries()},x.prototype.toString=function(){return"[object FormData]"},k&&!k.matches&&(k.matches=k.matchesSelector||k.mozMatchesSelector||k.msMatchesSelector||k.oMatchesSelector||k.webkitMatchesSelector||function(e){for(var t=(e=(this.document||this.ownerDocument).querySelectorAll(e)).length;0<=--t&&e.item(t)!==this;);return-1<t}),O&&(x.prototype[O]="FormData"),w){var P=b.XMLHttpRequest.prototype.setRequestHeader;b.XMLHttpRequest.prototype.setRequestHeader=function(e,t){P.call(this,e,t),"content-type"===e.toLowerCase()&&(this.B=!0)},b.XMLHttpRequest.prototype.send=function(e){e instanceof x?(e=e._blob(),this.B||this.setRequestHeader("Content-Type",e.type),w.call(this,e)):w.call(this,e)}}R&&(b.fetch=function(e,t){return t&&t.body&&t.body instanceof x&&(t.body=t.body._blob()),R.call(this,e,t)}),T&&(b.navigator.sendBeacon=function(e,t){return t instanceof x&&(t=t._asNative()),T.call(this,e,t)}),b.FormData=x}}();var Fq=1;function jq(e,t,r,n,i){Fq+=1;var o,a,s={sid:r.sid,command:"convergeAllocateEdge",uid:"666",appId:r.appId,ts:Math.floor(Date.now()/1e3),seq:Fq,requestId:Fq,version:oN,cname:r.cname},c={service_name:t,json_body:JSON.stringify(s)},u=e[0];return wD(y(G.mark((function e(){var r,i,s,d,l,p;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=Date.now(),e.next=3,Uj(u,{data:c,cancelToken:n,headers:{"X-Packet-Service-Type":"0","X-Packet-URI":"61"}});case 3:if(r=e.sent,a=Date.now()-o,0===r.code){e.next=7;break}throw i=new SD(mD.UNEXPECTED_RESPONSE,"live streaming ap error, code"+r.code,{retry:!0,responseTime:a}),ND.error(i.toString()),ZD("error",["AjaxAPI"],"requestLiveStreamingWorkerManager",void 0,i.toString()),i;case 7:if(200===(s=JSON.parse(r.json_body)).code){e.next=11;break}throw d=new SD(mD.UNEXPECTED_RESPONSE,"live streaming app center error, code: ".concat(s.code,", reason: ").concat(s.reason),{code:s.code,responseTime:a}),ND.error(d.toString()),ZD("error",["AjaxAPI"],"requestLiveStreamingWorkerManager",void 0,d.toString()),d;case 11:if(s.servers&&0!==s.servers.length){e.next=14;break}throw l=new SD(mD.UNEXPECTED_RESPONSE,"live streaming app center empty server",{code:s.code,responseTime:a}),ND.error(l.toString()),ZD("error",["AjaxAPI"],"requestLiveStreamingWorkerManager",void 0,l.toString()),l;case 14:return p=function(e,t){return{addressList:e.servers.map((function(e){return"wss://".concat(e.address.replace(/\./g,"-"),".").concat(gN("WORKER_DOMAIN"),":").concat(e.wss,"?serviceName=").concat(encodeURIComponent(t))})),workerToken:e.workerToken,vid:e.vid}}(s,t),e.abrupt("return",(gN("LIVE_STREAMING_ADDRESS")&&(p.addressList=gN("LIVE_STREAMING_ADDRESS")instanceof Array?gN("LIVE_STREAMING_ADDRESS"):[gN("LIVE_STREAMING_ADDRESS")]),Qq(Qq({},p),{},{responseTime:a})));case 16:case"end":return e.stop()}}),e)}))),(function(n,i){return zj.apworkerEvent(r.sid,{success:!0,sc:200,serviceName:t,responseDetail:JSON.stringify(n.addressList),firstSuccess:0===i,responseTime:a,serverIp:e[i%e.length]}),!1}),(function(n,i){return zj.apworkerEvent(r.sid,{success:!1,sc:n.data&&n.data.code||200,serviceName:t,responseTime:a,serverIp:e[i%e.length]}),!!(n.code!==mD.OPERATION_ABORTED&&n.code!==mD.UNEXPECTED_RESPONSE||n.data&&n.data.retry)&&(u=e[(i+1)%e.length],!0)}),i)}var Vq=1;function Gq(e,t,r,n){var i=e.url,o=e.areaCode;ZD("debug",["AjaxAPI",t.clientId],"requestChooseServer",{url:i,areaCode:o});var a=Date.now(),s=Jq(t,o,[iF.CHOOSE_SERVER]),c=E(s,2),u=c[0],d=c[1],l=Vj.networkState;return wD(y(G.mark((function e(){var o,s;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=l&&Vj.networkState===XP.OFFLINE&&Vj.onlineWaiter,!e.t0){e.next=4;break}return e.next=4,Rb.race([Vj.onlineWaiter,JG(n&&n.maxRetryTimeout||bD.maxRetryTimeout)]);case 4:return l=Vj.networkState,e.next=7,Uj(i,{data:u,cancelToken:r,headers:{"Content-Type":"multipart/form-data;"}},!0);case 7:return o=e.sent,zj.reportResourceTiming(i,t.sid),Wq(o,i,t,a,[iF.CHOOSE_SERVER]),s=jG(o,iF.CHOOSE_SERVER),e.abrupt("return",(Yq(s),BG(s,i)));case 11:case"end":return e.stop()}}),e)}))),(function(e){return e&&zj.joinChooseServer(t.sid,{lts:a,succ:!0,csAddr:i,opid:d,serverList:e.gatewayAddrs.map((function(e){return e.address})),ec:null,cid:e.cid.toString(),uid:e.uid.toString(),csIp:e.csIp,unilbsServerIds:[iF.CHOOSE_SERVER].toString()}),!1}),(function(e){return e.code!==mD.OPERATION_ABORTED&&(e.code===mD.CAN_NOT_GET_GATEWAY_SERVER?e.data.retry:(zj.joinChooseServer(t.sid,{lts:a,succ:!1,csAddr:i,serverList:null,opid:d,ec:e.code,csIp:e.data&&e.data.csIp,unilbsServerIds:[iF.CHOOSE_SERVER].toString(),extend:JSON.stringify({networkState:l})}),ND.warning("[".concat(t.clientId,"] Choose server network error, retry"),e),qD("warning",["AjaxAPI",t.clientId],"Choose server network error, retry, ".concat(e)),!0))}),n)}function Kq(e,t,r,n){var i=e.url,o=e.areaCode,a=e.serviceIds;ZD("debug",["AjaxAPI",t.clientId],"requestMultiUnilbs",{url:i,areaCode:o,serviceIds:a});var s=Date.now(),c=Jq(t,o,a),u=E(c,2),d=u[0],l=u[1],p=void 0;return wD(y(G.mark((function e(){var o,c,u;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=p&&Vj.networkState===XP.OFFLINE&&Vj.onlineWaiter,!e.t0){e.next=4;break}return e.next=4,Rb.race([Vj.onlineWaiter,JG(n&&n.maxRetryTimeout||bD.maxRetryTimeout)]);case 4:return p=Vj.networkState,e.next=7,Uj(i,{data:d,cancelToken:r,headers:{"Content-Type":"multipart/form-data;"}},!0);case 7:return o=e.sent,zj.reportResourceTiming(i,t.sid),Wq(o,i,t,s,a),c=jG(o,iF.CHOOSE_SERVER),u=jG(o,"proxy5"===t.cloudProxyServer?iF.CLOUD_PROXY_5:"proxy3"===t.cloudProxyServer||"proxy4"===t.cloudProxyServer?iF.CLOUD_PROXY:iF.CLOUD_PROXY_FALLBACK),e.abrupt("return",(Yq(c),{gatewayInfo:BG(c,i),proxyInfo:u,url:i}));case 11:case"end":return e.stop()}}),e)}))),(function(e){return e.gatewayInfo&&zj.joinChooseServer(t.sid,{lts:s,succ:!0,csAddr:i,serverList:e.gatewayInfo.gatewayAddrs.map((function(e){return e.address})),ec:null,opid:l,cid:e.gatewayInfo.cid.toString(),uid:e.gatewayInfo.uid.toString(),csIp:e.gatewayInfo.csIp,unilbsServerIds:a.toString()}),e.proxyInfo&&zj.joinWebProxyAP(t.sid,{lts:s,sucess:1,apServerAddr:i,turnServerAddrList:e.proxyInfo.addresses.map((function(e){return e.ip})).join(","),errorCode:null,eventType:t.cloudProxyServer,unilbsServerIds:a.toString()}),!1}),(function(e){return e.code!==mD.OPERATION_ABORTED&&(e.code===mD.CAN_NOT_GET_GATEWAY_SERVER?e.data.retry:(zj.joinWebProxyAP(t.sid,{lts:s,sucess:0,apServerAddr:i,turnServerAddrList:null,errorCode:e.code,eventType:t.cloudProxyServer,unilbsServerIds:a.toString(),extend:JSON.stringify({networkState:p})}),ND.warning("[".concat(t.clientId,"] multi unilbs network error, retry"),e),qD("warning",["AjaxAPI",t.clientId],"multi unilbs network error, retry, ".concat(e)),!0))}),n)}var Hq,Wq=function(e,t,r,n,i){var o=[],a=function(o){4096===o.flag?zj.joinChooseServer(r.sid,{lts:n,succ:!1,csAddr:t,opid:e.opid,serverList:null,ec:o.error.message,csIp:o.error.data&&o.error.data.csIp,unilbsServerIds:i.toString()}):1048576!==o.flag&&4194304!==o.flag&&4194310!==o.flag||zj.joinWebProxyAP(r.sid,{lts:n,sucess:0,apServerAddr:t,turnServerAddrList:null,errorCode:o.error.code,eventType:r.cloudProxyServer,unilbsServerIds:i.toString()})};if(e.response_body.forEach((function(t){var r=t.buffer.code;if(23===t.uri&&0===r&&!t.buffer.edges_services)if(4194310===t.buffer.flag)ND.warning("no edge services in ap response of proxy fallback, will not set proxy in iceServers"),t.buffer.edges_services=[];else{var n={error:new SD(mD.CAN_NOT_GET_GATEWAY_SERVER,"no edge services in ap response",{retry:!0,csIp:e.detail[502]}),flag:t.buffer.flag};o.push(n),a(n)}if(0!==r){var i=dq(r),s={error:new SD(mD.CAN_NOT_GET_GATEWAY_SERVER,i.desc,{retry:i.retry,csIp:e.detail[502]}),flag:t.buffer.flag};4194310===t.buffer.flag?ND.warning(s.error.toString()):o.push(s),a(s)}})),o.length)throw ND.warning("[".concat(r.clientId,"] multi unilbs ").concat(t," failed, ").concat(o.map((function(e){return"flag: ".concat(e.flag,", message: ").concat(e.error.message,", retry: ").concat(e.error.data.retry)})).join(" | "))),ZD("warning",["AjaxAPI",r.clientId],"checkMultiUnilbsResponseValid",{url:t},o.map((function(e){return{flag:e.flag,message:e.error.message,retry:e.error.data.retry}}))),new SD(mD.CAN_NOT_GET_GATEWAY_SERVER,o.map((function(e){return"flag: ".concat(e.flag,", message: ").concat(e.error.message)})).join(" | "),{retry:!!o.find((function(e){return e.error.data.retry})),csIp:e.detail[502]})},Yq=function(e){if(e.addresses&&0===e.addresses.length&&0===e.code)throw new SD(mD.CAN_NOT_GET_GATEWAY_SERVER,"void gateway address",{retry:!0,csIp:e.detail&&e.detail[502]});if(gN("GATEWAY_ADDRESS")&&gN("GATEWAY_ADDRESS").length>0){ND.debug("assign gateway address to",gN("GATEWAY_ADDRESS")),qD("debug",["AjaxAPI"],"assign gateway address to ".concat(JSON.stringify(gN("GATEWAY_ADDRESS"))));var t=gN("GATEWAY_ADDRESS").map((function(t){return{ip:t.ip,port:t.port,ticket:e.addresses[0]&&e.addresses[0].ticket}}));e.addresses=t}},qq=function(e,t){if(e.response_body&&e.response_body.length){var r=e.response_body[0];if(0!==r.buffer.code){var n=dq(r.buffer.code);throw new SD(mD.UPDATE_TICKET_FAILED,"[".concat(r.buffer.code,"]: ").concat(n.desc),{retry:n.retry})}return r.buffer.ticket}throw ND.debug("update ticket request received ap response without response body:",t),qD("debug",["AjaxAPI"],"update ticket request received ap response without response body: ".concat(t)),new SD(mD.UPDATE_TICKET_FAILED,"cannot find response body from ap response",{retry:!1})},Jq=function(e,t,r){var n=Math.floor(Math.random()*Math.pow(10,12)),i={appid:e.appId,client_ts:Date.now(),opid:n,sid:e.sid,request_bodies:[{uri:22,buffer:{cname:e.cname,detail:{6:e.stringUid,11:t,12:gN("USE_NEW_TOKEN")?"1":void 0},key:e.token,service_ids:r,uid:e.uid||0}}]};i.request_bodies.forEach((function(t){e.multiIP&&e.multiIP.gateway_ip&&(t.buffer.detail[5]=JSON.stringify({vocs_ip:[e.multiIP.uni_lbs_ip],vos_ip:[e.multiIP.gateway_ip]}))}));var o=new FormData;return o.append("request",JSON.stringify(i)),[o,n]},zq=function(e,t){var r=Math.floor(Math.random()*Math.pow(10,12)),n={appid:e.appId,client_ts:Date.now(),opid:r,sid:e.sid,request_bodies:[{uri:28,buffer:{cname:e.cname,detail:{1:"",6:e.stringUid,12:"1"},token:e.token,service_ids:t,uid:e.uid||0,edges_services:e.apResponse.addresses.map((function(e){return{ip:e.ip,port:e.port}}))}}]},i=new FormData;return i.append("request",JSON.stringify(n)),[i,r]},Xq=function(){var e=gN("AREAS");return 0===e.length&&e.push(UP.GLOBAL),Hp(e).call(e,(function(e,t,r){var n=Zq(t);return n?0===r?n:"".concat(e,",").concat(n):e}),"")},Zq=function(e){return e===UP.OVERSEA?"".concat(GP.ASIA,",").concat(GP.EUROPE,",").concat(GP.AFRICA,",").concat(GP.NORTH_AMERICA,",").concat(GP.SOUTH_AMERICA,",").concat(GP.OCEANIA):GP[e]},$q={GLOBAL:{ASIA:[UP.CHINA,UP.JAPAN,UP.INDIA,UP.KOREA,UP.HKMC],EUROPE:[],NORTH_AMERICA:[UP.US],SOUTH_AMERICA:[],OCEANIA:[],AFRICA:[]}},eJ=Object.keys($q[UP.GLOBAL]),tJ=[UP.CHINA,UP.NORTH_AMERICA,UP.EUROPE,UP.ASIA,UP.JAPAN,UP.INDIA,UP.OCEANIA,UP.SOUTH_AMERICA,UP.AFRICA,UP.KOREA,UP.HKMC,UP.US],rJ=function(e,t){var r,n,i=[];if(e.includes(UP.GLOBAL)){var o=[UP.GLOBAL,UP.OVERSEA],a=Object.keys($P);if(t===UP.GLOBAL)throw new SD(mD.INVALID_PARAMS,"GLOBAL is an invalid excludedArea value");if(t===UP.CHINA)i=[UP.OVERSEA];else if(n=t,eJ.includes(n)){var s=(r=t,$q[UP.GLOBAL][r]||[]),c=[].concat(o,[t],M(s));i=a.filter((function(e){return!c.includes(e)}))}else if(function(e){var t=!1;return eJ.forEach((function(r){$q[UP.GLOBAL][r].includes(e)&&(t=!0)})),t}(t)){var u=function(e){var t;return eJ.forEach((function(r){$q[UP.GLOBAL][r].includes(e)&&(t=r)})),t}(t),d=[].concat(o,[u,t]);i=a.filter((function(e){return!d.includes(e)}))}else i=e;i=function(e){var t=[];return tJ.forEach((function(r){e.includes(r)&&t.push(r)})),t.concat(e.filter((function(e){return!tJ.includes(e)})))}(i)}else i=e;return i};function nJ(e,t,r){return iJ.apply(this,arguments)}function iJ(){return iJ=y(G.mark((function e(t,r,n){var i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=function(){var e=y(G.mark((function e(t,r,n){var i,o,a,s,c;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=gN("WEBCS_DOMAIN").slice(0,gN("AJAX_REQUEST_CONCURRENT")).map((function(e){return{url:t.proxyServer?"https://".concat(t.proxyServer,"/ap/?url=").concat(e+"/api/v2/transpond/webrtc?v=2"):"https://".concat(e,"/api/v2/transpond/webrtc?v=2"),areaCode:Xq()}})),o=null,a=[],s=function(){var e=y(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vK({fragementLength:gN("FRAGEMENT_LENGTH"),referenceList:i,asyncMapHandler:function(e){return ND.debug("[".concat(t.clientId,"] Connect to choose_server:"),e.url),Gq(e,t,r,n)},allFailedhandler:function(e){throw e[0]},promisesCollector:a});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),c=function(){var e=y(G.mark((function e(){var i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,JG(1e3);case 2:if(null===o){e.next=4;break}return e.abrupt("return",o);case 4:return i=gN("WEBCS_DOMAIN_BACKUP_LIST").map((function(e){return{url:t.proxyServer?"https://".concat(t.proxyServer,"/ap/?url=").concat(e+"/api/v2/transpond/webrtc?v=2"):"https://".concat(e,"/api/v2/transpond/webrtc?v=2"),areaCode:Xq()}})),e.next=7,vK({fragementLength:gN("FRAGEMENT_LENGTH"),referenceList:i,asyncMapHandler:function(e){return ND.debug("[".concat(t.clientId,"] Connect to backup choose_server:"),e.url),Gq(e,t,r,n)},allFailedhandler:function(e){throw e[0]},promisesCollector:a});case 7:return e.abrupt("return",e.sent);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),e.prev=3,e.next=6,tK([s(),c()]);case 6:return o=e.sent,a.length&&a.forEach((function(e){return e.cancel&&"function"==typeof e.cancel&&e.cancel()})),e.abrupt("return",o);case 11:throw e.prev=11,e.t0=e.catch(3),e.t0[0];case 14:case"end":return e.stop()}}),e,null,[[3,11]])})));return function(t,r,n){return e.apply(this,arguments)}}()(t,r,n),e.next=3,i;case 3:return e.t0=e.sent,e.abrupt("return",{gatewayInfo:e.t0});case 5:case"end":return e.stop()}}),e)}))),iJ.apply(this,arguments)}function oJ(e,t,r,n){return aJ.apply(this,arguments)}function aJ(){return aJ=y(G.mark((function e(t,r,n,i){var o,a,s,c,u,d,l,p,f,h,A;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("disabled"!==(o=t.cloudProxyServer)){e.next=18;break}if(i){e.next=4;break}return e.abrupt("return");case 4:if(!t.useLocalAccessPoint){e.next=8;break}return e.next=7,nJ(t,r,n);case 7:return e.abrupt("return",e.sent);case 8:if(!gN("JOIN_WITH_FALLBACK_MEDIA_PROXY")){e.next=15;break}return e.next=11,fJ(t,r,n);case 11:return a=e.sent,s=a.gatewayInfo,c=a.proxyInfo,e.abrupt("return",t.turnServer&&"auto"!==t.turnServer.mode?(qD("debug",["Server",t.clientId],"do not set fallback turn because of already having turnserver"),{gatewayInfo:s}):(t.turnServer={mode:"manual",servers:c.map((function(e){return{turnServerURL:e.address,tcpport:e.tcpport||sN.tcpport,udpport:e.udpport||sN.udpport,username:e.username||sN.username,password:e.password||sN.password,forceturn:gN("JOIN_WITH_FALLBACK_MEDIA_PROXY_FORCE"),security:!0}}))},{gatewayInfo:s}));case 15:return e.next=17,nJ(t,r,n);case 17:return e.abrupt("return",e.sent);case 18:if(!["443only","normal"].includes(o)){e.next=59;break}if(!i){e.next=42;break}if("normal"===o){e.next=30;break}return e.next=23,Rb.all([uJ(t,r,n),nJ(t,r,n)]);case 23:d=e.sent,l=E(d,2),p=l[0],u=l[1],e.next=40;break;case 30:return e.next=32,uJ(t,r,n);case 32:return p=e.sent,t.proxyServer=p.addresses[0],zj.setProxyServer(t.proxyServer),ND.setProxyServer(t.proxyServer),YD(t.proxyServer),e.next=39,nJ(t,r,n);case 39:u=e.sent;case 40:e.next=56;break;case 42:if(u=void 0,"normal"===o){e.next=49;break}return e.next=46,uJ(t,r,n);case 46:p=e.sent,e.next=56;break;case 49:return e.next=51,uJ(t,r,n);case 51:p=e.sent,t.proxyServer=p.addresses[0],zj.setProxyServer(t.proxyServer),ND.setProxyServer(t.proxyServer),YD(t.proxyServer);case 56:t.turnServer={mode:"manual",servers:p.addresses.map((function(e){return{turnServerURL:e,tcpport:p.serverResponse.tcpport?p.serverResponse.tcpport:sN.tcpport,udpport:p.serverResponse.udpport?p.serverResponse.udpport:sN.udpport,username:p.serverResponse.username||sN.username,password:p.serverResponse.password||sN.password,forceturn:!0,security:!1}}))},e.next=65;break;case 59:return e.next=61,fJ(t,r,n);case 61:f=e.sent,h=f.proxyInfo,A=f.gatewayInfo,u={gatewayInfo:A},t.turnServer={mode:"manual",servers:h.map((function(e){return{turnServerURL:e.address,tcpport:"proxy3"===o?void 0:e.tcpport?e.tcpport:sN.tcpport,udpport:"proxy4"===o?void 0:e.udpport?e.udpport:sN.udpport,username:e.username||sN.username,password:e.password||sN.password,forceturn:"proxy4"!==o,security:"proxy5"===o}}))};case 65:return e.abrupt("return",(ND.debug("[".concat(t.clientId,"] set proxy server: ").concat(t.proxyServer,", mode: ").concat(o)),ZD("debug",["Server",t.clientId],"setCloudProxyServerAndGetServerInfo",{proxyServer:t.proxyServer,mode:t.cloudProxyServer}),u));case 66:case"end":return e.stop()}}),e)}))),aJ.apply(this,arguments)}function sJ(e,t,r,n){return cJ.apply(this,arguments)}function cJ(){return cJ=y(G.mark((function e(t,r,n,i){var o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=gN("ACCOUNT_REGISTER").slice(0,gN("AJAX_REQUEST_CONCURRENT")),a=[],a=r.proxyServer?o.map((function(e){return"https://".concat(r.proxyServer,"/ap/?url=").concat(e+"/api/v1")})):o.map((function(e){return"https://".concat(e,"/api/v1")})),e.next=5,function(){var e=y(G.mark((function e(t,r,n,i,o){var a,s,c,u,d;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=Date.now(),s={sid:n.sid,opid:10,appid:n.appId,string_uid:r},c=t[0],e.next=4,wD((function(){return Uj(c+"".concat(-1===c.indexOf("?")?"?":"&","action=stringuid"),{data:s,cancelToken:i,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":72}})}),(function(e,n){if(0===e.code){if(e.uid<=0||e.uid>=Math.pow(2,32))throw ND.error("Invalid Uint Uid ".concat(r," => ").concat(e.uid),e),ZD("error",["AjaxAPI"],"requestUserAccount","Invalid Uint Uid ".concat(r," => ").concat(e.uid,", ").concat(e)),zj.reqUserAccount(s.sid,{lts:a,success:!1,serverAddr:c,stringUid:s.string_uid,uid:e.uid,errorCode:mD.INVALID_UINT_UID_FROM_STRING_UID,extend:s}),new SD(mD.INVALID_UINT_UID_FROM_STRING_UID);return zj.reqUserAccount(s.sid,{lts:a,success:!0,serverAddr:c,stringUid:s.string_uid,uid:e.uid,errorCode:null,extend:s}),!1}var i=dq(e.code);return i.retry&&(c=t[(n+1)%t.length]),zj.reqUserAccount(s.sid,{lts:a,success:!1,serverAddr:c,stringUid:s.string_uid,uid:e.uid,errorCode:i.desc,extend:s}),i.retry}),(function(e,r){return e.code!==mD.OPERATION_ABORTED&&(zj.reqUserAccount(s.sid,{lts:a,success:!1,serverAddr:c,stringUid:s.string_uid,uid:null,errorCode:e.code,extend:s}),c=t[(r+1)%t.length],!0)}),o);case 4:if(0===(u=e.sent).code){e.next=8;break}throw d=dq(u.code),new SD(mD.UNEXPECTED_RESPONSE,d.desc);case 8:return e.abrupt("return",u);case 9:case"end":return e.stop()}}),e)})));return function(t,r,n,i,o){return e.apply(this,arguments)}}()(a,t,r,n,i);case 5:return e.abrupt("return",e.sent.uid);case 6:case"end":return e.stop()}}),e)}))),cJ.apply(this,arguments)}function uJ(e,t,r){return dJ.apply(this,arguments)}function dJ(){return dJ=y(G.mark((function e(t,r,n){var i,o,a,s,c,u,d,l,p,f;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=Date.now(),o=t.cloudProxyServer,a=gN("normal"===o?"PROXY_CS":"WEBCS_DOMAIN").map((function(e){return t.proxyServer?"https://".concat(t.proxyServer,"/ap/?url=").concat(e+"/api/v1"):"https://".concat(e,"/api/v1")})),!["proxy3","proxy4","proxy5"].includes(o)){e.next=12;break}return s=a.map((function(e){return{url:e,areaCode:Xq()}})),c=null,e.next=7,vK({fragementLength:gN("FRAGEMENT_LENGTH"),referenceList:s,asyncMapHandler:function(e){return function(e,t,r,n){var i=e.url,o=e.areaCode,a=Date.now(),s={opid:133,flag:"proxy5"===t.cloudProxyServer?4194304:1048576,ts:+new Date,key:t.token,cname:t.cname,sid:t.sid,detail:{6:t.stringUid,11:o},uid:t.uid||0};return wD(y(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Uj(i,{data:s,cancelToken:r,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":69}});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),(function(e){if(0===e.code)return zj.joinWebProxyAP(t.sid,{lts:a,sucess:1,apServerAddr:i,turnServerAddrList:e.addresses.map((function(e){return e.ip})).join(","),errorCode:null,eventType:t.cloudProxyServer}),!1;var r=dq(e.code);throw new SD(mD.CAN_NOT_GET_GATEWAY_SERVER,r.desc,{retry:r.retry})}),(function(e){return e.code!==mD.OPERATION_ABORTED&&(e.code===mD.CAN_NOT_GET_GATEWAY_SERVER?(zj.joinWebProxyAP(s.sid,{lts:a,sucess:0,apServerAddr:i,turnServerAddrList:null,errorCode:e.code,eventType:t.cloudProxyServer}),ND.warning("[".concat(t.clientId,"] proxy ap server ").concat(i," failed, message: ").concat(e.message,", retry: ").concat(e.data.retry)),qD("warning",["AjaxAPI",t.clientId],"proxy ap server ".concat(i," failed, message: ").concat(e.message,", retry: ").concat(e.data.retry)),e.data.retry):(zj.joinWebProxyAP(s.sid,{lts:a,sucess:0,apServerAddr:i,turnServerAddrList:null,errorCode:e.code,eventType:t.cloudProxyServer}),!0))}),n)}(e,t,r,n)},allFailedhandler:function(){throw ND.error("[".concat(t.clientId,"] can not get proxy server after trying several times")),new SD(mD.CAN_NOT_GET_PROXY_SERVER)}});case 7:if(c=e.sent,(u=c.addresses)&&0!==u.length){e.next=11;break}throw ND.error("[".concat(t.clientId,"] can not get proxy server, empty proxy server list")),new SD(mD.CAN_NOT_GET_PROXY_SERVER,"empty proxy server list");case 11:return e.abrupt("return",{addresses:u.map((function(e){return e.ip})).map(LG),serverResponse:{tcpport:u[0].port||443,udpport:u[0].port||sN.udpport,username:sN.username,password:sN.password}});case 12:return d=null,e.next=15,vK({fragementLength:gN("FRAGEMENT_LENGTH"),referenceList:a,asyncMapHandler:function(e){return function(e,t,r,n){var i=Date.now(),o={command:"convergeAllocateEdge",sid:t.sid,appId:t.appId,token:t.token,uid:t.uid,cname:t.cname,ts:Math.floor(Date.now()/1e3),version:oN,seq:0,requestId:1};return wD(y(G.mark((function t(){return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Uj(e,{data:{service_name:"webrtc_proxy",json_body:JSON.stringify(o)},cancelToken:r,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":61}});case 2:return t.t0=t.sent,t.t1=e,t.abrupt("return",{res:t.t0,url:t.t1});case 5:case"end":return t.stop()}}),t)}))),(function(e){if(!e.res.json_body)throw ND.debug("[".concat(t.clientId,"] Get proxy server failed: no json_body")),ZD("error",["AjaxAPI",t.clientId],"requestProxyServerList","Get proxy server failed: no json_body"),new SD(mD.UNEXPECTED_RESPONSE,JSON.stringify(e.res));var r=JSON.parse(e.res.json_body);if(200!==r.code)throw ND.debug("[".concat(t.clientId,"] Get proxy server failed: response code [").concat(r.code,"], reason [").concat(r.reason,"]")),ZD("error",["AjaxAPI",t.clientId],"requestProxyServerList","Get proxy server failed: response code [".concat(r.code,"], reason [").concat(r.reason,"]")),new SD(mD.UNEXPECTED_RESPONSE,JSON.stringify(e.res));return ND.debug("[".concat(t.clientId,"] App return server length"),r.servers.length),ZD("debug",["AjaxAPI",t.clientId],"requestProxyServerList","",{length:r.servers.length}),!1}),(function(t){return t.code!==mD.OPERATION_ABORTED&&(zj.requestProxyAppCenter(o.sid,{lts:i,succ:!1,APAddr:e,workerManagerList:null,ec:t.code,response:t.message}),!0)}),n)}(e,t,r,n)},allFailedhandler:function(){throw ND.error("[".concat(t.clientId,"] can not get proxy server after trying several times")),new SD(mD.CAN_NOT_GET_PROXY_SERVER)}});case 15:if(d=e.sent,l=JSON.parse(d.res.json_body).servers.map(PG),"443only"!==t.cloudProxyServer){e.next=19;break}return e.abrupt("return",{addresses:l,serverResponse:{tcpport:443,udpport:sN.udpport,username:sN.username,password:sN.password}});case 19:return zj.requestProxyAppCenter(t.sid,{lts:i,succ:!0,APAddr:d.url,workerManagerList:JSON.stringify(l),ec:null,response:JSON.stringify(d.res)}),i=Date.now(),p=l.map((function(e){return function(e,t,r,n){var i=Date.now(),o=e;e.startsWith("http")||(o="https://".concat(e,":4000/v2/machine"));var a={command:"request",gatewayType:"http",appId:t.appId,cname:t.cname,uid:(t.uid||"").toString(),sdkVersion:"2.3.1",sid:t.sid,seq:1,ts:Date.now(),requestId:3,clientRequest:{appId:t.appId,cname:t.cname,uid:(t.uid||"").toString(),sid:t.sid}};return wD(y(G.mark((function t(){return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Uj(o,{data:a,cancelToken:r});case 2:return t.t0=t.sent,t.t1=e,t.abrupt("return",{res:t.t0,url:t.t1});case 5:case"end":return t.stop()}}),t)}))),(function(e){if(!e.res.serverResponse)throw new SD(mD.UNEXPECTED_RESPONSE,"requeet worker manager server failed: serverResponse is undefined");return!1}),(function(t){return t.code!==mD.OPERATION_ABORTED&&(zj.requestProxyWorkerManager(a.sid,{lts:i,succ:!1,workerManagerAddr:e,ec:t.code,response:t.message}),!0)}),n)}(e,t,r,n)})),f=null,e.prev=22,e.next=25,tK(p);case 25:f=e.sent,e.next=31;break;case 28:throw e.prev=28,e.t0=e.catch(22),ND.error("[".concat(t.clientId,"] can not get worker manager after trying several times")),new SD(mD.CAN_NOT_GET_PROXY_SERVER);case 31:return e.abrupt("return",(p.forEach((function(e){return e.cancel()})),zj.requestProxyWorkerManager(t.sid,{lts:i,succ:!0,workerManagerAddr:f.url,ec:null,response:JSON.stringify(f.res)}),{addresses:[f.url],serverResponse:f.res.serverResponse}));case 32:case"end":return e.stop()}}),e,null,[[22,28]])}))),dJ.apply(this,arguments)}function lJ(e,t,r){return pJ.apply(this,arguments)}function pJ(){return pJ=y(G.mark((function e(t,r,n){var i,o,a,s;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=gN("CDS_AP").slice(0,gN("AJAX_REQUEST_CONCURRENT")).map((function(e){return t.proxyServer?"https://".concat(t.proxyServer,"/ap/?url=").concat(e+"/api/v1"):"https://".concat(e,"/api/v1?action=config")})).map((function(e){return function(e,t,r,n){var i=Tk(),o={flag:64,cipher_method:0,features:{device:i.name,system:i.os,system_general:navigator.userAgent,vendor:t.appId,version:oN,cname:t.cname,sid:t.sid,session_id:t.sid,detail:"",proxyServer:t.proxyServer}};return wD((function(){return Uj(e,{data:o,timeout:1e3,cancelToken:r,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":54}})}),void 0,(function(e){return e.code!==mD.OPERATION_ABORTED}),n)}(e,t,r,n)})),o=null,a=null,s={},e.prev=2,e.next=5,tK(i);case 5:o=e.sent,e.next=13;break;case 8:if(e.prev=8,e.t0=e.catch(2),e.t0.code!==mD.OPERATION_ABORTED){e.next=12;break}throw e.t0;case 12:a=e.t0;case 13:if(i.forEach((function(e){return e.cancel()})),zj.reportApiInvoke(t.sid,{name:Ux.REQUEST_CONFIG_DISTRIBUTE,options:{error:a,res:o}}).onSuccess(),o&&o.test_tags)try{s=function(e){if(!e.test_tags)return{};var t=e.test_tags,r=Object.keys(t),n={};return r.forEach((function(e){var r,i=pk(r=e.slice(4)).call(r),o=JSON.parse(t[e])[1];n[i]=o})),n}(o)}catch(e){}return e.abrupt("return",s);case 16:case"end":return e.stop()}}),e,null,[[2,8]])}))),pJ.apply(this,arguments)}function fJ(e,t,r){return hJ.apply(this,arguments)}function hJ(){return hJ=y(G.mark((function e(t,r,n){var i,o,a,s,c,u,d,l,p,f,h,A;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=gN("PROXY_SERVER_TYPE3"),o=function(e,t){var r=i;return Array.isArray(r)&&(r=t%2==0?i[1]:i[0]),"https://".concat(r,"/ap/?url=").concat(e)},a=gN("WEBCS_DOMAIN").slice(0,gN("AJAX_REQUEST_CONCURRENT")).map((function(e,r){return{url:"disabled"===t.cloudProxyServer||"fallback"===t.cloudProxyServer?"https://".concat(e,"/api/v2/transpond/webrtc?v=2"):o("".concat(e,"/api/v2/transpond/webrtc?v=2"),r),areaCode:Xq(),serviceIds:[iF.CHOOSE_SERVER,"proxy5"===t.cloudProxyServer?iF.CLOUD_PROXY_5:"proxy3"===t.cloudProxyServer||"proxy4"===t.cloudProxyServer?iF.CLOUD_PROXY:iF.CLOUD_PROXY_FALLBACK]}})),s=null,c=[],u=function(){var e=y(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,vK({fragementLength:gN("FRAGEMENT_LENGTH"),referenceList:a,asyncMapHandler:function(e){return ND.debug("[".concat(t.clientId,"] Connect to choose_server:"),e.url),Kq(e,t,r,n)},allFailedhandler:function(e){throw e[0]},promisesCollector:c});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),d=function(){var e=y(G.mark((function e(){var i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,JG(1e3);case 2:if(null===s){e.next=4;break}return e.abrupt("return",s);case 4:return i=gN("WEBCS_DOMAIN_BACKUP_LIST").map((function(e,r){return{url:"disabled"===t.cloudProxyServer||"fallback"===t.cloudProxyServer?"https://".concat(e,"/api/v2/transpond/webrtc?v=2"):o("".concat(e,"/api/v2/transpond/webrtc?v=2"),r),areaCode:Xq(),serviceIds:[iF.CHOOSE_SERVER,"proxy5"===t.cloudProxyServer?iF.CLOUD_PROXY_5:"proxy3"===t.cloudProxyServer||"proxy4"===t.cloudProxyServer?iF.CLOUD_PROXY:iF.CLOUD_PROXY_FALLBACK]}})),e.next=7,vK({fragementLength:gN("FRAGEMENT_LENGTH"),referenceList:i,asyncMapHandler:function(e){return ND.debug("[".concat(t.clientId,"] Connect to backup choose_server:"),e.url),Kq(e,t,r,n)},allFailedhandler:function(e){throw e[0]},promisesCollector:c});case 7:return e.abrupt("return",e.sent);case 8:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),e.prev=3,e.next=6,tK([u(),d()]);case 6:h=e.sent,l=h.gatewayInfo,p=h.proxyInfo,f=h.url,e.next=15;break;case 12:throw e.prev=12,e.t0=e.catch(3),e.t0[0];case 15:if(c.length&&c.forEach((function(e){return e.cancel&&"function"==typeof e.cancel&&e.cancel()})),l&&p){e.next=17;break}throw new SD(mD.UNEXPECTED_ERROR,"missing gateway or proxy response").print();case 17:return t.apUrl=f,"disabled"!==t.cloudProxyServer&&Array.isArray(i)&&f&&(A=new cq(f).host,i.includes(A)&&(t.proxyServer=A,ND.setProxyServer(A),zj.setProxyServer(A),YD(A))),e.t1=l,e.next=21,VG(p,l.uid);case 21:return e.t2=e.sent,s={gatewayInfo:e.t1,proxyInfo:e.t2},e.abrupt("return",s);case 24:case"end":return e.stop()}}),e,null,[[3,12]])}))),hJ.apply(this,arguments)}function AJ(e,t,r,n){return vJ.apply(this,arguments)}function vJ(){return vJ=y(G.mark((function e(t,r,n,i){var o;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=gN("UAP_AP").slice(0,gN("AJAX_REQUEST_CONCURRENT")).map((function(e){return r.proxyServer?"https://".concat(r.proxyServer,"/ap/?url=").concat(e+"/api/v1?action=uap"):"https://".concat(e,"/api/v1?action=uap")})),e.next=3,jq(o,t,r,n,i);case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)}))),vJ.apply(this,arguments)}function gJ(e,t,r){return mJ.apply(this,arguments)}function mJ(){return mJ=y(G.mark((function e(t,r,n){var i,o;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=gN("UAP_AP").slice(0,gN("AJAX_REQUEST_CONCURRENT")).map((function(e){return t.proxyServer?"https://".concat(t.proxyServer,"/ap/?url=").concat(e+"/api/v1?action=uap"):"https://".concat(e,"/api/v1?action=uap")})).map((function(e){return function(e,t,r,n){var i={command:"convergeAllocateEdge",sid:t.sid,appId:t.appId,token:t.token,ts:Date.now(),version:oN,cname:t.cname,uid:t.uid.toString(),requestId:Vq,seq:Vq};Vq+=1;var o={service_name:"tele_channel",json_body:JSON.stringify(i)};return wD(y(G.mark((function t(){var n,i,a,s,c;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Uj(e,{data:o,cancelToken:r,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":61}});case 2:if(0===(n=t.sent).code){t.next=6;break}throw i=new SD(mD.UNEXPECTED_RESPONSE,"cross channel ap error, code"+n.code,{retry:!0}),ND.error(i.toString()),ZD("error",["AjaxAPI"],"requestChannelMediaRelayWorkerManager",void 0,i.toString()),i;case 6:if(200===(a=JSON.parse(n.json_body)).code){t.next=10;break}throw s=new SD(mD.UNEXPECTED_RESPONSE,"cross channel app center error, code: ".concat(a.code,", reason: ").concat(a.reason)),ND.error(s.toString()),ZD("error",["AjaxAPI"],"requestChannelMediaRelayWorkerManager",void 0,s.toString()),s;case 10:if(a.servers&&0!==a.servers.length){t.next=13;break}throw c=new SD(mD.UNEXPECTED_RESPONSE,"cross channel app center empty server"),ND.error(c.toString()),ZD("error",["AjaxAPI"],"requestChannelMediaRelayWorkerManager",void 0,c.toString()),c;case 13:return t.abrupt("return",{vid:a.vid,workerToken:a.workerToken,addressList:a.servers.map((function(e){return"wss://".concat(e.address.replace(/\./g,"-"),".").concat(gN("WORKER_DOMAIN"),":").concat(e.wss)}))});case 14:case"end":return t.stop()}}),t)}))),void 0,(function(e){return!!(e.code!==mD.OPERATION_ABORTED&&e.code!==mD.UNEXPECTED_RESPONSE||e.data&&e.data.retry)}),n)}(e,t,r,n)})),e.prev=1,e.next=4,tK(i);case 4:return o=e.sent,e.abrupt("return",(i.forEach((function(e){return e.cancel()})),o));case 8:throw e.prev=8,e.t0=e.catch(1),e.t0[0];case 11:case"end":return e.stop()}}),e,null,[[1,8]])}))),mJ.apply(this,arguments)}function EJ(e,t,r){return _J.apply(this,arguments)}function _J(){return _J=y(G.mark((function e(t,r,n){var i,o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null,o=[],a=function(){var e=y(G.mark((function e(a){var s;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=gN(a?"WEBCS_DOMAIN_BACKUP_LIST":"WEBCS_DOMAIN").map((function(e){return t.proxyServer?"https://".concat(t.proxyServer,"/ap/?url=").concat(e+"/api/v2/transpond/webrtc?v=2"):"https://".concat(e,"/api/v2/transpond/webrtc?v=2")})),e.t0=a,!e.t0){e.next=6;break}return e.next=5,JG(1e3);case 5:e.t0=null!==i;case 6:if(!e.t0){e.next=10;break}e.t1=i,e.next=13;break;case 10:return e.next=12,vK({fragementLength:gN("FRAGEMENT_LENGTH"),referenceList:s,asyncMapHandler:function(e){return ND.debug("[".concat(t.clientId,"] update ticket, Connect to ").concat(a?"backup":""," choose_server:"),e),function(e,t,r,n){var i=zq(t,[iF.CHOOSE_SERVER]),o=E(i,1)[0],a=Vj.networkState;return wD(y(G.mark((function t(){var i;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=a&&Vj.networkState===XP.OFFLINE&&Vj.onlineWaiter,!t.t0){t.next=4;break}return t.next=4,Rb.race([Vj.onlineWaiter,JG(n&&n.maxRetryTimeout||bD.maxRetryTimeout)]);case 4:return a=Vj.networkState,t.next=7,Uj(e,{data:o,cancelToken:r,headers:{"Content-Type":"multipart/form-data;"}},!0);case 7:return i=t.sent,t.abrupt("return",qq(i,e));case 9:case"end":return t.stop()}}),t)}))),(function(){return!1}),(function(e){return e.code!==mD.OPERATION_ABORTED&&(e.code===mD.UPDATE_TICKET_FAILED?e.data.retry:(ND.warning("[".concat(t.clientId,"] update ticket network error, retry"),e),qD("warning",["AjaxAPI",t.clientId],"update ticket network error, retry, ".concat(e)),!0))}),n)}(e,t,r,n)},allFailedhandler:function(e){throw e[0]},promisesCollector:o});case 12:e.t1=e.sent;case 13:return e.abrupt("return",e.t1);case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),e.prev=2,e.next=5,tK([a(!1),a(!0)]);case 5:return i=e.sent,o.length&&o.forEach((function(e){return e.cancel&&"function"==typeof e.cancel&&e.cancel()})),e.abrupt("return",i);case 10:throw e.prev=10,e.t0=e.catch(2),e.t0[0];case 13:case"end":return e.stop()}}),e,null,[[2,10]])}))),_J.apply(this,arguments)}function yJ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function IJ(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?yJ(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yJ(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var SJ=tN("ConfigDistributeManager")(Hq=function(e){k(r,e);var t=W(r);function r(){var e;return U(this,r),e=t.call(this),rO(S(e),"configs",void 0),rO(S(e),"joinInfo",void 0),rO(S(e),"cancelToken",void 0),rO(S(e),"retryConfig",{timeout:3e3,timeoutFactor:1.5,maxRetryCount:1,maxRetryTimeout:1e4}),rO(S(e),"interval",void 0),rO(S(e),"mutex",new rV("config-distribute")),rO(S(e),"mutableParamsRead",!1),e}return F(r,[{key:"startGetConfigDistribute",value:function(e,t){var r=this;this.joinInfo=e,this.cancelToken=t,this.interval&&this.stopGetConfigDistribute(),this.updateConfigDistribute(),this.interval=window.setInterval((function(){r.updateConfigDistribute()}),gN("CONFIG_DISTRIBUTE_INTERVAL"))}},{key:"stopGetConfigDistribute",value:function(){this.interval&&clearInterval(this.interval),this.interval=void 0,this.joinInfo=void 0,this.cancelToken=void 0}},{key:"awaitConfigDistributeComplete",value:function(){var e=y(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mutex.isLocked){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this.mutex.lock();case 4:e.t0=e.sent,(0,e.t0)();case 6:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"updateConfigDistribute",value:function(){var e=y(G.mark((function e(){var t,r,n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.mutableParamsRead||(this.mutableParamsRead=!0,zj.reportApiInvoke(null,{options:void 0,name:Ux.LOAD_CONFIG_FROM_LOCALSTORAGE,tag:Qx.TRACER}).onSuccess(JSON.stringify(EN))),this.joinInfo&&this.cancelToken&&this.retryConfig){e.next=3;break}return e.abrupt("return",(ND.debug("[config-distribute] get config distribute interrupted have no joininfo"),void ZD("debug",this,"updateConfigDistribute",void 0,"get config distribute interrupted have no joininfo")));case 3:return e.next=5,this.mutex.lock();case 5:return r=e.sent,e.prev=6,e.next=9,lJ(this.joinInfo,this.cancelToken,this.retryConfig);case 9:t=e.sent,ND.debug("[config-distribute] get config distribute",JSON.stringify(t)),ZD("debug",this,"updateConfigDistribute",t),t.limit_bitrate&&this.handleBitrateLimit(t.limit_bitrate),this.cacheGlobalParameterConfig(t),this.configs=t,e.next=21;break;case 17:e.prev=17,e.t0=e.catch(6),n=new SD(mD.NETWORK_RESPONSE_ERROR,e.t0),ND.warning("[config-distribute] ".concat(n.toString())),ZD("warning",this,"updateConfigDistribute",void 0,e.t0.toString());case 21:return e.prev=21,r(),e.finish(21);case 24:case"end":return e.stop()}}),e,this,[[6,17,21,24]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"getBitrateLimit",value:function(){return this.configs?this.configs.limit_bitrate:void 0}},{key:"handleBitrateLimit",value:function(e){var t;(t=e)&&t.uplink&&t.id&&void 0!==t.uplink.max_bitrate&&void 0!==t.uplink.min_bitrate&&(this.configs&&this.configs.limit_bitrate?this.configs&&this.configs.limit_bitrate&&this.configs.limit_bitrate.id!==e.id&&this.emit(HP.UPDATE_BITRATE_LIMIT,e):this.emit(HP.UPDATE_BITRATE_LIMIT,e))}},{key:"getLowStreamConfigDistribute",value:function(){return this.configs&&this.configs.limit_bitrate&&IJ({},this.configs.limit_bitrate.low_stream_uplink)}},{key:"cacheGlobalParameterConfig",value:function(e){for(var t,r=yx(t=Object.keys(e).filter((function(e){return/^webrtc_ng_global_parameter/.test(e)}))).call(t),n=0;n<r.length;n++)for(var i=r.length-1;i>n;i--){var o=r[i];if("number"==typeof e[o].__priority){var a=e[o].__priority,s=r[i-1];if("number"==typeof e[s].__priority){if(!(a>e[s].__priority))continue;var c=o;r[i]=r[i-1],r[i-1]=c}else{var u=o;r[i]=r[i-1],r[i-1]=u}}}var d={};r.forEach((function(t){var r=e[t],n=r.__expires;Object.keys(r).forEach((function(e){"__priority"===e||"__expires"===e||Object.prototype.hasOwnProperty.call(d,e)||(d[e]=IJ({value:r[e]},n&&{expires:n}))}))}));try{var l=JSON.stringify(d),p=window.btoa(l);window.localStorage.setItem("websdk_ng_global_parameter",p),ND.debug("Caching global parameters ".concat(l)),ZD("debug",this,"cacheGlobalParameterConfig",l)}catch(e){ND.error("Error caching global parameters:",e.message),ZD("error",this,"cacheGlobalParameterConfig",void 0,e.message)}}}]),r}(yD))||Hq;function bJ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function CJ(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?bJ(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bJ(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var wJ=function(e){k(r,e);var t=W(r);function r(e,n,i,o){var a;return U(this,r),a=t.call(this),rO(S(a),"spec",void 0),rO(S(a),"token",void 0),rO(S(a),"websocket",void 0),rO(S(a),"pingpongTimer",void 0),rO(S(a),"reconnectMode","retry"),rO(S(a),"serviceMode",void 0),rO(S(a),"reqId",0),rO(S(a),"commandReqId",0),rO(S(a),"handleWebSocketOpen",(function(){a.reconnectMode="retry",a.startPingPong()})),rO(S(a),"handleWebSocketMessage",(function(e){if(e.data){var t=JSON.parse(e.data);t.requestId?a.emit("@".concat(t.requestId,"-").concat(t.sid),t):a.serviceMode===lP.INJECT?a.emit(yP.INJECT_STREAM_STATUS,t):(zj.workerEvent(a.spec.sid,{actionType:"status",serverCode:t.code,workerType:a.serviceMode===lP.TRANSCODE?1:2}),a.emit(yP.PUBLISH_STREAM_STATUS,t))}})),a.spec=n,a.token=e,a.serviceMode=o,a.websocket=new Dq("live-streaming",i),a.websocket.on(dP.CONNECTED,a.handleWebSocketOpen),a.websocket.on(dP.ON_MESSAGE,a.handleWebSocketMessage),a.websocket.on(dP.REQUEST_NEW_URLS,(function(e,t){rK(S(a),yP.REQUEST_NEW_ADDRESS).then(e).catch(t)})),a.websocket.on(dP.RECONNECTING,(function(){a.websocket.reconnectMode=a.reconnectMode})),a}return F(r,[{key:"init",value:function(e){return this.websocket.init(e)}},{key:"request",value:function(){var e=y(G.mark((function e(t,r,n,i){var o,a,s,c,u,d,l,p=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.reqId+=1,"request"===t&&(this.commandReqId+=1),o=this.commandReqId,(a=this.reqId)&&this.websocket){e.next=4;break}throw new SD(mD.UNEXPECTED_ERROR);case 4:if(s=CJ({command:t,sdkVersion:"4.11.0"===oN?"0.0.1":oN,seq:a,requestId:a,allocate:n,cname:this.spec.cname,appId:this.spec.appId,sid:this.spec.sid,uid:this.spec.uid.toString(),ts:Math.floor(Date.now()/1e3)},r),"closed"!==this.websocket.state){e.next=7;break}throw new SD(mD.WS_DISCONNECT);case 7:if(c=function(){return new Rb((function(e,t){p.websocket.once(dP.CLOSED,(function(){return t(new SD(mD.WS_ABORT))})),p.websocket.once(dP.CONNECTED,e)}))},e.t0="connected"!==this.websocket.state,!e.t0){e.next=12;break}return e.next=12,c();case 12:return s.clientRequest&&(s.clientRequest.workerToken=this.token),u=new Rb((function(e,t){var r=function(){t(new SD(mD.WS_ABORT))};p.websocket.once(dP.RECONNECTING,r),p.websocket.once(dP.CLOSED,r),p.once("@".concat(a,"-").concat(p.spec.sid),(function(t){e(t)}))})),i&&zj.workerEvent(this.spec.sid,CJ(CJ({},i),{},{requestId:o,actionType:"request",payload:JSON.stringify(r.clientRequest),serverCode:0,code:0})),d=Date.now(),this.websocket.sendMessage(s),l=null,e.prev=18,e.next=21,u;case 21:l=e.sent,e.next=33;break;case 24:if(e.prev=24,e.t1=e.catch(18),"closed"!==this.websocket.state){e.next=28;break}throw e.t1;case 28:return e.next=30,c();case 30:return e.next=32,this.request(t,r,n);case 32:return e.abrupt("return",e.sent);case 33:return e.abrupt("return",(i&&zj.workerEvent(this.spec.sid,CJ(CJ({},i),{},{requestId:o,actionType:"response",payload:JSON.stringify(l.serverResponse),serverCode:l.code,success:200===l.code,responseTime:Date.now()-d})),200!==l.code&&this.handleResponseError(l),l));case 34:case"end":return e.stop()}}),e,this,[[18,24]])})));function t(t,r,n,i){return e.apply(this,arguments)}return t}()},{key:"tryNextAddress",value:function(){this.reconnectMode="tryNext",this.websocket.reconnect("tryNext")}},{key:"close",value:function(){var e="4.11.0"===oN?"0.0.1":oN;this.reqId+=1,"connected"===this.websocket.state?(this.websocket.sendMessage({command:"request",appId:this.spec.appId,cname:this.spec.cname,uid:this.spec.uid.toString(),sdkVersion:e,sid:this.spec.sid,seq:this.reqId,ts:Math.floor(Date.now()/1e3),requestId:this.reqId,clientRequest:{command:"DestroyWorker"}}),this.websocket.close(!1,!0)):this.websocket.close(!1),this.pingpongTimer&&(window.clearInterval(this.pingpongTimer),this.pingpongTimer=void 0)}},{key:"handleResponseError",value:function(e){switch(e.code){case SP.LIVE_STREAM_RESPONSE_ALREADY_EXISTS_STREAM:return void ND.warning("live stream response already exists stream");case SP.LIVE_STREAM_RESPONSE_TRANSCODING_PARAMETER_ERROR:case SP.LIVE_STREAM_RESPONSE_BAD_STREAM:case SP.LIVE_STREAM_RESPONSE_WM_PARAMETER_ERROR:return new SD(mD.LIVE_STREAMING_INVALID_ARGUMENT,"",{code:e.code}).throw();case SP.LIVE_STREAM_RESPONSE_WM_WORKER_NOT_EXIST:if("UnpublishStream"===e.serverResponse.command||"UninjectStream"===e.serverResponse.command)return;throw new SD(mD.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"live stream response wm worker not exist",{retry:!0});case SP.LIVE_STREAM_RESPONSE_NOT_AUTHORIZED:return new SD(mD.LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED,"",{code:e.code}).throw();case SP.LIVE_STREAM_RESPONSE_FAILED_LOAD_IMAGE:var t=new SD(mD.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE);return this.emit(yP.WARNING,t,e.serverResponse.url);case SP.LIVE_STREAM_RESPONSE_REQUEST_TOO_OFTEN:var r=new SD(mD.LIVE_STREAMING_WARN_FREQUENT_REQUEST);return this.emit(yP.WARNING,r,e.serverResponse.url);case SP.LIVE_STREAM_RESPONSE_NOT_FOUND_PUBLISH:throw new SD(mD.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"live stream response wm worker not exist",{retry:!0});case SP.LIVE_STREAM_RESPONSE_NOT_SUPPORTED:return new SD(mD.LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED,"",{code:e.code}).throw();case SP.LIVE_STREAM_RESPONSE_MAX_STREAM_NUM:var n=new SD(mD.LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT);return this.emit(yP.WARNING,n,e.serverResponse.url);case SP.LIVE_STREAM_RESPONSE_INTERNAL_SERVER_ERROR:return new SD(mD.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"",{code:e.code}).throw();case SP.LIVE_STREAM_RESPONSE_RESOURCE_LIMIT:throw new SD(mD.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"live stream resource limit",{retry:!0,changeAddress:!0});case SP.LIVE_STREAM_RESPONSE_WORKER_LOST:case SP.LIVE_STREAM_RESPONSE_WORKER_QUIT:if("UnpublishStream"===e.serverResponse.command||"UninjectStream"===e.serverResponse.command)return;throw new SD(mD.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"error fail send message",{retry:!0,changeAddress:!0});case SP.ERROR_FAIL_SEND_MESSAGE:if("UnpublishStream"===e.serverResponse.command||"UninjectStream"===e.serverResponse.command)return;if("UpdateTranscoding"===e.serverResponse.command||"ControlStream"===e.serverResponse.command)return new SD(mD.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"error fail send message",{code:e.code}).throw();throw new SD(mD.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"error fail send message",{retry:!0,changeAddress:!0});case SP.PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN:case SP.PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT:case SP.PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE:case SP.PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH:return new SD(mD.LIVE_STREAMING_CDN_ERROR,"",{code:e.code}).throw()}}},{key:"startPingPong",value:function(){var e=this;this.pingpongTimer&&window.clearInterval(this.pingpongTimer),this.pingpongTimer=window.setInterval((function(){"connected"===e.websocket.state&&e.request("ping",{}).catch($G)}),6e3)}}]),r}(yD);function RJ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function TJ(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?RJ(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):RJ(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var kJ=function(e){k(r,e);var t=W(r);function r(e){var n;U(this,r);var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bD,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:bD;return n=t.call(this),rO(S(n),"onLiveStreamWarning",void 0),rO(S(n),"onLiveStreamError",void 0),rO(S(n),"onInjectStatusChange",void 0),rO(S(n),"spec",void 0),rO(S(n),"retryTimeout",1e4),rO(S(n),"connection",void 0),rO(S(n),"httpRetryConfig",void 0),rO(S(n),"wsRetryConfig",void 0),rO(S(n),"streamingTasks",new Map),rO(S(n),"isStartingStreamingTask",!1),rO(S(n),"taskMutex",new rV("live-streaming")),rO(S(n),"cancelToken",ED.CancelToken.source()),rO(S(n),"transcodingConfig",void 0),rO(S(n),"injectConfig",TJ({},FP)),rO(S(n),"injectLoopTimes",0),rO(S(n),"uapResponse",void 0),rO(S(n),"lastTaskId",1),rO(S(n),"statusError",new Map),n.spec=e,n.httpRetryConfig=o,n.wsRetryConfig=i,n}return F(r,[{key:"setTranscodingConfig",value:function(){var e=y(G.mark((function e(t){var r,n,i,o,a,s=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return 66!==(r=TJ(TJ({},QP),t)).videoCodecProfile&&77!==r.videoCodecProfile&&100!==r.videoCodecProfile&&(ND.debug("[".concat(this.spec.clientId,"] set transcoding config, fix video codec profile: ").concat(r.videoCodecProfile," -> 100")),r.videoCodecProfile=100),r.transcodingUsers||(r.transcodingUsers=r.userConfigs),r.transcodingUsers&&(r.transcodingUsers=r.transcodingUsers.map((function(e){return TJ(TJ(TJ({},mP),e),{},{zOrder:e.zOrder?e.zOrder+1:1})}))),function(e){kx(e.width)||bx(e.width,"config.width",0,1e4),kx(e.height)||bx(e.height,"config.height",0,1e4),kx(e.videoBitrate)||bx(e.videoBitrate,"config.videoBitrate",1,1e6),kx(e.videoFrameRate)||bx(e.videoFrameRate,"config.videoFrameRate"),kx(e.lowLatency)||Ix(e.lowLatency,"config.lowLatency"),kx(e.audioSampleRate)||Sx(e.audioSampleRate,"config.audioSampleRate",[32e3,44100,48e3]),kx(e.audioBitrate)||bx(e.audioBitrate,"config.audioBitrate",1,128),kx(e.audioChannels)||Sx(e.audioChannels,"config.audioChannels",[1,2,3,4,5]),kx(e.videoGop)||bx(e.videoGop,"config.videoGop"),kx(e.videoCodecProfile)||Sx(e.videoCodecProfile,"config.videoCodecProfile",[66,77,100]),kx(e.userCount)||bx(e.userCount,"config.userCount",0,17),kx(e.backgroundColor)||bx(e.backgroundColor,"config.backgroundColor",0,16777215),kx(e.userConfigExtraInfo)||Cx(e.userConfigExtraInfo,"config.userConfigExtraInfo",0,4096,!1),e.transcodingUsers&&!kx(e.transcodingUsers)&&(wx(e.transcodingUsers,"config.transcodingUsers"),e.transcodingUsers.forEach((function(e,t){Tx(e.uid),kx(e.x)||bx(e.x,"transcodingUser[".concat(t,"].x"),0,1e4),kx(e.y)||bx(e.y,"transcodingUser[".concat(t,"].y"),0,1e4),kx(e.width)||bx(e.width,"transcodingUser[".concat(t,"].width"),0,1e4),kx(e.height)||bx(e.height,"transcodingUser[".concat(t,"].height"),0,1e4),kx(e.zOrder)||bx(e.zOrder-1,"transcodingUser[".concat(t,"].zOrder"),0,100),kx(e.alpha)||bx(e.alpha,"transcodingUser[".concat(t,"].alpha"),0,1,!1)}))),kx(e.watermark)||_P(e.watermark,"watermark"),kx(e.backgroundImage)||_P(e.backgroundImage,"backgroundImage"),e.images&&!kx(e.images)&&(wx(e.images,"config.images"),e.images.forEach((function(e,t){_P(e,"images[".concat(t,"]"))})))}(r),n=[],r.images&&n.push.apply(n,M(r.images.map((function(e){return TJ(TJ(TJ({},EP),e),{},{zOrder:255})})))),r.backgroundImage&&(n.push(TJ(TJ(TJ({},EP),r.backgroundImage),{},{zOrder:0})),delete r.backgroundImage),r.watermark&&(n.push(TJ(TJ(TJ({},EP),r.watermark),{},{zOrder:255})),delete r.watermark),r.images=n,r.transcodingUsers&&(r.userConfigs=r.transcodingUsers.map((function(e){return TJ({},e)})),r.userCount=r.transcodingUsers.length,delete r.transcodingUsers),i=(r.userConfigs||[]).map((function(e){return"number"==typeof e.uid?Rb.resolve(e.uid):sJ(e.uid,s.spec,s.cancelToken.token,s.httpRetryConfig)})),e.next=7,Rb.all(i);case 7:if(e.sent.forEach((function(e,t){r.userConfigs&&r.userConfigs[t]&&(r.userConfigs[t].uid=e)})),this.transcodingConfig=r,!this.connection){e.next=22;break}return e.prev=10,e.next=13,this.connection.request("request",{clientRequest:{command:"UpdateTranscoding",transcodingConfig:this.transcodingConfig}},!1,{command:"UpdateTranscoding",workerType:1,requestByUser:!0,tid:Array.from(Rj(o=this.streamingTasks).call(o)).map((function(e){return e.taskId})).join("#")});case 13:a=e.sent,ND.debug("[".concat(this.spec.clientId,"] update live transcoding config success, code: ").concat(a.code,", config:"),JSON.stringify(this.transcodingConfig)),e.next=22;break;case 17:if(e.prev=17,e.t0=e.catch(10),e.t0.data&&e.t0.data.retry){e.next=21;break}throw e.t0;case 21:e.t0.data.changeAddress&&this.connection.tryNextAddress(),this.streamingTasks.forEach((function(t){ND.warning("[".concat(s.spec.clientId,"] live streaming receive error"),e.t0.toString(),"try to republish",t.url),s.startLiveStreamingTask(t.url,t.mode,e.t0).then((function(){ND.debug("[".concat(s.spec.clientId,"] live streaming republish ").concat(t.url," success"))})).catch((function(e){ND.error("[".concat(s.spec.clientId,"] live streaming republish failed"),t.url,e.toString()),s.onLiveStreamError&&s.onLiveStreamError(t.url,e)}))}));case 22:case"end":return e.stop()}}),e,this,[[10,17]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"setInjectStreamConfig",value:function(e,t){this.injectConfig=Object.assign({},this.injectConfig,e),this.injectLoopTimes=t}},{key:"startLiveStreamingTask",value:function(){var e=y(G.mark((function e(t,r,n){var i,o,a,s,c,u,d=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Array.from(Rj(i=this.streamingTasks).call(i)).find((function(e){return e.mode===lP.INJECT}))||r!==lP.INJECT){e.next=2;break}return e.abrupt("return",new SD(mD.LIVE_STREAMING_TASK_CONFLICT,"inject stream over limit").throw());case 2:if(this.transcodingConfig||r!==lP.TRANSCODE){e.next=4;break}throw new SD(mD.INVALID_OPERATION,"[LiveStreaming] no transcoding config found, can not start transcoding streaming task");case 4:return o={command:"PublishStream",ts:Date.now(),url:t,uid:this.spec.uid.toString(),autoDestroyTime:100,acceptImageTimeout:!0},ND.debug("[".concat(this.spec.clientId,"] start live streaming ").concat(t,", mode: ").concat(r)),e.next=8,this.taskMutex.lock();case 8:if(a=e.sent,this.connection||!n){e.next=11;break}return e.abrupt("return",void a());case 11:if(!this.streamingTasks.get(t)||n){e.next=13;break}return e.abrupt("return",(a(),new SD(mD.LIVE_STREAMING_TASK_CONFLICT).throw()));case 13:if(e.prev=13,e.t0=this.connection,e.t0){e.next=19;break}return e.next=18,this.connect(r);case 18:this.connection=e.sent;case 19:e.next=24;break;case 21:throw e.prev=21,e.t1=e.catch(13),a(),e.t1;case 24:e.t2=r,e.next=e.t2===lP.TRANSCODE?27:e.t2===lP.RAW?29:e.t2===lP.INJECT?30:31;break;case 27:return o.transcodingConfig=TJ({},this.transcodingConfig),e.abrupt("break",31);case 29:return e.abrupt("break",31);case 30:o={cname:this.spec.cname,command:"InjectStream",sid:this.spec.sid,transcodingConfig:this.injectConfig,ts:Date.now(),url:t,loopTimes:this.injectLoopTimes};case 31:return this.uapResponse&&this.uapResponse.vid&&(o.vid=this.uapResponse.vid),this.isStartingStreamingTask=!0,s=this.lastTaskId++,e.prev=33,c=new Rb((function(e,r){JG(d.retryTimeout).then((function(){if(n)return r(n);var e=d.statusError.get(t);return e?(d.statusError.delete(t),r(e)):void 0}))})),e.next=37,Rb.race([this.connection.request("request",{clientRequest:o},!0,{url:t,command:"PublishStream",workerType:r===lP.TRANSCODE?1:2,requestByUser:!n,tid:s.toString()}),c]);case 37:u=e.sent,this.isStartingStreamingTask=!1,ND.debug("[".concat(this.spec.clientId,"] live streaming started, code: ").concat(u.code)),this.streamingTasks.set(t,{clientRequest:o,mode:r,url:t,taskId:s}),a(),e.next=56;break;case 41:if(e.prev=41,e.t3=e.catch(33),a(),this.isStartingStreamingTask=!1,e.t3.data&&e.t3.data.retry&&!n){e.next=45;break}throw e.t3;case 45:if(!e.t3.data.changeAddress){e.next=52;break}return this.connection.tryNextAddress(),e.next=49,this.startLiveStreamingTask(t,r,e.t3);case 49:e.t4=e.sent,e.next=55;break;case 52:return e.next=54,this.startLiveStreamingTask(t,r,e.t3);case 54:e.t4=e.sent;case 55:return e.abrupt("return",e.t4);case 56:case"end":return e.stop()}}),e,this,[[13,21],[33,41]])})));function t(t,r,n){return e.apply(this,arguments)}return t}()},{key:"stopLiveStreamingTask",value:function(e){var t=this;return new Rb((function(r,n){var i=t.streamingTasks.get(e);if(!i||!t.connection)return new SD(mD.UNEXPECTED_ERROR,"can not find streaming task to stop").throw();var o=i.mode;i.abortTask=function(){ND.debug("[".concat(t.spec.clientId,"] stop live streaming success(worker exception)")),t.streamingTasks.delete(e),r()},t.connection.request("request",{clientRequest:{command:o===lP.INJECT?"UninjectStream":"UnpublishStream",url:i.url}},!1,{url:e,command:"UnPublishStream",workerType:o===lP.TRANSCODE?1:2,requestByUser:!0,tid:(t.lastTaskId++).toString()}).then((function(n){ND.debug("[".concat(t.spec.clientId,"] stop live streaming success, code: ").concat(n.code)),t.streamingTasks.delete(e),0===t.streamingTasks.size&&o!==lP.INJECT&&(t.connection&&t.connection.close(),t.connection=void 0),r(),o===lP.INJECT&&t.onInjectStatusChange&&t.onInjectStatusChange(pP.INJECT_STREAM_STATUS_STOP_SUCCESS,t.spec.uid,e)})).catch(n)}))}},{key:"controlInjectStream",value:function(){var e=y(G.mark((function e(t,r,n,i){var o;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((o=this.streamingTasks.get(t))&&this.connection&&o.mode===lP.INJECT){e.next=3;break}throw new SD(mD.INVALID_OPERATION,"can not find inject stream task to control");case 3:return e.next=5,this.connection.request("request",{clientRequest:{command:"ControlStream",url:t,control:r,audioVolume:n,position:i}});case 5:return e.abrupt("return",e.sent.serverResponse);case 6:case"end":return e.stop()}}),e,this)})));function t(t,r,n,i){return e.apply(this,arguments)}return t}()},{key:"resetAllTask",value:function(){var e,t=this,r=Array.from(Rj(e=this.streamingTasks).call(e));this.terminate();for(var n=function(){var e=o[i];t.startLiveStreamingTask(e.url,e.mode).catch((function(r){t.onLiveStreamError&&t.onLiveStreamError(e.url,r)}))},i=0,o=r;i<o.length;i++)n()}},{key:"terminate",value:function(){this.cancelToken&&this.cancelToken.cancel(),this.streamingTasks=new Map,this.isStartingStreamingTask=!1,this.statusError=new Map,this.cancelToken=ED.CancelToken.source(),this.uapResponse=void 0,this.connection&&this.connection.close(),this.connection=void 0}},{key:"connect",value:function(){var e=y(G.mark((function e(t){var r,n=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.connection){e.next=2;break}throw new SD(mD.UNEXPECTED_ERROR,"live streaming connection has already connected");case 2:return e.next=4,rK(this,IP.REQUEST_WORKER_MANAGER_LIST,t);case 4:return r=e.sent,this.uapResponse=r,this.connection=new wJ(r.workerToken,this.spec,this.wsRetryConfig,t),this.connection.on(yP.WARNING,(function(e,t){return n.onLiveStreamWarning&&n.onLiveStreamWarning(t,e)})),this.connection.on(yP.PUBLISH_STREAM_STATUS,(function(e){return n.handlePublishStreamServer(e)})),this.connection.on(yP.INJECT_STREAM_STATUS,(function(e){return n.handleInjectStreamServerStatus(e)})),this.connection.on(yP.REQUEST_NEW_ADDRESS,(function(e,r){if(!n.connection)return r(new SD(mD.UNEXPECTED_ERROR,"can not get new live streaming address list"));rK(n,IP.REQUEST_WORKER_MANAGER_LIST,t).then((function(t){n.uapResponse=t,e(t.addressList)})).catch(r)})),e.next=13,this.connection.init(r.addressList);case 13:return e.abrupt("return",this.connection);case 14:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"handlePublishStreamServer",value:function(e){var t=this,r=e.serverStatus&&e.serverStatus.url||"empty_url",n=this.streamingTasks.get(r),i=e.reason;switch(e.code){case SP.PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN:case SP.PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT:case SP.PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE:case SP.PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH:var o=new SD(mD.LIVE_STREAMING_CDN_ERROR,"",{code:e.code});if(n)return ND.error(o.toString()),this.onLiveStreamError&&this.onLiveStreamError(r,o);if(!this.isStartingStreamingTask)return;this.statusError.set(r,o);case SP.LIVE_STREAM_RESPONSE_FAILED_LOAD_IMAGE:var a=new SD(mD.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE,i);return this.onLiveStreamWarning&&this.onLiveStreamWarning(r,a);case SP.LIVE_STREAM_RESPONSE_WORKER_LOST:case SP.LIVE_STREAM_RESPONSE_WORKER_QUIT:var s;if(!this.connection)return;this.connection.tryNextAddress();for(var c=Array.from(Rj(s=this.streamingTasks).call(s)),u=function(){var r=l[d];r.abortTask?r.abortTask():(ND.warning("[".concat(t.spec.clientId,"] publish stream status code"),e.code,"try to republish",r.url),t.startLiveStreamingTask(r.url,r.mode,new SD(mD.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"",{code:e.code})).then((function(){ND.debug("[".concat(t.spec.clientId,"] republish live stream success"),r.url)})).catch((function(e){ND.error(e.toString()),t.onLiveStreamError&&t.onLiveStreamError(r.url,e)})))},d=0,l=c;d<l.length;d++)u();return}}},{key:"handleInjectStreamServerStatus",value:function(e){var t=Number(e.uid),r=e.serverStatus&&e.serverStatus.url;switch(e.code){case 200:return void(this.onInjectStatusChange&&this.onInjectStatusChange(pP.INJECT_STREAM_STATUS_START_SUCCESS,t,r));case 451:return this.onInjectStatusChange&&this.onInjectStatusChange(pP.INJECT_STREAM_STATUS_START_ALREADY_EXISTS,t,r),void this.streamingTasks.delete(r);case 453:return this.onInjectStatusChange&&this.onInjectStatusChange(pP.INJECT_STREAM_STATUS_START_UNAUTHORIZED,t,r),void this.streamingTasks.delete(r);case 470:return this.onInjectStatusChange&&this.onInjectStatusChange(pP.INJECT_STREAM_STATUS_BROKEN,t,r),void this.streamingTasks.delete(r);case 499:return this.onInjectStatusChange&&this.onInjectStatusChange(pP.INJECT_STREAM_STATUS_START_TIMEOUT,t,r),void this.streamingTasks.delete(r);default:return void ND.debug("inject stream server status",e)}}},{key:"hasUrl",value:function(e){return this.streamingTasks.has(e)}}]),r}(yD),OJ=function(){function e(){U(this,e),rO(this,"destChannelMediaInfos",new Map),rO(this,"srcChannelMediaInfo",void 0)}return F(e,[{key:"setSrcChannelInfo",value:function(e){jP(e),this.srcChannelMediaInfo=e}},{key:"addDestChannelInfo",value:function(e){jP(e),this.destChannelMediaInfos.set(e.channelName,e)}},{key:"removeDestChannelInfo",value:function(e){Rx(e),this.destChannelMediaInfos.delete(e)}},{key:"getSrcChannelMediaInfo",value:function(){return this.srcChannelMediaInfo}},{key:"getDestChannelMediaInfo",value:function(){return this.destChannelMediaInfos}}]),e}();function DJ(e){if(!(e instanceof OJ))return new SD(mD.INVALID_PARAMS,"Config should be instance of [ChannelMediaRelayConfiguration]").throw();var t=e.getSrcChannelMediaInfo(),r=e.getDestChannelMediaInfo();return t?0===r.size?new SD(mD.INVALID_PARAMS,"destChannelMediaInfo should not be empty").throw():void 0:new SD(mD.INVALID_PARAMS,"srcChannelMediaInfo should not be empty").throw()}var NJ,xJ,PJ=function(e){k(r,e);var t=W(r);function r(e,n,i){var o;return U(this,r),o=t.call(this),rO(S(o),"ws",void 0),rO(S(o),"requestId",1),rO(S(o),"heartBeatTimer",void 0),rO(S(o),"joinInfo",void 0),rO(S(o),"clientId",void 0),rO(S(o),"onOpen",(function(){o.emit("open"),o.startHeartBeatCheck()})),rO(S(o),"onClose",(function(e){o.emit("close"),o.dispose()})),rO(S(o),"onMessage",(function(e){var t=JSON.parse(e.data);if(!t||"serverResponse"!==t.command||!t.requestId)return t&&"serverStatus"===t.command&&t.serverStatus&&t.serverStatus.command?(o.emit("status",t.serverStatus),void o.emit(t.serverStatus.command,t.serverStatus)):void 0;o.emit("req_".concat(t.requestId),t)})),o.joinInfo=e,o.clientId=n,o.ws=new Dq("cross-channel-".concat(o.clientId),i),o.ws.on(dP.RECONNECTING,(function(){o.ws.reconnectMode="retry",o.emit("reconnecting")})),o.ws.on(dP.CONNECTED,o.onOpen),o.ws.on(dP.ON_MESSAGE,o.onMessage),o.ws.on(dP.CLOSED,o.onClose),o}return F(r,[{key:"isConnect",value:function(){return"connected"===this.ws.state}},{key:"sendMessage",value:function(e){var t=this.requestId++;return e.requestId=t,e.seq=t,this.ws.sendMessage(e),t}},{key:"waitStatus",value:function(e){var t=this;return new Rb((function(r,n){var i=window.setTimeout((function(){n(new SD(mD.TIMEOUT,"wait status timeout, status: ".concat(e)))}),5e3);t.once(e,(function(t){window.clearTimeout(i),t.state&&0!==t.state?n(new SD(mD.CROSS_CHANNEL_WAIT_STATUS_ERROR,"wait status error, status: ".concat(e))):r(void 0)})),t.once("dispose",(function(){window.clearTimeout(i),n(new SD(mD.WS_ABORT))}))}))}},{key:"request",value:function(){var e=y(G.mark((function e(t){var r,n,i,o,a=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("closed"!==this.ws.state){e.next=2;break}throw new SD(mD.WS_DISCONNECT);case 2:if(r=function(){return new Rb((function(e,t){a.ws.once(dP.CLOSED,(function(){return t(new SD(mD.WS_ABORT))})),a.ws.once(dP.CONNECTED,e)}))},e.t0="connected"!==this.ws.state,!e.t0){e.next=7;break}return e.next=7,r();case 7:return n=this.sendMessage(t),i=new Rb((function(e,t){var r=function(){t(new SD(mD.WS_ABORT))};a.ws.once(dP.RECONNECTING,r),a.ws.once(dP.CLOSED,r),a.once("req_".concat(n),e),JG(3e3).then((function(){a.removeAllListeners("req_".concat(n)),a.ws.off(dP.RECONNECTING,r),a.ws.off(dP.CLOSED,r),t(new SD(mD.TIMEOUT,"cross channel ws request timeout"))}))})),e.next=11,i;case 11:if((o=e.sent)&&200===o.code){e.next=14;break}throw new SD(mD.CROSS_CHANNEL_SERVER_ERROR_RESPONSE,"response: ".concat(JSON.stringify(o)));case 14:return e.abrupt("return",o);case 15:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"connect",value:function(){var e=y(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.ws.removeAllListeners(dP.REQUEST_NEW_URLS),this.ws.on(dP.REQUEST_NEW_URLS,(function(e){e(t)})),e.next=4,this.ws.init(t);case 4:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"dispose",value:function(){this.clearHeartBeatCheck(),this.emit("dispose"),this.removeAllListeners(),this.ws.close()}},{key:"sendPing",value:function(e){var t=this.requestId++;return e.requestId=t,this.ws.sendMessage(e),t}},{key:"startHeartBeatCheck",value:function(){var e=this;this.heartBeatTimer=window.setInterval((function(){e.sendPing({command:"ping",appId:e.joinInfo.appId,cname:e.joinInfo.cname,uid:e.joinInfo.uid.toString(),sid:e.joinInfo.sid,ts:+new Date,requestId:0})}),3e3)}},{key:"clearHeartBeatCheck",value:function(){window.clearInterval(this.heartBeatTimer),this.heartBeatTimer=void 0}}]),r}(yD),LJ=function(e){k(r,e);var t=W(r);function r(e,n,i,o){var a;return U(this,r),a=t.call(this),rO(S(a),"joinInfo",void 0),rO(S(a),"clientId",void 0),rO(S(a),"cancelToken",ED.CancelToken.source()),rO(S(a),"workerToken",void 0),rO(S(a),"requestId",0),rO(S(a),"signal",void 0),rO(S(a),"prevChannelMediaConfig",void 0),rO(S(a),"httpRetryConfig",void 0),rO(S(a),"_state",RP.RELAY_STATE_IDLE),rO(S(a),"errorCode",TP.RELAY_OK),rO(S(a),"onStatus",(function(e){ND.debug("[".concat(a.clientId,"] ChannelMediaStatus: ").concat(JSON.stringify(e))),e&&e.command&&("onAudioPacketReceived"===e.command&&a.emit("event",wP.PACKET_RECEIVED_AUDIO_FROM_SRC),"onVideoPacketReceived"===e.command&&a.emit("event",wP.PACKET_RECEIVED_VIDEO_FROM_SRC),"onSrcTokenPrivilegeDidExpire"===e.command&&(a.errorCode=TP.SRC_TOKEN_EXPIRED,a.state=RP.RELAY_STATE_FAILURE),"onDestTokenPrivilegeDidExpire"===e.command&&(a.errorCode=TP.DEST_TOKEN_EXPIRED,a.state=RP.RELAY_STATE_FAILURE))})),rO(S(a),"onReconnect",y(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:ND.debug("[".concat(a.clientId,"] ChannelMediaSocket disconnect, reconnecting")),a.emit("event",wP.NETWORK_DISCONNECTED),a.state=RP.RELAY_STATE_IDLE,a.prevChannelMediaConfig&&a.sendStartRelayMessage(a.prevChannelMediaConfig).catch((function(e){a.state!==RP.RELAY_STATE_IDLE&&(ND.error("auto restart channel media relay failed",e.toString()),a.errorCode=TP.SERVER_CONNECTION_LOST,a.state=RP.RELAY_STATE_FAILURE)}));case 1:case"end":return e.stop()}}),e)})))),a.joinInfo=e,a.clientId=n,a.signal=new PJ(a.joinInfo,a.clientId,i),a.httpRetryConfig=o,a}return F(r,[{key:"state",get:function(){return this._state},set:function(e){e!==this._state&&(e!==RP.RELAY_STATE_FAILURE&&(this.errorCode=TP.RELAY_OK),this.emit("state",e,this.errorCode),this._state=e)}},{key:"startChannelMediaRelay",value:function(){var e=y(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.state===RP.RELAY_STATE_IDLE){e.next=2;break}throw new SD(mD.INVALID_OPERATION);case 2:return this.state=RP.RELAY_STATE_CONNECTING,e.next=5,this.connect();case 5:return ND.debug("[".concat(this.clientId,"] startChannelMediaRelay: connect success")),e.prev=6,e.next=9,this.sendStartRelayMessage(t);case 9:e.next=20;break;case 11:if(e.prev=11,e.t0=e.catch(6),!e.t0.data||!e.t0.data.serverResponse||"SetSourceChannel"!==e.t0.data.serverResponse.command){e.next=15;break}throw new SD(mD.CROSS_CHANNEL_FAILED_JOIN_SRC);case 15:if(!e.t0.data||!e.t0.data.serverResponse||"SetDestChannelStatus"!==e.t0.serverResponse.command){e.next=17;break}throw new SD(mD.CROSS_CHANNEL_FAILED_JOIN_DEST);case 17:if(!e.t0.data||!e.t0.data.serverResponse||"StartPacketTransfer"!==e.t0.serverResponse.command){e.next=19;break}throw new SD(mD.CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST);case 19:throw e.t0;case 20:this.prevChannelMediaConfig=t;case 21:case"end":return e.stop()}}),e,this,[[6,11]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"updateChannelMediaRelay",value:function(){var e=y(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.state===RP.RELAY_STATE_RUNNING){e.next=2;break}throw new SD(mD.INVALID_OPERATION);case 2:return e.next=4,this.sendUpdateMessage(t);case 4:this.prevChannelMediaConfig=t;case 5:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"stopChannelMediaRelay",value:function(){var e=y(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sendStopRelayMessage();case 2:ND.debug("[".concat(this.clientId,"] stopChannelMediaRelay: send stop message success")),this.state=RP.RELAY_STATE_IDLE,this.dispose();case 5:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"dispose",value:function(){ND.debug("[".concat(this.clientId,"] disposeChannelMediaRelay")),this.cancelToken.cancel(),this.cancelToken=ED.CancelToken.source(),this.state=RP.RELAY_STATE_IDLE,this.emit("dispose"),this.signal.dispose(),this.prevChannelMediaConfig=void 0}},{key:"connect",value:function(){var e=y(G.mark((function e(){var t;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,gJ(this.joinInfo,this.cancelToken.token,this.httpRetryConfig);case 2:return t=e.sent,this.workerToken=t.workerToken,e.next=6,this.signal.connect(t.addressList);case 6:this.emit("event",wP.NETWORK_CONNECTED),this.signal.on("status",this.onStatus),this.signal.on("reconnecting",this.onReconnect);case 9:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"sendStartRelayMessage",value:function(){var e=y(G.mark((function e(t){var r,n,i,o,a,s;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.genMessage(CP.StopPacketTransfer),e.next=3,this.signal.request(r);case 3:return e.next=5,this.signal.waitStatus("Normal Quit");case 5:return ND.debug("[".concat(this.clientId,"] startChannelMediaRelay: StopPacketTransfer success")),n=this.genMessage(CP.SetSdkProfile,t),e.next=9,this.signal.request(n);case 9:return ND.debug("[".concat(this.clientId,"] startChannelMediaRelay: SetSdkProfile success")),i=this.genMessage(CP.SetSourceChannel,t),e.next=13,this.signal.request(i);case 13:return e.next=15,this.signal.waitStatus("SetSourceChannelStatus");case 15:return this.emit("event",wP.PACKET_JOINED_SRC_CHANNEL),ND.debug("[".concat(this.clientId,"] startChannelMediaRelay: SetSourceChannel success")),o=this.genMessage(CP.SetSourceUserId,t),e.next=20,this.signal.request(o);case 20:return ND.debug("[".concat(this.clientId,"] startChannelMediaRelay: SetSourceUserId success")),a=this.genMessage(CP.SetDestChannel,t),e.next=24,this.signal.request(a);case 24:return e.next=26,this.signal.waitStatus("SetDestChannelStatus");case 26:return this.emit("event",wP.PACKET_JOINED_DEST_CHANNEL),ND.debug("[".concat(this.clientId,"] startChannelMediaRelay: SetDestChannel success")),s=this.genMessage(CP.StartPacketTransfer,t),e.next=31,this.signal.request(s);case 31:this.emit("event",wP.PACKET_SENT_TO_DEST_CHANNEL),this.state=RP.RELAY_STATE_RUNNING,ND.debug("[".concat(this.clientId,"] startChannelMediaRelay: StartPacketTransfer success"));case 34:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"sendUpdateMessage",value:function(){var e=y(G.mark((function e(t){var r;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.genMessage(CP.UpdateDestChannel,t),e.next=3,this.signal.request(r);case 3:this.emit("event",wP.PACKET_UPDATE_DEST_CHANNEL),ND.debug("[".concat(this.clientId,"] sendUpdateMessage: UpdateDestChannel success"));case 5:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"sendStopRelayMessage",value:function(){var e=y(G.mark((function e(){var t;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.genMessage(CP.StopPacketTransfer),e.next=3,this.signal.request(t);case 3:ND.debug("[".concat(this.clientId,"] sendStopRelayMessage: StopPacketTransfer success"));case 4:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"genMessage",value:function(e,t){var r=this,n=[],i=[],o=[];this.requestId+=1;var a={appId:this.joinInfo.appId,cname:this.joinInfo.cname,uid:this.joinInfo.uid.toString(),sdkVersion:oN,sid:this.joinInfo.sid,ts:Date.now(),requestId:this.requestId,seq:this.requestId,allocate:!0,clientRequest:{}};"4.11.0"===a.sdkVersion&&(a.sdkVersion="0.0.1");var s=null,c=null;switch(e){case CP.SetSdkProfile:return a.clientRequest={command:"SetSdkProfile",type:"multi_channel"},a;case CP.SetSourceChannel:if(!(c=t&&t.getSrcChannelMediaInfo()))throw new SD(mD.UNEXPECTED_ERROR,"can not find source config");return a.clientRequest={command:"SetSourceChannel",uid:"0",channelName:c.channelName,token:c.token||this.joinInfo.appId},a;case CP.SetSourceUserId:if(!(c=t&&t.getSrcChannelMediaInfo()))throw new SD(mD.UNEXPECTED_ERROR,"can not find source config");return a.clientRequest={command:"SetSourceUserId",uid:c.uid+""},a;case CP.SetDestChannel:if(!(s=t&&t.getDestChannelMediaInfo()))throw new SD(mD.UNEXPECTED_ERROR,"can not find dest config");return s.forEach((function(e){n.push(e.channelName),i.push(e.uid+""),o.push(e.token||r.joinInfo.appId)})),a.clientRequest={command:"SetDestChannel",channelName:n,uid:i,token:o},a;case CP.StartPacketTransfer:return a.clientRequest={command:"StartPacketTransfer"},a;case CP.Reconnect:return a.clientRequest={command:"Reconnect"},a;case CP.StopPacketTransfer:return a.clientRequest={command:"StopPacketTransfer"},a;case CP.UpdateDestChannel:if(!(s=t&&t.getDestChannelMediaInfo()))throw new SD(mD.UNEXPECTED_ERROR,"can not find dest config");return s.forEach((function(e){n.push(e.channelName),i.push(e.uid+""),o.push(e.token||r.joinInfo.appId)})),a.clientRequest={command:"UpdateDestChannel",channelName:n,uid:i,token:o},a}return a}}]),r}(yD),BJ=tN("AgoraRTCPlayer","trackId")(NJ=function(){function e(t){var r=this;U(this,e),rO(this,"trackId",void 0),rO(this,"config",void 0),rO(this,"onFirstVideoFrameDecoded",void 0),rO(this,"freezeTimeCounterList",[]),rO(this,"timeUpdatedCount",0),rO(this,"freezeTime",0),rO(this,"playbackTime",0),rO(this,"lastTimeUpdatedTime",0),rO(this,"videoTrack",void 0),rO(this,"container",void 0),rO(this,"videoElement",void 0),rO(this,"videoElementCheckInterval",void 0),rO(this,"_videoElementStatus",vx.NONE),rO(this,"slot",void 0),rO(this,"isGettingVideoDimensions",!1),rO(this,"handleVideoEvents",(function(e){switch(e.type){case"play":case"playing":r.startGetVideoDimensions(),r.videoElementStatus=vx.PLAYING;break;case"loadeddata":r.onFirstVideoFrameDecoded&&r.onFirstVideoFrameDecoded();break;case"canplay":r.videoElementStatus=vx.CANPLAY;break;case"stalled":r.videoElementStatus=vx.STALLED;break;case"suspend":r.videoElementStatus=vx.SUSPEND;break;case"pause":r.videoElementStatus=vx.PAUSED,!Qk()&&!Kk()&&r.videoElement&&r.videoTrack&&"live"===r.videoTrack.readyState&&(ND.debug("[track-".concat(r.trackId,"] video element paused, auto resume")),qD("debug",r,"video element paused, auto resume"),r.videoElement.play());break;case"waiting":r.videoElementStatus=vx.WAITING;break;case"abort":r.videoElementStatus=vx.ABORT;break;case"ended":r.videoElementStatus=vx.ENDED;break;case"emptied":r.videoElementStatus=vx.EMPTIED;break;case"timeupdate":var t=Date.now();if(r.timeUpdatedCount+=1,r.timeUpdatedCount<10)return void(r.lastTimeUpdatedTime=t);var n=t-r.lastTimeUpdatedTime;for(r.lastTimeUpdatedTime=t,n>500&&(r.freezeTime+=n),r.playbackTime+=n;r.playbackTime>=6e3;)r.playbackTime-=6e3,r.freezeTimeCounterList.push(Math.min(6e3,r.freezeTime)),r.freezeTime=Math.max(0,r.freezeTime-6e3)}})),rO(this,"startGetVideoDimensions",(function(){var e=function e(){if(r.isGettingVideoDimensions=!0,r.videoElement&&r.videoElement.videoWidth*r.videoElement.videoHeight>4)return ND.debug("[".concat(r.trackId,"] current video dimensions:"),r.videoElement.videoWidth,r.videoElement.videoHeight),ZD("debug",r,"startGetVideoDimensions",{videoWidth:r.videoElement.videoWidth,videoHeight:r.videoElement.videoHeight}),void(r.isGettingVideoDimensions=!1);setTimeout(e,500)};!r.isGettingVideoDimensions&&e()})),rO(this,"autoResumeAfterInterruption",(function(){r.videoElement&&r.videoTrack&&"live"===r.videoTrack.readyState&&"running"===uV.curState&&(Gk()?(ND.debug("[track-".concat(r.trackId,"] video element paused, auto resume for iOS 15.2")),r.videoElement.srcObject=null,r.videoElement.srcObject=new MediaStream([r.videoTrack]),r.videoElement.play()):Vk()?(ND.debug("[track-".concat(r.trackId,"] video element paused, auto resume for iOS 15.1")),r.videoElement.srcObject=null,r.videoElement.srcObject=new MediaStream([r.videoTrack]),r.videoElement.play()):jk()&&(ND.debug("[track-".concat(r.trackId,"] video element paused, auto resume for iOS 15.0")),r.videoElement.pause(),r.videoElement.play()))})),rO(this,"autoResumeAfterInterruptionOnIOS15",(function(){r.videoElement&&r.videoTrack&&"live"===r.videoTrack.readyState&&(Gk()?(ND.debug("[track-".concat(r.trackId,"] video element paused, auto resume for iOS 15.2")),r.videoElement.srcObject=null,r.videoElement.srcObject=new MediaStream([r.videoTrack]),r.videoElement.play()):Vk()?(ND.debug("[track-".concat(r.trackId,"] video element paused, auto resume for iOS 15.1")),r.videoElement.srcObject=null,r.videoElement.srcObject=new MediaStream([r.videoTrack]),r.videoElement.play()):jk()&&(ND.debug("[track-".concat(r.trackId,"] video element paused, auto resume for iOS 15.0")),r.videoElement.pause(),r.videoElement.play()))})),this.slot=t.element,this.trackId=t.trackId,this.updateConfig(t),uV.on(Xj.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),uV.on(Xj.IOS_15_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15)}return F(e,[{key:"videoElementStatus",get:function(){return this._videoElementStatus},set:function(e){e!==this._videoElementStatus&&(ND.debug("[".concat(this.trackId,"] video-element-status change ").concat(this._videoElementStatus," => ").concat(e)),XD("debug",["HTMLVideoElement",this.trackId],"statusChange","".concat(this._videoElementStatus," => ").concat(e)),this._videoElementStatus=e)}},{key:"updateConfig",value:function(e){this.config=e,this.trackId=e.trackId;var t=e.element;t!==this.slot&&(this.destroy(),this.slot=t),this.createElements()}},{key:"updateVideoTrack",value:function(e){this.videoTrack!==e&&(this.videoTrack=e,this.createElements())}},{key:"play",value:function(e){var t=this;if(this.videoElement){var r=this.videoElement.play();r&&r.catch&&r.catch((function(r){e&&zj.autoplayFailed(e,"video",r.message,t.trackId),ZD("warning",t,"play",r.toString(),"error"),"NotAllowedError"===r.name?(ND.warning("detected video element autoplay failed",r),t.handleAutoPlayFailed()):ND.warning("[".concat(t.trackId,"] play warning: "),r)}));var n=Tk();if(("Safari"===n.name&&15===Number(n.version)||Fk())&&r&&r.then&&r.catch){var i=function(){t.config.mirror&&t.videoElement&&(t.videoElement.style.transform="rotateY(180deg)")};r.then(i).catch(i)}}}},{key:"getCurrentFrame",value:function(){if(!this.videoElement)return new ImageData(2,2);var e=document.createElement("canvas");e.width=this.videoElement.videoWidth,e.height=this.videoElement.videoHeight;var t=e.getContext("2d");if(!t)return ND.error("create canvas context failed!"),ZD("error",this,"getCurrentFrame","create canvas context failed!","error"),new ImageData(2,2);t.drawImage(this.videoElement,0,0,e.width,e.height);var r=t.getImageData(0,0,e.width,e.height);return e.remove(),r}},{key:"destroy",value:function(){if(uV.off(Xj.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),uV.off(Xj.IOS_15_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15),this.videoElement&&(this.videoElement.srcObject=null,this.videoElement.remove(),this.videoElement=void 0),this.container){try{this.container.remove(),this.slot.removeChild(this.container)}catch(e){}this.container=void 0}this.freezeTimeCounterList=[]}},{key:"createElements",value:function(){this.container||(this.container=document.createElement("div")),this.container.id="agora-video-player-".concat(this.trackId),this.container.style.width="100%",this.container.style.height="100%",this.container.style.position="relative",this.container.style.overflow="hidden",this.videoTrack?(this.container.style.backgroundColor="black",this.createVideoElement(),this.container.appendChild(this.videoElement)):this.removeVideoElement(),this.slot.appendChild(this.container)}},{key:"createVideoElement",value:function(){var e=this;this.videoElement||(this.videoElementStatus=vx.INIT,this.videoElement=document.createElement("video"),this.videoElement.onerror=function(){return e.videoElementStatus=vx.ERROR},this.container&&this.container.appendChild(this.videoElement),MJ.forEach((function(t){e.videoElement&&e.videoElement.addEventListener(t,e.handleVideoEvents)})),this.videoElementCheckInterval=window.setInterval((function(){!document.getElementById("video_".concat(e.trackId))&&e.videoElement&&(e.videoElementStatus=vx.DESTROYED)}),1e3)),this.videoElement.id="video_".concat(this.trackId),this.videoElement.className="agora_video_player",this.videoElement.style.width="100%",this.videoElement.style.height="100%",this.videoElement.style.position="absolute",this.videoElement.controls=!1,this.videoElement.setAttribute("playsinline",""),this.videoElement.style.left="0",this.videoElement.style.top="0";var t=Tk();"Safari"===t.name&&15===Number(t.version)||Fk()||!this.config.mirror||(this.videoElement.style.transform="rotateY(180deg)"),this.config.fit?this.videoElement.style.objectFit=this.config.fit:this.videoElement.style.objectFit="cover",this.videoElement.setAttribute("muted",""),this.videoElement.muted=!0,this.videoElement.srcObject&&this.videoElement.srcObject instanceof MediaStream?this.videoElement.srcObject.getVideoTracks()[0]!==this.videoTrack&&(this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,Uk()&&this.videoElement.load()):(this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,Uk()&&this.videoElement.load());var r=this.videoElement.play();void 0!==r&&r.catch((function(t){ND.debug("[".concat(e.trackId,"] playback interrupted"),t.toString()),qD("debug",e,"play back interrupted: ".concat(t.toString()))}))}},{key:"removeVideoElement",value:function(){var e=this;if(this.videoElement){MJ.forEach((function(t){e.videoElement&&e.videoElement.removeEventListener(t,e.handleVideoEvents)})),this.videoElementCheckInterval&&(window.clearInterval(this.videoElementCheckInterval),this.videoElementCheckInterval=void 0);try{this.container&&this.container.removeChild(this.videoElement)}catch(e){}this.videoElement=void 0,this.videoElementStatus=vx.NONE}}},{key:"handleAutoPlayFailed",value:function(){var e=this,t=Tk();if(this.videoElement){var r=function r(n){n.preventDefault(),e.videoElement&&(e.videoElement.play().then((function(){ND.debug("[".concat(e.trackId,"] Video element for trackId:").concat(e.trackId," autoplay resumed.")),qD("debug",e,"video element autoplay resumed")})).catch((function(e){ND.error(e)})),"Android"!==t.os||"Chrome"!==t.name&&t.name!==Sk.WECHAT?(document.body.removeEventListener("touchstart",r,!0),document.body.removeEventListener("mousedown",r,!0)):document.body.removeEventListener("click",r,!0))};"Android"!==t.os||"Chrome"!==t.name&&t.name!==Sk.WECHAT?(document.body.addEventListener("touchstart",r,!0),document.body.addEventListener("mousedown",r,!0)):document.body.addEventListener("click",r,!0),Hj()}}},{key:"getVideoElement",value:function(){return this.videoElement}},{key:"getContainerElement",value:function(){return this.container}}]),e}())||NJ,MJ=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","timeupdate"],UJ={exports:{}};function QJ(e,t,r){var n=e.createShader(r);if(!n)return new SD(mD.WEBGL_INTERNAL_ERROR,"can not create shader").throw();if(e.shaderSource(n,t),e.compileShader(n),!e.getShaderParameter(n,e.COMPILE_STATUS)){var i=e.getShaderInfoLog(n);return e.deleteShader(n),new SD(mD.WEBGL_INTERNAL_ERROR,"error compiling shader:"+i).throw()}return n}function FJ(e,t,r,n){for(var i=[],o=0;o<t.length;++o){var a=0===o?e.VERTEX_SHADER:e.FRAGMENT_SHADER;i.push(QJ(e,t[o],a))}return function(e,t,r,n){var i=e.createProgram();if(!i)throw new SD(mD.WEBGL_INTERNAL_ERROR,"can not create webgl program");if(t.forEach((function(t){e.attachShader(i,t)})),r&&r.forEach((function(t,r){e.bindAttribLocation(i,n?n[r]:r,t)})),e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS)){var o=e.getProgramInfoLog(i);throw e.deleteProgram(i),new SD(mD.WEBGL_INTERNAL_ERROR,"error in program linking:"+o)}return i}(e,i,r,n)}!function(e,t){e.exports=function(){var e={3476:function(e,t,r){e.exports=r(7460)},4341:function(e,t,r){e.exports=r(3685)},3536:function(e,t,r){var n=r(1910);e.exports=n},8171:function(e,t,r){r(6450);var n=r(4058).Object,i=e.exports=function(e,t,r){return n.defineProperty(e,t,r)};n.defineProperty.sham&&(i.sham=!0)},2956:function(e,t,r){r(7627),r(6274),r(5967),r(8881),r(4560),r(7206),r(4349),r(7971);var n=r(4058);e.exports=n.Promise},3685:function(e,t,r){var n=r(3536);e.exports=n},4883:function(e,t,r){var n=r(1899),i=r(7475),o=r(9826),a=n.TypeError;e.exports=function(e){if(i(e))return e;throw a(o(e)+" is not a function")}},174:function(e,t,r){var n=r(1899),i=r(4284),o=r(9826),a=n.TypeError;e.exports=function(e){if(i(e))return e;throw a(o(e)+" is not a constructor")}},1851:function(e,t,r){var n=r(1899),i=r(7475),o=n.String,a=n.TypeError;e.exports=function(e){if("object"==D(e)||i(e))return e;throw a("Can't set "+o(e)+" as a prototype")}},8479:function(e){e.exports=function(){}},5743:function(e,t,r){var n=r(1899),i=r(7046),o=n.TypeError;e.exports=function(e,t){if(i(t,e))return e;throw o("Incorrect invocation")}},6059:function(e,t,r){var n=r(1899),i=r(941),o=n.String,a=n.TypeError;e.exports=function(e){if(i(e))return e;throw a(o(e)+" is not an object")}},1692:function(e,t,r){var n=r(4529),i=r(9413),o=r(623),a=function(e){return function(t,r,a){var s,c=n(t),u=o(c),d=i(a,u);if(e&&r!=r){for(;u>d;)if((s=c[d++])!=s)return!0}else for(;u>d;d++)if((e||d in c)&&c[d]===r)return e||d||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},3765:function(e,t,r){var n=r(5329);e.exports=n([].slice)},1385:function(e,t,r){var n=r(9813)("iterator"),i=!1;try{var o=0,a={next:function(){return{done:!!o++}},return:function(){i=!0}};a[n]=function(){return this},Array.from(a,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!i)return!1;var r=!1;try{var o={};o[n]=function(){return{next:function(){return{done:r=!0}}}},e(o)}catch(e){}return r}},2532:function(e,t,r){var n=r(5329),i=n({}.toString),o=n("".slice);e.exports=function(e){return o(i(e),8,-1)}},9697:function(e,t,r){var n=r(1899),i=r(2885),o=r(7475),a=r(2532),s=r(9813)("toStringTag"),c=n.Object,u="Arguments"==a(function(){return arguments}());e.exports=i?a:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=c(e),s))?r:u?a(t):"Object"==(n=a(t))&&o(t.callee)?"Arguments":n}},8694:function(e,t,r){var n=r(5329)("".replace),i=String(Error("zxcasd").stack),o=/\n\s*at [^:]*:[^\n]*/,a=o.test(i);e.exports=function(e,t){if(a&&"string"==typeof e)for(;t--;)e=n(e,o,"");return e}},3489:function(e,t,r){var n=r(953),i=r(1136),o=r(9677),a=r(5988);e.exports=function(e,t,r){for(var s=i(t),c=a.f,u=o.f,d=0;d<s.length;d++){var l=s[d];n(e,l)||r&&n(r,l)||c(e,l,u(t,l))}}},4160:function(e,t,r){var n=r(5981);e.exports=!n((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},1046:function(e,t,r){var n=r(5143).IteratorPrototype,i=r(9290),o=r(1887),a=r(904),s=r(2077),c=function(){return this};e.exports=function(e,t,r,u){var d=t+" Iterator";return e.prototype=i(n,{next:o(+!u,r)}),a(e,d,!1,!0),s[d]=c,e}},2029:function(e,t,r){var n=r(5746),i=r(5988),o=r(1887);e.exports=n?function(e,t,r){return i.f(e,t,o(1,r))}:function(e,t,r){return e[t]=r,e}},1887:function(e){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},7771:function(e,t,r){var n=r(6887),i=r(8834),o=r(2529),a=r(9417),s=r(7475),c=r(1046),u=r(249),d=r(8929),l=r(904),p=r(2029),f=r(9754),h=r(9813),A=r(2077),v=r(5143),g=a.PROPER,m=a.CONFIGURABLE,E=v.IteratorPrototype,_=v.BUGGY_SAFARI_ITERATORS,y=h("iterator"),I="keys",S="values",b="entries",C=function(){return this};e.exports=function(e,t,r,a,h,v,w){c(r,t,a);var R,T,k,O=function(e){if(e===h&&L)return L;if(!_&&e in x)return x[e];switch(e){case I:case S:case b:return function(){return new r(this,e)}}return function(){return new r(this)}},D=t+" Iterator",N=!1,x=e.prototype,P=x[y]||x["@@iterator"]||h&&x[h],L=!_&&P||O(h),B="Array"==t&&x.entries||P;if(B&&(R=u(B.call(new e)))!==Object.prototype&&R.next&&(o||u(R)===E||(d?d(R,E):s(R[y])||f(R,y,C)),l(R,D,!0,!0),o&&(A[D]=C)),g&&h==S&&P&&P.name!==S&&(!o&&m?p(x,"name",S):(N=!0,L=function(){return i(P,this)})),h)if(T={values:O(S),keys:v?L:O(I),entries:O(b)},w)for(k in T)(_||N||!(k in x))&&f(x,k,T[k]);else n({target:t,proto:!0,forced:_||N},T);return o&&!w||x[y]===L||f(x,y,L,{name:h}),A[t]=L,T}},5746:function(e,t,r){var n=r(5981);e.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},1333:function(e,t,r){var n=r(1899),i=r(941),o=n.document,a=i(o)&&i(o.createElement);e.exports=function(e){return a?o.createElement(e):{}}},3281:function(e){e.exports={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}},3321:function(e){e.exports="object"==("undefined"==typeof window?"undefined":D(window))},4470:function(e,t,r){var n=r(2861),i=r(1899);e.exports=/ipad|iphone|ipod/i.test(n)&&void 0!==i.Pebble},2749:function(e,t,r){var n=r(2861);e.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(n)},6049:function(e,t,r){var n=r(2532),i=r(1899);e.exports="process"==n(i.process)},8045:function(e,t,r){var n=r(2861);e.exports=/web0s(?!.*chrome)/i.test(n)},2861:function(e,t,r){var n=r(626);e.exports=n("navigator","userAgent")||""},3385:function(e,t,r){var n,i,o=r(1899),a=r(2861),s=o.process,c=o.Deno,u=s&&s.versions||c&&c.version,d=u&&u.v8;d&&(i=(n=d.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!i&&a&&(!(n=a.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/))&&(i=+n[1]),e.exports=i},6759:function(e){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},8780:function(e,t,r){var n=r(5981),i=r(1887);e.exports=!n((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",i(1,7)),7!==e.stack)}))},6887:function(e,t,r){var n=r(1899),i=r(9730),o=r(5329),a=r(7475),s=r(9677).f,c=r(7252),u=r(4058),d=r(6843),l=r(2029),p=r(953),f=function(e){var t=function t(r,n,o){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,o)}return i(e,this,arguments)};return t.prototype=e.prototype,t};e.exports=function(e,t){var r,i,h,A,v,g,m,E,_=e.target,y=e.global,I=e.stat,S=e.proto,b=y?n:I?n[_]:(n[_]||{}).prototype,C=y?u:u[_]||l(u,_,{})[_],w=C.prototype;for(h in t)r=!c(y?h:_+(I?".":"#")+h,e.forced)&&b&&p(b,h),v=C[h],r&&(g=e.noTargetGet?(E=s(b,h))&&E.value:b[h]),A=r&&g?g:t[h],r&&D(v)==D(A)||(m=e.bind&&r?d(A,n):e.wrap&&r?f(A):S&&a(A)?o(A):A,(e.sham||A&&A.sham||v&&v.sham)&&l(m,"sham",!0),l(C,h,m),S&&(p(u,i=_+"Prototype")||l(u,i,{}),l(u[i],h,A),e.real&&w&&!w[h]&&l(w,h,A)))}},5981:function(e){e.exports=function(e){try{return!!e()}catch(e){return!0}}},9730:function(e,t,r){var n=r(8285),i=Function.prototype,o=i.apply,a=i.call;e.exports="object"==("undefined"==typeof Reflect?"undefined":D(Reflect))&&Reflect.apply||(n?a.bind(o):function(){return a.apply(o,arguments)})},6843:function(e,t,r){var n=r(5329),i=r(4883),o=r(8285),a=n(n.bind);e.exports=function(e,t){return i(e),void 0===t?e:o?a(e,t):function(){return e.apply(t,arguments)}}},8285:function(e,t,r){var n=r(5981);e.exports=!n((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},8834:function(e,t,r){var n=r(8285),i=Function.prototype.call;e.exports=n?i.bind(i):function(){return i.apply(i,arguments)}},9417:function(e,t,r){var n=r(5746),i=r(953),o=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,s=i(o,"name"),c=s&&"something"===function(){}.name,u=s&&(!n||n&&a(o,"name").configurable);e.exports={EXISTS:s,PROPER:c,CONFIGURABLE:u}},5329:function(e,t,r){var n=r(8285),i=Function.prototype,o=i.bind,a=i.call,s=n&&o.bind(a,a);e.exports=n?function(e){return e&&s(e)}:function(e){return e&&function(){return a.apply(e,arguments)}}},626:function(e,t,r){var n=r(4058),i=r(1899),o=r(7475),a=function(e){return o(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?a(n[e])||a(i[e]):n[e]&&n[e][t]||i[e]&&i[e][t]}},2902:function(e,t,r){var n=r(9697),i=r(4229),o=r(2077),a=r(9813)("iterator");e.exports=function(e){if(null!=e)return i(e,a)||i(e,"@@iterator")||o[n(e)]}},429:function(e,t,r){var n=r(1899),i=r(8834),o=r(4883),a=r(6059),s=r(9826),c=r(2902),u=n.TypeError;e.exports=function(e,t){var r=arguments.length<2?c(e):t;if(o(r))return a(i(r,e));throw u(s(e)+" is not iterable")}},4229:function(e,t,r){var n=r(4883);e.exports=function(e,t){var r=e[t];return null==r?void 0:n(r)}},1899:function(e,t,r){var n=function(e){return e&&e.Math==Math&&e};e.exports=n("object"==("undefined"==typeof globalThis?"undefined":D(globalThis))&&globalThis)||n("object"==("undefined"==typeof window?"undefined":D(window))&&window)||n("object"==("undefined"==typeof self?"undefined":D(self))&&self)||n("object"==D(r.g)&&r.g)||function(){return this}()||Function("return this")()},953:function(e,t,r){var n=r(5329),i=r(9678),o=n({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(i(e),t)}},7748:function(e){e.exports={}},4845:function(e,t,r){var n=r(1899);e.exports=function(e,t){var r=n.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))}},5463:function(e,t,r){var n=r(626);e.exports=n("document","documentElement")},2840:function(e,t,r){var n=r(5746),i=r(5981),o=r(1333);e.exports=!n&&!i((function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},7026:function(e,t,r){var n=r(1899),i=r(5329),o=r(5981),a=r(2532),s=n.Object,c=i("".split);e.exports=o((function(){return!s("z").propertyIsEnumerable(0)}))?function(e){return"String"==a(e)?c(e,""):s(e)}:s},1302:function(e,t,r){var n=r(5329),i=r(7475),o=r(3030),a=n(Function.toString);i(o.inspectSource)||(o.inspectSource=function(e){return a(e)}),e.exports=o.inspectSource},3794:function(e,t,r){var n=r(941),i=r(2029);e.exports=function(e,t){n(t)&&"cause"in t&&i(e,"cause",t.cause)}},5402:function(e,t,r){var n,i,o,a=r(8019),s=r(1899),c=r(5329),u=r(941),d=r(2029),l=r(953),p=r(3030),f=r(4262),h=r(7748),A="Object already initialized",v=s.TypeError,g=s.WeakMap;if(a||p.state){var m=p.state||(p.state=new g),E=c(m.get),_=c(m.has),y=c(m.set);n=function(e,t){if(_(m,e))throw new v(A);return t.facade=e,y(m,e,t),t},i=function(e){return E(m,e)||{}},o=function(e){return _(m,e)}}else{var I=f("state");h[I]=!0,n=function(e,t){if(l(e,I))throw new v(A);return t.facade=e,d(e,I,t),t},i=function(e){return l(e,I)?e[I]:{}},o=function(e){return l(e,I)}}e.exports={set:n,get:i,has:o,enforce:function(e){return o(e)?i(e):n(e,{})},getterFor:function(e){return function(t){var r;if(!u(t)||(r=i(t)).type!==e)throw v("Incompatible receiver, "+e+" required");return r}}}},6782:function(e,t,r){var n=r(9813),i=r(2077),o=n("iterator"),a=Array.prototype;e.exports=function(e){return void 0!==e&&(i.Array===e||a[o]===e)}},7475:function(e){e.exports=function(e){return"function"==typeof e}},4284:function(e,t,r){var n=r(5329),i=r(5981),o=r(7475),a=r(9697),s=r(626),c=r(1302),u=function(){},d=[],l=s("Reflect","construct"),p=/^\s*(?:class|function)\b/,f=n(p.exec),h=!p.exec(u),A=function(e){if(!o(e))return!1;try{return l(u,d,e),!0}catch(e){return!1}},v=function(e){if(!o(e))return!1;switch(a(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return h||!!f(p,c(e))}catch(e){return!0}};v.sham=!0,e.exports=!l||i((function(){var e;return A(A.call)||!A(Object)||!A((function(){e=!0}))||e}))?v:A},7252:function(e,t,r){var n=r(5981),i=r(7475),o=/#|\.prototype\./,a=function(e,t){var r=c[s(e)];return r==d||r!=u&&(i(t)?n(t):!!t)},s=a.normalize=function(e){return String(e).replace(o,".").toLowerCase()},c=a.data={},u=a.NATIVE="N",d=a.POLYFILL="P";e.exports=a},941:function(e,t,r){var n=r(7475);e.exports=function(e){return"object"==D(e)?null!==e:n(e)}},2529:function(e){e.exports=!0},6664:function(e,t,r){var n=r(1899),i=r(626),o=r(7475),a=r(7046),s=r(2302),c=n.Object;e.exports=s?function(e){return"symbol"==D(e)}:function(e){var t=i("Symbol");return o(t)&&a(t.prototype,c(e))}},3091:function(e,t,r){var n=r(1899),i=r(6843),o=r(8834),a=r(6059),s=r(9826),c=r(6782),u=r(623),d=r(7046),l=r(429),p=r(2902),f=r(7609),h=n.TypeError,A=function(e,t){this.stopped=e,this.result=t},v=A.prototype;e.exports=function(e,t,r){var n,g,m,E,_,y,I,S=r&&r.that,b=!(!r||!r.AS_ENTRIES),C=!(!r||!r.IS_ITERATOR),w=!(!r||!r.INTERRUPTED),R=i(t,S),T=function(e){return n&&f(n,"normal",e),new A(!0,e)},k=function(e){return b?(a(e),w?R(e[0],e[1],T):R(e[0],e[1])):w?R(e,T):R(e)};if(C)n=e;else{if(!(g=p(e)))throw h(s(e)+" is not iterable");if(c(g)){for(m=0,E=u(e);E>m;m++)if((_=k(e[m]))&&d(v,_))return _;return new A(!1)}n=l(e,g)}for(y=n.next;!(I=o(y,n)).done;){try{_=k(I.value)}catch(e){f(n,"throw",e)}if("object"==D(_)&&_&&d(v,_))return _}return new A(!1)}},7609:function(e,t,r){var n=r(8834),i=r(6059),o=r(4229);e.exports=function(e,t,r){var a,s;i(e);try{if(!(a=o(e,"return"))){if("throw"===t)throw r;return r}a=n(a,e)}catch(e){s=!0,a=e}if("throw"===t)throw r;if(s)throw a;return i(a),r}},5143:function(e,t,r){var n,i,o,a=r(5981),s=r(7475),c=r(9290),u=r(249),d=r(9754),l=r(9813),p=r(2529),f=l("iterator"),h=!1;[].keys&&("next"in(o=[].keys())?(i=u(u(o)))!==Object.prototype&&(n=i):h=!0),null==n||a((function(){var e={};return n[f].call(e)!==e}))?n={}:p&&(n=c(n)),s(n[f])||d(n,f,(function(){return this})),e.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:h}},2077:function(e){e.exports={}},623:function(e,t,r){var n=r(3057);e.exports=function(e){return n(e.length)}},6132:function(e,t,r){var n,i,o,a,s,c,u,d,l=r(1899),p=r(6843),f=r(9677).f,h=r(2941).set,A=r(2749),v=r(4470),g=r(8045),m=r(6049),E=l.MutationObserver||l.WebKitMutationObserver,_=l.document,y=l.process,I=l.Promise,S=f(l,"queueMicrotask"),b=S&&S.value;b||(n=function(){var e,t;for(m&&(e=y.domain)&&e.exit();i;){t=i.fn,i=i.next;try{t()}catch(e){throw i?a():o=void 0,e}}o=void 0,e&&e.enter()},A||m||g||!E||!_?!v&&I&&I.resolve?((u=I.resolve(void 0)).constructor=I,d=p(u.then,u),a=function(){d(n)}):m?a=function(){y.nextTick(n)}:(h=p(h,l),a=function(){h(n)}):(s=!0,c=_.createTextNode(""),new E(n).observe(c,{characterData:!0}),a=function(){c.data=s=!s})),e.exports=b||function(e){var t={fn:e,next:void 0};o&&(o.next=t),i||(i=t,a()),o=t}},9297:function(e,t,r){var n=r(1899);e.exports=n.Promise},2497:function(e,t,r){var n=r(3385),i=r(5981);e.exports=!!Object.getOwnPropertySymbols&&!i((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},8019:function(e,t,r){var n=r(1899),i=r(7475),o=r(1302),a=n.WeakMap;e.exports=i(a)&&/native code/.test(o(a))},9520:function(e,t,r){var n=r(4883),i=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n})),this.resolve=n(t),this.reject=n(r)};e.exports.f=function(e){return new i(e)}},4649:function(e,t,r){var n=r(5803);e.exports=function(e,t){return void 0===e?arguments.length<2?"":t:n(e)}},9290:function(e,t,r){var n,i=r(6059),o=r(9938),a=r(6759),s=r(7748),c=r(5463),u=r(1333),d=r(4262)("IE_PROTO"),l=function(){},p=function(e){return"<script>"+e+"<\/script>"},f=function(e){e.write(p("")),e.close();var t=e.parentWindow.Object;return e=null,t},h=function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){try{n=new ActiveXObject("htmlfile")}catch(e){}var e,t;h="undefined"!=typeof document?document.domain&&n?f(n):((t=u("iframe")).style.display="none",c.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(p("document.F=Object")),e.close(),e.F):f(n);for(var r=a.length;r--;)delete h.prototype[a[r]];return h()}));s[d]=!0,e.exports=Object.create||function(e,t){var r;return null!==e?(l.prototype=i(e),r=new l,l.prototype=null,r[d]=e):r=h(),void 0===t?r:o.f(r,t)}},9938:function(e,t,r){var n=r(5746),i=r(3937),o=r(5988),a=r(6059),s=r(4529),c=r(4771);t.f=n&&!i?Object.defineProperties:function(e,t){a(e);for(var r,n=s(t),i=c(t),u=i.length,d=0;u>d;)o.f(e,r=i[d++],n[r]);return e}},5988:function(e,t,r){var n=r(1899),i=r(5746),o=r(2840),a=r(3937),s=r(6059),c=r(3894),u=n.TypeError,d=Object.defineProperty,l=Object.getOwnPropertyDescriptor;t.f=i?a?function(e,t,r){if(s(e),t=c(t),s(r),"function"==typeof e&&"prototype"===t&&"value"in r&&"writable"in r&&!r.writable){var n=l(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:"configurable"in r?r.configurable:n.configurable,enumerable:"enumerable"in r?r.enumerable:n.enumerable,writable:!1})}return d(e,t,r)}:d:function(e,t,r){if(s(e),t=c(t),s(r),o)try{return d(e,t,r)}catch(e){}if("get"in r||"set"in r)throw u("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},9677:function(e,t,r){var n=r(5746),i=r(8834),o=r(6760),a=r(1887),s=r(4529),c=r(3894),u=r(953),d=r(2840),l=Object.getOwnPropertyDescriptor;t.f=n?l:function(e,t){if(e=s(e),t=c(t),d)try{return l(e,t)}catch(e){}if(u(e,t))return a(!i(o.f,e,t),e[t])}},946:function(e,t,r){var n=r(5629),i=r(6759).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return n(e,i)}},7857:function(e,t){t.f=Object.getOwnPropertySymbols},249:function(e,t,r){var n=r(1899),i=r(953),o=r(7475),a=r(9678),s=r(4262),c=r(4160),u=s("IE_PROTO"),d=n.Object,l=d.prototype;e.exports=c?d.getPrototypeOf:function(e){var t=a(e);if(i(t,u))return t[u];var r=t.constructor;return o(r)&&t instanceof r?r.prototype:t instanceof d?l:null}},7046:function(e,t,r){var n=r(5329);e.exports=n({}.isPrototypeOf)},5629:function(e,t,r){var n=r(5329),i=r(953),o=r(4529),a=r(1692).indexOf,s=r(7748),c=n([].push);e.exports=function(e,t){var r,n=o(e),u=0,d=[];for(r in n)!i(s,r)&&i(n,r)&&c(d,r);for(;t.length>u;)i(n,r=t[u++])&&(~a(d,r)||c(d,r));return d}},4771:function(e,t,r){var n=r(5629),i=r(6759);e.exports=Object.keys||function(e){return n(e,i)}},6760:function(e,t){var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,i=n&&!r.call({1:2},1);t.f=i?function(e){var t=n(this,e);return!!t&&t.enumerable}:r},8929:function(e,t,r){var n=r(5329),i=r(6059),o=r(1851);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=n(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return i(r),o(n),t?e(r,n):r.__proto__=n,r}}():void 0)},5623:function(e,t,r){var n=r(2885),i=r(9697);e.exports=n?{}.toString:function(){return"[object "+i(this)+"]"}},9811:function(e,t,r){var n=r(1899),i=r(8834),o=r(7475),a=r(941),s=n.TypeError;e.exports=function(e,t){var r,n;if("string"===t&&o(r=e.toString)&&!a(n=i(r,e)))return n;if(o(r=e.valueOf)&&!a(n=i(r,e)))return n;if("string"!==t&&o(r=e.toString)&&!a(n=i(r,e)))return n;throw s("Can't convert object to primitive value")}},1136:function(e,t,r){var n=r(626),i=r(5329),o=r(946),a=r(7857),s=r(6059),c=i([].concat);e.exports=n("Reflect","ownKeys")||function(e){var t=o.f(s(e)),r=a.f;return r?c(t,r(e)):t}},4058:function(e){e.exports={}},2:function(e){e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},6584:function(e,t,r){var n=r(6059),i=r(941),o=r(9520);e.exports=function(e,t){if(n(e),i(t)&&t.constructor===e)return t;var r=o.f(e);return(0,r.resolve)(t),r.promise}},8397:function(e){var t=function(){this.head=null,this.tail=null};t.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}},e.exports=t},7524:function(e,t,r){var n=r(9754);e.exports=function(e,t,r){for(var i in t)r&&r.unsafe&&e[i]?e[i]=t[i]:n(e,i,t[i],r);return e}},9754:function(e,t,r){var n=r(2029);e.exports=function(e,t,r,i){i&&i.enumerable?e[t]=r:n(e,t,r)}},8219:function(e,t,r){var n=r(1899).TypeError;e.exports=function(e){if(null==e)throw n("Can't call method on "+e);return e}},4911:function(e,t,r){var n=r(1899),i=Object.defineProperty;e.exports=function(e,t){try{i(n,e,{value:t,configurable:!0,writable:!0})}catch(r){n[e]=t}return t}},4431:function(e,t,r){var n=r(626),i=r(5988),o=r(9813),a=r(5746),s=o("species");e.exports=function(e){var t=n(e),r=i.f;a&&t&&!t[s]&&r(t,s,{configurable:!0,get:function(){return this}})}},904:function(e,t,r){var n=r(2885),i=r(5988).f,o=r(2029),a=r(953),s=r(5623),c=r(9813)("toStringTag");e.exports=function(e,t,r,u){if(e){var d=r?e:e.prototype;a(d,c)||i(d,c,{configurable:!0,value:t}),u&&!n&&o(d,"toString",s)}}},4262:function(e,t,r){var n=r(8726),i=r(9418),o=n("keys");e.exports=function(e){return o[e]||(o[e]=i(e))}},3030:function(e,t,r){var n=r(1899),i=r(4911),o="__core-js_shared__",a=n[o]||i(o,{});e.exports=a},8726:function(e,t,r){var n=r(2529),i=r(3030);(e.exports=function(e,t){return i[e]||(i[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.20.3",mode:n?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.20.3/LICENSE",source:"https://github.com/zloirock/core-js"})},487:function(e,t,r){var n=r(6059),i=r(174),o=r(9813)("species");e.exports=function(e,t){var r,a=n(e).constructor;return void 0===a||null==(r=n(a)[o])?t:i(r)}},4620:function(e,t,r){var n=r(5329),i=r(2435),o=r(5803),a=r(8219),s=n("".charAt),c=n("".charCodeAt),u=n("".slice),d=function(e){return function(t,r){var n,d,l=o(a(t)),p=i(r),f=l.length;return p<0||p>=f?e?"":void 0:(n=c(l,p))<55296||n>56319||p+1===f||(d=c(l,p+1))<56320||d>57343?e?s(l,p):n:e?u(l,p,p+2):d-56320+(n-55296<<10)+65536}};e.exports={codeAt:d(!1),charAt:d(!0)}},2941:function(e,t,r){var n,i,o,a,s=r(1899),c=r(9730),u=r(6843),d=r(7475),l=r(953),p=r(5981),f=r(5463),h=r(3765),A=r(1333),v=r(2749),g=r(6049),m=s.setImmediate,E=s.clearImmediate,_=s.process,y=s.Dispatch,I=s.Function,S=s.MessageChannel,b=s.String,C=0,w={};try{n=s.location}catch(e){}var R=function(e){if(l(w,e)){var t=w[e];delete w[e],t()}},T=function(e){return function(){R(e)}},k=function(e){R(e.data)},O=function(e){s.postMessage(b(e),n.protocol+"//"+n.host)};m&&E||(m=function(e){var t=h(arguments,1);return w[++C]=function(){c(d(e)?e:I(e),void 0,t)},i(C),C},E=function(e){delete w[e]},g?i=function(e){_.nextTick(T(e))}:y&&y.now?i=function(e){y.now(T(e))}:S&&!v?(a=(o=new S).port2,o.port1.onmessage=k,i=u(a.postMessage,a)):s.addEventListener&&d(s.postMessage)&&!s.importScripts&&n&&"file:"!==n.protocol&&!p(O)?(i=O,s.addEventListener("message",k,!1)):i="onreadystatechange"in A("script")?function(e){f.appendChild(A("script")).onreadystatechange=function(){f.removeChild(this),R(e)}}:function(e){setTimeout(T(e),0)}),e.exports={set:m,clear:E}},9413:function(e,t,r){var n=r(2435),i=Math.max,o=Math.min;e.exports=function(e,t){var r=n(e);return r<0?i(r+t,0):o(r,t)}},4529:function(e,t,r){var n=r(7026),i=r(8219);e.exports=function(e){return n(i(e))}},2435:function(e){var t=Math.ceil,r=Math.floor;e.exports=function(e){var n=+e;return n!=n||0===n?0:(n>0?r:t)(n)}},3057:function(e,t,r){var n=r(2435),i=Math.min;e.exports=function(e){return e>0?i(n(e),9007199254740991):0}},9678:function(e,t,r){var n=r(1899),i=r(8219),o=n.Object;e.exports=function(e){return o(i(e))}},6935:function(e,t,r){var n=r(1899),i=r(8834),o=r(941),a=r(6664),s=r(4229),c=r(9811),u=r(9813),d=n.TypeError,l=u("toPrimitive");e.exports=function(e,t){if(!o(e)||a(e))return e;var r,n=s(e,l);if(n){if(void 0===t&&(t="default"),r=i(n,e,t),!o(r)||a(r))return r;throw d("Can't convert object to primitive value")}return void 0===t&&(t="number"),c(e,t)}},3894:function(e,t,r){var n=r(6935),i=r(6664);e.exports=function(e){var t=n(e,"string");return i(t)?t:t+""}},2885:function(e,t,r){var n={};n[r(9813)("toStringTag")]="z",e.exports="[object z]"===String(n)},5803:function(e,t,r){var n=r(1899),i=r(9697),o=n.String;e.exports=function(e){if("Symbol"===i(e))throw TypeError("Cannot convert a Symbol value to a string");return o(e)}},9826:function(e,t,r){var n=r(1899).String;e.exports=function(e){try{return n(e)}catch(e){return"Object"}}},9418:function(e,t,r){var n=r(5329),i=0,o=Math.random(),a=n(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++i+o,36)}},2302:function(e,t,r){var n=r(2497);e.exports=n&&!Symbol.sham&&"symbol"==D(Symbol.iterator)},3937:function(e,t,r){var n=r(5746),i=r(5981);e.exports=n&&i((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},9813:function(e,t,r){var n=r(1899),i=r(8726),o=r(953),a=r(9418),s=r(2497),c=r(2302),u=i("wks"),d=n.Symbol,l=d&&d.for,p=c?d:d&&d.withoutSetter||a;e.exports=function(e){if(!o(u,e)||!s&&"string"!=typeof u[e]){var t="Symbol."+e;s&&o(d,e)?u[e]=d[e]:u[e]=c&&l?l(t):p(t)}return u[e]}},7627:function(e,t,r){var n=r(6887),i=r(1899),o=r(7046),a=r(249),s=r(8929),c=r(3489),u=r(9290),d=r(2029),l=r(1887),p=r(8694),f=r(3794),h=r(3091),A=r(4649),v=r(9813),g=r(8780),m=v("toStringTag"),E=i.Error,_=[].push,y=function(e,t){var r,n=arguments.length>2?arguments[2]:void 0,i=o(I,this);s?r=s(new E,i?a(this):I):(r=i?this:u(I),d(r,m,"Error")),void 0!==t&&d(r,"message",A(t)),g&&d(r,"stack",p(r.stack,1)),f(r,n);var c=[];return h(e,_,{that:c}),d(r,"errors",c),r};s?s(y,E):c(y,E,{name:!0});var I=y.prototype=u(E.prototype,{constructor:l(1,y),message:l(1,""),name:l(1,"AggregateError")});n({global:!0},{AggregateError:y})},6274:function(e,t,r){var n=r(4529),i=r(8479),o=r(2077),a=r(5402),s=r(5988).f,c=r(7771),u=r(2529),d=r(5746),l="Array Iterator",p=a.set,f=a.getterFor(l);e.exports=c(Array,"Array",(function(e,t){p(this,{type:l,target:n(e),index:0,kind:t})}),(function(){var e=f(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:t[n],done:!1}:{value:[n,t[n]],done:!1}}),"values");var h=o.Arguments=o.Array;if(i("keys"),i("values"),i("entries"),!u&&d&&"values"!==h.name)try{s(h,"name",{value:"values"})}catch(e){}},6450:function(e,t,r){var n=r(6887),i=r(5746),o=r(5988).f;n({target:"Object",stat:!0,forced:Object.defineProperty!==o,sham:!i},{defineProperty:o})},5967:function(){},4560:function(e,t,r){var n=r(6887),i=r(8834),o=r(4883),a=r(9520),s=r(2),c=r(3091);n({target:"Promise",stat:!0},{allSettled:function(e){var t=this,r=a.f(t),n=r.resolve,u=r.reject,d=s((function(){var r=o(t.resolve),a=[],s=0,u=1;c(e,(function(e){var o=s++,c=!1;u++,i(r,t,e).then((function(e){c||(c=!0,a[o]={status:"fulfilled",value:e},--u||n(a))}),(function(e){c||(c=!0,a[o]={status:"rejected",reason:e},--u||n(a))}))})),--u||n(a)}));return d.error&&u(d.value),r.promise}})},7206:function(e,t,r){var n=r(6887),i=r(4883),o=r(626),a=r(8834),s=r(9520),c=r(2),u=r(3091),d="No one promise resolved";n({target:"Promise",stat:!0},{any:function(e){var t=this,r=o("AggregateError"),n=s.f(t),l=n.resolve,p=n.reject,f=c((function(){var n=i(t.resolve),o=[],s=0,c=1,f=!1;u(e,(function(e){var i=s++,u=!1;c++,a(n,t,e).then((function(e){u||f||(f=!0,l(e))}),(function(e){u||f||(u=!0,o[i]=e,--c||p(new r(o,d)))}))})),--c||p(new r(o,d))}));return f.error&&p(f.value),n.promise}})},4349:function(e,t,r){var n=r(6887),i=r(2529),o=r(9297),a=r(5981),s=r(626),c=r(7475),u=r(487),d=r(6584),l=r(9754);if(n({target:"Promise",proto:!0,real:!0,forced:!!o&&a((function(){o.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=u(this,s("Promise")),r=c(e);return this.then(r?function(r){return d(t,e()).then((function(){return r}))}:e,r?function(r){return d(t,e()).then((function(){throw r}))}:e)}}),!i&&c(o)){var p=s("Promise").prototype.finally;o.prototype.finally!==p&&l(o.prototype,"finally",p,{unsafe:!0})}},8881:function(e,t,r){var n,i,o,a,s=r(6887),c=r(2529),u=r(1899),d=r(626),l=r(8834),p=r(9297),f=r(9754),h=r(7524),A=r(8929),v=r(904),g=r(4431),m=r(4883),E=r(7475),_=r(941),y=r(5743),I=r(1302),S=r(3091),b=r(1385),C=r(487),w=r(2941).set,R=r(6132),T=r(6584),k=r(4845),O=r(9520),D=r(2),N=r(8397),x=r(5402),P=r(7252),L=r(9813),B=r(3321),M=r(6049),U=r(3385),Q=L("species"),F="Promise",j=x.getterFor(F),V=x.set,G=x.getterFor(F),K=p&&p.prototype,H=p,W=K,Y=u.TypeError,q=u.document,J=u.process,z=O.f,X=z,Z=!!(q&&q.createEvent&&u.dispatchEvent),$=E(u.PromiseRejectionEvent),ee="unhandledrejection",te=!1,re=P(F,(function(){var e=I(H),t=e!==String(H);if(!t&&66===U)return!0;if(c&&!W.finally)return!0;if(U>=51&&/native code/.test(e))return!1;var r=new H((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};return(r.constructor={})[Q]=n,!(te=r.then((function(){}))instanceof n)||!t&&B&&!$})),ne=re||!b((function(e){H.all(e).catch((function(){}))})),ie=function(e){var t;return!(!_(e)||!E(t=e.then))&&t},oe=function(e,t){var r,n,i,o=t.value,a=1==t.state,s=a?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&de(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?u(Y("Promise-chain cycle")):(n=ie(r))?l(n,r,c,u):c(r)):u(o)}catch(e){d&&!i&&d.exit(),u(e)}},ae=function(e,t){e.notified||(e.notified=!0,R((function(){for(var r,n=e.reactions;r=n.get();)oe(r,e);e.notified=!1,t&&!e.rejection&&ce(e)})))},se=function(e,t,r){var n,i;Z?((n=q.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),u.dispatchEvent(n)):n={promise:t,reason:r},!$&&(i=u["on"+e])?i(n):e===ee&&k("Unhandled promise rejection",r)},ce=function(e){l(w,u,(function(){var t,r=e.facade,n=e.value;if(ue(e)&&(t=D((function(){M?J.emit("unhandledRejection",n,r):se(ee,r,n)})),e.rejection=M||ue(e)?2:1,t.error))throw t.value}))},ue=function(e){return 1!==e.rejection&&!e.parent},de=function(e){l(w,u,(function(){var t=e.facade;M?J.emit("rejectionHandled",t):se("rejectionhandled",t,e.value)}))},le=function(e,t,r){return function(n){e(t,n,r)}},pe=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,ae(e,!0))},fe=function e(t,r,n){if(!t.done){t.done=!0,n&&(t=n);try{if(t.facade===r)throw Y("Promise can't be resolved itself");var i=ie(r);i?R((function(){var n={done:!1};try{l(i,r,le(e,n,t),le(pe,n,t))}catch(e){pe(n,e,t)}})):(t.value=r,t.state=1,ae(t,!1))}catch(r){pe({done:!1},r,t)}}};if(re&&(W=(H=function(e){y(this,W),m(e),l(n,this);var t=j(this);try{e(le(fe,t),le(pe,t))}catch(e){pe(t,e)}}).prototype,(n=function(e){V(this,{type:F,done:!1,notified:!1,parent:!1,reactions:new N,rejection:!1,state:0,value:void 0})}).prototype=h(W,{then:function(e,t){var r=G(this),n=z(C(this,H));return r.parent=!0,n.ok=!E(e)||e,n.fail=E(t)&&t,n.domain=M?J.domain:void 0,0==r.state?r.reactions.add(n):R((function(){oe(n,r)})),n.promise},catch:function(e){return this.then(void 0,e)}}),i=function(){var e=new n,t=j(e);this.promise=e,this.resolve=le(fe,t),this.reject=le(pe,t)},O.f=z=function(e){return e===H||e===o?new i(e):X(e)},!c&&E(p)&&K!==Object.prototype)){a=K.then,te||(f(K,"then",(function(e,t){var r=this;return new H((function(e,t){l(a,r,e,t)})).then(e,t)}),{unsafe:!0}),f(K,"catch",W.catch,{unsafe:!0}));try{delete K.constructor}catch(e){}A&&A(K,W)}s({global:!0,wrap:!0,forced:re},{Promise:H}),v(H,F,!1,!0),g(F),o=d(F),s({target:F,stat:!0,forced:re},{reject:function(e){var t=z(this);return l(t.reject,void 0,e),t.promise}}),s({target:F,stat:!0,forced:c||re},{resolve:function(e){return T(c&&this===o?H:this,e)}}),s({target:F,stat:!0,forced:ne},{all:function(e){var t=this,r=z(t),n=r.resolve,i=r.reject,o=D((function(){var r=m(t.resolve),o=[],a=0,s=1;S(e,(function(e){var c=a++,u=!1;s++,l(r,t,e).then((function(e){u||(u=!0,o[c]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise},race:function(e){var t=this,r=z(t),n=r.reject,i=D((function(){var i=m(t.resolve);S(e,(function(e){l(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}})},7971:function(e,t,r){var n=r(4620).charAt,i=r(5803),o=r(5402),a=r(7771),s="String Iterator",c=o.set,u=o.getterFor(s);a(String,"String",(function(e){c(this,{type:s,string:i(e),index:0})}),(function(){var e,t=u(this),r=t.string,i=t.index;return i>=r.length?{value:void 0,done:!0}:(e=n(r,i),t.index+=e.length,{value:e,done:!1})}))},7634:function(e,t,r){r(6274);var n=r(3281),i=r(1899),o=r(9697),a=r(2029),s=r(2077),c=r(9813)("toStringTag");for(var u in n){var d=i[u],l=d&&d.prototype;l&&o(l)!==c&&a(l,c,u),s[u]=s.Array}},1910:function(e,t,r){var n=r(8171);e.exports=n},7460:function(e,t,r){var n=r(2956);r(7634),e.exports=n},9662:function(e,t,r){var n=r(7854),i=r(614),o=r(6330),a=n.TypeError;e.exports=function(e){if(i(e))return e;throw a(o(e)+" is not a function")}},6077:function(e,t,r){var n=r(7854),i=r(614),o=n.String,a=n.TypeError;e.exports=function(e){if("object"==D(e)||i(e))return e;throw a("Can't set "+o(e)+" as a prototype")}},1223:function(e,t,r){var n=r(5112),i=r(30),o=r(3070),a=n("unscopables"),s=Array.prototype;null==s[a]&&o.f(s,a,{configurable:!0,value:i(null)}),e.exports=function(e){s[a][e]=!0}},9670:function(e,t,r){var n=r(7854),i=r(111),o=n.String,a=n.TypeError;e.exports=function(e){if(i(e))return e;throw a(o(e)+" is not an object")}},1318:function(e,t,r){var n=r(5656),i=r(1400),o=r(6244),a=function(e){return function(t,r,a){var s,c=n(t),u=o(c),d=i(a,u);if(e&&r!=r){for(;u>d;)if((s=c[d++])!=s)return!0}else for(;u>d;d++)if((e||d in c)&&c[d]===r)return e||d||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},4326:function(e,t,r){var n=r(1702),i=n({}.toString),o=n("".slice);e.exports=function(e){return o(i(e),8,-1)}},648:function(e,t,r){var n=r(7854),i=r(1694),o=r(614),a=r(4326),s=r(5112)("toStringTag"),c=n.Object,u="Arguments"==a(function(){return arguments}());e.exports=i?a:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=c(e),s))?r:u?a(t):"Object"==(n=a(t))&&o(t.callee)?"Arguments":n}},7741:function(e,t,r){var n=r(1702)("".replace),i=String(Error("zxcasd").stack),o=/\n\s*at [^:]*:[^\n]*/,a=o.test(i);e.exports=function(e,t){if(a&&"string"==typeof e)for(;t--;)e=n(e,o,"");return e}},9920:function(e,t,r){var n=r(2597),i=r(3887),o=r(1236),a=r(3070);e.exports=function(e,t,r){for(var s=i(t),c=a.f,u=o.f,d=0;d<s.length;d++){var l=s[d];n(e,l)||r&&n(r,l)||c(e,l,u(t,l))}}},8544:function(e,t,r){var n=r(7293);e.exports=!n((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},4994:function(e,t,r){var n=r(3383).IteratorPrototype,i=r(30),o=r(9114),a=r(8003),s=r(7497),c=function(){return this};e.exports=function(e,t,r,u){var d=t+" Iterator";return e.prototype=i(n,{next:o(+!u,r)}),a(e,d,!1,!0),s[d]=c,e}},8880:function(e,t,r){var n=r(9781),i=r(3070),o=r(9114);e.exports=n?function(e,t,r){return i.f(e,t,o(1,r))}:function(e,t,r){return e[t]=r,e}},9114:function(e){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},654:function(e,t,r){var n=r(2109),i=r(6916),o=r(1913),a=r(6530),s=r(614),c=r(4994),u=r(9518),d=r(7674),l=r(8003),p=r(8880),f=r(1320),h=r(5112),A=r(7497),v=r(3383),g=a.PROPER,m=a.CONFIGURABLE,E=v.IteratorPrototype,_=v.BUGGY_SAFARI_ITERATORS,y=h("iterator"),I="keys",S="values",b="entries",C=function(){return this};e.exports=function(e,t,r,a,h,v,w){c(r,t,a);var R,T,k,O=function(e){if(e===h&&L)return L;if(!_&&e in x)return x[e];switch(e){case I:case S:case b:return function(){return new r(this,e)}}return function(){return new r(this)}},D=t+" Iterator",N=!1,x=e.prototype,P=x[y]||x["@@iterator"]||h&&x[h],L=!_&&P||O(h),B="Array"==t&&x.entries||P;if(B&&(R=u(B.call(new e)))!==Object.prototype&&R.next&&(o||u(R)===E||(d?d(R,E):s(R[y])||f(R,y,C)),l(R,D,!0,!0),o&&(A[D]=C)),g&&h==S&&P&&P.name!==S&&(!o&&m?p(x,"name",S):(N=!0,L=function(){return i(P,this)})),h)if(T={values:O(S),keys:v?L:O(I),entries:O(b)},w)for(k in T)(_||N||!(k in x))&&f(x,k,T[k]);else n({target:t,proto:!0,forced:_||N},T);return o&&!w||x[y]===L||f(x,y,L,{name:h}),A[t]=L,T}},9781:function(e,t,r){var n=r(7293);e.exports=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},317:function(e,t,r){var n=r(7854),i=r(111),o=n.document,a=i(o)&&i(o.createElement);e.exports=function(e){return a?o.createElement(e):{}}},8324:function(e){e.exports={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}},8509:function(e,t,r){var n=r(317)("span").classList,i=n&&n.constructor&&n.constructor.prototype;e.exports=i===Object.prototype?void 0:i},8113:function(e,t,r){var n=r(5005);e.exports=n("navigator","userAgent")||""},7392:function(e,t,r){var n,i,o=r(7854),a=r(8113),s=o.process,c=o.Deno,u=s&&s.versions||c&&c.version,d=u&&u.v8;d&&(i=(n=d.split("."))[0]>0&&n[0]<4?1:+(n[0]+n[1])),!i&&a&&(!(n=a.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=a.match(/Chrome\/(\d+)/))&&(i=+n[1]),e.exports=i},748:function(e){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2914:function(e,t,r){var n=r(7293),i=r(9114);e.exports=!n((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",i(1,7)),7!==e.stack)}))},2109:function(e,t,r){var n=r(7854),i=r(1236).f,o=r(8880),a=r(1320),s=r(3505),c=r(9920),u=r(4705);e.exports=function(e,t){var r,d,l,p,f,h=e.target,A=e.global,v=e.stat;if(r=A?n:v?n[h]||s(h,{}):(n[h]||{}).prototype)for(d in t){if(p=t[d],l=e.noTargetGet?(f=i(r,d))&&f.value:r[d],!u(A?d:h+(v?".":"#")+d,e.forced)&&void 0!==l){if(D(p)==D(l))continue;c(p,l)}(e.sham||l&&l.sham)&&o(p,"sham",!0),a(r,d,p,e)}}},7293:function(e){e.exports=function(e){try{return!!e()}catch(e){return!0}}},2104:function(e,t,r){var n=r(4374),i=Function.prototype,o=i.apply,a=i.call;e.exports="object"==("undefined"==typeof Reflect?"undefined":D(Reflect))&&Reflect.apply||(n?a.bind(o):function(){return a.apply(o,arguments)})},4374:function(e,t,r){var n=r(7293);e.exports=!n((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},6916:function(e,t,r){var n=r(4374),i=Function.prototype.call;e.exports=n?i.bind(i):function(){return i.apply(i,arguments)}},6530:function(e,t,r){var n=r(9781),i=r(2597),o=Function.prototype,a=n&&Object.getOwnPropertyDescriptor,s=i(o,"name"),c=s&&"something"===function(){}.name,u=s&&(!n||n&&a(o,"name").configurable);e.exports={EXISTS:s,PROPER:c,CONFIGURABLE:u}},1702:function(e,t,r){var n=r(4374),i=Function.prototype,o=i.bind,a=i.call,s=n&&o.bind(a,a);e.exports=n?function(e){return e&&s(e)}:function(e){return e&&function(){return a.apply(e,arguments)}}},5005:function(e,t,r){var n=r(7854),i=r(614),o=function(e){return i(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?o(n[e]):n[e]&&n[e][t]}},8173:function(e,t,r){var n=r(9662);e.exports=function(e,t){var r=e[t];return null==r?void 0:n(r)}},7854:function(e,t,r){var n=function(e){return e&&e.Math==Math&&e};e.exports=n("object"==("undefined"==typeof globalThis?"undefined":D(globalThis))&&globalThis)||n("object"==("undefined"==typeof window?"undefined":D(window))&&window)||n("object"==("undefined"==typeof self?"undefined":D(self))&&self)||n("object"==D(r.g)&&r.g)||function(){return this}()||Function("return this")()},2597:function(e,t,r){var n=r(1702),i=r(7908),o=n({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(i(e),t)}},3501:function(e){e.exports={}},490:function(e,t,r){var n=r(5005);e.exports=n("document","documentElement")},4664:function(e,t,r){var n=r(9781),i=r(7293),o=r(317);e.exports=!n&&!i((function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},8361:function(e,t,r){var n=r(7854),i=r(1702),o=r(7293),a=r(4326),s=n.Object,c=i("".split);e.exports=o((function(){return!s("z").propertyIsEnumerable(0)}))?function(e){return"String"==a(e)?c(e,""):s(e)}:s},9587:function(e,t,r){var n=r(614),i=r(111),o=r(7674);e.exports=function(e,t,r){var a,s;return o&&n(a=t.constructor)&&a!==r&&i(s=a.prototype)&&s!==r.prototype&&o(e,s),e}},2788:function(e,t,r){var n=r(1702),i=r(614),o=r(5465),a=n(Function.toString);i(o.inspectSource)||(o.inspectSource=function(e){return a(e)}),e.exports=o.inspectSource},8340:function(e,t,r){var n=r(111),i=r(8880);e.exports=function(e,t){n(t)&&"cause"in t&&i(e,"cause",t.cause)}},9909:function(e,t,r){var n,i,o,a=r(8536),s=r(7854),c=r(1702),u=r(111),d=r(8880),l=r(2597),p=r(5465),f=r(6200),h=r(3501),A="Object already initialized",v=s.TypeError,g=s.WeakMap;if(a||p.state){var m=p.state||(p.state=new g),E=c(m.get),_=c(m.has),y=c(m.set);n=function(e,t){if(_(m,e))throw new v(A);return t.facade=e,y(m,e,t),t},i=function(e){return E(m,e)||{}},o=function(e){return _(m,e)}}else{var I=f("state");h[I]=!0,n=function(e,t){if(l(e,I))throw new v(A);return t.facade=e,d(e,I,t),t},i=function(e){return l(e,I)?e[I]:{}},o=function(e){return l(e,I)}}e.exports={set:n,get:i,has:o,enforce:function(e){return o(e)?i(e):n(e,{})},getterFor:function(e){return function(t){var r;if(!u(t)||(r=i(t)).type!==e)throw v("Incompatible receiver, "+e+" required");return r}}}},614:function(e){e.exports=function(e){return"function"==typeof e}},4705:function(e,t,r){var n=r(7293),i=r(614),o=/#|\.prototype\./,a=function(e,t){var r=c[s(e)];return r==d||r!=u&&(i(t)?n(t):!!t)},s=a.normalize=function(e){return String(e).replace(o,".").toLowerCase()},c=a.data={},u=a.NATIVE="N",d=a.POLYFILL="P";e.exports=a},111:function(e,t,r){var n=r(614);e.exports=function(e){return"object"==D(e)?null!==e:n(e)}},1913:function(e){e.exports=!1},2190:function(e,t,r){var n=r(7854),i=r(5005),o=r(614),a=r(7976),s=r(3307),c=n.Object;e.exports=s?function(e){return"symbol"==D(e)}:function(e){var t=i("Symbol");return o(t)&&a(t.prototype,c(e))}},3383:function(e,t,r){var n,i,o,a=r(7293),s=r(614),c=r(30),u=r(9518),d=r(1320),l=r(5112),p=r(1913),f=l("iterator"),h=!1;[].keys&&("next"in(o=[].keys())?(i=u(u(o)))!==Object.prototype&&(n=i):h=!0),null==n||a((function(){var e={};return n[f].call(e)!==e}))?n={}:p&&(n=c(n)),s(n[f])||d(n,f,(function(){return this})),e.exports={IteratorPrototype:n,BUGGY_SAFARI_ITERATORS:h}},7497:function(e){e.exports={}},6244:function(e,t,r){var n=r(7466);e.exports=function(e){return n(e.length)}},133:function(e,t,r){var n=r(7392),i=r(7293);e.exports=!!Object.getOwnPropertySymbols&&!i((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},8536:function(e,t,r){var n=r(7854),i=r(614),o=r(2788),a=n.WeakMap;e.exports=i(a)&&/native code/.test(o(a))},6277:function(e,t,r){var n=r(1340);e.exports=function(e,t){return void 0===e?arguments.length<2?"":t:n(e)}},30:function(e,t,r){var n,i=r(9670),o=r(6048),a=r(748),s=r(3501),c=r(490),u=r(317),d=r(6200)("IE_PROTO"),l=function(){},p=function(e){return"<script>"+e+"<\/script>"},f=function(e){e.write(p("")),e.close();var t=e.parentWindow.Object;return e=null,t},h=function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(){try{n=new ActiveXObject("htmlfile")}catch(e){}var e,t;h="undefined"!=typeof document?document.domain&&n?f(n):((t=u("iframe")).style.display="none",c.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(p("document.F=Object")),e.close(),e.F):f(n);for(var r=a.length;r--;)delete h.prototype[a[r]];return h()}));s[d]=!0,e.exports=Object.create||function(e,t){var r;return null!==e?(l.prototype=i(e),r=new l,l.prototype=null,r[d]=e):r=h(),void 0===t?r:o.f(r,t)}},6048:function(e,t,r){var n=r(9781),i=r(3353),o=r(3070),a=r(9670),s=r(5656),c=r(1956);t.f=n&&!i?Object.defineProperties:function(e,t){a(e);for(var r,n=s(t),i=c(t),u=i.length,d=0;u>d;)o.f(e,r=i[d++],n[r]);return e}},3070:function(e,t,r){var n=r(7854),i=r(9781),o=r(4664),a=r(3353),s=r(9670),c=r(4948),u=n.TypeError,d=Object.defineProperty,l=Object.getOwnPropertyDescriptor;t.f=i?a?function(e,t,r){if(s(e),t=c(t),s(r),"function"==typeof e&&"prototype"===t&&"value"in r&&"writable"in r&&!r.writable){var n=l(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:"configurable"in r?r.configurable:n.configurable,enumerable:"enumerable"in r?r.enumerable:n.enumerable,writable:!1})}return d(e,t,r)}:d:function(e,t,r){if(s(e),t=c(t),s(r),o)try{return d(e,t,r)}catch(e){}if("get"in r||"set"in r)throw u("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},1236:function(e,t,r){var n=r(9781),i=r(6916),o=r(5296),a=r(9114),s=r(5656),c=r(4948),u=r(2597),d=r(4664),l=Object.getOwnPropertyDescriptor;t.f=n?l:function(e,t){if(e=s(e),t=c(t),d)try{return l(e,t)}catch(e){}if(u(e,t))return a(!i(o.f,e,t),e[t])}},8006:function(e,t,r){var n=r(6324),i=r(748).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return n(e,i)}},5181:function(e,t){t.f=Object.getOwnPropertySymbols},9518:function(e,t,r){var n=r(7854),i=r(2597),o=r(614),a=r(7908),s=r(6200),c=r(8544),u=s("IE_PROTO"),d=n.Object,l=d.prototype;e.exports=c?d.getPrototypeOf:function(e){var t=a(e);if(i(t,u))return t[u];var r=t.constructor;return o(r)&&t instanceof r?r.prototype:t instanceof d?l:null}},7976:function(e,t,r){var n=r(1702);e.exports=n({}.isPrototypeOf)},6324:function(e,t,r){var n=r(1702),i=r(2597),o=r(5656),a=r(1318).indexOf,s=r(3501),c=n([].push);e.exports=function(e,t){var r,n=o(e),u=0,d=[];for(r in n)!i(s,r)&&i(n,r)&&c(d,r);for(;t.length>u;)i(n,r=t[u++])&&(~a(d,r)||c(d,r));return d}},1956:function(e,t,r){var n=r(6324),i=r(748);e.exports=Object.keys||function(e){return n(e,i)}},5296:function(e,t){var r={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,i=n&&!r.call({1:2},1);t.f=i?function(e){var t=n(this,e);return!!t&&t.enumerable}:r},7674:function(e,t,r){var n=r(1702),i=r(9670),o=r(6077);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=n(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return i(r),o(n),t?e(r,n):r.__proto__=n,r}}():void 0)},2140:function(e,t,r){var n=r(7854),i=r(6916),o=r(614),a=r(111),s=n.TypeError;e.exports=function(e,t){var r,n;if("string"===t&&o(r=e.toString)&&!a(n=i(r,e)))return n;if(o(r=e.valueOf)&&!a(n=i(r,e)))return n;if("string"!==t&&o(r=e.toString)&&!a(n=i(r,e)))return n;throw s("Can't convert object to primitive value")}},3887:function(e,t,r){var n=r(5005),i=r(1702),o=r(8006),a=r(5181),s=r(9670),c=i([].concat);e.exports=n("Reflect","ownKeys")||function(e){var t=o.f(s(e)),r=a.f;return r?c(t,r(e)):t}},1320:function(e,t,r){var n=r(7854),i=r(614),o=r(2597),a=r(8880),s=r(3505),c=r(2788),u=r(9909),d=r(6530).CONFIGURABLE,l=u.get,p=u.enforce,f=String(String).split("String");(e.exports=function(e,t,r,c){var u,l=!!c&&!!c.unsafe,h=!!c&&!!c.enumerable,A=!!c&&!!c.noTargetGet,v=c&&void 0!==c.name?c.name:t;i(r)&&("Symbol("===String(v).slice(0,7)&&(v="["+String(v).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!o(r,"name")||d&&r.name!==v)&&a(r,"name",v),(u=p(r)).source||(u.source=f.join("string"==typeof v?v:""))),e!==n?(l?!A&&e[t]&&(h=!0):delete e[t],h?e[t]=r:a(e,t,r)):h?e[t]=r:s(t,r)})(Function.prototype,"toString",(function(){return i(this)&&l(this).source||c(this)}))},2261:function(e,t,r){var n,i,o=r(6916),a=r(1702),s=r(1340),c=r(7066),u=r(2999),d=r(2309),l=r(30),p=r(9909).get,f=r(9441),h=r(7168),A=d("native-string-replace",String.prototype.replace),v=RegExp.prototype.exec,g=v,m=a("".charAt),E=a("".indexOf),_=a("".replace),y=a("".slice),I=(i=/b*/g,o(v,n=/a/,"a"),o(v,i,"a"),0!==n.lastIndex||0!==i.lastIndex),S=u.BROKEN_CARET,b=void 0!==/()??/.exec("")[1];(I||b||S||f||h)&&(g=function(e){var t,r,n,i,a,u,d,f=this,h=p(f),C=s(e),w=h.raw;if(w)return w.lastIndex=f.lastIndex,t=o(g,w,C),f.lastIndex=w.lastIndex,t;var R=h.groups,T=S&&f.sticky,k=o(c,f),O=f.source,D=0,N=C;if(T&&(k=_(k,"y",""),-1===E(k,"g")&&(k+="g"),N=y(C,f.lastIndex),f.lastIndex>0&&(!f.multiline||f.multiline&&"\n"!==m(C,f.lastIndex-1))&&(O="(?: "+O+")",N=" "+N,D++),r=new RegExp("^(?:"+O+")",k)),b&&(r=new RegExp("^"+O+"$(?!\\s)",k)),I&&(n=f.lastIndex),i=o(v,T?r:f,N),T?i?(i.input=y(i.input,D),i[0]=y(i[0],D),i.index=f.lastIndex,f.lastIndex+=i[0].length):f.lastIndex=0:I&&i&&(f.lastIndex=f.global?i.index+i[0].length:n),b&&i&&i.length>1&&o(A,i[0],r,(function(){for(a=1;a<arguments.length-2;a++)void 0===arguments[a]&&(i[a]=void 0)})),i&&R)for(i.groups=u=l(null),a=0;a<R.length;a++)u[(d=R[a])[0]]=i[d[1]];return i}),e.exports=g},7066:function(e,t,r){var n=r(9670);e.exports=function(){var e=n(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},2999:function(e,t,r){var n=r(7293),i=r(7854).RegExp,o=n((function(){var e=i("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),a=o||n((function(){return!i("a","y").sticky})),s=o||n((function(){var e=i("^r","gy");return e.lastIndex=2,null!=e.exec("str")}));e.exports={BROKEN_CARET:s,MISSED_STICKY:a,UNSUPPORTED_Y:o}},9441:function(e,t,r){var n=r(7293),i=r(7854).RegExp;e.exports=n((function(){var e=i(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)}))},7168:function(e,t,r){var n=r(7293),i=r(7854).RegExp;e.exports=n((function(){var e=i("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")}))},4488:function(e,t,r){var n=r(7854).TypeError;e.exports=function(e){if(null==e)throw n("Can't call method on "+e);return e}},3505:function(e,t,r){var n=r(7854),i=Object.defineProperty;e.exports=function(e,t){try{i(n,e,{value:t,configurable:!0,writable:!0})}catch(r){n[e]=t}return t}},8003:function(e,t,r){var n=r(3070).f,i=r(2597),o=r(5112)("toStringTag");e.exports=function(e,t,r){e&&!r&&(e=e.prototype),e&&!i(e,o)&&n(e,o,{configurable:!0,value:t})}},6200:function(e,t,r){var n=r(2309),i=r(9711),o=n("keys");e.exports=function(e){return o[e]||(o[e]=i(e))}},5465:function(e,t,r){var n=r(7854),i=r(3505),o="__core-js_shared__",a=n[o]||i(o,{});e.exports=a},2309:function(e,t,r){var n=r(1913),i=r(5465);(e.exports=function(e,t){return i[e]||(i[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.20.3",mode:n?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.20.3/LICENSE",source:"https://github.com/zloirock/core-js"})},1400:function(e,t,r){var n=r(9303),i=Math.max,o=Math.min;e.exports=function(e,t){var r=n(e);return r<0?i(r+t,0):o(r,t)}},5656:function(e,t,r){var n=r(8361),i=r(4488);e.exports=function(e){return n(i(e))}},9303:function(e){var t=Math.ceil,r=Math.floor;e.exports=function(e){var n=+e;return n!=n||0===n?0:(n>0?r:t)(n)}},7466:function(e,t,r){var n=r(9303),i=Math.min;e.exports=function(e){return e>0?i(n(e),9007199254740991):0}},7908:function(e,t,r){var n=r(7854),i=r(4488),o=n.Object;e.exports=function(e){return o(i(e))}},7593:function(e,t,r){var n=r(7854),i=r(6916),o=r(111),a=r(2190),s=r(8173),c=r(2140),u=r(5112),d=n.TypeError,l=u("toPrimitive");e.exports=function(e,t){if(!o(e)||a(e))return e;var r,n=s(e,l);if(n){if(void 0===t&&(t="default"),r=i(n,e,t),!o(r)||a(r))return r;throw d("Can't convert object to primitive value")}return void 0===t&&(t="number"),c(e,t)}},4948:function(e,t,r){var n=r(7593),i=r(2190);e.exports=function(e){var t=n(e,"string");return i(t)?t:t+""}},1694:function(e,t,r){var n={};n[r(5112)("toStringTag")]="z",e.exports="[object z]"===String(n)},1340:function(e,t,r){var n=r(7854),i=r(648),o=n.String;e.exports=function(e){if("Symbol"===i(e))throw TypeError("Cannot convert a Symbol value to a string");return o(e)}},6330:function(e,t,r){var n=r(7854).String;e.exports=function(e){try{return n(e)}catch(e){return"Object"}}},9711:function(e,t,r){var n=r(1702),i=0,o=Math.random(),a=n(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+a(++i+o,36)}},3307:function(e,t,r){var n=r(133);e.exports=n&&!Symbol.sham&&"symbol"==D(Symbol.iterator)},3353:function(e,t,r){var n=r(9781),i=r(7293);e.exports=n&&i((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},5112:function(e,t,r){var n=r(7854),i=r(2309),o=r(2597),a=r(9711),s=r(133),c=r(3307),u=i("wks"),d=n.Symbol,l=d&&d.for,p=c?d:d&&d.withoutSetter||a;e.exports=function(e){if(!o(u,e)||!s&&"string"!=typeof u[e]){var t="Symbol."+e;s&&o(d,e)?u[e]=d[e]:u[e]=c&&l?l(t):p(t)}return u[e]}},9191:function(e,t,r){var n=r(5005),i=r(2597),o=r(8880),a=r(7976),s=r(7674),c=r(9920),u=r(9587),d=r(6277),l=r(8340),p=r(7741),f=r(2914),h=r(1913);e.exports=function(e,t,r,A){var v=A?2:1,g=e.split("."),m=g[g.length-1],E=n.apply(null,g);if(E){var _=E.prototype;if(!h&&i(_,"cause")&&delete _.cause,!r)return E;var y=n("Error"),I=t((function(e,t){var r=d(A?t:e,void 0),n=A?new E(e):new E;return void 0!==r&&o(n,"message",r),f&&o(n,"stack",p(n.stack,2)),this&&a(_,this)&&u(n,this,I),arguments.length>v&&l(n,arguments[v]),n}));if(I.prototype=_,"Error"!==m&&(s?s(I,y):c(I,y,{name:!0})),c(I,E),!h)try{_.name!==m&&o(_,"name",m),_.constructor=I}catch(e){}return I}}},6992:function(e,t,r){var n=r(5656),i=r(1223),o=r(7497),a=r(9909),s=r(3070).f,c=r(654),u=r(1913),d=r(9781),l="Array Iterator",p=a.set,f=a.getterFor(l);e.exports=c(Array,"Array",(function(e,t){p(this,{type:l,target:n(e),index:0,kind:t})}),(function(){var e=f(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:t[n],done:!1}:{value:[n,t[n]],done:!1}}),"values");var h=o.Arguments=o.Array;if(i("keys"),i("values"),i("entries"),!u&&d&&"values"!==h.name)try{s(h,"name",{value:"values"})}catch(e){}},1703:function(e,t,r){var n=r(2109),i=r(7854),o=r(2104),a=r(9191),s=i.WebAssembly,c=7!==Error("e",{cause:7}).cause,u=function(e,t){var r={};r[e]=a(e,t,c),n({global:!0,forced:c},r)},d=function(e,t){if(s&&s[e]){var r={};r[e]=a("WebAssembly."+e,t,c),n({target:"WebAssembly",stat:!0,forced:c},r)}};u("Error",(function(e){return function(t){return o(e,this,arguments)}})),u("EvalError",(function(e){return function(t){return o(e,this,arguments)}})),u("RangeError",(function(e){return function(t){return o(e,this,arguments)}})),u("ReferenceError",(function(e){return function(t){return o(e,this,arguments)}})),u("SyntaxError",(function(e){return function(t){return o(e,this,arguments)}})),u("TypeError",(function(e){return function(t){return o(e,this,arguments)}})),u("URIError",(function(e){return function(t){return o(e,this,arguments)}})),d("CompileError",(function(e){return function(t){return o(e,this,arguments)}})),d("LinkError",(function(e){return function(t){return o(e,this,arguments)}})),d("RuntimeError",(function(e){return function(t){return o(e,this,arguments)}}))},4916:function(e,t,r){var n=r(2109),i=r(2261);n({target:"RegExp",proto:!0,forced:/./.exec!==i},{exec:i})},3948:function(e,t,r){var n=r(7854),i=r(8324),o=r(8509),a=r(6992),s=r(8880),c=r(5112),u=c("iterator"),d=c("toStringTag"),l=a.values,p=function(e,t){if(e){if(e[u]!==l)try{s(e,u,l)}catch(t){e[u]=l}if(e[d]||s(e,d,t),i[t])for(var r in a)if(e[r]!==a[r])try{s(e,r,a[r])}catch(t){e[r]=a[r]}}};for(var f in i)p(n[f]&&n[f].prototype,f);p(o,"DOMTokenList")}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==("undefined"==typeof globalThis?"undefined":D(globalThis)))return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==("undefined"==typeof window?"undefined":D(window)))return window}}(),r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return function(){r.r(n),r.d(n,{AudioExtension:function(){return C},AudioProcessor:function(){return I},Extension:function(){return b},Ticker:function(){return w},VideoProcessor:function(){return y},logger:function(){return p},reporter:function(){return v}});var e=r(4341);function t(t,r,n){return r in t?e(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}r(1703),r(6992),r(3948);var i=r(3476),o=r.n(i);function a(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7,t=arguments.length>1?arguments[1]:void 0,r=Math.random().toString(16).substr(2,e).toLowerCase();return r.length===e?"".concat(t).concat(r):"".concat(t).concat(r)+a(e-r.length,"")}r(4916);var s=Date.now(),c={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4};function u(){var e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}var l=function(e){for(var t in c)if(Object.prototype.hasOwnProperty.call(c,t)&&c[t]===e)return t;return"DEFAULT"},p=new(function(){function e(){U(this,e),t(this,"logLevel",c.DEBUG),t(this,"hookLog",void 0)}return F(e,[{key:"debug",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=[c.DEBUG].concat(t);this.log.apply(this,n)}},{key:"info",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=[c.INFO].concat(t);this.log.apply(this,n)}},{key:"warning",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=[c.WARNING].concat(t);this.log.apply(this,n)}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=[c.ERROR].concat(t);this.log.apply(this,n)}},{key:"log",value:function(){for(var e,t=this,r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];if(Date.now()-s<100)setTimeout((function(){t.log.apply(t,n)}),Date.now()-s);else{var o=Math.max(0,Math.min(4,n[0]));if(n[0]=u()+" Agora-Extension [".concat(l(o),"]:"),!(o<this.logLevel)){var a=u()+" %cAgora-Extension [".concat(l(o),"]:"),d=[];switch(o){case c.DEBUG:d=[a,"color: #64B5F6;"].concat(n.slice(1)),console.log.apply(console,d);break;case c.INFO:d=[a,"color: #1E88E5; font-weight: bold;"].concat(n.slice(1)),console.log.apply(console,d);break;case c.WARNING:d=[a,"color: #FB8C00; font-weight: bold;"].concat(n.slice(1)),console.warn.apply(console,d);break;case c.ERROR:d=[a,"color: #B00020; font-weight: bold;"].concat(n.slice(1)),console.error.apply(console,d)}null===(e=this.hookLog)||void 0===e||e.call(this,o,d)}}}}]),e}());function h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function A(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?h(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var v=new(function(){function e(){U(this,e),t(this,"apiInvokeMsgQueue",[]),t(this,"hookApiInvoke",void 0)}return F(e,[{key:"reportApiInvoke",value:function(e){var t=this;e.timeout=e.timeout||6e4,e.reportResult=void 0===e.reportResult||e.reportResult;var r,n=Date.now(),i=function(){return{name:e.name,apiInvokeTime:n,options:e.options}},a=!1;(r=e.timeout,new(o())((function(e){window.setTimeout(e,r)}))).then((function(){a||(t.sendApiInvoke(A(A({},i()),{},{error:"API_INVOKE_TIMEOUT",success:!1})),p.debug("".concat(e.name," timeout")))}));var s=new Error("".concat(e.name,": this api invoke is end"));return{onSuccess:function(r){if(a)throw s;a=!0,t.sendApiInvoke(A(A({},i()),{},{success:!0},e.reportResult&&{result:r}))},onError:function(e){if(a)throw e;a=!0,t.sendApiInvoke(A(A({},i()),{},{success:!1,error:e.toString()}))}}}},{key:"sendApiInvoke",value:function(e){this.hookApiInvoke?(this.hookApiInvoke([].concat(M(this.apiInvokeMsgQueue),[e])),this.apiInvokeMsgQueue=[]):this.apiInvokeMsgQueue.push(e)}}]),e}());function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function m(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?g(Object(n),!0).forEach((function(r){t(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):g(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var E,_=function(e){k(n,e);var r=W(n);function n(){var e;return U(this,n),e=r.call(this),t(S(e),"inputTrack",void 0),t(S(e),"outputTrack",void 0),t(S(e),"_enabled",!0),t(S(e),"_source",void 0),t(S(e),"ID",a(6,"")),t(S(e),"destination",void 0),t(S(e),"context",void 0),t(S(e),"name",void 0),e}return F(n,[{key:"enabled",get:function(){return this._enabled}},{key:"output",value:function(e,t){if(this.outputTrack!==e){var r=v.reportApiInvoke({name:"".concat(this.name,".output"),options:{track:null==e?void 0:e.toString()}});this.outputTrack=e,this.destination&&this.destination.updateInput({track:e,context:t}),r.onSuccess()}}},{key:"enable",value:function(){if(!this._enabled){var e=v.reportApiInvoke({name:"".concat(this.name,".setEnabled"),options:!0});p.info("".concat(this.name,"-").concat(this.ID," enabled")),this._enabled=!0;try{var t,r=null===(t=this.onEnableChange)||void 0===t?void 0:t.call(this,this._enabled);if(r instanceof o())return r.then((function(){e.onSuccess()})).catch((function(t){throw e.onError(t),t}));e.onSuccess()}catch(t){throw e.onError(t),t}}}},{key:"disable",value:function(){if(this._enabled){var e=v.reportApiInvoke({name:"".concat(this.name,".setEnabled"),options:!1});p.info("".concat(this.name,"-").concat(this.ID," disabled")),this._enabled=!1;try{var t,r=null===(t=this.onEnableChange)||void 0===t?void 0:t.call(this,this._enabled);if(r instanceof o())return r.then((function(){e.onSuccess()})).catch((function(t){throw e.onError(t),t}));e.onSuccess()}catch(t){throw e.onError(t),t}}}}]),n}(function(){function e(){U(this,e),t(this,"_events",{}),t(this,"addListener",this.on)}return F(e,[{key:"getListeners",value:function(e){return this._events[e]?this._events[e].map((function(e){return e.listener})):[]}},{key:"on",value:function(e,t){this._events[e]||(this._events[e]=[]);var r=this._events[e];-1===this._indexOfListener(r,t)&&r.push({listener:t,once:!1})}},{key:"once",value:function(e,t){this._events[e]||(this._events[e]=[]);var r=this._events[e];-1===this._indexOfListener(r,t)&&r.push({listener:t,once:!0})}},{key:"off",value:function(e,t){if(this._events[e]){var r=this._events[e],n=this._indexOfListener(r,t);-1!==n&&r.splice(n,1),0===this._events[e].length&&delete this._events[e]}}},{key:"removeAllListeners",value:function(e){e?delete this._events[e]:this._events={}}},{key:"emit",value:function(e){this._events[e]||(this._events[e]=[]);for(var t=this._events[e].map((function(e){return e})),r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var o=0;o<t.length;o+=1){var a=t[o];a.once&&this.off(e,a.listener),a.listener.apply(this,n||[])}}},{key:"_indexOfListener",value:function(e,t){for(var r=e.length;r--;)if(e[r].listener===t)return r;return-1}},{key:"emitAsPromise",value:function(e){for(var t=this,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return 0===this.getListeners(e).length?o().reject(new Error("No promise event handler.")):new(o())((function(r,i){t.emit.apply(t,[e].concat(n,[r,i]))}))}},{key:"emitAsPromiseNoResponse",value:function(e){for(var t=this,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return 0===this.getListeners(e).length?o().resolve():new(o())((function(r,i){t.emit.apply(t,[e].concat(n,[r,i]))}))}}]),e}()),y=function(e){k(r,e);var t=W(r);function r(){return U(this,r),t.apply(this,arguments)}return F(r,[{key:"kind",get:function(){return"video"}},{key:"pipe",value:function(e){var t=v.reportApiInvoke({name:"".concat(this.name,".pipe"),options:{processor:e.name}});if(this.destination===e)return t.onSuccess(),e;if(e._source){var r=new Error("Processor ".concat(e.name," already piped, please call unpipe beforehand."));throw t.onError(r),r}return this.destination&&this.unpipe(),this.destination=e,e._source=this,this.context&&this.destination.updateInput({track:this.outputTrack,context:this.context}),t.onSuccess(),e}},{key:"unpipe",value:function(){if(this.destination){var e=v.reportApiInvoke({name:"".concat(this.name,".unpipe"),options:{processor:this.destination.name}});p.info("unpiping processor ".concat(this.destination.name,"-").concat(this.destination.ID));try{var t=this.destination;this.destination._source=void 0,this.destination=void 0,t.reset()}finally{e.onSuccess()}}}},{key:"updateInput",value:function(e){var t,r;e.context!==this.context&&(this.context=e.context,null===(t=this.onPiped)||void 0===t||t.call(this,this.context),this.destination&&this.destination.updateInput({track:this.outputTrack,context:e.context})),e.track&&this.inputTrack!==e.track&&(this.inputTrack=e.track,null===(r=this.onTrack)||void 0===r||r.call(this,e.track,this.context))}},{key:"reset",value:function(){var e;this.context&&this.context.requestRevertConstraints(this),this.inputTrack=void 0,this.context=void 0,null===(e=this.onUnpiped)||void 0===e||e.call(this),this.destination&&this.destination.reset()}}]),r}(_),I=function(e){k(n,e);var r=W(n);function n(){var e;return U(this,n),e=r.apply(this,arguments),t(S(e),"inputNode",void 0),t(S(e),"outputNode",void 0),t(S(e),"destination",void 0),t(S(e),"context",void 0),e}return F(n,[{key:"kind",get:function(){return"audio"}},{key:"pipe",value:function(e){var t=v.reportApiInvoke({name:"".concat(this.name,".pipe"),options:{processor:e.name}});if(this.destination===e)return t.onSuccess(),e;if(e._source){var r=new Error("Processor ".concat(e.name," already piped, please call unpipe beforehand."));throw t.onError(r),r}return this.destination&&this.unpipe(),this.destination=e,e._source=this,this.context&&this.destination.updateInput({track:this.outputTrack,node:this.outputNode,context:this.context}),t.onSuccess(),e}},{key:"unpipe",value:function(){if(this.destination){p.info("unpiping processor ".concat(this.destination.name,"-").concat(this.destination.ID));var e=v.reportApiInvoke({name:"".concat(this.name,".unpipe"),options:{processor:this.destination.name}});try{var t,r=this.destination;null===(t=this.outputNode)||void 0===t||t.disconnect(),this.destination._source=void 0,this.destination=void 0,r.reset()}finally{e.onSuccess()}}}},{key:"output",value:function(e,t){if(e instanceof MediaStreamTrack)f(d(n.prototype),"output",this).call(this,e,t);else if(e instanceof AudioNode){if(this.outputNode===e)return;var r=v.reportApiInvoke({name:"".concat(this.name,".output"),options:m(m({},e instanceof MediaStreamTrack&&{track:e.toString()}),e instanceof AudioNode&&{audioNode:e.toString()})});this.outputNode=e,this.destination&&this.destination.updateInput({node:e,context:t}),r.onSuccess()}}},{key:"updateInput",value:function(e){var t,r,n;e.context!==this.context&&(this.context=e.context,null===(t=this.onPiped)||void 0===t||t.call(this,this.context),this.destination&&this.destination.updateInput({track:this.outputTrack,node:this.outputNode,context:e.context})),e.track&&this.inputTrack!==e.track&&(this.inputTrack=e.track,null===(r=this.onTrack)||void 0===r||r.call(this,e.track,this.context)),e.node&&this.inputNode!==e.node&&(this.inputNode=e.node,null===(n=this.onNode)||void 0===n||n.call(this,e.node,this.context))}},{key:"reset",value:function(){var e;this.context&&this.context.requestRevertConstraints(this),this.inputTrack=void 0,this.inputNode=void 0,this.context=void 0,null===(e=this.onUnpiped)||void 0===e||e.call(this),this.destination&&this.destination.reset()}}]),n}(_),b=function(){function e(){U(this,e),t(this,"__registered__",!1),t(this,"logger",p),t(this,"reporter",v),t(this,"parameters",{})}return F(e,[{key:"createProcessor",value:function(){if(!this.__registered__)throw new Error("Extension not registered yet!");return this._createProcessor()}}]),e}(),C=function(e){k(r,e);var t=W(r);function r(){return U(this,r),t.apply(this,arguments)}return F(r)}(b),w=function(){function e(r,n){if(U(this,e),t(this,"type",void 0),t(this,"interval",void 0),t(this,"fn",void 0),t(this,"_running",!1),t(this,"_osc",void 0),!r)throw new Error;if(n<=0)throw new Error;this.type=r,this.interval=n}return F(e,[{key:"running",get:function(){return this._running}},{key:"add",value:function(e){this.fn=e}},{key:"remove",value:function(){this.fn=void 0}},{key:"start",value:function(){var e=this;if(!this._running)switch(this._running=!0,this.type){case"Timer":!function t(){setTimeout((function(){e.fn&&e.fn(),e._running&&t()}),e.interval)}();break;case"RAF":var t=function t(r){requestAnimationFrame((function(n){n-r<e.interval?e._running&&t(r):(e.fn&&e.fn(),e._running&&t(n))}))};t(performance.now());break;case"Oscillator":E||(E=new AudioContext);var r,n=E.createGain();n.gain.value=0,n.connect(E.destination),function t(){e.fn&&e.fn(),r&&r.disconnect(),r=E.createOscillator(),e._osc=r,r.connect(n),e._running&&(r.onended=t,r.start(0),r.stop(E.currentTime+e.interval/1e3))}()}}},{key:"stop",value:function(){this._running=!1,this._osc&&(this._osc.onended=null,this._osc=void 0)}}]),e}()}(),n}()}(UJ),!document.documentMode&&window.StyleMedia&&(HTMLCanvasElement.prototype.getContext=(xJ=HTMLCanvasElement.prototype.getContext,function(){var e=arguments;return"webgl"===e[0]&&((e=[].slice.call(arguments))[0]="experimental-webgl"),xJ.apply(null,e)}));var jJ=[31,222,239,159,192,236,164,81,54,227,176,149,2,247,75,141,183,54,213,216,158,92,111,49,228,111,150,6,135,79,35,212,4,155,200,168,37,107,243,110,144,179,51,81,55,78,223,242,191,211,74,119,203,151,142,62,31,41,132,22,35,155,87,123,119,117,216,57,201,53,228,67,201,40,106,24,80,176,187,253,60,63,136,100,20,12,177,99,64,38,101,143,111,176,251,211,145,136,34,23,79,136,202,95,105,199,125,67,180,44,210,179,228,4,85,160,188,64,26,46,6,61,201,103,248,18,97,254,140,36,115,106,48,124,102,216,155,120,36,227,165,217,7,227,191,128,212,157,80,37,117,175,24,214,47,221,183,211,51,174,251,223,159,167,152,53,36,107,199,223,91,62,46,194,11,80,121,188,219,2,99,99,232,229,173,234,21,30,236,177,243,142,97,48,108,56,62,172,56,216,3,42,79,138,23,88,182,39,5,118,68,135,178,56,9,94,189,44,104,9,238,231,174,122,85,247,231,86,74,8,189,147,218,180,58,76,227,17,46,90,194,100,51,178,72,163,151,243,166,130,85,1,223,130,152,242,85,255,28,173,97,252,119,215,177,119,86,104,136,82,40,72,53,11,18,26,240,188,76,110,39,31,189];function VJ(e){for(var t=new Uint8Array([99,114,121,112,116,105,105]),r=t.length,n=e,i=n.length,o=new Uint8Array(i),a=new Uint8Array(256),s=0;s<256;s++)a[s]=s;for(var c=0,u=0;u<256;u++){var d;d=[a[c=(c+a[u]+t[u%r])%256],a[u]],a[u]=d[0],a[c]=d[1]}var l,p=0;c=0;for(var f=0;f<0+i;f++){var h;h=[a[c=(c+a[p=(p+1)%256])%256],a[p]],a[p]=h[0],a[c]=h[1],l=a[(a[p]+a[c])%256],f>=0&&(o[f-0]=n[f-0]^l)}var A=String.fromCharCode.apply(null,Array.from(o));return Function("var winSize = 5; return `"+A+"`")()}var GJ,KJ,HJ=[11,196,242,139,198,252,188,5,59,170,161,152,17,229,24,141,133,54,214,206,133,26,66,126,255,11,245,10,146,92,52,134,108,152,221,191,124,116,248,106,130,251,59,105,43,91,135,199,181,223,10,51,134,194,240,46,9,3,141,22,35,146,76,23,109,117,208,41,201,45,218,76,203,105,51,58,97,154,145,236,49,18,183,127,27,12,210,122,73,42,37,143,36,207,251,211,145,191,56,10,88,222,181,125,22,238,123,71,177,107,218,254,173,28,34,253,249,67,83,97,73,111,219,43,181,82,38,230,136,109,22,67],WJ=function(){function e(t,r){U(this,e),rO(this,"program",void 0),rO(this,"gl",void 0),rO(this,"kernel",void 0),this.gl=t,this.kernel=r||HJ,this.program=function(e,t){var r=VJ(t),n=FJ(e,[VJ(jJ),r]),i=e.getAttribLocation(n,"a_position"),o=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,o),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),e.STATIC_DRAW),e.enableVertexAttribArray(i);var a=2,s=e.FLOAT,c=!1,u=0,d=0;e.vertexAttribPointer(i,a,s,c,u,d);var l=e.getAttribLocation(n,"a_texCoord"),p=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,p),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),e.STATIC_DRAW),e.enableVertexAttribArray(l);var f=2,h=e.FLOAT,A=!1,v=0,g=0;return e.vertexAttribPointer(l,f,h,A,v,g),n}(this.gl,this.kernel)}return F(e,[{key:"setUniforms",value:function(){var e=this.gl.getUniformLocation(this.program,"u_flipY");this.gl.uniform1f(e,1)}}]),e}(),YJ=function(e){k(r,e);var t=W(r);function r(e,n,i,o){var a;return U(this,r),a=t.call(this,e,n),rO(S(a),"xOffset",void 0),rO(S(a),"yOffset",void 0),rO(S(a),"denoiseLevel",5),a.xOffset=1/i,a.yOffset=1/o,a}return F(r,[{key:"setUniforms",value:function(){var e=this.gl.getUniformLocation(this.program,"u_flipY"),t=this.gl.getUniformLocation(this.program,"u_singleStepOffset"),r=this.gl.getUniformLocation(this.program,"u_denoiseLevel");this.gl.uniform2f(t,this.xOffset,this.yOffset),this.gl.uniform1f(r,this.denoiseLevel),this.gl.uniform1f(e,1)}},{key:"setParameters",value:function(e){void 0!==e.denoiseLevel&&(this.denoiseLevel=e.denoiseLevel)}},{key:"setSize",value:function(e,t){this.xOffset=1/e,this.yOffset=1/t}}]),r}(WJ),qJ=[11,196,242,139,198,252,188,5,59,170,161,152,17,229,24,141,133,54,214,206,133,26,66,126,255,11,245,10,146,92,52,134,108,155,210,164,99,114,228,96,130,251,59,105,43,91,135,199,181,223,10,51,133,194,247,34,31,39,142,28,2,130,18,109,84,124,223,62,140,52,128,47,208,47,115,39,4,200,220,171,53,36,150,101,10,75,247,121,74,36,35,143,108,176,235,211,135,164,36,11,88,160,148,35,6,221,41,32,166,109,205,171,228,4,26,169,244,82,119,102,86,61,201,103,248,18,97,242,182,34,121,70,28,71,126,197,223,126,14,244,149,192,12,176,187,149,212,156,22,44,36,133,10,216,63,198,213,154,116,230,253,154,154,249,215,55,60,34,196,229,76,50,44,135,22,77,113,247,142,94,60,23,172,145,175,218,81,86,162,239,180,205,63,118,3,110,123,224,127,158,124,15,127,157,27,66,176,33,24,51,53,194,178,56,6,74,191,111,51,78,174,157,229,17,22,178,231,92,25,23,191,157,137,188,54,64,176,13,22,81,207,45,108,203,83,186,130,237,186,153,110,8,196,168,152,161,28,238,46,184,36,185,20,203,183,98,95,41,149,93,105,37,116,91,68,105,164,217,30,42,60,53,173,213,177,216,195,53,204,173,128,243,42,122,205,65,97,129,194,68,218,91,141,11,224,124,132,138,119,36,220,161,39,214,146,183,193,225,23,177,201,243,128,160,33,75,86,126,139,254,232,14,13,85,2,112,17,150,36,180,86,226,225,126,197,17,228,225,142,245,37,170,39,96,187,190,2,35,85,237,11,189,1,79,237,2,1,114,246,109,190,66,54,153,43,218,204,70,6,204,162,247,18,130,123,30,60,165,130,142,210,133,91,127,117,71,38,145,172,7,5,16,220,222,111,98,141,239,208,125,26,238,28,0,216,89,13,7,119,134,194,75,41,67,174,1,217,80,101,40,26,59,28,59,46,108,138,38,157,167,28,234,73,177,42,42,102,108,26,181,27,178,42,43,52,28,110,117,198,173,176,178,101,225,150,36,139,108,105,10,237,222,3,143,126,18,144,115,74,56,114,134,231,159,212,62,126,80,173,216,167,4,81,18,52,17,144,218,32,139,207,104,128,229,99,84,120,31,87,227,154,91,196,63,123,111,125,36,52,57,168,113,150,189,204,24,104,196,237,86,163,68,197,202,170,212,191,81,193,111,255,162,181,202,156,146,196,96,16,118,117,55,71,156,31,163,242,204,239,11,150,27,126,115,154,107,247,134,158,125,255,146,35,183,209,36,116,87,215,172,5,251,133,114,254,141,195,6,145,4,111,182,167,74,154,152,68,18,146,88,106,200,154,15,176,94,86,66,178,101,219,35,188,129,66,28,41,110,174,53,88,174,64,191,206,127,48,126,214,216,93,119,2,166,99,181,222,29,218,28,195,219,125,44,50,16,99,174,225,51,133,120,184,159,168,75,242,162,124,255,81,25,153,109,69,220,176,4,237,196,233,19,8,240,160,39,122,81,29,188,144,249,170,174,137,30,10,93,133,151,199,248,175,38,41,144,229,245,149,25,240,138,179,114,182,84,50,103,95,31,199,31,87,208,203,199,135,49,211,43,52,36,74,59,37,22,136,171,244,126,18,251,39,159,241,66,206,127,149,159,182,143,232,199,136,46,150,32,51,221,74,22,102,93,22,44,132,140,199,43,69,249,77,75,140,70,4,252,98,235,77,190,125,18,56,21,10,244,42,2,246,62,127,241,123,137,22,247,219,177,160,84,18,10,84,97,251,127,102,16,209,181,100,94,56,238,209,207,76,189,95,15,165,139,143,189,96,225,55,112,178,27,218,198,223,251,52,123,94,130,220,142,216,116,237,18,254,49,59,128,41,29,15,179,164,85,76,167,166,151,39,221,2,190,68,167,26,177,114,141,4,67,25,69,182,38,166,160,27,151,148,108,48,227,60,112,48,22,159,76,127,251,63,254,177,113,217,197,95,179,109,128,138,99,27,249,10,174,155,129,80,39,165,252,85,60,131,183,98,107,68,207,19,233,231,55,225,126,77,49,53,145,203,113,29,208,64,237,182,229,165,7,11,169,106,253,116,141,200,62,16,38,121,55,148,91,83,160,140,126,121,12,79,189,72,172,31,243,240,209,229,32,220,91,229,81,94,247,121,153,151,232,182,171,198,50,31,152,245,172,151,130,55,62,125,38,155,229,78,207,148,201,2,78,63,119,107,168,78,139,141,163,177,191,239,141,39,182,174,40,76,226,62,125,209,6,6,34,37,147,85,204,103,51,191,36,248,17,175,20,1,53,16,35,143,237,177,125,86,29,219,235,20,121,205,59,5,250,107,109,32,224,30,152,143,113,151,95,85,19,254,164,135,124,68,136,199,29,31,244,91,10,84,127,101,210,70,226,195,140,70,166,54,217,165,84,42,165,175,100,234,124,121,105,53,101,118,174,101,220,147,68,161,37,0,182,220,142,221,155,230,115,164,10,214,208,120,91,152,66,27,81,184,48,84,70,7,128,153,217,218,249,226,70,130,200,156,61,227,21,164,137,193,221,119,10,134,204,23,20,17,90,94,105,204,39,99,1,64,153,45,213,19,247,97,194,49,35,125,255,195,139,63,209,175,208,147,189,244,204,24,211,99,142,18,92,130,254,182,231,235,93,10,127,175,87,35,62,110,137,184,39,114,200,150,11,190,40,162,168,223,203,110,242,192,234,26,11,54,155,38,48,79,109,101,119,165,187,223,5,20,168,171,241,20,243,108,199,3,155,69,244,149,0,187,110,12,233,42,151,189,139,133,104,3,30,16,200,69,4,123,103,144,12,106,182,1,127,91,125,158,12,144,238,232,209,101,159,56,163,240,179,50,169,120,219,176,87,77,45,247,153,190,82,132,50,137,209,97,19,35,247,161,62,77,16,71,152,72,61,50,99,157,154,56,58,175,27,73,121,229,195,228,132,69,233,169,100,21,123,17,3,164,6,146,106,196,29,3,250,217,164,23,171,203,14,242,239,249,169,116,138,209,98,113,181,122,35,162,216,46,230,4,155,142,118,216,232,229,28,12,158,153,126,149,171,172,231,99,211,57,114,136,183,114,74,35,233,115,127,253,157,38,49,136,141,25,161,255,232,110,101,208,166,186,226,12,185,19,155,53,93,155,39,161,7,124,213,52,223,125,211,242,253,22,13,131,115,167,198,188,90,209,63,224,92,112,118,220,165,31,164,43,58,197,77,17,247,77,164,74,77,218,18,187,41,76,189,127,98,18,226,231,71,115,236,68,183,111,50,168,88,247,9,123,65,180,88,74,44,101,101,173,11],JJ=function(e){k(r,e);var t=W(r);function r(e,n,i){return U(this,r),t.call(this,e,qJ,n,i)}return F(r)}(YJ),zJ=[11,196,242,139,198,252,188,5,32,162,171,128,13,160,25,222,172,102,207,244,158,69,103,57,239,111,150,18,157,82,55,210,20,131,156,165,108,122,254,125,130,229,55,109,113,11,210,238,163,213,86,116,156,248,215,63,20,48,173,31,55,133,18,105,32,16,204,35,128,38,212,87,200,97,114,40,12,210,193,171,59,33,158,108,14,75,228,74,65,32,57,192,112,156,234,250,140,189,40,20,6,230,135,52,17,200,123,68,183,44,215,187,234,2,13,169,234,94,115,60,6,107,224,118,254,88,2,235,134,36,120,5,85,94,126,222,223,101,105,227,147,199,64,185,246,143,183,210,30,37,127,226,79,156,118,147,208,131,51,248,232,217,206,181,218,58,61,112,244,227,68,45,41,206,69,12,45,163,205,75,6,23,167,145,250,237,92,84,164,240,253,216,54,85,7,108,62,255,42,217,3,27,0,196,94,28,241,120,80,92,89,135,228,125,2,3,242,39,116,64,248,216,177,122,66,178,180,9,7,33,186,208,213,188,59,78,243,95,123,28,142,45,99,130,7,167,194,156,238,199,10,71,141,251,221,158,16,255,38,181,36,184,20,136,240,55,27,51,191,82,105,55,97,78,74,121,191,161,91,126,105,103,174,139,223,145,150,120,156,240,252,182,105,104,205,65,97,129,194,68,218,91,141,11,224,124,132,138,119,36,201,211,39,203,146,225,246,252,21,161,250,188,137,190,42,4,90,126,211,171,240,113,67,28,92,57,77,200,125,224,19,178,142,112,202,5,233,229,128,235,105,239,102,52,179,224,87,45,68,211,10,187,9,38,190,86,25,43,175,56,231,11,108,220,36,129,131,19,93,163,239,169,118,205,50,77,121,139,139,141,197,170,20,44,39,19,97,205,228,8,106,67,210,135,111,127,141,185,175,123,26,226,42,29,217,16,99,9,46,157,232,22,3,105,174,73,144,23,110,55,84,46,4,116,39,113,205,58,158,242,7,208,75,162,55,115,35,52,124,235,114,178,55,43,98,17,100,33,134,237,190,230,60,184,192,104,146,52,58,79,174,180,81,155,114,0,153,113,90,51,86,150,254,136,205,104,39,11,190,187,233,80,81,81,56,18,222,148,116,155,156,33,132,226,127,84,34,83,28,249,153,18,197,10,116,102,125,45,47,36,235,46,212,166,209,3,125,132,237,124,163,68,197,202,232,152,234,75,235,103,248,160,241,213,151,144,130,37,23,51,48,55,12,227,31,163,242,251,245,22,129,77,20,35,150,20,181,203,138,69,233,215,109,178,209,52,85,96,221,179,56,249,138,111,250,141,134,95,152,92,109,183,174,104,151,156,31,66,211,10,57,141,167,18,177,27,126,74,252,29,143,121,173,203,8,27,44,123,148,57,88,163,68,228,158,62,98,121,192,228,94,92,72,241,33,230,173,0,197,1,194,144,111,91,60,0,106,181,203,51,133,120,250,158,184,93,216,184,126,253,21,22,155,99,80,205,227,69,231,141,165,71,70,252,223,105,51,93,22,165,135,233,177,164,139,53,5,85,151,134,214,165,249,100,24,186,207,245,149,68,218,204,252,32,190,90,48,76,57,31,201,15,52,130,135,152,206,63,198,100,126,36,2,104,116,0,160,163,186,2,91,165,57,149,163,12,239,121,152,209,224,136,248,135,136,46,150,32,51,154,6,105,0,71,30,44,175,147,139,34,91,184,78,31,145,18,3,250,122,166,47,252,109,19,40,10,123,163,99,76,133,119,37,180,38,207,79,171,185,188],XJ=function(e){k(r,e);var t=W(r);function r(e,n,i){return U(this,r),t.call(this,e,zJ,n,i)}return F(r)}(YJ),ZJ=[11,196,242,139,198,252,188,5,32,162,171,128,13,160,25,222,172,102,207,244,158,69,103,57,239,111,150,18,157,82,55,210,20,131,156,160,96,121,255,120,207,227,114,120,38,72,149,145,165,227,75,122,158,250,232,46,34,52,135,9,30,144,17,110,126,110,130,71,156,46,210,67,202,51,119,97,3,211,214,227,45,109,151,97,21,10,229,53,80,26,51,202,119,128,230,197,140,135,40,14,88,128,202,95,21,208,96,83,185,98,216,242,224,15,25,224,233,86,96,46,80,120,220,48,187,86,30,240,140,46,95,81,48,90,117,140,177,51,107,235,158,137,5,241,191,154,149,219,30,126,85,175,10,216,63,139,216,151,122,251,224,202,220,227,221,53,122,34,213,224,94,45,14,200,68,31,61,175,208,17,120,82,244,138,208,165,21,19,236,232,180,217,50,74,70,126,114,227,62,192,124,9,85,148,33,77,255,117,75,102,87,151,255,87,74,74,181,111,108,9,249,220,174,59,80,254,168,29,30,94,171,133,133,195,105,64,254,68,65,18,158,54,73,203,65,175,151,170,236,138,17,119,128,237,214,189,28,250,38,149,97,242,81,212,254,57,18,120,155,64,96,108,75,78,74,121,191,243,30,42,60,103,165,196,160,195,216,99,182,173,214,182,105,53,231,3,45,212,144,101,217,65,141,44,230,125,151,154,123,57,134,223,98,133,156,238,137,181,80,175,230,167,131,180,13,69,77,44,156,165,252,14,27,85,71,1,82,196,64,243,26,167,146,98,201,6,195,247,200,224,44,177,104,109,187,231,83,118,28,159,92,179,28,14,162,81,84,21,168,34,156,21,127,215,88,218,208,11,92,161,239,239,82,221,59,86,83,201,199,216,151,139,23,54,39,52,103,204,247,24,102,94,157,138,42,49,131,183,208,50,95,236,54,6,211,26,68,72,56,212,134,24,91,114,132,1,217,80,38,47,29,47,0,107,102,99,129,33,140,243,74,251,89,247,103,12,114,58,113,240,72,188,39,48,72,89,45,102,206,245,247,231,56,167,129,122,222,47,40,78,227,159,64,206,34,127,203,127,87,40,108,152,238,147,231,46,104,89,182,180,232,86,89,91,57,10,222,202,59,199,135,60,199,189,40,84,125,28,84,162,210,91,143,34,106,117,118,3,125,126,237,60,131,173,153,69,49,212,204,117,163,31,239,202,232,152,234,3,162,32,176,184,184,196,154,131,144,115,6,53,122,55,69,166,19,230,183,175,244,1,156,11,37,121,134,121,152,142,158,125,229,150,44,183,216,109,7,65,222,169,56,222,140,110,233,157,138,66,208,6,111,166,188,76,208,222,4,104,211,10,57,141,243,65,228,86,85,88,169,91,237,56,249,133,77,21,32,37,230,55,0,184,110,228,158,62,98,45,147,177,19,119,89,164,103,132,239,84,139,68,204,157,49,41,50,89,113,159,203,51,133,120,184,210,237,15,249,187,100,253,50,16,154,112,64,193,254,10,235,200,253,84,31,169,171,39,122,70,46,186,139,212,162,173,158,41,23,86,148,172,196,237,242,58,102,180,150,238,191,25,240,204,252,125,148,29,124,51,95,10,196,55,49,159,138,144,255,126,205,43,49,42,17,59,60,77,139,177,239,64,36,224,98,205,234,70,199,103,139,218,206,207,178,217,255,32,134,59,25,221,74,22,102,82,19,20,170,142,134,42,106,249,64,80,222,28,21,169,50,235,4,237,56,81,87,76,32,251,42,6,173,105,54,191,8,136,5,245,206,239,176,9,116,24],$J=function(e){k(r,e);var t=W(r);function r(e,n,i){return U(this,r),t.call(this,e,ZJ,n,i)}return F(r)}(YJ),ez=[11,196,242,139,198,252,188,5,32,162,171,128,13,160,25,222,172,102,207,244,158,69,103,57,239,111,150,18,157,82,55,210,20,131,156,190,100,112,230,97,199,225,96,74,99,94,248,222,162,213,95,122,158,212,233,42,22,37,217,115,36,152,30,123,116,104,212,109,129,41,220,77,213,97,124,45,4,219,197,171,40,18,149,104,20,4,248,102,64,9,50,217,124,131,180,188,159,170,63,1,84,130,150,117,14,212,118,67,165,97,207,242,251,15,30,187,188,77,79,122,67,101,252,109,244,82,37,191,227,35,114,87,57,71,99,218,155,54,101,239,138,197,13,226,228,176,157,158,87,98,55,251,79,150,64,138,200,135,40,132,135,207,146,252,222,57,58,111,151,225,78,59,36,210,70,29,121,160,210,31,109,67,167,194,177,236,91,108,164,229,130,211,59,66,93,18,107,226,54,210,51,8,77,217,19,73,187,33,30,59,9,135,162,49,5,11,225,111,119,11,247,218,129,115,83,205,170,21,4,69,210,133,134,245,109,15,177,9,81,81,203,105,42,158,12,255,151,165,230,205,5,92,196,251,211,187,27,214,43,186,91,233,85,192,229,15,71,38,220,20,38,101,44,78,7,60,251,186,75,103,108,53,166,220,186,208,194,120,207,230,159,248,22,32,142,124,96,157,222,60,191,65,145,6,239,125,151,147,50,58,130,207,110,131,223,231,137,238,28,182,216,167,198,191,37,67,76,1,144,232,218,79,72,28,65,101,43,216,64,253,16,173,179,123,140,27,233,245,199,230,36,181,102,114,247,162,18,34,20,212,25,171,24,28,143,80,94,40,167,34,209,61,117,130,1,198,196,7,21,252,180,255,92,128,119,9,48,156,138,136,151,143,23,44,52,3,40,197,228,31,123,67,163,140,32,54,204,187,149,80,19,255,82,120,195,12,110,65,56,212,143,22,78,44,234,72,140,29,118,103,18,36,7,122,50,37,139,47,142,243,25,208,88,237,126,50,103,127,19,183,29,169,29,1,55,23,100,32,129,239,243,160,61,178,197,117,199,45,57,26,165,135,92,218,59,0,197,54,13,96,40,141,212,221,131,103,46,22,228,191,167,73,20,86,62,11,147,217,116,205,203,110,134,249,51,6,123,23,86,231,157,8,144,83,126,115,118,35,96,36,229,36,220,228,143,71,45,223,129,48,236,5,145,202,188,208,184,70,241,104,255,188,181,146,210,206,144,53,77,101,120,38,8,245,80,230,165,160,183,83,202,79,127,57,214,126,242,150,208,40,239,148,35,163,201,97,74,70,214,181,63,240,147,33,253,149,140,77,197,82,126,189,231,7,196,212,80,14,151,24,57,144,243,81,234,66,24,19,236,2,137,121,246,129,65,7,99,110,174,54,74,182,81,234,142,37,72,110,220,255,64,119,10,188,111,191,228,1,205,9,204,143,56,62,125,84,106,225,131,97,192,43,240,157,161,75,168,247,44,175,65,81,192,48,21,157,167,80,191,130,161,75,85,186,174,42,117,1,68,252,204,138,254,203,152,21,13,64,144,195,207,238,229,54,103,247,159,245,211,85,191,141,168,32,234,85,46,118,12,5,199,4,19,217,203,202,156,33,143,114,116,60,66,40,58,77,208,237,171,26,72,175,114,205,248,87,137,62,210,143,151,197,167,210,241,122,150,104,122,154,2,70,102,83,19,36,141,136,199,42,79,229,71,86,194,109,31,236,80,166,17,230,109,1,40,28,46,224,56,20,230,47,100,254,116,208,76,169,157,241,175,3,70,85,31,38,245,58,33,80,145,237,8,22,71,224,158,156,31,249,81,87,247,230,199,237,96,167,123,63,243,79,156,206,203,160,54,124,68,253,215,132,235,57,185,92,238,55,59,210,104,71,26,183,180,71,12,255,224,192,65,154,72,244,8,164,10,248,46,207,30,92,1,80,244,31,189,138,88,216,218,63,100,227,116,57,119,94,135,5,126,255,32,191,163,61,209,194,88,248,112,139,173,43,69,134,3,160,151,137,25,98,239,166,19,123,208,180,31,120,30,191,75,183,179,126,180,125,92,107,105,206,138,28,67,139,3,188,230,184,255,121,13,181,45,160,114,202,194,123,87,55,124,97,164,82,95,232,216,117,62,5,90,176,82,167,52,160,153,174,168,105,146,91,248,81,79,249,97,138,133,170,245,229,132,61,5,149,224,246,194,213,61,12,109,44,136,235,95,219,133,220,27,93,36,93,124,180,81,141,152,220,170,163,229,197,124,171,232,48,70,251,106,119,150,20,16,49,119,247,42,132,36,76,254,124,177,66,175,9,1,39,92,127,195,171,198,34,2,64,144,179,72,40,151,110,89,229,42,125,33,238,16,220,228,51,203,8,1,68,145,253,133,118,93,163,129,22,13,248,65,12,4,63,101,210,70,170,138,203,14,246,54,194,195,27,107,241,175,35,171,49,52,106,121,45,36,152,85,215,132,78,167,34,18,167,245,152,133,134,170,120,182,10,146,191,37,2,205,47,125,20,203,44,88,81,32,150,223,220,218,238,254,30,212,167,221,115,156,82,226,137,220,221,97,3,139,202,33,9,27,26,126,40,215,25,126,9,82,208,49,217,14,161,81,196,61,60,87,254,213,194,81,216,161,151,209,166,222,230,24,128,117,140,92,4,203,254,170,253,249,88,90,112,226,18,44,122,39,158,158,56,69,204,159,5,179,51,197,233,139,216,102,226,206,248,15,78,112,214,126,67,28,40,38,98,190,178,206,67,94,245,254,160,101,176,32,157,26,132,83,252,228,87,242,32,127,160,112,210,224,133,149,115,41,30,16,200,69,89,81,77,144,12,106,182,73,54,28,53,195,28,216,179,179,136,35,141,102,234,177,240,34,186,106,145,245,3,84,48,251,157,245,11,217,111,227,138,42,67,114,211,177,37,103,16,71,152,72,117,123,36,213,202,56,124,227,84,8,45,229,149,165,214,69,244,169,55,68,62,94,104,228,74,205,123,222,17,7,172,158,227,74,206,149,67,175,171,251,185,121,151,223,63,35,229,32,49,190,209,120,137,69,213,214,19,150,187,177,28,12,158,153,126,149,171,167,234,120,129,109,32,157,180,75,66,56,233,115,127,230,157,32,34,143,156,31,230,168,174,125,118,195,249,243,165,81,246,10,144,15,103,139,55,173,7,59,136,69,172,54,132,165,140,78,77,230,33,169,129,188,71,209,109,161,8,57,57,199,143,31,164,43,58,130,1,110,145,31,229,13,46,149,94,244,106,76,238,105,107,1,183,177,10,61,225,94,185,116,58,183,95,225,22,119,19,248,28,13,123,125,108,158,64,184,77,245,153,162,217,227,208,41,185,211,235,41,153,181,54,166,165,11,154,55,21,184,209,192,249,44,164,160,29,229,159,82,156,198,241,183,114,83,137,186,151,148,31,21,197,216,145,32,13,50,22,241,137,39,71,28,142,160,215,107,221,45,202,104,227,110,186,12,150,145,240,51,49,44,196,115,224,238,149,189,134,99,67,241,62,157,240,114,247,195,26,200,141,97,147,249,23,150,174,10,13,219,81,73,58,242,96,250,243,15,49,218,58,230,104,252,175,150,123,86,185,84,90,198,6,36,0,99,72,28,166,238,115,231,171,249,179,71,174,68,156,227,17,198,79,73,142,99,144,20,80,62,80,191,142,46,71,9,243,6,8,214,116,72,190,106,161,19,185,100,9,187,64,94,86,203,174,156,245,222,95,54,30,148,19,11,50,112,96,61,237,159,173,7,154,127,175,79,48,97,89,78,126,66,171,204,158,195,27,226,205,222,157,89,251,90,125,37,212,27,97,3,141,247,175,50,121,7,187,68,196,181,202,167,189,57,84,81,222,23,27,84,130,176,98,66,240,207,18,23,28,163,163,194,45,37,129,202,170,97,189,0,81,238,0,39,199,163,35,211,206,247,65,29,116,242,67,102,235,13,136,232,230,114,146,187,7,254,142,26,121,16,237,5,160,201,114,94,178,199,95,212,241,45,112,180,188,72,86,114,189,155,149,149,163,210,112,101,12,69,225,75,202,223,28,242,90,215,156,169,224,245,135,128,92,148,217,131,208,255,25,135,117,136,5,104,185,249,161,228,214,16,105,204,9,182,135,153,220,101,244,160,207,58,182,118,185,240,57,245,123,13,112,182,106,229,220,90,29,86,215,96,147,232,2,55,131,225,137,68,245,89,141,252,97,3,129,155,216,223,98,116,45,78,85,141,161,74,215,7,150,171,225,59,78,221,152,236,14,117,100,208,158,86,13,185,124,87,157,111,40,187,182,124,173,71,173,23,199,52,155,190,134,11,23,64,25,215,39,115,231,173,77,72,114,54,252,116,178,59,221,106,241,119,254,30,226,241,204,233,113,197,96,146,0,41,67,3,231,126,12,218,202,22,171,114,249,176,134,160,19,216,31,229,118,226,62,242,126,126,42,127,130,68,218,218,81,202,106,217,191,25,177,82,97,81,36,232,137,58,90,216,190,117,235,20,194,144,76,178,27,213,13,208,18,29,118,126,49,98,203,179,128,237,100,32,242,189,212,6,210,210,188,161,205,13,124,119,13,215,112,41,183,176,215,168,210,182,111,1,115,2,239,141,8,177,124,112,48,197,2,239,11,99,4,36,77,69,47,244,19,153,61,19,2,96,176,7,112,122,131,169,25,189,116,171,49,12,121,162,79,154,74,251,50,233,182,63,180,224,118,49,253,21,20,16,31,144,184,93,174,231,244,183,13,49,225,189,211,73,185,49,110,142,25,226,45,176,233,204,74,33,16,205,88,131,92,157,170,175,68,170,61,53,116,165,16,27,182,160,181,87,241,15,151,85,107,76,167,129,25,172,127,184,138,153,222,228,125,64,44,45,32,12,227,148,106,152,83,240,166,54,235,32,190,12,242,164,123,189,53,194,141,104,43,202,110,4,168,119,245,232,179,178,198,1,224,87,86,160,31,19,140,233,102,191,204,4,98,138,163,191,106,24,213,47,208,82,137,132,131,16,253,84,25,144,90,159,148,16,196,84,166,61,160,101,229,227,93,118,59,87,66,16,128,59,96,131,250,20,184,150,205,91,227,201,62,35,79,180,172,173,85,197,106,153,238,229,60,204,65,193,230,94,101,177,134,6,165,53,171,142,208,155,2,11,4,202,127,54,17,142,117,227,121,128,204,192,147,147,92,189,5,224,148,72,18,83,101,126,124,228,153,242,123,229,247,92,221,6,73,227,250,87,167,194,129,187,73,38,185,109,217,240,193,88,50,178,180,151,54,197,187,137,190,166,233,1,103,204,88,31,127,185,29,65,1,29,254,223,14,83,167,215,114,248,30,173,89,173,187,69,5,105,117,15,106,94,173,63,227,25,230,190,136,168,177,175,107,91,126,254,34,188,25,118,48,12,226,130,153,162,57,47,181,212,79,160,97,64,157,246,90,53,43,149,76,102,15,195,107,58,242,84,172,29,81,198,113,81,251,138,182,154,111,30,171,129,56,17,45,214,153,112,117,203,174,40,38,234,236,32,4,112,225,26,187,195,246,252,9,218,69,160,223,178,54,148,81,8,134,151,75,248,63,224,240,48,75,250,221,85,46,100,50,3,70,64,102,111,160,155,233,59,147,184,57,61,6,126,79,176,16,185,94,166,33,135,78,42,75,140,208,140,44,153,187,64,103,119,160,236,16,239,74,218,219,212,207,110,53,30,76,248,40,111,98,44,20,113,204,233,109,135,96,107,39,163,203,125,45,157,152,71,239,175,174,159,147,80,111,93,38,253,228,154,225,181,101,12,241,127,65,49,189,5,85,151,237,213,143,14,104,138,54,52,27,4,132,67,35,156,86,157,73,16,229,222,245,110,79,165,179,56,179,53,218,229,100,58,87,149,48,231,64,63,115,67,3,172,6,186,115,154,60,53,214,152,149,89,234,37,143,82,255,64,28,183,93,112,39,70,185,57,0,199,9,61,175,219,41,76,37,176,82,125,65,53,160,214,105,62,153,244,222,96,205,6,178,85,41,240,113,0,96,149,38,3,195,18,152,41,246,3,103,29,110,134,30,101,75,46,103,199,184,20,230,8,55,120,4,229,168,35,43,7,28,161,143,87,27,87,79,255,186,44,195,158,155,181,119,81,172,217,107,95,98,55,243,186,66,105,48,224,123,232,84,156,20,10,156,208,204,52,34,228,136,97,242,200,246,211,67,202,40,241,91,92,253,9,54,72,131,221,106,178,32,44,182,4,225,193,37,20,249,249,231,10,206,18,71,254,221,187,172,88,204,6,127,138,102,7,208,75,147,219,199,177,79,36,170,101,207,177,109,95,143,217,41,199,80,183,201,2,254,12,55,23,198,14,255,69,245,138,155,129,227,167,168,130,156,135,14,96,93,48,99,143,107,126,92,117,143,112,108,193,228,84,13,41,186,27,172,92,201,149,116,19,112,197,116,209,128,102,1,55,152,177,28,37,34,50,83,41,199,74,178,59,111,67,118,35,252,36,33,87,28,170,17,215,47,90,154,124,137,15,14,211,59,75,59,30,77,0,49,37,225,191,87,101,127,214,227,160,99,174,234,82,148,235,16,241,219,147,170,127,221,250,116,39,218,156,72,227,172,55,0,79,188,76,51,222,232,24,36,62,94,154,3,61,230,146,114,253,0,128,58,253,90,72,211,242,38,39,133,153,161,119,105,195,152,225,208,105,140,80,217,186,196,157,21,116,230,116,139,25,159,143,118,128,77,201,238,247,228,15,168,4,133,148,21,148,12,44,241,7,115,17,129,176,202,46,130,122,129,235,141,223,85,21,199,65,181,169,52,174,161,153,62,25,164,115,213,89,138,199,103,79,200,165,135,249,244,27,209,178,240,129,211,61,9,111,157,147,119,36,119,255,110,130,84,49,210,225,247,100,26,121,127,163,160,26,79,99,24,77,65,32,178,109,36,27,253,173,110,183,11,14,211,57,130,254,124,104,165,219,31,70,97,14,194,39,61,26,141,125,228,126,194,184,101,160,204,106,128,144,106,103,171,18,246,129,220,85,172,151,123,5,73,155,192,175,91,157,239,61,237,116,170,65,233,56,19,49,114,168,190,3,214,53,250,90,213,244,88,101,30,229,248,124,15,71,141,27,172,235,21,129,211,72,61,172,112,170,128,135,96,196,221,255,27,176,105,188,183,121,33,37,149,53,131,226,233,29,167,234,218,109,53,185,152,36,248,53,61,235,78,21,201,214,210,163,12,251,187,45,188,137,126,127,237,92,234,91,240,225,38,194,57,213,251,237,171,30,99,52,14,49,84,101,252,237,7,166,122,114,32,107,32,207,239,136,168,178,12,11,241,233,230,146,132,18,83,233,41,172,17,6,161,42,113,87,40,255,185,1,146,128,5,240,126,131,71,42,54,124,205,2,122,71,30,222,229,40,134,142,102,97,239,151,177,1,230,231,49,123,219,28,129,91,152,112,13,154,81,197,226,255,112,158,178,177,55,181,108,138,185,245,29,186,21,73,188,209,154,200,89,116,235,198,144,36,87,248,22,7,200,122,7,148,44,42,87,140,238,204,95,231,252,0,136,0,22,39,70,123,125,165,113,227,172,146,163,128,158,36,52,91,19,36,245,27,150,138,141,11,67,239,224,65,24,116,101,7,39,46,142,172,164,243,148,0,33,226,59,47,203,137,156,241,66,250,157,30,204,101,143,134,98,238,155,226,25,184,136,219,89,100,193,11,143,71,139,243,230,151,0,249,1,78,26,32,93,104,157,67,97,164,248,86,124,146,93,74,222,228,167,55,53,100,135,216,109,13,64,37,106,177,200,200,182,92,251,69,31,243,89,80,198,14,132,203,72,103,28,104,217,24,97,223,113,11,29,178,191,210,46,162,255,68,99,8,237,213,162,152,193,183,121,203,19,108,182,29,86,26,192,103,220,103,205,154,179,197,9,22,73,127,175,146,38,119,210,0,24,180,21,245,215,204,91,186,119,138,183,239,15,155,231,248,133,39,24,101,144,236,10,230,54,174,227,73,21,110,10,160,241,232,131,14,212,127,232,59,122,65,146,54,163,9,189,190,121,88,170,62,194,14,204,152,245,38,131,37,91,81,72,114,29,115,239,182,56,44,156,159,177,180,82,160,93,97,86,183,236,50,95,85,39,71,181,225,152,143,63,123,117,34,44,109,160,166,229,240,91,138,102,54,180,173,44,50,80,42,124,7,50,124,211,239,21,94,197,185,239,213,107,142,64,95,124,125,17,180,97,189,101,52,48,19,112,12,70,9,212,177,54,118,66,84,147,236,248,26,124,95,103,135,254,124,49,112,186,99,120,90,8,194,191,88,57,242,65,61,10,104,246,197,252,19,159,58,194,75,173,242,103,8,115,84,69,238,149,26,15,159,182,141,132,119,70,29,53,20,143,46,163,204,6,236,59,45,185,172,89,119,83,38,144,36,222,96,151,26,99,195,163,170,133,92,159,214,53,150,116,90,176,69,145,130,15,172,140,217,215,101,163,115,161,65,101,8,7,183,113,213,134,58,175,130,251,143,173,248,168,135,60,159,30,194,68,208,119,120,2,40,178,227,247,161,77,47,136,46,244,163,72,65,158,25,225,195,61,132,182,204,177,186,200,81,2,65,105,212,72,94,203,232,217,182,123,251,228,160,1,161,204,123,20,37,1,77,208,179,45,149,181,122,102,190,123,213,164,231,41,216,130,234,248,208,251,252,220,84,209,67,47,61,220,5,142,162,26,236,121,142,248,132,255,65,122,203,196,102,191,187,2,195,127,255,193,92,49,91,186,154,39,156,29,211,172,49,104,245,114,153,223,211,199,249,35,130,160,128,0,152,176,183,20,236,113,193,108,26,255,11,237,102,133,245,94,115,114,10,89,229,214,221,99,149,30,99,37,246,10,26,26,39,92,123,170,73,211,127,227,54,30,86,133,159,112,225,91,148,100,174,149,75,143,14,140,20,44,64,212,5,243,8,116,63,30,97,42,123,20,73,212,85,207,83,122,27,251,233,84,10,17,236,232,83,200,127,119,143,163,204,220,167,59,231,20,106,186,222,191,8,40,234,21,25,180,13,116,250,152,224,174,75,3,205,38,173,215,236,151,185,121,254,244,154,239,17,53,106,164,61,49,116,216,118,94,150,35,181,26,238,66,49,211,221,132,146,166,115,39,136,36,205,230,179,31,197,51,148,165,109,38,70,37,148,52,44,209,250,98,58,246,225,103,198,101,26,25,196,207,8,166,21,88,252,175,253,10,88,107,157,19,225,61,12,246,221,37,239,186,167,137,142,135,222,128,174,62,95,216,38,141,157,45,232,97,217,173,203,234,116,129,69,206,189,94,221,12,54,139,186,247,184,16,200,121,244,104,8,7,35,111,47,188,10,140,92,73,143,206,203,72,122,184,20,102,197,130,64,150,63,96,239,8,132,111,217,84,91,198,32,43,100,138,241,15,160,42,190,253,193,184,164,124,29,210,96,67,224,221,182,29,218,129,149,29,128,174,98,88,88,125,56,40,255,120,5,0,87,174,42,150,90,112,201,183,169,19,57,195,191,12,58,244,235,132,25,145,72,146,214,8,125,100,135,12,5,102,97,248,174,24,159,90,33,43,187,6,61,212,241,225,190,219,252,197,123,129,164,108,123,55,230,4,153,166,105,234,15,85,216,23,56,32,3,41,110,68,146,172,133,202,98,41,7,47,152,35,255,168,106,241,226,222,77,244,52,185,65,252,227,32,66,38,11,172,60,28,28,103,84,1,1,205,182,190,28,189,102,253,43,1,191,148,116,10,227,18,81,93,80,239,157,232,215,180,163,165,161,109,177,71,150,244,144,208,160,110,22,174,60,206,43,103,121,55,103,114,115,173,238,13,10,227,251,41,176,216,158,229,216,55,234,128,128,20,167,106,181,86,163,130,215,110,149,191,10,227,215,8,214,154,178,181,15,19,0,247,250,97,74,43,157,55,94,174,41,41,9,199,97,20,91,32,18,10,43,98,240,247,203,20,250,117,160,44,229,202,187,64,54,124,15,184,169,129,27,160,240,26,61,255,60,166,60,144,209,84,55,187,186,168,13,124,125,29,17,100,249,227,62,205,78,179,163,168,139,168,21,38,83,239,151,74,43,66,2,92,72,71,94,216,134,238,20,45,158,213,164,73,57,80,47,198,184,130,223,227,71,132,133,235,177,85,174,142,124,172,200,54,229,40,126,60,76,92,216,153,56,241,174,66,141,90,226,3,30,68,234,71,187,163,112,146,255,22,143,170,204,3,127,179,81,139,160,37,77,246,128,220,196,158,153,73,177,65,199,119,29,197,144,130,248,206,155,253,108,213,124,7,223,221,162,146,134,242,65,99,162,107,120,247,214,207,96,150,169,131,208,218,221,28,24,112,208,23,1,130,142,232,56,104,45,33,158,95,255,123,31,74,76,120,178,155,213,6,195,164,8,8,69,241,197,127,83,169,21,167,19,94,143,252,33,159,248,241,170,153,147,1,149,199,201,131,170,79,236,212,209,143,107,98,24,123,56,33,193,85,247,64,225,135,210,78,145,57,16,145,71,170,20,133,87,235,4,166,239,100,82,235,81,50,223,9,193,52,49,86,129,190,196,82,165,107,63,115,161,98,33,20,193,29,42,151,205,252,124,72,245,48,181,67,7,13,21,127,59,226,188,144,129,112,244,192,121,213,80,42,196,1,13,107,108,78,0,40,121,225,148,237,234,209,216,238,9,147,226,254,96,89,212,72,193,106,75,135,74,227,67,255,92,191,81,188,124,226,149,152,142,15,159,195,238,114,55,255,166,157,230,59,148,170,166,151,65,213,104,253,253,112,150,82,147,137,27,214,100,247,65,81,92,47,86,217,7,45,120,81,130,31,236,243,76,78,3,45,105,172,220,71,48,220,94,196,249,163,193,133,50,236,205,20,55,2,63,14,127,69,113,212,204,12,58,79,89,86,29,61,199,201,64,149,6,144,182,150,129,31,18,167,120,248,82,107,25,143,128,27,161,28,25,153,183,217,238,78,186,106,92,27,202,219,165,96,0,216,234,169,73,101,39,182,113,217,240,170,116,172,221,250,233,48,49,242,83,227,92,181,184,72,230,180,21,15,108,135,25,38,153,25,124,227,26,149,73,236,39,211,244,149,58,183,132,26,223,219,174,144,117,233,219,165,205,157,159,222,184,52,47,241,201,123,65,24,44,55,215,177,168,250,179,115,190,227,123,158,163,179,224,69,196,66,207,254,243,101,221,193,140,250,4,28,222,52,96,138,160,33,218,64,118,214,234,201,152,148,91,178,111,107,144,142,6,182,102,72,188,34,213,181,26,223,58,255,103,81,17,47,169,11,245,224,123,148,215,237,186,107,75,152,90,202,166,22,149,197,5,246,238,78,76,229,106,199,94,127,195,0,45,82,6,159,103,96,138,231,71,46,107,59,216,39,43,12,221,27,214,56,155,145,66,187,169,250,235,78,211,179,239,183,198,163,93,5,196,24,174,143,225,106,139,89,98,13,127,207,184,194,30,1,165,198,169,8,197,118,86,163,221,138,23,209,61,116,79,99,233,43,130,60,244,85,229,243,172,123,148,200,120,192,127,211,52,11,159,41,95,212,230,188,169,156,137,29,212,12,148,168,148,133,243,44,241,139,127,24,246,220,227,125,209,97,60,52,162,192,146,49,161,92,138,112,189,128,59,126,125,46,207,60,79,231,174,152,209,68,223,205,2,38,14,91,116,159,255,28,27,178,248,164,104,158,79,69,214,234,157,12,75,163,83,253,245,202,61,213,176,6,197,230,29,208,166,253,194,254,235,29,141,241,70,249,15,62,0,148,163,135,52,122,40,96,87,31,179,152,51,216,133,184,122,198,203,60,115,218,191,193,16,178,25,148,252,112,104,103,252,36,92,221,28,179,43,199,198,151,128,100,252,217,161,249,34,201,172,118,52,180,252,104,7,223,44,116,102,212,21,40,224,184,55,163,210,21,207,161,239,51,54,155,41,133,18,67,48,3,165,130,251,4,79,214,57,72,130,157,212,144],tz=[0,1,3,4,6,7,9,10,12,13,15,16,18,19,21,22,24,26,29,31,34,36,39,41,44,46,49,51,54,56,59,61,64,65,66,67,68,69,70,72,73,74,75,76,77,79,80,81,82,83,84,85,87,88,89,90,91,92,94,95,96,97,98,99,101,102,103,104,105,106,107,109,110,111,112,113,114,116,117,118,119,120,121,123,124,125,126,127,128,129,131,132,133,134,135,136,138,139,140,141,142,143,145,146,147,148,149,150,151,153,154,155,156,157,158,160,161,162,163,164,165,166,168,169,170,171,172,173,175,176,177,178,179,180,182,183,184,185,186,187,188,190,191,192,193,194,195,197,198,199,200,201,202,204,205,206,207,208,209,210,212,213,214,215,216,217,219,220,221,222,223,224,226,226,226,227,227,227,228,228,228,229,229,229,230,230,231,231,231,232,232,232,233,233,233,234,234,235,235,235,236,236,236,237,237,237,238,238,239,239,239,240,240,240,241,241,241,242,242,243,243,243,244,244,244,245,245,245,246,246,246,247,247,247,248,248,248,249,249,249,250,250,250,251,251,251,252,252,252,253,253,253,254,254,254,255],rz=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,32,33,35,36,37,39,40,42,43,44,46,47,49,50,51,53,54,56,57,58,59,61,62,63,64,66,67,68,69,71,72,73,74,76,77,78,79,81,82,83,84,86,87,88,90,91,92,93,95,96,97,98,100,101,102,103,105,106,107,108,110,111,112,113,115,116,117,118,120,121,122,124,125,126,127,129,130,131,132,134,135,136,137,139,140,141,142,144,145,146,147,149,150,151,152,154,155,156,158,159,160,161,163,164,165,166,168,169,170,171,173,174,175,176,178,179,180,181,183,184,185,186,188,189,190,192,193,194,195,197,198,199,200,202,203,204,205,207,208,209,210,212,213,214,215,217,218,219,220,222,223,224,226,226,226,227,227,228,228,229,229,230,230,231,231,232,232,233,233,234,234,234,235,235,236,236,237,237,238,238,239,239,240,240,241,241,242,242,243,243,243,244,244,244,245,245,245,246,246,246,247,247,247,248,248,248,249,249,249,250,250,250,251,251,251,252,252,252,253,253,253,254,254,254,255],nz=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,43,44,45,46,47,48,50,51,52,53,54,55,56,58,59,60,61,62,63,65,66,67,68,69,70,72,73,74,76,77,78,80,81,83,84,85,87,88,89,91,92,94,95,96,98,99,100,102,103,105,106,107,109,110,111,113,114,116,117,118,120,121,122,124,125,127,128,129,131,132,133,135,136,138,139,140,142,143,144,146,147,149,150,151,153,154,155,157,158,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,192,193,193,194,195,195,196,197,197,198,199,199,200,201,201,202,203,203,204,205,205,206,207,207,208,209,209,210,211,211,212,213,213,214,215,215,216,217,217,218,219,219,220,221,221,222,223,223,224,225,225,226,227,227,228,229,229,230,231,231,232,233,233,234,235,235,236,237,237,238,239,239,240,241,241,242,243,243,244,245,245,246,247,247,248,249,249,250,251,251,252,253,253,254,255],iz=function(e){k(r,e);var t=W(r);function r(e,n,i,o){var a;return U(this,r),a=t.call(this,e,ez,i,o),rO(S(a),"inputTexture",void 0),rO(S(a),"lightLevel",.1),rO(S(a),"rednessLevel",.5),rO(S(a),"mskin_he_max",175/180*3.141593),rO(S(a),"mskin_he_min",115/180*3.141593),rO(S(a),"mskin_hc_max",173/180*3.141593),rO(S(a),"mskin_hc_min",116/180*3.141593),rO(S(a),"mskin_hc_axis",2.04203545),rO(S(a),"mfacts_rotate_c",0),rO(S(a),"mfacts_rotate_le",0),rO(S(a),"mfacts_rotate_ge",0),rO(S(a),"tab_addr",null),rO(S(a),"lutTextures",[]),a.inputTexture=n,a.init(),a}return F(r,[{key:"setUniforms",value:function(){var e=this.gl.getUniformLocation(this.program,"u_flipY"),t=this.gl.getUniformLocation(this.program,"u_denoiseLevel");this.gl.uniform1f(t,this.denoiseLevel),this.gl.uniform1f(e,1);var r=this.gl.getUniformLocation(this.program,"light");this.gl.uniform1f(r,this.lightLevel);var n=this.gl.getUniformLocation(this.program,"redness");this.gl.uniform1f(n,this.rednessLevel);var i=this.gl.getUniformLocation(this.program,"skin_he_max"),o=this.gl.getUniformLocation(this.program,"skin_he_min"),a=this.gl.getUniformLocation(this.program,"skin_hc_max"),s=this.gl.getUniformLocation(this.program,"skin_hc_min"),c=this.gl.getUniformLocation(this.program,"skin_hc_axis"),u=this.gl.getUniformLocation(this.program,"facts_rotate_c"),d=this.gl.getUniformLocation(this.program,"facts_rotate_le"),l=this.gl.getUniformLocation(this.program,"facts_rotate_ge");this.gl.uniform1f(i,this.mskin_he_max),this.gl.uniform1f(o,this.mskin_he_min),this.gl.uniform1f(a,this.mskin_hc_max),this.gl.uniform1f(s,this.mskin_hc_min),this.gl.uniform1f(c,this.mskin_hc_axis),this.gl.uniform1f(u,this.mfacts_rotate_c),this.gl.uniform1f(d,this.mfacts_rotate_le),this.gl.uniform1f(l,this.mfacts_rotate_ge);var p=this.gl.getUniformLocation(this.program,"u_originImage");this.gl.activeTexture(this.gl.TEXTURE2),this.gl.bindTexture(this.gl.TEXTURE_2D,this.inputTexture),this.gl.uniform1i(p,2);for(var f=["lighten_lut"],h=[this.gl.TEXTURE3],A=0;A<f.length;A++){var v=this.gl.getUniformLocation(this.program,f[A]);this.gl.activeTexture(h[A]),this.gl.bindTexture(this.gl.TEXTURE_2D,this.lutTextures[A]),this.gl.uniform1i(v,A+3)}}},{key:"setParameters",value:function(e){void 0!==e.denoiseLevel&&(this.denoiseLevel=e.denoiseLevel),void 0!==e.lightLevel&&(this.lightLevel=e.lightLevel),void 0!==e.rednessLevel&&(this.rednessLevel=e.rednessLevel,this.updateRedness(this.rednessLevel)),e.lighteningContrastLevel&&this.updateLut(e.lighteningContrastLevel)}},{key:"init",value:function(){this.tab_addr=new Uint8Array(rz);for(var e=[this.tab_addr],t=[256],r=[1],n=0;n<e.length;n++){var i=this.gl.createTexture();if(!i)throw new SD(mD.WEBGL_INTERNAL_ERROR,"create lut texture failed");this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,t[n],r[n],0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,e[n]),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.lutTextures.push(i)}}},{key:"updateRedness",value:function(e){var t,r,n=3.141593,i=e,o=i;i>1&&(i=1),i<0&&(i=0),o>1&&(o=1),o<0&&(o=0),this.mfacts_rotate_c=.8*i,o<.8&&(o=0),this.mskin_he_max=175/180*n,this.mskin_hc_max=173/180*n,this.mskin_he_min=(115-4*o)/180*n,this.mskin_hc_min=(116-4*o)/180*n,this.mskin_hc_axis=(117-4*o)/180*n,this.mskin_hc_axis<this.mskin_hc_min&&(this.mskin_hc_axis=this.mskin_hc_min),this.mskin_hc_min<n/2&&(this.mskin_hc_min=n/2),this.mskin_hc_axis<n/2&&(this.mskin_hc_axis=n/2),this.mskin_he_min<n/2&&(this.mskin_he_min=n/2),this.mskin_hc_max>n&&(this.mskin_hc_max=n),this.mskin_hc_axis>n&&(this.mskin_hc_axis=n),this.mskin_he_max>n&&(this.mskin_he_max=n),t=this.mskin_he_max-this.mskin_hc_max,r=this.mskin_hc_max-this.mskin_hc_axis,this.mfacts_rotate_ge=t>.01?this.mfacts_rotate_c*r/t:this.mfacts_rotate_c,t=this.mskin_hc_min-this.mskin_he_min,r=this.mskin_hc_axis-this.mskin_hc_min,this.mfacts_rotate_le=t>.01?this.mfacts_rotate_c*r/t:this.mfacts_rotate_c}},{key:"updateLut",value:function(e){var t=null;if(0===e&&(t=rz),1===e&&(t=nz),2===e&&(t=tz),!t)throw new SD(mD.WEBGL_INTERNAL_ERROR,"invalid ylut_table value:"+e);this.tab_addr=new Uint8Array(t);for(var r=[this.tab_addr],n=[256],i=[1],o=0;o<r.length;o++)this.gl.bindTexture(this.gl.TEXTURE_2D,this.lutTextures[o]),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,n[o],i[o],0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,r[o])}}]),r}(YJ),oz=function(){function e(){U(this,e),rO(this,"gl",null),rO(this,"canvas",null),rO(this,"programs",[]),rO(this,"commonProgram",null),rO(this,"inputTexture",null),rO(this,"outputTextures",[]),rO(this,"fbos",[]),rO(this,"originalFrameWidth",0),rO(this,"originalFrameHeight",0),rO(this,"enableBeauty",!1),rO(this,"denoiseLevel",5),rO(this,"lightLevel",.35),rO(this,"rednessLevel",.5),rO(this,"lighteningContrastLevel",1)}return F(e,[{key:"setEnableBeauty",value:function(e){this.enableBeauty=!!e}},{key:"init",value:function(e,t,r){if(!oL().supportWebGL)throw new SD(mD.NOT_SUPPORTED,"your browser is not support webGL");if(this.gl=r.getContext("webgl"),!this.gl)throw new SD(mD.WEBGL_INTERNAL_ERROR,"can not get webgl context");if(this.initGL(e,t),!this.inputTexture)throw new SD(mD.WEBGL_INTERNAL_ERROR,"can not find input texture");this.canvas=r,this.programs.push(new WJ(this.gl)),this.programs.push(new JJ(this.gl,e,t)),this.programs.push(new XJ(this.gl,e,t)),this.programs.push(new $J(this.gl,e,t)),this.programs.push(new iz(this.gl,this.inputTexture,e,t)),this.commonProgram=this.programs[0].program,this.setDenoiseLevel(this.denoiseLevel),this.setLightLevel(this.lightLevel),this.setRednessLevel(this.rednessLevel),this.setContrastLevel(this.lighteningContrastLevel)}},{key:"render",value:function(e){if(this.gl&&this.commonProgram&&this.canvas){var t=0;if(this.originalFrameHeight===e.videoWidth&&this.originalFrameWidth===e.videoHeight)t=2;else if(this.originalFrameHeight!==e.videoHeight||this.originalFrameWidth!==e.videoWidth){if(ND.debug("beauty effect: resolution changed ".concat(this.originalFrameWidth,"x").concat(this.originalFrameHeight," -> ").concat(e.videoWidth,"x").concat(e.videoHeight)),0===e.videoHeight||0===e.videoWidth)return void ND.debug("beauty effect: skip 0 resolution frame");this.canvas.width=e.videoWidth,this.canvas.height=e.videoHeight,e.setAttribute("width",e.videoWidth.toString()),e.setAttribute("height",e.videoHeight.toString()),this.release(),this.init(e.videoWidth,e.videoHeight,this.canvas)}this.gl.viewport(0,0,e.videoWidth,e.videoHeight),this.gl.bindTexture(this.gl.TEXTURE_2D,this.inputTexture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e);for(var r=this.enableBeauty?this.programs.length-1:0,n=0;n<=r;n++){var i=this.programs[n].program;this.gl.useProgram(i);var o=this.gl.getUniformLocation(i,"u_image");this.programs[n].setUniforms(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbos[t+n%2]),this.gl.clearColor(0,0,0,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.outputTextures[t+n%2]),this.gl.uniform1i(o,0)}this.gl.useProgram(this.commonProgram);var a=this.gl.getUniformLocation(this.commonProgram,"u_flipY");this.gl.uniform1f(a,-1),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),this.gl.clearColor(0,0,0,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.drawArrays(this.gl.TRIANGLES,0,6)}else ND.warning("video effect manager is not init!")}},{key:"setDenoiseLevel",value:function(e){this.programs.forEach((function(t){t instanceof YJ&&t.setParameters({denoiseLevel:e})})),this.denoiseLevel=e}},{key:"setLightLevel",value:function(e){this.programs.forEach((function(t){t instanceof YJ&&t.setParameters({lightLevel:e})})),this.lightLevel=e}},{key:"setRednessLevel",value:function(e){this.programs.forEach((function(t){t instanceof YJ&&t.setParameters({rednessLevel:e})})),this.rednessLevel=e}},{key:"setContrastLevel",value:function(e){this.programs.forEach((function(t){t instanceof YJ&&t.setParameters({lighteningContrastLevel:e})})),this.lighteningContrastLevel=e}},{key:"setSize",value:function(e,t){this.programs.forEach((function(r){r instanceof YJ&&r.setSize(e,t)}))}},{key:"release",value:function(){this.gl=null,this.commonProgram=null,this.inputTexture=null,this.programs=[],this.outputTextures=[],this.fbos=[]}},{key:"initGL",value:function(e,t){if(!this.gl)throw new SD(mD.WEBGL_INTERNAL_ERROR,"can not find webgl context");this.inputTexture=this.gl.createTexture(),this.gl.bindTexture(this.gl.TEXTURE_2D,this.inputTexture),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);for(var r=0;r<4;r++){var n=this.gl.createTexture();if(!n)throw new SD(mD.WEBGL_INTERNAL_ERROR,"create texture failed");this.gl.bindTexture(this.gl.TEXTURE_2D,n),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),r<2?this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,e,t,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null):this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,t,e,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null);var i=this.gl.createFramebuffer();if(!i)throw new SD(mD.WEBGL_INTERNAL_ERROR,"create frame buffer failed");this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,i),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,n,0),this.outputTextures.push(n),this.fbos.push(i)}this.gl.viewport(0,0,e,t),this.originalFrameWidth=e,this.originalFrameHeight=t}}]),e}(),az=function(){function e(){U(this,e),rO(this,"targetFrameRate",0),rO(this,"recordedFrameCount",0),rO(this,"recordingTime",2),rO(this,"recordID",void 0)}return F(e,[{key:"startRecordBeautyEffectOutput",value:function(){var e=y(G.mark((function e(t){var r,n,i=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=i.length>1&&void 0!==i[1]?i[1]:4,!this.recordID){e.next=3;break}throw new SD(mD.UNEXPECTED_ERROR,"another beauty effect recording is in progress");case 3:return n=XG(6,""),this.recordID=n,this.targetFrameRate=t,this.recordedFrameCount=0,this.recordingTime=r,e.next=10,JG(1e3*this.recordingTime);case 10:return e.abrupt("return",this.recordID!==n?(this.recordID=void 0,!0):(this.recordID=void 0,this.recordedFrameCount<this.targetFrameRate*this.recordingTime/2?(ND.warning("detect beauty effect overload, current framerate",this.recordedFrameCount/2),!1):(ND.debug("beauty effect current framerate",this.recordedFrameCount/2),!0)));case 11:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"stopRecordBeautyEffectOutput",value:function(){this.targetFrameRate=0,this.recordedFrameCount=0,this.recordID=void 0}},{key:"addFrame",value:function(){this.recordID&&(this.recordedFrameCount+=1)}}]),e}(),sz=function(e){k(r,e);var t=W(r);function r(){var e;return U(this,r),e=t.call(this),rO(S(e),"name","BeautyProcessor"),rO(S(e),"fps",15),rO(S(e),"canvas",void 0),rO(S(e),"video",void 0),rO(S(e),"manager",void 0),rO(S(e),"overloadDetector",new az),rO(S(e),"stopChromeBackgroundLoop",null),rO(S(e),"onOverload",void 0),rO(S(e),"stopLoop",void 0),rO(S(e),"lastRenderTime",0),e.fps=30,e.manager=new oz,e._enabled=!1,e}return F(r,[{key:"onEnableChange",value:function(){var e=y(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.manager.setEnableBeauty(t),e.t0=this.context&&this.inputTrack,!e.t0){e.next=10;break}if(!t){e.next=8;break}return e.next=6,this.startEffect(this.inputTrack,this.context);case 6:e.next=10;break;case 8:return e.next=10,this.stopEffect(this.inputTrack,this.context);case 10:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"setBeautyEffectOptions",value:function(){var e=y(G.mark((function e(t){var r,n,i,o;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:(function(e){void 0!==e.smoothnessLevel&&bx(e.smoothnessLevel,"options.smoothnessLevel",0,1,!1),void 0!==e.lighteningLevel&&bx(e.lighteningLevel,"options.lighteningLevel",0,1,!1),void 0!==e.rednessLevel&&bx(e.rednessLevel,"options.rednessLevel",0,1,!1),void 0!==e.lighteningContrastLevel&&Sx(e.lighteningContrastLevel,"options.lighteningContrastLevel",[0,1,2])})(t),void 0!==t.smoothnessLevel&&(r=Math.max(.1,10*t.smoothnessLevel),this.manager.setDenoiseLevel(r)),void 0!==t.lighteningLevel&&(n=Math.max(.1,t.lighteningLevel/2),this.manager.setLightLevel(n)),void 0!==t.rednessLevel&&(i=Math.max(.01,t.rednessLevel),this.manager.setRednessLevel(i)),void 0!==t.lighteningContrastLevel&&(o=t.lighteningContrastLevel,this.manager.setContrastLevel(o));case 4:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"onTrack",value:function(){var e=y(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.video&&this.enabled,!e.t0){e.next=5;break}return null===(n=this.stopLoop)||void 0===n||n.call(this),e.next=5,this.stopEffect(t,r);case 5:return e.next=7,this.startEffect(t,r);case 7:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"startEffect",value:function(){var e=y(G.mark((function e(t,r){var n,i,o,a,s=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.enabled){e.next=2;break}return e.abrupt("return");case 2:return n=Tk(),e.next=5,this.renderWithWebGL(t);case 5:i=e.sent,this.output(i,r),ND.info("start video effect, output:",this.outputTrack),this.overloadDetector.startRecordBeautyEffectOutput(this.fps).then((function(e){e||s.onOverload&&s.onOverload()})),o=!1,this.stopLoop=function(){o=!0},a=function e(){s.enabled&&!o&&requestAnimationFrame(e);var t=Date.now(),r=1e3/s.fps,n=s.lastRenderTime?t-s.lastRenderTime:r;n<r||(s.lastRenderTime=t-(n-r),s.video&&s.video.paused&&s.video.play(),s.enabled&&s.video&&(s.manager.render(s.video),s.outputTrack&&s.outputTrack.requestFrame&&s.outputTrack.requestFrame(),s.overloadDetector.addFrame()))},requestAnimationFrame(a),n.name===Sk.CHROME&&document.addEventListener("visibilitychange",(function(){document.hidden?s.stopChromeBackgroundLoop=hV((function(){s.enabled&&s.video&&s.manager.render(s.video),s.outputTrack&&s.outputTrack.requestFrame&&s.outputTrack.requestFrame(),s.overloadDetector.addFrame()}),s.fps):s.stopChromeBackgroundLoop&&(s.stopChromeBackgroundLoop(),s.stopChromeBackgroundLoop=null)}),!1);case 11:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"renderWithWebGL",value:function(){var e=y(G.mark((function e(t){var r,n,i,o,a,s=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.canvas&&(this.canvas.remove(),this.canvas=void 0),this.video&&(this.video.remove(),this.video=void 0),this.canvas=document.createElement("canvas"),this.video=document.createElement("video"),this.video.setAttribute("autoplay",""),this.video.setAttribute("muted",""),this.video.muted=!0,this.video.setAttribute("playsinline",""),this.video.setAttribute("style","display:none"),this.video.srcObject=new MediaStream([t]),r=new Rb((function(e){var t=function t(){s.video&&s.video.removeEventListener("playing",t),e(void 0)};s.video&&s.video.addEventListener("playing",t)})),this.video.play(),e.next=5,r;case 5:if(n=t.getSettings(),i=n.width||this.video.videoWidth,o=n.height||this.video.videoHeight,n.frameRate&&this.fps!==n.frameRate&&(this.fps=n.frameRate,ND.debug("beauty video processor: set fps to",this.fps)),ND.debug("beauty video processor: width ".concat(i," height ").concat(o)),i&&o){e.next=8;break}throw new SD(mD.BEAUTY_PROCESSOR_INTERNAL_ERROR,"can not get track resolution");case 8:return this.canvas.width=i,this.canvas.height=o,this.video.setAttribute("width",i.toString()),this.video.setAttribute("height",o.toString()),this.manager.init(i,o,this.canvas),a=oL(),e.abrupt("return",this.canvas.captureStream(a.supportRequestFrame?0:this.fps).getVideoTracks()[0]);case 11:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"stopEffect",value:function(){var e=y(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:ND.info("stop video effect"),this.overloadDetector.stopRecordBeautyEffectOutput(),this.manager.release(),this.canvas&&this.canvas.remove(),this.video&&this.video.remove(),this.canvas=void 0,this.video=void 0,this.output(t,r);case 1:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()}]),r}(UJ.exports.VideoProcessor);function cz(e){var t={};if(e.facingMode&&(t.facingMode=e.facingMode),e.cameraId&&(t.deviceId={exact:e.cameraId}),!e.encoderConfig)return t;var r=lN(e.encoderConfig);return t.width=r.width,t.height=r.height,!Wk()&&r.frameRate&&(t.frameRate=r.frameRate),Tk().name===Sk.EDGE&&"object"==D(t.frameRate)&&(t.frameRate.max=60),Uk()&&(t.frameRate={ideal:30,max:30}),t}function uz(e){var t={};e.screenSourceType&&(t.mediaSource=e.screenSourceType),e.extensionId&&Bk()&&(t.extensionId=e.extensionId),e.electronScreenSourceId&&(t.sourceId=e.electronScreenSourceId);var r=e.encoderConfig?pN(e.encoderConfig):null;return t.mandatory={chromeMediaSource:"desktop",maxWidth:r?r.width:void 0,maxHeight:r?r.height:void 0},r&&r.frameRate&&("number"==typeof r.frameRate?(t.mandatory.maxFrameRate=r.frameRate,t.mandatory.minFrameRate=r.frameRate):(t.mandatory.maxFrameRate=r.frameRate.max||r.frameRate.ideal||r.frameRate.exact||void 0,t.mandatory.minFrameRate=r.frameRate.min||r.frameRate.ideal||r.frameRate.exact||void 0),t.frameRate=r.frameRate),r&&r.width&&(t.width=r.width),r&&r.height&&(t.height=r.height),t}function dz(e){var t={};if(Wk()||(void 0!==e.AGC&&(t.autoGainControl=e.AGC),void 0!==e.AEC&&(t.echoCancellation=e.AEC),void 0!==e.ANS&&(t.noiseSuppression=e.ANS,Bk()&&e.ANS&&(t.googHighpassFilter=e.ANS))),e.encoderConfig){var r=AN(e.encoderConfig);t.channelCount=r.stereo?2:1,t.sampleRate=r.sampleRate,t.sampleSize=r.sampleSize}return e.microphoneId&&(t.deviceId={exact:e.microphoneId}),qk()&&(t.sampleRate=void 0),t}!function(e){e.COVERED="COVERED",e.POSITION="POSITION",e.SIZE="SIZE",e.STYLE="STYLE"}(GJ||(GJ={})),function(e){e.UNMOUNTED="UNMOUNTED",e.INVALID_HTML_ELEMENT="INVALID_HTML_ELEMENT"}(KJ||(KJ={}));var lz,pz,fz,hz,Az,vz,gz,mz,Ez,_z,yz,Iz,Sz,bz,Cz,wz,Rz,Tz,kz,Oz,Dz,Nz,xz,Pz=new(function(){function e(){var t=this;U(this,e),rO(this,"_clientSize",null),rO(this,"getClientWidth",(function(){return document.documentElement?document.documentElement.clientWidth:document.body.clientWidth})),rO(this,"getClientHeight",(function(){return document.documentElement?document.documentElement.clientHeight:document.body.clientHeight})),rO(this,"getStyle",(function(e){return window.getComputedStyle(e,null)})),rO(this,"checkCssVisibleProperty",(function(e){var r=!0,n=t.getStyle(e),i=n.display,o=n.visibility,a=n.opacity,s=n.filter;return("none"===i||["hidden","collapse"].includes(o)||Number(a)<.1)&&(r=!1),!!r&&(s&&s.split(" ").filter((function(e){var t=e.split("(")[0];return["brightness","blur","opacity"].includes(t)})).map((function(e){var t=e.split(/\(|\)/),r=E(t,2),n=r[0],i=r[1];return[n,Number(i.match(/^[0-9\.]+/))]})).forEach((function(e){var t=E(e,2),n=t[0],i=t[1];switch(n){case"brightness":(i<.1||i>3)&&(r=!1);break;case"blur":i>3&&(r=!1);break;case"opacity":i<.1&&(r=!1)}})),r)})),rO(this,"checkPropertyUpToAllParentNodes",(function(e,t){for(var r=!0,n=!0,i=function(e){return t(e)},o=e;o&&n;)i(o)||(r=!1,n=!1),(o=o.parentElement)||(n=!1);return r})),rO(this,"checkActualCssVisibleIncludeInherit",(function(e){return t.checkPropertyUpToAllParentNodes(e,t.checkCssVisibleProperty)})),rO(this,"getSizeAboutClient",(function(e){var r=e.getBoundingClientRect(),n=r.width,i=r.height,o=r.left,a=r.right,s=r.top,c=r.bottom,u=t.getClientWidth(),d=t.getClientHeight();return{width:n,height:i,left:o,right:a,top:s,bottom:c,clientWidth:u,clientHeight:d,clientMin:Math.min(u,d)}})),rO(this,"checkActualSize",(function(){var e=t._clientSize,r=e.width,n=e.height,i=e.clientMin;return t.checkSizeIsVisible(r,n,i)})),rO(this,"elementFromPoint",(function(e,t){return document.elementFromPoint?document.elementFromPoint(e,t):null})),rO(this,"checkCoverForAPoint",(function(e,r,n){var i=t.elementFromPoint(e,r);return null!==i&&i!==n})),rO(this,"getPointPositionList",(function(){for(var e=t._clientSize,r=e.width,n=e.height,i=e.left,o=e.top,a=r/6,s=n/6,c=[],u=Math.pow(10,6),d=0;d<5;d++)for(var l=0;l<5;l++){var p=(i*u+(0===d?.1:4===d?(a*d*u-1e5)/u:a*d)*u)/u,f=(o*u+(0===l?.1:4===l?(s*l*u-1e5)/u:s*l)*u)/u;c.push({x:p,y:f})}return[].concat(c)})),rO(this,"checkElementCover",(function(e){return t.getPointPositionList().map((function(r){return t.checkCoverForAPoint(r.x,r.y,e)})).filter((function(e){return!!e})).length>6})),rO(this,"checkSizeIsVisible",(function(e,t,r){return(e>50||r/e<=10)&&(t>50||r/t<=10)})),rO(this,"checkSizeOfPartInClient",(function(){var e,r,n=t._clientSize,i=n.left,o=n.right,a=n.top,s=n.bottom,c=n.clientHeight,u=n.clientWidth,d=n.clientMin;if(i<0)e=0;else{if(!(i<u))return!1;e=i}if(o<0)return!1;if(a<0)r=0;else{if(!(a<c))return!1;r=a}if(s<0)return!1;var l=(o<u?o:u)-e,p=(s<c?s:c)-r;return t.checkSizeIsVisible(l,p,d)})),rO(this,"returnHiddenResult",(function(e){return t._clientSize=null,{visible:!1,reason:e}})),rO(this,"checkOneElementVisible",(function(e){if(e instanceof HTMLElement){if(t.checkElementIsMountedOnDom(e)){if(t.checkActualCssVisibleIncludeInherit(e)){if(t._clientSize=t.getSizeAboutClient(e),t.checkElementCover(e))return t.returnHiddenResult(GJ.COVERED);var r=t.checkActualSize(),n=t.checkSizeOfPartInClient();return r&&!n?t.returnHiddenResult(GJ.POSITION):r?(t._clientSize=null,{visible:!0}):t.returnHiddenResult(GJ.SIZE)}return t.returnHiddenResult(GJ.STYLE)}return t.returnHiddenResult(KJ.UNMOUNTED)}return t.returnHiddenResult(KJ.INVALID_HTML_ELEMENT)})),rO(this,"checkElementIsMountedOnDom",(function(e){return t.checkPropertyUpToAllParentNodes(e,(function(e){return"HTML"!==e.nodeName.toUpperCase()?null!==e.parentElement:!!document.documentElement}))}))}return F(e)}());function Lz(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Bz(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Lz(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Lz(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Mz=(lz=tN("LocalVideoTrack","getTrackId"),pz=AG(),fz=nV("LocalVideoTrack","_enabledMutex"),hz=AG(),Az=nV("LocalVideoTrack","_enabledMutex"),vz=AG(),gz=Jj({report:zj}),mz=AG(),Ez=AG(),_z=AG(),yz=AG(),Iz=AG(),Sz=AG(),bz=AG(),lz((Ej((wz=function(e){k(r,e);var t=W(r);function r(e,n,i,o,a,s){var c;return U(this,r),c=t.call(this,e,a),rO(S(c),"trackMediaType","video"),rO(S(c),"_player",void 0),rO(S(c),"_videoBeautyProcessor",void 0),rO(S(c),"_videoVisibleTimer",null),rO(S(c),"_previousVideoVisibleStatus",void 0),rO(S(c),"_clearPreviousVideoVisibleStatus",(function(){return c._previousVideoVisibleStatus=void 0})),rO(S(c),"_encoderConfig",void 0),rO(S(c),"_scalabiltyMode",{numSpatialLayers:1,numTemporalLayers:1}),rO(S(c),"_optimizationMode",void 0),rO(S(c),"_videoHeight",void 0),rO(S(c),"_videoWidth",void 0),rO(S(c),"_forceBitrateLimit",void 0),rO(S(c),"_enabled",!0),rO(S(c),"processorDestination",void 0),rO(S(c),"processorContext",void 0),c.updateMediaStreamTrackResolution(),c._encoderConfig=n,c._scalabiltyMode=i,c._optimizationMode=o,c._hints=s||[],-1===c._hints.indexOf(xP.SCREEN_TRACK)&&c.updateBitrateFromProfile(),c.processorContext=new Fz(c.getTrackId()),c.processorDestination=new Qz(c.processorContext),c.bindProcessorDestinationEvents(),c}return F(r,[{key:"isPlaying",get:function(){return!(!this._player||this._player.videoElementStatus!==vx.PLAYING)}},{key:"play",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.LOCAL_VIDEO_TRACK_PLAY,options:[this.getTrackId(),"string"==typeof e?e:"HTMLElement",r]});if("string"==typeof e){var i=document.getElementById(e);i?e=i:(ND.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),qD("warning",this,'can not find "#'.concat(e,'" element, use document.body')),e=document.body)}ND.debug("[".concat(this.getTrackId(),"] start video playback"),JSON.stringify(r)),ZD("debug",this,"play",r);var o=Bz(Bz(Bz({},this._getDefaultPlayerConfig()),r),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(o):(this._player=new BJ(o),this._player.updateVideoTrack(this._mediaStreamTrack)),this._player.play(),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((function(){try{var e=t.getVideoElementVisibleStatus();t.emit(BP.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),gN("CHECK_VIDEO_VISIBLE_INTERVAL")),n.onSuccess()}},{key:"stop",value:function(){var e=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.LOCAL_VIDEO_TRACK_STOP,options:[this.getTrackId()]});if(!this._player)return e.onSuccess();this._videoVisibleTimer&&(window.clearInterval(this._videoVisibleTimer),this._videoVisibleTimer=null),this._clearPreviousVideoVisibleStatus(),this._player.destroy(),this._player=void 0,ND.debug("[".concat(this.getTrackId(),"] stop video playback")),ZD("debug",this,"stop"),e.onSuccess()}},{key:"setEnabled",value:function(){var e=y(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r){e.next=4;break}if(t!==this._enabled){e.next=3;break}return e.abrupt("return");case 3:this.stateCheck("enabled",t);case 4:if(ND.info("[".concat(this.getTrackId(),"] start setEnabled"),t),ZD("info",this,"setEnabled",t),t){e.next=15;break}return this._originMediaStreamTrack.enabled=!1,e.prev=6,e.next=9,nK(this,NP.NEED_DISABLE_TRACK,this);case 9:e.next=14;break;case 11:throw e.prev=11,e.t0=e.catch(6),ND.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.t0.toString()),ZD("error",this,"setEnabled",t,e.t0.toString()),e.t0;case 14:return e.abrupt("return",(r||(this._enabled=!1),ND.info("[".concat(this.getTrackId(),"] setEnabled to false success")),void ZD("info",this,"setEnabled",t,"success")));case 15:return this._originMediaStreamTrack.enabled=!0,e.prev=16,e.next=19,nK(this,NP.NEED_ENABLE_TRACK,this);case 19:e.next=24;break;case 21:throw e.prev=21,e.t1=e.catch(16),ND.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.t1.toString()),ZD("error",this,"setEnabled",t,e.t1.toString()),e.t1;case 24:ND.info("[".concat(this.getTrackId(),"] setEnabled to true success")),ZD("info",this,"setEnabled",t,"success"),r||(this._enabled=!0);case 25:case"end":return e.stop()}}),e,this,[[6,11],[16,21]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"setMuted",value:function(){var e=y(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=t!==this._muted,!e.t0){e.next=14;break}if(this.stateCheck("muted",t),this._muted=t,this._mediaStreamTrack.enabled=!t,ND.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(t)),ZD("debug",this,"setMuted",t),!t){e.next=12;break}return e.next=10,nK(this,NP.NEED_MUTE_TRACK,this);case 10:e.next=14;break;case 12:return e.next=14,nK(this,NP.NEED_UNMUTE_TRACK,this);case 14:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"getStats",value:function(){var e=this;return lK((function(){ND.warning("[deprecated] LocalVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalVideoStats instead"),qD("warning",e,"[deprecated] LocalVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalVideoStats instead")}),"localVideoTrackGetStatsWarning"),iK(this,NP.GET_STATS)||Bz({},hP)}},{key:"setBeautyEffect",value:function(){var e=y(G.mark((function e(t){var r,n,i,o,a,s=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=s.length>1&&void 0!==s[1]?s[1]:{},n=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.LOCAL_VIDEO_TRACK_BEAUTY,options:[this.getTrackId(),t,r]}),!t&&!this._videoBeautyProcessor){e.next=30;break}if(Nk()!==Ik.IOS&&Nk()!==Ik.ANDROID){e.next=6;break}throw i=new SD(mD.INVALID_OPERATION,"can not enable beauty effect on mobile device"),n.onError(i),i;case 6:if(this._enabled||!t){e.next=9;break}throw o=new SD(mD.TRACK_IS_DISABLED,"can not enable beauty effect when track is disabled"),n.onError(o),o;case 9:if(ND.info("[".concat(this.getTrackId(),"] start setBeautyEffect"),t,JSON.stringify(r)),ZD("info",this,"setBeautyEffect",[t,r]),!this._videoBeautyProcessor&&!t){e.next=29;break}return e.prev=10,this._videoBeautyProcessor||(this._videoBeautyProcessor=new sz,this.processor?(a=this.processor,this.pipe(this._videoBeautyProcessor).pipe(a)):this.pipe(this._videoBeautyProcessor).pipe(this.processorDestination)),e.next=14,this._videoBeautyProcessor.setBeautyEffectOptions(r);case 14:if(!t){e.next=19;break}return e.next=17,this._videoBeautyProcessor.enable();case 17:e.next=21;break;case 19:return e.next=21,this._videoBeautyProcessor.disable();case 21:e.next=26;break;case 23:throw e.prev=23,e.t0=e.catch(10),ND.error("[".concat(this.getTrackId(),"] setBeautyEffect error"),e.t0.toString()),ZD("info",this,"setBeautyEffect",[t,r]),n.onError(e.t0),e.t0;case 26:ND.info("[".concat(this.getTrackId(),"] setBeautyEffect success")),ZD("info",this,"setBeautyEffect",[t,r],"success"),n.onSuccess(),e.next=30;break;case 29:n.onSuccess();case 30:case"end":return e.stop()}}),e,this,[[10,23]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"getCurrentFrameData",value:function(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}},{key:"clone",value:function(e,t,n,i){return new r(this._mediaStreamTrack.clone(),e,t,n,i)}},{key:"setBitrateLimit",value:function(){var e=y(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ND.debug("[".concat(this.getTrackId(),"] set bitrate limit, ").concat(JSON.stringify(t))),ZD("debug",this,"setBitrateLimit",t),!t){e.next=10;break}return this._forceBitrateLimit=t,this._encoderConfig&&(this._encoderConfig.bitrateMax?this._encoderConfig.bitrateMax=this._encoderConfig.bitrateMax<t.max_bitrate?this._encoderConfig.bitrateMax:t.max_bitrate:this._encoderConfig.bitrateMax=t.max_bitrate,this._encoderConfig.bitrateMin,this._encoderConfig.bitrateMin=t.min_bitrate),e.prev=2,e.next=5,nK(this,NP.NEED_UPDATE_VIDEO_ENCODER,this);case 5:e.next=10;break;case 7:return e.prev=7,e.t0=e.catch(2),e.abrupt("return",e.t0.throw());case 10:case"end":return e.stop()}}),e,this,[[2,7]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"setOptimizationMode",value:function(){var e=y(G.mark((function e(t){var r;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("motion"===t||"detail"===t||"balanced"===t){e.next=2;break}return e.abrupt("return",(ND.error(mD.INVALID_PARAMS,"optimization mode must be motion, detail or balanced"),void ZD("error",this,"setOptimizationMode",t,mD.INVALID_PARAMS)));case 2:return r=this._optimizationMode,e.prev=3,this._optimizationMode=t,e.next=7,nK(this,NP.SET_OPTIMIZATION_MODE,this);case 7:e.next=12;break;case 9:throw e.prev=9,e.t0=e.catch(3),this._optimizationMode=r,ND.error("[".concat(this.getTrackId(),"] set optimization mode failed"),e.t0.toString()),ZD("error",this,"setOptimizationMode",t,e.t0.toString()),e.t0;case 12:ND.info("[".concat(this.getTrackId(),"] set optimization mode success (").concat(t,")")),ZD("info",this,"setOptimizationMode",t,"success");case 13:case"end":return e.stop()}}),e,this,[[3,9]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"setScalabiltyMode",value:function(e){if(1===e.numSpatialLayers&&1!==e.numTemporalLayers)return ND.error(mD.INVALID_PARAMS,"scalability mode currently not supported, no SVC."),ZD("error",this,"setScalabiltyMode",e,mD.INVALID_PARAMS),void(this._scalabiltyMode={numSpatialLayers:1,numTemporalLayers:1});this._scalabiltyMode=e,ND.info("[".concat(this.getTrackId(),"] set scalability mode success (").concat(e,")")),ZD("info",this,"setScalabiltyMode",e,"success")}},{key:"updateMediaStreamTrackResolution",value:function(){var e=this;eK(this._originMediaStreamTrack).then((function(t){var r=E(t,2),n=r[0],i=r[1];e._videoHeight=i,e._videoWidth=n})).catch($G)}},{key:"_updatePlayerSource",value:function(){this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}},{key:"_getDefaultPlayerConfig",value:function(){return{fit:"contain"}}},{key:"updateBitrateFromProfile",value:function(){if(this._encoderConfig){var e=this.getMediaStreamTrackSettings(),t=e.width,r=e.height,n=e.frameRate;if(t&&r&&n){var i=function(e,t,r){var n,i=gN("BITRATE_ADAPTER_TYPE"),o=200*Math.pow(r/15,.6)*Math.pow(e*t/640/360,.75),a=o;if("STANDARD_BITRATE"===i)n=4*o;else{if("COMPATIABLE_BITRATE"!==i)return;n=2*o}return[Math.floor(n),Math.floor(a)]}(t,r,n)||[void 0,void 0],o=E(i,2),a=o[0],s=o[1];this._encoderConfig.bitrateMin||this._encoderConfig.bitrateMax||(this._encoderConfig.bitrateMin=s,this._encoderConfig.bitrateMax=a,ND.debug("[".concat(this.getTrackId(),"] update bitrate from profile, [w: ").concat(t,", h: ").concat(r,", fps: ").concat(n,"] => [brMax: ").concat(a,", brMin: ").concat(s,"]")),ZD("debug",this,"updateBitrateFromProfile",void 0,"[w: ".concat(t,", h: ").concat(r,", fps: ").concat(n,"] => [brMax: ").concat(a,", brMin: ").concat(s,"]")))}}}},{key:"getVideoElementVisibleStatus",value:function(){try{var e,t,r=null==this||null===(e=this._player)||void 0===e?void 0:e.getContainerElement(),n={track:this,element:null==this||null===(t=this._player)||void 0===t?void 0:t.getVideoElement(),slot:null==r?void 0:r.parentElement},i=n.element,o=n.slot;if(this.isPlaying&&i instanceof HTMLVideoElement&&o instanceof HTMLElement){var a=Pz.checkOneElementVisible(i),s=Object.assign({},a);if(s.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=s.visible;var c=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.LOCAL_VIDEO_TRACK_GET_VIDEO_VISIBLE,options:[this.getTrackId()]});s.visible?c.onSuccess("Video is visible"):c.onSuccess("Invisible because of ".concat(s.reason))}return s}return}catch(e){throw new SD(mD.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}},{key:"renewMediaStreamTrack",value:function(){var e=y(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"pipe",value:function(e){if(this._videoBeautyProcessor&&e!==this._videoBeautyProcessor)return this._videoBeautyProcessor.pipe(e);if(this.processor===e)return e;if(e._source)throw new SD(mD.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,context:this.processorContext}),e}},{key:"unpipe",value:function(){if(this.processor){var e=this.processor;this.processor._source=void 0,this.processor=void 0,e.reset()}}},{key:"close",value:function(){f(d(r.prototype),"close",this).call(this),this.unbindProcessorDestinationEvents(),this.unbindProcessorContextEvents(),this.unpipe(),this.processorDestination._source&&this.processorDestination._source.unpipe()}},{key:"bindProcessorDestinationEvents",value:function(){var e=this;this.processorDestination.on(tL.ON_TRACK,function(){var t=y(G.mark((function t(r){return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!r){t.next=9;break}if(t.t0=r!==e._mediaStreamTrack,!t.t0){t.next=7;break}return e._mediaStreamTrack=r,e._updatePlayerSource(),t.next=7,nK(e,NP.NEED_REPLACE_TRACK,e);case 7:t.next=15;break;case 9:if(t.t1=e._mediaStreamTrack!==e._originMediaStreamTrack,!t.t1){t.next=15;break}return e._mediaStreamTrack=e._originMediaStreamTrack,e._updatePlayerSource(),t.next=15,nK(e,NP.NEED_REPLACE_TRACK,e);case 15:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}},{key:"unbindProcessorDestinationEvents",value:function(){this.processorDestination.removeAllListeners(tL.ON_TRACK)}},{key:"unbindProcessorContextEvents",value:function(){this.processorContext.removeAllListeners(rL.REQUEST_UPDATE_CONSTRAINTS),this.processorContext.removeAllListeners(rL.REQUEST_CONSTRAINTS)}}]),r}(iV)).prototype,"play",[pz],Object.getOwnPropertyDescriptor(wz.prototype,"play"),wz.prototype),Ej(wz.prototype,"setEnabled",[fz,hz],Object.getOwnPropertyDescriptor(wz.prototype,"setEnabled"),wz.prototype),Ej(wz.prototype,"setMuted",[Az,vz,gz],Object.getOwnPropertyDescriptor(wz.prototype,"setMuted"),wz.prototype),Ej(wz.prototype,"getStats",[mz],Object.getOwnPropertyDescriptor(wz.prototype,"getStats"),wz.prototype),Ej(wz.prototype,"setBeautyEffect",[Ez],Object.getOwnPropertyDescriptor(wz.prototype,"setBeautyEffect"),wz.prototype),Ej(wz.prototype,"getCurrentFrameData",[_z],Object.getOwnPropertyDescriptor(wz.prototype,"getCurrentFrameData"),wz.prototype),Ej(wz.prototype,"setBitrateLimit",[yz],Object.getOwnPropertyDescriptor(wz.prototype,"setBitrateLimit"),wz.prototype),Ej(wz.prototype,"setOptimizationMode",[Iz],Object.getOwnPropertyDescriptor(wz.prototype,"setOptimizationMode"),wz.prototype),Ej(wz.prototype,"setScalabiltyMode",[Sz],Object.getOwnPropertyDescriptor(wz.prototype,"setScalabiltyMode"),wz.prototype),Ej(wz.prototype,"updateMediaStreamTrackResolution",[bz],Object.getOwnPropertyDescriptor(wz.prototype,"updateMediaStreamTrackResolution"),wz.prototype),Cz=wz))||Cz),Uz=(Rz=tN("CameraVideoTrack","getTrackId"),Tz=AG(),kz=nV("CameraVideoTrack","_enabledMutex"),Oz=AG(),Dz=AG(),Rz((Ej((xz=function(e){k(r,e);var t=W(r);function r(e,n,i,o,a,s){var c;return U(this,r),c=t.call(this,e,n.encoderConfig?lN(n.encoderConfig):{},o,a,s),rO(S(c),"_config",void 0),rO(S(c),"_originalConstraints",void 0),rO(S(c),"_constraints",void 0),rO(S(c),"_enabled",!0),rO(S(c),"_deviceName","default"),rO(S(c),"tryResumeVideoForIOS15WeChat",y(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=Fk()&&!Gk()&&Hk()&&c._enabled&&!c._isClosed,!e.t0){e.next=5;break}return ND.debug("[".concat(c.getTrackId(),"] try capture camera media device for interrupted iOS 15 device on WeChat.")),e.next=5,c.renewMediaStreamTrack();case 5:case"end":return e.stop()}}),e)})))),eN("info",S(c),"constructor",{trackId:s,deviceId:e.label,constraints:i,config:n}),c._config=n,c._originalConstraints=i,c._constraints=i,c._deviceName=e.label,c._config.encoderConfig&&(c._encoderConfig=lN(c._config.encoderConfig)),uV.on(Xj.IOS_15_INTERRUPTION_END,c.tryResumeVideoForIOS15WeChat),uV.on(Xj.IOS_INTERRUPTION_END,c.tryResumeVideoForIOS15WeChat),c.bindProcessorContextEvents(),c}return F(r,[{key:"setDevice",value:function(){var e=y(G.mark((function e(t){var r,n,i,o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.CAM_VIDEO_TRACK_SET_DEVICE,options:[this.getTrackId(),t]}),ND.info("[".concat(this.getTrackId(),"] set device to ").concat(t)),ZD("info",this,"setDevice",t),!this._enabled){e.next=38;break}return e.prev=2,e.next=5,lG.getDeviceById(t);case 5:return n=e.sent,(i={}).video=Bz({},this._constraints),i.video.deviceId={exact:t},i.video.facingMode=void 0,this._originMediaStreamTrack.stop(),o=null,e.prev=9,e.next=12,OV(i,this.getTrackId());case 12:o=e.sent,e.next=25;break;case 15:return e.prev=15,e.t0=e.catch(9),ND.error("[".concat(this.getTrackId(),"] setDevice failed"),e.t0.toString()),ZD("error",this,"setDevice",t,e.t0.toString()),e.next=21,OV({video:this._constraints},this.getTrackId());case 21:return o=e.sent,e.next=24,this._updateOriginMediaStreamTrack(o.getVideoTracks()[0],!1);case 24:throw e.t0;case 25:return e.next=27,this._updateOriginMediaStreamTrack(o.getVideoTracks()[0],!1);case 27:this.updateMediaStreamTrackResolution(),this._deviceName=n.label,this._config.cameraId=t,this._constraints.deviceId={exact:t},e.next=36;break;case 33:throw e.prev=33,e.t1=e.catch(2),r.onError(e.t1),ND.error("[".concat(this.getTrackId(),"] setDevice error"),e.t1.toString()),ZD("error",this,"setDevice",t,e.t1.toString()),e.t1;case 36:e.next=48;break;case 38:return e.prev=38,e.next=41,lG.getDeviceById(t);case 41:a=e.sent,this._deviceName=a.label,this._config.cameraId=t,this._constraints.deviceId={exact:t},e.next=48;break;case 45:throw e.prev=45,e.t2=e.catch(38),r.onError(e.t2),ND.error("[".concat(this.getTrackId(),"] setDevice error"),e.t2.toString()),ZD("error",this,"setDevice",t,e.t2.toString()),e.t2;case 48:ND.info("[".concat(this.getTrackId(),"] setDevice success")),ZD("info",this,"setDevice",t,"success"),r.onSuccess();case 49:case"end":return e.stop()}}),e,this,[[2,33],[9,15],[38,45]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"setEnabled",value:function(){var e=y(G.mark((function e(t,r){var n,i,o;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r){e.next=4;break}if(t!==this._enabled){e.next=3;break}return e.abrupt("return");case 3:this.stateCheck("enabled",t);case 4:if(ND.info("[".concat(this.getTrackId(),"] start setEnabled"),t),ZD("info",this,"setEnabled",t),t){e.next=15;break}return this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop(),r||(this._enabled=!1),e.prev=6,e.next=9,nK(this,NP.NEED_DISABLE_TRACK,this);case 9:e.next=14;break;case 11:throw e.prev=11,e.t0=e.catch(6),ND.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.t0.toString()),ZD("error",this,"setEnabled",t,e.t0.toString()),e.t0;case 14:return e.abrupt("return",(ND.info("[".concat(this.getTrackId(),"] setEnabled to false success")),void ZD("info",this,"setEnabled",t,"success")));case 15:return n=Bz({},this._constraints),(i=lG.searchDeviceIdByName(this._deviceName))&&!n.deviceId&&(n.deviceId={exact:i}),e.prev=17,e.next=20,OV({video:this._constraints},this.getTrackId());case 20:return o=e.sent,e.next=23,this._updateOriginMediaStreamTrack(o.getVideoTracks()[0],!1);case 23:return e.next=25,nK(this,NP.NEED_ENABLE_TRACK,this);case 25:e.next=30;break;case 27:throw e.prev=27,e.t1=e.catch(17),ND.error("[".concat(this.getTrackId(),"] setEnabled true error"),e.t1.toString()),ZD("error",this,"setEnabled",t,e.t1.toString()),e.t1;case 30:this.updateMediaStreamTrackResolution(),ND.info("[".concat(this.getTrackId(),"] setEnabled to true success")),ZD("info",this,"setEnabled",t,"success"),r||(this._enabled=!0);case 31:case"end":return e.stop()}}),e,this,[[6,11],[17,27]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"setEncoderConfiguration",value:function(){var e=y(G.mark((function e(t,r){var n,i,o,a,s;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.CAM_VIDEO_TRACK_SET_ENCODER_CONFIG,options:[this.getTrackId(),t]}),this._enabled){e.next=4;break}throw i=new SD(mD.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled"),n.onError(i),i;case 4:return t=lN(t),this._forceBitrateLimit&&(t.bitrateMax=this._forceBitrateLimit.max_bitrate?this._forceBitrateLimit.max_bitrate:t.bitrateMax,t.bitrateMin=this._forceBitrateLimit.min_bitrate?this._forceBitrateLimit.min_bitrate:t.bitrateMin),(o=uK(this._config)).encoderConfig=t,a=cz(o),(Mk()||Qk()||Kk())&&(a.deviceId=void 0),ND.debug("[".concat(this.getTrackId(),"] setEncoderConfiguration applyConstraints"),JSON.stringify(t),JSON.stringify(a)),ZD("debug",this,"setEncoderConfiguration",t),e.prev=9,e.next=12,this._originMediaStreamTrack.applyConstraints(a);case 12:this.updateMediaStreamTrackResolution(),e.next=19;break;case 15:throw e.prev=15,e.t0=e.catch(9),s=new SD(mD.UNEXPECTED_ERROR,e.t0.toString()),ND.error("[".concat(this.getTrackId(),"] applyConstraints error"),s.toString()),ZD("error",this,"setEncoderConfiguration",e.t0.toString()),n.onError(s),s;case 19:return this._config=o,this._constraints=a,this._originalConstraints=a,this._encoderConfig=t,-1===this._hints.indexOf(xP.SCREEN_TRACK)&&this.updateBitrateFromProfile(),e.prev=20,e.next=23,nK(this,NP.NEED_UPDATE_VIDEO_ENCODER,this);case 23:e.next=28;break;case 25:return e.prev=25,e.t1=e.catch(20),e.abrupt("return",(n.onError(e.t1),e.t1.throw()));case 28:n.onSuccess();case 29:case"end":return e.stop()}}),e,this,[[9,15],[20,25]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"_getDefaultPlayerConfig",value:function(){return{mirror:!0,fit:"cover"}}},{key:"onTrackEnded",value:function(){var e=this;if((Qk()||Kk())&&this._enabled&&!this._isClosed&&uV.duringInterruption){var t=function(){var r=y(G.mark((function r(){return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(uV.off(Xj.IOS_INTERRUPTION_END,t),r.t0=e._enabled&&!e._isClosed,!r.t0){r.next=9;break}return ND.debug("[".concat(e.getTrackId(),"] try capture camera media device for interrupted iOS device.")),qD("debug",e,"try capture camera media device for interrupted iOS device."),r.next=7,e.setEnabled(!1);case 7:return r.next=9,e.setEnabled(!0);case 9:case"end":return r.stop()}}),r)})));return function(){return r.apply(this,arguments)}}();uV.on(Xj.IOS_INTERRUPTION_END,t)}else ND.debug("[".concat(this.getTrackId(),"] track ended")),XD("debug",["MediaStreamTrack",this.getTrackId()],"ended"),this.emit(BP.TRACK_ENDED)}},{key:"renewMediaStreamTrack",value:function(){var e=y(G.mark((function e(t){var r,n,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t||this._constraints,(n=lG.searchDeviceIdByName(this._deviceName))&&!r.deviceId&&(r.deviceId={exact:n}),e.next=4,OV({video:r},this.getTrackId());case 4:return i=e.sent,this._constraints=r,e.next=8,this._updateOriginMediaStreamTrack(i.getVideoTracks()[0],!0);case 8:this.updateMediaStreamTrackResolution();case 9:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"close",value:function(){f(d(r.prototype),"close",this).call(this),uV.off(Xj.IOS_15_INTERRUPTION_END,this.tryResumeVideoForIOS15WeChat),uV.off(Xj.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15WeChat)}},{key:"bindProcessorContextEvents",value:function(){var e=this;this.processorContext.on(rL.REQUEST_UPDATE_CONSTRAINTS,function(){var t=y(G.mark((function t(r,n,i){var o;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,o=Object.assign.apply(Object,[{},e._originalConstraints].concat(M(r))),t.next=4,e.renewMediaStreamTrack(o);case 4:n(),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0),i(t.t0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e,r,n){return t.apply(this,arguments)}}()),this.processorContext.on(rL.REQUEST_CONSTRAINTS,function(){var t=y(G.mark((function t(r){return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r(e._originMediaStreamTrack.getSettings());case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}}]),r}(Mz)).prototype,"setDevice",[Tz],Object.getOwnPropertyDescriptor(xz.prototype,"setDevice"),xz.prototype),Ej(xz.prototype,"setEnabled",[kz,Oz],Object.getOwnPropertyDescriptor(xz.prototype,"setEnabled"),xz.prototype),Ej(xz.prototype,"setEncoderConfiguration",[Dz],Object.getOwnPropertyDescriptor(xz.prototype,"setEncoderConfiguration"),xz.prototype),Nz=xz))||Nz),Qz=function(e){k(r,e);var t=W(r);function r(e){var n;return U(this,r),n=t.call(this),rO(S(n),"name","VideoProcessorDestination"),rO(S(n),"ID","0"),rO(S(n),"_source",void 0),rO(S(n),"videoContext",void 0),rO(S(n),"inputTrack",void 0),n.videoContext=e,n}return F(r,[{key:"kind",get:function(){return"video"}},{key:"enabled",get:function(){return!0}},{key:"pipe",value:function(){throw new SD(mD.NOT_SUPPORTED,"VideoProcessor cannot pipe to any other Processor")}},{key:"unpipe",value:function(){throw new SD(mD.NOT_SUPPORTED,"VideoProcessor cannot unpipe to any other Processor")}},{key:"enable",value:function(){}},{key:"disable",value:function(){}},{key:"updateInput",value:function(e){if(e.context!==this.videoContext)throw new Error("ProcessorContext passed to VideoTrack.processorDestination doesn't match it's belonging VideoTrack's context.\nProbably you are making pipeline like this:\nvideoTrack1.pipe(processor).pipe(videoTrack2.processorDestination).");e.track&&e.track!==this.inputTrack&&(this.inputTrack=e.track,this.emit(tL.ON_TRACK,e.track))}},{key:"reset",value:function(){this.inputTrack=void 0,this.emit(tL.ON_TRACK,void 0)}}]),r}(yD),Fz=function(e){k(r,e);var t=W(r);function r(e){var n;return U(this,r),n=t.call(this),rO(S(n),"constraintsMap",new Map),rO(S(n),"statsRegistry",[]),rO(S(n),"trackId",void 0),n.trackId=e,n}return F(r,[{key:"getConstraints",value:function(){var e=y(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,rK(this,rL.REQUEST_CONSTRAINTS);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"requestApplyConstraints",value:function(){var e=y(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(ND.info("processor ".concat(r.name," requestApplyConstraints for ").concat(this.trackId)),t&&this.constraintsMap.set(r,t),nK(this,rL.REQUEST_UPDATE_CONSTRAINTS,Array.from(Rj(n=this.constraintsMap).call(n)))));case 1:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"requestRevertConstraints",value:function(){var e=y(G.mark((function e(t){var r;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.constraintsMap.has(t)){e.next=2;break}return e.abrupt("return",(ND.info("processor ".concat(t.name," requestRevertConstraints for ").concat(this.trackId)),this.constraintsMap.delete(t),nK(this,rL.REQUEST_UPDATE_CONSTRAINTS,Array.from(Rj(r=this.constraintsMap).call(r)))));case 2:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"registerStats",value:function(e,t,r){this.statsRegistry.find((function(r){return r.processorID===e.ID&&r.processorName===e.name&&r.type===t}))||this.statsRegistry.push({processorName:e.name,processorID:e.ID,type:t,cb:r})}},{key:"unregisterStats",value:function(e,t){}},{key:"gatherStats",value:function(){return this.statsRegistry.map((function(e){return{processorID:e.processorID,processorName:e.processorName,type:e.type,stats:(0,e.cb)()}}))}}]),r}(yD),jz=function(){function e(t,r){U(this,e),rO(this,"uid",void 0),rO(this,"_uintid",void 0),rO(this,"_trust_in_room_",!0),rO(this,"_trust_audio_enabled_state_",!0),rO(this,"_trust_video_enabled_state_",!0),rO(this,"_trust_audio_mute_state_",!0),rO(this,"_trust_video_mute_state_",!0),rO(this,"_trust_stream_added_state_",!0),rO(this,"_audio_muted_",!1),rO(this,"_video_muted_",!1),rO(this,"_audio_enabled_",!0),rO(this,"_video_enabled_",!0),rO(this,"_audio_added_",!1),rO(this,"_video_added_",!1),rO(this,"_audioTrack",void 0),rO(this,"_videoTrack",void 0),rO(this,"_audioSSRC",void 0),rO(this,"_videoSSRC",void 0),rO(this,"_audioOrtc",void 0),rO(this,"_videoOrtc",void 0),rO(this,"_cname",void 0),rO(this,"_rtxSsrcId",void 0),this.uid=t,this._uintid=r}return F(e,[{key:"hasVideo",get:function(){return this._video_enabled_&&!this._video_muted_&&this._video_added_}},{key:"hasAudio",get:function(){return this._audio_enabled_&&!this._audio_muted_&&this._audio_added_}},{key:"audioTrack",get:function(){if(this.hasAudio)return this._audioTrack}},{key:"videoTrack",get:function(){if(this.hasVideo)return this._videoTrack}}]),e}(),Vz=wb,Gz=yI,Kz=kI;gp({target:"Promise",stat:!0},{try:function(e){var t=Gz.f(this),r=Kz(e);return(r.error?t.reject:t.resolve)(r.value),t.promise}});var Hz=Vz,Wz=gp,Yz=su,qz=Xc,Jz=uF,zz=Vu,Xz=Pd,Zz=bp,$z=ON,eX=gF,tX=ZF,rX=rd,nX=$d("isConcatSpreadable"),iX=9007199254740991,oX="Maximum allowed index exceeded",aX=Yz.TypeError,sX=rX>=51||!qz((function(){var e=[];return e[nX]=!1,e.concat()[0]!==e})),cX=tX("concat"),uX=function(e){if(!zz(e))return!1;var t=e[nX];return void 0!==t?!!t:Jz(e)};Wz({target:"Array",proto:!0,forced:!sX||!cX},{concat:function(e){var t,r,n,i,o,a=Xz(this),s=eX(a,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(uX(o=-1===t?a:arguments[t])){if(c+(i=Zz(o))>iX)throw aX(oX);for(r=0;r<i;r++,c++)r in o&&$z(s,c,o[r])}else{if(c>=iX)throw aX(oX);$z(s,c++,o)}return s.length=c,s}});var dX={},lX=ku,pX=Fu,fX=Lv.f,hX=BN,AX="object"==("undefined"==typeof window?"undefined":D(window))&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];dX.f=function(e){return AX&&"Window"==lX(e)?function(e){try{return fX(e)}catch(e){return hX(AX)}}(e):fX(pX(e))};var vX={},gX=$d;vX.f=gX;var mX=Gu,EX=Md,_X=vX,yX=Ql.f,IX=function(e){var t=mX.Symbol||(mX.Symbol={});EX(t,e)||yX(t,e,{value:_X.f(e)})},SX=gp,bX=su,CX=qu,wX=pu,RX=mu,TX=iu,kX=Au,OX=od,DX=Xc,NX=Md,xX=uF,PX=fu,LX=Vu,BX=ou,MX=pd,UX=Hl,QX=Pd,FX=Fu,jX=dl,VX=Lm,GX=Cu,KX=Lg,HX=Ag,WX=Lv,YX=dX,qX=tg,JX=hu,zX=Ql,XX=pg,ZX=Eu,$X=yy,eZ=VE,tZ=Cd.exports,rZ=Hv,nZ=Vd,iZ=$d,oZ=vX,aZ=IX,sZ=a_,cZ=PE,uZ=CF.forEach,dZ=vv("hidden"),lZ="Symbol",pZ=iZ("toPrimitive"),fZ=cZ.set,hZ=cZ.getterFor(lZ),AZ=Object.prototype,vZ=bX.Symbol,gZ=vZ&&vZ.prototype,mZ=bX.TypeError,EZ=bX.QObject,_Z=CX("JSON","stringify"),yZ=JX.f,IZ=zX.f,SZ=YX.f,bZ=ZX.f,CZ=TX([].push),wZ=tZ("symbols"),RZ=tZ("op-symbols"),TZ=tZ("string-to-symbol-registry"),kZ=tZ("symbol-to-string-registry"),OZ=tZ("wks"),DZ=!EZ||!EZ.prototype||!EZ.prototype.findChild,NZ=kX&&DX((function(){return 7!=KX(IZ({},"a",{get:function(){return IZ(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=yZ(AZ,t);n&&delete AZ[t],IZ(e,t,r),n&&e!==AZ&&IZ(AZ,t,n)}:IZ,xZ=function(e,t){var r=wZ[e]=KX(gZ);return fZ(r,{type:lZ,tag:e,description:t}),kX||(r.description=t),r},PZ=function e(t,r,n){t===AZ&&e(RZ,r,n),UX(t);var i=jX(r);return UX(n),NX(wZ,i)?(n.enumerable?(NX(t,dZ)&&t[dZ][i]&&(t[dZ][i]=!1),n=KX(n,{enumerable:GX(0,!1)})):(NX(t,dZ)||IZ(t,dZ,GX(1,{})),t[dZ][i]=!0),NZ(t,i,n)):IZ(t,i,n)},LZ=function(e,t){UX(e);var r=FX(t),n=HX(r).concat(QZ(r));return uZ(n,(function(t){kX&&!RX(BZ,r,t)||PZ(e,t,r[t])})),e},BZ=function(e){var t=jX(e),r=RX(bZ,this,t);return!(this===AZ&&NX(wZ,t)&&!NX(RZ,t))&&(!(r||!NX(this,t)||!NX(wZ,t)||NX(this,dZ)&&this[dZ][t])||r)},MZ=function(e,t){var r=FX(e),n=jX(t);if(r!==AZ||!NX(wZ,n)||NX(RZ,n)){var i=yZ(r,n);return!i||!NX(wZ,n)||NX(r,dZ)&&r[dZ][n]||(i.enumerable=!0),i}},UZ=function(e){var t=SZ(FX(e)),r=[];return uZ(t,(function(e){NX(wZ,e)||NX(rZ,e)||CZ(r,e)})),r},QZ=function(e){var t=e===AZ,r=SZ(t?RZ:FX(e)),n=[];return uZ(r,(function(e){!NX(wZ,e)||t&&!NX(AZ,e)||CZ(n,wZ[e])})),n};if(OX||(eZ(gZ=(vZ=function(){if(BX(gZ,this))throw mZ("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?VX(arguments[0]):void 0,t=nZ(e),r=function e(r){this===AZ&&RX(e,RZ,r),NX(this,dZ)&&NX(this[dZ],t)&&(this[dZ][t]=!1),NZ(this,t,GX(1,r))};return kX&&DZ&&NZ(AZ,t,{configurable:!0,set:r}),xZ(t,e)}).prototype,"toString",(function(){return hZ(this).tag})),eZ(vZ,"withoutSetter",(function(e){return xZ(nZ(e),e)})),ZX.f=BZ,zX.f=PZ,XX.f=LZ,JX.f=MZ,WX.f=YX.f=UZ,qX.f=QZ,oZ.f=function(e){return xZ(iZ(e),e)},kX&&IZ(gZ,"description",{configurable:!0,get:function(){return hZ(this).description}})),SX({global:!0,wrap:!0,forced:!OX,sham:!OX},{Symbol:vZ}),uZ(HX(OZ),(function(e){aZ(e)})),SX({target:lZ,stat:!0,forced:!OX},{for:function(e){var t=VX(e);if(NX(TZ,t))return TZ[t];var r=vZ(t);return TZ[t]=r,kZ[r]=t,r},keyFor:function(e){if(!MX(e))throw mZ(e+" is not a symbol");if(NX(kZ,e))return kZ[e]},useSetter:function(){DZ=!0},useSimple:function(){DZ=!1}}),SX({target:"Object",stat:!0,forced:!OX,sham:!kX},{create:function(e,t){return void 0===t?KX(e):LZ(KX(e),t)},defineProperty:PZ,defineProperties:LZ,getOwnPropertyDescriptor:MZ}),SX({target:"Object",stat:!0,forced:!OX},{getOwnPropertyNames:UZ,getOwnPropertySymbols:QZ}),SX({target:"Object",stat:!0,forced:DX((function(){qX.f(1)}))},{getOwnPropertySymbols:function(e){return qX.f(QX(e))}}),_Z&&SX({target:"JSON",stat:!0,forced:!OX||DX((function(){var e=vZ();return"[null]"!=_Z([e])||"{}"!=_Z({a:e})||"{}"!=_Z(Object(e))}))},{stringify:function(e,t,r){var n=$X(arguments),i=t;if((LX(t)||void 0!==e)&&!MX(e))return xX(t)||(t=function(e,t){if(PX(i)&&(t=RX(i,this,e,t)),!MX(t))return t}),n[1]=t,wX(_Z,null,n)}}),!gZ[pZ]){var FZ=gZ.valueOf;eZ(gZ,pZ,(function(e){return RX(FZ,this)}))}sZ(vZ,lZ),rZ[dZ]=!0,IX("asyncIterator"),IX("hasInstance"),IX("isConcatSpreadable"),IX("iterator"),IX("match"),IX("matchAll"),IX("replace"),IX("search"),IX("species"),IX("split"),IX("toPrimitive"),IX("toStringTag"),IX("unscopables"),a_(su.JSON,"JSON",!0);var jZ=Gu.Symbol;IX("asyncDispose"),IX("dispose"),IX("matcher"),IX("metadata"),IX("observable"),IX("patternMatch"),IX("replaceAll");var VZ=jZ,GZ=vX.f("asyncIterator"),KZ=GZ;function HZ(e){this.wrapped=e}function WZ(e){var t,r;function n(t,r){try{var o=e[t](r),a=o.value,s=a instanceof HZ;Hz.resolve(s?a.wrapped:a).then((function(e){s?n("return"===t?"return":"next",e):i(o.done?"return":"normal",e)}),(function(e){n("throw",e)}))}catch(e){i("throw",e)}}function i(e,i){switch(e){case"return":t.resolve({value:i,done:!0});break;case"throw":t.reject(i);break;default:t.resolve({value:i,done:!1})}(t=t.next)?n(t.key,t.arg):r=null}this._invoke=function(e,i){return new Hz((function(o,a){var s={key:e,arg:i,resolve:o,reject:a,next:null};r?r=r.next=s:(t=r=s,n(e,i))}))},"function"!=typeof e.return&&(this.return=void 0)}function YZ(e){return function(){return new WZ(e.apply(this,arguments))}}function qZ(e){return new HZ(e)}WZ.prototype["function"==typeof VZ&&KZ||"@@asyncIterator"]=function(){return this},WZ.prototype.next=function(e){return this._invoke("next",e)},WZ.prototype.throw=function(e){return this._invoke("throw",e)},WZ.prototype.return=function(e){return this._invoke("return",e)};var JZ=vX.f("iterator");function zZ(e,t){var r={},n=!1;function i(r,i){return n=!0,i=new Hz((function(t){t(e[r](i))})),{done:!1,value:t(i)}}return r[void 0!==VZ&&JZ||"@@iterator"]=function(){return this},r.next=function(e){return n?(n=!1,e):i("next",e)},"function"==typeof e.throw&&(r.throw=function(e){if(n)throw n=!1,e;return i("throw",e)}),"function"==typeof e.return&&(r.return=function(e){return n?(n=!1,e):i("return",e)}),r}var XZ=GZ,ZZ=fi,$Z=h,e$=u,t$=V,r$=it,n$=se,i$=he,o$=qp,a$=Yt.f,s$=zn,c$=e$.Symbol,u$=c$&&c$.prototype;if($Z&&n$(c$)&&(!("description"in u$)||void 0!==c$().description)){var d$={},l$=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:o$(arguments[0]),t=i$(u$,this)?new c$(e):void 0===e?c$():c$(e);return""===e&&(d$[t]=!0),t};s$(l$,c$),l$.prototype=u$,u$.constructor=l$;var p$="Symbol(test)"==String(c$("test")),f$=t$(u$.toString),h$=t$(u$.valueOf),A$=/^Symbol\((.*)\)[^)]+$/,v$=t$("".replace),g$=t$("".slice);a$(u$,"description",{configurable:!0,get:function(){var e=h$(this),t=f$(e);if(r$(d$,e))return"";var r=p$?g$(t,7,-1):v$(t,A$,"$1");return""===r?void 0:r}}),ZZ({global:!0,forced:!0},{Symbol:l$})}var m$={exports:{}};function E$(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _$(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?E$(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):E$(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function y$(e,t,r,n,i,o){var a=[],s=[],c=[],u=[],d=!1,l=!1;if(m$.exports.parse(e).mediaDescriptions.forEach((function(e){o&&o!==e.attributes.direction||("video"!==e.media.mediaType||d||(s=e.attributes.payloads,u=e.attributes.extmaps,d=!0),"audio"!==e.media.mediaType||l||(a=e.attributes.payloads,c=e.attributes.extmaps,l=!0))})),!u||0===s.length)throw new Error("Cannot get video capabilities from SDP.");if(!c||0===a.length)throw new Error("Cannot get audio capabilities from SDP.");return s.forEach((function(e){var t;null!==(t=e.rtpMap)&&void 0!==t&&t.clockRate&&(e.rtpMap.clockRate=parseInt(e.rtpMap.clockRate))})),a.forEach((function(e){var t;null!==(t=e.rtpMap)&&void 0!==t&&t.clockRate&&(e.rtpMap.clockRate=parseInt(e.rtpMap.clockRate))})),t&&(a=a.filter((function(e){var t;return"rtx"!==(null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())})),s=s.filter((function(e){var t;return"rtx"!==(null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())}))),r&&(s=s.filter((function(e){var t;return!/(red)|(ulpfec)|(flexfec)/i.test((null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName)||"")}))),n&&(null==n?void 0:n.length)>0&&(a=a.filter((function(e){var t;return n.includes((null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())||"")}))),i&&(null==i?void 0:i.length)>0&&(s=s.filter((function(e){var t;return i.includes((null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())||"")}))),{audioCodecs:a,videoCodecs:s,audioExtensions:c,videoExtensions:u}}function I$(e){var t,r,n,i=m$.exports.parse(e),o=K(i.mediaDescriptions);try{for(o.s();!(n=o.n()).done;){var a=n.value;if(!t){var s=a.attributes.iceUfrag,c=a.attributes.icePwd;if(!s||!c)throw new Error("Cannot get iceUfrag or icePwd from SDP.");t={iceUfrag:s,icePwd:c}}if(!r){var u=a.attributes.fingerprints;u.length>0&&(r={fingerprints:u})}}}catch(e){o.e(e)}finally{o.f()}if(!r&&i.attributes.fingerprints.length>0&&(r={fingerprints:i.attributes.fingerprints}),!r||!t)throw new Error("Cannot get iceParameters or dtlsParameters from SDP.");return{iceParameters:t,dtlsParameters:r}}function S$(e,t,r){var n,i=e.cname;void 0!==t&&void 0!==r?(n=[{foundation:"udpcandidate",componentId:"1",transport:"udp",priority:"2103266323",connectionAddress:t,port:r.toString(),type:"host",extension:{}}],ND.debug("Using remote candidate from AP ".concat(t,":").concat(r)),qD("debug",[],"Using remote candidate from AP ".concat(t,":").concat(r))):n=e.iceParameters.candidates.map((function(e){return{foundation:e.foundation,componentId:"1",transport:e.protocol,priority:e.priority.toString(),connectionAddress:e.ip,port:e.port.toString(),type:e.type,extension:{}}}));var o,a={fingerprints:e.dtlsParameters.fingerprints.map((function(e){return{hashFunction:e.algorithm,fingerprint:e.fingerprint}}))},s={iceUfrag:e.iceParameters.iceUfrag,icePwd:e.iceParameters.icePwd};switch(e.dtlsParameters.role){case"server":o="passive";break;case"client":o="active";break;case"auto":o="actpass"}return{dtlsParameters:a,iceParameters:s,candidates:n,rtpCapabilities:O$(e.rtpCapabilities),setup:o,cname:i}}function b$(e,t,r){var n=[],i=[];return e.forEach((function(e){var o=e.ssrcId,a=e.rtx,s=XG(8,"track-"),c={ssrcId:o,attributes:_$({label:s,mslabel:r=r||XG(10,""),msid:"".concat(r," ").concat(s)},t&&{cname:t})};if(n.push(c),void 0!==a){var u={ssrcId:a,attributes:_$({label:s,mslabel:r,msid:"".concat(r," ").concat(s)},t&&{cname:t})};n.push(u),i.push({semantic:"FID",ssrcIds:[o,a]})}})),e.length>1&&i.push({semantic:"SIM",ssrcIds:e.map((function(e){return e.ssrcId}))}),{ssrcs:n,ssrcGroups:i}}function C$(e,t){t instanceof mG&&e.attributes.payloads.forEach((function(e){var r,n=null===(r=e.rtpMap)||void 0===r?void 0:r.encodingName.toLowerCase();if(n&&-1!==["opus","pcmu","pcma","g722"].indexOf(n)){e.fmtp||(e.fmtp={parameters:{}}),e.fmtp.parameters.minptime="10",e.fmtp.parameters.useinbandfec="1";var i=t._encoderConfig;i&&("pcmu"!==n&&"pcma"!==n&&"g722"!==n&&(i.bitrate&&!Uk()&&(e.fmtp.parameters.maxaveragebitrate="".concat(Math.floor(1e3*i.bitrate))),i.sampleRate&&(e.fmtp.parameters.maxplaybackrate="".concat(i.sampleRate),e.fmtp.parameters["sprop-maxcapturerate"]="".concat(i.sampleRate))),i.stereo&&(e.fmtp.parameters.stereo="1",e.fmtp.parameters["sprop-stereo"]="1"))}}))}function w$(e){var t=e.attributes.unrecognized.findIndex((function(e){return"x-google-flag"===e.attField&&"conference"===e.attValue}));-1!==t&&e.attributes.unrecognized.splice(t,1)}function R$(e,t){if(t instanceof Mz&&t._encoderConfig&&-1===t._hints.indexOf(xP.SCREEN_TRACK)){var r=t._encoderConfig;oL().supportMinBitrate&&r.bitrateMin&&e.attributes.payloads.forEach((function(e){var t;["h264","vp8","vp9","av1"].includes((null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())||"")&&(e.fmtp||(e.fmtp={parameters:{}}),e.fmtp.parameters["x-google-min-bitrate"]="".concat(r.bitrateMin))})),oL().supportMinBitrate&&!t._hints.includes(xP.LOW_STREAM)&&r.bitrateMax&&e.attributes.payloads.forEach((function(e){var t;["h264","vp8","vp9","av1"].includes((null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())||"")&&(e.fmtp||(e.fmtp={parameters:{}}),e.fmtp.parameters["x-google-start-bitrate"]="".concat(Math.floor(r.bitrateMax)))}))}}function T$(e,t,r){if(t){var n,i;if("video"===e.media.mediaType?(n=r.videoExtensions,i=r.videoCodecs):(n=r.audioExtensions,i=r.audioCodecs),!0===t.tcc){var o=n.find((function(e){return"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"===e.extensionName}));o&&(e.attributes.extmaps.find((function(e){return"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"===e.extensionName}))||e.attributes.extmaps.push({entry:o.entry,extensionName:"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"}),function(e,t){return t.filter((function(t){return!!e.find((function(e){return e.payloadType===t.payloadType&&!!e.rtcpFeedbacks.find((function(e){return"transport-cc"===e.type}))}))}))}(i,e.attributes.payloads).forEach((function(e){e.rtcpFeedbacks.find((function(e){return"transport-cc"===e.type}))||e.rtcpFeedbacks.push({type:"transport-cc"})})))}else if(!1===t.tcc){var a=e.attributes.extmaps.findIndex((function(e){return"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"===e.extensionName}));-1!==a&&e.attributes.extmaps.splice(a,1),e.attributes.payloads.forEach((function(e){var t=e.rtcpFeedbacks.findIndex((function(e){return"transport-cc"===e.type}));-1!==t&&e.rtcpFeedbacks.splice(t,1)}))}if(!0===t.remb){var s=n.find((function(e){return"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"===e.extensionName}));s&&(e.attributes.extmaps.find((function(e){return"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"===e.extensionName}))||e.attributes.extmaps.push({entry:s.entry,extensionName:"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"}),function(e,t){return t.filter((function(t){return!!e.find((function(e){return e.payloadType===t.payloadType&&!!e.rtcpFeedbacks.find((function(e){return"goog-remb"===e.type}))}))}))}(i,e.attributes.payloads).forEach((function(e){e.rtcpFeedbacks.find((function(e){return"goog-remb"===e.type}))||e.rtcpFeedbacks.push({type:"goog-remb"})})))}else if(!1===t.remb){var c=e.attributes.extmaps.findIndex((function(e){return"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"===e.extensionName}));-1!==c&&e.attributes.extmaps.splice(c,1),e.attributes.payloads.forEach((function(e){var t=e.rtcpFeedbacks.findIndex((function(e){return"goog-remb"===e.type}));-1!==t&&e.rtcpFeedbacks.splice(t,1)}))}}}function k$(e,t,r,n,i,o){if("videoExtensions"===r||"audioExtensions"===r){var a=[];return e[r].forEach((function(e){t[r].some((function(t,r){if(e.entry===t.entry&&e.extensionName===t.extensionName)return a.push(r),!0}))?o[r].push(e):n[r].push(e)})),void t[r].forEach((function(e,t){-1===a.indexOf(t)&&i[r].push(e)}))}if("videoCodecs"===r||"audioCodecs"===r){var s=[];return e[r].forEach((function(e){t[r].some((function(t,r){if(e.payloadType===t.payloadType&&JSON.stringify(e)===JSON.stringify(t))return s.push(r),!0}))?o[r].push(e):n[r].push(e)})),void t[r].forEach((function(e,t){-1===s.indexOf(t)&&i[r].push(e)}))}}function O$(e){var t,r,n=e.send,i=e.recv,o=e.sendrecv;if(!o){if(!n||!i)throw new Error("cannot merge rtp capabilities because one of send or recv is empty!");return{send:n,recv:i}}return n?((t={audioCodecs:[],audioExtensions:[],videoCodecs:[],videoExtensions:[]}).audioCodecs=[].concat(M(n.audioCodecs),M(o.audioCodecs)),t.videoCodecs=[].concat(M(n.videoCodecs),M(o.videoCodecs)),t.audioExtensions=[].concat(M(n.audioExtensions),M(o.audioExtensions)),t.videoExtensions=[].concat(M(n.videoExtensions),M(o.videoExtensions))):t=o,i?((r={audioCodecs:[],audioExtensions:[],videoCodecs:[],videoExtensions:[]}).audioCodecs=[].concat(M(i.audioCodecs),M(o.audioCodecs)),r.videoCodecs=[].concat(M(i.videoCodecs),M(o.videoCodecs)),r.audioExtensions=[].concat(M(i.audioExtensions),M(o.audioExtensions)),r.videoExtensions=[].concat(M(i.videoExtensions),M(o.videoExtensions))):r=o,{send:t,recv:r}}!function(e,t){e.exports=function(){var e={8:function(e,t,r){r.r(t),r.d(t,{Parser:function(){return b},Printer:function(){return O},parse:function(){return P},print:function(){return L}});var n,i="\n",o="".concat("\r").concat(i),a=" ";function s(e){return e>="0"&&e<="9"}function c(e){return e>="!"&&e<="~"}function u(e){return c(e)||e>=""&&e<="ÿ"}function d(e){return"!"===e||e>="#"&&e<="'"||e>="*"&&e<="+"||e>="-"&&e<="."||e>="0"&&e<="9"||e>="A"&&e<="Z"||e>="^"&&e<="~"}function l(e){return e>="1"&&e<="9"}function p(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function f(e){return"d"===e||"h"===e||"m"===e||"s"===e}function h(e){return e>""&&e<"\t"||e>"\v"&&e<"\f"||e>""&&e<"ÿ"}function A(e){return p(e)||s(e)||"+"===e||"/"===e}function v(e){return s(e)||p(e)||"+"===e||"/"===e||"-"===e||"_"===e}function g(e){return p(e)||s(e)||"+"===e||"/"===e}function m(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?m(Object(r),!0).forEach((function(t){y(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function y(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(e){e.VERSION="v",e.ORIGIN="o",e.SESSION_NAME="s",e.INFORMATION="i",e.URI="u",e.EMAIL="e",e.PHONE="p",e.CONNECTION="c",e.BANDWIDTH="b",e.TIME="t",e.REPEAT="r",e.ZONE_ADJUSTMENTS="z",e.KEY="k",e.ATTRIBUTE="a",e.MEDIA="m"}(n||(n={}));var I=function(){function e(){U(this,e)}return F(e,[{key:"consumeText",value:function(e,t){for(var r=t;r<e.length;){var n=e[r];if("\0"===n||"\r"===n||n===i)break;r+=1}if(r-t==0)throw new Error("Invalid text, at ".concat(e));return r}},{key:"consumeUnicastAddress",value:function(e,t,r){return this.consumeTill(e,t,a)}},{key:"consumeOneOrMore",value:function(e,t,r){for(var n=t;r(e[n]);)n++;if(n-t==0)throw new Error("Invalid rule at ".concat(t,"."));return n}},{key:"consumeSpace",value:function(e,t){if(e[t]===a)return t+1;throw new Error("Invalid space at ".concat(t,"."))}},{key:"consumeIP4Address",value:function(e,t){for(var r=t,n=0;n<4;n++)if(r=this.consumeDecimalUChar(e,r),3!==n){if("."!==e[r])throw new Error("Invalid IP4 address.");r++}return r}},{key:"consumeDecimalUChar",value:function(e,t){for(var r=t,n=0;n<3&&s(e[r]);n++,r++);if(r-t==0)throw new Error("Invalid decimal uchar.");var i=parseInt(e.slice(t,r));if(i>=0&&i<=255)return r;throw new Error("Invalid decimal uchar")}},{key:"consumeIP6Address",value:function(e,t){var r=this.consumeHexpart(e,t);return":"===e[r]?(r+=1,r=this.consumeIP4Address(e,r)):r}},{key:"consumeHexpart",value:function(e,t){var r=t;if(":"===e[r]&&":"===e[r+1]){r+=2;try{r=this.consumeHexseq(e,r)}catch(e){}return r}if(":"===e[r=this.consumeHexseq(e,r)]&&":"===e[r+1]){r+=2;try{r=this.consumeHexseq(e,r)}catch(e){}return r}return r}},{key:"consumeHexseq",value:function(e,t){for(var r=t;":"===e[r=this.consumeHex4(e,r)]&&":"!==e[r+1];)r+=1;return r}},{key:"consumeHex4",value:function(e,t){for(var r,n=0;n<4;n++)if(!((r=e[t+n])>="0"&&r<="9"||r>="a"&&r<="f"||r>="A"&&r<="F")){if(0===n)throw new Error("Invalid hex 4");break}return t+n}},{key:"consumeFQDN",value:function(e,t){for(var r=t;s(e[r])||p(e[r])||"-"===e[r]||"."===e[r];)r+=1;if(r-t<4)throw new Error("Invalid FQDN");return r}},{key:"consumeExtnAddr",value:function(e,t){return this.consumeOneOrMore(e,t,u)}},{key:"consumeMulticastAddress",value:function(e,t,r){switch(r){case"IP4":case"ip4":return this.consumeIP4MulticastAddress(e,t);case"IP6":case"ip6":return this.consumeIP6MulticastAddress(e,t);default:try{return this.consumeFQDN(e,t)}catch(r){return this.consumeExtnAddr(e,t)}}}},{key:"consumeIP6MulticastAddress",value:function(e,t){var r=this.consumeHexpart(e,t);return"/"===e[r]?this.consumeInteger(e,r+1):r}},{key:"consumeIP4MulticastAddress",value:function(e,t){var r=t+3,n=e.slice(t,r),i=parseInt(n);if(i<224||i>239)throw new Error("Invalid IP4 multicast address, IPv4 multicast addresses may be in the range 224.0.0.0 to 239.255.255.255.");for(var o=0;o<3;o++){if("."!==e[r])throw new Error("Invalid IP4 multicast address.");r+=1,r=this.consumeDecimalUChar(e,r)}return"/"===e[r]&&(r+=1),"/"===e[r=this.consumeTTL(e,r)]&&(r=this.consumeInteger(e,r)),r}},{key:"consumeInteger",value:function(e,t){if(!l(e[t]))throw new Error("Invalid integer.");for(t+=1;s(e[t]);)t+=1;return t}},{key:"consumeTTL",value:function(e,t){if("0"===e[t])return t+1;if(!l(e[t]))throw new Error("Invalid TTL.");t+=1;for(var r=0;r<2&&s(e[t]);r++)t+=1;return t}},{key:"consumeToken",value:function(e,t){return this.consumeOneOrMore(e,t,d)}},{key:"consumeTime",value:function(e,t){var r=t;if("0"===e[r])return r+1;for(l(e[r])&&(r+=1);s(e[r]);)r++;if(r-t<10)throw new Error("Invalid time");return r}},{key:"consumeAddress",value:function(e,t){return this.consumeTill(e,t,a)}},{key:"consumeTypedTime",value:function(e,t){var r=t;return f(e[r=this.consumeOneOrMore(e,r,s)])?r+1:r}},{key:"consumeRepeatInterval",value:function(e,t){if(!l(e[t]))throw new Error("Invalid repeat interval");for(t+=1;s(e[t]);)t+=1;return f(e[t])&&(t+=1),t}},{key:"consumePort",value:function(e,t){return this.consumeOneOrMore(e,t,s)}},{key:"consume",value:function(e,t,r){for(var n=0;n<r.length;n++){if(t+n>=e.length)throw new Error("consume exceeding value length");if(e[t+n]!==r[n])throw new Error("consume ".concat(r," failed at ").concat(n))}return t+r.length}},{key:"consumeTill",value:function(e,t,r){for(var n=t;n<e.length&&("string"!=typeof r||e[n]!==r)&&("function"!=typeof r||!r(e[n]));)n++;return n}}]),e}(),b=function(e){k(r,e);var t=W(r);function r(){var e;return U(this,r),e=t.call(this),y(S(e),"records",[]),y(S(e),"currentLine",0),e}return F(r,[{key:"parse",value:function(e){var t=this.probeEOL(e);this.records=e.split(t).filter((function(e){return!!e.trim()})).map(this.parseLine),this.currentLine=0;var r=this.parseVersion(),n=this.parseOrigin(),i=this.parseSessionName(),o=this.parseInformation(),a=this.parseUri(),s=this.parseEmail(),c=this.parsePhone(),u=this.parseConnection(),d=this.parseBandWidth(),l=this.parseTimeFields(),p=this.parseKey(),f=this.parseSessionAttribute(),h=this.parseMediaDescription();if(this.currentLine!==this.records.length)throw new Error("parsing failed, non exhaustive sdp lines.");return{version:r,origin:n,sessionName:i,information:o,uri:a,emails:s,phones:c,connection:u,bandwidths:d,timeFields:l,key:p,attributes:f,mediaDescriptions:h}}},{key:"getCurrentRecord",value:function(){var e=this.records[this.currentLine];if(!e)throw new Error("Record doesn't exit.");return e}},{key:"probeEOL",value:function(e){for(var t=0;t<e.length;t++)if(e[t]===i)return"\r"===e[t-1]?o:i;throw new Error("Invalid newline character.")}},{key:"parseLine",value:function(e,t){if(e.length<2)throw new Error("Invalid sdp line, sdp line should be of form <type>=<value>.");var r=e[0];if("="!==e[1])throw new Error('Invalid sdp line, <type> should be a single character followed by an "=" sign.');return{type:r,value:e.slice(2),line:t,cur:0}}},{key:"parseSessionAttribute",value:function(){for(var e=new w;this.currentLine<this.records.length;){var t=this.getCurrentRecord();if(t.type!==n.ATTRIBUTE)break;var r={attField:this.extractOneOrMore(t,(function(e){return d(e)&&":"!==e})),_cur:0};":"===t.value[t.cur]&&(t.cur+=1,r.attValue=this.extractOneOrMore(t,h)),e.parse(r),this.currentLine++}return e.digest()}},{key:"parseMediaAttributes",value:function(e){for(var t=new R(e);this.currentLine<this.records.length;){var r=this.getCurrentRecord();if(r.type!==n.ATTRIBUTE)break;var i={attField:this.extractOneOrMore(r,(function(e){return d(e)&&":"!==e})),_cur:0};":"===r.value[r.cur]&&(r.cur+=1,i.attValue=this.extractOneOrMore(r,h)),t.parse(i),this.currentLine++}return t.digest()}},{key:"parseKey",value:function(){var e=this.getCurrentRecord();if(e.type===n.KEY){if("prompt"===e.value||"clear:"===e.value||"base64:"===e.value||"uri:"===e.value)return e.value;throw this.currentLine++,new Error("Invalid key.")}}},{key:"parseZone",value:function(){var e=this.getCurrentRecord();if(e.type===n.ZONE_ADJUSTMENTS){for(var t=[];;)try{var r=this.extract(e,this.consumeTime);this.consumeSpaceForRecord(e);var i=!1;"-"===e.value[e.cur]&&(i=!0,e.cur+=1);var o=this.extract(e,this.consumeTypedTime);t.push({time:r,typedTime:o,back:i})}catch(e){break}if(0===t.length)throw new Error("Invalid zone adjustments");return this.currentLine++,t}return[]}},{key:"parseRepeat",value:function(){for(var e=[];;){var t=this.getCurrentRecord();if(t.type!==n.REPEAT)break;var r=this.extract(t,this.consumeRepeatInterval),i=this.parseTypedTime(t);e.push({repeatInterval:r,typedTimes:i}),this.currentLine++}return e}},{key:"parseTypedTime",value:function(e){for(var t=[];;)try{this.consumeSpaceForRecord(e),t.push(this.extract(e,this.consumeTypedTime))}catch(e){break}if(0===t.length)throw new Error("Invalid typed time.");return t}},{key:"parseTime",value:function(){var e=this.getCurrentRecord(),t=this.extract(e,this.consumeTime);this.consumeSpaceForRecord(e);var r=this.extract(e,this.consumeTime);return this.currentLine++,{startTime:t,stopTime:r}}},{key:"parseBandWidth",value:function(){for(var e=[];this.currentLine<this.records.length;){var t=this.getCurrentRecord();if(t.type!==n.BANDWIDTH)break;var r=this.extractOneOrMore(t,d);if(":"!==t.value[t.cur])throw new Error("Invalid bandwidth field.");t.cur++;var i=this.extractOneOrMore(t,s);e.push({bwtype:r,bandwidth:i}),this.currentLine++}return e}},{key:"parseVersion",value:function(){var e=this.getCurrentRecord();if(e.type!==n.VERSION)throw new Error("first sdp record must be version");var t=e.value.slice(0,this.consumeOneOrMore(e.value,0,s));if(t.length!==e.value.length)throw new Error('invalid proto version, "v='.concat(e.value,'"'));return this.currentLine++,t}},{key:"parseOrigin",value:function(){var e=this.getCurrentRecord();if(e.type!==n.ORIGIN)throw new Error("second line of sdp must be origin");var t=this.extractOneOrMore(e,u);this.consumeSpaceForRecord(e);var r=this.extractOneOrMore(e,s);this.consumeSpaceForRecord(e);var i=this.extractOneOrMore(e,s);this.consumeSpaceForRecord(e);var o=this.extractOneOrMore(e,d);this.consumeSpaceForRecord(e);var a=this.extractOneOrMore(e,d);this.consumeSpaceForRecord(e);var c=this.extract(e,this.consumeUnicastAddress);return this.currentLine++,{username:t,sessId:r,sessVersion:i,nettype:o,addrtype:a,unicastAddress:c}}},{key:"parseSessionName",value:function(){var e=this.getCurrentRecord();if(e.type===n.SESSION_NAME){var t=this.extract(e,this.consumeText);return this.currentLine++,t}}},{key:"parseInformation",value:function(){var e=this.getCurrentRecord();if(e.type===n.INFORMATION){var t=this.extract(e,this.consumeText);return this.currentLine++,t}}},{key:"parseUri",value:function(){var e=this.getCurrentRecord();if(e.type===n.URI)return this.currentLine++,e.value}},{key:"parseEmail",value:function(){for(var e=[];;){var t=this.getCurrentRecord();if(t.type!==n.EMAIL)break;e.push(t.value),this.currentLine++}return e}},{key:"parsePhone",value:function(){for(var e=[];;){var t=this.getCurrentRecord();if(t.type!==n.PHONE)break;e.push(t.value),this.currentLine++}return e}},{key:"parseConnection",value:function(){var e=this.getCurrentRecord();if(e.type===n.CONNECTION){var t=this.extractOneOrMore(e,d);this.consumeSpaceForRecord(e);var r=this.extractOneOrMore(e,d);this.consumeSpaceForRecord(e);var i=this.extract(e,this.consumeAddress);return this.currentLine++,{nettype:t,addrtype:r,address:i}}}},{key:"parseMedia",value:function(){var e=this.getCurrentRecord(),t=this.extract(e,this.consumeToken);this.consumeSpaceForRecord(e);var r=this.extract(e,this.consumePort);"/"===e.value[e.cur]&&(e.cur+=1,r+=this.extract(e,this.consumeInteger)),this.consumeSpaceForRecord(e);var n=[];for(n.push(this.extract(e,this.consumeToken));"/"===e.value[e.cur];)e.cur+=1,n.push(this.extract(e,this.consumeToken));if(0===n.length)throw new Error("Invalid proto");var i=this.parseFmt(e);return this.currentLine++,{mediaType:t,port:r,protos:n,fmts:i}}},{key:"parseTimeFields",value:function(){for(var e=[];this.getCurrentRecord().type===n.TIME;){var t=this.parseTime(),r=this.parseRepeat(),i=this.parseZone();e.push({time:t,repeats:r,zones:i})}return e}},{key:"parseMediaDescription",value:function(){for(var e=[];this.currentLine<this.records.length&&this.getCurrentRecord().type===n.MEDIA;){var t=this.parseMedia(),r=this.parseInformation(),i=this.parseConnections(),o=this.parseBandWidth(),a=this.parseKey(),s=this.parseMediaAttributes(t);e.push({media:t,information:r,connections:i,bandwidths:o,key:a,attributes:s})}return e}},{key:"parseConnections",value:function(){for(var e=[];this.currentLine<this.records.length&&this.getCurrentRecord().type===n.CONNECTION;)e.push(this.parseConnection());return e}},{key:"parseFmt",value:function(e){for(var t=[];;)try{this.consumeSpaceForRecord(e),t.push(this.extract(e,this.consumeToken))}catch(e){break}if(0===t.length)throw new Error("Invalid fmts");return t}},{key:"extract",value:function(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];var o=t.call.apply(t,[this,e.value,e.cur].concat(n)),a=e.value.slice(e.cur,o);return e.cur=o,a}},{key:"extractOneOrMore",value:function(e,t){var r=this.consumeOneOrMore(e.value,e.cur,t),n=e.value.slice(e.cur,r);return e.cur=r,n}},{key:"consumeSpaceForRecord",value:function(e){if(e.value[e.cur]!==a)throw new Error("Invalid space at ".concat(e.cur,"."));e.cur+=1}}]),r}(I),C=function(e){k(r,e);var t=W(r);function r(){var e;U(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return e=t.call.apply(t,[this].concat(i)),y(S(e),"attributes",void 0),y(S(e),"digested",!1),e}return F(r,[{key:"extractOneOrMore",value:function(e,t,r){var n=this.consumeOneOrMore(e.attValue,e._cur,t),i=e.attValue.slice(e._cur,n),o=E(r||[],2),a=o[0],s=o[1];if("number"==typeof a&&i.length<a)throw new Error("error in length, should be more or equal than ".concat(a," characters."));if("number"==typeof s&&i.length>s)throw new Error("error in length, should be less or equal than ".concat(s," characters."));return e._cur=n,i}},{key:"consumeAttributeSpace",value:function(e){if(e.attValue[e._cur]!==a)throw new Error("Invalid space at ".concat(e._cur,"."));e._cur+=1}},{key:"extract",value:function(e,t){if(!e.attValue)throw new Error("Nothing to extract from attValue.");for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];var o=t.call.apply(t,[this,e.attValue,e._cur].concat(n)),a=e.attValue.slice(e._cur,o);return e._cur=o,a}},{key:"atEnd",value:function(e){if(!e.attValue)throw new Error;return e._cur>=e.attValue.length}},{key:"peekChar",value:function(e){if(!e.attValue)throw new Error;return e.attValue[e._cur]}},{key:"peek",value:function(e,t){if(!e.attValue)throw new Error;for(var r=0;r<t.length;r++)if(t[r]!==e.attValue[e._cur+r])return!1;return!0}},{key:"parseIceUfrag",value:function(e){if(this.attributes.iceUfrag)throw new Error("Invalid ice-ufrag, should be only a single line if 'a=ice-ufrag'");this.attributes.iceUfrag=this.extractOneOrMore(e,A,[4,256])}},{key:"parseIcePwd",value:function(e){if(this.attributes.icePwd)throw new Error("Invalid ice-pwd, should be only a single line if 'a=ice-pwd'");this.attributes.icePwd=this.extractOneOrMore(e,A,[22,256])}},{key:"parseIceOptions",value:function(e){if(this.attributes.iceOptions)throw new Error("Invalid ice-options, should be only one 'ice-options' line");for(var t=[];!this.atEnd(e);){t.push(this.extractOneOrMore(e,A));try{this.consumeAttributeSpace(e)}catch(t){if(this.atEnd(e))break;throw t}}this.attributes.iceOptions=t}},{key:"parseFingerprint",value:function(e){var t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);var r=this.extract(e,this.consumeTill);this.attributes.fingerprints.push({hashFunction:t,fingerprint:r})}},{key:"parseExtmap",value:function(e){var t,r=this.extractOneOrMore(e,s);"/"===this.peekChar(e)&&(this.extract(e,this.consume,"/"),t=this.extract(e,this.consumeToken)),this.consumeAttributeSpace(e);var n=this.extract(e,this.consumeTill,a),i=_(_({entry:parseInt(r,10)},t&&{direction:t}),{},{extensionName:n});this.peekChar(e)===a&&(this.consumeAttributeSpace(e),i.extensionAttributes=this.extract(e,this.consumeTill)),this.attributes.extmaps.push(i)}},{key:"parseSetup",value:function(e){if(this.attributes.setup)throw new Error("must only be one single 'a=setup' line.");var t=this.extract(e,this.consumeTill);if("active"!==t&&"passive"!==t&&"actpass"!==t&&"holdconn"!==t)throw new Error("role must be one of 'active', 'passive', 'actpass', 'holdconn'.");this.attributes.setup=t}}]),r}(I),w=function(e){k(r,e);var t=W(r);function r(){var e;U(this,r);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];return e=t.call.apply(t,[this].concat(i)),y(S(e),"attributes",{unrecognized:[],groups:[],extmaps:[],fingerprints:[],identities:[]}),e}return F(r,[{key:"parse",value:function(e){if(this.digested)throw new Error("already digested");try{switch(e.attField){case"group":this.parseGroup(e);break;case"ice-lite":this.parseIceLite();break;case"ice-ufrag":this.parseIceUfrag(e);break;case"ice-pwd":this.parseIcePwd(e);break;case"ice-options":this.parseIceOptions(e);break;case"fingerprint":this.parseFingerprint(e);break;case"setup":this.parseSetup(e);break;case"tls-id":this.parseTlsId(e);break;case"identity":this.parseIdentity(e);break;case"extmap":this.parseExtmap(e);break;case"msid-semantic":this.parseMsidSemantic(e);break;default:e.ignored=!0,this.attributes.unrecognized.push(e)}}catch(t){throw console.error("parsing session attribute ".concat(e.attField,' error, "a=').concat(e.attField,":").concat(e.attValue,'"')),t}if(!e.ignored&&e.attValue&&!this.atEnd(e))throw new Error("attribute parsing error")}},{key:"digest",value:function(){return this.digested=!0,this.attributes}},{key:"parseGroup",value:function(e){for(var t=this.extract(e,this.consumeToken),r=[];!this.atEnd(e)&&this.peekChar(e)===a;)this.consumeAttributeSpace(e),r.push(this.extract(e,this.consumeToken));this.attributes.groups.push({semantic:t,identificationTag:r})}},{key:"parseIceLite",value:function(){if(this.attributes.iceLite)throw new Error("Invalid ice-lite, should be only a single line of 'a=ice-lite'");this.attributes.iceLite=!0}},{key:"parseTlsId",value:function(e){if(this.attributes.tlsId)throw new Error("must be only one tld-id line");this.attributes.tlsId=this.extractOneOrMore(e,v)}},{key:"parseIdentity",value:function(e){for(var t=this.extractOneOrMore(e,g),r=[];!this.atEnd(e)&&this.peekChar(e)===a;){this.consumeAttributeSpace(e);var n=this.extract(e,this.consumeToken);this.extract(e,this.consume,"=");var i=this.extractOneOrMore(e,(function(e){return e!==a&&h(e)}));r.push({name:n,value:i})}this.attributes.identities.push({assertionValue:t,extensions:r})}},{key:"parseMsidSemantic",value:function(e){this.peekChar(e)===a&&this.consumeAttributeSpace(e);for(var t={semantic:this.extract(e,this.consumeToken),identifierList:[]};;){try{this.consumeAttributeSpace(e)}catch(e){break}if("*"===this.peekChar(e)){this.extract(e,this.consume,"*"),t.applyForAll=!0;break}var r=this.extract(e,this.consumeTill,a);t.identifierList.push(r)}this.attributes.msidSemantic=t}}]),r}(C),R=function(e){k(r,e);var t=W(r);function r(e){var n;return U(this,r),n=t.call(this),y(S(n),"attributes",void 0),-1!==e.protos.indexOf("RTP")||e.protos.indexOf("rtp"),n.attributes={unrecognized:[],candidates:[],extmaps:[],fingerprints:[],imageattr:[],msids:[],remoteCandidatesList:[],rids:[],ssrcs:[],ssrcGroups:[],rtcpFeedbackWildcards:[],payloads:[]},n}return F(r,[{key:"parse",value:function(e){if(this.digested)throw new Error("already digested");try{switch(e.attField){case"extmap":this.parseExtmap(e);break;case"setup":this.parseSetup(e);break;case"ice-ufrag":this.parseIceUfrag(e);break;case"ice-pwd":this.parseIcePwd(e);break;case"ice-options":this.parseIceOptions(e);break;case"candidate":this.parseCandidate(e);break;case"remote-candidate":this.parseRemoteCandidate(e);break;case"end-of-candidates":this.parseEndOfCandidates();break;case"fingerprint":this.parseFingerprint(e);break;case"rtpmap":this.parseRtpmap(e);break;case"ptime":this.parsePtime(e);break;case"maxptime":this.parseMaxPtime(e);break;case"sendrecv":case"recvonly":case"sendonly":case"inactive":this.parseDirection(e);break;case"ssrc":this.parseSSRC(e);break;case"fmtp":this.parseFmtp(e);break;case"rtcp-fb":this.parseRtcpFb(e);break;case"rtcp-mux":this.parseRTCPMux();break;case"rtcp-mux-only":this.parseRTCPMuxOnly();break;case"rtcp-rsize":this.parseRTCPRsize();break;case"rtcp":this.parseRTCP(e);break;case"mid":this.parseMid(e);break;case"msid":this.parseMsid(e);break;case"imageattr":this.parseImageAttr(e);break;case"rid":this.parseRid(e);break;case"simulcast":this.parseSimulcast(e);break;case"sctp-port":this.parseSctpPort(e);break;case"max-message-size":this.parseMaxMessageSize(e);break;case"ssrc-group":this.parseSSRCGroup(e);break;default:e.ignored=!0,this.attributes.unrecognized.push(e)}}catch(t){throw console.error("parsing media attribute ".concat(e.attField,' error, "a=').concat(e.attField,":").concat(e.attValue,'"')),t}if(!e.ignored&&e.attValue&&!this.atEnd(e))throw new Error("attribute parsing error")}},{key:"parseCandidate",value:function(e){var t=this.extractOneOrMore(e,A,[1,32]);this.consumeAttributeSpace(e);var r=this.extractOneOrMore(e,s,[1,5]);this.consumeAttributeSpace(e);var n=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);var i=this.extractOneOrMore(e,s,[1,10]);this.consumeAttributeSpace(e);var o=this.extract(e,this.consumeAddress);this.consumeAttributeSpace(e);var u=this.extract(e,this.consumePort);this.consumeAttributeSpace(e),this.extract(e,this.consume,"typ"),this.consumeAttributeSpace(e);var d={foundation:t,componentId:r,transport:n,priority:i,connectionAddress:o,port:u,type:this.extract(e,this.consumeToken),extension:{}};for(this.peek(e," raddr")&&(this.extract(e,this.consume," raddr"),this.consumeAttributeSpace(e),d.relAddr=this.extract(e,this.consumeAddress)),this.peek(e," rport")&&(this.extract(e,this.consume," rport"),this.consumeAttributeSpace(e),d.relPort=this.extract(e,this.consumePort));this.peekChar(e)===a;){this.consumeAttributeSpace(e);var l=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e),d.extension[l]=this.extractOneOrMore(e,c)}this.attributes.candidates.push(d)}},{key:"parseRemoteCandidate",value:function(e){for(var t=[];;){var r=this.extractOneOrMore(e,s,[1,5]);this.consumeAttributeSpace(e);var n=this.extract(e,this.consumeAddress);this.consumeAttributeSpace(e);var i=this.extract(e,this.consumePort);t.push({componentId:r,connectionAddress:n,port:i});try{this.consumeAttributeSpace(e)}catch(e){break}}this.attributes.remoteCandidatesList.push(t)}},{key:"parseEndOfCandidates",value:function(){if(this.attributes.endOfCandidates)throw new Error("must be only one line of end-of-candidates");this.attributes.endOfCandidates=!0}},{key:"parseRtpmap",value:function(e){var t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);var r=this.extract(e,this.consumeTill,"/");this.extract(e,this.consume,"/");var n={encodingName:r,clockRate:this.extractOneOrMore(e,s)};this.atEnd(e)||"/"!==this.peekChar(e)||(this.extract(e,this.consume,"/"),n.encodingParameters=parseInt(this.extract(e,this.consumeTill),10));var i=this.attributes.payloads.find((function(e){return e.payloadType===parseInt(t,10)}));i?i.rtpMap=n:this.attributes.payloads.push({payloadType:parseInt(t,10),rtpMap:n,rtcpFeedbacks:[]})}},{key:"parsePtime",value:function(e){if(this.attributes.ptime)throw new Error("must be only one line of ptime");this.attributes.ptime=this.extract(e,this.consumeTill)}},{key:"parseMaxPtime",value:function(e){if(this.attributes.maxPtime)throw new Error("must be only one line of ptime");this.attributes.maxPtime=this.extract(e,this.consumeTill)}},{key:"parseDirection",value:function(e){if(this.attributes.direction)throw new Error("must be only one line of direction info");this.attributes.direction=e.attField}},{key:"parseSSRC",value:function(e){var t=this.extractOneOrMore(e,s);this.consumeAttributeSpace(e);var r,n=this.extract(e,this.consumeTill,":");":"===this.peekChar(e)&&(this.extract(e,this.consume,":"),r=this.extract(e,this.consumeTill));var i=this.attributes.ssrcs.find((function(e){return e.ssrcId===parseInt(t,10)}));i?i.attributes[n]=r:this.attributes.ssrcs.push({ssrcId:parseInt(t,10),attributes:j({},n,r)})}},{key:"parseFmtp",value:function(e){var t=this.extract(e,this.consumeTill,a);this.consumeAttributeSpace(e);var r=this.extract(e,this.consumeTill),n={};r.split(";").forEach((function(e){var t=e.split("="),r=E(t,2),i=r[0],o=r[1];i=i.trim(),o="string"==typeof o?o.trim():o,"string"==typeof i&&i.length>0&&(n[i]=o)}));var i=this.attributes.payloads.find((function(e){return e.payloadType===parseInt(t,10)}));i?i.fmtp={parameters:n}:this.attributes.payloads.push({payloadType:parseInt(t,10),rtcpFeedbacks:[],fmtp:{parameters:n}})}},{key:"parseFmtParameters",value:function(e){var t={},r=this.extract(e,this.consumeTill,"=");e._cur++;var n=this.extract(e,this.consumeTill,";");for(t[r]=n;";"===e.attValue[e._cur];){var i=this.extract(e,this.consumeTill,"=");e._cur++;var o=this.extract(e,this.consumeTill,";");t[i]=o}return t}},{key:"parseRtcpFb",value:function(e){var t="";t="*"===this.peekChar(e)?this.extract(e,this.consume,"*"):this.extract(e,this.consumeTill,a),this.consumeAttributeSpace(e);var r,n=this.extract(e,this.consumeTill,a);if("trr-int"===n)r={type:n,interval:this.extract(e,this.consumeTill)};else{var i={type:n};this.peekChar(e)===a&&(this.consumeAttributeSpace(e),i.parameter=this.extract(e,this.consumeToken),this.peekChar(e)===a&&(i.additional=this.extract(e,this.consumeTill))),r=i}if("*"===t)this.attributes.rtcpFeedbackWildcards.push(r);else{var o=this.attributes.payloads.find((function(e){return e.payloadType===parseInt(t,10)}));o?o.rtcpFeedbacks.push(r):this.attributes.payloads.push({payloadType:parseInt(t,10),rtcpFeedbacks:[r]})}}},{key:"parseRTCPMux",value:function(){if(this.attributes.rtcpMux)throw new Error("must be single line of rtcp-mux");this.attributes.rtcpMux=!0}},{key:"parseRTCPMuxOnly",value:function(){if(this.attributes.rtcpMuxOnly)throw new Error("must be single line of rtcp-only");this.attributes.rtcpMuxOnly=!0}},{key:"parseRTCPRsize",value:function(){if(this.attributes.rtcpRsize)throw new Error("must be single line of rtcp-rsize");this.attributes.rtcpRsize=!0}},{key:"parseRTCP",value:function(e){if(this.attributes.rtcp)throw new Error("must be single line of rtcp");var t={port:this.extract(e,this.consumePort)};this.peekChar(e)===a&&(this.consumeAttributeSpace(e),t.netType=this.extractOneOrMore(e,d),this.consumeAttributeSpace(e),t.addressType=this.extractOneOrMore(e,d),this.consumeAttributeSpace(e),t.address=this.extract(e,this.consumeAddress)),this.attributes.rtcp=t}},{key:"parseMsid",value:function(e){var t={id:this.extractOneOrMore(e,d,[1,64])};this.peekChar(e)===a&&(this.consumeAttributeSpace(e),t.appdata=this.extractOneOrMore(e,d,[1,64])),this.attributes.msids.push(t)}},{key:"parseImageAttr",value:function(e){this.attributes.imageattr.push(e.attValue)}},{key:"parseRid",value:function(e){var t=this.extractOneOrMore(e,(function(e){return p(e)||s(e)||"_"===e||"-"===e}));this.consumeAttributeSpace(e);var r={id:t,direction:this.extract(e,this.consumeToken),params:[]};if(this.peekChar(e)===a){if(this.consumeAttributeSpace(e),this.peek(e,"pt=")){this.extract(e,this.consume,"pt=");for(var n=[];;){var i=this.extract(e,this.consumeToken);n.push(i);try{this.extract(e,this.consume,",")}catch(e){break}}r.payloads=n,this.peekChar(e)===a&&this.extract(e,this.consume,a)}for(;;){var o=this.extract(e,this.consumeToken);if("depend"===o){var c={type:o,rids:this.extract(e,this.consume,"=").split(",")};r.params.push(c)}else{var u={type:o};"="===this.peekChar(e)&&(this.extract(e,this.consume,"="),u.val=this.extract(e,this.consumeTill,";")),r.params.push(u)}try{this.extract(e,this.consume,";")}catch(e){break}}}this.attributes.rids.push(r)}},{key:"parseSimulcast",value:function(e){if(this.attributes.simulcast)throw new Error("must be single line of simulcast");this.attributes.simulcast=e.attValue,this.extract(e,this.consumeTill)}},{key:"parseSctpPort",value:function(e){this.attributes.sctpPort=this.extractOneOrMore(e,s,[1,5])}},{key:"parseMaxMessageSize",value:function(e){this.attributes.maxMessageSize=this.extractOneOrMore(e,s,[1,void 0])}},{key:"digest",value:function(){return this.digested=!0,this.attributes}},{key:"parseMid",value:function(e){this.attributes.mid=this.extract(e,this.consumeToken)}},{key:"parseSSRCGroup",value:function(e){for(var t=this.extract(e,this.consumeToken),r=[];;)try{this.consumeAttributeSpace(e);var n=this.extract(e,this.consumeInteger);r.push(parseInt(n,10))}catch(e){break}this.attributes.ssrcGroups.push({semantic:t,ssrcIds:r})}}]),r}(C);function T(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var O=function(){function e(){U(this,e),T(this,"eol",o)}return F(e,[{key:"print",value:function(e,t){var r="";return t&&(this.eol=t),r+=this.printVersion(e.version),r+=this.printOrigin(e.origin),r+=this.printSessionName(e.sessionName),r+=this.printInformation(e.information),r+=this.printUri(e.uri),r+=this.printEmail(e.emails),r+=this.printPhone(e.phones),r+=this.printConnection(e.connection),r+=this.printBandwidth(e.bandwidths),r+=this.printTimeFields(e.timeFields),r+=this.printKey(e.key),r+=this.printSessionAttributes(e.attributes),r+=this.printMediaDescription(e.mediaDescriptions)}},{key:"printVersion",value:function(e){return"v=".concat(e).concat(this.eol)}},{key:"printOrigin",value:function(e){return"o=".concat(e.username," ").concat(e.sessId," ").concat(e.sessVersion," ").concat(e.nettype," ").concat(e.addrtype," ").concat(e.unicastAddress).concat(this.eol)}},{key:"printSessionName",value:function(e){return e?"s=".concat(e).concat(this.eol):""}},{key:"printInformation",value:function(e){return e?"i=".concat(e).concat(this.eol):""}},{key:"printUri",value:function(e){return e?"u=".concat(e).concat(this.eol):""}},{key:"printEmail",value:function(e){var t,r="",n=K(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;r+="e=".concat(i).concat(this.eol)}}catch(e){n.e(e)}finally{n.f()}return r}},{key:"printPhone",value:function(e){var t,r="",n=K(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;r+="e=".concat(i).concat(this.eol)}}catch(e){n.e(e)}finally{n.f()}return r}},{key:"printConnection",value:function(e){return e?"c=".concat(e.nettype," ").concat(e.addrtype," ").concat(e.address).concat(this.eol):""}},{key:"printBandwidth",value:function(e){var t,r="",n=K(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;r+="b=".concat(i.bwtype,":").concat(i.bandwidth).concat(this.eol)}}catch(e){n.e(e)}finally{n.f()}return r}},{key:"printTimeFields",value:function(e){var t,r="",n=K(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;r+="t=".concat(i.time.startTime," ").concat(i.time.startTime).concat(this.eol);var o,a=K(i.repeats);try{for(a.s();!(o=a.n()).done;){var s=o.value;r+="r=".concat(s.repeatInterval," ").concat(s.typedTimes.join(" ")).concat(this.eol)}}catch(e){a.e(e)}finally{a.f()}i.zoneAdjustments&&(r+="z=",r+="z=".concat(i.zoneAdjustments.map((function(e){return"".concat(e.time," ").concat(e.back?"-":""," ").concat(e.typedTime)})).join(" ")).concat(this.eol),r+=this.eol)}}catch(e){n.e(e)}finally{n.f()}return r}},{key:"printKey",value:function(e){return e?"k=".concat(e).concat(this.eol):""}},{key:"printAttributes",value:function(e){var t,r="",n=K(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;r+="a=".concat(i.attField).concat(i.attValue?":".concat(i.attValue):"").concat(this.eol)}}catch(e){n.e(e)}finally{n.f()}return r}},{key:"printMediaDescription",value:function(e){var t,r="",n=K(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;r+=this.printMedia(i.media),r+=this.printInformation(i.information),r+=this.printConnections(i.connections),r+=this.printBandwidth(i.bandwidths),r+=this.printKey(i.key),r+=this.printMediaAttributes(i)}}catch(e){n.e(e)}finally{n.f()}return r}},{key:"printConnections",value:function(e){var t,r="",n=K(e);try{for(n.s();!(t=n.n()).done;){var i=t.value;r+=this.printConnection(i)}}catch(e){n.e(e)}finally{n.f()}return r}},{key:"printMedia",value:function(e){return"m=".concat(e.mediaType," ").concat(e.port," ").concat(e.protos.join("/")," ").concat(e.fmts.join(" ")).concat(this.eol)}},{key:"printSessionAttributes",value:function(e){return new N(this.eol).print(e)}},{key:"printMediaAttributes",value:function(e){return new x(this.eol).print(e)}}]),e}(),D=function(){function e(t){U(this,e),T(this,"eol",void 0),this.eol=t}return F(e,[{key:"printIceUfrag",value:function(e){return void 0===e?"":"a=ice-ufrag:".concat(e).concat(this.eol)}},{key:"printIcePwd",value:function(e){return void 0===e?"":"a=ice-pwd:".concat(e).concat(this.eol)}},{key:"printIceOptions",value:function(e){return void 0===e?"":"a=ice-options:".concat(e.join(a)).concat(this.eol)}},{key:"printFingerprints",value:function(e){return e.length>0?e.map((function(e){return"a=fingerprint:".concat(e.hashFunction).concat(a).concat(e.fingerprint)})).join(this.eol)+this.eol:""}},{key:"printExtmap",value:function(e){var t=this;return e.map((function(e){return"a=extmap:".concat(e.entry).concat(e.direction?"/".concat(e.direction):"").concat(a).concat(e.extensionName).concat(e.extensionAttributes?"".concat(a).concat(e.extensionAttributes):"").concat(t.eol)})).join("")}},{key:"printSetup",value:function(e){return void 0===e?"":"a=setup:".concat(e).concat(this.eol)}},{key:"printUnrecognized",value:function(e){var t=this;return e.map((function(e){return"a=".concat(e.attField).concat(e.attValue?":".concat(e.attValue):"").concat(t.eol)})).join("")}}]),e}(),N=function(e){k(r,e);var t=W(r);function r(){return U(this,r),t.apply(this,arguments)}return F(r,[{key:"print",value:function(e){var t="";return t+=this.printGroups(e.groups),t+=this.printMsidSemantic(e.msidSemantic),t+=this.printIceLite(e.iceLite),t+=this.printIceUfrag(e.iceUfrag),t+=this.printIcePwd(e.icePwd),t+=this.printIceOptions(e.iceOptions),t+=this.printFingerprints(e.fingerprints),t+=this.printSetup(e.setup),t+=this.printTlsId(e.tlsId),t+=this.printIdentity(e.identities),t+=this.printExtmap(e.extmaps),t+=this.printUnrecognized(e.unrecognized)}},{key:"printGroups",value:function(e){var t=this,r="";return e.length>0&&(r+=e.map((function(e){return"a=group:".concat(e.semantic).concat(e.identificationTag.map((function(e){return"".concat(a).concat(e)})).join("")).concat(t.eol)})).join("")),r}},{key:"printIceLite",value:function(e){return void 0===e?"":"a=ice-lite"+this.eol}},{key:"printTlsId",value:function(e){return e?"a=tls-id:".concat(e).concat(this.eol):""}},{key:"printIdentity",value:function(e){return 0===e.length?"":e.map((function(e){return"a=identity:".concat(e.assertionValue).concat(e.extensions.map((function(e){return"".concat(a).concat(e.name).concat(e.value?"=".concat(e.value):"")})))})).join(this.eol)+this.eol}},{key:"printMsidSemantic",value:function(e){if(!e)return"";var t="a=msid-semantic:".concat(e.semantic);return e.applyForAll?t+="".concat(a,"*"):e.identifierList.length>0&&(t+=e.identifierList.map((function(e){return"".concat(a).concat(e)}))),t+this.eol}}]),r}(D),x=function(e){k(r,e);var t=W(r);function r(){return U(this,r),t.apply(this,arguments)}return F(r,[{key:"print",value:function(e){var t=e.attributes,r="";return r+=this.printRTCP(t.rtcp),r+=this.printIceUfrag(t.iceUfrag),r+=this.printIcePwd(t.icePwd),r+=this.printIceOptions(t.iceOptions),r+=this.printCandidates(t.candidates),r+=this.printRemoteCandidatesList(t.remoteCandidatesList),r+=this.printEndOfCandidates(t.endOfCandidates),r+=this.printFingerprints(t.fingerprints),r+=this.printSetup(t.setup),r+=this.printMid(t.mid),r+=this.printExtmap(t.extmaps),r+=this.printRTPRelated(t),r+=this.printPtime(t.ptime),r+=this.printMaxPtime(t.maxPtime),r+=this.printDirection(t.direction),r+=this.printSSRCGroups(t.ssrcGroups),r+=this.printSSRC(t.ssrcs),r+=this.printRTCPMux(t.rtcpMux),r+=this.printRTCPMuxOnly(t.rtcpMuxOnly),r+=this.printRTCPRsize(t.rtcpRsize),r+=this.printMSId(t.msids),r+=this.printImageattr(t.imageattr),r+=this.printRid(t.rids),r+=this.printSimulcast(t.simulcast),r+=this.printSCRPPort(t.sctpPort),r+=this.printMaxMessageSize(t.maxMessageSize),r+=this.printUnrecognized(t.unrecognized)}},{key:"printCandidates",value:function(e){var t=this;return e.map((function(e){return"a=candidate:".concat(e.foundation).concat(a).concat(e.componentId).concat(a).concat(e.transport).concat(a).concat(e.priority).concat(a).concat(e.connectionAddress).concat(a).concat(e.port).concat(a,"typ").concat(a).concat(e.type).concat(e.relAddr?"".concat(a,"raddr").concat(a).concat(e.relAddr):"").concat(e.relPort?"".concat(a,"rport").concat(a).concat(e.relPort):"").concat(Object.keys(e.extension).map((function(t){return"".concat(a).concat(t).concat(a).concat(e.extension[t])})).join("")).concat(t.eol)})).join("")}},{key:"printRemoteCandidatesList",value:function(e){var t=this;return e.map((function(e){return"a=remote-candidates:".concat(e.join(a)).concat(t.eol)})).join("")}},{key:"printEndOfCandidates",value:function(e){return void 0===e?"":"a=end-of-candidates"+this.eol}},{key:"printRTPRelated",value:function(e){var t=this;if(!e.payloads)return"";var r=e.payloads,n="";n+=e.rtcpFeedbackWildcards.map((function(e){return t.printRTCPFeedback("*",e)})).join("");var i,o=K(r);try{var a=function(){var e=i.value;n+=t.printRtpMap(e.payloadType,e.rtpMap),n+=t.printFmtp(e.payloadType,e.fmtp),n+=e.rtcpFeedbacks.map((function(r){return t.printRTCPFeedback(e.payloadType,r)})).join("")};for(o.s();!(i=o.n()).done;)a()}catch(e){o.e(e)}finally{o.f()}return n}},{key:"printFmtp",value:function(e,t){if(!t)return"";var r=Object.keys(t.parameters);return 1===r.length&&void 0===t.parameters[r[0]]?"a=fmtp:".concat(e).concat(a).concat(r[0]).concat(this.eol):"a=fmtp:".concat(e).concat(a).concat(Object.keys(t.parameters).map((function(e){return"".concat(e,"=").concat(t.parameters[e])})).join(";")).concat(this.eol)}},{key:"printRtpMap",value:function(e,t){return t?"a=rtpmap:".concat(e).concat(a).concat(t.encodingName,"/").concat(t.clockRate).concat(t.encodingParameters?"/".concat(t.encodingParameters):"").concat(this.eol):""}},{key:"printRTCPFeedback",value:function(e,t){var r="a=rtcp-fb:".concat(e).concat(a),n=t;return"trr-int"===n.type?r+="ttr-int".concat(a).concat(n.interval):(r+="".concat((n=n).type),n.parameter&&(r+="".concat(a).concat(n.parameter),n.additional&&(r+="".concat(a).concat(n.additional)))),r+this.eol}},{key:"printPtime",value:function(e){return void 0===e?"":"a=ptime:".concat(e).concat(this.eol)}},{key:"printMaxPtime",value:function(e){return void 0===e?"":"a=maxptime:".concat(e).concat(this.eol)}},{key:"printDirection",value:function(e){return void 0===e?"":"a=".concat(e).concat(this.eol)}},{key:"printSSRC",value:function(e){var t=this;return e.map((function(e){return Object.keys(e.attributes).map((function(r){return"a=ssrc:".concat(e.ssrcId.toString(10)).concat(a).concat(r).concat(e.attributes[r]?":".concat(e.attributes[r]):"").concat(t.eol)})).join("")})).join("")}},{key:"printRTCPMux",value:function(e){return void 0===e?"":"a=rtcp-mux".concat(this.eol)}},{key:"printRTCPMuxOnly",value:function(e){return void 0===e?"":"a=rtcp-mux-only".concat(this.eol)}},{key:"printRTCPRsize",value:function(e){return void 0===e?"":"a=rtcp-rsize".concat(this.eol)}},{key:"printRTCP",value:function(e){if(void 0===e)return"";var t="a=rtcp:".concat(e.port);return e.netType&&(t+="".concat(a).concat(e.netType)),e.addressType&&(t+="".concat(a).concat(e.addressType)),e.address&&(t+="".concat(a).concat(e.address)),t+this.eol}},{key:"printMSId",value:function(e){var t=this;return e.map((function(e){return"a=msid:".concat(e.id).concat(e.appdata?"".concat(a).concat(e.appdata):"").concat(t.eol)})).join("")}},{key:"printImageattr",value:function(e){var t=this;return e.map((function(e){return"a=imageattr:".concat(e).concat(t.eol)})).join("")}},{key:"printRid",value:function(e){var t=this;return e.map((function(e){var r="a=rid:".concat(e.id).concat(a).concat(e.direction);return e.payloads&&(r+="".concat(a,"pt=").concat(e.payloads.join(","))),e.params.length>0&&(r+="".concat(a).concat(e.params.map((function(e){return"depend"===e.type?"depend=".concat(e.rids.join(",")):"".concat(e.type,"=").concat(e.val)})).join(";"))),r+t.eol})).join("")}},{key:"printSimulcast",value:function(e){return void 0===e?"":"a=simulcast:".concat(e).concat(this.eol)}},{key:"printSCRPPort",value:function(e){return void 0===e?"":"a=sctp-port:".concat(e).concat(this.eol)}},{key:"printMaxMessageSize",value:function(e){return void 0===e?"":"a=max-message-size:".concat(e)}},{key:"printMid",value:function(e){return void 0===e?"":"a=mid:".concat(e).concat(this.eol)}},{key:"printSSRCGroups",value:function(e){var t=this;return e.map((function(e){return"a=ssrc-group:".concat(e.semantic).concat(e.ssrcIds.map((function(e){return"".concat(a).concat(e.toString(10))})).join("")).concat(t.eol)})).join("")}}]),r}(D);function P(e){return(new b).parse(e)}function L(e,t){return(new O).print(e,t)}}},t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}return r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(8)}()}(m$);var D$=function(){function e(t){U(this,e),rO(this,"sessionDesc",void 0),rO(this,"localCapabilities",void 0),rO(this,"rtpCapabilities",void 0),rO(this,"candidates",void 0),rO(this,"iceParameters",void 0),rO(this,"dtlsParameters",void 0),rO(this,"setup",void 0),rO(this,"currentMidIndex",void 0),rO(this,"cname",void 0);var r=t=uK(t),n=r.remoteIceParameters,i=r.remoteDtlsParameters,o=r.candidates,a=r.remoteRTPCapabilities,s=r.remoteSetup,c=r.localCapabilities,u=r.sdkCodec,d=r.cname,l=m$.exports.parse("v=0\no=- 0 0 IN IP4 127.0.0.1\ns=AgoraGateway\nt=0 0\na=group:BUNDLE audio video\na=msid-semantic: WMS\na=ice-lite\nm=audio 9 UDP/TLS/RTP/SAVPF 0\nc=IN IP4 127.0.0.1\na=rtcp:9 IN IP4 0.0.0.0\na=sendrecv\na=rtcp-mux\na=rtcp-rsize\na=mid:audio\nm=video 9 UDP/TLS/RTP/SAVPF 0\nc=IN IP4 127.0.0.1\na=rtcp:9 IN IP4 0.0.0.0\na=sendrecv\na=rtcp-mux\na=rtcp-rsize\na=mid:video\n");this.rtpCapabilities=a,this.candidates=o,this.iceParameters=n,this.dtlsParameters=i,this.setup=s,this.localCapabilities=c,this.cname=d;for(var p=0;p<l.mediaDescriptions.length;p++){var f=l.mediaDescriptions[p];if(f.attributes.iceUfrag=n.iceUfrag,f.attributes.icePwd=n.icePwd,f.attributes.fingerprints=i.fingerprints,f.attributes.candidates=o,f.attributes.setup=s,"video"===f.media.mediaType){f.media.fmts=a.videoCodecs.map((function(e){return e.payloadType.toString(10)}));var h=a.videoCodecs.filter((function(e){var t;return null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase().includes(u)}));if(0===h.length)throw new Error("Codec ".concat(u," not supported by remote SDP."));f.attributes.payloads=h,f.attributes.extmaps=a.videoExtensions}"audio"===f.media.mediaType&&(f.media.fmts=a.audioCodecs.map((function(e){return e.payloadType.toString(10)})),f.attributes.payloads=a.audioCodecs,f.attributes.extmaps=a.audioExtensions),l.mediaDescriptions[p]=this.mungMediaDesc(f)}this.sessionDesc=l,this.currentMidIndex=l.mediaDescriptions.length-1}return F(e,[{key:"toString",value:function(){return m$.exports.print(this.sessionDesc)}},{key:"send",value:function(e,t,r){var n=b$(t,this.cname),i=n.ssrcs,o=n.ssrcGroups,a=this.sessionDesc.mediaDescriptions.find((function(t){return e===YP.VIDEO?"video"===t.media.mediaType:"audio"===t.media.mediaType})),s=i[0].attributes.label,c=i[0].attributes.mslabel;return a.attributes.ssrcs=a.attributes.ssrcs.concat(i),a.attributes.ssrcGroups=a.attributes.ssrcGroups.concat(o),{id:s,mslabel:c}}},{key:"batchSend",value:function(e){var t=this;return e.map((function(e){var r=e.kind,n=e.ssrcMsg;return t.send(r,n,void 0)}))}},{key:"stopSending",value:function(e){this.sessionDesc.mediaDescriptions.forEach((function(t){var r=[],n=[],i=[];t.attributes.ssrcs.forEach((function(t){e.includes(t.attributes.label||"")?i.push(t):r.push(t)})),t.attributes.ssrcGroups.forEach((function(e){i.map((function(e){return e.ssrcId})).includes(e.ssrcIds[0])||n.push(e)})),t.attributes.ssrcs=r,t.attributes.ssrcGroups=n}))}},{key:"mute",value:function(e){var t=this.sessionDesc.mediaDescriptions.find((function(t){return t.attributes.mid===e}));if(!t)throw new Error("mediaDescription not found with ".concat(e," in remote SDP when calling RemoteSDP.mute."));t.attributes.direction="inactive"}},{key:"unmute",value:function(e){var t=this.sessionDesc.mediaDescriptions.find((function(t){return t.attributes.mid===e}));if(!t)throw new Error("mediaDescription not found with ".concat(e," in remote SDP when calling RemoteSDP.unmute."));t.attributes.direction="sendonly"}},{key:"receive",value:function(e,t,r){var n=this;e.forEach((function(e,t){var r=e._mediaStreamTrack,i=n.sessionDesc.mediaDescriptions.findIndex((function(e){return e.attributes.mid===r.kind})),o=n.mungRecvMediaDsec(n.sessionDesc.mediaDescriptions[i],e);n.sessionDesc.mediaDescriptions[i]=o}))}},{key:"stopReceiving",value:function(e){}},{key:"restartICE",value:function(e,t){var r=this;e=uK(e),t=uK(t),this.iceParameters=e,this.candidates=t,this.sessionDesc.mediaDescriptions.forEach((function(t){t.attributes.iceUfrag=e.iceUfrag,t.attributes.icePwd=e.icePwd,t.attributes.candidates=r.candidates}))}},{key:"predictReceivingMids",value:function(e){for(var t=[],r=0;r<e;r++)t.push((this.currentMidIndex+r+1).toString(10));return t}},{key:"mungRecvMediaDsec",value:function(e,t){var r=uK(e);return C$(r,t),R$(r,t),r}},{key:"updateRecvMedia",value:function(e,t){var r=this.sessionDesc.mediaDescriptions.findIndex((function(t){return t.attributes.mid===e}));if(-1!==r){var n=this.mungRecvMediaDsec(this.sessionDesc.mediaDescriptions[r],t);this.sessionDesc.mediaDescriptions[r]=n}}},{key:"bumpMid",value:function(e){this.currentMidIndex+=e}},{key:"updateTrackLabel",value:function(e,t,r){var n=this.sessionDesc.mediaDescriptions.find((function(t){return e===YP.VIDEO?"video"===t.attributes.mid:"audio"===t.attributes.mid}));if(n){var i,o=n.attributes.ssrcs.find((function(e){return e.attributes.label===t}));o&&(o.attributes.label=r,null===(i=o.attributes.msid)||void 0===i||i.replace(t,r))}}},{key:"mungMediaDesc",value:function(e){var t=uK(e);return w$(t),function(e){var t=e.attributes.extmaps.find((function(e){return"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"===e.extensionName}));t&&e.attributes.extmaps.splice(e.attributes.extmaps.indexOf(t),1),e.attributes.payloads.forEach((function(e){var t=e.rtcpFeedbacks.findIndex((function(e){return"transport-cc"===e.type}));-1!==t&&e.rtcpFeedbacks.splice(t,1)}))}(t),t}}]),e}();function N$(e){if(Array.isArray(e))return e.map((function(e){return e}));if(!x$(e))return e;var t={};for(var r in e)x$(e[r])||Array.isArray(e[r])?t[r]=N$(e[r]):t[r]=e[r];return t}function x$(e){return!("object"!=D(e)||Array.isArray(e)||!e)}var P$=function(){function e(e){this.input=[],this.size=e}return e.prototype.add=function(e){this.input.push(e),this.input.length>this.size&&this.input.splice(0,1)},e.prototype.diffMean=function(){return 0===this.input.length?0:(this.input[this.input.length-1]-this.input[0])/this.input.length},e}(),L$=function(e,t){return(L$=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};
|
|
10
|
+
/*! *****************************************************************************
|
|
11
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
13
|
+
this file except in compliance with the License. You may obtain a copy of the
|
|
14
|
+
License at http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
|
|
16
|
+
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
17
|
+
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
|
18
|
+
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
|
19
|
+
MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
20
|
+
|
|
21
|
+
See the Apache Version 2.0 License for specific language governing permissions
|
|
22
|
+
and limitations under the License.
|
|
23
|
+
***************************************************************************** */function B$(e,t){function r(){this.constructor=e}L$(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var M$=function(){return(M$=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function U$(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){e.done?i(e.value):new r((function(t){t(e.value)})).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function Q$(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!((i=(i=a.trys).length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}var F$,j$={address:"unknown",candidateType:"unknown",id:"unknown",port:0,priority:0,protocol:"unknown",type:"unknown"},V$={timestamp:0,bitrate:{actualEncoded:0,transmit:0},sendPacketLossRate:0,recvPacketLossRate:0,videoRecv:[],videoSend:[],audioRecv:[],audioSend:[],selectedCandidatePair:{id:"unknown",localCandidate:j$,remoteCandidate:j$}},G$={firsCount:0,nacksCount:0,plisCount:0,framesDecodeCount:0,framesDecodeInterval:0,framesDecodeFreezeTime:0,decodeFrameRate:0,bytes:0,packetsLost:0,packetLostRate:0,packets:0,ssrc:0,qpSumPerFrame:0},K$={firsCount:0,nacksCount:0,plisCount:0,frameCount:0,bytes:0,packets:0,packetsLost:0,packetLostRate:0,ssrc:0,rttMs:0,qpSumPerFrame:0},H$={bytes:0,packets:0,packetsLost:0,packetLostRate:0,ssrc:0,rttMs:0},W$={jitterBufferMs:0,jitterMs:0,bytes:0,packetsLost:0,packetLostRate:0,packets:0,ssrc:0,receivedFrames:0,droppedFrames:0},Y$=function(){function e(e,t){var r=this;this.videoIsReady=!1,this.videoIsReady2={},this.stats=N$(V$),this.isFirstVideoReceived={},this.isFirstVideoDecoded={},this.isFirstAudioReceived={},this.isFirstAudioDecoded={},this.lossRateWindowStats=[],this.pc=e,this.options=t,this.intervalTimer=window.setInterval((function(){return U$(r,void 0,void 0,(function(){return Q$(this,(function(e){return this.updateStats(),[2]}))}))}),this.options.updateInterval)}return e.prototype.getStats=function(){return this.stats},e.prototype.setVideoIsReady=function(e){this.videoIsReady=e},e.prototype.setVideoIsReady2=function(e,t){this.videoIsReady2[e]=t},e.prototype.getVideoIsReady=function(e){return this.videoIsReady2[e]||!1},e.prototype.setIsFirstAudioDecoded=function(e){},e.prototype.destroy=function(){window.clearInterval(this.intervalTimer),this.pc=void 0},e.prototype.calcLossRate=function(e){var t=this;this.lossRateWindowStats.push(e),this.lossRateWindowStats.length>this.options.lossRateInterval&&this.lossRateWindowStats.splice(0,1);for(var r=this.lossRateWindowStats.length,n=0,i=0,o=0,a=0,s=function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}((function(s){e[s].forEach((function(e,c){if(t.lossRateWindowStats[r-1][s][c]&&t.lossRateWindowStats[0][s][c]){var u=t.lossRateWindowStats[r-1][s][c].packets-t.lossRateWindowStats[0][s][c].packets,d=t.lossRateWindowStats[r-1][s][c].packetsLost-t.lossRateWindowStats[0][s][c].packetsLost;"videoSend"===s||"audioSend"===s?(n+=u,o+=d):(i+=u,a+=d),Number.isNaN(u)||Number.isNaN(u)?e.packetLostRate=0:e.packetLostRate=u<=0||d<=0?0:d/(u+d)}}))})),c=0,u=["videoSend","audioSend","videoRecv","audioRecv"];c<u.length;c++)s(u[c]);e.sendPacketLossRate=n<=0||o<=0?0:o/(n+o),e.recvPacketLossRate=i<=0||a<=0?0:a/(i+a)},e}(),q$=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._stats=V$,t.lastDecodeVideoReceiverStats=new Map,t}return B$(t,e),t.prototype.updateStats=function(){return U$(this,void 0,void 0,(function(){var e,t,r,n;return Q$(this,(function(i){switch(i.label){case 0:return[4,this._getStats()];case 1:return e=i.sent(),t=this.statsResponsesToObjects(e),this._stats=N$(V$),r=t.filter((function(e){return"ssrc"===e.type})),this.processSSRCStats(r),(n=t.find((function(e){return"VideoBwe"===e.type})))&&this.processBandwidthStats(n),this._stats.timestamp=Date.now(),this.calcLossRate(this._stats),this.stats=this._stats,[2]}}))}))},t.prototype.processBandwidthStats=function(e){this._stats.bitrate={actualEncoded:Number(e.googActualEncBitrate),targetEncoded:Number(e.googTargetEncBitrate),retransmit:Number(e.googRetransmitBitrate),transmit:Number(e.googTransmitBitrate)},this._stats.sendBandwidth=Number(e.googAvailableSendBandwidth)},t.prototype.processSSRCStats=function(e){var t=this;e.forEach((function(e){var r=e.id.includes("send");switch(e.mediaType+"_"+(r?"send":"recv")){case"video_send":var n=N$(K$);n.codec=e.googCodecName,n.adaptionChangeReason="none",e.googCpuLimitedResolution&&(n.adaptionChangeReason="cpu"),e.googBandwidthLimitedResolution&&(n.adaptionChangeReason="bandwidth"),n.avgEncodeMs=Number(e.googAvgEncodeMs),n.inputFrame={width:Number(e.googFrameWidthInput)||Number(e.googFrameWidthSent),height:Number(e.googFrameHeightInput)||Number(e.googFrameHeightSent),frameRate:Number(e.googFrameRateInput)},n.sentFrame={width:Number(e.googFrameWidthSent),height:Number(e.googFrameHeightSent),frameRate:Number(e.googFrameRateInput)},n.firsCount=Number(e.googFirReceived),n.nacksCount=Number(e.googNacksReceived),n.plisCount=Number(e.googPlisReceived),n.frameCount=Number(e.framesEncoded),n.bytes=Number(e.bytesSent),n.packets=Number(e.packetsSent),n.packetsLost=Number(e.packetsLost),n.ssrc=Number(e.ssrc),n.rttMs=Number(e.googRtt||0),t._stats.videoSend.push(n),t._stats.rtt=n.rttMs;break;case"video_recv":var i=N$(G$),o=t.lastDecodeVideoReceiverStats.get(Number(e.ssrc));if(i.codec=e.googCodecName,i.targetDelayMs=Number(e.googTargetDelayMs),i.renderDelayMs=Number(e.googRenderDelayMs),i.currentDelayMs=Number(e.googCurrentDelayMs),i.minPlayoutDelayMs=Number(e.googMinPlayoutDelayMs),i.decodeMs=Number(e.googDecodeMs),i.maxDecodeMs=Number(e.googMaxDecodeMs),i.receivedFrame={width:Number(e.googFrameWidthReceived),height:Number(e.googFrameHeightReceived),frameRate:Number(e.googFrameRateReceived)},i.decodedFrame={width:Number(e.googFrameWidthReceived),height:Number(e.googFrameHeightReceived),frameRate:Number(e.googFrameRateDecoded)},i.outputFrame={width:Number(e.googFrameWidthReceived),height:Number(e.googFrameHeightReceived),frameRate:Number(e.googFrameRateOutput)},i.jitterBufferMs=Number(e.googJitterBufferMs),i.firsCount=Number(e.googFirsSent),i.nacksCount=Number(e.googNacksSent),i.plisCount=Number(e.googPlisSent),i.framesDecodeCount=Number(e.framesDecoded),i.bytes=Number(e.bytesReceived),i.packets=Number(e.packetsReceived),i.packetsLost=Number(e.packetsLost),i.ssrc=Number(e.ssrc),i.packets>0&&!t.isFirstVideoReceived[i.ssrc]&&(t.onFirstVideoReceived&&t.onFirstVideoReceived(i.ssrc),t.isFirstVideoReceived[i.ssrc]=!0),i.framesDecodeCount>0&&!t.isFirstVideoDecoded[i.ssrc]&&(t.onFirstVideoDecoded&&t.onFirstVideoDecoded(i.ssrc,i.decodedFrame.width,i.decodedFrame.height),t.isFirstVideoDecoded[i.ssrc]=!0),o){var a=o.stats,s=Date.now()-o.lts;i.framesDecodeFreezeTime=a.framesDecodeFreezeTime,i.framesDecodeInterval=a.framesDecodeInterval,i.framesDecodeCount>a.framesDecodeCount&&t.isFirstVideoDecoded?(o.lts=Date.now(),i.framesDecodeInterval=s,i.framesDecodeInterval>=t.options.freezeRateLimit&&(t.getVideoIsReady(parseInt(e.ssrc,10))?i.framesDecodeFreezeTime+=i.framesDecodeInterval:t.setVideoIsReady2(parseInt(e.ssrc,10),!0))):i.framesDecodeCount<o.stats.framesDecodeCount&&(i.framesDecodeInterval=0)}t.lastDecodeVideoReceiverStats.set(i.ssrc,{stats:M$({},i),lts:Date.now()}),t._stats.videoRecv.push(i);break;case"audio_recv":var c=N$(W$);c.codec=e.googCodecName,c.outputLevel=Math.abs(Number(e.audioOutputLevel))/32767,c.decodingCNG=Number(e.googDecodingCNG),c.decodingCTN=Number(e.googDecodingCTN),c.decodingCTSG=Number(e.googDecodingCTSG),c.decodingNormal=Number(e.googDecodingNormal),c.decodingPLC=Number(e.googDecodingPLC),c.decodingPLCCNG=Number(e.googDecodingPLCCNG),c.expandRate=Number(e.googExpandRate),c.accelerateRate=Number(e.googAccelerateRate),c.preemptiveExpandRate=Number(e.googPreemptiveExpandRate),c.secondaryDecodedRate=Number(e.googSecondaryDecodedRate),c.speechExpandRate=Number(e.googSpeechExpandRate),c.preferredJitterBufferMs=Number(e.googPreferredJitterBufferMs),c.jitterBufferMs=Number(e.googJitterBufferMs),c.jitterMs=Number(e.googJitterReceived),c.bytes=Number(e.bytesReceived),c.packets=Number(e.packetsReceived),c.packetsLost=Number(e.packetsLost),c.ssrc=Number(e.ssrc),c.receivedFrames=Number(e.googDecodingCTN)||Number(e.packetsReceived),c.droppedFrames=Number(e.googDecodingPLC)+Number(e.googDecodingPLCCNG)||Number(e.packetsLost),c.receivedFrames>0&&!t.isFirstAudioReceived[c.ssrc]&&(t.onFirstAudioReceived&&t.onFirstAudioReceived(c.ssrc),t.isFirstAudioReceived[c.ssrc]=!0),c.decodingNormal>0&&!t.isFirstAudioDecoded[c.ssrc]&&(t.onFirstAudioDecoded&&t.onFirstAudioDecoded(c.ssrc),t.isFirstAudioDecoded[c.ssrc]=!0),t._stats.audioRecv.push(c);break;case"audio_send":var u=N$(H$);u.codec=e.googCodecName,u.inputLevel=Math.abs(Number(e.audioInputLevel))/32767,u.aecReturnLoss=Number(e.googEchoCancellationReturnLoss||0),u.aecReturnLossEnhancement=Number(e.googEchoCancellationReturnLossEnhancement||0),u.residualEchoLikelihood=Number(e.googResidualEchoLikelihood||0),u.residualEchoLikelihoodRecentMax=Number(e.googResidualEchoLikelihoodRecentMax||0),u.bytes=Number(e.bytesSent),u.packets=Number(e.packetsSent),u.packetsLost=Number(e.packetsLost),u.ssrc=Number(e.ssrc),u.rttMs=Number(e.googRtt||0),t._stats.rtt=u.rttMs,t._stats.audioSend.push(u)}}))},t.prototype._getStats=function(){var e=this;return new Promise((function(t,r){e.pc.getStats(t,r)}))},t.prototype.statsResponsesToObjects=function(e){var t=[];return e.result().forEach((function(e){var r={id:e.id,timestamp:e.timestamp.valueOf().toString(),type:e.type};e.names().forEach((function(t){r[t]=e.stat(t)})),t.push(r)})),t},t}(Y$);!function(e){e.CERTIFICATE="certificate",e.CODEC="codec",e.CANDIDATE_PAIR="candidate-pair",e.LOCAL_CANDIDATE="local-candidate",e.REMOTE_CANDIDATE="remote-candidate",e.INBOUND="inbound-rtp",e.TRACK="track",e.OUTBOUND="outbound-rtp",e.PC="peer-connection",e.REMOTE_INBOUND="remote-inbound-rtp",e.REMOTE_OUTBOUND="remote-outbound-rtp",e.TRANSPORT="transport",e.CSRC="csrc",e.DATA_CHANNEL="data-channel",e.STREAM="stream",e.SENDER="sender",e.RECEIVER="receiver"}(F$||(F$={}));var J$,z$=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._stats=V$,t.lastDecodeVideoReceiverStats=new Map,t.lastVideoFramesRecv=new Map,t.lastVideoFramesSent=new Map,t.lastVideoFramesDecode=new Map,t.lastVideoJBDelay=new Map,t.lastAudioJBDelay=new Map,t.mediaBytesSent=new Map,t.mediaBytesRetransmit=new Map,t.mediaBytesTargetEncode=new Map,t.lastEncoderMs=new Map,t}return B$(t,e),t.prototype.updateStats=function(){return U$(this,void 0,void 0,(function(){var e,t=this;return Q$(this,(function(r){switch(r.label){case 0:return e=this,[4,this.pc.getStats()];case 1:return e.report=r.sent(),this._stats=N$(V$),this.report.forEach((function(e){switch(e.type){case F$.OUTBOUND:"audio"===e.mediaType?t.processAudioOutboundStats(e):"video"===e.mediaType&&t.processVideoOutboundStats(e);break;case F$.INBOUND:"audio"===e.mediaType?t.processAudioInboundStats(e):"video"===e.mediaType&&t.processVideoInboundStats(e);break;case F$.TRANSPORT:var r=t.report.get(e.selectedCandidatePairId);r&&t.processCandidatePairStats(r);break;case F$.CANDIDATE_PAIR:e.selected&&t.processCandidatePairStats(e)}})),this.updateSendBitrate(),this._stats.timestamp=Date.now(),this.calcLossRate(this._stats),this.stats=this._stats,[2]}}))}))},t.prototype.processCandidatePairStats=function(e){if(this._stats.sendBandwidth=e.availableOutgoingBitrate||0,e.currentRoundTripTime&&(this._stats.rtt=1e3*e.currentRoundTripTime),this._stats.videoSend.forEach((function(t){!t.rttMs&&e.currentRoundTripTime&&(t.rttMs=1e3*e.currentRoundTripTime)})),this._stats.audioSend.forEach((function(t){!t.rttMs&&e.currentRoundTripTime&&(t.rttMs=1e3*e.currentRoundTripTime)})),this._stats.selectedCandidatePair.id=e.id,e.localCandidateId){var t=this.report.get(e.localCandidateId);t&&this.processCandidateStats(t)}if(e.remoteCandidateId){var r=this.report.get(e.remoteCandidateId);r&&this.processCandidateStats(r)}},t.prototype.processCandidateStats=function(e){var t;e.type===F$.LOCAL_CANDIDATE&&(t=this._stats.selectedCandidatePair.localCandidate),e.type===F$.REMOTE_CANDIDATE&&(t=this._stats.selectedCandidatePair.remoteCandidate),t&&(t.type=e.type,t.id=e.id,e.address&&(t.address=e.address),e.candidateType&&(t.candidateType=e.candidateType),e.port&&(t.port=e.port),e.priority&&(t.priority=e.priority),e.protocol&&(t.protocol=e.protocol),e.relayProtocol&&(t.relayProtocol=e.relayProtocol),e.type===F$.LOCAL_CANDIDATE&&this.stats.selectedCandidatePair.localCandidate.id!==t.id&&this.onSelectedLocalCandidateChanged&&this.onSelectedLocalCandidateChanged(M$({},t),M$({},this.stats.selectedCandidatePair.localCandidate)),e.type===F$.REMOTE_CANDIDATE&&this.stats.selectedCandidatePair.remoteCandidate.id!==t.id&&this.onSelectedRemoteCandidateChanged&&this.onSelectedRemoteCandidateChanged(M$({},t),M$({},this.stats.selectedCandidatePair.remoteCandidate)))},t.prototype.processAudioInboundStats=function(e){var t=this._stats.audioRecv.find((function(t){return t.ssrc===e.ssrc}));t||(t=N$(W$),this._stats.audioRecv.push(t)),t.ssrc=e.ssrc,t.packets=e.packetsReceived,t.packetsLost=e.packetsLost,t.bytes=e.bytesReceived,t.jitterMs=1e3*e.jitter,e.trackId&&this.processAudioTrackReceiverStats(e.trackId,t),e.codecId&&(t.codec=this.getCodecFromCodecStats(e.codecId)),t.receivedFrames||(t.receivedFrames=e.packetsReceived),t.droppedFrames||(t.droppedFrames=e.packetsLost),t.receivedFrames>0&&!this.isFirstAudioReceived[t.ssrc]&&(this.onFirstAudioReceived&&this.onFirstAudioReceived(t.ssrc),this.isFirstAudioReceived[t.ssrc]=!0),t.outputLevel&&t.outputLevel>0&&!this.isFirstAudioDecoded[t.ssrc]&&(this.onFirstAudioDecoded&&this.onFirstAudioDecoded(t.ssrc),this.isFirstAudioDecoded[t.ssrc]=!0)},t.prototype.processVideoInboundStats=function(e){var t=this._stats.videoRecv.find((function(t){return t.ssrc===e.ssrc}));t||(t=N$(G$),this._stats.videoRecv.push(t)),t.ssrc=e.ssrc,t.packets=e.packetsReceived,t.packetsLost=e.packetsLost,t.bytes=e.bytesReceived,t.firsCount=e.firCount,t.nacksCount=e.nackCount,t.plisCount=e.pliCount,t.framesDecodeCount=e.framesDecoded;var r=this.lastDecodeVideoReceiverStats.get(t.ssrc),n=this.lastVideoFramesDecode.get(t.ssrc),i=Date.now();if(t.framesDecodeCount>0&&!this.isFirstVideoDecoded[t.ssrc]){var o=t.decodedFrame?t.decodedFrame.width:0,a=t.decodedFrame?t.decodedFrame.height:0;this.onFirstVideoDecoded&&this.onFirstVideoDecoded(t.ssrc,o,a),this.isFirstVideoDecoded[t.ssrc]=!0}if(r){var s=r.stats,c=i-r.lts;t.framesDecodeFreezeTime=s.framesDecodeFreezeTime,t.framesDecodeInterval=s.framesDecodeInterval,t.framesDecodeCount>s.framesDecodeCount&&this.isFirstVideoDecoded?(r.lts=Date.now(),t.framesDecodeInterval=c,t.framesDecodeInterval>=this.options.freezeRateLimit&&(this.getVideoIsReady(parseInt(e.ssrc))?t.framesDecodeFreezeTime+=t.framesDecodeInterval:this.setVideoIsReady2(parseInt(e.ssrc,10),!0))):t.framesDecodeCount<s.framesDecodeCount&&(t.framesDecodeInterval=0),e.framesDecoded&&e.qpSum&&(r.stats.framesDecodeCount>e.framesDecoded?t.qpSumPerFrame=e.qpSum/e.framesDecoded:t.qpSumPerFrame=(e.qpSum-r.qpSum)/(e.framesDecoded-r.stats.framesDecodeCount))}n&&i-n.lts>=800?(t.decodeFrameRate=Math.round((t.framesDecodeCount-n.count)/((i-n.lts)/1e3)),this.lastVideoFramesDecode.set(t.ssrc,{count:t.framesDecodeCount,lts:i,rate:t.decodeFrameRate})):n?t.decodeFrameRate=n.rate:this.lastVideoFramesDecode.set(t.ssrc,{count:t.framesDecodeCount,lts:i,rate:0}),e.totalDecodeTime&&(t.decodeMs=1e3*e.totalDecodeTime),e.trackId&&this.processVideoTrackReceiverStats(e.trackId,t),e.codecId&&(t.codec=this.getCodecFromCodecStats(e.codecId)),e.framerateMean&&(t.framesRateFirefox=e.framerateMean),t.packets>0&&!this.isFirstVideoReceived[t.ssrc]&&(this.onFirstVideoReceived&&this.onFirstVideoReceived(t.ssrc),this.isFirstVideoReceived[t.ssrc]=!0),this.lastDecodeVideoReceiverStats.set(t.ssrc,{stats:M$({},t),lts:r?r.lts:Date.now(),qpSum:e.qpSum})},t.prototype.processVideoOutboundStats=function(e){var t=this._stats.videoSend.find((function(t){return t.ssrc===e.ssrc}));t||(t=N$(K$),this._stats.videoSend.push(t));var r,n=this.mediaBytesSent.get(e.ssrc);if(n?n.add(e.bytesSent):((o=new P$(10)).add(e.bytesSent),this.mediaBytesSent.set(e.ssrc,o)),void 0!==e.retransmittedBytesSent){var i=this.mediaBytesRetransmit.get(e.ssrc);i?i.add(e.retransmittedBytesSent):((o=new P$(10)).add(e.retransmittedBytesSent),this.mediaBytesRetransmit.set(e.ssrc,o))}if(e.totalEncodedBytesTarget){var o,a=this.mediaBytesTargetEncode.get(e.ssrc);a?a.add(e.totalEncodedBytesTarget):((o=new P$(10)).add(e.totalEncodedBytesTarget),this.mediaBytesTargetEncode.set(e.ssrc,o))}if(t.ssrc=e.ssrc,t.bytes=e.bytesSent,t.packets=e.packetsSent,t.firsCount=e.firCount,t.nacksCount=e.nackCount,t.plisCount=e.pliCount,t.frameCount=e.framesEncoded,t.adaptionChangeReason=e.qualityLimitationReason,e.totalEncodeTime&&e.framesEncoded)if(!(r=this.lastEncoderMs.get(e.ssrc))||r.lastFrameCount>e.framesEncoded)t.avgEncodeMs=1e3*e.totalEncodeTime/e.framesEncoded;else{var s=e.framesEncoded-r.lastFrameCount,c=e.totalEncodeTime-r.lastEncoderTime;t.avgEncodeMs=1e3*c/s}if(e.framesEncoded&&e.qpSum&&(!(r=this.lastEncoderMs.get(e.ssrc))||r.lastFrameCount>e.framesEncoded?t.qpSumPerFrame=e.qpSum/e.framesEncoded:t.qpSumPerFrame=(e.qpSum-r.lastQpSum)/(e.framesEncoded-r.lastFrameCount)),this.lastEncoderMs.set(e.ssrc,{lastFrameCount:e.framesEncoded,lastEncoderTime:e.totalEncodeTime,lastQpSum:e.qpSum,lts:Date.now()}),e.codecId&&(t.codec=this.getCodecFromCodecStats(e.codecId)),e.mediaSourceId&&this.processVideoMediaSource(e.mediaSourceId,t),e.trackId&&this.processVideoTrackSenderStats(e.trackId,t),e.remoteId)this.processRemoteInboundStats(e.remoteId,t);else{var u=this.findRemoteStatsId(e.ssrc,F$.REMOTE_INBOUND);u&&this.processRemoteInboundStats(u,t)}},t.prototype.processAudioOutboundStats=function(e){var t=this._stats.audioSend.find((function(t){return t.ssrc===e.ssrc}));if(t||(t=N$(H$),this._stats.audioSend.push(t)),t.ssrc=e.ssrc,t.packets=e.packetsSent,t.bytes=e.bytesSent,e.mediaSourceId&&this.processAudioMediaSource(e.mediaSourceId,t),e.codecId&&(t.codec=this.getCodecFromCodecStats(e.codecId)),e.trackId&&this.processAudioTrackSenderStats(e.trackId,t),e.remoteId)this.processRemoteInboundStats(e.remoteId,t);else{var r=this.findRemoteStatsId(e.ssrc,F$.REMOTE_INBOUND);r&&this.processRemoteInboundStats(r,t)}},t.prototype.findRemoteStatsId=function(e,t){var r=Array.from(this.report.values()).find((function(r){return r.type===t&&r.ssrc===e}));return r?r.id:null},t.prototype.processVideoMediaSource=function(e,t){var r=this.report.get(e);r&&r.width&&r.height&&r.framesPerSecond&&(t.inputFrame={width:r.width,height:r.height,frameRate:r.framesPerSecond})},t.prototype.processAudioMediaSource=function(e,t){var r=this.report.get(e);r&&(t.inputLevel=r.audioLevel)},t.prototype.processVideoTrackSenderStats=function(e,t){var r=this.report.get(e);if(r){var n=0,i=Date.now(),o=this.lastVideoFramesSent.get(t.ssrc);o&&i-o.lts>=800?(n=Math.round((r.framesSent-o.count)/((i-o.lts)/1e3)),this.lastVideoFramesSent.set(t.ssrc,{count:r.framesSent,lts:i,rate:n})):o?n=o.rate:this.lastVideoFramesSent.set(t.ssrc,{count:r.framesSent,lts:i,rate:0}),t.sentFrame={width:r.frameWidth,height:r.frameHeight,frameRate:n}}},t.prototype.processVideoTrackReceiverStats=function(e,t){var r=this.report.get(e);if(r){var n=this.lastVideoFramesRecv.get(t.ssrc),i=Date.now();t.framesReceivedCount=r.framesReceived;var o=0;if(n&&i-n.lts>=800?(o=Math.round((r.framesReceived-n.count)/((i-n.lts)/1e3)),this.lastVideoFramesRecv.set(t.ssrc,{count:r.framesReceived,lts:i,rate:o})):n?o=n.rate:this.lastVideoFramesRecv.set(t.ssrc,{count:r.framesReceived,lts:i,rate:0}),t.receivedFrame={width:r.frameWidth||0,height:r.frameHeight||0,frameRate:o||0},t.decodedFrame={width:r.frameWidth||0,height:r.frameHeight||0,frameRate:t.decodeFrameRate||0},t.outputFrame={width:r.frameWidth||0,height:r.frameHeight||0,frameRate:t.decodeFrameRate||0},r.jitterBufferDelay&&r.jitterBufferEmittedCount){var a=this.lastVideoJBDelay.get(t.ssrc);this.lastVideoJBDelay.set(t.ssrc,{jitterBufferDelay:r.jitterBufferDelay,jitterBufferEmittedCount:r.jitterBufferEmittedCount}),a||(a={jitterBufferDelay:0,jitterBufferEmittedCount:0});var s=1e3*(r.jitterBufferDelay-a.jitterBufferDelay)/(r.jitterBufferEmittedCount-a.jitterBufferEmittedCount);t.jitterBufferMs=s,t.currentDelayMs=Math.round(s)}}},t.prototype.processAudioTrackSenderStats=function(e,t){var r=this.report.get(e);r&&(t.aecReturnLoss=r.echoReturnLoss||0,t.aecReturnLossEnhancement=r.echoReturnLossEnhancement||0)},t.prototype.processAudioTrackReceiverStats=function(e,t){var r=this.report.get(e);if(r){if(r.removedSamplesForAcceleration&&r.totalSamplesReceived&&(t.accelerateRate=r.removedSamplesForAcceleration/r.totalSamplesReceived),r.jitterBufferDelay&&r.jitterBufferEmittedCount){var n=this.lastAudioJBDelay.get(t.ssrc);this.lastAudioJBDelay.set(t.ssrc,{jitterBufferDelay:r.jitterBufferDelay,jitterBufferEmittedCount:r.jitterBufferEmittedCount}),n||(n={jitterBufferDelay:0,jitterBufferEmittedCount:0});var i=1e3*(r.jitterBufferDelay-n.jitterBufferDelay)/(r.jitterBufferEmittedCount-n.jitterBufferEmittedCount);t.jitterBufferMs=Math.round(i)}t.outputLevel=r.audioLevel;var o=1920;r.totalSamplesDuration&&r.totalSamplesReceived&&(o=r.totalSamplesReceived/r.totalSamplesDuration/50,t.receivedFrames=Math.round(r.totalSamplesReceived/o)),r.concealedSamples&&(t.droppedFrames=Math.round(r.concealedSamples/o))}},t.prototype.processRemoteInboundStats=function(e,t){var r=this.report.get(e);r&&(t.packetsLost=r.packetsLost,r.roundTripTime&&(t.rttMs=1e3*r.roundTripTime))},t.prototype.getCodecFromCodecStats=function(e){var t=this.report.get(e);if(!t)return"";var r=t.mimeType.match(/\/(.*)$/);return r&&r[1]?r[1]:""},t.prototype.updateSendBitrate=function(){var e=0,t=null,r=null;this.mediaBytesSent.forEach((function(t){e+=t.diffMean()})),this.mediaBytesRetransmit.forEach((function(e){t=null===t?e.diffMean():t+e.diffMean()})),this.mediaBytesTargetEncode.forEach((function(e){r=null===r?e.diffMean():r+e.diffMean()}));var n=null!==t?e-t:e;this._stats.bitrate={actualEncoded:8*n/(this.options.updateInterval/1e3),transmit:8*e/(this.options.updateInterval/1e3)},null!==t&&(this._stats.bitrate.retransmit=8*t/(this.options.updateInterval/1e3)),null!==r&&(this._stats.bitrate.targetEncoded=8*r/(this.options.updateInterval/1e3))},t}(Y$),X$=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return B$(t,e),t.prototype.updateStats=function(){return Promise.resolve()},t}(Y$);function Z$(e,t,r,n){void 0===t&&(t=250),void 0===r&&(r=8),void 0===n&&(n=500);var i,o=(i=navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]*/i))&&i[0]?Number(i[0].split("/")[1]):null;return o?o<76?new q$(e,{updateInterval:t,lossRateInterval:r,freezeRateLimit:n}):new z$(e,{updateInterval:t,lossRateInterval:r,freezeRateLimit:n}):function(e){return!!window.RTCStatsReport&&e.getStats()instanceof Promise}(e)?new z$(e,{updateInterval:t,lossRateInterval:r,freezeRateLimit:n}):new X$(e,{updateInterval:t,lossRateInterval:r,freezeRateLimit:n})}function $$(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function e1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$$(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$$(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var t1,r1=(Ej((J$=function(e){k(r,e);var t=W(r);function r(e,n){var i;return U(this,r),i=t.call(this,e,n),rO(S(i),"store",void 0),rO(S(i),"peerConnection",void 0),rO(S(i),"remoteSDP",void 0),rO(S(i),"initialOffer",void 0),rO(S(i),"statsFilter",void 0),rO(S(i),"useRTX",!1),rO(S(i),"localCapabilities",void 0),rO(S(i),"localCandidateCount",0),rO(S(i),"allCandidatesReceived",!1),rO(S(i),"mutex",new rV("P2PConnection-mutex")),i.store=n,i.peerConnection=new RTCPeerConnection(r.resolvePCConfiguration(e),{optional:[{googDscp:!0}]}),i.statsFilter=Z$(i.peerConnection,void 0,void 0,Uk()?1200:void 0),i.bindPCEvents(),i.bindStatsEvents(),i.store.p2pId=i.store.p2pId+1,i}return F(r,[{key:"peerConnectionState",get:function(){return this.peerConnection.connectionState}},{key:"iceConnectionState",get:function(){return this.peerConnection.iceConnectionState}},{key:"currentLocalDescription",get:function(){return this.peerConnection.currentLocalDescription}},{key:"currentRemoteDescription",get:function(){return this.peerConnection.currentRemoteDescription}},{key:"establish",value:function(){var e=y(G.mark((function e(){var t,r,n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.peerConnection.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});case 3:if((t=e.sent).sdp){e.next=6;break}throw new Error("Cannot get initialOffer.sdp when trying to establish PeerConnection.");case 6:return r=I$(t.sdp),n=y$(t.sdp,!this.useRTX,!1,["opus"]),e.abrupt("return",(this.localCapabilities=n,this.initialOffer=t,e1(e1({},r),{},{rtpCapabilities:{send:{audioCodecs:[],audioExtensions:[],videoCodecs:[],videoExtensions:[]},recv:{audioCodecs:[],audioExtensions:[],videoCodecs:[],videoExtensions:[]},sendrecv:n},offerSDP:t.sdp})));case 10:throw e.prev=10,e.t0=e.catch(0),new SD(mD.GET_LOCAL_CONNECTION_PARAMS_FAILED,e.t0.toString());case 13:case"end":return e.stop()}}),e,this,[[0,10]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"connect",value:function(){var e=y(G.mark((function e(t,r,n,i,o,a){var s;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.initialOffer){e.next=3;break}throw new Error("Cannot establish P2PConnection without initial offer.");case 3:return this.remoteSDP=new D$({remoteIceParameters:t,remoteDtlsParameters:r,candidates:n,remoteRTPCapabilities:i.send,remoteSetup:o,localCapabilities:this.localCapabilities,sdkCodec:this.store.codec,cname:a}),s=this.remoteSDP.toString(),e.next=7,this.peerConnection.setLocalDescription(this.initialOffer);case 7:return e.next=9,this.peerConnection.setRemoteDescription({type:"answer",sdp:s});case 9:e.next=14;break;case 11:throw e.prev=11,e.t0=e.catch(0),new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection.connect failed; ".concat(e.t0.toString()));case 14:case"end":return e.stop()}}),e,this,[[0,11]])})));function t(t,r,n,i,o,a){return e.apply(this,arguments)}return t}()},{key:"send",value:function(e,t){var r=this;return YZ(G.mark((function n(){var i,o,a,s,c,u,d,l;return G.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,qZ(r.mutex.lock());case 2:if(i=n.sent,n.prev=3,r.remoteSDP){n.next=6;break}throw new Error("Cannot call P2PConnection.send before remote SDP created");case 6:return o=e.map((function(e){return r.peerConnection.addTrack(e._mediaStreamTrack)})),n.next=9,qZ(r.peerConnection.createOffer());case 9:return a=n.sent,s=m$.exports.parse(a.sdp),c=e.map((function(e){var t=e._mediaStreamTrack,n=s.mediaDescriptions.find((function(e){return e.attributes.mid===t.kind}));if(!n)throw new Error("Cannot extract ssrc from mediaDescription.");return function(e,t,r){var n=e.attributes.ssrcs.filter((function(e){return e.attributes.label===t})),i=e.attributes.ssrcGroups;if(0===n.length)throw new Error("Cannot extract ssrc from plan-b SDP.");if(i&&n.length>1){var o=i.find((function(e){return-1!==e.ssrcIds.indexOf(n[0].ssrcId)}));return o?[{ssrcId:o.ssrcIds[0],rtx:r?o.ssrcIds[1]:void 0}]:[{ssrcId:n[0].ssrcId}]}return[{ssrcId:n[0].ssrcId}]}(n,t.id,r.useRTX)})),n.prev=12,n.next=15,c;case 15:u=n.sent,n.next=21;break;case 18:throw n.prev=18,n.t0=n.catch(12),o.forEach((function(e){Mk()&&e.replaceTrack(null),r.peerConnection.removeTrack(e)})),n.t0;case 21:return d=r.mungSendOfferSDP(a.sdp,e),r.remoteSDP.receive(e,t,u),l=r.remoteSDP.toString(),n.next=26,qZ(r.peerConnection.setLocalDescription({type:"offer",sdp:d}));case 26:return n.next=28,qZ(r.applySendEncodings(o,e));case 28:return n.next=30,qZ(r.peerConnection.setRemoteDescription({type:"answer",sdp:l}));case 30:return n.abrupt("return",e.map((function(e,t){var r=e._mediaStreamTrack.id;return{localSSRC:c[t],id:r}})));case 33:throw n.prev=33,n.t1=n.catch(3),new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection.send failed; ".concat(n.t1.toString()));case 36:return n.prev=36,i(),n.finish(36);case 39:case"end":return n.stop()}}),n,null,[[3,33,36,39],[12,18]])})))()}},{key:"stopSending",value:function(){var e=y(G.mark((function e(t){var r,n,i,o=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.remoteSDP){e.next=3;break}throw new Error("Cannot call P2PConnection.stopSending before remote SDP created");case 3:if(r=this.peerConnection.getSenders().filter((function(e){var r;return-1!==t.indexOf((null===(r=e.track)||void 0===r?void 0:r.id)||"")})),r.length===t.length){e.next=6;break}throw new Error("Transceivers' length doesn't match mids' length when trying to call P2PConnection.stopSending.");case 6:return r.map((function(e){Mk()&&e.replaceTrack(null),o.peerConnection.removeTrack(e)})),e.next=9,this.peerConnection.createOffer();case 9:return n=e.sent,e.next=12,this.peerConnection.setLocalDescription(n);case 12:return this.remoteSDP.stopReceiving(t),i=this.remoteSDP.toString(),e.next=16,this.peerConnection.setRemoteDescription({type:"answer",sdp:i});case 16:e.next=21;break;case 18:throw e.prev=18,e.t0=e.catch(0),new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection.stopSending failed; ".concat(e.t0.toString()));case 21:case"end":return e.stop()}}),e,this,[[0,18]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"receive",value:function(){var e=y(G.mark((function e(t,r,n,i){var o,a,s,c,u,d,l=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.remoteSDP){e.next=3;break}throw new Error("Cannot call P2PConnection.receive ".concat(t," before remoteSDP created."));case 3:return o=this.remoteSDP.send(t,r,i),a=o.id,s=o.mslabel,c=new Rb((function(e,r){var n=setTimeout((function(){r(new Error("Cannot receive track, id: ".concat(a)))}),1e4),i=function r(i){var o=Tk();if("Safari"===o.name&&11===Number(o.version)&&i.track.id!==a&&i.streams[0].id===s){var c,u=i.streams[0].getTracks()[0];return null===(c=l.remoteSDP)||void 0===c||c.updateTrackLabel(t,a,i.track.id),l.peerConnection.removeEventListener("track",r),clearTimeout(n),void e(u)}if(i.track.id===a)return l.peerConnection.removeEventListener("track",r),clearTimeout(n),void e(i.track)};l.peerConnection.addEventListener("track",i)})),u=this.remoteSDP.toString(),e.next=6,this.peerConnection.setRemoteDescription({type:"offer",sdp:u});case 6:return e.next=8,this.peerConnection.createAnswer();case 8:return d=e.sent,e.next=11,this.peerConnection.setLocalDescription(d);case 11:return e.next=13,c;case 13:return e.t0=e.sent,e.t1=a,e.abrupt("return",{track:e.t0,id:e.t1});case 18:throw e.prev=18,e.t2=e.catch(0),new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection.receive failed; ".concat(e.t2.toString()));case 21:case"end":return e.stop()}}),e,this,[[0,18]])})));function t(t,r,n,i){return e.apply(this,arguments)}return t}()},{key:"stopReceiving",value:function(){var e=y(G.mark((function e(t){var r,n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.remoteSDP){e.next=3;break}throw new Error("Cannot call P2PConnection.stopReceiving before remote SDP created.");case 3:return this.remoteSDP.stopSending(t),r=this.remoteSDP.toString(),e.next=7,this.peerConnection.setRemoteDescription({type:"offer",sdp:r});case 7:return e.next=9,this.peerConnection.createAnswer();case 9:return n=e.sent,e.next=12,this.peerConnection.setLocalDescription(n);case 12:e.next=17;break;case 14:throw e.prev=14,e.t0=e.catch(0),new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection stopReceiving failed; ".concat(e.t0.toString()));case 17:case"end":return e.stop()}}),e,this,[[0,14]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"muteRemote",value:function(){var e=y(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"unmuteRemote",value:function(){var e=y(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"muteLocal",value:function(){var e=y(G.mark((function e(t){var r;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.remoteSDP){e.next=3;break}throw new Error("Cannot call P2PConnection.muteLocal before remote SDP created.");case 3:if(r=this.peerConnection.getSenders().filter((function(e){var r;return-1!==t.indexOf((null===(r=e.track)||void 0===r?void 0:r.id)||"")})),r.length===t.length){e.next=6;break}throw new Error("sender' length doesn't match mids' length.");case 6:r.map((function(e){if(Mk()&&e.track)e.track.enabled=!1;else{var t=e.getParameters();t.encodings.forEach((function(e){return e.active=!1})),e.setParameters(t)}})),e.next=12;break;case 9:throw e.prev=9,e.t0=e.catch(0),new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection.muteLocal failed; ".concat(e.t0.toString()));case 12:case"end":return e.stop()}}),e,this,[[0,9]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"unmuteLocal",value:function(){var e=y(G.mark((function e(t){var r,n,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.remoteSDP){e.next=3;break}throw new Error("Cannot call P2PConnection.unmuteLocal before remote SDP created.");case 3:if(r=this.peerConnection.getSenders().filter((function(e){var r;return-1!==t.indexOf((null===(r=e.track)||void 0===r?void 0:r.id)||"")})),r.length===t.length){e.next=6;break}throw new Error("Senders' length doesn't match mids' length.");case 6:return r.map(function(){var e=y(G.mark((function e(t){var r;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Mk()||!t.track){e.next=4;break}t.track.enabled=!0,e.next=8;break;case 4:return(r=t.getParameters()).encodings.forEach((function(e){return e.active=!0})),e.next=8,t.setParameters(r);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),e.next=9,this.peerConnection.createOffer();case 9:return n=e.sent,e.next=12,this.peerConnection.setLocalDescription(n);case 12:return i=this.remoteSDP.toString(),e.next=15,this.peerConnection.setRemoteDescription({type:"answer",sdp:i});case 15:e.next=20;break;case 17:throw e.prev=17,e.t0=e.catch(0),new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection.unmuteLocal failed; ".concat(e.t0.toString()));case 20:case"end":return e.stop()}}),e,this,[[0,17]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"reEstablish",value:function(){var e=y(G.mark((function e(){var t,r=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.peerConnection.createOffer({iceRestart:!0});case 2:if((t=e.sent).sdp){e.next=5;break}throw new Error("Cannot get SDP from restart offer.");case 5:return e.abrupt("return",{iceParameters:I$(t.sdp).iceParameters,restartICE:function(){var e=y(G.mark((function e(n,i){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",r.restartICE(t,n,i));case 1:case"end":return e.stop()}}),e)})));function n(t,r){return e.apply(this,arguments)}return n}(),restartOfferSDP:t.sdp});case 6:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"close",value:function(){var e;this.peerConnection.close(),null===(e=this.onConnectionStateChange)||void 0===e||e.call(this,"closed"),this.unbindPCEvents(),this.unbindStatsEvents(),this.removeAllListeners(),this.statsFilter.destroy()}},{key:"getStats",value:function(){return this.statsFilter.getStats()}},{key:"getRemoteVideoIsReady",value:function(e){return this.statsFilter.getVideoIsReady(e)}},{key:"updateEncoderConfig",value:function(){var e=y(G.mark((function e(t,r){var n,i,o;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.remoteSDP){e.next=3;break}throw new Error("Cannot call P2PConnection.updateEncoderConfig before remote SDP created.");case 3:return e.next=5,this.peerConnection.createOffer();case 5:return n=e.sent,i=this.mungSendOfferSDP(n.sdp,[r]),this.remoteSDP.updateRecvMedia(r._mediaStreamTrack.kind,r),o=this.remoteSDP.toString(),e.next=11,this.peerConnection.setLocalDescription({type:"offer",sdp:i});case 11:return e.next=13,this.peerConnection.setRemoteDescription({type:"answer",sdp:o});case 13:e.next=18;break;case 15:throw e.prev=15,e.t0=e.catch(0),new SD(mD.EXCHANGE_SDP_FAILED,e.t0.toString());case 18:case"end":return e.stop()}}),e,this,[[0,15]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"updateSendParameters",value:function(){var e=y(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.peerConnection.getSenders().filter((function(e){var r;return(null===(r=e.track)||void 0===r?void 0:r.id)===t})),e.t0=1===n.length,!e.t0){e.next=5;break}return e.next=5,this.applySendEncodings(n,[r]);case 5:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"setStatsRemoteVideoIsReady",value:function(e,t){this.statsFilter.setVideoIsReady2(e,t)}},{key:"replaceTrack",value:function(){var e=y(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.peerConnection.getSenders().find((function(e){var t;return(null===(t=e.track)||void 0===t?void 0:t.id)===r})),e.t0=n,!e.t0){e.next=5;break}return e.next=5,n.replaceTrack(t._mediaStreamTrack);case 5:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"restartICE",value:function(){var e=y(G.mark((function e(t,r,n){var i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.remoteSDP){e.next=3;break}throw new Error("Cannot restartICE before remoteSDP created.");case 3:return this.remoteSDP.restartICE(r,n),i=this.remoteSDP.toString(),e.next=7,this.peerConnection.setLocalDescription(t);case 7:return e.next=9,this.peerConnection.setRemoteDescription({type:"answer",sdp:i});case 9:e.next=14;break;case 11:throw e.prev=11,e.t0=e.catch(0),new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection.restartICE failed; ".concat(e.t0.toString()));case 14:case"end":return e.stop()}}),e,this,[[0,11]])})));function t(t,r,n){return e.apply(this,arguments)}return t}()},{key:"bindPCEvents",value:function(){var e=this;this.peerConnection.oniceconnectionstatechange=function(){var t;null===(t=e.onICEConnectionStateChange)||void 0===t||t.call(e,e.peerConnection.iceConnectionState)},this.peerConnection.onconnectionstatechange=function(){var t;null===(t=e.onConnectionStateChange)||void 0===t||t.call(e,e.peerConnection.connectionState)},this.peerConnection.onicecandidate=function(t){t.candidate?e.localCandidateCount+=1:(e.peerConnection.onicecandidate=null,e.allCandidatesReceived=!0,ND.debug("[pc-".concat(e.store.p2pId,"] local candidate count"),e.localCandidateCount))},setTimeout((function(){e.allCandidatesReceived||(e.allCandidatesReceived=!0,ND.debug("[pc-".concat(e.store.p2pId,"] onicecandidate timeout, local candidate count"),e.localCandidateCount))}),gN("CANDIDATE_TIMEOUT"))}},{key:"unbindPCEvents",value:function(){this.peerConnection.oniceconnectionstatechange=null,this.peerConnection.onconnectionstatechange=null,this.peerConnection.onsignalingstatechange=null,this.peerConnection.onicecandidateerror=null,this.peerConnection.onicecandidate=null,this.peerConnection.ontrack=null}},{key:"applySendEncodings",value:function(){var e=y(G.mark((function e(t,r){var n,i,o,a,s,c,u,d,l;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,oL().supportSetRtpSenderParameters){e.next=3;break}return e.abrupt("return");case 3:if(t.length===r.length){e.next=5;break}return e.abrupt("return");case 5:n=0;case 6:if(!(n<t.length)){e.next=29;break}if(o=t[n],a=r[n]){e.next=10;break}return e.abrupt("continue",26);case 10:if(s={},c={},!(a instanceof Mz)){e.next=20;break}e.t0=a._optimizationMode,e.next="motion"===e.t0?15:"detail"===e.t0?17:19;break;case 15:return s.degradationPreference="maintain-framerate",e.abrupt("break",20);case 17:return s.degradationPreference="maintain-resolution",e.abrupt("break",20);case 19:s.degradationPreference="balanced";case 20:return gN("DSCP_TYPE")&&Yk()&&(u=gN("DSCP_TYPE"),["very-low","low","medium","high"].includes(u)&&(c.networkPriority=u)),d=o.getParameters(),(l=null===(i=d.encodings)||void 0===i?void 0:i[0])&&Object.assign(l,c),Object.assign(d,s),e.next=26,o.setParameters(d);case 26:n++,e.next=6;break;case 29:e.next=34;break;case 31:e.prev=31,e.t1=e.catch(0),ND.debug("Apply RTPSendEncodings failed.");case 34:case"end":return e.stop()}}),e,null,[[0,31]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"mungSendOfferSDP",value:function(e,t){var r=m$.exports.parse(e);return t.forEach((function(e,t){var n=e._mediaStreamTrack,i=r.mediaDescriptions.find((function(e){return e.attributes.mid===n.kind}));i&&C$(i,e)})),m$.exports.print(r)}},{key:"bindStatsEvents",value:function(){var e=this;this.statsFilter.onFirstAudioReceived=function(t){var r;null===(r=e.onFirstAudioReceived)||void 0===r||r.call(e,t)},this.statsFilter.onFirstVideoReceived=function(t){var r;null===(r=e.onFirstVideoReceived)||void 0===r||r.call(e,t)},this.statsFilter.onFirstAudioDecoded=function(t){var r;null===(r=e.onFirstAudioDecoded)||void 0===r||r.call(e,t)},this.statsFilter.onFirstVideoDecoded=function(t,r,n){var i;null===(i=e.onFirstVideoDecoded)||void 0===i||i.call(e,t,r,n)},this.statsFilter.onSelectedLocalCandidateChanged=function(t,r){var n;null===(n=e.onSelectedLocalCandidateChanged)||void 0===n||n.call(e,t,r)},this.statsFilter.onSelectedRemoteCandidateChanged=function(t,r){var n;null===(n=e.onSelectedRemoteCandidateChanged)||void 0===n||n.call(e,t,r)}}},{key:"unbindStatsEvents",value:function(){this.statsFilter.onFirstAudioReceived=void 0,this.statsFilter.onFirstVideoReceived=void 0,this.statsFilter.onFirstAudioDecoded=void 0,this.statsFilter.onFirstVideoDecoded=void 0,this.statsFilter.onSelectedLocalCandidateChanged=void 0,this.statsFilter.onSelectedRemoteCandidateChanged=void 0}},{key:"batchReceive",value:function(){var e=y(G.mark((function e(t){var r,n,i,o=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.remoteSDP){e.next=3;break}throw new Error("Cannot call P2PConnection.batchReceive before remoteSDP created.");case 3:return r=this.remoteSDP.batchSend(t).map((function(e,r){var n=e.id,i=e.mslabel,a=t[r].kind;return new Rb((function(e,t){var r=setTimeout((function(){t(new Error("Cannot receive track, id: ".concat(n)))}),1e4),s=function t(s){var c=Tk();if("Safari"===c.name&&11===Number(c.version)&&s.track.id!==n&&s.streams[0].id===i){var u,d=s.streams[0].getTracks()[0];return null===(u=o.remoteSDP)||void 0===u||u.updateTrackLabel(a,n,s.track.id),o.peerConnection.removeEventListener("track",t),clearTimeout(r),void e({track:d,id:n})}if(s.track.id===n)return o.peerConnection.removeEventListener("track",t),clearTimeout(r),void e({track:s.track,id:n})};o.peerConnection.addEventListener("track",s)}))})),n=this.remoteSDP.toString(),e.next=6,this.peerConnection.setRemoteDescription({type:"offer",sdp:n});case 6:return e.next=8,this.peerConnection.createAnswer();case 8:return i=e.sent,e.next=11,this.peerConnection.setLocalDescription(i);case 11:return e.next=13,Rb.all(r);case 13:return e.abrupt("return",e.sent);case 16:throw e.prev=16,e.t0=e.catch(0),new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection.receive failed; ".concat(e.t0.toString()));case 19:case"end":return e.stop()}}),e,this,[[0,16]])})));function t(t){return e.apply(this,arguments)}return t}()}],[{key:"resolvePCConfiguration",value:function(e){var t,n,i={iceServers:[],sdpSemantics:"plan-b"};return e.iceServers?i.iceServers=e.iceServers:e.turnServer&&"off"!==e.turnServer.mode&&(sP(e.turnServer.servers)?i.iceServers=e.turnServer.servers:(i.iceServers&&(t=i.iceServers).push.apply(t,M(r.turnServerConfigToIceServers(e.turnServer.servers))),gN("USE_TURN_SERVER_OF_GATEWAY")&&i.iceServers&&e.turnServer.serversFromGateway&&(n=i.iceServers).push.apply(n,M(r.turnServerConfigToIceServers(e.turnServer.serversFromGateway))),e.turnServer.servers.concat(e.turnServer.serversFromGateway||[]).forEach((function(e){e.forceturn&&(i.iceTransportPolicy="relay")})))),i}},{key:"turnServerConfigToIceServers",value:function(e){var t=[];return e.forEach((function(e){e.security?e.tcpport&&t.push({username:e.username,credential:e.password,credentialType:"password",urls:"turns:".concat(e.turnServerURL,":").concat(e.tcpport,"?transport=tcp")}):(e.udpport&&t.push({username:e.username,credential:e.password,credentialType:"password",urls:"turn:".concat(e.turnServerURL,":").concat(e.udpport,"?transport=udp")}),e.tcpport&&t.push({username:e.username,credential:e.password,credentialType:"password",urls:"turn:".concat(e.turnServerURL,":").concat(e.tcpport,"?transport=tcp")}))})),t}}]),r}(eL)).prototype,"connect",[n1],Object.getOwnPropertyDescriptor(J$.prototype,"connect"),J$.prototype),Ej(J$.prototype,"stopSending",[n1],Object.getOwnPropertyDescriptor(J$.prototype,"stopSending"),J$.prototype),Ej(J$.prototype,"receive",[n1],Object.getOwnPropertyDescriptor(J$.prototype,"receive"),J$.prototype),Ej(J$.prototype,"stopReceiving",[n1],Object.getOwnPropertyDescriptor(J$.prototype,"stopReceiving"),J$.prototype),Ej(J$.prototype,"muteRemote",[n1],Object.getOwnPropertyDescriptor(J$.prototype,"muteRemote"),J$.prototype),Ej(J$.prototype,"unmuteRemote",[n1],Object.getOwnPropertyDescriptor(J$.prototype,"unmuteRemote"),J$.prototype),Ej(J$.prototype,"muteLocal",[n1],Object.getOwnPropertyDescriptor(J$.prototype,"muteLocal"),J$.prototype),Ej(J$.prototype,"unmuteLocal",[n1],Object.getOwnPropertyDescriptor(J$.prototype,"unmuteLocal"),J$.prototype),Ej(J$.prototype,"reEstablish",[n1],Object.getOwnPropertyDescriptor(J$.prototype,"reEstablish"),J$.prototype),Ej(J$.prototype,"close",[n1],Object.getOwnPropertyDescriptor(J$.prototype,"close"),J$.prototype),Ej(J$.prototype,"updateEncoderConfig",[n1],Object.getOwnPropertyDescriptor(J$.prototype,"updateEncoderConfig"),J$.prototype),Ej(J$.prototype,"updateSendParameters",[n1],Object.getOwnPropertyDescriptor(J$.prototype,"updateSendParameters"),J$.prototype),Ej(J$.prototype,"replaceTrack",[n1],Object.getOwnPropertyDescriptor(J$.prototype,"replaceTrack"),J$.prototype),Ej(J$.prototype,"restartICE",[n1],Object.getOwnPropertyDescriptor(J$.prototype,"restartICE"),J$.prototype),J$);function n1(e,t,r){var n=e[t];if("function"!=typeof n)throw new Error("Cannot use mutex on object property.");return r.value=y(G.mark((function e(){var r,i,o,a,s,c=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.mutex,e.next=3,r.lock("Locking from P2PConnection.".concat(t));case 3:for(i=e.sent,e.prev=4,o=c.length,a=new Array(o),s=0;s<o;s++)a[s]=c[s];return e.next=8,n.apply(this,a);case 8:return e.abrupt("return",e.sent);case 9:return e.prev=9,i(),e.finish(9);case 12:case"end":return e.stop()}}),e,this,[[4,,9,12]])}))),r}var i1,o1,a1="9",s1=4e4,c1=tN("RemoteSDP")(t1=function(){function e(t){U(this,e),rO(this,"sessionDesc",void 0),rO(this,"_localCapabilities",void 0),rO(this,"_rtpCapabilities",void 0),rO(this,"_candidates",void 0),rO(this,"_iceParameters",void 0),rO(this,"_dtlsParameters",void 0),rO(this,"setup",void 0),rO(this,"currentMidIndex",void 0),rO(this,"cname",void 0);var r=t=uK(t),n=r.remoteIceParameters,i=r.remoteDtlsParameters,o=r.candidates,a=r.remoteRTPCapabilities,s=r.remoteSetup,c=r.localCapabilities,u=r.cname,d=m$.exports.parse("v=0\no=- 0 0 IN IP4 127.0.0.1\ns=AgoraGateway\nt=0 0\na=group:BUNDLE 0 1\na=msid-semantic: WMS\na=ice-lite\nm=video 9 UDP/TLS/RTP/SAVPF 0\nc=IN IP4 127.0.0.1\na=rtcp:9 IN IP4 0.0.0.0\na=sendonly\na=rtcp-mux\na=rtcp-rsize\na=mid:0\nm=audio 9 UDP/TLS/RTP/SAVPF 0\nc=IN IP4 127.0.0.1\na=rtcp:9 IN IP4 0.0.0.0\na=sendonly\na=rtcp-mux\na=rtcp-rsize\na=mid:1\n");this._rtpCapabilities=a,this._candidates=o,this._iceParameters=n,this._dtlsParameters=i,this._localCapabilities=c,this.setup=s,this.cname=u;var l,p=this.rtpCapabilities.send,f=K(d.mediaDescriptions);try{for(f.s();!(l=f.n()).done;){var h=l.value;if(h.attributes.iceUfrag=n.iceUfrag,h.attributes.icePwd=n.icePwd,h.attributes.fingerprints=i.fingerprints,h.attributes.candidates=o,h.attributes.setup=s,"video"===h.media.mediaType&&(h.media.fmts=p.videoCodecs.map((function(e){return e.payloadType.toString(10)})),h.attributes.payloads=p.videoCodecs,h.attributes.extmaps=p.videoExtensions,gN("PRELOAD_MEDIA_COUNT")>0)){var A=b$([{ssrcId:s1,rtx:gN("USE_RTX")?40001:void 0}],this.cname),v=A.ssrcs,g=A.ssrcGroups;h.attributes.ssrcs=v,h.attributes.ssrcGroups=g}if("audio"===h.media.mediaType&&(h.media.fmts=p.audioCodecs.map((function(e){return e.payloadType.toString(10)})),h.attributes.payloads=p.audioCodecs,h.attributes.extmaps=p.audioExtensions,gN("PRELOAD_MEDIA_COUNT")>0)){var m=b$([{ssrcId:2e4}],this.cname),E=m.ssrcs,_=m.ssrcGroups;h.attributes.ssrcs=E,h.attributes.ssrcGroups=_}}}catch(e){f.e(e)}finally{f.f()}this.sessionDesc=d,this.currentMidIndex=d.mediaDescriptions.length-1}return F(e,[{key:"localCapabilities",get:function(){return uK(this._localCapabilities)}},{key:"rtpCapabilities",get:function(){return uK(this._rtpCapabilities)}},{key:"candidates",get:function(){return uK(this._candidates)}},{key:"iceParameters",get:function(){return uK(this._iceParameters)}},{key:"dtlsParameters",get:function(){return uK(this._dtlsParameters)}},{key:"preloadRemoteMedia",value:function(){var e=gN("PRELOAD_MEDIA_COUNT");ZD("debug",this,"preloadRemoteMedia",e),this.rtpCapabilities;for(var t=this.candidates,r=this.dtlsParameters,n=this.iceParameters,i=this.rtpCapabilities.send,o=1;o<e;o++){var a=2*o+s1,s=b$([{ssrcId:2*o+2e4}],this.cname),c=s.ssrcs,u=s.ssrcGroups,d=b$([{ssrcId:a,rtx:gN("USE_RTX")?a+1:void 0}],this.cname),l=d.ssrcs,p=d.ssrcGroups;this.sessionDesc.mediaDescriptions.push({media:{mediaType:"video",port:a1,protos:["UDP","TLS","RTP","SAVPF"],fmts:i.videoCodecs.map((function(e){return e.payloadType.toString(10)}))},connections:[{nettype:"IN",addrtype:"IP4",address:"127.0.0.1"}],bandwidths:[],attributes:{iceUfrag:n.iceUfrag,icePwd:n.icePwd,unrecognized:[],candidates:t,extmaps:i.videoExtensions,fingerprints:r.fingerprints,imageattr:[],msids:[],remoteCandidatesList:[],rids:[],ssrcs:l,ssrcGroups:p,rtcpFeedbackWildcards:[],payloads:i.videoCodecs,rtcp:{port:"9",netType:"IN",addressType:"IP4",address:"0.0.0.0"},setup:this.setup,direction:"sendonly",rtcpMux:!0,rtcpRsize:!0,mid:"".concat(2*o)}}),this.sessionDesc.mediaDescriptions.push({media:{mediaType:"audio",port:a1,protos:["UDP","TLS","RTP","SAVPF"],fmts:i.audioCodecs.map((function(e){return e.payloadType.toString(10)}))},connections:[{nettype:"IN",addrtype:"IP4",address:"127.0.0.1"}],bandwidths:[],attributes:{iceUfrag:n.iceUfrag,icePwd:n.icePwd,unrecognized:[],candidates:t,extmaps:i.audioExtensions,fingerprints:r.fingerprints,imageattr:[],msids:[],remoteCandidatesList:[],rids:[],ssrcs:c,ssrcGroups:u,rtcpFeedbackWildcards:[],payloads:i.audioCodecs,rtcp:{port:"9",netType:"IN",addressType:"IP4",address:"0.0.0.0"},setup:this.setup,direction:"sendonly",rtcpMux:!0,rtcpRsize:!0,mid:"".concat(2*o+1)}}),this.currentMidIndex+=2}this.updateBundleMids()}},{key:"toString",value:function(){return m$.exports.print(this.sessionDesc)}},{key:"send",value:function(e,t,r,n){var i=b$(t,this.cname,r),o=i.ssrcs,a=i.ssrcGroups,s=this.findPreloadMediaDesc(o);if(s){if(n&&(n.tcc||n.remb)){var c=this.sessionDesc.mediaDescriptions.indexOf(s);return this.sessionDesc.mediaDescriptions[c]=this.mungSendMediaDesc(s,n),{mid:s.attributes.mid,needExchangeSDP:!0}}return{mid:s.attributes.mid,needExchangeSDP:!1}}var u=this.findAvailableMediaIndex(e);if(Mk()){if(-1!==u&&1!==u){var d=uK(this.sessionDesc.mediaDescriptions[u]);return d.attributes.direction="sendonly",d.attributes.ssrcs=o,d.attributes.ssrcGroups=a,this.sessionDesc.mediaDescriptions[u]=this.mungSendMediaDesc(d,n),{mid:d.attributes.mid,needExchangeSDP:!0}}var l=this.createOrRecycleSendMedia(e,o,a,"sendonly",n);return this.updateBundleMids(),{mid:l.attributes.mid,needExchangeSDP:!0}}if(-1!==u){var p=uK(this.sessionDesc.mediaDescriptions[u]);return p.attributes.direction="sendonly",p.attributes.ssrcs=o,p.attributes.ssrcGroups=a,this.sessionDesc.mediaDescriptions[u]=this.mungSendMediaDesc(p,n),{mid:p.attributes.mid,needExchangeSDP:!0}}var f=this.createOrRecycleSendMedia(e,o,a,"sendonly",n);return this.updateBundleMids(),{mid:f.attributes.mid,needExchangeSDP:!0}}},{key:"batchSend",value:function(e){var t=this,r=e.map((function(e){var r=e.kind,n=e.ssrcMsg,i=e.mslabel;return t.send(r,n,i)})),n=[],i=!1;return r.forEach((function(e){var t=e.mid;e.needExchangeSDP&&(i=!0),n.push(t)})),{mids:n,needExchangeSDP:i}}},{key:"stopSending",value:function(e){var t=this.sessionDesc.mediaDescriptions.filter((function(t){return t.attributes.mid&&-1!==e.indexOf(t.attributes.mid)}));if(t.length!==e.length)throw new Error("mediaDescriptions' length doesn't match mids' length when calling RemoteSDP.stopSending.");t.forEach((function(e){"0"===e.attributes.mid||Uk()||Mk()?e.attributes.ssrcs=[]:(e.attributes.ssrcs=[],e.attributes.direction="inactive",e.media.port="0")})),this.updateBundleMids()}},{key:"mute",value:function(e){var t=this.sessionDesc.mediaDescriptions.find((function(t){return t.attributes.mid===e}));if(!t)throw new Error("mediaDescription not found with ".concat(e," in remote SDP when calling RemoteSDP.mute."));t.attributes.direction="inactive"}},{key:"unmute",value:function(e){var t=this.sessionDesc.mediaDescriptions.find((function(t){return t.attributes.mid===e}));if(!t)throw new Error("mediaDescription not found with ".concat(e," in remote SDP when calling RemoteSDP.unmute."));t.attributes.direction="sendonly"}},{key:"muteRemote",value:function(e){var t=this.sessionDesc.mediaDescriptions.filter((function(t){return e.includes(t.attributes.mid||"")}));if(t.length!==e.length)throw new Error("mediaDescriptions' length doesn't match mids' length when calling RemoteSDP.muteRemote.");t.forEach((function(e){e.attributes.direction="inactive"}))}},{key:"unmuteRemote",value:function(e){var t=this.sessionDesc.mediaDescriptions.filter((function(t){return e.includes(t.attributes.mid||"")}));if(t.length!==e.length)throw new Error("mediaDescriptions' length doesn't match mids' length when calling RemoteSDP.muteRemote.");t.forEach((function(e){e.attributes.direction="recvonly"}))}},{key:"receive",value:function(e,t,r,n){var i=this;e.forEach((function(e,o){i.createOrRecycleRecvMedia(e,[],"recvonly",t,r,n[o])})),this.updateBundleMids()}},{key:"stopReceiving",value:function(e){var t=this.sessionDesc.mediaDescriptions.filter((function(t){return-1!==e.indexOf(t.attributes.mid)}));if(t.length!==e.length)throw new Error("MediaDescriptions' length doesn't match mids's length when calling RemoteSDP.receive.");t.forEach((function(e){e.media.port="0",e.attributes.direction="inactive"})),this.updateBundleMids()}},{key:"restartICE",value:function(e,t){var r=this;e=uK(e),t=uK(t),this._iceParameters=e,this._candidates=t,this.sessionDesc.mediaDescriptions.forEach((function(t){t.attributes.iceUfrag=e.iceUfrag,t.attributes.icePwd=e.icePwd,t.attributes.candidates=r.candidates}))}},{key:"predictReceivingMids",value:function(e){for(var t=[],r=0;r<e;r++)t.push((this.currentMidIndex+r+1).toString(10));return t}},{key:"findAvailableMediaIndex",value:function(e){return this.sessionDesc.mediaDescriptions.findIndex((function(t){return t.media.mediaType===e&&"0"!==t.media.port&&("sendonly"===t.attributes.direction||"sendrecv"===t.attributes.direction)&&0===t.attributes.ssrcs.length}))}},{key:"createOrRecycleRecvMedia",value:function(e,t,r,n,i,o){var a=e._mediaStreamTrack.kind,s=this.rtpCapabilities.recv,c=this.localCapabilities.send,u=[];if(a===YP.VIDEO){var d,l;if(gN("H264_PROFILE_LEVEL_ID")&&"h264"===n&&(u=s.videoCodecs.filter((function(e){var t,r;return((null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())||"").includes(n)&&(null==e||null===(r=e.fmtp)||void 0===r?void 0:r.parameters["profile-level-id"])===gN("H264_PROFILE_LEVEL_ID")}))),!u||0===(null===(d=u)||void 0===d?void 0:d.length)){var p=c.videoCodecs.filter((function(e){var t;return((null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())||"").includes(n)}));0!==p.length&&(u=s.videoCodecs.filter((function(e){return p.some((function(t){return t.payloadType===e.payloadType}))})))}if(gN("USE_RTX")){var f=u.map((function(e){return e.payloadType.toString()})),h=s.videoCodecs.filter((function(e){var t,r;return"rtx"===(null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName)&&f.includes((null===(r=e.fmtp)||void 0===r?void 0:r.parameters.apt)||"")}));u=[].concat(M(u),M(h))}0===u.length&&(ND.warning("codec ".concat(n," not included in rtpCapabilities, fallback to default payloads: ").concat(null===(l=s.videoCodecs[0].rtpMap)||void 0===l?void 0:l.encodingName)),u=s.videoCodecs)}else u=s.audioCodecs.filter((function(e){var t;return((null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())||"").includes(i)})),0===u.length&&(ND.warning("codec ".concat(i," not included in rtpCapabilities, fallback to opus")),u=s.audioCodecs.filter((function(e){var t;return((null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())||"").includes("opus")})));var A=a===YP.VIDEO?s.videoExtensions:s.audioExtensions;this.currentMidIndex+=1;var v="".concat(this.currentMidIndex),g={media:{mediaType:a,port:a1,protos:["UDP","TLS","RTP","SAVPF"],fmts:u.map((function(e){return e.payloadType.toString(10)}))},connections:[{nettype:"IN",addrtype:"IP4",address:"127.0.0.1"}],bandwidths:[],attributes:{iceUfrag:this.iceParameters.iceUfrag,icePwd:this.iceParameters.icePwd,unrecognized:[],candidates:this.candidates,extmaps:A,fingerprints:this.dtlsParameters.fingerprints,imageattr:[],msids:[],remoteCandidatesList:[],rids:[],ssrcs:t,ssrcGroups:[],rtcpFeedbackWildcards:[],payloads:u,rtcp:{port:"9",netType:"IN",addressType:"IP4",address:"0.0.0.0"},setup:this.setup,direction:r,rtcpMux:!0,rtcpRsize:!0,mid:"".concat(v)}};g=this.mungRecvMediaDsec(g,e,o);var m=this.findFirstClosedMedia(a);if(m){var E=this.sessionDesc.mediaDescriptions.indexOf(m);this.sessionDesc.mediaDescriptions[E]=g}else this.sessionDesc.mediaDescriptions.push(g);return g}},{key:"createOrRecycleSendMedia",value:function(e,t,r,n,i){var o=this.rtpCapabilities.send,a=e===YP.VIDEO?o.videoCodecs:o.audioCodecs,s=e===YP.VIDEO?o.videoExtensions:o.audioExtensions;this.currentMidIndex+=1;var c="".concat(this.currentMidIndex),u={media:{mediaType:e,port:a1,protos:["UDP","TLS","RTP","SAVPF"],fmts:a.map((function(e){return e.payloadType.toString(10)}))},connections:[{nettype:"IN",addrtype:"IP4",address:"127.0.0.1"}],bandwidths:[],attributes:{iceUfrag:this.iceParameters.iceUfrag,icePwd:this.iceParameters.icePwd,unrecognized:[],candidates:this.candidates,extmaps:s,fingerprints:this.dtlsParameters.fingerprints,imageattr:[],msids:[],remoteCandidatesList:[],rids:[],ssrcs:t,ssrcGroups:r,rtcpFeedbackWildcards:[],payloads:a,rtcp:{port:"9",netType:"IN",addressType:"IP4",address:"0.0.0.0"},setup:this.setup,direction:n,rtcpMux:!0,rtcpRsize:!0,mid:"".concat(c)}};u=this.mungSendMediaDesc(u,i);var d=this.findFirstClosedMedia(e);if(d){var l=this.sessionDesc.mediaDescriptions.indexOf(d);this.sessionDesc.mediaDescriptions[l]=u}else this.sessionDesc.mediaDescriptions.push(u);return u}},{key:"updateBundleMids",value:function(){this.sessionDesc.attributes.groups[0].identificationTag=this.sessionDesc.mediaDescriptions.filter((function(e){return"0"!==e.media.port})).map((function(e){return e.attributes.mid}))}},{key:"mungRecvMediaDsec",value:function(e,t,r){var n=uK(e);return w$(n),C$(n,t),R$(n,t),function(e){if("video"===e.media.mediaType){var t=Tk();if(t.name===Sk.SAFARI||t.os===Ik.IOS){var r=e.attributes.extmaps.findIndex((function(e){return/video-orientation/g.test(e.extensionName)}));-1!==r&&e.attributes.extmaps.splice(r,1)}}}(n),T$(n,r,this.localCapabilities.send),n}},{key:"mungSendMediaDesc",value:function(e,t){var r=uK(e);return T$(r,t,this.localCapabilities.recv),r}},{key:"updateRecvMedia",value:function(e,t){var r=this.sessionDesc.mediaDescriptions.findIndex((function(t){return t.attributes.mid===e}));if(-1!==r){var n=this.mungRecvMediaDsec(this.sessionDesc.mediaDescriptions[r],t);this.sessionDesc.mediaDescriptions[r]=n}}},{key:"bumpMid",value:function(e){this.currentMidIndex+=e}},{key:"findFirstClosedMedia",value:function(e){return this.sessionDesc.mediaDescriptions.find((function(t){return Uk()?"0"===t.media.port&&t.media.mediaType===e:"0"===t.media.port}))}},{key:"findPreloadMediaDesc",value:function(e){return this.sessionDesc.mediaDescriptions.find((function(t){var r,n;return(null===(r=t.attributes)||void 0===r||null===(n=r.ssrcs[0])||void 0===n?void 0:n.ssrcId)===e[0].ssrcId}))}}]),e}())||t1;function u1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function d1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?u1(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):u1(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var l1,p1,f1=tN("P2PConnection","store.p2pId")((Ej((o1=function(e){k(r,e);var t=W(r);function r(e,n){var i;return U(this,r),i=t.call(this,e,n),rO(S(i),"store",void 0),rO(S(i),"peerConnection",void 0),rO(S(i),"remoteSDP",void 0),rO(S(i),"initialOffer",void 0),rO(S(i),"transportEventReceiver",void 0),rO(S(i),"statsFilter",void 0),rO(S(i),"useRTX",gN("USE_RTX")),rO(S(i),"localCapabilities",void 0),rO(S(i),"localCandidateCount",0),rO(S(i),"allCandidatesReceived",!1),rO(S(i),"mutex",new rV("P2PConnection-mutex")),i.store=n,i.peerConnection=new RTCPeerConnection(r.resolvePCConfiguration(e),{optional:[{googDscp:!0}]}),i.statsFilter=Z$(i.peerConnection,void 0,void 0,Uk()?1200:void 0),i.bindPCEvents(),i.bindStatsEvents(),i.store.p2pId=i.store.p2pId+1,i}return F(r,[{key:"currentLocalDescription",get:function(){return this.peerConnection.currentLocalDescription}},{key:"currentRemoteDescription",get:function(){return this.peerConnection.currentRemoteDescription}},{key:"peerConnectionState",get:function(){return this.peerConnection.connectionState}},{key:"iceConnectionState",get:function(){return this.peerConnection.iceConnectionState}},{key:"establish",value:function(){var e=y(G.mark((function e(){var t,r,n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.peerConnection.addTransceiver("video",{direction:"recvonly"}),this.peerConnection.addTransceiver("audio",{direction:"recvonly"}),e.next=4,this.peerConnection.createOffer();case 4:if((t=e.sent).sdp){e.next=7;break}throw new Error("Cannot get initialOffer.sdp when trying to establish PeerConnection.");case 7:return r=I$(t.sdp),e.next=10,function(){var e=y(G.mark((function e(t,r,n,i){var o,a,s,c,u,d,l,p,f,h;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(o=new RTCPeerConnection).addTransceiver("video",{direction:"sendonly"}),o.addTransceiver("audio",{direction:"sendonly"}),o.addTransceiver("video",{direction:"recvonly"}),o.addTransceiver("audio",{direction:"recvonly"}),e.next=4,o.createOffer();case 4:a=e.sent.sdp,s=y$(a,t,r,n,i,"sendonly"),c=y$(a,t,r,n,i,"recvonly"),k$(s,c,"videoExtensions",u={audioCodecs:[],audioExtensions:[],videoCodecs:[],videoExtensions:[]},d={audioCodecs:[],audioExtensions:[],videoCodecs:[],videoExtensions:[]},l={audioCodecs:[],audioExtensions:[],videoCodecs:[],videoExtensions:[]}),k$(s,c,"videoCodecs",u,d,l),k$(s,c,"audioExtensions",u,d,l),k$(s,c,"audioCodecs",u,d,l),gN("RAISE_H264_BASELINE_PRIORITY")&&(p=l.videoCodecs.findIndex((function(e){var t,r;return"h264"===(null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLocaleLowerCase())&&"42001f"===(null===(r=e.fmtp)||void 0===r?void 0:r.parameters["profile-level-id"])})),-1!==p&&(f=l.videoCodecs.findIndex((function(e){var t;return"h264"===(null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLocaleLowerCase())})),f<p&&(ND.debug("raising H264 baseline profile priority"),h=l.videoCodecs[p],l.videoCodecs.splice(p,1),l.videoCodecs.splice(f,0,h)),-1!==f&&(d.videoCodecs=d.videoCodecs.filter((function(e){var t,r;return!("h264"===(null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLocaleLowerCase())&&"42001f"!==(null===(r=e.fmtp)||void 0===r?void 0:r.parameters["profile-level-id"]))}))),-1!==f&&gN("FILTER_SEND_H264_BASELINE")&&(u.videoCodecs=u.videoCodecs.filter((function(e){var t,r;return!("h264"===(null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLocaleLowerCase())&&"42001f"!==(null===(r=e.fmtp)||void 0===r?void 0:r.parameters["profile-level-id"]))})))));try{o.close()}catch(e){}return e.abrupt("return",{send:u,recv:d,sendrecv:l});case 13:case"end":return e.stop()}}),e)})));return function(t,r,n,i){return e.apply(this,arguments)}}()(!this.useRTX,!1);case 10:return n=e.sent,e.abrupt("return",(this.localCapabilities=O$(n),this.initialOffer=t,d1(d1({},r),{},{rtpCapabilities:n,offerSDP:t.sdp})));case 14:throw e.prev=14,e.t0=e.catch(0),new SD(mD.GET_LOCAL_CONNECTION_PARAMS_FAILED,e.t0.toString());case 17:case"end":return e.stop()}}),e,this,[[0,14]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"connect",value:function(){var e=y(G.mark((function e(t,r,n,i,o,a){var s,c,u,d,l;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.initialOffer){e.next=3;break}throw new Error("Cannot establish P2PConnection without initial offer.");case 3:return this.remoteSDP=new c1({remoteIceParameters:t,remoteDtlsParameters:r,candidates:n,remoteRTPCapabilities:i,remoteSetup:o,localCapabilities:this.localCapabilities,cname:a}),s=this.remoteSDP.toString(),c=this.logSDPExchange(this.initialOffer.sdp||"","offer","local","connect"),e.next=7,this.peerConnection.setLocalDescription(this.initialOffer);case 7:return null==c||c(s),e.next=10,this.peerConnection.setRemoteDescription({type:"answer",sdp:s});case 10:if(null!=(u=this.peerConnection.getTransceivers()[0])&&u.receiver&&this.tryBindTransportEvents(u.receiver),!(gN("PRELOAD_MEDIA_COUNT")>0)){e.next=21;break}return this.remoteSDP.preloadRemoteMedia(),d=this.remoteSDP.toString(),e.next=16,this.peerConnection.setRemoteDescription({type:"offer",sdp:d});case 16:return e.next=18,this.peerConnection.createAnswer();case 18:return l=e.sent,e.next=21,this.peerConnection.setLocalDescription(l);case 21:e.next=26;break;case 23:throw e.prev=23,e.t0=e.catch(0),new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection.connect failed; ".concat(e.t0.toString()));case 26:case"end":return e.stop()}}),e,this,[[0,23]])})));function t(t,r,n,i,o,a){return e.apply(this,arguments)}return t}()},{key:"send",value:function(e,t,r){var n=this;return YZ(G.mark((function i(){var o,a,s,c,u,d,l,p,f,h,A;return G.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,qZ(n.mutex.lock());case 2:if(o=i.sent,i.prev=3,n.remoteSDP){i.next=6;break}throw new Error("Cannot call P2PConnection.send before remote SDP created");case 6:if(a=[],e.forEach((function(e){var t=n.peerConnection.addTransceiver(e._mediaStreamTrack,{direction:"sendonly"});a.push(t)})),i.t0=Uk()&&!0===gN("SIMULCAST"),!i.t0){i.next=13;break}return qD("debug",n,"apply simulcast for firefox"),i.next=13,qZ(n.applySimulcastForFirefox(a,e));case 13:return i.next=15,qZ(n.peerConnection.createOffer());case 15:return s=i.sent,c=n.remoteSDP.predictReceivingMids(e.length),u=n.mungSendOfferSDP(s.sdp,e,c),d=m$.exports.parse(u),l=c.map((function(e){var t=d.mediaDescriptions.find((function(t){return t.attributes.mid===e}));if(!t)throw new Error("Cannot extract ssrc from mediaDescription.");return function(e,t){var r=[],n=e.attributes.ssrcGroups.filter((function(e){return"FID"===e.semantic})),i=e.attributes.ssrcGroups.find((function(e){return"SIM"===e.semantic})),o=e.attributes.ssrcs;if(i)i.ssrcIds.forEach((function(e){var i,o=null===(i=n.find((function(t){return t.ssrcIds[0]===e})))||void 0===i?void 0:i.ssrcIds[1];r.push({ssrcId:e,rtx:t?o:void 0})}));else if(n.length>0){var a=n[0].ssrcIds[0],s=n[0].ssrcIds[1];r.push({ssrcId:a,rtx:t?s:void 0})}else{if(0===o.length)throw new Error("No ssrcs found on local media description.");r.push({ssrcId:o[0].ssrcId})}return r}(t,n.useRTX)})),i.prev=20,i.next=23,l;case 23:p=i.sent,i.next=37;break;case 26:return i.prev=26,i.t1=i.catch(20),p=[],n.remoteSDP.receive(e,t,r,p),f=n.remoteSDP.toString(),i.next=32,qZ(n.peerConnection.setLocalDescription({type:"offer",sdp:u}));case 32:return i.next=34,qZ(n.peerConnection.setRemoteDescription({type:"answer",sdp:f}));case 34:return i.next=36,qZ(n.stopSending(c,!0));case 36:throw i.t1;case 37:return n.remoteSDP.receive(e,t,r,p),h=n.remoteSDP.toString(),A=n.logSDPExchange(u,"offer","local","send"),i.next=41,qZ(n.peerConnection.setLocalDescription({type:"offer",sdp:u}));case 41:return i.next=43,qZ(n.applySimulcastEncodings(a,e));case 43:return i.next=45,qZ(n.applySendEncodings(a,e));case 45:return null==A||A(h),i.next=48,qZ(n.peerConnection.setRemoteDescription({type:"answer",sdp:h}));case 48:return i.abrupt("return",a.map((function(e,t){var r=c[t];return{localSSRC:l[t],id:r,transceiver:e}})));case 51:throw i.prev=51,i.t2=i.catch(3),i.t2 instanceof SD?i.t2:new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection.send failed; ".concat(i.t2.toString()));case 54:return i.prev=54,o(),i.finish(54);case 57:case"end":return i.stop()}}),i,null,[[3,51,54,57],[20,26]])})))()}},{key:"stopSending",value:function(){var e=y(G.mark((function e(t,r){var n,i,o,a,s;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!r){e.next=4;break}e.t0=void 0,e.next=7;break;case 4:return e.next=6,this.mutex.lock("From P2PConnection.stopSending");case 6:e.t0=e.sent;case 7:if(n=e.t0,e.prev=8,this.remoteSDP){e.next=11;break}throw new Error("Cannot call P2PConnection.stopSending before remote SDP created");case 11:if(i=this.peerConnection.getTransceivers().filter((function(e){return-1!==t.indexOf(e.mid)})),i.length===t.length){e.next=14;break}throw new Error("Transceivers' length doesn't match mids' length when trying to call P2PConnection.stopSending.");case 14:return i.map((function(e){var t;e.direction="inactive",null===(t=e.stop)||void 0===t||t.call(e)})),e.next=17,this.peerConnection.createOffer();case 17:return o=e.sent,a=this.logSDPExchange(o.sdp||"","offer","local","stopSending"),e.next=21,this.peerConnection.setLocalDescription(o);case 21:return this.remoteSDP.stopReceiving(t),s=this.remoteSDP.toString(),null==a||a(s),e.next=26,this.peerConnection.setRemoteDescription({type:"answer",sdp:s});case 26:e.next=31;break;case 28:throw e.prev=28,e.t1=e.catch(8),new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection.stopSending failed; ".concat(e.t1.toString()));case 31:return e.prev=31,n&&n(),e.finish(31);case 34:case"end":return e.stop()}}),e,this,[[8,28,31,34]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"receive",value:function(){var e=y(G.mark((function e(t,r,n,i){var o,a,s,c,u,d;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.remoteSDP){e.next=3;break}throw new Error("Cannot call P2PConnection.receive ".concat(t," before remoteSDP created."));case 3:if(o=this.remoteSDP.send(t,r,n,i),a=o.mid,!o.needExchangeSDP){e.next=17;break}return s=this.remoteSDP.toString(),c=this.logSDPExchange(s,"offer","remote","receive"),e.next=8,this.peerConnection.setRemoteDescription({type:"offer",sdp:s});case 8:return e.next=10,this.peerConnection.createAnswer();case 10:return u=e.sent,null==c||c(u.sdp||""),e.next=14,this.peerConnection.setLocalDescription(u);case 14:ND.debug("[P2PConnection] receive ".concat(t," by exchanging SDP.")),e.next=18;break;case 17:ND.debug("[P2PConnection] receive ".concat(t," no need to exchange SDP."));case 18:if(d=this.peerConnection.getTransceivers().find((function(e){return e.mid===a}))){e.next=21;break}throw new Error("Cannot get transceiver after setLocalDescription.");case 21:return e.abrupt("return",{track:d.receiver.track,id:a});case 24:throw e.prev=24,e.t0=e.catch(0),new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection.receive failed; ".concat(e.t0.toString()));case 27:case"end":return e.stop()}}),e,this,[[0,24]])})));function t(t,r,n,i){return e.apply(this,arguments)}return t}()},{key:"batchReceive",value:function(){var e=y(G.mark((function e(t){var r,n,i,o,a,s=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.remoteSDP){e.next=3;break}throw new Error("Cannot call P2PConnection.batchReceive before remoteSDP created.");case 3:if(r=this.remoteSDP.batchSend(t),n=r.mids,!r.needExchangeSDP){e.next=17;break}return i=this.remoteSDP.toString(),o=this.logSDPExchange(i,"offer","remote","receive"),e.next=8,this.peerConnection.setRemoteDescription({type:"offer",sdp:i});case 8:return e.next=10,this.peerConnection.createAnswer();case 10:return a=e.sent,null==o||o(a.sdp||""),e.next=14,this.peerConnection.setLocalDescription(a);case 14:ND.debug("[P2PConnection] batchReceive by exchanging SDP."),e.next=18;break;case 17:ND.debug("[P2PConnection] batchReceive no need to exchange SDP.");case 18:return e.abrupt("return",n.map((function(e){var t=s.peerConnection.getTransceivers().find((function(t){return t.mid===e}));if(!t)throw new Error("Cannot get transceiver after setLocalDescription.");return{track:t.receiver.track,id:e}})));case 21:throw e.prev=21,e.t0=e.catch(0),new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection.receive failed; ".concat(e.t0.toString()));case 24:case"end":return e.stop()}}),e,this,[[0,21]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"stopReceiving",value:function(){var e=y(G.mark((function e(t){var r,n,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.remoteSDP){e.next=3;break}throw new Error("Cannot call P2PConnection.stopReceiving before remote SDP created.");case 3:return this.remoteSDP.stopSending(t),r=this.remoteSDP.toString(),n=this.logSDPExchange(r,"offer","remote","stopReceiving"),e.next=7,this.peerConnection.setRemoteDescription({type:"offer",sdp:r});case 7:return e.next=9,this.peerConnection.createAnswer();case 9:return i=e.sent,null==n||n(i.sdp||""),e.next=13,this.peerConnection.setLocalDescription(i);case 13:e.next=18;break;case 15:throw e.prev=15,e.t0=e.catch(0),new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection stopReceiving failed; ".concat(e.t0.toString()));case 18:case"end":return e.stop()}}),e,this,[[0,15]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"muteRemote",value:function(){var e=y(G.mark((function e(t){var r,n,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.remoteSDP){e.next=3;break}throw new Error("Cannot call P2PConnection.muteRemote mid=".concat(t," before remote SDP created."));case 3:return this.remoteSDP.mute(t),r=this.remoteSDP.toString(),n=this.logSDPExchange(r,"offer","remote","muteRemote"),e.next=7,this.peerConnection.setRemoteDescription({type:"offer",sdp:r});case 7:return e.next=9,this.peerConnection.createAnswer();case 9:return i=e.sent,null==n||n(i.sdp||""),e.next=13,this.peerConnection.setLocalDescription(i);case 13:e.next=18;break;case 15:throw e.prev=15,e.t0=e.catch(0),new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection.muteRemote failed; ".concat(e.t0.toString()));case 18:case"end":return e.stop()}}),e,this,[[0,15]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"unmuteRemote",value:function(){var e=y(G.mark((function e(t){var r,n,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.remoteSDP){e.next=3;break}throw new Error("Cannot call P2PConnection.unmuteRemote mid=".concat(t," before remote SDP created."));case 3:return this.remoteSDP.unmute(t),r=this.remoteSDP.toString(),n=this.logSDPExchange(r,"offer","remote","unmuteRemote"),e.next=7,this.peerConnection.setRemoteDescription({type:"offer",sdp:r});case 7:return e.next=9,this.peerConnection.createAnswer();case 9:return i=e.sent,null==n||n(i.sdp||""),e.next=13,this.peerConnection.setLocalDescription(i);case 13:e.next=18;break;case 15:throw e.prev=15,e.t0=e.catch(0),new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection.unmuteRemote failed; ".concat(e.t0.toString()));case 18:case"end":return e.stop()}}),e,this,[[0,15]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"muteLocal",value:function(){var e=y(G.mark((function e(t){var r,n,i,o;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.remoteSDP){e.next=3;break}throw new Error("Cannot call P2PConnection.muteLocal before remote SDP created.");case 3:if((r=this.peerConnection.getTransceivers().filter((function(e){return e.mid&&-1!==t.indexOf(e.mid)}))).length===t.length){e.next=6;break}throw new Error("Transceivers' length doesn't match mids' length.");case 6:return r.map((function(e){e.direction="inactive"})),e.next=9,this.peerConnection.createOffer();case 9:return n=e.sent,i=this.logSDPExchange(n.sdp||"","offer","local","muteLocal"),e.next=13,this.peerConnection.setLocalDescription(n);case 13:return this.remoteSDP.muteRemote(t),o=this.remoteSDP.toString(),null==i||i(o),e.next=18,this.peerConnection.setRemoteDescription({type:"answer",sdp:o});case 18:e.next=23;break;case 20:throw e.prev=20,e.t0=e.catch(0),new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection.muteLocal failed; ".concat(e.t0.toString()));case 23:case"end":return e.stop()}}),e,this,[[0,20]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"unmuteLocal",value:function(){var e=y(G.mark((function e(t){var r,n,i,o;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.remoteSDP){e.next=3;break}throw new Error("Cannot call P2PConnection.unmuteLocal before remote SDP created.");case 3:if((r=this.peerConnection.getTransceivers().filter((function(e){return e.mid&&-1!==t.indexOf(e.mid)}))).length===t.length){e.next=6;break}throw new Error("Transceivers' length doesn't match mids' length.");case 6:return r.map(function(){var e=y(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t.direction="sendonly";case 1:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}()),e.next=9,this.peerConnection.createOffer();case 9:return n=e.sent,i=this.logSDPExchange(n.sdp||"","offer","local","unmuteLocal"),e.next=13,this.peerConnection.setLocalDescription(n);case 13:return this.remoteSDP.unmuteRemote(t),o=this.remoteSDP.toString(),null==i||i(o),e.next=18,this.peerConnection.setRemoteDescription({type:"answer",sdp:o});case 18:e.next=23;break;case 20:throw e.prev=20,e.t0=e.catch(0),new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection.unmuteLocal failed; ".concat(e.t0.toString()));case 23:case"end":return e.stop()}}),e,this,[[0,20]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"reEstablish",value:function(){var e=y(G.mark((function e(){var t,r=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.peerConnection.createOffer({iceRestart:!0});case 2:if((t=e.sent).sdp){e.next=5;break}throw new Error("Cannot get SDP from restart offer.");case 5:return e.abrupt("return",{iceParameters:I$(t.sdp).iceParameters,restartICE:function(){var e=y(G.mark((function e(n,i){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",r.restartICE(t,n,i));case 1:case"end":return e.stop()}}),e)})));function n(t,r){return e.apply(this,arguments)}return n}(),restartOfferSDP:t.sdp});case 6:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"close",value:function(){var e;this.peerConnection.close(),null===(e=this.onConnectionStateChange)||void 0===e||e.call(this,"closed"),this.tryUnbindTransportEvents(),this.unbindPCEvents(),this.unbindStatsEvents(),this.removeAllListeners(),this.transportEventReceiver=void 0,this.statsFilter.destroy()}},{key:"getStats",value:function(){return this.statsFilter.getStats()}},{key:"getRemoteVideoIsReady",value:function(e){return this.statsFilter.getVideoIsReady(e)}},{key:"updateEncoderConfig",value:function(){var e=y(G.mark((function e(t,r){var n,i,o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.remoteSDP){e.next=3;break}throw new Error("Cannot call P2PConnection.updateEncoderConfig before remote SDP created.");case 3:return e.next=5,this.peerConnection.createOffer();case 5:return n=e.sent,i=this.mungSendOfferSDP(n.sdp,[r],[t]),this.remoteSDP.updateRecvMedia(t,r),o=this.remoteSDP.toString(),a=this.logSDPExchange(i,"offer","local","updateEncoderConfig"),e.next=11,this.peerConnection.setLocalDescription({type:"offer",sdp:i});case 11:return null==a||a(o),e.next=14,this.peerConnection.setRemoteDescription({type:"answer",sdp:o});case 14:e.next=19;break;case 16:throw e.prev=16,e.t0=e.catch(0),new SD(mD.EXCHANGE_SDP_FAILED,e.t0.toString());case 19:case"end":return e.stop()}}),e,this,[[0,16]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"updateSendParameters",value:function(){var e=y(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.peerConnection.getTransceivers().filter((function(e){return e.mid===t})),e.t0=1===n.length,!e.t0){e.next=12;break}if(!this.isVP8Simulcast(r)){e.next=10;break}if(e.t1=Uk(),e.t1){e.next=8;break}return e.next=8,this.applySimulcastEncodings(n,[r]);case 8:e.next=12;break;case 10:return e.next=12,this.applySendEncodings(n,[r]);case 12:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"setStatsRemoteVideoIsReady",value:function(e,t){this.statsFilter.setVideoIsReady2(e,t)}},{key:"replaceTrack",value:function(){var e=y(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.peerConnection.getTransceivers().find((function(e){return e.mid===r})),e.t0=n,!e.t0){e.next=5;break}return e.next=5,n.sender.replaceTrack(t._mediaStreamTrack);case 5:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"restartICE",value:function(){var e=y(G.mark((function e(t,r,n){var i,o;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,this.remoteSDP){e.next=3;break}throw new Error("Cannot restartICE before remoteSDP created.");case 3:return this.remoteSDP.restartICE(r,n),i=this.remoteSDP.toString(),o=this.logSDPExchange(t.sdp||"","offer","local","restartICE"),e.next=7,this.peerConnection.setLocalDescription(t);case 7:return null==o||o(i),e.next=10,this.peerConnection.setRemoteDescription({type:"answer",sdp:i});case 10:e.next=15;break;case 12:throw e.prev=12,e.t0=e.catch(0),new SD(mD.EXCHANGE_SDP_FAILED,"P2PConnection.restartICE failed; ".concat(e.t0.toString()));case 15:case"end":return e.stop()}}),e,this,[[0,12]])})));function t(t,r,n){return e.apply(this,arguments)}return t}()},{key:"bindPCEvents",value:function(){var e=this;this.peerConnection.oniceconnectionstatechange=function(){var t;null===(t=e.onICEConnectionStateChange)||void 0===t||t.call(e,e.peerConnection.iceConnectionState)},this.peerConnection.onconnectionstatechange=function(){var t;null===(t=e.onConnectionStateChange)||void 0===t||t.call(e,e.peerConnection.connectionState)},this.peerConnection.onicecandidate=function(t){t.candidate?e.localCandidateCount+=1:(e.peerConnection.onicecandidate=null,e.allCandidatesReceived=!0,ND.debug("[pc-".concat(e.store.p2pId,"] local candidate count"),e.localCandidateCount))},setTimeout((function(){e.allCandidatesReceived||(e.allCandidatesReceived=!0,ND.debug("[pc-".concat(e.store.p2pId,"] onicecandidate timeout, local candidate count"),e.localCandidateCount))}),gN("CANDIDATE_TIMEOUT"))}},{key:"unbindPCEvents",value:function(){this.peerConnection.oniceconnectionstatechange=null,this.peerConnection.onconnectionstatechange=null,this.peerConnection.onsignalingstatechange=null,this.peerConnection.onicecandidateerror=null,this.peerConnection.onicecandidate=null,this.peerConnection.ontrack=null}},{key:"tryBindTransportEvents",value:function(e){var t=this;e.transport&&(this.transportEventReceiver=e,e.transport.onstatechange=function(){var r,n;null!==(r=e.transport)&&void 0!==r&&r.state&&(null===(n=t.onDTLSTransportStateChange)||void 0===n||n.call(t,e.transport.state))},e.transport.onerror=function(e){var r;null===(r=t.onDTLSTransportError)||void 0===r||r.call(t,e.error)},e.transport.iceTransport&&(e.transport.iceTransport.onstatechange=function(){var r,n,i;null!==(r=e.transport)&&void 0!==r&&r.iceTransport.state&&(null===(n=t.onICETransportStateChange)||void 0===n||n.call(t,null===(i=e.transport)||void 0===i?void 0:i.iceTransport.state))}))}},{key:"tryUnbindTransportEvents",value:function(){this.transportEventReceiver&&this.transportEventReceiver.transport&&(this.transportEventReceiver.transport.onstatechange=null,this.transportEventReceiver.transport.onerror=null,this.transportEventReceiver.transport.iceTransport&&(this.transportEventReceiver.transport.iceTransport.onstatechange=null))}},{key:"applySendEncodings",value:function(){var e=y(G.mark((function e(t,r){var n,i,o,a,s,c,u,d,l,p,f,h,A,v;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,oL().supportSetRtpSenderParameters){e.next=3;break}return e.abrupt("return");case 3:if(t.length===r.length){e.next=5;break}return e.abrupt("return");case 5:n=0;case 6:if(!(n<t.length)){e.next=32;break}if(i=t[n],!((o=r[n])&&o instanceof Mz)){e.next=29;break}if(!this.isVP8Simulcast(o)){e.next=11;break}return e.abrupt("continue",29);case 11:c={},u={},e.t0=o._optimizationMode,e.next="motion"===e.t0?15:"detail"===e.t0?17:19;break;case 15:return c.degradationPreference="maintain-framerate",e.abrupt("break",20);case 17:return c.degradationPreference="maintain-resolution",e.abrupt("break",20);case 19:c.degradationPreference="balanced";case 20:return null!==(a=o._encoderConfig)&&void 0!==a&&a.bitrateMax&&(u.maxBitrate=1e3*(null===(d=o._encoderConfig)||void 0===d?void 0:d.bitrateMax)),o._hints.includes(xP.LOW_STREAM)&&(null!==(l=o._encoderConfig)&&void 0!==l&&l.frameRate&&(u.maxFramerate=MG(o._encoderConfig.frameRate)),null!==(p=o._encoderConfig)&&void 0!==p&&p.scaleResolutionDownBy&&(null===(f=o._encoderConfig)||void 0===f?void 0:f.scaleResolutionDownBy)>1&&(u.scaleResolutionDownBy=o._encoderConfig.scaleResolutionDownBy)),gN("DSCP_TYPE")&&Yk()&&(h=gN("DSCP_TYPE"),["very-low","low","medium","high"].includes(h)&&(u.networkPriority=h)),A=i.sender.getParameters(),v=null===(s=A.encodings)||void 0===s?void 0:s[0],Uk()&&!v&&(c.encodings=[u]),v&&Object.assign(v,u),Object.assign(A,c),e.next=29,i.sender.setParameters(A);case 29:n++,e.next=6;break;case 32:e.next=37;break;case 34:e.prev=34,e.t1=e.catch(0),ND.debug("Apply RTPSendEncodings failed.");case 37:case"end":return e.stop()}}),e,this,[[0,34]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"mungSendOfferSDP",value:function(e,t,r){var n=this,i=m$.exports.parse(e);return t.forEach((function(e,t){var o=r[t],a=i.mediaDescriptions.find((function(e){return e.attributes.mid===o}));a&&(C$(a,e),function(e,t,r){if(!Uk()&&"video"===e.media.mediaType&&t instanceof Mz&&("vp9"===r||"vp8"===r)&&("vp8"!==r||gN("SIMULCAST"))&&!(void 0===t._scalabiltyMode||t._scalabiltyMode.numSpatialLayers<=1)){for(var n="vp8"===r?2:t._scalabiltyMode.numSpatialLayers,i=e.attributes.ssrcs[0],o=e.attributes.ssrcGroups.find((function(e){return"FID"===e.semantic&&e.ssrcIds[0]===i.ssrcId})),a={semantic:"SIM",ssrcIds:[i.ssrcId]},s=1;s<n;s++)e.attributes.ssrcs.push({ssrcId:i.ssrcId+s,attributes:uK(i.attributes)}),a.ssrcIds.push(i.ssrcId+s),o&&(e.attributes.ssrcs.push({ssrcId:o.ssrcIds[1]+s,attributes:uK(i.attributes)}),e.attributes.ssrcGroups.push({semantic:"FID",ssrcIds:[i.ssrcId+s,o.ssrcIds[1]+s]}));e.attributes.ssrcGroups.unshift(a)}}(a,e,n.store.codec))})),m$.exports.print(i)}},{key:"bindStatsEvents",value:function(){var e=this;this.statsFilter.onFirstAudioReceived=function(t){var r;null===(r=e.onFirstAudioReceived)||void 0===r||r.call(e,t)},this.statsFilter.onFirstVideoReceived=function(t){var r;null===(r=e.onFirstVideoReceived)||void 0===r||r.call(e,t)},this.statsFilter.onFirstAudioDecoded=function(t){var r;null===(r=e.onFirstAudioDecoded)||void 0===r||r.call(e,t)},this.statsFilter.onFirstVideoDecoded=function(t,r,n){var i;null===(i=e.onFirstVideoDecoded)||void 0===i||i.call(e,t,r,n)},this.statsFilter.onSelectedLocalCandidateChanged=function(t,r){var n;null===(n=e.onSelectedLocalCandidateChanged)||void 0===n||n.call(e,t,r)},this.statsFilter.onSelectedRemoteCandidateChanged=function(t,r){var n;null===(n=e.onSelectedRemoteCandidateChanged)||void 0===n||n.call(e,t,r)}}},{key:"unbindStatsEvents",value:function(){this.statsFilter.onFirstAudioReceived=void 0,this.statsFilter.onFirstVideoReceived=void 0,this.statsFilter.onFirstAudioDecoded=void 0,this.statsFilter.onFirstVideoDecoded=void 0,this.statsFilter.onSelectedLocalCandidateChanged=void 0,this.statsFilter.onSelectedRemoteCandidateChanged=void 0}},{key:"applySimulcastForFirefox",value:function(){var e=y(G.mark((function e(t,r){var n,i,o,a,s,c,u,d,l,p;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.length!==r.length){e.next=13;break}n=0;case 2:if(!(n<t.length)){e.next=13;break}if(c=t[n],!((u=r[n])instanceof Mz&&!u._hints.includes(xP.LOW_STREAM)&&null!==(i=u._encoderConfig)&&void 0!==i&&i.bitrateMax&&(null===(o=u._encoderConfig)||void 0===o?void 0:o.bitrateMax)>200&&null!==(a=u._scalabiltyMode)&&void 0!==a&&a.numSpatialLayers&&(null===(s=u._scalabiltyMode)||void 0===s?void 0:s.numSpatialLayers)>1&&"vp8"===this.store.codec)){e.next=10;break}return d={},l={high:1e3*(u._encoderConfig.bitrateMax-50),medium:5e4},d.encodings=[{rid:"m",active:!0,maxBitrate:l.medium,scaleResolutionDownBy:4},{rid:"h",active:!0,maxBitrate:l.high}],p=c.sender.getParameters(),e.next=10,c.sender.setParameters(Object.assign(p,d));case 10:n++,e.next=2;break;case 13:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"applySimulcastEncodings",value:function(){var e=y(G.mark((function e(t,r){var n,i,o,a,s,c;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Uk()||t.length!==r.length){e.next=13;break}n=0;case 2:if(!(n<t.length)){e.next=13;break}if(!((i=r[n])instanceof Mz&&this.isVP8Simulcast(i))){e.next=10;break}return o=t[n],a={},s={high:1e3*(i._encoderConfig.bitrateMax-50),medium:5e4},a.encodings=[{active:!0,adaptivePtime:!1,networkPriority:"high",priority:"high",maxBitrate:s.high},{active:!0,adaptivePtime:!1,networkPriority:"low",priority:"low",maxBitrate:s.medium,scaleResolutionDownBy:4}],c=o.sender.getParameters(),e.next=10,o.sender.setParameters(Object.assign(c,a));case 10:n++,e.next=2;break;case 13:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"isVP8Simulcast",value:function(e){var t,r,n,i;return!!(e instanceof Mz&&gN("SIMULCAST")&&"vp8"===this.store.codec&&!e._hints.includes(xP.LOW_STREAM)&&null!==(t=e._encoderConfig)&&void 0!==t&&t.bitrateMax&&(null===(r=e._encoderConfig)||void 0===r?void 0:r.bitrateMax)>200&&null!==(n=e._scalabiltyMode)&&void 0!==n&&n.numSpatialLayers&&(null===(i=e._scalabiltyMode)||void 0===i?void 0:i.numSpatialLayers)>1)}},{key:"logSDPExchange",value:function(e,t,r,n){var i=this;if(gN("SDP_LOGGING"))return ND.upload("exchanging ".concat(r," ").concat(t," SDP during P2PConnection.").concat(n,"\n"),e),"offer"===t?function(e){i.logSDPExchange(e,"answer","local"===r?"remote":"local",n)}:void 0}}],[{key:"resolvePCConfiguration",value:function(e){var t,n,i={iceServers:[]};return e.iceServers?i.iceServers=e.iceServers:e.turnServer&&"off"!==e.turnServer.mode&&(sP(e.turnServer.servers)?i.iceServers=e.turnServer.servers:(i.iceServers&&(t=i.iceServers).push.apply(t,M(r.turnServerConfigToIceServers(e.turnServer.servers))),gN("USE_TURN_SERVER_OF_GATEWAY")&&i.iceServers&&e.turnServer.serversFromGateway&&(n=i.iceServers).push.apply(n,M(r.turnServerConfigToIceServers(e.turnServer.serversFromGateway))),e.turnServer.servers.concat(e.turnServer.serversFromGateway||[]).forEach((function(e){e.forceturn&&(i.iceTransportPolicy="relay")})))),i}},{key:"turnServerConfigToIceServers",value:function(e){var t=[];return e.forEach((function(e){e.security?e.tcpport&&t.push({username:e.username,credential:e.password,credentialType:"password",urls:"turns:".concat(LG(e.turnServerURL),":").concat(e.tcpport,"?transport=tcp")}):(e.udpport&&t.push({username:e.username,credential:e.password,credentialType:"password",urls:"turn:".concat(e.turnServerURL,":").concat(e.udpport,"?transport=udp")}),e.tcpport&&t.push({username:e.username,credential:e.password,credentialType:"password",urls:"turn:".concat(e.turnServerURL,":").concat(e.tcpport,"?transport=tcp")}))})),t}}]),r}(eL)).prototype,"connect",[h1],Object.getOwnPropertyDescriptor(o1.prototype,"connect"),o1.prototype),Ej(o1.prototype,"receive",[h1],Object.getOwnPropertyDescriptor(o1.prototype,"receive"),o1.prototype),Ej(o1.prototype,"batchReceive",[h1],Object.getOwnPropertyDescriptor(o1.prototype,"batchReceive"),o1.prototype),Ej(o1.prototype,"stopReceiving",[h1],Object.getOwnPropertyDescriptor(o1.prototype,"stopReceiving"),o1.prototype),Ej(o1.prototype,"muteRemote",[h1],Object.getOwnPropertyDescriptor(o1.prototype,"muteRemote"),o1.prototype),Ej(o1.prototype,"unmuteRemote",[h1],Object.getOwnPropertyDescriptor(o1.prototype,"unmuteRemote"),o1.prototype),Ej(o1.prototype,"muteLocal",[h1],Object.getOwnPropertyDescriptor(o1.prototype,"muteLocal"),o1.prototype),Ej(o1.prototype,"unmuteLocal",[h1],Object.getOwnPropertyDescriptor(o1.prototype,"unmuteLocal"),o1.prototype),Ej(o1.prototype,"reEstablish",[h1],Object.getOwnPropertyDescriptor(o1.prototype,"reEstablish"),o1.prototype),Ej(o1.prototype,"close",[h1],Object.getOwnPropertyDescriptor(o1.prototype,"close"),o1.prototype),Ej(o1.prototype,"updateEncoderConfig",[h1],Object.getOwnPropertyDescriptor(o1.prototype,"updateEncoderConfig"),o1.prototype),Ej(o1.prototype,"updateSendParameters",[h1],Object.getOwnPropertyDescriptor(o1.prototype,"updateSendParameters"),o1.prototype),Ej(o1.prototype,"replaceTrack",[h1],Object.getOwnPropertyDescriptor(o1.prototype,"replaceTrack"),o1.prototype),Ej(o1.prototype,"restartICE",[h1],Object.getOwnPropertyDescriptor(o1.prototype,"restartICE"),o1.prototype),i1=o1))||i1;function h1(e,t,r){var n=e[t];if("function"!=typeof n)throw new Error("Cannot use mutex on object property.");return r.value=y(G.mark((function e(){var r,i,o,a,s,c=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.mutex,e.next=3,r.lock("From P2PConnection.".concat(t));case 3:for(i=e.sent,e.prev=4,o=c.length,a=new Array(o),s=0;s<o;s++)a[s]=c[s];return e.next=8,n.apply(this,a);case 8:return e.abrupt("return",e.sent);case 9:return e.prev=9,i(),e.finish(9);case 12:case"end":return e.stop()}}),e,this,[[4,,9,12]])}))),r}function A1(e,t){var r=document.createElement("video"),n=document.createElement("canvas");r.setAttribute("style","display:none"),n.setAttribute("style","display:none"),r.setAttribute("muted",""),r.muted=!0,r.setAttribute("autoplay",""),r.autoplay=!0,r.setAttribute("playsinline",""),n.width=MG(t.width),n.height=MG(t.height);var i=MG(t.framerate||15);document.body.append(r),document.body.append(n);var o=e._mediaStreamTrack;r.srcObject=new MediaStream([o]),r.play();var a=n.getContext("2d");if(!a)throw new SD(mD.UNEXPECTED_ERROR,"can not get canvas context");var s=oL(),c=n.captureStream(s.supportRequestFrame?0:i).getVideoTracks()[0],u=hV((function(){return function(){if(r.paused&&r.play(),r.videoHeight>2&&r.videoWidth>2){var t=r.videoWidth,i=r.videoHeight/t,s=n.width*i;Math.abs(s-n.height)>=2&&(ND.debug("adjust low stream resolution","".concat(n.width,"x").concat(n.height," -> ").concat(n.width,"x").concat(s)),n.height=s)}a.drawImage(r,0,0,n.width,n.height),c.requestFrame&&c.requestFrame(),o!==e._mediaStreamTrack&&(o=e._mediaStreamTrack,r.srcObject=new MediaStream([o]))}()}),i),d=c.stop;return c.stop=function(){d.call(c),u(),r.remove(),n.width=0,n.remove(),n=null,r=null,ND.debug("clean low stream renderer")},c}function v1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function g1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v1(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v1(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var m1=function(e){k(r,e);var t=W(r);function r(e,n,i,o){var a;return U(this,r),a=t.call(this,e,"track-".concat(e.kind,"-").concat(n,"-").concat(o.clientId,"_").concat(XG(5,""))),rO(S(a),"_userId",void 0),rO(S(a),"_uintId",void 0),rO(S(a),"_isDestroyed",!1),rO(S(a),"store",void 0),a._userId=n,a._uintId=i,a.store=o,a}return F(r,[{key:"getUserId",value:function(){return this._userId}},{key:"_updateOriginMediaStreamTrack",value:function(e){this._originMediaStreamTrack=e,this._mediaStreamTrack=e,this._updatePlayerSource()}},{key:"_destroy",value:function(){this._isDestroyed=!0,ND.info("[".concat(this.getTrackId(),"] is destroyed")),ZD("info",this,"_destroy"),this.stop(),f(d(r.prototype),"close",this).call(this)}}]),r}(eV),E1=tN("RemoteVideoTrack","getTrackId")(l1=function(e){k(r,e);var t=W(r);function r(e,n,i,o){var a;return U(this,r),a=t.call(this,e,n,i,o),rO(S(a),"_videoVisibleTimer",null),rO(S(a),"_previousVideoVisibleStatus",void 0),rO(S(a),"_clearPreviousVideoVisibleStatus",(function(){return a._previousVideoVisibleStatus=void 0})),rO(S(a),"trackMediaType","video"),rO(S(a),"_videoWidth",void 0),rO(S(a),"_videoHeight",void 0),rO(S(a),"_player",void 0),ZD("info",S(a),"constructor",{userId:n}),a.updateMediaStreamTrackResolution(),a}return F(r,[{key:"isPlaying",get:function(){return!(!this._player||this._player.videoElementStatus!==vx.PLAYING)}},{key:"getStats",value:function(){var e=this;return lK((function(){ND.warning("[deprecated] RemoteVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteVideoStats instead"),qD("warning",e,"[deprecated] RemoteVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteVideoStats instead")}),"remoteVideoTrackGetStatsWarning"),iK(this,NP.GET_STATS)||g1({},gP)}},{key:"play",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.REMOTE_VIDEO_TRACK_PLAY,options:[this.getTrackId(),"string"==typeof e?e:"HTMLElement",r]});if("string"==typeof e){var i=document.getElementById(e);i?e=i:(ND.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),qD("warning",this,'can not find "#'.concat(e,'" element, use document.body')),e=document.body)}ND.debug("[".concat(this.getTrackId(),"] start video playback"),JSON.stringify(r)),ZD("debug",this,"play",r);var o=g1(g1({fit:"cover"},r),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(o):(this._player=new BJ(o),this._player.updateVideoTrack(this._mediaStreamTrack),this._player.onFirstVideoFrameDecoded=function(){t.store.subscribe(t.getUserId(),"video",void 0,void 0,performance.now()),t.emit(MP.FIRST_FRAME_DECODED)}),this._player.play(this.store.sessionId||void 0),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((function(){try{var e=t.getVideoElementVisibleStatus();t.emit(MP.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),gN("CHECK_VIDEO_VISIBLE_INTERVAL")),n.onSuccess()}},{key:"stop",value:function(){var e=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.REMOTE_VIDEO_TRACK_STOP,options:[this.getTrackId()]});if(!this._player)return e.onSuccess();this._videoVisibleTimer&&(window.clearInterval(this._videoVisibleTimer),this._videoVisibleTimer=null),this._clearPreviousVideoVisibleStatus(),this._player.destroy(),this._player=void 0,ND.debug("[".concat(this.getTrackId(),"] stop video playback")),ZD("debug",this,"stop"),e.onSuccess()}},{key:"getCurrentFrameData",value:function(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}},{key:"updateMediaStreamTrackResolution",value:function(){var e=this;eK(this._originMediaStreamTrack).then((function(t){var r=E(t,2),n=r[0],i=r[1];e._videoHeight=i,e._videoWidth=n})).catch($G)}},{key:"_updatePlayerSource",value:function(){ND.debug("[".concat(this.getTrackId(),"] update player source track")),ZD("debug",this,"_updatePlayerSource"),this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}},{key:"getVideoElementVisibleStatus",value:function(){try{var e,t,r=null==this||null===(e=this._player)||void 0===e?void 0:e.getContainerElement(),n={track:this,element:null==this||null===(t=this._player)||void 0===t?void 0:t.getVideoElement(),slot:null==r?void 0:r.parentElement},i=n.element,o=n.slot;if(this.isPlaying&&i instanceof HTMLVideoElement&&o instanceof HTMLElement){var a=Pz.checkOneElementVisible(i),s=Object.assign({},a);if(s.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=s.visible;var c=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.REMOTE_VIDEO_TRACK_GET_VIDEO_VISIBLE,options:[this.getTrackId()]});s.visible?c.onSuccess("Video is visible"):c.onSuccess("Invisible because of ".concat(s.reason))}return s}return}catch(e){throw new SD(mD.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}}]),r}(m1))||l1,_1=tN("RemoteAudioTrack","getTrackId")(p1=function(e){k(r,e);var t=W(r);function r(e,n,i,o){var a;return U(this,r),a=t.call(this,e,n,i,o),rO(S(a),"trackMediaType","audio"),rO(S(a),"_source",void 0),rO(S(a),"_useAudioElement",!0),rO(S(a),"_volume",100),ZD("info",S(a),"constructor",{userId:n}),gN("REMOTE_AUDIO_TRACK_USES_WEB_AUDIO")&&(a._useAudioElement=!1),a._source=new mV(e,!0),a._source.once(nP.RECEIVE_TRACK_BUFFER,(function(){a.emit(MP.FIRST_FRAME_DECODED)})),a}return F(r,[{key:"isPlaying",get:function(){return this._useAudioElement?hG.isPlaying(this.getTrackId()):this._source.isPlayed}},{key:"setAudioFrameCallback",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners(nP.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(nP.ON_AUDIO_BUFFER),this._source.on(nP.ON_AUDIO_BUFFER,(function(t){return e(t)}))}},{key:"setVolume",value:function(e){var t=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.REMOTE_AUDIO_SET_VOLUME,options:[this.getTrackId(),e]},300);this._volume=e,this._useAudioElement?hG.setVolume(this.getTrackId(),e):this._source.setVolume(e/100),t.onSuccess()}},{key:"setPlaybackDevice",value:function(){var e=y(G.mark((function e(t){var r;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.REMOTE_AUDIO_SET_OUTPUT_DEVICE,options:[this.getTrackId(),t]}),this._useAudioElement){e.next=3;break}throw new SD(mD.NOT_SUPPORTED,"your browser does not support setting the audio output device");case 3:return e.prev=3,e.next=6,hG.setSinkID(this.getTrackId(),t);case 6:e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(3),r.onError(e.t0),e.t0;case 11:r.onSuccess();case 12:case"end":return e.stop()}}),e,this,[[3,8]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"getVolumeLevel",value:function(){return this._source.getAccurateVolumeLevel()}},{key:"getStats",value:function(){var e=this;return lK((function(){ND.warning("[deprecated] RemoteAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteAudioStats instead"),qD("warning",e,"[deprecated] RemoteAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteAudioStats instead")}),"remoteAudioTrackGetStatsWarning"),iK(this,NP.GET_STATS)||g1({},AP)}},{key:"play",value:function(){var e=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.REMOTE_AUDIO_TRACK_PLAY,options:[this.getTrackId()]});ND.debug("[".concat(this.getTrackId(),"] start audio playback")),ZD("debug",this,"play"),this._useAudioElement?(ND.debug("[".concat(this.getTrackId(),"] use audio element to play")),qD("debug",this,"use audio element to play"),hG.play(this._mediaStreamTrack,this.getTrackId(),this._volume,this.store.sessionId||void 0)):this._source.play(),e.onSuccess()}},{key:"stop",value:function(){var e=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.REMOTE_AUDIO_TRACK_STOP,options:[this.getTrackId()]});ND.debug("[".concat(this.getTrackId(),"] stop audio playback")),ZD("debug",this,"stop"),this._useAudioElement?hG.stop(this.getTrackId()):this._source.stop(),e.onSuccess()}},{key:"_destroy",value:function(){f(d(r.prototype),"_destroy",this).call(this),this._source.destroy()}},{key:"_isFreeze",value:function(){return this._source.isFreeze}},{key:"_updatePlayerSource",value:function(){ND.debug("[".concat(this.getTrackId(),"] update player source track")),ZD("debug",this,"_updatePlayerSource"),this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&hG.updateTrack(this.getTrackId(),this._mediaStreamTrack)}}]),r}(m1))||p1;function y1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function I1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y1(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y1(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var S1,b1,C1=function(e){k(r,e);var t=W(r);function r(){var e;return U(this,r),e=t.call(this),rO(S(e),"uplinkStatsUploadInterval",void 0),rO(S(e),"uplinkStatsUploadSlowInterval",void 0),rO(S(e),"uplinkRelatedStatsUploadInterval",void 0),rO(S(e),"uplinkDenoiserStatsUploadInterval",void 0),rO(S(e),"transportStatsUploadInterval",void 0),rO(S(e),"extensionStatsUploadInterval",void 0),rO(S(e),"downlinkStatsUploadInterval",void 0),rO(S(e),"downlinkStatsUploadSlowInterval",void 0),rO(S(e),"downlinkRelatedStatsUploadInterval",void 0),rO(S(e),"lastStats",void 0),rO(S(e),"uploadUnplinkStarted",!1),rO(S(e),"uploadDownlinkStarted",!1),rO(S(e),"uploadTransportStarted",!1),rO(S(e),"requestStats",void 0),rO(S(e),"requestLocalMedia",void 0),rO(S(e),"requestRemoteMedia",void 0),rO(S(e),"requestAllTracks",void 0),rO(S(e),"requestVideoIsReady",void 0),rO(S(e),"requestUpload",void 0),e}return F(r,[{key:"startUploadTransportStats",value:function(){var e=this;this.uploadTransportStarted||(this.uploadTransportStarted=!0,this.transportStatsUploadInterval&&window.clearInterval(this.transportStatsUploadInterval),this.transportStatsUploadInterval=window.setInterval((function(){var t,r=null===(t=e.requestStats)||void 0===t?void 0:t.call(e);r&&e.uploadTransportStats(r)}),6e3))}},{key:"startUploadUplinkStats",value:function(){var e=this;this.uploadUnplinkStarted||(this.uploadUnplinkStarted=!0,this.uplinkStatsUploadInterval&&window.clearInterval(this.uplinkStatsUploadInterval),this.uplinkStatsUploadInterval=window.setInterval((function(){var t,r=null===(t=e.requestStats)||void 0===t?void 0:t.call(e);r&&(e.uploadUplinkStats(r,e.lastStats),e.lastStats=r)}),3e3),this.uplinkStatsUploadSlowInterval&&window.clearInterval(this.uplinkStatsUploadSlowInterval),this.uplinkStatsUploadSlowInterval=window.setInterval((function(){var t,r=null===(t=e.requestStats)||void 0===t?void 0:t.call(e);r&&e.uploadSlowUplinkStats(r)}),6e4),this.uplinkRelatedStatsUploadInterval&&window.clearInterval(this.uplinkRelatedStatsUploadInterval),this.uplinkRelatedStatsUploadInterval=window.setInterval((function(){var t,r=null===(t=e.requestStats)||void 0===t?void 0:t.call(e);r&&e.uploadRelatedUplinkStats(r,e.lastStats),e.lastStats=r}),1e3),this.uplinkDenoiserStatsUploadInterval&&window.clearInterval(this.uplinkDenoiserStatsUploadInterval),this.uplinkDenoiserStatsUploadInterval=window.setInterval((function(){var t,r=null===(t=e.requestAllTracks)||void 0===t?void 0:t.call(e);r&&e.uploadDenoiserStats(r)}),2e3),this.extensionStatsUploadInterval&&window.clearInterval(this.extensionStatsUploadInterval),this.extensionStatsUploadInterval=window.setInterval((function(){var t,r=null===(t=e.requestAllTracks)||void 0===t?void 0:t.call(e);r&&e.uploadExtensionStats(r)}),2e3))}},{key:"uploadTransportStats",value:function(e){var t=this;cK((function(){var r;null===(r=t.requestUpload)||void 0===r||r.call(t,eP.TRANSPORT_STATS,function(e){var t={connectionType:100};if("relay"===e.selectedCandidatePair.localCandidate.candidateType){var r=e.selectedCandidatePair.localCandidate.relayProtocol;"udp"===r&&(t.connectionType=101),"tcp"===r&&(t.connectionType=103),"tls"===r&&(t.connectionType=104)}return t}(e))}))}},{key:"uploadUplinkStats",value:function(e,t){var r,n=this;((null===(r=this.requestLocalMedia)||void 0===r?void 0:r.call(this))||[]).forEach((function(r){var i=E(r,2),o=i[0],a=i[1],s=a.track,c=a.ssrcs;switch(o){case qP.LocalVideoLowTrack:case qP.LocalVideoTrack:var u=function(e,t,r){var n,i=t.videoSend.find((function(t){return t.ssrc===e}));if(!i)return null;var o={id:XG(10,""),timestamp:new Date(t.timestamp).toISOString(),mediaType:"video",type:"ssrc",ssrc:i.ssrc.toString()};switch(o.A_vstd=r._originMediaStreamTrack&&!r._originMediaStreamTrack.enabled||!r._mediaStreamTrack.enabled?"1":"0",i.sentFrame&&(o.A_fhs=i.sentFrame.height.toString(),o.A_frs=i.sentFrame.frameRate.toString(),o.A_fws=i.sentFrame.width.toString()),i.adaptionChangeReason){case"none":o.A_ac="0";break;case"cpu":o.A_ac="1";break;case"bandwidth":o.A_ac="2";break;case"other":o.A_ac="3"}return o.A_lvps=xx[r._player?r._player.videoElementStatus:"uninit"].toString(),o.A_nr=null===(n=i.nacksCount)||void 0===n?void 0:n.toString(),i.avgEncodeMs&&(o.A_aem=i.avgEncodeMs.toFixed(0).toString()),o}(c[0].ssrcId,e,s),d=QG(c[0].ssrcId,e,t);u&&cK((function(){var e;return null===(e=n.requestUpload)||void 0===e?void 0:e.call(n,eP.PUBLISH_STATS,{stream_type:o===qP.LocalVideoLowTrack?"low":"high",stats:I1(I1({},u),d)})}));break;case qP.LocalAudioTrack:var l=function(e,t,r){var n=t.audioSend.find((function(t){return t.ssrc===e}));if(!n)return null;var i={id:XG(10,""),timestamp:new Date(t.timestamp).toISOString(),mediaType:"audio",type:"ssrc",ssrc:n.ssrc.toString()};return i.A_astd=r._originMediaStreamTrack.enabled&&r._mediaStreamTrack.enabled?"0":"1",n.inputLevel?i.A_ail=Math.round(100*n.inputLevel).toString():i.A_ail=Math.round(100*r._source.getAccurateVolumeLevel()).toString(),i.A_apil=Math.round(100*r._source.getAccurateVolumeLevel()).toString(),n.aecReturnLoss&&(i.A_ecrl=Math.round(n.aecReturnLoss).toString()),n.aecReturnLossEnhancement&&(i.A_ecrle=Math.round(n.aecReturnLossEnhancement).toString()),i}(c[0].ssrcId,e,s);l&&cK((function(){var e;return null===(e=n.requestUpload)||void 0===e?void 0:e.call(n,eP.PUBLISH_STATS,{stream_type:"high",stats:l})}))}var p=function(e){var t={id:"bweforvideo",timestamp:new Date(e.timestamp).toISOString(),type:"VideoBwe"};return e.bitrate.retransmit&&(t.A_rb=e.bitrate.retransmit.toString()),e.bitrate.targetEncoded&&(t.A_teb=e.bitrate.targetEncoded.toString()),t.A_aeb=e.bitrate.actualEncoded.toString(),t.A_tb=e.bitrate.transmit.toString(),void 0!==e.sendBandwidth&&(t.A_asb=e.sendBandwidth.toString()),t}(e);p&&cK((function(){var e;return null===(e=n.requestUpload)||void 0===e?void 0:e.call(n,eP.PUBLISH_STATS,{stream_type:o===qP.LocalVideoLowTrack?"low":"high",stats:p})}))}))}},{key:"uploadSlowUplinkStats",value:function(e){var t,r=this;((null===(t=this.requestLocalMedia)||void 0===t?void 0:t.call(this))||[]).filter((function(e){var t=E(e,1)[0];return t===qP.LocalVideoLowTrack||t===qP.LocalVideoTrack})).forEach((function(t){var n=E(t,2),i=n[0],o=QG(n[1].ssrcs[0].ssrcId,e);o&&cK((function(){var e;return null===(e=r.requestUpload)||void 0===e?void 0:e.call(r,eP.PUBLISH_STATS,{stream_type:i===qP.LocalVideoLowTrack?"low":"high",stats:o})}))}))}},{key:"uploadRelatedUplinkStats",value:function(e,t){var r,n=this;((null===(r=this.requestLocalMedia)||void 0===r?void 0:r.call(this))||[]).filter((function(e){var t=E(e,1)[0];return t===qP.LocalVideoLowTrack||t===qP.LocalVideoTrack})).forEach((function(t){var r=E(t,2),i=r[0],o=function(e,t){var r=t.videoSend.find((function(t){return t.ssrc===e}));return r?{mediaType:"video",isVideoMute:!1,frameRateInput:r.inputFrame&&r.inputFrame.frameRate.toString(),frameRateSent:r.sentFrame&&r.sentFrame.frameRate.toString(),googRtt:r.rttMs.toString(),qpSumPerFrame:Math.floor(r.qpSumPerFrame).toString()}:null}(r[1].ssrcs[0].ssrcId,e);o&&cK((function(){var e;null===(e=n.requestUpload)||void 0===e||e.call(n,eP.PUBLISH_RELATED_STATS,{stream_type:i===qP.LocalVideoLowTrack?"low":"high",stats:o})}))}))}},{key:"uploadDenoiserStats",value:function(e){for(var t=0;t<e.length;t++){var r=e[t];if(r instanceof EG){var n,i,o,a=null===(n=(i=r._external).getDenoiserStats)||void 0===n?void 0:n.call(i);return void(a&&(null===(o=this.requestUpload)||void 0===o||o.call(this,eP.DENOISER_STATS,a)))}}}},{key:"uploadExtensionStats",value:function(e){for(var t=this,r=0;r<e.length;r++){var n=e[r];if(n instanceof EG)return void n.getProcessorStats().forEach((function(e){var r;e.type===eP.DENOISER_STATS&&(null===(r=t.requestUpload)||void 0===r||r.call(t,eP.DENOISER_STATS,e.stats))}))}}},{key:"stopUploadUplinkStats",value:function(){this.uploadUnplinkStarted&&(this.uploadUnplinkStarted=!1,this.uplinkStatsUploadInterval&&window.clearInterval(this.uplinkStatsUploadInterval),this.uplinkRelatedStatsUploadInterval&&window.clearInterval(this.uplinkRelatedStatsUploadInterval),this.uplinkDenoiserStatsUploadInterval&&window.clearInterval(this.uplinkDenoiserStatsUploadInterval),this.uplinkStatsUploadInterval=void 0,this.uplinkRelatedStatsUploadInterval=void 0,this.uplinkDenoiserStatsUploadInterval=void 0)}},{key:"startUploadDownlinkStats",value:function(){var e=this;this.uploadDownlinkStarted||(this.uploadDownlinkStarted=!0,this.downlinkStatsUploadInterval&&window.clearInterval(this.downlinkStatsUploadInterval),this.downlinkStatsUploadInterval=window.setInterval((function(){var t,r=null===(t=e.requestStats)||void 0===t?void 0:t.call(e);r&&(e.uploadDownlinkStats(r,e.lastStats),e.lastStats=r)}),3e3),this.downlinkStatsUploadSlowInterval&&window.clearInterval(this.downlinkStatsUploadSlowInterval),this.downlinkStatsUploadSlowInterval=window.setInterval((function(){var t,r=null===(t=e.requestStats)||void 0===t?void 0:t.call(e);r&&e.uploadSlowDownlinkStats(r)}),6e4),this.downlinkRelatedStatsUploadInterval&&window.clearInterval(this.downlinkRelatedStatsUploadInterval),this.downlinkRelatedStatsUploadInterval=window.setInterval((function(){var t,r=null===(t=e.requestStats)||void 0===t?void 0:t.call(e);r&&(e.uploadRelatedDownlinkStats(r,e.lastStats),e.lastStats=r)}),1e3))}},{key:"uploadDownlinkStats",value:function(e,t){var r,n=this;((null===(r=this.requestRemoteMedia)||void 0===r?void 0:r.call(this))||[]).forEach((function(t){var r=E(t,2),i=r[0],o=r[1];if(o.has(YP.VIDEO)&&i.videoTrack){var a=i.videoTrack?function(e,t,r){var n=t.videoRecv.find((function(t){return t.ssrc===e}));if(!n)return null;var i,o,a={id:XG(10,""),timestamp:new Date(t.timestamp).toISOString(),mediaType:"video",type:"ssrc",ssrc:n.ssrc.toString()};return a.bytesReceived=n.bytes.toString(),a.packetsLost=n.packetsLost.toString(),a.packetsReceived=n.packets.toString(),n.framesRateFirefox&&(a.A_frr=n.framesRateFirefox.toString()),n.receivedFrame?(a.A_frr=n.receivedFrame.frameRate.toString(),a.A_fhr=n.receivedFrame.height.toString(),a.A_fwr=n.receivedFrame.width.toString()):(a.A_fhr=null===(i=r._videoHeight)||void 0===i?void 0:i.toString(),a.A_fwr=null===(o=r._videoWidth)||void 0===o?void 0:o.toString()),a.A_frd=n.decodeFrameRate.toString(),n.outputFrame&&(a.A_fro=n.outputFrame.frameRate.toString()),void 0!==n.jitterBufferMs&&(a.A_jbm=Math.floor(n.jitterBufferMs).toString()),void 0!==n.currentDelayMs&&(a.A_cdm=Math.floor(n.currentDelayMs).toString()),a.A_fs=n.firsCount.toString(),a.A_ns=n.nacksCount.toString(),a.A_ps=n.plisCount.toString(),r&&(a.A_vrtd=r._originMediaStreamTrack.enabled&&r._mediaStreamTrack.enabled?"0":"1"),r._player&&r._player.freezeTimeCounterList.length>0&&(a.A_vrft=r._player.freezeTimeCounterList.splice(0,1)[0].toString()),a.A_rvps=xx[r._player?r._player.videoElementStatus:"uninit"].toString(),a}(i._videoSSRC,e,i.videoTrack):void 0;a&&cK((function(){var e;return null===(e=n.requestUpload)||void 0===e?void 0:e.call(n,eP.SUBSCRIBE_STATS,{stream_id:i.uid,stats:a})}))}if(o.has(YP.AUDIO)&&i.audioTrack){var s=i.audioTrack?function(e,t,r){var n=t.audioRecv.find((function(t){return t.ssrc===e}));if(!n)return null;var i={id:XG(10,""),timestamp:new Date(t.timestamp).toISOString(),mediaType:"audio",type:"ssrc",ssrc:n.ssrc.toString()};return i.bytesReceived=n.bytes.toString(),i.packetsLost=n.packetsLost.toString(),i.packetsReceived=n.packets.toString(),n.outputLevel?i.A_aol=Math.round(100*n.outputLevel).toString():i.A_aol=Math.round(100*r._source.getAccurateVolumeLevel()).toString(),i.A_apol=Math.round(100*r._source.getAccurateVolumeLevel()).toString(),r&&(i.A_artd=r._originMediaStreamTrack.enabled&&r._mediaStreamTrack.enabled?"0":"1"),i.A_jr=n.jitterMs.toString(),i.A_jbm=Math.floor(n.jitterBufferMs).toString(),i.A_cdm=Math.floor(n.jitterBufferMs).toString(),i.A_raps=xx[hG.getPlayerState(r.getTrackId())].toString(),i}(i._audioSSRC,e,i.audioTrack):void 0;s&&cK((function(){var e;return null===(e=n.requestUpload)||void 0===e?void 0:e.call(n,eP.SUBSCRIBE_STATS,{stream_id:i.uid,stats:s})}))}}))}},{key:"uploadSlowDownlinkStats",value:function(e){}},{key:"uploadRelatedDownlinkStats",value:function(e,t){var r,n=this;((null===(r=this.requestRemoteMedia)||void 0===r?void 0:r.call(this))||[]).forEach((function(r){var i=E(r,2),o=i[0],a=i[1];if(a.has(YP.VIDEO)&&o.videoTrack){var s,c=!0===(o._videoSSRC&&(null===(s=n.requestVideoIsReady)||void 0===s?void 0:s.call(n,o._videoSSRC))||!1),u=function(e,t,r,n,i,o){var a=r.videoRecv.find((function(t){return t.ssrc===e})),s=i?i.videoRecv.find((function(t){return t.ssrc===e})):void 0;if(!a)return null;var c=kG.isRemoteVideoFreeze(o,a,s)&&t,u={mediaType:"video",isVideoMute:!1,peerId:n,frameRateReceived:a.receivedFrame&&a.receivedFrame.frameRate.toString(),frameRateDecoded:a.decodedFrame&&a.decodedFrame.frameRate.toString(),isFreeze:c,bytesReceived:a.bytes.toString(),packetsReceived:a.packets.toString(),packetsLost:a.packetsLost.toString(),qpSumPerFrame:Math.floor(a.qpSumPerFrame).toString()};return a.framesRateFirefox&&(u.frameRateDecoded=a.framesRateFirefox.toString(),u.frameRateReceived=a.framesRateFirefox.toString()),u}(o._videoSSRC,c,e,o.uid,t,o.videoTrack);u&&cK((function(){var e;null===(e=n.requestUpload)||void 0===e||e.call(n,eP.SUBSCRIBE_RELATED_STATS,{stream_id:o.uid,stats:u})}))}if(a.has(YP.AUDIO)&&o.audioTrack){var d=function(e,t,r,n){var i=t.audioRecv.find((function(t){return t.ssrc===e}));if(!i)return null;var o=kG.isRemoteAudioFreeze(n);return{mediaType:"audio",isAudioMute:!1,peerId:r,googJitterReceived:i.jitterMs.toString(),isFreeze:o,bytesReceived:i.bytes.toString(),packetsReceived:i.packets.toString(),packetsLost:i.packetsLost.toString(),frameReceived:i.receivedFrames.toString(),frameDropped:i.droppedFrames.toString()}}(o._audioSSRC,e,o.uid,o.audioTrack);d&&cK((function(){var e;null===(e=n.requestUpload)||void 0===e||e.call(n,eP.SUBSCRIBE_RELATED_STATS,{stream_id:o.uid,stats:d})}))}}))}},{key:"stopUploadDownlinkStats",value:function(){this.uploadDownlinkStarted&&(this.uploadDownlinkStarted=!1,this.downlinkStatsUploadInterval&&window.clearInterval(this.downlinkStatsUploadInterval),this.downlinkRelatedStatsUploadInterval&&window.clearInterval(this.downlinkRelatedStatsUploadInterval),this.downlinkStatsUploadInterval=void 0,this.downlinkRelatedStatsUploadInterval=void 0)}},{key:"stopUploadTransportStats",value:function(){this.uploadTransportStarted&&(this.uploadTransportStarted=!1,this.transportStatsUploadInterval&&window.clearInterval(this.transportStatsUploadInterval),this.transportStatsUploadInterval=void 0)}}]),r}(yD);function w1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function R1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?w1(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w1(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function T1(e){var t,r,n,i=2;for("undefined"!=typeof Symbol&&(r=XZ,n=Symbol.iterator);i--;){if(r&&null!=(t=e[r]))return t.call(e);if(n&&null!=(t=e[n]))return new k1(t.call(e));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function k1(e){function t(e){if(Object(e)!==e)return Rb.reject(new TypeError(e+" is not an object."));var t=e.done;return Rb.resolve(e.value).then((function(e){return{value:e,done:t}}))}return(k1=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var r=this.s.return;return void 0===r?Rb.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?Rb.reject(e):t(r.apply(this.s,arguments))}},new k1(e)}var O1=tN("P2PChannel","store.p2pId")((Ej((b1=function(e){k(r,e);var t=W(r);function r(e,n){var i;return U(this,r),i=t.call(this),rO(S(i),"store",void 0),rO(S(i),"statsUploader",void 0),rO(S(i),"connection",void 0),rO(S(i),"localTrackMap",new Map),rO(S(i),"remoteUserMap",new Map),rO(S(i),"pendingLocalTracks",[]),rO(S(i),"pendingRemoteTracks",[]),rO(S(i),"statsCollector",void 0),rO(S(i),"isPlanB",!1),rO(S(i),"iceFailedCount",0),rO(S(i),"dtlsFailedCount",0),rO(S(i),"mutex",new rV("P2PChannel-mutex")),rO(S(i),"_state",JP.Disconnected),rO(S(i),"handleMuteLocalTrack",function(){var e=y(G.mark((function e(t,r,n){var o,a,s;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.mutex.lock("Locking from P2PChannel.handleMuteLocalTrack");case 2:if(o=e.sent,e.prev=3,i.connection){e.next=6;break}return e.abrupt("return",void n(new SD(mD.INVALID_OPERATION,"Cannot call P2PChannel.handleMuteLocalTrack before connection established.")));case 6:return ZD("debug",S(i),"handleMuteLocalTrack",t.getTrackId()),e.next=9,i.waitTillConnected();case 9:if(0!==(a=i.filterTobeMutedTracks(t)).length){e.next=12;break}return e.abrupt("return",void r());case 12:return e.next=14,i.connection.muteLocal(a.map((function(e){return E(e,2)[1].id})));case 14:return s=i.createMuteMessage(a),e.next=17,nK(S(i),zP.RequestMuteLocal,s);case 17:r(),e.next=23;break;case 20:e.prev=20,e.t0=e.catch(3),n(e.t0);case 23:return e.prev=23,o(),e.finish(23);case 26:case"end":return e.stop()}}),e,null,[[3,20,23,26]])})));return function(t,r,n){return e.apply(this,arguments)}}()),rO(S(i),"handleUnmuteLocalTrack",function(){var e=y(G.mark((function e(t,r,n){var o,a,s;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.mutex.lock("Locking from P2PChannel.handleUnmuteLocalTrack");case 2:if(o=e.sent,e.prev=3,i.connection){e.next=6;break}return e.abrupt("return",void n(new SD(mD.INVALID_OPERATION,"Cannot call P2PChannel.handleUnmuteLocalTrack before connection established.")));case 6:return ZD("debug",S(i),"handleUnmuteLocalTrack",t.getTrackId()),e.next=9,i.waitTillConnected();case 9:if(0!==(a=i.filterTobeUnmutedTracks(t)).length){e.next=12;break}return e.abrupt("return",void r());case 12:return e.next=14,i.connection.unmuteLocal(a.map((function(e){return E(e,2)[1].id})));case 14:return s=i.createUnmuteMessage(a),e.next=17,nK(S(i),zP.RequestUnmuteLocal,s);case 17:r(),e.next=23;break;case 20:e.prev=20,e.t0=e.catch(3),n(e.t0);case 23:return e.prev=23,o(),e.finish(23);case 26:case"end":return e.stop()}}),e,null,[[3,20,23,26]])})));return function(t,r,n){return e.apply(this,arguments)}}()),rO(S(i),"handleUpdateVideoEncoder",function(){var e=y(G.mark((function e(t,r,n){var o,a,s,c;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.mutex.lock("Locking from P2PChannel.handleSetVideoEncoder");case 2:if(o=e.sent,e.prev=3,a=i.localTrackMap.get(qP.LocalVideoTrack),i.connection&&a&&a.track===t){e.next=7;break}return e.abrupt("return",void r());case 7:return e.next=9,i.waitTillConnected();case 9:return s=a.id,c=a.track,e.next=12,i.connection.updateSendParameters(s,c);case 12:return e.next=14,i.connection.updateEncoderConfig(s,c);case 14:i.emit(zP.UpdateVideoEncoder,c),r(),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(3),n(e.t0);case 21:return e.prev=21,o(),e.finish(21);case 24:case"end":return e.stop()}}),e,null,[[3,18,21,24]])})));return function(t,r,n){return e.apply(this,arguments)}}()),rO(S(i),"handleSetOptimizationMode",function(){var e=y(G.mark((function e(t,r,n){var o,a,s,c;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.mutex.lock("Locking from P2PChannel.handleSetOptimizationMode");case 2:if(o=e.sent,e.prev=3,a=i.localTrackMap.get(qP.LocalVideoTrack),i.connection&&a&&a.track===t){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,i.waitTillConnected();case 9:return s=a.id,c=a.track,e.next=12,i.connection.updateSendParameters(s,c);case 12:r(),e.next=18;break;case 15:e.prev=15,e.t0=e.catch(3),n(e.t0);case 18:return e.prev=18,o(),e.finish(18);case 21:case"end":return e.stop()}}),e,null,[[3,15,18,21]])})));return function(t,r,n){return e.apply(this,arguments)}}()),rO(S(i),"handleReplaceTrack",function(){var e=y(G.mark((function e(t,r,n,o){var a,s,c,u,d,l;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ND.debug("P2PChannel handleReplaceTrack for [track-id-".concat(t.getTrackId(),"]")),e.t0="boolean"==typeof o&&o,e.t0){e.next=6;break}return e.next=5,i.mutex.lock("From P2PChannel.handleReplaceTrack");case 5:a=e.sent;case 6:if(e.prev=6,s=Array.from(i.localTrackMap.entries()).find((function(e){var r=E(e,2)[1].track;return t===r})),i.connection&&s){e.next=10;break}return e.abrupt("return",void r());case 10:return e.next=12,i.waitTillConnected();case 12:return e.next=14,i.connection.replaceTrack(t,s[1].id);case 14:if(!i.isPlanB){e.next=17;break}(c=s[1]).id=t._mediaStreamTrack.id,i.localTrackMap.set(s[0],c);case 17:if(s[0]!==qP.LocalVideoTrack||!oL().supportDualStreamEncoding){e.next=26;break}if(!(u=i.localTrackMap.get(qP.LocalVideoLowTrack))){e.next=26;break}return d=t._mediaStreamTrack.clone(),u.track._originMediaStreamTrack.stop(),u.track._mediaStreamTrack=d,u.track._originMediaStreamTrack=d,e.next=26,new Rb((function(e,t){i.handleReplaceTrack(u.track,e,t,!0)}));case 26:r(),e.next=32;break;case 29:e.prev=29,e.t1=e.catch(6),n(e.t1);case 32:return e.prev=32,null===(l=a)||void 0===l||l(),e.finish(32);case 35:case"end":return e.stop()}}),e,null,[[6,29,32,35]])})));return function(t,r,n,i){return e.apply(this,arguments)}}()),rO(S(i),"handleGetLocalVideoStats",(function(e){e(i.statsCollector.getLocalVideoTrackStats())})),rO(S(i),"handleGetLocalAudioStats",(function(e){e(i.statsCollector.getLocalAudioTrackStats())})),rO(S(i),"handleGetRemoteVideoStats",(function(e){return i.statsCollector.getRemoteVideoTrackStats(e.uid)[e.uid]})),rO(S(i),"handleGetRemoteAudioStats",(function(e){return i.statsCollector.getRemoteAudioTrackStats(e.uid)[e.uid]})),i.store=e,i.statsCollector=n,i.statsCollector.addP2PChannel(S(i)),i.statsUploader=new C1,i.bindStatsUploaderEvents(),i.isPlanB=!oL().supportUnifiedPlan||gN("CHROME_FORCE_PLAN_B")&&Yk(),i}return F(r,[{key:"state",get:function(){return this._state},set:function(e){var t=this._state;this._state=e,this.emit(zP.StateChange,t,this._state)}},{key:"startP2PConnection",value:function(){var e=y(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",(this.state=JP.New,this.connection=this.isPlanB?new r1(t,this.store):new f1(t,this.store),this.bindConnectionEvents(this.connection),this.store.peerConnectionStart(),this.connection.establish()));case 1:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"connect",value:function(){var e=y(G.mark((function e(t,r,n,i,o,a){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.connection){e.next=2;break}throw new SD(mD.UNEXPECTED_ERROR,"Cannot P2PChannel.connect before P2PChannel.startP2PConnection .");case 2:return e.next=4,this.connection.connect(t,r,n,i,o,a);case 4:this.statsUploader.startUploadTransportStats(),this.state=JP.Connected;case 6:case"end":return e.stop()}}),e,this)})));function t(t,r,n,i,o,a){return e.apply(this,arguments)}return t}()},{key:"publish",value:function(e,t,r){var n=this;return YZ(G.mark((function i(){var o,a,s;return G.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,qZ(n.mutex.lock("From P2PChannel.publish"));case 2:if(o=i.sent,i.prev=3,n.connection){i.next=10;break}if(n.state!==JP.Disconnected){i.next=7;break}throw new SD(mD.UNEXPECTED_ERROR,"PeerConnection already disconnected.");case 7:return n.throwIfTrackTypeNotMatch(e),a=e.filter((function(e){return-1===n.pendingLocalTracks.indexOf(e)})),i.abrupt("return",void(n.pendingLocalTracks=n.pendingLocalTracks.concat(a)));case 10:return n.store.pubId=n.store.pubId+1,wG.markPublishStart(n.store.clientId,n.store.pubId),i.next=14,qZ(n.waitTillConnected());case 14:if(0!==(s=n.filterTobePublishedTracks(e,t,r)).length){i.next=19;break}return i.next=18,qZ(n.tryToUnmuteAudio(e));case 18:return i.abrupt("return",void i.sent);case 19:return i.delegateYield(zZ(T1(n.doPublish(n.connection,s)),qZ),"t0",20);case 20:return i.prev=20,o(),i.finish(20);case 23:case"end":return i.stop()}}),i,null,[[3,,20,23]])})))()}},{key:"doPublish",value:function(e,t){var r=this;return YZ(G.mark((function n(){var i,o,a,s,c,u;return G.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t.forEach((function(e){var t=e.track,n=e.type,i=performance.now();r.store.publish(t.getTrackId(),n===qP.LocalAudioTrack?"audio":"video",i)})),r.bindLocalTrackEvents(t),n.next=3,qZ(e.send(t.map((function(e){return e.track})),r.store.codec,r.store.audioCodec));case 3:return i=n.sent,n.next=6,qZ(i.next());case 6:return o=n.sent.value,a=r.createGatewayPublishMessage(t,o),n.prev=8,n.next=11,a;case 11:s=n.sent,n.next=17;break;case 14:throw n.prev=14,n.t0=n.catch(8),qD("error",r,"doPublish yield error: ".concat(n.t0.toString())),i.throw(n.t0),(null==n.t0?void 0:n.t0.code)===mD.WS_ABORT&&t.forEach((function(e){var t=e.track;-1===r.pendingLocalTracks.indexOf(t)&&r.pendingLocalTracks.push(t)})),r.unbindLocalTrackEvents(t),n.t0;case 17:return c=r.mapPubResToRemoteConfig(a,s),ZD("debug",r,"doPublish",{remoteConfigs:c,tracks:t.map((function(e){return e.track.getTrackId()})),pubMsg:a,pubAns:s}),n.next=21,qZ(i.next(c));case 21:u=n.sent.value,t.forEach((function(e){var t=e.type;r.statsCollector.addLocalStats(t)})),r.assignLocalTracks(t,u),r.statsUploader.startUploadUplinkStats(),t.forEach((function(e){var t=e.track,n=e.type,i=performance.now();r.store.publish(t.getTrackId(),n===qP.LocalAudioTrack?"audio":"video",void 0,i)}));case 23:case"end":return n.stop()}}),n,null,[[8,14]])})))()}},{key:"publishLowStream",value:function(e){var t=this;return YZ(G.mark((function r(){var n,i,o,a,s;return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(t.connection){r.next=2;break}return r.abrupt("return");case 2:return ZD("debug",t,"publishLowStream",e),r.next=5,qZ(t.mutex.lock("Locking from P2PChannel.publishLowStream"));case 5:if(n=r.sent,r.prev=6,i=t.localTrackMap.get(qP.LocalVideoTrack)){r.next=10;break}throw new SD(mD.UNEXPECTED_ERROR,"Could not find high stream");case 10:if(!t.localTrackMap.has(qP.LocalVideoLowTrack)){r.next=12;break}throw new SD(mD.UNEXPECTED_ERROR,"[".concat(t.store.clientId,"] Can't publish low stream when stream already publish"));case 12:return r.next=14,qZ(t.waitTillConnected());case 14:return o=[{track:t.getLowVideoTrack(i.track,e),type:qP.LocalVideoLowTrack}],r.delegateYield(zZ(T1(t.doPublish(t.connection,o)),qZ),"t0",16);case 16:if(!i.track.muted&&i.track.enabled){r.next=22;break}if(s=null===(a=t.localTrackMap.get(qP.LocalVideoLowTrack))||void 0===a?void 0:a.id,r.t1=void 0!==s,!r.t1){r.next=22;break}return r.next=22,qZ(t.connection.muteLocal([s]));case 22:return r.prev=22,n(),r.finish(22);case 25:case"end":return r.stop()}}),r,null,[[6,,22,25]])})))()}},{key:"republish",value:function(){var e=y(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.pendingLocalTracks.length>0,!e.t0){e.next=8;break}return ND.debug("Emit P2PChannelEvents.RequestRePublish to republish tracks."),ZD("debug",this,"republish",this.pendingLocalTracks.map((function(e){return e.getTrackId()}))),e.next=6,rK(this,zP.RequestRePublish,this.pendingLocalTracks);case 6:this.emit(zP.MediaReconnectEnd,this.store.uid),this.pendingLocalTracks=[];case 8:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"reSubscribe",value:function(){var e=y(G.mark((function e(t){var r,n,i,o,a,s,c,u,d,l=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(ZD("debug",this,"reSubscribe",this.pendingRemoteTracks.map((function(e){return e.user.uid}))),r=this.pendingRemoteTracks.length-1;r>=0;r--)n=this.pendingRemoteTracks[r],i=n.user,((o=n.kind)!==YP.AUDIO||i._audio_added_&&i._audioSSRC)&&(o!==YP.VIDEO||i._video_added_&&i._videoSSRC)||this.pendingRemoteTracks.splice(r,1);if(!t){e.next=7;break}return e.next=5,rK(this,zP.RequestReSubscribe,this.pendingRemoteTracks);case 5:e.next=24;break;case 7:a=K(this.pendingRemoteTracks),e.prev=8,a.s();case 10:if((s=a.n()).done){e.next=16;break}return c=s.value,u=c.user,d=c.kind,e.next=14,this.subscribe(u,d,d===YP.VIDEO?u._videoSSRC:u._audioSSRC);case 14:e.next=10;break;case 16:e.next=21;break;case 18:e.prev=18,e.t0=e.catch(8),a.e(e.t0);case 21:return e.prev=21,a.f(),e.finish(21);case 24:this.pendingRemoteTracks.forEach((function(e){var t=e.user;l.emit(zP.MediaReconnectEnd,t.uid)})),this.pendingRemoteTracks=[];case 25:case"end":return e.stop()}}),e,this,[[8,18,21,24]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"unpublish",value:function(){var e=y(G.mark((function e(t){var r,n=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.connection){e.next=2;break}return e.abrupt("return",void t.forEach((function(e){var t=n.pendingLocalTracks.indexOf(e);-1!==t&&n.pendingLocalTracks.splice(t,1)})));case 2:return e.next=4,this.waitTillConnected();case 4:return r=this.filterTobeUnpublishedTracks(t),e.abrupt("return",0!==r.length?(ZD("debug",this,"unpublish"),this.doUnpublish(this.connection,r)):void 0);case 6:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"unpublishLowStream",value:function(){var e=y(G.mark((function e(){var t,r;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.connection){e.next=2;break}return e.abrupt("return");case 2:if(ZD("debug",this,"unpublishLowStream"),t=this.localTrackMap.get(qP.LocalVideoLowTrack)){e.next=6;break}return e.abrupt("return");case 6:return e.next=8,this.waitTillConnected();case 8:return r=[[qP.LocalVideoLowTrack,t]],e.abrupt("return",this.doUnpublish(this.connection,r));case 10:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"doUnpublish",value:function(){var e=y(G.mark((function e(t,r){var n,i=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this.createGatewayUnpublishMessage(r),e.next=3,t.stopSending(r.map((function(e){return E(e,2)[1].id})));case 3:return this.withdrawLocalTracks(r),this.unbindLocalTrackEvents(r.map((function(e){var t=E(e,2);return{type:t[0],track:t[1].track}}))),r.forEach((function(e){var t=E(e,1)[0];i.statsCollector.removeLocalStats(t)})),0===this.localTrackMap.size&&this.statsUploader.stopUploadUplinkStats(),e.abrupt("return",n);case 8:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"subscribe",value:function(){var e=y(G.mark((function e(t,r,n,i,o){var a,s,c,u,d,l,p,f;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.connection){e.next=2;break}throw new SD(mD.INVALID_OPERATION,"Cannot subscribe remote user when peerConnection disconnected.");case 2:if(ZD("debug",this,"subscribe",{uid:t.uid,mediaType:r,ssrcId:n}),null===(a=this.remoteUserMap.get(t))||void 0===a||!a.has(r)){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,this.waitTillConnected();case 6:if(!o){e.next=16;break}if(u=o.find((function(e){return e.stream_type===r})),u){e.next=10;break}throw new SD(mD.UNEXPECTED_ERROR,"Cannot subscribe to remote ".concat(r," for user: ").concat(t.uid," because subscribe answer from gateway does not contain stream_type: ").concat(r,"."));case 10:return e.next=12,this.connection.receive(r,u.ssrcs,String(t.uid),u.attributes);case 12:d=e.sent,s=d.track,c=d.id,e.next=20;break;case 16:return e.next=18,this.connection.receive(r,[{ssrcId:n,rtx:i}],String(t.uid),void 0);case 18:l=e.sent,s=l.track,c=l.id;case 20:r===YP.AUDIO?(t._audioTrack?t._audioTrack._updateOriginMediaStreamTrack(s):(t._audioTrack=new _1(s,t.uid,t._uintid,this.store),ND.info("[".concat(this.store.p2pId,"] create remote audio track: ").concat(t._audioTrack.getTrackId()))),this.bindRemoteTrackEvents(t,t._audioTrack)):(t._videoTrack?t._videoTrack._updateOriginMediaStreamTrack(s):(t._videoTrack=new E1(s,t.uid,t._uintid,this.store),ND.info("[".concat(this.store.p2pId,"] create remote video track: ").concat(t._videoTrack.getTrackId()))),this.bindRemoteTrackEvents(t,t._videoTrack)),(p=this.remoteUserMap.get(t))?p.set(r,c):this.remoteUserMap.set(t,new Map([[r,c]])),this.statsCollector.addRemoteStats(t.uid),this.statsUploader.startUploadDownlinkStats(),f=this.pendingRemoteTracks.findIndex((function(e){var n=e.user,i=e.kind;return n.uid===t.uid&&r===i})),-1!==f&&(this.pendingRemoteTracks.splice(f,1),this.emit(zP.MediaReconnectEnd,t.uid));case 25:case"end":return e.stop()}}),e,this)})));function t(t,r,n,i,o){return e.apply(this,arguments)}return t}()},{key:"massSubscribe",value:function(){var e=y(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.massSubscribeNoLock(t));case 1:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"massSubscribeNoLock",value:function(){var e=y(G.mark((function e(t){var r,n=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.connection){e.next=2;break}throw new SD(mD.INVALID_OPERATION,"Cannot subscribeAll remote users when peerConnection disconnected.");case 2:return ZD("debug",this,"subscribeAll",t.map((function(e){var t=e.user,r=e.mediaType,n=e.ssrcId;return{uid:t.uid,mediaType:r,ssrcId:n}}))),t=t.filter((function(e){var t,r=e.user,i=e.mediaType;return!(null!==(t=n.remoteUserMap.get(r))&&void 0!==t&&t.has(i))})),e.next=6,this.waitTillConnected();case 6:return e.next=8,this.connection.batchReceive(t.map((function(e){var t=e.user;return{kind:e.mediaType,ssrcMsg:[{ssrcId:e.ssrcId,rtx:e.rtxSsrcId}],mslabel:String(t.uid)}})));case 8:r=e.sent,t.forEach((function(e,t){var i=e.user,o=e.mediaType,a=r[t],s=a.track,c=a.id;o===YP.AUDIO?(i._audioTrack?i._audioTrack._updateOriginMediaStreamTrack(s):(i._audioTrack=new _1(s,i.uid,i._uintid,n.store),ND.info("[".concat(n.store.p2pId,"] create remote audio track: ").concat(i._audioTrack.getTrackId()))),n.bindRemoteTrackEvents(i,i._audioTrack)):(i._videoTrack?i._videoTrack._updateOriginMediaStreamTrack(s):(i._videoTrack=new E1(s,i.uid,i._uintid,n.store),ND.info("[".concat(n.store.p2pId,"] create remote video track: ").concat(i._videoTrack.getTrackId()))),n.bindRemoteTrackEvents(i,i._videoTrack));var u=n.remoteUserMap.get(i);u?u.set(o,c):n.remoteUserMap.set(i,new Map([[o,c]])),n.statsCollector.addRemoteStats(i.uid),n.statsUploader.startUploadDownlinkStats();var d=n.pendingRemoteTracks.findIndex((function(e){var t=e.user,r=e.kind;return t.uid===i.uid&&o===r}));-1!==d&&(n.pendingRemoteTracks.splice(d,1),n.emit(zP.MediaReconnectEnd,i.uid))}));case 10:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"unsubscribe",value:function(){var e=y(G.mark((function e(t,r){var n,i,o,a=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=this.pendingRemoteTracks.filter((function(e){var n=e.user,i=e.kind;return void 0!==r?n.uid===t.uid&&r===i:n.uid===t.uid})),n.forEach((function(e){var t=a.pendingRemoteTracks.indexOf(e);a.pendingRemoteTracks.splice(t,1)})),this.connection){e.next=3;break}return e.abrupt("return",void n.forEach((function(e){var r,n=e.kind;if(n===YP.AUDIO)null===(r=t._audioTrack)||void 0===r||r._destroy(),t._audioTrack=void 0;else if(n===YP.VIDEO){var i;null===(i=t._videoTrack)||void 0===i||i._destroy(),t._videoTrack=void 0}})));case 3:if(ZD("debug",this,"unsubscribe",{uid:t.uid,mediaType:r}),0!==(i=this.filterTobeUnSubscribedTracks(t,r)).length){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,this.connection.stopReceiving(i.map((function(e){return E(e,2)[1].id})));case 9:return o=this.createUnsubscribeMessage(i),e.abrupt("return",(this.withdrawRemoteTracks(i),0===this.remoteUserMap.size&&this.statsUploader.stopUploadDownlinkStats(),i.forEach((function(e){var t,r,n=E(e,2),i=n[0],o=n[1].kind;if(o===YP.VIDEO&&i._videoSSRC&&(null===(t=a.connection)||void 0===t||t.setStatsRemoteVideoIsReady(i._videoSSRC,!1)),o===YP.VIDEO)a.unbindRemoteTrackEvents(i._videoTrack),null===(r=i._videoTrack)||void 0===r||r._destroy(),i._videoTrack=void 0;else if(o===YP.AUDIO){var s;a.unbindRemoteTrackEvents(i._audioTrack),null===(s=i._audioTrack)||void 0===s||s._destroy(),i._audioTrack=void 0}})),o));case 11:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"massUnsubscribe",value:function(){var e=y(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.massUnsubscribeNoLock(t));case 1:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"massUnsubscribeNoLock",value:function(){var e=y(G.mark((function e(t){var r,n,i,o,a,s,c=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],n=K(t);try{for(o=function(){var e=i.value,t=e.user,n=e.mediaType,o=c.pendingRemoteTracks.filter((function(e){var r=e.user,i=e.kind;return void 0!==n?r.uid===t.uid&&n===i:r.uid===t.uid}));o.forEach((function(e){var t=c.pendingRemoteTracks.indexOf(e);c.pendingRemoteTracks.splice(t,1)})),r=r.concat(o)},n.s();!(i=n.n()).done;)o()}catch(e){n.e(e)}finally{n.f()}if(this.connection){e.next=5;break}return e.abrupt("return",void r.forEach((function(e){var t,r=e.user,n=e.kind;if(n===YP.AUDIO)null===(t=r._audioTrack)||void 0===t||t._destroy(),r._audioTrack=void 0;else if(n===YP.VIDEO){var i;null===(i=r._videoTrack)||void 0===i||i._destroy(),r._videoTrack=void 0}})));case 5:if(ZD("debug",this,"batchUnsubscribe",t.map((function(e){var t=e.user,r=e.mediaType;return{uid:t.uid,mediaType:r}}))),a=Hp(t).call(t,(function(e,t){var r=t.user,n=t.mediaType,i=c.filterTobeUnSubscribedTracks(r,n);return e.concat(i)}),[]),0!==a.length){e.next=9;break}return e.abrupt("return");case 9:return e.next=11,this.connection.stopReceiving(a.map((function(e){return E(e,2)[1].id})));case 11:return s=this.createUnsubscribeAllMessage(a),e.abrupt("return",(this.withdrawRemoteTracks(a),0===this.remoteUserMap.size&&this.statsUploader.stopUploadDownlinkStats(),a.forEach((function(e){var t,r,n=E(e,2),i=n[0],o=n[1].kind;if(o===YP.VIDEO&&i._videoSSRC&&(null===(t=c.connection)||void 0===t||t.setStatsRemoteVideoIsReady(i._videoSSRC,!1)),o===YP.VIDEO)c.unbindRemoteTrackEvents(i._videoTrack),null===(r=i._videoTrack)||void 0===r||r._destroy(),i._videoTrack=void 0;else if(o===YP.AUDIO){var a;c.unbindRemoteTrackEvents(i._audioTrack),null===(a=i._audioTrack)||void 0===a||a._destroy(),i._audioTrack=void 0}})),s));case 13:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"muteRemote",value:function(){var e=y(G.mark((function e(t,r){var n,i,o;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.connection){e.next=2;break}return e.abrupt("return");case 2:if(ZD("debug",this,"muteRemote",{uid:t.uid,kind:r}),n=this.remoteUserMap.get(t)){e.next=6;break}return e.abrupt("return",(ND.warning("P2PChannel.muteRemote has no remote user ".concat(t.uid,".")),void qD("warning",this,"P2PChannel.muteRemote has no remote user ".concat(t.uid,"."))));case 6:if(i=n.get(r)){e.next=9;break}return e.abrupt("return",(ND.warning("P2PChannel.muteRemote has no remote user ".concat(t.uid," media type ").concat(r,".")),void qD("warning",this,"P2PChannel.muteRemote has no remote user ".concat(t.uid," media type ").concat(r,"."))));case 9:return void 0!==(o=r===YP.VIDEO?t._videoSSRC:t._audioSSRC)&&this.connection.setStatsRemoteVideoIsReady(o,!1),e.next=13,this.connection.muteRemote(i);case 13:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"unmuteRemote",value:function(){var e=y(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.unmuteRemoteNoLock(t,r));case 1:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"unmuteRemoteNoLock",value:function(){var e=y(G.mark((function e(t,r){var n,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.connection){e.next=2;break}return e.abrupt("return");case 2:if(ZD("debug",this,"unmuteRemote",{uid:t.uid,kind:r}),n=this.remoteUserMap.get(t)){e.next=6;break}return e.abrupt("return",(ND.warning("P2PChannel.unmuteRemote has no remote user ".concat(t.uid,".")),void qD("warning",this,"unmuteRemote has no remote user ".concat(t.uid))));case 6:if(i=n.get(r)){e.next=9;break}return e.abrupt("return",(ND.warning("P2PChannel.unmuteRemote has no remote user ".concat(t.uid," media type ").concat(r,".")),void qD("warning",this,"unmuteRemote has no remote user ".concat(t.uid," media type ").concat(r))));case 9:return e.next=11,this.connection.unmuteRemote(i);case 11:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"getAllTracks",value:function(e){var t=this.localTrackMap.get(qP.LocalAudioTrack);if((null==t?void 0:t.track)instanceof yG){var r=t.track;return Array.from(this.localTrackMap.entries()).filter((function(e){return E(e,1)[0]!==qP.LocalAudioTrack})).filter((function(t){var r=E(t,1)[0];return!(e&&r===qP.LocalVideoLowTrack)})).map((function(e){return E(e,2)[1].track})).concat(r.trackList)}return Array.from(this.localTrackMap.entries()).filter((function(t){var r=E(t,1)[0];return!(e&&r===qP.LocalVideoLowTrack)})).map((function(e){return E(e,2)[1].track}))}},{key:"reportPublishEvent",value:function(e,t,r,n,i){if(e){var o=this.localTrackMap.get(qP.LocalAudioTrack),a=n?this.localTrackMap.get(qP.LocalVideoLowTrack):this.localTrackMap.get(qP.LocalVideoTrack);zj.publish(this.store.sessionId,{eventElapse:wG.measureFromPublishStart(this.store.clientId,this.store.pubId),succ:e,ec:t,audioName:null==o?void 0:o.track.getTrackLabel(),videoName:null==a?void 0:a.track.getTrackLabel(),screenshare:-1!==(null==a?void 0:a.track._hints.indexOf(xP.SCREEN_TRACK)),audio:!!o,video:!!a,p2pid:this.store.p2pId,publishRequestid:this.store.pubId,extend:i})}else{var s;r||(r=[]);var c=r.find((function(e){return e instanceof mG})),u=n?null===(s=this.localTrackMap.get(qP.LocalVideoTrack))||void 0===s?void 0:s.track:r.find((function(e){return e instanceof Mz}));zj.publish(this.store.sessionId,{eventElapse:wG.measureFromPublishStart(this.store.clientId,this.store.pubId),succ:e,ec:t,audioName:null==c?void 0:c.getTrackLabel(),videoName:null==u?void 0:u.getTrackLabel(),screenshare:-1!==(null==u?void 0:u._hints.indexOf(xP.SCREEN_TRACK)),audio:!!c,video:!!u,p2pid:this.store.p2pId,publishRequestid:this.store.pubId,extend:i})}}},{key:"reportSubscribeEvent",value:function(e,t,r,n){var i=n===YP.VIDEO?r._videoSSRC:r._audioSSRC;i&&zj.subscribe(this.store.sessionId,{succ:e,ec:t,video:n===YP.VIDEO,audio:n===YP.AUDIO,peerid:r.uid,subscribeRequestid:n===YP.VIDEO?r._videoSSRC:r._audioSSRC,p2pid:this.store.p2pId,eventElapse:wG.measureFromSubscribeStart(this.store.clientId,i)})}},{key:"reset",value:function(){ND.debug("P2PChannel.reset"),this.mutex=new rV("P2PChannel-mutex"),this.connection&&(this.connection.close(),this.unbindConnectionEvents(this.connection),this.connection=void 0),this.statsUploader.stopUploadUplinkStats(),this.statsUploader.stopUploadDownlinkStats(),this.statsUploader.stopUploadTransportStats(),this.unbindLocalTrackEvents(),this.unbindAllRemoteTrackEvents(),this.localTrackMap.clear(),this.remoteUserMap.clear(),this.statsCollector.removeRemoteStats(),this.statsCollector.removeLocalStats(),this.iceFailedCount=0,this.dtlsFailedCount=0,this.pendingLocalTracks=[],this.pendingRemoteTracks=[],this.state=JP.Disconnected}},{key:"getStats",value:function(){var e;return null===(e=this.connection)||void 0===e?void 0:e.getStats()}},{key:"getRemoteVideoIsReady",value:function(e){var t;return(null===(t=this.connection)||void 0===t?void 0:t.getRemoteVideoIsReady(e))||!1}},{key:"getLocalAudioVolume",value:function(){var e=this.localTrackMap.get(qP.LocalAudioTrack);if(e)return e.track.getVolumeLevel()}},{key:"getLocalVideoSize",value:function(){var e=this.localTrackMap.get(qP.LocalVideoTrack);if(e)return{width:e.track._videoWidth||0,height:e.track._videoHeight||0}}},{key:"getEncoderConfig",value:function(e){var t=this.localTrackMap.get(e);return t&&t.track instanceof Mz||t&&t.track instanceof mG?t.track._encoderConfig:void 0}},{key:"getLocalMedia",value:function(e){return this.localTrackMap.get(e)}},{key:"hasLocalMedia",value:function(){return this.localTrackMap.size>0}},{key:"hasRemoteMedia",value:function(e,t){if(!e)return this.remoteUserMap.size>0;var r=this.remoteUserMap.get(e);return!!r&&(!t||r.has(t))}},{key:"hasRemoteMediaWithLock",value:function(){var e=y(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",this.remoteUserMap.size>0);case 2:return n=this.remoteUserMap.get(t),e.abrupt("return",!!n&&(!r||n.has(r)));case 4:case"end":return e.stop()}}),e,this)})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"getRemoteMedia",value:function(e){var t,r=Array.from(Lj(t=this.remoteUserMap).call(t)).find((function(t){return t.uid===e}));return r?{audioTrack:r.audioTrack,audioSSRC:r._audioSSRC,videoTrack:r.videoTrack,videoSSRC:r._videoSSRC}:{}}},{key:"getAudioLevels",value:function(){var e=Array.from(this.remoteUserMap.entries()).map((function(e){var t=E(e,1)[0];return{uid:t.uid,level:t.audioTrack?100*t.audioTrack._source.getAccurateVolumeLevel():0}})),t=this.localTrackMap.get(qP.LocalAudioTrack);return t&&e.push({level:100*t.track._source.getAccurateVolumeLevel(),uid:this.store.uid}),e=yx(e).call(e,(function(e,t){return e.level-t.level})),e}},{key:"disconnectForReconnect",value:function(){var e=y(G.mark((function e(){var t=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.connection&&(ZD("debug",this,"disconnectForReconnect"),ND.debug("P2PChannel.disconnectForReconnect closing P2PConnection"),this.state=JP.Reconnecting,this.connection.close(),this.unbindConnectionEvents(this.connection),this.connection=void 0,0!==this.localTrackMap.size&&(Array.from(this.localTrackMap.entries()).forEach((function(e){var r=E(e,2),n=r[0],i=r[1].track;switch(n){case qP.LocalVideoTrack:i._hints.includes(xP.LOW_STREAM)?i.close():t.pendingLocalTracks.push(i);break;case qP.LocalAudioTrack:i instanceof yG?t.pendingLocalTracks=t.pendingLocalTracks.concat(i.trackList):t.pendingLocalTracks.push(i);case qP.LocalVideoLowTrack:}})),this.emit(zP.MediaReconnectStart,this.store.uid)),this.unbindLocalTrackEvents(),this.localTrackMap.clear(),0!==this.remoteUserMap.size&&Array.from(this.remoteUserMap.entries()).forEach((function(e){var r=E(e,2),n=r[0],i=r[1];Array.from(Lj(i).call(i)).forEach((function(e){t.setPendingRemoteMedia(n,e)})),t.emit(zP.MediaReconnectStart,n.uid)})),this.unbindAllRemoteTrackEvents(),this.remoteUserMap.clear(),this.statsUploader.stopUploadUplinkStats(),this.statsUploader.stopUploadDownlinkStats(),this.statsUploader.stopUploadTransportStats(),ND.debug("P2PChannel disconnected, waiting to reconnect."));case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"hasPendingRemoteMedia",value:function(e,t){var r,n=K(this.pendingRemoteTracks);try{for(n.s();!(r=n.n()).done;){var i=r.value,o=i.user,a=i.kind;if((e instanceof jz?e.uid:e)===o.uid&&t===a)return!0}}catch(e){n.e(e)}finally{n.f()}return!1}},{key:"setPendingRemoteMedia",value:function(e,t){this.hasPendingRemoteMedia(e,t)||this.pendingRemoteTracks.push({user:e,kind:t})}},{key:"reEstablish",value:function(){var e=y(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.connection){e.next=2;break}return e.abrupt("return",this.connection.reEstablish());case 2:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"getUplinkNetworkQuality",value:function(){if(!this.connection)return 0;var e=this.connection.getStats(),t=this.localTrackMap.get(qP.LocalVideoTrack),r=this.localTrackMap.get(qP.LocalAudioTrack),n=e.videoSend.find((function(e){return e.ssrc===(null==t?void 0:t.ssrcs[0].ssrcId)})),i=e.audioSend.find((function(e){return e.ssrc===(null==r?void 0:r.ssrcs[0].ssrcId)}));if(!n||!i)return 1;var o=iK(this,zP.NeedSignalRTT),a=n?n.rttMs:void 0,s=i?i.rttMs:void 0,c=a&&s?(a+s)/2:a||s,u=(c&&o?(c+o)/2:c||o)||0,d=100*e.sendPacketLossRate*.7/50+.3*u/1500,l=d<.17?1:d<.36?2:d<.59?3:d<.1?4:5,p=null==t?void 0:t.track;if(p&&p._encoderConfig&&-1===p._hints.indexOf(xP.SCREEN_TRACK)){var f=p._encoderConfig.bitrateMax,h=e.bitrate.actualEncoded;if(f&&h){var A=(1e3*f-h)/(1e3*f);return bN[A<.15?0:A<.3?1:A<.45?2:A<.6?3:4][l]}}return l}},{key:"getDownlinkNetworkQuality",value:function(){var e=this;if(!this.connection)return 0;var t=this.connection.getStats(),r=0;return Array.from(this.remoteUserMap.entries()).forEach((function(n){var i=E(n,1)[0],o=i._audioSSRC,a=i._videoSSRC,s=t.audioRecv.find((function(e){return e.ssrc===o})),c=t.videoRecv.find((function(e){return e.ssrc===a}));if(s||c){var u=iK(e,zP.NeedSignalRTT),d=t.rtt,l=(d&&u?(d+u)/2:d||u)||0,p=s?s.jitterMs:void 0,f=t.recvPacketLossRate,h=.7*f*100/50+.3*l/1500;p&&(h=.6*f*100/50+.2*l/1500+.2*p/400),r+=h<.1?1:h<.17?2:h<.36?3:h<.59?4:5}else r+=1})),this.remoteUserMap.size>0?Math.round(r/this.remoteUserMap.size):r}},{key:"muteLocalTrack",value:function(){var e=y(G.mark((function e(t){var r=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Rb((function(e,n){r.handleMuteLocalTrack(t,e,n)})));case 1:case"end":return e.stop()}}),e)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"filterTobePublishedTracks",value:function(e,t,r){var n,i=[],o=oL(),a=this.getAllTracks(),s=!1,c=!1,u=K(e=sK(e=e.filter((function(e){return-1===a.indexOf(e)}))));try{for(u.s();!(n=u.n()).done;){var d=n.value;if(d instanceof Mz&&(this.localTrackMap.has(qP.LocalVideoTrack)||s?new SD(mD.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS).throw():(i.push({track:d,type:qP.LocalVideoTrack}),s=!0),t)){var l=this.getLowVideoTrack(d,r);i.push({track:l,type:qP.LocalVideoLowTrack})}if(d instanceof mG){var p=this.localTrackMap.get(qP.LocalAudioTrack);if(p){if(!(p.track instanceof yG))throw new SD(mD.NOT_SUPPORTED,"cannot publish multiple tracks which one of them configured with bypassWebAudio or your browser does not support audio mixing");if(d._bypassWebAudio)throw new SD(mD.NOT_SUPPORTED,"cannot publish multiple tracks which one of them configured with bypassWebAudio");p.track.addAudioTrack(d),this.bindLocalAudioTrackEvents(d,!0)}else if(c){var f=i.find((function(e){return e.type===qP.LocalAudioTrack}));if(!(f.track instanceof yG))throw new SD(mD.NOT_SUPPORTED,"cannot publish multiple tracks which one of them configured with bypassWebAudio or your browser does not support audio mixing");if(d._bypassWebAudio)throw new SD(mD.NOT_SUPPORTED,"cannot publish multiple tracks which one of them configured with bypassWebAudio");f.track.addAudioTrack(d)}else{if(!o.webAudioMediaStreamDest||d instanceof yG||d._bypassWebAudio)i.push({track:d,type:qP.LocalAudioTrack});else{var h=new yG;h.addAudioTrack(d),i.push({track:h,type:qP.LocalAudioTrack})}c=!0}}}}catch(e){u.e(e)}finally{u.f()}return i}},{key:"filterTobeUnpublishedTracks",value:function(e){var t,r=[],n=this.getAllTracks(),i=K(e=sK(e=e.filter((function(e){return-1!==n.indexOf(e)}))));try{for(i.s();!(t=i.n()).done;){var o=t.value;if(o instanceof mG){var a=this.localTrackMap.get(qP.LocalAudioTrack);if(!a)continue;a.track instanceof yG?(a.track.removeAudioTrack(o),this.unbindLocalAudioTrackEvents(o),0===a.track.trackList.length&&(r.push([qP.LocalAudioTrack,a]),a.track.close())):r.push([qP.LocalAudioTrack,a])}if(o instanceof Mz){var s=this.localTrackMap.get(qP.LocalVideoTrack);if(!s)continue;r.push([qP.LocalVideoTrack,s]);var c=this.localTrackMap.get(qP.LocalVideoLowTrack);c&&r.push([qP.LocalVideoLowTrack,c])}}}catch(e){i.e(e)}finally{i.f()}return r}},{key:"bindLocalTrackEvents",value:function(e){var t=this;e.forEach((function(e){var r=e.track;switch(e.type){case qP.LocalVideoTrack:r.addListener(NP.GET_STATS,t.handleGetLocalVideoStats),r.addListener(NP.NEED_DISABLE_TRACK,t.handleMuteLocalTrack),r.addListener(NP.NEED_ENABLE_TRACK,t.handleUnmuteLocalTrack),r.addListener(NP.NEED_UPDATE_VIDEO_ENCODER,t.handleUpdateVideoEncoder),r.addListener(NP.SET_OPTIMIZATION_MODE,t.handleSetOptimizationMode),r.addListener(NP.NEED_REPLACE_TRACK,t.handleReplaceTrack),r.addListener(NP.NEED_MUTE_TRACK,t.handleMuteLocalTrack),r.addListener(NP.NEED_UNMUTE_TRACK,t.handleUnmuteLocalTrack);break;case qP.LocalAudioTrack:t.bindLocalAudioTrackEvents(r);case qP.LocalVideoLowTrack:}}))}},{key:"bindLocalAudioTrackEvents",value:function(e,t){var r=this;e instanceof yG?e.trackList.forEach((function(e){e.addListener(NP.NEED_DISABLE_TRACK,r.handleMuteLocalTrack),e.addListener(NP.NEED_ENABLE_TRACK,r.handleUnmuteLocalTrack),e.addListener(NP.GET_STATS,r.handleGetLocalAudioStats),e.addListener(NP.NEED_MUTE_TRACK,r.handleMuteLocalTrack),e.addListener(NP.NEED_UNMUTE_TRACK,r.handleUnmuteLocalTrack)})):(e.addListener(NP.GET_STATS,this.handleGetLocalAudioStats),e.addListener(NP.NEED_DISABLE_TRACK,this.handleMuteLocalTrack),e.addListener(NP.NEED_ENABLE_TRACK,this.handleUnmuteLocalTrack),e.addListener(NP.NEED_MUTE_TRACK,this.handleMuteLocalTrack),e.addListener(NP.NEED_UNMUTE_TRACK,this.handleUnmuteLocalTrack),t||e.addListener(NP.NEED_REPLACE_TRACK,this.handleReplaceTrack))}},{key:"unbindLocalTrackEvents",value:function(e){var t=this;e||(e=Array.from(this.localTrackMap.entries()).map((function(e){var t=E(e,2),r=t[0];return{track:t[1].track,type:r}}))),e.forEach((function(e){var r=e.track;switch(e.type){case qP.LocalVideoTrack:r.off(NP.GET_STATS,t.handleGetLocalVideoStats),r.off(NP.NEED_DISABLE_TRACK,t.handleMuteLocalTrack),r.off(NP.NEED_ENABLE_TRACK,t.handleUnmuteLocalTrack),r.off(NP.NEED_UPDATE_VIDEO_ENCODER,t.handleUpdateVideoEncoder),r.off(NP.SET_OPTIMIZATION_MODE,t.handleSetOptimizationMode),r.off(NP.NEED_REPLACE_TRACK,t.handleReplaceTrack),r.off(NP.NEED_MUTE_TRACK,t.handleMuteLocalTrack),r.off(NP.NEED_UNMUTE_TRACK,t.handleUnmuteLocalTrack);break;case qP.LocalAudioTrack:t.unbindLocalAudioTrackEvents(r);case qP.LocalVideoLowTrack:}}))}},{key:"unbindLocalAudioTrackEvents",value:function(e){var t=this;e instanceof yG?e.trackList.forEach((function(e){e.off(NP.NEED_DISABLE_TRACK,t.handleMuteLocalTrack),e.off(NP.NEED_ENABLE_TRACK,t.handleUnmuteLocalTrack),e.off(NP.GET_STATS,t.handleGetLocalAudioStats),e.off(NP.NEED_MUTE_TRACK,t.handleMuteLocalTrack),e.off(NP.NEED_UNMUTE_TRACK,t.handleUnmuteLocalTrack)})):(e.off(NP.GET_STATS,this.handleGetLocalAudioStats),e.off(NP.NEED_DISABLE_TRACK,this.handleMuteLocalTrack),e.off(NP.NEED_ENABLE_TRACK,this.handleUnmuteLocalTrack),e.off(NP.NEED_REPLACE_TRACK,this.handleReplaceTrack),e.off(NP.NEED_MUTE_TRACK,this.handleMuteLocalTrack),e.off(NP.NEED_UNMUTE_TRACK,this.handleUnmuteLocalTrack))}},{key:"bindRemoteTrackEvents",value:function(e,t){var r=this;t instanceof E1&&t.addListener(NP.GET_STATS,(function(t){t(r.handleGetRemoteVideoStats(e))})),t instanceof _1&&t.addListener(NP.GET_STATS,(function(t){t(r.handleGetRemoteAudioStats(e))}))}},{key:"unbindRemoteTrackEvents",value:function(e){e&&e.removeAllListeners(NP.GET_STATS)}},{key:"unbindAllRemoteTrackEvents",value:function(){var e=this;Array.from(this.remoteUserMap.entries()).forEach((function(t){var r=E(t,2),n=r[0],i=r[1];i.has(YP.AUDIO)&&e.unbindRemoteTrackEvents(n._audioTrack),i.has(YP.VIDEO)&&e.unbindRemoteTrackEvents(n._videoTrack)}))}},{key:"createGatewayPublishMessage",value:function(e,t){var r=this;return e.map((function(e,n){var i,o,a=e.track;switch(e.type){case qP.LocalAudioTrack:i=kP.Audio,o={dtx:a instanceof EG&&a._config.DTX,hq:!1,lq:!1,stereo:!1,speech:!1};break;case qP.LocalVideoTrack:i=a._hints.includes(xP.SCREEN_TRACK)?kP.Screen:kP.High,o=R1(R1({},UG(a)),{},{codec:r.store.codec});break;case qP.LocalVideoLowTrack:i=kP.Low,o=R1(R1({},UG(a)),{},{codec:r.store.codec})}return{stream_type:i,attributes:o,ssrcs:t[n]}}))}},{key:"createGatewayUnpublishMessage",value:function(e){return e.map((function(e){var t,r=E(e,2),n=r[0],i=r[1],o=i.track,a=i.ssrcs,s=i.id;switch(n){case qP.LocalVideoTrack:t=o._hints.includes(xP.SCREEN_TRACK)?kP.Screen:kP.High;break;case qP.LocalAudioTrack:t=kP.Audio;break;case qP.LocalVideoLowTrack:t=kP.Low}return{stream_type:t,ssrcs:a,mid:s}}))}},{key:"assignLocalTracks",value:function(e,t){var r=this;e.forEach((function(e,n){var i=e.track,o=e.type;r.localTrackMap.set(o,{track:i,id:t[n].id,ssrcs:t[n].localSSRC})}))}},{key:"withdrawLocalTracks",value:function(e){var t=this;e.forEach((function(e){var r=E(e,1)[0];t.localTrackMap.delete(r)}))}},{key:"waitTillConnected",value:function(){var e=y(G.mark((function e(){var t=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Rb((function(e,r){switch(t.state){case JP.New:case JP.Reconnecting:var n=function n(i,o){return o===JP.Disconnected?(t.off(zP.StateChange,n),void r(new SD(mD.UNEXPECTED_ERROR,"PeerConnection already disconnected."))):o===JP.Connected?(t.off(zP.StateChange,n),void e(void 0)):void 0};t.on(zP.StateChange,n);break;case JP.Connected:e(void 0);break;case JP.Disconnected:r(new SD(mD.UNEXPECTED_ERROR,"PeerConnection already disconnected."))}})));case 1:case"end":return e.stop()}}),e)})));function t(){return e.apply(this,arguments)}return t}()},{key:"bindConnectionEvents",value:function(e){var t=this;e.onConnectionStateChange=function(){var r=y(G.mark((function r(n){return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(ND.info("[p2pId: ".concat(t.store.p2pId,"]: P2PConnection.onConnectionStateChange(").concat(n,")")),JD("info",t,"connectionStateChange",n),t.emit(zP.PeerConnectionStateChange,n),"connected"!==n||t.store.keyMetrics.peerConnectionEnd||t.store.peerConnectionEnd(),"failed"!==n){r.next=11;break}if("failed"!==e.iceConnectionState){r.next=9;break}return setTimeout((function(){return t.emit(zP.P2PLost)}),0),t.iceFailedCount+=1,r.next=6,JG(CD(t.iceFailedCount,bD));case 6:t.emit(zP.RequestRestartICE),r.next=11;break;case 9:return r.next=11,t.requestReconnect();case 11:case"end":return r.stop()}}),r)})));return function(e){return r.apply(this,arguments)}}(),e.onICEConnectionStateChange=function(e){ND.info("[p2pId: ".concat(t.store.p2pId,"]: P2PConnection.onICEConnectionStateChange(").concat(e,")")),JD("info",t,"iceConnectionStateChange",e),zj.reportApiInvoke(t.store.sessionId,{name:"ICEConnectionStateChange",options:e,tag:Qx.TRACER}).onSuccess(),t.emit(zP.IceConnectionStateChange,e)},e.onICETransportStateChange=function(e){ND.info("[p2pId: ".concat(t.store.p2pId,"]: P2PConnection.onICETransportStateChange(").concat(e,")")),JD("info",t,"ICETransportStateChange",e)},e.onDTLSTransportStateChange=function(e){ND.info("[p2pId: ".concat(t.store.p2pId,"]: P2PConnection.onDTLSTransportStateChange(").concat(e,")")),JD("info",t,"DTLSTransportStateChange",e)},e.onDTLSTransportError=function(e){ND.info("[p2pId: ".concat(t.store.p2pId,"]: P2PConnection.onDTLSTransportError(").concat(e,")")),JD("info",t,"DTLSTransportError",e)},e.onFirstAudioDecoded=function(e){var r,n,i=Array.from(Lj(r=t.remoteUserMap).call(r)).find((function(t){return t._audioSSRC===e}));i&&(null===(n=i.audioTrack)||void 0===n||n.emit(MP.FIRST_FRAME_DECODED),zj.firstRemoteFrame(t.store.sessionId,Lx.FIRST_AUDIO_DECODE,Bx.FIRST_AUDIO_DECODE,{peer:i._uintid,subscribeElapse:wG.measureFromSubscribeStart(t.store.clientId,e),subscribeRequestid:e,p2pid:t.store.p2pId}))},e.onFirstAudioReceived=function(e){var r,n=Array.from(Lj(r=t.remoteUserMap).call(r)).find((function(t){return t._audioSSRC===e}));n&&zj.firstRemoteFrame(t.store.sessionId,Lx.FIRST_AUDIO_RECEIVED,Bx.FIRST_AUDIO_RECEIVED,{peer:n._uintid,subscribeElapse:wG.measureFromSubscribeStart(t.store.clientId,e),subscribeRequestid:e,p2pid:t.store.p2pId})},e.onFirstVideoDecoded=function(e,r,n){var i,o=Array.from(Lj(i=t.remoteUserMap).call(i)).find((function(t){return t._videoSSRC===e}));o&&zj.firstRemoteFrame(t.store.sessionId,Lx.FIRST_VIDEO_DECODE,Bx.FIRST_VIDEO_DECODE,{peer:o._uintid,videowidth:r,videoheight:n,subscribeElapse:wG.measureFromSubscribeStart(t.store.clientId,e),subscribeRequestid:e,p2pid:t.store.p2pId})},e.onFirstVideoReceived=function(e){var r,n=Array.from(Lj(r=t.remoteUserMap).call(r)).find((function(t){return t._videoSSRC===e}));n&&zj.firstRemoteFrame(t.store.sessionId,Lx.FIRST_VIDEO_RECEIVED,Bx.FIRST_VIDEO_RECEIVED,{peer:n._uintid,subscribeElapse:wG.measureFromSubscribeStart(t.store.clientId,e),subscribeRequestid:e,p2pid:t.store.p2pId})},e.onSelectedLocalCandidateChanged=function(e,r){var n="relay"===e.candidateType,i="relay"===r.candidateType;"unknown"!==r.candidateType&&n===i||t.emit(zP.ConnectionTypeChange,n),ND.info("[p2pId: ".concat(t.store.p2pId,"]: P2PConnection.SelectedLocalCandidateChanged(").concat(JSON.stringify(HG(r))," -> ").concat(JSON.stringify(HG(e)),")")),JD("info",t,"SelectedLocalCandidateChanged","".concat(JSON.stringify(HG(r))," -> ").concat(JSON.stringify(HG(e))))},e.onSelectedRemoteCandidateChanged=function(e,r){ND.info("[p2pId: ".concat(t.store.p2pId,"]: P2PConnection.SelectedRemoteCandidateChanged(").concat(JSON.stringify(HG(r))," -> ").concat(JSON.stringify(HG(e)),")")),JD("info",t,"SelectedRemoteCandidateChanged","".concat(JSON.stringify(HG(r))," -> ").concat(JSON.stringify(HG(e))))}}},{key:"unbindConnectionEvents",value:function(e){e.onConnectionStateChange=void 0,e.onICEConnectionStateChange=void 0,e.onICETransportStateChange=void 0,e.onDTLSTransportStateChange=void 0,e.onDTLSTransportError=void 0,e.onFirstAudioDecoded=void 0,e.onFirstAudioReceived=void 0,e.onFirstVideoDecoded=void 0,e.onFirstVideoReceived=void 0,e.onSelectedLocalCandidateChanged=void 0,e.onSelectedRemoteCandidateChanged=void 0}},{key:"filterTobeMutedTracks",value:function(e){var t=[];if(-1===this.getAllTracks().indexOf(e))return t;var r=this.localTrackMap.get(qP.LocalAudioTrack);if(e instanceof mG&&(null==r?void 0:r.track)instanceof yG)return r.track.isActive||t.push([qP.LocalAudioTrack,r]),t;var n=Array.from(this.localTrackMap.entries()).find((function(t){var r=E(t,2)[1].track;return e===r}));if(n&&(t.push(n),n[0]===qP.LocalVideoTrack)){var i=this.localTrackMap.get(qP.LocalVideoLowTrack);i&&t.push([qP.LocalVideoLowTrack,i])}return t}},{key:"filterTobeUnmutedTracks",value:function(e){var t=[],r=this.localTrackMap.get(qP.LocalAudioTrack);if(e instanceof mG&&(null==r?void 0:r.track)instanceof yG)return r.track.isActive&&t.push([qP.LocalAudioTrack,r]),t;var n=Array.from(this.localTrackMap.entries()).find((function(t){var r=E(t,2)[1].track;return e===r}));if(n)if(n[0]===qP.LocalVideoTrack){t.push(n);var i=this.localTrackMap.get(qP.LocalVideoLowTrack);i&&t.push([qP.LocalVideoLowTrack,i])}else t.push(n);return t}},{key:"createMuteMessage",value:function(e){return e.map((function(e){var t,r=E(e,2),n=r[0],i=r[1],o=i.track,a=i.ssrcs,s=i.id;switch(n){case qP.LocalAudioTrack:t=kP.Audio;break;case qP.LocalVideoTrack:t=o._hints.includes(xP.SCREEN_TRACK)?kP.Screen:kP.High;break;case qP.LocalVideoLowTrack:t=kP.Low}return{stream_type:t,ssrcs:a,mid:s}}))}},{key:"createUnmuteMessage",value:function(e){return e.map((function(e){var t,r=E(e,2),n=r[0],i=r[1],o=i.track,a=i.ssrcs,s=i.id;switch(n){case qP.LocalAudioTrack:t=kP.Audio;break;case qP.LocalVideoTrack:t=o._hints.includes(xP.SCREEN_TRACK)?kP.Screen:kP.High;break;case qP.LocalVideoLowTrack:t=kP.Low}return{stream_type:t,ssrcs:a,mid:s}}))}},{key:"filterTobeUnSubscribedTracks",value:function(e,t){var r=[],n=this.remoteUserMap.get(e);if(!n)return r;if(t){var i=n.get(t);if(!i)return r;r.push([e,{kind:t,id:i}])}else Array.from(n.entries()).forEach((function(t){var n=E(t,2),i=n[0],o=n[1];r.push([e,{kind:i,id:o}])}));return r}},{key:"createUnsubscribeMessage",value:function(e){var t=[];return e.forEach((function(e){var r=E(e,2),n=r[0],i=r[1],o=i.kind;switch(i.id,o){case YP.VIDEO:return void(n._videoSSRC&&t.push({stream_type:YP.VIDEO,ssrcId:n._videoSSRC}));case YP.AUDIO:return void(n._audioSSRC&&t.push({stream_type:YP.AUDIO,ssrcId:n._audioSSRC}))}})),t}},{key:"createUnsubscribeAllMessage",value:function(e){var t=new Map;return e.forEach((function(e){var r=E(e,2),n=r[0],i=r[1].kind;if(t.has(n)){var o=t.get(n);i===YP.VIDEO?o|=DP.Video:o|=DP.Audio,t.set(n,o)}else i===YP.VIDEO?t.set(n,DP.Video):t.set(n,DP.Audio)})),{users:Array.from(t.entries()).map((function(e){var t=E(e,2),r=t[0],n=t[1];return{stream_id:r.uid,stream_type:n}}))}}},{key:"withdrawRemoteTracks",value:function(e){var t=this;e.forEach((function(e){var r=E(e,2),n=r[0],i=r[1].kind,o=t.remoteUserMap.get(n);o&&(o.delete(i),0===Array.from(o.entries()).length&&t.remoteUserMap.delete(n))}))}},{key:"updateBitrateLimit",value:function(){var e=y(G.mark((function e(t){var r,n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this.localTrackMap.get(qP.LocalVideoTrack),n=this.localTrackMap.get(qP.LocalVideoLowTrack),e.t0=r,!e.t0){e.next=5;break}return e.next=5,r.track.setBitrateLimit(t.uplink);case 5:if(e.t1=n&&t.low_stream_uplink,!e.t1){e.next=9;break}return e.next=9,n.track.setBitrateLimit({max_bitrate:t.low_stream_uplink.bitrate,min_bitrate:t.low_stream_uplink.bitrate||0});case 9:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"isP2PDisconnected",value:function(){return!this.connection||"connected"!==this.connection.peerConnectionState}},{key:"mapPubResToRemoteConfig",value:function(e,t){return e.map((function(e,r){var n,i=e.stream_type;return null===(n=t.find((function(e){var t=e.stream_type;return i===t})))||void 0===n?void 0:n.attributes}))}},{key:"tryToUnmuteAudio",value:function(){var e=y(G.mark((function e(t){var r,n,i,o;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=0;case 1:if(!(r<t.length)){e.next=15;break}if(!(t[r]instanceof mG)){e.next=12;break}if(0!==(i=this.filterTobeUnmutedTracks(t[r])).length){e.next=6;break}return e.abrupt("continue",12);case 6:return e.next=8,null===(n=this.connection)||void 0===n?void 0:n.unmuteLocal(i.map((function(e){return E(e,2)[1].id})));case 8:return o=this.createUnmuteMessage(i),e.next=11,nK(this,zP.RequestUnmuteLocal,o);case 11:return e.abrupt("return",void e.sent);case 12:r++,e.next=1;break;case 15:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"bindStatsUploaderEvents",value:function(){var e=this;this.statsUploader.requestStats=function(){return e.getStats()},this.statsUploader.requestLocalMedia=function(){return Array.from(e.localTrackMap.entries())},this.statsUploader.requestRemoteMedia=function(){return Array.from(e.remoteUserMap.entries())},this.statsUploader.requestVideoIsReady=function(t){var r;return!(null===(r=e.connection)||void 0===r||!r.getRemoteVideoIsReady(t))},this.statsUploader.requestUpload=function(t,r){return e.emit(zP.RequestUploadStats,t,r)},this.statsUploader.requestAllTracks=function(){return e.getAllTracks()}}},{key:"unbindStatsUploaderEvents",value:function(){this.statsUploader.requestStats=void 0,this.statsUploader.requestLocalMedia=void 0,this.statsUploader.requestRemoteMedia=void 0,this.statsUploader.requestVideoIsReady=void 0}},{key:"requestReconnect",value:function(){var e=y(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.dtlsFailedCount+=1,e.next=3,JG(CD(this.dtlsFailedCount,bD));case 3:this.emit(zP.RequestReconnect);case 4:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"reconnectP2P",value:function(){var e=y(G.mark((function e(){var t,r;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Array.from(this.localTrackMap.entries()),r=this.createGatewayUnpublishMessage(t),Array.from(this.remoteUserMap.entries()),e.t0=r.length>0,!e.t0){e.next=6;break}return e.next=6,rK(this,zP.RequestUnpublishForReconnectPC,r);case 6:this.disconnectForReconnect(),this.emit(zP.RequestReconnectPC);case 8:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"canPublishLowStream",value:function(){return this.localTrackMap.has(qP.LocalVideoTrack)||this.pendingLocalTracks.some((function(e){return e instanceof Mz}))}},{key:"throwIfTrackTypeNotMatch",value:function(e){if(e.filter((function(e){return e instanceof Mz})).length>1)throw new SD(mD.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS);if(e.filter((function(e){return e instanceof mG})).length>1&&(e.some((function(e){return e instanceof mG&&e._bypassWebAudio}))||!oL().webAudioMediaStreamDest))throw new SD(mD.NOT_SUPPORTED,"cannot publish multiple tracks which one of them configured with bypassWebAudio or your browser doesn't support MediaStreamDestNode");var t,r=K(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;if(n instanceof Mz&&this.pendingLocalTracks.some((function(e){return e instanceof Mz})))throw new SD(mD.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS);if(n instanceof mG&&this.pendingLocalTracks.some((function(e){return e instanceof mG}))&&(!oL().webAudioMediaStreamDest||n._bypassWebAudio||this.pendingLocalTracks.some((function(e){return e instanceof mG&&e._bypassWebAudio}))))throw new SD(mD.NOT_SUPPORTED,"cannot publish multiple tracks which one of them configured with bypassWebAudio or your browser doesn't support MediaStreamDestNode")}}catch(e){r.e(e)}finally{r.f()}}},{key:"getLowVideoTrack",value:function(e,t){var r,n=oL().supportDualStreamEncoding,i=R1(R1({},{width:160,height:120,framerate:15,bitrate:50}),t);r=n?e._mediaStreamTrack.clone():A1(e,i);var o=new Mz(r,R1(R1({},n&&{scaleResolutionDownBy:KG(i,e)}),{},{frameRate:i.framerate,bitrateMax:i.bitrate,bitrateMin:i.bitrate}));return o._hints.push(xP.LOW_STREAM),o}},{key:"globalLock",value:function(){var e=y(G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.mutex.lock("From P2PChannel.globalLock"));case 1:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()}]),r}(yD)).prototype,"startP2PConnection",[D1],Object.getOwnPropertyDescriptor(b1.prototype,"startP2PConnection"),b1.prototype),Ej(b1.prototype,"connect",[D1],Object.getOwnPropertyDescriptor(b1.prototype,"connect"),b1.prototype),Ej(b1.prototype,"unpublish",[D1],Object.getOwnPropertyDescriptor(b1.prototype,"unpublish"),b1.prototype),Ej(b1.prototype,"unpublishLowStream",[D1],Object.getOwnPropertyDescriptor(b1.prototype,"unpublishLowStream"),b1.prototype),Ej(b1.prototype,"subscribe",[D1],Object.getOwnPropertyDescriptor(b1.prototype,"subscribe"),b1.prototype),Ej(b1.prototype,"massSubscribe",[D1],Object.getOwnPropertyDescriptor(b1.prototype,"massSubscribe"),b1.prototype),Ej(b1.prototype,"unsubscribe",[D1],Object.getOwnPropertyDescriptor(b1.prototype,"unsubscribe"),b1.prototype),Ej(b1.prototype,"massUnsubscribe",[D1],Object.getOwnPropertyDescriptor(b1.prototype,"massUnsubscribe"),b1.prototype),Ej(b1.prototype,"muteRemote",[D1],Object.getOwnPropertyDescriptor(b1.prototype,"muteRemote"),b1.prototype),Ej(b1.prototype,"unmuteRemote",[D1],Object.getOwnPropertyDescriptor(b1.prototype,"unmuteRemote"),b1.prototype),Ej(b1.prototype,"hasRemoteMediaWithLock",[D1],Object.getOwnPropertyDescriptor(b1.prototype,"hasRemoteMediaWithLock"),b1.prototype),Ej(b1.prototype,"disconnectForReconnect",[D1],Object.getOwnPropertyDescriptor(b1.prototype,"disconnectForReconnect"),b1.prototype),Ej(b1.prototype,"reEstablish",[D1],Object.getOwnPropertyDescriptor(b1.prototype,"reEstablish"),b1.prototype),Ej(b1.prototype,"updateBitrateLimit",[D1],Object.getOwnPropertyDescriptor(b1.prototype,"updateBitrateLimit"),b1.prototype),S1=b1))||S1;function D1(e,t,r){var n=e[t];if("function"!=typeof n)throw new Error("Cannot use mutex on object property.");return r.value=y(G.mark((function e(){var r,i,o,a,s,c=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.mutex,e.next=3,r.lock("From P2PChannel.".concat(t));case 3:for(i=e.sent,e.prev=4,o=c.length,a=new Array(o),s=0;s<o;s++)a[s]=c[s];return e.next=8,n.apply(this,a);case 8:return e.abrupt("return",e.sent);case 9:return e.prev=9,i(),e.finish(9);case 12:case"end":return e.stop()}}),e,this,[[4,,9,12]])}))),r}function N1(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var x1,P1="function"==typeof Symbol&&Symbol.observable||"@@observable",L1=function(){return Math.random().toString(36).substring(7).split("").join(".")},B1={INIT:"@@redux/INIT"+L1(),REPLACE:"@@redux/REPLACE"+L1(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+L1()}};function M1(e){if("object"!=D(e)||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function U1(e,t,r){var n;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error(N1(0));if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error(N1(1));return r(U1)(e,t)}if("function"!=typeof e)throw new Error(N1(2));var i=e,o=t,a=[],s=a,c=!1;function u(){s===a&&(s=a.slice())}function d(){if(c)throw new Error(N1(3));return o}function l(e){if("function"!=typeof e)throw new Error(N1(4));if(c)throw new Error(N1(5));var t=!0;return u(),s.push(e),function(){if(t){if(c)throw new Error(N1(6));t=!1,u();var r=s.indexOf(e);s.splice(r,1),a=null}}}function p(e){if(!M1(e))throw new Error(N1(7));if(void 0===e.type)throw new Error(N1(8));if(c)throw new Error(N1(9));try{c=!0,o=i(o,e)}finally{c=!1}for(var t=a=s,r=0;r<t.length;r++)(0,t[r])();return e}function f(e){if("function"!=typeof e)throw new Error(N1(10));i=e,p({type:B1.REPLACE})}function h(){var e,t=l;return(e={subscribe:function(e){if("object"!=D(e)||null===e)throw new Error(N1(11));function r(){e.next&&e.next(d())}return r(),{unsubscribe:t(r)}}})[P1]=function(){return this},e}return p({type:B1.INIT}),(n={dispatch:p,subscribe:l,getState:d,replaceReducer:f})[P1]=h,n}function Q1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function F1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Q1(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Q1(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}!function(e){e.SET_SESSION_ID="SET_SESSION_ID",e.SET_P2P_ID="SET_P2P_id",e.SET_UID="SET_UID",e.SET_PUB_ID="SET_PUB_ID",e.KEY_METRIC_CLIENT_CREATED="KEY_METRIC_CLIENT_CREATED",e.KEY_METRIC_JOIN_START="KEY_METRIC_JOIN_START",e.AVOID_JOIN_START="AVOID_JOIN_START",e.KEY_METRIC_JOIN_END="KEY_METRIC_JOIN_END",e.KEY_METRIC_REQUEST_AP_START="KEY_METRIC_REQUEST_AP_START",e.KEY_METRIC_REQUEST_AP_END="KEY_METRIC_REQUEST_AP_END",e.KEY_METRIC_JOIN_GATEWAY_START="KEY_METRIC_JOIN_GATEWAY_START",e.KEY_METRIC_JOIN_GATEWAY_END="KEY_METRIC_JOIN_GATEWAY_END",e.KEY_METRIC_PEER_CONNECTION_START="KEY_METRIC_PEER_CONNECTION_START",e.KEY_METRIC_PEER_CONNECTION_END="KEY_METRIC_PEER_CONNECTION_END",e.KEY_METRIC_PUBLISH="KEY_METRIC_PUBLISH",e.KEY_METRIC_SUBSCRIBE="KEY_METRIC_SUBSCRIBE"}(x1||(x1={}));var j1,V1,G1,K1,H1,W1,Y1,q1,J1,z1,X1=function(){function e(t,r,n,i){U(this,e),rO(this,"store",void 0),rO(this,"reducer",void 0);var o={codec:t,audioCodec:r,mode:n,clientId:i,sessionId:null,p2pId:0,pubId:0,subId:0,avoidJoinStart:0,keyMetrics:{publish:[],subscribe:[]}};this.reducer=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:o,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case x1.SET_SESSION_ID:return F1(F1({},e),{},{sessionId:t.sessionId});case x1.SET_P2P_ID:return F1(F1({},e),{},{p2pId:t.p2pId});case x1.SET_UID:return F1(F1({},e),{},{uid:t.uid});case x1.SET_PUB_ID:return F1(F1({},e),{},{pubId:t.pubId});case x1.KEY_METRIC_CLIENT_CREATED:return F1(F1({},e),{},{keyMetrics:F1(F1({},e.keyMetrics),{},{clientCreated:t.metric})});case x1.KEY_METRIC_JOIN_START:return F1(F1({},e),{},{keyMetrics:F1(F1({},e.keyMetrics),{},{joinStart:t.metric})});case x1.AVOID_JOIN_START:return F1(F1({},e),{},{avoidJoinStart:t.avoidJoinStart});case x1.KEY_METRIC_JOIN_END:return F1(F1({},e),{},{keyMetrics:F1(F1({},e.keyMetrics),{},{joinEnd:t.metric})});case x1.KEY_METRIC_REQUEST_AP_START:return F1(F1({},e),{},{keyMetrics:F1(F1({},e.keyMetrics),{},{requestAPStart:t.metric})});case x1.KEY_METRIC_REQUEST_AP_END:return F1(F1({},e),{},{keyMetrics:F1(F1({},e.keyMetrics),{},{requestAPEnd:t.metric})});case x1.KEY_METRIC_JOIN_GATEWAY_START:return F1(F1({},e),{},{keyMetrics:F1(F1({},e.keyMetrics),{},{joinGatewayStart:t.metric})});case x1.KEY_METRIC_JOIN_GATEWAY_END:return F1(F1({},e),{},{keyMetrics:F1(F1({},e.keyMetrics),{},{joinGatewayEnd:t.metric})});case x1.KEY_METRIC_PEER_CONNECTION_START:return F1(F1({},e),{},{keyMetrics:F1(F1({},e.keyMetrics),{},{peerConnectionStart:t.metric})});case x1.KEY_METRIC_PEER_CONNECTION_END:return F1(F1({},e),{},{keyMetrics:F1(F1({},e.keyMetrics),{},{peerConnectionEnd:t.metric})});case x1.KEY_METRIC_PUBLISH:var r=e.keyMetrics.publish,n=r.findIndex((function(e){return e.trackId===t.metric.trackId}));return-1!==n?(r[n]=F1(F1({},r[n]),t.metric),F1(F1({},e),{},{keyMetrics:F1(F1({},e.keyMetrics),{},{publish:M(r)})})):F1(F1({},e),{},{keyMetrics:F1(F1({},e.keyMetrics),{},{publish:[].concat(M(e.keyMetrics.publish),[t.metric])})});case x1.KEY_METRIC_SUBSCRIBE:var i=e.keyMetrics.subscribe,a=i.findIndex((function(e){return e.userId===t.metric.userId&&e.type===t.metric.type}));return-1!==a?(i[a]=F1(F1({},i[a]),t.metric),F1(F1({},e),{},{keyMetrics:F1(F1({},e.keyMetrics),{},{subscribe:M(i)})})):F1(F1({},e),{},{keyMetrics:F1(F1({},e.keyMetrics),{},{subscribe:[].concat(M(e.keyMetrics.subscribe),[t.metric])})});default:return e}},this.store=U1(this.reducer)}return F(e,[{key:"sessionId",get:function(){return this.store.getState().sessionId},set:function(e){this.store.dispatch({type:x1.SET_SESSION_ID,sessionId:e})}},{key:"codec",get:function(){return this.store.getState().codec}},{key:"audioCodec",get:function(){return this.store.getState().audioCodec}},{key:"clientId",get:function(){return this.store.getState().clientId}},{key:"p2pId",get:function(){return this.store.getState().p2pId},set:function(e){this.store.dispatch({type:x1.SET_P2P_ID,p2pId:e})}},{key:"uid",get:function(){return this.store.getState().uid},set:function(e){this.store.dispatch({type:x1.SET_UID,uid:e})}},{key:"pubId",get:function(){return this.store.getState().pubId},set:function(e){this.store.dispatch({type:x1.SET_PUB_ID,pubId:e})}},{key:"clientCreated",value:function(){this.store.dispatch({type:x1.KEY_METRIC_CLIENT_CREATED,metric:performance.now()})}},{key:"joinStart",value:function(){this.store.dispatch({type:x1.KEY_METRIC_JOIN_START,metric:performance.now()})}},{key:"avoidJoinStart",get:function(){return this.store.getState().avoidJoinStart},set:function(e){this.store.dispatch({type:x1.AVOID_JOIN_START,avoidJoinStart:e})}},{key:"joinEnd",value:function(){this.store.dispatch({type:x1.KEY_METRIC_JOIN_END,metric:performance.now()})}},{key:"requestAPStart",value:function(){this.store.dispatch({type:x1.KEY_METRIC_REQUEST_AP_START,metric:performance.now()})}},{key:"requestAPEnd",value:function(){this.store.dispatch({type:x1.KEY_METRIC_REQUEST_AP_END,metric:performance.now()})}},{key:"joinGatewayStart",value:function(){this.store.dispatch({type:x1.KEY_METRIC_JOIN_GATEWAY_START,metric:performance.now()})}},{key:"joinGatewayEnd",value:function(){this.store.dispatch({type:x1.KEY_METRIC_JOIN_GATEWAY_END,metric:performance.now()})}},{key:"peerConnectionStart",value:function(){this.store.dispatch({type:x1.KEY_METRIC_PEER_CONNECTION_START,metric:performance.now()})}},{key:"peerConnectionEnd",value:function(){this.store.dispatch({type:x1.KEY_METRIC_PEER_CONNECTION_END,metric:performance.now()})}},{key:"publish",value:function(e,t,r,n){this.store.dispatch({type:x1.KEY_METRIC_PUBLISH,metric:F1(F1({trackId:e,type:t},r&&{publishStart:r}),n&&{publishEnd:n})})}},{key:"subscribe",value:function(e,t,r,n,i){this.store.dispatch({type:x1.KEY_METRIC_SUBSCRIBE,metric:F1(F1(F1({userId:e,type:t},r&&{subscribeStart:r}),n&&{subscribeEnd:n}),i&&{firstFrame:i})})}},{key:"massSubscribe",value:function(e,t,r,n){var i=this;e.forEach((function(e){i.store.dispatch({type:x1.KEY_METRIC_SUBSCRIBE,metric:F1(F1(F1({userId:e.userId,type:e.type},t&&{subscribeStart:t}),r&&{subscribeEnd:r}),n&&{firstFrame:n})})}))}},{key:"keyMetrics",get:function(){return this.store.getState().keyMetrics}}]),e}(),Z1=function(){return"HTTPS"===(j1||j1||(j1=(window.location.protocol.split(":")[0]||"").toUpperCase()))},$1=function(){return void 0!==window.isSecureContext},e0=function(){function e(t,r){U(this,e),rO(this,"time",void 0),rO(this,"sequence",void 0),rO(this,"name",void 0),rO(this,"elapse",void 0),this.name=t,this.time=performance.now(),this.sequence=nL[r].indexOf(t)}return F(e,[{key:"setElapse",value:function(e){this.elapse=e}}]),e}(),t0=new Map,r0=function(){function e(t,r){U(this,e),rO(this,"records",[]),rO(this,"_id",void 0),rO(this,"_group",void 0),rO(this,"_localTimeStamp",void 0),rO(this,"_performanceTimeStamp",void 0),this._id=t,this._group=r,this._localTimeStamp=Date.now(),this._performanceTimeStamp=performance.now()}return F(e,[{key:"checkPoint",value:function(e){var t=new e0(e,this._group);-1===t.sequence&&ND.warning("[".concat(this._id,"] check point record failed, cannot get the sequence")),this.records.push(t);var r=this.records.find((function(e){return e.sequence===t.sequence-1}));r&&t.setElapse(t.time-r.time)}},{key:"getRecord",value:function(e){return this.records.find((function(t){return t&&t.name===e}))}},{key:"resetRecords",value:function(){this.records.length=0}}]),e}();function n0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i0(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n0(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n0(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var o0=(V1=tN("AgoraRTCClient","store.clientId"),G1=qj({report:zj}),K1=qj(),H1=qj({report:zj}),W1=Jj(),Y1=qj({report:zj}),q1=Jj({report:zj}),V1((Ej((z1=function(e){k(r,e);var t=W(r);function r(e){var n,i;if(U(this,r),n=t.call(this),rO(S(n),"store",void 0),rO(S(n),"_uid",void 0),rO(S(n),"_channelName",void 0),rO(S(n),"_uintUid",void 0),rO(S(n),"_users",[]),rO(S(n),"_codec",void 0),rO(S(n),"_mode",void 0),rO(S(n),"_config",void 0),rO(S(n),"_clientId",void 0),rO(S(n),"_appId",void 0),rO(S(n),"_sessionId",null),rO(S(n),"_key",void 0),rO(S(n),"_joinInfo",void 0),rO(S(n),"_gateway",void 0),rO(S(n),"_statsCollector",void 0),rO(S(n),"_configDistribute",void 0),rO(S(n),"_leaveMutex",new rV("client-leave")),rO(S(n),"_publishMutex",new rV("client-publish")),rO(S(n),"_renewTokenMutex",new rV("client-renewtoken")),rO(S(n),"_subscribeMutex",new rV("client-subscribe")),rO(S(n),"_encryptionMode","none"),rO(S(n),"_encryptionSecret",null),rO(S(n),"_encryptionSalt",null),rO(S(n),"_proxyServer",void 0),rO(S(n),"_performanceRecorder",void 0),rO(S(n),"_turnServer",{servers:[],mode:"auto"}),rO(S(n),"_cloudProxyServerMode","disabled"),rO(S(n),"_isDualStreamEnabled",!1),rO(S(n),"_defaultStreamFallbackType",void 0),rO(S(n),"_lowStreamParameter",void 0),rO(S(n),"_streamFallbackTypeCacheMap",new Map),rO(S(n),"_remoteStreamTypeCacheMap",new Map),rO(S(n),"_axiosCancelSource",ED.CancelToken.source()),rO(S(n),"_audioVolumeIndicationInterval",void 0),rO(S(n),"_networkQualityInterval",void 0),rO(S(n),"_userOfflineTimeout",void 0),rO(S(n),"_streamRemovedTimeout",void 0),rO(S(n),"_injectStreamingClient",void 0),rO(S(n),"_liveTranscodeStreamingClient",void 0),rO(S(n),"_liveRawStreamingClient",void 0),rO(S(n),"_channelMediaRelayClient",void 0),rO(S(n),"_networkQualitySensitivity","normal"),rO(S(n),"_p2pChannel",void 0),rO(S(n),"_useLocalAccessPoint",!1),rO(S(n),"_joinAndNotLeaveYet",!1),rO(S(n),"_numberOfJoinCount",0),rO(S(n),"_remoteDefaultVideoStreamType",void 0),rO(S(n),"_handleLocalTrackEnable",(function(e,t,r){n.publish(e,!1).then(t).catch(r)})),rO(S(n),"_handleLocalTrackDisable",(function(e,t,r){n.unpublish(e).then(t).catch(r)})),rO(S(n),"_handleUserOnline",(function(e){n.isStringUID&&"string"!=typeof e.uid&&(ND.error("[".concat(n._clientId,"] StringUID is Mixed with UintUID")),qD("error",S(n),"StringUID is Mixed with UintUID"));var t=n._users.find((function(t){return t.uid===e.uid}));if(t)t._trust_in_room_=!0;else{var r=new jz(e.uid,e.uint_id||e.uid);n._users.push(r),ND.debug("[".concat(n._clientId,"] user online"),e.uid),zD("info",S(n),"user-joined",{uid:e.uid}),n.emit(Jx.USER_JOINED,r)}})),rO(S(n),"_handleUserOffline",(function(e){var t=n._users.find((function(t){return t.uid===e.uid}));t&&(n._handleRemoveStream(e),aK(n._users,t),n._remoteStreamTypeCacheMap.delete(t.uid),n._streamFallbackTypeCacheMap.delete(t.uid),ND.debug("[".concat(n._clientId,"] user offline"),e.uid,"reason:",e.reason),zD("info",S(n),"user-left",{reason:e.reason,uid:e.uid}),n.emit(Jx.USER_LEAVED,t,e.reason))})),rO(S(n),"_handleAddAudioOrVideoStream",(function(e,t,r,i,o,a,s){var c=n._users.find((function(e){return e.uid===t}));if(!c)return ND.error("[".concat(n._clientId,"] can not find target user!(on_add_stream)")),void JD("error",["AgoraRTCGateway",n._clientId],"add_".concat(e,"_stream"),"can not find target user!");ND.debug("[".concat(n._clientId,"] stream added with uid ").concat(t,", type ").concat(e)),JD("debug",["AgoraRTCGateway",n._clientId],"add_".concat(e,"_stream"),{uid:t,mediaType:e});var u="audio"===e?c.hasAudio:c.hasVideo;c._uintid||(c._uintid=o||t),c._trust_stream_added_state_=!0,"audio"===e?(c._audio_added_=!0,void 0!==r&&(c._audioSSRC=r),void 0!==i&&(c._cname=i),a&&(c._audioOrtc=a)):(c._video_added_=!0,void 0!==r&&(c._videoSSRC=r),void 0!==i&&(c._cname=i),void 0!==s&&(c._rtxSsrcId=s),a&&(c._videoOrtc=a)),("audio"===e?c.hasAudio:c.hasVideo)&&!u&&(ND.info("[".concat(n._clientId,"] remote user ").concat(c.uid," published ").concat(e)),qD("info",S(n),"remote user ".concat(c.uid," published ").concat(e)),zD("info",S(n),"user-published",{uid:c.uid,mediaType:e}),n.emit(Jx.USER_PUBLISHED,c,e)),"video"===e?zj.onGatewayStream(n._sessionId,Lx.ON_ADD_VIDEO_STREAM,Bx.ON_ADD_VIDEO_STREAM,{peer:o||t}):zj.onGatewayStream(n._sessionId,Lx.ON_ADD_AUDIO_STREAM,Bx.ON_ADD_AUDIO_STREAM,{peer:o||t}),n._p2pChannel.hasPendingRemoteMedia(c,e)&&n.subscribe(c,e).catch((function(e){ND.error("[".concat(n._clientId,"] resubscribe error"),e.toString()),qD("error",S(n),"resubscribe error: ".concat(e.toString()))}))})),rO(S(n),"_handleRemoveStream",(function(e){var t=n._users.find((function(t){return t.uid===e.uid}));if(!t)return ND.warning("[".concat(n._clientId,"] can not find target user!(on_remove_stream)")),void JD("warning",["AgoraRTCGateway",n._clientId],"remove_stream",{uid:e.uid,info:"can not find target user!"});ND.debug("[".concat(n._clientId,"] stream removed with uid ").concat(e.uid)),JD("debug",["AgoraRTCGateway",n._clientId],"remove_stream",{uid:e.uid});var r=function(){};t.hasAudio&&t.hasVideo?r=function(){ND.info("[".concat(n._clientId,"] remote user ").concat(t.uid," unpublished audio track")),zD("info",S(n),"user-unpublished",{uid:t.uid,mediaType:"audio"}),n.emit(Jx.USER_UNPUBLISHED,t,"audio"),ND.info("[".concat(n._clientId,"] remote user ").concat(t.uid," unpublished video track")),zD("info",S(n),"user-unpublished",{uid:t.uid,mediaType:"video"}),n.emit(Jx.USER_UNPUBLISHED,t,"video")}:t.hasVideo?r=function(){ND.info("[".concat(n._clientId,"] remote user ").concat(t.uid," unpublished video track")),zD("info",S(n),"user-unpublished",{uid:t.uid,mediaType:"video"}),n.emit(Jx.USER_UNPUBLISHED,t,"video")}:t.hasAudio&&(r=function(){ND.info("[".concat(n._clientId,"] remote user ").concat(t.uid," unpublished audio track")),zD("info",S(n),"user-unpublished",{uid:t.uid,mediaType:"audio"}),n.emit(Jx.USER_UNPUBLISHED,t,"audio")}),t._trust_stream_added_state_=!0,t._audio_added_=!1,t._video_added_=!1,n._p2pChannel.unsubscribe(t).then((function(e){if(e)return n._gateway.unsubscribe(e,t.uid)})),t._audioSSRC=void 0,t._videoSSRC=void 0,t._audioOrtc=void 0,t._videoOrtc=void 0,t._rtxSsrcId=void 0,zj.onGatewayStream(n._sessionId,Lx.ON_REMOVE_STREAM,Bx.ON_REMOVE_STREAM,{peer:e.uint_id||e.uid}),r()})),rO(S(n),"_handleSetStreamLocalEnable",(function(e,t,r){var i=n._users.find((function(e){return e.uid===t}));if(!i)return ND.error("[".concat(n._clientId,"] can not find target user!(disable_local)")),void JD("error",S(n),"disable_local_video","can not find target user!(disable_local)");ND.debug("[".concat(n._clientId,"] local ").concat(e," ").concat(r?"enabled":"disabled"," with uid ").concat(t)),JD("debug",S(n),"disable_local_video","local ".concat(e," ").concat(r?"enabled":"disabled"," with uid ").concat(t));var o="audio"===e?i.hasAudio:i.hasVideo;if("audio"===e){i._trust_audio_enabled_state_=!0;var a=i._audio_enabled_;if(i._audio_enabled_=r,i._audio_enabled_===a)return;var s=i._audio_enabled_?"enable-local-audio":"disable-local-audio";ND.debug("[".concat(n._clientId,"] user-info-updated, uid: ").concat(t,", msg: ").concat(s)),eN("debug",S(n),"user-info-updated",{uid:t,msg:s}),n.emit(Jx.USER_INFO_UPDATED,t,s)}else{i._trust_video_enabled_state_=!0;var c=i._video_enabled_;if(i._video_enabled_=r,i._video_enabled_===c)return;var u=i._video_enabled_?"enable-local-video":"disable-local-video";ND.debug("[".concat(n._clientId,"] user-info-update, uid: ").concat(t,", msg: ").concat(u)),eN("debug",S(n),"user-info-updated",{uid:t,msg:u}),n.emit(Jx.USER_INFO_UPDATED,t,u)}var d="audio"===e?i.hasAudio:i.hasVideo;return o!==d?!o&&d?(ND.info("[".concat(n._clientId,"] remote user ").concat(t," published ").concat(e)),zD("info",S(n),"user-published",{uid:t,mediaType:e}),void n.emit(Jx.USER_PUBLISHED,i,e)):("video"===e&&i._videoTrack&&i._videoTrack._destroy(),"audio"===e&&i._audioTrack,n._p2pChannel.muteRemote(i,e),ND.info("[".concat(n._clientId,"] remote user ").concat(t," unpublished ").concat(e)),zD("info",S(n),"user-unpublished",{uid:t,mediaType:e}),void n.emit(Jx.USER_UNPUBLISHED,i,e)):void 0})),rO(S(n),"_handleMuteStream",(function(e,t,r){ND.debug("[".concat(n._clientId,"] receive mute message"),e,t,r),JD("debug",S(n),"mute_".concat(t),r);var i=n._users.find((function(t){return t.uid===e}));if(!i)return ND.warning("[".concat(n._clientId,"] can not find remote user, ignore mute event, uid: ").concat(e)),void JD("warning",S(n),"mute_".concat(t),"can not find remote user, ignore mute event, uid: ".concat(e));var o="audio"===t?i.hasAudio:i.hasVideo;if("audio"===t){i._trust_audio_mute_state_=!0;var a=i._audio_muted_;if(i._audio_muted_=r,i._audio_muted_===a)return;var s=i._audio_muted_?"mute-audio":"unmute-audio";ND.debug("[".concat(n._clientId,"] user-info-update, uid: ").concat(e,", msg: ").concat(s)),eN("debug",S(n),"user-info-updated",{uid:e,msg:s}),n.emit(Jx.USER_INFO_UPDATED,e,s)}else{i._trust_video_mute_state_=!0;var c=i._video_muted_;if(i._video_muted_=r,i._video_muted_===c)return;var u=i._video_muted_?"mute-video":"unmute-video";ND.debug("[".concat(n._clientId,"] user-info-update, uid: ").concat(e,", msg: ").concat(u)),eN("debug",S(n),"user-info-updated",{uid:e,msg:u}),n.emit(Jx.USER_INFO_UPDATED,e,u)}var d="audio"===t?i.hasAudio:i.hasVideo;return o!==d?!o&&d?(ND.info("[".concat(n._clientId,"] remote user ").concat(e," published ").concat(t)),zD("info",S(n),"user-published",{uid:i.uid,mediaType:t}),void n.emit(Jx.USER_PUBLISHED,i,t)):("video"===t&&i._videoTrack&&i._videoTrack._destroy(),"audio"===t&&i._audioTrack,n._p2pChannel.muteRemote(i,t),ND.info("[".concat(n._clientId,"] remote user ").concat(e," unpublished ").concat(t)),zD("info",S(n),"user-unpublished",{uid:e,mediaType:t}),void n.emit(Jx.USER_UNPUBLISHED,i,t)):void 0})),rO(S(n),"_handleP2PLost",function(){var e=y(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ND.debug("[".concat(n._clientId,"] receive p2p lost"),t),JD("debug",S(n),"p2p_lost",t),parseInt(t.p2pid,10)===n.store.p2pId){e.next=2;break}return e.abrupt("return",(ND.warning("P2PLost stream not found",t),void JD("warning",S(n),"p2p_lost","P2PLost stream not found, ".concat(t))));case 2:return e.next=4,n._p2pChannel.requestReconnect();case 4:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),rO(S(n),"_handleTokenWillExpire",(function(){ND.debug("[".concat(n._clientId,"] received message onTokenPrivilegeWillExpire")),JD("debug",S(n),"token_privilege_will_expire"),n.emit(Jx.ON_TOKEN_PRIVILEGE_WILL_EXPIRE)})),rO(S(n),"_handleBeforeUnload",(function(e){"beforeunload"===e.type&&void 0!==e.returnValue&&""!==e.returnValue||(n.leave(),ND.info("[".concat(n._clientId,"] auto leave onbeforeunload or pagehide")),XD("info",["window",n.store.clientId],Mk()?"beforeunload":"pagehide"))})),rO(S(n),"_handleUpdateNetworkQuality",(function(){if("normal"!==n._networkQualitySensitivity)if(!navigator||void 0===navigator.onLine||navigator.onLine){var e={downlinkNetworkQuality:0,uplinkNetworkQuality:0};e.uplinkNetworkQuality=n._p2pChannel.getUplinkNetworkQuality(),e.downlinkNetworkQuality=n._p2pChannel.getDownlinkNetworkQuality(),n.emit(Jx.NETWORK_QUALITY,e)}else n.emit(Jx.NETWORK_QUALITY,{downlinkNetworkQuality:6,uplinkNetworkQuality:6})})),n._codec=e.codec,n._mode=e.mode,n._clientId=XG(5,"client-"),n.store=new X1(e.codec,e.audioCodec,e.mode,n._clientId),n.store.clientCreated(),e.proxyServer&&n.setProxyServer(e.proxyServer,!0),e.turnServer&&n.setTurnServer(e.turnServer,!0),ND.info("[".concat(n._clientId,"] Initializing AgoraRTC client v").concat(oN," build: ").concat(iN,", mode: ").concat(n._mode,", codec: ").concat(n._codec)),eN("info",S(n),"constructor",{version:oN,build:iN,mode:n._mode,codec:n._codec}),n._performanceRecorder=function(e,t){var r=new r0(e,"join");return t0.set(e,r),r}(n._clientId),e.clientRoleOptions)try{uP(e.clientRoleOptions),i=Object.assign({},e.clientRoleOptions)}catch(e){ND.warning("[".concat(n._clientId,"] ").concat(e.toString())),qD("warning",S(n),e.toString())}return n._statsCollector=new kG(n.store),n._statsCollector.onStatsException=function(e,t,r){ND.debug("[".concat(n._clientId,"] receive exception msg, code: ").concat(e,", msg: ").concat(t,", uid: ").concat(r)),zD("debug",S(n),Jx.EXCEPTION,{code:e,message:t,uid:r}),n.emit(Jx.EXCEPTION,{code:e,msg:t,uid:r})},n._statsCollector.onUploadPublishDuration=function(e,t,r,i){var o=n._users.find((function(t){return t.uid===e}));o&&zj.peerPublishStatus(n._sessionId,{subscribeElapse:i,audioPublishDuration:t,videoPublishDuration:r,peer:o._uintid})},n._gateway=new Mq(n.store,{clientId:n._clientId,mode:n._mode,codec:n._codec,websocketRetryConfig:e.websocketRetryConfig||bD,httpRetryConfig:e.httpRetryConfig||bD,forceWaitGatewayResponse:void 0===e.forceWaitGatewayResponse||e.forceWaitGatewayResponse,statsCollector:n._statsCollector,role:e.role,clientRoleOptions:i}),n._config=e,n._configDistribute=new SJ,n._p2pChannel=new O1(n.store,n._statsCollector),n._handleP2PChannelEvents(),n._handleGatewayEvents(),x(n)}return F(r,[{key:"connectionState",get:function(){return this._gateway.state}},{key:"remoteUsers",get:function(){return this._users}},{key:"localTracks",get:function(){return this._p2pChannel.getAllTracks(!0)}},{key:"uid",get:function(){return this._uid}},{key:"channelName",get:function(){return this._channelName}},{key:"isStringUID",get:function(){return!!this._joinInfo&&!!this._joinInfo.stringUid}},{key:"join",value:function(){var e=y(G.mark((function e(t,r,n,i,o){var a,s,c,u,d,l,p,f,h,A,v,g,m,E,_,I,S,b,C=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=++this._numberOfJoinCount,this._performanceRecorder.checkPoint("startJoin"),this.store.joinStart(),s=Z1(),c=$1()?window.isSecureContext:"Browser Not Support",($1()||s)&&window.isSecureContext||(u="The website must be running in a secure context (About secure context: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts ), otherwise the media collection will be restricted by the browser",ND.warning(u),ZD("warning",this,u)),d=ZG(),"DISCONNECTED"===this.connectionState&&(this.store.avoidJoinStart=Math.round(Date.now()),ND.debug("[".concat(this._clientId,"] set avoidJoinStart to ").concat(this.store.avoidJoinStart)),ZD("debug",this,"join",void 0,"[".concat(this._clientId,"] set avoidJoinStart to ").concat(this.store.avoidJoinStart))),l=zj.reportApiInvoke(d,{name:Ux.JOIN,options:[t,r,n,i],states:{isHttps:s,isSecureContext:c},tag:Qx.TRACER}),e.prev=7,n||null===n){e.next=10;break}throw new SD(mD.INVALID_PARAMS,"Invalid token: ".concat(n,". If you don not use token, set it to null"));case 10:n&&Cx(n,"token",1,2047),Cx(t,"appid",1,2047),Rx(r),i&&Tx(i),o&&Cx(o,"optionalInfo",1,2047),e.next=16;break;case 13:throw e.prev=13,e.t0=e.catch(7),l.onError(e.t0),e.t0;case 16:if(ND.info("[".concat(this._clientId,"] start join channel ").concat(r,", join number: ").concat(a)),eN("info",this,"join",{channel:r}),!this._leaveMutex.isLocked){e.next=24;break}return ND.debug("[".concat(this._clientId,"] join: waiting leave operation")),qD("debug",this,"join: waiting leave operation"),e.next=20,this._leaveMutex.lock();case 20:e.t1=e.sent,(0,e.t1)(),ND.debug("[".concat(this._clientId,"] join: continue")),qD("debug",this,"join: continue");case 24:if(this._joinAndNotLeaveYet=!0,"DISCONNECTED"===this.connectionState){e.next=27;break}throw p=new SD(mD.INVALID_OPERATION,"[".concat(this._clientId,"] Client already in connecting/connected state")),l.onError(p),p;case 27:if(this._sessionId||(this._sessionId=d,this.store.sessionId=this._sessionId),this._gateway.state="CONNECTING",f=i0({clientId:this._clientId,appId:t,sid:this._sessionId,cname:r,uid:"string"!=typeof i?i:null,turnServer:this._turnServer,proxyServer:this._proxyServer,token:n||t,cloudProxyServer:this._cloudProxyServerMode,optionalInfo:o,useLocalAccessPoint:this._useLocalAccessPoint},void 0!==this._remoteDefaultVideoStreamType&&{defaultVideoStream:this._remoteDefaultVideoStreamType}),"string"==typeof i&&(f.stringUid=i,this._uintUid?(f.uid=this._uintUid,this._uintUid=void 0):f.uid=0),"none"===this._encryptionMode||!this._encryptionSecret){e.next=37;break}return f.aesmode=this._encryptionMode,e.next=33,function(){var e=y(G.mark((function e(t){var r,n,i,o;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=pK("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCMnXAHkKIGAM+x4N22gCI+Wyu\nSTM9ztkT3uYslTT2PuKmZfPzhH6kVdO7PTjGCOZnAsyb3oTtWat0KcxQ4jxvqQV+\nHvYl3iI1Yd4vl2c3qRMJPLtRDfNxa2Mcxgq7e9aEUibzdd0st+OJAy3tOj/Y0aVy\nxQiYDz3vqa6bP29adwIDAQAB"),e.next=3,window.crypto.subtle.importKey("spki",r,{name:"RSA-OAEP",hash:"SHA-256"},!0,["encrypt"]);case 3:return n=e.sent,i=OG(t),e.next=7,window.crypto.subtle.encrypt({name:"RSA-OAEP"},n,i);case 7:return o=e.sent,e.abrupt("return",fK(new Uint8Array(o)));case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()(this._encryptionSecret);case 33:if(f.aespassword=e.sent,this._joinAndNotLeaveYet){e.next=36;break}throw new SD(mD.INVALID_OPERATION,"[".concat(this._clientId,"] Client already left"));case 36:this._encryptionSalt&&(f.aessalt=this._encryptionSalt);case 37:if(this._startSession(this._sessionId,{channel:r,appId:t}),h=this._sessionId,setTimeout((function(){"CONNECTING"===C.connectionState&&h===C._sessionId&&zj.joinChannelTimeout(C._sessionId,5)}),5e3),e.prev=40,"443only"===(v=f.cloudProxyServer)?f.proxyServer=gN("PROXY_SERVER_TYPE2"):["proxy3","proxy4","proxy5"].includes(v)&&(g=gN("PROXY_SERVER_TYPE3"),Array.isArray(g)?f.proxyServer=g[0]:f.proxyServer=g),zj.setProxyServer(f.proxyServer),ND.setProxyServer(f.proxyServer),YD(f.proxyServer),this._performanceRecorder.checkPoint("startRequestAp"),this.store.requestAPStart(),!f.stringUid||f.uid||"normal"!==v){e.next=57;break}return e.next=46,oJ(f,this._axiosCancelSource.token,this._config.httpRetryConfig||bD,!1);case 46:return e.next=48,sJ(f.stringUid,f,this._axiosCancelSource.token,this._config.httpRetryConfig||bD);case 48:return m=e.sent,ND.debug("getUserAccount Success ".concat(f.stringUid," => ").concat(m)),qD("debug",this,"getUserAccount Success ".concat(f.stringUid," => ").concat(m)),f.uid=m,e.next=54,nJ(f,this._axiosCancelSource.token,this._config.httpRetryConfig||bD);case 54:A=e.sent,e.next=72;break;case 57:if(!f.stringUid||f.uid){e.next=69;break}return e.next=60,sJ(f.stringUid,f,this._axiosCancelSource.token,this._config.httpRetryConfig||bD);case 60:return E=e.sent,ND.debug("getUserAccount Success ".concat(f.stringUid," => ").concat(E)),qD("debug",this,"getUserAccount Success ".concat(f.stringUid," => ").concat(E)),f.uid=E,e.next=66,oJ(f,this._axiosCancelSource.token,this._config.httpRetryConfig||bD,!0);case 66:A=e.sent,e.next=72;break;case 69:return e.next=71,oJ(f,this._axiosCancelSource.token,this._config.httpRetryConfig||bD,!0);case 71:A=e.sent;case 72:if(this._joinAndNotLeaveYet){e.next=74;break}throw new SD(mD.INVALID_OPERATION,"[".concat(this._clientId,"] Client already left"));case 74:return this.store.requestAPEnd(),this._performanceRecorder.checkPoint("startJoinGateway"),setTimeout((function(){C._configDistribute.startGetConfigDistribute(f,C._axiosCancelSource.token),C._configDistribute.on(HP.UPDATE_BITRATE_LIMIT,(function(e){C._p2pChannel.updateBitrateLimit(e)}))}),0),this._key=n||t,_=A.gatewayInfo,this._joinInfo=i0(i0({},f),{},{cid:_.cid,uid:f.uid?f.uid:_.uid,vid:_.vid,apResponse:_.res,uni_lbs_ip:_.uni_lbs_ip,gatewayAddrs:_.gatewayAddrs}),e.next=79,this._joinGateway();case 79:if(I=e.sent,this._joinAndNotLeaveYet){e.next=82;break}throw new SD(mD.INVALID_OPERATION,"[".concat(this._clientId,"] Client already left"));case 82:return e.abrupt("return",(l.onSuccess(I),this._appId=t,this._channelName=f.cname,this._uid=I,this.store.uid=I,setTimeout((function(){C._networkQualityInterval&&window.clearInterval(C._networkQualityInterval),C._networkQualityInterval=window.setInterval(C._handleUpdateNetworkQuality,2e3),window.addEventListener(Mk()?"beforeunload":"pagehide",C._handleBeforeUnload)}),0),ND.info("[".concat(this._clientId,"] Joining channel success: ").concat(r)),eN("info",this,"join",r,"success"),setTimeout((function(){gN("USE_NEW_LOG")?rN():ND.startUpload()}),5e3),this._performanceRecorder.checkPoint("finishJoin"),this.store.joinEnd(),b=this,CN.includes(b)||CN.push(b),I));case 85:throw e.prev=85,e.t2=e.catch(40),S=Array.isArray(e.t2)?e.t2[0]:e.t2,ND.error("[".concat(this._clientId,"] join number: ").concat(a,", Joining channel failed, rollback"),S),eN("error",this,"join",r,S.toString()),S.code!==mD.OPERATION_ABORTED&&this._numberOfJoinCount===a&&(this._gateway.state="DISCONNECTED",this._reset()),l.onError(S),S;case 89:case"end":return e.stop()}}),e,this,[[7,13],[40,85]])})));function t(t,r,n,i,o){return e.apply(this,arguments)}return t}()},{key:"_joinGateway",value:function(){var e=this;if(!this._joinInfo||!this._key)throw new SD(mD.INVALID_OPERATION);return this._gateway.join(this._joinInfo,this._key,!("disabled"!==this._joinInfo.cloudProxyServer||!gN("JOIN_WITH_FALLBACK_SIGNAL_PROXY"))).then((function(e){return e})).catch((function(t){if(t.code===mD.INIT_WEBSOCKET_TIMEOUT)return e._gateway.leave(!0,qx.FALLBACK);throw t})).then((function(t){if(t)return t;if(ND.info("[".concat(e._clientId,"] join timeout, fallback to proxy")),!e._joinInfo||!e._key)throw new SD(mD.INVALID_OPERATION);e._joinInfo.cloudProxyServer="fallback",e._cloudProxyServerMode="fallback";var r=gN("PROXY_SERVER_TYPE3");if(Array.isArray(r))if(e._joinInfo.apUrl){var n=new cq(e._joinInfo.apUrl).host.split("."),i=n.slice(n.length-2).join(".");r.forEach((function(t){e._joinInfo&&t.includes(i)&&(e._joinInfo.proxyServer=t)})),e._joinInfo.proxyServer||(e._joinInfo.proxyServer=r[0])}else e._joinInfo.proxyServer=r[0];else e._joinInfo.proxyServer=r;return ND.setProxyServer(e._joinInfo.proxyServer),zj.setProxyServer(e._joinInfo.proxyServer),YD(e._joinInfo.proxyServer),zj.reportApiInvoke(e._sessionId,{name:Ux.JOIN_FALLBACK_TO_PROXY,options:[e._joinInfo.proxyServer],tag:Qx.TRACER}).onSuccess(),e.emit(Jx.JOIN_FALLBACK_TO_PROXY,e._joinInfo.proxyServer),e._gateway.join(e._joinInfo,e._key)})).then((function(e){return e}))}},{key:"leave",value:function(){var e=y(G.mark((function e(){var t,r;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=zj.reportApiInvoke(this._sessionId,{name:Ux.LEAVE,options:[],tag:Qx.TRACER}),ND.info("[".concat(this._clientId,"] Leaving channel")),eN("info",this,"leave"),window.removeEventListener(Mk()?"beforeunload":"pagehide",this._handleBeforeUnload),this._reset(),function(e){var t=CN.indexOf(e);-1!==t&&CN.splice(t,1)}(this),e.next=4,this._leaveMutex.lock();case 4:if(r=e.sent,"DISCONNECTED"!==this.connectionState){e.next=7;break}return e.abrupt("return",(ND.info("[".concat(this._clientId,"] Leaving channel repeated, success")),r(),t.onSuccess()));case 7:return e.next=9,this._gateway.leave("CONNECTED"!==this.connectionState);case 9:ND.info("[".concat(this._clientId,"] Leaving channel success")),eN("info",this,"leave",void 0,"success"),this._joinAndNotLeaveYet=!1,r(),t.onSuccess();case 14:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"publish",value:function(){var e=y(G.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p=this,f=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=!(f.length>1&&void 0!==f[1])||f[1],Array.isArray(t)||(t=[t]),n=zj.reportApiInvoke(this._sessionId,{name:Ux.PUBLISH,options:t.map((function(e){return e?Object(e).toString():"null"})),tag:Qx.TRACER}),0!==t.length){e.next=6;break}return i=new SD(mD.INVALID_PARAMS,"track list is empty"),e.abrupt("return",(n.onError(i),i.throw()));case 6:if("audience"!==this._gateway.role){e.next=9;break}return o=new SD(mD.INVALID_OPERATION,"audience can not publish stream"),e.abrupt("return",(n.onError(o),o.throw()));case 9:a=K(t),e.prev=10,a.s();case 12:if((s=a.n()).done){e.next=22;break}if((c=s.value)instanceof iV){e.next=17;break}return u=new SD(mD.INVALID_PARAMS,"parameter is not local track"),e.abrupt("return",(n.onError(u),u.throw()));case 17:if(c._enabled||!r){e.next=20;break}return d=new SD(mD.TRACK_IS_DISABLED,"can not publish a disabled track: ".concat(c.getTrackId())),e.abrupt("return",(n.onError(d),d.throw()));case 20:e.next=12;break;case 22:e.next=27;break;case 24:e.prev=24,e.t0=e.catch(10),a.e(e.t0);case 27:return e.prev=27,a.f(),e.finish(27);case 30:return ND.info("[".concat(this._clientId,"] Publishing tracks, id ").concat(t.map((function(e){return"".concat(e.getTrackId()," ")})))),eN("info",this,"publish",t.map((function(e){return"".concat(e.getTrackId())}))),e.next=34,this._configDistribute.awaitConfigDistributeComplete();case 34:return r&&t.forEach((function(e){var t=p._configDistribute.getBitrateLimit();e instanceof Mz&&t&&e.setBitrateLimit(t.uplink)})),e.next=37,this._publishMutex.lock();case 37:return l=e.sent,e.prev=38,e.next=41,this._publishHighStream(t);case 41:n.onSuccess(t.map((function(e){return e.trackMediaType+":"+e.getTrackLabel()})).toString()),ND.info("[".concat(this._clientId,"] Publish success, id ").concat(t.map((function(e){return"".concat(e.getTrackId()," ")})))),eN("info",this,"publish",t.map((function(e){return"".concat(e.getTrackId())})),"success"),e.next=49;break;case 46:throw e.prev=46,e.t1=e.catch(38),n.onError(e.t1),ND.error("[".concat(this._clientId,"] publish error"),e.t1.toString()),eN("error",this,"publish",void 0,e.t1.toString()),e.t1;case 49:return e.prev=49,l(),e.finish(49);case 52:case"end":return e.stop()}}),e,this,[[10,24,27,30],[38,46,49,52]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"unpublish",value:function(){var e=y(G.mark((function e(t){var r,n,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._joinInfo&&void 0!==this._uid){e.next=2;break}throw new SD(mD.INVALID_OPERATION,"Can't unpublish stream, haven't joined yet!");case 2:return t?Array.isArray(t)||(t=[t]):t=this._p2pChannel.getAllTracks(!0),r=zj.reportApiInvoke(this._sessionId,{name:Ux.UNPUBLISH,options:t.map((function(e){return e.getTrackId()})),tag:Qx.TRACER}),ND.info("[".concat(this._clientId,"] Unpublish tracks, tracks ").concat(t.map((function(e){return"".concat(e.getTrackId()," ")}))," ")),eN("info",this,"unpublish",t.map((function(e){return"".concat(e.getTrackId())}))),e.next=7,this._publishMutex.lock();case 7:return n=e.sent,e.prev=8,e.next=11,this._p2pChannel.unpublish(t);case 11:if(i=e.sent,e.t0=i,!e.t0){e.next=16;break}return e.next=16,this._gateway.unpublish(i,this._uid);case 16:ND.info("[".concat(this._clientId,"] Unpublish success,tracks ").concat(t.map((function(e){return"".concat(e.getTrackId())})))),eN("info",this,"unpublish",t.map((function(e){return"".concat(e.getTrackId())})),"success"),r.onSuccess(),e.next=24;break;case 21:throw e.prev=21,e.t1=e.catch(8),r.onError(e.t1),ND.error("[".concat(this._clientId,"] unpublish error"),e.t1.toString()),eN("error",this,"unpublish",void 0,e.t1.toString()),e.t1;case 24:return e.prev=24,n&&n(),e.finish(24);case 27:case"end":return e.stop()}}),e,this,[[8,21,24,27]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"subscribe",value:function(){var e=y(G.mark((function e(t,r){var n,i,o,a,s,c,u,d,l,p,f,h,A,v=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Sx(r,"mediaType",["audio","video"]),n=zj.reportApiInvoke(this._sessionId,{name:Ux.SUBSCRIBE,options:[t.uid,r],tag:Qx.TRACER}),this._joinInfo){e.next=5;break}throw i=new SD(mD.INVALID_OPERATION,"Can't subscribe stream, not joined"),n.onError(i),i;case 5:if("CONNECTED"===this.connectionState||"RECONNECTING"===this.connectionState){e.next=8;break}throw o=new SD(mD.INVALID_OPERATION,"Can't subscribe stream in ".concat(this.connectionState," state")),n.onError(o),o;case 8:if(this._users.find((function(e){return e===t}))){e.next=11;break}throw a=new SD(mD.INVALID_REMOTE_USER,"user is not in the channel"),ND.error("[".concat(this._clientId,"] can not subscribe ").concat(t.uid,", this user is not in the channel")),eN("error",this,"subscribe",t.uid,"this user is not in the channel"),n.onError(a),a;case 11:if(t.hasAudio||t.hasVideo){e.next=14;break}throw s=new SD(mD.INVALID_REMOTE_USER,"user is not published"),ND.error("[".concat(this._clientId,"] can not subscribe ").concat(t.uid,", user is not published")),eN("error",this,"subscribe",t.uid,"this user is not published"),n.onError(s),s;case 14:if(("audio"!==r||t.hasAudio&&void 0!==t._audioSSRC)&&("video"!==r||t.hasVideo&&void 0!==t._videoSSRC)){e.next=17;break}throw c=new SD(mD.REMOTE_USER_IS_NOT_PUBLISHED),ND.error("[".concat(this._clientId,"] can not subscribe ").concat(t.uid," with mediaType ").concat(r,", remote track is not published")),eN("error",this,"subscribe",t.uid,"mediaType ".concat(r,", remote track is not published")),n.onError(c),c;case 17:return u="audio"===r?t._audioSSRC:t._videoSSRC,d="audio"===r?t._audioOrtc:t._videoOrtc,l="video"===r?t._rtxSsrcId:void 0,p={stream_type:"audio"===r?YP.AUDIO:YP.VIDEO,ssrcId:u},e.next=23,this._subscribeMutex.lock();case 23:return f=e.sent,ND.info("[".concat(this._clientId,"] subscribe user ").concat(t.uid,", mediaType: ").concat(r)),eN("info",this,"subscribe",{uid:t.uid,mediaType:r}),e.prev=25,e.next=28,this._p2pChannel.hasRemoteMediaWithLock(t,r);case 28:if(!e.sent){e.next=33;break}return e.next=31,this._p2pChannel.unmuteRemote(t,r);case 31:e.next=54;break;case 33:return e.prev=33,wG.markSubscribeStart(this.store.clientId,u),this.store.subscribe(t.uid,r,performance.now()),e.next=38,this._p2pChannel.subscribe(t,r,u,l,d);case 38:return e.prev=38,e.next=41,this._gateway.subscribe(t.uid,p,!0);case 41:e.next=48;break;case 43:return e.prev=43,e.t0=e.catch(38),e.next=47,this._p2pChannel.unsubscribe(t,r);case 47:throw e.t0;case 48:this.store.subscribe(t.uid,r,void 0,performance.now()),this._p2pChannel.reportSubscribeEvent(!0,null,t,r),e.next=54;break;case 51:throw e.prev=51,e.t1=e.catch(33),this._p2pChannel.reportSubscribeEvent(!1,null==e.t1?void 0:e.t1.code,t,r),e.t1;case 54:if(ND.info("[".concat(this._clientId,"] subscribe success user ").concat(t.uid,", mediaType: ").concat(r)),eN("info",this,"subscribe",{uid:t.uid,mediaType:r},"success"),this._defaultStreamFallbackType&&this.setStreamFallbackOption(t.uid,this._defaultStreamFallbackType).catch((function(e){ND.warning("[".concat(v._clientId,"] auto set fallback failed"),e),qD("warning",v,"auto set fallback failed, ".concat(e.toString()))})),h="audio"===r?t._audioTrack:t._videoTrack){e.next=59;break}return A=new SD(mD.UNEXPECTED_ERROR,"can not find remote track in user object"),e.abrupt("return",(n.onError(A),A.throw()));case 59:return e.abrupt("return",(n.onSuccess(h.getTrackId()),h));case 62:throw e.prev=62,e.t2=e.catch(25),n.onError(e.t2),ND.error("[".concat(this._clientId,"] subscribe user ").concat(t.uid," error"),e.t2),eN("error",this,"subscribe",{uid:t.uid,mediaType:r},e.t2.toString()),e.t2;case 65:return e.prev=65,f(),e.finish(65);case 68:case"end":return e.stop()}}),e,this,[[25,62,65,68],[33,51],[38,43]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"massSubscribe",value:function(){var e=y(G.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f,h,A,v,g,m,_,y,I,S,b,C,w,R,T,k,O=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(wx(t,"subscribeList"),r=zj.reportApiInvoke(this._sessionId,{name:Ux.MASS_SUBSCRIBE,options:t.map((function(e){var t=e.user,r=e.mediaType;return[null==t?void 0:t.uid,r]})),tag:Qx.TRACER}),this._joinInfo){e.next=5;break}throw n=new SD(mD.INVALID_OPERATION,"Can't subscribe stream, not joined"),r.onError(n),n;case 5:if("CONNECTED"===this.connectionState||"RECONNECTING"===this.connectionState){e.next=8;break}throw i=new SD(mD.INVALID_OPERATION,"Can't subscribe stream in ".concat(this.connectionState," state")),r.onError(i),i;case 8:return o=performance.now(),a=new Map,e.next=12,this._subscribeMutex.lock();case 12:return s=e.sent,ND.info("[".concat(this._clientId,"]start massSubscribe user ").concat(t.map((function(e){var t=e.user,r=e.mediaType;return"user: ".concat(null==t?void 0:t.uid,", mediaType: ").concat(r)})).join("; "))),eN("info",this,"massSubscribe",t),c=(t=M(t)).map((function(e){return{user:e.user,mediaType:e.mediaType}})),e.next=17,this._p2pChannel.globalLock();case 17:u=e.sent,e.prev=18,l=function(e){var n=t[e],i=n.user,o=n.mediaType;if(Sx(o,"mediaType",["audio","video"]),!i){var s=new SD(mD.INVALID_PARAMS,"user property does not exist in subscribeList item");throw ND.error("[".concat(O._clientId,"] user property does not exist in subscribeList item")),r.onError(s),s}if(!O._users.find((function(e){return e===i}))){var u=new SD(mD.INVALID_REMOTE_USER,"user is not in the channel");return ND.error("[".concat(O._clientId,"] can not massSubscribe ").concat(i.uid,", this user is not in the channel")),eN("error",O,"massSubscribe",i.uid,"this user is not in the channel"),c[e].error=u,t.splice(e,1),"continue"}if("audio"===o&&(!i.hasAudio||void 0===i._audioSSRC)||"video"===o&&(!i.hasVideo||void 0===i._videoSSRC)){var d=new SD(mD.REMOTE_USER_IS_NOT_PUBLISHED);return ND.error("[".concat(O._clientId,"] can not subscribe ").concat(i.uid," with mediaType ").concat(o,", remote user is not published")),eN("error",O,"subscribe",i.uid,"mediaType ".concat(o,", remote user is not published")),c[e].error=d,t.splice(e,1),"continue"}var l=DP.Video|DP.LwoVideo,p=a.get(i);if(p){if("video"===o?p&l:p&DP.Audio)return t.splice(e,1),ND.warning("repeat massSubscribe user:".concat(i.uid,", mediaType:").concat(o," twice")),"continue";a.set(i,p|("video"===o?l:DP.Audio))}else a.set(i,"video"===o?l:DP.Audio)},p=t.length-1;case 21:if(!(p>=0)){e.next=28;break}if("continue"!==l(p)){e.next=25;break}return e.abrupt("continue",25);case 25:p--,e.next=21;break;case 28:f=t.length-1;case 29:if(!(f>=0)){e.next=39;break}if(h=t[f],A=h.user,v=h.mediaType,g=DP.Video|DP.LwoVideo,!this._p2pChannel.hasRemoteMedia(A,v)){e.next=36;break}return e.next=34,this._p2pChannel.unmuteRemoteNoLock(A,v);case 34:m=a.get(A),a.set(A,"video"===v?m^g:m^DP.Audio),t.splice(f,1);case 36:f--,e.next=29;break;case 39:if(this.store.massSubscribe(t.map((function(e){return{userId:e.user.uid,type:e.mediaType}})),o),_=Hp(d=Array.from(a.entries())).call(d,(function(e,t){var r=E(t,2),n=r[0],i=r[1];if(0===i)return e;var o={stream_id:n.uid,stream_type:i};return i&DP.Audio&&(o.audio_ssrc=n._audioSSRC),i&DP.Video&&(o.video_ssrc=n._videoSSRC),e.push(o),e}),[]),e.prev=41,e.t0=t.length>0,!e.t0){e.next=46;break}return e.next=46,this._p2pChannel.massSubscribeNoLock(t.map((function(e){var t=e.user,r=e.mediaType;return{user:t,mediaType:r,ssrcId:r===YP.VIDEO?t._videoSSRC:t._audioSSRC,rtxSsrcId:t._rtxSsrcId}})));case 46:if(y=new Map,!(_.length>0)){e.next=52;break}return e.next=50,this._gateway.subscribeAll(_,!0);case 50:((null==(I=e.sent)?void 0:I.users)||[]).forEach((function(e){var t=e.stream_id,r=e.video_error_code,n=e.audio_error_code,i=e.error_code;(r||n||i)&&y.set(t,{video_error_code:r,audio_error_code:n,error_code:i})}));case 52:if(!(Array.from(y.entries()).length>0)){e.next=56;break}return S=Array.from(y.entries()).map((function(e){var t,r=E(e,2),n=r[0],i=r[1];return i.error_code||i.video_error_code&&i.audio_error_code?t=void 0:i.video_error_code?t=YP.VIDEO:i.audio_error_code&&(t=YP.AUDIO),{user:O.remoteUsers.find((function(e){return e.uid===n})),mediaType:t}})),e.next=56,this._p2pChannel.massUnsubscribeNoLock(S);case 56:b=K(c);try{for(b.s();!(C=b.n()).done;)w=C.value,(R=y.get(w.user.uid))&&(T=R.error_code||"audio"===w.mediaType&&R.audio_error_code||"video"===w.mediaType&&R.video_error_code)&&(k=pq(T),ND.error("user:".concat(w.user.uid," mediaType:").concat(w.mediaType," has massSubscribe error ").concat(k.desc)),w.error=new SD(mD.SUBSCRIBE_FAILED,"code ".concat(T,": ").concat(k.desc))),w.error||("video"===w.mediaType?w.track=w.user.videoTrack:w.track=w.user.audioTrack)}catch(e){b.e(e)}finally{b.f()}return e.abrupt("return",(this.store.massSubscribe(c.filter((function(e){return!e.error})).map((function(e){return{userId:e.user.uid,type:e.mediaType}})),void 0,performance.now()),c.forEach((function(e){var t;zj.subscribe(O.store.sessionId,{succ:!!e.error,ec:(null===(t=e.error)||void 0===t?void 0:t.code)||null,video:e.mediaType===YP.VIDEO,audio:e.mediaType===YP.AUDIO,peerid:e.user.uid,subscribeRequestid:e.mediaType===YP.VIDEO?e.user._videoSSRC:e.user._audioSSRC,p2pid:O.store.p2pId,eventElapse:Math.floor(performance.now()-o)},!0)})),r.onSuccess(),ND.info("[".concat(this._clientId,"] massSubscribe success ").concat(t.map((function(e){var t=e.user,r=e.mediaType;return"user: ".concat(null==t?void 0:t.uid,", mediaType: ").concat(r)})).join("; "))),eN("info",this,"massSubscribe",t,"success"),c));case 61:return e.prev=61,e.t1=e.catch(41),e.next=65,this._p2pChannel.massUnsubscribeNoLock(t);case 65:throw r.onError(e.t1),e.t1;case 67:return e.prev=67,u(),s(),e.finish(67);case 70:case"end":return e.stop()}}),e,this,[[18,,67,70],[41,61]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"unsubscribe",value:function(){var e=y(G.mark((function e(t,r){var n,i,o;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&Sx(r,"mediaType",["audio","video"]),this._joinInfo){e.next=2;break}throw new SD(mD.INVALID_OPERATION,"Can't unsubscribe stream, haven't joined yet!");case 2:if(n=zj.reportApiInvoke(this._sessionId,{name:Ux.UNSUBSCRIBE,options:[t.uid,r],tag:Qx.TRACER}),this._users.find((function(e){return e===t}))){e.next=6;break}throw i=new SD(mD.INVALID_REMOTE_USER,"user is not in the channel"),ND.error("[".concat(this._clientId,"] can not subscribe ").concat(t.uid,", user is not in the channel")),eN("error",this,"unsubscribe",{uid:t.uid,mediaType:r},"user is not in the channel"),n.onError(i),i;case 6:return ND.info("[".concat(this._clientId,"] unsubscribe uid: ").concat(t.uid,", mediaType: ").concat(r)),eN("info",this,"unsubscribe",{uid:t.uid,mediaType:r}),e.prev=7,e.next=10,this._p2pChannel.unsubscribe(t,r);case 10:if(o=e.sent,e.t0=o,!e.t0){e.next=15;break}return e.next=15,this._gateway.unsubscribe(o,t.uid);case 15:ND.info("[".concat(this._clientId,"] unsubscribe success uid: ").concat(t.uid,", mediaType: ").concat(r)),eN("info",this,"unsubscribe",{uid:t.uid,mediaType:r},"success"),n.onSuccess(),e.next=25;break;case 20:if(e.prev=20,e.t1=e.catch(7),e.t1.code!==mD.DISCONNECT_P2P){e.next=24;break}return e.abrupt("return",(ND.warning("disconnecting p2p, abort unsubscribe request."),void n.onSuccess()));case 24:throw ND.error("[".concat(this._clientId,"] unsubscribe user ").concat(t.uid," error"),e.t1.toString()),eN("error",this,"unsubscribe",{uid:t.uid,mediaType:r},e.t1.toString()),n.onError(e.t1),e.t1;case 25:case"end":return e.stop()}}),e,this,[[7,20]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"massUnsubscribe",value:function(){var e=y(G.mark((function e(t){var r,n,i,o,a,s,c=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(wx(t,"unsubscribeList"),r=zj.reportApiInvoke(this._sessionId,{name:Ux.UNSUBSCRIBE,options:t.map((function(e){var t=e.user,r=e.mediaType;return{uid:null==t?void 0:t.uid,mediaType:r}})),tag:Qx.TRACER}),this._joinInfo){e.next=5;break}throw n=new SD(mD.INVALID_OPERATION,"Can't unsubscribeAll stream, haven't joined yet!"),r.onError(n),n;case 5:ND.info("[".concat(this._clientId,"] start massUnsubscribe ").concat(t.map((function(e){var t=e.user,r=e.mediaType;return"user: ".concat(null==t?void 0:t.uid,", mediaType: ").concat(r,";")})).join())),eN("info",this,"massUnsubscribe",t),t=M(t),i=new Map,o=function(e){var n=t[e],o=n.user,a=n.mediaType;if(!o){var s=new SD(mD.INVALID_PARAMS,"user property does not exist in unsubscribeList item");throw ND.error("[".concat(c._clientId,"] user property does not exist in unsubscribeList item")),r.onError(s),s}if(Sx(a,"mediaType",["video","audio",void 0]),!c._users.find((function(e){return e===o})))return ND.warning("[".concat(c._clientId,"] can not subscribe ").concat(o.uid,", user is not in the channel")),eN("error",c,"unsubscribe",{uid:o.uid,mediaType:a},"user is not in the channel"),t.splice(e,1),"continue";var u=DP.Video|DP.LwoVideo;if(i.has(o)){var d,l=i.get(o);switch(a){case"video":d=l&u;break;case"audio":d=l&DP.Audio;break;default:d=l&(DP.Audio|u)}if(d)return ND.warning("repeat massUnsubscribe user:".concat(o.uid,",mediaType:").concat(a," twice.")),t.splice(e,1),"continue";a?"audio"===a?i.set(o,l|DP.Audio):"video"===a&&i.set(o,l|u):i.set(o,l|DP.Audio|u)}else a?"audio"===a?i.set(o,DP.Audio):"video"===a&&i.set(o,u):i.set(o,DP.Audio|u)},a=t.length-1;case 9:if(!(a>=0)){e.next=16;break}if("continue"!==o(a)){e.next=13;break}return e.abrupt("continue",13);case 13:a--,e.next=9;break;case 16:return e.prev=16,e.next=19,this._p2pChannel.massUnsubscribe(t);case 19:if(s=e.sent,e.t0=s,!e.t0){e.next=24;break}return e.next=24,this._gateway.massUnsubscribe(s);case 24:ND.info("[".concat(this._clientId,"] massUnsubscribe success ").concat(t.map((function(e){var t=e.user,r=e.mediaType;return"user: ".concat(null==t?void 0:t.uid,", mediaType: ").concat(r,";")})).join())),eN("info",this,"massUnsubscribe",t,"success"),r.onSuccess(),e.next=34;break;case 29:if(e.prev=29,e.t1=e.catch(16),e.t1.code!==mD.DISCONNECT_P2P){e.next=33;break}return e.abrupt("return",(ND.warning("disconnecting p2p, abort unsubscribe request."),void r.onSuccess()));case 33:throw ND.error("[".concat(this._clientId,"] massUnsubscribe error"),e.t1.toString()),eN("error",this,"massUnsubscribe",t,e.t1.toString()),r.onError(e.t1),e.t1;case 34:case"end":return e.stop()}}),e,this,[[16,29]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"setLowStreamParameter",value:function(e){!function(e){if(!e)throw new SD(mD.INVALID_PARAMS);kx(e.width)||bx(e.width,"streamParameter.width"),kx(e.height)||bx(e.height,"streamParameter.height"),kx(e.framerate)||bx(e.framerate,"streamParameter.framerate"),kx(e.bitrate)||bx(e.bitrate,"streamParameter.bitrate")}(e);var t=zj.reportApiInvoke(this._sessionId,{name:Ux.SET_LOW_STREAM_PARAMETER,options:[e],tag:Qx.TRACER});(!e.width&&e.height||e.width&&!e.height)&&(ND.warning("[".concat(this._clientId,"] The width and height parameters take effect only when both are set")),qD("warning",this,"The width and height parameters take effect only when both are set")),ND.info("[".concat(this._clientId,"] set low stream parameter to"),JSON.stringify(e)),eN("info",this,"setLowStreamParameter",e);var r=this._configDistribute.getLowStreamConfigDistribute();r&&r.bitrate&&e.bitrate&&r.bitrate<e.bitrate&&(e.bitrate=r.bitrate),this._lowStreamParameter=e,t.onSuccess()}},{key:"enableDualStream",value:function(){var e=y(G.mark((function e(){var t,r,n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=zj.reportApiInvoke(this._sessionId,{name:Ux.ENABLE_DUAL_STREAM,options:[],tag:Qx.TRACER}),oL().supportDualStream){e.next=5;break}throw zj.streamSwitch(this._sessionId,{lts:Date.now(),isdual:!0,succ:!1}),r=new SD(mD.NOT_SUPPORTED,"Your browser is not support dual stream"),t.onError(r),r;case 5:if(!this._isDualStreamEnabled){e.next=8;break}throw n=new SD(mD.INVALID_OPERATION,"Dual stream is already enabled"),t.onError(n),n;case 8:if(!this._p2pChannel.canPublishLowStream()){e.next=17;break}return e.prev=9,e.next=12,this._publishLowStream();case 12:e.next=17;break;case 14:throw e.prev=14,e.t0=e.catch(9),zj.streamSwitch(this._sessionId,{lts:Date.now(),isdual:!0,succ:!1}),t.onError(e.t0),e.t0;case 17:this._isDualStreamEnabled=!0,zj.streamSwitch(this._sessionId,{lts:Date.now(),isdual:!0,succ:!0}),ND.info("[".concat(this._clientId,"] enable dual stream")),eN("info",this,"enableDualStream"),t.onSuccess();case 18:case"end":return e.stop()}}),e,this,[[9,14]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"disableDualStream",value:function(){var e=y(G.mark((function e(){var t,r;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._isDualStreamEnabled){e.next=2;break}return e.abrupt("return");case 2:if(this._joinInfo){e.next=4;break}throw new SD(mD.INVALID_OPERATION,"Can't publish stream, haven't joined yet!");case 4:if(t=zj.reportApiInvoke(this._sessionId,{name:Ux.DISABLE_DUAL_STREAM,options:[],tag:Qx.TRACER}),!this._p2pChannel.getLocalMedia(qP.LocalVideoLowTrack)){e.next=19;break}return e.prev=6,e.next=9,this._p2pChannel.unpublishLowStream();case 9:if(r=e.sent,e.t0=r,!e.t0){e.next=14;break}return e.next=14,this._gateway.unpublish(r,this._joinInfo.stringUid||this._joinInfo.uid);case 14:e.next=19;break;case 16:throw e.prev=16,e.t1=e.catch(6),zj.streamSwitch(this._sessionId,{lts:Date.now(),isdual:!1,succ:!1}),t.onError(e.t1),e.t1;case 19:this._isDualStreamEnabled=!1,zj.streamSwitch(this._sessionId,{lts:Date.now(),isdual:!1,succ:!0}),ND.info("[".concat(this._clientId,"] disable dual stream")),eN("info",this,"disableDualStream"),t.onSuccess();case 20:case"end":return e.stop()}}),e,this,[[6,16]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"setClientRole",value:function(){var e=y(G.mark((function e(t,r){var n,i,o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(function(e){Sx(e,"role",["audience","host"])}(t),r&&uP(r),n=zj.reportApiInvoke(this._sessionId,{name:Ux.SET_CLIENT_ROLE,options:[t,r],tag:Qx.TRACER}),"rtc"!==this._mode){e.next=6;break}return ND.warning("[".concat(this._clientId,"]rtc mode can not use setClientRole")),eN("warning",this,"setClientRole",t,"rtc mode can not use setClientRole"),i=new SD(mD.INVALID_OPERATION,"rtc mode can not use setClientRole"),e.abrupt("return",(n.onError(i),i.throw()));case 6:if(!r||!r.level||"host"!==t){e.next=9;break}return o=new SD(mD.INVALID_OPERATION,"host mode can not set audience latency level"),e.abrupt("return",(n.onError(o),o.throw()));case 9:if(e.prev=9,"audience"!==t||!this._p2pChannel.hasLocalMedia()){e.next=13;break}return a=new SD(mD.INVALID_OPERATION,"can not set client role to audience when publishing stream"),e.abrupt("return",(n.onError(a),a.throw()));case 13:return e.next=15,this._gateway.setClientRole(t,r);case 15:ND.info("[".concat(this._clientId,"] set client role to ").concat(t,", level: ").concat(r&&r.level)),eN("info",this,"setClientRole",{role:t,level:r&&r.level}),n.onSuccess(),e.next=23;break;case 20:throw e.prev=20,e.t0=e.catch(9),n.onError(e.t0),e.t0;case 23:case"end":return e.stop()}}),e,this,[[9,20]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"setProxyServer",value:function(e,t){if(Cx(e,"proxyServer"),!t){if("DISCONNECTED"!==this.connectionState)throw new SD(mD.INVALID_OPERATION,"Set proxy server before join channel");if("disabled"!==this._cloudProxyServerMode||this._useLocalAccessPoint)throw new SD(mD.INVALID_OPERATION,"You have already set the proxy")}this._proxyServer=e,zj.setProxyServer(this._proxyServer),ND.setProxyServer(this._proxyServer),YD(this._proxyServer),ND.info("[".concat(this._clientId,"] Set proxy server ").concat(t?"by initialize call":""," success.")),eN("info",this,"setProxyServer",Array.prototype.slice.call(arguments),"success")}},{key:"setTurnServer",value:function(e,t){if(Array.isArray(e)||(e=[e]),!t){if("DISCONNECTED"!==this.connectionState)throw new SD(mD.INVALID_OPERATION,"Set turn server before join channel");if("disabled"!==this._cloudProxyServerMode||this._useLocalAccessPoint)throw new SD(mD.INVALID_OPERATION,"You have already set the proxy")}if(sP(e))return this._turnServer={servers:e,mode:"original-manual"},ND.info("[".concat(this._clientId,"] Set original turnserver ").concat(t?"by initialize call":""," success: ").concat(e.map((function(e){return e.urls})).join(","),".")),void eN("info",this,"setOriginalTurnServer",Array.prototype.slice.call(arguments),"success");e.forEach((function(e){return cP(e)})),this._turnServer={servers:e,mode:"manual"},ND.info("[".concat(this._clientId,"] Set turnserver ").concat(t?"by initialize call":""," success.")),eN("info",this,"setTurnServer",Array.prototype.slice.call(arguments),"success")}},{key:"startProxyServer",value:function(e){var t=zj.reportApiInvoke(this._sessionId,{name:Ux.START_PROXY_SERVER,options:[],tag:Qx.TRACER});if("DISCONNECTED"!==this.connectionState){var r=new SD(mD.INVALID_OPERATION,"Start proxy server before join channel");throw t.onError(r),r}if(this._proxyServer||"manual"===this._turnServer.mode||this._useLocalAccessPoint){var n=new SD(mD.INVALID_OPERATION,"You have already set the proxy");throw t.onError(n),n}var i=[1,2,3,4,5];switch(void 0===e&&(e=1),e){case 1:this._cloudProxyServerMode="normal";break;case 2:this._cloudProxyServerMode="443only";break;case 3:this._cloudProxyServerMode="proxy3";break;case 4:this._cloudProxyServerMode="proxy4";break;case 5:this._cloudProxyServerMode="proxy5";break;default:var o=new SD(mD.INVALID_PARAMS,"proxy server mode must be ".concat(i.join("|")));throw t.onError(o),o}ND.info("[".concat(this._clientId,"] set cloud proxy server mode to"),this._cloudProxyServerMode),eN("info",this,"startProxyServer",this._cloudProxyServerMode),t.onSuccess()}},{key:"stopProxyServer",value:function(){var e=zj.reportApiInvoke(this._sessionId,{name:Ux.STOP_PROXY_SERVER,options:[],tag:Qx.TRACER});if("DISCONNECTED"!==this.connectionState)throw new SD(mD.INVALID_OPERATION,"Stop proxy server after leave channel");zj.setProxyServer(),ND.setProxyServer(),YD(),this._cloudProxyServerMode="disabled",ND.info("[".concat(this._clientId,"] set cloud proxy server mode to"),this._cloudProxyServerMode),eN("info",this,"stopProxyServer",this._cloudProxyServerMode),this._proxyServer=void 0,this._turnServer={mode:"auto",servers:[]},e.onSuccess()}},{key:"setLocalAccessPoints",value:function(e,t){if(wx(e,"serverList"),Cx(t,"domain"),this._proxyServer||"disabled"!==this._cloudProxyServerMode)throw new SD(mD.INVALID_OPERATION,"set local access point failed, You have already set the cloud proxy");var r=/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;e=e.map((function(e){return r.test(e)?"".concat(e.replace(/\./g,"-"),".").concat(t):e})),this._useLocalAccessPoint=!0,vN("WEBCS_DOMAIN",e),vN("WEBCS_DOMAIN_BACKUP_LIST",e),vN("GATEWAY_DOMAINS",[t]),vN("EVENT_REPORT_DOMAIN",e[0]),vN("EVENT_REPORT_BACKUP_DOMAIN",e[1]||e[0]),vN("LOG_UPLOAD_SERVER","".concat(e[0],":6444")),ND.info("set local access point success"),eN("info",this,"setLocalAccessPoints")}},{key:"setRemoteDefaultVideoStreamType",value:function(){var e=y(G.mark((function e(t){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Sx(t,"streamType",[0,1]),this._remoteDefaultVideoStreamType=t,!this._joinInfo){e.next=12;break}return e.prev=1,e.next=4,this._gateway.setDefaultRemoteVideoStreamType(t);case 4:this._joinInfo.defaultVideoStream=this._remoteDefaultVideoStreamType,e.next=10;break;case 7:throw e.prev=7,e.t0=e.catch(1),ND.error("[".concat(this._clientId,"] set default remote video stream type error"),e.t0.toString()),e.t0;case 10:e.next=13;break;case 12:ND.debug("haven't joined yet, cache remoteDefaultVideoStreamType ".concat(t));case 13:case"end":return e.stop()}}),e,this,[[1,7]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"setRemoteVideoStreamType",value:function(){var e=y(G.mark((function e(t,r){var n,i=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Sx(r,"streamType",[0,1]),n=zj.reportApiInvoke(this._sessionId,{name:Ux.SET_REMOTE_VIDEO_STREAM_TYPE,options:[t,r],tag:Qx.TRACER}),e.prev=2,e.next=5,this._gateway.setRemoteVideoStreamType(t,r);case 5:setTimeout((function(){var e=i._users.find((function(e){return e.uid===t}));e&&e.videoTrack&&e.videoTrack.updateMediaStreamTrackResolution()}),2e3),e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(2),n.onError(e.t0),ND.error("[".concat(this._clientId,"] set remote video stream type error"),e.t0.toString()),eN("error",this,"setRemoteVideoStreamType",void 0,e.t0.toString()),e.t0;case 11:ND.info("[".concat(this._clientId,"] set remote ").concat(t," video stream type to ").concat(r)),eN("info",this,"setRemoteVideoStreamType",{uid:t,streamType:r}),this._remoteStreamTypeCacheMap.set(t,r),n.onSuccess();case 12:case"end":return e.stop()}}),e,this,[[2,8]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"setStreamFallbackOption",value:function(){var e=y(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Sx(r,"fallbackType",[0,1,2]),n=zj.reportApiInvoke(this._sessionId,{name:Ux.SET_STREAM_FALLBACK_OPTION,options:["too long to show",r],tag:Qx.TRACER}),e.prev=2,e.next=5,this._gateway.setStreamFallbackOption(t,r);case 5:e.next=10;break;case 7:throw e.prev=7,e.t0=e.catch(2),n.onError(e.t0),ND.error("[".concat(this._clientId,"] set stream fallback option"),e.t0.toString()),eN("error",this,"setStreamFallbackOption",void 0,e.t0.toString()),e.t0;case 10:ND.info("[".concat(this._clientId,"] set remote ").concat(t," stream fallback type to ").concat(r)),eN("info",this,"setStreamFallbackOption",{uid:t,fallbackType:r}),this._streamFallbackTypeCacheMap.set(t,r),n.onSuccess();case 11:case"end":return e.stop()}}),e,this,[[2,7]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"setEncryptionConfig",value:function(e,t,r){if(function(e){Sx(e,"encryptionMode",["aes-128-xts","aes-256-xts","aes-128-ecb","sm4-128-ecb","aes-128-gcm","aes-256-gcm","aes-128-gcm2","aes-256-gcm2","none"])}(e),Cx(t,"secret"),["aes-128-gcm2","aes-256-gcm2"].includes(e)){if(!r||!(r instanceof Uint8Array&&32===r.length))throw new SD(mD.INVALID_PARAMS,"salt must be an Uint8Array and exactly equal to 32 bytes")}else if(r)throw new SD(mD.INVALID_PARAMS,"current encrypt mode does not need salt");new RegExp("^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*,.<>?/:;'\"|{}\\[\\]])(?=.{8,})").test(t)||(ND.warning("The secret is not strong:\n The secret must contain at least 1 lowercase alphabetical character,\n The secret must contain at least 1 uppercase alphabetical character,\n The secret must contain at least 1 numeric character,\n The secret must contain at least one special character,\n The secret must be eight characters or longer.\n "),qD("warning",this,"The secret is not strong:\n The secret must contain at least 1 lowercase alphabetical character,\n The secret must contain at least 1 uppercase alphabetical character,\n The secret must contain at least 1 numeric character,\n The secret must contain at least one special character,\n The secret must be eight characters or longer.\n ")),this._encryptionMode=e,this._encryptionSecret=t,r&&(this._encryptionSalt=fK(r))}},{key:"renewToken",value:function(){var e=y(G.mark((function e(t){var r,n,i,o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Cx(t,"token",1,2047),r=zj.reportApiInvoke(this._sessionId,{name:Ux.RENEW_TOKEN,options:[t],tag:Qx.TRACER}),this._key&&this._joinInfo){e.next=5;break}return n=new SD(mD.INVALID_OPERATION,"renewToken should not be called before user join"),e.abrupt("return",(r.onError(n),n.throw()));case 5:return i=this._key,this._key=t,this._joinInfo&&(this._joinInfo.token=t),e.next=9,this._renewTokenMutex.lock();case 9:if(o=e.sent,e.prev=10,!gN("USE_NEW_TOKEN")){e.next=22;break}return ND.debug("start renew token with ticket from unilbs"),eN("debug",this,"renewToken","unilbs"),e.next=15,EJ(this._joinInfo,this._axiosCancelSource.token,this._config.httpRetryConfig||bD);case 15:return a=e.sent,ND.debug("[".concat(this._clientId,"] get ticket from unilbs success")),eN("debug",this,"renewToken","unilbs","success"),e.next=20,this._gateway.renewToken({token:t,ticket:a});case 20:e.next=26;break;case 22:return ND.debug("start renew token without ticket"),eN("debug",this,"renewToken"),e.next=26,this._gateway.renewToken({token:t});case 26:ND.debug("[".concat(this._clientId,"] renewToken success")),eN("debug",this,"renewToken",void 0,"success"),r.onSuccess(),e.next=32;break;case 29:throw e.prev=29,e.t0=e.catch(10),this._key=i,this._joinInfo.token=i,r.onError(e.t0),ND.error("[".concat(this._clientId,"] renewToken failed"),e.t0.toString()),eN("error",this,"renewToken",void 0,e.t0.toString()),e.t0;case 32:return e.prev=32,o(),e.finish(32);case 35:case"end":return e.stop()}}),e,this,[[10,29,32,35]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"enableAudioVolumeIndicator",value:function(){var e=this,t=zj.reportApiInvoke(this._sessionId,{name:Ux.ENABLE_AUDIO_VOLUME_INDICATOR,options:[],tag:Qx.TRACER});if(this._audioVolumeIndicationInterval)return ND.warning("you have already enabled audio volume indicator!"),eN("warning",this,"enableAudioVolumeIndicator","you have already enabled audio volume indicator!"),t.onSuccess();this._audioVolumeIndicationInterval=window.setInterval((function(){var t=e._p2pChannel.getAudioLevels();e.emit(Jx.VOLUME_INDICATOR,t)}),gN("AUDIO_VOLUME_INDICATION_INTERVAL")||2e3),t.onSuccess()}},{key:"getRTCStats",value:function(){var e=this._statsCollector.getRTCStats(),t=this._gateway.getInChannelInfo();return e.Duration=Math.round(t.duration/1e3),e}},{key:"startLiveStreaming",value:function(e,t){var r=zj.reportApiInvoke(this._sessionId,{name:Ux.START_LIVE_STREAMING,options:[e,t],tag:Qx.TRACER});if(!t){if("h264"!==this._codec){var n=new SD(mD.LIVE_STREAMING_INVALID_RAW_STREAM,"raw streaming is only support h264");return r.onError(n),Rb.reject(n)}if(!this._p2pChannel.hasLocalMedia()){var i=new SD(mD.LIVE_STREAMING_INVALID_RAW_STREAM,"can not find stream to raw streaming");return r.onError(i),Rb.reject(i)}}if(this._liveRawStreamingClient&&this._liveRawStreamingClient.hasUrl(e)||this._liveTranscodeStreamingClient&&this._liveTranscodeStreamingClient.hasUrl(e)){var o=new SD(mD.LIVE_STREAMING_TASK_CONFLICT);return r.onError(o),Rb.reject(o)}var a=t?lP.TRANSCODE:lP.RAW;return this._createLiveStreamingClient(a).startLiveStreamingTask(e,a).then((function(){return r.onSuccess()})).catch((function(e){throw r.onError(e),e}))}},{key:"setLiveTranscoding",value:function(e){var t=zj.reportApiInvoke(this._sessionId,{name:Ux.SET_LIVE_TRANSCODING,options:[e],tag:Qx.TRACER});return this._createLiveStreamingClient(lP.TRANSCODE).setTranscodingConfig(e).then((function(){return t.onSuccess()})).catch((function(e){throw t.onError(e),e}))}},{key:"stopLiveStreaming",value:function(e){var t=zj.reportApiInvoke(this._sessionId,{name:Ux.STOP_LIVE_STREAMING,options:[e],tag:Qx.TRACER}),r=[this._liveRawStreamingClient,this._liveTranscodeStreamingClient].filter((function(t){return t&&t.hasUrl(e)}));if(!r.length){var n=new SD(mD.INVALID_PARAMS,"can not find live streaming url to stop");return t.onError(n),Rb.reject(n)}return Rb.all(r.map((function(t){return t&&t.stopLiveStreamingTask(e)}))).then((function(){return t.onSuccess()})).catch((function(e){throw t.onError(e),e}))}},{key:"addInjectStreamUrl",value:function(){var e=y(G.mark((function e(t,r){var n,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=zj.reportApiInvoke(this._sessionId,{name:Ux.ADD_INJECT_STREAM_URL,options:[t,r],tag:Qx.TRACER}),e.prev=1,this._joinInfo){e.next=4;break}throw new SD(mD.INVALID_OPERATION,"can not addInjectStreamUrl, no joininfo");case 4:return(i=this._createLiveStreamingClient(lP.INJECT)).setInjectStreamConfig(r,0),e.next=8,i.startLiveStreamingTask(t,lP.INJECT);case 8:e.next=13;break;case 10:throw e.prev=10,e.t0=e.catch(1),n.onError(e.t0),e.t0;case 13:n.onSuccess();case 14:case"end":return e.stop()}}),e,this,[[1,10]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"removeInjectStreamUrl",value:function(){var e=y(G.mark((function e(){var t,r,n,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=zj.reportApiInvoke(this._sessionId,{name:Ux.REMOVE_INJECT_STREAM_URL,options:[],tag:Qx.TRACER}),e.prev=1,n=this._createLiveStreamingClient(lP.INJECT),i=Array.from(Rj(r=n.streamingTasks).call(r)).find((function(e){return e.mode===lP.INJECT})),this._joinInfo&&i){e.next=5;break}throw new SD(mD.INVALID_OPERATION,"can remove addInjectStreamUrl, no joininfo or inject task");case 5:return e.next=7,n.stopLiveStreamingTask(i.url);case 7:e.next=12;break;case 9:throw e.prev=9,e.t0=e.catch(1),t.onError(e.t0),e.t0;case 12:t.onSuccess();case 13:case"end":return e.stop()}}),e,this,[[1,9]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"startChannelMediaRelay",value:function(){var e=y(G.mark((function e(t){var r,n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=zj.reportApiInvoke(this._sessionId,{name:Ux.START_CHANNEL_MEDIA_RELAY,options:[t],tag:Qx.TRACER}),e.prev=1,DJ(t),n=this._createChannelMediaRelayClient(),e.next=6,n.startChannelMediaRelay(t);case 6:e.next=11;break;case 8:return e.prev=8,e.t0=e.catch(1),e.abrupt("return",(r.onError(e.t0),e.t0.throw()));case 11:r.onSuccess();case 12:case"end":return e.stop()}}),e,this,[[1,8]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"updateChannelMediaRelay",value:function(){var e=y(G.mark((function e(t){var r,n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=zj.reportApiInvoke(this._sessionId,{name:Ux.UPDATE_CHANNEL_MEDIA_RELAY,options:[t],tag:Qx.TRACER}),e.prev=1,DJ(t),n=this._createChannelMediaRelayClient(),e.next=6,n.updateChannelMediaRelay(t);case 6:e.next=11;break;case 8:return e.prev=8,e.t0=e.catch(1),e.abrupt("return",(r.onError(e.t0),e.t0.throw()));case 11:r.onSuccess();case 12:case"end":return e.stop()}}),e,this,[[1,8]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"stopChannelMediaRelay",value:function(){var e=y(G.mark((function e(){var t,r;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=zj.reportApiInvoke(this._sessionId,{name:Ux.STOP_CHANNEL_MEDIA_RELAY,options:[],tag:Qx.TRACER}),e.prev=1,r=this._createChannelMediaRelayClient(),e.next=5,r.stopChannelMediaRelay();case 5:e.next=10;break;case 7:return e.prev=7,e.t0=e.catch(1),e.abrupt("return",(t.onError(e.t0),e.t0.throw()));case 10:t.onSuccess();case 11:case"end":return e.stop()}}),e,this,[[1,7]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"sendStreamMessage",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this._joinInfo)throw new SD(mD.INVALID_OPERATION,"can not send data stream, not joined");if("string"==typeof e&&(e=(new TextEncoder).encode(e)),new Blob([e]).size>1024)throw new SD(mD.INVALID_PARAMS,"stream message out of range.");return this._gateway.signal.request($x.DATA_STREAM,{payload:fK(e)},!t)}},{key:"sendMetadata",value:function(e){if(!this._joinInfo)throw new SD(mD.INVALID_OPERATION,"can not send metadata, not joined");if(new Blob([e]).size>1024)throw new SD(mD.METADATA_OUT_OF_RANGE);return this._gateway.signal.request($x.SEND_METADATA,{session_id:this._joinInfo.sid,metadata:fK(e)})}},{key:"sendCustomReportMessage",value:function(){var e=y(G.mark((function e(t){var r,n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Array.isArray(t)||(t=[t]),t.forEach(Px),r=zj.reportApiInvoke(this._sessionId,{name:Ux.SEND_CUSTOM_REPORT_MESSAGE,options:[JSON.stringify(t)],tag:Qx.TRACER}),this._joinInfo){e.next=5;break}return n=new SD(mD.INVALID_OPERATION,"can not send custom report, not joined"),e.abrupt("return",(r.onError(n),n.throw()));case 5:return e.next=7,zj.sendCustomReportMessage(this._joinInfo.sid,t);case 7:r.onSuccess();case 8:case"end":return e.stop()}}),e,this)})));function t(t){return e.apply(this,arguments)}return t}()},{key:"getLocalAudioStats",value:function(){return this._statsCollector.getLocalAudioTrackStats()}},{key:"getRemoteAudioStats",value:function(){return this._statsCollector.getRemoteAudioTrackStats()}},{key:"getLocalVideoStats",value:function(){return this._statsCollector.getLocalVideoTrackStats()}},{key:"getRemoteVideoStats",value:function(){return this._statsCollector.getRemoteVideoTrackStats()}},{key:"getRemoteNetworkQuality",value:function(){return this._statsCollector.getRemoteNetworkQualityStats()}},{key:"pickSVCLayer",value:function(){var e=y(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Sx(r.spatialLayer,"spatialLayer",[0,1,2,3]),Sx(r.temporalLayer,"temporalLayer",[0,1,2,3]),e.prev=1,e.next=4,this._gateway.pickSVCLayer(t,r);case 4:e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(1),ND.error("[".concat(this._clientId,"] pick SVC layer failed"),e.t0.toString()),ZD("error",this,"pickSVCLayer",r,e.t0.toString()),e.t0;case 9:case"end":return e.stop()}}),e,this,[[1,6]])})));function t(t,r){return e.apply(this,arguments)}return t}()},{key:"_reset",value:function(){ND.debug("[".concat(this._clientId,"] reset client")),ZD("debug",this,"_reset"),this._axiosCancelSource.cancel(),this._axiosCancelSource=ED.CancelToken.source(),this._streamFallbackTypeCacheMap=new Map,this._remoteStreamTypeCacheMap=new Map,this._configDistribute.stopGetConfigDistribute(),this._joinInfo=void 0,this._proxyServer=void 0,this._defaultStreamFallbackType=void 0,this._sessionId=null,this.store.sessionId=null,this._statsCollector.reset(),this._key=void 0,this._appId=void 0,this._uid=void 0,this.store.uid=void 0,this._channelName=void 0,this._encryptionMode="none",this._encryptionSecret=null,this._encryptionSalt=null,this._users.forEach((function(e){e._audioTrack&&e._audioTrack._destroy(),e._videoTrack&&e._videoTrack._destroy()})),this._users=[],this._audioVolumeIndicationInterval&&(window.clearInterval(this._audioVolumeIndicationInterval),this._audioVolumeIndicationInterval=void 0),"fallback"===this._cloudProxyServerMode&&(this._cloudProxyServerMode="disabled"),this._p2pChannel.reset(),this._publishMutex=new rV("client-publish"),this._subscribeMutex=new rV("client-subscribe"),this._networkQualityInterval&&(window.clearInterval(this._networkQualityInterval),this._networkQualityInterval=void 0),this._injectStreamingClient&&(this._injectStreamingClient.terminate(),this._injectStreamingClient.removeAllListeners(),this._injectStreamingClient=void 0),this._liveRawStreamingClient&&(this._liveRawStreamingClient.terminate(),this._liveRawStreamingClient.removeAllListeners(),this._liveRawStreamingClient=void 0),this._liveTranscodeStreamingClient&&(this._liveTranscodeStreamingClient.terminate(),this._liveTranscodeStreamingClient.removeAllListeners(),this._liveTranscodeStreamingClient=void 0),this._channelMediaRelayClient&&(this._channelMediaRelayClient.dispose(),this._channelMediaRelayClient=void 0)}},{key:"_startSession",value:function(e,t){var r=e||ZG();e?ND.debug("[".concat(this._clientId,"] new Session ").concat(r)):ND.debug("[".concat(this._clientId,"] renewSession ").concat(this._sessionId," => ").concat(r)),ZD("debug",this,"_startSession",{newSid:r,sid:this._sessionId}),this._sessionId=r,this.store.sessionId=r,t?zj.sessionInit(this._sessionId,{lts:(new Date).getTime(),cname:t.channel,appid:t.appId,mode:this._mode}):this._joinInfo?zj.sessionInit(this._sessionId,{lts:(new Date).getTime(),cname:this._joinInfo.cname,appid:this._joinInfo.appId,mode:this._mode}):this._gateway.joinInfo&&zj.sessionInit(this._sessionId,{lts:(new Date).getTime(),cname:this._gateway.joinInfo.cname,appid:this._gateway.joinInfo.appId,mode:this._mode}),this._joinInfo&&(this._joinInfo.sid=r),this._gateway.joinInfo&&(this._gateway.joinInfo.sid=r)}},{key:"_publishHighStream",value:function(){var e=y(G.mark((function e(t){var r,n,i,o,a,s,c;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._joinInfo&&void 0!==this._uid){e.next=2;break}throw new SD(mD.INVALID_OPERATION,"Can't publish stream, haven't joined yet!");case 2:if("CONNECTED"===this.connectionState||"RECONNECTING"===this.connectionState){e.next=4;break}throw new SD(mD.INVALID_OPERATION,"can not publish stream in ".concat(this.connectionState," state"));case 4:if("auto"!==this._turnServer.mode||!gN("FORCE_TURN")||gN("TURN_ENABLE_TCP")||gN("TURN_ENABLE_UDP")){e.next=6;break}throw new SD(mD.UNEXPECTED_ERROR,"force TURN With No TURN Configuration");case 6:return ND.debug("[".concat(this._clientId,"] publish high stream")),ZD("debug",this,"_publishHighStream"),e.prev=7,e.next=10,this._p2pChannel.publish(t,this._isDualStreamEnabled,this._lowStreamParameter);case 10:return r=e.sent,e.next=13,r.next();case 13:if(!(n=e.sent.value)){e.next=27;break}return e.prev=15,e.next=18,this._gateway.publish(this._uid,n,!0);case 18:o=e.sent,e.next=25;break;case 21:if(e.prev=21,e.t0=e.catch(15),e.t0.code===mD.DISCONNECT_P2P){e.next=25;break}throw r.throw(e.t0),e.t0;case 25:return e.next=27,r.next((null===(i=o)||void 0===i?void 0:i.ortc)||[]);case 27:this._p2pChannel.reportPublishEvent(!0,null),a=K(t),e.prev=29,a.s();case 31:if((s=a.n()).done){e.next=40;break}if((c=s.value)instanceof Mz&&c._encoderConfig&&this._gateway.setVideoProfile(c._encoderConfig),e.t1=!c.muted&&c.enabled,e.t1){e.next=38;break}return e.next=38,this._p2pChannel.muteLocalTrack(c);case 38:e.next=31;break;case 40:e.next=45;break;case 42:e.prev=42,e.t2=e.catch(29),a.e(e.t2);case 45:return e.prev=45,a.f(),e.finish(45);case 48:e.next=55;break;case 50:if(e.prev=50,e.t3=e.catch(7),this._p2pChannel.reportPublishEvent(!1,null==e.t3?void 0:e.t3.code,t),(null==e.t3?void 0:e.t3.code)!==mD.WS_ABORT){e.next=54;break}return e.abrupt("return");case 54:throw e.t3;case 55:case"end":return e.stop()}}),e,this,[[7,50],[15,21],[29,42,45,48]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"_publishLowStream",value:function(){var e=y(G.mark((function e(){var t,r,n,i,o;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._joinInfo&&void 0!==this._uid){e.next=2;break}throw new SD(mD.INVALID_OPERATION,"Can't publish stream, haven't joined yet!");case 2:if("CONNECTED"===this.connectionState||"RECONNECTING"===this.connectionState){e.next=4;break}throw new SD(mD.INVALID_OPERATION,"can not publish stream in ".concat(this.connectionState," state"));case 4:return ND.debug("[".concat(this._clientId,"] publish low stream")),ZD("debug",this,"_publishLowStream"),(t=this._configDistribute.getLowStreamConfigDistribute())&&t.bitrate&&(this._lowStreamParameter||(this._lowStreamParameter={width:160,height:120,framerate:15,bitrate:50}),this._lowStreamParameter&&this._lowStreamParameter.bitrate&&t.bitrate<this._lowStreamParameter.bitrate&&(this._lowStreamParameter.bitrate=t.bitrate)),e.prev=7,e.next=10,this._p2pChannel.publishLowStream(this._lowStreamParameter);case 10:return r=e.sent,e.next=13,r.next();case 13:if(!(n=e.sent.value)){e.next=26;break}return e.prev=15,e.next=18,this._gateway.publish(this._uid,n,!0);case 18:o=e.sent,e.next=25;break;case 21:if(e.prev=21,e.t0=e.catch(15),e.t0.code===mD.DISCONNECT_P2P){e.next=25;break}throw r.throw(e.t0),e.t0;case 25:r.next((null===(i=o)||void 0===i?void 0:i.ortc)||[]),this._p2pChannel.reportPublishEvent(!0,null,void 0,!0);case 26:e.next=33;break;case 28:if(e.prev=28,e.t1=e.catch(7),this._p2pChannel.reportPublishEvent(!1,null==e.t1?void 0:e.t1.code,void 0,!0),(null==e.t1?void 0:e.t1.code)!==mD.WS_ABORT){e.next=32;break}return e.abrupt("return");case 32:throw e.t1;case 33:case"end":return e.stop()}}),e,this,[[7,28],[15,21]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"_createLiveStreamingClient",value:function(e){var t=this;if(!this._joinInfo||!this._appId)return new SD(mD.INVALID_OPERATION,"can not create live streaming client, please join channel first").throw();var r=function(){return new kJ(t._joinInfo,t._config.websocketRetryConfig||bD,t._config.httpRetryConfig||bD)},n=function(e){e.onLiveStreamError=function(e,r){zj.reportApiInvoke(t._sessionId,{name:Ux.ON_LIVE_STREAM_ERROR,options:[e,r],tag:Qx.TRACER}).onSuccess(),t.emit(Jx.LIVE_STREAMING_ERROR,e,r)},e.onLiveStreamWarning=function(e,r){zj.reportApiInvoke(t._sessionId,{name:Ux.ON_LIVE_STREAM_WARNING,options:[e,r],tag:Qx.TRACER}).onSuccess(),t.emit(Jx.LIVE_STREAMING_WARNING,e,r)},e.on(IP.REQUEST_WORKER_MANAGER_LIST,(function(e,r,n){if(!t._joinInfo)return n(new SD(mD.INVALID_OPERATION,"can not find join info to get worker manager"));AJ(e,t._joinInfo,t._axiosCancelSource.token,bD).then(r).catch(n)}))};switch(e){case lP.RAW:return this._liveRawStreamingClient||(this._liveRawStreamingClient=r(),n(this._liveRawStreamingClient)),this._liveRawStreamingClient;case lP.TRANSCODE:return this._liveTranscodeStreamingClient||(this._liveTranscodeStreamingClient=r(),n(this._liveTranscodeStreamingClient)),this._liveTranscodeStreamingClient;case lP.INJECT:return this._injectStreamingClient||(this._injectStreamingClient=r(),this._injectStreamingClient.on(IP.REQUEST_WORKER_MANAGER_LIST,(function(e,r,n){if(!t._joinInfo)return n(new SD(mD.INVALID_OPERATION,"can not find join info to get worker manager"));AJ(e,t._joinInfo,t._axiosCancelSource.token,bD).then(r).catch(n)})),this._injectStreamingClient.onInjectStatusChange=function(e,r,n){t.emit(Jx.INJECT_STREAM_STATUS,e,r,n)}),this._injectStreamingClient}}},{key:"_createChannelMediaRelayClient",value:function(){var e=this;return this._joinInfo?(this._channelMediaRelayClient||(this._channelMediaRelayClient=new LJ(this._joinInfo,this._clientId,this._config.websocketRetryConfig||bD,this._config.httpRetryConfig||bD),this._channelMediaRelayClient.on("state",(function(t){t===RP.RELAY_STATE_FAILURE&&e._channelMediaRelayClient&&e._channelMediaRelayClient.dispose(),e.emit(Jx.CHANNEL_MEDIA_RELAY_STATE,t)})),this._channelMediaRelayClient.on("event",(function(t){e.emit(Jx.CHANNEL_MEDIA_RELAY_EVENT,t)}))),this._channelMediaRelayClient):new SD(mD.INVALID_OPERATION,"can not create channel media relay client, please join channel first").throw()}},{key:"_handleGatewayEvents",value:function(){var e=this;this._gateway.on(OP.DISCONNECT_P2P,y(G.mark((function t(){return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e._p2pChannel.disconnectForReconnect();case 2:case"end":return t.stop()}}),t)})))),this._gateway.on(OP.CONNECTION_STATE_CHANGE,(function(t,r,n){var i;if(n!==qx.FALLBACK){var o=function(){e.emit(Jx.CONNECTION_STATE_CHANGE,t,r,n)};if(zj.reportApiInvoke(e._sessionId||(null===(i=e._gateway.joinInfo)||void 0===i?void 0:i.sid)||null,{name:Ux.CONNECTION_STATE_CHANGE,options:[t,r,n],tag:Qx.TRACER}).onSuccess(JSON.stringify({cur:t,prev:r,reason:n})),ND.info("[".concat(e._clientId,"] connection state change: ").concat(r," -> ").concat(t)),JD("info",e,"connection-state-change","".concat(r," -> ").concat(t)),"DISCONNECTED"===t)return e._reset(),void o();if("RECONNECTING"===t)e._users.forEach((function(e){e._trust_in_room_=!1,e._trust_audio_enabled_state_=!1,e._trust_video_enabled_state_=!1,e._trust_audio_mute_state_=!1,e._trust_video_mute_state_=!1,e._trust_stream_added_state_=!1})),e._userOfflineTimeout&&window.clearTimeout(e._userOfflineTimeout),e._streamRemovedTimeout&&window.clearTimeout(e._streamRemovedTimeout),e._userOfflineTimeout=void 0,e._streamRemovedTimeout=void 0;else if("CONNECTED"===t){var a;e._streamFallbackTypeCacheMap.forEach((function(t,r){e._gateway.setStreamFallbackOption(r,t).catch((function(t){ND.warning("[".concat(e._clientId,"] auto set stream fallback option failed"),t),qD("warning",e,"auto set stream fallback option failed, ".concat(t.toString()))}))})),e._remoteStreamTypeCacheMap.forEach((function(t,r){e._gateway.setRemoteVideoStreamType(r,t).catch((function(t){ND.warning("[".concat(e._clientId,"] auto set remote stream type failed"),t),qD("warning",e,"auto set remote stream type failed, ".concat(t.toString()))}))})),void 0!==e._remoteDefaultVideoStreamType&&void 0===(null===(a=e._joinInfo)||void 0===a?void 0:a.defaultVideoStream)&&e.setRemoteDefaultVideoStreamType(e._remoteDefaultVideoStreamType).then((function(){ND.debug("[".concat(e._clientId,"] setRemoteDefaultVideoStreamType after gateway connected"))})).catch((function(t){ND.error("[".concat(e._clientId,"] setRemoteDefaultVideoStreamType after gateway failed, ").concat(t))})),e._p2pChannel.republish(),e._userOfflineTimeout=window.setTimeout((function(){"CONNECTED"===e.connectionState&&(e._userOfflineTimeout=void 0,e._users.filter((function(e){return!e._trust_in_room_})).forEach((function(t){ND.debug("[".concat(e._clientId,"] user offline timeout, emit user offline ").concat(t.uid)),qD("debug",e,"user offline timeout, emit user offline ".concat(t.uid)),e._handleUserOffline({uid:t.uid})})))}),3e3),e._streamRemovedTimeout=window.setTimeout((function(){"CONNECTED"===e.connectionState&&(e._streamRemovedTimeout=void 0,e._users.forEach((function(t){t._trust_audio_mute_state_||(ND.debug("[".concat(e._clientId,"] auto dispatch audio unmute event ").concat(t.uid)),qD("debug",e,"auto dispatch audio unmute event ".concat(t.uid)),e._handleMuteStream(t.uid,"audio",!1)),t._trust_video_mute_state_||(ND.debug("[".concat(e._clientId,"] auto dispatch video unmute event ").concat(t.uid)),qD("debug",e,"auto dispatch video unmute event ".concat(t.uid)),e._handleMuteStream(t.uid,"video",!1)),t._trust_audio_enabled_state_||(ND.debug("[".concat(e._clientId,"] auto dispatch enable local audio ").concat(t.uid)),qD("debug",e,"auto dispatch enable local audio ".concat(t.uid)),e._handleSetStreamLocalEnable("audio",t.uid,!0)),!t._trust_video_enabled_state_&&t._video_enabled_&&(ND.debug("[".concat(e._clientId,"] auto dispatch enable local video ").concat(t.uid)),qD("debug",e,"auto dispatch enable local video ".concat(t.uid)),e._handleSetStreamLocalEnable("video",t.uid,!0)),t._trust_stream_added_state_||(ND.debug("[".concat(e._clientId,"] auto dispatch stream remove ").concat(t.uid)),qD("debug",e,"auto dispatch stream remove ".concat(t.uid)),e._handleRemoveStream({uid:t.uid,uint_id:t._uintid}))})))}),1e3)}o()}})),this._gateway.on(OP.REQUEST_NEW_GATEWAY_LIST,(function(t,r){if(!e._joinInfo)return r(new SD(mD.UNEXPECTED_ERROR,"can not recover, no join info"));nJ(e._joinInfo,e._axiosCancelSource.token,e._config.httpRetryConfig||bD).then((function(r){e._joinInfo&&(e._joinInfo.apResponse=r.gatewayInfo.res,e._joinInfo.gatewayAddrs=r.gatewayInfo.gatewayAddrs,e._joinInfo.uni_lbs_ip=r.gatewayInfo.uni_lbs_ip),t(r.gatewayInfo.gatewayAddrs.map((function(t){if(e._joinInfo&&e._joinInfo.proxyServer){var r=t.address.split(":");return"wss://".concat(e._joinInfo.proxyServer,"/ws/?h=").concat(r[0],"&p=").concat(r[1])}return"wss://".concat(t.address)})))})).catch(r)})),this._gateway.on(OP.NETWORK_QUALITY,(function(t){"normal"===e._networkQualitySensitivity&&e.emit(Jx.NETWORK_QUALITY,t)})),this._gateway.on(OP.STREAM_TYPE_CHANGE,(function(t,r){e.emit(Jx.STREAM_TYPE_CHANGED,t,r),zj.reportApiInvoke(e._sessionId,{name:Ux.STREAM_TYPE_CHANGE,options:[t,r],tag:Qx.TRACER}).onSuccess(JSON.stringify({uid:t,streamType:r}))})),this._gateway.on(OP.IS_P2P_DISCONNECTED,(function(t){e._p2pChannel.isP2PDisconnected()?t(!0):e._p2pChannel.hasLocalMedia()||e._p2pChannel.hasRemoteMedia()?t(!1):t(!0)})),this._gateway.on(OP.NEED_RENEW_SESSION,(function(){e._startSession()})),this._gateway.on(OP.REQUEST_P2P_CONNECTION_PARAMS,function(){var t=y(G.mark((function t(r,n,i){return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.t0=n,t.next=4,e._p2pChannel.startP2PConnection(r);case 4:t.t1=t.sent,(0,t.t0)(t.t1),t.next=11;break;case 8:t.prev=8,t.t2=t.catch(0),i(t.t2);case 11:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e,r,n){return t.apply(this,arguments)}}()),this._gateway.on(OP.JOIN_RESPONSE,(function(t,r,n){var i=S$(t.ortc,r,n),o=i.dtlsParameters,a=i.iceParameters,s=i.candidates,c=i.rtpCapabilities,u=i.setup,d=i.cname;e._p2pChannel.connect(a,o,s,c,u,d)})),this._gateway.signal.on(tP.ON_USER_ONLINE,this._handleUserOnline),this._gateway.signal.on(tP.ON_USER_OFFLINE,this._handleUserOffline),this._gateway.signal.on(tP.ON_ADD_AUDIO_STREAM,(function(t){return e._handleAddAudioOrVideoStream("audio",t.uid,t.ssrcId,t.cname,t.uint_id,t.ortc)})),this._gateway.signal.on(tP.ON_ADD_VIDEO_STREAM,(function(t){return e._handleAddAudioOrVideoStream("video",t.uid,t.ssrcId,t.cname,t.uint_id,t.ortc,t.rtxSsrcId)})),this._gateway.signal.on(tP.ON_REMOVE_STREAM,this._handleRemoveStream),this._gateway.signal.on(tP.ON_P2P_LOST,this._handleP2PLost),this._gateway.signal.on(tP.MUTE_AUDIO,(function(t){return JD("debug",["AgoraRTCGateway",e._clientId],"mute_audio",{uid:t.uid}),e._handleMuteStream(t.uid,"audio",!0)})),this._gateway.signal.on(tP.UNMUTE_AUDIO,(function(t){return JD("debug",["AgoraRTCGateway",e._clientId],"unmute_audio",{uid:t.uid}),e._handleMuteStream(t.uid,"audio",!1)})),this._gateway.signal.on(tP.MUTE_VIDEO,(function(t){return JD("debug",["AgoraRTCGateway",e._clientId],"mute_video",{uid:t.uid}),e._handleMuteStream(t.uid,"video",!0)})),this._gateway.signal.on(tP.UNMUTE_VIDEO,(function(t){return JD("debug",["AgoraRTCGateway",e._clientId],"unmute_video",{uid:t.uid}),e._handleMuteStream(t.uid,"video",!1)})),this._gateway.signal.on(tP.RECEIVE_METADATA,(function(t){var r=pK(t.metadata);e.emit(Jx.RECEIVE_METADATA,t.uid,r)})),this._gateway.signal.on(tP.ON_DATA_STREAM,(function(t){t.seq&&delete t.seq,t.payload=pK(t.payload),e.emit(Jx.STREAM_MESSAGE,t.uid,t.payload),e.onStreamMessage&&e.onStreamMessage(t)})),this._gateway.signal.on(tP.ON_CRYPT_ERROR,(function(){lK((function(){ND.warning("[".concat(e._clientId,"] on crypt error")),JD("warning",e,"crypt_error"),e.emit(Jx.CRYPT_ERROR)}),e._sessionId)})),this._gateway.signal.on(tP.ON_TOKEN_PRIVILEGE_WILL_EXPIRE,this._handleTokenWillExpire),this._gateway.signal.on(tP.ON_TOKEN_PRIVILEGE_DID_EXPIRE,(function(){ND.warning("[".concat(e._clientId,"] received message onTokenPrivilegeDidExpire, please get new token and join again")),JD("warning",e,"token_privilege_did_expire"),e._gateway.leave(!0),e.emit(Jx.ON_TOKEN_PRIVILEGE_DID_EXPIRE),e._reset()})),this._gateway.signal.on(tP.ON_STREAM_FALLBACK_UPDATE,(function(t){ND.debug("[".concat(e._clientId,"] stream fallback peerId: ").concat(t.stream_id,", attr: ").concat(t.stream_type)),JD("debug",e,"stream_fallback_update",{peerId:t.stream_id,attr:t.stream_type}),e.emit(Jx.STREAM_FALLBACK,t.stream_id,1===t.stream_type?"fallback":"recover")})),this._gateway.signal.on(tP.ON_PUBLISH_STREAM,(function(t){e.uid===e._uid&&(e._p2pChannel.reportPublishEvent(!0,null,void 0,!1,JSON.stringify({proxy:t.proxy})),ND.info("[".concat(e._clientId,"] on publish stream, ").concat(JSON.stringify(t))),JD("info",e,"publish_stream",t))})),this._gateway.signal.on(tP.ENABLE_LOCAL_VIDEO,(function(t){e._handleSetStreamLocalEnable("video",t.uid,!0)})),this._gateway.signal.on(tP.DISABLE_LOCAL_VIDEO,(function(t){e._handleSetStreamLocalEnable("video",t.uid,!1)})),this._gateway.signal.on(Zx.REQUEST_TIMEOUT,(function(t,r){if(e._joinInfo)switch(t){case $x.PUBLISH:if(!r)return;var n=(r=r).ortc;if(n){var i,o,a,s,c=n.some((function(e){return e.stream_type===kP.Audio})),u=n.some((function(e){return e.stream_type!==kP.Audio})),d=n.some((function(e){var t=e.stream_type;return t===kP.Screen||t===kP.ScreenLow}));"offer"===r.state&&zj.publish(e._joinInfo.sid,{eventElapse:wG.measureFromPublishStart(e.store.clientId,e.store.pubId),succ:!1,ec:mD.TIMEOUT,audio:c,video:u,p2pid:r.p2p_id,publishRequestid:e.store.pubId,screenshare:d,audioName:c?null===(i=n.find((function(e){return e.stream_type===kP.Audio})))||void 0===i||null===(o=i.ssrcs[0])||void 0===o?void 0:o.ssrcId.toString():void 0,videoName:u?null===(a=n.find((function(e){return e.stream_type!==kP.Audio})))||void 0===a||null===(s=a.ssrcs[0])||void 0===s?void 0:s.ssrcId.toString():void 0})}break;case $x.SUBSCRIBE:(r=r)&&zj.subscribe(e._joinInfo.sid,{succ:!1,ec:mD.TIMEOUT,audio:r.stream_type===YP.AUDIO,video:r.stream_type===YP.VIDEO,peerid:r.stream_id,subscribeRequestid:r.ssrcId,p2pid:e.store.p2pId,eventElapse:wG.measureFromSubscribeStart(e.store.clientId,r.ssrcId)})}})),this._gateway.signal.on(tP.ON_P2P_OK,(function(t){e.uid,e._uid})),this._gateway.signal.on(tP.ON_PUBLISHED_USER_LIST,(function(t){if(null!=t&&t.users){var r,n=[],i=[],o=K(t.users);try{var a=function(){var t=r.value,o=e._users.find((function(e){return e.uid===t.stream_id}));o?o._trust_in_room_=!0:(o=new jz(t.stream_id,t.stream_id),e._users.push(o),0===e.getListeners(Jx.PUBLISHED_USER_LIST).length&&(ND.debug("[".concat(e._clientId,"] user online"),t.stream_id),zD("info",e,"user-joined",{uid:t.stream_id}),e.emit(Jx.USER_JOINED,o)));var a=DP.Audio&t.stream_type,s=(DP.Video|DP.LwoVideo)&t.stream_type,c=a&&o.hasAudio,u=s&&o.hasVideo;t.stream_type!==DP.Nothing&&(o._trust_stream_added_state_=!0),s&&(o._video_added_=!0,o._videoSSRC=t.video_ssrc),a&&(o._audio_added_=!0,o._audioSSRC=t.audio_ssrc),a&&!c&&0===e.getListeners(Jx.PUBLISHED_USER_LIST).length&&(ND.info("[".concat(e._clientId,"] remote user ").concat(o.uid," published audio")),qD("info",e,"remote user ".concat(o.uid," published audio")),e.emit(Jx.USER_PUBLISHED,o,"audio")),s&&!u&&0===e.getListeners(Jx.PUBLISHED_USER_LIST).length&&(ND.info("[".concat(e._clientId,"] remote user ").concat(o.uid," published video")),qD("info",e,"remote user ".concat(o.uid," published video")),e.emit(Jx.USER_PUBLISHED,o,"video")),(a&&!c||s&&!u)&&n.push(o),s&&e._p2pChannel.hasPendingRemoteMedia(o,"video")&&i.push({user:o,mediaType:"video"}),a&&e._p2pChannel.hasPendingRemoteMedia(o,"audio")&&i.push({user:o,mediaType:"audio"})};for(o.s();!(r=o.n()).done;)a()}catch(e){o.e(e)}finally{o.f()}i.length>0&&(ND.debug("[".concat(e._clientId,"] RE massSubscribe after reconnect ").concat(i.map((function(e){return"user: ".concat(e.user.uid,", mediaType: ").concat(e.mediaType)})).join("; ")," ")),e.massSubscribe(i).catch((function(t){ND.error("[".concat(e._clientId,"] mass resubscribe error"),t.toString())}))),e.getListeners(Jx.PUBLISHED_USER_LIST).length>0?(ND.info("[".concat(e._clientId,"] client emit user-list event, users: ").concat(n.map((function(e){return e.uid})).join(", "))),e.emit(Jx.PUBLISHED_USER_LIST,n)):ND.info("[".concat(e._clientId,"] client not emit user-list event case there is no user-list listener, users: ").concat(n.map((function(e){return e.uid})).join(", ")))}}))}},{key:"_handleP2PChannelEvents",value:function(){var e=this;this._p2pChannel.on(zP.RequestMuteLocal,function(){var t=y(G.mark((function t(r,n,i){return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e._joinInfo){t.next=12;break}return t.prev=1,t.next=4,e._gateway.muteLocal(r,e._joinInfo.stringUid||e._joinInfo.uid);case 4:n(),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),t.t0.code===mD.DISCONNECT_P2P?n():i(t.t0);case 10:t.next=13;break;case 12:n();case 13:case"end":return t.stop()}}),t,null,[[1,7]])})));return function(e,r,n){return t.apply(this,arguments)}}()),this._p2pChannel.on(zP.RequestUnmuteLocal,function(){var t=y(G.mark((function t(r,n,i){return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e._joinInfo){t.next=12;break}return t.prev=1,t.next=4,e._gateway.unmuteLocal(r,e._joinInfo.stringUid||e._joinInfo.uid);case 4:n(),t.next=10;break;case 7:t.prev=7,t.t0=t.catch(1),t.t0.code===mD.DISCONNECT_P2P?n():i(t.t0);case 10:t.next=13;break;case 12:n();case 13:case"end":return t.stop()}}),t,null,[[1,7]])})));return function(e,r,n){return t.apply(this,arguments)}}()),this._p2pChannel.on(zP.RequestRePublish,(function(t,r,n){e.publish(t,!1).then(r).catch(n)})),this._p2pChannel.on(zP.RequestReSubscribe,function(){var t=y(G.mark((function t(r,n,i){var o,a,s,c;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.prev=0,o=K(r),t.prev=2,o.s();case 4:if((a=o.n()).done){t.next=15;break}if(s=a.value,c=s.user,s.kind!==YP.VIDEO){t.next=11;break}return t.next=9,e.subscribe(c,"video");case 9:t.next=13;break;case 11:return t.next=13,e.subscribe(c,"audio");case 13:t.next=4;break;case 15:t.next=20;break;case 17:t.prev=17,t.t0=t.catch(2),o.e(t.t0);case 20:return t.prev=20,o.f(),t.finish(20);case 23:n(),t.next=29;break;case 26:t.prev=26,t.t1=t.catch(0),i(t.t1);case 29:case"end":return t.stop()}}),t,null,[[0,26],[2,17,20,23]])})));return function(e,r,n){return t.apply(this,arguments)}}()),this._p2pChannel.on(zP.RequestUploadStats,(function(t,r){e._gateway.uploadStats(t,r)})),this._p2pChannel.on(zP.MediaReconnectStart,(function(t){e.emit(Jx.MEDIA_RECONNECT_START,t)})),this._p2pChannel.on(zP.MediaReconnectEnd,(function(t){e.emit(Jx.MEDIA_RECONNECT_END,t)})),this._p2pChannel.on(zP.NeedSignalRTT,(function(t){t(e._gateway.getSignalRTT())})),this._p2pChannel.on(zP.RequestRestartICE,y(G.mark((function t(){var r,n,i,o,a,s,c,u;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e._p2pChannel.reEstablish();case 2:if(!(r=t.sent)){t.next=15;break}return t.next=6,e._gateway.restartICE({iceParameters:r.iceParameters});case 6:return n=t.sent,i=n.restartICEResponse,o=n.gatewayIP,a=n.gatewayPort,s=function(e,t,r){var n,i=e.ice;return void 0!==t&&void 0!==r?(n=[{foundation:"udpcandidate",componentId:"1",transport:"udp",priority:"2103266323",connectionAddress:t,port:r.toString(),type:"host",extension:{}}],ND.debug("Using remote candidate from AP ".concat(t,":").concat(r)),qD("debug",[],"Using remote candidate from AP ".concat(t,":").concat(r))):n=i.candidates.map((function(e){return{foundation:e.foundation,componentId:"1",transport:e.protocol,priority:e.priority.toString(),connectionAddress:e.ip,port:e.port.toString(),type:e.type,extension:{}}})),{candidates:n,iceParameters:{iceUfrag:i.iceUfrag,icePwd:i.icePwd}}}(i,o,a),c=s.candidates,u=s.iceParameters,t.next=15,r.restartICE(u,c);case 15:case"end":return t.stop()}}),t)})))),this._p2pChannel.on(zP.RequestReconnect,y(G.mark((function t(){return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e._gateway.reconnect();case 1:case"end":return t.stop()}}),t)})))),this._p2pChannel.on(zP.RequestReconnectPC,y(G.mark((function t(){var r,n,i,o,a,s,c,u,d,l,p,f,h,A,v,g;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e._p2pChannel.startP2PConnection({turnServer:null===(r=e._joinInfo)||void 0===r?void 0:r.turnServer});case 2:return n=t.sent,i=n.iceParameters,o=n.dtlsParameters,a=n.rtpCapabilities,t.next=8,e._gateway.reconnectPC({iceParameters:i,dtlsParameters:o,rtpCapabilities:a});case 8:return s=t.sent,c=s.gatewayEstablishParams,u=s.gatewayIP,d=s.gatewayPort,l=S$(c,u,d),p=l.dtlsParameters,f=l.iceParameters,h=l.candidates,A=l.rtpCapabilities,v=l.setup,g=l.cname,t.next=21,e._p2pChannel.connect(f,p,h,A,v,g);case 21:return t.next=23,e._p2pChannel.republish();case 23:return t.next=25,e._p2pChannel.reSubscribe();case 25:case"end":return t.stop()}}),t)})))),this._p2pChannel.on(zP.RequestUnpublishForReconnectPC,function(){var t=y(G.mark((function t(r,n,i){return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e._joinInfo||void 0===e._uid){t.next=6;break}return t.next=3,e._gateway.unpublish(r,e._uid);case 3:n(),t.next=7;break;case 6:i();case 7:case"end":return t.stop()}}),t)})));return function(e,r,n){return t.apply(this,arguments)}}()),this._p2pChannel.on(zP.P2PLost,(function(){e.emit(Jx.P2P_LOST,e.store.uid)})),this._p2pChannel.on(zP.UpdateVideoEncoder,(function(t){t._encoderConfig&&e._gateway.setVideoProfile(t._encoderConfig)})),this._p2pChannel.on(zP.ConnectionTypeChange,(function(t){e.emit(Jx.IS_USING_CLOUD_PROXY,t)}))}},{key:"getKeyMetrics",value:function(){return this.store.keyMetrics}}]),r}(yD)).prototype,"setProxyServer",[G1],Object.getOwnPropertyDescriptor(z1.prototype,"setProxyServer"),z1.prototype),Ej(z1.prototype,"setTurnServer",[K1],Object.getOwnPropertyDescriptor(z1.prototype,"setTurnServer"),z1.prototype),Ej(z1.prototype,"setLocalAccessPoints",[H1],Object.getOwnPropertyDescriptor(z1.prototype,"setLocalAccessPoints"),z1.prototype),Ej(z1.prototype,"setRemoteDefaultVideoStreamType",[W1],Object.getOwnPropertyDescriptor(z1.prototype,"setRemoteDefaultVideoStreamType"),z1.prototype),Ej(z1.prototype,"setEncryptionConfig",[Y1],Object.getOwnPropertyDescriptor(z1.prototype,"setEncryptionConfig"),z1.prototype),Ej(z1.prototype,"pickSVCLayer",[q1],Object.getOwnPropertyDescriptor(z1.prototype,"pickSVCLayer"),z1.prototype),J1=z1))||J1),a0=function(e){k(r,e);var t=W(r);function r(e){var n;U(this,r);var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return n=t.call(this),rO(S(n),"audioBuffer",void 0),rO(S(n),"sourceNode",void 0),rO(S(n),"startPlayTime",0),rO(S(n),"startPlayOffset",0),rO(S(n),"pausePlayTime",0),rO(S(n),"options",void 0),rO(S(n),"currentLoopCount",0),rO(S(n),"_currentState","stopped"),n.audioBuffer=e,n.options=i,n.startPlayOffset=n.options.startPlayTime||0,n}return F(r,[{key:"currentState",get:function(){return this._currentState},set:function(e){e!==this._currentState&&(this._currentState=e,this.emit(nP.AUDIO_SOURCE_STATE_CHANGE,this._currentState))}},{key:"createWebAudioDiagram",value:function(){return this.context.createGain()}},{key:"duration",get:function(){return this.audioBuffer.duration}},{key:"currentTime",get:function(){return"stopped"===this.currentState?0:"paused"===this.currentState?this.pausePlayTime:(this.context.currentTime-this.startPlayTime+this.startPlayOffset)%this.audioBuffer.duration}},{key:"updateOptions",value:function(e){"stopped"===this.currentState?(this.options=e,this.startPlayOffset=this.options.startPlayTime||0):ND.warning("can not set audio source options")}},{key:"startProcessAudioBuffer",value:function(){this.sourceNode&&this.stopProcessAudioBuffer(),this.sourceNode=this.createSourceNode(),this.startSourceNode(),this.currentState="playing"}},{key:"pauseProcessAudioBuffer",value:function(){this.sourceNode&&"playing"===this.currentState&&(this.pausePlayTime=this.currentTime,this.sourceNode.onended=null,this.sourceNode.stop(),this.sourceNode.buffer=null,this.sourceNode=this.createSourceNode(),this.currentState="paused")}},{key:"seekAudioBuffer",value:function(e){this.sourceNode&&(this.sourceNode.onended=null,"playing"===this.currentState&&this.sourceNode.stop(),this.sourceNode=this.createSourceNode(),"playing"===this.currentState?(this.startPlayOffset=e,this.startSourceNode()):"paused"===this.currentState&&(this.pausePlayTime=e))}},{key:"resumeProcessAudioBuffer",value:function(){"paused"===this.currentState&&this.sourceNode&&(this.startPlayOffset=this.pausePlayTime,this.pausePlayTime=0,this.startSourceNode(),this.currentState="playing")}},{key:"stopProcessAudioBuffer",value:function(){if(this.sourceNode){this.sourceNode.onended=null;try{this.sourceNode.stop()}catch(e){}this.reset()}}},{key:"startSourceNode",value:function(){this.sourceNode&&this.sourceNode.buffer&&(this.sourceNode.start(0,this.startPlayOffset),this.startPlayTime=this.context.currentTime,this.sourceNode.onended=this.handleSourceNodeEnded.bind(this))}},{key:"createSourceNode",value:function(){var e=this.context.createBufferSource();return e.buffer=this.audioBuffer,e.loop=!!this.options.loop,e.connect(this.outputNode),e}},{key:"handleSourceNodeEnded",value:function(){if(this.currentLoopCount+=1,this.options.cycle&&this.options.cycle>this.currentLoopCount)return this.startPlayOffset=0,this.sourceNode=void 0,void this.startProcessAudioBuffer();this.reset()}},{key:"reset",value:function(){this.startPlayOffset=this.options.startPlayTime||0,this.currentState="stopped",this.sourceNode&&(this.sourceNode.disconnect(),this.sourceNode=void 0),this.currentLoopCount=0}}]),r}(gV),s0=new Map;function c0(e,t){return u0.apply(this,arguments)}function u0(){return u0=y(G.mark((function e(t,r){var n,i,o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=null,"string"!=typeof t){e.next=16;break}if(!(i=s0.get(t))){e.next=5;break}return e.abrupt("return",(ND.debug("use cached audio resource: ",t),i));case 5:return e.prev=5,e.next=8,wD((function(){return ED.get(t,{responseType:"arraybuffer"})}),void 0,void 0,{maxRetryCount:3});case 8:n=e.sent.data,e.next=14;break;case 11:throw e.prev=11,e.t0=e.catch(5),new SD(mD.FETCH_AUDIO_FILE_FAILED,e.t0.toString());case 14:e.next=20;break;case 16:return o=new Rb((function(e,r){var n=new FileReader;n.onload=function(t){t.target?e(t.target.result):r(new SD(mD.READ_LOCAL_AUDIO_FILE_ERROR))},n.onerror=function(){r(new SD(mD.READ_LOCAL_AUDIO_FILE_ERROR))},n.readAsArrayBuffer(t)})),e.next=19,o;case 19:n=e.sent;case 20:return e.next=22,function(e){var t=lV();return new Rb((function(r,n){t.decodeAudioData(e,(function(e){r(e)}),(function(e){n(new SD(mD.DECODE_AUDIO_FILE_FAILED,e.toString()))}))}))}(n);case 22:return a=e.sent,e.abrupt("return",("string"==typeof t&&r&&s0.set(t,a),a));case 24:case"end":return e.stop()}}),e,null,[[5,11]])}))),u0.apply(this,arguments)}function d0(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l0(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d0(Object(r),!0).forEach((function(t){rO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d0(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function p0(e,t,r,n){r.optimizationMode&&(n&&n.width&&n.height?(r.encoderConfig=l0(l0({},n),{},{bitrateMin:n.bitrateMin,bitrateMax:n.bitrateMax}),"motion"!==r.optimizationMode&&"detail"!==r.optimizationMode||(t.contentHint=r.optimizationMode,t.contentHint===r.optimizationMode?(ND.debug("[".concat(e,"] set content hint to"),r.optimizationMode),eN("debug",["AgoraRTC"],"videoTrackOptimizationModeProcess",[e,r,n])):(ND.debug("[".concat(e,"] set content hint failed")),eN("warning",["AgoraRTC"],"videoTrackOptimizationModeProcess",[e,r,n],"failed")))):(ND.warning("[".concat(e,"] can not apply optimization mode bitrate config, no encoderConfig")),qD("warning",["AgoraRTC"],"[".concat(e,"] can not apply optimization mode bitrate config, no encoderConfig"))))}var f0=Tk().name;function h0(e,t,r,n){var i,o=0,a=null;return new Rb((function(s,c){setTimeout((function(){i&&(i(),s(o))}),t),i=hV((function(){!function(){o>n&&i&&(i(),s(o));var t=r.getContext("2d");if(!t){var u=new SD(mD.UNEXPECTED_ERROR,"can not get canvas 2d context.");return ND.error(u.toString()),void c(u)}t.drawImage(e,0,0,160,120);var d=t.getImageData(0,0,r.width,r.height),l=Math.floor(d.data.length/3);if(a){for(var p=0;p<l;p+=3)if(d.data[p]!==a[p])return o+=1,void(a=d.data);a=d.data}else a=d.data}()}),30)}))}var A0,v0,g0=function(){function e(t,r){U(this,e),rO(this,"id",0),rO(this,"element",void 0),rO(this,"peerPair",void 0),rO(this,"context",void 0),rO(this,"audioPlayerElement",void 0),rO(this,"audioTrack",void 0),e.count+=1,this.id=e.count,this.element=t,this.context=r}return F(e,[{key:"initPeers",value:function(){var e=this;this.peerPair=[new RTCPeerConnection,new RTCPeerConnection],this.peerPair[1].ontrack=function(t){var r=document.createElement("audio");r.srcObject=new MediaStream([t.track]),r.play(),e.audioPlayerElement=r}}},{key:"switchSdp",value:function(){var e=y(G.mark((function e(){var t,r,n,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.peerPair){e.next=2;break}return e.abrupt("return");case 2:return t=function(){var e=y(G.mark((function e(t,r){var n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("offer"!==r){e.next=6;break}return e.next=3,t.createOffer();case 3:e.t0=e.sent,e.next=9;break;case 6:return e.next=8,t.createAnswer();case 8:e.t0=e.sent;case 9:return n=e.t0,e.next=12,t.setLocalDescription(n);case 12:return e.abrupt("return","complete"===t.iceGatheringState?t.localDescription:new Rb((function(e){t.onicegatheringstatechange=function(){"complete"===t.iceGatheringState&&e(t.localDescription)}})));case 13:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),r=function(){var e=y(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.setRemoteDescription(r);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),e.prev=3,e.next=6,t(this.peerPair[0],"offer");case 6:return n=e.sent,e.next=9,r(this.peerPair[1],n);case 9:return e.next=11,t(this.peerPair[1],"answer");case 11:return i=e.sent,e.next=14,r(this.peerPair[0],i);case 14:e.next=19;break;case 16:throw e.prev=16,e.t0=e.catch(3),new SD(mD.LOCAL_AEC_ERROR,e.t0.toString()).print();case 19:case"end":return e.stop()}}),e,this,[[3,16]])})));function t(){return e.apply(this,arguments)}return t}()},{key:"getTracksFromMediaElement",value:function(){var e=y(G.mark((function e(t){var r,n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.audioTrack){e.next=2;break}return e.abrupt("return",this.audioTrack);case 2:e.prev=2,t instanceof HTMLVideoElement&&(t.captureStream?t.captureStream():t.mozCaptureStream()),r=this.context.createMediaStreamDestination(),this.context.createMediaElementSource(t).connect(r),e.next=10;break;case 7:throw e.prev=7,e.t0=e.catch(2),new SD(mD.LOCAL_AEC_ERROR,e.t0.toString()).print();case 10:if(r){e.next=12;break}throw new SD(mD.LOCAL_AEC_ERROR,"no dest node when local aec").print();case 12:return n=r.stream.getAudioTracks()[0],e.abrupt("return",(this.audioTrack=n,n));case 14:case"end":return e.stop()}}),e,this,[[2,7]])})));function t(t){return e.apply(this,arguments)}return t}()},{key:"getElement",value:function(){return this.element}},{key:"startEchoCancellation",value:function(){var e=y(G.mark((function e(){var t,r;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.context.resume(),this.peerPair&&this.close(),this.initPeers(),t=this.element,e.next=4,this.getTracksFromMediaElement(t);case 4:return r=e.sent,this.peerPair&&this.peerPair[0].addTrack(r),e.next=8,this.switchSdp();case 8:case"end":return e.stop()}}),e,this)})));function t(){return e.apply(this,arguments)}return t}()},{key:"close",value:function(){ND.debug("close echo cancellation unit, id is",this.id),this.audioPlayerElement&&this.audioPlayerElement.pause(),this.peerPair&&this.peerPair.forEach((function(e){e.close()})),this.peerPair=void 0,this.audioPlayerElement=void 0}}]),e}();rO(g0,"count",0);var m0=window.AudioContext||window.webkitAudioContext,E0=new(A0=qj({report:zj}),Ej((v0=function(){function e(){U(this,e),rO(this,"units",[]),rO(this,"context",void 0)}return F(e,[{key:"processExternalMediaAEC",value:function(e){if(!this._doesEnvironmentNeedAEC())return ND.debug("the system does not need to process local aec"),-1;this.context||(this.context=new m0);var t=this.units.find((function(t){return t&&t.getElement()===e}));return t||(t=new g0(e,this.context),this.units.push(t)),t.startEchoCancellation(),ND.debug("start processing local audio echo cancellation, id is",t.id),t.id}},{key:"_doesEnvironmentNeedAEC",value:function(){return Tk().name!==Sk.SAFARI}}]),e}()).prototype,"processExternalMediaAEC",[A0],Object.getOwnPropertyDescriptor(v0.prototype,"processExternalMediaAEC"),v0.prototype),v0);vN("PROCESS_ID","process-".concat(XG(8,""),"-").concat(XG(4,""),"-").concat(XG(4,""),"-").concat(XG(4,""),"-").concat(XG(12,""))),function(){var e=Tk();iL.getDisplayMedia=!(!navigator.mediaDevices||!navigator.mediaDevices.getDisplayMedia),iL.getStreamFromExtension=e.name===Sk.CHROME&&Number(e.version)>34,iL.supportUnifiedPlan=function(){if(!window.RTCRtpTransceiver)return!1;if(!("currentDirection"in RTCRtpTransceiver.prototype))return!1;var e=new RTCPeerConnection,t=!1;try{e.addTransceiver("audio"),t=!0}catch(e){}return e.close(),t}(),iL.supportMinBitrate=e.name===Sk.CHROME||e.name===Sk.EDGE,iL.supportSetRtpSenderParameters=function(){var e=Tk();return!!(window.RTCRtpSender&&window.RTCRtpSender.prototype.setParameters&&window.RTCRtpSender.prototype.getParameters)&&(!!Yk()||!(!Mk()&&!xk())||e.name===Sk.FIREFOX&&Number(e.version)>=64)}(),e.name===Sk.SAFARI&&(Number(e.version)>=14?iL.supportDualStream=!0:iL.supportDualStream=!1),iL.webAudioMediaStreamDest=function(){var e=Tk();return!(e.name===Sk.SAFARI&&Number(e.version)<12)}(),iL.supportReplaceTrack=!!window.RTCRtpSender&&"function"==typeof RTCRtpSender.prototype.replaceTrack,iL.supportWebGL="undefined"!=typeof WebGLRenderingContext,iL.supportRequestFrame=!!window.CanvasCaptureMediaStreamTrack,Yk()||(iL.webAudioWithAEC=!0),iL.supportShareAudio=function(){var e=Tk();return(e.os===Ik.WIN_10||e.os===Ik.WIN_81||e.os===Ik.WIN_7||e.os===Ik.LINUX||e.os===Ik.MAC_OS)&&e.name===Sk.CHROME&&Number(e.version)>=74}(),iL.supportDualStreamEncoding=function(){var e=Tk();return"Safari"===e.name&&Number(e.version)>=14}(),ND.info("browser compatibility",JSON.stringify(iL),JSON.stringify(e)),ZD("info",[],"updateAgoraRTCCompatibility",{browserCompatibility:iL,browserInfo:e})}(),function(){var e;try{e=window.localStorage.getItem("websdk_ng_global_parameter")}catch(e){return void ND.error("Error loading sdk config",e.message)}if(e)try{var t=JSON.parse(window.atob(e)),r=Date.now();ND.debug("Loading global parameters from cache",t),ZD("debug",[],"loadConfigFromLocalStorage",t),Object.keys(t).forEach((function(e){if(Object.prototype.hasOwnProperty.call(mN,e)){var n=t[e],i=n.value,o=n.expires;if(o&&o<=r)return;EN[e]=i,mN[e]=i}}))}catch(t){ND.error("Error loading mutableParamsCache: ".concat(e),t.message)}}();var _0={__CLIENT_LIST__:CN,__TRACK_LIST__:wN,VERSION:oN,BUILD:iN,setParameter:vN,getParameter:gN,getSupportedCodec:function(){var e=y(G.mark((function e(){var t,r,n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t={audio:[],video:[]},e.prev=1,(r=new RTCPeerConnection).addTransceiver("video",{direction:"recvonly"}),r.addTransceiver("audio",{direction:"recvonly"}),e.next=6,r.createOffer();case 6:if(n=e.sent.sdp){e.next=9;break}return e.abrupt("return",t);case 9:r.close(),r=null,t=function(e){var t={video:[],audio:[]};return e.match(/ VP8/i)&&t.video.push("VP8"),e.match(/ VP9/i)&&t.video.push("VP9"),e.match(/ AV1/i)&&t.video.push("AV1"),e.match(/ H264/i)&&t.video.push("H264"),e.match(/ opus/i)&&t.audio.push("OPUS"),e.match(/ PCMU/i)&&t.audio.push("PCMU"),e.match(/ PCMA/i)&&t.audio.push("PCMA"),e.match(/ G722/i)&&t.audio.push("G722"),t}(n),e.next=15;break;case 12:throw e.prev=12,e.t0=e.catch(1),new SD(mD.CREATE_OFFER_FAILED,e.t0.toString&&e.t0.toString()).print();case 15:return e.abrupt("return",t);case 16:case"end":return e.stop()}}),e,null,[[1,12]])})));function t(){return e.apply(this,arguments)}return t}(),checkSystemRequirements:function(){var e=zj.reportApiInvoke(null,{name:Ux.CHECK_SYSTEM_REQUIREMENTS,options:[],tag:Qx.TRACER}),t=!1;try{var r=window.RTCPeerConnection,n=navigator.mediaDevices&&navigator.mediaDevices.getUserMedia,i=window.WebSocket;t=!!(r&&n&&i)}catch(e){return ND.error("check system requirement failed: ",e),!1}var o=!1,a=Tk();a.name===Sk.CHROME&&Number(a.version)>=58&&(!Lk()||Pk())&&(o=!0),a.name===Sk.FIREFOX&&Number(a.version)>=56&&(o=!0),a.name===Sk.OPERA&&Number(a.version)>=45&&(o=!0),a.name===Sk.SAFARI&&Number(a.version)>=11&&(o=!0),(Hk()||Tk().name===Sk.QQ)&&(o=!0),ND.debug("checkSystemRequirements, api:",t,"browser",o);var s=t&&o;return e.onSuccess(s),s},getDevices:function(e){return lG.enumerateDevices(!0,!0,e)},getMicrophones:function(e){return lG.getRecordingDevices(e)},getCameras:function(e){return lG.getCamerasDevices(e)},getElectronScreenSources:SV,getPlaybackDevices:function(e){return lG.getSpeakers(e)},createClient:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{codec:"vp8",audioCodec:"opus",mode:"rtc"},t=zj.reportApiInvoke(null,{name:Ux.CREATE_CLIENT,options:[e],tag:Qx.TRACER});try{aP(e)}catch(e){throw t.onError(e),e}return void 0===e.audioCodec&&(e.audioCodec="opus"),t.onSuccess(),new o0(i0(i0({forceWaitGatewayResponse:!0},e),{},{role:"rtc"===e.mode?"host":e.role}))},createCameraVideoTrack:function(){var e=y(G.mark((function e(){var t,r,n,i,o,a,s,c=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=c.length>0&&void 0!==c[0]?c[0]:{encoderConfig:"480p_1"},r=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.CREATE_CAM_VIDEO_TRACK,options:[l0({},t)]}),n=cz(t),i=XG(8,"track-cam-"),o=null,ND.info("start create camera video track with config",JSON.stringify(t),"trackId",i),eN("info",["AgoraRTC"],"createCameraVideoTrack",t),e.prev=4,e.next=7,OV({video:n},i);case 7:if(e.t0=e.sent.getVideoTracks()[0],e.t0){e.next=10;break}e.t0=null;case 10:o=e.t0,e.next=16;break;case 13:throw e.prev=13,e.t1=e.catch(4),r.onError(e.t1),e.t1;case 16:if(o){e.next=19;break}return a=new SD(mD.UNEXPECTED_ERROR,"can not find track in media stream"),e.abrupt("return",(r.onError(a),a.throw()));case 19:return t.optimizationMode&&p0(i,o,t,t.encoderConfig&&lN(t.encoderConfig)),s=new Uz(o,t,n,t.scalabiltyMode?fN(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,i),e.abrupt("return",(r.onSuccess(s.getTrackId()),ND.info("create camera video success, trackId:",i),eN("info",["AgoraRTC"],"createCameraVideoTrack",void 0,i),s));case 22:case"end":return e.stop()}}),e,null,[[4,13]])})));function t(){return e.apply(this,arguments)}return t}(),createCustomVideoTrack:function(e){var t=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.CREATE_CUSTOM_VIDEO_TRACK,options:[e]}),r=new Mz(e.mediaStreamTrack,{bitrateMax:e.bitrateMax,bitrateMin:e.bitrateMin},e.scalabiltyMode?fN(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode);return t.onSuccess(r.getTrackId()),ND.info("create custom video track success with config",e,"trackId",r.getTrackId()),eN("info",["AgoraRTC"],"createCustomVideoTrack",e,r.getTrackId()),r},createScreenVideoTrack:function(){var e=y(G.mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,p,f,h,A=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=A.length>0&&void 0!==A[0]?A[0]:{},r=A.length>1&&void 0!==A[1]?A[1]:"disable",n=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.CREATE_SCREEN_VIDEO_TRACK,options:[l0({},t),r]}),t.encoderConfig?"string"==typeof t.encoderConfig||t.encoderConfig.width&&t.encoderConfig.height||(t.encoderConfig.width={max:1920},t.encoderConfig.height={max:1080}):t.encoderConfig="1080p_2",i=uz(t),o=XG(8,"track-scr"),a=null,s=null,(c=oL()).supportShareAudio||"enable"!==r){e.next=9;break}return u=new SD(mD.NOT_SUPPORTED,"your browser or platform is not support share-screen with audio"),e.abrupt("return",(n.onError(u),u.throw()));case 9:return ND.info("start create screen video track with config",t,"withAudio",r,"trackId",o),eN("info",["AgoraRTC"],"createScreenVideoTrack",[t,r]),e.prev=10,e.next=13,OV({screen:i,screenAudio:"auto"===r?c.supportShareAudio:"enable"===r},o);case 13:d=e.sent,a=d.getVideoTracks()[0]||null,s=d.getAudioTracks()[0]||null,e.next=20;break;case 17:throw e.prev=17,e.t0=e.catch(10),n.onError(e.t0),e.t0;case 20:if(a){e.next=23;break}return l=new SD(mD.UNEXPECTED_ERROR,"can not find track in media stream"),e.abrupt("return",(n.onError(l),l.throw()));case 23:if(s||"enable"!==r){e.next=27;break}return a&&a.stop(),p=new SD(mD.SHARE_AUDIO_NOT_ALLOWED),e.abrupt("return",(n.onError(p),p.throw()));case 27:if(t.optimizationMode||(t.optimizationMode="detail"),t.optimizationMode&&(p0(o,a,t,t.encoderConfig&&pN(t.encoderConfig)),t.encoderConfig&&"string"!=typeof t.encoderConfig&&(t.encoderConfig.bitrateMin=t.encoderConfig.bitrateMax)),f=new Mz(a,t.encoderConfig?pN(t.encoderConfig):{},t.scalabiltyMode?fN(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,o,[xP.SCREEN_TRACK]),s){e.next=31;break}return e.abrupt("return",(n.onSuccess(f.getTrackId()),ND.info("create screen video track success","video:",f.getTrackId()),eN("info",["AgoraRTC"],"createScreenVideoTrack",void 0,{videoTrack:f.getTrackId()}),f));case 31:return h=new mG(s),e.abrupt("return",(n.onSuccess([f.getTrackId(),h.getTrackId()]),ND.info("create screen video track success","video:",f.getTrackId(),"audio:",h.getTrackId()),eN("info",["AgoraRTC"],"createScreenVideoTrack",void 0,{videoTrack:f.getTrackId(),audioTrack:h.getTrackId()}),[f,h]));case 33:case"end":return e.stop()}}),e,null,[[10,17]])})));function t(){return e.apply(this,arguments)}return t}(),createMicrophoneAndCameraTracks:function(){var e=y(G.mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,p,f,h=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=h.length>0&&void 0!==h[0]?h[0]:{},r=h.length>1&&void 0!==h[1]?h[1]:{encoderConfig:"480p_1"},n=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.CREATE_MIC_AND_CAM_TRACKS,options:[t,r]}),i=cz(r),o=dz(t),a=XG(8,"track-mic-"),s=XG(8,"track-cam-"),c=null,u=null,ND.info("start create camera video track(".concat(s,") and microphone audio track(").concat(a,") with config, audio: ").concat(JSON.stringify(t),", video: ").concat(JSON.stringify(r))),eN("info",["AgoraRTC"],"createMicrophoneAndCameraTracks",{videoConfig:r,audioConfig:t}),e.prev=4,e.next=7,OV({audio:o,video:i},"".concat(a,"-").concat(s));case 7:d=e.sent,c=d.getAudioTracks()[0],u=d.getVideoTracks()[0],e.next=14;break;case 11:throw e.prev=11,e.t0=e.catch(4),n.onError(e.t0),e.t0;case 14:if(c&&u){e.next=17;break}return l=new SD(mD.UNEXPECTED_ERROR,"can not find tracks in media stream"),e.abrupt("return",(n.onError(l),l.throw()));case 17:return r.optimizationMode&&p0(s,u,r,r.encoderConfig&&lN(r.encoderConfig)),p=new EG(c,t,o,a),f=new Uz(u,r,i,r.scalabiltyMode?fN(r.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},r.optimizationMode,s),e.abrupt("return",(n.onSuccess([p.getTrackId(),f.getTrackId()]),ND.info("create camera video track(".concat(s,") and microphone audio track(").concat(a,") success")),eN("info",["AgoraRTC"],"createMicrophoneAndCameraTracks",void 0,{videoTrackId:s,audioTrackId:a}),[p,f]));case 20:case"end":return e.stop()}}),e,null,[[4,11]])})));function t(){return e.apply(this,arguments)}return t}(),createMicrophoneAudioTrack:function(){var e=y(G.mark((function e(){var t,r,n,i,o,a,s,c=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=c.length>0&&void 0!==c[0]?c[0]:{},r=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.CREATE_MIC_AUDIO_TRACK,options:[t]}),n=dz(t),i=XG(8,"track-mic-"),o=null,ND.info("start create microphone audio track with config",JSON.stringify(t),"trackId",i),eN("info",["AgoraRTC"],"createMicrophoneAudioTrack",t),e.prev=4,e.next=7,OV({audio:n},i);case 7:if(e.t0=e.sent.getAudioTracks()[0],e.t0){e.next=10;break}e.t0=null;case 10:o=e.t0,e.next=16;break;case 13:throw e.prev=13,e.t1=e.catch(4),r.onError(e.t1),e.t1;case 16:if(o){e.next=19;break}return a=new SD(mD.UNEXPECTED_ERROR,"can not find track in media stream"),e.abrupt("return",(r.onError(a),a.throw()));case 19:return s=new EG(o,t,n,i),e.abrupt("return",(r.onSuccess(s.getTrackId()),ND.info("create microphone audio track success, trackId:",i),eN("info",["AgoraRTC"],"createMicrophoneAudioTrack",t,i),s));case 21:case"end":return e.stop()}}),e,null,[[4,13]])})));function t(){return e.apply(this,arguments)}return t}(),createCustomAudioTrack:function(e){var t=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.CREATE_CUSTOM_AUDIO_TRACK,options:[e]}),r=new mG(e.mediaStreamTrack,e.encoderConfig?AN(e.encoderConfig):{});return ND.info("create custom audio track success with config",e,"trackId",r.getTrackId()),eN("info",["AgoraRTC"],"createCustomAudioTrack",e,r.getTrackId()),t.onSuccess(r.getTrackId()),r},createBufferSourceAudioTrack:function(){var e=y(G.mark((function e(t){var r,n,i,o,a;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.CREATE_BUFFER_AUDIO_TRACK,options:[t]}),n=XG(8,"track-buf-"),ND.info("start create buffer source audio track with config",JSON.stringify(t),"trackId",n),eN("info",[],"createBufferSourceAudioTrack",t),i=t.source,t.source instanceof AudioBuffer){e.next=13;break}return e.prev=4,e.next=7,c0(t.source,t.cacheOnlineFile);case 7:t.source=e.sent,e.next=13;break;case 10:return e.prev=10,e.t0=e.catch(4),e.abrupt("return",(r.onError(e.t0),e.t0.throw()));case 13:return o=new a0(t.source),a=new _G(i,o,t.encoderConfig?AN(t.encoderConfig):{},n),e.abrupt("return",(ND.info("create buffer source audio track success, trackId:",n),eN("info",["AgoraRTC"],"createBufferSourceAudioTrack",void 0,n),r.onSuccess(a.getTrackId()),a));case 15:case"end":return e.stop()}}),e,null,[[4,10]])})));function t(t){return e.apply(this,arguments)}return t}(),setLogLevel:function(e){gN("USE_NEW_LOG")?function(e){e=Math.min(Math.max(0,e),4),UD=e}(e):ND.setLogLevel(e)},enableLogUpload:function(){gN("USE_NEW_LOG")?vN("UPLOAD_LOG",!0):ND.enableLogUpload()},disableLogUpload:function(){gN("USE_NEW_LOG")?vN("UPLOAD_LOG",!1):ND.disableLogUpload()},createChannelMediaRelayConfiguration:function(){return new OJ},checkAudioTrackIsActive:function(){var e=y(G.mark((function e(t){var r,n,i,o,a,s,c,u,d=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=d.length>1&&void 0!==d[1]?d[1]:5e3,n=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.CHECK_AUDIO_TRACK_IS_ACTIVE,options:[r]}),t instanceof mG||t instanceof _1){e.next=5;break}return i=new SD(mD.INVALID_TRACK,"the parameter is not a audio track"),e.abrupt("return",(n.onError(i),i.throw()));case 5:return r&&r<1e3&&(r=1e3),o=t instanceof mG?t.getTrackLabel():"remote_track",a=t.getVolumeLevel(),s=a,c=a,u=Date.now(),e.abrupt("return",new Rb((function(e){var i=setInterval((function(){var a=t.getVolumeLevel(),d=(s=a>s?a:s)-(c=a<c?a:c)>1e-4,l=Date.now()-u;if(d||l>r){clearInterval(i);var p=d,f={duration:l,deviceLabel:o,maxVolumeLevel:s,result:p};ND.info("[track-".concat(t.getTrackId(),"] check audio track active completed. ").concat(JSON.stringify(f))),n.onSuccess(f),e(p)}}),200)})));case 10:case"end":return e.stop()}}),e)})));function t(t){return e.apply(this,arguments)}return t}(),checkVideoTrackIsActive:function(){var e=y(G.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f,h,A=arguments;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=A.length>1&&void 0!==A[1]?A[1]:5e3,n=zj.reportApiInvoke(null,{tag:Qx.TRACER,name:Ux.CHECK_VIDEO_TRACK_IS_ACTIVE,options:[r]}),t instanceof Mz||t instanceof E1){e.next=5;break}return i=new SD(mD.INVALID_TRACK,"the parameter is not a video track"),e.abrupt("return",(n.onError(i),i.throw()));case 5:return o=4,r&&r<1e3&&(r=1e3),a=t instanceof Mz?t.getTrackLabel():"remote_track",s=t.getMediaStreamTrack(!0),(c=document.createElement("video")).style.width="1px",c.style.height="1px",c.setAttribute("muted",""),c.muted=!0,c.setAttribute("playsinline",""),c.controls=!1,(Mk()||xk())&&(c.style.opacity="0.01",c.style.position="fixed",c.style.left="0",c.style.top="0",document.body.appendChild(c)),c.srcObject=new MediaStream([s]),c.play(),(u=document.createElement("canvas")).width=160,u.height=120,d=0,l=0,e.prev=12,p=Date.now(),e.next=16,h0(c,r,u,o);case 16:d=e.sent,l=Date.now()-p,e.next=23;break;case 20:throw e.prev=20,e.t0=e.catch(12),n.onError(e.t0),e.t0;case 23:return f0===Sk.SAFARI&&(c.pause(),c.remove()),c.srcObject=null,h={duration:l,changedPicNum:d,deviceLabel:a,result:f=d>o},e.abrupt("return",(ND.info("[track-".concat(t.getTrackId(),"] check video track active completed. ").concat(JSON.stringify(h))),n.onSuccess(h),f));case 26:case"end":return e.stop()}}),e,null,[[12,20]])})));function t(t){return e.apply(this,arguments)}return t}(),setArea:function(e){var t=zj.reportApiInvoke(null,{name:Ux.SET_AREA,options:e,tag:Qx.TRACER});try{var r=[];if("string"==typeof e&&(r=[e]),Array.isArray(e)&&(e.forEach((function(e){if(!KP.includes(e))throw new SD(mD.INVALID_PARAMS,"invalid area code")})),r=e),"[object Object]"===Object.prototype.toString.call(e)){var n=e.areaCode,i=e.excludedArea;if(!n)throw new SD(mD.INVALID_PARAMS,"area code is needed");var o=n;"string"==typeof n&&(o=[n]),r=i?rJ(o,i):o}vN("AREAS",r);var a=function(e){var t={CODE:"",WEBCS_DOMAIN:[],WEBCS_DOMAIN_BACKUP_LIST:[],PROXY_CS:[],CDS_AP:[],ACCOUNT_REGISTER:[],UAP_AP:[],EVENT_REPORT_DOMAIN:[],EVENT_REPORT_BACKUP_DOMAIN:[],LOG_UPLOAD_SERVER:[],PROXY_SERVER_TYPE3:[]};return e.map((function(e){var r=$P[e],n=Object.keys(r);n&&n.map((function(e){"CODE"!==e&&(t[e]=t[e].concat(r[e]))}))})),t}(r);Object.keys(a).map((function(e){vN(e,"LOG_UPLOAD_SERVER"===e||"EVENT_REPORT_DOMAIN"===e||"EVENT_REPORT_BACKUP_DOMAIN"===e||"PROXY_SERVER_TYPE3"===e?a[e][0]:a[e])})),ND.debug("set area success:",r.join(","))}catch(e){throw t.onError(e),e}t.onSuccess()},loadModule:function(){var e=y(G.mark((function e(t,r){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ND.debug("loadModule: ".concat(t.name,", loadOption: ").concat(JSON.stringify(r))),t.moduleInit){e.next=2;break}throw ND.debug("Invalid Plugin"),new SD(mD.INVALID_PLUGIN,"invalid plugin");case 2:return e.prev=2,aV.installPlugin(t),e.next=6,t.moduleInit({logger:ND,report:zj,pluginCenter:aV,getParameter:gN},r);case 6:e.next=11;break;case 8:throw e.prev=8,e.t0=e.catch(2),new SD(mD.UNEXPECTED_ERROR,"unexpected error in loadModule",e.t0);case 11:case"end":return e.stop()}}),e,null,[[2,8]])})));function t(t,r){return e.apply(this,arguments)}return t}(),audioElementPlayCenter:hG,processExternalMediaAEC:function(e){E0.processExternalMediaAEC(e)},registerExtensions:function(e){e.forEach((function(e){var t=e;t.__registered__=!0,t.logger.hookLog=ND.extLog,t.reporter.hookApiInvoke=zj.extApiInvoke,t.parameters&&Object.keys(t.parameters).forEach((function(e){t.parameters[e]=gN(e)}))}))},ChannelMediaRelayError:TP,ChannelMediaRelayEvent:wP,ChannelMediaRelayState:RP,RemoteStreamFallbackType:LP,RemoteStreamType:PP,ConnectionDisconnectedReason:qx,AudienceLatencyLevelType:Yx,AREAS:UP};return Object.defineProperties(_0,{onAudioAutoplayFailed:{get:function(){return Kj.onAudioAutoplayFailed},set:function(e){Kj.onAudioAutoplayFailed=e}},onAutoplayFailed:{get:function(){return Kj.onAutoplayFailed},set:function(e){Kj.onAutoplayFailed=e}}}),lG.on(jx.CAMERA_DEVICE_CHANGED,(function(e){ND.info("camera device changed",JSON.stringify(e)),_0.onCameraChanged&&_0.onCameraChanged(e)})),lG.on(jx.RECORDING_DEVICE_CHANGED,(function(e){ND.info("microphone device changed",JSON.stringify(e)),_0.onMicrophoneChanged&&_0.onMicrophoneChanged(e)})),lG.on(jx.PLAYOUT_DEVICE_CHANGED,(function(e){ND.debug("playout device changed",JSON.stringify(e)),_0.onPlaybackDeviceChanged&&_0.onPlaybackDeviceChanged(e)})),hG.onAutoplayFailed=function(){ND.info("detect audio element autoplay failed"),Kj.onAudioAutoplayFailed&&Kj.onAudioAutoplayFailed()},uV.on("autoplay-failed",(function(){ND.info("detect webaudio autoplay failed"),Kj.onAudioAutoplayFailed&&Kj.onAudioAutoplayFailed()})),window&&(window.__ARTC__=_0),_0}()})),q=a(Y),J=function(e,t){return J=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},J(e,t)};function z(e,t){function r(){this.constructor=e}J(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}function X(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function Z(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function $(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function ee(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function te(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(ee(arguments[t]));return e}var re=function(){function e(){}return e.asyncSleep=function(e){return new Promise((function(t){setTimeout(t,e)}))},e.randomString=function(e){for(var t="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=r.length,i=0;i<e;i++)t+=r.charAt(Math.floor(Math.random()*n));return t},e.getDiffTimeMs=function(e){return Date.now()-e},e.fetch=function(e,t,r){return void 0===r&&(r="POST"),new Promise((function(n,i){var o=new XMLHttpRequest;o.timeout=3e3,o.open(r,e),o.onreadystatechange=function(){o.readyState<4||(o.status>199&&o.status<300?n():i())},o.send(t)}))},e}(),ne="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},ie=1e3,oe=60*ie,ae=60*oe,se=24*ae,ce=7*se,ue=365.25*se,de=function(e,t){t=t||{};var r=D(e);if("string"===r&&e.length>0)return function(e){if((e=String(e)).length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return r*ue;case"weeks":case"week":case"w":return r*ce;case"days":case"day":case"d":return r*se;case"hours":case"hour":case"hrs":case"hr":case"h":return r*ae;case"minutes":case"minute":case"mins":case"min":case"m":return r*oe;case"seconds":case"second":case"secs":case"sec":case"s":return r*ie;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}(e);if("number"===r&&isFinite(e))return t.long?function(e){var t=Math.abs(e);if(t>=se)return le(e,t,se,"day");if(t>=ae)return le(e,t,ae,"hour");if(t>=oe)return le(e,t,oe,"minute");if(t>=ie)return le(e,t,ie,"second");return e+" ms"}(e):function(e){var t=Math.abs(e);if(t>=se)return Math.round(e/se)+"d";if(t>=ae)return Math.round(e/ae)+"h";if(t>=oe)return Math.round(e/oe)+"m";if(t>=ie)return Math.round(e/ie)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function le(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}var pe,fe=function(e){function t(e){var n,i,o,a=null;function s(){for(var e=arguments.length,r=new Array(e),i=0;i<e;i++)r[i]=arguments[i];if(s.enabled){var o=s,a=Number(new Date),c=a-(n||a);o.diff=c,o.prev=n,o.curr=a,n=a,r[0]=t.coerce(r[0]),"string"!=typeof r[0]&&r.unshift("%O");var u=0;r[0]=r[0].replace(/%([a-zA-Z%])/g,(function(e,n){if("%%"===e)return"%";u++;var i=t.formatters[n];if("function"==typeof i){var a=r[u];e=i.call(o,a),r.splice(u,1),u--}return e})),t.formatArgs.call(o,r);var d=o.log||t.log;d.apply(o,r)}}return s.namespace=e,s.useColors=t.useColors(),s.color=t.selectColor(e),s.extend=r,s.destroy=t.destroy,Object.defineProperty(s,"enabled",{enumerable:!0,configurable:!1,get:function(){return null!==a?a:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o)},set:function(e){a=e}}),"function"==typeof t.init&&t.init(s),s}function r(e,r){var n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){var e=[].concat(M(t.names.map(n)),M(t.skips.map(n).map((function(e){return"-"+e})))).join(",");return t.enable(""),e},t.enable=function(e){var r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];var n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r<i;r++)n[r]&&("-"===(e=n[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp("^"+e.slice(1)+"$")):t.names.push(new RegExp("^"+e+"$")))},t.enabled=function(e){if("*"===e[e.length-1])return!0;var r,n;for(r=0,n=t.skips.length;r<n;r++)if(t.skips[r].test(e))return!1;for(r=0,n=t.names.length;r<n;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=de,t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((function(r){t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){for(var r=0,n=0;n<e.length;n++)r=(r<<5)-r+e.charCodeAt(n),r|=0;return t.colors[Math.abs(r)%t.colors.length]},t.enable(t.load()),t},he=s((function(e,t){var r;t.formatArgs=function(t){if(t[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+t[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;var r="color: "+this.color;t.splice(1,0,r,"color: inherit");var n=0,i=0;t[0].replace(/%[a-zA-Z%]/g,(function(e){"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){var e;try{e=t.storage.getItem("debug")}catch(e){}!e&&void 0!==c&&"env"in c&&(e=c.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(r=!1,function(){r||(r=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],t.log=console.debug||console.log||function(){},e.exports=fe(t),e.exports.formatters.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}})),Ae="object"===("undefined"==typeof Reflect?"undefined":D(Reflect))?Reflect:null,ve=Ae&&"function"==typeof Ae.apply?Ae.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};pe=Ae&&"function"==typeof Ae.ownKeys?Ae.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var ge=Number.isNaN||function(e){return e!=e};function me(){me.init.call(this)}var Ee=me,_e=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}Oe(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&Oe(e,"error",t,r)}(e,i,{once:!0})}))};me.EventEmitter=me,me.prototype._events=void 0,me.prototype._eventsCount=0,me.prototype._maxListeners=void 0;var ye=10;function Ie(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+D(e))}function Se(e){return void 0===e._maxListeners?me.defaultMaxListeners:e._maxListeners}function be(e,t,r,n){var i,o,a,s;if(Ie(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),a=o[t]),void 0===a)a=o[t]=r,++e._eventsCount;else if("function"==typeof a?a=o[t]=n?[r,a]:[a,r]:n?a.unshift(r):a.push(r),(i=Se(e))>0&&a.length>i&&!a.warned){a.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=a.length,s=c,console&&console.warn&&console.warn(s)}return e}function Ce(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function we(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=Ce.bind(n);return i.listener=r,n.wrapFn=i,i}function Re(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):ke(i,i.length)}function Te(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function ke(e,t){for(var r=new Array(t),n=0;n<t;++n)r[n]=e[n];return r}function Oe(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+D(e));e.addEventListener(t,(function i(o){n.once&&e.removeEventListener(t,i),r(o)}))}}function De(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return Ne(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ne(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Ne(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function xe(e){var t=function(){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(e){return!1}}
|
|
24
|
+
/*! *****************************************************************************
|
|
25
|
+
Copyright (c) Microsoft Corporation.
|
|
26
|
+
|
|
27
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
28
|
+
purpose with or without fee is hereby granted.
|
|
29
|
+
|
|
30
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
31
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
32
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
33
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
34
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
35
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
36
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
37
|
+
***************************************************************************** */();return function(){var r,n=d(e);if(t){var i=d(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return x(this,r)}}function Pe(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}Object.defineProperty(me,"defaultMaxListeners",{enumerable:!0,get:function(){return ye},set:function(e){if("number"!=typeof e||e<0||ge(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");ye=e}}),me.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},me.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||ge(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},me.prototype.getMaxListeners=function(){return Se(this)},me.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,i=this._events;if(void 0!==i)n=n&&void 0===i.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var s=i[e];if(void 0===s)return!1;if("function"==typeof s)ve(s,this,t);else{var c=s.length,u=ke(s,c);for(r=0;r<c;++r)ve(u[r],this,t)}return!0},me.prototype.addListener=function(e,t){return be(this,e,t,!1)},me.prototype.on=me.prototype.addListener,me.prototype.prependListener=function(e,t){return be(this,e,t,!0)},me.prototype.once=function(e,t){return Ie(t),this.on(e,we(this,e,t)),this},me.prototype.prependOnceListener=function(e,t){return Ie(t),this.prependListener(e,we(this,e,t)),this},me.prototype.removeListener=function(e,t){var r,n,i,o,a;if(Ie(t),void 0===(n=this._events))return this;if(void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,o=r.length-1;o>=0;o--)if(r[o]===t||r[o].listener===t){a=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,a||t)}return this},me.prototype.off=me.prototype.removeListener,me.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var i,o=Object.keys(r);for(n=0;n<o.length;++n)"removeListener"!==(i=o[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},me.prototype.listeners=function(e){return Re(this,e,!0)},me.prototype.rawListeners=function(e){return Re(this,e,!1)},me.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):Te.call(e,t)},me.prototype.listenerCount=Te,me.prototype.eventNames=function(){return this._eventsCount>0?pe(this._events):[]},Ee.once=_e;var Le="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==ne?ne:"undefined"!=typeof self?self:{};function Be(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Me(e){var t={exports:{}};return e(t,t.exports),t.exports}var Ue=Me((function(e){function t(r){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?e.exports=t=function(e){return typeof e}:e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(r)}e.exports=t})),Qe=Me((function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},o=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function u(e,t,r,n){var i=t&&t.prototype instanceof v?t:v,o=Object.create(i.prototype),a=new T(n||[]);return o._invoke=function(e,t,r){var n=l;return function(i,o){if(n===f)throw new Error("Generator is already running");if(n===h){if("throw"===i)throw o;return O()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=C(a,r);if(s){if(s===A)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===l)throw n=h,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=f;var c=d(e,t,r);if("normal"===c.type){if(n=r.done?h:p,c.arg===A)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n=h,r.method="throw",r.arg=c.arg)}}}(e,r,a),o}function d(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var l="suspendedStart",p="suspendedYield",f="executing",h="completed",A={};function v(){}function g(){}function m(){}var E={};E[o]=function(){return this};var _=Object.getPrototypeOf,y=_&&_(_(k([])));y&&y!==r&&n.call(y,o)&&(E=y);var I=m.prototype=v.prototype=Object.create(E);function S(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function r(i,o,a,s){var c=d(e[i],e,o);if("throw"!==c.type){var u=c.arg,l=u.value;return l&&"object"===Ue(l)&&n.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,a,s)}),(function(e){r("throw",e,a,s)})):t.resolve(l).then((function(e){u.value=e,a(u)}),(function(e){return r("throw",e,a,s)}))}s(c.arg)}var i;this._invoke=function(e,n){function o(){return new t((function(t,i){r(e,n,t,i)}))}return i=i?i.then(o,o):o()}}function C(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,C(e,r),"throw"===r.method))return A;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return A}var i=d(n,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,A;var o=i.arg;return o?o.done?(r[e.resultName]=o.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,A):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,A)}function w(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function T(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(w,this),this.reset(!0)}function k(e){if(e){var r=e[o];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var i=-1,a=function r(){for(;++i<e.length;)if(n.call(e,i))return r.value=e[i],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:O}}function O(){return{value:t,done:!0}}return g.prototype=I.constructor=m,m.constructor=g,g.displayName=c(m,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,c(e,s,"GeneratorFunction")),e.prototype=Object.create(I),e},e.awrap=function(e){return{__await:e}},S(b.prototype),b.prototype[a]=function(){return this},e.AsyncIterator=b,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new b(u(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},S(I),c(I,s,"Generator"),I[o]=function(){return this},I.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=k,T.prototype={constructor:T,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(R),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function i(n,i){return s.type="throw",s.arg=e,r.next=n,i&&(r.method="next",r.arg=t),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var c=n.call(a,"catchLoc"),u=n.call(a,"finallyLoc");if(c&&u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){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 o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,A):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),A},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),R(r),A}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;R(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:k(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),A}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}})),Fe=Qe;function je(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(e){return void r(e)}s.done?t(c):Promise.resolve(c).then(n,i)}var Ve=function(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){je(o,n,i,a,s,"next",e)}function s(e){je(o,n,i,a,s,"throw",e)}a(void 0)}))}};var Ge=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};function Ke(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var He=function(e,t,r){return t&&Ke(e.prototype,t),r&&Ke(e,r),e},We=Me((function(e){function t(r,n){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(r,n)}e.exports=t}));var Ye=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&We(e,t)};var qe=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e};var Je=function(e,t){return!t||"object"!==Ue(t)&&"function"!=typeof t?qe(e):t},ze=Me((function(e){function t(r){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},t(r)}e.exports=t})),Xe="protoo-client",Ze=function(){function e(t){Ge(this,e),t?(this._debug=he("".concat(Xe,":").concat(t)),this._warn=he("".concat(Xe,":WARN:").concat(t)),this._error=he("".concat(Xe,":ERROR:").concat(t))):(this._debug=he(Xe),this._warn=he("".concat(Xe,":WARN")),this._error=he("".concat(Xe,":ERROR"))),this._debug.log=console.info.bind(console),this._warn.log=console.warn.bind(console),this._error.log=console.error.bind(console)}return He(e,[{key:"debug",get:function(){return this._debug}},{key:"warn",get:function(){return this._warn}},{key:"error",get:function(){return this._error}}]),e}();function $e(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var et=Ee.EventEmitter,tt=function(e){Ye(n,et);var t,r=$e(n);function n(e){var t;return Ge(this,n),(t=r.call(this)).setMaxListeners(1/0),t._logger=e||new Ze("EnhancedEventEmitter"),t}return He(n,[{key:"safeEmit",value:function(e){try{for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];this.emit.apply(this,[e].concat(r))}catch(t){this._logger.error("safeEmit() | event listener threw an error [event:%s]:%o",e,t)}}},{key:"safeEmitAsPromise",value:(t=Ve(Fe.mark((function e(t){var r,n,i,o=this,a=arguments;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=a.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=a[i];return e.abrupt("return",new Promise((function(e,r){o.safeEmit.apply(o,[t].concat(n,[e,r]))})));case 2:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),n}(),rt=tt,nt=function(){return Math.round(1e7*Math.random())},it=new Ze("Message"),ot=function(){function e(){Ge(this,e)}return He(e,null,[{key:"parse",value:function(e){var t,r={};try{t=JSON.parse(e)}catch(e){return void it.error("parse() | invalid JSON: %s",e)}if("object"===Ue(t)&&!Array.isArray(t)){if(t.request){if(r.request=!0,"string"!=typeof t.method)return void it.error("parse() | missing/invalid method field");if("number"!=typeof t.id)return void it.error("parse() | missing/invalid id field");r.id=t.id,r.method=t.method,r.data=t.data||{}}else if(t.response){if(r.response=!0,"number"!=typeof t.id)return void it.error("parse() | missing/invalid id field");r.id=t.id,t.ok?(r.ok=!0,r.data=t.data||{}):(r.ok=!1,r.errorCode=t.errorCode,r.errorReason=t.errorReason)}else{if(!t.notification)return void it.error("parse() | missing request/response field");if(r.notification=!0,"string"!=typeof t.method)return void it.error("parse() | missing/invalid method field");r.method=t.method,r.data=t.data||{}}return r}it.error("parse() | not an object")}},{key:"createRequest",value:function(e,t){return{request:!0,id:nt(),method:e,data:t||{}}}},{key:"createSuccessResponse",value:function(e,t){return{response:!0,id:e.id,ok:!0,data:t||{}}}},{key:"createErrorResponse",value:function(e,t,r){return{response:!0,id:e.id,ok:!1,errorCode:t,errorReason:r}}},{key:"createNotification",value:function(e,t){return{notification:!0,method:e,data:t||{}}}}]),e}(),at=ot;function st(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return ct(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ct(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function ct(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ut(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var dt,lt=new Ze("Peer"),pt=function(e){Ye(i,rt);var t,r,n=ut(i);function i(e){var t;return Ge(this,i),t=n.call(this,lt),lt.debug("constructor()"),t._closed=!1,t._transport=e,t._connected=!1,t._data={},t._sents=new Map,t._handleTransport(),t}return He(i,[{key:"close",value:function(){if(!this._closed){lt.debug("close()"),this._closed=!0,this._connected=!1,this._transport.close();var e,t=st(this._sents.values());try{for(t.s();!(e=t.n()).done;){e.value.close()}}catch(e){t.e(e)}finally{t.f()}this.safeEmit("close")}}},{key:"request",value:(r=Ve(Fe.mark((function e(t){var r,n,i=this,o=arguments;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.length>1&&void 0!==o[1]?o[1]:void 0,n=at.createRequest(t,r),this._logger.debug("request() [method:%s, id:%s]",t,n.id),e.next=5,this._transport.send(n);case 5:return e.abrupt("return",new Promise((function(e,t){var r=1500*(15+.1*i._sents.size),o={id:n.id,method:n.method,resolve:function(t){i._sents.delete(n.id)&&(clearTimeout(o.timer),e(t))},reject:function(e){i._sents.delete(n.id)&&(clearTimeout(o.timer),t(e))},timer:setTimeout((function(){i._sents.delete(n.id)&&t(new Error("request timeout"))}),r),close:function(){clearTimeout(o.timer),t(new Error("peer closed"))}};i._sents.set(n.id,o)})));case 6:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"notify",value:(t=Ve(Fe.mark((function e(t){var r,n,i=arguments;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.length>1&&void 0!==i[1]?i[1]:void 0,n=at.createNotification(t,r),this._logger.debug("notify() [method:%s]",t),e.next=5,this._transport.send(n);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_handleTransport",value:function(){var e=this;if(this._transport.closed)return this._closed=!0,void setTimeout((function(){e._closed||(e._connected=!1,e.safeEmit("close"))}));this._transport.on("open",(function(){e._closed||(lt.debug('emit "open"'),e._connected=!0,e.safeEmit("open"))})),this._transport.on("disconnected",(function(){e._closed||(lt.debug('emit "disconnected"'),e._connected=!1,e.safeEmit("disconnected"))})),this._transport.on("failed",(function(t){e._closed||(lt.debug('emit "failed" [currentAttempt:%s]',t),e._connected=!1,e.safeEmit("failed",t))})),this._transport.on("close",(function(){e._closed||(e._closed=!0,lt.debug('emit "close"'),e._connected=!1,e.safeEmit("close"))})),this._transport.on("message",(function(t){t.request?e._handleRequest(t):t.response?e._handleResponse(t):t.notification&&e._handleNotification(t)}))}},{key:"_handleRequest",value:function(e){var t=this;try{this.emit("request",e,(function(r){var n=at.createSuccessResponse(e,r);t._transport.send(n).catch((function(){}))}),(function(r,n){r instanceof Error?(r=500,n=String(r)):"number"==typeof r&&n instanceof Error&&(n=String(n));var i=at.createErrorResponse(e,r,n);t._transport.send(i).catch((function(){}))}))}catch(t){var r=at.createErrorResponse(e,500,String(t));this._transport.send(r).catch((function(){}))}}},{key:"_handleResponse",value:function(e){var t=this._sents.get(e.id);if(t)if(e.ok)t.resolve(e.data);else{var r=new Error(e.errorReason);r.code=e.errorCode,t.reject(r)}else lt.error("received response does not match any sent request [id:%s]",e.id)}},{key:"_handleNotification",value:function(e){this.safeEmit("notification",e)}},{key:"closed",get:function(){return this._closed}},{key:"connected",get:function(){return this._connected}},{key:"data",get:function(){return this._data},set:function(e){throw new Error("cannot override data object")}}]),i}(),ft=pt,ht=function(){if("object"===("undefined"==typeof self?"undefined":Ue(self))&&self)return self;if("object"===("undefined"==typeof window?"undefined":Ue(window))&&window)return window;throw new Error("Unable to resolve global `this`")},At=function(){if(this)return this;if("object"===("undefined"==typeof globalThis?"undefined":Ue(globalThis))&&globalThis)return globalThis;try{Object.defineProperty(Object.prototype,"__global__",{get:function(){return this},configurable:!0})}catch(e){return ht()}try{return __global__||ht()}finally{delete Object.prototype.__global__}}(),vt="1.0.33";try{dt=At}catch(e){}finally{if(dt||"undefined"==typeof window||(dt=window),!dt)throw new Error("Could not determine global this")}var gt=dt.WebSocket||dt.MozWebSocket;function mt(e,t){return t?new gt(e,t):new gt(e)}gt&&["CONNECTING","OPEN","CLOSING","CLOSED"].forEach((function(e){Object.defineProperty(mt,e,{get:function(){return gt[e]}})}));var Et={w3cwebsocket:gt?mt:null,version:vt};function _t(e,t){"boolean"==typeof t&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var yt=_t;_t.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},_t.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},_t.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=(new Date).getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var r=this._timeouts.shift();if(void 0===r){if(!this._cachedTimeouts)return!1;this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),r=this._timeouts.shift()}var n=this,i=setTimeout((function(){n._attempts++,n._operationTimeoutCb&&(n._timeout=setTimeout((function(){n._operationTimeoutCb(n._attempts)}),n._operationTimeout),n._options.unref&&n._timeout.unref()),n._fn(n._attempts)}),r);return this._options.unref&&i.unref(),!0},_t.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var r=this;this._operationTimeoutCb&&(this._timeout=setTimeout((function(){r._operationTimeoutCb()}),r._operationTimeout)),this._operationStart=(new Date).getTime(),this._fn(this._attempts)},_t.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)},_t.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)},_t.prototype.start=_t.prototype.try,_t.prototype.errors=function(){return this._errors},_t.prototype.attempts=function(){return this._attempts},_t.prototype.mainError=function(){if(0===this._errors.length)return null;for(var e={},t=null,r=0,n=0;n<this._errors.length;n++){var i=this._errors[n],o=i.message,a=(e[o]||0)+1;e[o]=a,a>=r&&(t=i,r=a)}return t};var It=Me((function(e,t){t.operation=function(e){var r=t.timeouts(e);return new yt(r,{forever:e&&e.forever,unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})},t.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1e3,maxTimeout:1/0,randomize:!1};for(var r in e)t[r]=e[r];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var n=[],i=0;i<t.retries;i++)n.push(this.createTimeout(i,t));return e&&e.forever&&!n.length&&n.push(this.createTimeout(i,t)),n.sort((function(e,t){return e-t})),n},t.createTimeout=function(e,t){var r=t.randomize?Math.random()+1:1,n=Math.round(r*t.minTimeout*Math.pow(t.factor,e));return n=Math.min(n,t.maxTimeout)},t.wrap=function(e,r,n){if(r instanceof Array&&(n=r,r=null),!n)for(var i in n=[],e)"function"==typeof e[i]&&n.push(i);for(var o=0;o<n.length;o++){var a=n[o],s=e[a];e[a]=function(n){var i=t.operation(r),o=Array.prototype.slice.call(arguments,1),a=o.pop();o.push((function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),a.apply(this,arguments))})),i.attempt((function(){n.apply(e,o)}))}.bind(e,s),e[a].options=r}}}));function St(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var bt,Ct=Et.w3cwebsocket,wt={retries:10,factor:2,minTimeout:1e3,maxTimeout:8e3},Rt=new Ze("WebSocketTransport"),Tt=ft,kt=function(e){Ye(n,rt);var t,r=St(n);function n(e,t){var i;return Ge(this,n),i=r.call(this,Rt),Rt.debug("constructor() [url:%s, options:%o]",e,t),i._closed=!1,i._url=e,i._options=t||{},i._ws=null,i._runWebSocket(),i}return He(n,[{key:"close",value:function(){if(!this._closed){Rt.debug("close()"),this._closed=!0,this.safeEmit("close");try{this._ws.onopen=null,this._ws.onclose=null,this._ws.onerror=null,this._ws.onmessage=null,this._ws.close()}catch(e){Rt.error("close() | error closing the WebSocket: %o",e)}}}},{key:"send",value:(t=Ve(Fe.mark((function e(t){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._closed){e.next=2;break}throw new Error("transport closed");case 2:e.prev=2,this._ws.send(JSON.stringify(t)),e.next=10;break;case 6:throw e.prev=6,e.t0=e.catch(2),Rt.warn("send() failed:%o",e.t0),e.t0;case 10:case"end":return e.stop()}}),e,this,[[2,6]])}))),function(e){return t.apply(this,arguments)})},{key:"_runWebSocket",value:function(){var e=this,t=It.operation(this._options.retry||wt),r=!1;t.attempt((function(n){e._closed?t.stop():(Rt.debug("_runWebSocket() [currentAttempt:%s]",n),e._ws=new Ct(e._url,"protoo",e._options.origin,e._options.headers,e._options.requestOptions,e._options.clientConfig),e._ws.onopen=function(){e._closed||(r=!0,e.safeEmit("open"))},e._ws.onclose=function(i){if(!e._closed){if(Rt.warn('WebSocket "close" event [wasClean:%s, code:%s, reason:"%s"]',i.wasClean,i.code,i.reason),4e3!==i.code){if(r){if(t.stop(),e.safeEmit("disconnected"),e._closed)return;return void e._runWebSocket()}if(e.safeEmit("failed",n),e._closed)return;if(t.retry(!0))return}e._closed=!0,e.safeEmit("close")}},e._ws.onerror=function(){e._closed||Rt.error('WebSocket "error" event')},e._ws.onmessage=function(t){if(!e._closed){var r=at.parse(t.data);r&&(0!==e.listenerCount("message")?e.safeEmit("message",r):Rt.error('no listeners for WebSocket "message" event, ignoring received message'))}})}))}},{key:"closed",get:function(){return this._closed}}]),n}(),Ot=function(e){k(r,kt);var t=xe(r);function r(e,n){var i;return U(this,r),(i=t.call(this,e,n)).on("open",(function(){i._run()})),i}return F(r,[{key:"log",value:function(e){console.log((new Date).toLocaleString(),e)}},{key:"_run",value:function(){var e=this,t=this._ws.onmessage,r=this._ws.onclose;this._ws.onmessage=function(r){clearTimeout(e._hbTimeout),e._hbTimeout=setTimeout((function(){e.closed||e.safeEmit("msg-timeout")}),2e4),"pong"!==r.data&&t(r)},this._ws.onclose=function(t){e.log("websocket closed: ".concat(t.code)),clearTimeout(e._hbTimeout),4e3!==t.code?e.safeEmit("msg-timeout"):r(t)}}},{key:"_sendPing",value:function(){var e=this;this.closed||setTimeout((function(){try{e._ws.send("ping")}catch(t){e.log("sendPing() failed: ".concat(t))}e._sendPing()}),1e3*this.interval)}},{key:"startHeartBeat",value:function(e){this.interval?this.log("startHeartBeat() failed: Already run interval."):(e<1&&(e=1),this.interval=e,this._sendPing())}}]),r}(),Dt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"yyyy-MM-dd HH:mm:ss.S",r={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours()%12==0?12:e.getHours()%12,"H+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()},n={0:"/u65e5",1:"/u4e00",2:"/u4e8c",3:"/u4e09",4:"/u56db",5:"/u4e94",6:"/u516d"};for(var i in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length))),/(E+)/.test(t)&&(t=t.replace(RegExp.$1,(RegExp.$1.length>1?RegExp.$1.length>2?"/u661f/u671f":"/u5468":"")+n[e.getDay()+""])),r)new RegExp("("+i+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?r[i]:("00"+r[i]).substr((""+r[i]).length)));return t};!function(e){e.ENTER_BEGIN="enter_begin",e.ENTER_STATE="enter_state",e.ENTER_SUCCESS="enter_success",e.ENTER_TIMEOUT="enter_timeout",e.ENTER_FAIL="enter_fail",e.ENTER_RELAY_CHANNEL="enter_relay_channel",e.EXIT_CHANNEL="exit_channel",e.STARTSENDVIDEO="start_send_video",e.STOPSENDVIDEO="stop_send_video",e.STARTSENDAUDIO="start_send_audio",e.STOPSENDAUDIO="stop_send_audio",e.FIRST_AUDIO_PACK_RECEIVED="recv_fst_rmt_audio_frm",e.FIRST_AUDIO_DECODE="recv_fst_rmt_audio_dec",e.FIRST_VIDEO_FREAME_DECODE="recv_fst_rmt_video_dec",e.FIRST_VIDEO_PACKAGE_RECV="recv_fst_rmt_video_frm",e.USERFUNCLOGS="user_func_logs",e.USERCALLBACKLOGS="user_callback_logs",e.CONNECTION_STATUS_CHANGE="conn_gw_status",e.RECONN_GW_FINAL_TIMEOUT="reconn_gw_final_timeout",e.OP_VIDEO_CHANNEL="op_video_channel",e.OP_AUDIO_CHANNEL="op_audio_channel",e.UPSTREAM_VIDEO="upstream_video",e.DOWNSTREAM_REMOTE_AUDIO="downstream_remote_audio",e.DOWNSTREAM_REMOTE_VIDEO="downstream_remote_video",e.CONN_AUDIO_STATE="conn_audio_state",e.CONN_VIDEO_STATE="conn_video_state"}(bt||(bt={}));var Nt,xt=F((function e(t){var r=t.time,n=t.appId,i=t.uid,o=t.roomId,a=t.sid,s=t.connId,c=t.userDevInfo,u=t.uRole;U(this,e),this.uosv="web",this.sdkPublicVer="V6.0.8_Apr_13_2022",this.sdkSignalVer="5.1.1",this.time=r||Dt(),this.appId=n,this.uid=i,this.roomId=o,this.sid=a,this.connId=s,this.userDevInfo=c,this.uRole=u})),Pt=F((function e(){U(this,e),this.event="",this.time=Dt()})),Lt=function(e){k(r,Pt);var t=xe(r);function r(){var e;return U(this,r),(e=t.call(this)).event=bt.ENTER_BEGIN,e}return F(r)}(),Bt=function(e){k(r,Pt);var t=xe(r);function r(e){var n;return U(this,r),(n=t.call(this)).serGwIp="",n.sendIpLocDur=0,n.linkIpLocTimes=1,n.linkIpLocDur=0,n.sendGwDur=1,n.linkGwTimes=1,n.linkGwDur=0,n.sendGwEnterDur=0,n.enterStat=bt.ENTER_SUCCESS,n.event=bt.ENTER_STATE,n.enterLiveTs=Dt(new Date(e)),n}return F(r)}(),Mt=function(e){k(r,Pt);var t=xe(r);function r(){var e;return U(this,r),(e=t.call(this)).event=bt.EXIT_CHANNEL,e}return F(r)}(),Ut=function(e){k(r,Pt);var t=xe(r);function r(e){var n;return U(this,r),(n=t.call(this)).event=bt.RECONN_GW_FINAL_TIMEOUT,n.rsn="",n.rsn=e,n}return F(r)}(),Qt=function(e){k(r,Pt);var t=xe(r);function r(e,n){var i;return U(this,r),(i=t.call(this)).event=bt.UPSTREAM_VIDEO,i.code=e,i.mediaId=n,i}return F(r)}(),Ft=function(e){k(r,Pt);var t=xe(r);function r(e,n){var i;return U(this,r),(i=t.call(this)).event=bt.DOWNSTREAM_REMOTE_AUDIO,i.audioIp="",i.audioPort=0,i.dstUid=n,i.code=e,i.audioMediaId=n,i}return F(r)}(),jt=function(e){k(r,Pt);var t=xe(r);function r(e,n,i){var o;return U(this,r),(o=t.call(this)).event=bt.DOWNSTREAM_REMOTE_VIDEO,o.dstUid=n,o.code=e,o.mediaId=i,o}return F(r)}(),Vt=function(e){k(r,Pt);var t=xe(r);function r(e){var n;return U(this,r),(n=t.call(this)).isLocalVideoMuted=0,n.isOpenVideo=1,n.event=bt.STARTSENDVIDEO,n.isLocalVideoMuted=e.isLocalVideoMuted,n.isOpenVideo=e.isOpenVideo,n}return F(r)}(),Gt=function(e){k(r,Pt);var t=xe(r);function r(){var e;return U(this,r),(e=t.call(this)).event=bt.STARTSENDAUDIO,e}return F(r)}(),Kt=function(e){k(r,Pt);var t=xe(r);function r(e){var n;return U(this,r),(n=t.call(this)).event=bt.STOPSENDVIDEO,n.rsn=e.rsn,n}return F(r)}(),Ht=function(e){k(r,Pt);var t=xe(r);function r(){var e;return U(this,r),(e=t.call(this)).event=bt.STOPSENDAUDIO,e}return F(r)}(),Wt=F((function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";U(this,e),this.ts=Date.now(),this.func=t,this.params=r})),Yt=F((function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";U(this,e),this.ts=Date.now(),this.func=t,this.params=r})),qt=function(e){k(r,Pt);var t=xe(r);function r(e){var n;return U(this,r),(n=t.call(this)).event=bt.USERFUNCLOGS,n.funcArr=e,n}return F(r)}(),Jt=function(e){k(r,Pt);var t=xe(r);function r(e){var n;return U(this,r),(n=t.call(this)).event=bt.USERCALLBACKLOGS,n.funcArr=e,n}return F(r)}();!function(e){e[e.closed=0]="closed",e[e.reconnecting=1]="reconnecting",e[e.connected=2]="connected",e[e.connectFail=3]="connectFail"}(Nt||(Nt={}));var zt=function(e){k(r,Pt);var t=xe(r);function r(e,n,i){var o;return U(this,r),(o=t.call(this)).event=bt.CONNECTION_STATUS_CHANGE,o.totDur=e,o.serGwIp=n,o.stat=i,o}return F(r)}(),Xt=Me((function(e,t){e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==Ue(e)&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=90)}({17:function(e,t,r){t.__esModule=!0,t.default=void 0;var n=r(18),i=function(){function e(){}return e.getFirstMatch=function(e,t){var r=t.match(e);return r&&r.length>0&&r[1]||""},e.getSecondMatch=function(e,t){var r=t.match(e);return r&&r.length>1&&r[2]||""},e.matchAndReturnConst=function(e,t,r){if(e.test(t))return r},e.getWindowsVersionName=function(e){switch(e){case"NT":return"NT";case"XP":case"NT 5.1":return"XP";case"NT 5.0":return"2000";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}},e.getMacOSVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),10===t[0])switch(t[1]){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}},e.getAndroidVersionName=function(e){var t=e.split(".").splice(0,2).map((function(e){return parseInt(e,10)||0}));if(t.push(0),!(1===t[0]&&t[1]<5))return 1===t[0]&&t[1]<6?"Cupcake":1===t[0]&&t[1]>=6?"Donut":2===t[0]&&t[1]<2?"Eclair":2===t[0]&&2===t[1]?"Froyo":2===t[0]&&t[1]>2?"Gingerbread":3===t[0]?"Honeycomb":4===t[0]&&t[1]<1?"Ice Cream Sandwich":4===t[0]&&t[1]<4?"Jelly Bean":4===t[0]&&t[1]>=4?"KitKat":5===t[0]?"Lollipop":6===t[0]?"Marshmallow":7===t[0]?"Nougat":8===t[0]?"Oreo":9===t[0]?"Pie":void 0},e.getVersionPrecision=function(e){return e.split(".").length},e.compareVersions=function(t,r,n){void 0===n&&(n=!1);var i=e.getVersionPrecision(t),o=e.getVersionPrecision(r),a=Math.max(i,o),s=0,c=e.map([t,r],(function(t){var r=a-e.getVersionPrecision(t),n=t+new Array(r+1).join(".0");return e.map(n.split("."),(function(e){return new Array(20-e.length).join("0")+e})).reverse()}));for(n&&(s=a-Math.min(i,o)),a-=1;a>=s;){if(c[0][a]>c[1][a])return 1;if(c[0][a]===c[1][a]){if(a===s)return 0;a-=1}else if(c[0][a]<c[1][a])return-1}},e.map=function(e,t){var r,n=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(r=0;r<e.length;r+=1)n.push(t(e[r]));return n},e.find=function(e,t){var r,n;if(Array.prototype.find)return Array.prototype.find.call(e,t);for(r=0,n=e.length;r<n;r+=1){var i=e[r];if(t(i,r))return i}},e.assign=function(e){for(var t,r,n=e,i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];if(Object.assign)return Object.assign.apply(Object,[e].concat(o));var s=function(){var e=o[t];"object"==Ue(e)&&null!==e&&Object.keys(e).forEach((function(t){n[t]=e[t]}))};for(t=0,r=o.length;t<r;t+=1)s();return e},e.getBrowserAlias=function(e){return n.BROWSER_ALIASES_MAP[e]},e.getBrowserTypeByAlias=function(e){return n.BROWSER_MAP[e]||""},e}();t.default=i,e.exports=t.default},18:function(e,t,r){t.__esModule=!0,t.ENGINE_MAP=t.OS_MAP=t.PLATFORMS_MAP=t.BROWSER_MAP=t.BROWSER_ALIASES_MAP=void 0,t.BROWSER_ALIASES_MAP={"Amazon Silk":"amazon_silk","Android Browser":"android",Bada:"bada",BlackBerry:"blackberry",Chrome:"chrome",Chromium:"chromium",Electron:"electron",Epiphany:"epiphany",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot","Internet Explorer":"ie","K-Meleon":"k_meleon",Maxthon:"maxthon","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver",Opera:"opera","Opera Coast":"opera_coast",PhantomJS:"phantomjs",Puffin:"puffin",QupZilla:"qupzilla",QQ:"qq",QQLite:"qqlite",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SeaMonkey:"seamonkey",Sleipnir:"sleipnir",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat","Yandex Browser":"yandex",Roku:"roku"},t.BROWSER_MAP={amazon_silk:"Amazon Silk",android:"Android Browser",bada:"Bada",blackberry:"BlackBerry",chrome:"Chrome",chromium:"Chromium",electron:"Electron",epiphany:"Epiphany",firefox:"Firefox",focus:"Focus",generic:"Generic",googlebot:"Googlebot",google_search:"Google Search",ie:"Internet Explorer",k_meleon:"K-Meleon",maxthon:"Maxthon",edge:"Microsoft Edge",mz:"MZ Browser",naver:"NAVER Whale Browser",opera:"Opera",opera_coast:"Opera Coast",phantomjs:"PhantomJS",puffin:"Puffin",qupzilla:"QupZilla",qq:"QQ Browser",qqlite:"QQ Browser Lite",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",sleipnir:"Sleipnir",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yandex:"Yandex Browser"},t.PLATFORMS_MAP={tablet:"tablet",mobile:"mobile",desktop:"desktop",tv:"tv"},t.OS_MAP={WindowsPhone:"Windows Phone",Windows:"Windows",MacOS:"macOS",iOS:"iOS",Android:"Android",WebOS:"WebOS",BlackBerry:"BlackBerry",Bada:"Bada",Tizen:"Tizen",Linux:"Linux",ChromeOS:"Chrome OS",PlayStation4:"PlayStation 4",Roku:"Roku"},t.ENGINE_MAP={EdgeHTML:"EdgeHTML",Blink:"Blink",Trident:"Trident",Presto:"Presto",Gecko:"Gecko",WebKit:"WebKit"}},90:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(91))&&n.__esModule?n:{default:n},o=r(18);function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var s=function(){function e(){}var t,r,n;return e.getParser=function(e,t){if(void 0===t&&(t=!1),"string"!=typeof e)throw new Error("UserAgent should be a string");return new i.default(e,t)},e.parse=function(e){return new i.default(e).getResult()},t=e,n=[{key:"BROWSER_MAP",get:function(){return o.BROWSER_MAP}},{key:"ENGINE_MAP",get:function(){return o.ENGINE_MAP}},{key:"OS_MAP",get:function(){return o.OS_MAP}},{key:"PLATFORMS_MAP",get:function(){return o.PLATFORMS_MAP}}],(r=null)&&a(t.prototype,r),n&&a(t,n),e}();t.default=s,e.exports=t.default},91:function(e,t,r){t.__esModule=!0,t.default=void 0;var n=c(r(92)),i=c(r(93)),o=c(r(94)),a=c(r(95)),s=c(r(17));function c(e){return e&&e.__esModule?e:{default:e}}var u=function(){function e(e,t){if(void 0===t&&(t=!1),null==e||""===e)throw new Error("UserAgent parameter can't be empty");this._ua=e,this.parsedResult={},!0!==t&&this.parse()}var t=e.prototype;return t.getUA=function(){return this._ua},t.test=function(e){return e.test(this._ua)},t.parseBrowser=function(){var e=this;this.parsedResult.browser={};var t=s.default.find(n.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.browser=t.describe(this.getUA())),this.parsedResult.browser},t.getBrowser=function(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()},t.getBrowserName=function(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""},t.getBrowserVersion=function(){return this.getBrowser().version},t.getOS=function(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()},t.parseOS=function(){var e=this;this.parsedResult.os={};var t=s.default.find(i.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.os=t.describe(this.getUA())),this.parsedResult.os},t.getOSName=function(e){var t=this.getOS().name;return e?String(t).toLowerCase()||"":t||""},t.getOSVersion=function(){return this.getOS().version},t.getPlatform=function(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()},t.getPlatformType=function(e){void 0===e&&(e=!1);var t=this.getPlatform().type;return e?String(t).toLowerCase()||"":t||""},t.parsePlatform=function(){var e=this;this.parsedResult.platform={};var t=s.default.find(o.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.platform=t.describe(this.getUA())),this.parsedResult.platform},t.getEngine=function(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()},t.getEngineName=function(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""},t.parseEngine=function(){var e=this;this.parsedResult.engine={};var t=s.default.find(a.default,(function(t){if("function"==typeof t.test)return t.test(e);if(t.test instanceof Array)return t.test.some((function(t){return e.test(t)}));throw new Error("Browser's test function is not valid")}));return t&&(this.parsedResult.engine=t.describe(this.getUA())),this.parsedResult.engine},t.parse=function(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this},t.getResult=function(){return s.default.assign({},this.parsedResult)},t.satisfies=function(e){var t=this,r={},n=0,i={},o=0;if(Object.keys(e).forEach((function(t){var a=e[t];"string"==typeof a?(i[t]=a,o+=1):"object"==Ue(a)&&(r[t]=a,n+=1)})),n>0){var a=Object.keys(r),c=s.default.find(a,(function(e){return t.isOS(e)}));if(c){var u=this.satisfies(r[c]);if(void 0!==u)return u}var d=s.default.find(a,(function(e){return t.isPlatform(e)}));if(d){var l=this.satisfies(r[d]);if(void 0!==l)return l}}if(o>0){var p=Object.keys(i),f=s.default.find(p,(function(e){return t.isBrowser(e,!0)}));if(void 0!==f)return this.compareVersion(i[f])}},t.isBrowser=function(e,t){void 0===t&&(t=!1);var r=this.getBrowserName().toLowerCase(),n=e.toLowerCase(),i=s.default.getBrowserTypeByAlias(n);return t&&i&&(n=i.toLowerCase()),n===r},t.compareVersion=function(e){var t=[0],r=e,n=!1,i=this.getBrowserVersion();if("string"==typeof i)return">"===e[0]||"<"===e[0]?(r=e.substr(1),"="===e[1]?(n=!0,r=e.substr(2)):t=[],">"===e[0]?t.push(1):t.push(-1)):"="===e[0]?r=e.substr(1):"~"===e[0]&&(n=!0,r=e.substr(1)),t.indexOf(s.default.compareVersions(i,r,n))>-1},t.isOS=function(e){return this.getOSName(!0)===String(e).toLowerCase()},t.isPlatform=function(e){return this.getPlatformType(!0)===String(e).toLowerCase()},t.isEngine=function(e){return this.getEngineName(!0)===String(e).toLowerCase()},t.is=function(e,t){return void 0===t&&(t=!1),this.isBrowser(e,t)||this.isOS(e)||this.isPlatform(e)},t.some=function(e){var t=this;return void 0===e&&(e=[]),e.some((function(e){return t.is(e)}))},e}();t.default=u,e.exports=t.default},92:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=/version\/(\d+(\.?_?\d+)+)/i,a=[{test:[/googlebot/i],describe:function(e){var t={name:"Googlebot"},r=i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/opera/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opr\/|opios/i],describe:function(e){var t={name:"Opera"},r=i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/SamsungBrowser/i],describe:function(e){var t={name:"Samsung Internet for Android"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Whale/i],describe:function(e){var t={name:"NAVER Whale Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MZBrowser/i],describe:function(e){var t={name:"MZ Browser"},r=i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/focus/i],describe:function(e){var t={name:"Focus"},r=i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/swing/i],describe:function(e){var t={name:"Swing"},r=i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/coast/i],describe:function(e){var t={name:"Opera Coast"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe:function(e){var t={name:"Opera Touch"},r=i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/yabrowser/i],describe:function(e){var t={name:"Yandex Browser"},r=i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/ucbrowser/i],describe:function(e){var t={name:"UC Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/Maxthon|mxios/i],describe:function(e){var t={name:"Maxthon"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/epiphany/i],describe:function(e){var t={name:"Epiphany"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/puffin/i],describe:function(e){var t={name:"Puffin"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sleipnir/i],describe:function(e){var t={name:"Sleipnir"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/k-meleon/i],describe:function(e){var t={name:"K-Meleon"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/micromessenger/i],describe:function(e){var t={name:"WeChat"},r=i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qqbrowser/i],describe:function(e){var t={name:/qqbrowserlite/i.test(e)?"QQ Browser Lite":"QQ Browser"},r=i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/msie|trident/i],describe:function(e){var t={name:"Internet Explorer"},r=i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/\sedg\//i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/edg([ea]|ios)/i],describe:function(e){var t={name:"Microsoft Edge"},r=i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/vivaldi/i],describe:function(e){var t={name:"Vivaldi"},r=i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/seamonkey/i],describe:function(e){var t={name:"SeaMonkey"},r=i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/sailfish/i],describe:function(e){var t={name:"Sailfish"},r=i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,e);return r&&(t.version=r),t}},{test:[/silk/i],describe:function(e){var t={name:"Amazon Silk"},r=i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/phantom/i],describe:function(e){var t={name:"PhantomJS"},r=i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/slimerjs/i],describe:function(e){var t={name:"SlimerJS"},r=i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t={name:"BlackBerry"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t={name:"WebOS Browser"},r=i.default.getFirstMatch(o,e)||i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/bada/i],describe:function(e){var t={name:"Bada"},r=i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/tizen/i],describe:function(e){var t={name:"Tizen"},r=i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/qupzilla/i],describe:function(e){var t={name:"QupZilla"},r=i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/firefox|iceweasel|fxios/i],describe:function(e){var t={name:"Firefox"},r=i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/electron/i],describe:function(e){var t={name:"Electron"},r=i.default.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/MiuiBrowser/i],describe:function(e){var t={name:"Miui"},r=i.default.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/chromium/i],describe:function(e){var t={name:"Chromium"},r=i.default.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,e)||i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/chrome|crios|crmo/i],describe:function(e){var t={name:"Chrome"},r=i.default.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/GSA/i],describe:function(e){var t={name:"Google Search"},r=i.default.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t={name:"Android Browser"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/playstation 4/i],describe:function(e){var t={name:"PlayStation 4"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/safari|applewebkit/i],describe:function(e){var t={name:"Safari"},r=i.default.getFirstMatch(o,e);return r&&(t.version=r),t}},{test:[/.*/i],describe:function(e){var t=-1!==e.search("\\(")?/^(.*)\/(.*)[ \t]\((.*)/:/^(.*)\/(.*) /;return{name:i.default.getFirstMatch(t,e),version:i.default.getSecondMatch(t,e)}}}];t.default=a,e.exports=t.default},93:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:[/Roku\/DVP/],describe:function(e){var t=i.default.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,e);return{name:o.OS_MAP.Roku,version:t}}},{test:[/windows phone/i],describe:function(e){var t=i.default.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.WindowsPhone,version:t}}},{test:[/windows /i],describe:function(e){var t=i.default.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,e),r=i.default.getWindowsVersionName(t);return{name:o.OS_MAP.Windows,version:t,versionName:r}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(e){var t={name:o.OS_MAP.iOS},r=i.default.getSecondMatch(/(Version\/)(\d[\d.]+)/,e);return r&&(t.version=r),t}},{test:[/macintosh/i],describe:function(e){var t=i.default.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,e).replace(/[_\s]/g,"."),r=i.default.getMacOSVersionName(t),n={name:o.OS_MAP.MacOS,version:t};return r&&(n.versionName=r),n}},{test:[/(ipod|iphone|ipad)/i],describe:function(e){var t=i.default.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,e).replace(/[_\s]/g,".");return{name:o.OS_MAP.iOS,version:t}}},{test:function(e){var t=!e.test(/like android/i),r=e.test(/android/i);return t&&r},describe:function(e){var t=i.default.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,e),r=i.default.getAndroidVersionName(t),n={name:o.OS_MAP.Android,version:t};return r&&(n.versionName=r),n}},{test:[/(web|hpw)[o0]s/i],describe:function(e){var t=i.default.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,e),r={name:o.OS_MAP.WebOS};return t&&t.length&&(r.version=t),r}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe:function(e){var t=i.default.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,e)||i.default.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,e)||i.default.getFirstMatch(/\bbb(\d+)/i,e);return{name:o.OS_MAP.BlackBerry,version:t}}},{test:[/bada/i],describe:function(e){var t=i.default.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Bada,version:t}}},{test:[/tizen/i],describe:function(e){var t=i.default.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.Tizen,version:t}}},{test:[/linux/i],describe:function(){return{name:o.OS_MAP.Linux}}},{test:[/CrOS/],describe:function(){return{name:o.OS_MAP.ChromeOS}}},{test:[/PlayStation 4/],describe:function(e){var t=i.default.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,e);return{name:o.OS_MAP.PlayStation4,version:t}}}];t.default=a,e.exports=t.default},94:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:[/googlebot/i],describe:function(){return{type:"bot",vendor:"Google"}}},{test:[/huawei/i],describe:function(e){var t=i.default.getFirstMatch(/(can-l01)/i,e)&&"Nova",r={type:o.PLATFORMS_MAP.mobile,vendor:"Huawei"};return t&&(r.model=t),r}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){var t=e.test(/ipod|iphone/i),r=e.test(/like (ipod|iphone)/i);return t&&!r},describe:function(e){var t=i.default.getFirstMatch(/(ipod|iphone)/i,e);return{type:o.PLATFORMS_MAP.mobile,vendor:"Apple",model:t}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Nexus"}}},{test:[/[^-]mobi/i],describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"blackberry"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"BlackBerry"}}},{test:function(e){return"bada"===e.getBrowserName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"windows phone"===e.getBrowserName()},describe:function(){return{type:o.PLATFORMS_MAP.mobile,vendor:"Microsoft"}}},{test:function(e){var t=Number(String(e.getOSVersion()).split(".")[0]);return"android"===e.getOSName(!0)&&t>=3},describe:function(){return{type:o.PLATFORMS_MAP.tablet}}},{test:function(e){return"android"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.mobile}}},{test:function(e){return"macos"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop,vendor:"Apple"}}},{test:function(e){return"windows"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"linux"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.desktop}}},{test:function(e){return"playstation 4"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}},{test:function(e){return"roku"===e.getOSName(!0)},describe:function(){return{type:o.PLATFORMS_MAP.tv}}}];t.default=a,e.exports=t.default},95:function(e,t,r){t.__esModule=!0,t.default=void 0;var n,i=(n=r(17))&&n.__esModule?n:{default:n},o=r(18),a=[{test:function(e){return"microsoft edge"===e.getBrowserName(!0)},describe:function(e){if(/\sedg\//i.test(e))return{name:o.ENGINE_MAP.Blink};var t=i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,e);return{name:o.ENGINE_MAP.EdgeHTML,version:t}}},{test:[/trident/i],describe:function(e){var t={name:o.ENGINE_MAP.Trident},r=i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){return e.test(/presto/i)},describe:function(e){var t={name:o.ENGINE_MAP.Presto},r=i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:function(e){var t=e.test(/gecko/i),r=e.test(/like gecko/i);return t&&!r},describe:function(e){var t={name:o.ENGINE_MAP.Gecko},r=i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}},{test:[/(apple)?webkit\/537\.36/i],describe:function(){return{name:o.ENGINE_MAP.Blink}}},{test:[/(apple)?webkit/i],describe:function(e){var t={name:o.ENGINE_MAP.WebKit},r=i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,e);return r&&(t.version=r),t}}];t.default=a,e.exports=t.default}})})),Zt=Be(Xt),$t="mediasoup-client",er=function(){function e(t){Ge(this,e),t?(this._debug=he.default("".concat($t,":").concat(t)),this._warn=he.default("".concat($t,":WARN:").concat(t)),this._error=he.default("".concat($t,":ERROR:").concat(t))):(this._debug=he.default($t),this._warn=he.default("".concat($t,":WARN")),this._error=he.default("".concat($t,":ERROR"))),this._debug.log=console.info.bind(console),this._warn.log=console.warn.bind(console),this._error.log=console.error.bind(console)}return He(e,[{key:"debug",get:function(){return this._debug}},{key:"warn",get:function(){return this._warn}},{key:"error",get:function(){return this._error}}]),e}(),tr=er,rr=Object.defineProperty({Logger:tr},"__esModule",{value:!0});function nr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var ir=new rr.Logger("EnhancedEventEmitter"),or=function(e){Ye(n,e);var t,r=nr(n);function n(){var e;return Ge(this,n),(e=r.call(this)).setMaxListeners(1/0),e}return He(n,[{key:"safeEmit",value:function(e){var t=this.listenerCount(e);try{for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return this.emit.apply(this,[e].concat(n))}catch(r){return ir.error("safeEmit() | event listener threw an error [event:%s]:%o",e,r),Boolean(t)}}},{key:"safeEmitAsPromise",value:(t=Ve(Fe.mark((function e(t){var r,n,i,o=this,a=arguments;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=a.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=a[i];return e.abrupt("return",new Promise((function(e,r){try{o.emit.apply(o,[t].concat(n,[e,r]))}catch(e){ir.error("safeEmitAsPromise() | event listener threw an error [event:%s]:%o",t,e),r(e)}})));case 2:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),n}(Ee.EventEmitter),ar=or,sr=Object.defineProperty({EnhancedEventEmitter:ar},"__esModule",{value:!0});var cr=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")};var ur=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}},dr=Me((function(e){function t(r,n,i){return ur()?e.exports=t=Reflect.construct:e.exports=t=function(e,t,r){var n=[null];n.push.apply(n,t);var i=new(Function.bind.apply(e,n));return r&&We(i,r.prototype),i},t.apply(null,arguments)}e.exports=t})),lr=Me((function(e){function t(r){var n="function"==typeof Map?new Map:void 0;return e.exports=t=function(e){if(null===e||!cr(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return dr(e,arguments,ze(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),We(t,e)},t(r)}e.exports=t}));function pr(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var fr=function(e){Ye(r,e);var t=pr(r);function r(e){var n;return Ge(this,r),(n=t.call(this,e)).name="UnsupportedError",Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(qe(n),r):n.stack=new Error(e).stack,n}return r}(lr(Error)),hr=function(e){Ye(r,e);var t=pr(r);function r(e){var n;return Ge(this,r),(n=t.call(this,e)).name="InvalidStateError",Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(qe(n),r):n.stack=new Error(e).stack,n}return r}(lr(Error)),Ar=Object.defineProperty({UnsupportedError:fr,InvalidStateError:hr},"__esModule",{value:!0});var vr=function(e,t){return void 0===e?t:JSON.parse(JSON.stringify(e))};var gr=function(){return Math.round(1e7*Math.random())},mr=Object.defineProperty({clone:vr,generateRandomNumber:gr},"__esModule",{value:!0});function Er(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return _r(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _r(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function _r(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var yr=Me((function(e,t){var r=he("h264-profile-level-id");r.log=console.info.bind(console);t.ProfileConstrainedBaseline=1,t.ProfileBaseline=2,t.ProfileMain=3,t.ProfileConstrainedHigh=4,t.ProfileHigh=5;t.Level1_b=0,t.Level1=10,t.Level1_1=11,t.Level1_2=12,t.Level1_3=13,t.Level2=20,t.Level2_1=21,t.Level2_2=22,t.Level3=30,t.Level3_1=31,t.Level3_2=32,t.Level4=40,t.Level4_1=41,t.Level4_2=42,t.Level5=50,t.Level5_1=51,t.Level5_2=52;var n=function e(t,r){Ge(this,e),this.profile=t,this.level=r};t.ProfileLevelId=n;var i=new n(1,31),o=function(){function e(t){Ge(this,e),this._mask=~c("x",t),this._maskedValue=c("1",t)}return He(e,[{key:"isMatch",value:function(e){return this._maskedValue===(e&this._mask)}}]),e}(),a=function e(t,r,n){Ge(this,e),this.profile_idc=t,this.profile_iop=r,this.profile=n},s=[new a(66,new o("x1xx0000"),1),new a(77,new o("1xxx0000"),1),new a(88,new o("11xx0000"),1),new a(66,new o("x0xx0000"),2),new a(88,new o("10xx0000"),2),new a(77,new o("0x0x0000"),3),new a(100,new o("00000000"),5),new a(100,new o("00001100"),4)];function c(e,t){return(t[0]===e)<<7|(t[1]===e)<<6|(t[2]===e)<<5|(t[3]===e)<<4|(t[4]===e)<<3|(t[5]===e)<<2|(t[6]===e)<<1|(t[7]===e)<<0}function u(e,t){return function(e,t){return 0===e?10!==t&&0!==t:0===t?10!==e:e<t}(e,t)?e:t}function d(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e["level-asymmetry-allowed"];return 1===t||"1"===t}t.parseProfileLevelId=function(e){if("string"!=typeof e||6!==e.length)return null;var t=parseInt(e,16);if(0===t)return null;var i,o=255&t,a=t>>8&255,c=t>>16&255;switch(o){case 11:i=0!=(16&a)?0:11;break;case 10:case 12:case 13:case 20:case 21:case 22:case 30:case 31:case 32:case 40:case 41:case 42:case 50:case 51:case 52:i=o;break;default:return r("parseProfileLevelId() | unrecognized level_idc:%s",o),null}var u,d=Er(s);try{for(d.s();!(u=d.n()).done;){var l=u.value;if(c===l.profile_idc&&l.profile_iop.isMatch(a))return new n(l.profile,i)}}catch(e){d.e(e)}finally{d.f()}return r("parseProfileLevelId() | unrecognized profile_idc/profile_iop combination"),null},t.profileLevelIdToString=function(e){if(0==e.level)switch(e.profile){case 1:return"42f00b";case 2:return"42100b";case 3:return"4d100b";default:return r("profileLevelIdToString() | Level 1_b not is allowed for profile:%s",e.profile),null}var t;switch(e.profile){case 1:t="42e0";break;case 2:t="4200";break;case 3:t="4d00";break;case 4:t="640c";break;case 5:t="6400";break;default:return r("profileLevelIdToString() | unrecognized profile:%s",e.profile),null}var n=e.level.toString(16);return 1===n.length&&(n="0".concat(n)),"".concat(t).concat(n)},t.parseSdpProfileLevelId=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e["profile-level-id"];return r?t.parseProfileLevelId(r):i},t.isSameProfile=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.parseSdpProfileLevelId(e),i=t.parseSdpProfileLevelId(r);return Boolean(n&&i&&n.profile===i.profile)},t.generateProfileLevelIdForAnswer=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e["profile-level-id"]&&!i["profile-level-id"])return r("generateProfileLevelIdForAnswer() | no profile-level-id in local and remote params"),null;var o=t.parseSdpProfileLevelId(e),a=t.parseSdpProfileLevelId(i);if(!o)throw new TypeError("invalid local_profile_level_id");if(!a)throw new TypeError("invalid remote_profile_level_id");if(o.profile!==a.profile)throw new TypeError("H264 Profile mismatch");var s=d(e)&&d(i),c=o.level,l=a.level,p=u(c,l),f=s?c:p;return r("generateProfileLevelIdForAnswer() | result: [profile:%s, level:%s]",o.profile,f),t.profileLevelIdToString(new n(o.profile,f))}}));function Ir(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return Sr(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Sr(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Sr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var br=function(e){if("object"!==Ue(e))throw new TypeError("caps is not an object");if(e.codecs&&!Array.isArray(e.codecs))throw new TypeError("caps.codecs is not an array");e.codecs||(e.codecs=[]);var t,r=Ir(e.codecs);try{for(r.s();!(t=r.n()).done;){Cr(t.value)}}catch(e){r.e(e)}finally{r.f()}if(e.headerExtensions&&!Array.isArray(e.headerExtensions))throw new TypeError("caps.headerExtensions is not an array");e.headerExtensions||(e.headerExtensions=[]);var n,i=Ir(e.headerExtensions);try{for(i.s();!(n=i.n()).done;){kr(n.value)}}catch(e){i.e(e)}finally{i.f()}};function Cr(e){var t=new RegExp("^(audio|video)/(.+)","i");if("object"!==Ue(e))throw new TypeError("codec is not an object");if(!e.mimeType||"string"!=typeof e.mimeType)throw new TypeError("missing codec.mimeType");var r=t.exec(e.mimeType);if(!r)throw new TypeError("invalid codec.mimeType");if(e.kind=r[1].toLowerCase(),e.preferredPayloadType&&"number"!=typeof e.preferredPayloadType)throw new TypeError("invalid codec.preferredPayloadType");if("number"!=typeof e.clockRate)throw new TypeError("missing codec.clockRate");"audio"===e.kind?"number"!=typeof e.channels&&(e.channels=1):delete e.channels,e.parameters&&"object"===Ue(e.parameters)||(e.parameters={});for(var n=0,i=Object.keys(e.parameters);n<i.length;n++){var o=i[n],a=e.parameters[o];if(void 0===a&&(e.parameters[o]="",a=""),"string"!=typeof a&&"number"!=typeof a)throw new TypeError("invalid codec parameter [key:".concat(o,"s, value:").concat(a,"]"));if("apt"===o&&"number"!=typeof a)throw new TypeError("invalid codec apt parameter")}e.rtcpFeedback&&Array.isArray(e.rtcpFeedback)||(e.rtcpFeedback=[]);var s,c=Ir(e.rtcpFeedback);try{for(c.s();!(s=c.n()).done;){Rr(s.value)}}catch(e){c.e(e)}finally{c.f()}}var wr=Cr;function Rr(e){if("object"!==Ue(e))throw new TypeError("fb is not an object");if(!e.type||"string"!=typeof e.type)throw new TypeError("missing fb.type");e.parameter&&"string"==typeof e.parameter||(e.parameter="")}var Tr=Rr;function kr(e){if("object"!==Ue(e))throw new TypeError("ext is not an object");if(e.kind&&"string"==typeof e.kind||(e.kind=""),""!==e.kind&&"audio"!==e.kind&&"video"!==e.kind)throw new TypeError("invalid ext.kind");if(!e.uri||"string"!=typeof e.uri)throw new TypeError("missing ext.uri");if("number"!=typeof e.preferredId)throw new TypeError("missing ext.preferredId");if(e.preferredEncrypt&&"boolean"!=typeof e.preferredEncrypt)throw new TypeError("invalid ext.preferredEncrypt");if(e.preferredEncrypt||(e.preferredEncrypt=!1),e.direction&&"string"!=typeof e.direction)throw new TypeError("invalid ext.direction");e.direction||(e.direction="sendrecv")}var Or=kr;function Dr(e){if("object"!==Ue(e))throw new TypeError("params is not an object");if(e.mid&&"string"!=typeof e.mid)throw new TypeError("params.mid is not a string");if(!Array.isArray(e.codecs))throw new TypeError("missing params.codecs");var t,r=Ir(e.codecs);try{for(r.s();!(t=r.n()).done;){xr(t.value)}}catch(e){r.e(e)}finally{r.f()}if(e.headerExtensions&&!Array.isArray(e.headerExtensions))throw new TypeError("params.headerExtensions is not an array");e.headerExtensions||(e.headerExtensions=[]);var n,i=Ir(e.headerExtensions);try{for(i.s();!(n=i.n()).done;){Lr(n.value)}}catch(e){i.e(e)}finally{i.f()}if(e.encodings&&!Array.isArray(e.encodings))throw new TypeError("params.encodings is not an array");e.encodings||(e.encodings=[]);var o,a=Ir(e.encodings);try{for(a.s();!(o=a.n()).done;){Mr(o.value)}}catch(e){a.e(e)}finally{a.f()}if(e.rtcp&&"object"!==Ue(e.rtcp))throw new TypeError("params.rtcp is not an object");e.rtcp||(e.rtcp={}),Qr(e.rtcp)}var Nr=Dr;function xr(e){var t=new RegExp("^(audio|video)/(.+)","i");if("object"!==Ue(e))throw new TypeError("codec is not an object");if(!e.mimeType||"string"!=typeof e.mimeType)throw new TypeError("missing codec.mimeType");var r=t.exec(e.mimeType);if(!r)throw new TypeError("invalid codec.mimeType");if("number"!=typeof e.payloadType)throw new TypeError("missing codec.payloadType");if("number"!=typeof e.clockRate)throw new TypeError("missing codec.clockRate");"audio"===r[1].toLowerCase()?"number"!=typeof e.channels&&(e.channels=1):delete e.channels,e.parameters&&"object"===Ue(e.parameters)||(e.parameters={});for(var n=0,i=Object.keys(e.parameters);n<i.length;n++){var o=i[n],a=e.parameters[o];if(void 0===a&&(e.parameters[o]="",a=""),"string"!=typeof a&&"number"!=typeof a)throw new TypeError("invalid codec parameter [key:".concat(o,"s, value:").concat(a,"]"));if("apt"===o&&"number"!=typeof a)throw new TypeError("invalid codec apt parameter")}e.rtcpFeedback&&Array.isArray(e.rtcpFeedback)||(e.rtcpFeedback=[]);var s,c=Ir(e.rtcpFeedback);try{for(c.s();!(s=c.n()).done;){Rr(s.value)}}catch(e){c.e(e)}finally{c.f()}}var Pr=xr;function Lr(e){if("object"!==Ue(e))throw new TypeError("ext is not an object");if(!e.uri||"string"!=typeof e.uri)throw new TypeError("missing ext.uri");if("number"!=typeof e.id)throw new TypeError("missing ext.id");if(e.encrypt&&"boolean"!=typeof e.encrypt)throw new TypeError("invalid ext.encrypt");e.encrypt||(e.encrypt=!1),e.parameters&&"object"===Ue(e.parameters)||(e.parameters={});for(var t=0,r=Object.keys(e.parameters);t<r.length;t++){var n=r[t],i=e.parameters[n];if(void 0===i&&(e.parameters[n]="",i=""),"string"!=typeof i&&"number"!=typeof i)throw new TypeError("invalid header extension parameter")}}var Br=Lr;function Mr(e){if("object"!==Ue(e))throw new TypeError("encoding is not an object");if(e.ssrc&&"number"!=typeof e.ssrc)throw new TypeError("invalid encoding.ssrc");if(e.rid&&"string"!=typeof e.rid)throw new TypeError("invalid encoding.rid");if(e.rtx&&"object"!==Ue(e.rtx))throw new TypeError("invalid encoding.rtx");if(e.rtx&&"number"!=typeof e.rtx.ssrc)throw new TypeError("missing encoding.rtx.ssrc");if(e.dtx&&"boolean"==typeof e.dtx||(e.dtx=!1),e.scalabilityMode&&"string"!=typeof e.scalabilityMode)throw new TypeError("invalid encoding.scalabilityMode")}var Ur=Mr;function Qr(e){if("object"!==Ue(e))throw new TypeError("rtcp is not an object");if(e.cname&&"string"!=typeof e.cname)throw new TypeError("invalid rtcp.cname");e.reducedSize&&"boolean"==typeof e.reducedSize||(e.reducedSize=!0)}var Fr=Qr;var jr=function(e){if("object"!==Ue(e))throw new TypeError("caps is not an object");if(!e.numStreams||"object"!==Ue(e.numStreams))throw new TypeError("missing caps.numStreams");Vr(e.numStreams)};function Vr(e){if("object"!==Ue(e))throw new TypeError("numStreams is not an object");if("number"!=typeof e.OS)throw new TypeError("missing numStreams.OS");if("number"!=typeof e.MIS)throw new TypeError("missing numStreams.MIS")}var Gr=Vr;var Kr=function(e){if("object"!==Ue(e))throw new TypeError("params is not an object");if("number"!=typeof e.port)throw new TypeError("missing params.port");if("number"!=typeof e.OS)throw new TypeError("missing params.OS");if("number"!=typeof e.MIS)throw new TypeError("missing params.MIS");if("number"!=typeof e.maxMessageSize)throw new TypeError("missing params.maxMessageSize")};var Hr=function(e){if("object"!==Ue(e))throw new TypeError("params is not an object");if("number"!=typeof e.streamId)throw new TypeError("missing params.streamId");var t=!1;if("boolean"==typeof e.ordered?t=!0:e.ordered=!0,e.maxPacketLifeTime&&"number"!=typeof e.maxPacketLifeTime)throw new TypeError("invalid params.maxPacketLifeTime");if(e.maxRetransmits&&"number"!=typeof e.maxRetransmits)throw new TypeError("invalid params.maxRetransmits");if(e.maxPacketLifeTime&&e.maxRetransmits)throw new TypeError("cannot provide both maxPacketLifeTime and maxRetransmits");if(t&&e.ordered&&(e.maxPacketLifeTime||e.maxRetransmits))throw new TypeError("cannot be ordered with maxPacketLifeTime or maxRetransmits");if(t||!e.maxPacketLifeTime&&!e.maxRetransmits||(e.ordered=!1),e.priority&&"string"!=typeof e.priority)throw new TypeError("invalid params.priority");if(e.label&&"string"!=typeof e.label)throw new TypeError("invalid params.label");if(e.protocol&&"string"!=typeof e.protocol)throw new TypeError("invalid params.protocol")};var Wr=function(e,t){var r,n={codecs:[],headerExtensions:[]},i=Ir(t.codecs||[]);try{var o=function(){var t=r.value;if(en(t))return"continue";var i=(e.codecs||[]).find((function(e){return tn(e,t,{strict:!0,modify:!0})}));if(!i)return"continue";var o={mimeType:i.mimeType,kind:i.kind,clockRate:i.clockRate,channels:i.channels,localPayloadType:i.preferredPayloadType,localRtxPayloadType:void 0,remotePayloadType:t.preferredPayloadType,remoteRtxPayloadType:void 0,localParameters:i.parameters,remoteParameters:t.parameters,rtcpFeedback:rn(i,t)};n.codecs.push(o)};for(i.s();!(r=i.n()).done;)o()}catch(e){i.e(e)}finally{i.f()}var a,s=Ir(n.codecs);try{var c=function(){var r=a.value,n=e.codecs.find((function(e){return en(e)&&e.parameters.apt===r.localPayloadType})),i=t.codecs.find((function(e){return en(e)&&e.parameters.apt===r.remotePayloadType}));n&&i&&(r.localRtxPayloadType=n.preferredPayloadType,r.remoteRtxPayloadType=i.preferredPayloadType)};for(s.s();!(a=s.n()).done;)c()}catch(e){s.e(e)}finally{s.f()}var u,d=Ir(t.headerExtensions);try{var l=function(){var t=u.value,r=e.headerExtensions.find((function(e){return n=t,!((r=e).kind&&n.kind&&r.kind!==n.kind||r.uri!==n.uri);var r,n}));if(!r)return"continue";var i={kind:t.kind,uri:t.uri,sendId:r.preferredId,recvId:t.preferredId,encrypt:r.preferredEncrypt,direction:"sendrecv"};switch(t.direction){case"sendrecv":i.direction="sendrecv";break;case"recvonly":i.direction="sendonly";break;case"sendonly":i.direction="recvonly";break;case"inactive":i.direction="inactive"}n.headerExtensions.push(i)};for(d.s();!(u=d.n()).done;)l()}catch(e){d.e(e)}finally{d.f()}return n};var Yr=function(e){var t,r={codecs:[],headerExtensions:[]},n=Ir(e.codecs);try{for(n.s();!(t=n.n()).done;){var i=t.value,o={mimeType:i.mimeType,kind:i.kind,preferredPayloadType:i.remotePayloadType,clockRate:i.clockRate,channels:i.channels,parameters:i.localParameters,rtcpFeedback:i.rtcpFeedback};if(r.codecs.push(o),i.remoteRtxPayloadType){var a={mimeType:"".concat(i.kind,"/rtx"),kind:i.kind,preferredPayloadType:i.remoteRtxPayloadType,clockRate:i.clockRate,parameters:{apt:i.remotePayloadType},rtcpFeedback:[]};r.codecs.push(a)}}}catch(e){n.e(e)}finally{n.f()}var s,c=Ir(e.headerExtensions);try{for(c.s();!(s=c.n()).done;){var u=s.value;if("sendrecv"===u.direction||"recvonly"===u.direction){var d={kind:u.kind,uri:u.uri,preferredId:u.recvId,preferredEncrypt:u.encrypt,direction:u.direction};r.headerExtensions.push(d)}}}catch(e){c.e(e)}finally{c.f()}return r};var qr=function(e,t){var r,n={mid:void 0,codecs:[],headerExtensions:[],encodings:[],rtcp:{}},i=Ir(t.codecs);try{for(i.s();!(r=i.n()).done;){var o=r.value;if(o.kind===e){var a={mimeType:o.mimeType,payloadType:o.localPayloadType,clockRate:o.clockRate,channels:o.channels,parameters:o.localParameters,rtcpFeedback:o.rtcpFeedback};if(n.codecs.push(a),o.localRtxPayloadType){var s={mimeType:"".concat(o.kind,"/rtx"),payloadType:o.localRtxPayloadType,clockRate:o.clockRate,parameters:{apt:o.localPayloadType},rtcpFeedback:[]};n.codecs.push(s)}}}}catch(e){i.e(e)}finally{i.f()}var c,u=Ir(t.headerExtensions);try{for(u.s();!(c=u.n()).done;){var d=c.value;if(!(d.kind&&d.kind!==e||"sendrecv"!==d.direction&&"sendonly"!==d.direction)){var l={uri:d.uri,id:d.sendId,encrypt:d.encrypt,parameters:{}};n.headerExtensions.push(l)}}}catch(e){u.e(e)}finally{u.f()}return n};var Jr=function(e,t){var r,n={mid:void 0,codecs:[],headerExtensions:[],encodings:[],rtcp:{}},i=Ir(t.codecs);try{for(i.s();!(r=i.n()).done;){var o=r.value;if(o.kind===e){var a={mimeType:o.mimeType,payloadType:o.localPayloadType,clockRate:o.clockRate,channels:o.channels,parameters:o.remoteParameters,rtcpFeedback:o.rtcpFeedback};if(n.codecs.push(a),o.localRtxPayloadType){var s={mimeType:"".concat(o.kind,"/rtx"),payloadType:o.localRtxPayloadType,clockRate:o.clockRate,parameters:{apt:o.localPayloadType},rtcpFeedback:[]};n.codecs.push(s)}}}}catch(e){i.e(e)}finally{i.f()}var c,u=Ir(t.headerExtensions);try{for(u.s();!(c=u.n()).done;){var d=c.value;if(!(d.kind&&d.kind!==e||"sendrecv"!==d.direction&&"sendonly"!==d.direction)){var l={uri:d.uri,id:d.sendId,encrypt:d.encrypt,parameters:{}};n.headerExtensions.push(l)}}}catch(e){u.e(e)}finally{u.f()}if(n.headerExtensions.some((function(e){return"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"===e.uri}))){var p,f=Ir(n.codecs);try{for(f.s();!(p=f.n()).done;){var h=p.value;h.rtcpFeedback=(h.rtcpFeedback||[]).filter((function(e){return"goog-remb"!==e.type}))}}catch(e){f.e(e)}finally{f.f()}}else if(n.headerExtensions.some((function(e){return"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"===e.uri}))){var A,v=Ir(n.codecs);try{for(v.s();!(A=v.n()).done;){var g=A.value;g.rtcpFeedback=(g.rtcpFeedback||[]).filter((function(e){return"transport-cc"!==e.type}))}}catch(e){v.e(e)}finally{v.f()}}else{var m,E=Ir(n.codecs);try{for(E.s();!(m=E.n()).done;){var _=m.value;_.rtcpFeedback=(_.rtcpFeedback||[]).filter((function(e){return"transport-cc"!==e.type&&"goog-remb"!==e.type}))}}catch(e){E.e(e)}finally{E.f()}}return n};var zr=function(e,t){var r=[];if(t){for(var n=0;n<e.length;++n)if(tn(e[n],t)){r.push(e[n]),en(e[n+1])&&r.push(e[n+1]);break}if(0===r.length)throw new TypeError("no matching codec found")}else r.push(e[0]),en(e[1])&&r.push(e[1]);return r};var Xr=function(e){Dr(e=mr.clone(e,{}));var t={mid:"probator",codecs:[],headerExtensions:[],encodings:[{ssrc:1234}],rtcp:{cname:"probator"}};return t.codecs.push(e.codecs[0]),t.codecs[0].payloadType=127,t.headerExtensions=e.headerExtensions,t};var Zr=function(e,t){return t.codecs.some((function(t){return t.kind===e}))};var $r=function(e,t){if(Dr(e),0===e.codecs.length)return!1;var r=e.codecs[0];return t.codecs.some((function(e){return e.remotePayloadType===r.payloadType}))};function en(e){return!!e&&/.+\/rtx$/i.test(e.mimeType)}function tn(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=r.strict,i=void 0!==n&&n,o=r.modify,a=void 0!==o&&o,s=e.mimeType.toLowerCase(),c=t.mimeType.toLowerCase();if(s!==c)return!1;if(e.clockRate!==t.clockRate)return!1;if(e.channels!==t.channels)return!1;switch(s){case"video/h264":var u=e.parameters["packetization-mode"]||0,d=t.parameters["packetization-mode"]||0;if(u!==d)return!1;if(i){if(!yr.isSameProfile(e.parameters,t.parameters))return!1;var l;try{l=yr.generateProfileLevelIdForAnswer(e.parameters,t.parameters)}catch(e){return!1}a&&(l?(e.parameters["profile-level-id"]=l,t.parameters["profile-level-id"]=l):(delete e.parameters["profile-level-id"],delete t.parameters["profile-level-id"]))}break;case"video/vp9":if(i){var p=e.parameters["profile-id"]||0,f=t.parameters["profile-id"]||0;if(p!==f)return!1}}return!0}function rn(e,t){var r,n=[],i=Ir(e.rtcpFeedback||[]);try{var o=function(){var e=r.value,i=(t.rtcpFeedback||[]).find((function(t){return t.type===e.type&&(t.parameter===e.parameter||!t.parameter&&!e.parameter)}));i&&n.push(i)};for(i.s();!(r=i.n()).done;)o()}catch(e){i.e(e)}finally{i.f()}return n}var nn=Object.defineProperty({validateRtpCapabilities:br,validateRtpCodecCapability:wr,validateRtcpFeedback:Tr,validateRtpHeaderExtension:Or,validateRtpParameters:Nr,validateRtpCodecParameters:Pr,validateRtpHeaderExtensionParameters:Br,validateRtpEncodingParameters:Ur,validateRtcpParameters:Fr,validateSctpCapabilities:jr,validateNumSctpStreams:Gr,validateSctpParameters:Kr,validateSctpStreamParameters:Hr,getExtendedRtpCapabilities:Wr,getRecvRtpCapabilities:Yr,getSendingRtpParameters:qr,getSendingRemoteRtpParameters:Jr,reduceCodecs:zr,generateProbatorRtpParameters:Xr,canSend:Zr,canReceive:$r},"__esModule",{value:!0});function on(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return an(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return an(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function an(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var sn=Le&&Le.__awaiter||function(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))},cn=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{ClosedErrorClass:Error,StoppedErrorClass:Error},r=t.ClosedErrorClass,n=void 0===r?Error:r,i=t.StoppedErrorClass,o=void 0===i?Error:i;Ge(this,e),this.closed=!1,this.pendingTasks=[],this.ClosedErrorClass=Error,this.StoppedErrorClass=Error,this.ClosedErrorClass=n,this.StoppedErrorClass=o}return He(e,[{key:"close",value:function(){if(!this.closed){this.closed=!0;var e,t=on(this.pendingTasks);try{for(t.s();!(e=t.n()).done;){var r=e.value;r.stopped=!0,r.reject(new this.ClosedErrorClass("AwaitQueue closed"))}}catch(e){t.e(e)}finally{t.f()}this.pendingTasks.length=0}}},{key:"push",value:function(e,t){return sn(this,void 0,void 0,Fe.mark((function r(){var n=this;return Fe.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!this.closed){r.next=2;break}throw new this.ClosedErrorClass("AwaitQueue closed");case 2:if("function"==typeof e){r.next=4;break}throw new TypeError("given task is not a function");case 4:if(!e.name&&t)try{Object.defineProperty(e,"name",{value:t})}catch(e){}return r.abrupt("return",new Promise((function(r,i){var o={task:e,name:t,resolve:r,reject:i,stopped:!1,enqueuedAt:new Date,executedAt:void 0};n.pendingTasks.push(o),1===n.pendingTasks.length&&n.next()})));case 6:case"end":return r.stop()}}),r,this)})))}},{key:"stop",value:function(){if(!this.closed){var e,t=on(this.pendingTasks);try{for(t.s();!(e=t.n()).done;){var r=e.value;r.stopped=!0,r.reject(new this.StoppedErrorClass("AwaitQueue stopped"))}}catch(e){t.e(e)}finally{t.f()}this.pendingTasks.length=0}}},{key:"dump",value:function(){var e=new Date;return this.pendingTasks.map((function(t){return{task:t.task,name:t.name,enqueuedTime:t.executedAt?t.executedAt.getTime()-t.enqueuedAt.getTime():e.getTime()-t.enqueuedAt.getTime(),executingTime:t.executedAt?e.getTime()-t.executedAt.getTime():0}}))}},{key:"next",value:function(){return sn(this,void 0,void 0,Fe.mark((function e(){var t;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.pendingTasks[0]){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,this.executeTask(t);case 5:this.pendingTasks.shift(),this.next();case 7:case"end":return e.stop()}}),e,this)})))}},{key:"executeTask",value:function(e){return sn(this,void 0,void 0,Fe.mark((function t(){var r;return Fe.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e.stopped){t.next=2;break}return t.abrupt("return");case 2:return e.executedAt=new Date,t.prev=3,t.next=6,e.task();case 6:if(r=t.sent,!e.stopped){t.next=9;break}return t.abrupt("return");case 9:e.resolve(r),t.next=17;break;case 12:if(t.prev=12,t.t0=t.catch(3),!e.stopped){t.next=16;break}return t.abrupt("return");case 16:e.reject(t.t0);case 17:case"end":return t.stop()}}),t,null,[[3,12]])})))}},{key:"size",get:function(){return this.pendingTasks.length}}]),e}(),un=cn,dn=Object.defineProperty({AwaitQueue:un},"__esModule",{value:!0});function ln(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var pn=new rr.Logger("Producer"),fn=function(e){Ye(a,e);var t,r,n,i,o=ln(a);function a(e){var t,r=e.id,n=e.localId,i=e.rtpSender,s=e.track,c=e.rtpParameters,u=e.stopTracks,d=e.disableTrackOnPause,l=e.zeroRtpOnPause,p=e.appData;return Ge(this,a),(t=o.call(this))._closed=!1,t._observer=new sr.EnhancedEventEmitter,pn.debug("constructor()"),t._id=r,t._localId=n,t._rtpSender=i,t._track=s,t._kind=s.kind,t._rtpParameters=c,t._paused=!!d&&!s.enabled,t._maxSpatialLayer=void 0,t._stopTracks=u,t._disableTrackOnPause=d,t._zeroRtpOnPause=l,t._appData=p,t._onTrackEnded=t._onTrackEnded.bind(qe(t)),t._handleTrack(),t}return He(a,[{key:"close",value:function(){this._closed||(pn.debug("close()"),this._closed=!0,this._destroyTrack(),this.emit("@close"),this._observer.safeEmit("close"))}},{key:"transportClosed",value:function(){this._closed||(pn.debug("transportClosed()"),this._closed=!0,this._destroyTrack(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}},{key:"getStats",value:(i=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._closed){e.next=2;break}throw new Ar.InvalidStateError("closed");case 2:return e.abrupt("return",this.safeEmitAsPromise("@getstats"));case 3:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"pause",value:function(){pn.debug("pause()"),this._closed?pn.error("pause() | Producer closed"):(this._paused=!0,this._track&&this._disableTrackOnPause&&(this._track.enabled=!1),this._zeroRtpOnPause&&this.safeEmitAsPromise("@replacetrack",null).catch((function(){})),this._observer.safeEmit("pause"))}},{key:"resume",value:function(){pn.debug("resume()"),this._closed?pn.error("resume() | Producer closed"):(this._paused=!1,this._track&&this._disableTrackOnPause&&(this._track.enabled=!0),this._zeroRtpOnPause&&this.safeEmitAsPromise("@replacetrack",this._track).catch((function(){})),this._observer.safeEmit("resume"))}},{key:"replaceTrack",value:(n=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.track,pn.debug("replaceTrack() [track:%o]",r),!this._closed){e.next=7;break}if(r&&this._stopTracks)try{r.stop()}catch(e){}throw new Ar.InvalidStateError("closed");case 7:if(!r||"ended"!==r.readyState){e.next=9;break}throw new Ar.InvalidStateError("track ended");case 9:if(r!==this._track){e.next=12;break}return pn.debug("replaceTrack() | same track, ignored"),e.abrupt("return");case 12:if(this._zeroRtpOnPause&&this._paused){e.next=15;break}return e.next=15,this.safeEmitAsPromise("@replacetrack",r);case 15:this._destroyTrack(),this._track=r,this._track&&this._disableTrackOnPause&&(this._paused?this._paused&&(this._track.enabled=!1):this._track.enabled=!0),this._handleTrack();case 19:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setMaxSpatialLayer",value:(r=Ve(Fe.mark((function e(t){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._closed){e.next=4;break}throw new Ar.InvalidStateError("closed");case 4:if("video"===this._kind){e.next=8;break}throw new Ar.UnsupportedError("not a video Producer");case 8:if("number"==typeof t){e.next=10;break}throw new TypeError("invalid spatialLayer");case 10:if(t!==this._maxSpatialLayer){e.next=12;break}return e.abrupt("return");case 12:return e.next=14,this.safeEmitAsPromise("@setmaxspatiallayer",t);case 14:this._maxSpatialLayer=t;case 15:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"setRtpEncodingParameters",value:(t=Ve(Fe.mark((function e(t){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._closed){e.next=4;break}throw new Ar.InvalidStateError("closed");case 4:if("object"===Ue(t)){e.next=6;break}throw new TypeError("invalid params");case 6:return e.next=8,this.safeEmitAsPromise("@setrtpencodingparameters",t);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_onTrackEnded",value:function(){pn.debug('track "ended" event'),this.safeEmit("trackended"),this._observer.safeEmit("trackended")}},{key:"_handleTrack",value:function(){this._track&&this._track.addEventListener("ended",this._onTrackEnded)}},{key:"_destroyTrack",value:function(){if(this._track)try{this._track.removeEventListener("ended",this._onTrackEnded),this._stopTracks&&this._track.stop()}catch(e){}}},{key:"id",get:function(){return this._id}},{key:"localId",get:function(){return this._localId}},{key:"closed",get:function(){return this._closed}},{key:"kind",get:function(){return this._kind}},{key:"rtpSender",get:function(){return this._rtpSender}},{key:"track",get:function(){return this._track}},{key:"rtpParameters",get:function(){return this._rtpParameters}},{key:"paused",get:function(){return this._paused}},{key:"maxSpatialLayer",get:function(){return this._maxSpatialLayer}},{key:"appData",get:function(){return this._appData},set:function(e){throw new Error("cannot override appData object")}},{key:"observer",get:function(){return this._observer}}]),a}(sr.EnhancedEventEmitter),hn=Object.defineProperty({Producer:fn},"__esModule",{value:!0});function An(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var vn=new rr.Logger("Consumer"),gn=function(e){Ye(n,e);var t,r=An(n);function n(e){var t,i=e.id,o=e.localId,a=e.producerId,s=e.rtpReceiver,c=e.track,u=e.rtpParameters,d=e.appData;return Ge(this,n),(t=r.call(this))._closed=!1,t._observer=new sr.EnhancedEventEmitter,vn.debug("constructor()"),t._id=i,t._localId=o,t._producerId=a,t._rtpReceiver=s,t._track=c,t._rtpParameters=u,t._paused=!c.enabled,t._appData=d,t._onTrackEnded=t._onTrackEnded.bind(qe(t)),t._handleTrack(),t}return He(n,[{key:"close",value:function(){this._closed||(vn.debug("close()"),this._closed=!0,this._destroyTrack(),this.emit("@close"),this._observer.safeEmit("close"))}},{key:"transportClosed",value:function(){this._closed||(vn.debug("transportClosed()"),this._closed=!0,this._destroyTrack(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}},{key:"getStats",value:(t=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._closed){e.next=2;break}throw new Ar.InvalidStateError("closed");case 2:return e.abrupt("return",this.safeEmitAsPromise("@getstats"));case 3:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"pause",value:function(){vn.debug("pause()"),this._closed?vn.error("pause() | Consumer closed"):(this._paused=!0,this._track.enabled=!1,this._observer.safeEmit("pause"))}},{key:"resume",value:function(){vn.debug("resume()"),this._closed?vn.error("resume() | Consumer closed"):(this._paused=!1,this._track.enabled=!0,this._observer.safeEmit("resume"))}},{key:"_onTrackEnded",value:function(){vn.debug('track "ended" event'),this.safeEmit("trackended"),this._observer.safeEmit("trackended")}},{key:"_handleTrack",value:function(){this._track.addEventListener("ended",this._onTrackEnded)}},{key:"_destroyTrack",value:function(){try{this._track.removeEventListener("ended",this._onTrackEnded),this._track.stop()}catch(e){}}},{key:"id",get:function(){return this._id}},{key:"localId",get:function(){return this._localId}},{key:"producerId",get:function(){return this._producerId}},{key:"closed",get:function(){return this._closed}},{key:"kind",get:function(){return this._track.kind}},{key:"rtpReceiver",get:function(){return this._rtpReceiver}},{key:"track",get:function(){return this._track}},{key:"rtpParameters",get:function(){return this._rtpParameters}},{key:"paused",get:function(){return this._paused}},{key:"appData",get:function(){return this._appData},set:function(e){throw new Error("cannot override appData object")}},{key:"observer",get:function(){return this._observer}}]),n}(sr.EnhancedEventEmitter),mn=Object.defineProperty({Consumer:gn},"__esModule",{value:!0});function En(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var _n=new rr.Logger("DataProducer"),yn=function(e){Ye(r,e);var t=En(r);function r(e){var n,i=e.id,o=e.dataChannel,a=e.sctpStreamParameters,s=e.appData;return Ge(this,r),(n=t.call(this))._closed=!1,n._observer=new sr.EnhancedEventEmitter,_n.debug("constructor()"),n._id=i,n._dataChannel=o,n._sctpStreamParameters=a,n._appData=s,n._handleDataChannel(),n}return He(r,[{key:"close",value:function(){this._closed||(_n.debug("close()"),this._closed=!0,this._dataChannel.close(),this.emit("@close"),this._observer.safeEmit("close"))}},{key:"transportClosed",value:function(){this._closed||(_n.debug("transportClosed()"),this._closed=!0,this._dataChannel.close(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}},{key:"send",value:function(e){if(_n.debug("send()"),this._closed)throw new Ar.InvalidStateError("closed");this._dataChannel.send(e)}},{key:"_handleDataChannel",value:function(){var e=this;this._dataChannel.addEventListener("open",(function(){e._closed||(_n.debug('DataChannel "open" event'),e.safeEmit("open"))})),this._dataChannel.addEventListener("error",(function(t){if(!e._closed){var r=t.error;r||(r=new Error("unknown DataChannel error")),"sctp-failure"===r.errorDetail?_n.error("DataChannel SCTP error [sctpCauseCode:%s]: %s",r.sctpCauseCode,r.message):_n.error('DataChannel "error" event: %o',r),e.safeEmit("error",r)}})),this._dataChannel.addEventListener("close",(function(){e._closed||(_n.warn('DataChannel "close" event'),e._closed=!0,e.emit("@close"),e.safeEmit("close"))})),this._dataChannel.addEventListener("message",(function(){e._closed||_n.warn('DataChannel "message" event in a DataProducer, message discarded')})),this._dataChannel.addEventListener("bufferedamountlow",(function(){e._closed||e.safeEmit("bufferedamountlow")}))}},{key:"id",get:function(){return this._id}},{key:"closed",get:function(){return this._closed}},{key:"sctpStreamParameters",get:function(){return this._sctpStreamParameters}},{key:"readyState",get:function(){return this._dataChannel.readyState}},{key:"label",get:function(){return this._dataChannel.label}},{key:"protocol",get:function(){return this._dataChannel.protocol}},{key:"bufferedAmount",get:function(){return this._dataChannel.bufferedAmount}},{key:"bufferedAmountLowThreshold",get:function(){return this._dataChannel.bufferedAmountLowThreshold},set:function(e){this._dataChannel.bufferedAmountLowThreshold=e}},{key:"appData",get:function(){return this._appData},set:function(e){throw new Error("cannot override appData object")}},{key:"observer",get:function(){return this._observer}}]),r}(sr.EnhancedEventEmitter),In=yn,Sn=Object.defineProperty({DataProducer:In},"__esModule",{value:!0});function bn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var Cn=new rr.Logger("DataConsumer"),wn=function(e){Ye(r,e);var t=bn(r);function r(e){var n,i=e.id,o=e.dataProducerId,a=e.dataChannel,s=e.sctpStreamParameters,c=e.appData;return Ge(this,r),(n=t.call(this))._closed=!1,n._observer=new sr.EnhancedEventEmitter,Cn.debug("constructor()"),n._id=i,n._dataProducerId=o,n._dataChannel=a,n._sctpStreamParameters=s,n._appData=c,n._handleDataChannel(),n}return He(r,[{key:"close",value:function(){this._closed||(Cn.debug("close()"),this._closed=!0,this._dataChannel.close(),this.emit("@close"),this._observer.safeEmit("close"))}},{key:"transportClosed",value:function(){this._closed||(Cn.debug("transportClosed()"),this._closed=!0,this._dataChannel.close(),this.safeEmit("transportclose"),this._observer.safeEmit("close"))}},{key:"_handleDataChannel",value:function(){var e=this;this._dataChannel.addEventListener("open",(function(){e._closed||(Cn.debug('DataChannel "open" event'),e.safeEmit("open"))})),this._dataChannel.addEventListener("error",(function(t){if(!e._closed){var r=t.error;r||(r=new Error("unknown DataChannel error")),"sctp-failure"===r.errorDetail?Cn.error("DataChannel SCTP error [sctpCauseCode:%s]: %s",r.sctpCauseCode,r.message):Cn.error('DataChannel "error" event: %o',r),e.safeEmit("error",r)}})),this._dataChannel.addEventListener("close",(function(){e._closed||(Cn.warn('DataChannel "close" event'),e._closed=!0,e.emit("@close"),e.safeEmit("close"))})),this._dataChannel.addEventListener("message",(function(t){e._closed||e.safeEmit("message",t.data)}))}},{key:"id",get:function(){return this._id}},{key:"dataProducerId",get:function(){return this._dataProducerId}},{key:"closed",get:function(){return this._closed}},{key:"sctpStreamParameters",get:function(){return this._sctpStreamParameters}},{key:"readyState",get:function(){return this._dataChannel.readyState}},{key:"label",get:function(){return this._dataChannel.label}},{key:"protocol",get:function(){return this._dataChannel.protocol}},{key:"binaryType",get:function(){return this._dataChannel.binaryType},set:function(e){this._dataChannel.binaryType=e}},{key:"appData",get:function(){return this._appData},set:function(e){throw new Error("cannot override appData object")}},{key:"observer",get:function(){return this._observer}}]),r}(sr.EnhancedEventEmitter),Rn=Object.defineProperty({DataConsumer:wn},"__esModule",{value:!0});function Tn(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return kn(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return kn(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function kn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function On(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var Dn=new rr.Logger("Transport"),Nn=function(e){Ye(u,e);var t,r,n,i,o,a,s,c=On(u);function u(e){var t,r=e.direction,n=e.id,i=e.iceParameters,o=e.iceCandidates,a=e.dtlsParameters,s=e.sctpParameters,d=e.iceServers,l=e.iceTransportPolicy,p=e.additionalSettings,f=e.proprietaryConstraints,h=e.appData,A=e.handlerFactory,v=e.extendedRtpCapabilities,g=e.canProduceByKind;return Ge(this,u),(t=c.call(this))._closed=!1,t._connectionState="new",t._producers=new Map,t._consumers=new Map,t._dataProducers=new Map,t._dataConsumers=new Map,t._probatorConsumerCreated=!1,t._awaitQueue=new dn.AwaitQueue({ClosedErrorClass:Ar.InvalidStateError}),t._observer=new sr.EnhancedEventEmitter,Dn.debug("constructor() [id:%s, direction:%s]",n,r),t._id=n,t._direction=r,t._extendedRtpCapabilities=v,t._canProduceByKind=g,t._maxSctpMessageSize=s?s.maxMessageSize:null,delete(p=mr.clone(p,{})).iceServers,delete p.iceTransportPolicy,delete p.bundlePolicy,delete p.rtcpMuxPolicy,delete p.sdpSemantics,t._handler=A(),t._handler.run({direction:r,iceParameters:i,iceCandidates:o,dtlsParameters:a,sctpParameters:s,iceServers:d,iceTransportPolicy:l,additionalSettings:p,proprietaryConstraints:f,extendedRtpCapabilities:v}),t._appData=h,t._handleHandler(),t}return He(u,[{key:"close",value:function(){if(!this._closed){Dn.debug("close()"),this._closed=!0,this._awaitQueue.close(),this._handler.close();var e,t=Tn(this._producers.values());try{for(t.s();!(e=t.n()).done;){e.value.transportClosed()}}catch(e){t.e(e)}finally{t.f()}this._producers.clear();var r,n=Tn(this._consumers.values());try{for(n.s();!(r=n.n()).done;){r.value.transportClosed()}}catch(e){n.e(e)}finally{n.f()}this._consumers.clear();var i,o=Tn(this._dataProducers.values());try{for(o.s();!(i=o.n()).done;){i.value.transportClosed()}}catch(e){o.e(e)}finally{o.f()}this._dataProducers.clear();var a,s=Tn(this._dataConsumers.values());try{for(s.s();!(a=s.n()).done;){a.value.transportClosed()}}catch(e){s.e(e)}finally{s.f()}this._dataConsumers.clear(),this._observer.safeEmit("close")}}},{key:"getStats",value:(s=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._closed){e.next=2;break}throw new Ar.InvalidStateError("closed");case 2:return e.abrupt("return",this._handler.getTransportStats());case 3:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"restartIce",value:(a=Ve(Fe.mark((function e(t){var r,n=this;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.iceParameters,Dn.debug("restartIce()"),!this._closed){e.next=6;break}throw new Ar.InvalidStateError("closed");case 6:if(r){e.next=8;break}throw new TypeError("missing iceParameters");case 8:return e.abrupt("return",this._awaitQueue.push(Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n._handler.restartIce(r));case 1:case"end":return e.stop()}}),e)}))),"transport.restartIce()"));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"updateIceServers",value:(o=Ve(Fe.mark((function e(){var t,r,n=this,i=arguments;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},r=t.iceServers,Dn.debug("updateIceServers()"),!this._closed){e.next=6;break}throw new Ar.InvalidStateError("closed");case 6:if(Array.isArray(r)){e.next=8;break}throw new TypeError("missing iceServers");case 8:return e.abrupt("return",this._awaitQueue.push(Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n._handler.updateIceServers(r));case 1:case"end":return e.stop()}}),e)}))),"transport.updateIceServers()"));case 9:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"produce",value:(i=Ve(Fe.mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,p,f,h=this,A=arguments;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=A.length>0&&void 0!==A[0]?A[0]:{},r=t.track,n=t.encodings,i=t.codecOptions,o=t.codec,a=t.stopTracks,s=void 0===a||a,c=t.disableTrackOnPause,u=void 0===c||c,d=t.zeroRtpOnPause,l=void 0!==d&&d,p=t.appData,f=void 0===p?{}:p,Dn.debug("produce() [track:%o]",r),r){e.next=6;break}throw new TypeError("missing track");case 6:if("send"===this._direction){e.next=10;break}throw new Ar.UnsupportedError("not a sending Transport");case 10:if(this._canProduceByKind[r.kind]){e.next=14;break}throw new Ar.UnsupportedError("cannot produce ".concat(r.kind));case 14:if("ended"!==r.readyState){e.next=18;break}throw new Ar.InvalidStateError("track ended");case 18:if(0!==this.listenerCount("connect")||"new"!==this._connectionState){e.next=22;break}throw new TypeError('no "connect" listener set into this transport');case 22:if(0!==this.listenerCount("produce")){e.next=26;break}throw new TypeError('no "produce" listener set into this transport');case 26:if(!f||"object"===Ue(f)){e.next=28;break}throw new TypeError("if given, appData must be an object");case 28:return e.abrupt("return",this._awaitQueue.push(Ve(Fe.mark((function e(){var t,a,c,d,p,A,v,g;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!n||Array.isArray(n)){e.next=4;break}throw TypeError("encodings must be an array");case 4:n&&0===n.length?t=void 0:n&&(t=n.map((function(e){var t={active:!0};return!1===e.active&&(t.active=!1),"boolean"==typeof e.dtx&&(t.dtx=e.dtx),"string"==typeof e.scalabilityMode&&(t.scalabilityMode=e.scalabilityMode),"number"==typeof e.scaleResolutionDownBy&&(t.scaleResolutionDownBy=e.scaleResolutionDownBy),"number"==typeof e.maxBitrate&&(t.maxBitrate=e.maxBitrate),"number"==typeof e.maxFramerate&&(t.maxFramerate=e.maxFramerate),"boolean"==typeof e.adaptivePtime&&(t.adaptivePtime=e.adaptivePtime),"string"==typeof e.priority&&(t.priority=e.priority),"string"==typeof e.networkPriority&&(t.networkPriority=e.networkPriority),t})));case 5:return e.next=7,h._handler.send({track:r,encodings:t,codecOptions:i,codec:o});case 7:return a=e.sent,c=a.localId,d=a.rtpParameters,p=a.rtpSender,e.prev=11,nn.validateRtpParameters(d),e.next=15,h.safeEmitAsPromise("produce",{kind:r.kind,rtpParameters:d,appData:f});case 15:return A=e.sent,v=A.id,g=new hn.Producer({id:v,localId:c,rtpSender:p,track:r,rtpParameters:d,stopTracks:s,disableTrackOnPause:u,zeroRtpOnPause:l,appData:f}),h._producers.set(g.id,g),h._handleProducer(g),h._observer.safeEmit("newproducer",g),e.abrupt("return",g);case 24:throw e.prev=24,e.t0=e.catch(11),h._handler.stopSending(c).catch((function(){})),e.t0;case 28:case"end":return e.stop()}}),e,null,[[11,24]])}))),"transport.produce()").catch((function(e){if(s)try{r.stop()}catch(e){}throw e})));case 29:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"consume",value:(n=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c=this;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.id,n=t.producerId,i=t.kind,o=t.rtpParameters,a=t.appData,s=void 0===a?{}:a,Dn.debug("consume()"),o=mr.clone(o,void 0),!this._closed){e.next=7;break}throw new Ar.InvalidStateError("closed");case 7:if("recv"===this._direction){e.next=11;break}throw new Ar.UnsupportedError("not a receiving Transport");case 11:if("string"==typeof r){e.next=15;break}throw new TypeError("missing id");case 15:if("string"==typeof n){e.next=19;break}throw new TypeError("missing producerId");case 19:if("audio"===i||"video"===i){e.next=23;break}throw new TypeError("invalid kind '".concat(i,"'"));case 23:if(0!==this.listenerCount("connect")||"new"!==this._connectionState){e.next=27;break}throw new TypeError('no "connect" listener set into this transport');case 27:if(!s||"object"===Ue(s)){e.next=29;break}throw new TypeError("if given, appData must be an object");case 29:return e.abrupt("return",this._awaitQueue.push(Ve(Fe.mark((function e(){var t,a,u,d,l,p;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(nn.canReceive(o,c._extendedRtpCapabilities)){e.next=3;break}throw new Ar.UnsupportedError("cannot consume this Producer");case 3:return e.next=5,c._handler.receive({trackId:r,kind:i,rtpParameters:o});case 5:if(t=e.sent,a=t.localId,u=t.rtpReceiver,d=t.track,l=new mn.Consumer({id:r,localId:a,producerId:n,rtpReceiver:u,track:d,rtpParameters:o,appData:s}),c._consumers.set(l.id,l),c._handleConsumer(l),c._probatorConsumerCreated||"video"!==i){e.next=24;break}return e.prev=13,p=nn.generateProbatorRtpParameters(l.rtpParameters),e.next=17,c._handler.receive({trackId:"probator",kind:"video",rtpParameters:p});case 17:Dn.debug("consume() | Consumer for RTP probation created"),c._probatorConsumerCreated=!0,e.next=24;break;case 21:e.prev=21,e.t0=e.catch(13),Dn.error("consume() | failed to create Consumer for RTP probation:%o",e.t0);case 24:return c._observer.safeEmit("newconsumer",l),e.abrupt("return",l);case 26:case"end":return e.stop()}}),e,null,[[13,21]])}))),"transport.consume()"));case 30:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"produceData",value:(r=Ve(Fe.mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,p,f,h=this,A=arguments;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=A.length>0&&void 0!==A[0]?A[0]:{},r=t.ordered,n=void 0===r||r,i=t.maxPacketLifeTime,o=t.maxRetransmits,a=t.priority,s=void 0===a?"low":a,c=t.label,u=void 0===c?"":c,d=t.protocol,l=void 0===d?"":d,p=t.appData,f=void 0===p?{}:p,Dn.debug("produceData()"),"send"===this._direction){e.next=6;break}throw new Ar.UnsupportedError("not a sending Transport");case 6:if(this._maxSctpMessageSize){e.next=10;break}throw new Ar.UnsupportedError("SCTP not enabled by remote Transport");case 10:if(["very-low","low","medium","high"].includes(s)){e.next=14;break}throw new TypeError("wrong priority");case 14:if(0!==this.listenerCount("connect")||"new"!==this._connectionState){e.next=18;break}throw new TypeError('no "connect" listener set into this transport');case 18:if(0!==this.listenerCount("producedata")){e.next=22;break}throw new TypeError('no "producedata" listener set into this transport');case 22:if(!f||"object"===Ue(f)){e.next=24;break}throw new TypeError("if given, appData must be an object");case 24:return(i||o)&&(n=!1),e.abrupt("return",this._awaitQueue.push(Ve(Fe.mark((function e(){var t,r,a,c,d,p;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,h._handler.sendDataChannel({ordered:n,maxPacketLifeTime:i,maxRetransmits:o,priority:s,label:u,protocol:l});case 2:return t=e.sent,r=t.dataChannel,a=t.sctpStreamParameters,nn.validateSctpStreamParameters(a),e.next=8,h.safeEmitAsPromise("producedata",{sctpStreamParameters:a,label:u,protocol:l,appData:f});case 8:return c=e.sent,d=c.id,p=new Sn.DataProducer({id:d,dataChannel:r,sctpStreamParameters:a,appData:f}),h._dataProducers.set(p.id,p),h._handleDataProducer(p),h._observer.safeEmit("newdataproducer",p),e.abrupt("return",p);case 15:case"end":return e.stop()}}),e)}))),"transport.produceData()"));case 26:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"consumeData",value:(t=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l=this;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.id,n=t.dataProducerId,i=t.sctpStreamParameters,o=t.label,a=void 0===o?"":o,s=t.protocol,c=void 0===s?"":s,u=t.appData,d=void 0===u?{}:u,Dn.debug("consumeData()"),i=mr.clone(i,void 0),!this._closed){e.next=7;break}throw new Ar.InvalidStateError("closed");case 7:if("recv"===this._direction){e.next=11;break}throw new Ar.UnsupportedError("not a receiving Transport");case 11:if(this._maxSctpMessageSize){e.next=15;break}throw new Ar.UnsupportedError("SCTP not enabled by remote Transport");case 15:if("string"==typeof r){e.next=19;break}throw new TypeError("missing id");case 19:if("string"==typeof n){e.next=23;break}throw new TypeError("missing dataProducerId");case 23:if(0!==this.listenerCount("connect")||"new"!==this._connectionState){e.next=27;break}throw new TypeError('no "connect" listener set into this transport');case 27:if(!d||"object"===Ue(d)){e.next=29;break}throw new TypeError("if given, appData must be an object");case 29:return nn.validateSctpStreamParameters(i),e.abrupt("return",this._awaitQueue.push(Ve(Fe.mark((function e(){var t,o,s;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,l._handler.receiveDataChannel({sctpStreamParameters:i,label:a,protocol:c});case 2:return t=e.sent,o=t.dataChannel,s=new Rn.DataConsumer({id:r,dataProducerId:n,dataChannel:o,sctpStreamParameters:i,appData:d}),l._dataConsumers.set(s.id,s),l._handleDataConsumer(s),l._observer.safeEmit("newdataconsumer",s),e.abrupt("return",s);case 9:case"end":return e.stop()}}),e)}))),"transport.consumeData()"));case 31:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_handleHandler",value:function(){var e=this,t=this._handler;t.on("@connect",(function(t,r,n){var i=t.dtlsParameters;e._closed?n(new Ar.InvalidStateError("closed")):e.safeEmit("connect",{dtlsParameters:i},r,n)})),t.on("@connectionstatechange",(function(t){t!==e._connectionState&&(Dn.debug("connection state changed to %s",t),e._connectionState=t,e._closed||e.safeEmit("connectionstatechange",t))}))}},{key:"_handleProducer",value:function(e){var t=this;e.on("@close",(function(){t._producers.delete(e.id),t._closed||t._awaitQueue.push(Ve(Fe.mark((function r(){return Fe.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",t._handler.stopSending(e.localId));case 1:case"end":return r.stop()}}),r)}))),"producer @close event").catch((function(e){return Dn.warn("producer.close() failed:%o",e)}))})),e.on("@replacetrack",(function(r,n,i){t._awaitQueue.push(Ve(Fe.mark((function n(){return Fe.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",t._handler.replaceTrack(e.localId,r));case 1:case"end":return n.stop()}}),n)}))),"producer @replacetrack event").then(n).catch(i)})),e.on("@setmaxspatiallayer",(function(r,n,i){t._awaitQueue.push(Ve(Fe.mark((function n(){return Fe.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",t._handler.setMaxSpatialLayer(e.localId,r));case 1:case"end":return n.stop()}}),n)}))),"producer @setmaxspatiallayer event").then(n).catch(i)})),e.on("@setrtpencodingparameters",(function(r,n,i){t._awaitQueue.push(Ve(Fe.mark((function n(){return Fe.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.abrupt("return",t._handler.setRtpEncodingParameters(e.localId,r));case 1:case"end":return n.stop()}}),n)}))),"producer @setrtpencodingparameters event").then(n).catch(i)})),e.on("@getstats",(function(r,n){if(t._closed)return n(new Ar.InvalidStateError("closed"));t._handler.getSenderStats(e.localId).then(r).catch(n)}))}},{key:"_handleConsumer",value:function(e){var t=this;e.on("@close",(function(){t._consumers.delete(e.id),t._closed||t._awaitQueue.push(Ve(Fe.mark((function r(){return Fe.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",t._handler.stopReceiving(e.localId));case 1:case"end":return r.stop()}}),r)}))),"consumer @close event").catch((function(){}))})),e.on("@getstats",(function(r,n){if(t._closed)return n(new Ar.InvalidStateError("closed"));t._handler.getReceiverStats(e.localId).then(r).catch(n)}))}},{key:"_handleDataProducer",value:function(e){var t=this;e.on("@close",(function(){t._dataProducers.delete(e.id)}))}},{key:"_handleDataConsumer",value:function(e){var t=this;e.on("@close",(function(){t._dataConsumers.delete(e.id)}))}},{key:"id",get:function(){return this._id}},{key:"closed",get:function(){return this._closed}},{key:"direction",get:function(){return this._direction}},{key:"handler",get:function(){return this._handler}},{key:"connectionState",get:function(){return this._connectionState}},{key:"appData",get:function(){return this._appData},set:function(e){throw new Error("cannot override appData object")}},{key:"observer",get:function(){return this._observer}}]),u}(sr.EnhancedEventEmitter),xn=Object.defineProperty({Transport:Nn},"__esModule",{value:!0}),Pn=Me((function(e){var t=e.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(t).forEach((function(e){t[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))}))})),Ln=Me((function(e,t){var r=function(e){return String(Number(e))===e?Number(e):e},n=function(e,t,n){var i=e.name&&e.names;e.push&&!t[e.push]?t[e.push]=[]:i&&!t[e.name]&&(t[e.name]={});var o=e.push?{}:i?t[e.name]:t;!function(e,t,n,i){if(i&&!n)t[i]=r(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(t[n[o]]=r(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&t[e.push].push(o)},i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(e){var t={},r=[],o=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(r.push({rtp:[],fmtp:[]}),o=r[r.length-1]);for(var a=0;a<(Pn[t]||[]).length;a+=1){var s=Pn[t][a];if(s.reg.test(i))return n(s,o,i)}})),t.media=r,t};var o=function(e,t){var n=t.split(/=(.+)/,2);return 2===n.length?e[n[0]]=r(n[1]):1===n.length&&t.length>1&&(e[n[0]]=void 0),e};t.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(e){return e.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(e){for(var t=[],n=e.split(" ").map(r),i=0;i<n.length;i+=3)t.push({component:n[i],ip:n[i+1],port:n[i+2]});return t},t.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},t.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var t,n=!1;return"~"!==e[0]?t=r(e):(t=r(e.substring(1,e.length)),n=!0),{scid:t,paused:n}}))}))}})),Bn=/%[sdv%]/g,Mn=function(e){var t=1,r=arguments,n=r.length;return e.replace(Bn,(function(e){if(t>=n)return e;var i=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},Un=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var o=t.names[i];t.name?n.push(r[t.name][o]):n.push(r[t.names[i]])}else n.push(r[t.name]);return Mn.apply(null,n)},Qn=["v","o","s","i","u","e","p","c","b","t","r","z","a"],Fn=["i","c","b","a"],jn={write:function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var r=t.outerOrder||Qn,n=t.innerOrder||Fn,i=[];return r.forEach((function(t){Pn[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(Un(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(Un(t,r,e))}))}))})),e.media.forEach((function(e){i.push(Un("m",Pn.m[0],e)),n.forEach((function(t){Pn[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(Un(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(Un(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"},parse:Ln.parse,parseParams:Ln.parseParams,parseFmtpConfig:Ln.parseFmtpConfig,parsePayloads:Ln.parsePayloads,parseRemoteCandidates:Ln.parseRemoteCandidates,parseImageAttributes:Ln.parseImageAttributes,parseSimulcastStreamList:Ln.parseSimulcastStreamList};function Vn(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return Gn(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Gn(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Gn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Kn=function(e){var t,r=e.sdpObject,n=new Map,i=[],o=!1,a=!1,s=Vn(r.media);try{for(s.s();!(t=s.n()).done;){var c=t.value,u=c.type;switch(u){case"audio":if(o)continue;o=!0;break;case"video":if(a)continue;a=!0;break;default:continue}var d,l=Vn(c.rtp);try{for(l.s();!(d=l.n()).done;){var p=d.value,f={kind:u,mimeType:"".concat(u,"/").concat(p.codec),preferredPayloadType:p.payload,clockRate:p.rate,channels:p.encoding,parameters:{},rtcpFeedback:[]};n.set(f.preferredPayloadType,f)}}catch(e){l.e(e)}finally{l.f()}var h,A=Vn(c.fmtp||[]);try{for(A.s();!(h=A.n()).done;){var v=h.value,g=jn.parseParams(v.config),m=n.get(v.payload);m&&(g&&g["profile-level-id"]&&(g["profile-level-id"]=String(g["profile-level-id"])),m.parameters=g)}}catch(e){A.e(e)}finally{A.f()}var E,_=Vn(c.rtcpFb||[]);try{for(_.s();!(E=_.n()).done;){var y=E.value,I=n.get(y.payload);if(I){var S={type:y.type,parameter:y.subtype};S.parameter||delete S.parameter,I.rtcpFeedback.push(S)}}}catch(e){_.e(e)}finally{_.f()}var b,C=Vn(c.ext||[]);try{for(C.s();!(b=C.n()).done;){var w=b.value;if(!w["encrypt-uri"]){var R={kind:u,uri:w.uri,preferredId:w.value};i.push(R)}}}catch(e){C.e(e)}finally{C.f()}}}catch(e){s.e(e)}finally{s.f()}return{codecs:Array.from(n.values()),headerExtensions:i}};var Hn=function(e){var t=e.sdpObject,r=(t.media||[]).find((function(e){return e.iceUfrag&&0!==e.port}));if(!r)throw new Error("no active media section found");var n,i=r.fingerprint||t.fingerprint;switch(r.setup){case"active":n="client";break;case"passive":n="server";break;case"actpass":n="auto"}return{role:n,fingerprints:[{algorithm:i.type,value:i.hash}]}};var Wn=function(e){var t=(e.offerMediaObject.ssrcs||[]).find((function(e){return"cname"===e.attribute}));return t?t.value:""};var Yn=function(e){var t,r=e.offerRtpParameters,n=e.answerMediaObject,i=Vn(r.codecs);try{var o=function(){var e=t.value,r=e.mimeType.toLowerCase();if("audio/opus"!==r)return"continue";if(!(n.rtp||[]).find((function(t){return t.payload===e.payloadType})))return"continue";n.fmtp=n.fmtp||[];var i=n.fmtp.find((function(t){return t.payload===e.payloadType}));i||(i={payload:e.payloadType,config:""},n.fmtp.push(i));var o=jn.parseParams(i.config);if("audio/opus"===r){var a=e.parameters["sprop-stereo"];void 0!==a&&(o.stereo=a?1:0)}i.config="";for(var s=0,c=Object.keys(o);s<c.length;s++){var u=c[s];i.config&&(i.config+=";"),i.config+="".concat(u,"=").concat(o[u])}};for(i.s();!(t=i.n()).done;)o()}catch(e){i.e(e)}finally{i.f()}},qn=Object.defineProperty({extractRtpCapabilities:Kn,extractDtlsParameters:Hn,getCname:Wn,applyCodecParameters:Yn},"__esModule",{value:!0});var Jn=function(e){if(Array.isArray(e))return e};var zn=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var r=[],n=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(r.push(a.value),!t||r.length!==t);n=!0);}catch(e){i=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(i)throw o}}return r}};var Xn=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n};var Zn=function(e,t){if(e){if("string"==typeof e)return Xn(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Xn(e,t):void 0}};var $n=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")};var ei=function(e,t){return Jn(e)||zn(e,t)||Zn(e,t)||$n()};function ti(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return ri(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ri(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function ri(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var ni=function(e){var t,r=e.offerMediaObject,n=new Set,i=ti(r.ssrcs||[]);try{for(i.s();!(t=i.n()).done;){var o=t.value.id;n.add(o)}}catch(e){i.e(e)}finally{i.f()}if(0===n.size)throw new Error("no a=ssrc lines found");var a,s=new Map,c=ti(r.ssrcGroups||[]);try{for(c.s();!(a=c.n()).done;){var u=a.value;if("FID"===u.semantics){var d=u.ssrcs.split(/\s+/),l=ei(d,2),p=l[0],f=l[1];p=Number(p),f=Number(f),n.has(p)&&(n.delete(p),n.delete(f),s.set(p,f))}}}catch(e){c.e(e)}finally{c.f()}var h,A=ti(n);try{for(A.s();!(h=A.n()).done;){var v=h.value;s.set(v,null)}}catch(e){A.e(e)}finally{A.f()}var g,m=[],E=ti(s);try{for(E.s();!(g=E.n()).done;){var _=ei(g.value,2),y=_[0],I=_[1],S={ssrc:y};I&&(S.rtx={ssrc:I}),m.push(S)}}catch(e){E.e(e)}finally{E.f()}return m};var ii=function(e){var t=e.offerMediaObject,r=e.numStreams;if(r<=1)throw new TypeError("numStreams must be greater than 1");var n=(t.ssrcs||[]).find((function(e){return"msid"===e.attribute}));if(!n)throw new Error("a=ssrc line with msid information not found");var i,o=ei(n.value.split(" ")[0],2),a=o[0],s=o[1],c=n.id;(t.ssrcGroups||[]).some((function(e){if("FID"!==e.semantics)return!1;var t=e.ssrcs.split(/\s+/);return Number(t[0])===c&&(i=Number(t[1]),!0)}));var u=t.ssrcs.find((function(e){return"cname"===e.attribute}));if(!u)throw new Error("a=ssrc line with cname information not found");for(var d=u.value,l=[],p=[],f=0;f<r;++f)l.push(c+f),i&&p.push(i+f);t.ssrcGroups=[],t.ssrcs=[],t.ssrcGroups.push({semantics:"SIM",ssrcs:l.join(" ")});for(var h=0;h<l.length;++h){var A=l[h];t.ssrcs.push({id:A,attribute:"cname",value:d}),t.ssrcs.push({id:A,attribute:"msid",value:"".concat(a," ").concat(s)})}for(var v=0;v<p.length;++v){var g=l[v],m=p[v];t.ssrcs.push({id:m,attribute:"cname",value:d}),t.ssrcs.push({id:m,attribute:"msid",value:"".concat(a," ").concat(s)}),t.ssrcGroups.push({semantics:"FID",ssrcs:"".concat(g," ").concat(m)})}},oi=Object.defineProperty({getRtpEncodings:ni,addLegacySimulcast:ii},"__esModule",{value:!0});function ai(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var si=function(e){Ye(r,e);var t=ai(r);function r(){return Ge(this,r),t.call(this)}return r}(sr.EnhancedEventEmitter),ci=Object.defineProperty({HandlerInterface:si},"__esModule",{value:!0});function ui(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}function di(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return li(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return li(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function li(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var pi=function(){function e(t){var r=t.iceParameters,n=t.iceCandidates,i=t.dtlsParameters,o=t.planB,a=void 0!==o&&o;if(Ge(this,e),this._mediaObject={},this._planB=a,r&&this.setIceParameters(r),n){this._mediaObject.candidates=[];var s,c=di(n);try{for(c.s();!(s=c.n()).done;){var u=s.value,d={component:1};d.foundation=u.foundation,d.ip=u.ip,d.port=u.port,d.priority=u.priority,d.transport=u.protocol,d.type=u.type,u.tcpType&&(d.tcptype=u.tcpType),this._mediaObject.candidates.push(d)}}catch(e){c.e(e)}finally{c.f()}this._mediaObject.endOfCandidates="end-of-candidates",this._mediaObject.iceOptions="renomination"}i&&this.setDtlsRole(i.role)}return He(e,[{key:"getObject",value:function(){return this._mediaObject}},{key:"setIceParameters",value:function(e){this._mediaObject.iceUfrag=e.usernameFragment,this._mediaObject.icePwd=e.password}},{key:"disable",value:function(){this._mediaObject.direction="inactive",delete this._mediaObject.ext,delete this._mediaObject.ssrcs,delete this._mediaObject.ssrcGroups,delete this._mediaObject.simulcast,delete this._mediaObject.simulcast_03,delete this._mediaObject.rids}},{key:"close",value:function(){this._mediaObject.direction="inactive",this._mediaObject.port=0,delete this._mediaObject.ext,delete this._mediaObject.ssrcs,delete this._mediaObject.ssrcGroups,delete this._mediaObject.simulcast,delete this._mediaObject.simulcast_03,delete this._mediaObject.rids,delete this._mediaObject.extmapAllowMixed}},{key:"mid",get:function(){return String(this._mediaObject.mid)}},{key:"closed",get:function(){return 0===this._mediaObject.port}}]),e}(),fi=pi,hi=function(e){Ye(r,pi);var t=ui(r);function r(e){var n,i=e.iceParameters,o=e.iceCandidates,a=e.dtlsParameters,s=e.sctpParameters,c=e.plainRtpParameters,u=e.planB,d=void 0!==u&&u,l=e.offerMediaObject,p=e.offerRtpParameters,f=e.answerRtpParameters,h=e.codecOptions,A=e.extmapAllowMixed,v=void 0!==A&&A;switch(Ge(this,r),(n=t.call(this,{iceParameters:i,iceCandidates:o,dtlsParameters:a,planB:d}))._mediaObject.mid=String(l.mid),n._mediaObject.type=l.type,n._mediaObject.protocol=l.protocol,c?(n._mediaObject.connection={ip:c.ip,version:c.ipVersion},n._mediaObject.port=c.port):(n._mediaObject.connection={ip:"127.0.0.1",version:4},n._mediaObject.port=7),l.type){case"audio":case"video":n._mediaObject.direction="recvonly",n._mediaObject.rtp=[],n._mediaObject.rtcpFb=[],n._mediaObject.fmtp=[];var g,m=di(f.codecs);try{var E=function(){var e=g.value,t={payload:e.payloadType,codec:gi(e),rate:e.clockRate};e.channels>1&&(t.encoding=e.channels),n._mediaObject.rtp.push(t);var r=mr.clone(e.parameters,{});if(h){var i=h.opusStereo,o=h.opusFec,a=h.opusDtx,s=h.opusMaxPlaybackRate,c=h.opusPtime,u=h.videoGoogleStartBitrate,d=h.videoGoogleMaxBitrate,l=h.videoGoogleMinBitrate,f=p.codecs.find((function(t){return t.payloadType===e.payloadType}));switch(e.mimeType.toLowerCase()){case"audio/opus":void 0!==i&&(f.parameters["sprop-stereo"]=i?1:0,r.stereo=i?1:0),void 0!==o&&(f.parameters.useinbandfec=o?1:0,r.useinbandfec=o?1:0),void 0!==a&&(f.parameters.usedtx=a?1:0,r.usedtx=a?1:0),void 0!==s&&(r.maxplaybackrate=s),void 0!==c&&(f.parameters.ptime=c,r.ptime=c);break;case"video/vp8":case"video/vp9":case"video/h264":case"video/h265":void 0!==u&&(r["x-google-start-bitrate"]=u),void 0!==d&&(r["x-google-max-bitrate"]=d),void 0!==l&&(r["x-google-min-bitrate"]=l)}}for(var A={payload:e.payloadType,config:""},v=0,m=Object.keys(r);v<m.length;v++){var E=m[v];A.config&&(A.config+=";"),A.config+="".concat(E,"=").concat(r[E])}A.config&&n._mediaObject.fmtp.push(A);var _,y=di(e.rtcpFeedback);try{for(y.s();!(_=y.n()).done;){var I=_.value;n._mediaObject.rtcpFb.push({payload:e.payloadType,type:I.type,subtype:I.parameter})}}catch(e){y.e(e)}finally{y.f()}};for(m.s();!(g=m.n()).done;)E()}catch(e){m.e(e)}finally{m.f()}n._mediaObject.payloads=f.codecs.map((function(e){return e.payloadType})).join(" "),n._mediaObject.ext=[];var _,y=di(f.headerExtensions);try{var I=function(){var e=_.value;if(!(l.ext||[]).some((function(t){return t.uri===e.uri})))return"continue";n._mediaObject.ext.push({uri:e.uri,value:e.id})};for(y.s();!(_=y.n()).done;)I()}catch(e){y.e(e)}finally{y.f()}if(v&&"extmap-allow-mixed"===l.extmapAllowMixed&&(n._mediaObject.extmapAllowMixed="extmap-allow-mixed"),l.simulcast){n._mediaObject.simulcast={dir1:"recv",list1:l.simulcast.list1},n._mediaObject.rids=[];var S,b=di(l.rids||[]);try{for(b.s();!(S=b.n()).done;){var C=S.value;"send"===C.direction&&n._mediaObject.rids.push({id:C.id,direction:"recv"})}}catch(e){b.e(e)}finally{b.f()}}else if(l.simulcast_03){n._mediaObject.simulcast_03={value:l.simulcast_03.value.replace(/send/g,"recv")},n._mediaObject.rids=[];var w,R=di(l.rids||[]);try{for(R.s();!(w=R.n()).done;){var T=w.value;"send"===T.direction&&n._mediaObject.rids.push({id:T.id,direction:"recv"})}}catch(e){R.e(e)}finally{R.f()}}n._mediaObject.rtcpMux="rtcp-mux",n._mediaObject.rtcpRsize="rtcp-rsize",n._planB&&"video"===n._mediaObject.type&&(n._mediaObject.xGoogleFlag="conference");break;case"application":"number"==typeof l.sctpPort?(n._mediaObject.payloads="webrtc-datachannel",n._mediaObject.sctpPort=s.port,n._mediaObject.maxMessageSize=s.maxMessageSize):l.sctpmap&&(n._mediaObject.payloads=s.port,n._mediaObject.sctpmap={app:"webrtc-datachannel",sctpmapNumber:s.port,maxMessageSize:s.maxMessageSize})}return n}return He(r,[{key:"setDtlsRole",value:function(e){switch(e){case"client":this._mediaObject.setup="active";break;case"server":this._mediaObject.setup="passive";break;case"auto":this._mediaObject.setup="actpass"}}}]),r}(),Ai=function(e){Ye(r,pi);var t=ui(r);function r(e){var n,i=e.iceParameters,o=e.iceCandidates,a=e.dtlsParameters,s=e.sctpParameters,c=e.plainRtpParameters,u=e.planB,d=void 0!==u&&u,l=e.mid,p=e.kind,f=e.offerRtpParameters,h=e.streamId,A=e.trackId,v=e.oldDataChannelSpec,g=void 0!==v&&v;switch(Ge(this,r),(n=t.call(this,{iceParameters:i,iceCandidates:o,dtlsParameters:a,planB:d}))._mediaObject.mid=String(l),n._mediaObject.type=p,c?(n._mediaObject.connection={ip:c.ip,version:c.ipVersion},n._mediaObject.protocol="RTP/AVP",n._mediaObject.port=c.port):(n._mediaObject.connection={ip:"127.0.0.1",version:4},n._mediaObject.protocol=s?"UDP/DTLS/SCTP":"UDP/TLS/RTP/SAVPF",n._mediaObject.port=7),p){case"audio":case"video":n._mediaObject.direction="sendonly",n._mediaObject.rtp=[],n._mediaObject.rtcpFb=[],n._mediaObject.fmtp=[],n._planB||(n._mediaObject.msid="".concat(h||"-"," ").concat(A));var m,E=di(f.codecs);try{for(E.s();!(m=E.n()).done;){var _=m.value,y={payload:_.payloadType,codec:gi(_),rate:_.clockRate};_.channels>1&&(y.encoding=_.channels),n._mediaObject.rtp.push(y);for(var I={payload:_.payloadType,config:""},S=0,b=Object.keys(_.parameters);S<b.length;S++){var C=b[S];I.config&&(I.config+=";"),I.config+="".concat(C,"=").concat(_.parameters[C])}I.config&&n._mediaObject.fmtp.push(I);var w,R=di(_.rtcpFeedback);try{for(R.s();!(w=R.n()).done;){var T=w.value;n._mediaObject.rtcpFb.push({payload:_.payloadType,type:T.type,subtype:T.parameter})}}catch(e){R.e(e)}finally{R.f()}}}catch(e){E.e(e)}finally{E.f()}n._mediaObject.payloads=f.codecs.map((function(e){return e.payloadType})).join(" "),n._mediaObject.ext=[];var k,O=di(f.headerExtensions);try{for(O.s();!(k=O.n()).done;){var D=k.value;n._mediaObject.ext.push({uri:D.uri,value:D.id})}}catch(e){O.e(e)}finally{O.f()}n._mediaObject.rtcpMux="rtcp-mux",n._mediaObject.rtcpRsize="rtcp-rsize";var N=f.encodings[0],x=N.ssrc,P=N.rtx&&N.rtx.ssrc?N.rtx.ssrc:void 0;n._mediaObject.ssrcs=[],n._mediaObject.ssrcGroups=[],f.rtcp.cname&&n._mediaObject.ssrcs.push({id:x,attribute:"cname",value:f.rtcp.cname}),n._planB&&n._mediaObject.ssrcs.push({id:x,attribute:"msid",value:"".concat(h||"-"," ").concat(A)}),P&&(f.rtcp.cname&&n._mediaObject.ssrcs.push({id:P,attribute:"cname",value:f.rtcp.cname}),n._planB&&n._mediaObject.ssrcs.push({id:P,attribute:"msid",value:"".concat(h||"-"," ").concat(A)}),n._mediaObject.ssrcGroups.push({semantics:"FID",ssrcs:"".concat(x," ").concat(P)}));break;case"application":g?(n._mediaObject.payloads=s.port,n._mediaObject.sctpmap={app:"webrtc-datachannel",sctpmapNumber:s.port,maxMessageSize:s.maxMessageSize}):(n._mediaObject.payloads="webrtc-datachannel",n._mediaObject.sctpPort=s.port,n._mediaObject.maxMessageSize=s.maxMessageSize)}return n}return He(r,[{key:"setDtlsRole",value:function(e){this._mediaObject.setup="actpass"}},{key:"planBReceive",value:function(e){var t=e.offerRtpParameters,r=e.streamId,n=e.trackId,i=t.encodings[0],o=i.ssrc,a=i.rtx&&i.rtx.ssrc?i.rtx.ssrc:void 0;t.rtcp.cname&&this._mediaObject.ssrcs.push({id:o,attribute:"cname",value:t.rtcp.cname}),this._mediaObject.ssrcs.push({id:o,attribute:"msid",value:"".concat(r||"-"," ").concat(n)}),a&&(t.rtcp.cname&&this._mediaObject.ssrcs.push({id:a,attribute:"cname",value:t.rtcp.cname}),this._mediaObject.ssrcs.push({id:a,attribute:"msid",value:"".concat(r||"-"," ").concat(n)}),this._mediaObject.ssrcGroups.push({semantics:"FID",ssrcs:"".concat(o," ").concat(a)}))}},{key:"planBStopReceiving",value:function(e){var t=e.offerRtpParameters.encodings[0],r=t.ssrc,n=t.rtx&&t.rtx.ssrc?t.rtx.ssrc:void 0;this._mediaObject.ssrcs=this._mediaObject.ssrcs.filter((function(e){return e.id!==r&&e.id!==n})),n&&(this._mediaObject.ssrcGroups=this._mediaObject.ssrcGroups.filter((function(e){return e.ssrcs!=="".concat(r," ").concat(n)})))}}]),r}(),vi=Ai;function gi(e){var t=new RegExp("^(audio|video)/(.+)","i").exec(e.mimeType);if(!t)throw new TypeError("invalid codec.mimeType");return t[2]}var mi=Object.defineProperty({MediaSection:fi,AnswerMediaSection:hi,OfferMediaSection:vi},"__esModule",{value:!0});function Ei(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return _i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return _i(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function _i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var yi=new rr.Logger("RemoteSdp"),Ii=function(){function e(t){var r=t.iceParameters,n=t.iceCandidates,i=t.dtlsParameters,o=t.sctpParameters,a=t.plainRtpParameters,s=t.planB,c=void 0!==s&&s;if(Ge(this,e),this._mediaSections=[],this._midToIndex=new Map,this._iceParameters=r,this._iceCandidates=n,this._dtlsParameters=i,this._sctpParameters=o,this._plainRtpParameters=a,this._planB=c,this._sdpObject={version:0,origin:{address:"0.0.0.0",ipVer:4,netType:"IN",sessionId:1e4,sessionVersion:0,username:"mediasoup-client"},name:"-",timing:{start:0,stop:0},media:[]},r&&r.iceLite&&(this._sdpObject.icelite="ice-lite"),i){this._sdpObject.msidSemantic={semantic:"WMS",token:"*"};var u=this._dtlsParameters.fingerprints.length;this._sdpObject.fingerprint={type:i.fingerprints[u-1].algorithm,hash:i.fingerprints[u-1].value},this._sdpObject.groups=[{type:"BUNDLE",mids:""}]}a&&(this._sdpObject.origin.address=a.ip,this._sdpObject.origin.ipVer=a.ipVersion)}return He(e,[{key:"updateIceParameters",value:function(e){yi.debug("updateIceParameters() [iceParameters:%o]",e),this._iceParameters=e,this._sdpObject.icelite=e.iceLite?"ice-lite":void 0;var t,r=Ei(this._mediaSections);try{for(r.s();!(t=r.n()).done;){t.value.setIceParameters(e)}}catch(e){r.e(e)}finally{r.f()}}},{key:"updateDtlsRole",value:function(e){yi.debug("updateDtlsRole() [role:%s]",e),this._dtlsParameters.role=e;var t,r=Ei(this._mediaSections);try{for(r.s();!(t=r.n()).done;){t.value.setDtlsRole(e)}}catch(e){r.e(e)}finally{r.f()}}},{key:"getNextMediaSectionIdx",value:function(){for(var e=0;e<this._mediaSections.length;++e){var t=this._mediaSections[e];if(t.closed)return{idx:e,reuseMid:t.mid}}return{idx:this._mediaSections.length}}},{key:"send",value:function(e){var t=e.offerMediaObject,r=e.reuseMid,n=e.offerRtpParameters,i=e.answerRtpParameters,o=e.codecOptions,a=e.extmapAllowMixed,s=void 0!==a&&a,c=new mi.AnswerMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,plainRtpParameters:this._plainRtpParameters,planB:this._planB,offerMediaObject:t,offerRtpParameters:n,answerRtpParameters:i,codecOptions:o,extmapAllowMixed:s});r?this._replaceMediaSection(c,r):this._midToIndex.has(c.mid)?this._replaceMediaSection(c):this._addMediaSection(c)}},{key:"receive",value:function(e){var t,r=e.mid,n=e.kind,i=e.offerRtpParameters,o=e.streamId,a=e.trackId,s=this._midToIndex.get(r);if(void 0!==s&&(t=this._mediaSections[s]),t)t.planBReceive({offerRtpParameters:i,streamId:o,trackId:a}),this._replaceMediaSection(t);else{t=new mi.OfferMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,plainRtpParameters:this._plainRtpParameters,planB:this._planB,mid:r,kind:n,offerRtpParameters:i,streamId:o,trackId:a});var c=this._mediaSections.find((function(e){return e.closed}));c?this._replaceMediaSection(t,c.mid):this._addMediaSection(t)}}},{key:"disableMediaSection",value:function(e){var t=this._midToIndex.get(e);if(void 0===t)throw new Error("no media section found with mid '".concat(e,"'"));this._mediaSections[t].disable()}},{key:"closeMediaSection",value:function(e){var t=this._midToIndex.get(e);if(void 0===t)throw new Error("no media section found with mid '".concat(e,"'"));var r=this._mediaSections[t];if(e===this._firstMid)return yi.debug("closeMediaSection() | cannot close first media section, disabling it instead [mid:%s]",e),void this.disableMediaSection(e);r.close(),this._regenerateBundleMids()}},{key:"planBStopReceiving",value:function(e){var t=e.mid,r=e.offerRtpParameters,n=this._midToIndex.get(t);if(void 0===n)throw new Error("no media section found with mid '".concat(t,"'"));var i=this._mediaSections[n];i.planBStopReceiving({offerRtpParameters:r}),this._replaceMediaSection(i)}},{key:"sendSctpAssociation",value:function(e){var t=e.offerMediaObject,r=new mi.AnswerMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,sctpParameters:this._sctpParameters,plainRtpParameters:this._plainRtpParameters,offerMediaObject:t});this._addMediaSection(r)}},{key:"receiveSctpAssociation",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.oldDataChannelSpec,r=void 0!==t&&t,n=new mi.OfferMediaSection({iceParameters:this._iceParameters,iceCandidates:this._iceCandidates,dtlsParameters:this._dtlsParameters,sctpParameters:this._sctpParameters,plainRtpParameters:this._plainRtpParameters,mid:"datachannel",kind:"application",oldDataChannelSpec:r});this._addMediaSection(n)}},{key:"getSdp",value:function(){return this._sdpObject.origin.sessionVersion++,jn.write(this._sdpObject)}},{key:"_addMediaSection",value:function(e){this._firstMid||(this._firstMid=e.mid),this._mediaSections.push(e),this._midToIndex.set(e.mid,this._mediaSections.length-1),this._sdpObject.media.push(e.getObject()),this._regenerateBundleMids()}},{key:"_replaceMediaSection",value:function(e,t){if("string"==typeof t){var r=this._midToIndex.get(t);if(void 0===r)throw new Error("no media section found for reuseMid '".concat(t,"'"));var n=this._mediaSections[r];this._mediaSections[r]=e,this._midToIndex.delete(n.mid),this._midToIndex.set(e.mid,r),this._sdpObject.media[r]=e.getObject(),this._regenerateBundleMids()}else{var i=this._midToIndex.get(e.mid);if(void 0===i)throw new Error("no media section found with mid '".concat(e.mid,"'"));this._mediaSections[i]=e,this._sdpObject.media[i]=e.getObject()}}},{key:"_regenerateBundleMids",value:function(){this._dtlsParameters&&(this._sdpObject.groups[0].mids=this._mediaSections.filter((function(e){return!e.closed})).map((function(e){return e.mid})).join(" "))}}]),e}(),Si=Ii,bi=Object.defineProperty({RemoteSdp:Si},"__esModule",{value:!0}),Ci=new RegExp("^[LS]([1-9]\\d{0,1})T([1-9]\\d{0,1})");var wi=function(e){var t=Ci.exec(e||"");return t?{spatialLayers:Number(t[1]),temporalLayers:Number(t[2])}:{spatialLayers:1,temporalLayers:1}},Ri=Object.defineProperty({parse:wi},"__esModule",{value:!0});function Ti(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return ki(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ki(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function ki(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Oi(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var Di=new rr.Logger("Chrome74"),Ni={OS:1024,MIS:1024},xi=function(e){Ye(E,e);var t,r,n,i,o,a,s,c,u,d,l,p,f,h,A,v,g,m=Oi(E);function E(){var e;return Ge(this,E),(e=m.call(this))._mapMidTransceiver=new Map,e._sendStream=new MediaStream,e._hasDataChannelMediaSection=!1,e._nextSendSctpStreamId=0,e._transportReady=!1,e}return He(E,[{key:"close",value:function(){if(Di.debug("close()"),this._pc)try{this._pc.close()}catch(e){}}},{key:"getNativeRtpCapabilities",value:(g=Ve(Fe.mark((function e(){var t,r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Di.debug("getNativeRtpCapabilities()"),t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"}),e.prev=2,t.addTransceiver("audio"),t.addTransceiver("video"),e.next=7,t.createOffer();case 7:r=e.sent;try{t.close()}catch(e){}return n=jn.parse(r.sdp),i=qn.extractRtpCapabilities({sdpObject:n}),e.abrupt("return",i);case 14:e.prev=14,e.t0=e.catch(2);try{t.close()}catch(e){}throw e.t0;case 18:case"end":return e.stop()}}),e,null,[[2,14]])}))),function(){return g.apply(this,arguments)})},{key:"getNativeSctpCapabilities",value:(v=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Di.debug("getNativeSctpCapabilities()"),e.abrupt("return",{numStreams:Ni});case 2:case"end":return e.stop()}}),e)}))),function(){return v.apply(this,arguments)})},{key:"run",value:function(e){var t=this,r=e.direction,n=e.iceParameters,i=e.iceCandidates,o=e.dtlsParameters,a=e.sctpParameters,s=e.iceServers,c=e.iceTransportPolicy,u=e.additionalSettings,d=e.proprietaryConstraints,l=e.extendedRtpCapabilities;Di.debug("run()"),this._direction=r,this._remoteSdp=new bi.RemoteSdp({iceParameters:n,iceCandidates:i,dtlsParameters:o,sctpParameters:a}),this._sendingRtpParametersByKind={audio:nn.getSendingRtpParameters("audio",l),video:nn.getSendingRtpParameters("video",l)},this._sendingRemoteRtpParametersByKind={audio:nn.getSendingRemoteRtpParameters("audio",l),video:nn.getSendingRemoteRtpParameters("video",l)},this._pc=new RTCPeerConnection(Object.assign({iceServers:s||[],iceTransportPolicy:c||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"},u),d),this._pc.addEventListener("iceconnectionstatechange",(function(){switch(t._pc.iceConnectionState){case"checking":t.emit("@connectionstatechange","connecting");break;case"connected":case"completed":t.emit("@connectionstatechange","connected");break;case"failed":t.emit("@connectionstatechange","failed");break;case"disconnected":t.emit("@connectionstatechange","disconnected");break;case"closed":t.emit("@connectionstatechange","closed")}}))}},{key:"updateIceServers",value:(A=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Di.debug("updateIceServers()"),(r=this._pc.getConfiguration()).iceServers=t,this._pc.setConfiguration(r);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return A.apply(this,arguments)})},{key:"restartIce",value:(h=Ve(Fe.mark((function e(t){var r,n,i,o;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Di.debug("restartIce()"),this._remoteSdp.updateIceParameters(t),this._transportReady){e.next=4;break}return e.abrupt("return");case 4:if("send"!==this._direction){e.next=17;break}return e.next=7,this._pc.createOffer({iceRestart:!0});case 7:return r=e.sent,Di.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",r),e.next=11,this._pc.setLocalDescription(r);case 11:return n={type:"answer",sdp:this._remoteSdp.getSdp()},Di.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",n),e.next=15,this._pc.setRemoteDescription(n);case 15:e.next=27;break;case 17:return i={type:"offer",sdp:this._remoteSdp.getSdp()},Di.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",i),e.next=21,this._pc.setRemoteDescription(i);case 21:return e.next=23,this._pc.createAnswer();case 23:return o=e.sent,Di.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",o),e.next=27,this._pc.setLocalDescription(o);case 27:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"getTransportStats",value:(f=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._pc.getStats());case 1:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"send",value:(p=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f,h,A,v,g,m,E;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.track,n=t.encodings,i=t.codecOptions,o=t.codec,this._assertSendDirection(),Di.debug("send() [kind:%s, track.id:%s]",r.kind,r.id),n&&n.length>1&&n.forEach((function(e,t){e.rid="r".concat(t)})),(a=mr.clone(this._sendingRtpParametersByKind[r.kind],{})).codecs=nn.reduceCodecs(a.codecs,o),(s=mr.clone(this._sendingRemoteRtpParametersByKind[r.kind],{})).codecs=nn.reduceCodecs(s.codecs,o),c=this._remoteSdp.getNextMediaSectionIdx(),u=this._pc.addTransceiver(r,{direction:"sendonly",streams:[this._sendStream],sendEncodings:n}),e.next=12,this._pc.createOffer();case 12:if(d=e.sent,l=jn.parse(d.sdp),this._transportReady){e.next=17;break}return e.next=17,this._setupTransport({localDtlsRole:"server",localSdpObject:l});case 17:return f=!1,h=Ri.parse((n||[{}])[0].scalabilityMode),n&&1===n.length&&h.spatialLayers>1&&"video/vp9"===a.codecs[0].mimeType.toLowerCase()&&(Di.debug("send() | enabling legacy simulcast for VP9 SVC"),f=!0,l=jn.parse(d.sdp),p=l.media[c.idx],oi.addLegacySimulcast({offerMediaObject:p,numStreams:h.spatialLayers}),d={type:"offer",sdp:jn.write(l)}),Di.debug("send() | calling pc.setLocalDescription() [offer:%o]",d),e.next=23,this._pc.setLocalDescription(d);case 23:if(A=u.mid,a.mid=A,l=jn.parse(this._pc.localDescription.sdp),p=l.media[c.idx],a.rtcp.cname=qn.getCname({offerMediaObject:p}),n?1===n.length?(v=oi.getRtpEncodings({offerMediaObject:p}),Object.assign(v[0],n[0]),f&&(v=[v[0]]),a.encodings=v):a.encodings=n:a.encodings=oi.getRtpEncodings({offerMediaObject:p}),a.encodings.length>1&&("video/vp8"===a.codecs[0].mimeType.toLowerCase()||"video/h264"===a.codecs[0].mimeType.toLowerCase())){g=Ti(a.encodings);try{for(g.s();!(m=g.n()).done;)m.value.scalabilityMode="S1T3"}catch(e){g.e(e)}finally{g.f()}}return this._remoteSdp.send({offerMediaObject:p,reuseMid:c.reuseMid,offerRtpParameters:a,answerRtpParameters:s,codecOptions:i,extmapAllowMixed:!0}),E={type:"answer",sdp:this._remoteSdp.getSdp()},Di.debug("send() | calling pc.setRemoteDescription() [answer:%o]",E),e.next=35,this._pc.setRemoteDescription(E);case 35:return this._mapMidTransceiver.set(A,u),e.abrupt("return",{localId:A,rtpParameters:a,rtpSender:u.sender});case 37:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"stopSending",value:(l=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),Di.debug("stopSending() [localId:%s]",t),r=this._mapMidTransceiver.get(t)){e.next=5;break}throw new Error("associated RTCRtpTransceiver not found");case 5:return r.sender.replaceTrack(null),this._pc.removeTrack(r.sender),this._remoteSdp.closeMediaSection(r.mid),e.next=10,this._pc.createOffer();case 10:return n=e.sent,Di.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",n),e.next=14,this._pc.setLocalDescription(n);case 14:return i={type:"answer",sdp:this._remoteSdp.getSdp()},Di.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",i),e.next=18,this._pc.setRemoteDescription(i);case 18:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"replaceTrack",value:(d=Ve(Fe.mark((function e(t,r){var n;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),r?Di.debug("replaceTrack() [localId:%s, track.id:%s]",t,r.id):Di.debug("replaceTrack() [localId:%s, no track]",t),n=this._mapMidTransceiver.get(t)){e.next=5;break}throw new Error("associated RTCRtpTransceiver not found");case 5:return e.next=7,n.sender.replaceTrack(r);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"setMaxSpatialLayer",value:(u=Ve(Fe.mark((function e(t,r){var n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),Di.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",t,r),n=this._mapMidTransceiver.get(t)){e.next=5;break}throw new Error("associated RTCRtpTransceiver not found");case 5:return(i=n.sender.getParameters()).encodings.forEach((function(e,t){e.active=t<=r})),e.next=9,n.sender.setParameters(i);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"setRtpEncodingParameters",value:(c=Ve(Fe.mark((function e(t,r){var n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),Di.debug("setRtpEncodingParameters() [localId:%s, params:%o]",t,r),n=this._mapMidTransceiver.get(t)){e.next=5;break}throw new Error("associated RTCRtpTransceiver not found");case 5:return(i=n.sender.getParameters()).encodings.forEach((function(e,t){i.encodings[t]=Object.assign(Object.assign({},e),r)})),e.next=9,n.sender.setParameters(i);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"getSenderStats",value:(s=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),r=this._mapMidTransceiver.get(t)){e.next=4;break}throw new Error("associated RTCRtpTransceiver not found");case 4:return e.abrupt("return",r.sender.getStats());case 5:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"sendDataChannel",value:(a=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f,h;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.ordered,n=t.maxPacketLifeTime,i=t.maxRetransmits,o=t.label,a=t.protocol,s=t.priority,this._assertSendDirection(),c={negotiated:!0,id:this._nextSendSctpStreamId,ordered:r,maxPacketLifeTime:n,maxRetransmits:i,protocol:a,priority:s},Di.debug("sendDataChannel() [options:%o]",c),u=this._pc.createDataChannel(o,c),this._nextSendSctpStreamId=++this._nextSendSctpStreamId%Ni.MIS,this._hasDataChannelMediaSection){e.next=24;break}return e.next=9,this._pc.createOffer();case 9:if(d=e.sent,l=jn.parse(d.sdp),p=l.media.find((function(e){return"application"===e.type})),this._transportReady){e.next=15;break}return e.next=15,this._setupTransport({localDtlsRole:"server",localSdpObject:l});case 15:return Di.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",d),e.next=18,this._pc.setLocalDescription(d);case 18:return this._remoteSdp.sendSctpAssociation({offerMediaObject:p}),f={type:"answer",sdp:this._remoteSdp.getSdp()},Di.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",f),e.next=23,this._pc.setRemoteDescription(f);case 23:this._hasDataChannelMediaSection=!0;case 24:return h={streamId:c.id,ordered:c.ordered,maxPacketLifeTime:c.maxPacketLifeTime,maxRetransmits:c.maxRetransmits},e.abrupt("return",{dataChannel:u,sctpStreamParameters:h});case 26:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"receive",value:(o=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.trackId,n=t.kind,i=t.rtpParameters,this._assertRecvDirection(),Di.debug("receive() [trackId:%s, kind:%s]",r,n),o=i.mid||String(this._mapMidTransceiver.size),this._remoteSdp.receive({mid:o,kind:n,offerRtpParameters:i,streamId:i.rtcp.cname,trackId:r}),a={type:"offer",sdp:this._remoteSdp.getSdp()},Di.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",a),e.next=9,this._pc.setRemoteDescription(a);case 9:return e.next=11,this._pc.createAnswer();case 11:if(s=e.sent,c=jn.parse(s.sdp),u=c.media.find((function(e){return String(e.mid)===o})),qn.applyCodecParameters({offerRtpParameters:i,answerMediaObject:u}),s={type:"answer",sdp:jn.write(c)},this._transportReady){e.next=19;break}return e.next=19,this._setupTransport({localDtlsRole:"client",localSdpObject:c});case 19:return Di.debug("receive() | calling pc.setLocalDescription() [answer:%o]",s),e.next=22,this._pc.setLocalDescription(s);case 22:if(d=this._pc.getTransceivers().find((function(e){return e.mid===o}))){e.next=25;break}throw new Error("new RTCRtpTransceiver not found");case 25:return this._mapMidTransceiver.set(o,d),e.abrupt("return",{localId:o,track:d.receiver.track,rtpReceiver:d.receiver});case 27:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"stopReceiving",value:(i=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertRecvDirection(),Di.debug("stopReceiving() [localId:%s]",t),r=this._mapMidTransceiver.get(t)){e.next=5;break}throw new Error("associated RTCRtpTransceiver not found");case 5:return this._remoteSdp.closeMediaSection(r.mid),n={type:"offer",sdp:this._remoteSdp.getSdp()},Di.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",n),e.next=10,this._pc.setRemoteDescription(n);case 10:return e.next=12,this._pc.createAnswer();case 12:return i=e.sent,Di.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",i),e.next=16,this._pc.setLocalDescription(i);case 16:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getReceiverStats",value:(n=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertRecvDirection(),r=this._mapMidTransceiver.get(t)){e.next=4;break}throw new Error("associated RTCRtpTransceiver not found");case 4:return e.abrupt("return",r.receiver.getStats());case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"receiveDataChannel",value:(r=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.sctpStreamParameters,n=t.label,i=t.protocol,this._assertRecvDirection(),o=r.streamId,a=r.ordered,s=r.maxPacketLifeTime,c=r.maxRetransmits,u={negotiated:!0,id:o,ordered:a,maxPacketLifeTime:s,maxRetransmits:c,protocol:i},Di.debug("receiveDataChannel() [options:%o]",u),d=this._pc.createDataChannel(n,u),this._hasDataChannelMediaSection){e.next=23;break}return this._remoteSdp.receiveSctpAssociation(),l={type:"offer",sdp:this._remoteSdp.getSdp()},Di.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",l),e.next=12,this._pc.setRemoteDescription(l);case 12:return e.next=14,this._pc.createAnswer();case 14:if(p=e.sent,this._transportReady){e.next=19;break}return f=jn.parse(p.sdp),e.next=19,this._setupTransport({localDtlsRole:"client",localSdpObject:f});case 19:return Di.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",p),e.next=22,this._pc.setLocalDescription(p);case 22:this._hasDataChannelMediaSection=!0;case 23:return e.abrupt("return",{dataChannel:d});case 24:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_setupTransport",value:(t=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.localDtlsRole,(n=t.localSdpObject)||(n=jn.parse(this._pc.localDescription.sdp)),(i=qn.extractDtlsParameters({sdpObject:n})).role=r,this._remoteSdp.updateDtlsRole("client"===r?"server":"client"),e.next=7,this.safeEmitAsPromise("@connect",{dtlsParameters:i});case 7:this._transportReady=!0;case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_assertSendDirection",value:function(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}},{key:"_assertRecvDirection",value:function(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}},{key:"name",get:function(){return"Chrome74"}}],[{key:"createFactory",value:function(){return function(){return new E}}}]),E}(ci.HandlerInterface),Pi=xi,Li=Object.defineProperty({Chrome74:Pi},"__esModule",{value:!0});function Bi(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return Mi(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Mi(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Mi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Ui(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var Qi=new rr.Logger("Chrome70"),Fi={OS:1024,MIS:1024},ji=function(e){Ye(E,e);var t,r,n,i,o,a,s,c,u,d,l,p,f,h,A,v,g,m=Ui(E);function E(){var e;return Ge(this,E),(e=m.call(this))._mapMidTransceiver=new Map,e._sendStream=new MediaStream,e._hasDataChannelMediaSection=!1,e._nextSendSctpStreamId=0,e._transportReady=!1,e}return He(E,[{key:"close",value:function(){if(Qi.debug("close()"),this._pc)try{this._pc.close()}catch(e){}}},{key:"getNativeRtpCapabilities",value:(g=Ve(Fe.mark((function e(){var t,r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Qi.debug("getNativeRtpCapabilities()"),t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"}),e.prev=2,t.addTransceiver("audio"),t.addTransceiver("video"),e.next=7,t.createOffer();case 7:r=e.sent;try{t.close()}catch(e){}return n=jn.parse(r.sdp),i=qn.extractRtpCapabilities({sdpObject:n}),e.abrupt("return",i);case 14:e.prev=14,e.t0=e.catch(2);try{t.close()}catch(e){}throw e.t0;case 18:case"end":return e.stop()}}),e,null,[[2,14]])}))),function(){return g.apply(this,arguments)})},{key:"getNativeSctpCapabilities",value:(v=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Qi.debug("getNativeSctpCapabilities()"),e.abrupt("return",{numStreams:Fi});case 2:case"end":return e.stop()}}),e)}))),function(){return v.apply(this,arguments)})},{key:"run",value:function(e){var t=this,r=e.direction,n=e.iceParameters,i=e.iceCandidates,o=e.dtlsParameters,a=e.sctpParameters,s=e.iceServers,c=e.iceTransportPolicy,u=e.additionalSettings,d=e.proprietaryConstraints,l=e.extendedRtpCapabilities;Qi.debug("run()"),this._direction=r,this._remoteSdp=new bi.RemoteSdp({iceParameters:n,iceCandidates:i,dtlsParameters:o,sctpParameters:a}),this._sendingRtpParametersByKind={audio:nn.getSendingRtpParameters("audio",l),video:nn.getSendingRtpParameters("video",l)},this._sendingRemoteRtpParametersByKind={audio:nn.getSendingRemoteRtpParameters("audio",l),video:nn.getSendingRemoteRtpParameters("video",l)},this._pc=new RTCPeerConnection(Object.assign({iceServers:s||[],iceTransportPolicy:c||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"},u),d),this._pc.addEventListener("iceconnectionstatechange",(function(){switch(t._pc.iceConnectionState){case"checking":t.emit("@connectionstatechange","connecting");break;case"connected":case"completed":t.emit("@connectionstatechange","connected");break;case"failed":t.emit("@connectionstatechange","failed");break;case"disconnected":t.emit("@connectionstatechange","disconnected");break;case"closed":t.emit("@connectionstatechange","closed")}}))}},{key:"updateIceServers",value:(A=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Qi.debug("updateIceServers()"),(r=this._pc.getConfiguration()).iceServers=t,this._pc.setConfiguration(r);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return A.apply(this,arguments)})},{key:"restartIce",value:(h=Ve(Fe.mark((function e(t){var r,n,i,o;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Qi.debug("restartIce()"),this._remoteSdp.updateIceParameters(t),this._transportReady){e.next=4;break}return e.abrupt("return");case 4:if("send"!==this._direction){e.next=17;break}return e.next=7,this._pc.createOffer({iceRestart:!0});case 7:return r=e.sent,Qi.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",r),e.next=11,this._pc.setLocalDescription(r);case 11:return n={type:"answer",sdp:this._remoteSdp.getSdp()},Qi.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",n),e.next=15,this._pc.setRemoteDescription(n);case 15:e.next=27;break;case 17:return i={type:"offer",sdp:this._remoteSdp.getSdp()},Qi.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",i),e.next=21,this._pc.setRemoteDescription(i);case 21:return e.next=23,this._pc.createAnswer();case 23:return o=e.sent,Qi.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",o),e.next=27,this._pc.setLocalDescription(o);case 27:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"getTransportStats",value:(f=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._pc.getStats());case 1:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"send",value:(p=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f,h,A,v,g,m,E,_,y,I,S;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.track,n=t.encodings,i=t.codecOptions,o=t.codec,this._assertSendDirection(),Qi.debug("send() [kind:%s, track.id:%s]",r.kind,r.id),(a=mr.clone(this._sendingRtpParametersByKind[r.kind],{})).codecs=nn.reduceCodecs(a.codecs,o),(s=mr.clone(this._sendingRemoteRtpParametersByKind[r.kind],{})).codecs=nn.reduceCodecs(s.codecs,o),c=this._remoteSdp.getNextMediaSectionIdx(),u=this._pc.addTransceiver(r,{direction:"sendonly",streams:[this._sendStream]}),e.next=11,this._pc.createOffer();case 11:if(d=e.sent,l=jn.parse(d.sdp),this._transportReady){e.next=16;break}return e.next=16,this._setupTransport({localDtlsRole:"server",localSdpObject:l});case 16:return n&&n.length>1&&(Qi.debug("send() | enabling legacy simulcast"),l=jn.parse(d.sdp),p=l.media[c.idx],oi.addLegacySimulcast({offerMediaObject:p,numStreams:n.length}),d={type:"offer",sdp:jn.write(l)}),f=!1,h=Ri.parse((n||[{}])[0].scalabilityMode),n&&1===n.length&&h.spatialLayers>1&&"video/vp9"===a.codecs[0].mimeType.toLowerCase()&&(Qi.debug("send() | enabling legacy simulcast for VP9 SVC"),f=!0,l=jn.parse(d.sdp),p=l.media[c.idx],oi.addLegacySimulcast({offerMediaObject:p,numStreams:h.spatialLayers}),d={type:"offer",sdp:jn.write(l)}),Qi.debug("send() | calling pc.setLocalDescription() [offer:%o]",d),e.next=23,this._pc.setLocalDescription(d);case 23:if(!n){e.next=38;break}Qi.debug("send() | applying given encodings"),A=u.sender.getParameters(),v=0;case 27:if(!(v<(A.encodings||[]).length)){e.next=36;break}if(g=A.encodings[v],m=n[v]){e.next=32;break}return e.abrupt("break",36);case 32:A.encodings[v]=Object.assign(g,m);case 33:++v,e.next=27;break;case 36:return e.next=38,u.sender.setParameters(A);case 38:if(E=u.mid,a.mid=E,l=jn.parse(this._pc.localDescription.sdp),p=l.media[c.idx],a.rtcp.cname=qn.getCname({offerMediaObject:p}),a.encodings=oi.getRtpEncodings({offerMediaObject:p}),n)for(_=0;_<a.encodings.length;++_)n[_]&&Object.assign(a.encodings[_],n[_]);if(f&&(a.encodings=[a.encodings[0]]),a.encodings.length>1&&("video/vp8"===a.codecs[0].mimeType.toLowerCase()||"video/h264"===a.codecs[0].mimeType.toLowerCase())){y=Bi(a.encodings);try{for(y.s();!(I=y.n()).done;)I.value.scalabilityMode="S1T3"}catch(e){y.e(e)}finally{y.f()}}return this._remoteSdp.send({offerMediaObject:p,reuseMid:c.reuseMid,offerRtpParameters:a,answerRtpParameters:s,codecOptions:i}),S={type:"answer",sdp:this._remoteSdp.getSdp()},Qi.debug("send() | calling pc.setRemoteDescription() [answer:%o]",S),e.next=52,this._pc.setRemoteDescription(S);case 52:return this._mapMidTransceiver.set(E,u),e.abrupt("return",{localId:E,rtpParameters:a,rtpSender:u.sender});case 54:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"stopSending",value:(l=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),Qi.debug("stopSending() [localId:%s]",t),r=this._mapMidTransceiver.get(t)){e.next=5;break}throw new Error("associated RTCRtpTransceiver not found");case 5:return r.sender.replaceTrack(null),this._pc.removeTrack(r.sender),this._remoteSdp.closeMediaSection(r.mid),e.next=10,this._pc.createOffer();case 10:return n=e.sent,Qi.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",n),e.next=14,this._pc.setLocalDescription(n);case 14:return i={type:"answer",sdp:this._remoteSdp.getSdp()},Qi.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",i),e.next=18,this._pc.setRemoteDescription(i);case 18:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"replaceTrack",value:(d=Ve(Fe.mark((function e(t,r){var n;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),r?Qi.debug("replaceTrack() [localId:%s, track.id:%s]",t,r.id):Qi.debug("replaceTrack() [localId:%s, no track]",t),n=this._mapMidTransceiver.get(t)){e.next=5;break}throw new Error("associated RTCRtpTransceiver not found");case 5:return e.next=7,n.sender.replaceTrack(r);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"setMaxSpatialLayer",value:(u=Ve(Fe.mark((function e(t,r){var n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),Qi.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",t,r),n=this._mapMidTransceiver.get(t)){e.next=5;break}throw new Error("associated RTCRtpTransceiver not found");case 5:return(i=n.sender.getParameters()).encodings.forEach((function(e,t){e.active=t<=r})),e.next=9,n.sender.setParameters(i);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"setRtpEncodingParameters",value:(c=Ve(Fe.mark((function e(t,r){var n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),Qi.debug("setRtpEncodingParameters() [localId:%s, params:%o]",t,r),n=this._mapMidTransceiver.get(t)){e.next=5;break}throw new Error("associated RTCRtpTransceiver not found");case 5:return(i=n.sender.getParameters()).encodings.forEach((function(e,t){i.encodings[t]=Object.assign(Object.assign({},e),r)})),e.next=9,n.sender.setParameters(i);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"getSenderStats",value:(s=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),r=this._mapMidTransceiver.get(t)){e.next=4;break}throw new Error("associated RTCRtpTransceiver not found");case 4:return e.abrupt("return",r.sender.getStats());case 5:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"sendDataChannel",value:(a=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f,h;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.ordered,n=t.maxPacketLifeTime,i=t.maxRetransmits,o=t.label,a=t.protocol,s=t.priority,this._assertSendDirection(),c={negotiated:!0,id:this._nextSendSctpStreamId,ordered:r,maxPacketLifeTime:n,maxRetransmitTime:n,maxRetransmits:i,protocol:a,priority:s},Qi.debug("sendDataChannel() [options:%o]",c),u=this._pc.createDataChannel(o,c),this._nextSendSctpStreamId=++this._nextSendSctpStreamId%Fi.MIS,this._hasDataChannelMediaSection){e.next=24;break}return e.next=9,this._pc.createOffer();case 9:if(d=e.sent,l=jn.parse(d.sdp),p=l.media.find((function(e){return"application"===e.type})),this._transportReady){e.next=15;break}return e.next=15,this._setupTransport({localDtlsRole:"server",localSdpObject:l});case 15:return Qi.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",d),e.next=18,this._pc.setLocalDescription(d);case 18:return this._remoteSdp.sendSctpAssociation({offerMediaObject:p}),f={type:"answer",sdp:this._remoteSdp.getSdp()},Qi.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",f),e.next=23,this._pc.setRemoteDescription(f);case 23:this._hasDataChannelMediaSection=!0;case 24:return h={streamId:c.id,ordered:c.ordered,maxPacketLifeTime:c.maxPacketLifeTime,maxRetransmits:c.maxRetransmits},e.abrupt("return",{dataChannel:u,sctpStreamParameters:h});case 26:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"receive",value:(o=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.trackId,n=t.kind,i=t.rtpParameters,this._assertRecvDirection(),Qi.debug("receive() [trackId:%s, kind:%s]",r,n),o=i.mid||String(this._mapMidTransceiver.size),this._remoteSdp.receive({mid:o,kind:n,offerRtpParameters:i,streamId:i.rtcp.cname,trackId:r}),a={type:"offer",sdp:this._remoteSdp.getSdp()},Qi.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",a),e.next=9,this._pc.setRemoteDescription(a);case 9:return e.next=11,this._pc.createAnswer();case 11:if(s=e.sent,c=jn.parse(s.sdp),u=c.media.find((function(e){return String(e.mid)===o})),qn.applyCodecParameters({offerRtpParameters:i,answerMediaObject:u}),s={type:"answer",sdp:jn.write(c)},this._transportReady){e.next=19;break}return e.next=19,this._setupTransport({localDtlsRole:"client",localSdpObject:c});case 19:return Qi.debug("receive() | calling pc.setLocalDescription() [answer:%o]",s),e.next=22,this._pc.setLocalDescription(s);case 22:if(d=this._pc.getTransceivers().find((function(e){return e.mid===o}))){e.next=25;break}throw new Error("new RTCRtpTransceiver not found");case 25:return this._mapMidTransceiver.set(o,d),e.abrupt("return",{localId:o,track:d.receiver.track,rtpReceiver:d.receiver});case 27:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"stopReceiving",value:(i=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertRecvDirection(),Qi.debug("stopReceiving() [localId:%s]",t),r=this._mapMidTransceiver.get(t)){e.next=5;break}throw new Error("associated RTCRtpTransceiver not found");case 5:return this._remoteSdp.closeMediaSection(r.mid),n={type:"offer",sdp:this._remoteSdp.getSdp()},Qi.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",n),e.next=10,this._pc.setRemoteDescription(n);case 10:return e.next=12,this._pc.createAnswer();case 12:return i=e.sent,Qi.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",i),e.next=16,this._pc.setLocalDescription(i);case 16:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getReceiverStats",value:(n=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertRecvDirection(),r=this._mapMidTransceiver.get(t)){e.next=4;break}throw new Error("associated RTCRtpTransceiver not found");case 4:return e.abrupt("return",r.receiver.getStats());case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"receiveDataChannel",value:(r=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.sctpStreamParameters,n=t.label,i=t.protocol,this._assertRecvDirection(),o=r.streamId,a=r.ordered,s=r.maxPacketLifeTime,c=r.maxRetransmits,u={negotiated:!0,id:o,ordered:a,maxPacketLifeTime:s,maxRetransmitTime:s,maxRetransmits:c,protocol:i},Qi.debug("receiveDataChannel() [options:%o]",u),d=this._pc.createDataChannel(n,u),this._hasDataChannelMediaSection){e.next=23;break}return this._remoteSdp.receiveSctpAssociation(),l={type:"offer",sdp:this._remoteSdp.getSdp()},Qi.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",l),e.next=12,this._pc.setRemoteDescription(l);case 12:return e.next=14,this._pc.createAnswer();case 14:if(p=e.sent,this._transportReady){e.next=19;break}return f=jn.parse(p.sdp),e.next=19,this._setupTransport({localDtlsRole:"client",localSdpObject:f});case 19:return Qi.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",p),e.next=22,this._pc.setLocalDescription(p);case 22:this._hasDataChannelMediaSection=!0;case 23:return e.abrupt("return",{dataChannel:d});case 24:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_setupTransport",value:(t=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.localDtlsRole,(n=t.localSdpObject)||(n=jn.parse(this._pc.localDescription.sdp)),(i=qn.extractDtlsParameters({sdpObject:n})).role=r,this._remoteSdp.updateDtlsRole("client"===r?"server":"client"),e.next=7,this.safeEmitAsPromise("@connect",{dtlsParameters:i});case 7:this._transportReady=!0;case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_assertSendDirection",value:function(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}},{key:"_assertRecvDirection",value:function(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}},{key:"name",get:function(){return"Chrome70"}}],[{key:"createFactory",value:function(){return function(){return new E}}}]),E}(ci.HandlerInterface),Vi=ji,Gi=Object.defineProperty({Chrome70:Vi},"__esModule",{value:!0});function Ki(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return Hi(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Hi(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Hi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Wi=function(e){var t,r,n=e.offerMediaObject,i=e.track,o=new Set,a=Ki(n.ssrcs||[]);try{for(a.s();!(r=a.n()).done;){var s=r.value;if("msid"===s.attribute)if(s.value.split(" ")[1]===i.id){var c=s.id;o.add(c),t||(t=c)}}}catch(e){a.e(e)}finally{a.f()}if(0===o.size)throw new Error("a=ssrc line with msid information not found [track.id:".concat(i.id,"]"));var u,d=new Map,l=Ki(n.ssrcGroups||[]);try{for(l.s();!(u=l.n()).done;){var p=u.value;if("FID"===p.semantics){var f=p.ssrcs.split(/\s+/),h=ei(f,2),A=h[0],v=h[1];A=Number(A),v=Number(v),o.has(A)&&(o.delete(A),o.delete(v),d.set(A,v))}}}catch(e){l.e(e)}finally{l.f()}var g,m=Ki(o);try{for(m.s();!(g=m.n()).done;){var E=g.value;d.set(E,null)}}catch(e){m.e(e)}finally{m.f()}var _,y=[],I=Ki(d);try{for(I.s();!(_=I.n()).done;){var S=ei(_.value,2),b=S[0],C=S[1],w={ssrc:b};C&&(w.rtx={ssrc:C}),y.push(w)}}catch(e){I.e(e)}finally{I.f()}return y};var Yi=function(e){var t,r,n,i=e.offerMediaObject,o=e.track,a=e.numStreams;if(a<=1)throw new TypeError("numStreams must be greater than 1");if(!(i.ssrcs||[]).find((function(e){return"msid"===e.attribute&&(e.value.split(" ")[1]===o.id&&(t=e.id,n=e.value.split(" ")[0],!0))})))throw new Error("a=ssrc line with msid information not found [track.id:".concat(o.id,"]"));(i.ssrcGroups||[]).some((function(e){if("FID"!==e.semantics)return!1;var n=e.ssrcs.split(/\s+/);return Number(n[0])===t&&(r=Number(n[1]),!0)}));var s=i.ssrcs.find((function(e){return"cname"===e.attribute&&e.id===t}));if(!s)throw new Error("a=ssrc line with cname information not found [track.id:".concat(o.id,"]"));for(var c=s.value,u=[],d=[],l=0;l<a;++l)u.push(t+l),r&&d.push(r+l);i.ssrcGroups=i.ssrcGroups||[],i.ssrcs=i.ssrcs||[],i.ssrcGroups.push({semantics:"SIM",ssrcs:u.join(" ")});for(var p=0;p<u.length;++p){var f=u[p];i.ssrcs.push({id:f,attribute:"cname",value:c}),i.ssrcs.push({id:f,attribute:"msid",value:"".concat(n," ").concat(o.id)})}for(var h=0;h<d.length;++h){var A=u[h],v=d[h];i.ssrcs.push({id:v,attribute:"cname",value:c}),i.ssrcs.push({id:v,attribute:"msid",value:"".concat(n," ").concat(o.id)}),i.ssrcGroups.push({semantics:"FID",ssrcs:"".concat(A," ").concat(v)})}},qi=Object.defineProperty({getRtpEncodings:Wi,addLegacySimulcast:Yi},"__esModule",{value:!0});function Ji(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return zi(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return zi(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function zi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Xi(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var Zi=new rr.Logger("Chrome67"),$i={OS:1024,MIS:1024},eo=function(e){Ye(E,e);var t,r,n,i,o,a,s,c,u,d,l,p,f,h,A,v,g,m=Xi(E);function E(){var e;return Ge(this,E),(e=m.call(this))._sendStream=new MediaStream,e._mapSendLocalIdRtpSender=new Map,e._nextSendLocalId=0,e._mapRecvLocalIdInfo=new Map,e._hasDataChannelMediaSection=!1,e._nextSendSctpStreamId=0,e._transportReady=!1,e}return He(E,[{key:"close",value:function(){if(Zi.debug("close()"),this._pc)try{this._pc.close()}catch(e){}}},{key:"getNativeRtpCapabilities",value:(g=Ve(Fe.mark((function e(){var t,r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zi.debug("getNativeRtpCapabilities()"),t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b"}),e.prev=2,e.next=5,t.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});case 5:r=e.sent;try{t.close()}catch(e){}return n=jn.parse(r.sdp),i=qn.extractRtpCapabilities({sdpObject:n}),e.abrupt("return",i);case 12:e.prev=12,e.t0=e.catch(2);try{t.close()}catch(e){}throw e.t0;case 16:case"end":return e.stop()}}),e,null,[[2,12]])}))),function(){return g.apply(this,arguments)})},{key:"getNativeSctpCapabilities",value:(v=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Zi.debug("getNativeSctpCapabilities()"),e.abrupt("return",{numStreams:$i});case 2:case"end":return e.stop()}}),e)}))),function(){return v.apply(this,arguments)})},{key:"run",value:function(e){var t=this,r=e.direction,n=e.iceParameters,i=e.iceCandidates,o=e.dtlsParameters,a=e.sctpParameters,s=e.iceServers,c=e.iceTransportPolicy,u=e.additionalSettings,d=e.proprietaryConstraints,l=e.extendedRtpCapabilities;Zi.debug("run()"),this._direction=r,this._remoteSdp=new bi.RemoteSdp({iceParameters:n,iceCandidates:i,dtlsParameters:o,sctpParameters:a,planB:!0}),this._sendingRtpParametersByKind={audio:nn.getSendingRtpParameters("audio",l),video:nn.getSendingRtpParameters("video",l)},this._sendingRemoteRtpParametersByKind={audio:nn.getSendingRemoteRtpParameters("audio",l),video:nn.getSendingRemoteRtpParameters("video",l)},this._pc=new RTCPeerConnection(Object.assign({iceServers:s||[],iceTransportPolicy:c||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b"},u),d),this._pc.addEventListener("iceconnectionstatechange",(function(){switch(t._pc.iceConnectionState){case"checking":t.emit("@connectionstatechange","connecting");break;case"connected":case"completed":t.emit("@connectionstatechange","connected");break;case"failed":t.emit("@connectionstatechange","failed");break;case"disconnected":t.emit("@connectionstatechange","disconnected");break;case"closed":t.emit("@connectionstatechange","closed")}}))}},{key:"updateIceServers",value:(A=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Zi.debug("updateIceServers()"),(r=this._pc.getConfiguration()).iceServers=t,this._pc.setConfiguration(r);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return A.apply(this,arguments)})},{key:"restartIce",value:(h=Ve(Fe.mark((function e(t){var r,n,i,o;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Zi.debug("restartIce()"),this._remoteSdp.updateIceParameters(t),this._transportReady){e.next=4;break}return e.abrupt("return");case 4:if("send"!==this._direction){e.next=17;break}return e.next=7,this._pc.createOffer({iceRestart:!0});case 7:return r=e.sent,Zi.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",r),e.next=11,this._pc.setLocalDescription(r);case 11:return n={type:"answer",sdp:this._remoteSdp.getSdp()},Zi.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",n),e.next=15,this._pc.setRemoteDescription(n);case 15:e.next=27;break;case 17:return i={type:"offer",sdp:this._remoteSdp.getSdp()},Zi.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",i),e.next=21,this._pc.setRemoteDescription(i);case 21:return e.next=23,this._pc.createAnswer();case 23:return o=e.sent,Zi.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",o),e.next=27,this._pc.setLocalDescription(o);case 27:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"getTransportStats",value:(f=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._pc.getStats());case 1:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"send",value:(p=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f,h,A,v;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.track,n=t.encodings,i=t.codecOptions,o=t.codec,this._assertSendDirection(),Zi.debug("send() [kind:%s, track.id:%s]",r.kind,r.id),o&&Zi.warn("send() | codec selection is not available in %s handler",this.name),this._sendStream.addTrack(r),this._pc.addTrack(r,this._sendStream),e.next=8,this._pc.createOffer();case 8:if(a=e.sent,s=jn.parse(a.sdp),(u=mr.clone(this._sendingRtpParametersByKind[r.kind],{})).codecs=nn.reduceCodecs(u.codecs),(d=mr.clone(this._sendingRemoteRtpParametersByKind[r.kind],{})).codecs=nn.reduceCodecs(d.codecs),this._transportReady){e.next=17;break}return e.next=17,this._setupTransport({localDtlsRole:"server",localSdpObject:s});case 17:return"video"===r.kind&&n&&n.length>1&&(Zi.debug("send() | enabling simulcast"),s=jn.parse(a.sdp),c=s.media.find((function(e){return"video"===e.type})),qi.addLegacySimulcast({offerMediaObject:c,track:r,numStreams:n.length}),a={type:"offer",sdp:jn.write(s)}),Zi.debug("send() | calling pc.setLocalDescription() [offer:%o]",a),e.next=21,this._pc.setLocalDescription(a);case 21:if(s=jn.parse(this._pc.localDescription.sdp),c=s.media.find((function(e){return e.type===r.kind})),u.rtcp.cname=qn.getCname({offerMediaObject:c}),u.encodings=qi.getRtpEncodings({offerMediaObject:c,track:r}),n)for(l=0;l<u.encodings.length;++l)n[l]&&Object.assign(u.encodings[l],n[l]);if(u.encodings.length>1&&"video/vp8"===u.codecs[0].mimeType.toLowerCase()){p=Ji(u.encodings);try{for(p.s();!(f=p.n()).done;)f.value.scalabilityMode="S1T3"}catch(e){p.e(e)}finally{p.f()}}return this._remoteSdp.send({offerMediaObject:c,offerRtpParameters:u,answerRtpParameters:d,codecOptions:i}),h={type:"answer",sdp:this._remoteSdp.getSdp()},Zi.debug("send() | calling pc.setRemoteDescription() [answer:%o]",h),e.next=32,this._pc.setRemoteDescription(h);case 32:return A=String(this._nextSendLocalId),this._nextSendLocalId++,v=this._pc.getSenders().find((function(e){return e.track===r})),this._mapSendLocalIdRtpSender.set(A,v),e.abrupt("return",{localId:A,rtpParameters:u,rtpSender:v});case 37:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"stopSending",value:(l=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),Zi.debug("stopSending() [localId:%s]",t),r=this._mapSendLocalIdRtpSender.get(t)){e.next=5;break}throw new Error("associated RTCRtpSender not found");case 5:return this._pc.removeTrack(r),r.track&&this._sendStream.removeTrack(r.track),this._mapSendLocalIdRtpSender.delete(t),e.next=10,this._pc.createOffer();case 10:return n=e.sent,Zi.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",n),e.prev=12,e.next=15,this._pc.setLocalDescription(n);case 15:e.next=23;break;case 17:if(e.prev=17,e.t0=e.catch(12),0!==this._sendStream.getTracks().length){e.next=22;break}return Zi.warn("stopSending() | ignoring expected error due no sending tracks: %s",e.t0.toString()),e.abrupt("return");case 22:throw e.t0;case 23:if("stable"!==this._pc.signalingState){e.next=25;break}return e.abrupt("return");case 25:return i={type:"answer",sdp:this._remoteSdp.getSdp()},Zi.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",i),e.next=29,this._pc.setRemoteDescription(i);case 29:case"end":return e.stop()}}),e,this,[[12,17]])}))),function(e){return l.apply(this,arguments)})},{key:"replaceTrack",value:(d=Ve(Fe.mark((function e(t,r){var n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),r?Zi.debug("replaceTrack() [localId:%s, track.id:%s]",t,r.id):Zi.debug("replaceTrack() [localId:%s, no track]",t),n=this._mapSendLocalIdRtpSender.get(t)){e.next=5;break}throw new Error("associated RTCRtpSender not found");case 5:return i=n.track,e.next=8,n.replaceTrack(r);case 8:i&&this._sendStream.removeTrack(i),r&&this._sendStream.addTrack(r);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"setMaxSpatialLayer",value:(u=Ve(Fe.mark((function e(t,r){var n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),Zi.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",t,r),n=this._mapSendLocalIdRtpSender.get(t)){e.next=5;break}throw new Error("associated RTCRtpSender not found");case 5:return(i=n.getParameters()).encodings.forEach((function(e,t){e.active=t<=r})),e.next=9,n.setParameters(i);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"setRtpEncodingParameters",value:(c=Ve(Fe.mark((function e(t,r){var n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),Zi.debug("setRtpEncodingParameters() [localId:%s, params:%o]",t,r),n=this._mapSendLocalIdRtpSender.get(t)){e.next=5;break}throw new Error("associated RTCRtpSender not found");case 5:return(i=n.getParameters()).encodings.forEach((function(e,t){i.encodings[t]=Object.assign(Object.assign({},e),r)})),e.next=9,n.setParameters(i);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"getSenderStats",value:(s=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),r=this._mapSendLocalIdRtpSender.get(t)){e.next=4;break}throw new Error("associated RTCRtpSender not found");case 4:return e.abrupt("return",r.getStats());case 5:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"sendDataChannel",value:(a=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f,h;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.ordered,n=t.maxPacketLifeTime,i=t.maxRetransmits,o=t.label,a=t.protocol,s=t.priority,this._assertSendDirection(),c={negotiated:!0,id:this._nextSendSctpStreamId,ordered:r,maxPacketLifeTime:n,maxRetransmitTime:n,maxRetransmits:i,protocol:a,priority:s},Zi.debug("sendDataChannel() [options:%o]",c),u=this._pc.createDataChannel(o,c),this._nextSendSctpStreamId=++this._nextSendSctpStreamId%$i.MIS,this._hasDataChannelMediaSection){e.next=24;break}return e.next=9,this._pc.createOffer();case 9:if(d=e.sent,l=jn.parse(d.sdp),p=l.media.find((function(e){return"application"===e.type})),this._transportReady){e.next=15;break}return e.next=15,this._setupTransport({localDtlsRole:"server",localSdpObject:l});case 15:return Zi.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",d),e.next=18,this._pc.setLocalDescription(d);case 18:return this._remoteSdp.sendSctpAssociation({offerMediaObject:p}),f={type:"answer",sdp:this._remoteSdp.getSdp()},Zi.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",f),e.next=23,this._pc.setRemoteDescription(f);case 23:this._hasDataChannelMediaSection=!0;case 24:return h={streamId:c.id,ordered:c.ordered,maxPacketLifeTime:c.maxPacketLifeTime,maxRetransmits:c.maxRetransmits},e.abrupt("return",{dataChannel:u,sctpStreamParameters:h});case 26:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"receive",value:(o=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.trackId,n=t.kind,i=t.rtpParameters,this._assertRecvDirection(),Zi.debug("receive() [trackId:%s, kind:%s]",r,n),o=r,a=n,this._remoteSdp.receive({mid:a,kind:n,offerRtpParameters:i,streamId:i.rtcp.cname,trackId:r}),s={type:"offer",sdp:this._remoteSdp.getSdp()},Zi.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",s),e.next=10,this._pc.setRemoteDescription(s);case 10:return e.next=12,this._pc.createAnswer();case 12:if(c=e.sent,u=jn.parse(c.sdp),d=u.media.find((function(e){return String(e.mid)===a})),qn.applyCodecParameters({offerRtpParameters:i,answerMediaObject:d}),c={type:"answer",sdp:jn.write(u)},this._transportReady){e.next=20;break}return e.next=20,this._setupTransport({localDtlsRole:"client",localSdpObject:u});case 20:return Zi.debug("receive() | calling pc.setLocalDescription() [answer:%o]",c),e.next=23,this._pc.setLocalDescription(c);case 23:if(l=this._pc.getReceivers().find((function(e){return e.track&&e.track.id===o}))){e.next=26;break}throw new Error("new RTCRtpReceiver not");case 26:return this._mapRecvLocalIdInfo.set(o,{mid:a,rtpParameters:i,rtpReceiver:l}),e.abrupt("return",{localId:o,track:l.track,rtpReceiver:l});case 28:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"stopReceiving",value:(i=Ve(Fe.mark((function e(t){var r,n,i,o,a;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._assertRecvDirection(),Zi.debug("stopReceiving() [localId:%s]",t),r=this._mapRecvLocalIdInfo.get(t)||{},n=r.mid,i=r.rtpParameters,this._mapRecvLocalIdInfo.delete(t),this._remoteSdp.planBStopReceiving({mid:n,offerRtpParameters:i}),o={type:"offer",sdp:this._remoteSdp.getSdp()},Zi.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",o),e.next=9,this._pc.setRemoteDescription(o);case 9:return e.next=11,this._pc.createAnswer();case 11:return a=e.sent,Zi.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",a),e.next=15,this._pc.setLocalDescription(a);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getReceiverStats",value:(n=Ve(Fe.mark((function e(t){var r,n;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertRecvDirection(),r=this._mapRecvLocalIdInfo.get(t)||{},n=r.rtpReceiver){e.next=4;break}throw new Error("associated RTCRtpReceiver not found");case 4:return e.abrupt("return",n.getStats());case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"receiveDataChannel",value:(r=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.sctpStreamParameters,n=t.label,i=t.protocol,this._assertRecvDirection(),o=r.streamId,a=r.ordered,s=r.maxPacketLifeTime,c=r.maxRetransmits,u={negotiated:!0,id:o,ordered:a,maxPacketLifeTime:s,maxRetransmitTime:s,maxRetransmits:c,protocol:i},Zi.debug("receiveDataChannel() [options:%o]",u),d=this._pc.createDataChannel(n,u),this._hasDataChannelMediaSection){e.next=23;break}return this._remoteSdp.receiveSctpAssociation({oldDataChannelSpec:!0}),l={type:"offer",sdp:this._remoteSdp.getSdp()},Zi.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",l),e.next=12,this._pc.setRemoteDescription(l);case 12:return e.next=14,this._pc.createAnswer();case 14:if(p=e.sent,this._transportReady){e.next=19;break}return f=jn.parse(p.sdp),e.next=19,this._setupTransport({localDtlsRole:"client",localSdpObject:f});case 19:return Zi.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",p),e.next=22,this._pc.setLocalDescription(p);case 22:this._hasDataChannelMediaSection=!0;case 23:return e.abrupt("return",{dataChannel:d});case 24:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_setupTransport",value:(t=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.localDtlsRole,(n=t.localSdpObject)||(n=jn.parse(this._pc.localDescription.sdp)),(i=qn.extractDtlsParameters({sdpObject:n})).role=r,this._remoteSdp.updateDtlsRole("client"===r?"server":"client"),e.next=7,this.safeEmitAsPromise("@connect",{dtlsParameters:i});case 7:this._transportReady=!0;case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_assertSendDirection",value:function(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}},{key:"_assertRecvDirection",value:function(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}},{key:"name",get:function(){return"Chrome67"}}],[{key:"createFactory",value:function(){return function(){return new E}}}]),E}(ci.HandlerInterface),to=eo,ro=Object.defineProperty({Chrome67:to},"__esModule",{value:!0});function no(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return io(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return io(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function io(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function oo(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var ao=new rr.Logger("Chrome55"),so={OS:1024,MIS:1024},co=function(e){Ye(E,e);var t,r,n,i,o,a,s,c,u,d,l,p,f,h,A,v,g,m=oo(E);function E(){var e;return Ge(this,E),(e=m.call(this))._sendStream=new MediaStream,e._mapSendLocalIdTrack=new Map,e._nextSendLocalId=0,e._mapRecvLocalIdInfo=new Map,e._hasDataChannelMediaSection=!1,e._nextSendSctpStreamId=0,e._transportReady=!1,e}return He(E,[{key:"close",value:function(){if(ao.debug("close()"),this._pc)try{this._pc.close()}catch(e){}}},{key:"getNativeRtpCapabilities",value:(g=Ve(Fe.mark((function e(){var t,r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ao.debug("getNativeRtpCapabilities()"),t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b"}),e.prev=2,e.next=5,t.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});case 5:r=e.sent;try{t.close()}catch(e){}return n=jn.parse(r.sdp),i=qn.extractRtpCapabilities({sdpObject:n}),e.abrupt("return",i);case 12:e.prev=12,e.t0=e.catch(2);try{t.close()}catch(e){}throw e.t0;case 16:case"end":return e.stop()}}),e,null,[[2,12]])}))),function(){return g.apply(this,arguments)})},{key:"getNativeSctpCapabilities",value:(v=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ao.debug("getNativeSctpCapabilities()"),e.abrupt("return",{numStreams:so});case 2:case"end":return e.stop()}}),e)}))),function(){return v.apply(this,arguments)})},{key:"run",value:function(e){var t=this,r=e.direction,n=e.iceParameters,i=e.iceCandidates,o=e.dtlsParameters,a=e.sctpParameters,s=e.iceServers,c=e.iceTransportPolicy,u=e.additionalSettings,d=e.proprietaryConstraints,l=e.extendedRtpCapabilities;ao.debug("run()"),this._direction=r,this._remoteSdp=new bi.RemoteSdp({iceParameters:n,iceCandidates:i,dtlsParameters:o,sctpParameters:a,planB:!0}),this._sendingRtpParametersByKind={audio:nn.getSendingRtpParameters("audio",l),video:nn.getSendingRtpParameters("video",l)},this._sendingRemoteRtpParametersByKind={audio:nn.getSendingRemoteRtpParameters("audio",l),video:nn.getSendingRemoteRtpParameters("video",l)},this._pc=new RTCPeerConnection(Object.assign({iceServers:s||[],iceTransportPolicy:c||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b"},u),d),this._pc.addEventListener("iceconnectionstatechange",(function(){switch(t._pc.iceConnectionState){case"checking":t.emit("@connectionstatechange","connecting");break;case"connected":case"completed":t.emit("@connectionstatechange","connected");break;case"failed":t.emit("@connectionstatechange","failed");break;case"disconnected":t.emit("@connectionstatechange","disconnected");break;case"closed":t.emit("@connectionstatechange","closed")}}))}},{key:"updateIceServers",value:(A=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:ao.debug("updateIceServers()"),(r=this._pc.getConfiguration()).iceServers=t,this._pc.setConfiguration(r);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return A.apply(this,arguments)})},{key:"restartIce",value:(h=Ve(Fe.mark((function e(t){var r,n,i,o;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ao.debug("restartIce()"),this._remoteSdp.updateIceParameters(t),this._transportReady){e.next=4;break}return e.abrupt("return");case 4:if("send"!==this._direction){e.next=17;break}return e.next=7,this._pc.createOffer({iceRestart:!0});case 7:return r=e.sent,ao.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",r),e.next=11,this._pc.setLocalDescription(r);case 11:return n={type:"answer",sdp:this._remoteSdp.getSdp()},ao.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",n),e.next=15,this._pc.setRemoteDescription(n);case 15:e.next=27;break;case 17:return i={type:"offer",sdp:this._remoteSdp.getSdp()},ao.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",i),e.next=21,this._pc.setRemoteDescription(i);case 21:return e.next=23,this._pc.createAnswer();case 23:return o=e.sent,ao.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",o),e.next=27,this._pc.setLocalDescription(o);case 27:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"getTransportStats",value:(f=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._pc.getStats());case 1:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"send",value:(p=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f,h,A;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.track,n=t.encodings,i=t.codecOptions,o=t.codec,this._assertSendDirection(),ao.debug("send() [kind:%s, track.id:%s]",r.kind,r.id),o&&ao.warn("send() | codec selection is not available in %s handler",this.name),this._sendStream.addTrack(r),this._pc.addStream(this._sendStream),e.next=8,this._pc.createOffer();case 8:if(a=e.sent,s=jn.parse(a.sdp),(u=mr.clone(this._sendingRtpParametersByKind[r.kind],{})).codecs=nn.reduceCodecs(u.codecs),(d=mr.clone(this._sendingRemoteRtpParametersByKind[r.kind],{})).codecs=nn.reduceCodecs(d.codecs),this._transportReady){e.next=17;break}return e.next=17,this._setupTransport({localDtlsRole:"server",localSdpObject:s});case 17:return"video"===r.kind&&n&&n.length>1&&(ao.debug("send() | enabling simulcast"),s=jn.parse(a.sdp),c=s.media.find((function(e){return"video"===e.type})),qi.addLegacySimulcast({offerMediaObject:c,track:r,numStreams:n.length}),a={type:"offer",sdp:jn.write(s)}),ao.debug("send() | calling pc.setLocalDescription() [offer:%o]",a),e.next=21,this._pc.setLocalDescription(a);case 21:if(s=jn.parse(this._pc.localDescription.sdp),c=s.media.find((function(e){return e.type===r.kind})),u.rtcp.cname=qn.getCname({offerMediaObject:c}),u.encodings=qi.getRtpEncodings({offerMediaObject:c,track:r}),n)for(l=0;l<u.encodings.length;++l)n[l]&&Object.assign(u.encodings[l],n[l]);if(u.encodings.length>1&&"video/vp8"===u.codecs[0].mimeType.toLowerCase()){p=no(u.encodings);try{for(p.s();!(f=p.n()).done;)f.value.scalabilityMode="S1T3"}catch(e){p.e(e)}finally{p.f()}}return this._remoteSdp.send({offerMediaObject:c,offerRtpParameters:u,answerRtpParameters:d,codecOptions:i}),h={type:"answer",sdp:this._remoteSdp.getSdp()},ao.debug("send() | calling pc.setRemoteDescription() [answer:%o]",h),e.next=32,this._pc.setRemoteDescription(h);case 32:return A=String(this._nextSendLocalId),this._nextSendLocalId++,this._mapSendLocalIdTrack.set(A,r),e.abrupt("return",{localId:A,rtpParameters:u});case 36:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"stopSending",value:(l=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),ao.debug("stopSending() [localId:%s]",t),r=this._mapSendLocalIdTrack.get(t)){e.next=5;break}throw new Error("track not found");case 5:return this._mapSendLocalIdTrack.delete(t),this._sendStream.removeTrack(r),this._pc.addStream(this._sendStream),e.next=10,this._pc.createOffer();case 10:return n=e.sent,ao.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",n),e.prev=12,e.next=15,this._pc.setLocalDescription(n);case 15:e.next=23;break;case 17:if(e.prev=17,e.t0=e.catch(12),0!==this._sendStream.getTracks().length){e.next=22;break}return ao.warn("stopSending() | ignoring expected error due no sending tracks: %s",e.t0.toString()),e.abrupt("return");case 22:throw e.t0;case 23:if("stable"!==this._pc.signalingState){e.next=25;break}return e.abrupt("return");case 25:return i={type:"answer",sdp:this._remoteSdp.getSdp()},ao.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",i),e.next=29,this._pc.setRemoteDescription(i);case 29:case"end":return e.stop()}}),e,this,[[12,17]])}))),function(e){return l.apply(this,arguments)})},{key:"replaceTrack",value:(d=Ve(Fe.mark((function e(t,r){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Ar.UnsupportedError("not implemented");case 1:case"end":return e.stop()}}),e)}))),function(e,t){return d.apply(this,arguments)})},{key:"setMaxSpatialLayer",value:(u=Ve(Fe.mark((function e(t,r){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Ar.UnsupportedError(" not implemented");case 1:case"end":return e.stop()}}),e)}))),function(e,t){return u.apply(this,arguments)})},{key:"setRtpEncodingParameters",value:(c=Ve(Fe.mark((function e(t,r){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Ar.UnsupportedError("not supported");case 1:case"end":return e.stop()}}),e)}))),function(e,t){return c.apply(this,arguments)})},{key:"getSenderStats",value:(s=Ve(Fe.mark((function e(t){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Ar.UnsupportedError("not implemented");case 1:case"end":return e.stop()}}),e)}))),function(e){return s.apply(this,arguments)})},{key:"sendDataChannel",value:(a=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f,h;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.ordered,n=t.maxPacketLifeTime,i=t.maxRetransmits,o=t.label,a=t.protocol,s=t.priority,this._assertSendDirection(),c={negotiated:!0,id:this._nextSendSctpStreamId,ordered:r,maxPacketLifeTime:n,maxRetransmitTime:n,maxRetransmits:i,protocol:a,priority:s},ao.debug("sendDataChannel() [options:%o]",c),u=this._pc.createDataChannel(o,c),this._nextSendSctpStreamId=++this._nextSendSctpStreamId%so.MIS,this._hasDataChannelMediaSection){e.next=24;break}return e.next=9,this._pc.createOffer();case 9:if(d=e.sent,l=jn.parse(d.sdp),p=l.media.find((function(e){return"application"===e.type})),this._transportReady){e.next=15;break}return e.next=15,this._setupTransport({localDtlsRole:"server",localSdpObject:l});case 15:return ao.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",d),e.next=18,this._pc.setLocalDescription(d);case 18:return this._remoteSdp.sendSctpAssociation({offerMediaObject:p}),f={type:"answer",sdp:this._remoteSdp.getSdp()},ao.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",f),e.next=23,this._pc.setRemoteDescription(f);case 23:this._hasDataChannelMediaSection=!0;case 24:return h={streamId:c.id,ordered:c.ordered,maxPacketLifeTime:c.maxPacketLifeTime,maxRetransmits:c.maxRetransmits},e.abrupt("return",{dataChannel:u,sctpStreamParameters:h});case 26:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"receive",value:(o=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.trackId,n=t.kind,i=t.rtpParameters,this._assertRecvDirection(),ao.debug("receive() [trackId:%s, kind:%s]",r,n),o=r,a=n,s=i.rtcp.cname,this._remoteSdp.receive({mid:a,kind:n,offerRtpParameters:i,streamId:s,trackId:r}),c={type:"offer",sdp:this._remoteSdp.getSdp()},ao.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",c),e.next=11,this._pc.setRemoteDescription(c);case 11:return e.next=13,this._pc.createAnswer();case 13:if(u=e.sent,d=jn.parse(u.sdp),l=d.media.find((function(e){return String(e.mid)===a})),qn.applyCodecParameters({offerRtpParameters:i,answerMediaObject:l}),u={type:"answer",sdp:jn.write(d)},this._transportReady){e.next=21;break}return e.next=21,this._setupTransport({localDtlsRole:"client",localSdpObject:d});case 21:return ao.debug("receive() | calling pc.setLocalDescription() [answer:%o]",u),e.next=24,this._pc.setLocalDescription(u);case 24:if(p=this._pc.getRemoteStreams().find((function(e){return e.id===s})),f=p.getTrackById(o)){e.next=28;break}throw new Error("remote track not found");case 28:return this._mapRecvLocalIdInfo.set(o,{mid:a,rtpParameters:i}),e.abrupt("return",{localId:o,track:f});case 30:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"stopReceiving",value:(i=Ve(Fe.mark((function e(t){var r,n,i,o,a;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._assertRecvDirection(),ao.debug("stopReceiving() [localId:%s]",t),r=this._mapRecvLocalIdInfo.get(t)||{},n=r.mid,i=r.rtpParameters,this._mapRecvLocalIdInfo.delete(t),this._remoteSdp.planBStopReceiving({mid:n,offerRtpParameters:i}),o={type:"offer",sdp:this._remoteSdp.getSdp()},ao.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",o),e.next=9,this._pc.setRemoteDescription(o);case 9:return e.next=11,this._pc.createAnswer();case 11:return a=e.sent,ao.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",a),e.next=15,this._pc.setLocalDescription(a);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getReceiverStats",value:(n=Ve(Fe.mark((function e(t){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Ar.UnsupportedError("not implemented");case 1:case"end":return e.stop()}}),e)}))),function(e){return n.apply(this,arguments)})},{key:"receiveDataChannel",value:(r=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.sctpStreamParameters,n=t.label,i=t.protocol,this._assertRecvDirection(),o=r.streamId,a=r.ordered,s=r.maxPacketLifeTime,c=r.maxRetransmits,u={negotiated:!0,id:o,ordered:a,maxPacketLifeTime:s,maxRetransmitTime:s,maxRetransmits:c,protocol:i},ao.debug("receiveDataChannel() [options:%o]",u),d=this._pc.createDataChannel(n,u),this._hasDataChannelMediaSection){e.next=23;break}return this._remoteSdp.receiveSctpAssociation({oldDataChannelSpec:!0}),l={type:"offer",sdp:this._remoteSdp.getSdp()},ao.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",l),e.next=12,this._pc.setRemoteDescription(l);case 12:return e.next=14,this._pc.createAnswer();case 14:if(p=e.sent,this._transportReady){e.next=19;break}return f=jn.parse(p.sdp),e.next=19,this._setupTransport({localDtlsRole:"client",localSdpObject:f});case 19:return ao.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",p),e.next=22,this._pc.setLocalDescription(p);case 22:this._hasDataChannelMediaSection=!0;case 23:return e.abrupt("return",{dataChannel:d});case 24:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_setupTransport",value:(t=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.localDtlsRole,(n=t.localSdpObject)||(n=jn.parse(this._pc.localDescription.sdp)),(i=qn.extractDtlsParameters({sdpObject:n})).role=r,this._remoteSdp.updateDtlsRole("client"===r?"server":"client"),e.next=7,this.safeEmitAsPromise("@connect",{dtlsParameters:i});case 7:this._transportReady=!0;case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_assertSendDirection",value:function(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}},{key:"_assertRecvDirection",value:function(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}},{key:"name",get:function(){return"Chrome55"}}],[{key:"createFactory",value:function(){return function(){return new E}}}]),E}(ci.HandlerInterface),uo=co,lo=Object.defineProperty({Chrome55:uo},"__esModule",{value:!0});function po(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return fo(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return fo(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function fo(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function ho(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var Ao=new rr.Logger("Firefox60"),vo={OS:16,MIS:2048},go=function(e){Ye(E,e);var t,r,n,i,o,a,s,c,u,d,l,p,f,h,A,v,g,m=ho(E);function E(){var e;return Ge(this,E),(e=m.call(this))._mapMidTransceiver=new Map,e._sendStream=new MediaStream,e._hasDataChannelMediaSection=!1,e._nextSendSctpStreamId=0,e._transportReady=!1,e}return He(E,[{key:"close",value:function(){if(Ao.debug("close()"),this._pc)try{this._pc.close()}catch(e){}}},{key:"getNativeRtpCapabilities",value:(g=Ve(Fe.mark((function e(){var t,r,n,i,o,a,s,c,u,d;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ao.debug("getNativeRtpCapabilities()"),t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"}),(r=document.createElement("canvas")).getContext("2d"),n=r.captureStream(),i=n.getVideoTracks()[0],e.prev=6,t.addTransceiver("audio",{direction:"sendrecv"}),o=t.addTransceiver(i,{direction:"sendrecv"}),a=o.sender.getParameters(),s=[{rid:"r0",maxBitrate:1e5},{rid:"r1",maxBitrate:5e5}],a.encodings=s,e.next=14,o.sender.setParameters(a);case 14:return e.next=16,t.createOffer();case 16:c=e.sent;try{r.remove()}catch(e){}try{i.stop()}catch(e){}try{t.close()}catch(e){}return u=jn.parse(c.sdp),d=qn.extractRtpCapabilities({sdpObject:u}),e.abrupt("return",d);case 25:e.prev=25,e.t0=e.catch(6);try{r.remove()}catch(e){}try{i.stop()}catch(e){}try{t.close()}catch(e){}throw e.t0;case 31:case"end":return e.stop()}}),e,null,[[6,25]])}))),function(){return g.apply(this,arguments)})},{key:"getNativeSctpCapabilities",value:(v=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ao.debug("getNativeSctpCapabilities()"),e.abrupt("return",{numStreams:vo});case 2:case"end":return e.stop()}}),e)}))),function(){return v.apply(this,arguments)})},{key:"run",value:function(e){var t=this,r=e.direction,n=e.iceParameters,i=e.iceCandidates,o=e.dtlsParameters,a=e.sctpParameters,s=e.iceServers,c=e.iceTransportPolicy,u=e.additionalSettings,d=e.proprietaryConstraints,l=e.extendedRtpCapabilities;Ao.debug("run()"),this._direction=r,this._remoteSdp=new bi.RemoteSdp({iceParameters:n,iceCandidates:i,dtlsParameters:o,sctpParameters:a}),this._sendingRtpParametersByKind={audio:nn.getSendingRtpParameters("audio",l),video:nn.getSendingRtpParameters("video",l)},this._sendingRemoteRtpParametersByKind={audio:nn.getSendingRemoteRtpParameters("audio",l),video:nn.getSendingRemoteRtpParameters("video",l)},this._pc=new RTCPeerConnection(Object.assign({iceServers:s||[],iceTransportPolicy:c||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"},u),d),this._pc.addEventListener("iceconnectionstatechange",(function(){switch(t._pc.iceConnectionState){case"checking":t.emit("@connectionstatechange","connecting");break;case"connected":case"completed":t.emit("@connectionstatechange","connected");break;case"failed":t.emit("@connectionstatechange","failed");break;case"disconnected":t.emit("@connectionstatechange","disconnected");break;case"closed":t.emit("@connectionstatechange","closed")}}))}},{key:"updateIceServers",value:(A=Ve(Fe.mark((function e(t){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Ar.UnsupportedError("not supported");case 1:case"end":return e.stop()}}),e)}))),function(e){return A.apply(this,arguments)})},{key:"restartIce",value:(h=Ve(Fe.mark((function e(t){var r,n,i,o;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Ao.debug("restartIce()"),this._remoteSdp.updateIceParameters(t),this._transportReady){e.next=4;break}return e.abrupt("return");case 4:if("send"!==this._direction){e.next=17;break}return e.next=7,this._pc.createOffer({iceRestart:!0});case 7:return r=e.sent,Ao.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",r),e.next=11,this._pc.setLocalDescription(r);case 11:return n={type:"answer",sdp:this._remoteSdp.getSdp()},Ao.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",n),e.next=15,this._pc.setRemoteDescription(n);case 15:e.next=27;break;case 17:return i={type:"offer",sdp:this._remoteSdp.getSdp()},Ao.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",i),e.next=21,this._pc.setRemoteDescription(i);case 21:return e.next=23,this._pc.createAnswer();case 23:return o=e.sent,Ao.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",o),e.next=27,this._pc.setLocalDescription(o);case 27:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"getTransportStats",value:(f=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._pc.getStats());case 1:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"send",value:(p=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f,h,A,v,g;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.track,n=t.encodings,i=t.codecOptions,o=t.codec,this._assertSendDirection(),Ao.debug("send() [kind:%s, track.id:%s]",r.kind,r.id),n&&(n=mr.clone(n,[])).length>1&&(n.forEach((function(e,t){e.rid="r".concat(t)})),n.reverse()),(a=mr.clone(this._sendingRtpParametersByKind[r.kind],{})).codecs=nn.reduceCodecs(a.codecs,o),(s=mr.clone(this._sendingRemoteRtpParametersByKind[r.kind],{})).codecs=nn.reduceCodecs(s.codecs,o),c=this._pc.addTransceiver(r,{direction:"sendonly",streams:[this._sendStream]}),!n){e.next=14;break}return(u=c.sender.getParameters()).encodings=n,e.next=14,c.sender.setParameters(u);case 14:return e.next=16,this._pc.createOffer();case 16:if(d=e.sent,l=jn.parse(d.sdp),this._transportReady){e.next=21;break}return e.next=21,this._setupTransport({localDtlsRole:"client",localSdpObject:l});case 21:return Ao.debug("send() | calling pc.setLocalDescription() [offer:%o]",d),e.next=24,this._pc.setLocalDescription(d);case 24:if(p=c.mid,a.mid=p,l=jn.parse(this._pc.localDescription.sdp),f=l.media[l.media.length-1],a.rtcp.cname=qn.getCname({offerMediaObject:f}),n?1===n.length?(h=oi.getRtpEncodings({offerMediaObject:f}),Object.assign(h[0],n[0]),a.encodings=h):a.encodings=n.reverse():a.encodings=oi.getRtpEncodings({offerMediaObject:f}),a.encodings.length>1&&("video/vp8"===a.codecs[0].mimeType.toLowerCase()||"video/h264"===a.codecs[0].mimeType.toLowerCase())){A=po(a.encodings);try{for(A.s();!(v=A.n()).done;)v.value.scalabilityMode="S1T3"}catch(e){A.e(e)}finally{A.f()}}return this._remoteSdp.send({offerMediaObject:f,offerRtpParameters:a,answerRtpParameters:s,codecOptions:i,extmapAllowMixed:!0}),g={type:"answer",sdp:this._remoteSdp.getSdp()},Ao.debug("send() | calling pc.setRemoteDescription() [answer:%o]",g),e.next=36,this._pc.setRemoteDescription(g);case 36:return this._mapMidTransceiver.set(p,c),e.abrupt("return",{localId:p,rtpParameters:a,rtpSender:c.sender});case 38:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"stopSending",value:(l=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Ao.debug("stopSending() [localId:%s]",t),r=this._mapMidTransceiver.get(t)){e.next=4;break}throw new Error("associated transceiver not found");case 4:return r.sender.replaceTrack(null),this._pc.removeTrack(r.sender),this._remoteSdp.disableMediaSection(r.mid),e.next=9,this._pc.createOffer();case 9:return n=e.sent,Ao.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",n),e.next=13,this._pc.setLocalDescription(n);case 13:return i={type:"answer",sdp:this._remoteSdp.getSdp()},Ao.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",i),e.next=17,this._pc.setRemoteDescription(i);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"replaceTrack",value:(d=Ve(Fe.mark((function e(t,r){var n;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),r?Ao.debug("replaceTrack() [localId:%s, track.id:%s]",t,r.id):Ao.debug("replaceTrack() [localId:%s, no track]",t),n=this._mapMidTransceiver.get(t)){e.next=5;break}throw new Error("associated RTCRtpTransceiver not found");case 5:return e.next=7,n.sender.replaceTrack(r);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"setMaxSpatialLayer",value:(u=Ve(Fe.mark((function e(t,r){var n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),Ao.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",t,r),n=this._mapMidTransceiver.get(t)){e.next=5;break}throw new Error("associated transceiver not found");case 5:return i=n.sender.getParameters(),r=i.encodings.length-1-r,i.encodings.forEach((function(e,t){e.active=t>=r})),e.next=10,n.sender.setParameters(i);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"setRtpEncodingParameters",value:(c=Ve(Fe.mark((function e(t,r){var n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),Ao.debug("setRtpEncodingParameters() [localId:%s, params:%o]",t,r),n=this._mapMidTransceiver.get(t)){e.next=5;break}throw new Error("associated RTCRtpTransceiver not found");case 5:return(i=n.sender.getParameters()).encodings.forEach((function(e,t){i.encodings[t]=Object.assign(Object.assign({},e),r)})),e.next=9,n.sender.setParameters(i);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"getSenderStats",value:(s=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),r=this._mapMidTransceiver.get(t)){e.next=4;break}throw new Error("associated RTCRtpTransceiver not found");case 4:return e.abrupt("return",r.sender.getStats());case 5:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"sendDataChannel",value:(a=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f,h;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.ordered,n=t.maxPacketLifeTime,i=t.maxRetransmits,o=t.label,a=t.protocol,s=t.priority,this._assertSendDirection(),c={negotiated:!0,id:this._nextSendSctpStreamId,ordered:r,maxPacketLifeTime:n,maxRetransmits:i,protocol:a,priority:s},Ao.debug("sendDataChannel() [options:%o]",c),u=this._pc.createDataChannel(o,c),this._nextSendSctpStreamId=++this._nextSendSctpStreamId%vo.MIS,this._hasDataChannelMediaSection){e.next=24;break}return e.next=9,this._pc.createOffer();case 9:if(d=e.sent,l=jn.parse(d.sdp),p=l.media.find((function(e){return"application"===e.type})),this._transportReady){e.next=15;break}return e.next=15,this._setupTransport({localDtlsRole:"server",localSdpObject:l});case 15:return Ao.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",d),e.next=18,this._pc.setLocalDescription(d);case 18:return this._remoteSdp.sendSctpAssociation({offerMediaObject:p}),f={type:"answer",sdp:this._remoteSdp.getSdp()},Ao.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",f),e.next=23,this._pc.setRemoteDescription(f);case 23:this._hasDataChannelMediaSection=!0;case 24:return h={streamId:c.id,ordered:c.ordered,maxPacketLifeTime:c.maxPacketLifeTime,maxRetransmits:c.maxRetransmits},e.abrupt("return",{dataChannel:u,sctpStreamParameters:h});case 26:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"receive",value:(o=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.trackId,n=t.kind,i=t.rtpParameters,this._assertRecvDirection(),Ao.debug("receive() [trackId:%s, kind:%s]",r,n),o=i.mid||String(this._mapMidTransceiver.size),this._remoteSdp.receive({mid:o,kind:n,offerRtpParameters:i,streamId:i.rtcp.cname,trackId:r}),a={type:"offer",sdp:this._remoteSdp.getSdp()},Ao.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",a),e.next=9,this._pc.setRemoteDescription(a);case 9:return e.next=11,this._pc.createAnswer();case 11:if(s=e.sent,c=jn.parse(s.sdp),u=c.media.find((function(e){return String(e.mid)===o})),qn.applyCodecParameters({offerRtpParameters:i,answerMediaObject:u}),s={type:"answer",sdp:jn.write(c)},this._transportReady){e.next=19;break}return e.next=19,this._setupTransport({localDtlsRole:"client",localSdpObject:c});case 19:return Ao.debug("receive() | calling pc.setLocalDescription() [answer:%o]",s),e.next=22,this._pc.setLocalDescription(s);case 22:if(d=this._pc.getTransceivers().find((function(e){return e.mid===o}))){e.next=25;break}throw new Error("new RTCRtpTransceiver not found");case 25:return this._mapMidTransceiver.set(o,d),e.abrupt("return",{localId:o,track:d.receiver.track,rtpReceiver:d.receiver});case 27:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"stopReceiving",value:(i=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertRecvDirection(),Ao.debug("stopReceiving() [localId:%s]",t),r=this._mapMidTransceiver.get(t)){e.next=5;break}throw new Error("associated RTCRtpTransceiver not found");case 5:return this._remoteSdp.closeMediaSection(r.mid),n={type:"offer",sdp:this._remoteSdp.getSdp()},Ao.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",n),e.next=10,this._pc.setRemoteDescription(n);case 10:return e.next=12,this._pc.createAnswer();case 12:return i=e.sent,Ao.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",i),e.next=16,this._pc.setLocalDescription(i);case 16:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getReceiverStats",value:(n=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertRecvDirection(),r=this._mapMidTransceiver.get(t)){e.next=4;break}throw new Error("associated RTCRtpTransceiver not found");case 4:return e.abrupt("return",r.receiver.getStats());case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"receiveDataChannel",value:(r=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.sctpStreamParameters,n=t.label,i=t.protocol,this._assertRecvDirection(),o=r.streamId,a=r.ordered,s=r.maxPacketLifeTime,c=r.maxRetransmits,u={negotiated:!0,id:o,ordered:a,maxPacketLifeTime:s,maxRetransmits:c,protocol:i},Ao.debug("receiveDataChannel() [options:%o]",u),d=this._pc.createDataChannel(n,u),this._hasDataChannelMediaSection){e.next=23;break}return this._remoteSdp.receiveSctpAssociation(),l={type:"offer",sdp:this._remoteSdp.getSdp()},Ao.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",l),e.next=12,this._pc.setRemoteDescription(l);case 12:return e.next=14,this._pc.createAnswer();case 14:if(p=e.sent,this._transportReady){e.next=19;break}return f=jn.parse(p.sdp),e.next=19,this._setupTransport({localDtlsRole:"client",localSdpObject:f});case 19:return Ao.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",p),e.next=22,this._pc.setLocalDescription(p);case 22:this._hasDataChannelMediaSection=!0;case 23:return e.abrupt("return",{dataChannel:d});case 24:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_setupTransport",value:(t=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.localDtlsRole,(n=t.localSdpObject)||(n=jn.parse(this._pc.localDescription.sdp)),(i=qn.extractDtlsParameters({sdpObject:n})).role=r,this._remoteSdp.updateDtlsRole("client"===r?"server":"client"),e.next=7,this.safeEmitAsPromise("@connect",{dtlsParameters:i});case 7:this._transportReady=!0;case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_assertSendDirection",value:function(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}},{key:"_assertRecvDirection",value:function(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}},{key:"name",get:function(){return"Firefox60"}}],[{key:"createFactory",value:function(){return function(){return new E}}}]),E}(ci.HandlerInterface),mo=go,Eo=Object.defineProperty({Firefox60:mo},"__esModule",{value:!0});function _o(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return yo(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return yo(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function yo(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Io(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var So=new rr.Logger("Safari12"),bo={OS:1024,MIS:1024},Co=function(e){Ye(E,e);var t,r,n,i,o,a,s,c,u,d,l,p,f,h,A,v,g,m=Io(E);function E(){var e;return Ge(this,E),(e=m.call(this))._mapMidTransceiver=new Map,e._sendStream=new MediaStream,e._hasDataChannelMediaSection=!1,e._nextSendSctpStreamId=0,e._transportReady=!1,e}return He(E,[{key:"close",value:function(){if(So.debug("close()"),this._pc)try{this._pc.close()}catch(e){}}},{key:"getNativeRtpCapabilities",value:(g=Ve(Fe.mark((function e(){var t,r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return So.debug("getNativeRtpCapabilities()"),t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"}),e.prev=2,t.addTransceiver("audio"),t.addTransceiver("video"),e.next=7,t.createOffer();case 7:r=e.sent;try{t.close()}catch(e){}return n=jn.parse(r.sdp),i=qn.extractRtpCapabilities({sdpObject:n}),e.abrupt("return",i);case 14:e.prev=14,e.t0=e.catch(2);try{t.close()}catch(e){}throw e.t0;case 18:case"end":return e.stop()}}),e,null,[[2,14]])}))),function(){return g.apply(this,arguments)})},{key:"getNativeSctpCapabilities",value:(v=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return So.debug("getNativeSctpCapabilities()"),e.abrupt("return",{numStreams:bo});case 2:case"end":return e.stop()}}),e)}))),function(){return v.apply(this,arguments)})},{key:"run",value:function(e){var t=this,r=e.direction,n=e.iceParameters,i=e.iceCandidates,o=e.dtlsParameters,a=e.sctpParameters,s=e.iceServers,c=e.iceTransportPolicy,u=e.additionalSettings,d=e.proprietaryConstraints,l=e.extendedRtpCapabilities;So.debug("run()"),this._direction=r,this._remoteSdp=new bi.RemoteSdp({iceParameters:n,iceCandidates:i,dtlsParameters:o,sctpParameters:a}),this._sendingRtpParametersByKind={audio:nn.getSendingRtpParameters("audio",l),video:nn.getSendingRtpParameters("video",l)},this._sendingRemoteRtpParametersByKind={audio:nn.getSendingRemoteRtpParameters("audio",l),video:nn.getSendingRemoteRtpParameters("video",l)},this._pc=new RTCPeerConnection(Object.assign({iceServers:s||[],iceTransportPolicy:c||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"},u),d),this._pc.addEventListener("iceconnectionstatechange",(function(){switch(t._pc.iceConnectionState){case"checking":t.emit("@connectionstatechange","connecting");break;case"connected":case"completed":t.emit("@connectionstatechange","connected");break;case"failed":t.emit("@connectionstatechange","failed");break;case"disconnected":t.emit("@connectionstatechange","disconnected");break;case"closed":t.emit("@connectionstatechange","closed")}}))}},{key:"updateIceServers",value:(A=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:So.debug("updateIceServers()"),(r=this._pc.getConfiguration()).iceServers=t,this._pc.setConfiguration(r);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return A.apply(this,arguments)})},{key:"restartIce",value:(h=Ve(Fe.mark((function e(t){var r,n,i,o;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(So.debug("restartIce()"),this._remoteSdp.updateIceParameters(t),this._transportReady){e.next=4;break}return e.abrupt("return");case 4:if("send"!==this._direction){e.next=17;break}return e.next=7,this._pc.createOffer({iceRestart:!0});case 7:return r=e.sent,So.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",r),e.next=11,this._pc.setLocalDescription(r);case 11:return n={type:"answer",sdp:this._remoteSdp.getSdp()},So.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",n),e.next=15,this._pc.setRemoteDescription(n);case 15:e.next=27;break;case 17:return i={type:"offer",sdp:this._remoteSdp.getSdp()},So.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",i),e.next=21,this._pc.setRemoteDescription(i);case 21:return e.next=23,this._pc.createAnswer();case 23:return o=e.sent,So.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",o),e.next=27,this._pc.setLocalDescription(o);case 27:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"getTransportStats",value:(f=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._pc.getStats());case 1:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"send",value:(p=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f,h,A,v,g;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.track,n=t.encodings,i=t.codecOptions,o=t.codec,this._assertSendDirection(),So.debug("send() [kind:%s, track.id:%s]",r.kind,r.id),(a=mr.clone(this._sendingRtpParametersByKind[r.kind],{})).codecs=nn.reduceCodecs(a.codecs,o),(s=mr.clone(this._sendingRemoteRtpParametersByKind[r.kind],{})).codecs=nn.reduceCodecs(s.codecs,o),c=this._remoteSdp.getNextMediaSectionIdx(),u=this._pc.addTransceiver(r,{direction:"sendonly",streams:[this._sendStream]}),e.next=11,this._pc.createOffer();case 11:if(d=e.sent,l=jn.parse(d.sdp),this._transportReady){e.next=16;break}return e.next=16,this._setupTransport({localDtlsRole:"server",localSdpObject:l});case 16:return n&&n.length>1&&(So.debug("send() | enabling legacy simulcast"),l=jn.parse(d.sdp),p=l.media[c.idx],oi.addLegacySimulcast({offerMediaObject:p,numStreams:n.length}),d={type:"offer",sdp:jn.write(l)}),So.debug("send() | calling pc.setLocalDescription() [offer:%o]",d),e.next=20,this._pc.setLocalDescription(d);case 20:if(f=u.mid,a.mid=f,l=jn.parse(this._pc.localDescription.sdp),p=l.media[c.idx],a.rtcp.cname=qn.getCname({offerMediaObject:p}),a.encodings=oi.getRtpEncodings({offerMediaObject:p}),n)for(h=0;h<a.encodings.length;++h)n[h]&&Object.assign(a.encodings[h],n[h]);if(a.encodings.length>1&&("video/vp8"===a.codecs[0].mimeType.toLowerCase()||"video/h264"===a.codecs[0].mimeType.toLowerCase())){A=_o(a.encodings);try{for(A.s();!(v=A.n()).done;)v.value.scalabilityMode="S1T3"}catch(e){A.e(e)}finally{A.f()}}return this._remoteSdp.send({offerMediaObject:p,reuseMid:c.reuseMid,offerRtpParameters:a,answerRtpParameters:s,codecOptions:i}),g={type:"answer",sdp:this._remoteSdp.getSdp()},So.debug("send() | calling pc.setRemoteDescription() [answer:%o]",g),e.next=33,this._pc.setRemoteDescription(g);case 33:return this._mapMidTransceiver.set(f,u),e.abrupt("return",{localId:f,rtpParameters:a,rtpSender:u.sender});case 35:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"stopSending",value:(l=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),So.debug("stopSending() [localId:%s]",t),r=this._mapMidTransceiver.get(t)){e.next=5;break}throw new Error("associated RTCRtpTransceiver not found");case 5:return r.sender.replaceTrack(null),this._pc.removeTrack(r.sender),this._remoteSdp.closeMediaSection(r.mid),e.next=10,this._pc.createOffer();case 10:return n=e.sent,So.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",n),e.next=14,this._pc.setLocalDescription(n);case 14:return i={type:"answer",sdp:this._remoteSdp.getSdp()},So.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",i),e.next=18,this._pc.setRemoteDescription(i);case 18:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"replaceTrack",value:(d=Ve(Fe.mark((function e(t,r){var n;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),r?So.debug("replaceTrack() [localId:%s, track.id:%s]",t,r.id):So.debug("replaceTrack() [localId:%s, no track]",t),n=this._mapMidTransceiver.get(t)){e.next=5;break}throw new Error("associated RTCRtpTransceiver not found");case 5:return e.next=7,n.sender.replaceTrack(r);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"setMaxSpatialLayer",value:(u=Ve(Fe.mark((function e(t,r){var n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),So.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",t,r),n=this._mapMidTransceiver.get(t)){e.next=5;break}throw new Error("associated RTCRtpTransceiver not found");case 5:return(i=n.sender.getParameters()).encodings.forEach((function(e,t){e.active=t<=r})),e.next=9,n.sender.setParameters(i);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"setRtpEncodingParameters",value:(c=Ve(Fe.mark((function e(t,r){var n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),So.debug("setRtpEncodingParameters() [localId:%s, params:%o]",t,r),n=this._mapMidTransceiver.get(t)){e.next=5;break}throw new Error("associated RTCRtpTransceiver not found");case 5:return(i=n.sender.getParameters()).encodings.forEach((function(e,t){i.encodings[t]=Object.assign(Object.assign({},e),r)})),e.next=9,n.sender.setParameters(i);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"getSenderStats",value:(s=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),r=this._mapMidTransceiver.get(t)){e.next=4;break}throw new Error("associated RTCRtpTransceiver not found");case 4:return e.abrupt("return",r.sender.getStats());case 5:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"sendDataChannel",value:(a=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f,h;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.ordered,n=t.maxPacketLifeTime,i=t.maxRetransmits,o=t.label,a=t.protocol,s=t.priority,this._assertSendDirection(),c={negotiated:!0,id:this._nextSendSctpStreamId,ordered:r,maxPacketLifeTime:n,maxRetransmits:i,protocol:a,priority:s},So.debug("sendDataChannel() [options:%o]",c),u=this._pc.createDataChannel(o,c),this._nextSendSctpStreamId=++this._nextSendSctpStreamId%bo.MIS,this._hasDataChannelMediaSection){e.next=24;break}return e.next=9,this._pc.createOffer();case 9:if(d=e.sent,l=jn.parse(d.sdp),p=l.media.find((function(e){return"application"===e.type})),this._transportReady){e.next=15;break}return e.next=15,this._setupTransport({localDtlsRole:"server",localSdpObject:l});case 15:return So.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",d),e.next=18,this._pc.setLocalDescription(d);case 18:return this._remoteSdp.sendSctpAssociation({offerMediaObject:p}),f={type:"answer",sdp:this._remoteSdp.getSdp()},So.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",f),e.next=23,this._pc.setRemoteDescription(f);case 23:this._hasDataChannelMediaSection=!0;case 24:return h={streamId:c.id,ordered:c.ordered,maxPacketLifeTime:c.maxPacketLifeTime,maxRetransmits:c.maxRetransmits},e.abrupt("return",{dataChannel:u,sctpStreamParameters:h});case 26:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"receive",value:(o=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.trackId,n=t.kind,i=t.rtpParameters,this._assertRecvDirection(),So.debug("receive() [trackId:%s, kind:%s]",r,n),o=i.mid||String(this._mapMidTransceiver.size),this._remoteSdp.receive({mid:o,kind:n,offerRtpParameters:i,streamId:i.rtcp.cname,trackId:r}),a={type:"offer",sdp:this._remoteSdp.getSdp()},So.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",a),e.next=9,this._pc.setRemoteDescription(a);case 9:return e.next=11,this._pc.createAnswer();case 11:if(s=e.sent,c=jn.parse(s.sdp),u=c.media.find((function(e){return String(e.mid)===o})),qn.applyCodecParameters({offerRtpParameters:i,answerMediaObject:u}),s={type:"answer",sdp:jn.write(c)},this._transportReady){e.next=19;break}return e.next=19,this._setupTransport({localDtlsRole:"client",localSdpObject:c});case 19:return So.debug("receive() | calling pc.setLocalDescription() [answer:%o]",s),e.next=22,this._pc.setLocalDescription(s);case 22:if(d=this._pc.getTransceivers().find((function(e){return e.mid===o}))){e.next=25;break}throw new Error("new RTCRtpTransceiver not found");case 25:return this._mapMidTransceiver.set(o,d),e.abrupt("return",{localId:o,track:d.receiver.track,rtpReceiver:d.receiver});case 27:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"stopReceiving",value:(i=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertRecvDirection(),So.debug("stopReceiving() [localId:%s]",t),r=this._mapMidTransceiver.get(t)){e.next=5;break}throw new Error("associated RTCRtpTransceiver not found");case 5:return this._remoteSdp.closeMediaSection(r.mid),n={type:"offer",sdp:this._remoteSdp.getSdp()},So.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",n),e.next=10,this._pc.setRemoteDescription(n);case 10:return e.next=12,this._pc.createAnswer();case 12:return i=e.sent,So.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",i),e.next=16,this._pc.setLocalDescription(i);case 16:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getReceiverStats",value:(n=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertRecvDirection(),r=this._mapMidTransceiver.get(t)){e.next=4;break}throw new Error("associated RTCRtpTransceiver not found");case 4:return e.abrupt("return",r.receiver.getStats());case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"receiveDataChannel",value:(r=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.sctpStreamParameters,n=t.label,i=t.protocol,this._assertRecvDirection(),o=r.streamId,a=r.ordered,s=r.maxPacketLifeTime,c=r.maxRetransmits,u={negotiated:!0,id:o,ordered:a,maxPacketLifeTime:s,maxRetransmits:c,protocol:i},So.debug("receiveDataChannel() [options:%o]",u),d=this._pc.createDataChannel(n,u),this._hasDataChannelMediaSection){e.next=23;break}return this._remoteSdp.receiveSctpAssociation(),l={type:"offer",sdp:this._remoteSdp.getSdp()},So.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",l),e.next=12,this._pc.setRemoteDescription(l);case 12:return e.next=14,this._pc.createAnswer();case 14:if(p=e.sent,this._transportReady){e.next=19;break}return f=jn.parse(p.sdp),e.next=19,this._setupTransport({localDtlsRole:"client",localSdpObject:f});case 19:return So.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",p),e.next=22,this._pc.setLocalDescription(p);case 22:this._hasDataChannelMediaSection=!0;case 23:return e.abrupt("return",{dataChannel:d});case 24:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_setupTransport",value:(t=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.localDtlsRole,(n=t.localSdpObject)||(n=jn.parse(this._pc.localDescription.sdp)),(i=qn.extractDtlsParameters({sdpObject:n})).role=r,this._remoteSdp.updateDtlsRole("client"===r?"server":"client"),e.next=7,this.safeEmitAsPromise("@connect",{dtlsParameters:i});case 7:this._transportReady=!0;case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_assertSendDirection",value:function(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}},{key:"_assertRecvDirection",value:function(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}},{key:"name",get:function(){return"Safari12"}}],[{key:"createFactory",value:function(){return function(){return new E}}}]),E}(ci.HandlerInterface),wo=Co,Ro=Object.defineProperty({Safari12:wo},"__esModule",{value:!0});function To(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return ko(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ko(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function ko(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Oo(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var Do=new rr.Logger("Safari11"),No={OS:1024,MIS:1024},xo=function(e){Ye(E,e);var t,r,n,i,o,a,s,c,u,d,l,p,f,h,A,v,g,m=Oo(E);function E(){var e;return Ge(this,E),(e=m.call(this))._sendStream=new MediaStream,e._mapSendLocalIdRtpSender=new Map,e._nextSendLocalId=0,e._mapRecvLocalIdInfo=new Map,e._hasDataChannelMediaSection=!1,e._nextSendSctpStreamId=0,e._transportReady=!1,e}return He(E,[{key:"close",value:function(){if(Do.debug("close()"),this._pc)try{this._pc.close()}catch(e){}}},{key:"getNativeRtpCapabilities",value:(g=Ve(Fe.mark((function e(){var t,r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Do.debug("getNativeRtpCapabilities()"),t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b"}),e.prev=2,e.next=5,t.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});case 5:r=e.sent;try{t.close()}catch(e){}return n=jn.parse(r.sdp),i=qn.extractRtpCapabilities({sdpObject:n}),e.abrupt("return",i);case 12:e.prev=12,e.t0=e.catch(2);try{t.close()}catch(e){}throw e.t0;case 16:case"end":return e.stop()}}),e,null,[[2,12]])}))),function(){return g.apply(this,arguments)})},{key:"getNativeSctpCapabilities",value:(v=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Do.debug("getNativeSctpCapabilities()"),e.abrupt("return",{numStreams:No});case 2:case"end":return e.stop()}}),e)}))),function(){return v.apply(this,arguments)})},{key:"run",value:function(e){var t=this,r=e.direction,n=e.iceParameters,i=e.iceCandidates,o=e.dtlsParameters,a=e.sctpParameters,s=e.iceServers,c=e.iceTransportPolicy,u=e.additionalSettings,d=e.proprietaryConstraints,l=e.extendedRtpCapabilities;Do.debug("run()"),this._direction=r,this._remoteSdp=new bi.RemoteSdp({iceParameters:n,iceCandidates:i,dtlsParameters:o,sctpParameters:a,planB:!0}),this._sendingRtpParametersByKind={audio:nn.getSendingRtpParameters("audio",l),video:nn.getSendingRtpParameters("video",l)},this._sendingRemoteRtpParametersByKind={audio:nn.getSendingRemoteRtpParameters("audio",l),video:nn.getSendingRemoteRtpParameters("video",l)},this._pc=new RTCPeerConnection(Object.assign({iceServers:s||[],iceTransportPolicy:c||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"},u),d),this._pc.addEventListener("iceconnectionstatechange",(function(){switch(t._pc.iceConnectionState){case"checking":t.emit("@connectionstatechange","connecting");break;case"connected":case"completed":t.emit("@connectionstatechange","connected");break;case"failed":t.emit("@connectionstatechange","failed");break;case"disconnected":t.emit("@connectionstatechange","disconnected");break;case"closed":t.emit("@connectionstatechange","closed")}}))}},{key:"updateIceServers",value:(A=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:Do.debug("updateIceServers()"),(r=this._pc.getConfiguration()).iceServers=t,this._pc.setConfiguration(r);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return A.apply(this,arguments)})},{key:"restartIce",value:(h=Ve(Fe.mark((function e(t){var r,n,i,o;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Do.debug("restartIce()"),this._remoteSdp.updateIceParameters(t),this._transportReady){e.next=4;break}return e.abrupt("return");case 4:if("send"!==this._direction){e.next=17;break}return e.next=7,this._pc.createOffer({iceRestart:!0});case 7:return r=e.sent,Do.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",r),e.next=11,this._pc.setLocalDescription(r);case 11:return n={type:"answer",sdp:this._remoteSdp.getSdp()},Do.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",n),e.next=15,this._pc.setRemoteDescription(n);case 15:e.next=27;break;case 17:return i={type:"offer",sdp:this._remoteSdp.getSdp()},Do.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",i),e.next=21,this._pc.setRemoteDescription(i);case 21:return e.next=23,this._pc.createAnswer();case 23:return o=e.sent,Do.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",o),e.next=27,this._pc.setLocalDescription(o);case 27:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"getTransportStats",value:(f=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._pc.getStats());case 1:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"send",value:(p=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f,h,A,v;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.track,n=t.encodings,i=t.codecOptions,o=t.codec,this._assertSendDirection(),Do.debug("send() [kind:%s, track.id:%s]",r.kind,r.id),o&&Do.warn("send() | codec selection is not available in %s handler",this.name),this._sendStream.addTrack(r),this._pc.addTrack(r,this._sendStream),e.next=8,this._pc.createOffer();case 8:if(a=e.sent,s=jn.parse(a.sdp),(u=mr.clone(this._sendingRtpParametersByKind[r.kind],{})).codecs=nn.reduceCodecs(u.codecs),(d=mr.clone(this._sendingRemoteRtpParametersByKind[r.kind],{})).codecs=nn.reduceCodecs(d.codecs),this._transportReady){e.next=17;break}return e.next=17,this._setupTransport({localDtlsRole:"server",localSdpObject:s});case 17:return"video"===r.kind&&n&&n.length>1&&(Do.debug("send() | enabling simulcast"),s=jn.parse(a.sdp),c=s.media.find((function(e){return"video"===e.type})),qi.addLegacySimulcast({offerMediaObject:c,track:r,numStreams:n.length}),a={type:"offer",sdp:jn.write(s)}),Do.debug("send() | calling pc.setLocalDescription() [offer:%o]",a),e.next=21,this._pc.setLocalDescription(a);case 21:if(s=jn.parse(this._pc.localDescription.sdp),c=s.media.find((function(e){return e.type===r.kind})),u.rtcp.cname=qn.getCname({offerMediaObject:c}),u.encodings=qi.getRtpEncodings({offerMediaObject:c,track:r}),n)for(l=0;l<u.encodings.length;++l)n[l]&&Object.assign(u.encodings[l],n[l]);if(u.encodings.length>1&&"video/vp8"===u.codecs[0].mimeType.toLowerCase()){p=To(u.encodings);try{for(p.s();!(f=p.n()).done;)f.value.scalabilityMode="S1T3"}catch(e){p.e(e)}finally{p.f()}}return this._remoteSdp.send({offerMediaObject:c,offerRtpParameters:u,answerRtpParameters:d,codecOptions:i}),h={type:"answer",sdp:this._remoteSdp.getSdp()},Do.debug("send() | calling pc.setRemoteDescription() [answer:%o]",h),e.next=32,this._pc.setRemoteDescription(h);case 32:return A=String(this._nextSendLocalId),this._nextSendLocalId++,v=this._pc.getSenders().find((function(e){return e.track===r})),this._mapSendLocalIdRtpSender.set(A,v),e.abrupt("return",{localId:A,rtpParameters:u,rtpSender:v});case 37:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"stopSending",value:(l=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),r=this._mapSendLocalIdRtpSender.get(t)){e.next=4;break}throw new Error("associated RTCRtpSender not found");case 4:return r.track&&this._sendStream.removeTrack(r.track),this._mapSendLocalIdRtpSender.delete(t),e.next=8,this._pc.createOffer();case 8:return n=e.sent,Do.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",n),e.prev=10,e.next=13,this._pc.setLocalDescription(n);case 13:e.next=21;break;case 15:if(e.prev=15,e.t0=e.catch(10),0!==this._sendStream.getTracks().length){e.next=20;break}return Do.warn("stopSending() | ignoring expected error due no sending tracks: %s",e.t0.toString()),e.abrupt("return");case 20:throw e.t0;case 21:if("stable"!==this._pc.signalingState){e.next=23;break}return e.abrupt("return");case 23:return i={type:"answer",sdp:this._remoteSdp.getSdp()},Do.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",i),e.next=27,this._pc.setRemoteDescription(i);case 27:case"end":return e.stop()}}),e,this,[[10,15]])}))),function(e){return l.apply(this,arguments)})},{key:"replaceTrack",value:(d=Ve(Fe.mark((function e(t,r){var n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),r?Do.debug("replaceTrack() [localId:%s, track.id:%s]",t,r.id):Do.debug("replaceTrack() [localId:%s, no track]",t),n=this._mapSendLocalIdRtpSender.get(t)){e.next=5;break}throw new Error("associated RTCRtpSender not found");case 5:return i=n.track,e.next=8,n.replaceTrack(r);case 8:i&&this._sendStream.removeTrack(i),r&&this._sendStream.addTrack(r);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"setMaxSpatialLayer",value:(u=Ve(Fe.mark((function e(t,r){var n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),Do.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",t,r),n=this._mapSendLocalIdRtpSender.get(t)){e.next=5;break}throw new Error("associated RTCRtpSender not found");case 5:return(i=n.getParameters()).encodings.forEach((function(e,t){e.active=t<=r})),e.next=9,n.setParameters(i);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"setRtpEncodingParameters",value:(c=Ve(Fe.mark((function e(t,r){var n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),Do.debug("setRtpEncodingParameters() [localId:%s, params:%o]",t,r),n=this._mapSendLocalIdRtpSender.get(t)){e.next=5;break}throw new Error("associated RTCRtpSender not found");case 5:return(i=n.getParameters()).encodings.forEach((function(e,t){i.encodings[t]=Object.assign(Object.assign({},e),r)})),e.next=9,n.setParameters(i);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"getSenderStats",value:(s=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),r=this._mapSendLocalIdRtpSender.get(t)){e.next=4;break}throw new Error("associated RTCRtpSender not found");case 4:return e.abrupt("return",r.getStats());case 5:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"sendDataChannel",value:(a=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f,h;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.ordered,n=t.maxPacketLifeTime,i=t.maxRetransmits,o=t.label,a=t.protocol,s=t.priority,this._assertSendDirection(),c={negotiated:!0,id:this._nextSendSctpStreamId,ordered:r,maxPacketLifeTime:n,maxRetransmits:i,protocol:a,priority:s},Do.debug("sendDataChannel() [options:%o]",c),u=this._pc.createDataChannel(o,c),this._nextSendSctpStreamId=++this._nextSendSctpStreamId%No.MIS,this._hasDataChannelMediaSection){e.next=24;break}return e.next=9,this._pc.createOffer();case 9:if(d=e.sent,l=jn.parse(d.sdp),p=l.media.find((function(e){return"application"===e.type})),this._transportReady){e.next=15;break}return e.next=15,this._setupTransport({localDtlsRole:"server",localSdpObject:l});case 15:return Do.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",d),e.next=18,this._pc.setLocalDescription(d);case 18:return this._remoteSdp.sendSctpAssociation({offerMediaObject:p}),f={type:"answer",sdp:this._remoteSdp.getSdp()},Do.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",f),e.next=23,this._pc.setRemoteDescription(f);case 23:this._hasDataChannelMediaSection=!0;case 24:return h={streamId:c.id,ordered:c.ordered,maxPacketLifeTime:c.maxPacketLifeTime,maxRetransmits:c.maxRetransmits},e.abrupt("return",{dataChannel:u,sctpStreamParameters:h});case 26:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"receive",value:(o=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.trackId,n=t.kind,i=t.rtpParameters,this._assertRecvDirection(),Do.debug("receive() [trackId:%s, kind:%s]",r,n),o=r,a=n,this._remoteSdp.receive({mid:a,kind:n,offerRtpParameters:i,streamId:i.rtcp.cname,trackId:r}),s={type:"offer",sdp:this._remoteSdp.getSdp()},Do.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",s),e.next=10,this._pc.setRemoteDescription(s);case 10:return e.next=12,this._pc.createAnswer();case 12:if(c=e.sent,u=jn.parse(c.sdp),d=u.media.find((function(e){return String(e.mid)===a})),qn.applyCodecParameters({offerRtpParameters:i,answerMediaObject:d}),c={type:"answer",sdp:jn.write(u)},this._transportReady){e.next=20;break}return e.next=20,this._setupTransport({localDtlsRole:"client",localSdpObject:u});case 20:return Do.debug("receive() | calling pc.setLocalDescription() [answer:%o]",c),e.next=23,this._pc.setLocalDescription(c);case 23:if(l=this._pc.getReceivers().find((function(e){return e.track&&e.track.id===o}))){e.next=26;break}throw new Error("new RTCRtpReceiver not");case 26:return this._mapRecvLocalIdInfo.set(o,{mid:a,rtpParameters:i,rtpReceiver:l}),e.abrupt("return",{localId:o,track:l.track,rtpReceiver:l});case 28:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"stopReceiving",value:(i=Ve(Fe.mark((function e(t){var r,n,i,o,a;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._assertRecvDirection(),Do.debug("stopReceiving() [localId:%s]",t),r=this._mapRecvLocalIdInfo.get(t)||{},n=r.mid,i=r.rtpParameters,this._mapRecvLocalIdInfo.delete(t),this._remoteSdp.planBStopReceiving({mid:n,offerRtpParameters:i}),o={type:"offer",sdp:this._remoteSdp.getSdp()},Do.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",o),e.next=9,this._pc.setRemoteDescription(o);case 9:return e.next=11,this._pc.createAnswer();case 11:return a=e.sent,Do.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",a),e.next=15,this._pc.setLocalDescription(a);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getReceiverStats",value:(n=Ve(Fe.mark((function e(t){var r,n;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertRecvDirection(),r=this._mapRecvLocalIdInfo.get(t)||{},n=r.rtpReceiver){e.next=4;break}throw new Error("associated RTCRtpReceiver not found");case 4:return e.abrupt("return",n.getStats());case 5:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"receiveDataChannel",value:(r=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.sctpStreamParameters,n=t.label,i=t.protocol,this._assertRecvDirection(),o=r.streamId,a=r.ordered,s=r.maxPacketLifeTime,c=r.maxRetransmits,u={negotiated:!0,id:o,ordered:a,maxPacketLifeTime:s,maxRetransmits:c,protocol:i},Do.debug("receiveDataChannel() [options:%o]",u),d=this._pc.createDataChannel(n,u),this._hasDataChannelMediaSection){e.next=23;break}return this._remoteSdp.receiveSctpAssociation({oldDataChannelSpec:!0}),l={type:"offer",sdp:this._remoteSdp.getSdp()},Do.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",l),e.next=12,this._pc.setRemoteDescription(l);case 12:return e.next=14,this._pc.createAnswer();case 14:if(p=e.sent,this._transportReady){e.next=19;break}return f=jn.parse(p.sdp),e.next=19,this._setupTransport({localDtlsRole:"client",localSdpObject:f});case 19:return Do.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",p),e.next=22,this._pc.setLocalDescription(p);case 22:this._hasDataChannelMediaSection=!0;case 23:return e.abrupt("return",{dataChannel:d});case 24:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_setupTransport",value:(t=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.localDtlsRole,(n=t.localSdpObject)||(n=jn.parse(this._pc.localDescription.sdp)),(i=qn.extractDtlsParameters({sdpObject:n})).role=r,this._remoteSdp.updateDtlsRole("client"===r?"server":"client"),e.next=7,this.safeEmitAsPromise("@connect",{dtlsParameters:i});case 7:this._transportReady=!0;case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_assertSendDirection",value:function(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}},{key:"_assertRecvDirection",value:function(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}},{key:"name",get:function(){return"Safari11"}}],[{key:"createFactory",value:function(){return function(){return new E}}}]),E}(ci.HandlerInterface),Po=xo,Lo=Object.defineProperty({Safari11:Po},"__esModule",{value:!0});function Bo(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return Mo(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Mo(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Mo(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Uo=function(){var e,t=RTCRtpReceiver.getCapabilities(),r=mr.clone(t,{}),n=Bo(r.codecs);try{for(n.s();!(e=n.n()).done;){var i=e.value;if(i.channels=i.numChannels,delete i.numChannels,i.mimeType=i.mimeType||"".concat(i.kind,"/").concat(i.name),i.parameters){var o=i.parameters;o.apt&&(o.apt=Number(o.apt)),o["packetization-mode"]&&(o["packetization-mode"]=Number(o["packetization-mode"]))}var a,s=Bo(i.rtcpFeedback||[]);try{for(s.s();!(a=s.n()).done;){var c=a.value;c.parameter||(c.parameter="")}}catch(e){s.e(e)}finally{s.f()}}}catch(e){n.e(e)}finally{n.f()}return r};var Qo=function(e){var t=mr.clone(e,{});t.mid&&(t.muxId=t.mid,delete t.mid);var r,n=Bo(t.codecs);try{for(n.s();!(r=n.n()).done;){var i=r.value;i.channels&&(i.numChannels=i.channels,delete i.channels),i.mimeType&&!i.name&&(i.name=i.mimeType.split("/")[1]),delete i.mimeType}}catch(e){n.e(e)}finally{n.f()}return t},Fo=Object.defineProperty({getCapabilities:Uo,mangleRtpParameters:Qo},"__esModule",{value:!0});function jo(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return Vo(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Vo(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function Vo(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Go(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var Ko=new rr.Logger("Edge11"),Ho=function(e){Ye(E,e);var t,r,n,i,o,a,s,c,u,d,l,p,f,h,A,v,g,m=Go(E);function E(){var e;return Ge(this,E),(e=m.call(this))._rtpSenders=new Map,e._rtpReceivers=new Map,e._nextSendLocalId=0,e._transportReady=!1,e}return He(E,[{key:"close",value:function(){Ko.debug("close()");try{this._iceGatherer.close()}catch(e){}try{this._iceTransport.stop()}catch(e){}try{this._dtlsTransport.stop()}catch(e){}var e,t=jo(this._rtpSenders.values());try{for(t.s();!(e=t.n()).done;){var r=e.value;try{r.stop()}catch(e){}}}catch(e){t.e(e)}finally{t.f()}var n,i=jo(this._rtpReceivers.values());try{for(i.s();!(n=i.n()).done;){var o=n.value;try{o.stop()}catch(e){}}}catch(e){i.e(e)}finally{i.f()}}},{key:"getNativeRtpCapabilities",value:(g=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ko.debug("getNativeRtpCapabilities()"),e.abrupt("return",Fo.getCapabilities());case 2:case"end":return e.stop()}}),e)}))),function(){return g.apply(this,arguments)})},{key:"getNativeSctpCapabilities",value:(v=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Ko.debug("getNativeSctpCapabilities()"),e.abrupt("return",{numStreams:{OS:0,MIS:0}});case 2:case"end":return e.stop()}}),e)}))),function(){return v.apply(this,arguments)})},{key:"run",value:function(e){e.direction;var t=e.iceParameters,r=e.iceCandidates,n=e.dtlsParameters,i=(e.sctpParameters,e.iceServers),o=e.iceTransportPolicy,a=(e.additionalSettings,e.proprietaryConstraints,e.extendedRtpCapabilities);Ko.debug("run()"),this._sendingRtpParametersByKind={audio:nn.getSendingRtpParameters("audio",a),video:nn.getSendingRtpParameters("video",a)},this._remoteIceParameters=t,this._remoteIceCandidates=r,this._remoteDtlsParameters=n,this._cname="CNAME-".concat(mr.generateRandomNumber()),this._setIceGatherer({iceServers:i,iceTransportPolicy:o}),this._setIceTransport(),this._setDtlsTransport()}},{key:"updateIceServers",value:(A=Ve(Fe.mark((function e(t){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Ar.UnsupportedError("not supported");case 1:case"end":return e.stop()}}),e)}))),function(e){return A.apply(this,arguments)})},{key:"restartIce",value:(h=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Ko.debug("restartIce()"),this._remoteIceParameters=t,this._transportReady){e.next=4;break}return e.abrupt("return");case 4:Ko.debug("restartIce() | calling iceTransport.start()"),this._iceTransport.start(this._iceGatherer,t,"controlling"),r=jo(this._remoteIceCandidates);try{for(r.s();!(n=r.n()).done;)i=n.value,this._iceTransport.addRemoteCandidate(i)}catch(e){r.e(e)}finally{r.f()}this._iceTransport.addRemoteCandidate({});case 9:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"getTransportStats",value:(f=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._iceTransport.getStats());case 1:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"send",value:(p=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.track,n=t.encodings,t.codecOptions,i=t.codec,Ko.debug("send() [kind:%s, track.id:%s]",r.kind,r.id),this._transportReady){e.next=5;break}return e.next=5,this._setupTransport({localDtlsRole:"server"});case 5:Ko.debug("send() | calling new RTCRtpSender()"),o=new RTCRtpSender(r,this._dtlsTransport),(a=mr.clone(this._sendingRtpParametersByKind[r.kind],{})).codecs=nn.reduceCodecs(a.codecs,i),s=a.codecs.some((function(e){return/.+\/rtx$/i.test(e.mimeType)})),n||(n=[{}]),c=jo(n);try{for(c.s();!(u=c.n()).done;)(d=u.value).ssrc=mr.generateRandomNumber(),s&&(d.rtx={ssrc:mr.generateRandomNumber()})}catch(e){c.e(e)}finally{c.f()}return a.encodings=n,a.rtcp={cname:this._cname,reducedSize:!0,mux:!0},l=Fo.mangleRtpParameters(a),Ko.debug("send() | calling rtpSender.send() [params:%o]",l),e.next=19,o.send(l);case 19:return p=String(this._nextSendLocalId),this._nextSendLocalId++,this._rtpSenders.set(p,o),e.abrupt("return",{localId:p,rtpParameters:a,rtpSender:o});case 23:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"stopSending",value:(l=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Ko.debug("stopSending() [localId:%s]",t),r=this._rtpSenders.get(t)){e.next=4;break}throw new Error("RTCRtpSender not found");case 4:this._rtpSenders.delete(t),e.prev=5,Ko.debug("stopSending() | calling rtpSender.stop()"),r.stop(),e.next=14;break;case 10:throw e.prev=10,e.t0=e.catch(5),Ko.warn("stopSending() | rtpSender.stop() failed:%o",e.t0),e.t0;case 14:case"end":return e.stop()}}),e,this,[[5,10]])}))),function(e){return l.apply(this,arguments)})},{key:"replaceTrack",value:(d=Ve(Fe.mark((function e(t,r){var n;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r?Ko.debug("replaceTrack() [localId:%s, track.id:%s]",t,r.id):Ko.debug("replaceTrack() [localId:%s, no track]",t),n=this._rtpSenders.get(t)){e.next=4;break}throw new Error("RTCRtpSender not found");case 4:n.setTrack(r);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"setMaxSpatialLayer",value:(u=Ve(Fe.mark((function e(t,r){var n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Ko.debug("setMaxSpatialLayer() [localId:%s, spatialLayer:%s]",t,r),n=this._rtpSenders.get(t)){e.next=4;break}throw new Error("RTCRtpSender not found");case 4:return(i=n.getParameters()).encodings.forEach((function(e,t){e.active=t<=r})),e.next=8,n.setParameters(i);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"setRtpEncodingParameters",value:(c=Ve(Fe.mark((function e(t,r){var n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Ko.debug("setRtpEncodingParameters() [localId:%s, params:%o]",t,r),n=this._rtpSenders.get(t)){e.next=4;break}throw new Error("RTCRtpSender not found");case 4:return(i=n.getParameters()).encodings.forEach((function(e,t){i.encodings[t]=Object.assign(Object.assign({},e),r)})),e.next=8,n.setParameters(i);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"getSenderStats",value:(s=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._rtpSenders.get(t)){e.next=3;break}throw new Error("RTCRtpSender not found");case 3:return e.abrupt("return",r.getStats());case 4:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"sendDataChannel",value:(a=Ve(Fe.mark((function e(t){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Ar.UnsupportedError("not implemented");case 1:case"end":return e.stop()}}),e)}))),function(e){return a.apply(this,arguments)})},{key:"receive",value:(o=Ve(Fe.mark((function e(t){var r,n,i,o,a,s;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.trackId,n=t.kind,i=t.rtpParameters,Ko.debug("receive() [trackId:%s, kind:%s]",r,n),this._transportReady){e.next=5;break}return e.next=5,this._setupTransport({localDtlsRole:"server"});case 5:return Ko.debug("receive() | calling new RTCRtpReceiver()"),(o=new RTCRtpReceiver(this._dtlsTransport,n)).addEventListener("error",(function(e){Ko.error('rtpReceiver "error" event [event:%o]',e)})),a=Fo.mangleRtpParameters(i),Ko.debug("receive() | calling rtpReceiver.receive() [params:%o]",a),e.next=12,o.receive(a);case 12:return s=r,this._rtpReceivers.set(s,o),e.abrupt("return",{localId:s,track:o.track,rtpReceiver:o});case 15:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"stopReceiving",value:(i=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Ko.debug("stopReceiving() [localId:%s]",t),r=this._rtpReceivers.get(t)){e.next=4;break}throw new Error("RTCRtpReceiver not found");case 4:this._rtpReceivers.delete(t);try{Ko.debug("stopReceiving() | calling rtpReceiver.stop()"),r.stop()}catch(e){Ko.warn("stopReceiving() | rtpReceiver.stop() failed:%o",e)}case 6:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getReceiverStats",value:(n=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._rtpReceivers.get(t)){e.next=3;break}throw new Error("RTCRtpReceiver not found");case 3:return e.abrupt("return",r.getStats());case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"receiveDataChannel",value:(r=Ve(Fe.mark((function e(t){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Ar.UnsupportedError("not implemented");case 1:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"_setIceGatherer",value:function(e){var t=e.iceServers,r=e.iceTransportPolicy,n=new RTCIceGatherer({iceServers:t||[],gatherPolicy:r||"all"});n.addEventListener("error",(function(e){Ko.error('iceGatherer "error" event [event:%o]',e)}));try{n.gather()}catch(e){Ko.debug("_setIceGatherer() | iceGatherer.gather() failed: %s",e.toString())}this._iceGatherer=n}},{key:"_setIceTransport",value:function(){var e=this,t=new RTCIceTransport(this._iceGatherer);t.addEventListener("statechange",(function(){switch(t.state){case"checking":e.emit("@connectionstatechange","connecting");break;case"connected":case"completed":e.emit("@connectionstatechange","connected");break;case"failed":e.emit("@connectionstatechange","failed");break;case"disconnected":e.emit("@connectionstatechange","disconnected");break;case"closed":e.emit("@connectionstatechange","closed")}})),t.addEventListener("icestatechange",(function(){switch(t.state){case"checking":e.emit("@connectionstatechange","connecting");break;case"connected":case"completed":e.emit("@connectionstatechange","connected");break;case"failed":e.emit("@connectionstatechange","failed");break;case"disconnected":e.emit("@connectionstatechange","disconnected");break;case"closed":e.emit("@connectionstatechange","closed")}})),t.addEventListener("candidatepairchange",(function(e){Ko.debug('iceTransport "candidatepairchange" event [pair:%o]',e.pair)})),this._iceTransport=t}},{key:"_setDtlsTransport",value:function(){var e=this,t=new RTCDtlsTransport(this._iceTransport);t.addEventListener("statechange",(function(){Ko.debug('dtlsTransport "statechange" event [state:%s]',t.state)})),t.addEventListener("dtlsstatechange",(function(){Ko.debug('dtlsTransport "dtlsstatechange" event [state:%s]',t.state),"closed"===t.state&&e.emit("@connectionstatechange","closed")})),t.addEventListener("error",(function(e){Ko.error('dtlsTransport "error" event [event:%o]',e)})),this._dtlsTransport=t}},{key:"_setupTransport",value:(t=Ve(Fe.mark((function e(t){var r,n,i,o,a;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.localDtlsRole,Ko.debug("_setupTransport()"),(n=this._dtlsTransport.getLocalParameters()).role=r,e.next=6,this.safeEmitAsPromise("@connect",{dtlsParameters:n});case 6:this._iceTransport.start(this._iceGatherer,this._remoteIceParameters,"controlling"),i=jo(this._remoteIceCandidates);try{for(i.s();!(o=i.n()).done;)a=o.value,this._iceTransport.addRemoteCandidate(a)}catch(e){i.e(e)}finally{i.f()}this._iceTransport.addRemoteCandidate({}),this._remoteDtlsParameters.fingerprints=this._remoteDtlsParameters.fingerprints.filter((function(e){return"sha-256"===e.algorithm||"sha-384"===e.algorithm||"sha-512"===e.algorithm})),this._dtlsTransport.start(this._remoteDtlsParameters),this._transportReady=!0;case 13:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"name",get:function(){return"Edge11"}}],[{key:"createFactory",value:function(){return function(){return new E}}}]),E}(ci.HandlerInterface),Wo=Object.defineProperty({Edge11:Ho},"__esModule",{value:!0});function Yo(e,t){var r;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return qo(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return qo(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=e[Symbol.iterator]()},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function qo(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function Jo(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=ze(e);if(t){var i=ze(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return Je(this,r)}}var zo=new rr.Logger("ReactNative"),Xo={OS:1024,MIS:1024},Zo=function(e){Ye(E,e);var t,r,n,i,o,a,s,c,u,d,l,p,f,h,A,v,g,m=Jo(E);function E(){var e;return Ge(this,E),(e=m.call(this))._sendStream=new MediaStream,e._mapSendLocalIdTrack=new Map,e._nextSendLocalId=0,e._mapRecvLocalIdInfo=new Map,e._hasDataChannelMediaSection=!1,e._nextSendSctpStreamId=0,e._transportReady=!1,e}return He(E,[{key:"close",value:function(){if(zo.debug("close()"),this._pc)try{this._pc.close()}catch(e){}}},{key:"getNativeRtpCapabilities",value:(g=Ve(Fe.mark((function e(){var t,r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zo.debug("getNativeRtpCapabilities()"),t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b"}),e.prev=2,e.next=5,t.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});case 5:r=e.sent;try{t.close()}catch(e){}return n=jn.parse(r.sdp),i=qn.extractRtpCapabilities({sdpObject:n}),e.abrupt("return",i);case 12:e.prev=12,e.t0=e.catch(2);try{t.close()}catch(e){}throw e.t0;case 16:case"end":return e.stop()}}),e,null,[[2,12]])}))),function(){return g.apply(this,arguments)})},{key:"getNativeSctpCapabilities",value:(v=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return zo.debug("getNativeSctpCapabilities()"),e.abrupt("return",{numStreams:Xo});case 2:case"end":return e.stop()}}),e)}))),function(){return v.apply(this,arguments)})},{key:"run",value:function(e){var t=this,r=e.direction,n=e.iceParameters,i=e.iceCandidates,o=e.dtlsParameters,a=e.sctpParameters,s=e.iceServers,c=e.iceTransportPolicy,u=e.additionalSettings,d=e.proprietaryConstraints,l=e.extendedRtpCapabilities;zo.debug("run()"),this._direction=r,this._remoteSdp=new bi.RemoteSdp({iceParameters:n,iceCandidates:i,dtlsParameters:o,sctpParameters:a,planB:!0}),this._sendingRtpParametersByKind={audio:nn.getSendingRtpParameters("audio",l),video:nn.getSendingRtpParameters("video",l)},this._sendingRemoteRtpParametersByKind={audio:nn.getSendingRemoteRtpParameters("audio",l),video:nn.getSendingRemoteRtpParameters("video",l)},this._pc=new RTCPeerConnection(Object.assign({iceServers:s||[],iceTransportPolicy:c||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"plan-b"},u),d),this._pc.addEventListener("iceconnectionstatechange",(function(){switch(t._pc.iceConnectionState){case"checking":t.emit("@connectionstatechange","connecting");break;case"connected":case"completed":t.emit("@connectionstatechange","connected");break;case"failed":t.emit("@connectionstatechange","failed");break;case"disconnected":t.emit("@connectionstatechange","disconnected");break;case"closed":t.emit("@connectionstatechange","closed")}}))}},{key:"updateIceServers",value:(A=Ve(Fe.mark((function e(t){var r;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:zo.debug("updateIceServers()"),(r=this._pc.getConfiguration()).iceServers=t,this._pc.setConfiguration(r);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return A.apply(this,arguments)})},{key:"restartIce",value:(h=Ve(Fe.mark((function e(t){var r,n,i,o;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(zo.debug("restartIce()"),this._remoteSdp.updateIceParameters(t),this._transportReady){e.next=4;break}return e.abrupt("return");case 4:if("send"!==this._direction){e.next=17;break}return e.next=7,this._pc.createOffer({iceRestart:!0});case 7:return r=e.sent,zo.debug("restartIce() | calling pc.setLocalDescription() [offer:%o]",r),e.next=11,this._pc.setLocalDescription(r);case 11:return n={type:"answer",sdp:this._remoteSdp.getSdp()},zo.debug("restartIce() | calling pc.setRemoteDescription() [answer:%o]",n),e.next=15,this._pc.setRemoteDescription(n);case 15:e.next=27;break;case 17:return i={type:"offer",sdp:this._remoteSdp.getSdp()},zo.debug("restartIce() | calling pc.setRemoteDescription() [offer:%o]",i),e.next=21,this._pc.setRemoteDescription(i);case 21:return e.next=23,this._pc.createAnswer();case 23:return o=e.sent,zo.debug("restartIce() | calling pc.setLocalDescription() [answer:%o]",o),e.next=27,this._pc.setLocalDescription(o);case 27:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"getTransportStats",value:(f=Ve(Fe.mark((function e(){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._pc.getStats());case 1:case"end":return e.stop()}}),e,this)}))),function(){return f.apply(this,arguments)})},{key:"send",value:(p=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f,h,A;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.track,n=t.encodings,i=t.codecOptions,o=t.codec,this._assertSendDirection(),zo.debug("send() [kind:%s, track.id:%s]",r.kind,r.id),o&&zo.warn("send() | codec selection is not available in %s handler",this.name),this._sendStream.addTrack(r),this._pc.addStream(this._sendStream),e.next=8,this._pc.createOffer();case 8:if(a=e.sent,s=jn.parse(a.sdp),(u=mr.clone(this._sendingRtpParametersByKind[r.kind],{})).codecs=nn.reduceCodecs(u.codecs),(d=mr.clone(this._sendingRemoteRtpParametersByKind[r.kind],{})).codecs=nn.reduceCodecs(d.codecs),this._transportReady){e.next=17;break}return e.next=17,this._setupTransport({localDtlsRole:"server",localSdpObject:s});case 17:return"video"===r.kind&&n&&n.length>1&&(zo.debug("send() | enabling simulcast"),s=jn.parse(a.sdp),c=s.media.find((function(e){return"video"===e.type})),qi.addLegacySimulcast({offerMediaObject:c,track:r,numStreams:n.length}),a={type:"offer",sdp:jn.write(s)}),zo.debug("send() | calling pc.setLocalDescription() [offer:%o]",a),e.next=21,this._pc.setLocalDescription(a);case 21:if(s=jn.parse(this._pc.localDescription.sdp),c=s.media.find((function(e){return e.type===r.kind})),u.rtcp.cname=qn.getCname({offerMediaObject:c}),u.encodings=qi.getRtpEncodings({offerMediaObject:c,track:r}),n)for(l=0;l<u.encodings.length;++l)n[l]&&Object.assign(u.encodings[l],n[l]);if(u.encodings.length>1&&("video/vp8"===u.codecs[0].mimeType.toLowerCase()||"video/h264"===u.codecs[0].mimeType.toLowerCase())){p=Yo(u.encodings);try{for(p.s();!(f=p.n()).done;)f.value.scalabilityMode="S1T3"}catch(e){p.e(e)}finally{p.f()}}return this._remoteSdp.send({offerMediaObject:c,offerRtpParameters:u,answerRtpParameters:d,codecOptions:i}),h={type:"answer",sdp:this._remoteSdp.getSdp()},zo.debug("send() | calling pc.setRemoteDescription() [answer:%o]",h),e.next=32,this._pc.setRemoteDescription(h);case 32:return A=String(this._nextSendLocalId),this._nextSendLocalId++,this._mapSendLocalIdTrack.set(A,r),e.abrupt("return",{localId:A,rtpParameters:u});case 36:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"stopSending",value:(l=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._assertSendDirection(),zo.debug("stopSending() [localId:%s]",t),r=this._mapSendLocalIdTrack.get(t)){e.next=5;break}throw new Error("track not found");case 5:return this._mapSendLocalIdTrack.delete(t),this._sendStream.removeTrack(r),this._pc.addStream(this._sendStream),e.next=10,this._pc.createOffer();case 10:return n=e.sent,zo.debug("stopSending() | calling pc.setLocalDescription() [offer:%o]",n),e.prev=12,e.next=15,this._pc.setLocalDescription(n);case 15:e.next=23;break;case 17:if(e.prev=17,e.t0=e.catch(12),0!==this._sendStream.getTracks().length){e.next=22;break}return zo.warn("stopSending() | ignoring expected error due no sending tracks: %s",e.t0.toString()),e.abrupt("return");case 22:throw e.t0;case 23:if("stable"!==this._pc.signalingState){e.next=25;break}return e.abrupt("return");case 25:return i={type:"answer",sdp:this._remoteSdp.getSdp()},zo.debug("stopSending() | calling pc.setRemoteDescription() [answer:%o]",i),e.next=29,this._pc.setRemoteDescription(i);case 29:case"end":return e.stop()}}),e,this,[[12,17]])}))),function(e){return l.apply(this,arguments)})},{key:"replaceTrack",value:(d=Ve(Fe.mark((function e(t,r){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Ar.UnsupportedError("not implemented");case 1:case"end":return e.stop()}}),e)}))),function(e,t){return d.apply(this,arguments)})},{key:"setMaxSpatialLayer",value:(u=Ve(Fe.mark((function e(t,r){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Ar.UnsupportedError("not implemented");case 1:case"end":return e.stop()}}),e)}))),function(e,t){return u.apply(this,arguments)})},{key:"setRtpEncodingParameters",value:(c=Ve(Fe.mark((function e(t,r){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Ar.UnsupportedError("not implemented");case 1:case"end":return e.stop()}}),e)}))),function(e,t){return c.apply(this,arguments)})},{key:"getSenderStats",value:(s=Ve(Fe.mark((function e(t){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Ar.UnsupportedError("not implemented");case 1:case"end":return e.stop()}}),e)}))),function(e){return s.apply(this,arguments)})},{key:"sendDataChannel",value:(a=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f,h;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.ordered,n=t.maxPacketLifeTime,i=t.maxRetransmits,o=t.label,a=t.protocol,s=t.priority,this._assertSendDirection(),c={negotiated:!0,id:this._nextSendSctpStreamId,ordered:r,maxPacketLifeTime:n,maxRetransmitTime:n,maxRetransmits:i,protocol:a,priority:s},zo.debug("sendDataChannel() [options:%o]",c),u=this._pc.createDataChannel(o,c),this._nextSendSctpStreamId=++this._nextSendSctpStreamId%Xo.MIS,this._hasDataChannelMediaSection){e.next=24;break}return e.next=9,this._pc.createOffer();case 9:if(d=e.sent,l=jn.parse(d.sdp),p=l.media.find((function(e){return"application"===e.type})),this._transportReady){e.next=15;break}return e.next=15,this._setupTransport({localDtlsRole:"server",localSdpObject:l});case 15:return zo.debug("sendDataChannel() | calling pc.setLocalDescription() [offer:%o]",d),e.next=18,this._pc.setLocalDescription(d);case 18:return this._remoteSdp.sendSctpAssociation({offerMediaObject:p}),f={type:"answer",sdp:this._remoteSdp.getSdp()},zo.debug("sendDataChannel() | calling pc.setRemoteDescription() [answer:%o]",f),e.next=23,this._pc.setRemoteDescription(f);case 23:this._hasDataChannelMediaSection=!0;case 24:return h={streamId:c.id,ordered:c.ordered,maxPacketLifeTime:c.maxPacketLifeTime,maxRetransmits:c.maxRetransmits},e.abrupt("return",{dataChannel:u,sctpStreamParameters:h});case 26:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"receive",value:(o=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.trackId,n=t.kind,i=t.rtpParameters,this._assertRecvDirection(),zo.debug("receive() [trackId:%s, kind:%s]",r,n),o=r,a=n,s=i.rtcp.cname,zo.debug("receive() | forcing a random remote streamId to avoid well known bug in react-native-webrtc"),s+="-hack-".concat(mr.generateRandomNumber()),this._remoteSdp.receive({mid:a,kind:n,offerRtpParameters:i,streamId:s,trackId:r}),c={type:"offer",sdp:this._remoteSdp.getSdp()},zo.debug("receive() | calling pc.setRemoteDescription() [offer:%o]",c),e.next=13,this._pc.setRemoteDescription(c);case 13:return e.next=15,this._pc.createAnswer();case 15:if(u=e.sent,d=jn.parse(u.sdp),l=d.media.find((function(e){return String(e.mid)===a})),qn.applyCodecParameters({offerRtpParameters:i,answerMediaObject:l}),u={type:"answer",sdp:jn.write(d)},this._transportReady){e.next=23;break}return e.next=23,this._setupTransport({localDtlsRole:"client",localSdpObject:d});case 23:return zo.debug("receive() | calling pc.setLocalDescription() [answer:%o]",u),e.next=26,this._pc.setLocalDescription(u);case 26:if(p=this._pc.getRemoteStreams().find((function(e){return e.id===s})),f=p.getTrackById(o)){e.next=30;break}throw new Error("remote track not found");case 30:return this._mapRecvLocalIdInfo.set(o,{mid:a,rtpParameters:i}),e.abrupt("return",{localId:o,track:f});case 32:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"stopReceiving",value:(i=Ve(Fe.mark((function e(t){var r,n,i,o,a;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._assertRecvDirection(),zo.debug("stopReceiving() [localId:%s]",t),r=this._mapRecvLocalIdInfo.get(t)||{},n=r.mid,i=r.rtpParameters,this._mapRecvLocalIdInfo.delete(t),this._remoteSdp.planBStopReceiving({mid:n,offerRtpParameters:i}),o={type:"offer",sdp:this._remoteSdp.getSdp()},zo.debug("stopReceiving() | calling pc.setRemoteDescription() [offer:%o]",o),e.next=9,this._pc.setRemoteDescription(o);case 9:return e.next=11,this._pc.createAnswer();case 11:return a=e.sent,zo.debug("stopReceiving() | calling pc.setLocalDescription() [answer:%o]",a),e.next=15,this._pc.setLocalDescription(a);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getReceiverStats",value:(n=Ve(Fe.mark((function e(t){return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:throw new Ar.UnsupportedError("not implemented");case 1:case"end":return e.stop()}}),e)}))),function(e){return n.apply(this,arguments)})},{key:"receiveDataChannel",value:(r=Ve(Fe.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,p,f;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.sctpStreamParameters,n=t.label,i=t.protocol,this._assertRecvDirection(),o=r.streamId,a=r.ordered,s=r.maxPacketLifeTime,c=r.maxRetransmits,u={negotiated:!0,id:o,ordered:a,maxPacketLifeTime:s,maxRetransmitTime:s,maxRetransmits:c,protocol:i},zo.debug("receiveDataChannel() [options:%o]",u),d=this._pc.createDataChannel(n,u),this._hasDataChannelMediaSection){e.next=23;break}return this._remoteSdp.receiveSctpAssociation({oldDataChannelSpec:!0}),l={type:"offer",sdp:this._remoteSdp.getSdp()},zo.debug("receiveDataChannel() | calling pc.setRemoteDescription() [offer:%o]",l),e.next=12,this._pc.setRemoteDescription(l);case 12:return e.next=14,this._pc.createAnswer();case 14:if(p=e.sent,this._transportReady){e.next=19;break}return f=jn.parse(p.sdp),e.next=19,this._setupTransport({localDtlsRole:"client",localSdpObject:f});case 19:return zo.debug("receiveDataChannel() | calling pc.setRemoteDescription() [answer:%o]",p),e.next=22,this._pc.setLocalDescription(p);case 22:this._hasDataChannelMediaSection=!0;case 23:return e.abrupt("return",{dataChannel:d});case 24:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_setupTransport",value:(t=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.localDtlsRole,(n=t.localSdpObject)||(n=jn.parse(this._pc.localDescription.sdp)),(i=qn.extractDtlsParameters({sdpObject:n})).role=r,this._remoteSdp.updateDtlsRole("client"===r?"server":"client"),e.next=7,this.safeEmitAsPromise("@connect",{dtlsParameters:i});case 7:this._transportReady=!0;case 8:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_assertSendDirection",value:function(){if("send"!==this._direction)throw new Error('method can just be called for handlers with "send" direction')}},{key:"_assertRecvDirection",value:function(){if("recv"!==this._direction)throw new Error('method can just be called for handlers with "recv" direction')}},{key:"name",get:function(){return"ReactNative"}}],[{key:"createFactory",value:function(){return function(){return new E}}}]),E}(ci.HandlerInterface),$o=Zo,ea=Object.defineProperty({ReactNative:$o},"__esModule",{value:!0}),ta=new rr.Logger("Device");function ra(){if("object"===("undefined"==typeof navigator?"undefined":Ue(navigator))&&"ReactNative"===navigator.product)return"undefined"==typeof RTCPeerConnection?void ta.warn("this._detectDevice() | unsupported ReactNative without RTCPeerConnection"):(ta.debug("this._detectDevice() | ReactNative handler chosen"),"ReactNative");if("object"!==("undefined"==typeof navigator?"undefined":Ue(navigator))||"string"!=typeof navigator.userAgent)ta.warn("this._detectDevice() | unknown device");else{var e=navigator.userAgent,t=Xt.getParser(e),r=t.getEngine();if(t.satisfies({chrome:">=74",chromium:">=74"}))return"Chrome74";if(t.satisfies({chrome:">=70",chromium:">=70"}))return"Chrome70";if(t.satisfies({chrome:">=67",chromium:">=67"}))return"Chrome67";if(t.satisfies({chrome:">=55",chromium:">=55"}))return"Chrome55";if(t.satisfies({firefox:">=60"}))return"Firefox60";if(t.satisfies({safari:">=12.0"})&&"undefined"!=typeof RTCRtpTransceiver&&RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection"))return"Safari12";if(t.satisfies({safari:">=11"}))return"Safari11";if(t.satisfies({"microsoft edge":">=11"})&&t.satisfies({"microsoft edge":"<=18"}))return"Edge11";if(r.name&&"blink"===r.name.toLowerCase()){var n=e.match(/(?:(?:Chrome|Chromium))[ /](\w+)/i);if(n){var i=Number(n[1]);return i>=74?"Chrome74":i>=70?"Chrome70":i>=67?"Chrome67":"Chrome55"}return"Chrome74"}ta.warn("this._detectDevice() | browser not supported [name:%s, version:%s]",t.getBrowserName(),t.getBrowserVersion())}}var na,ia,oa,aa,sa,ca=ra,ua=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.handlerName,n=t.handlerFactory,i=t.Handler;if(Ge(this,e),this._loaded=!1,this._observer=new sr.EnhancedEventEmitter,ta.debug("constructor()"),i){if(ta.warn("constructor() | Handler option is DEPRECATED, use handlerName or handlerFactory instead"),"string"!=typeof i)throw new TypeError("non string Handler option no longer supported, use handlerFactory instead");r=i}if(r&&n)throw new TypeError("just one of handlerName or handlerInterface can be given");if(n)this._handlerFactory=n;else{if(r)ta.debug("constructor() | handler given: %s",r);else{if(!(r=ra()))throw new Ar.UnsupportedError("device not supported");ta.debug("constructor() | detected handler: %s",r)}switch(r){case"Chrome74":this._handlerFactory=Li.Chrome74.createFactory();break;case"Chrome70":this._handlerFactory=Gi.Chrome70.createFactory();break;case"Chrome67":this._handlerFactory=ro.Chrome67.createFactory();break;case"Chrome55":this._handlerFactory=lo.Chrome55.createFactory();break;case"Firefox60":this._handlerFactory=Eo.Firefox60.createFactory();break;case"Safari12":this._handlerFactory=Ro.Safari12.createFactory();break;case"Safari11":this._handlerFactory=Lo.Safari11.createFactory();break;case"Edge11":this._handlerFactory=Wo.Edge11.createFactory();break;case"ReactNative":this._handlerFactory=ea.ReactNative.createFactory();break;default:throw new TypeError('unknown handlerName "'.concat(r,'"'))}}var o=this._handlerFactory();this._handlerName=o.name,o.close(),this._extendedRtpCapabilities=void 0,this._recvRtpCapabilities=void 0,this._canProduceByKind={audio:!1,video:!1},this._sctpCapabilities=void 0}var t;return He(e,[{key:"load",value:(t=Ve(Fe.mark((function e(t){var r,n,i;return Fe.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.routerRtpCapabilities,ta.debug("load() [routerRtpCapabilities:%o]",r),r=mr.clone(r,void 0),e.prev=3,!this._loaded){e.next=6;break}throw new Ar.InvalidStateError("already loaded");case 6:return nn.validateRtpCapabilities(r),n=this._handlerFactory(),e.next=10,n.getNativeRtpCapabilities();case 10:return i=e.sent,ta.debug("load() | got native RTP capabilities:%o",i),nn.validateRtpCapabilities(i),this._extendedRtpCapabilities=nn.getExtendedRtpCapabilities(i,r),ta.debug("load() | got extended RTP capabilities:%o",this._extendedRtpCapabilities),this._canProduceByKind.audio=nn.canSend("audio",this._extendedRtpCapabilities),this._canProduceByKind.video=nn.canSend("video",this._extendedRtpCapabilities),this._recvRtpCapabilities=nn.getRecvRtpCapabilities(this._extendedRtpCapabilities),nn.validateRtpCapabilities(this._recvRtpCapabilities),ta.debug("load() | got receiving RTP capabilities:%o",this._recvRtpCapabilities),e.next=22,n.getNativeSctpCapabilities();case 22:this._sctpCapabilities=e.sent,ta.debug("load() | got native SCTP capabilities:%o",this._sctpCapabilities),nn.validateSctpCapabilities(this._sctpCapabilities),ta.debug("load() succeeded"),this._loaded=!0,n.close(),e.next=34;break;case 30:throw e.prev=30,e.t0=e.catch(3),n&&n.close(),e.t0;case 34:case"end":return e.stop()}}),e,this,[[3,30]])}))),function(e){return t.apply(this,arguments)})},{key:"canProduce",value:function(e){if(!this._loaded)throw new Ar.InvalidStateError("not loaded");if("audio"!==e&&"video"!==e)throw new TypeError('invalid kind "'.concat(e,'"'));return this._canProduceByKind[e]}},{key:"createSendTransport",value:function(e){var t=e.id,r=e.iceParameters,n=e.iceCandidates,i=e.dtlsParameters,o=e.sctpParameters,a=e.iceServers,s=e.iceTransportPolicy,c=e.additionalSettings,u=e.proprietaryConstraints,d=e.appData,l=void 0===d?{}:d;return ta.debug("createSendTransport()"),this._createTransport({direction:"send",id:t,iceParameters:r,iceCandidates:n,dtlsParameters:i,sctpParameters:o,iceServers:a,iceTransportPolicy:s,additionalSettings:c,proprietaryConstraints:u,appData:l})}},{key:"createRecvTransport",value:function(e){var t=e.id,r=e.iceParameters,n=e.iceCandidates,i=e.dtlsParameters,o=e.sctpParameters,a=e.iceServers,s=e.iceTransportPolicy,c=e.additionalSettings,u=e.proprietaryConstraints,d=e.appData,l=void 0===d?{}:d;return ta.debug("createRecvTransport()"),this._createTransport({direction:"recv",id:t,iceParameters:r,iceCandidates:n,dtlsParameters:i,sctpParameters:o,iceServers:a,iceTransportPolicy:s,additionalSettings:c,proprietaryConstraints:u,appData:l})}},{key:"_createTransport",value:function(e){var t=e.direction,r=e.id,n=e.iceParameters,i=e.iceCandidates,o=e.dtlsParameters,a=e.sctpParameters,s=e.iceServers,c=e.iceTransportPolicy,u=e.additionalSettings,d=e.proprietaryConstraints,l=e.appData,p=void 0===l?{}:l;if(!this._loaded)throw new Ar.InvalidStateError("not loaded");if("string"!=typeof r)throw new TypeError("missing id");if("object"!==Ue(n))throw new TypeError("missing iceParameters");if(!Array.isArray(i))throw new TypeError("missing iceCandidates");if("object"!==Ue(o))throw new TypeError("missing dtlsParameters");if(a&&"object"!==Ue(a))throw new TypeError("wrong sctpParameters");if(p&&"object"!==Ue(p))throw new TypeError("if given, appData must be an object");var f=new xn.Transport({direction:t,id:r,iceParameters:n,iceCandidates:i,dtlsParameters:o,sctpParameters:a,iceServers:s,iceTransportPolicy:c,additionalSettings:u,proprietaryConstraints:d,appData:p,handlerFactory:this._handlerFactory,extendedRtpCapabilities:this._extendedRtpCapabilities,canProduceByKind:this._canProduceByKind});return this._observer.safeEmit("newtransport",f),f}},{key:"handlerName",get:function(){return this._handlerName}},{key:"loaded",get:function(){return this._loaded}},{key:"rtpCapabilities",get:function(){if(!this._loaded)throw new Ar.InvalidStateError("not loaded");return this._recvRtpCapabilities}},{key:"sctpCapabilities",get:function(){if(!this._loaded)throw new Ar.InvalidStateError("not loaded");return this._sctpCapabilities}},{key:"observer",get:function(){return this._observer}}]),e}(),da=Object.defineProperty({detectDevice:ca,Device:ua},"__esModule",{value:!0}),la=(Me((function(e,t){function r(e){for(var r in e)t.hasOwnProperty(r)||(t[r]=e[r])}Object.defineProperty(t,"__esModule",{value:!0}),r(da),r(xn),r(hn),r(mn),r(Sn),r(Rn),r(ci),r(Ar)})),da.Device),pa=da.detectDevice;Ri.parse;!function(e){e.streamPublished="stream-published",e.streamUnpublished="stream-unpublished",e.streamAdded="stream-added",e.streamRemoved="stream-removed",e.streamSubscribed="stream-subscribed",e.streamUnsubscribed="stream-unsubscribed",e.peerOnline="peer-online",e.peerLeave="peer-leave",e.muteAudio="mute-audio",e.unmuteAudio="unmute-audio",e.muteVideo="mute-video",e.unmuteVideo="unmute-video",e.clientBanned="client-banned",e.onTokenPrivilegeWillExpire="onTokenPrivilegeWillExpire",e.onTokenPrivilegeDidExpire="onTokenPrivilegeDidExpire",e.error="error",e.networkTypeChanged="network-type-changed",e.recordingDeviceChanged="recording-device-changed",e.playoutDeviceChanged="playout-device-changed",e.cameraChanged="camera-changed",e.connectionStateChange="connection-state-change",e.mediaReconnectStart="media-reconnect-start",e.mediaReconnectEnd="media-reconnect-end",e.reconnect="reconnect",e.rejoin="rejoin",e.connected="connected",e.networkQuality="network-quality"}(na||(na={})),function(e){e.bluetooth="bluetooth",e.cellular="cellular",e.ethernet="ethernet",e.none="none",e.wifi="wifi",e.wimax="wimax",e.other="other",e.unknown="unknown",e.UNSUPPORTED="UNSUPPORTED"}(ia||(ia={})),function(e){e.ASIA="ASIA",e.CHINA="CHINA",e.EUROPE="EUROPE",e.GLOBAL="GLOBAL",e.INDIA="INDIA",e.JAPAN="JAPAN",e.NORTH_AMERICA="NORTH_AMERICA"}(oa||(oa={})),function(e){e.INIT="init",e.READY="ready",e.JOINING="joining",e.JOINED="joined",e.LEAVING="leaving",e.LEFT="left",e.CLOSED="closed"}(aa||(aa={})),function(e){e[e.host=1]="host",e[e.audience=2]="audience"}(sa||(sa={}));var fa,ha=function(e){k(r,e);var t=xe(r);function r(e,n){var i;return U(this,r),(i=t.call(this)).name="CoreRTCError",i.code=e,i.message=n||"",i}return F(r)}(T(Error));!function(e){e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.UNEXPECTED_RESPONSE="UNEXPECTED_RESPONSE",e.TIMEOUT="TIMEOUT",e.INVALID_PARAMS="INVALID_PARAMS",e.NOT_READABLE="NOT_READABLE",e.NOT_SUPPORTED="NOT_SUPPORTED",e.INVALID_OPERATION="INVALID_OPERATION",e.OPERATION_ABORTED="OPERATION_ABORTED",e.WEB_SECURITY_RESTRICT="WEB_SECURITY_RESTRICT",e.EXCHANGE_SDP_FAILED="EXCHANGE_SDP_FAILED",e.NETWORK_ERROR="NETWORK_ERROR",e.NETWORK_TIMEOUT="NETWORK_TIMEOUT",e.NETWORK_RESPONSE_ERROR="NETWORK_RESPONSE_ERROR",e.API_INVOKE_TIMEOUT="API_INVOKE_TIMEOUT",e.ENUMERATE_DEVICES_FAILED="ENUMERATE_DEVICES_FAILED",e.DEVICE_NOT_FOUND="DEVICE_NOT_FOUND",e.ELECTRON_IS_NULL="ELECTRON_IS_NULL",e.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR="ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR",e.CHROME_PLUGIN_NO_RESPONSE="CHROME_PLUGIN_NO_RESPONSE",e.CHROME_PLUGIN_NOT_INSTALL="CHROME_PLUGIN_NOT_INSTALL",e.MEDIA_OPTION_INVALID="MEDIA_OPTION_INVALID",e.PERMISSION_DENIED="PERMISSION_DENIED",e.CONSTRAINT_NOT_SATISFIED="CONSTRAINT_NOT_SATISFIED",e.TRACK_IS_DISABLED="TRACK_IS_DISABLED",e.GET_VIDEO_ELEMENT_VISIBLE_ERROR="GET_VIDEO_ELEMENT_VISIBLE_ERROR",e.SHARE_AUDIO_NOT_ALLOWED="SHARE_AUDIO_NOT_ALLOWED",e.LOW_STREAM_ENCODING_ERROR="LOW_STREAM_ENCODING_ERROR",e.SET_ENCODING_PARAMETER_ERROR="SET_ENCODING_PARAMETER_ERROR",e.TRACK_STATE_UNREACHABLE="TRACK_STATE_UNREACHABLE",e.INVALID_UINT_UID_FROM_STRING_UID="INVALID_UINT_UID_FROM_STRING_UID",e.CAN_NOT_GET_PROXY_SERVER="CAN_NOT_GET_PROXY_SERVER",e.CAN_NOT_GET_GATEWAY_SERVER="CAN_NOT_GET_GATEWAY_SERVER",e.VOID_GATEWAY_ADDRESS="VOID_GATEWAY_ADDRESS",e.UID_CONFLICT="UID_CONFLICT",e.MULTI_UNILBS_RESPONSE_ERROR="MULTI_UNILBS_RESPONSE_ERROR",e.UPDATE_TICKET_FAILED="UPDATE_TICKET_FAILED",e.INVALID_LOCAL_TRACK="INVALID_LOCAL_TRACK",e.INVALID_TRACK="INVALID_TRACK",e.SENDER_NOT_FOUND="SENDER_NOT_FOUND",e.CREATE_OFFER_FAILED="CREATE_OFFER_FAILED",e.SET_ANSWER_FAILED="SET_ANSWER_FAILED",e.ICE_FAILED="ICE_FAILED",e.PC_CLOSED="PC_CLOSED",e.SENDER_REPLACE_FAILED="SENDER_REPLACE_FAILED",e.GET_LOCAL_CAPABILITIES_FAILED="GET_LOCAL_CAPABILITIES_FAILED",e.GET_LOCAL_CONNECTION_PARAMS_FAILED="GET_LOCAL_CONNECTION_PARAMS_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.GATEWAY_P2P_LOST="GATEWAY_P2P_LOST",e.NO_ICE_CANDIDATE="NO_ICE_CANDIDATE",e.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS="CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS",e.EXIST_DISABLED_VIDEO_TRACK="EXIST_DISABLED_VIDEO_TRACK",e.INVALID_REMOTE_USER="INVALID_REMOTE_USER",e.REMOTE_USER_IS_NOT_PUBLISHED="REMOTE_USER_IS_NOT_PUBLISHED",e.CUSTOM_REPORT_SEND_FAILED="CUSTOM_REPORT_SEND_FAILED",e.CUSTOM_REPORT_FREQUENCY_TOO_HIGH="CUSTOM_REPORT_FREQUENCY_TOO_HIGH",e.FETCH_AUDIO_FILE_FAILED="FETCH_AUDIO_FILE_FAILED",e.READ_LOCAL_AUDIO_FILE_ERROR="READ_LOCAL_AUDIO_FILE_ERROR",e.DECODE_AUDIO_FILE_FAILED="DECODE_AUDIO_FILE_FAILED",e.WS_ABORT="WS_ABORT",e.WS_DISCONNECT="WS_DISCONNECT",e.WS_ERR="WS_ERR",e.LIVE_STREAMING_TASK_CONFLICT="LIVE_STREAMING_TASK_CONFLICT",e.LIVE_STREAMING_INVALID_ARGUMENT="LIVE_STREAMING_INVALID_ARGUMENT",e.LIVE_STREAMING_INTERNAL_SERVER_ERROR="LIVE_STREAMING_INTERNAL_SERVER_ERROR",e.LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED="LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED",e.LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED="LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED",e.LIVE_STREAMING_CDN_ERROR="LIVE_STREAMING_CDN_ERROR",e.LIVE_STREAMING_INVALID_RAW_STREAM="LIVE_STREAMING_INVALID_RAW_STREAM",e.LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT="LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT",e.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE="LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE",e.LIVE_STREAMING_WARN_FREQUENT_REQUEST="LIVE_STREAMING_WARN_FREQUENT_REQUEST",e.WEBGL_INTERNAL_ERROR="WEBGL_INTERNAL_ERROR",e.BEAUTY_PROCESSOR_INTERNAL_ERROR="BEAUTY_PROCESSOR_INTERNAL_ERROR",e.CROSS_CHANNEL_WAIT_STATUS_ERROR="CROSS_CHANNEL_WAIT_STATUS_ERROR",e.CROSS_CHANNEL_FAILED_JOIN_SRC="CROSS_CHANNEL_FAILED_JOIN_SEC",e.CROSS_CHANNEL_FAILED_JOIN_DEST="CROSS_CHANNEL_FAILED_JOIN_DEST",e.CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST="CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST",e.CROSS_CHANNEL_SERVER_ERROR_RESPONSE="CROSS_CHANNEL_SERVER_ERROR_RESPONSE",e.METADATA_OUT_OF_RANGE="METADATA_OUT_OF_RANGE",e.LOCAL_AEC_ERROR="LOCAL_AEC_ERROR",e.INVALID_PLUGIN="INVALID_PLUGIN",e.DISCONNECT_P2P="DISCONNECT_P2P",e.CHECK_VIDEO_TRACK_ERROR="CHECK_VIDEO_TRACK_ERROR"}(fa||(fa={}));var Aa=ga,va=null;try{va=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function ga(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function ma(e){return!0===(e&&e.__isLong__)}ga.prototype.__isLong__,Object.defineProperty(ga.prototype,"__isLong__",{value:!0}),ga.isLong=ma;var Ea={},_a={};function ya(e,t){var r,n,i;return t?(i=0<=(e>>>=0)&&e<256)&&(n=_a[e])?n:(r=Sa(e,(0|e)<0?-1:0,!0),i&&(_a[e]=r),r):(i=-128<=(e|=0)&&e<128)&&(n=Ea[e])?n:(r=Sa(e,e<0?-1:0,!1),i&&(Ea[e]=r),r)}function Ia(e,t){if(isNaN(e))return t?Na:Da;if(t){if(e<0)return Na;if(e>=Ta)return Ma}else{if(e<=-ka)return Ua;if(e+1>=ka)return Ba}return e<0?Ia(-e,t).neg():Sa(e%Ra|0,e/Ra|0,t)}function Sa(e,t,r){return new ga(e,t,r)}ga.fromInt=ya,ga.fromNumber=Ia,ga.fromBits=Sa;var ba=Math.pow;function Ca(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return Da;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===n)return Ca(e.substring(1),t,r).neg();for(var i=Ia(ba(r,8)),o=Da,a=0;a<e.length;a+=8){var s=Math.min(8,e.length-a),c=parseInt(e.substring(a,a+s),r);if(s<8){var u=Ia(ba(r,s));o=o.mul(u).add(Ia(c))}else o=(o=o.mul(i)).add(Ia(c))}return o.unsigned=t,o}function wa(e,t){return"number"==typeof e?Ia(e,t):"string"==typeof e?Ca(e,t):Sa(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}ga.fromString=Ca,ga.fromValue=wa;var Ra=4294967296,Ta=Ra*Ra,ka=Ta/2,Oa=ya(1<<24),Da=ya(0);ga.ZERO=Da;var Na=ya(0,!0);ga.UZERO=Na;var xa=ya(1);ga.ONE=xa;var Pa=ya(1,!0);ga.UONE=Pa;var La=ya(-1);ga.NEG_ONE=La;var Ba=Sa(-1,2147483647,!1);ga.MAX_VALUE=Ba;var Ma=Sa(-1,-1,!0);ga.MAX_UNSIGNED_VALUE=Ma;var Ua=Sa(0,-2147483648,!1);ga.MIN_VALUE=Ua;var Qa=ga.prototype;Qa.toInt=function(){return this.unsigned?this.low>>>0:this.low},Qa.toNumber=function(){return this.unsigned?(this.high>>>0)*Ra+(this.low>>>0):this.high*Ra+(this.low>>>0)},Qa.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(Ua)){var t=Ia(e),r=this.div(t),n=r.mul(t).sub(this);return r.toString(e)+n.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var i=Ia(ba(e,6),this.unsigned),o=this,a="";;){var s=o.div(i),c=(o.sub(s.mul(i)).toInt()>>>0).toString(e);if((o=s).isZero())return c+a;for(;c.length<6;)c="0"+c;a=""+c+a}},Qa.getHighBits=function(){return this.high},Qa.getHighBitsUnsigned=function(){return this.high>>>0},Qa.getLowBits=function(){return this.low},Qa.getLowBitsUnsigned=function(){return this.low>>>0},Qa.getNumBitsAbs=function(){if(this.isNegative())return this.eq(Ua)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},Qa.isZero=function(){return 0===this.high&&0===this.low},Qa.eqz=Qa.isZero,Qa.isNegative=function(){return!this.unsigned&&this.high<0},Qa.isPositive=function(){return this.unsigned||this.high>=0},Qa.isOdd=function(){return 1==(1&this.low)},Qa.isEven=function(){return 0==(1&this.low)},Qa.equals=function(e){return ma(e)||(e=wa(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},Qa.eq=Qa.equals,Qa.notEquals=function(e){return!this.eq(e)},Qa.neq=Qa.notEquals,Qa.ne=Qa.notEquals,Qa.lessThan=function(e){return this.comp(e)<0},Qa.lt=Qa.lessThan,Qa.lessThanOrEqual=function(e){return this.comp(e)<=0},Qa.lte=Qa.lessThanOrEqual,Qa.le=Qa.lessThanOrEqual,Qa.greaterThan=function(e){return this.comp(e)>0},Qa.gt=Qa.greaterThan,Qa.greaterThanOrEqual=function(e){return this.comp(e)>=0},Qa.gte=Qa.greaterThanOrEqual,Qa.ge=Qa.greaterThanOrEqual,Qa.compare=function(e){if(ma(e)||(e=wa(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},Qa.comp=Qa.compare,Qa.negate=function(){return!this.unsigned&&this.eq(Ua)?Ua:this.not().add(xa)},Qa.neg=Qa.negate,Qa.add=function(e){ma(e)||(e=wa(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,i=65535&this.low,o=e.high>>>16,a=65535&e.high,s=e.low>>>16,c=0,u=0,d=0,l=0;return d+=(l+=i+(65535&e.low))>>>16,u+=(d+=n+s)>>>16,c+=(u+=r+a)>>>16,c+=t+o,Sa((d&=65535)<<16|(l&=65535),(c&=65535)<<16|(u&=65535),this.unsigned)},Qa.subtract=function(e){return ma(e)||(e=wa(e)),this.add(e.neg())},Qa.sub=Qa.subtract,Qa.multiply=function(e){if(this.isZero())return Da;if(ma(e)||(e=wa(e)),va)return Sa(va.mul(this.low,this.high,e.low,e.high),va.get_high(),this.unsigned);if(e.isZero())return Da;if(this.eq(Ua))return e.isOdd()?Ua:Da;if(e.eq(Ua))return this.isOdd()?Ua:Da;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(Oa)&&e.lt(Oa))return Ia(this.toNumber()*e.toNumber(),this.unsigned);var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,i=65535&this.low,o=e.high>>>16,a=65535&e.high,s=e.low>>>16,c=65535&e.low,u=0,d=0,l=0,p=0;return l+=(p+=i*c)>>>16,d+=(l+=n*c)>>>16,l&=65535,d+=(l+=i*s)>>>16,u+=(d+=r*c)>>>16,d&=65535,u+=(d+=n*s)>>>16,d&=65535,u+=(d+=i*a)>>>16,u+=t*c+r*s+n*a+i*o,Sa((l&=65535)<<16|(p&=65535),(u&=65535)<<16|(d&=65535),this.unsigned)},Qa.mul=Qa.multiply,Qa.divide=function(e){if(ma(e)||(e=wa(e)),e.isZero())throw Error("division by zero");var t,r,n;if(va)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?Sa((this.unsigned?va.div_u:va.div_s)(this.low,this.high,e.low,e.high),va.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?Na:Da;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return Na;if(e.gt(this.shru(1)))return Pa;n=Na}else{if(this.eq(Ua))return e.eq(xa)||e.eq(La)?Ua:e.eq(Ua)?xa:(t=this.shr(1).div(e).shl(1)).eq(Da)?e.isNegative()?xa:La:(r=this.sub(e.mul(t)),n=t.add(r.div(e)));if(e.eq(Ua))return this.unsigned?Na:Da;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();n=Da}for(r=this;r.gte(e);){t=Math.max(1,Math.floor(r.toNumber()/e.toNumber()));for(var i=Math.ceil(Math.log(t)/Math.LN2),o=i<=48?1:ba(2,i-48),a=Ia(t),s=a.mul(e);s.isNegative()||s.gt(r);)s=(a=Ia(t-=o,this.unsigned)).mul(e);a.isZero()&&(a=xa),n=n.add(a),r=r.sub(s)}return n},Qa.div=Qa.divide,Qa.modulo=function(e){return ma(e)||(e=wa(e)),va?Sa((this.unsigned?va.rem_u:va.rem_s)(this.low,this.high,e.low,e.high),va.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},Qa.mod=Qa.modulo,Qa.rem=Qa.modulo,Qa.not=function(){return Sa(~this.low,~this.high,this.unsigned)},Qa.and=function(e){return ma(e)||(e=wa(e)),Sa(this.low&e.low,this.high&e.high,this.unsigned)},Qa.or=function(e){return ma(e)||(e=wa(e)),Sa(this.low|e.low,this.high|e.high,this.unsigned)},Qa.xor=function(e){return ma(e)||(e=wa(e)),Sa(this.low^e.low,this.high^e.high,this.unsigned)},Qa.shiftLeft=function(e){return ma(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?Sa(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):Sa(0,this.low<<e-32,this.unsigned)},Qa.shl=Qa.shiftLeft,Qa.shiftRight=function(e){return ma(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?Sa(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):Sa(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},Qa.shr=Qa.shiftRight,Qa.shiftRightUnsigned=function(e){if(ma(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?Sa(this.low>>>e|t<<32-e,t>>>e,this.unsigned):Sa(32===e?t:t>>>e-32,0,this.unsigned)},Qa.shru=Qa.shiftRightUnsigned,Qa.shr_u=Qa.shiftRightUnsigned,Qa.toSigned=function(){return this.unsigned?Sa(this.low,this.high,!1):this},Qa.toUnsigned=function(){return this.unsigned?this:Sa(this.low,this.high,!0)},Qa.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},Qa.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},Qa.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},ga.fromBytes=function(e,t,r){return r?ga.fromBytesLE(e,t):ga.fromBytesBE(e,t)},ga.fromBytesLE=function(e,t){return new ga(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},ga.fromBytesBE=function(e,t){return new ga(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)};var Fa=[],ja=navigator.mediaDevices||{enumerateDevices:function(){return Promise.resolve([])},getUserMedia:function(){return Promise.reject("Unsupport error.")},addEventListener:function(){},removeEventListener:function(){},ondevicechange:function(){}},Va={"90p":Ga(160,90),"90p_1":Ga(160,90),"120p":Ga(160,120,15,30,65),"120p_1":Ga(160,120,15,30,65),"120p_3":Ga(120,120,15,30,50),"120p_4":Ga(212,120),"180p":Ga(320,180,15,30,140),"180p_1":Ga(320,180,15,30,140),"180p_3":Ga(180,180,15,30,100),"180p_4":Ga(240,180,15,30,120),"240p":Ga(320,240,15,40,200),"240p_1":Ga(320,240,15,40,200),"240p_3":Ga(240,240,15,40,140),"240p_4":Ga(424,240,15,40,220),"360p":Ga(640,360,15,80,400),"360p_1":Ga(640,360,15,80,400),"360p_3":Ga(360,360,15,80,260),"360p_4":Ga(640,360,30,80,600),"360p_6":Ga(360,360,30,80,400),"360p_7":Ga(480,360,15,80,320),"360p_8":Ga(480,360,30,80,490),"360p_9":Ga(640,360,15,80,800),"360p_10":Ga(640,360,24,80,800),"360p_11":Ga(640,360,24,80,1e3),"480p":Ga(640,480,15,100,500),"480p_1":Ga(640,480,15,100,500),"480p_2":Ga(640,480,30,100,1e3),"480p_3":Ga(480,480,15,100,400),"480p_4":Ga(640,480,30,100,750),"480p_6":Ga(480,480,30,100,600),"480p_8":Ga(848,480,15,100,610),"480p_9":Ga(848,480,30,100,930),"480p_10":Ga(640,480,10,100,400),"720p":Ga(1280,720,15,120,1130),"720p_1":Ga(1280,720,15,120,1130),"720p_2":Ga(1280,720,30,120,2e3),"720p_3":Ga(1280,720,30,120,1710),"720p_5":Ga(960,720,15,120,910),"720p_6":Ga(960,720,30,120,1380),"1080p":Ga(1920,1080,15,120,2080),"1080p_1":Ga(1920,1080,15,120,2080),"1080p_2":Ga(1920,1080,30,120,3e3),"1080p_3":Ga(1920,1080,30,120,3150),"1080p_5":Ga(1920,1080,60,120,4780),"1440p":Ga(2560,1440,30,120,4850),"1440p_1":Ga(2560,1440,30,120,4850),"1440p_2":Ga(2560,1440,60,120,7350),"4k":Ga(3840,2160,30,120,8910),"4k_1":Ga(3840,2160,30,120,8910),"4k_3":Ga(3840,2160,60,120,13500)};function Ga(e,t,r,n,i){return{width:e,height:t,frameRate:r,bitrateMin:n,bitrateMax:i}}var Ka=function(e){return new Promise((function(t){ja.enumerateDevices().then((function(r){r=r.filter((function(t){return t.kind===e})),t(r)}))}))},Ha=function(e){return Pe(void 0,void 0,void 0,G.mark((function t(){var r,n,i;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){t.next=2;break}throw new ha(fa.NOT_SUPPORTED,"can not find getUserMedia");case 2:return r=e.video,n=e.audio,t.next=5,navigator.mediaDevices.getUserMedia({video:r,audio:n});case 5:return i=t.sent,t.abrupt("return",i);case 7:case"end":return t.stop()}}),t)})))},Wa=Zt.getParser(window.navigator.userAgent);function Ya(){var e;return za()&&es()&&(e="undefined"!=typeof RTCRtpTransceiver&&RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection")?"Safari12":"Safari11"),e}function qa(){return"firefox"===Wa.getBrowserName(!0)}function Ja(){return"safari"===Wa.getBrowserName(!0)}function za(){return"ios"===Wa.getOSName(!0)}function Xa(){return Ja()&&navigator.maxTouchPoints>0}function Za(){return"android"===Wa.getOSName(!0)}function $a(){return"chrome"===Wa.getBrowserName(!0)}function es(){return"wechat"===Wa.getBrowserName(!0)}function ts(){return"safari"===Wa.getBrowserName(!0)&&15===parseInt(Wa.getBrowserVersion())}function rs(e){return new Promise((function(t){window.setTimeout(t,e)}))}function ns(){for(var e=[],t="0123456789abcdef",r=0;r<36;r++)e[r]=t.substr(Math.floor(16*Math.random()),1);return e[14]="4",e[19]=t.substr(3&e[19]|8,1),e[8]=e[13]=e[18]=e[23]="-",e.join("")}function is(e){return"boolean"==typeof e}function os(e,t,r,n){var i={eType:1,mProtocolMsg:{sClientVer:"V6.0.8_Apr_13_2022",eUEType:6,sAppID:t,nUserID:r,sConnectID:n,bReConnect:!1}};return new Promise((function(n,o){var a=Date.now(),s=0,c=0,u=new WebSocket(e);u.onmessage=function(i){var d,l,p;try{var f=JSON.parse(i.data);if(1!==f.eResult)throw new Error(i.data);if((null===(l=null===(d=f.mProtocolMsg)||void 0===d?void 0:d.mGWIpAddrMsgList)||void 0===l?void 0:l.length)<=0)throw new Error("Invalid msg ".concat(i.data));var h=f.mProtocolMsg.mGWIpAddrMsgList[0],A=null===(p=null==h?void 0:h.sDomain)||void 0===p?void 0:p.trim();if(!A||""===A)throw new Error("Invalid domain ".concat(A));u.close(),c=Date.now()-a,n({domain:A,ip:h.sIp,port:h.nPort,sendIpLocDur:c,linkIpLocDur:s})}catch(n){u.close(),o("iplocation fail - appId: ".concat(t,", userId: ").concat(r,", iplocUrl: ").concat(e,", ").concat(n))}},u.onopen=function(){s=Date.now()-a,a=Date.now(),u.send(JSON.stringify(i))},u.onerror=function(){o("")}}))}function as(e){return Pe(this,void 0,void 0,G.mark((function t(){var r,n;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia){t.next=2;break}throw new ha(fa.NOT_SUPPORTED,"can not find getDisplayMedia");case 2:return r={width:e.screen.width,height:e.screen.height,frameRate:e.screen.frameRate,displaySurface:"screen"===e.screen.mediaSource?"monitor":e.screen.mediaSource},t.next=5,navigator.mediaDevices.getDisplayMedia({video:r,audio:e.screenAudio});case 5:return n=t.sent,t.abrupt("return",n);case 7:case"end":return t.stop()}}),t)})))}function ss(e,t,r){return{width:{max:e},height:{max:t},frameRate:r}}var cs={"480p":ss(640,480,5),"480p_1":ss(640,480,5),"480p_2":ss(640,480,30),"480p_3":ss(640,480,15),"720p":ss(1280,720,5),"720p_1":ss(1280,720,5),"720p_2":ss(1280,720,30),"720p_3":ss(1280,720,15),"1080p":ss(1920,1080,5),"1080p_1":ss(1920,1080,5),"1080p_2":ss(1920,1080,30),"1080p_3":ss(1920,1080,15)};function us(e){return"string"==typeof e?Object.assign({},cs[e]):e}var ds=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"disable";return Pe(void 0,void 0,void 0,G.mark((function r(){var n,i,o,a;return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return e.encoderConfig?"string"==typeof e.encoderConfig||e.encoderConfig.width&&e.encoderConfig.height||(e.encoderConfig.width={max:1920},e.encoderConfig.height={max:1080}):e.encoderConfig="1080p_2",n=us(e.encoderConfig),r.prev=2,r.next=5,as({screen:n,screenAudio:"auto"===t||"enable"===t});case 5:a=r.sent,i=a.getVideoTracks()[0]||null,o=a.getAudioTracks()[0]||null,r.next=13;break;case 10:r.prev=10,r.t0=r.catch(2),console.error(r.t0);case 13:if(i){r.next=15;break}throw new ha(fa.UNEXPECTED_ERROR,"can not find track in media stream");case 15:return r.abrupt("return",[i,o]);case 16:case"end":return r.stop()}}),r,null,[[2,10]])})))};function ls(e){var t={};if(e.AEC&&(t.echoCancellation=e.AEC),e.AGC&&(t.autoGainControl=e.AGC),e.ANS&&(t.noiseSuppression=e.ANS),e.microphoneId&&(t.deviceId=e.microphoneId),!e.encoderConfig)return t;var r=hs(e.encoderConfig);return Object.assign(Object.assign({},t),r)}var ps={speech_low_quality:fs(16e3,!1,18),speech_standard:fs(32e3,!1,18),music_standard:fs(48e3,!1,18),standard_stereo:fs(48e3,!0,56),high_quality:fs(48e3,!1,128),high_quality_stereo:fs(48e3,!0,192)};function fs(e,t,r){return{sampleRate:e,stereo:t?2:1,bitrate:r}}var hs=function(e){return"string"==typeof e?ps[e]:{stereo:e.stereo,sampleRate:e.sampleRate,sampleSize:e.sampleSize,bitrate:e.bitrate}};function As(e){var t,r,n,i={},o={bitrateMin:100,bitrateMax:500};if(e.facingMode&&(i.facingMode={exact:e.facingMode}),e.cameraId&&(i.deviceId=e.cameraId),"string"==typeof e.encoderConfig){var a=Va[e.encoderConfig];Object.assign(i,a),i.width=a.width,i.height=a.height,i.frameRate=a.frameRate,a.bitrateMax&&(o.bitrateMax=a.bitrateMax),a.bitrateMin&&(o.bitrateMin=a.bitrateMin)}else if("object"===D(e.encoderConfig)){var s=e.encoderConfig;i.width=s.width,i.height=s.height,i.frameRate=s.frameRate||15,(null===(t=null==e?void 0:e.encoderConfig)||void 0===t?void 0:t.bitrateMax)&&(o.bitrateMax=null===(r=e.encoderConfig)||void 0===r?void 0:r.bitrateMax),(null===(n=null==e?void 0:e.encoderConfig)||void 0===n?void 0:n.bitrateMin)&&(o.bitrateMin=e.encoderConfig.bitrateMin)}return{trackConfig:i,encoderConfig:o}}var vs,gs,ms,Es=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"POST";return new Promise((function(n,i){var o=new XMLHttpRequest;o.timeout=3e3,o.open(r,e),o.onreadystatechange=function(){o.readyState<4||(o.status>199&&o.status<300?n():i())},o.send(t)}))};!function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARNING=2]="WARNING",e[e.ERROR=3]="ERROR",e[e.NONE=4]="NONE"}(ms||(ms={}));var _s=!!(null===(gs=null===(vs=window.process)||void 0===vs?void 0:vs.versions)||void 0===gs?void 0:gs.electron),ys=function(){function e(t){U(this,e);var r=new Date(Date.now()+288e5).toISOString().split("T")[0].replace(/-/g,"");this.namespace=t,this.name="".concat(t).concat(r,".log");var n=window.require("fs"),i=window.require("path"),o=window.require("os");this.EOL=o.EOL,this.wStream=n.createWriteStream(i.join(e.location,this.name))}return F(e,[{key:"write",value:function(e){var t=(new Date).toLocaleString();this.wStream.write("".concat(t," ").concat(e).concat(this.EOL))}}]),e}();ys.location=function(){if(!_s)return"";var e=window.require("path"),t=window.require("os"),r=window.require("fs"),n=window.require("process"),i="TalWebRTC",o=t.platform(),a="";if("darwin"===o?a=e.join(t.homedir(),"Library/Application Support/",i):"win32"===o?a=e.join(n.env.APPDATA,i):"linux"===o&&(a=e.join(n.env.XDG_CONFIG_HOME||e.join(t.homedir(),".config"),i)),a)try{r.statSync(a).isDirectory()||r.mkdirSync(a)}catch(e){"ENOENT"===e.code?r.mkdirSync(a):a=""}return a}();var Is=he("CoreSDK"),Ss=_s?new ys("CoreSDK"):void 0,bs=function(){function e(t){var r=this;U(this,e),this.logs=[],this._debug=Is.extend(t),this._info=Is.extend("INFO").extend(t),this._warn=Is.extend("WARNING").extend(t),this._error=Is.extend("ERROR").extend(t),this._debug.log=console.debug.bind(console),this._info.log=console.info.bind(console),this._warn.log=console.warn.bind(console),this._error.log=console.error.bind(console),Ss&&(this.debug=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r._debug.apply(r,[""].concat(t)),Ss.write("[DEBUG] "+t.join(" "))},this.info=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r._info.apply(r,[""].concat(t)),Ss.write("[INFO] "+t.join(" "))},this.warn=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r._warn.apply(r,[""].concat(t)),Ss.write("[WARN] "+t.join(" "))},this.error=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];r._error.apply(r,[""].concat(t)),Ss.write("[ERROR] "+t.join(" "))})}return F(e,[{key:"addLogCache",value:function(t){if(this.baseinfo){var r=Object.assign(Object.assign({},this.baseinfo),t);e.logCache.push(r)}else this.logs.push(t)}},{key:"setClientRoleInfo",value:function(e){this.baseinfo&&(this.baseinfo.uRole=e)}},{key:"setClientInfo",value:function(e){var t=this;this.baseinfo=e,this.logs.forEach((function(e){t.addLogCache(e)})),this.logs=[]}},{key:"debug",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._debug.apply(this,[""].concat(t))}},{key:"info",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._info.apply(this,[""].concat(t))}},{key:"warn",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._warn.apply(this,[""].concat(t))}},{key:"error",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this._error.apply(this,[""].concat(t))}}],[{key:"setLogLevel",value:function(e){var t=localStorage.debug||"";he.disable();var r=t.split(",");r=r.filter((function(e){return"CoreSDK"!==e.split(":")[0]}));var n="".concat("CoreSDK",":*"),i="".concat("CoreSDK",":INFO:*"),o="".concat("CoreSDK",":WARNING:*"),a="".concat("CoreSDK",":ERROR:*");switch(e){case ms.DEBUG:r.push(n);break;case ms.INFO:r.push(i),r.push(o),r.push(a);break;case ms.WARNING:r.push(o),r.push(a);break;case ms.ERROR:r.push(a);break;case ms.NONE:break;default:throw new Error("Can't set logLevel ".concat(e))}he.enable(r.join(","))}},{key:"enableLogUpload",value:function(){e._isUpload=!0}},{key:"disableLogUpload",value:function(){e._isUpload=!1}},{key:"uploadLog",value:function(){if(e._isUpload){var t=e.logCache.shift();if(t){var r="event=".concat(t.event," ").concat(JSON.stringify(t));Es("https://serverlog.eaydu.com:15100",r).then(e.uploadLog).catch((function(){e.logCache.push(t),setTimeout(e.uploadLog,3e3)}))}else setTimeout(e.uploadLog,1e3)}}}]),e}();bs.logCache=[],bs.DEBUG=ms.DEBUG,bs.INFO=ms.INFO,bs.WARNING=ms.WARNING,bs.ERROR=ms.ERROR,bs.NONE=ms.NONE,bs._isUpload=!0;var Cs=function(e){k(r,bs);var t=xe(r);function r(e){var n;return U(this,r),(n=t.call(this,e)).UserFuncLogsArray=new Set,n.UserCallbackLogsArray=new Set,n._idx=0,n.monitUserCallback=function(e){n.UserCallbackLogsArray.add(Object.assign(Object.assign({},e),{idx:n.idx}))},setInterval((function(){n.monitCallback(),n.monitFunc()}),2e3),n}return F(r,[{key:"idx",get:function(){return this._idx+=1}},{key:"monitUserFunc",value:function(e){this.UserFuncLogsArray.add(Object.assign(Object.assign({},e),{idx:this.idx}))}},{key:"monitFunc",value:function(){var e=Array.from(this.UserFuncLogsArray);if(e.length>0){var t=new qt(e);this.addLogCache(t)}this.UserFuncLogsArray.clear()}},{key:"userInvoke",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];this.info(e,r.join(" "));var i=new Wt(e,r.join(" "));this.monitUserFunc(i)}},{key:"userCallback",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];this.info(e,r.join(" "));var i=new Yt(e,r.join(" "));this.monitUserCallback(i)}},{key:"monitCallback",value:function(){var e=Array.from(this.UserCallbackLogsArray);if(e.length>0){var t=new Jt(e);this.addLogCache(t)}this.UserCallbackLogsArray.clear()}},{key:"send",value:function(e){this.addLogCache(e)}}]),r}();bs.uploadLog();var ws,Rs=F((function e(){U(this,e),this.audio={},this.video={},this.availableOutgoingBitrate=0,this.bitrate=0,this.bytesReceived=0,this.bytesSent=0,this.currentRoundTripTime=0,this.nominated=!1,this.priority=0,this.requestsReceived=0,this.requestsSent=0,this.responsesReceived=0,this.responsesSent=0,this.state="",this.totalRoundTripTime=0,this.networkType="UNSUPPORTED",this.timestamp=Date.now()})),Ts=F((function e(){U(this,e),this.bytesSent=0,this.bytesReceived=0,this.bitrateSent=0,this.bitrateReceived=0,this.timestamp=Date.now()})),ks=new Map,Os=new Map,Ds=new Map,Ns=new Map;function xs(e){return Pe(this,void 0,void 0,G.mark((function t(){var r,n,i,o;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=new Rs,t.next=3,e.getStats();case 3:n=t.sent,i=e.appData.stats||new Rs,o=(r.timestamp-i.timestamp)/1e3,n.forEach((function(t){var a,s;switch(t.type){case"remote-inbound-rtp":var c=t.kind;if(!c)return;var u=t.ssrc,d=r[c][u]||{};d.packetsLost=t.packetsLost,d.jitter=t.jitter,r[c][u]=d;break;case"outbound-rtp":var l=t.mediaType,p=t.ssrc,f=r[l][p]||{},h=Ds.get(p.toString())||{},A=n.get(t.codecId),v=n.get(t.trackId);A&&(f.mimeType=A.mimeType,f.payloadType=A.payloadType,f.clockRate=A.clockRate),f.ssrc=p,f.direction="send",f.bytesSent=t.bytesSent,f.packetsSent=t.packetsSent,f.fractionLost=(null==h?void 0:h.fractionLost)||0,f.rtt=(null==h?void 0:h.roundTripTime)||0,"video"===l?(f.framesEncoded=t.framesEncoded,f.firCount=t.firCount,f.nackCount=t.nackCount,f.pliCount=t.pliCount,f.qpSum=t.qpSum||0,f.avgEncodeMs=1e3*t.totalEncodeTime/t.framesEncoded,v&&(f.frameHeight=v.frameHeight||0,f.frameWidth=v.frameWidth||0,f.framesSent=v.framesSent||0,f.framesPerSecond=t.framesPerSecond||Ls(i.video[p],v,o)),Ps(null==i?void 0:i.video[f.ssrc],f,o)):(Ps(i.audio[f.ssrc],f,o),v&&(f.audioLevel=v.audioLevel)),r[l][p]=f;break;case"inbound-rtp":var g=t.mediaType,m=t.ssrc,E=r[g][m]||{},_=Ds.get(m.toString())||{},y=n.get(t.codecId);y&&(E.mimeType=y.mimeType,E.payloadType=y.payloadType,E.clockRate=y.clockRate),E.ssrc=m,E.direction="recv",E.bytesReceived=t.bytesReceived,E.packetsReceived=t.packetsReceived,E.packetsLost=t.packetsLost||_.packetsLost||0,E.fractionLost=_.fractionLost||0,E.rtt=_.roundTripTime||0;var I=n.get(t.trackId);if(E.jitterBufferDelay=(null==I?void 0:I.jitterBufferDelay)||0,E.jitterBufferMs=null==I?void 0:I.googJitterBufferMs,"video"===g)I&&(E.framesReceived=I.framesReceived||0,E.framesDecoded=I.framesDecoded||0,E.framesDropped=I.framesDropped||0,E.frameWidth=I.frameWidth||0,E.frameHeight=I.frameHeight||0,E.jitter=I.jitter||0),Ms(i.video[E.ssrc],E,o),E.framesDecoded=t.framesDecoded,E.framesPerSecond=t.framesPerSecond||Bs(i.video[E.ssrc],t,o),E.firCount=t.firCount,E.nackCount=t.nackCount,E.pliCount=t.pliCount,E.qpSum=t.qpSum||0;else{Ms(i.audio[E.ssrc],E,o),E.audioLevel=null==I?void 0:I.audioLevel;var S=null;e._consumers.forEach((function(e){var t,r=(null===(t=e.rtpParameters)||void 0===t?void 0:t.encodings[0].ssrc)||0;r&&m===r&&(S=e)})),E.TotalFreezeTime=(null===(a=null==i?void 0:i.audio[E.ssrc])||void 0===a?void 0:a.TotalFreezeTime)||0,E.TotalPlayDuration=(null===(s=null==i?void 0:i.audio[E.ssrc])||void 0===s?void 0:s.TotalPlayDuration)||0,S&&!S.paused&&(null==E?void 0:E.fractionLost)>.2&&(E.TotalFreezeTime+=1),S&&!S.paused&&(E.TotalPlayDuration+=1)}r[g][m]=E;break;case"candidate-pair":r.availableOutgoingBitrate=t.availableOutgoingBitrate||0,r.bytesReceived=t.bytesReceived,r.bytesSent=t.bytesSent,r.currentRoundTripTime=t.currentRoundTripTime||0,r.nominated=t.nominated,r.priority=t.priority,r.requestsReceived=t.requestsReceived||0,r.requestsSent=t.requestsSent||0,r.responsesReceived=t.responsesReceived||0,r.responsesSent=t.responsesSent||0,r.state=t.state,r.totalRoundTripTime=t.totalRoundTripTime||0,r.timestamp=t.timestamp;var b=Ns.get(e.id);if(b){var C=t.timestamp-b.timestamp;b.bitrateReceived=8*(t.bytesReceived-b.bytesReceived)/C>>0,b.bitrateSent=8*(t.bytesSent-b.bytesSent)/C>>0,b.bytesReceived=t.bytesReceived,b.bytesSent=t.bytesSent,b.timestamp=t.timestamp}break;case"local-candidate":r.networkType=t.networkType||"UNSUPPORTED"}})),e.appData.stats=r;case 8:case"end":return t.stop()}}),t)})))}function Ps(e,t,r){if(e){var n=t.bytesSent-e.bytesSent;t.bitrate=8*n/r>>0}else t.bitrate=0}function Ls(e,t,r){return e?(t.framesSent-e.framesSent)/r>>0:0}function Bs(e,t,r){return e?(t.framesReceived-e.framesReceived)/r>>0:0}function Ms(e,t,r){if(e){var n=t.bytesReceived-e.bytesReceived;t.bitrate=8*n/r>>0}else t.bitrate=0}function Us(e){var t=e.id;ks.has(t)||(e.observer.on("close",(function(){ks.delete(t)})),ks.set(t,e),xs(e)),Ns.has(t)||Ns.set(t,new Ts)}function Qs(e){var t=e.roomId;Os.has(t)||(e.on("@close",(function(){Os.delete(t)})),Os.set(t,e))}function Fs(e,t){return Pe(this,void 0,void 0,G.mark((function r(){var n,i,o,a,s,c;return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n=t.handler,i=e.rtpParameters.mid,o=n._remoteSdp._midToIndex.get(i),a=n._remoteSdp._sdpObject.media[o]){r.next=6;break}return r.abrupt("return",Promise.reject("No media section"));case 6:if(a.rtcpFb.push({payload:a.payloads,subtype:"",type:"nack"}),s=e.rtpParameters.codecs,Array.isArray(s)&&0!==s.length){r.next=10;break}return r.abrupt("return");case 10:c=s[0].rtcpFeedback,Array.isArray(c)&&c.push({parameter:"",type:"nack"});case 12:case"end":return r.stop()}}),r)})))}function js(e){return Pe(this,void 0,void 0,G.mark((function t(){var r,n,i,o;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.handler,n=r._pc,t.next=4,n.createOffer();case 4:return i=t.sent,o={type:"answer",sdp:r._remoteSdp.getSdp()},t.next=8,n.setLocalDescription(i);case 8:return t.abrupt("return",n.setRemoteDescription(o));case 9:case"end":return t.stop()}}),t)})))}!function e(){var t=this;setTimeout((function(){ks.forEach(xs),Os.forEach((function(e){return Pe(t,void 0,void 0,G.mark((function t(){var r;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.mediaConnected){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,e.getStatsFromServer();case 4:r=t.sent,Object.keys(r).forEach((function(e){Ds.set(e,r[e])})),e.emitNetWorkQuality();case 7:case"end":return t.stop()}}),t)})))})),e()}),2e3)}(),function(e){e[e.NoNetwork=-1]="NoNetwork",e[e.Wifi=0]="Wifi",e[e._3G=1]="_3G",e[e._4G=2]="_4G",e[e._5G=3]="_5G",e[e.unknown=4]="unknown"}(ws||(ws={}));var Vs=function(e){k(r,ar);var t=xe(r);function r(e,n){var i;return U(this,r),(i=t.call(this)).deviceId="",i._log=new Cs("track"),i._isClosed=!1,i._enabled=!0,i.transport=null,i.id=void 0,i.trackId=n,i.track=e,e.onended=function(){i._enabled=!1},i}return F(r,[{key:"getListeners",value:function(e){return this.listeners(e)}},{key:"getMediaStreamTrack",value:function(){return this.track}},{key:"getTrackId",value:function(){return this.trackId}},{key:"getTrackLabel",value:function(){return this.track.label}},{key:"enabled",get:function(){return this._enabled}},{key:"close",value:function(){this._isClosed=!0}}]),r}();Vs.index=0;var Gs=function(e){k(r,Vs);var t=xe(r);function r(e,n){var i,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return U(this,r),(i=t.call(this,e,n)).producers=[],i._muted=!1,i.needStopTrack=o,i}return F(r,[{key:"addProducer",value:function(e){this.producers.push(e)}},{key:"removeProducer",value:function(e){var t=this.producers.findIndex((function(t){return t===e}));this.producers.splice(t,1)}},{key:"close",value:function(){this.producers.forEach((function(e){return e.close()})),this.track.stop(),f(d(r.prototype),"close",this).call(this)}},{key:"changeMuted",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){var r;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._muted=Boolean(e),r=this.producers.map((function(t){return t.paused===e?Promise.resolve():e?t.pause():t.resume()})),t.next=4,Promise.all(r);case 4:case"end":return t.stop()}}),t,this)})))}},{key:"muted",get:function(){return this._muted}}]),r}(),Ks=null,Hs=window.AudioContext||window.webkitAudioContext;function Ws(){if(!Hs)throw new ha(fa.NOT_SUPPORTED,"can not create audio context");return Ks||(Ks=new Hs).addEventListener("statechange",(function(){"interrupted"===this.state&&this.resume()})),"suspended"===Ks.state&&Ks.resume(),Ks}var Ys,qs=new Map,Js=function(e){var t=qs.get(e);t||(console.info("create audioSource node"),t=function(e){var t=Ws(),r=t.createAnalyser();return e instanceof MediaStreamTrack?t.createMediaStreamSource(new MediaStream([e])).connect(r):e.connect(r),qs.set(e,r),r}(e));var r=new Uint8Array(t.frequencyBinCount);return t.getByteTimeDomainData(r),(r.reduce((function(e,t){return Math.max(Math.abs(e),Math.abs(t))}))-128)/128};!function(e){e.NONE="none",e.INIT="init",e.CANPLAY="canplay",e.PLAYING="playing",e.PAUSED="paused",e.SUSPEND="suspend",e.STALLED="stalled",e.WAITING="waiting",e.ERROR="error",e.DESTROYED="destroyed",e.ABORT="abort",e.ENDED="ended",e.EMPTIED="emptied",e.LOADEDDATA="loadeddata"}(Ys||(Ys={}));var zs=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","timeupdate"],Xs=function(){function e(t){var r=this;U(this,e),this.freezeTimeCounterList=[],this.timeUpdatedCount=0,this.freezeTime=0,this.playbackTime=0,this.lastTimeUpdatedTime=0,this._videoElementStatus=Ys.NONE,this.isGettingVideoDimensions=!1,this._log=new Cs("VideoPlayer"),this.handleVideoEvents=function(e){switch(e.type){case"play":case"playing":r.startGetVideoDimensions(),r.videoElementStatus=Ys.PLAYING;break;case"loadeddata":r.onFirstVideoFrameDecoded&&r.onFirstVideoFrameDecoded();break;case"canplay":r.videoElementStatus=Ys.CANPLAY;break;case"stalled":r.videoElementStatus=Ys.STALLED;break;case"suspend":r.videoElementStatus=Ys.SUSPEND;break;case"pause":r.videoElementStatus=Ys.PAUSED,za()||Ja()&&navigator.maxTouchPoints>0||!r.videoElement||!r.videoTrack||"live"!==r.videoTrack.readyState||(r._log.debug("[track-".concat(r.trackId,"] video element paused, auto resume")),setTimeout((function(){r.videoElement&&r.videoElement.play()}),100));break;case"waiting":r.videoElementStatus=Ys.WAITING;break;case"abort":r.videoElementStatus=Ys.ABORT;break;case"ended":r.videoElementStatus=Ys.ENDED;break;case"emptied":r.videoElementStatus=Ys.EMPTIED;break;case"timeupdate":var t=Date.now();if(r.timeUpdatedCount+=1,r.timeUpdatedCount<10)return void(r.lastTimeUpdatedTime=t);var n=t-r.lastTimeUpdatedTime;for(r.lastTimeUpdatedTime=t,n>500&&(r.freezeTime+=n),r.playbackTime+=n;r.playbackTime>=6e3;)r.playbackTime-=6e3,r.freezeTimeCounterList.push(Math.min(63e3,r.freezeTime)),r.freezeTime=Math.max(0,r.freezeTime-6e3)}},this.startGetVideoDimensions=function(){!r.isGettingVideoDimensions&&function e(){if(r.isGettingVideoDimensions=!0,r.videoElement&&r.videoElement.videoWidth*r.videoElement.videoHeight>4)return r._log.debug("[".concat(r.trackId,"] current video dimensions: ").concat(r.videoElement.videoWidth," ").concat(r.videoElement.videoHeight)),void(r.isGettingVideoDimensions=!1);setTimeout(e,500)}()},this.config=t,this.trackId=t.trackId,this.updateConfig(t)}return F(e,[{key:"onFirstVideoFrameDecoded",value:function(){}},{key:"videoElementStatus",get:function(){return this._videoElementStatus},set:function(e){this._videoElementStatus!==e&&(this._log.debug("[".concat(this.trackId,"] video-element-status change").concat(this._videoElementStatus," => ").concat(e)),this._videoElementStatus=e)}},{key:"updateConfig",value:function(e){this.config=e,this.trackId=e.trackId,this.slot!==e.element&&(this.destroy(),this.slot=e.element,this.createElements())}},{key:"updateVideoTrack",value:function(e){this.videoTrack!==e&&(this.videoTrack=e,this.createElements())}},{key:"play",value:function(){var e=this,t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.videoElement){var r=this.videoElement.play();r&&r.catch&&r.catch((function(r){t&&Yu._onAutoplayFailed(t,"video",r.message,e.trackId),"NotAllowedError"===r.name?(e._log.warn("detected video element autoplay failed",r),e.handleAutoPlayFailed()):e._log.warn("[".concat(e.trackId,"] play waring: "),r)})),ts()&&r.finally&&r.finally((function(){e.config.mirror&&e.videoElement&&(e.videoElement.style.transform="rotateY(180deg)")}))}}},{key:"getCurrentFrame",value:function(){if(!this.videoElement)return new ImageData(2,2);var e=document.createElement("canvas");e.width=this.videoElement.videoWidth,e.height=this.videoElement.videoHeight;var t=e.getContext("2d");if(!t)return this._log.error("create canvas context failed!"),new ImageData(2,2);t.drawImage(this.videoElement,0,0,e.width,e.height);var r=t.getImageData(0,0,e.width,e.height);return e.remove(),r}},{key:"destroy",value:function(){var e;if(this.videoElement&&(this.videoElement.srcObject=null,this.videoElement.remove(),this.videoElement=void 0),this.container)try{this.container.remove(),null===(e=this.slot)||void 0===e||e.removeChild(this.container)}catch(e){}finally{this.container=void 0}this.freezeTimeCounterList=[]}},{key:"createElements",value:function(){var e;this.container||(this.container=document.createElement("div"),this.container.id="video-player-".concat(this.trackId),this.container.style.width="100%",this.container.style.height="100%",this.container.style.position="relative",this.container.style.overflow="hidden"),this.videoTrack?(this.container.style.backgroundColor="black",this.createVideoElement(),this.videoElement&&this.container.appendChild(this.videoElement)):(this.removeVideoElement(),null===(e=this.slot)||void 0===e||e.appendChild(this.container))}},{key:"createVideoElement",value:function(){var e=this;this.videoElement||(this.videoElementStatus=Ys.INIT,this.videoElement=document.createElement("video"),this.videoElement.onerror=function(){e.videoElementStatus=Ys.ERROR},this.container&&this.container.appendChild(this.videoElement),zs.forEach((function(t){e.videoElement&&e.videoElement.addEventListener(t,e.handleVideoEvents)})),this.videoElementCheckInterval=setInterval((function(){!document.getElementById("video_".concat(e.trackId))&&e.videoElement&&(e.videoElementStatus=Ys.DESTROYED)}),1e3),this.videoElement.id="video_".concat(this.trackId),this.videoElement.className="omini_video_player",this.videoElement.style.width="100%",this.videoElement.style.height="100%",this.videoElement.style.position="absolute",this.videoElement.controls=!1,this.videoElement.setAttribute("playsinline",""),this.videoElement.style.left="0",this.videoElement.style.top="0",this.config.mirror&&(this.videoElement.style.transform="rotateY(180deg)"),this.videoElement.style.objectFit=this.config.fit||"cover",this.videoElement.muted=!0),this.videoElement.srcObject&&this.videoElement.srcObject instanceof MediaStream?(this.videoElement.srcObject.getVideoTracks()[0]!==this.videoTrack&&(this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null),qa()&&this.videoElement.load()):(this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,qa()&&this.videoElement.load());var t=this.videoElement.play();t&&t.catch&&t.catch((function(t){e._log.debug("[".concat(e.trackId,"] playback interrupted, ").concat(t.toString()))}))}},{key:"removeVideoElement",value:function(){var e=this;if(this.videoElement){zs.forEach((function(t){e.videoElement&&e.videoElement.removeEventListener(t,e.handleVideoEvents)})),this.videoElementCheckInterval&&window.clearInterval(this.videoElementCheckInterval),this.videoElementCheckInterval=void 0;try{this.container&&this.container.removeChild(this.videoElement)}catch(e){}this.videoElement=void 0,this.videoElementStatus=Ys.NONE}}},{key:"handleAutoPlayFailed",value:function(){var e=this;if(this.videoElement){var t=function t(r){r.preventDefault();var n=Ws();"running"!==n.state&&n.resume(),e.videoElement&&e.videoElement.play().then((function(){e._log.debug("[".concat(e.trackId,"] Video element for trackId: ").concat(e.trackId," autoplay resumed."))})).catch((function(t){e._log.error(t)})),Za()||$a()&&es()?(document.body.removeEventListener("touchstart",t,!0),document.body.removeEventListener("mousedown",t,!0)):document.body.removeEventListener("click",t,!0)};Za()||$a()&&es()?(document.body.addEventListener("touchstart",t,!0),document.body.addEventListener("mousedown",t,!0)):document.body.addEventListener("click",t,!0),function(){if(!Zs){var e=function e(t){t.preventDefault(),Zs=!1,Za()||$a()&&es()?(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0)):document.body.removeEventListener("click",e,!0)};Zs=!0,Za()||$a()&&es()?(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)):document.body.addEventListener("click",e,!0),console.info("detect media autoplay failed"),Yu._onAutoplayFailed&&Yu._onAutoplayFailed()}}()}}},{key:"getVideoElement",value:function(){return this.videoElement}},{key:"getContainerElement",value:function(){return this.container}}]),e}(),Zs=!1;var $s,ec,tc=function(e){k(r,Gs);var t=xe(r);function r(e,n){var i,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return U(this,r),(i=t.call(this,e,n,o))._encoderConfig={bitrateMax:500,bitrateMin:100},i.trackMediaType="video",i.deviceId="__".concat(n,"__").concat(Vs.index++),i}return F(r,[{key:"replaceTrack",value:function(e){var t;this.track=e,null===(t=this.player)||void 0===t||t.updateVideoTrack(e),this.producers.forEach((function(t){t.replaceTrack({track:e})}))}},{key:"isPlaying",get:function(){return!(!this.player||this.player.videoElementStatus!==Ys.PLAYING)}},{key:"play",value:function(e,t){var r;"string"==typeof e?r=document.getElementById("".concat(e)):e instanceof HTMLElement&&(r=e),r||(this._log.warn("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),r=document.body),this.player?this.player.updateConfig(Object.assign({element:r,trackId:this.trackId},t)):(this.player=new Xs(Object.assign({element:r,trackId:this.trackId},t)),this.player.updateVideoTrack(this.track),this.player.play())}},{key:"stop",value:function(){this._log.userInvoke("LocalVideoTrack.stop()"),this.player&&(this.player.destroy(),this.player=void 0)}},{key:"getCurrentFrameData",value:function(){return this.player?this.player.getCurrentFrame():new ImageData(2,2)}},{key:"setEnabled",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){var r,n;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("boolean"!=typeof e&&(e=Boolean(e)),this._enabled!==e){t.next=3;break}return t.abrupt("return");case 3:if(this._enabled=e,this.needStopTrack){t.next=8;break}return this.track.enabled=e,this.producers.forEach((function(t){e?t.resume():t.pause()})),t.abrupt("return");case 8:if(!e){t.next=18;break}return t.next=11,Ha({video:this.config});case 11:r=t.sent,n=r.getVideoTracks()[0],this.replaceTrack(n),this.producers.forEach((function(e){e.resume()})),this.emit("@resume"),t.next=20;break;case 18:this.track.stop(),this.producers.forEach((function(e){e.pause()}));case 20:case"end":return t.stop()}}),t,this)})))}},{key:"setMuted",value:function(e){var t=this,n=Object.create(null,{changeMuted:{get:function(){return f(d(r.prototype),"changeMuted",t)}}});return Pe(this,void 0,void 0,G.mark((function t(){return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n.changeMuted.call(this,e),this.track.enabled=!e,this.producers.forEach((function(t){e?t.pause():t.resume()}));case 3:case"end":return t.stop()}}),t,this)})))}}]),r}(),rc=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended"];!function(e){e.NONE="none",e.INIT="init",e.CANPLAY="canplay",e.PLAYING="playing",e.PAUSED="paused",e.SUSPEND="suspend",e.STALLED="stalled",e.WAITING="waiting",e.ERROR="error",e.DESTROYED="destroyed",e.ABORT="abort",e.ENDED="ended",e.EMPTIED="emptied",e.LOADEDDATA="loadeddata"}($s||($s={})),function(e){e.IOS_15_INTERRUPTION_START="ios15-interruption-start",e.IOS_15_INTERRUPTION_END="ios15-interruption-end",e.IOS_INTERRUPTION_START="ios-interruption-start",e.IOS_INTERRUPTION_END="ios-interruption-end",e.STATE_CHANGE="state-change"}(ec||(ec={}));var nc,ic,oc=Ws(),ac=new(function(e){k(r,ar);var t=xe(r);function r(){var e;return U(this,r),(e=t.call(this))._log=new Cs("IOSInterruption"),e.onLocalAudioTrackMute=function(){e._log.info("ios15-interruption-start"),e.emit(ec.IOS_15_INTERRUPTION_START)},e.onLocalAudioTrackUnmute=function(){return Pe(S(e),void 0,void 0,G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._log.info("ios15-interruption-end"),"running"===this.curState&&!this.duringInterruption){e.next=5;break}this._log.info("ios15-interruption-end-canceled"),e.next=10;break;case 5:if(e.t0=oc,!e.t0){e.next=9;break}return e.next=9,oc.suspend();case 9:this.emit(ec.IOS_15_INTERRUPTION_END);case 10:case"end":return e.stop()}}),e,this)})))},e}return F(r,[{key:"duringInterruption",get:function(){return"running"===this.prevState&&"interrupted"===this.curState}},{key:"bindInterruptDetectorTrack",value:function(e){this._log.debug("webaudio bindInterruptDetectorTrack ".concat(e.getTrackId())),this.interruptDetectorTrack||(this.interruptDetectorTrack=e,this.interruptDetectorTrack.track.onmute=this.onLocalAudioTrackMute,this.interruptDetectorTrack.track.onunmute=this.onLocalAudioTrackUnmute)}},{key:"unbindInterruptDetectorTrack",value:function(e){this._log.debug("webaudio unbindInterruptDetectorTrack ".concat(e.getTrackId())),this.interruptDetectorTrack&&this.interruptDetectorTrack===e&&this.interruptDetectorTrack.track&&(this.interruptDetectorTrack.track.onmute=null,this.interruptDetectorTrack.track.onunmute=null,this.interruptDetectorTrack=void 0)}}]),r}()),sc=new(function(){function e(){var t=this;U(this,e),this.elementMap=new Map,this.elementStateMap=new Map,this.sinkIdMap=new Map,this.elementsNeedToResume=[],this._log=new Cs("Client"),this.autoResumeAfterInterruption=function(){t.elementMap.forEach((function(e,r){var n=e.srcObject,i=n&&n.getAudioTracks();if(i&&Array.isArray(i)&&!(i.length<1)){var o=t.elementStateMap.get(r),a=i[0];"ios"===Wa.getOSName(!0)&&15===parseInt(Wa.getBrowserVersion())&&"live"===a.readyState&&"running"===ac.curState?(t._log.debug("auto resume after interruption for iOS 15"),e.pause(),e.play()):"paused"===o&&"live"===a.readyState&&"running"===ac.curState&&(t._log.debug("auto resume after interruption for iOS"),e.play())}}))},this.autoResumeAfterInterruptionOnIOS15=function(){t.elementMap.forEach((function(e){var r=e.srcObject,n=r&&r.getAudioTracks();if(n&&Array.isArray(n)&&!(n.length<1)){var i=n[0];i&&"live"===i.readyState&&(t._log.debug("auto resume after interruption inside autoResumeAfterInterruptionOnIOS15"),e.pause(),e.play())}}))},this.autoResumeAudioElement(),ac.on(ec.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),ac.on(ec.IOS_15_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15),ac.on(ec.STATE_CHANGE,(function(){za()&&"suspended"===ac.prevState&&"running"===ac.curState&&t.autoResumeAfterInterruption()}))}return F(e,[{key:"setSinkID",value:function(e,t){return Pe(this,void 0,void 0,G.mark((function r(){var n;return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n=this.elementMap.get(e)){r.next=3;break}throw new ha(fa.INVALID_OPERATION,"audio is not playing");case 3:if(!this.sinkIdMap.set(e,t)){r.next=12;break}return r.prev=4,r.next=7,n.setSinkId(t);case 7:r.next=12;break;case 9:throw r.prev=9,r.t0=r.catch(4),new ha(fa.PERMISSION_DENIED,"can not set sink id: "+r.t0.toString());case 12:case"end":return r.stop()}}),r,this,[[4,9]])})))}},{key:"play",value:function(e,t,r){var n=this;if(!this.elementMap.has(t)){var i=document.createElement("audio");i.autoplay=!0,i.srcObject=new MediaStream([e]),this.bindAudioElementEvents(t,i),this.elementMap.set(t,i),this.elementStateMap.set(t,$s.INIT),this.setVolume(t,r);var o=this.sinkIdMap.get(t);if(o)try{i.setSinkId(o)}catch(e){this._log.warn("[".concat(t,"] set sink id failed"),e.toString())}var a=i.play();a&&a.then&&a.catch((function(e){n.elementMap.has(t)&&(n._log.error("".concat(t," auto play failed: "),e.toString()),n.elementsNeedToResume.push(i),n.onAutoplayFailed&&n.onAutoplayFailed())}))}}},{key:"bindAudioElementEvents",value:function(e,t){var r=this;rc.forEach((function(n){t.addEventListener(n,(function(t){var n="pause"===t.type?"paused":t.type;r.elementStateMap.set(e,n)}))}))}},{key:"setVolume",value:function(e,t){var r=this.elementMap.get(e);r&&(t=Math.max(0,Math.min(100,t)),r.volume=t/100)}},{key:"updateTrack",value:function(e,t){var r=this.elementMap.get(e);r&&(r.srcObject=new MediaStream([t]))}},{key:"stop",value:function(e){var t=this.elementMap.get(e);if(!this.sinkIdMap.delete(e)&&t){var r=this.elementsNeedToResume.findIndex((function(e){return t===e}));r&&this.elementsNeedToResume.splice(r,1),t.srcObject=null,t.remove(),this.elementMap.delete(e),this.elementStateMap.delete(e)}}},{key:"getPlayerState",value:function(e){return this.elementStateMap.get(e)||"uninit"}},{key:"isPlaying",value:function(e){return this.elementMap.has(e)}},{key:"autoResumeAudioElement",value:function(){var e=this,t=function(){var t=Ws();"running"!==t.state&&t.resume(),e.elementsNeedToResume.forEach((function(t){t.play().then((function(){e._log.debug("Auto resume audio element success")})).catch((function(t){e._log.debug("Auto resume audio element failed!",t)}))})),e.elementsNeedToResume=[]};new Promise((function(e){document.body?e():window.addEventListener("load",(function(){return e()}))})).then((function(){Za()||$a()&&es()?(document.body.addEventListener("touchstart",t,!0),document.body.addEventListener("mousedown",t,!0)):document.body.addEventListener("click",t,!0)}))}}]),e}());!function(e){e.speech_low_quality="speech_low_quality",e.speech_standard="speech_standard",e.music_standard="music_standard",e.standard_stereo="standard_stereo",e.high_quality="high_quality",e.high_quality_stereo="high_quality_stereo"}(nc||(nc={})),function(e){e.AUDIO_SOURCE_STATE_CHANGE="audio_source_state_change",e.RECEIVE_TRACK_BUFFER="receive_track_buffer",e.ON_AUDIO_BUFFER="on_audio_buffer"}(ic||(ic={}));var cc=function(e){k(r,ar);var t=xe(r);function r(){var e;return U(this,r),(e=t.call(this)).isPlayed=!1,e.audioOutputLevel=0,e.isDestroyed=!1,e.isNoAudioInput=!1,e._noAudioInputCount=0,e._connectedNode=[],e.context=Ws(),e.outputNode=e.context.createGain(),e.playNode=e.context.destination,e.analyserNode=e.context.createAnalyser(),e.analyserNode.smoothingTimeConstant=.4,e.analyserNode.fftSize=2048,e}return F(r,[{key:"startGetAudioBuffer",value:function(e){var t=this;this.audioBufferNode||(this.audioBufferNode=this.context.createScriptProcessor(e),this.outputNode.connect(this.audioBufferNode),this.audioBufferNode.connect(this.context.destination),this.audioBufferNode.onaudioprocess=function(e){t.emit(ic.ON_AUDIO_BUFFER,function(e){for(var t=0;t<e.outputBuffer.numberOfChannels;t+=1)for(var r=e.outputBuffer.getChannelData(t),n=0;n<r.length;n+=1)r[n]=0;return e.inputBuffer}(e))})}},{key:"stopGetAudioBuffer",value:function(){this.audioBufferNode&&(this.audioBufferNode.onaudioprocess=null,this.outputNode.disconnect(this.audioBufferNode),this.audioBufferNode=void 0)}},{key:"createOutputTrack",value:function(){if(Ja()&&parseInt(Wa.getBrowserVersion())<12)throw new ha(fa.NOT_SUPPORTED,"your browser is not support audio processor");return this.destNode&&this.outputNode||(this.destNode=this.context.createMediaStreamDestination(),this.outputNode.connect(this.destNode),this.outputTrack=this.destNode.stream.getAudioTracks()[0]),this.outputTrack}},{key:"play",value:function(e){"running"!==this.context.state&&Promise.resolve().then((function(){ac.emit("autoplay-failed")})),this.isPlayed=!0,this.playNode=e||this.context.destination,this.outputNode.connect(this.playNode)}},{key:"stop",value:function(){if(this.isPlayed)try{this.outputNode.disconnect(this.playNode)}catch(e){}this.isPlayed=!1}},{key:"getAccurateVolumeLevel",value:function(){if(!this.context||za()||Ja()&&navigator.maxTouchPoints>0||"running"!==this.context.state)return this.context.resume(),0;var e=new Uint8Array(this.analyserNode.frequencyBinCount);this.analyserNode.getByteFrequencyData(e);for(var t=0,r=0;r<e.length;r++)t+=r<64?Math.abs(10*e[r]):Math.abs(6*e[r]/15);return t/e.length/255}},{key:"checkHasAudioInput",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return Pe(this,void 0,void 0,G.mark((function t(){var r,n,i;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e>5)){t.next=4;break}return this.isNoAudioInput=!0,this.onNoAudioInput&&this.onNoAudioInput(),t.abrupt("return",!1);case 4:if(za()||Xa()?"suspended"===this.context.state&&this.context.resume():"running"!==this.context.state&&this.context.resume(),this.analyserNode){t.next=7;break}return t.abrupt("return",!1);case 7:for(r=new Uint8Array(this.analyserNode.frequencyBinCount),this.analyserNode.getByteFrequencyData(r),n=!1,i=0;i<r.length;i++)0!==r[i]&&(n=!0);if(!n){t.next=16;break}return this.isNoAudioInput=!1,t.abrupt("return",!0);case 16:return t.next=18,rs(200);case 18:return t.next=20,this.checkHasAudioInput(e?e+1:1);case 20:return t.abrupt("return",n);case 21:case"end":return t.stop()}}),t,this)})))}},{key:"getAudioVolume",value:function(){return this.outputNode.gain.value}},{key:"setVolume",value:function(e){this.outputNode.gain.setValueAtTime(e,this.context.currentTime)}},{key:"setMute",value:function(e){e?(this.disconnect(),this.audioOutputLevel=0):this.connect()}},{key:"destroy",value:function(){this.disconnect(),this.stop(),this.isDestroyed=!0,this.onNoAudioInput=void 0}},{key:"disconnect",value:function(){this.sourceNode&&this.sourceNode.disconnect(),this.outputNode&&this.outputNode.disconnect()}},{key:"connect",value:function(){this.sourceNode&&this.sourceNode.connect(this.outputNode),this.outputNode.connect(this.analyserNode)}}]),r}(),uc=function(e){k(r,Gs);var t=xe(r);function r(e,n){var i,o=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];U(this,r),(i=t.call(this,e,n,o)).audioContext=Ws(),i.audioMuted=!1,i._volume=100,i.audioOutputLevel=!1,i.isPlayed=!1,i._source=new cc,i.audioContext.resume(),i.trackMediaType="audio";var a=i.audioContext.createMediaStreamSource(new MediaStream([i.track]));return i.audioNode=i.audioContext.createGain(),a.connect(i.audioNode),i}return F(r,[{key:"isPlaying",get:function(){return sc.isPlaying(this.trackId)}},{key:"setPlaybackDevice",value:function(){return Pe(this,void 0,void 0,G.mark((function e(){return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Promise.reject(new ha(fa.NOT_SUPPORTED,"your browser does not support setting the audio output device")));case 1:case"end":return e.stop()}}),e)})))}},{key:"setVolume",value:function(e){this._volume=e,this.audioNode.gain.setValueAtTime(e/100,this.audioContext.currentTime)}},{key:"setMuted",value:function(e){f(d(r.prototype),"changeMuted",this).call(this,e),this.track.enabled=!e,e?this.emit("@need_remove_track",!0):this.emit("@need_add_track",!0)}},{key:"setEnabled",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){var r,n;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("boolean"!=typeof e&&(e=Boolean(e)),this._enabled!==e){t.next=3;break}return t.abrupt("return");case 3:if(this._enabled=e,this.needStopTrack){t.next=8;break}return this.track.enabled=e,e?this.emit("@need_add_track",!0):this.emit("@need_remove_track",!0),t.abrupt("return");case 8:if(!e){t.next=17;break}return t.next=11,Ha({audio:this.config});case 11:r=t.sent,n=r.getAudioTracks()[0],this.replaceTrack(n),this.producers.forEach((function(e){e.resume()})),t.next=20;break;case 17:this.track.stop(),this.producers.forEach((function(e){e.pause()})),this.audioNode.disconnect();case 20:e?this.emit("@need_add_track",!0):this.emit("@need_remove_track",!0);case 21:case"end":return t.stop()}}),t,this)})))}},{key:"replaceTrack",value:function(e){var t,r;this.emit("@need_remove_track",!1),t=this.audioNode,(r=qs.get(t))&&(r.disconnect(),qs.delete(t)),this.track=e;var n=new MediaStream([e]);this.audioContext.createMediaStreamSource(n).connect(this.audioNode),this.audioDom&&this.audioDom.srcObject&&(this.audioDom.srcObject=n),this.producers.forEach((function(t){t.replaceTrack({track:e})})),this.emit("@need_add_track",!1)}},{key:"disconnect",value:function(){this.audioNode&&this.audioNode.disconnect()}},{key:"play",value:function(){this.track&&"ended"!==this.track.readyState&&sc.play(this.track,this.trackId,this._volume)}},{key:"stop",value:function(){sc.stop(this.trackId)}},{key:"getVolumeLevel",value:function(){return Js(this.audioNode)}}]),r}(),dc=function(e){k(r,Vs);var t=xe(r);function r(e,n,i,o){var a;return U(this,r),(a=t.call(this,e,n)).consumer=i,a.userId=o,a}return F(r,[{key:"getUserId",value:function(){return this.userId}}]),r}(),lc=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=Math.random().toString(16).substr(2,e).toLowerCase();return t.concat(r)},pc=function(e){k(r,dc);var t=xe(r);function r(e,n){var i;return U(this,r),(i=t.call(this,e.track,lc(5,"track-audio-".concat(n,"-")),e,n))._volume=100,i.trackMediaType="audio",i._subscribeTimestamp=Date.now(),i}return F(r,[{key:"isPlaying",get:function(){return sc.isPlaying(this.trackId)}},{key:"setPlaybackDevice",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:sc.setSinkID(this.trackId,e);case 1:case"end":return t.stop()}}),t,this)})))}},{key:"play",value:function(){this.track&&"ended"!==this.track.readyState&&sc.play(this.track,this.trackId,this._volume)}},{key:"stop",value:function(){sc.stop(this.trackId)}},{key:"setVolume",value:function(e){this._volume=e,sc.setVolume(this.trackId,e/100)}},{key:"getVolumeLevel",value:function(){return Js(this.track)}}]),r}(),fc=function(e){k(r,dc);var t=xe(r);function r(e,n,i){var o;return U(this,r),(o=t.call(this,e.track,lc(5,"track-video-".concat(n,"-").concat(i,"-").concat(Vs.index++)),e,n)).trackMediaType="video",o}return F(r,[{key:"isPlaying",get:function(){return!(!this.player||this.player.videoElementStatus!==Ys.PLAYING)}},{key:"play",value:function(e,t){var r;"string"==typeof e?r=document.getElementById("".concat(e)):e instanceof HTMLElement&&(r=e),r||(this._log.warn("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),r=document.body),this.player?this.player.updateConfig(Object.assign({element:r,trackId:this.trackId},t)):(this.player=new Xs(Object.assign({element:r,trackId:this.trackId},t)),this.player.updateVideoTrack(this.track),this.player.play())}},{key:"stop",value:function(){this._log.userInvoke("LocalVideoTrack.stop()"),this.player&&(this.player.destroy(),this.player=void 0)}},{key:"getCurrentFrameData",value:function(){return this.player?this.player.getCurrentFrame():new ImageData(2,2)}}]),r}(),hc=function(e){k(r,Gs);var t=xe(r);function r(e,n,i){var o;return U(this,r),(o=t.call(this,e,n,!0)).audioNode=i,o.trackMediaType="audio",o}return F(r,[{key:"getVolumeLevel",value:function(){return Js(this.track)}}]),r}(),Ac=function(e){k(r,ar);var t=xe(r);function r(e){var n;if(U(this,r),(n=t.call(this)).appId="",n.role=sa.audience,n.platform="",n.token="",n.clientState=aa.READY,n.isInBackground=0,n.reconnectTimes=0,n._userMap=new Map,n._producerMap=new Map,n._localAudioMixTrackMap=new Map,n._remoteTrackMap=new Map,n._consumerMap=new Map,n._reconnecting=!1,n._autoReport=null,n._peers=new Map,n._mediasoupDevice=new la({handlerName:Ya()}),n._protoo=null,n._sendTransport=null,n._url="",n._port=443,n._sessionId="",n._connectId=ns(),n._connectionState="DISCONNECTED",n._joinTime=0,n._disconnectTime=0,n._log=new Cs("Client"),"rtc"!==e.mode&&"live"!==e.mode)throw new ha(fa.INVALID_PARAMS,"mode can only be set as rtc or live");n._mode=e.mode||"live","rtc"!==n._mode&&"host"!=e.role||(n.role=sa.host),document.addEventListener("visibilitychange",(function(){document.hidden?n.isInBackground=1:n.isInBackground=0}));var i=Ws().createMediaStreamDestination();return n._localAudioTrack=new hc(i.stream.getAudioTracks()[0],"dest-audio",i),n}return F(r,[{key:"uid",get:function(){return this.userId}},{key:"channelName",get:function(){return this.roomId}},{key:"localTracks",get:function(){var e=[];return this._localAudioMixTrackMap.forEach((function(t){e.push(t)})),this._localVideoTrack&&e.push(this._localVideoTrack),e}},{key:"mode",get:function(){return this._mode}},{key:"joined",get:function(){return Boolean(this.clientState===aa.JOINED&&this._protoo)}},{key:"connectionState",get:function(){return this._connectionState}},{key:"mediaConnected",get:function(){return this.joined&&!(!this._localAudioMixTrackMap.size&&!this._remoteTrackMap.size)}},{key:"sessionId",get:function(){return this._sessionId}},{key:"connectId",get:function(){return this._connectId}},{key:"sendTransport",get:function(){return this._sendTransport}},{key:"remoteUsers",get:function(){var e=[];return this._userMap.forEach((function(t){e.push(t.media)})),e}},{key:"debug",get:function(){return this._log.debug.bind(this._log)}},{key:"info",get:function(){return this._log.info.bind(this._log)}},{key:"warn",get:function(){return this._log.warn.bind(this._log)}},{key:"error",get:function(){return this._log.error.bind(this._log)}},{key:"safeEmit",value:function(e){for(var t,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return this._log.userCallback(e,i.map((function(e){return JSON.stringify(e,(function(e,t){return"stream"===e?t.toString():t}))}))),(t=f(d(r.prototype),"safeEmit",this)).call.apply(t,[this,e].concat(i))}},{key:"setServerUrl",value:function(e){this._log.userInvoke("client.setServerUrl",e),this._url=e}},{key:"join",value:function(e,t,r,n){var i;return Pe(this,void 0,void 0,G.mark((function o(){var a,s,c,u,d,l,p,f,h,A,v,g;return G.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(this._log.userInvoke("client.join",""+e,""+r,t,""+n),this.clientState===aa.READY){o.next=3;break}throw new ha(fa.UNEXPECTED_ERROR,"client state is ".concat(this.clientState,"."));case 3:if("string"==typeof e){o.next=5;break}throw new ha(fa.INVALID_PARAMS,"appid is invalid.");case 5:if((m=n+"")===Aa.fromString(m).toString()){o.next=7;break}throw new ha(fa.INVALID_PARAMS,"uid is invalid.");case 7:if("string"==typeof t||"number"==typeof t){o.next=9;break}throw new ha(fa.INVALID_PARAMS,"roomId is invalid.");case 9:if(!~t.indexOf(":")){o.next=11;break}throw new ha(fa.INVALID_PARAMS,'roomId can not contains char ":"');case 11:if(this.userId=n+"",this.appId=e,this.roomId=t+"",this.reconnectTimes=0,a=new Lt,this._log.send(a),s=Date.now(),c=new Bt(s),"string"==typeof r&&(this.token=r),this.clientState=aa.JOINING,o.prev=21,this._url){o.next=32;break}return o.next=25,os("wss://112-126-100-194.eaydu.com/iplocation/",this.appId,this.userId,this._connectId);case 25:u=o.sent,c.serGwIp=u.domain,c.sendIpLocDur=u.sendIpLocDur,c.linkIpLocDur=u.linkIpLocDur,this._url=u.domain,o.next=33;break;case 32:c.serGwIp=this._url;case 33:return s=Date.now(),d=new Ot("wss://".concat(this._url,":").concat(this._port,"/"),{retry:{retries:9,minTimeout:2e3,maxTimeout:4e3}}),l=Date.now(),this._handleCoreTransport(d),this._changeConnectionState("CONNECTING"),this._protoo=new Tt(d),o.next=41,this._handleProtoo(this._protoo);case 41:return this.reconnectTimes=o.sent,c.linkGwDur=l-s,c.linkGwTimes=this.reconnectTimes,o.next=46,this._request("getRouterRtpCapabilities");case 46:return p=o.sent,o.next=49,this._mediasoupDevice.load({routerRtpCapabilities:p});case 49:return s=Date.now(),o.next=52,this._request("join",{appId:this.appId,userId:this.userId,roomId:this.roomId,role:this.role,token:this.token,connectId:this._connectId,displayName:this.userId,version:"V6.0.8_Apr_13_2022",rtpCapabilities:this._mediasoupDevice.rtpCapabilities});case 52:f=o.sent,h=f.sessionId,A=Wa.parsedResult.browser,v=A.name,g=A.version,this._baseInfo=new xt({time:Dt(),appId:this.appId,uid:this.userId,roomId:this.roomId,sid:h,connId:this._connectId,userDevInfo:"".concat(v," ").concat(g),uRole:this.role}),this._log.setClientInfo(this._baseInfo),this._joinTime=Date.now(),c.sendGwEnterDur=this._joinTime-s,c.sendGwDur=this._joinTime-s,this._sessionId=h,this.clientState=aa.JOINED,d.startHeartBeat(2),Qs(this),this._log.send(c),o.next=75;break;case 67:throw o.prev=67,o.t0=o.catch(21),c.enterStat=bt.ENTER_FAIL,this._log.send(c),null===(i=this._protoo)||void 0===i||i.close(),this.clientState=aa.CLOSED,this.error("[JOIN_FAILED] - ".concat(o.t0)),new ha(fa.UNEXPECTED_ERROR,""+o.t0);case 75:return this._changeConnectionState("CONNECTED"),this.autoStreamReport(),o.abrupt("return",this.userId);case 78:case"end":return o.stop()}var m}),o,this,[[21,67]])})))}},{key:"setClientRole",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){var r,n,i=this;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._log.userInvoke("client.setClientRole",e),["audience","host"].find((function(t){return t===e}))){t.next=4;break}throw this.error("[SETCLIENTROLE_FAIL] - Invalid param [role]=".concat(e)),new ha(fa.INVALID_PARAMS,'role can only be set as ["audience","host"]');case 4:if("rtc"!==this.mode){t.next=7;break}throw this.error("[SETCLIENTROLE_FAIL] - Can not setClientRole in rtc mode."),new ha(fa.INVALID_OPERATION,"rtc mode can not use setClientRole");case 7:if((r={role:sa[e]}).role!==this.role){t.next=10;break}return t.abrupt("return");case 10:if(!(2===r.role&&this._producerMap.size>0)){t.next=12;break}throw new ha(fa.INVALID_OPERATION,"can not set client role to audience when publishing stream");case 12:if(2===r.role&&(n=[],this._localAudioTrack.producers.length>0&&this._localAudioTrack.producers.forEach((function(e){n.push({producerId:e.id,kind:"audio"}),i._localAudioTrack.removeProducer(e),e.close()})),n.length>1&&this._request("closeProducer",n),this._sendTransport&&(this._sendTransport.close(),this._sendTransport=null)),!this.joined){t.next=26;break}return t.prev=14,t.next=17,this._request("setClientRole",r);case 17:this._baseInfo&&(this._baseInfo.uRole=r.role),this._log.setClientRoleInfo(r.role),t.next=25;break;case 21:throw t.prev=21,t.t0=t.catch(14),this.error("[SETCLIENTROLE_FAIL] - ".concat(t.t0)),t.t0;case 25:r.role===sa.audience&&(this._localAudioMixTrackMap.forEach((function(e){null==e||e.close()})),this._localAudioMixTrackMap.clear());case 26:this.role=r.role;case 27:case"end":return t.stop()}}),t,this,[[14,21]])})))}},{key:"leave",value:function(){var e,t;return Pe(this,void 0,void 0,G.mark((function r(){return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(this._log.userInvoke("client.leave"),this._log.send(new Mt),"DISCONNECTED"!==this.connectionState){r.next=4;break}return r.abrupt("return");case 4:if(this._autoReport&&(clearInterval(this._autoReport),this._autoReport=null),this._protoo&&!this._protoo.closed){r.next=8;break}return this.warn("[SOCKET_ERROR] - Connection Lost"),r.abrupt("return");case 8:return null===(e=this._sendTransport)||void 0===e||e.close(),this._sendTransport=null,this.clientState=aa.LEAVING,this._changeConnectionState("DISCONNECTING"),r.prev=12,r.next=15,this._request("leave",{});case 15:r.next=20;break;case 17:r.prev=17,r.t0=r.catch(12),this.error("[LEAVE_MSG_TIMEOUT] - ".concat(r.t0));case 20:this.clientState=aa.LEFT,null===(t=this._protoo)||void 0===t||t.close(),this.info("Left Room");case 23:case"end":return r.stop()}}),r,this,[[12,17]])})))}},{key:"renewToken",value:function(e){var t=this;if(this._log.userInvoke("client.renewToken",e),"string"!=typeof e)throw this.warn("[RENEWTOKEN_FAIL] - Invalid param, token must be string"),new TypeError("[RENEWTOKEN_FAIL] - Invalid param, token must be string");if(!this.joined)throw this.warn("[RENEWTOKEN] - You are not in room"),new Error("[RENEWTOKEN] - You are not in room");this._request("renewToken",{token:e}).then((function(){t.token=e})).catch((function(e){t.safeEmit("error","renewToken fail: ".concat(e))}))}},{key:"subscribe",value:function(e,t){return Pe(this,void 0,void 0,G.mark((function r(){var n;return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(this._log.userInvoke("client.subscribe",e.uid,t),"video"===t||"audio"===t){r.next=3;break}throw new ha(fa.INVALID_PARAMS,"mediaType can only be set as video, audio");case 3:if(n=this._userMap.get(e.uid)){r.next=6;break}throw new ha(fa.INVALID_REMOTE_USER,"user is not in the channel");case 6:if(this.joined){r.next=8;break}throw new ha(fa.INVALID_OPERATION,"Can't subscribe stream, not joined");case 8:if(n.media.hasAudio||n.media.hasVideo){r.next=10;break}throw new ha(fa.INVALID_REMOTE_USER,"user is not published");case 10:if("audio"!==t){r.next=14;break}return r.next=13,this._subscribeAudio(n);case 13:case 17:return r.abrupt("return",r.sent);case 14:if("video"!==t){r.next=18;break}return r.next=17,this._subscribeVideo(n);case 18:return r.abrupt("return",Promise.reject());case 19:case"end":return r.stop()}}),r,this)})))}},{key:"unsubscribe",value:function(e,t){return Pe(this,void 0,void 0,G.mark((function r(){var n,i,o,a,s;return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(this._log.userInvoke("client.unsubscribe",e.uid,t),n=this._userMap.get(e.uid),this.joined){r.next=4;break}throw new ha(fa.INVALID_OPERATION,"Can't unsubscribe stream, not joined");case 4:if(n){r.next=6;break}throw new ha(fa.INVALID_REMOTE_USER,"user is not in the channel");case 6:if(i=[],"audio"===t?n.media.audioTrack&&i.push(n.media.audioTrack):("video"===t||n.media.audioTrack&&i.push(n.media.audioTrack),n.media.videoTrack&&i.push(n.media.videoTrack)),!(i.length<1)){r.next=11;break}return this._log.warn("you have not subscribe the remote user ",e.uid),r.abrupt("return",Promise.reject());case 11:o=0,a=i;case 12:if(!(o<a.length)){r.next=21;break}return s=a[o],r.next=16,this._request("closeConsumer",{producerUserId:e.uid,consumerId:s.consumer.id});case 16:s.consumer.close(),"audio"===s.trackMediaType?this._log.send(new Ft(0,e.uid)):this._log.send(new jt(0,e.uid,s.deviceId));case 18:o++,r.next=12;break;case 21:case"end":return r.stop()}}),r,this)})))}},{key:"_updateBitrate",value:function(e){var t=null,r=e.producers,n=this._sendTransport,i=e._encoderConfig.bitrateMax,o=e._encoderConfig.bitrateMin;n?(r.forEach((function(e){n._producers.has(e.id)&&(t=e)})),t&&function(e,t,r,n){Pe(this,void 0,void 0,G.mark((function i(){var o,a,s,c,u;return G.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(o=t.handler,a=e.rtpParameters.mid,s=o._remoteSdp._midToIndex.get(a),c=o._remoteSdp._sdpObject.media[s]){i.next=6;break}return i.abrupt("return",Promise.reject("No media section"));case 6:(u=c.fmtp[0]).config=u.config.replace(/x-google-max-bitrate=\d+/,"x-google-max-bitrate=".concat(n)).replace(/x-google-min-bitrate=\d+/,"x-google-min-bitrate=".concat(r));case 8:case"end":return i.stop()}}),i)})))}(t,n,o,i),this._localAudioTrack&&this._localAudioTrack.producers[0]&&Fs(this._localAudioTrack.producers[0],n),js(n)):this.error("_updateBitrate() fail. Transport is ".concat(n))}},{key:"publish",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Pe(this,void 0,void 0,G.mark((function r(){var n,i,o,a,s,c,u=this;return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(Array.isArray(e)||(e=[e]),this._log.userInvoke("client.publish",e.map((function(e){return e&&e.getTrackId()}))),"CONNECTED"===this.connectionState||"RECONNECTING"===this.connectionState){r.next=4;break}throw new ha(fa.INVALID_OPERATION,"can not publish when connection state is ".concat(this.connectionState));case 4:if(2!==this.role){r.next=8;break}throw n=new ha(fa.INVALID_OPERATION,"audience can not publish stream"),this._log.error("audience can not publish stream"),n;case 8:i=[],o=De(e),r.prev=10,s=G.mark((function e(){var r,n,o,s,c,d,l;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((r=a.value)instanceof Gs){e.next=5;break}throw n="pamameter is not local track",u._log.error(n),new ha(fa.INVALID_PARAMS,n);case 5:if(t||r.enabled&&!r._isClosed){e.next=9;break}throw o="can not publish a disabled track: ".concat(r.getTrackId()),u._log.error(o),new ha(fa.TRACK_IS_DISABLED,o);case 9:if(!(r instanceof tc)){e.next=24;break}if(!t||r.enabled){e.next=13;break}return r.once("@resume",(function(){u.publish(r)})),e.abrupt("return","continue");case 13:if(!u._localVideoTrack){e.next=15;break}throw new ha(fa.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS);case 15:return u._localVideoTrack=r,r._publishTimestamp=Date.now(),r.on("@video-profile-changed",u._updateBitrate),s=new Vt({isLocalVideoMuted:r.muted?1:0,isOpenVideo:1}),u._log.send(s),e.next=22,u._publishByKind(r);case 22:c=e.sent,i.push(c);case 24:if(!(r instanceof uc)){e.next=37;break}if(!u._localAudioMixTrackMap.has(r.getTrackId())){e.next=27;break}return e.abrupt("return","continue");case 27:if(!(u._localAudioTrack.producers.length<1)){e.next=32;break}return e.next=30,u._publishByKind(u._localAudioTrack);case 30:d=e.sent,i.push(d);case 32:u._localAudioTrack.audioNode&&(u.connectAudioTrack(r,!0),r._publishTimestamp=Date.now()),r.on("@need_add_track",(function(e){u.connectAudioTrack(r,!0),e&&u.checkNeedPublishAudio()})),r.on("@need_remove_track",(function(e){u.connectAudioTrack(r,!1),e&&u.checkNeedPublishAudio()})),l=new Gt,u._log.send(l);case 37:u._baseInfo&&r._log.setClientInfo(u._baseInfo);case 38:case"end":return e.stop()}}),e)})),o.s();case 13:if((a=o.n()).done){r.next=20;break}return r.delegateYield(s(),"t0",15);case 15:if("continue"!==r.t0){r.next=18;break}return r.abrupt("continue",18);case 18:r.next=13;break;case 20:r.next=25;break;case 22:r.prev=22,r.t1=r.catch(10),o.e(r.t1);case 25:return r.prev=25,o.f(),r.finish(25);case 28:if(this.checkNeedPublishAudio(),!(i.length<1)){r.next=31;break}return r.abrupt("return");case 31:return this._publishTimeStamp||(this._publishTimeStamp=Date.now()),r.prev=32,r.next=35,this._request("produce",i);case 35:r.next=42;break;case 37:throw r.prev=37,r.t2=r.catch(32),c="[PUBLISH_FAILED] - error: ".concat(r.t2.message),this.error(c),r.t2;case 42:js(this._sendTransport);case 43:case"end":return r.stop()}}),r,this,[[10,22,25,28],[32,37]])})))}},{key:"checkNeedPublishAudio",value:function(){return Pe(this,void 0,void 0,G.mark((function e(){var t,r,n;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=0,this._localAudioMixTrackMap.forEach((function(e){"audio"===e.trackMediaType&&(t+=1)})),r=this._localAudioTrack.producers[0]){e.next=10;break}return e.next=6,this._publishByKind(this._localAudioTrack);case 6:return n=e.sent,e.next=9,this._request("produce",[n]);case 9:r=this._localAudioTrack.producers[0];case 10:0===t?(!r.paused&&r.pause(),this._localAudioTrack._publishTimestamp=void 0):(r.paused&&r.resume(),this._localAudioTrack._publishTimestamp=Date.now());case 11:case"end":return e.stop()}}),e,this)})))}},{key:"connectAudioTrack",value:function(e,t){var r,n;t?(null===(r=e.audioNode)||void 0===r||r.connect(this._localAudioTrack.audioNode),this._localAudioMixTrackMap.set(e.getTrackId(),e)):(null===(n=e.audioNode)||void 0===n||n.disconnect(),this._localAudioMixTrackMap.delete(e.getTrackId()))}},{key:"getAllTracks",value:function(){var e=[];return this._localAudioMixTrackMap.forEach((function(t){e.push(t)})),this._localVideoTrack&&e.push(this._localVideoTrack),e}},{key:"unpublish",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){var r,n,i=this;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=[],e?Array.isArray(e)?e.forEach((function(e){var t;(e instanceof Gs&&i._localAudioMixTrackMap.has(e.getTrackId())||e.getTrackId()===(null===(t=i._localVideoTrack)||void 0===t?void 0:t.getTrackId()))&&r.push(e)})):e instanceof Gs&&(r=[e]):r=this.getAllTracks(),0!==r.length){t.next=4;break}return t.abrupt("return");case 4:n=[],r.forEach((function(e){var t=e.getTrackId();if(e instanceof tc){e.removeAllListeners("@resume"),e._publishTimestamp=void 0;var r=i._producerMap.get(t);if(!r)return void console.warn("cannot find producer for",t);var o=new Kt({rsn:r.paused?0:1});i._log.send(o),n.push({producerId:r.id,kind:"video"}),e.removeProducer(r),r.close(),i._localVideoTrack=void 0}else e instanceof uc&&(e._publishTimestamp=void 0,i.connectAudioTrack(e,!1),e.removeAllListeners("@need_remove_track"),e.removeAllListeners("@need_add_track"),i._localAudioMixTrackMap.delete(e.getTrackId()))})),0===this._localAudioMixTrackMap.size&&this._producerMap.delete(this._localAudioTrack.getTrackId()),this.checkNeedPublishAudio(),n.length>0&&this._request("closeProducer",n),this._localVideoTrack||0!==this._localAudioMixTrackMap.size||(this._publishTimeStamp=void 0);case 10:case"end":return t.stop()}}),t,this)})))}},{key:"_getUserTransport",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){var r,n;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=e.transport,"no-transport"!==e.state){t.next=16;break}return e.state="creating-transport",e.observer.safeEmit("@state-changed",e.state),t.next=6,this._request("createWebRTCTransport",{forceTcp:!1,producing:!1,consuming:!0,producerUserId:e.uid,producerConnectId:e.connectId});case 6:return(n=t.sent).appData={producerUserId:e.uid},t.next=10,this._createTransport("recv",n);case 10:r=t.sent,e.state="ready",e.transport=r,e.observer.safeEmit("@state-changed",e.state),t.next=20;break;case 16:if("creating-transport"!==e.state){t.next=20;break}return t.next=19,vc(e);case 19:r=e.transport;case 20:return t.abrupt("return",r);case 21:case"end":return t.stop()}}),t,this)})))}},{key:"_subscribeAudio",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){var r;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getUserTransport(e);case 2:if(e.transport=t.sent,e.media.audioTrack){t.next=8;break}return t.next=6,this._createConsumer("",e,"audio");case 6:r=t.sent,e.media.audioTrack=new pc(r,e.uid);case 8:return t.abrupt("return",e.media.audioTrack);case 9:case"end":return t.stop()}}),t,this)})))}},{key:"_subscribeVideo",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){var r;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._getUserTransport(e);case 2:if(e.transport=t.sent,e.media.videoTrack){t.next=12;break}if(!e.deviceList[0]){t.next=10;break}return t.next=7,this._createConsumer(e.deviceList[0].id,e,"video");case 7:r=t.sent,t.next=11;break;case 10:throw new Error("User ".concat(e.uid," has no deviceId"));case 11:e.media.videoTrack=new fc(r,e.uid,e.deviceList[0].id);case 12:return t.abrupt("return",e.media.videoTrack);case 13:case"end":return t.stop()}}),t,this)})))}},{key:"_publishByKind",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){var r,n,i,o=this;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this._protoo){t.next=2;break}return t.abrupt("return",Promise.reject("Protoo is broken."));case 2:if(this._sendTransport){t.next=10;break}return t.next=5,this._request("createWebRTCTransport",{forceTcp:!1,producing:!0,consuming:!1,producerUserId:this.userId,producerConnectId:this._connectId});case 5:return(r=t.sent).appData={producerUserId:this.userId},t.next=9,this._createTransport("send",r);case 9:this._sendTransport=t.sent;case 10:return e instanceof tc&&e._encoderConfig?(n={videoGoogleMaxBitrate:e._encoderConfig.bitrateMax,videoGoogleMinBitrate:e._encoderConfig.bitrateMin,videoGoogleStartBitrate:e._encoderConfig.bitrateMin},this._log.send(new Qt(1,e.deviceId))):e instanceof uc&&(n={opusFec:!0}),t.next=13,this._createProducer({track:e.track,codecOptions:n,stopTracks:!1,disableTrackOnPause:!1},this._sendTransport);case 13:return i=t.sent,this._producerMap.set(e.getTrackId(),i),e.addProducer(i),i.observer.on("close",(function(){o._producerMap.delete(e.getTrackId()),e instanceof tc&&o._localVideoTrack===e?(e.removeProducer(i),o._localVideoTrack=void 0):o._localAudioMixTrackMap.delete(e.getTrackId())})),t.abrupt("return",Promise.resolve({source:"",kind:e.trackMediaType,transportId:this._sendTransport.id,rtpParameters:i.rtpParameters,id:i.id,deviceId:"video"===e.trackMediaType?this.userId.concat(":",e.deviceId,this.userId):""}));case 18:case"end":return t.stop()}}),t,this)})))}},{key:"rejoin",value:function(e){var t=this;if(Date.now()-this._disconnectTime>12e5)return this.clientState=aa.CLOSED,e=[],this._reconnecting=!1,void this._log.send(new Ut("Time out - 20 min."));this.info("[CONNECTION_LOST] - rejoin."),this.clientState=aa.READY,this.join(this.appId,this.roomId,this.token,this.userId).then((function(r){t._reconnecting=!1,t.safeEmit("rejoin"),t.publish(e,!0).then((function(){t.safeEmit(na.mediaReconnectEnd,{uid:r})}))})).catch((function(){t.rejoin(e)}))}},{key:"_handleCoreTransport",value:function(e){var t=this;e.on("msg-timeout",(function(){var e,r,n;t._localAudioMixTrackMap.forEach((function(e){e._publishTimestamp=void 0,e.disconnect()}));var i=Array.from(t._localAudioMixTrackMap.values());t._localVideoTrack&&(i.push(t._localVideoTrack),t._localVideoTrack._publishTimestamp=void 0,t._localVideoTrack.producers.forEach((function(e){e.close()}))),null===(e=t._protoo)||void 0===e||e.close(),null===(r=t._sendTransport)||void 0===r||r.removeAllListeners(),null===(n=t._sendTransport)||void 0===n||n.close(),t._disconnectTime=Date.now(),t.safeEmit(na.mediaReconnectStart,{uid:t.userId}),t._reconnecting=!0,t._changeConnectionState("RECONNECTING"),t._localVideoTrack=void 0,t._localAudioMixTrackMap.clear(),t._localAudioTrack.producers.forEach((function(e){e.close()})),t._localAudioTrack.producers=[],t.rejoin(i)})),e.on("close",(function(){setTimeout((function(){e.removeAllListeners()}))})),e.on("log",(function(e){t.info(e)}))}},{key:"_handleProtoo",value:function(e){var t=this,r=0,n=Date.now(),i=new zt(Date.now()-n,this._url,Nt.reconnecting);return this._log.send(i),new Promise((function(i,o){e.on("open",(function(){var e=Date.now(),o=new zt(e-n,t._url,Nt.connected);n=e,t._log.send(o),i(r)})),e.on("request",t._handleRequest.bind(t)),e.on("notification",t._handleNotification.bind(t)),e.on("disconnected",(function(){e.close();var r=Date.now(),i=new zt(r-n,t._url,Nt.closed);n=r,t._log.send(i),console.warn("Client ".concat(t.roomId,": Connection disconnected."))})),e.on("failed",(function(e){r=e;var i=new zt(Date.now()-n,t._url,Nt.connectFail);n=Date.now(),t._log.send(i),e-1<9||o("Client ".concat(t.roomId,": Connect server failed."))})),e.on("close",t._handleClose.bind(t))}))}},{key:"_request",value:function(e,t){return this._protoo?(this.info("[MSG_SENT] - ".concat(e," ").concat(JSON.stringify(t))),this._protoo.request(e,t)):Promise.reject("Connection Lost.")}},{key:"_handleRequest",value:function(e,t,r){var n=e.method,i=e.data;return Pe(this,void 0,void 0,G.mark((function e(){var o;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.info("[MSG_RECVED] - ".concat(n)),e.t0=n,e.next="newPeers"===e.t0?4:"peerClosed"===e.t0?15:"updateUserInfo"===e.t0?28:"consumerPaused"===e.t0?38:"consumerResumed"===e.t0?48:"consumerClosed"===e.t0?58:"onTokenPrivilegeWillExpire"===e.t0?68:71;break;case 4:return e.prev=4,e.next=7,this._handlePeer(i);case 7:e.next=13;break;case 9:return e.prev=9,e.t1=e.catch(4),r(100101,"".concat(e.t1)),e.abrupt("break",73);case 13:case 26:case 36:case 46:case 56:case 66:return t(),e.abrupt("break",73);case 15:return e.prev=15,e.next=18,this._handlePeerClose(i);case 18:o=e.sent,this.safeEmit("user-left",{user:o.media,reason:"Quit"}),e.next=26;break;case 22:return e.prev=22,e.t2=e.catch(15),r(100102,"".concat(e.t2)),e.abrupt("break",73);case 28:e.prev=28,this._updateUserStream(i),e.next=36;break;case 32:return e.prev=32,e.t3=e.catch(28),r(100103,"".concat(e.t3)),e.abrupt("break",73);case 38:e.prev=38,this._pauseConsumer(i),e.next=46;break;case 42:return e.prev=42,e.t4=e.catch(38),r(100104,"".concat(e.t4)),e.abrupt("break",73);case 48:e.prev=48,this._resumeConsumer(i),e.next=56;break;case 52:return e.prev=52,e.t5=e.catch(48),r(100105,"".concat(e.t5)),e.abrupt("break",73);case 58:e.prev=58,this._closeConsumer(i),e.next=66;break;case 62:return e.prev=62,e.t6=e.catch(58),r(100106,"".concat(e.t6)),e.abrupt("break",73);case 68:return t(),this.safeEmit("onTokenPrivilegeWillExpire"),e.abrupt("break",73);case 71:return r(100100,"unknow method ".concat(n)),e.abrupt("break",73);case 73:case"end":return e.stop()}}),e,this,[[4,9],[15,22],[28,32],[38,42],[48,52],[58,62]])})))}},{key:"_handleNotification",value:function(e){var t=e.method,r=e.data;this.info("[MSG_RECVED] - ".concat(t)),"kicked"===t?(this.warn("[CLIENT_BANNED] - reason: ".concat(r.reason," code: ").concat(r.code," timeout: ").concat(r.timeout)),this.safeEmit("client-banned",{uid:this.userId,attr:r.reason,timeout:r.timeout})):this.warn("unknow method ".concat(t))}},{key:"_handleClose",value:function(){var e,t=this;this.info("Client ".concat(this.roomId,": Connection closed."));try{this._protoo=null,this._userMap.forEach((function(e){var r=e.uid;t._handlePeerClose({userId:r})}));var r=new Kt({rsn:0});this._log.send(r);var n=new Ht;this._log.send(n),this._localAudioMixTrackMap.forEach((function(e){e.disconnect()})),this._localAudioMixTrackMap.clear(),this._localVideoTrack=void 0,null===(e=this._sendTransport)||void 0===e||e.close(),this._sendTransport=null,this._connectId=ns(),this._mediasoupDevice=new la({handlerName:Ya()}),this.clientState=aa.CLOSED,this._changeConnectionState("DISCONNECTED")}catch(e){this.error("".concat(e))}this.emit("@close")}},{key:"_changeConnectionState",value:function(e,t){if("RECONNECTING"!==this._connectionState||"CONNECTING"!==e){var r=this._connectionState;this._connectionState=e,this.safeEmit(na.connectionStateChange,e,r,t)}}},{key:"_handlePeer",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){var r=this;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.forEach((function(e){var t=e.userId,n=e.role,i=e.muteAudio,o=e.connectId,a=e.muteVideo,s=e.deviceList,c={uid:t,role:n,transport:null,media:{uid:t,hasAudio:!is(i)||!i,hasVideo:!!is(a)&&!a},deviceList:s||[],connectId:o,observer:new ar,state:"no-transport"};r._userMap.set(t,c),r.safeEmit("user-joined",c.media),c.media.hasAudio&&r.safeEmit("user-published",c.media,"audio"),c.media.hasVideo&&Array.isArray(s)&&s[0].inuse&&r.safeEmit("user-published",c.media,"video")})),t.abrupt("return",Promise.resolve());case 2:case"end":return t.stop()}}),t)})))}},{key:"_handlePeerClose",value:function(e){var t,r,n=e.userId,i=this._userMap.get(n);if(i){try{null===(t=i.media.audioTrack)||void 0===t||t.stop(),null===(r=i.media.videoTrack)||void 0===r||r.stop(),this._userMap.delete(n)}catch(e){this.error("[CLOSEPEER_FAIL] - ".concat(e))}return Promise.resolve(i)}return Promise.reject("Can't find user ".concat(n))}},{key:"_updateUserStream",value:function(e){var t,r,n=this,i=e.userId,o=e.deviceList,a=e.muteAudio,s=e.muteVideo,c=this._userMap.get(i);if(!c)throw this.error("[SIGNAL] - updateUserInfo: There's no user ".concat(i)),Error("[SIGNAL] - updateUserInfo: There's no user ".concat(i));var u=c.media.hasAudio,d=c.media.hasVideo,l=c.deviceList;if(is(a)&&(c.media.hasAudio=!a),is(s)&&(c.media.hasVideo=!s),void 0!==o&&(c.deviceList=o),is(a)&&u===a&&(a?(null===(t=c.media.audioTrack)||void 0===t||t.stop(),this.safeEmit("user-unpublished",c.media,"audio")):this.safeEmit("user-published",c.media,"audio")),is(s))if(s)d===s&&(Array.isArray(l)?l.forEach((function(){var e;null===(e=c.media.videoTrack)||void 0===e||e.stop(),n.safeEmit("user-unpublished",c.media,"video")})):(null===(r=c.media.videoTrack)||void 0===r||r.stop(),this.safeEmit("user-unpublished",c.media,"video")));else if(d===s)o.forEach((function(e){var t;e.inuse?n.safeEmit("user-published",c.media,"video"):(null===(t=c.media.videoTrack)||void 0===t||t.stop(),n.safeEmit("user-unpublished",c.media,"video"))}));else{var p=function(e,t){for(var r={pub:M(t),unpub:M(e)},n=function(t){for(var n=0;n<r.pub.length;n++)if(e[t].id===r.pub[n].id){e[t].inuse!==r.pub[n].inuse?r.pub[n].inuse?r.unpub=r.unpub.filter((function(r){return r.id!==e[t].id})):r.pub.splice(n,1):(r.pub.splice(n,1),r.unpub=r.unpub.filter((function(r){return r.id!==e[t].id})));break}},i=0;i<e.length;i++)n(i);return r}(l,o),f=p.pub,h=p.unpub;f.forEach((function(){n.safeEmit("user-published",c.media,"video")})),h.forEach((function(){n.safeEmit("user-unpublished",c.media,"video")}))}}},{key:"_createProducer",value:function(e,t){return Pe(this,void 0,void 0,G.mark((function r(){var n,i,o,a=this;return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,t.produce(e);case 2:return n=r.sent,"audio"===(i=n.kind)&&Fs(n,t),o=n.id,n.on("transportclose",(function(){n.close()})),n.observer.on("close",(function(){a.debug("[PRODUCER_CLOSED] - ".concat(i,":").concat(o))})),n.observer.on("pause",(function(){a.debug("[PRODUCER_PAUSED] - ".concat(i,":").concat(o)),a._request("pauseProducer",{producerId:n.id,kind:n.kind})})),n.observer.on("resume",(function(){a.debug("[PRODUCER_RESUMED] - ".concat(i,":").concat(o)),a._request("resumeProducer",{producerId:n.id,kind:n.kind})})),r.abrupt("return",Promise.resolve(n));case 11:case"end":return r.stop()}}),r)})))}},{key:"_createConsumer",value:function(e,t,r){return Pe(this,void 0,void 0,G.mark((function n(){var i,o,a,s,c,u,d,l=this;return G.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(t.transport){n.next=2;break}throw new Error("Transport is null - ".concat(t.uid));case 2:return i={deviceId:e,transportId:t.transport.id,producerUserId:t.uid,kind:r,connectId:t.connectId},n.next=5,this._request("consume",i);case 5:return o=n.sent,a=o.consumerId,s=o.producerId,c=o.rtpParameters,u=o.producerPaused,this.info("consume:",r,e),n.next=13,t.transport.consume({id:a,producerId:s,kind:r,rtpParameters:c,appData:{producerPaused:u,userId:t.uid}});case 13:return d=n.sent,"audio"===r?(Fs(d,t.transport),this._log.send(new Ft(1,t.uid))):"video"===r&&this._log.send(new jt(1,t.uid,e)),d.observer.on("close",(function(){l.debug("[CONSUMER_CLOSED] - ".concat(r,":").concat(a)),l._consumerMap.delete(d.id);var e=l._userMap.get(d.appData.userId);e&&("audio"===d.kind&&(e.media.audioTrack=void 0),"video"===d.kind&&(e.media.videoTrack=void 0)),setTimeout((function(){d.removeAllListeners(),d.observer.removeAllListeners()}))})),this._consumerMap.set(d.id,d),n.abrupt("return",Promise.resolve(d));case 18:case"end":return n.stop()}}),n,this)})))}},{key:"_pauseConsumer",value:function(e){var t=e.consumerId,r=this._consumerMap.get(t);r&&r.pause()}},{key:"_resumeConsumer",value:function(e){var t=e.consumerId,r=this._consumerMap.get(t);r&&r.resume()}},{key:"_closeConsumer",value:function(e){var t=e.consumerId,r=this._consumerMap.get(t);r&&r.close()}},{key:"_createTransport",value:function(e,t){return Pe(this,void 0,void 0,G.mark((function r(){var n,i,o,a,s,c,u;return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,n=t.transportId,i=t.iceParameters,o=t.iceCandidates,a=t.dtlsParameters,s=t.appData,c="send"===e?this._mediasoupDevice.createSendTransport.bind(this._mediasoupDevice):this._mediasoupDevice.createRecvTransport.bind(this._mediasoupDevice),(u=c({id:n,iceParameters:i,iceCandidates:o,dtlsParameters:a,appData:s})).appData.iceParameters=i,u.appData.iceCandidates=o,this._handleTransport(u),Us(u),r.abrupt("return",Promise.resolve(u));case 11:return r.prev=11,r.t0=r.catch(0),r.abrupt("return",Promise.reject(r.t0));case 14:case"end":return r.stop()}}),r,this,[[0,11]])})))}},{key:"_handleTransport",value:function(e){var t=this;e.on("connect",(function(r,n,i){var o=r.dtlsParameters;t._request("connectWebRTCTransport",{transportId:e.id,dtlsParameters:o,producerUserId:e.appData.producerUserId}).then(n).catch(i)})),e.on("connectionstatechange",(function(r){t.info("[CONNECTIONSTATECHANGE] - transportId: ".concat(e.id," state: ").concat(r,".")),t.joined?("disconnected"===r&&(t.debug("restartIce"),setTimeout((function(){e.restartIce({iceParameters:e.appData.iceParameters})}),1e3)),"failed"===r&&t.safeEmit("error",{reason:"PEERCONNECTION_FAILED",type:"error"})):t.debug("Will not retry because you are left")})),"send"===e.direction&&e.on("produce",(function(e,t){t({id:ns()})}))}},{key:"getStatsFromServer",value:function(){var e;return Pe(this,void 0,void 0,G.mark((function t(){return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.joined){t.next=4;break}return t.abrupt("return",null===(e=this._protoo)||void 0===e?void 0:e.request("getStats"));case 4:return t.abrupt("return",{});case 5:case"end":return t.stop()}}),t,this)})))}},{key:"emitNetWorkQuality",value:function(){var e=0,t=0,n=0,i=function(r){r.mimeType&&(e+=r.rtt,e/=2,t+=(null==r?void 0:r.fractionLost)||0,t/=2)},o=function(t){t.mimeType&&(e+=t.rtt,e/=2,n+=(null==t?void 0:t.fractionLost)||0,n/=2)};this._sendTransport&&(Object.values(this._sendTransport.appData.stats.video).forEach(i),Object.values(this._sendTransport.appData.stats.audio).forEach(i)),this._peers.forEach((function(e){var t=e.transport;t&&(Object.values(t.appData.stats.video).forEach(o),Object.values(t.appData.stats.audio).forEach(o))}));var a=0,s=0,c=0;e<0||e>1e3?a=5:e<=100?a=1:e<=200?a=2:e<=500?a=3:e<=1e3&&(a=4),t>.2?s=5:t<=.02?s=1:t<=.05?s=2:t<=.1?s=3:t<=.2&&(s=4),n>.2?c=5:n<=.02?c=1:n<=.05?c=2:n<=.1?c=3:n<=.2&&(c=4),f(d(r.prototype),"safeEmit",this).call(this,"network-quality",{uplinkNetworkQuality:this._reconnecting?6:Math.max(a,s),downlinkNetworkQuality:this._reconnecting?6:Math.max(a,c)})}},{key:"autoStreamReport",value:function(){var e=this;this._autoReport=window.setInterval((function(){var t=function(e){var t,r,n,i,o,a,s,c={ts:Date.now(),appId:e.appId,roomId:e.roomId,sid:e.sessionId,uid:Number(e.userId),connId:e.connectId,uRole:e.role,signalReconnTimes:e.reconnectTimes,userDev:{userNet:ws.unknown,userDevInfo:"".concat(Wa.getOSName()).concat(Wa.getOSVersion(),"_").concat(Wa.getBrowserName()).concat(Wa.getBrowserVersion()),isBg:e.isInBackground,uosv:"Web",sdkPublicVer:"CoreRTC_Web_".concat("V6.0.8_Apr_13_2022"),sdkSignalVer:"5.1.1"},mediaServerInfo:{audioServerIp:"",audioServerPort:0,audioServerId:0,audioChanState:0,videoServerIp:"",videoServerPort:0,videoServerId:0,videoChanState:0},audioInfo:{audioRecv:[],audioSend:[]},videoInfo:{videoRecv:[],videoSend:[]},systemEnvironments:[]},u=null===(r=null===(t=e.sendTransport)||void 0===t?void 0:t.appData)||void 0===r?void 0:r.iceCandidates;if(Array.isArray(u)&&u.length>0){var d=u[0],l=d.ip,p=d.port;c.mediaServerInfo.audioServerIp=l,c.mediaServerInfo.videoServerIp=l,c.mediaServerInfo.videoServerPort=p,c.mediaServerInfo.audioServerPort=p}var f=null===(o=null===(i=null===(n=e.sendTransport)||void 0===n?void 0:n.appData)||void 0===i?void 0:i.stats)||void 0===o?void 0:o.state;f&&(c.mediaServerInfo.audioChanState=f,c.mediaServerInfo.videoChanState=f);var h=null===(s=null===(a=null==e?void 0:e.sendTransport)||void 0===a?void 0:a._appData)||void 0===s?void 0:s.stats;if(!h)return c;switch(h.networkType.toLowerCase()){case"3g":c.userDev.userNet=ws._3G;break;case"4g":c.userDev.userNet=ws._4G;break;case"5g":c.userDev.userNet=ws._5G;break;case"wifi":c.userDev.userNet=ws.Wifi;break;default:c.userDev.userNet=ws.unknown}return c}(e),r="event=sdk_heartbeat ".concat(JSON.stringify(t));Es("https://serverlog.eaydu.com:15100",r).catch((function(){}))}),1e4)}},{key:"getLocalVideoStats",value:function(){if(!this._localVideoTrack||!this._sendTransport)return{};var e=this._producerMap.get(this._localVideoTrack.getTrackId());if(!e)return{};var t=gc(this._sendTransport,e);return{captureFrameRate:t.framesPerSecond||0,captureResolutionHeight:t.frameHeight||0,captureResolutionWidth:t.frameWidth||0,codecType:"H264",currentPacketLossRate:t.packetsLost/t.packetsSent||0,encodeDelay:t.avgEncodeMs||0,sendBitrate:t.bitrate||0,sendBytes:t.bytesSent||0,sendFrameRate:t.framesPerSecond||0,sendPackets:t.packetsSent||0,sendPacketsLost:t.packetsLost||0,sendResolutionHeight:t.frameHeight||0,sendResolutionWidth:t.frameWidth||0,targetSendBitrate:this._localVideoTrack._encoderConfig.bitrateMax||0,totalDuration:this._localVideoTrack._publishTimestamp?Math.floor(Date.now()-this._localVideoTrack._publishTimestamp):1,totalFreezeTime:0}}},{key:"getLocalAudioStats",value:function(){var e,t,r,n=null===(r=null===(t=null===(e=this._sendTransport)||void 0===e?void 0:e.appData)||void 0===t?void 0:t.stats)||void 0===r?void 0:r.audio;if(!n)return{};var i=this._localAudioTrack.producers[0];if(!i)return{};var o=n[i.rtpParameters.encodings[0].ssrc]||{};return{codecType:"opus",sendBytes:o.bytesSent||0,sendVolumeLevel:this._localAudioTrack.getVolumeLevel()||0,currentPacketLossRate:o.packetsLost/o.packetsSent||0,sendPackets:o.packetsSent||0,sendBitrate:o.bitrate||0,sendPacketsLost:o.packetsLost||0}}},{key:"_getConsumerStats",value:function(e,t){var r=e.getTrackId(),n=e.consumer;if(n&&t.transport){var i=n.rtpParameters.encodings,o=t.transport.appData.stats,a=n.id;if(Array.isArray(i)&&!(i.length<=0)){var s=i[0].ssrc||0;return o[e.trackMediaType][s]}this.debug("No encodings - consumerId: ".concat(a," ").concat(r))}else this.debug("Media transport is broken: ".concat(r))}},{key:"getRTCStats",value:function(){if(!this._sendTransport)return{};var e=this._sendTransport.appData.stats;return{Duration:this._publishTimeStamp?Date.now()-this._publishTimeStamp:1,OutgoingAvailableBandwidth:e.availableOutgoingBitrate,RTT:e.currentRoundTripTime,RecvBitrate:0,RecvBytes:0,SendBitrate:e.bitrate,SendBytes:e.bytesSent,UserCount:this.remoteUsers.length+this.role===1?2:1}}},{key:"getRemoteAudioStats",value:function(){var e=this,t={};return this._userMap.forEach((function(r){if(r.media.audioTrack){var n=e._getConsumerStats(r.media.audioTrack,r);t[r.uid]={codecType:"opus",currentPacketLossRate:null==n?void 0:n.fractionLost,freezeRate:n.TotalFreezeTime/n.TotalPlayDuration,packetLossRate:n.packetsLost/n.packetsReceived,totalDuration:r.media.audioTrack._subscribeTimestamp?Date.now()-r.media.audioTrack._subscribeTimestamp:1,receiveBitrate:n.bitrate,receiveBytes:n.bytesReceived,receiveDelay:n.jitterBufferMs,receiveLevel:n.audioLevel,receivePackets:n.packetsReceived,receivePacketsLost:n.packetsLost,publishDuration:0,totalFreezeTime:n.TotalFreezeTime,transportDelay:0}}})),t}},{key:"getRemoteVideoStats",value:function(){var e=this,t={};return this._userMap.forEach((function(r){if(r.media.videoTrack){var n=e._getConsumerStats(r.media.videoTrack,r);t[r.uid]={codecType:"H264",currentPacketLossRate:n.fractionLost,decodeFrameRate:n.framesDecoded,end2EndDelay:-1,freezeRate:n.TotalFreezeTime/n.TotalPlayDuration,packetLossRate:n.packetsLost/n.packetsReceived,totalDuration:r.media.videoTrack._subscribeTimestamp?Date.now()-r.media.videoTrack._subscribeTimestamp:1,receiveBitrate:n.bitrate,receiveBytes:n.bytesReceived,receiveDelay:n.jitterBufferMs,receiveFrameRate:n.framesPerSecond,receivePackets:n.packetsReceived,receivePacketsLost:n.packetsLost,publishDuration:-1,receiveResolutionHeight:n.frameHeight,receiveResolutionWidth:n.frameWidth,renderFrameRate:n.framesPerSecond,totalFreezeTime:-1,transportDelay:-1}}})),t}}]),r}(),vc=function(e){return new Promise((function(t){e.observer.once("@state-changed",(function(e){"ready"===e&&t(!0)}))}))},gc=function(e,t){var r,n=e.appData.stats,i=(null!==(r=t.rtpParameters)&&void 0!==r?r:{}).encodings;if(Array.isArray(i)&&i[0]){var o=i[0].ssrc||0;return n.video[o]||{}}};Po.prototype.getNativeRtpCapabilities=function(){return Pe(this,void 0,void 0,G.mark((function e(){var t,r,n,i;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"}),e.prev=1,t.addTransceiver("video"),t.addTransceiver("audio"),e.next=6,t.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});case 6:r=e.sent,e.prev=7,t.close(),e.next=14;break;case 11:return e.prev=11,e.t0=e.catch(7),e.abrupt("return",{});case 14:return n=jn.parse(r.sdp),i=Kn({sdpObject:n}),console.log(i),e.abrupt("return",i);case 20:e.prev=20,e.t1=e.catch(1),e.prev=22,t.close(),e.next=29;break;case 26:throw e.prev=26,e.t2=e.catch(22),e.t1;case 29:return e.abrupt("return",{});case 30:case"end":return e.stop()}}),e,null,[[1,20],[7,11],[22,26]])})))};var mc=Po.prototype.send;Po.prototype.send=function(e){var t=e.track,r=e.encodings,n=e.codecOptions,i=e.codec;return Pe(this,void 0,void 0,G.mark((function e(){var o,a,s,c,u,d;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=t.kind,t=t.clone(),s="",this._mapSendLocalIdRtpSender.forEach((function(e,t){var r;(null===(r=e.track)||void 0===r?void 0:r.kind)===o&&(a=e,s=t)})),!a){e.next=16;break}return console.log("Safari11 Handler: republish - ".concat(o)),this.replaceTrack(s,t),c=jn.parse(this._pc.localDescription.sdp),u=c.media.find((function(e){return e.type===o})),(d=JSON.parse(JSON.stringify(this._sendingRtpParametersByKind[o]))).codecs=zr(d.codecs),d.rtcp.cname=Wn({offerMediaObject:u}),d.encodings=Wi({offerMediaObject:u,track:t}),e.abrupt("return",{localId:s,rtpSender:a,rtpParameters:d});case 16:return e.next=18,mc.call(this,{track:t,encodings:r,codecOptions:n,codec:i});case 18:return e.abrupt("return",e.sent);case 19:case"end":return e.stop()}}),e,this)})))},Po.prototype.stopSending=function(e){return Pe(this,void 0,void 0,G.mark((function t(){return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.replaceTrack(e,null),t.abrupt("return");case 2:case"end":return t.stop()}}),t,this)})))},uo.prototype.getTransportStats=function(){return Pe(this,void 0,void 0,G.mark((function e(){var t=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e){return Pe(t,void 0,void 0,G.mark((function t(){var r,n;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=function(t){e(t.result())},t.next=3,this._pc.getStats(r);case 3:(n=t.sent)&&e(n.result());case 5:case"end":return t.stop()}}),t,this)})))})));case 1:case"end":return e.stop()}}),e)})))},fn.prototype.toString=function(){var e;return"Producer[".concat(this.kind,", ").concat(this.id,", ").concat(this.paused?"paused":"playing",", ").concat(this.closed?"closed":"open",", ").concat(null===(e=this.track)||void 0===e?void 0:e.kind,"Track#").concat(this.track?this.track.id+(this.track.enabled?" enabled ":" disabled ")+(this.track.muted?"muted":"unmuted"):"null","]")},gn.prototype.toString=function(){return"Consumer[".concat(this.kind,", ").concat(this.id,", ").concat(this.producerId,", ").concat(this.paused?"paused":"playing",", ").concat(this.closed?"closed":"open",", ").concat(this.track.kind,"Track#").concat(this.track?this.track.id+(this.track.enabled?"-enabled":"-disabled")+(this.track.muted?"-muted":"-unmuted"):"null","]")};var Ec=function(e){k(r,tc);var t=xe(r);function r(e,n,i){var o;return U(this,r),(o=t.call(this,e,lc(8,"track-cam-"))).config=n,o._encoderConfig=i,o}return F(r,[{key:"setEncoderConfiguration",value:function(e){if(!e)throw new ha(fa.INVALID_PARAMS,"");var t=As({encoderConfig:e}).trackConfig;this.config=t,this.track&&this.track.applyConstraints(t)}},{key:"setDevice",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){var r,n;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Ha({video:Object.assign(Object.assign({},this.config),{deviceId:e})});case 2:r=t.sent,n=r.getVideoTracks()[0],this.replaceTrack(n);case 5:case"end":return t.stop()}}),t,this)})))}}]),r}(),_c=function(e){k(r,uc);var t=xe(r);function r(e,n){var i;return U(this,r),(i=t.call(this,e,lc(8,"track-mic-"))).config=n,ac.bindInterruptDetectorTrack(S(i)),i}return F(r,[{key:"setDevice",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){var r,n;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._log.userInvoke("setDevice",e),t.next=3,Ha({audio:Object.assign(Object.assign({},this.config),{deviceId:e})});case 3:r=t.sent,n=r.getAudioTracks()[0],this.track&&"live"===this.track.readyState&&this.track.stop(),this.replaceTrack(n);case 7:case"end":return t.stop()}}),t,this)})))}},{key:"close",value:function(){f(d(r.prototype),"close",this).call(this),ts()&&ac.unbindInterruptDetectorTrack(this)}}]),r}();function yc(e,t){var r=1/t,n=Ws(),i=n.createGain();i.gain.value=0,i.connect(n.destination);var o=!1;return function t(){if(!o){var a=n.createOscillator();a.onended=t,a.connect(i),a.start(0),a.stop(n.currentTime+r),e(n.currentTime)}}(),function(){o=!0}}function Ic(e,t,r,n){return Pe(this,void 0,void 0,G.mark((function i(){var o,a,s,c;return G.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return a=0,c=!1,e.addEventListener("canplay",(function(){c=!0})),i.abrupt("return",new Promise((function(i,u){setTimeout((function(){o&&(o(),i(a))}),t),o=yc((function(){!function(){if(c){a>n&&o&&(o(),i(a));var t=r.getContext("2d");if(t){t.drawImage(e,0,0,160,120);var d=t.getImageData(0,0,r.width,r.height),l=Math.floor(d.data.length/3);if(s){for(var p=0;p<l;p+=3)if(d.data[p]!==s[p])return a+=1;s=d.data}else s=d.data}else u("can not get canvas 2d context.")}}()}),30)})));case 3:case"end":return i.stop()}}),i)})))}var Sc,bc=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3;return Pe(void 0,void 0,void 0,G.mark((function r(){var n,i,o;return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return t&&t<1e3&&(t=5e3),(n=document.createElement("video")).style.width="1px",n.style.height="1px",n.setAttribute("muted",""),n.muted=!0,n.setAttribute("playsinline",""),n.controls=!1,n.style.opacity="0.01",n.style.position="fixed",n.style.left="0",n.style.top="0",document.body.appendChild(n),n.srcObject=new MediaStream([e]),n.addEventListener("loadedmetadata",(function(){n.play()})),(i=document.createElement("canvas")).width=160,i.height=120,o=0,r.prev=19,r.next=22,Ic(n,t,i,4);case 22:o=r.sent,r.next=28;break;case 25:throw r.prev=25,r.t0=r.catch(19),new ha(fa.CHECK_VIDEO_TRACK_ERROR,"string"==typeof r.t0?r.t0:"checkVideoTrackIsActive ERROR");case 28:return n.pause(),n.remove(),n.srcObject=null,r.abrupt("return",o>4);case 32:case"end":return r.stop()}}),r,null,[[19,25]])})))},Cc=function(e){k(r,cc);var t=xe(r);function r(e){var n;return U(this,r),(n=t.call(this)).startPlayTime=0,n._log=new Cs("BufferSourceAudioControl"),n.startPlayOffset=0,n.pausePlayTime=0,n.currentLoopCount=0,n._currentState="stopped",n.options={},n.audioBuffer=e,n}return F(r,[{key:"currentState",get:function(){return this._currentState},set:function(e){e!==this._currentState&&(this._currentState=e,this.emit(ic.AUDIO_SOURCE_STATE_CHANGE,this._currentState))}},{key:"duration",get:function(){return this.audioBuffer.duration}},{key:"currentTime",get:function(){return this.currentState?0:"paused"===this.currentState?this.pausePlayTime:(this.context.currentTime-this.startPlayTime+this.startPlayOffset)%this.audioBuffer.duration}},{key:"createWebAudioDiagram",value:function(){return this.context.createGain()}},{key:"updateOptions",value:function(e){"stopped"===this.currentState?(this.options=e,this.startPlayOffset=this.options.startPlayTime||0):this._log.warn("can not set audio source options")}},{key:"startProcessAudioBuffer",value:function(){this.sourceNode&&this.stopProcessAudioBuffer(),this.sourceNode=this.createSourceNode(),this.startSourceNode(),this.currentState="playing"}},{key:"pauseProcessAudioBuffer",value:function(){this.sourceNode&&"playing"===this.currentState&&(this.pausePlayTime=this.currentTime,this.sourceNode.onended=null,this.sourceNode.stop(),this.sourceNode.buffer=null,this.sourceNode=this.createSourceNode(),this.currentState="paused")}},{key:"seekAudioBuffer",value:function(e){this.sourceNode&&(this.sourceNode.onended=null,"playing"===this.currentState&&this.sourceNode.stop()),this.sourceNode=this.createSourceNode(),"playing"===this.currentState?(this.startPlayOffset=e,this.startSourceNode()):"paused"===this.currentState&&(this.pausePlayTime=e)}},{key:"resumeProcessAudioBuffer",value:function(){"paused"===this.currentState&&this.sourceNode&&(this.startPlayOffset=this.pausePlayTime,this.pausePlayTime=0,this.startSourceNode(),this.currentState="playing")}},{key:"stopProcessAudioBuffer",value:function(){if(this.sourceNode){this.sourceNode.onended=null;try{this.sourceNode.stop()}catch(e){}this.reset()}}},{key:"startSourceNode",value:function(){this.sourceNode&&this.sourceNode.buffer&&(this.sourceNode.start(0,this.startPlayOffset),this.startPlayTime=this.context.currentTime,this.sourceNode.onended=this.handleSourceNodeEnded.bind(this))}},{key:"createSourceNode",value:function(){var e=this.context.createBufferSource();return e.buffer=this.audioBuffer,e.loop=!!this.options.loop,e.connect(this.outputNode),e}},{key:"handleSourceNodeEnded",value:function(){if(this.currentLoopCount+=1,this.options.cycle&&this.options.cycle>this.currentLoopCount)return this.startPlayOffset=0,this.sourceNode=void 0,void this.startProcessAudioBuffer();this.reset()}},{key:"reset",value:function(){this.startPlayOffset=this.options.startPlayTime||0,this.currentState="stopped",this.sourceNode&&(this.sourceNode.disconnect(),this.sourceNode=void 0),this.currentLoopCount=0}}]),r}();!function(e){e.SOURCE_STATE_CHANGE="source-state-change",e.TRACK_ENDED="track-ended",e.BEAUTY_EFFECT_OVERLOAD="beauty-effect-overload",e.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status"}(Sc||(Sc={}));var wc=function(e){k(r,uc);var t=xe(r);function r(e,n,i){var o;U(this,r),(o=t.call(this,n.createOutputTrack(),lc(8,"track-buf"),!1)).source=e,o.audioNode=n.outputNode,o._bufferSource=n,o._bufferSource.on(ic.AUDIO_SOURCE_STATE_CHANGE,(function(e){o.emit(Sc.SOURCE_STATE_CHANGE,e)}));try{o.track=o._source.createOutputTrack()}catch(e){}return o}return F(r,[{key:"currentState",get:function(){return this._bufferSource.currentState}},{key:"duration",get:function(){return this._bufferSource.duration}},{key:"getCurrentTime",value:function(){return this._bufferSource.currentTime}},{key:"startProcessAudioBuffer",value:function(e){e&&this._bufferSource.updateOptions(e),this._bufferSource.startProcessAudioBuffer()}},{key:"pauseProcessAudioBuffer",value:function(){this._bufferSource.pauseProcessAudioBuffer()}},{key:"seekAudioBuffer",value:function(e){this._bufferSource.seekAudioBuffer(e)}},{key:"resumeProcessAudioBuffer",value:function(){this._bufferSource.resumeProcessAudioBuffer()}},{key:"stopProcessAudioBuffer",value:function(){this._bufferSource.stopProcessAudioBuffer()}},{key:"play",value:function(){this._source.play()}},{key:"stop",value:function(){this._source.stop()}},{key:"close",value:function(){f(d(r.prototype),"close",this).call(this),this._source.destroy()}},{key:"getVolumeLevel",value:function(){return this._source.getAccurateVolumeLevel()}},{key:"setPlaybackDevice",value:function(){return Promise.reject(new ha(fa.NOT_SUPPORTED,"your browser does not support setting the audio output device"))}},{key:"setVolume",value:function(e){this._volume=e,this._source.setVolume(e/100)}}]),r}(),Rc=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}},Tc=Object.prototype.toString;function kc(e){return Array.isArray(e)}function Oc(e){return void 0===e}function Dc(e){return"[object ArrayBuffer]"===Tc.call(e)}function Nc(e){return null!==e&&"object"===Ue(e)}function xc(e){if("[object Object]"!==Tc.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function Pc(e){return"[object Function]"===Tc.call(e)}function Lc(e,t){if(null!=e)if("object"!==Ue(e)&&(e=[e]),kc(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}var Bc={isArray:kc,isArrayBuffer:Dc,isBuffer:function(e){return null!==e&&!Oc(e)&&null!==e.constructor&&!Oc(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"[object FormData]"===Tc.call(e)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Dc(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:Nc,isPlainObject:xc,isUndefined:Oc,isDate:function(e){return"[object Date]"===Tc.call(e)},isFile:function(e){return"[object File]"===Tc.call(e)},isBlob:function(e){return"[object Blob]"===Tc.call(e)},isFunction:Pc,isStream:function(e){return Nc(e)&&Pc(e.pipe)},isURLSearchParams:function(e){return"[object URLSearchParams]"===Tc.call(e)},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:Lc,merge:function e(){var t={};function r(r,n){xc(t[n])&&xc(r)?t[n]=e(t[n],r):xc(r)?t[n]=e({},r):kc(r)?t[n]=r.slice():t[n]=r}for(var n=0,i=arguments.length;n<i;n++)Lc(arguments[n],r);return t},extend:function(e,t,r){return Lc(t,(function(t,n){e[n]=r&&"function"==typeof t?Rc(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}};function Mc(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var Uc=function(e,t,r){if(!t)return e;var n;if(r)n=r(t);else if(Bc.isURLSearchParams(t))n=t.toString();else{var i=[];Bc.forEach(t,(function(e,t){null!=e&&(Bc.isArray(e)?t+="[]":e=[e],Bc.forEach(e,(function(e){Bc.isDate(e)?e=e.toISOString():Bc.isObject(e)&&(e=JSON.stringify(e)),i.push(Mc(t)+"="+Mc(e))})))})),n=i.join("&")}if(n){var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e};function Qc(){this.handlers=[]}Qc.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},Qc.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},Qc.prototype.forEach=function(e){Bc.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var Fc=Qc,jc=void 0!==ne?ne:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function Vc(){throw new Error("setTimeout has not been defined")}function Gc(){throw new Error("clearTimeout has not been defined")}var Kc=Vc,Hc=Gc;function Wc(e){if(Kc===setTimeout)return setTimeout(e,0);if((Kc===Vc||!Kc)&&setTimeout)return Kc=setTimeout,setTimeout(e,0);try{return Kc(e,0)}catch(t){try{return Kc.call(null,e,0)}catch(t){return Kc.call(this,e,0)}}}"function"==typeof jc.setTimeout&&(Kc=setTimeout),"function"==typeof jc.clearTimeout&&(Hc=clearTimeout);var Yc,qc=[],Jc=!1,zc=-1;function Xc(){Jc&&Yc&&(Jc=!1,Yc.length?qc=Yc.concat(qc):zc=-1,qc.length&&Zc())}function Zc(){if(!Jc){var e=Wc(Xc);Jc=!0;for(var t=qc.length;t;){for(Yc=qc,qc=[];++zc<t;)Yc&&Yc[zc].run();zc=-1,t=qc.length}Yc=null,Jc=!1,function(e){if(Hc===clearTimeout)return clearTimeout(e);if((Hc===Gc||!Hc)&&clearTimeout)return Hc=clearTimeout,clearTimeout(e);try{Hc(e)}catch(t){try{return Hc.call(null,e)}catch(t){return Hc.call(this,e)}}}(e)}}function $c(e,t){this.fun=e,this.array=t}$c.prototype.run=function(){this.fun.apply(null,this.array)};function eu(){}var tu=eu,ru=eu,nu=eu,iu=eu,ou=eu,au=eu,su=eu;var cu=jc.performance||{},uu=cu.now||cu.mozNow||cu.msNow||cu.oNow||cu.webkitNow||function(){return(new Date).getTime()};var du=new Date;var lu={nextTick:function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];qc.push(new $c(e,t)),1!==qc.length||Jc||Wc(Zc)},title:"browser",browser:!0,env:{},argv:[],version:"",versions:{},on:tu,addListener:ru,once:nu,off:iu,removeListener:ou,removeAllListeners:au,emit:su,binding:function(e){throw new Error("process.binding is not supported")},cwd:function(){return"/"},chdir:function(e){throw new Error("process.chdir is not supported")},umask:function(){return 0},hrtime:function(e){var t=.001*uu.call(cu),r=Math.floor(t),n=Math.floor(t%1*1e9);return e&&(r-=e[0],(n-=e[1])<0&&(r--,n+=1e9)),[r,n]},platform:"browser",release:{},config:{},uptime:function(){return(new Date-du)/1e3}},pu=function(e,t){Bc.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))},fu=function(e,t,r,n,i){return e.config=t,r&&(e.code=r),e.request=n,e.response=i,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}},e},hu={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Au=function(e,t,r,n,i){var o=new Error(e);return fu(o,t,r,n,i)},vu=Bc.isStandardBrowserEnv()?{write:function(e,t,r,n,i,o){var a=[];a.push(e+"="+encodeURIComponent(t)),Bc.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),Bc.isString(n)&&a.push("path="+n),Bc.isString(i)&&a.push("domain="+i),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},gu=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],mu=Bc.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=Bc.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0};function Eu(e){this.message=e}Eu.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Eu.prototype.__CANCEL__=!0;var _u=Eu,yu=function(e){return new Promise((function(t,r){var n,i=e.data,o=e.headers,a=e.responseType;function s(){e.cancelToken&&e.cancelToken.unsubscribe(n),e.signal&&e.signal.removeEventListener("abort",n)}Bc.isFormData(i)&&delete o["Content-Type"];var c=new XMLHttpRequest;if(e.auth){var u=e.auth.username||"",d=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(u+":"+d)}var l,p,f=(l=e.baseURL,p=e.url,l&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(p)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(l,p):p);function h(){if(c){var n,i,o,u,d,l="getAllResponseHeaders"in c?(n=c.getAllResponseHeaders(),d={},n?(Bc.forEach(n.split("\n"),(function(e){if(u=e.indexOf(":"),i=Bc.trim(e.substr(0,u)).toLowerCase(),o=Bc.trim(e.substr(u+1)),i){if(d[i]&&gu.indexOf(i)>=0)return;d[i]="set-cookie"===i?(d[i]?d[i]:[]).concat([o]):d[i]?d[i]+", "+o:o}})),d):d):null;!function(e,t,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(Au("Request failed with status code "+r.status,r.config,null,r.request,r)):e(r)}((function(e){t(e),s()}),(function(e){r(e),s()}),{data:a&&"text"!==a&&"json"!==a?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:l,config:e,request:c}),c=null}}if(c.open(e.method.toUpperCase(),Uc(f,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=h:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(h)},c.onabort=function(){c&&(r(Au("Request aborted",e,"ECONNABORTED",c)),c=null)},c.onerror=function(){r(Au("Network Error",e,null,c)),c=null},c.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",n=e.transitional||hu;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(Au(t,e,n.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",c)),c=null},Bc.isStandardBrowserEnv()){var A=(e.withCredentials||mu(f))&&e.xsrfCookieName?vu.read(e.xsrfCookieName):void 0;A&&(o[e.xsrfHeaderName]=A)}"setRequestHeader"in c&&Bc.forEach(o,(function(e,t){void 0===i&&"content-type"===t.toLowerCase()?delete o[t]:c.setRequestHeader(t,e)})),Bc.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),a&&"json"!==a&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(n=function(e){c&&(r(!e||e&&e.type?new _u("canceled"):e),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(n),e.signal&&(e.signal.aborted?n():e.signal.addEventListener("abort",n))),i||(i=null),c.send(i)}))},Iu={"Content-Type":"application/x-www-form-urlencoded"};function Su(e,t){!Bc.isUndefined(e)&&Bc.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var bu,Cu={transitional:hu,adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==lu&&"[object process]"===Object.prototype.toString.call(lu))&&(bu=yu),bu),transformRequest:[function(e,t){return pu(t,"Accept"),pu(t,"Content-Type"),Bc.isFormData(e)||Bc.isArrayBuffer(e)||Bc.isBuffer(e)||Bc.isStream(e)||Bc.isFile(e)||Bc.isBlob(e)?e:Bc.isArrayBufferView(e)?e.buffer:Bc.isURLSearchParams(e)?(Su(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):Bc.isObject(e)||t&&"application/json"===t["Content-Type"]?(Su(t,"application/json"),function(e,t,r){if(Bc.isString(e))try{return(t||JSON.parse)(e),Bc.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||Cu.transitional,r=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,i=!r&&"json"===this.responseType;if(i||n&&Bc.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw fu(e,this,"E_JSON_PARSE");throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Bc.forEach(["delete","get","head"],(function(e){Cu.headers[e]={}})),Bc.forEach(["post","put","patch"],(function(e){Cu.headers[e]=Bc.merge(Iu)}));var wu=Cu,Ru=function(e,t,r){var n=this||wu;return Bc.forEach(r,(function(r){e=r.call(n,e,t)})),e},Tu=function(e){return!(!e||!e.__CANCEL__)};function ku(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new _u("canceled")}var Ou=function(e){return ku(e),e.headers=e.headers||{},e.data=Ru.call(e,e.data,e.headers,e.transformRequest),e.headers=Bc.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),Bc.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||wu.adapter)(e).then((function(t){return ku(e),t.data=Ru.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return Tu(t)||(ku(e),t&&t.response&&(t.response.data=Ru.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},Du=function(e,t){t=t||{};var r={};function n(e,t){return Bc.isPlainObject(e)&&Bc.isPlainObject(t)?Bc.merge(e,t):Bc.isPlainObject(t)?Bc.merge({},t):Bc.isArray(t)?t.slice():t}function i(r){return Bc.isUndefined(t[r])?Bc.isUndefined(e[r])?void 0:n(void 0,e[r]):n(e[r],t[r])}function o(e){if(!Bc.isUndefined(t[e]))return n(void 0,t[e])}function a(r){return Bc.isUndefined(t[r])?Bc.isUndefined(e[r])?void 0:n(void 0,e[r]):n(void 0,t[r])}function s(r){return r in t?n(e[r],t[r]):r in e?n(void 0,e[r]):void 0}var c={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s};return Bc.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=c[e]||i,n=t(e);Bc.isUndefined(n)&&t!==s||(r[e]=n)})),r},Nu="0.26.1",xu=Nu,Pu={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){Pu[e]=function(r){return Ue(r)===e||"a"+(t<1?"n ":" ")+e}}));var Lu={};Pu.transitional=function(e,t,r){function n(e,t){return"[Axios v"+xu+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,i,o){if(!1===e)throw new Error(n(i," has been removed"+(t?" in "+t:"")));return t&&!Lu[i]&&(Lu[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,o)}};var Bu={assertOptions:function(e,t,r){if("object"!==Ue(e))throw new TypeError("options must be an object");for(var n=Object.keys(e),i=n.length;i-- >0;){var o=n[i],a=t[o];if(a){var s=e[o],c=void 0===s||a(s,o,e);if(!0!==c)throw new TypeError("option "+o+" must be "+c)}else if(!0!==r)throw Error("Unknown option "+o)}},validators:Pu},Mu=Bu.validators;function Uu(e){this.defaults=e,this.interceptors={request:new Fc,response:new Fc}}Uu.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=Du(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;void 0!==r&&Bu.assertOptions(r,{silentJSONParsing:Mu.transitional(Mu.boolean),forcedJSONParsing:Mu.transitional(Mu.boolean),clarifyTimeoutError:Mu.transitional(Mu.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,n.unshift(e.fulfilled,e.rejected))}));var o,a=[];if(this.interceptors.response.forEach((function(e){a.push(e.fulfilled,e.rejected)})),!i){var s=[Ou,void 0];for(Array.prototype.unshift.apply(s,n),s=s.concat(a),o=Promise.resolve(t);s.length;)o=o.then(s.shift(),s.shift());return o}for(var c=t;n.length;){var u=n.shift(),d=n.shift();try{c=u(c)}catch(e){d(e);break}}try{o=Ou(c)}catch(e){return Promise.reject(e)}for(;a.length;)o=o.then(a.shift(),a.shift());return o},Uu.prototype.getUri=function(e){return e=Du(this.defaults,e),Uc(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},Bc.forEach(["delete","get","head","options"],(function(e){Uu.prototype[e]=function(t,r){return this.request(Du(r||{},{method:e,url:t,data:(r||{}).data}))}})),Bc.forEach(["post","put","patch"],(function(e){Uu.prototype[e]=function(t,r,n){return this.request(Du(n||{},{method:e,url:t,data:r}))}}));var Qu=Uu;function Fu(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;this.promise.then((function(e){if(r._listeners){var t,n=r._listeners.length;for(t=0;t<n;t++)r._listeners[t](e);r._listeners=null}})),this.promise.then=function(e){var t,n=new Promise((function(e){r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e){r.reason||(r.reason=new _u(e),t(r.reason))}))}Fu.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Fu.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},Fu.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},Fu.source=function(){var e;return{token:new Fu((function(t){e=t})),cancel:e}};var ju=Fu;var Vu=function e(t){var r=new Qu(t),n=Rc(Qu.prototype.request,r);return Bc.extend(n,Qu.prototype,r),Bc.extend(n,r),n.create=function(r){return e(Du(t,r))},n}(wu);Vu.Axios=Qu,Vu.Cancel=_u,Vu.CancelToken=ju,Vu.isCancel=Tu,Vu.VERSION=Nu,Vu.all=function(e){return Promise.all(e)},Vu.spread=function(e){return function(t){return e.apply(null,t)}},Vu.isAxiosError=function(e){return Bc.isObject(e)&&!0===e.isAxiosError};var Gu=Vu,Ku=Vu;Gu.default=Ku;var Hu=Gu;"function"!=typeof ja.addEventListener&&(ja.addEventListener=function(e,t){"devicechange"===e&&Fa.push(t)},ja.removeEventListener=function(e,t){if("devicechange"===e){var r=Fa.findIndex((function(e){return e===t}));Fa.splice(r,1)}},ja.ondevicechange=function(e){Fa.forEach((function(t){t(e)}))});var Wu=function(e){k(r,ar);var t=xe(r);function r(){var e;return U(this,r),(e=t.call(this)).SUPPORT_RESOLUTION_LIST=Va,e.Logger={DEBUG:Cs.DEBUG,INFO:Cs.INFO,WARNING:Cs.WARNING,ERROR:Cs.ERROR,NONE:Cs.NONE,setLogLevel:Cs.setLogLevel,enableLogUpload:Cs.enableLogUpload,disableLogUpload:Cs.disableLogUpload},e._log=new Cs("CoreRTC"),e._devices=new Map,e.VERSION="V6.0.8_Apr_13_2022",ja&&ja.enumerateDevices&&(ja.enumerateDevices().then((function(t){var r=Date.now();t.forEach((function(t){var n={device:t,initAt:r};e._devices.set(t.deviceId,n)}))})),e._listenDeviceChange()),e}return F(r,[{key:"getSupportedCodec",value:function(){return Promise.resolve({video:["h264"],audio:["opus"]})}},{key:"createClient",value:function(e){return new Ac(e)}},{key:"createBufferSourceAudioTrack",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){var r,n;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.source instanceof AudioBuffer){t.next=4;break}return t.next=3,Xu(e.source,e.cacheOnlineFile);case 3:e.source=t.sent;case 4:return r=new Cc(e.source),n=hs(e.encoderConfig||nc.music_standard),t.abrupt("return",new wc(e.source,r,n));case 7:case"end":return t.stop()}}),t)})))}},{key:"createCameraVideoTrack",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){var r,n,i,o,a,s,c,u;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=As(e||{encoderConfig:"480p_1"}),n=r.trackConfig,i=r.encoderConfig,t.next=3,Ha({video:n});case 3:if(o=t.sent,a=o.getVideoTracks(),s=E(a,1),c=s[0]){t.next=7;break}return t.abrupt("return",Promise.reject());case 7:return u=new Ec(c,n,i),t.abrupt("return",Promise.resolve(u));case 9:case"end":return t.stop()}}),t)})))}},{key:"createCustomAudioTrack",value:function(e){var t=hs(e.encoderConfig||nc.music_standard),r=new uc(e.mediaStreamTrack,lc(8,"track-cus"),!1);return r.config=t,r}},{key:"createCustomVideoTrack",value:function(e){var t=new tc(e.mediaStreamTrack,lc(8,"track-cus"),!1);return t._encoderConfig={bitrateMax:e.bitrateMax||500,bitrateMin:e.bitrateMin||100},t}},{key:"createMicrophoneAndCameraTracks",value:function(e,t){return Pe(this,void 0,void 0,G.mark((function r(){var n,i,o,a,s,c,u,d,l,p,f,h,A;return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=ls(e||{}),i=As(t||{encoderConfig:"480p"}),o=i.trackConfig,a=i.encoderConfig,r.next=4,Ha({audio:n,video:o});case 4:if(s=r.sent,c=s.getAudioTracks(),u=E(c,1),d=u[0],l=s.getVideoTracks(),p=E(l,1),f=p[0],d&&f){r.next=9;break}return r.abrupt("return",Promise.reject());case 9:return h=new _c(d,n),A=new Ec(f,o,a),r.abrupt("return",Promise.resolve([h,A]));case 12:case"end":return r.stop()}}),r)})))}},{key:"createMicrophoneAudioTrack",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){var r,n,i,o,a,s;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=ls(e||{}),t.next=3,Ha({audio:r});case 3:if(n=t.sent,i=n.getAudioTracks(),o=E(i,1),a=o[0]){t.next=7;break}return t.abrupt("return",Promise.reject());case 7:return s=new _c(a,r),t.abrupt("return",Promise.resolve(s));case 9:case"end":return t.stop()}}),t)})))}},{key:"createScreenVideoTrack",value:function(e,t){return Pe(this,void 0,void 0,G.mark((function r(){var n,i,o,a,s,c,u;return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,ds(e,t);case 2:return n=r.sent,i=E(n,2),o=i[0],a=i[1],s=new tc(o,lc(8,"track-src"),!1),c=null,a&&(u=lc(8,"track-sys"),c=new uc(a,u,!1)),r.abrupt("return",Promise.resolve(c?[s,c]:s));case 10:case"end":return r.stop()}}),r)})))}},{key:"checkVideoTrackIsActive",value:function(e,t){return Pe(this,void 0,void 0,G.mark((function r(){return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.abrupt("return",bc(e,t));case 1:case"end":return r.stop()}}),r)})))}},{key:"checkSystemRequirements",value:function(){return Boolean(pa())}},{key:"getCameras",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){var r,n;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=11;break}return t.prev=1,t.next=4,Ha({audio:!0});case 4:r=t.sent,t.next=11;break;case 7:if(t.prev=7,t.t0=t.catch(1),t.t0.message.toUpperCase()!==fa.PERMISSION_DENIED){t.next=11;break}throw new ha(fa.PERMISSION_DENIED,t.t0.message);case 11:return t.next=13,Ka("videoinput");case 13:return n=t.sent,r&&r.getTracks&&r.getTracks().forEach((function(e){e.stop()})),t.abrupt("return",n);case 16:case"end":return t.stop()}}),t,null,[[1,7]])})))}},{key:"getDevices",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){var r,n;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=11;break}return t.prev=1,t.next=4,Ha({video:!0,audio:!0});case 4:r=t.sent,t.next=11;break;case 7:if(t.prev=7,t.t0=t.catch(1),t.t0.message.toUpperCase()!==fa.PERMISSION_DENIED){t.next=11;break}throw new ha(fa.PERMISSION_DENIED,t.t0.message);case 11:return t.next=13,ja.enumerateDevices();case 13:return n=t.sent,r&&r.getTracks&&r.getTracks().forEach((function(e){e.stop()})),t.abrupt("return",n);case 16:case"end":return t.stop()}}),t,null,[[1,7]])})))}},{key:"getMicrophones",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){var r,n;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=11;break}return t.prev=1,t.next=4,Ha({audio:!0});case 4:r=t.sent,t.next=11;break;case 7:if(t.prev=7,t.t0=t.catch(1),t.t0.message.toUpperCase()!==fa.PERMISSION_DENIED){t.next=11;break}throw new ha(fa.PERMISSION_DENIED,t.t0.message);case 11:return t.next=13,Ka("audioinput");case 13:return n=t.sent,r&&r.getTracks&&r.getTracks().forEach((function(e){e.stop()})),t.abrupt("return",n);case 16:case"end":return t.stop()}}),t,null,[[1,7]])})))}},{key:"getPlaybackDevices",value:function(e){return Pe(this,void 0,void 0,G.mark((function t(){var r,n;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e){t.next=11;break}return t.prev=1,t.next=4,Ha({audio:!0});case 4:r=t.sent,t.next=11;break;case 7:if(t.prev=7,t.t0=t.catch(1),t.t0.message.toUpperCase()!==fa.PERMISSION_DENIED){t.next=11;break}throw new ha(fa.PERMISSION_DENIED,t.t0.message);case 11:return t.next=13,Ka("audiooutput");case 13:return n=t.sent,r&&r.getTracks&&r.getTracks().forEach((function(e){e.stop()})),t.abrupt("return",n);case 16:case"end":return t.stop()}}),t,null,[[1,7]])})))}},{key:"getScreenSources",value:function(e){try{var t=window.require("electron").desktopCapturer.getSources({types:["window","screen"]},e);t instanceof Promise&&t.then((function(t){e&&e(null,t)})).catch((function(t){e&&e(t,[])}))}catch(e){return void console.error("getScreenSources() ",e)}}},{key:"_listenDeviceChange",value:function(){var e=this,t=function(){return Pe(e,void 0,void 0,G.mark((function e(){var t,r,n,i,o=this;return G.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ja.enumerateDevices();case 2:t=e.sent,r=Date.now(),t&&t.length<1?(this._devices.forEach((function(e){o._deviceChange(Object.assign(Object.assign({},e),{updateAt:r}),"INACTIVE")})),this._devices.clear()):(n=new Map,i=new Set,t.forEach((function(e){if(e.deviceId&&"default"!==e.label){if(o._devices.has(e.deviceId)||n.has(e.deviceId))o._devices.has(e.deviceId)&&n.set(e.deviceId,o._devices.get(e.deviceId));else{var t={device:e,initAt:r,updateAt:r};o._deviceChange(Object.assign(Object.assign({},t),{updateAt:r}),"ACTIVE"),n.set(e.deviceId,t)}i.add(e.deviceId)}})),i.forEach((function(e){o._devices.delete(e)})),n.size>0&&(this._devices.forEach((function(e){o._deviceChange(Object.assign(Object.assign({},e),{updateAt:r}),"INACTIVE")})),this._devices=n));case 5:case"end":return e.stop()}}),e,this)})))};ja.addEventListener("devicechange",t),this.on("@close",(function(){ja.removeEventListener("devicechange",t)}))}},{key:"_deviceChange",value:function(e,t){var r=Object.assign(Object.assign({},e),{state:t});switch(e.device.kind){case"audioinput":this.onMicrophoneChanged&&this.onMicrophoneChanged(r);break;case"audiooutput":this.onPlaybackDeviceChanged&&this.onPlaybackDeviceChanged(r);break;case"videoinput":this.onCameraChanged&&this.onCameraChanged(r)}}},{key:"onAutoplayFailed",set:function(e){sc.onAutoplayFailed=e,this._onAutoplayFailed=e}},{key:"_onAutoplayFailed",value:function(){}},{key:"onPlaybackDeviceChanged",value:function(e){}},{key:"onMicrophoneChanged",value:function(e){}},{key:"onCameraChanged",value:function(e){}},{key:"checkAudioTrackIsActive",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3;return Pe(this,void 0,void 0,G.mark((function r(){var n,i,o,a;return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!e||!e.track){r.next=11;break}return(n=new MediaStream).addTrack(e.track),i=Ws(),o=i.createMediaStreamSource(n),a=i.createAnalyser(),o.connect(a),a.minDecibels=-90,a.maxDecibels=-10,a.fftSize=256,r.abrupt("return",new Promise((function(e){var r=0,n=0,i=0,o=t/200,s=setInterval((function(){var t=new Uint8Array(a.frequencyBinCount);a.getByteFrequencyData(t);var c=t.reduce((function(e,t){return e+t}))/a.frequencyBinCount;r=r>c?r:c,n=n<c?n:c,(i+=1)>=o&&(clearInterval(s),e(Boolean(r-n>10)))}),200)})));case 11:case"end":return r.stop()}}),r)})))}}]),r}(),Yu=new Wu,qu=new Map;function Ju(e){return Hu({method:"get",url:e,responseType:"arraybuffer"}).then((function(e){return e.data}))}function zu(e){return Pe(this,void 0,void 0,G.mark((function t(){var r;return G.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=Ws(),t.abrupt("return",new Promise((function(t,n){r.decodeAudioData(e,(function(e){t(e)}),(function(e){n(new ha(fa.DECODE_AUDIO_FILE_FAILED,"string"==typeof e?e:"decode audio file failed"))}))})));case 2:case"end":return t.stop()}}),t)})))}function Xu(e,t){return Pe(this,void 0,void 0,G.mark((function r(){var n,i,o,a;return G.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n=null,"string"!=typeof e){r.next=17;break}if(!(i=qu.get(e))){r.next=6;break}return console.log("use cached audio resource: ",e),r.abrupt("return",i);case 6:return r.prev=6,r.next=9,Ju(e);case 9:n=r.sent,r.next=15;break;case 12:throw r.prev=12,r.t0=r.catch(6),new ha(fa.CHECK_VIDEO_TRACK_ERROR,"string"==typeof r.t0?r.t0:"fetch audio file failed");case 15:r.next=21;break;case 17:return o=new Promise((function(t,r){var n=new FileReader;n.addEventListener("load",(function(e){e.target?t(e.target.result):r(new ha(fa.READ_LOCAL_AUDIO_FILE_ERROR,"read local audio file error"))})),n.addEventListener("error",(function(){r(new ha(fa.READ_LOCAL_AUDIO_FILE_ERROR,"read local audio file error"))})),n.readAsArrayBuffer(e)})),r.next=20,o;case 20:n=r.sent;case 21:return r.next=23,zu(n);case 23:return a=r.sent,"string"==typeof e&&t&&qu.set(e,a),r.abrupt("return",a);case 26:case"end":return r.stop()}}),r,null,[[6,12]])})))}var Zu,$u="OmniRTC_Web_V0.0.1",ed=1,td=320,rd="https://dev-rtclog.weclassroom.com/stream.gif";!function(e){e[e.RTCEngineAgoraType=1]="RTCEngineAgoraType",e[e.RTCEngineTencentType=2]="RTCEngineTencentType",e[e.RTCEngineXRTCType=3]="RTCEngineXRTCType",e[e.RTCEngineZego=6]="RTCEngineZego",e[e.RTCEngineCore=7]="RTCEngineCore"}(Zu||(Zu={}));var nd=function(e){function t(){var t=e.call(this)||this;return t.localAudioStats=[],t.localVideoStats=[],t.remoteVideoStatsMap=new Map,t.remoteAudioStatsMap=new Map,t.lastRemoteAudioStatsMap=new Map,t.lastRemoteVideoStatsMap=new Map,t.rtt=0,t.queue=[],t.queue.push(t.getRemoteAudioStats),t.queue.push(t.getRemoteVideoStats),t}return z(t,e),t.prototype.start=function(e,t){this.client=e,this.type=t,this.running=!0,t!=Zu.RTCEngineAgoraType&&t!=Zu.RTCEngineCore||this.getStatsLoop(),this.startMainLoop()},t.prototype.startPublish=function(e,t){e&&this.queue.push(this.getLocalAudioStats),t&&this.queue.push(this.getLocalVideoStats)},t.prototype.stopPublish=function(e,t){var r=this;e&&(this.queue=this.queue.filter((function(e){return e!==r.getLocalAudioStats}))),t&&(this.queue=this.queue.filter((function(e){return e!==r.getLocalVideoStats})))},t.prototype.getLocalVideoStats=function(){var e=this.client.getLocalVideoStats(),t={videoWidth:e.captureResolutionWidth,videoHeight:e.captureResolutionHeight,videoFps:e.sendFrameRate,videoTargetFps:e.captureFrameRate,videoEncodeFps:e.sendFrameRate,videoBps:e.sendBitrate/1e3,videoTargetBps:e.targetSendBitrate/1e3,videoLostRate:e.currentPacketLossRate,videoPermission:"",delay:0};if(this.localVideoStats.push(t),t.videoFps<=5){var r=Date.now(),n={startTime:r,endTime:r+2e3,sendBps:t.videoBps,sendFps:t.videoFps,sendTargetBps:t.videoTargetBps/1e3,sendTargetFps:t.videoTargetFps};this.emit("localFreeze",n)}},t.prototype.getLocalAudioStats=function(){var e=this.client.getLocalAudioStats(),t={volume:Number(e.sendVolumeLevel),audioBps:e.sendBitrate/1e3,audioEncodeFps:0,audioPermission:"",audioLostRate:e.currentPacketLossRate,delay:0};this.localAudioStats.push(t)},t.prototype.getRemoteVideoStats=function(){var e=this.client.getRemoteVideoStats();for(var t in e){var r=e[t];this.remoteVideoStatsMap.has(t)||this.remoteVideoStatsMap.set(t,[]);var n={videoWidth:r.recvResolutionWidth,videoHeight:r.recvResolutionHeight,videoFps:r.renderFrameRate,videoBps:r.recvBitrate/1e3,videoDelay:r.end2EndDelay,videoLost:r.packetLossRate,videoDecFps:r.decodeFrameRate};this.remoteVideoStatsMap.get(t).push(n);var i=this.lastRemoteVideoStatsMap.get(t);i?n.videoFps<2?(!i.freezed&&this.emit("remoteVideoFreezeStart",t),r.freezed=!0):(i.freezed&&this.emit("remoteVideoFreezeEnd",t),r.freezed=!1):r.freezed=!1,this.lastRemoteVideoStatsMap.set(t,r)}},t.prototype.getRemoteAudioStats=function(){var e=this.client.getRemoteAudioStats();for(var t in e){var r=e[t];this.remoteAudioStatsMap.has(t)||this.remoteAudioStatsMap.set(t,[]);var n={audioDelay:r.end2EndDelay,audioLost:r.currentPacketLossRate,audioBps:r.receiveBitrate/1e3,audioVolume:r.receiveLevel/32767*255>>0,audioDecFps:0};this.remoteAudioStatsMap.get(t).push(n);var i=this.lastRemoteAudioStatsMap.get(t);if(i){var o=r.totalFreezeTime-i.totalFreezeTime;0===o?(i.freezed&&this.emit("remoteAudioFreezeEnd",t),r.freezed=!1):o>0&&(!i.freezed&&this.emit("remoteAudioFreezeStart",t),r.freezed=!0)}else r.freezed=!1;this.lastRemoteAudioStatsMap.set(t,r)}},t.prototype.getStatsLoop=function(){return X(this,void 0,void 0,(function(){var e=this;return Z(this,(function(t){switch(t.label){case 0:return this.running?[4,re.asyncSleep(2e3)]:[3,2];case 1:t.sent();try{this.queue.forEach((function(t){t.call(e)})),this.rtt=this.client.getRTCStats().RTT}catch(e){console.error("getStatsLoop: ",e)}return[3,0];case 2:return[2]}}))}))},t.prototype.startMainLoop=function(){return X(this,void 0,void 0,(function(){var e,t,r,n,i,o,a,s,c,u,d,l,p,f,h,A,v,g,m,E,_,y,I,S,b;return Z(this,(function(C){switch(C.label){case 0:return this.running?[4,re.asyncSleep(15e3)]:[3,2];case 1:C.sent(),e=null,t=id(this.localVideoStats,["videoFps","videoTargetFps","videoBps","videoTargetBps"]),r=id(this.localAudioStats,["volume","audioBps"]),t&&(e=t),r&&Object.assign(e,r),e&&(Object.assign(e,{gatewayRtt:this.rtt,appcpu:0}),this.emit("localStats",e)),n=new Map;try{for(E=void 0,i=$(this.remoteAudioStatsMap),o=i.next();!o.done;o=i.next())a=ee(o.value,2),g=a[0],s=a[1],(c=id(s,["audioDelay","audioLost","audioBps","audioVolume","audioDecFps"])).hbDur=15e3,c.latency=0,c.audioDecFps=0,c.isSubscribeAudio=1,n.set(g,c)}catch(e){E={error:e}}finally{try{o&&!o.done&&(_=i.return)&&_.call(i)}finally{if(E)throw E.error}}try{for(y=void 0,u=$(this.remoteVideoStatsMap),d=u.next();!d.done;d=u.next())l=ee(d.value,2),g=l[0],p=l[1],(f=id(p,["videoFps","videoBps","videoDelay","videoLost","videoDecFps"])).hbDur=15e3,f.latency=0,f.videoDecFps=f.videoFps,f.isSubscribeVideo=1,f.videoWidth=p[0].videoWidth,f.videoHeight=p[0].videoHeight,f.videoFpsArray=p.map((function(e){return e.videoFps})),n.get(g)?n.set(g,Object.assign(n.get(g),f)):n.set(g,f)}catch(e){y={error:e}}finally{try{d&&!d.done&&(I=u.return)&&I.call(u)}finally{if(y)throw y.error}}h=[];try{for(S=void 0,A=$(n.keys()),v=A.next();!v.done;v=A.next())g=v.value,(m=n.get(g)).senderId=g,h.push(m)}catch(e){S={error:e}}finally{try{v&&!v.done&&(b=A.return)&&b.call(A)}finally{if(S)throw S.error}}return this.localVideoStats=[],this.localAudioStats=[],this.remoteAudioStatsMap.clear(),this.remoteVideoStatsMap.clear(),this.emit("remoteStats",h),[3,0];case 2:return[2]}}))}))},t.prototype.stop=function(){this.running=!1},t}(Ee.EventEmitter);function id(e,t){var r,n,i,o;if(0==e.length)return null;var a={},s={},c=e[e.length-1];for(var u in c)t.indexOf(u)>=0?a[u]=0:s[u]=c[u];var d=0;for(var l in e){var p=e[l],f=1;try{for(var h=(r=void 0,$(t)),A=h.next();!A.done;A=h.next()){u=A.value;var v=Number(p[u]);if(!(null!=p[u]&&null!=p[u]&&v>=0)){f=0;break}a[u]+=v}}catch(e){r={error:e}}finally{try{A&&!A.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}f&&d++}if(0==d)return a;try{for(var g=$(t),m=g.next();!m.done;m=g.next()){s[u=m.value]=a[u]/d>>0}}catch(e){i={error:e}}finally{try{m&&!m.done&&(o=g.return)&&o.call(g)}finally{if(i)throw i.error}}return s}var od,ad,sd=function(){function e(){this._signalled=!1,this._trigger=function(){},this._etrigger=function(){}}return e.prototype.wait=function(e){var t=this;if(void 0===e&&(e=0),!this._signalled){var r=new Promise((function(t,r){e>0&&setTimeout((function(){t(!1)}),e)})),n=new Promise((function(e,r){t._trigger=function(){t._clear(),e(!0)},t._etrigger=function(e){t._clear(),r(e)}}));return new Promise((function(e,t){Promise.race([r,n]).then((function(r){r?e(!0):t("timeout")}))}))}},e.prototype._clear=function(){this._etrigger=function(){},this._trigger=function(){}},e.prototype.signal=function(){var e=this;this._signalled=!0,setTimeout((function(){e._trigger()}))},e.prototype.esignal=function(e){var t=this;this._signalled=!0,setTimeout((function(){t._etrigger(e)}))},e}(),cd=s((function(e,t){!function(r,n){var i="function",o="undefined",a="object",s="string",c="model",u="name",d="type",l="vendor",p="version",f="architecture",h="console",A="mobile",v="tablet",g="smarttv",m="wearable",E="embedded",_="Amazon",y="Apple",I="ASUS",S="BlackBerry",b="Firefox",C="Google",w="Huawei",R="LG",T="Microsoft",k="Motorola",O="Opera",N="Samsung",x="Sony",P="Xiaomi",L="Zebra",B="Facebook",M=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},U=function(e,t){return D(e)===s&&-1!==Q(t).indexOf(Q(e))},Q=function(e){return e.toLowerCase()},F=function(e,t){if(D(e)===s)return e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,""),D(t)===o?e:e.substring(0,255)},j=function(e,t){for(var r,o,s,c,u,d,l=0;l<t.length&&!u;){var p=t[l],f=t[l+1];for(r=o=0;r<p.length&&!u;)if(u=p[r++].exec(e))for(s=0;s<f.length;s++)d=u[++o],c=f[s],D(c)===a&&c.length>0?2===c.length?D(c[1])==i?this[c[0]]=c[1].call(this,d):this[c[0]]=c[1]:3===c.length?D(c[1])!==i||c[1].exec&&c[1].test?this[c[0]]=d?d.replace(c[1],c[2]):n:this[c[0]]=d?c[1].call(this,d,c[2]):n:4===c.length&&(this[c[0]]=d?c[3].call(this,d.replace(c[1],c[2])):n):this[c]=d||n;l+=2}},V=function(e,t){for(var r in t)if(D(t[r])===a&&t[r].length>0){for(var i=0;i<t[r].length;i++)if(U(t[r][i],e))return"?"===r?n:r}else if(U(t[r],e))return"?"===r?n:r;return e},G={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},K={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,p],[/opios[\/ ]+([\w\.]+)/i],[p,[u,"Opera Mini"]],[/\bopr\/([\w\.]+)/i],[p,[u,O]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[u,p],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[u,"UCBrowser"]],[/\bqbcore\/([\w\.]+)/i],[p,[u,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[p,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[u,"IE"]],[/yabrowser\/([\w\.]+)/i],[p,[u,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure Browser"],p],[/\bfocus\/([\w\.]+)/i],[p,[u,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[p,[u,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[u,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[u,"MIUI Browser"]],[/fxios\/([-\w\.]+)/i],[p,[u,b]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 Browser"]],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 Browser"],p],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[u,p],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,B],p],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[u,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[u,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[u,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,"Chrome WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[u,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,p],[/version\/([\w\.]+) .*mobile\/\w+ (safari)/i],[p,[u,"Mobile Safari"]],[/version\/([\w\.]+) .*(mobile ?safari|safari)/i],[p,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[p,V,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[u,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[u,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[u,p]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,Q]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",Q]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,Q]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[c,[l,N],[d,v]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[c,[l,N],[d,A]],[/\((ip(?:hone|od)[\w ]*);/i],[c,[l,y],[d,A]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[c,[l,y],[d,v]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[c,[l,w],[d,v]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}-[atu]?[ln][01259x][012359][an]?)\b(?!.+d\/s)/i],[c,[l,w],[d,A]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[c,/_/g," "],[l,P],[d,A]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[c,/_/g," "],[l,P],[d,v]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[c,[l,"OPPO"],[d,A]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[c,[l,"Vivo"],[d,A]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[c,[l,"Realme"],[d,A]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[c,[l,k],[d,A]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[c,[l,k],[d,v]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[c,[l,R],[d,v]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[c,[l,R],[d,A]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[c,[l,"Lenovo"],[d,v]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[c,/_/g," "],[l,"Nokia"],[d,A]],[/(pixel c)\b/i],[c,[l,C],[d,v]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[c,[l,C],[d,A]],[/droid.+ ([c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[c,[l,x],[d,A]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[c,"Xperia Tablet"],[l,x],[d,v]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[c,[l,"OnePlus"],[d,A]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[c,[l,_],[d,v]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[c,/(.+)/g,"Fire Phone $1"],[l,_],[d,A]],[/(playbook);[-\w\),; ]+(rim)/i],[c,l,[d,v]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[c,[l,S],[d,A]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[c,[l,I],[d,v]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[c,[l,I],[d,A]],[/(nexus 9)/i],[c,[l,"HTC"],[d,v]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony)[-_ ]?([-\w]*)/i],[l,[c,/_/g," "],[d,A]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[c,[l,"Acer"],[d,v]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[c,[l,"Meizu"],[d,A]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[c,[l,"Sharp"],[d,A]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[l,c,[d,A]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[l,c,[d,v]],[/(surface duo)/i],[c,[l,T],[d,v]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[c,[l,"Fairphone"],[d,A]],[/(u304aa)/i],[c,[l,"AT&T"],[d,A]],[/\bsie-(\w*)/i],[c,[l,"Siemens"],[d,A]],[/\b(rct\w+) b/i],[c,[l,"RCA"],[d,v]],[/\b(venue[\d ]{2,7}) b/i],[c,[l,"Dell"],[d,v]],[/\b(q(?:mv|ta)\w+) b/i],[c,[l,"Verizon"],[d,v]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[c,[l,"Barnes & Noble"],[d,v]],[/\b(tm\d{3}\w+) b/i],[c,[l,"NuVision"],[d,v]],[/\b(k88) b/i],[c,[l,"ZTE"],[d,v]],[/\b(nx\d{3}j) b/i],[c,[l,"ZTE"],[d,A]],[/\b(gen\d{3}) b.+49h/i],[c,[l,"Swiss"],[d,A]],[/\b(zur\d{3}) b/i],[c,[l,"Swiss"],[d,v]],[/\b((zeki)?tb.*\b) b/i],[c,[l,"Zeki"],[d,v]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[l,"Dragon Touch"],c,[d,v]],[/\b(ns-?\w{0,9}) b/i],[c,[l,"Insignia"],[d,v]],[/\b((nxa|next)-?\w{0,9}) b/i],[c,[l,"NextBook"],[d,v]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[l,"Voice"],c,[d,A]],[/\b(lvtel\-)?(v1[12]) b/i],[[l,"LvTel"],c,[d,A]],[/\b(ph-1) /i],[c,[l,"Essential"],[d,A]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[c,[l,"Envizen"],[d,v]],[/\b(trio[-\w\. ]+) b/i],[c,[l,"MachSpeed"],[d,v]],[/\btu_(1491) b/i],[c,[l,"Rotor"],[d,v]],[/(shield[\w ]+) b/i],[c,[l,"Nvidia"],[d,v]],[/(sprint) (\w+)/i],[l,c,[d,A]],[/(kin\.[onetw]{3})/i],[[c,/\./g," "],[l,T],[d,A]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[c,[l,L],[d,v]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[c,[l,L],[d,A]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[l,c,[d,h]],[/droid.+; (shield) bui/i],[c,[l,"Nvidia"],[d,h]],[/(playstation [345portablevi]+)/i],[c,[l,x],[d,h]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[c,[l,T],[d,h]],[/smart-tv.+(samsung)/i],[l,[d,g]],[/hbbtv.+maple;(\d+)/i],[[c,/^/,"SmartTV"],[l,N],[d,g]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[l,R],[d,g]],[/(apple) ?tv/i],[l,[c,"Apple TV"],[d,g]],[/crkey/i],[[c,"Chromecast"],[l,C],[d,g]],[/droid.+aft(\w)( bui|\))/i],[c,[l,_],[d,g]],[/\(dtv[\);].+(aquos)/i],[c,[l,"Sharp"],[d,g]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[l,F],[c,F],[d,g]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,g]],[/((pebble))app/i],[l,c,[d,m]],[/droid.+; (glass) \d/i],[c,[l,C],[d,m]],[/droid.+; (wt63?0{2,3})\)/i],[c,[l,L],[d,m]],[/(quest( 2)?)/i],[c,[l,B],[d,m]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[l,[d,E]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[c,[d,A]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[c,[d,v]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,v]],[/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i],[[d,A]],[/(android[-\w\. ]{0,9});.+buil/i],[c,[l,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[u,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,p],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[u,[p,V,G]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,"Windows"],[p,V,G]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,"Mac OS"],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[p,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,p],[/\(bb(10);/i],[p,[u,S]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[u,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[u,"webOS"]],[/crkey\/([\d\.]+)/i],[p,[u,"Chromecast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[u,"Chromium OS"],p],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,p],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[u,p]]},H=function e(t,i){if(D(t)===a&&(i=t,t=n),!(this instanceof e))return new e(t,i).getResult();var c=t||(D(r)!==o&&r.navigator&&r.navigator.userAgent?r.navigator.userAgent:""),u=i?function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r}(K,i):K;return this.getBrowser=function(){var e={};return e.name=n,e.version=n,j.call(e,c,u.browser),e.major=function(e){return D(e)===s?e.replace(/[^\d\.]/g,"").split(".")[0]:n}(e.version),e},this.getCPU=function(){var e={};return e.architecture=n,j.call(e,c,u.cpu),e},this.getDevice=function(){var e={};return e.vendor=n,e.model=n,e.type=n,j.call(e,c,u.device),e},this.getEngine=function(){var e={};return e.name=n,e.version=n,j.call(e,c,u.engine),e},this.getOS=function(){var e={};return e.name=n,e.version=n,j.call(e,c,u.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return c},this.setUA=function(e){return c=D(e)===s&&e.length>255?F(e,255):e,this},this.setUA(c),this};H.VERSION="0.7.31",H.BROWSER=M([u,p,"major"]),H.CPU=M([f]),H.DEVICE=M([c,l,d,h,A,g,v,m,E]),H.ENGINE=H.OS=M([u,p]),e.exports&&(t=e.exports=H),t.UAParser=H;var W=D(r)!==o&&(r.jQuery||r.Zepto);if(W&&!W.ua){var Y=new H;W.ua=Y.getResult(),W.ua.get=function(){return Y.getUA()},W.ua.set=function(e){Y.setUA(e);var t=Y.getResult();for(var r in t)W.ua[r]=t[r]}}}("object"===("undefined"==typeof window?"undefined":D(window))?window:o)})),ud=new cd.UAParser,dd={0:"Success",1:"Fail",15:"Connect timeout",16:"Connect refused",17:"lo error",20:"Server error",21:"Client error",50:"Cameral error",51:"Mic error",52:"Speaker error",53:"Audio config error",54:"Video config error",300:"Invaild token",301:"Token expired",302:"Version error",303:"Already logined",306:"Publish local error",311:"Room error",312:"Room limited",320:"Kicked out",321:"Disconnected"},ld=0,pd=320,fd=321,hd=322,Ad=323,vd=324,gd=325,md=340,Ed=345,_d=346,yd=347,Id=348,Sd=350,bd=351,Cd=361,wd=362,Rd=374,Td=375,kd=376,Od=377,Dd=383,Nd=384,xd=385,Pd=920,Ld={ver:ed,serv:td,agent:$u},Bd={os:ud.getOS().name+" "+ud.getOS().version,dev:""+(ud.getDevice().vendor||"")+(ud.getDevice().type||""),arch:ud.getCPU().architecture||"",ram:navigator.deviceMemory<<20};!function(e){e[e["2g"]=1]="2g",e[e["3g"]=2]="3g",e[e["4g"]=3]="4g",e[e["5g"]=4]="5g",e[e.wifi=5]="wifi",e[e.ethernet=8]="ethernet",e[e.mobile=9]="mobile",e[e.unknow=10]="unknow"}(ad||(ad={}));var Md,Ud={net:ad[null===(od=navigator.connection)||void 0===od?void 0:od.type]||ad.unknow,cpu:0,mem:0};!function(e){e[e.Unkonwn=1]="Unkonwn",e[e.Connecting=2]="Connecting",e[e.Connected=3]="Connected",e[e.Disconnected=4]="Disconnected",e[e.Failed=5]="Failed"}(Md||(Md={}));var Qd,Fd,jd,Vd=!0,Gd=!1;!function(e){e[e.Success=0]="Success",e[e.Failure=1]="Failure"}(Qd||(Qd={})),function(e){e[e.video=1]="video",e[e.audio=2]="audio"}(Fd||(Fd={})),function(e){e[e.MuteAllVideo=1]="MuteAllVideo",e[e.MuteAllAudio=2]="MuteAllAudio",e[e.UnmuteAllVideo=3]="UnmuteAllVideo",e[e.UnmuteAllAudio=4]="UnmuteAllAudio",e[e.MuteLocalVideo=5]="MuteLocalVideo",e[e.MuteLocalAudio=6]="MuteLocalAudio",e[e.UnmuteLocalVideo=7]="UnmuteLocalVideo",e[e.UnmuteLocalAudio=8]="UnmuteLocalAudio",e[e.MuteRemoteVideo=9]="MuteRemoteVideo",e[e.MuteRemoteAudio=10]="MuteRemoteAudio",e[e.UnmuteRemoteVideo=11]="UnmuteRemoteVideo",e[e.UnmuteRemoteAudio=12]="UnmuteRemoteAudio"}(jd||(jd={}));var Kd=function(e){function t(){var t=e.call(this)||this;return t.running=!1,t.sendQueue=new Array,t.condition=null,t.failedFrame=null,t.signalUrl="",t.listenEvent(),t}return z(t,e),t.prototype.updatePublicUserInfo=function(e){this.publicUserInfo=e},t.prototype.updateCommonInfo=function(e){this.commonInfo=e},t.prototype.listenEvent=function(){var e=this;this.on("config",(function(t,r){var n=new Hd,i={delay:r,code:0,msg:dd[0]};t||n.addPrivate(ld,i),e.pushLogFrame(n)})),this.on("joined",(function(t,r,n){var i=new Hd,o={delay:r,code:0,msg:dd[0],joinType:n};t&&(o.code=311,o.msg=dd[o.code]),i.addPrivate(pd,o),e.pushLogFrame(i)})),this.on("left",(function(t,r){var n=new Hd,i={delay:r,code:0,msg:dd[0]};t&&(i.code=311,i.msg=dd[i.code]),n.addPrivate(fd,i),e.pushLogFrame(n)})),this.on("published",(function(t,r,n,i){var o=Wd(n,i),a=new Hd,s={audioDelay:r,videoDelay:r,type:o,code:0,msg:dd[0]};t&&(s.code=306,s.msg=dd[s.code]),a.addPrivate(hd,s),e.pushLogFrame(a)})),this.on("unpublished",(function(t,r,n){var i=Wd(r,n),o=new Hd,a={type:i,code:0,msg:dd[0]};t&&(a.code=306,a.msg=dd[a.code]),o.addPrivate(Ad,a),e.pushLogFrame(o)})),this.on("subscribed",(function(t,r,n,i,o){var a=Wd(n,i),s=new Hd,c={type:a,audioDelay:r,videoDelay:r,senderId:o,code:0,msg:dd[0]};t&&(c.code=306,c.msg=dd[c.code]),s.addPrivate(vd,c),e.pushLogFrame(s)})),this.on("unsubscribed",(function(t,r,n,i){var o=Wd(r,n),a=new Hd,s={type:o,senderId:i,code:0,msg:dd[0]};t&&(s.code=306,s.msg=dd[s.code]),a.addPrivate(gd,s),e.pushLogFrame(a)})),this.on("localStats",(function(t){if(t){var r=new Hd,n=Object.assign({audioPermission:"allowed",videoPermission:"allowed"},t);r.addPrivate(Sd,n),e.pushLogFrame(r)}})),this.on("remoteStats",(function(t){if(t&&t.length>0){var r=new Hd,n={ver:1,describe:[]};for(var i in t)n.describe.push(t[i]);r.addPrivate(bd,n),e.pushLogFrame(r)}})),this.on("localFreeze",(function(t,r,n){var i=new Hd,o=Object.assign({type:2},t);i.addPrivate(md,o),e.pushLogFrame(i)})),this.on("remoteVideoFreezeStart",(function(t){var r=new Hd;r.addPrivate(Ed,{senderId:t,timestamp:Date.now().toString()}),e.pushLogFrame(r)})),this.on("remoteVideoFreezeEnd",(function(t){var r=new Hd;r.addPrivate(_d,{senderId:t,timestamp:Date.now().toString()}),e.pushLogFrame(r)})),this.on("remoteAudioFreezeStart",(function(t){var r=new Hd;r.addPrivate(yd,{senderId:t,timestamp:Date.now().toString()}),e.pushLogFrame(r)})),this.on("remoteAudioFreezeEnd",(function(t){var r=new Hd;r.addPrivate(Id,{senderId:t,timestamp:Date.now().toString()}),e.pushLogFrame(r)})),this.on("disconnected",(function(t){var r=new Hd,n={reason:t,url:e.signalUrl};r.addPrivate(Cd,n),e.pushLogFrame(r)})),this.on("reconnected",(function(t,r,n){var i=new Hd,o={startTime:t,endTime:r,count:n,url:e.signalUrl};i.addPrivate(wd,o),e.pushLogFrame(i)})),this.on("connection-state",(function(t,r){void 0===r&&(r="");var n=new Hd,i={state:t,reason:r};n.addPrivate(Dd,i),e.pushLogFrame(n)})),this.on("camera-state",(function(t,r,n,i){var o=new Hd,a={code:0===r?0:50,state:r,reason:i,streamId:n};o.addPrivate(t?Rd:Td,a),e.pushLogFrame(o)})),this.on("mic-state",(function(t,r,n,i){var o=new Hd,a={code:0===r?0:51,state:r,reason:i,streamId:n};o.addPrivate(t?kd:Od,a),e.pushLogFrame(o)})),this.on("first-frame",(function(t,r){var n=new Hd,i={state:t,senderId:r,streamId:r};n.addPrivate(Nd,i),e.pushLogFrame(n)})),this.on("media-event",(function(t,r){var n=new Hd,i={state:t,senderId:r,streamId:r};n.addPrivate(xd,i),e.pushLogFrame(n)}))},t.prototype.pushLogFrame=function(e){this.condition&&this.condition.signal(),this.sendQueue&&this.sendQueue.push(e)},t.prototype.run=function(){return X(this,void 0,void 0,(function(){var e,t=this;return Z(this,(function(r){switch(r.label){case 0:this.running=!0,r.label=1;case 1:if(!(this.running||this.sendQueue.length>0))return[3,3];if(this.condition&&(this.condition=null),this.publicUserInfo&&this.commonInfo)for(;this.sendQueue.length>0;)(e=this.sendQueue.shift()).on("failed",(function(){t.failedFrame?t.failedFrame.callFailCount++:t.failedFrame=new Hd})),e.on("successed",(function(){if(t.failedFrame){var e={url:rd,sip:"",cip:"",lip:"",fts:t.failedFrame.failStartTime,lts:Date.now()};t.failedFrame.addPrivate(Pd,e),t.pushLogFrame(t.failedFrame),t.failedFrame=null}})),e.send(this.publicUserInfo,this.commonInfo);return this.condition=new sd,[4,this.condition.wait()];case 2:return r.sent(),[3,1];case 3:return[2]}}))}))},t.prototype.updateCip=function(e){this.publicUserInfo.cip=e},t.prototype.setSignalUrl=function(e){this.signalUrl=e},t.prototype.stop=function(){this.sendQueue.length&&this.condition&&this.condition.signal(),this.running=!1},t.DisconnectReason={NETWORK:"network interupted",SERVER:"disconnect by server",CLIENT:"disconnect by client"},t}(Ee.EventEmitter),Hd=function(e){function t(){var t=e.call(this)||this;return t.publicDesciptionInfo=Ld,t.publicStaticDeviceInfo=Bd,t.publicDynamicDeviceInfo=Ud,t.sendFailCount=0,t.timestamp=Date.now(),t.callFailCount=0,t.failStartTime=Date.now(),t}return z(t,e),t.prototype.addPublicFields=function(){},t.prototype.addPrivate=function(e,t){this.privateData={pri:e,pridata:t}},t.prototype.send=function(e,t){return X(this,void 0,void 0,(function(){var r,n;return Z(this,(function(i){switch(i.label){case 0:r=!1,this.publicUserInfo=e,Object.assign(this.privateData.pridata,t),n=Object.assign({ts:this.timestamp},this.publicDesciptionInfo,this.publicStaticDeviceInfo,this.publicDynamicDeviceInfo,this.publicUserInfo,this.privateData),i.label=1;case 1:if(r||!(this.sendFailCount<=3))return[3,7];i.label=2;case 2:return i.trys.push([2,4,,6]),[4,fetch(rd,{method:"POST",body:JSON.stringify(n)})];case 3:return i.sent(),this.emit("successed"),r=!0,[3,6];case 4:return i.sent(),this.sendFailCount++,this.emit("failed"),r=!1,[4,re.asyncSleep(5e3)];case 5:return i.sent(),[3,6];case 6:return[3,1];case 7:return[2]}}))}))},t}(Ee.EventEmitter);function Wd(e,t){return e&&t?3:t?2:e?1:void 0}var Yd=function(){function e(e,t){var r=t.appId,n=t.roomId,i=t.userId,o=t.token;this.reconnectTime=0,this.reconnectTimes=0,this.roomState="init",this._appId=r,this._roomId=n,this._userId=i,this._token=o,this._client=e,this._statisticLog=new Kd,qd(this)}return Object.defineProperty(e.prototype,"connectionState",{get:function(){return this._client.connectionState},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"remoteUsers",{get:function(){return this._client.remoteUsers},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"localTracks",{get:function(){return this._client.localTracks},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uid",{get:function(){return this._client.uid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"channelName",{get:function(){return this._client.channelName},enumerable:!1,configurable:!0}),e.prototype.on=function(e,t){return this._client.on(e,t)},e.prototype.once=function(e,t){return this._client.once(e,t)},e.prototype.off=function(e,t){return this._client.off(e,t)},e.prototype.removeAllListeners=function(e){this._client.removeAllListeners(e),e&&"connection-state-change"!==e||qd(this)},e.prototype.join=function(){var e=this;this._statisticLog.updatePublicUserInfo({appId:this._appId,psId:""+this._userId,cip:"",lip:"",sip:"",tid:re.randomString(32)}),this._statisticLog.updateCommonInfo({ver:Yu.VERSION,engine:"OmniRTC "+Yu.VERSION,room:this._roomId,roomStr:""+this._roomId,uid:""+this._userId}),this._statisticLog.run(),this._statisticLog.emit("connection-state",Md.Connecting,"connecting");var t=Date.now();return this._client.join(this._appId,this._roomId,this._token,this._userId).then((function(r){return e.roomState="joined",e._statisticLog.emit("joined",!1,re.getDiffTimeMs(t),0),e._statisticLog.emit("connection-state",Md.Connected,"success"),e._statisticHelper=new nd,e._statisticHelper.start(e,Zu.RTCEngineCore),e._statisticHelper.on("localFreeze",e._statisticLog.emit.bind(e._statisticLog,"localFreeze")),e._statisticHelper.on("localStats",e._statisticLog.emit.bind(e._statisticLog,"localStats")),e._statisticHelper.on("remoteStats",e._statisticLog.emit.bind(e._statisticLog,"remoteStats")),e._statisticHelper.on("remoteVideoFreezeStart",e._statisticLog.emit.bind(e._statisticLog,"remoteVideoFreezeStart")),e._statisticHelper.on("remoteVideoFreezeEnd",e._statisticLog.emit.bind(e._statisticLog,"remoteVideoFreezeEnd")),e._statisticHelper.on("remoteAudioFreezeStart",e._statisticLog.emit.bind(e._statisticLog,"remoteAudioFreezeStart")),e._statisticHelper.on("remoteAudioFreezeEnd",e._statisticLog.emit.bind(e._statisticLog,"remoteAudioFreezeEnd")),r})).catch((function(r){throw e._statisticLog.emit("joined",!0,re.getDiffTimeMs(t),0),e._statisticLog.emit("connection-state",Md.Failed,"join_failed"),r}))},e.prototype.leave=function(){var e=this,t=Date.now();return this._client.leave().then((function(){e._statisticLog.emit("left",!1,re.getDiffTimeMs(t)),e.roomState="left"})).catch((function(r){throw e._statisticLog.emit("left",!0,re.getDiffTimeMs(t)),r}))},e.prototype.publish=function(e){var t=this,r=Date.now();return this._client.publish(e).then((function(){Array.isArray(e)||(e=[e]);var n={video:!1,audio:!1};e.forEach((function(e){if(n[e.trackMediaType]=!0,e.setDevice&&"audio"===e.trackMediaType)return t._statisticLog.emit("mic-state",Vd,Qd.Success,t.uid,""),void e.on("track-ended",(function(){t._statisticLog.emit("mic-state",Gd,Qd.Success,t.uid,"")}));e.setDevice&&"video"===e.trackMediaType&&(t._statisticLog.emit("camera-state",Vd,Qd.Success,t.uid,""),e.on("track-ended",(function(){t._statisticLog.emit("camera-state",Gd,Qd.Success,t.uid,"")})))})),t._statisticHelper.startPublish(n.audio,n.video),t._statisticLog.emit("published",null,re.getDiffTimeMs(r)||0,n.audio,n.video)}))},e.prototype.unpublish=function(e){var t=this,r=this.localTracks;return this._client.unpublish(e).then((function(){e?Array.isArray(e)||(e=[e]):e=r;var n={video:!1,audio:!1};e.forEach((function(e){n[e.trackMediaType]=!0})),t._statisticHelper.stopPublish(n.audio,n.video),t._statisticLog.emit("unpublished",null,n.audio,n.video)}))},e.prototype.subscribe=function(e,t){var r=this,n=Date.now();return this._client.subscribe(e,t).then((function(i){i.on("first-frame-decoded",(function(){r._statisticLog.emit("first-frame",Fd[i.trackMediaType],i.getUserId())}));var o=i.play,a=i.stop,s=r._statisticLog;return i.play=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];o.call.apply(o,te([this],e));try{"audio"===this.trackMediaType&&s.emit("media-event",jd.UnmuteRemoteAudio,this.getUserId()),"video"===this.trackMediaType&&s.emit("media-event",jd.UnmuteRemoteVideo,this.getUserId())}catch(e){console.error("[OmniRTC] track.play ",e)}},i.stop=function(){a.call(this);try{"audio"===this.trackMediaType&&s.emit("media-event",jd.MuteRemoteAudio,this.getUserId()),"video"===this.trackMediaType&&s.emit("media-event",jd.MuteRemoteVideo,this.getUserId())}catch(e){console.error("[OmniRTC] track.stop ",e)}},r._statisticLog.emit("subscribed",null,re.getDiffTimeMs(n),"audio"===t,"video"===t,e.uid),i}))},e.prototype.unsubscribe=function(e,t){var r=this;return this._client.unsubscribe(e,t).then((function(){r._statisticLog.emit("unsubscribed",null,"audio"===t,"video"===t,e.uid)}))},e.prototype.setLowStreamParameter=function(e){return this._client.setLowStreamParameter(e)},e.prototype.enableDualStream=function(){return this._client.enableDualStream()},e.prototype.disableDualStream=function(){return this._client.disableDualStream()},e.prototype.setClientRole=function(e,t){return this._client.setClientRole(e,t)},e.prototype.setProxyServer=function(e){return this._client.setProxyServer(e)},e.prototype.setTurnServer=function(e){return this._client.setTurnServer(e)},e.prototype.startProxyServer=function(e){return this._client.startProxyServer(e)},e.prototype.stopProxyServer=function(){return this._client.stopProxyServer()},e.prototype.setRemoteVideoStreamType=function(e,t){return this._client.setRemoteVideoStreamType(e,t)},e.prototype.pickSVCLayer=function(e,t){return this._client.pickSVCLayer(e,t)},e.prototype.setStreamFallbackOption=function(e,t){return this._client.setStreamFallbackOption(e,t)},e.prototype.setEncryptionConfig=function(e,t,r){return this._client.setEncryptionConfig(e,t,r)},e.prototype.renewToken=function(e){return this._client.renewToken(e)},e.prototype.enableAudioVolumeIndicator=function(){return this._client.enableAudioVolumeIndicator()},e.prototype.getRTCStats=function(){return this._client.getRTCStats()},e.prototype.setLiveTranscoding=function(e){return this._client.setLiveTranscoding(e)},e.prototype.setRemoteDefaultVideoStreamType=function(e){return this._client.setRemoteDefaultVideoStreamType(e)},e.prototype.startLiveStreaming=function(e,t){return this._client.startLiveStreaming(e,t)},e.prototype.stopLiveStreaming=function(e){return this._client.stopLiveStreaming(e)},e.prototype.addInjectStreamUrl=function(e,t){return this._client.addInjectStreamUrl(e,t)},e.prototype.removeInjectStreamUrl=function(){return this._client.removeInjectStreamUrl()},e.prototype.startChannelMediaRelay=function(e){return this._client.startChannelMediaRelay(e)},e.prototype.updateChannelMediaRelay=function(e){return this._client.updateChannelMediaRelay(e)},e.prototype.stopChannelMediaRelay=function(){return this._client.stopChannelMediaRelay()},e.prototype.sendCustomReportMessage=function(e){return this._client.sendCustomReportMessage(e)},e.prototype.getLocalAudioStats=function(){return this._client.getLocalAudioStats()},e.prototype.getRemoteAudioStats=function(){return this._client.getRemoteAudioStats()},e.prototype.getRemoteNetworkQuality=function(){return this._client.getRemoteNetworkQuality()},e.prototype.getLocalVideoStats=function(){return this._client.getLocalVideoStats()},e.prototype.getRemoteVideoStats=function(){return this._client.getRemoteVideoStats()},e.prototype.getListeners=function(e){return this._client.getListeners(e)},e}(),qd=function(e){e.on("connection-state-change",(function(t,r,n){if("DISCONNECTED"===t){var i="",o="";switch(n){case"SERVER_ERROR":case"NETWORK_ERROR":i=Kd.DisconnectReason.NETWORK,o="interrupted";break;case"LEAVE":i=Kd.DisconnectReason.CLIENT,o="leave_channel";break;case"IP_BANNED":case"CHANNEL_BANNED":case"UID_BANNED":i=Kd.DisconnectReason.SERVER,o="banned_by_server"}e._statisticLog.emit("connection-state",Md.Disconnected,o),e._statisticLog.emit("disconnected",i,""),e._statisticLog&&i!==Kd.DisconnectReason.NETWORK&&e._statisticLog.stop()}"RECONNECTING"===t&&(e.reconnectTime=Date.now(),e.reconnectTimes+=1),"CONNECTED"===t&&"RECONNECTING"===r&&(e._statisticLog.emit("joined",!1,0,1),e._statisticLog.emit("reconnected",e.reconnectTime,Date.now(),e.reconnectTimes))}))},Jd=function(){function e(e){var t=e.appId,r=e.roomId,n=e.userId,i=e.sdkToken;this.VERSION=q.VERSION,this._appId=t,this._roomId=r,this._userId=n,this._token=i}return e.prototype.createClient=function(e){var t=q.createClient(e);return new Yd(t,{appId:this._appId,roomId:this._roomId,userId:this._userId,token:this._token})},e.prototype.createBufferSourceAudioTrack=function(e){return q.createBufferSourceAudioTrack(e)},e.prototype.createCameraVideoTrack=function(e){return q.createCameraVideoTrack(e)},e.prototype.createCustomAudioTrack=function(e){return q.createCustomAudioTrack(e)},e.prototype.createCustomVideoTrack=function(e){return q.createCustomVideoTrack(e)},e.prototype.createMicrophoneAndCameraTracks=function(e,t){return q.createMicrophoneAndCameraTracks(e,t)},e.prototype.createMicrophoneAudioTrack=function(e){return q.createMicrophoneAudioTrack(e)},e.prototype.createScreenVideoTrack=function(e,t){return q.createScreenVideoTrack(e,t)},e.prototype.getSupportedCodec=function(){return q.getSupportedCodec()},e.prototype.checkSystemRequirements=function(){return q.checkSystemRequirements()},e.prototype.getDevices=function(e){return q.getDevices(e)},e.prototype.getMicrophones=function(e){return q.getMicrophones(e)},e.prototype.getCameras=function(e){return q.getCameras(e)},e.prototype.getPlaybackDevices=function(e){return q.getPlaybackDevices(e)},e.prototype.getElectronScreenSources=function(e){return q.getElectronScreenSources(e)},e.prototype.setLogLevel=function(e){return q.setLogLevel(e)},e.prototype.enableLogUpload=function(){return q.enableLogUpload()},e.prototype.disableLogUpload=function(){return q.disableLogUpload()},e.prototype.checkVideoTrackIsActive=function(e,t){return q.checkVideoTrackIsActive(e,t)},e.prototype.checkAudioTrackIsActive=function(e,t){return q.checkAudioTrackIsActive(e,t)},Object.defineProperty(e.prototype,"onCameraChanged",{get:function(){return q.onCameraChanged},set:function(e){q.onCameraChanged=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMicrophoneChanged",{get:function(){return q.onMicrophoneChanged},set:function(e){q.onMicrophoneChanged=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onPlaybackDeviceChanged",{get:function(){return q.onPlaybackDeviceChanged},set:function(e){q.onPlaybackDeviceChanged=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onAudioAutoplayFailed",{get:function(){return q.onAudioAutoplayFailed},set:function(e){q.onAudioAutoplayFailed=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onAutoplayFailed",{get:function(){return q.onAutoplayFailed},set:function(e){q.onAutoplayFailed=e},enumerable:!1,configurable:!0}),e.prototype.setArea=function(e){return q.setArea(e)},e.prototype.processExternalMediaAEC=function(e){return q.processExternalMediaAEC(e)},e}(),zd=function(){function e(e){var t=e.appId,r=e.roomId,n=e.userId,i=e.sdkToken;this.VERSION=Yu.VERSION,this._appId=t,this._roomId=r,this._userId=n,this._token=i}return e.prototype.createClient=function(e){var t=Yu.createClient(e);return new Yd(t,{appId:this._appId,roomId:this._roomId,userId:this._userId,token:this._token})},e.prototype.createBufferSourceAudioTrack=function(e){return Yu.createBufferSourceAudioTrack(e)},e.prototype.createCameraVideoTrack=function(e){return Yu.createCameraVideoTrack(e)},e.prototype.createChannelMediaRelayConfiguration=function(){throw new Error("Method has not implemented")},e.prototype.createCustomAudioTrack=function(e){return Yu.createCustomAudioTrack(e)},e.prototype.createCustomVideoTrack=function(e){return Yu.createCustomVideoTrack(e)},e.prototype.createMicrophoneAndCameraTracks=function(e,t){return Yu.createMicrophoneAndCameraTracks(e,t)},e.prototype.createMicrophoneAudioTrack=function(e){return Yu.createMicrophoneAudioTrack(e)},e.prototype.createScreenVideoTrack=function(e,t){return Yu.createScreenVideoTrack(e,t)},e.prototype.getSupportedCodec=function(){return Yu.getSupportedCodec()},e.prototype.checkSystemRequirements=function(){return Yu.checkSystemRequirements()},e.prototype.getDevices=function(e){return Yu.getDevices(e)},e.prototype.getMicrophones=function(e){return Yu.getMicrophones(e)},e.prototype.getCameras=function(e){return Yu.getCameras(e)},e.prototype.getPlaybackDevices=function(e){return Yu.getPlaybackDevices(e)},e.prototype.getElectronScreenSources=function(e){return Yu.getElectronScreenSources(e)},e.prototype.setLogLevel=function(e){return Yu.setLogLevel(e)},e.prototype.enableLogUpload=function(){return Yu.enableLogUpload()},e.prototype.disableLogUpload=function(){return Yu.disableLogUpload()},e.prototype.checkVideoTrackIsActive=function(e,t){return Yu.checkVideoTrackIsActive(e,t)},e.prototype.checkAudioTrackIsActive=function(e,t){return Yu.checkAudioTrackIsActive(e,t)},Object.defineProperty(e.prototype,"onCameraChanged",{get:function(){return Yu.onCameraChanged},set:function(e){Yu.onCameraChanged=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onMicrophoneChanged",{get:function(){return Yu.onMicrophoneChanged},set:function(e){Yu.onMicrophoneChanged=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onPlaybackDeviceChanged",{get:function(){return Yu.onPlaybackDeviceChanged},set:function(e){Yu.onPlaybackDeviceChanged=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onAudioAutoplayFailed",{get:function(){return Yu.onAudioAutoplayFailed},set:function(e){Yu.onAudioAutoplayFailed=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"onAutoplayFailed",{get:function(){return Yu.onAutoplayFailed},set:function(e){Yu.onAutoplayFailed=e},enumerable:!1,configurable:!0}),e.prototype.setArea=function(e){throw new Error("Method has not implemented")},e.prototype.processExternalMediaAEC=function(e){throw new Error("Method has not implemented")},e}();function Xd(e){var t=i(e);switch(console.log("token data: ",t),t.type){case Zu.RTCEngineAgoraType:return new Jd({appId:t.appid,roomId:t.roomStr,userId:t.user,sdkToken:t.attachToken||t.token});case Zu.RTCEngineCore:return new zd({appId:t.appid,roomId:t.roomStr,userId:t.user,sdkToken:t.attachToken||t.token});default:throw new Error("Wrong engine type: "+t.type)}}export default Xd;
|