@byteplus/rtc 4.46.12 → 4.46.13
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/index.esm.min.js +2 -2
- package/index.min.js +2 -2
- package/package.json +2 -2
package/index.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright (c) 2020 The BytePlusRTC project authors. All Rights Reserved.
|
|
3
3
|
* @brief BytePlusRTC Advance API
|
|
4
|
-
* version: 4.46.
|
|
4
|
+
* version: 4.46.13
|
|
5
5
|
*/
|
|
6
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).BytePlusRTC=t()}(this,(function(){"use strict";function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function t(e){var t,n,i,o=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,i=Symbol.iterator);o--;){if(n&&null!=(t=e[n]))return t.call(e);if(i&&null!=(t=e[i]))return new r(t.call(e));n="@@asyncIterator",i="@@iterator"}throw new TypeError("Object is not async iterable")}function r(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then((function(e){return{value:e,done:t}}))}return r=function(e){this.s=e,this.n=e.next},r.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?Promise.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?Promise.reject(e):t(r.apply(this.s,arguments))}},new r(e)}function n(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 i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){h(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(){o=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(lV){u=function(e,t,r){return e[t]=r}}function d(e,t,r,i){var o=t&&t.prototype instanceof f?t:f,a=Object.create(o.prototype),s=new A(i||[]);return n(a,"_invoke",{value:E(e,r,s)}),a}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(lV){return{type:"throw",arg:lV}}}e.wrap=d;var h={};function f(){}function p(){}function _(){}var v={};u(v,a,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(R([])));y&&y!==t&&r.call(y,a)&&(v=y);var g=_.prototype=f.prototype=Object.create(v);function S(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function i(n,o,a,s){var c=l(e[n],e,o);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(d).then((function(e){u.value=e,a(u)}),(function(e){return i("throw",e,a,s)}))}s(c.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function E(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return w()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=k(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=l(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===h)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function k(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=l(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,h;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function T(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 I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function R(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return p.prototype=_,n(g,"constructor",{value:_,configurable:!0}),n(_,"constructor",{value:p,configurable:!0}),p.displayName=u(_,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,u(e,c,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},S(b.prototype),u(b.prototype,s,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new b(d(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},S(g),u(g,c,"Generator"),u(g,a,(function(){return this})),u(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=R,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},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 t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),c=r.call(o,"finallyLoc");if(s&&c){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var 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,h):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),h},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),I(r),h}},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;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function a(e){return a="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},a(e)}function s(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(u){return void r(u)}s.done?t(c):Promise.resolve(c).then(n,i)}function c(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){s(o,n,i,a,c,"next",e)}function c(e){s(o,n,i,a,c,"throw",e)}a(void 0)}))}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(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)}}function l(e,t,r){return t&&d(e.prototype,t),r&&d(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(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&&_(e,t)}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function _(e,t){return _=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_(e,t)}function v(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function g(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=p(e);if(t){var i=p(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return y(this,r)}}function S(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}function b(){return b="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=S(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},b.apply(this,arguments)}function E(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;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(lV){s=!0,i=lV}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(e,t)||T(e,t)||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.")}()}function k(e){return function(e){if(Array.isArray(e))return I(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||T(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(e,t){if(e){if("string"==typeof e)return I(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)?I(e,t):void 0}}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}function A(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=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}}}}var R=function(e){return e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL",e}(R||{}),w=function(e){return e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL",e}(w||{}),C=function(e){return e[e.QUIT=0]="QUIT",e[e.DROPPED=1]="DROPPED",e[e.SWITCH_TO_INVISIBLE=2]="SWITCH_TO_INVISIBLE",e[e.KICKED_BY_ADMIN=3]="KICKED_BY_ADMIN",e}(C||{}),O=function(e){return e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING",e}(O||{}),x=function(e){return e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE",e}(x||{}),N=function(e){return e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL",e}(N||{}),D=function(e){return e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL",e}(D||{}),P=function(e){return e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON",e}(P||{}),M=function(e){return e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT",e}(M||{}),U=function(e){return e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN",e}(U||{}),L=function(e){return e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO",e}(L||{}),V=function(e){return e[e.STREAM_REMOVE_REASON_UNPUBLISH=0]="STREAM_REMOVE_REASON_UNPUBLISH",e[e.STREAM_REMOVE_REASON_PUBLISH_FAILED=1]="STREAM_REMOVE_REASON_PUBLISH_FAILED",e[e.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED=2]="STREAM_REMOVE_REASON_KEEP_LIVE_FAILED",e[e.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED=3]="STREAM_REMOVE_REASON_CLIENT_DISCONNECTED",e[e.STREAM_REMOVE_REASON_REPUBLISH=4]="STREAM_REMOVE_REASON_REPUBLISH",e[e.STREAM_REMOVE_REASON_OTHER=5]="STREAM_REMOVE_REASON_OTHER",e}(V||{}),F=function(e){return e[e.CONNECTION_START=0]="CONNECTION_START",e[e.CONNECTION_STATE_DISCONNECTED=1]="CONNECTION_STATE_DISCONNECTED",e[e.CONNECTION_STATE_CONNECTING=2]="CONNECTION_STATE_CONNECTING",e[e.CONNECTION_STATE_CONNECTED=3]="CONNECTION_STATE_CONNECTED",e[e.CONNECTION_STATE_RECONNECTING=4]="CONNECTION_STATE_RECONNECTING",e[e.CONNECTION_STATE_RECONNECTED=5]="CONNECTION_STATE_RECONNECTED",e[e.CONNECTION_STATE_LOST=6]="CONNECTION_STATE_LOST",e}(F||{}),B=function(e){return e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER",e}(B||{}),j=function(e){return e[e.domestic=0]="domestic",e[e.overseas=1]="overseas",e}(j||{}),G=function(e){return e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE",e}(G||{}),H=function(e){return e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO_ONLY=1]="AUDIO_ONLY",e[e.VIDEO_ONLY=2]="VIDEO_ONLY",e}(H||{}),z=function(e){return e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME",e}(z||{}),K=function(e){return e[e.DISABLE=0]="DISABLE",e[e.VIDEO_STREAM_LOW=1]="VIDEO_STREAM_LOW",e[e.AUDIO_ONLY=2]="AUDIO_ONLY",e}(K||{}),W=function(e){return e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH",e}(W||{}),X=function(e){return e[e.UNKNOWN=0]="UNKNOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD",e}(X||{}),q=function(e){return e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth",e}(q||{}),Y=function(e){return e[e.communication=0]="communication",e[e.chat=5]="chat",e[e.chatRoom=6]="chatRoom",e[e.coHost=9]="coHost",e[e.meeting=16]="meeting",e[e.classRoom=18]="classRoom",e}(Y||{}),J=function(e){return e[e.default=0]="default",e[e.fluent=1]="fluent",e[e.standard=2]="standard",e[e.hd=3]="hd",e[e.standardStereo=4]="standardStereo",e[e.hdMono=5]="hdMono",e}(J||{}),Q=function(e){return e[e.AUTO_PLAY=0]="AUTO_PLAY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.PLAY_MANUALLY=2]="PLAY_MANUALLY",e}(Q||{}),Z=Object.freeze(Object.defineProperty({__proto__:null,VideoSourceType:R,AudioSourceType:w,UserOfflineReason:C,ChannelProfile:O,SubscribeMode:x,SubscribeState:N,PublishState:D,MirrorMode:P,VideoRenderMode:M,StreamIndex:U,MediaType:L,StreamRemoveReason:V,ConnectionState:F,MirrorType:B,LogChannel:j,USER_ONLINE_STATUS:G,PublicStreamType:H,PublicInterpolationMode:z,SubscribeFallbackOption:K,RemoteUserPriority:W,NetworkQuality:X,FallbackOrRecoverReason:q,RoomProfileType:Y,AudioProfileType:J,RTCAutoPlayPolicy:Q},Symbol.toStringTag,{value:"Module"})),$=function(e){return e[e.AUTO=0]="AUTO",e[e.MODE_L=1]="MODE_L",e[e.MODE_R=2]="MODE_R",e[e.MODE_MIX=3]="MODE_MIX",e}($||{}),ee=function(e){return e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH",e}(ee||{}),te=function(e){return e[e.AUDIO_MIXING_STATE_PRELOADED=0]="AUDIO_MIXING_STATE_PRELOADED",e[e.AUDIO_MIXING_STATE_PLAYING=1]="AUDIO_MIXING_STATE_PLAYING",e[e.AUDIO_MIXING_STATE_PAUSED=2]="AUDIO_MIXING_STATE_PAUSED",e[e.AUDIO_MIXING_STATE_STOPPED=3]="AUDIO_MIXING_STATE_STOPPED",e[e.AUDIO_MIXING_STATE_FAILED=4]="AUDIO_MIXING_STATE_FAILED",e[e.AUDIO_MIXING_STATE_FINISHED=5]="AUDIO_MIXING_STATE_FINISHED",e[e.AUDIO_MIXING_STATE_PCM_ENABLED=6]="AUDIO_MIXING_STATE_PCM_ENABLED",e[e.AUDIO_MIXING_STATE_PCM_DISABLED=7]="AUDIO_MIXING_STATE_PCM_DISABLED",e}(te||{}),re=Object.freeze(Object.defineProperty({__proto__:null,AudioMixingDualMonoMode:$,AudioMixingType:ee,AudioMixingState:te},Symbol.toStringTag,{value:"Module"})),ne=function(e){return e.onTrackEnded="onTrackEnded",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onUserPublishStream="onUserPublishStream",e.onUserUnpublishStream="onUserUnpublishStream",e.onUserPublishScreen="onUserPublishScreen",e.onUserUnpublishScreen="onUserUnpublishScreen",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onFirstPublicStreamVideoFrameRendered="onFirstPublicStreamVideoFrameRendered",e.onFirstPublicStreamVideoFrameDecoded="onFirstPublicStreamVideoFrameDecoded",e.onFirstPublicStreamAudioFrameDecoded="onFirstPublicStreamAudioFrameDecoded",e.onVideoDeviceStateChanged="onVideoDeviceStateChanged",e.onAudioDeviceStateChanged="onAudioDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onPublicStreamStats="onPublicStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",e.onLocalAudioPropertiesReport="onLocalAudioPropertiesReport",e.onRemoteAudioPropertiesReport="onRemoteAudioPropertiesReport",e.onActiveSpeaker="onActiveSpeaker",e.onAudioPlaybackDeviceChanged="onAudioPlaybackDeviceChanged",e.onUserStartVideoCapture="onUserStartVideoCapture",e.onUserStopVideoCapture="onUserStopVideoCapture",e.onUserStartAudioCapture="onUserStartAudioCapture",e.onUserStopAudioCapture="onUserStopAudioCapture",e.onAutoPublishResult="onAutoPublishResult",e.onAutoSubscribeResult="onAutoSubscribeResult",e.onLiveTranscodingResult="onLiveTranscodingResult",e.onStreamMixingEvent="onStreamMixingEvent",e.onAudioPlaybackDeviceTestVolume="onAudioPlaybackDeviceTestVolume",e.onSEIMessageReceived="onSEIMessageReceived",e.onError="onError",e.onAudioMixingStateChanged="onAudioMixingStateChanged",e.onUserMessageReceivedOutsideRoom="onUserMessageReceivedOutsideRoom",e.onUserBinaryMessageReceivedOutsideRoom="onUserBinaryMessageReceivedOutsideRoom",e.onTokenWillExpire="onTokenWillExpire",e.onCloudProxyConnected="onCloudProxyConnected",e.onPushPublicStreamResult="onPushPublicStreamResult",e.onPublicStreamSEIMessageReceived="onPublicStreamSEIMessageReceived",e.onNetworkQuality="onNetworkQuality",e.onSimulcastSubscribeFallback="onSimulcastSubscribeFallback",e.onRemoteVideoSizeChanged="onRemoteVideoSizeChanged",e.onVideoStreamBanned="onVideoStreamBanned",e.onAudioStreamBanned="onAudioStreamBanned",e.onLocalVideoSizeChanged="onLocalVideoSizeChanged",e.onServerParamsSetResult="onServerParamsSetResult",e}(ne||{}),ie="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},oe=function(e){return e&&e.Math==Math&&e},ae=oe("object"==typeof globalThis&&globalThis)||oe("object"==typeof window&&window)||oe("object"==typeof self&&self)||oe("object"==typeof ie&&ie)||function(){return this}()||Function("return this")(),se={exports:{}},ce=ae,ue=Object.defineProperty,de=function(e,t){try{ue(ce,e,{value:t,configurable:!0,writable:!0})}catch(r){ce[e]=t}return t},le=de,he="__core-js_shared__",fe=ae[he]||le(he,{}),pe=fe;(se.exports=function(e,t){return pe[e]||(pe[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.26.1",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE",source:"https://github.com/zloirock/core-js"});var _e,ve,me=function(e){try{return!!e()}catch(t){return!0}},ye=!me((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),ge=ye,Se=Function.prototype,be=Se.call,Ee=ge&&Se.bind.bind(be,be),ke=ge?Ee:function(e){return function(){return be.apply(e,arguments)}},Te=function(e){return null==e},Ie=Te,Ae=TypeError,Re=function(e){if(Ie(e))throw Ae("Can't call method on "+e);return e},we=Re,Ce=Object,Oe=function(e){return Ce(we(e))},xe=Oe,Ne=ke({}.hasOwnProperty),De=Object.hasOwn||function(e,t){return Ne(xe(e),t)},Pe=ke,Me=0,Ue=Math.random(),Le=Pe(1..toString),Ve=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Le(++Me+Ue,36)},Fe="object"==typeof document&&document.all,Be={all:Fe,IS_HTMLDDA:void 0===Fe&&void 0!==Fe},je=Be.all,Ge=Be.IS_HTMLDDA?function(e){return"function"==typeof e||e===je}:function(e){return"function"==typeof e},He=ae,ze=Ge,Ke=function(e){return ze(e)?e:void 0},We=function(e,t){return arguments.length<2?Ke(He[e]):He[e]&&He[e][t]},Xe=We("navigator","userAgent")||"",qe=ae,Ye=Xe,Je=qe.process,Qe=qe.Deno,Ze=Je&&Je.versions||Qe&&Qe.version,$e=Ze&&Ze.v8;$e&&(ve=(_e=$e.split("."))[0]>0&&_e[0]<4?1:+(_e[0]+_e[1])),!ve&&Ye&&(!(_e=Ye.match(/Edge\/(\d+)/))||_e[1]>=74)&&(_e=Ye.match(/Chrome\/(\d+)/))&&(ve=+_e[1]);var et=ve,tt=et,rt=me,nt=!!Object.getOwnPropertySymbols&&!rt((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&tt&&tt<41})),it=nt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ot=ae,at=se.exports,st=De,ct=Ve,ut=nt,dt=it,lt=at("wks"),ht=ot.Symbol,ft=ht&&ht.for,pt=dt?ht:ht&&ht.withoutSetter||ct,_t=function(e){if(!st(lt,e)||!ut&&"string"!=typeof lt[e]){var t="Symbol."+e;ut&&st(ht,e)?lt[e]=ht[e]:lt[e]=dt&&ft?ft(t):pt(t)}return lt[e]},vt={};vt[_t("toStringTag")]="z";var mt="[object z]"===String(vt),yt={},gt=!me((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),St=Ge,bt=Be.all,Et=Be.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:St(e)||e===bt}:function(e){return"object"==typeof e?null!==e:St(e)},kt=Et,Tt=ae.document,It=kt(Tt)&&kt(Tt.createElement),At=function(e){return It?Tt.createElement(e):{}},Rt=At,wt=!gt&&!me((function(){return 7!=Object.defineProperty(Rt("div"),"a",{get:function(){return 7}}).a})),Ct=gt&&me((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Ot=Et,xt=String,Nt=TypeError,Dt=function(e){if(Ot(e))return e;throw Nt(xt(e)+" is not an object")},Pt=ye,Mt=Function.prototype.call,Ut=Pt?Mt.bind(Mt):function(){return Mt.apply(Mt,arguments)},Lt=ke({}.isPrototypeOf),Vt=We,Ft=Ge,Bt=Lt,jt=Object,Gt=it?function(e){return"symbol"==typeof e}:function(e){var t=Vt("Symbol");return Ft(t)&&Bt(t.prototype,jt(e))},Ht=String,zt=function(e){try{return Ht(e)}catch(t){return"Object"}},Kt=Ge,Wt=zt,Xt=TypeError,qt=function(e){if(Kt(e))return e;throw Xt(Wt(e)+" is not a function")},Yt=qt,Jt=Te,Qt=function(e,t){var r=e[t];return Jt(r)?void 0:Yt(r)},Zt=Ut,$t=Ge,er=Et,tr=TypeError,rr=Ut,nr=Et,ir=Gt,or=Qt,ar=function(e,t){var r,n;if("string"===t&&$t(r=e.toString)&&!er(n=Zt(r,e)))return n;if($t(r=e.valueOf)&&!er(n=Zt(r,e)))return n;if("string"!==t&&$t(r=e.toString)&&!er(n=Zt(r,e)))return n;throw tr("Can't convert object to primitive value")},sr=TypeError,cr=_t("toPrimitive"),ur=function(e,t){if(!nr(e)||ir(e))return e;var r,n=or(e,cr);if(n){if(void 0===t&&(t="default"),r=rr(n,e,t),!nr(r)||ir(r))return r;throw sr("Can't convert object to primitive value")}return void 0===t&&(t="number"),ar(e,t)},dr=ur,lr=Gt,hr=function(e){var t=dr(e,"string");return lr(t)?t:t+""},fr=gt,pr=wt,_r=Ct,vr=Dt,mr=hr,yr=TypeError,gr=Object.defineProperty,Sr=Object.getOwnPropertyDescriptor,br="enumerable",Er="configurable",kr="writable";yt.f=fr?_r?function(e,t,r){if(vr(e),t=mr(t),vr(r),"function"==typeof e&&"prototype"===t&&"value"in r&&kr in r&&!r.writable){var n=Sr(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:Er in r?r.configurable:n.configurable,enumerable:br in r?r.enumerable:n.enumerable,writable:!1})}return gr(e,t,r)}:gr:function(e,t,r){if(vr(e),t=mr(t),vr(r),pr)try{return gr(e,t,r)}catch(n){}if("get"in r||"set"in r)throw yr("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Tr={exports:{}},Ir=gt,Ar=De,Rr=Function.prototype,wr=Ir&&Object.getOwnPropertyDescriptor,Cr=Ar(Rr,"name"),Or={EXISTS:Cr,PROPER:Cr&&"something"===function(){}.name,CONFIGURABLE:Cr&&(!Ir||Ir&&wr(Rr,"name").configurable)},xr=Ge,Nr=fe,Dr=ke(Function.toString);xr(Nr.inspectSource)||(Nr.inspectSource=function(e){return Dr(e)});var Pr,Mr,Ur,Lr=Nr.inspectSource,Vr=Ge,Fr=ae.WeakMap,Br=Vr(Fr)&&/native code/.test(String(Fr)),jr=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Gr=yt,Hr=jr,zr=gt?function(e,t,r){return Gr.f(e,t,Hr(1,r))}:function(e,t,r){return e[t]=r,e},Kr=se.exports,Wr=Ve,Xr=Kr("keys"),qr=function(e){return Xr[e]||(Xr[e]=Wr(e))},Yr={},Jr=Br,Qr=ae,Zr=Et,$r=zr,en=De,tn=fe,rn=qr,nn=Yr,on="Object already initialized",an=Qr.TypeError,sn=Qr.WeakMap;if(Jr||tn.state){var cn=tn.state||(tn.state=new sn);cn.get=cn.get,cn.has=cn.has,cn.set=cn.set,Pr=function(e,t){if(cn.has(e))throw an(on);return t.facade=e,cn.set(e,t),t},Mr=function(e){return cn.get(e)||{}},Ur=function(e){return cn.has(e)}}else{var un=rn("state");nn[un]=!0,Pr=function(e,t){if(en(e,un))throw an(on);return t.facade=e,$r(e,un,t),t},Mr=function(e){return en(e,un)?e[un]:{}},Ur=function(e){return en(e,un)}}var dn={set:Pr,get:Mr,has:Ur,enforce:function(e){return Ur(e)?Mr(e):Pr(e,{})},getterFor:function(e){return function(t){var r;if(!Zr(t)||(r=Mr(t)).type!==e)throw an("Incompatible receiver, "+e+" required");return r}}},ln=me,hn=Ge,fn=De,pn=gt,_n=Or.CONFIGURABLE,vn=Lr,mn=dn.enforce,yn=dn.get,gn=Object.defineProperty,Sn=pn&&!ln((function(){return 8!==gn((function(){}),"length",{value:8}).length})),bn=String(String).split("String"),En=Tr.exports=function(e,t,r){"Symbol("===String(t).slice(0,7)&&(t="["+String(t).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!fn(e,"name")||_n&&e.name!==t)&&(pn?gn(e,"name",{value:t,configurable:!0}):e.name=t),Sn&&r&&fn(r,"arity")&&e.length!==r.arity&&gn(e,"length",{value:r.arity});try{r&&fn(r,"constructor")&&r.constructor?pn&&gn(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(i){}var n=mn(e);return fn(n,"source")||(n.source=bn.join("string"==typeof t?t:"")),e};Function.prototype.toString=En((function(){return hn(this)&&yn(this).source||vn(this)}),"toString");var kn=Ge,Tn=yt,In=Tr.exports,An=de,Rn=function(e,t,r,n){n||(n={});var i=n.enumerable,o=void 0!==n.name?n.name:t;if(kn(r)&&In(r,o,n),n.global)i?e[t]=r:An(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch(a){}i?e[t]=r:Tn.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},wn=ke,Cn=wn({}.toString),On=wn("".slice),xn=function(e){return On(Cn(e),8,-1)},Nn=mt,Dn=Ge,Pn=xn,Mn=_t("toStringTag"),Un=Object,Ln="Arguments"==Pn(function(){return arguments}()),Vn=Nn?Pn: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(r){}}(t=Un(e),Mn))?r:Ln?Pn(t):"Object"==(n=Pn(t))&&Dn(t.callee)?"Arguments":n},Fn=Vn,Bn=mt?{}.toString:function(){return"[object "+Fn(this)+"]"};mt||Rn(Object.prototype,"toString",Bn,{unsafe:!0});var jn={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},Gn=At("span").classList,Hn=Gn&&Gn.constructor&&Gn.constructor.prototype,zn=Hn===Object.prototype?void 0:Hn,Kn=xn,Wn=ke,Xn=function(e){if("Function"===Kn(e))return Wn(e)},qn=qt,Yn=ye,Jn=Xn(Xn.bind),Qn=function(e,t){return qn(e),void 0===t?e:Yn?Jn(e,t):function(){return e.apply(t,arguments)}},Zn=me,$n=xn,ei=Object,ti=ke("".split),ri=Zn((function(){return!ei("z").propertyIsEnumerable(0)}))?function(e){return"String"==$n(e)?ti(e,""):ei(e)}:ei,ni=Math.ceil,ii=Math.floor,oi=Math.trunc||function(e){var t=+e;return(t>0?ii:ni)(t)},ai=function(e){var t=+e;return t!=t||0===t?0:oi(t)},si=ai,ci=Math.min,ui=function(e){return e>0?ci(si(e),9007199254740991):0},di=ui,li=function(e){return di(e.length)},hi=xn,fi=Array.isArray||function(e){return"Array"==hi(e)},pi=ke,_i=me,vi=Ge,mi=Vn,yi=Lr,gi=function(){},Si=[],bi=We("Reflect","construct"),Ei=/^\s*(?:class|function)\b/,ki=pi(Ei.exec),Ti=!Ei.exec(gi),Ii=function(e){if(!vi(e))return!1;try{return bi(gi,Si,e),!0}catch(t){return!1}},Ai=function(e){if(!vi(e))return!1;switch(mi(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ti||!!ki(Ei,yi(e))}catch(t){return!0}};Ai.sham=!0;var Ri=!bi||_i((function(){var e;return Ii(Ii.call)||!Ii(Object)||!Ii((function(){e=!0}))||e}))?Ai:Ii,wi=fi,Ci=Ri,Oi=Et,xi=_t("species"),Ni=Array,Di=function(e){var t;return wi(e)&&(t=e.constructor,(Ci(t)&&(t===Ni||wi(t.prototype))||Oi(t)&&null===(t=t[xi]))&&(t=void 0)),void 0===t?Ni:t},Pi=function(e,t){return new(Di(e))(0===t?0:t)},Mi=Qn,Ui=ri,Li=Oe,Vi=li,Fi=Pi,Bi=ke([].push),ji=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 h,f,p=Li(c),_=Ui(p),v=Mi(u,d),m=Vi(_),y=0,g=l||Fi,S=t?g(c,m):r||a?g(c,0):void 0;m>y;y++)if((s||y in _)&&(f=v(h=_[y],y,p),e))if(t)S[y]=f;else if(f)switch(e){case 3:return!0;case 5:return h;case 6:return y;case 2:Bi(S,h)}else switch(e){case 4:return!1;case 7:Bi(S,h)}return o?-1:n||i?i:S}},Gi={forEach:ji(0),map:ji(1),filter:ji(2),some:ji(3),every:ji(4),find:ji(5),findIndex:ji(6),filterReject:ji(7)},Hi=me,zi=function(e,t){var r=[][e];return!!r&&Hi((function(){r.call(null,t||function(){return 1},1)}))},Ki=Gi.forEach,Wi=zi("forEach")?[].forEach:function(e){return Ki(this,e,arguments.length>1?arguments[1]:void 0)},Xi=ae,qi=jn,Yi=zn,Ji=Wi,Qi=zr,Zi=function(e){if(e&&e.forEach!==Ji)try{Qi(e,"forEach",Ji)}catch(t){e.forEach=Ji}};for(var $i in qi)qi[$i]&&Zi(Xi[$i]&&Xi[$i].prototype);Zi(Yi);var eo={},to={},ro={}.propertyIsEnumerable,no=Object.getOwnPropertyDescriptor,io=no&&!ro.call({1:2},1);to.f=io?function(e){var t=no(this,e);return!!t&&t.enumerable}:ro;var oo=ri,ao=Re,so=function(e){return oo(ao(e))},co=gt,uo=Ut,lo=to,ho=jr,fo=so,po=hr,_o=De,vo=wt,mo=Object.getOwnPropertyDescriptor;eo.f=co?mo:function(e,t){if(e=fo(e),t=po(t),vo)try{return mo(e,t)}catch(r){}if(_o(e,t))return ho(!uo(lo.f,e,t),e[t])};var yo={},go=ai,So=Math.max,bo=Math.min,Eo=function(e,t){var r=go(e);return r<0?So(r+t,0):bo(r,t)},ko=so,To=Eo,Io=li,Ao=function(e){return function(t,r,n){var i,o=ko(t),a=Io(o),s=To(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}},Ro={includes:Ao(!0),indexOf:Ao(!1)},wo=De,Co=so,Oo=Ro.indexOf,xo=Yr,No=ke([].push),Do=function(e,t){var r,n=Co(e),i=0,o=[];for(r in n)!wo(xo,r)&&wo(n,r)&&No(o,r);for(;t.length>i;)wo(n,r=t[i++])&&(~Oo(o,r)||No(o,r));return o},Po=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Mo=Do,Uo=Po.concat("length","prototype");yo.f=Object.getOwnPropertyNames||function(e){return Mo(e,Uo)};var Lo={};Lo.f=Object.getOwnPropertySymbols;var Vo=We,Fo=yo,Bo=Lo,jo=Dt,Go=ke([].concat),Ho=Vo("Reflect","ownKeys")||function(e){var t=Fo.f(jo(e)),r=Bo.f;return r?Go(t,r(e)):t},zo=De,Ko=Ho,Wo=eo,Xo=yt,qo=function(e,t,r){for(var n=Ko(t),i=Xo.f,o=Wo.f,a=0;a<n.length;a++){var s=n[a];zo(e,s)||r&&zo(r,s)||i(e,s,o(t,s))}},Yo=me,Jo=Ge,Qo=/#|\.prototype\./,Zo=function(e,t){var r=ea[$o(e)];return r==ra||r!=ta&&(Jo(t)?Yo(t):!!t)},$o=Zo.normalize=function(e){return String(e).replace(Qo,".").toLowerCase()},ea=Zo.data={},ta=Zo.NATIVE="N",ra=Zo.POLYFILL="P",na=Zo,ia=ae,oa=eo.f,aa=zr,sa=Rn,ca=de,ua=qo,da=na,la=function(e,t){var r,n,i,o,a,s=e.target,c=e.global,u=e.stat;if(r=c?ia:u?ia[s]||ca(s,{}):(ia[s]||{}).prototype)for(n in t){if(o=t[n],i=e.dontCallGetSet?(a=oa(r,n))&&a.value:r[n],!da(c?n:s+(u?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;ua(o,i)}(e.sham||i&&i.sham)&&aa(o,"sham",!0),sa(r,n,o,e)}},ha={},fa=Do,pa=Po,_a=Object.keys||function(e){return fa(e,pa)},va=gt,ma=Ct,ya=yt,ga=Dt,Sa=so,ba=_a;ha.f=va&&!ma?Object.defineProperties:function(e,t){ga(e);for(var r,n=Sa(t),i=ba(t),o=i.length,a=0;o>a;)ya.f(e,r=i[a++],n[r]);return e};var Ea,ka=We("document","documentElement"),Ta=Dt,Ia=ha,Aa=Po,Ra=Yr,wa=ka,Ca=At,Oa=qr("IE_PROTO"),xa=function(){},Na=function(e){return"<script>"+e+"</"+"script>"},Da=function(e){e.write(Na("")),e.close();var t=e.parentWindow.Object;return e=null,t},Pa=function(){try{Ea=new ActiveXObject("htmlfile")}catch(n){}var e,t;Pa="undefined"!=typeof document?document.domain&&Ea?Da(Ea):((t=Ca("iframe")).style.display="none",wa.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Na("document.F=Object")),e.close(),e.F):Da(Ea);for(var r=Aa.length;r--;)delete Pa.prototype[Aa[r]];return Pa()};Ra[Oa]=!0;var Ma=Object.create||function(e,t){var r;return null!==e?(xa.prototype=Ta(e),r=new xa,xa.prototype=null,r[Oa]=e):r=Pa(),void 0===t?r:Ia.f(r,t)},Ua=_t,La=Ma,Va=yt.f,Fa=Ua("unscopables"),Ba=Array.prototype;null==Ba[Fa]&&Va(Ba,Fa,{configurable:!0,value:La(null)});var ja=function(e){Ba[Fa][e]=!0},Ga=Ro.includes,Ha=ja;la({target:"Array",proto:!0,forced:me((function(){return!Array(1).includes()}))},{includes:function(e){return Ga(this,e,arguments.length>1?arguments[1]:void 0)}}),Ha("includes");var za=Et,Ka=xn,Wa=_t("match"),Xa=function(e){var t;return za(e)&&(void 0!==(t=e[Wa])?!!t:"RegExp"==Ka(e))},qa=Xa,Ya=TypeError,Ja=function(e){if(qa(e))throw Ya("The method doesn't accept regular expressions");return e},Qa=Vn,Za=String,$a=function(e){if("Symbol"===Qa(e))throw TypeError("Cannot convert a Symbol value to a string");return Za(e)},es=_t("match"),ts=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[es]=!1,"/./"[e](t)}catch(n){}}return!1},rs=la,ns=Ja,is=Re,os=$a,as=ts,ss=ke("".indexOf);rs({target:"String",proto:!0,forced:!as("includes")},{includes:function(e){return!!~ss(os(is(this)),os(ns(e)),arguments.length>1?arguments[1]:void 0)}});var cs=Dt,us=function(){var e=cs(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},ds=me,ls=ae.RegExp,hs=ds((function(){var e=ls("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),fs=hs||ds((function(){return!ls("a","y").sticky})),ps=hs||ds((function(){var e=ls("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),_s={BROKEN_CARET:ps,MISSED_STICKY:fs,UNSUPPORTED_Y:hs},vs=me,ms=ae.RegExp,ys=vs((function(){var e=ms(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),gs=me,Ss=ae.RegExp,bs=gs((function(){var e=Ss("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Es=Ut,ks=ke,Ts=$a,Is=us,As=_s,Rs=se.exports,ws=Ma,Cs=dn.get,Os=ys,xs=bs,Ns=Rs("native-string-replace",String.prototype.replace),Ds=RegExp.prototype.exec,Ps=Ds,Ms=ks("".charAt),Us=ks("".indexOf),Ls=ks("".replace),Vs=ks("".slice),Fs=function(){var e=/a/,t=/b*/g;return Es(Ds,e,"a"),Es(Ds,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Bs=As.BROKEN_CARET,js=void 0!==/()??/.exec("")[1];(Fs||js||Bs||Os||xs)&&(Ps=function(e){var t,r,n,i,o,a,s,c=this,u=Cs(c),d=Ts(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=Es(Ps,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,f=Bs&&c.sticky,p=Es(Is,c),_=c.source,v=0,m=d;if(f&&(p=Ls(p,"y",""),-1===Us(p,"g")&&(p+="g"),m=Vs(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Ms(d,c.lastIndex-1))&&(_="(?: "+_+")",m=" "+m,v++),r=new RegExp("^(?:"+_+")",p)),js&&(r=new RegExp("^"+_+"$(?!\\s)",p)),Fs&&(n=c.lastIndex),i=Es(Ds,f?r:c,m),f?i?(i.input=Vs(i.input,v),i[0]=Vs(i[0],v),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:Fs&&i&&(c.lastIndex=c.global?i.index+i[0].length:n),js&&i&&i.length>1&&Es(Ns,i[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&h)for(i.groups=a=ws(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=i[s[1]];return i});var Gs=Ps;la({target:"RegExp",proto:!0,forced:/./.exec!==Gs},{exec:Gs});var Hs=Xn,zs=Rn,Ks=Gs,Ws=me,Xs=_t,qs=zr,Ys=Xs("species"),Js=RegExp.prototype,Qs=function(e,t,r,n){var i=Xs(e),o=!Ws((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!Ws((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[Ys]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!a||r){var s=Hs(/./[i]),c=t(i,""[e],(function(e,t,r,n,i){var a=Hs(e),c=t.exec;return c===Ks||c===Js.exec?o&&!i?{done:!0,value:s(t,r,n)}:{done:!0,value:a(r,t,n)}:{done:!1}}));zs(String.prototype,e,c[0]),zs(Js,i,c[1])}n&&qs(Js[i],"sham",!0)},Zs=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},$s=Ut,ec=Dt,tc=Ge,rc=xn,nc=Gs,ic=TypeError,oc=function(e,t){var r=e.exec;if(tc(r)){var n=$s(r,e,t);return null!==n&&ec(n),n}if("RegExp"===rc(e))return $s(nc,e,t);throw ic("RegExp#exec called on incompatible receiver")},ac=Ut,sc=Dt,cc=Te,uc=Re,dc=Zs,lc=$a,hc=Qt,fc=oc;Qs("search",(function(e,t,r){return[function(t){var r=uc(this),n=cc(t)?void 0:hc(t,e);return n?ac(n,t,r):new RegExp(t)[e](lc(r))},function(e){var n=sc(this),i=lc(e),o=r(t,n,i);if(o.done)return o.value;var a=n.lastIndex;dc(a,0)||(n.lastIndex=0);var s=fc(n,i);return dc(n.lastIndex,a)||(n.lastIndex=a),null===s?-1:s.index}]}));var pc=ke,_c=ai,vc=$a,mc=Re,yc=pc("".charAt),gc=pc("".charCodeAt),Sc=pc("".slice),bc=function(e){return function(t,r){var n,i,o=vc(mc(t)),a=_c(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=gc(o,a))<55296||n>56319||a+1===s||(i=gc(o,a+1))<56320||i>57343?e?yc(o,a):n:e?Sc(o,a,a+2):i-56320+(n-55296<<10)+65536}},Ec={codeAt:bc(!1),charAt:bc(!0)},kc=Ec.charAt,Tc=function(e,t,r){return t+(r?kc(e,t).length:1)},Ic=Ut,Ac=Dt,Rc=Te,wc=ui,Cc=$a,Oc=Re,xc=Qt,Nc=Tc,Dc=oc;Qs("match",(function(e,t,r){return[function(t){var r=Oc(this),n=Rc(t)?void 0:xc(t,e);return n?Ic(n,t,r):new RegExp(t)[e](Cc(r))},function(e){var n=Ac(this),i=Cc(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return Dc(n,i);var a=n.unicode;n.lastIndex=0;for(var s,c=[],u=0;null!==(s=Dc(n,i));){var d=Cc(s[0]);c[u]=d,""===d&&(n.lastIndex=Nc(i,wc(n.lastIndex),a)),u++}return 0===u?null:c}]}));var Pc="\t\n\v\f\r \u2028\u2029\ufeff",Mc=Re,Uc=$a,Lc=ke("".replace),Vc="[\t\n\v\f\r \u2028\u2029\ufeff]",Fc=RegExp("^"+Vc+Vc+"*"),Bc=RegExp(Vc+Vc+"*$"),jc=function(e){return function(t){var r=Uc(Mc(t));return 1&e&&(r=Lc(r,Fc,"")),2&e&&(r=Lc(r,Bc,"")),r}},Gc={start:jc(1),end:jc(2),trim:jc(3)},Hc=ae,zc=me,Kc=ke,Wc=$a,Xc=Gc.trim,qc=Pc,Yc=Hc.parseInt,Jc=Hc.Symbol,Qc=Jc&&Jc.iterator,Zc=/^[+-]?0x/i,$c=Kc(Zc.exec),eu=8!==Yc(qc+"08")||22!==Yc(qc+"0x16")||Qc&&!zc((function(){Yc(Object(Qc))}))?function(e,t){var r=Xc(Wc(e));return Yc(r,t>>>0||($c(Zc,r)?16:10))}:Yc;la({global:!0,forced:parseInt!=eu},{parseInt:eu});var tu,ru,nu,iu={},ou=!me((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),au=De,su=Ge,cu=Oe,uu=ou,du=qr("IE_PROTO"),lu=Object,hu=lu.prototype,fu=uu?lu.getPrototypeOf:function(e){var t=cu(e);if(au(t,du))return t[du];var r=t.constructor;return su(r)&&t instanceof r?r.prototype:t instanceof lu?hu:null},pu=me,_u=Ge,vu=Et,mu=fu,yu=Rn,gu=_t("iterator"),Su=!1;[].keys&&("next"in(nu=[].keys())?(ru=mu(mu(nu)))!==Object.prototype&&(tu=ru):Su=!0);var bu=!vu(tu)||pu((function(){var e={};return tu[gu].call(e)!==e}));bu&&(tu={}),_u(tu[gu])||yu(tu,gu,(function(){return this}));var Eu={IteratorPrototype:tu,BUGGY_SAFARI_ITERATORS:Su},ku=yt.f,Tu=De,Iu=_t("toStringTag"),Au=function(e,t,r){e&&!r&&(e=e.prototype),e&&!Tu(e,Iu)&&ku(e,Iu,{configurable:!0,value:t})},Ru=Eu.IteratorPrototype,wu=Ma,Cu=jr,Ou=Au,xu=iu,Nu=function(){return this},Du=function(e,t,r,n){var i=t+" Iterator";return e.prototype=wu(Ru,{next:Cu(+!n,r)}),Ou(e,i,!1),xu[i]=Nu,e},Pu=Ge,Mu=String,Uu=TypeError,Lu=ke,Vu=Dt,Fu=function(e){if("object"==typeof e||Pu(e))return e;throw Uu("Can't set "+Mu(e)+" as a prototype")},Bu=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Lu(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(n){}return function(r,n){return Vu(r),Fu(n),t?e(r,n):r.__proto__=n,r}}():void 0),ju=la,Gu=Ut,Hu=Ge,zu=Du,Ku=fu,Wu=Bu,Xu=Au,qu=zr,Yu=Rn,Ju=iu,Qu=Or.PROPER,Zu=Or.CONFIGURABLE,$u=Eu.IteratorPrototype,ed=Eu.BUGGY_SAFARI_ITERATORS,td=_t("iterator"),rd="keys",nd="values",id="entries",od=function(){return this},ad=function(e,t,r,n,i,o,a){zu(r,t,n);var s,c,u,d=function(e){if(e===i&&_)return _;if(!ed&&e in f)return f[e];switch(e){case rd:case nd:case id:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,f=e.prototype,p=f[td]||f["@@iterator"]||i&&f[i],_=!ed&&p||d(i),v="Array"==t&&f.entries||p;if(v&&(s=Ku(v.call(new e)))!==Object.prototype&&s.next&&(Ku(s)!==$u&&(Wu?Wu(s,$u):Hu(s[td])||Yu(s,td,od)),Xu(s,l,!0)),Qu&&i==nd&&p&&p.name!==nd&&(Zu?qu(f,"name",nd):(h=!0,_=function(){return Gu(p,this)})),i)if(c={values:d(nd),keys:o?_:d(rd),entries:d(id)},a)for(u in c)(ed||h||!(u in f))&&Yu(f,u,c[u]);else ju({target:t,proto:!0,forced:ed||h},c);return f[td]!==_&&Yu(f,td,_,{name:i}),Ju[t]=_,c},sd=function(e,t){return{value:e,done:t}},cd=so,ud=ja,dd=iu,ld=dn,hd=yt.f,fd=ad,pd=sd,_d=gt,vd="Array Iterator",md=ld.set,yd=ld.getterFor(vd),gd=fd(Array,"Array",(function(e,t){md(this,{type:vd,target:cd(e),index:0,kind:t})}),(function(){var e=yd(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,pd(void 0,!0)):pd("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),Sd=dd.Arguments=dd.Array;if(ud("keys"),ud("values"),ud("entries"),_d&&"values"!==Sd.name)try{hd(Sd,"name",{value:"values"})}catch(RJ){}var bd={exports:{}},Ed={},kd=hr,Td=yt,Id=jr,Ad=function(e,t,r){var n=kd(t);n in e?Td.f(e,n,Id(0,r)):e[n]=r},Rd=Eo,wd=li,Cd=Ad,Od=Array,xd=Math.max,Nd=function(e,t,r){for(var n=wd(e),i=Rd(t,n),o=Rd(void 0===r?n:r,n),a=Od(xd(o-i,0)),s=0;i<o;i++,s++)Cd(a,s,e[i]);return a.length=s,a},Dd=xn,Pd=so,Md=yo.f,Ud=Nd,Ld="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Ed.f=function(e){return Ld&&"Window"==Dd(e)?function(e){try{return Md(e)}catch(RJ){return Ud(Ld)}}(e):Md(Pd(e))};var Vd=me((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Fd=me,Bd=Et,jd=xn,Gd=Vd,Hd=Object.isExtensible,zd=Fd((function(){Hd(1)}))||Gd?function(e){return!!Bd(e)&&((!Gd||"ArrayBuffer"!=jd(e))&&(!Hd||Hd(e)))}:Hd,Kd=!me((function(){return Object.isExtensible(Object.preventExtensions({}))})),Wd=la,Xd=ke,qd=Yr,Yd=Et,Jd=De,Qd=yt.f,Zd=yo,$d=Ed,el=zd,tl=Kd,rl=!1,nl=Ve("meta"),il=0,ol=function(e){Qd(e,nl,{value:{objectID:"O"+il++,weakData:{}}})},al=bd.exports={enable:function(){al.enable=function(){},rl=!0;var e=Zd.f,t=Xd([].splice),r={};r[nl]=1,e(r).length&&(Zd.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===nl){t(n,i,1);break}return n},Wd({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:$d.f}))},fastKey:function(e,t){if(!Yd(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Jd(e,nl)){if(!el(e))return"F";if(!t)return"E";ol(e)}return e[nl].objectID},getWeakData:function(e,t){if(!Jd(e,nl)){if(!el(e))return!0;if(!t)return!1;ol(e)}return e[nl].weakData},onFreeze:function(e){return tl&&rl&&el(e)&&!Jd(e,nl)&&ol(e),e}};qd[nl]=!0;var sl=iu,cl=_t("iterator"),ul=Array.prototype,dl=function(e){return void 0!==e&&(sl.Array===e||ul[cl]===e)},ll=Vn,hl=Qt,fl=Te,pl=iu,_l=_t("iterator"),vl=function(e){if(!fl(e))return hl(e,_l)||hl(e,"@@iterator")||pl[ll(e)]},ml=Ut,yl=qt,gl=Dt,Sl=zt,bl=vl,El=TypeError,kl=function(e,t){var r=arguments.length<2?bl(e):t;if(yl(r))return gl(ml(r,e));throw El(Sl(e)+" is not iterable")},Tl=Ut,Il=Dt,Al=Qt,Rl=function(e,t,r){var n,i;Il(e);try{if(!(n=Al(e,"return"))){if("throw"===t)throw r;return r}n=Tl(n,e)}catch(RJ){i=!0,n=RJ}if("throw"===t)throw r;if(i)throw n;return Il(n),r},wl=Qn,Cl=Ut,Ol=Dt,xl=zt,Nl=dl,Dl=li,Pl=Lt,Ml=kl,Ul=vl,Ll=Rl,Vl=TypeError,Fl=function(e,t){this.stopped=e,this.result=t},Bl=Fl.prototype,jl=function(e,t,r){var n,i,o,a,s,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),f=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),_=wl(t,d),v=function(e){return n&&Ll(n,"normal",e),new Fl(!0,e)},m=function(e){return l?(Ol(e),p?_(e[0],e[1],v):_(e[0],e[1])):p?_(e,v):_(e)};if(h)n=e.iterator;else if(f)n=e;else{if(!(i=Ul(e)))throw Vl(xl(e)+" is not iterable");if(Nl(i)){for(o=0,a=Dl(e);a>o;o++)if((s=m(e[o]))&&Pl(Bl,s))return s;return new Fl(!1)}n=Ml(e,i)}for(c=h?e.next:n.next;!(u=Cl(c,n)).done;){try{s=m(u.value)}catch(RJ){Ll(n,"throw",RJ)}if("object"==typeof s&&s&&Pl(Bl,s))return s}return new Fl(!1)},Gl=Lt,Hl=TypeError,zl=function(e,t){if(Gl(t,e))return e;throw Hl("Incorrect invocation")},Kl=_t("iterator"),Wl=!1;try{var Xl=0,ql={next:function(){return{done:!!Xl++}},return:function(){Wl=!0}};ql[Kl]=function(){return this},Array.from(ql,(function(){throw 2}))}catch(RJ){}var Yl=function(e,t){if(!t&&!Wl)return!1;var r=!1;try{var n={};n[Kl]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(RJ){}return r},Jl=Ge,Ql=Et,Zl=Bu,$l=function(e,t,r){var n,i;return Zl&&Jl(n=t.constructor)&&n!==r&&Ql(i=n.prototype)&&i!==r.prototype&&Zl(e,i),e},eh=la,th=ae,rh=ke,nh=na,ih=Rn,oh=bd.exports,ah=jl,sh=zl,ch=Ge,uh=Te,dh=Et,lh=me,hh=Yl,fh=Au,ph=$l,_h=function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",a=th[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=rh(s[e]);ih(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!dh(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!dh(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!dh(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(nh(e,!ch(a)||!(i||s.forEach&&!lh((function(){(new a).entries().next()})))))c=r.getConstructor(t,e,n,o),oh.enable();else if(nh(e,!0)){var l=new c,h=l[o](i?{}:-0,1)!=l,f=lh((function(){l.has(1)})),p=hh((function(e){new a(e)})),_=!i&&lh((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));p||((c=t((function(e,t){sh(e,s);var r=ph(new a,e,c);return uh(t)||ah(t,r[o],{that:r,AS_ENTRIES:n}),r}))).prototype=s,s.constructor=c),(f||_)&&(d("delete"),d("has"),n&&d("get")),(_||h)&&d(o),i&&s.clear&&delete s.clear}return u[e]=c,eh({global:!0,constructor:!0,forced:c!=a},u),fh(c,e),i||r.setStrong(c,e,n),c},vh=Rn,mh=function(e,t,r){for(var n in t)vh(e,n,t[n],r);return e},yh=We,gh=yt,Sh=gt,bh=_t("species"),Eh=function(e){var t=yh(e),r=gh.f;Sh&&t&&!t[bh]&&r(t,bh,{configurable:!0,get:function(){return this}})},kh=yt.f,Th=Ma,Ih=mh,Ah=Qn,Rh=zl,wh=Te,Ch=jl,Oh=ad,xh=sd,Nh=Eh,Dh=gt,Ph=bd.exports.fastKey,Mh=dn.set,Uh=dn.getterFor,Lh={getConstructor:function(e,t,r,n){var i=e((function(e,i){Rh(e,o),Mh(e,{type:t,index:Th(null),first:void 0,last:void 0,size:0}),Dh||(e.size=0),wh(i)||Ch(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=Uh(t),s=function(e,t,r){var n,i,o=a(e),s=c(e,t);return s?s.value=r:(o.last=s={index:i=Ph(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),Dh?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},c=function(e,t){var r,n=a(e),i=Ph(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return Ih(o,{clear:function(){for(var e=a(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,Dh?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),n=c(t,e);if(n){var i=n.next,o=n.previous;delete r.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),r.first==n&&(r.first=i),r.last==n&&(r.last=o),Dh?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=Ah(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),Ih(o,r?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),Dh&&kh(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=Uh(t),o=Uh(n);Oh(e,t,(function(e,t){Mh(this,{type:n,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?xh("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,xh(void 0,!0))}),r?"entries":"values",!r,!0),Nh(t)}};_h("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Lh);var Vh=Ec.charAt,Fh=$a,Bh=dn,jh=ad,Gh=sd,Hh="String Iterator",zh=Bh.set,Kh=Bh.getterFor(Hh);jh(String,"String",(function(e){zh(this,{type:Hh,string:Fh(e),index:0})}),(function(){var e,t=Kh(this),r=t.string,n=t.index;return n>=r.length?Gh(void 0,!0):(e=Vh(r,n),t.index+=e.length,Gh(e,!1))}));var Wh=ae,Xh=jn,qh=zn,Yh=gd,Jh=zr,Qh=_t,Zh=Qh("iterator"),$h=Qh("toStringTag"),ef=Yh.values,tf=function(e,t){if(e){if(e[Zh]!==ef)try{Jh(e,Zh,ef)}catch(RJ){e[Zh]=ef}if(e[$h]||Jh(e,$h,t),Xh[t])for(var r in Yh)if(e[r]!==Yh[r])try{Jh(e,r,Yh[r])}catch(RJ){e[r]=Yh[r]}}};for(var rf in Xh)tf(Wh[rf]&&Wh[rf].prototype,rf);tf(qh,"DOMTokenList");var nf=Oe,of=_a;la({target:"Object",stat:!0,forced:me((function(){of(1)}))},{keys:function(e){return of(nf(e))}});var af=la,sf=gt,cf=yt.f;af({target:"Object",stat:!0,forced:Object.defineProperty!==cf,sham:!sf},{defineProperty:cf});var uf=ye,df=Function.prototype,lf=df.apply,hf=df.call,ff="object"==typeof Reflect&&Reflect.apply||(uf?hf.bind(lf):function(){return hf.apply(lf,arguments)}),pf=yt.f,_f=function(e,t,r){r in e||pf(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})},vf=$a,mf=function(e,t){return void 0===e?arguments.length<2?"":t:vf(e)},yf=Et,gf=zr,Sf=Error,bf=ke("".replace),Ef=String(Sf("zxcasd").stack),kf=/\n\s*at [^:]*:[^\n]*/,Tf=kf.test(Ef),If=function(e,t){if(Tf&&"string"==typeof e&&!Sf.prepareStackTrace)for(;t--;)e=bf(e,kf,"");return e},Af=jr,Rf=!me((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Af(1,7)),7!==e.stack)})),wf=We,Cf=De,Of=zr,xf=Lt,Nf=Bu,Df=qo,Pf=_f,Mf=$l,Uf=mf,Lf=function(e,t){yf(t)&&"cause"in t&&gf(e,"cause",t.cause)},Vf=If,Ff=Rf,Bf=gt,jf=la,Gf=ff,Hf=function(e,t,r,n){var i="stackTraceLimit",o=n?2:1,a=e.split("."),s=a[a.length-1],c=wf.apply(null,a);if(c){var u=c.prototype;if(Cf(u,"cause")&&delete u.cause,!r)return c;var d=wf("Error"),l=t((function(e,t){var r=Uf(n?t:e,void 0),i=n?new c(e):new c;return void 0!==r&&Of(i,"message",r),Ff&&Of(i,"stack",Vf(i.stack,2)),this&&xf(u,this)&&Mf(i,this,l),arguments.length>o&&Lf(i,arguments[o]),i}));l.prototype=u,"Error"!==s?Nf?Nf(l,d):Df(l,d,{name:!0}):Bf&&i in c&&(Pf(l,c,i),Pf(l,c,"prepareStackTrace")),Df(l,c);try{u.name!==s&&Of(u,"name",s),u.constructor=l}catch(RJ){}return l}},zf="WebAssembly",Kf=ae.WebAssembly,Wf=7!==Error("e",{cause:7}).cause,Xf=function(e,t){var r={};r[e]=Hf(e,t,Wf),jf({global:!0,constructor:!0,arity:1,forced:Wf},r)},qf=function(e,t){if(Kf&&Kf[e]){var r={};r[e]=Hf("WebAssembly."+e,t,Wf),jf({target:zf,stat:!0,constructor:!0,arity:1,forced:Wf},r)}};Xf("Error",(function(e){return function(t){return Gf(e,this,arguments)}})),Xf("EvalError",(function(e){return function(t){return Gf(e,this,arguments)}})),Xf("RangeError",(function(e){return function(t){return Gf(e,this,arguments)}})),Xf("ReferenceError",(function(e){return function(t){return Gf(e,this,arguments)}})),Xf("SyntaxError",(function(e){return function(t){return Gf(e,this,arguments)}})),Xf("TypeError",(function(e){return function(t){return Gf(e,this,arguments)}})),Xf("URIError",(function(e){return function(t){return Gf(e,this,arguments)}})),qf("CompileError",(function(e){return function(t){return Gf(e,this,arguments)}})),qf("LinkError",(function(e){return function(t){return Gf(e,this,arguments)}})),qf("RuntimeError",(function(e){return function(t){return Gf(e,this,arguments)}}));var Yf=qt,Jf=Oe,Qf=ri,Zf=li,$f=TypeError,ep=function(e){return function(t,r,n,i){Yf(r);var o=Jf(t),a=Qf(o),s=Zf(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 $f("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}},tp={left:ep(!1),right:ep(!0)},rp="process"==xn(ae.process),np=tp.left,ip=et,op=rp;la({target:"Array",proto:!0,forced:!zi("reduce")||!op&&ip>79&&ip<83},{reduce:function(e){var t=arguments.length;return np(this,e,t,t>1?arguments[1]:void 0)}});var ap=gt,sp=ke,cp=Ut,up=me,dp=_a,lp=Lo,hp=to,fp=Oe,pp=ri,_p=Object.assign,vp=Object.defineProperty,mp=sp([].concat),yp=!_p||up((function(){if(ap&&1!==_p({b:1},_p(vp({},"a",{enumerable:!0,get:function(){vp(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!=_p({},e)[r]||dp(_p({},t)).join("")!=n}))?function(e,t){for(var r=fp(e),n=arguments.length,i=1,o=lp.f,a=hp.f;n>i;)for(var s,c=pp(arguments[i++]),u=o?mp(dp(c),o(c)):dp(c),d=u.length,l=0;d>l;)s=u[l++],ap&&!cp(a,c,s)||(r[s]=c[s]);return r}:_p,gp=yp;la({target:"Object",stat:!0,arity:2,forced:Object.assign!==gp},{assign:gp});var Sp=la,bp=Xn,Ep=eo.f,kp=ui,Tp=$a,Ip=Ja,Ap=Re,Rp=ts,wp=bp("".endsWith),Cp=bp("".slice),Op=Math.min,xp=Rp("endsWith"),Np=!xp&&!!function(){var e=Ep(String.prototype,"endsWith");return e&&!e.writable}();Sp({target:"String",proto:!0,forced:!Np&&!xp},{endsWith:function(e){var t=Tp(Ap(this));Ip(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:Op(kp(r),n),o=Tp(e);return wp?wp(t,o,i):Cp(t,i-o.length,i)===o}});var Dp=gt,Pp=fi,Mp=TypeError,Up=Object.getOwnPropertyDescriptor,Lp=Dp&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(RJ){return RJ instanceof TypeError}}()?function(e,t){if(Pp(e)&&!Up(e,"length").writable)throw Mp("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},Vp=TypeError,Fp=function(e){if(e>9007199254740991)throw Vp("Maximum allowed index exceeded");return e},Bp=la,jp=Oe,Gp=li,Hp=Lp,zp=Fp,Kp=me((function(){return 4294967297!==[].push.call({length:4294967296},1)})),Wp=!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(RJ){return RJ instanceof TypeError}}();Bp({target:"Array",proto:!0,arity:1,forced:Kp||Wp},{push:function(e){var t=jp(this),r=Gp(t),n=arguments.length;zp(r+n);for(var i=0;i<n;i++)t[r]=arguments[i],r++;return Hp(t,r),r}});var Xp=!0,qp=!0;function Yp(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function Jp(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 Qp(e){return"boolean"!=typeof e?new Error("Argument type: "+a(e)+". Please use a boolean."):(Xp=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function Zp(e){return"boolean"!=typeof e?new Error("Argument type: "+a(e)+". Please use a boolean."):(qp=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function $p(){if("object"===("undefined"==typeof window?"undefined":a(window))){if(Xp)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function e_(e,t){qp&&console.warn(e+" is deprecated, please use "+t+" instead.")}function t_(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=Yp(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=Yp(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=Yp(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function r_(e){return"[object Object]"===Object.prototype.toString.call(e)}function n_(e){return r_(e)?Object.keys(e).reduce((function(t,r){var n=r_(e[r]),i=n?n_(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,h({},r,i))}),{}):e}function i_(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((function(n){n.endsWith("Id")?i_(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((function(t){i_(e,e.get(t),r)}))})))}function o_(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&&i_(e,r,i)}))})),i}var a_=la,s_=Gi.find,c_=ja,u_="find",d_=!0;u_ in[]&&Array(1).find((function(){d_=!1})),a_({target:"Array",proto:!0,forced:d_},{find:function(e){return s_(this,e,arguments.length>1?arguments[1]:void 0)}}),c_(u_);var l_=me,h_=et,f_=_t("species"),p_=function(e){return h_>=51||!l_((function(){var t=[];return(t.constructor={})[f_]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},__=ke([].slice),v_=la,m_=fi,y_=Ri,g_=Et,S_=Eo,b_=li,E_=so,k_=Ad,T_=_t,I_=__,A_=p_("slice"),R_=T_("species"),w_=Array,C_=Math.max;v_({target:"Array",proto:!0,forced:!A_},{slice:function(e,t){var r,n,i,o=E_(this),a=b_(o),s=S_(e,a),c=S_(void 0===t?a:t,a);if(m_(o)&&(r=o.constructor,(y_(r)&&(r===w_||m_(r.prototype))||g_(r)&&null===(r=r[R_]))&&(r=void 0),r===w_||void 0===r))return I_(o,s,c);for(n=new(void 0===r?w_:r)(C_(c-s,0)),i=0;s<c;s++,i++)s in o&&k_(n,i,o[s]);return n.length=i,n}});var O_=la,x_=Ro.indexOf,N_=zi,D_=Xn([].indexOf),P_=!!D_&&1/D_([1],1,-0)<0,M_=N_("indexOf");O_({target:"Array",proto:!0,forced:P_||!M_},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return P_?D_(this,e,t)||0:x_(this,e,t)}});var U_=zt,L_=TypeError,V_=function(e,t){if(!delete e[t])throw L_("Cannot delete property "+U_(t)+" of "+U_(e))},F_=la,B_=Oe,j_=Eo,G_=ai,H_=li,z_=Lp,K_=Fp,W_=Pi,X_=Ad,q_=V_,Y_=p_("splice"),J_=Math.max,Q_=Math.min;F_({target:"Array",proto:!0,forced:!Y_},{splice:function(e,t){var r,n,i,o,a,s,c=B_(this),u=H_(c),d=j_(e,u),l=arguments.length;for(0===l?r=n=0:1===l?(r=0,n=u-d):(r=l-2,n=Q_(J_(G_(t),0),u-d)),K_(u+r-n),i=W_(c,n),o=0;o<n;o++)(a=d+o)in c&&X_(i,o,c[a]);if(i.length=n,r<n){for(o=d;o<u-n;o++)s=o+r,(a=o+n)in c?c[s]=c[a]:q_(c,s);for(o=u;o>u-n+r;o--)q_(c,o-1)}else if(r>n)for(o=u-n;o>d;o--)s=o+r-1,(a=o+n-1)in c?c[s]=c[a]:q_(c,s);for(o=0;o<r;o++)c[o+d]=arguments[o+2];return z_(c,u-n+r),i}});var Z_=Gi.map;la({target:"Array",proto:!0,forced:!p_("map")},{map:function(e){return Z_(this,e,arguments.length>1?arguments[1]:void 0)}});var $_,ev,tv,rv,nv=Ri,iv=zt,ov=TypeError,av=function(e){if(nv(e))return e;throw ov(iv(e)+" is not a constructor")},sv=Dt,cv=av,uv=Te,dv=_t("species"),lv=function(e,t){var r,n=sv(e).constructor;return void 0===n||uv(r=sv(n)[dv])?t:cv(r)},hv=TypeError,fv=function(e,t){if(e<t)throw hv("Not enough arguments");return e},pv=/(?:ipad|iphone|ipod).*applewebkit/i.test(Xe),_v=ae,vv=ff,mv=Qn,yv=Ge,gv=De,Sv=me,bv=ka,Ev=__,kv=At,Tv=fv,Iv=pv,Av=rp,Rv=_v.setImmediate,wv=_v.clearImmediate,Cv=_v.process,Ov=_v.Dispatch,xv=_v.Function,Nv=_v.MessageChannel,Dv=_v.String,Pv=0,Mv={},Uv="onreadystatechange";try{$_=_v.location}catch(RJ){}var Lv=function(e){if(gv(Mv,e)){var t=Mv[e];delete Mv[e],t()}},Vv=function(e){return function(){Lv(e)}},Fv=function(e){Lv(e.data)},Bv=function(e){_v.postMessage(Dv(e),$_.protocol+"//"+$_.host)};Rv&&wv||(Rv=function(e){Tv(arguments.length,1);var t=yv(e)?e:xv(e),r=Ev(arguments,1);return Mv[++Pv]=function(){vv(t,void 0,r)},ev(Pv),Pv},wv=function(e){delete Mv[e]},Av?ev=function(e){Cv.nextTick(Vv(e))}:Ov&&Ov.now?ev=function(e){Ov.now(Vv(e))}:Nv&&!Iv?(rv=(tv=new Nv).port2,tv.port1.onmessage=Fv,ev=mv(rv.postMessage,rv)):_v.addEventListener&&yv(_v.postMessage)&&!_v.importScripts&&$_&&"file:"!==$_.protocol&&!Sv(Bv)?(ev=Bv,_v.addEventListener("message",Fv,!1)):ev=Uv in kv("script")?function(e){bv.appendChild(kv("script")).onreadystatechange=function(){bv.removeChild(this),Lv(e)}}:function(e){setTimeout(Vv(e),0)});var jv,Gv,Hv,zv,Kv,Wv,Xv,qv,Yv={set:Rv,clear:wv},Jv=ae,Qv=/ipad|iphone|ipod/i.test(Xe)&&void 0!==Jv.Pebble,Zv=/web0s(?!.*chrome)/i.test(Xe),$v=ae,em=Qn,tm=eo.f,rm=Yv.set,nm=pv,im=Qv,om=Zv,am=rp,sm=$v.MutationObserver||$v.WebKitMutationObserver,cm=$v.document,um=$v.process,dm=$v.Promise,lm=tm($v,"queueMicrotask"),hm=lm&&lm.value;hm||(jv=function(){var e,t;for(am&&(e=um.domain)&&e.exit();Gv;){t=Gv.fn,Gv=Gv.next;try{t()}catch(RJ){throw Gv?zv():Hv=void 0,RJ}}Hv=void 0,e&&e.enter()},nm||am||om||!sm||!cm?!im&&dm&&dm.resolve?((Xv=dm.resolve(void 0)).constructor=dm,qv=em(Xv.then,Xv),zv=function(){qv(jv)}):am?zv=function(){um.nextTick(jv)}:(rm=em(rm,$v),zv=function(){rm(jv)}):(Kv=!0,Wv=cm.createTextNode(""),new sm(jv).observe(Wv,{characterData:!0}),zv=function(){Wv.data=Kv=!Kv}));var fm=hm||function(e){var t={fn:e,next:void 0};Hv&&(Hv.next=t),Gv||(Gv=t,zv()),Hv=t},pm=ae,_m=function(e){try{return{error:!1,value:e()}}catch(RJ){return{error:!0,value:RJ}}},vm=function(){this.head=null,this.tail=null};vm.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 mm=vm,ym=ae.Promise,gm="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Sm=!gm&&!rp&&"object"==typeof window&&"object"==typeof document,bm=ae,Em=ym,km=Ge,Tm=na,Im=Lr,Am=_t,Rm=Sm,wm=gm,Cm=et;Em&&Em.prototype;var Om=Am("species"),xm=!1,Nm=km(bm.PromiseRejectionEvent),Dm=Tm("Promise",(function(){var e=Im(Em),t=e!==String(Em);if(!t&&66===Cm)return!0;if(!Cm||Cm<51||!/native code/.test(e)){var r=new Em((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[Om]=n,!(xm=r.then((function(){}))instanceof n))return!0}return!t&&(Rm||wm)&&!Nm})),Pm={CONSTRUCTOR:Dm,REJECTION_EVENT:Nm,SUBCLASSING:xm},Mm={},Um=qt,Lm=TypeError,Vm=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw Lm("Bad Promise constructor");t=e,r=n})),this.resolve=Um(t),this.reject=Um(r)};Mm.f=function(e){return new Vm(e)};var Fm,Bm,jm,Gm=la,Hm=rp,zm=ae,Km=Ut,Wm=Rn,Xm=Bu,qm=Au,Ym=Eh,Jm=qt,Qm=Ge,Zm=Et,$m=zl,ey=lv,ty=Yv.set,ry=fm,ny=function(e,t){var r=pm.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},iy=_m,oy=mm,ay=dn,sy=ym,cy=Mm,uy="Promise",dy=Pm.CONSTRUCTOR,ly=Pm.REJECTION_EVENT,hy=Pm.SUBCLASSING,fy=ay.getterFor(uy),py=ay.set,_y=sy&&sy.prototype,vy=sy,my=_y,yy=zm.TypeError,gy=zm.document,Sy=zm.process,by=cy.f,Ey=by,ky=!!(gy&&gy.createEvent&&zm.dispatchEvent),Ty="unhandledrejection",Iy=function(e){var t;return!(!Zm(e)||!Qm(t=e.then))&&t},Ay=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&&xy(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?u(yy("Promise-chain cycle")):(n=Iy(r))?Km(n,r,c,u):c(r)):u(o)}catch(RJ){d&&!i&&d.exit(),u(RJ)}},Ry=function(e,t){e.notified||(e.notified=!0,ry((function(){for(var r,n=e.reactions;r=n.get();)Ay(r,e);e.notified=!1,t&&!e.rejection&&Cy(e)})))},wy=function(e,t,r){var n,i;ky?((n=gy.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),zm.dispatchEvent(n)):n={promise:t,reason:r},!ly&&(i=zm["on"+e])?i(n):e===Ty&&ny("Unhandled promise rejection",r)},Cy=function(e){Km(ty,zm,(function(){var t,r=e.facade,n=e.value;if(Oy(e)&&(t=iy((function(){Hm?Sy.emit("unhandledRejection",n,r):wy(Ty,r,n)})),e.rejection=Hm||Oy(e)?2:1,t.error))throw t.value}))},Oy=function(e){return 1!==e.rejection&&!e.parent},xy=function(e){Km(ty,zm,(function(){var t=e.facade;Hm?Sy.emit("rejectionHandled",t):wy("rejectionhandled",t,e.value)}))},Ny=function(e,t,r){return function(n){e(t,n,r)}},Dy=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Ry(e,!0))},Py=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw yy("Promise can't be resolved itself");var n=Iy(t);n?ry((function(){var r={done:!1};try{Km(n,t,Ny(Py,r,e),Ny(Dy,r,e))}catch(RJ){Dy(r,RJ,e)}})):(e.value=t,e.state=1,Ry(e,!1))}catch(RJ){Dy({done:!1},RJ,e)}}};if(dy&&(my=(vy=function(e){$m(this,my),Jm(e),Km(Fm,this);var t=fy(this);try{e(Ny(Py,t),Ny(Dy,t))}catch(RJ){Dy(t,RJ)}}).prototype,(Fm=function(e){py(this,{type:uy,done:!1,notified:!1,parent:!1,reactions:new oy,rejection:!1,state:0,value:void 0})}).prototype=Wm(my,"then",(function(e,t){var r=fy(this),n=by(ey(this,vy));return r.parent=!0,n.ok=!Qm(e)||e,n.fail=Qm(t)&&t,n.domain=Hm?Sy.domain:void 0,0==r.state?r.reactions.add(n):ry((function(){Ay(n,r)})),n.promise})),Bm=function(){var e=new Fm,t=fy(e);this.promise=e,this.resolve=Ny(Py,t),this.reject=Ny(Dy,t)},cy.f=by=function(e){return e===vy||undefined===e?new Bm(e):Ey(e)},Qm(sy)&&_y!==Object.prototype)){jm=_y.then,hy||Wm(_y,"then",(function(e,t){var r=this;return new vy((function(e,t){Km(jm,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete _y.constructor}catch(RJ){}Xm&&Xm(_y,my)}Gm({global:!0,constructor:!0,wrap:!0,forced:dy},{Promise:vy}),qm(vy,uy,!1),Ym(uy);var My=ym,Uy=Pm.CONSTRUCTOR||!Yl((function(e){My.all(e).then(void 0,(function(){}))})),Ly=Ut,Vy=qt,Fy=Mm,By=_m,jy=jl;la({target:"Promise",stat:!0,forced:Uy},{all:function(e){var t=this,r=Fy.f(t),n=r.resolve,i=r.reject,o=By((function(){var r=Vy(t.resolve),o=[],a=0,s=1;jy(e,(function(e){var c=a++,u=!1;s++,Ly(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}});var Gy=la,Hy=Pm.CONSTRUCTOR,zy=ym,Ky=We,Wy=Ge,Xy=Rn,qy=zy&&zy.prototype;if(Gy({target:"Promise",proto:!0,forced:Hy,real:!0},{catch:function(e){return this.then(void 0,e)}}),Wy(zy)){var Yy=Ky("Promise").prototype.catch;qy.catch!==Yy&&Xy(qy,"catch",Yy,{unsafe:!0})}var Jy=Ut,Qy=qt,Zy=Mm,$y=_m,eg=jl;la({target:"Promise",stat:!0,forced:Uy},{race:function(e){var t=this,r=Zy.f(t),n=r.reject,i=$y((function(){var i=Qy(t.resolve);eg(e,(function(e){Jy(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var tg=Ut,rg=Mm;la({target:"Promise",stat:!0,forced:Pm.CONSTRUCTOR},{reject:function(e){var t=rg.f(this);return tg(t.reject,void 0,e),t.promise}});var ng=Dt,ig=Et,og=Mm,ag=function(e,t){if(ng(e),ig(t)&&t.constructor===e)return t;var r=og.f(e);return(0,r.resolve)(t),r.promise},sg=la,cg=Pm.CONSTRUCTOR,ug=ag;We("Promise"),sg({target:"Promise",stat:!0,forced:cg},{resolve:function(e){return ug(this,e)}});var dg=rp,lg=Tr.exports,hg=yt,fg=function(e,t,r){return r.get&&lg(r.get,t,{getter:!0}),r.set&&lg(r.set,t,{setter:!0}),hg.f(e,t,r)},pg=gt,_g=me,vg=Dt,mg=Ma,yg=mf,gg=Error.prototype.toString,Sg=_g((function(){if(pg){var e=mg(Object.defineProperty({},"name",{get:function(){return this===e}}));if("true"!==gg.call(e))return!0}return"2: 1"!==gg.call({message:1,name:2})||"Error"!==gg.call({})}))?function(){var e=vg(this),t=yg(e.name,"Error"),r=yg(e.message);return t?r?t+": "+r:t:r}:gg,bg={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}},Eg=la,kg=function(e){try{if(dg)return Function('return require("'+e+'")')()}catch(RJ){}},Tg=We,Ig=me,Ag=Ma,Rg=jr,wg=yt.f,Cg=Rn,Og=fg,xg=De,Ng=zl,Dg=Dt,Pg=Sg,Mg=mf,Ug=bg,Lg=If,Vg=dn,Fg=gt,Bg="DOMException",jg="DATA_CLONE_ERR",Gg=Tg("Error"),Hg=Tg(Bg)||function(){try{(new(Tg("MessageChannel")||kg("worker_threads").MessageChannel)).port1.postMessage(new WeakMap)}catch(RJ){if(RJ.name==jg&&25==RJ.code)return RJ.constructor}}(),zg=Hg&&Hg.prototype,Kg=Gg.prototype,Wg=Vg.set,Xg=Vg.getterFor(Bg),qg="stack"in Gg(Bg),Yg=function(e){return xg(Ug,e)&&Ug[e].m?Ug[e].c:0},Jg=function(){Ng(this,Qg);var e=arguments.length,t=Mg(e<1?void 0:arguments[0]),r=Mg(e<2?void 0:arguments[1],"Error"),n=Yg(r);if(Wg(this,{type:Bg,name:r,message:t,code:n}),Fg||(this.name=r,this.message=t,this.code=n),qg){var i=Gg(t);i.name=Bg,wg(this,"stack",Rg(1,Lg(i.stack,1)))}},Qg=Jg.prototype=Ag(Kg),Zg=function(e){return{enumerable:!0,configurable:!0,get:e}},$g=function(e){return Zg((function(){return Xg(this)[e]}))};Fg&&(Og(Qg,"code",$g("code")),Og(Qg,"message",$g("message")),Og(Qg,"name",$g("name"))),wg(Qg,"constructor",Rg(1,Jg));var eS=Ig((function(){return!(new Hg instanceof Gg)})),tS=eS||Ig((function(){return Kg.toString!==Pg||"2: 1"!==String(new Hg(1,2))})),rS=eS||Ig((function(){return 25!==new Hg(1,"DataCloneError").code}));eS||25!==Hg.DATA_CLONE_ERR||zg.DATA_CLONE_ERR;Eg({global:!0,constructor:!0,forced:eS},{DOMException:eS?Jg:Hg});var nS=Tg(Bg),iS=nS.prototype;for(var oS in tS&&Hg===nS&&Cg(iS,"toString",Pg),rS&&Fg&&Hg===nS&&Og(iS,"code",Zg((function(){return Yg(Dg(this).name)}))),Ug)if(xg(Ug,oS)){var aS=Ug[oS],sS=aS.s,cS=Rg(6,aS.c);xg(nS,sS)||wg(nS,sS,cS),xg(iS,sS)||wg(iS,sS,cS)}var uS=la,dS=ae,lS=We,hS=jr,fS=yt.f,pS=De,_S=zl,vS=$l,mS=mf,yS=bg,gS=If,SS=gt,bS="DOMException",ES=lS("Error"),kS=lS(bS),TS=function(){_S(this,IS);var e=arguments.length,t=mS(e<1?void 0:arguments[0]),r=mS(e<2?void 0:arguments[1],"Error"),n=new kS(t,r),i=ES(t);return i.name=bS,fS(n,"stack",hS(1,gS(i.stack,1))),vS(n,this,TS),n},IS=TS.prototype=kS.prototype,AS="stack"in ES(bS),RS="stack"in new kS(1,2),wS=kS&&SS&&Object.getOwnPropertyDescriptor(dS,bS),CS=!(!wS||wS.writable&&wS.configurable),OS=AS&&!CS&&!RS;uS({global:!0,constructor:!0,forced:OS},{DOMException:OS?TS:kS});var xS=lS(bS),NS=xS.prototype;if(NS.constructor!==xS)for(var DS in fS(NS,"constructor",hS(1,xS)),yS)if(pS(yS,DS)){var PS=yS[DS],MS=PS.s;pS(xS,MS)||fS(xS,MS,hS(6,PS.c))}var US="DOMException";Au(We(US),US);var LS=Gi.filter;la({target:"Array",proto:!0,forced:!p_("filter")},{filter:function(e){return LS(this,e,arguments.length>1?arguments[1]:void 0)}});var VS=la,FS=me,BS=fi,jS=Et,GS=Oe,HS=li,zS=Fp,KS=Ad,WS=Pi,XS=p_,qS=et,YS=_t("isConcatSpreadable"),JS=qS>=51||!FS((function(){var e=[];return e[YS]=!1,e.concat()[0]!==e})),QS=XS("concat"),ZS=function(e){if(!jS(e))return!1;var t=e[YS];return void 0!==t?!!t:BS(e)};VS({target:"Array",proto:!0,arity:1,forced:!JS||!QS},{concat:function(e){var t,r,n,i,o,a=GS(this),s=WS(a,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(ZS(o=-1===t?a:arguments[t]))for(i=HS(o),zS(c+i),r=0;r<i;r++,c++)r in o&&KS(s,c,o[r]);else zS(c+1),KS(s,c++,o);return s.length=c,s}});var $S=ke,eb=Oe,tb=Math.floor,rb=$S("".charAt),nb=$S("".replace),ib=$S("".slice),ob=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,ab=/\$([$&'`]|\d{1,2})/g,sb=ff,cb=Ut,ub=ke,db=Qs,lb=me,hb=Dt,fb=Ge,pb=Te,_b=ai,vb=ui,mb=$a,yb=Re,gb=Tc,Sb=Qt,bb=function(e,t,r,n,i,o){var a=r+e.length,s=n.length,c=ab;return void 0!==i&&(i=eb(i),c=ob),nb(o,c,(function(o,c){var u;switch(rb(c,0)){case"$":return"$";case"&":return e;case"`":return ib(t,0,r);case"'":return ib(t,a);case"<":u=i[ib(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=tb(d/10);return 0===l?o:l<=s?void 0===n[l-1]?rb(c,1):n[l-1]+rb(c,1):o}u=n[d-1]}return void 0===u?"":u}))},Eb=oc,kb=_t("replace"),Tb=Math.max,Ib=Math.min,Ab=ub([].concat),Rb=ub([].push),wb=ub("".indexOf),Cb=ub("".slice),Ob="$0"==="a".replace(/./,"$0"),xb=!!/./[kb]&&""===/./[kb]("a","$0"),Nb=!lb((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));db("replace",(function(e,t,r){var n=xb?"$":"$0";return[function(e,r){var n=yb(this),i=pb(e)?void 0:Sb(e,kb);return i?cb(i,e,n,r):cb(t,mb(n),e,r)},function(e,i){var o=hb(this),a=mb(e);if("string"==typeof i&&-1===wb(i,n)&&-1===wb(i,"$<")){var s=r(t,o,a,i);if(s.done)return s.value}var c=fb(i);c||(i=mb(i));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=Eb(o,a);if(null===h)break;if(Rb(l,h),!u)break;""===mb(h[0])&&(o.lastIndex=gb(a,vb(o.lastIndex),d))}for(var f,p="",_=0,v=0;v<l.length;v++){for(var m=mb((h=l[v])[0]),y=Tb(Ib(_b(h.index),a.length),0),g=[],S=1;S<h.length;S++)Rb(g,void 0===(f=h[S])?f:String(f));var b=h.groups;if(c){var E=Ab([m],g,y,a);void 0!==b&&Rb(E,b);var k=mb(sb(i,void 0,E))}else k=bb(m,a,y,g,b,i);y>=_&&(p+=Cb(a,_,y)+k,_=y+m.length)}return p+Cb(a,_)}]}),!Nb||!Ob||xb);var Db=Ut,Pb=De,Mb=Lt,Ub=us,Lb=RegExp.prototype,Vb=function(e){var t=e.flags;return void 0!==t||"flags"in Lb||Pb(e,"flags")||!Mb(Lb,e)?t:Db(Ub,e)},Fb=gt,Bb=ae,jb=ke,Gb=na,Hb=$l,zb=zr,Kb=yo.f,Wb=Lt,Xb=Xa,qb=$a,Yb=Vb,Jb=_s,Qb=_f,Zb=Rn,$b=me,eE=De,tE=dn.enforce,rE=Eh,nE=ys,iE=bs,oE=_t("match"),aE=Bb.RegExp,sE=aE.prototype,cE=Bb.SyntaxError,uE=jb(sE.exec),dE=jb("".charAt),lE=jb("".replace),hE=jb("".indexOf),fE=jb("".slice),pE=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,_E=/a/g,vE=/a/g,mE=new aE(_E)!==_E,yE=Jb.MISSED_STICKY,gE=Jb.UNSUPPORTED_Y,SE=Fb&&(!mE||yE||nE||iE||$b((function(){return vE[oE]=!1,aE(_E)!=_E||aE(vE)==vE||"/a/i"!=aE(_E,"i")})));if(Gb("RegExp",SE)){for(var bE=function(e,t){var r,n,i,o,a,s,c=Wb(sE,this),u=Xb(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===bE)return e;if((u||Wb(sE,e))&&(e=e.source,d&&(t=Yb(h))),e=void 0===e?"":qb(e),t=void 0===t?"":qb(t),h=e,nE&&"dotAll"in _E&&(n=!!t&&hE(t,"s")>-1)&&(t=lE(t,/s/g,"")),r=t,yE&&"sticky"in _E&&(i=!!t&&hE(t,"y")>-1)&&gE&&(t=lE(t,/y/g,"")),iE&&(o=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=dE(e,n)))t+=dE(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:uE(pE,fE(e,n+1))&&(n+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===d||eE(a,d))throw new cE("Invalid capture group name");a[d]=!0,o[o.length]=[d,u],c=!1,d="";continue}c?d+=t:i+=t}return[i,o]}(e),e=o[0],l=o[1]),a=Hb(aE(e,t),c?this:sE,bE),(n||i||l.length)&&(s=tE(a),n&&(s.dotAll=!0,s.raw=bE(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=dE(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+dE(e,++n);return i}(e),r)),i&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{zb(a,"source",""===h?"(?:)":h)}catch(RJ){}return a},EE=Kb(aE),kE=0;EE.length>kE;)Qb(bE,aE,EE[kE++]);sE.constructor=bE,bE.prototype=sE,Zb(Bb,"RegExp",bE,{constructor:!0})}rE("RegExp");var TE=gt,IE=ys,AE=xn,RE=fg,wE=dn.get,CE=RegExp.prototype,OE=TypeError;TE&&IE&&RE(CE,"dotAll",{configurable:!0,get:function(){if(this!==CE){if("RegExp"===AE(this))return!!wE(this).dotAll;throw OE("Incompatible receiver, RegExp required")}}});var xE=gt,NE=_s.MISSED_STICKY,DE=xn,PE=fg,ME=dn.get,UE=RegExp.prototype,LE=TypeError;xE&&NE&&PE(UE,"sticky",{configurable:!0,get:function(){if(this!==UE){if("RegExp"===DE(this))return!!ME(this).sticky;throw LE("Incompatible receiver, RegExp required")}}});var VE=Or.PROPER,FE=Rn,BE=Dt,jE=$a,GE=me,HE=Vb,zE="toString",KE=RegExp.prototype.toString,WE=GE((function(){return"/a/b"!=KE.call({source:"a",flags:"b"})})),XE=VE&&KE.name!=zE;(WE||XE)&&FE(RegExp.prototype,zE,(function(){var e=BE(this);return"/"+jE(e.source)+"/"+jE(HE(e))}),{unsafe:!0});var qE=la,YE=me,JE=so,QE=eo.f,ZE=gt,$E=YE((function(){QE(1)}));qE({target:"Object",stat:!0,forced:!ZE||$E,sham:!ZE},{getOwnPropertyDescriptor:function(e,t){return QE(JE(e),t)}});var ek=la,tk=We,rk=ff,nk=Ut,ik=ke,ok=me,ak=fi,sk=Ge,ck=Et,uk=Gt,dk=__,lk=nt,hk=tk("JSON","stringify"),fk=ik(/./.exec),pk=ik("".charAt),_k=ik("".charCodeAt),vk=ik("".replace),mk=ik(1..toString),yk=/[\uD800-\uDFFF]/g,gk=/^[\uD800-\uDBFF]$/,Sk=/^[\uDC00-\uDFFF]$/,bk=!lk||ok((function(){var e=tk("Symbol")();return"[null]"!=hk([e])||"{}"!=hk({a:e})||"{}"!=hk(Object(e))})),Ek=ok((function(){return'"\\udf06\\ud834"'!==hk("\udf06\ud834")||'"\\udead"'!==hk("\udead")})),kk=function(e,t){var r=dk(arguments),n=t;if((ck(t)||void 0!==e)&&!uk(e))return ak(t)||(t=function(e,t){if(sk(n)&&(t=nk(n,this,e,t)),!uk(t))return t}),r[1]=t,rk(hk,null,r)},Tk=function(e,t,r){var n=pk(r,t-1),i=pk(r,t+1);return fk(gk,e)&&!fk(Sk,i)||fk(Sk,e)&&!fk(gk,n)?"\\u"+mk(_k(e,0),16):e};hk&&ek({target:"JSON",stat:!0,arity:3,forced:bk||Ek},{stringify:function(e,t,r){var n=dk(arguments),i=rk(bk?kk:hk,null,n);return Ek&&"string"==typeof i?vk(i,yk,Tk):i}});var Ik=$p;function Ak(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==a(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"===a(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"===a(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"===a(e.video)){var s=e.video.facingMode;s=s&&("object"===a(s)?s:{ideal:s});var c,u=t.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||u))if(delete e.video.facingMode,"environment"===s.exact||"environment"===s.ideal?c=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(c=["front"]),c)return r.mediaDevices.enumerateDevices().then((function(t){var r=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return c.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!r&&t.length&&c.includes("back")&&(r=t[t.length-1]),r&&(e.video.deviceId=s.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),Ik("chrome: "+JSON.stringify(e)),i(e)}));e.video=n(e.video)}return Ik("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 s=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return i(e,(function(e){return s(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 Promise.reject(o(e))}))}))}}}}function Rk(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function wk(e){if("object"===a(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 Jp(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function Ck(e){if("object"===a(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"===a(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var s=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=s.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 Ok(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 Promise((function(r,n){t.apply(e,[function(e){r(s(a(e)))},n])})).then(i,o)}}}function xk(e){if("object"===a(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 o_(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}),Jp(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 o_(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?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}}}function Nk(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 Dk(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Nk(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),Promise.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=h({},t,(function(){var e=this,t=arguments,n=arguments.length&&"function"==typeof arguments[0];return n?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 Pk(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=h({},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 Mk(e,t){Jp(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 Uk,Lk,Vk=Object.freeze(Object.defineProperty({__proto__:null,shimMediaStream:Rk,shimOnTrack:wk,shimGetSendersWithDtmf:Ck,shimGetStats:Ok,shimSenderReceiverGetStats:xk,shimAddTrackRemoveTrackWithNative:Nk,shimAddTrackRemoveTrack:Dk,shimPeerConnection:Pk,fixNegotiationNeeded:Mk,shimGetUserMedia:Ak,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"))}},Symbol.toStringTag,{value:"Module"})),Fk=la,Bk=Ut,jk=Ge,Gk=Dt,Hk=$a,zk=(Uk=!1,(Lk=/[ac]/).exec=function(){return Uk=!0,/./.exec.apply(this,arguments)},!0===Lk.test("abc")&&Uk),Kk=/./.test;Fk({target:"RegExp",proto:!0,forced:!zk},{test:function(e){var t=Gk(this),r=Hk(e),n=t.exec;if(!jk(n))return Bk(Kk,t,r);var i=Bk(n,t,r);return null!==i&&(Gk(i),!0)}});var Wk=ae,Xk=me,qk=$a,Yk=Gc.trim,Jk=ke("".charAt),Qk=Wk.parseFloat,Zk=Wk.Symbol,$k=Zk&&Zk.iterator,eT=1/Qk("\t\n\v\f\r \u2028\u2029\ufeff-0")!=-1/0||$k&&!Xk((function(){Qk(Object($k))}))?function(e){var t=Yk(qk(e)),r=Qk(t);return 0===r&&"-"==Jk(t,0)?-0:r}:Qk;la({global:!0,forced:parseFloat!=eT},{parseFloat:eT});var tT=la,rT=ym,nT=me,iT=We,oT=Ge,aT=lv,sT=ag,cT=Rn,uT=rT&&rT.prototype;if(tT({target:"Promise",proto:!0,real:!0,forced:!!rT&&nT((function(){uT.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=aT(this,iT("Promise")),r=oT(e);return this.then(r?function(r){return sT(t,e()).then((function(){return r}))}:e,r?function(r){return sT(t,e()).then((function(){throw r}))}:e)}}),oT(rT)){var dT=iT("Promise").prototype.finally;uT.finally!==dT&&cT(uT,"finally",dT,{unsafe:!0})}function lT(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){e_("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"===a(e)&&"object"===a(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 s=n.prototype.getSettings;n.prototype.getSettings=function(){var e=s.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var c=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===a(e)&&(e=JSON.parse(JSON.stringify(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),c.apply(this,[e])}}}}function hT(e){"object"===a(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 fT(e,t){if("object"===a(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=h({},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(n){if("TypeError"!==n.name)throw n;e.forEach((function(t,n){e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function pT(e){if("object"===a(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):Promise.resolve(new Map)}}}function _T(e){if("object"===a(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}),Jp(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function vT(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;e_("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function mT(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function yT(e){if("object"===a(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]);var r=(e=k(e)).length>0;r&&e.forEach((function(e){if("rid"in e){if(!/^[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,i.sendEncodings=e,this.setParametersPromises.push(i.setParameters(o).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return n})}}function gT(e){if("object"===a(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 ST(e){if("object"===a(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?Promise.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}function bT(e){if("object"===a(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?Promise.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}var ET=Object.freeze(Object.defineProperty({__proto__:null,shimOnTrack:hT,shimPeerConnection:fT,shimSenderGetStats:pT,shimReceiverGetStats:_T,shimRemoveStream:vT,shimRTCDataChannel:mT,shimAddTransceiver:yT,shimGetParameters:gT,shimCreateOffer:ST,shimCreateAnswer:bT,shimGetUserMedia:lT,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,Promise.reject(n)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}},Symbol.toStringTag,{value:"Module"}));function kT(e){if("object"===a(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 TT(e){if("object"===a(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 IT(e){if("object"===a(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,s=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),Promise.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),Promise.resolve()):i};var c=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=c,c=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=c,c=function(e,t,r){var n=s.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=c}}function AT(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(RT(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function RT(e){return e&&void 0!==e.video?Object.assign({},e,{video:n_(e.video)}):e}function wT(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")?(e_("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 CT(e){"object"===a(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 OT(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",{direction:"recvonly"}),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",{direction:"recvonly"})}return t.apply(this,arguments)}}function xT(e){"object"!==a(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var NT=Object.freeze(Object.defineProperty({__proto__:null,shimLocalStreamsAPI:kT,shimRemoteStreamsAPI:TT,shimCallbacksAPI:IT,shimGetUserMedia:AT,shimConstraints:RT,shimRTCIceServerUrls:wT,shimTrackEventTransceiver:CT,shimCreateOfferLegacy:OT,shimAudioContext:xT},Symbol.toStringTag,{value:"Module"})),DT=Ut;la({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return DT(URL.prototype.toString,this)}});var PT=ke(1..valueOf),MT=gt,UT=ae,LT=ke,VT=na,FT=Rn,BT=De,jT=$l,GT=Lt,HT=Gt,zT=ur,KT=me,WT=yo.f,XT=eo.f,qT=yt.f,YT=PT,JT=Gc.trim,QT="Number",ZT=UT.Number,$T=ZT.prototype,eI=UT.TypeError,tI=LT("".slice),rI=LT("".charCodeAt),nI=function(e){var t=zT(e,"number");return"bigint"==typeof t?t:iI(t)},iI=function(e){var t,r,n,i,o,a,s,c,u=zT(e,"number");if(HT(u))throw eI("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=JT(u),43===(t=rI(u,0))||45===t){if(88===(r=rI(u,2))||120===r)return NaN}else if(48===t){switch(rI(u,1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+u}for(a=(o=tI(u,2)).length,s=0;s<a;s++)if((c=rI(o,s))<48||c>i)return NaN;return parseInt(o,n)}return+u};if(VT(QT,!ZT(" 0o1")||!ZT("0b1")||ZT("+0x1"))){for(var oI,aI=function(e){var t=arguments.length<1?0:ZT(nI(e)),r=this;return GT($T,r)&&KT((function(){YT(r)}))?jT(Object(t),r,aI):t},sI=MT?WT(ZT):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),cI=0;sI.length>cI;cI++)BT(ZT,oI=sI[cI])&&!BT(aI,oI)&&qT(aI,oI,XT(ZT,oI));aI.prototype=$T,$T.constructor=aI,FT(UT,QT,aI,{constructor:!0})}var uI=Or.PROPER,dI=me,lI=Pc,hI=Gc.trim;la({target:"String",proto:!0,forced:function(e){return dI((function(){return!!lI[e]()||"
"!=="
"[e]()||uI&&lI[e].name!==e}))}("trim")},{trim:function(){return hI(this)}});var fI={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:{1:"rtp",2:"rtcp"}[t[1]]||t[1],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:void 0===r[t[n]]&&(r[t[n]]=t[n+1])}return r},t.writeCandidate=function(e){var t=[];t.push(e.foundation);var r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&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){void 0!==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].toUpperCase()}},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"===a(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){var t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},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"),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.writeRtcpParameters=function(e){var t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},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};var a=t.matchPrefix(e,"a=sctpmap:");if(a.length>0){var s=a[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[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.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}(fI);var pI=fI.exports,_I=e({__proto__:null,default:pI},[fI.exports]);function vI(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===a(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=pI.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,Jp(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function mI(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||Jp(e,"icecandidate",(function(e){if(e.candidate){var t=pI.parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function yI(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=pI.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=pI.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=pI.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){var e=this.getConfiguration(),s=e.sdpSemantics;"plan-b"===s&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){var c,u=n(arguments[0]),d=i(u),l=o(arguments[0],u);c=0===d&&0===l?Number.POSITIVE_INFINITY:0===d||0===l?Math.max(d,l):Math.min(d,l);var h={};Object.defineProperty(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function gI(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},Jp(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 SI(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 bI(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"!==e.trim()})).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 EI(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?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function kI(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,t=arguments[0]||{};if("object"!==a(t)||t.type&&t.sdp)return r.apply(this,arguments);if(!(t={type:t.type,sdp:t.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return r.apply(this,[t]);var n="offer"===t.type?this.createOffer:this.createAnswer;return n.apply(this).then((function(t){return r.apply(e,[t])}))})}}var TI=Object.freeze(Object.defineProperty({__proto__:null,shimRTCIceCandidate:vI,shimRTCIceCandidateRelayProtocol:mI,shimMaxMessageSize:yI,shimSendThrowTypeError:gI,shimConnectionState:SI,removeExtmapAllowMixed:bI,shimAddIceCandidateNullOrEmpty:EI,shimParameterlessSetLocalDescription:kI},Symbol.toStringTag,{value:"Module"}));!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},n=$p,i=t_(t),o={browserDetails:i,commonShim:TI,extractVersion:Yp,disableLog:Qp,disableWarnings:Zp,sdp:_I};switch(i.browser){case"chrome":if(!Vk||!Pk||!r.shimChrome)return n("Chrome shim is not included in this adapter release."),o;if(null===i.version)return n("Chrome shim can not determine version, not shimming."),o;n("adapter.js shimming chrome."),o.browserShim=Vk,EI(t,i),kI(t),Ak(t,i),Rk(t),Pk(t,i),wk(t),Dk(t,i),Ck(t),Ok(t),xk(t),Mk(t,i),vI(t),mI(t),SI(t),yI(t,i),gI(t),bI(t,i);break;case"firefox":if(!ET||!fT||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=ET,EI(t,i),kI(t),lT(t,i),fT(t,i),hT(t),vT(t),pT(t),_T(t),mT(t),yT(t),gT(t),ST(t),bT(t),vI(t),SI(t),yI(t,i),gI(t);break;case"safari":if(!NT||!r.shimSafari)return n("Safari shim is not included in this adapter release."),o;n("adapter.js shimming safari."),o.browserShim=NT,EI(t,i),kI(t),wT(t),OT(t),IT(t),kT(t),TT(t),CT(t),AT(t),xT(t),vI(t),mI(t),yI(t,i),gI(t),bI(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var II=Nd,AI=Math.floor,RI=function(e,t){var r=e.length,n=AI(r/2);return r<8?wI(e,t):CI(e,RI(II(e,0,n),t),RI(II(e,n),t),t)},wI=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},CI=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},OI=RI,xI=Xe.match(/firefox\/(\d+)/i),NI=!!xI&&+xI[1],DI=/MSIE|Trident/.test(Xe),PI=Xe.match(/AppleWebKit\/(\d+)\./),MI=!!PI&&+PI[1],UI=la,LI=ke,VI=qt,FI=Oe,BI=li,jI=V_,GI=$a,HI=me,zI=OI,KI=zi,WI=NI,XI=DI,qI=et,YI=MI,JI=[],QI=LI(JI.sort),ZI=LI(JI.push),$I=HI((function(){JI.sort(void 0)})),eA=HI((function(){JI.sort(null)})),tA=KI("sort"),rA=!HI((function(){if(qI)return qI<70;if(!(WI&&WI>3)){if(XI)return!0;if(YI)return YI<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++)JI.push({k:t+n,v:r})}for(JI.sort((function(e,t){return t.v-e.v})),n=0;n<JI.length;n++)t=JI[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));UI({target:"Array",proto:!0,forced:$I||!eA||!tA||!rA},{sort:function(e){void 0!==e&&VI(e);var t=FI(this);if(rA)return void 0===e?QI(t):QI(t,e);var r,n,i=[],o=BI(t);for(n=0;n<o;n++)n in t&&ZI(i,t[n]);for(zI(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:GI(t)>GI(r)?1:-1}}(e)),r=BI(i),n=0;n<r;)t[n]=i[n++];for(;n<o;)jI(t,n++);return t}});var nA,iA,oA,aA={exports:{}},sA="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,cA=sA,uA=gt,dA=ae,lA=Ge,hA=Et,fA=De,pA=Vn,_A=zt,vA=zr,mA=Rn,yA=yt.f,gA=Lt,SA=fu,bA=Bu,EA=_t,kA=Ve,TA=dn.enforce,IA=dn.get,AA=dA.Int8Array,RA=AA&&AA.prototype,wA=dA.Uint8ClampedArray,CA=wA&&wA.prototype,OA=AA&&SA(AA),xA=RA&&SA(RA),NA=Object.prototype,DA=dA.TypeError,PA=EA("toStringTag"),MA=kA("TYPED_ARRAY_TAG"),UA="TypedArrayConstructor",LA=cA&&!!bA&&"Opera"!==pA(dA.opera),VA=!1,FA={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},BA={BigInt64Array:8,BigUint64Array:8},jA=function(e){var t=SA(e);if(hA(t)){var r=IA(t);return r&&fA(r,UA)?r.TypedArrayConstructor:jA(t)}},GA=function(e){if(!hA(e))return!1;var t=pA(e);return fA(FA,t)||fA(BA,t)};for(nA in FA)(oA=(iA=dA[nA])&&iA.prototype)?TA(oA).TypedArrayConstructor=iA:LA=!1;for(nA in BA)(oA=(iA=dA[nA])&&iA.prototype)&&(TA(oA).TypedArrayConstructor=iA);if((!LA||!lA(OA)||OA===Function.prototype)&&(OA=function(){throw DA("Incorrect invocation")},LA))for(nA in FA)dA[nA]&&bA(dA[nA],OA);if((!LA||!xA||xA===NA)&&(xA=OA.prototype,LA))for(nA in FA)dA[nA]&&bA(dA[nA].prototype,xA);if(LA&&SA(CA)!==xA&&bA(CA,xA),uA&&!fA(xA,PA))for(nA in VA=!0,yA(xA,PA,{get:function(){return hA(this)?this[MA]:void 0}}),FA)dA[nA]&&vA(dA[nA],MA,nA);var HA={NATIVE_ARRAY_BUFFER_VIEWS:LA,TYPED_ARRAY_TAG:VA&&MA,aTypedArray:function(e){if(GA(e))return e;throw DA("Target is not a typed array")},aTypedArrayConstructor:function(e){if(lA(e)&&(!bA||gA(OA,e)))return e;throw DA(_A(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(uA){if(r)for(var i in FA){var o=dA[i];if(o&&fA(o.prototype,e))try{delete o.prototype[e]}catch(RJ){try{o.prototype[e]=t}catch(a){}}}xA[e]&&!r||mA(xA,e,r?t:LA&&RA[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(uA){if(bA){if(r)for(n in FA)if((i=dA[n])&&fA(i,e))try{delete i[e]}catch(RJ){}if(OA[e]&&!r)return;try{return mA(OA,e,r?t:LA&&OA[e]||t)}catch(RJ){}}for(n in FA)!(i=dA[n])||i[e]&&!r||mA(i,e,t)}},getTypedArrayConstructor:jA,isView:function(e){if(!hA(e))return!1;var t=pA(e);return"DataView"===t||fA(FA,t)||fA(BA,t)},isTypedArray:GA,TypedArray:OA,TypedArrayPrototype:xA},zA=ae,KA=me,WA=Yl,XA=HA.NATIVE_ARRAY_BUFFER_VIEWS,qA=zA.ArrayBuffer,YA=zA.Int8Array,JA=!XA||!KA((function(){YA(1)}))||!KA((function(){new YA(-1)}))||!WA((function(e){new YA,new YA(null),new YA(1.5),new YA(e)}),!0)||KA((function(){return 1!==new YA(new qA(2),1,void 0).length})),QA=ai,ZA=ui,$A=RangeError,eR=function(e){if(void 0===e)return 0;var t=QA(e),r=ZA(t);if(t!==r)throw $A("Wrong length or index");return r},tR=Array,rR=Math.abs,nR=Math.pow,iR=Math.floor,oR=Math.log,aR=Math.LN2,sR={pack:function(e,t,r){var n,i,o,a=tR(r),s=8*r-t-1,c=(1<<s)-1,u=c>>1,d=23===t?nR(2,-24)-nR(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=rR(e))!=e||e===1/0?(i=e!=e?1:0,n=c):(n=iR(oR(e)/aR),e*(o=nR(2,-n))<1&&(n--,o*=2),(e+=n+u>=1?d/o:d*nR(2,1-u))*o>=2&&(n++,o/=2),n+u>=c?(i=0,n=c):n+u>=1?(i=(e*o-1)*nR(2,t),n+=u):(i=e*nR(2,u-1)*nR(2,t),n=0));t>=8;)a[h++]=255&i,i/=256,t-=8;for(n=n<<t|i,s+=t;s>0;)a[h++]=255&n,n/=256,s-=8;return a[--h]|=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+=nR(2,t),d-=a}return(u?-1:1)*r*nR(2,d-t)}},cR=Oe,uR=Eo,dR=li,lR=function(e){for(var t=cR(this),r=dR(t),n=arguments.length,i=uR(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:uR(o,r);a>i;)t[i++]=e;return t},hR=ae,fR=ke,pR=gt,_R=sA,vR=Or,mR=zr,yR=mh,gR=me,SR=zl,bR=ai,ER=ui,kR=eR,TR=sR,IR=fu,AR=Bu,RR=yo.f,wR=yt.f,CR=lR,OR=Nd,xR=Au,NR=vR.PROPER,DR=vR.CONFIGURABLE,PR=dn.get,MR=dn.set,UR="ArrayBuffer",LR="DataView",VR="Wrong index",FR=hR.ArrayBuffer,BR=FR,jR=BR&&BR.prototype,GR=hR.DataView,HR=GR&&GR.prototype,zR=Object.prototype,KR=hR.Array,WR=hR.RangeError,XR=fR(CR),qR=fR([].reverse),YR=TR.pack,JR=TR.unpack,QR=function(e){return[255&e]},ZR=function(e){return[255&e,e>>8&255]},$R=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},ew=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},tw=function(e){return YR(e,23,4)},rw=function(e){return YR(e,52,8)},nw=function(e,t){wR(e.prototype,t,{get:function(){return PR(this)[t]}})},iw=function(e,t,r,n){var i=kR(r),o=PR(e);if(i+t>o.byteLength)throw WR(VR);var a=PR(o.buffer).bytes,s=i+o.byteOffset,c=OR(a,s,s+t);return n?c:qR(c)},ow=function(e,t,r,n,i,o){var a=kR(r),s=PR(e);if(a+t>s.byteLength)throw WR(VR);for(var c=PR(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(_R){var aw=NR&&FR.name!==UR;if(gR((function(){FR(1)}))&&gR((function(){new FR(-1)}))&&!gR((function(){return new FR,new FR(1.5),new FR(NaN),1!=FR.length||aw&&!DR})))aw&&DR&&mR(FR,"name",UR);else{(BR=function(e){return SR(this,jR),new FR(kR(e))}).prototype=jR;for(var sw,cw=RR(FR),uw=0;cw.length>uw;)(sw=cw[uw++])in BR||mR(BR,sw,FR[sw]);jR.constructor=BR}AR&&IR(HR)!==zR&&AR(HR,zR);var dw=new GR(new BR(2)),lw=fR(HR.setInt8);dw.setInt8(0,2147483648),dw.setInt8(1,2147483649),!dw.getInt8(0)&&dw.getInt8(1)||yR(HR,{setInt8:function(e,t){lw(this,e,t<<24>>24)},setUint8:function(e,t){lw(this,e,t<<24>>24)}},{unsafe:!0})}else jR=(BR=function(e){SR(this,jR);var t=kR(e);MR(this,{bytes:XR(KR(t),0),byteLength:t}),pR||(this.byteLength=t)}).prototype,HR=(GR=function(e,t,r){SR(this,HR),SR(e,jR);var n=PR(e).byteLength,i=bR(t);if(i<0||i>n)throw WR("Wrong offset");if(i+(r=void 0===r?n-i:ER(r))>n)throw WR("Wrong length");MR(this,{buffer:e,byteLength:r,byteOffset:i}),pR||(this.buffer=e,this.byteLength=r,this.byteOffset=i)}).prototype,pR&&(nw(BR,"byteLength"),nw(GR,"buffer"),nw(GR,"byteLength"),nw(GR,"byteOffset")),yR(HR,{getInt8:function(e){return iw(this,1,e)[0]<<24>>24},getUint8:function(e){return iw(this,1,e)[0]},getInt16:function(e){var t=iw(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=iw(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return ew(iw(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return ew(iw(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return JR(iw(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return JR(iw(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){ow(this,1,e,QR,t)},setUint8:function(e,t){ow(this,1,e,QR,t)},setInt16:function(e,t){ow(this,2,e,ZR,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){ow(this,2,e,ZR,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){ow(this,4,e,$R,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){ow(this,4,e,$R,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){ow(this,4,e,tw,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){ow(this,8,e,rw,t,arguments.length>2?arguments[2]:void 0)}});xR(BR,UR),xR(GR,LR);var hw={ArrayBuffer:BR,DataView:GR},fw=Et,pw=Math.floor,_w=Number.isInteger||function(e){return!fw(e)&&isFinite(e)&&pw(e)===e},vw=ai,mw=RangeError,yw=function(e){var t=vw(e);if(t<0)throw mw("The argument can't be less than 0");return t},gw=RangeError,Sw=function(e,t){var r=yw(e);if(r%t)throw gw("Wrong offset");return r},bw=Vn,Ew=ke("".slice),kw=function(e){return"Big"===Ew(bw(e),0,3)},Tw=ur,Iw=TypeError,Aw=function(e){var t=Tw(e,"number");if("number"==typeof t)throw Iw("Can't convert number to bigint");return BigInt(t)},Rw=Qn,ww=Ut,Cw=av,Ow=Oe,xw=li,Nw=kl,Dw=vl,Pw=dl,Mw=kw,Uw=HA.aTypedArrayConstructor,Lw=Aw,Vw=la,Fw=ae,Bw=Ut,jw=gt,Gw=JA,Hw=HA,zw=hw,Kw=zl,Ww=jr,Xw=zr,qw=_w,Yw=ui,Jw=eR,Qw=Sw,Zw=hr,$w=De,eC=Vn,tC=Et,rC=Gt,nC=Ma,iC=Lt,oC=Bu,aC=yo.f,sC=function(e){var t,r,n,i,o,a,s,c,u=Cw(this),d=Ow(e),l=arguments.length,h=l>1?arguments[1]:void 0,f=void 0!==h,p=Dw(d);if(p&&!Pw(p))for(c=(s=Nw(d,p)).next,d=[];!(a=ww(c,s)).done;)d.push(a.value);for(f&&l>2&&(h=Rw(h,arguments[2])),r=xw(d),n=new(Uw(u))(r),i=Mw(n),t=0;r>t;t++)o=f?h(d[t],t):d[t],n[t]=i?Lw(o):+o;return n},cC=Gi.forEach,uC=Eh,dC=yt,lC=eo,hC=$l,fC=dn.get,pC=dn.set,_C=dn.enforce,vC=dC.f,mC=lC.f,yC=Math.round,gC=Fw.RangeError,SC=zw.ArrayBuffer,bC=SC.prototype,EC=zw.DataView,kC=Hw.NATIVE_ARRAY_BUFFER_VIEWS,TC=Hw.TYPED_ARRAY_TAG,IC=Hw.TypedArray,AC=Hw.TypedArrayPrototype,RC=Hw.aTypedArrayConstructor,wC=Hw.isTypedArray,CC="BYTES_PER_ELEMENT",OC="Wrong length",xC=function(e,t){RC(e);for(var r=0,n=t.length,i=new e(n);n>r;)i[r]=t[r++];return i},NC=function(e,t){vC(e,t,{get:function(){return fC(this)[t]}})},DC=function(e){var t;return iC(bC,e)||"ArrayBuffer"==(t=eC(e))||"SharedArrayBuffer"==t},PC=function(e,t){return wC(e)&&!rC(t)&&t in e&&qw(+t)&&t>=0},MC=function(e,t){return t=Zw(t),PC(e,t)?Ww(2,e[t]):mC(e,t)},UC=function(e,t,r){return t=Zw(t),!(PC(e,t)&&tC(r)&&$w(r,"value"))||$w(r,"get")||$w(r,"set")||r.configurable||$w(r,"writable")&&!r.writable||$w(r,"enumerable")&&!r.enumerable?vC(e,t,r):(e[t]=r.value,e)};jw?(kC||(lC.f=MC,dC.f=UC,NC(AC,"buffer"),NC(AC,"byteOffset"),NC(AC,"byteLength"),NC(AC,"length")),Vw({target:"Object",stat:!0,forced:!kC},{getOwnPropertyDescriptor:MC,defineProperty:UC}),aA.exports=function(e,t,r){var n=e.match(/\d+$/)[0]/8,i=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=Fw[i],c=s,u=c&&c.prototype,d={},l=function(e,t){vC(e,t,{get:function(){return function(e,t){var r=fC(e);return r.view[o](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=fC(e);r&&(i=(i=yC(i))<0?0:i>255?255:255&i),o.view[a](t*n+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};kC?Gw&&(c=t((function(e,t,r,i){return Kw(e,u),hC(tC(t)?DC(t)?void 0!==i?new s(t,Qw(r,n),i):void 0!==r?new s(t,Qw(r,n)):new s(t):wC(t)?xC(c,t):Bw(sC,c,t):new s(Jw(t)),e,c)})),oC&&oC(c,IC),cC(aC(s),(function(e){e in c||Xw(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,r,i){Kw(e,u);var o,a,s,d=0,h=0;if(tC(t)){if(!DC(t))return wC(t)?xC(c,t):Bw(sC,c,t);o=t,h=Qw(r,n);var f=t.byteLength;if(void 0===i){if(f%n)throw gC(OC);if((a=f-h)<0)throw gC(OC)}else if((a=Yw(i)*n)+h>f)throw gC(OC);s=a/n}else s=Jw(t),o=new SC(a=s*n);for(pC(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new EC(o)});d<s;)l(e,d++)})),oC&&oC(c,IC),u=c.prototype=nC(AC)),u.constructor!==c&&Xw(u,"constructor",c),_C(u).TypedArrayConstructor=c,TC&&Xw(u,TC,i);var h=c!=s;d[i]=c,Vw({global:!0,constructor:!0,forced:h,sham:!kC},d),CC in c||Xw(c,CC,n),CC in u||Xw(u,CC,n),uC(i)}):aA.exports=function(){},(0,aA.exports)("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var LC=li,VC=ai,FC=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("at",(function(e){var t=FC(this),r=LC(t),n=VC(e),i=n>=0?n:r+n;return i<0||i>=r?void 0:t[i]}));var BC=Oe,jC=Eo,GC=li,HC=V_,zC=Math.min,KC=[].copyWithin||function(e,t){var r=BC(this),n=GC(r),i=jC(e,n),o=jC(t,n),a=arguments.length>2?arguments[2]:void 0,s=zC((void 0===a?n:jC(a,n))-o,n-i),c=1;for(o<i&&i<o+s&&(c=-1,o+=s-1,i+=s-1);s-- >0;)o in r?r[i]=r[o]:HC(r,i),i+=c,o+=c;return r},WC=HA,XC=ke(KC),qC=WC.aTypedArray;(0,WC.exportTypedArrayMethod)("copyWithin",(function(e,t){return XC(qC(this),e,t,arguments.length>2?arguments[2]:void 0)}));var YC=Gi.every,JC=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("every",(function(e){return YC(JC(this),e,arguments.length>1?arguments[1]:void 0)}));var QC=lR,ZC=Aw,$C=Vn,eO=Ut,tO=me,rO=HA.aTypedArray,nO=HA.exportTypedArrayMethod,iO=ke("".slice),oO=tO((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e}));nO("fill",(function(e){var t=arguments.length;rO(this);var r="Big"===iO($C(this),0,3)?ZC(e):+e;return eO(QC,this,r,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),oO);var aO=li,sO=function(e,t){for(var r=0,n=aO(t),i=new e(n);n>r;)i[r]=t[r++];return i},cO=lv,uO=HA.aTypedArrayConstructor,dO=HA.getTypedArrayConstructor,lO=function(e){return uO(cO(e,dO(e)))},hO=sO,fO=lO,pO=Gi.filter,_O=function(e,t){return hO(fO(e),t)},vO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("filter",(function(e){var t=pO(vO(this),e,arguments.length>1?arguments[1]:void 0);return _O(this,t)}));var mO=Gi.find,yO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("find",(function(e){return mO(yO(this),e,arguments.length>1?arguments[1]:void 0)}));var gO=Gi.findIndex,SO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("findIndex",(function(e){return gO(SO(this),e,arguments.length>1?arguments[1]:void 0)}));var bO=Qn,EO=ri,kO=Oe,TO=li,IO=function(e){var t=1==e;return function(r,n,i){for(var o,a=kO(r),s=EO(a),c=bO(n,i),u=TO(s);u-- >0;)if(c(o=s[u],u,a))switch(e){case 0:return o;case 1:return u}return t?-1:void 0}},AO={findLast:IO(0),findLastIndex:IO(1)},RO=AO.findLast,wO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("findLast",(function(e){return RO(wO(this),e,arguments.length>1?arguments[1]:void 0)}));var CO=AO.findLastIndex,OO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("findLastIndex",(function(e){return CO(OO(this),e,arguments.length>1?arguments[1]:void 0)}));var xO=Gi.forEach,NO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("forEach",(function(e){xO(NO(this),e,arguments.length>1?arguments[1]:void 0)}));var DO=Ro.includes,PO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("includes",(function(e){return DO(PO(this),e,arguments.length>1?arguments[1]:void 0)}));var MO=Ro.indexOf,UO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("indexOf",(function(e){return MO(UO(this),e,arguments.length>1?arguments[1]:void 0)}));var LO=ae,VO=me,FO=ke,BO=HA,jO=gd,GO=_t("iterator"),HO=LO.Uint8Array,zO=FO(jO.values),KO=FO(jO.keys),WO=FO(jO.entries),XO=BO.aTypedArray,qO=BO.exportTypedArrayMethod,YO=HO&&HO.prototype,JO=!VO((function(){YO[GO].call([1])})),QO=!!YO&&YO.values&&YO[GO]===YO.values&&"values"===YO.values.name,ZO=function(){return zO(XO(this))};qO("entries",(function(){return WO(XO(this))}),JO),qO("keys",(function(){return KO(XO(this))}),JO),qO("values",ZO,JO||!QO,{name:"values"}),qO(GO,ZO,JO||!QO,{name:"values"});var $O=HA.aTypedArray,ex=HA.exportTypedArrayMethod,tx=ke([].join);ex("join",(function(e){return tx($O(this),e)}));var rx=ff,nx=so,ix=ai,ox=li,ax=zi,sx=Math.min,cx=[].lastIndexOf,ux=!!cx&&1/[1].lastIndexOf(1,-0)<0,dx=ax("lastIndexOf"),lx=ux||!dx?function(e){if(ux)return rx(cx,this,arguments)||0;var t=nx(this),r=ox(t),n=r-1;for(arguments.length>1&&(n=sx(n,ix(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:cx,hx=ff,fx=lx,px=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return hx(fx,px(this),t>1?[e,arguments[1]]:[e])}));var _x=Gi.map,vx=lO,mx=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("map",(function(e){return _x(mx(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(vx(e))(t)}))}));var yx=tp.left,gx=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return yx(gx(this),e,t,t>1?arguments[1]:void 0)}));var Sx=tp.right,bx=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return Sx(bx(this),e,t,t>1?arguments[1]:void 0)}));var Ex=HA.aTypedArray,kx=HA.exportTypedArrayMethod,Tx=Math.floor;kx("reverse",(function(){for(var e,t=this,r=Ex(t).length,n=Tx(r/2),i=0;i<n;)e=t[i],t[i++]=t[--r],t[r]=e;return t}));var Ix=ae,Ax=Ut,Rx=HA,wx=li,Cx=Sw,Ox=Oe,xx=me,Nx=Ix.RangeError,Dx=Ix.Int8Array,Px=Dx&&Dx.prototype,Mx=Px&&Px.set,Ux=Rx.aTypedArray,Lx=Rx.exportTypedArrayMethod,Vx=!xx((function(){var e=new Uint8ClampedArray(2);return Ax(Mx,e,{length:1,0:3},1),3!==e[1]})),Fx=Vx&&Rx.NATIVE_ARRAY_BUFFER_VIEWS&&xx((function(){var e=new Dx(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));Lx("set",(function(e){Ux(this);var t=Cx(arguments.length>1?arguments[1]:void 0,1),r=Ox(e);if(Vx)return Ax(Mx,this,r,t);var n=this.length,i=wx(r),o=0;if(i+t>n)throw Nx("Wrong length");for(;o<i;)this[t+o]=r[o++]}),!Vx||Fx);var Bx=lO,jx=__,Gx=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("slice",(function(e,t){for(var r=jx(Gx(this),e,t),n=Bx(this),i=0,o=r.length,a=new n(o);o>i;)a[i]=r[i++];return a}),me((function(){new Int8Array(1).slice()})));var Hx=Gi.some,zx=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("some",(function(e){return Hx(zx(this),e,arguments.length>1?arguments[1]:void 0)}));var Kx=Xn,Wx=me,Xx=qt,qx=OI,Yx=NI,Jx=DI,Qx=et,Zx=MI,$x=HA.aTypedArray,eN=HA.exportTypedArrayMethod,tN=ae.Uint16Array,rN=tN&&Kx(tN.prototype.sort),nN=!(!rN||Wx((function(){rN(new tN(2),null)}))&&Wx((function(){rN(new tN(2),{})}))),iN=!!rN&&!Wx((function(){if(Qx)return Qx<74;if(Yx)return Yx<67;if(Jx)return!0;if(Zx)return Zx<602;var e,t,r=new tN(516),n=Array(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(rN(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0}));eN("sort",(function(e){return void 0!==e&&Xx(e),iN?rN(this,e):qx($x(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))}),!iN||nN);var oN=ff,aN=HA,sN=me,cN=__,uN=ae.Int8Array,dN=aN.aTypedArray,lN=aN.exportTypedArrayMethod,hN=[].toLocaleString,fN=!!uN&&sN((function(){hN.call(new uN(1))}));lN("toLocaleString",(function(){return oN(hN,fN?cN(dN(this)):dN(this),cN(arguments))}),sN((function(){return[1,2].toLocaleString()!=new uN([1,2]).toLocaleString()}))||!sN((function(){uN.prototype.toLocaleString.call([1,2])})));var pN=HA.exportTypedArrayMethod,_N=me,vN=ke,mN=ae.Uint8Array,yN=mN&&mN.prototype||{},gN=[].toString,SN=vN([].join);_N((function(){gN.call({})}))&&(gN=function(){return SN(this)});var bN=yN.toString!=gN;pN("toString",gN,bN);var EN=li,kN=function(e,t){for(var r=EN(e),n=new t(r),i=0;i<r;i++)n[i]=e[r-i-1];return n},TN=HA.aTypedArray,IN=HA.getTypedArrayConstructor;(0,HA.exportTypedArrayMethod)("toReversed",(function(){return kN(TN(this),IN(this))}));var AN=qt,RN=sO,wN=HA.aTypedArray,CN=HA.getTypedArrayConstructor,ON=HA.exportTypedArrayMethod,xN=ke(HA.TypedArrayPrototype.sort);ON("toSorted",(function(e){void 0!==e&&AN(e);var t=wN(this),r=RN(CN(t),t);return xN(r,e)}));var NN=li,DN=ai,PN=RangeError,MN=function(e,t,r,n){var i=NN(e),o=DN(r),a=o<0?i+o:o;if(a>=i||a<0)throw PN("Incorrect index");for(var s=new t(i),c=0;c<i;c++)s[c]=c===a?n:e[c];return s},UN=kw,LN=ai,VN=Aw,FN=HA.aTypedArray,BN=HA.getTypedArrayConstructor,jN=HA.exportTypedArrayMethod,GN=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(RJ){return 8===RJ}}();jN("with",{with:function(e,t){var r=FN(this),n=LN(e),i=UN(r)?VN(t):+t;return MN(r,BN(r),n,i)}}.with,!GN);var HN=la,zN=Gi.findIndex,KN=ja,WN="findIndex",XN=!0;WN in[]&&Array(1).findIndex((function(){XN=!1})),HN({target:"Array",proto:!0,forced:XN},{findIndex:function(e){return zN(this,e,arguments.length>1?arguments[1]:void 0)}}),KN(WN);var qN=function(e){return e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVOKED_BEFORE_JOIN_ROOM="INVOKED_BEFORE_JOIN_ROOM",e.INVALID_TOKEN="INVALID_TOKEN",e.EXPIRED_TOKEN="EXPIRED_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.UPDATE_TOKEN_WITH_INVALID_TOKEN="UPDATE_TOKEN_WITH_INVALID_TOKEN",e.UPDATE_TOKEN_BEFORE_JOIN="UPDATE_TOKEN_BEFORE_JOIN",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",e.REPEAT_PUSH="REPEAT_PUSH",e.REPEAT_PLAY="REPEAT_PLAY",e.PUBLISH_BEFORE_JOIN="PUBLISH_BEFORE_JOIN",e.UNPUBLISH_BEFORE_JOIN="UNPUBLISH_BEFORE_JOIN",e.SUBSCRIBE_BEFORE_JOIN="SUBSCRIBE_BEFORE_JOIN",e.UNSUBSCRIBE_BEFORE_JOIN="UNSUBSCRIBE_BEFORE_JOIN",e.NO_PUBLISH_PERMISSION="NO_PUBLISH_PERMISSION",e.STREAM_NOT_EXIST="STREAM_NOT_EXIST",e.EMPTY_STREAM="EMPTY_STREAM",e.NOT_CONNECTED_YET="NOT_CONNECTED_YET",e.IM_BEFORE_JOIN="IM_BEFORE_JOIN",e.USER_NOT_EXIST="USER_NOT_EXIST",e.ALREADY_IN_ROOM="ALREADY_IN_ROOM",e.KICKED_OUT="KICKED_OUT",e.ROOM_DISMISS="ROOM_DISMISS",e.TOKEN_EXPIRED="TOKEN_EXPIRED",e.DUPLICATE_LOGIN="DUPLICATE_LOGIN",e.INVOKED_BEFORE_CAPTURE="INVOKED_BEFORE_CAPTURE",e.REPEAT_CAPTURE="REPEAT_CAPTURE",e.GET_VIDEO_TRACK_FAILED="GET_VIDEO_TRACK_FAILED",e.GET_AUDIO_TRACK_FAILED="GET_AUDIO_TRACK_FAILED",e.GET_SCREEN_TRACK_FAILED="GET_SCREEN_TRACK_FAILED",e.STREAM_TYPE_NOT_MATCH="STREAM_TYPE_NOT_MATCH",e.CANT_FIND_DOM="CANT_FIND_DOM",e.INVALID_DEVICE_ID="INVALID_DEVICE_ID",e.NO_PERMISSION="NO_PERMISSION",e.NOT_SUPPORTED="NOT_SUPPORTED",e.INTERRUPT="INTERRUPT",e.ICE_SERVER_WRONG="ICE_SERVER_WRONG",e.ESTABLISH_DATACHANNEL_FAILED="ESTABLISH_DATACHANNEL_FAILED",e.LOAD_RESOURCES_FAILED="LOAD_RESOURCES_FAILED",e.SIGNALING_CHANNEL_NOT_OPEN="SIGNALING_CHANNEL_NOT_OPEN",e.TIME_OUT="TIME_OUT",e.REFUSE_OPERATION_IN_DISCONNECT="REFUSE_OPERATION_IN_DISCONNECT",e.ADD_TRANSCEIVER_FAILED="ADD_TRANSCEIVER_FAILED",e.UPDATE_TRACK_FAILED="UPDATE_TRACK_FAILED",e.PUBLISH_FAILED="PUBLISH_FAILED",e.UNPUBLISH_FAILED="UNPUBLISH_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.OPERATION_CANCEL="OPERATION_CANCEL",e.START_CLOUD_PROXY_AFTER_JOIN="START_CLOUD_PROXY_AFTER_JOIN",e.STOP_CLOUD_PROXY_BEFORE_LEAVE="STOP_CLOUD_PROXY_BEFORE_LEAVE",e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.REPEAT_DEVICE_TEST="REPEAT_DEVICE_TEST",e.AUDIO_DEVICE_TEST_FAILED="AUDIO_DEVICE_RECORD_FAILED",e.ALREADY_LOGIN="ALREADY_LOGIN",e.LOGIN_FAILED="LOGIN_FAILED",e.NOT_LOGIN="NOT_LOGIN",e.RTM_DUPLICATE_LOGIN="RTM_DUPLICATE_LOGIN",e.RTM_TOKEN_ERROR="RTM_TOKEN_ERROR",e.USER_MESSAGE_TIMEOUT="USER_MESSAGE_TIMEOUT",e.USER_MESSAGE_BROKEN="USER_MESSAGE_BROKEN",e.USER_MESSAGE_NO_RECEIVER="USER_MESSAGE_NO_RECEIVER",e.USER_MESSAGE_NO_RELAYPATH="USER_MESSAGE_NO_RELAYPATH",e.USER_MESSAGE_SEND_TO_SERVER_ERROR="USER_MESSAGE_SEND_TO_SERVER_ERROR",e.USER_MESSAGE_SERVER_RESPONSE_ERROR="USER_MESSAGE_SERVER_RESPONSE_ERROR",e.USER_MESSAGE_NOT_JOIN="USER_MESSAGE_NOT_JOIN",e.USER_MESSAGE_INIT="USER_MESSAGE_INIT",e.USER_MESSAGE_NO_CONNECTION="USER_MESSAGE_NO_CONNECTION",e.USER_MESSAGE_NOT_LOGIN="USER_MESSAGE_NOT_LOGIN",e.USER_MESSAGE_SERVER_PARAMS_NOTSET="USER_MESSAGE_SERVER_PARAMS_NOTSET",e.USER_MESSAGE_UNKNOWN="USER_MESSAGE_UNKNOWN",e.START_PUBLIC_STREAM_BEFORE_JOIN="START_PUBLIC_STREAM_BEFORE_JOIN",e.RECONNECT_FAILED="RECONNECT_FAILED",e}(qN||{}),YN=function(e){return e[e.AUDIO_MIXING_ERROR_OK=0]="AUDIO_MIXING_ERROR_OK",e[e.AUDIO_MIXING_ERROR_PRELOAD_FAILED=1]="AUDIO_MIXING_ERROR_PRELOAD_FAILED",e[e.AUDIO_MIXING_ERROR_START_FAILED=2]="AUDIO_MIXING_ERROR_START_FAILED",e[e.AUDIO_MIXING_ERROR_ID_NOT_FOUND=3]="AUDIO_MIXING_ERROR_ID_NOT_FOUND",e[e.AUDIO_MIXING_ERROR_SET_POSITION_FAILED=4]="AUDIO_MIXING_ERROR_SET_POSITION_FAILED",e[e.AUDIO_MIXING_ERROR_INVALID_VOLUME=5]="AUDIO_MIXING_ERROR_INVALID_VOLUME",e[e.AUDIO_MIXING_ERROR_LOAD_CONFLICT=6]="AUDIO_MIXING_ERROR_LOAD_CONFLICT",e[e.AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH=7]="AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH",e[e.AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH=8]="AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH",e[e.AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK=9]="AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK",e}(YN||{}),JN=l((function e(t,r,n){u(this,e),h(this,"code",void 0),h(this,"message",void 0),h(this,"error",void 0),this.code=t,this.message=r,this.error=n})),QN=gt,ZN=ke,$N=_a,eD=so,tD=ZN(to.f),rD=ZN([].push),nD=function(e){return function(t){for(var r,n=eD(t),i=$N(n),o=i.length,a=0,s=[];o>a;)r=i[a++],QN&&!tD(n,r)||rD(s,e?[r,n[r]]:n[r]);return s}},iD={entries:nD(!0),values:nD(!1)}.entries;la({target:"Object",stat:!0},{entries:function(e){return iD(e)}});var oD=ai,aD=$a,sD=Re,cD=RangeError,uD=ke,dD=ui,lD=$a,hD=function(e){var t=aD(sD(this)),r="",n=oD(e);if(n<0||n==1/0)throw cD("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},fD=Re,pD=uD(hD),_D=uD("".slice),vD=Math.ceil,mD=function(e){return function(t,r,n){var i,o,a=lD(fD(t)),s=dD(r),c=a.length,u=void 0===n?" ":lD(n);return s<=c||""==u?a:((o=pD(u,vD((i=s-c)/u.length))).length>i&&(o=_D(o,0,i)),e?a+o:o+a)}},yD={start:mD(!1),end:mD(!0)},gD=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Xe),SD=yD.end;la({target:"String",proto:!0,forced:gD},{padEnd:function(e){return SD(this,e,arguments.length>1?arguments[1]:void 0)}});var bD=eu;la({target:"Number",stat:!0,forced:Number.parseInt!=bD},{parseInt:bD});var ED=Dt,kD=Rl,TD=Qn,ID=Ut,AD=Oe,RD=function(e,t,r,n){try{return n?t(ED(r)[0],r[1]):t(r)}catch(RJ){kD(e,"throw",RJ)}},wD=dl,CD=Ri,OD=li,xD=Ad,ND=kl,DD=vl,PD=Array,MD=function(e){var t=AD(e),r=CD(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=TD(i,n>2?arguments[2]:void 0));var a,s,c,u,d,l,h=DD(t),f=0;if(!h||this===PD&&wD(h))for(a=OD(t),s=r?new this(a):PD(a);a>f;f++)l=o?i(t[f],f):t[f],xD(s,f,l);else for(d=(u=ND(t,h)).next,s=r?new this:[];!(c=ID(d,u)).done;f++)l=o?RD(u,i,[c.value,f],!0):c.value,xD(s,f,l);return s.length=f,s},UD=MD;la({target:"Array",stat:!0,forced:!Yl((function(e){Array.from(e)}))},{from:UD});var LD=Math.log,VD=Math.LOG10E;la({target:"Math",stat:!0},{log10:Math.log10||function(e){return LD(e)*VD}});var FD,BD=la,jD=Xn,GD=eo.f,HD=ui,zD=$a,KD=Ja,WD=Re,XD=ts,qD=jD("".startsWith),YD=jD("".slice),JD=Math.min,QD=XD("startsWith"),ZD=!QD&&!!function(){var e=GD(String.prototype,"startsWith");return e&&!e.writable}();BD({target:"String",proto:!0,forced:!ZD&&!QD},{startsWith:function(e){var t=zD(WD(this));KD(e);var r=HD(JD(arguments.length>1?arguments[1]:void 0,t.length)),n=zD(e);return qD?qD(t,n,r):YD(t,r,r+n.length)===n}});var $D=new Uint8Array(16);function eP(){if(!FD&&!(FD="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return FD($D)}var tP=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function rP(e){return"string"==typeof e&&tP.test(e)}for(var nP=[],iP=0;iP<256;++iP)nP.push((iP+256).toString(16).substr(1));function oP(e,t,r){var n=(e=e||{}).random||(e.rng||eP)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(nP[e[t+0]]+nP[e[t+1]]+nP[e[t+2]]+nP[e[t+3]]+"-"+nP[e[t+4]]+nP[e[t+5]]+"-"+nP[e[t+6]]+nP[e[t+7]]+"-"+nP[e[t+8]]+nP[e[t+9]]+"-"+nP[e[t+10]]+nP[e[t+11]]+nP[e[t+12]]+nP[e[t+13]]+nP[e[t+14]]+nP[e[t+15]]).toLowerCase();if(!rP(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var aP=new TextDecoder,sP=new TextEncoder,cP=function(){return oP()},uP=function(){return Date.now()};function dP(e){for(var t=0,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,a=n;o<a.length;o++){var s=a[o];t+=s.length}for(var c=new e(t),u=0,d=0,l=n;d<l.length;d++){var h=l[d];c.set(h,u),u+=h.length}return c}var lP=function(){return"undefined"==typeof window},hP=function(){function e(){u(this,e)}var t,r;return l(e,null,[{key:"token2auth",value:function(t,r,n,i){return i?"Bearer ".concat(i):"Basic ".concat(e.createUnsafeToken(t,r,n))}},{key:"createUnsafeToken",value:function(e,t,r){return window.btoa([e,t,r].filter((function(e){return null!==e})).join(":"))}},{key:"merge",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=0,i=Object.entries(t);n<i.length;n++){var o=E(i[n],2),s=o[0],c=o[1];null!==c&&"object"===a(c)?e.merge(t[s],r[s]):void 0!==r[s]&&(t[s]=r[s])}}},{key:"ab2str",value:function(e){return aP.decode(e)}},{key:"ab2obj",value:function(t){try{var r=e.ab2str(t);return JSON.parse(r)}catch(n){return{}}}},{key:"str2ab",value:function(e){return sP.encode(e).buffer}},{key:"ab2b64str",value:(r=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e){var r=new FileReader;r.onload=function(){return e(r.result)},r.readAsDataURL(new Blob([t]))}));case 2:return r=e.sent,e.abrupt("return",r.split(",",2)[1]);case 4:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"b64str2ab",value:(t=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",fetch("data:application/octet;base64,"+t).then((function(e){return e.arrayBuffer()})));case 1:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),e}();function fP(e){return new Promise((function(t){window.setTimeout(t,e)}))}function pP(){var e="none";return lP()||(null!==window.navigator.userAgent.match("Firefox")?e="mozilla":null!==window.navigator.userAgent.match("Chrome")?(e="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(e="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(e="safari")),e}var _P="mozilla"===pP(),vP="safari"===pP(),mP=!lP()&&navigator.userAgent.toLowerCase().includes("mobile");function yP(){for(var e=(+"".concat(Math.random()).slice(-7).padEnd(7,"0")).toString(2).padEnd(28,"1").split(""),t=[];e.length;)t.push(e.splice(0,7));return t.map((function(e,r){var n=r===t.length-1?"0":"1";return Number.parseInt(n+e.join(""),2)}))}var gP=function(){return Math.floor(65535*Math.random())};function SP(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function bP(e){return e.map((function e(t){if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var r=ArrayBuffer.isView(t)?t.buffer:t,n=r.byteLength,i=[];if(n>10){var o=new DataView(r),a=Array.from({length:5}).map((function(e,t){return o.getUint8(t)})),s=Array.from({length:5}).map((function(e,t){return n-1-t})).reverse().map((function(e){return o.getUint8(e)}));i=[].concat(k(a),["..."],k(s))}else i=Array.from(new Uint8Array(r));return"".concat(t.constructor.name,"(").concat(n,") [").concat(i.join(", "),"]")}if(t instanceof ImageData)return"ImageData";if(Array.isArray(t))return t.map(e);if("[object Object]"===Object.prototype.toString.call(t)){var c={};for(var u in t)c[u]=e(t[u]);return c}return t}))}var EP=function(){var e=c(o().mark((function e(){var t,r,n,i=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]&&i[0],e.prev=1,(r=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),r.addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),t&&(r.addTransceiver("audio",{direction:"sendonly"}),r.addTransceiver("video",{direction:"sendonly"})),e.next=9,r.createOffer();case 9:return n=e.sent,r.close(),e.abrupt("return",n.sdp);case 14:e.prev=14,e.t0=e.catch(1);case 16:case"end":return e.stop()}}),e,null,[[1,14]])})));return function(){return e.apply(this,arguments)}}(),kP=function(e){return new Promise((function(t,r){var n=(e=Array.isArray(e)?e:[]).length,i=[];0===n?r([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){n--,i.push(e),0===n&&r(i)}))}))}))};function TP(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function IP(e){return(e&L.AUDIO)===L.AUDIO}function AP(e){return(e&L.VIDEO)===L.VIDEO}function RP(e){var t={};return Object.keys(e).forEach((function(r){"object"===a(e[r])?t[r]=RP(e[r]):r.startsWith("_")||(t[r]=e[r])})),t}function wP(e){var t=new DataView(e.buffer);if(t.byteLength<=4||65535!==t.getUint16(0))return{seiCount:1,seis:[e]};for(var r={seiCount:0,seis:[]},n=!1,i=2;i<t.byteLength;){var o=t.getUint16(i);if(i+=2,t.byteLength-i<o){n=!0;break}var a=new Uint8Array(e.buffer,i,o);if(i+=o,t.byteLength-i>0&&t.byteLength-i<=2){n=!0;break}r.seiCount++,r.seis.push(a)}return n&&(r.seiCount=1,r.seis=[e]),r}function CP(e,t){if("boolean"!=typeof e)throw new JN(qN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function OP(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(e<r||e>n||"number"!=typeof e){var i=new JN(qN.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"));throw i}}function xP(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(null==e)throw new JN(qN.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!UP(e,r,n))throw new JN(qN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(n,"]"))}function NP(e,t,r){if(!r.includes(e))throw new JN(qN.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function DP(e,t){if(LP(e))throw new JN(qN.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function PP(e,t){if(!(e instanceof ArrayBuffer))throw new JN(qN.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function MP(e){try{for(var t=navigator.mediaDevices.getSupportedConstraints(),r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];t[i]||delete e[i]}}catch(o){}}function UP(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.POSITIVE_INFINITY;return"string"==typeof e&&e.length<=r&&e.length>=t}function LP(e){return null==e}function VP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new JN(qN.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function FP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new JN(qN.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function BP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new JN(qN.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function jP(e){DP(e,"userInfo"),FP(e.userId),LP(e.extraInfo)||xP(e.extraInfo,"userInfo.extraInfo",1,200)}function GP(e){DP(e,"roomConfig"),CP(e.isAutoPublish,"roomConfig.isAutoPublish"),CP(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),CP(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}function HP(e){DP(e,"videoPlayerOption")}function zP(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64;if(!e||0===(null==e?void 0:e.byteLength))throw new JN(qN.INVALID_PARAMS,"The message cannot be empty");if((null===(t=e instanceof ArrayBuffer?e:hP.str2ab(JSON.stringify(e)))||void 0===t?void 0:t.byteLength)>1e3*r)throw new JN(qN.INVALID_PARAMS,"The message length must be less than ".concat(r,"K"))}function KP(e){return![ne.onRemoteStreamStats,ne.onLocalStreamStats,ne.onAudioVolumeIndication,ne.onLocalAudioPropertiesReport,ne.onRemoteAudioPropertiesReport].includes(e)}function WP(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new JN(qN.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}var XP={},qP=_t;XP.f=qP;var YP=ae,JP=De,QP=XP,ZP=yt.f,$P=Ut,eM=We,tM=_t,rM=Rn,nM=la,iM=ae,oM=Ut,aM=ke,sM=gt,cM=nt,uM=me,dM=De,lM=Lt,hM=Dt,fM=so,pM=hr,_M=$a,vM=jr,mM=Ma,yM=_a,gM=yo,SM=Ed,bM=Lo,EM=eo,kM=yt,TM=ha,IM=to,AM=Rn,RM=se.exports,wM=Yr,CM=Ve,OM=_t,xM=XP,NM=function(e){var t=YP.Symbol||(YP.Symbol={});JP(t,e)||ZP(t,e,{value:QP.f(e)})},DM=function(){var e=eM("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=tM("toPrimitive");t&&!t[n]&&rM(t,n,(function(e){return $P(r,this)}),{arity:1})},PM=Au,MM=dn,UM=Gi.forEach,LM=qr("hidden"),VM="Symbol",FM=MM.set,BM=MM.getterFor(VM),jM=Object.prototype,GM=iM.Symbol,HM=GM&&GM.prototype,zM=iM.TypeError,KM=iM.QObject,WM=EM.f,XM=kM.f,qM=SM.f,YM=IM.f,JM=aM([].push),QM=RM("symbols"),ZM=RM("op-symbols"),$M=RM("wks"),eU=!KM||!KM.prototype||!KM.prototype.findChild,tU=sM&&uM((function(){return 7!=mM(XM({},"a",{get:function(){return XM(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=WM(jM,t);n&&delete jM[t],XM(e,t,r),n&&e!==jM&&XM(jM,t,n)}:XM,rU=function(e,t){var r=QM[e]=mM(HM);return FM(r,{type:VM,tag:e,description:t}),sM||(r.description=t),r},nU=function(e,t,r){e===jM&&nU(ZM,t,r),hM(e);var n=pM(t);return hM(r),dM(QM,n)?(r.enumerable?(dM(e,LM)&&e[LM][n]&&(e[LM][n]=!1),r=mM(r,{enumerable:vM(0,!1)})):(dM(e,LM)||XM(e,LM,vM(1,{})),e[LM][n]=!0),tU(e,n,r)):XM(e,n,r)},iU=function(e,t){hM(e);var r=fM(t),n=yM(r).concat(cU(r));return UM(n,(function(t){sM&&!oM(oU,r,t)||nU(e,t,r[t])})),e},oU=function(e){var t=pM(e),r=oM(YM,this,t);return!(this===jM&&dM(QM,t)&&!dM(ZM,t))&&(!(r||!dM(this,t)||!dM(QM,t)||dM(this,LM)&&this[LM][t])||r)},aU=function(e,t){var r=fM(e),n=pM(t);if(r!==jM||!dM(QM,n)||dM(ZM,n)){var i=WM(r,n);return!i||!dM(QM,n)||dM(r,LM)&&r[LM][n]||(i.enumerable=!0),i}},sU=function(e){var t=qM(fM(e)),r=[];return UM(t,(function(e){dM(QM,e)||dM(wM,e)||JM(r,e)})),r},cU=function(e){var t=e===jM,r=qM(t?ZM:fM(e)),n=[];return UM(r,(function(e){!dM(QM,e)||t&&!dM(jM,e)||JM(n,QM[e])})),n};cM||(GM=function(){if(lM(HM,this))throw zM("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?_M(arguments[0]):void 0,t=CM(e),r=function(e){this===jM&&oM(r,ZM,e),dM(this,LM)&&dM(this[LM],t)&&(this[LM][t]=!1),tU(this,t,vM(1,e))};return sM&&eU&&tU(jM,t,{configurable:!0,set:r}),rU(t,e)},AM(HM=GM.prototype,"toString",(function(){return BM(this).tag})),AM(GM,"withoutSetter",(function(e){return rU(CM(e),e)})),IM.f=oU,kM.f=nU,TM.f=iU,EM.f=aU,gM.f=SM.f=sU,bM.f=cU,xM.f=function(e){return rU(OM(e),e)},sM&&(XM(HM,"description",{configurable:!0,get:function(){return BM(this).description}}),AM(jM,"propertyIsEnumerable",oU,{unsafe:!0}))),nM({global:!0,constructor:!0,wrap:!0,forced:!cM,sham:!cM},{Symbol:GM}),UM(yM($M),(function(e){NM(e)})),nM({target:VM,stat:!0,forced:!cM},{useSetter:function(){eU=!0},useSimple:function(){eU=!1}}),nM({target:"Object",stat:!0,forced:!cM,sham:!sM},{create:function(e,t){return void 0===t?mM(e):iU(mM(e),t)},defineProperty:nU,defineProperties:iU,getOwnPropertyDescriptor:aU}),nM({target:"Object",stat:!0,forced:!cM},{getOwnPropertyNames:sU}),DM(),PM(GM,VM),wM[LM]=!0;var uU=nt&&!!Symbol.for&&!!Symbol.keyFor,dU=la,lU=We,hU=De,fU=$a,pU=se.exports,_U=uU,vU=pU("string-to-symbol-registry"),mU=pU("symbol-to-string-registry");dU({target:"Symbol",stat:!0,forced:!_U},{for:function(e){var t=fU(e);if(hU(vU,t))return vU[t];var r=lU("Symbol")(t);return vU[t]=r,mU[r]=t,r}});var yU=la,gU=De,SU=Gt,bU=zt,EU=uU,kU=(0,se.exports)("symbol-to-string-registry");yU({target:"Symbol",stat:!0,forced:!EU},{keyFor:function(e){if(!SU(e))throw TypeError(bU(e)+" is not a symbol");if(gU(kU,e))return kU[e]}});var TU=Lo,IU=Oe;la({target:"Object",stat:!0,forced:!nt||me((function(){TU.f(1)}))},{getOwnPropertySymbols:function(e){var t=TU.f;return t?t(IU(e)):[]}});var AU={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,o||e,a),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);i<o;i++)a[i]=n[i].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,i,o,a){var s=r?r+e:e;if(!this._events[s])return!1;var c,u,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,i),!0;case 5:return d.fn.call(d.context,t,n,i,o),!0;case 6:return d.fn.call(d.context,t,n,i,o,a),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,f=d.length;for(u=0;u<f;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,n);break;case 4:d[u].fn.call(d[u].context,t,n,i);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},s.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||i&&!s[c].once||n&&s[c].context!==n)&&u.push(s[c]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(AU);var RU=AU.exports,wU="[VERTC]",CU=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],OU=!lP()&&window.location.search.includes("_rtc_debug_"),xU=function(){function e(t,r,n){u(this,e),h(this,"_indent",void 0),h(this,"_module",void 0),h(this,"_id",void 0),this._module=t,this._indent=r}return l(e,[{key:"print",value:function(e){var t;if(OU){for(var r="",n=0;n<this._indent;n++)r+=" ";for(var i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];(t=console).log.apply(t,["%c".concat(wU).concat(r,"[").concat(this._module,".").concat(e,"] ").concat(o.shift()),"color:".concat(CU[this._indent],";")].concat(o))}}}]),e}(),NU=new xU("VERTC",0),DU=function(e){f(n,e);var t,r=g(n);function n(){return u(this,n),r.apply(this,arguments)}return l(n,[{key:"safeEmit",value:function(e){var t=this.listenerCount(e);try{for(var r,i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return(r=b(p(n.prototype),"emit",this)).call.apply(r,[this,e].concat(o))}catch(RJ){return NU.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",e,RJ),Boolean(t)}}},{key:"safeEmitAsPromise",value:(t=c(o().mark((function e(t){var r,n,i,a=this,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=s.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=s[i];return e.abrupt("return",new Promise((function(e,r){try{a.emit.apply(a,[t].concat(n,[e,r]))}catch(RJ){NU.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",t,RJ),r(RJ)}})));case 2:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),n}(AU.exports.EventEmitter),PU=De,MU=function(e){return void 0!==e&&(PU(e,"value")||PU(e,"writable"))},UU=Ut,LU=Et,VU=Dt,FU=MU,BU=eo,jU=fu;la({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return VU(t)===o?t[r]:(n=BU.f(t,r))?FU(n)?n.value:void 0===n.get?void 0:UU(n.get,o):LU(i=jU(t))?e(i,r,o):void 0}});var GU=ae,HU=Au;la({global:!0},{Reflect:{}}),HU(GU.Reflect,"Reflect",!0);var zU=la,KU=Ut,WU=Dt,XU=Et,qU=MU,YU=yt,JU=eo,QU=fu,ZU=jr;var $U=me((function(){var e=function(){},t=YU.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));zU({target:"Reflect",stat:!0,forced:$U},{set:function e(t,r,n){var i,o,a,s=arguments.length<4?t:arguments[3],c=JU.f(WU(t),r);if(!c){if(XU(o=QU(t)))return e(o,r,n,s);c=ZU(0)}if(qU(c)){if(!1===c.writable||!XU(s))return!1;if(i=JU.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,YU.f(s,r,i)}else YU.f(s,r,ZU(0,n))}else{if(void 0===(a=c.set))return!1;KU(a,s,n)}return!0}});var eL=la,tL=Oe,rL=li,nL=Lp,iL=V_,oL=Fp,aL=1!==[].unshift(0),sL=!function(){try{Object.defineProperty([],"length",{writable:!1}).unshift()}catch(RJ){return RJ instanceof TypeError}}();eL({target:"Array",proto:!0,arity:1,forced:aL||sL},{unshift:function(e){var t=tL(this),r=rL(t),n=arguments.length;if(n){oL(r+n);for(var i=r;i--;){var o=i+n;i in t?t[o]=t[i]:iL(t,o)}for(var a=0;a<n;a++)t[a]=arguments[a]}return nL(t,r+n)}}),(0,aA.exports)("Uint16",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,aA.exports)("Int32",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var cL={};!function(e){var t="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!==a(n))throw new TypeError(n+"must be non-object");for(var i in n)r(n,i)&&(e[i]=n[i])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){var t,r,n,i,o,a;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(a=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,i),i+=o.length;return a}},i={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){return[].concat.apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,n)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,i))},e.setTyped(t)}(cL);var uL={},dL={},lL={},hL=cL;function fL(e){for(var t=e.length;--t>=0;)e[t]=0}var pL=256,_L=286,vL=30,mL=15,yL=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],gL=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],SL=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],bL=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],EL=new Array(576);fL(EL);var kL=new Array(60);fL(kL);var TL=new Array(512);fL(TL);var IL=new Array(256);fL(IL);var AL=new Array(29);fL(AL);var RL,wL,CL,OL=new Array(vL);function xL(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function NL(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function DL(e){return e<256?TL[e]:TL[256+(e>>>7)]}function PL(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function ML(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,PL(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function UL(e,t,r){ML(e,r[2*t],r[2*t+1])}function LL(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function VL(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=mL;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=LL(o[s]++,s))}}function FL(e){var t;for(t=0;t<_L;t++)e.dyn_ltree[2*t]=0;for(t=0;t<vL;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function BL(e){e.bi_valid>8?PL(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function jL(e,t,r,n){var i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]}function GL(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&jL(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!jL(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function HL(e,t,r){var n,i,o,a,s=0;if(0!==e.last_lit)do{n=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],i=e.pending_buf[e.l_buf+s],s++,0===n?UL(e,i,t):(UL(e,(o=IL[i])+pL+1,t),0!==(a=yL[o])&&ML(e,i-=AL[o],a),UL(e,o=DL(--n),r),0!==(a=gL[o])&&ML(e,n-=OL[o],a))}while(s<e.last_lit);UL(e,256,t)}function zL(e,t){var r,n,i,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,c=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<c;r++)0!==o[2*r]?(e.heap[++e.heap_len]=u=r,e.depth[r]=0):o[2*r+1]=0;for(;e.heap_len<2;)o[2*(i=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=a[2*i+1]);for(t.max_code=u,r=e.heap_len>>1;r>=1;r--)GL(e,o,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],GL(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,GL(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,o,a,s,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,p=t.stat_desc.max_length,_=0;for(o=0;o<=mL;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(o=c[2*c[2*(n=e.heap[r])+1]+1]+1)>p&&(o=p,_++),c[2*n+1]=o,n>u||(e.bl_count[o]++,a=0,n>=f&&(a=h[n-f]),s=c[2*n],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*n+1]+a)));if(0!==_){do{for(o=p-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[p]--,_-=2}while(_>0);for(o=p;0!==o;o--)for(n=e.bl_count[o];0!==n;)(i=e.heap[--r])>u||(c[2*i+1]!==o&&(e.opt_len+=(o-c[2*i+1])*c[2*i],c[2*i+1]=o),n--)}}(e,t),VL(o,u,e.bl_count)}function KL(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<c&&i===a||(s<u?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4))}function WL(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<c&&i===a)){if(s<u)do{UL(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(UL(e,i,e.bl_tree),s--),UL(e,16,e.bl_tree),ML(e,s-3,2)):s<=10?(UL(e,17,e.bl_tree),ML(e,s-3,3)):(UL(e,18,e.bl_tree),ML(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}}fL(OL);var XL=!1;function qL(e,t,r,n){ML(e,0+(n?1:0),3),function(e,t,r,n){BL(e),n&&(PL(e,r),PL(e,~r)),hL.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}lL._tr_init=function(e){XL||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(AL[n]=r,e=0;e<1<<yL[n];e++)IL[r++]=n;for(IL[r-1]=n,i=0,n=0;n<16;n++)for(OL[n]=i,e=0;e<1<<gL[n];e++)TL[i++]=n;for(i>>=7;n<vL;n++)for(OL[n]=i<<7,e=0;e<1<<gL[n]-7;e++)TL[256+i++]=n;for(t=0;t<=mL;t++)o[t]=0;for(e=0;e<=143;)EL[2*e+1]=8,e++,o[8]++;for(;e<=255;)EL[2*e+1]=9,e++,o[9]++;for(;e<=279;)EL[2*e+1]=7,e++,o[7]++;for(;e<=287;)EL[2*e+1]=8,e++,o[8]++;for(VL(EL,287,o),e=0;e<vL;e++)kL[2*e+1]=5,kL[2*e]=LL(e,5);RL=new xL(EL,yL,257,_L,mL),wL=new xL(kL,gL,0,vL,mL),CL=new xL(new Array(0),SL,0,19,7)}(),XL=!0),e.l_desc=new NL(e.dyn_ltree,RL),e.d_desc=new NL(e.dyn_dtree,wL),e.bl_desc=new NL(e.bl_tree,CL),e.bi_buf=0,e.bi_valid=0,FL(e)},lL._tr_stored_block=qL,lL._tr_flush_block=function(e,t,r,n){var i,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<pL;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),zL(e,e.l_desc),zL(e,e.d_desc),a=function(e){var t;for(KL(e,e.dyn_ltree,e.l_desc.max_code),KL(e,e.dyn_dtree,e.d_desc.max_code),zL(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*bL[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?qL(e,t,r,n):4===e.strategy||o===i?(ML(e,2+(n?1:0),3),HL(e,EL,kL)):(ML(e,4+(n?1:0),3),function(e,t,r,n){var i;for(ML(e,t-257,5),ML(e,r-1,5),ML(e,n-4,4),i=0;i<n;i++)ML(e,e.bl_tree[2*bL[i]+1],3);WL(e,e.dyn_ltree,t-1),WL(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),HL(e,e.dyn_ltree,e.dyn_dtree)),FL(e),n&&BL(e)},lL._tr_tally=function(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(IL[r]+pL+1)]++,e.dyn_dtree[2*DL(t)]++),e.last_lit===e.lit_bufsize-1},lL._tr_align=function(e){ML(e,2,3),UL(e,256,EL),function(e){16===e.bi_valid?(PL(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)};var YL=function(e,t,r,n){for(var i=65535&e|0,o=e>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+t[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0};var JL=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var QL,ZL=function(e,t,r,n){var i=JL,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},$L={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},eV=cL,tV=lL,rV=YL,nV=ZL,iV=$L,oV=-2,aV=258,sV=262,cV=103,uV=113,dV=666;function lV(e,t){return e.msg=iV[t],t}function hV(e){return(e<<1)-(e>4?9:0)}function fV(e){for(var t=e.length;--t>=0;)e[t]=0}function pV(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(eV.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function _V(e,t){tV._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,pV(e.strm)}function vV(e,t){e.pending_buf[e.pending++]=t}function mV(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function yV(e,t){var r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-sV?e.strstart-(e.w_size-sV):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+aV,f=u[o+a-1],p=u[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(r=t)+a]===p&&u[r+a-1]===f&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<h);if(n=aV-(h-o),o=h-aV,n>a){if(e.match_start=t,a=n,n>=s)break;f=u[o+a-1],p=u[o+a]}}}while((t=l[t&d])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead}function gV(e){var t,r,n,i,o,a,s,c,u,d,l=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-sV)){eV.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=r=e.hash_size;do{n=e.head[--t],e.head[t]=n>=l?n-l:0}while(--r);t=r=l;do{n=e.prev[--t],e.prev[t]=n>=l?n-l:0}while(--r);i+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,c=e.strstart+e.lookahead,u=i,d=void 0,(d=a.avail_in)>u&&(d=u),r=0===d?0:(a.avail_in-=d,eV.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=rV(a.adler,s,d,c):2===a.state.wrap&&(a.adler=nV(a.adler,s,d,c)),a.next_in+=d,a.total_in+=d,d),e.lookahead+=r,e.lookahead+e.insert>=3)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+3-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<sV&&0!==e.strm.avail_in)}function SV(e,t){for(var r,n;;){if(e.lookahead<sV){if(gV(e),e.lookahead<sV&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-sV&&(e.match_length=yV(e,r)),e.match_length>=3)if(n=tV._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=tV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(_V(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(_V(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(_V(e,!1),0===e.strm.avail_out)?1:2}function bV(e,t){for(var r,n,i;;){if(e.lookahead<sV){if(gV(e),e.lookahead<sV&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-sV&&(e.match_length=yV(e,r),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,n=tV._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(_V(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=tV._tr_tally(e,0,e.window[e.strstart-1]))&&_V(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=tV._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(_V(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(_V(e,!1),0===e.strm.avail_out)?1:2}function EV(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function kV(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new eV.Buf16(1146),this.dyn_dtree=new eV.Buf16(122),this.bl_tree=new eV.Buf16(78),fV(this.dyn_ltree),fV(this.dyn_dtree),fV(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new eV.Buf16(16),this.heap=new eV.Buf16(573),fV(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new eV.Buf16(573),fV(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function TV(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:uV,e.adler=2===t.wrap?0:1,t.last_flush=0,tV._tr_init(t),0):lV(e,oV)}function IV(e){var t,r=TV(e);return 0===r&&((t=e.state).window_size=2*t.w_size,fV(t.head),t.max_lazy_match=QL[t.level].max_lazy,t.good_match=QL[t.level].good_length,t.nice_match=QL[t.level].nice_length,t.max_chain_length=QL[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),r}function AV(e,t,r,n,i,o){if(!e)return oV;var a=1;if(-1===t&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>9||8!==r||n<8||n>15||t<0||t>9||o<0||o>4)return lV(e,oV);8===n&&(n=9);var s=new kV;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new eV.Buf8(2*s.w_size),s.head=new eV.Buf16(s.hash_size),s.prev=new eV.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new eV.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=o,s.method=r,IV(e)}QL=[new EV(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(gV(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,_V(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-sV&&(_V(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(_V(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(_V(e,!1),e.strm.avail_out),1)})),new EV(4,4,8,4,SV),new EV(4,5,16,8,SV),new EV(4,6,32,32,SV),new EV(4,4,16,16,bV),new EV(8,16,32,32,bV),new EV(8,16,128,128,bV),new EV(8,32,128,256,bV),new EV(32,128,258,1024,bV),new EV(32,258,258,4096,bV)],dL.deflateInit=function(e,t){return AV(e,t,8,15,8,0)},dL.deflateInit2=AV,dL.deflateReset=IV,dL.deflateResetKeep=TV,dL.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?oV:(e.state.gzhead=t,0):oV},dL.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?lV(e,oV):oV;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===dV&&4!==t)return lV(e,0===e.avail_out?-5:oV);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,vV(n,31),vV(n,139),vV(n,8),n.gzhead?(vV(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),vV(n,255&n.gzhead.time),vV(n,n.gzhead.time>>8&255),vV(n,n.gzhead.time>>16&255),vV(n,n.gzhead.time>>24&255),vV(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),vV(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(vV(n,255&n.gzhead.extra.length),vV(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=nV(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(vV(n,0),vV(n,0),vV(n,0),vV(n,0),vV(n,0),vV(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),vV(n,3),n.status=uV);else{var a=8+(n.w_bits-8<<4)<<8;a|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=uV,mV(n,a),0!==n.strstart&&(mV(n,e.adler>>>16),mV(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=nV(e.adler,n.pending_buf,n.pending-i,i)),pV(e),i=n.pending,n.pending!==n.pending_buf_size));)vV(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=nV(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=nV(e.adler,n.pending_buf,n.pending-i,i)),pV(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,vV(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=nV(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=nV(e.adler,n.pending_buf,n.pending-i,i)),pV(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,vV(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=nV(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=cV)}else n.status=cV;if(n.status===cV&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&pV(e),n.pending+2<=n.pending_buf_size&&(vV(n,255&e.adler),vV(n,e.adler>>8&255),e.adler=0,n.status=uV)):n.status=uV),0!==n.pending){if(pV(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&hV(t)<=hV(r)&&4!==t)return lV(e,-5);if(n.status===dV&&0!==e.avail_in)return lV(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==dV){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(gV(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=tV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(_V(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(_V(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(_V(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,a=e.window;;){if(e.lookahead<=aV){if(gV(e),e.lookahead<=aV&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=a[i=e.strstart-1])===a[++i]&&n===a[++i]&&n===a[++i]){o=e.strstart+aV;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=aV-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=tV._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=tV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(_V(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(_V(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(_V(e,!1),0===e.strm.avail_out)?1:2}(n,t):QL[n.level].func(n,t);if(3!==s&&4!==s||(n.status=dV),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?tV._tr_align(n):5!==t&&(tV._tr_stored_block(n,0,0,!1),3===t&&(fV(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),pV(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(vV(n,255&e.adler),vV(n,e.adler>>8&255),vV(n,e.adler>>16&255),vV(n,e.adler>>24&255),vV(n,255&e.total_in),vV(n,e.total_in>>8&255),vV(n,e.total_in>>16&255),vV(n,e.total_in>>24&255)):(mV(n,e.adler>>>16),mV(n,65535&e.adler)),pV(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},dL.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==cV&&t!==uV&&t!==dV?lV(e,oV):(e.state=null,t===uV?lV(e,-3):0):oV},dL.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,c,u,d=t.length;if(!e||!e.state)return oV;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return oV;for(1===o&&(e.adler=rV(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(fV(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new eV.Buf8(r.w_size),eV.arraySet(u,t,d-r.w_size,r.w_size,0),t=u,d=r.w_size),a=e.avail_in,s=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,gV(r);r.lookahead>=3;){n=r.strstart,i=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++}while(--i);r.strstart=n,r.lookahead=2,gV(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=s,e.input=c,e.avail_in=a,r.wrap=o,0},dL.deflateInfo="pako deflate (from Nodeca project)";var RV={},wV=cL,CV=!0,OV=!0;try{String.fromCharCode.apply(null,[0])}catch(wJ){CV=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(wJ){OV=!1}for(var xV=new wV.Buf8(256),NV=0;NV<256;NV++)xV[NV]=NV>=252?6:NV>=248?5:NV>=240?4:NV>=224?3:NV>=192?2:1;function DV(e,t){if(t<65534&&(e.subarray&&OV||!e.subarray&&CV))return String.fromCharCode.apply(null,wV.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}xV[254]=xV[254]=1,RV.string2buf=function(e){var t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new wV.Buf8(s),o=0,i=0;o<s;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},RV.buf2binstring=function(e){return DV(e,e.length)},RV.binstring2buf=function(e){for(var t=new wV.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},RV.buf2string=function(e,t){var r,n,i,o,a=t||e.length,s=new Array(2*a);for(n=0,r=0;r<a;)if((i=e[r++])<128)s[n++]=i;else if((o=xV[i])>4)s[n++]=65533,r+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&r<a;)i=i<<6|63&e[r++],o--;o>1?s[n++]=65533:i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|1023&i)}return DV(s,n)},RV.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+xV[e[r]]>t?r:t};var PV=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},MV=dL,UV=cL,LV=RV,VV=$L,FV=PV,BV=Object.prototype.toString;function jV(e){if(!(this instanceof jV))return new jV(e);this.options=UV.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new FV,this.strm.avail_out=0;var r=MV.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(VV[r]);if(t.header&&MV.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?LV.string2buf(t.dictionary):"[object ArrayBuffer]"===BV.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=MV.deflateSetDictionary(this.strm,n)))throw new Error(VV[r]);this._dict_set=!0}}function GV(e,t){var r=new jV(t);if(r.push(e,!0),r.err)throw r.msg||VV[r.err];return r.result}jV.prototype.push=function(e,t){var r,n,i=this.strm,o=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:!0===t?4:0,"string"==typeof e?i.input=LV.string2buf(e):"[object ArrayBuffer]"===BV.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new UV.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=MV.deflate(i,n))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==i.avail_out&&(0!==i.avail_in||4!==n&&2!==n)||("string"===this.options.to?this.onData(LV.buf2binstring(UV.shrinkBuf(i.output,i.next_out))):this.onData(UV.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=MV.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},jV.prototype.onData=function(e){this.chunks.push(e)},jV.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=UV.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},uL.Deflate=jV,uL.deflate=GV,uL.deflateRaw=function(e,t){return(t=t||{}).raw=!0,GV(e,t)},uL.gzip=function(e,t){return(t=t||{}).gzip=!0,GV(e,t)};var HV={},zV=gt,KV=fg,WV=us,XV=me,qV=ae.RegExp,YV=qV.prototype,JV=zV&&XV((function(){var e=!0;try{qV(".","d")}catch(RJ){e=!1}var t={},r="",n=e?"dgimsy":"gimsy",i=function(e,n){Object.defineProperty(t,e,{get:function(){return r+=n,!0}})},o={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var a in e&&(o.hasIndices="d"),o)i(a,o[a]);return Object.getOwnPropertyDescriptor(YV,"flags").get.call(t)!==n||r!==n}));JV&&KV(YV,"flags",{configurable:!0,get:WV});var QV={},ZV=cL,$V=15,eF=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],tF=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],rF=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],nF=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],iF=cL,oF=YL,aF=ZL,sF=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,y,g,S,b,E,k,T,I,A;r=e.state,n=e.next_in,I=e.input,i=n+(e.avail_in-5),o=e.next_out,A=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=r.dmax,u=r.wsize,d=r.whave,l=r.wnext,h=r.window,f=r.hold,p=r.bits,_=r.lencode,v=r.distcode,m=(1<<r.lenbits)-1,y=(1<<r.distbits)-1;e:do{p<15&&(f+=I[n++]<<p,p+=8,f+=I[n++]<<p,p+=8),g=_[f&m];t:for(;;){if(f>>>=S=g>>>24,p-=S,0===(S=g>>>16&255))A[o++]=65535&g;else{if(!(16&S)){if(0==(64&S)){g=_[(65535&g)+(f&(1<<S)-1)];continue t}if(32&S){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}b=65535&g,(S&=15)&&(p<S&&(f+=I[n++]<<p,p+=8),b+=f&(1<<S)-1,f>>>=S,p-=S),p<15&&(f+=I[n++]<<p,p+=8,f+=I[n++]<<p,p+=8),g=v[f&y];r:for(;;){if(f>>>=S=g>>>24,p-=S,!(16&(S=g>>>16&255))){if(0==(64&S)){g=v[(65535&g)+(f&(1<<S)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(E=65535&g,p<(S&=15)&&(f+=I[n++]<<p,(p+=8)<S&&(f+=I[n++]<<p,p+=8)),(E+=f&(1<<S)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(f>>>=S,p-=S,E>(S=o-a)){if((S=E-S)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(k=0,T=h,0===l){if(k+=u-S,S<b){b-=S;do{A[o++]=h[k++]}while(--S);k=o-E,T=A}}else if(l<S){if(k+=u+l-S,(S-=l)<b){b-=S;do{A[o++]=h[k++]}while(--S);if(k=0,l<b){b-=S=l;do{A[o++]=h[k++]}while(--S);k=o-E,T=A}}}else if(k+=l-S,S<b){b-=S;do{A[o++]=h[k++]}while(--S);k=o-E,T=A}for(;b>2;)A[o++]=T[k++],A[o++]=T[k++],A[o++]=T[k++],b-=3;b&&(A[o++]=T[k++],b>1&&(A[o++]=T[k++]))}else{k=o-E;do{A[o++]=A[k++],A[o++]=A[k++],A[o++]=A[k++],b-=3}while(b>2);b&&(A[o++]=A[k++],b>1&&(A[o++]=A[k++]))}break}}break}}while(n<i&&o<s);n-=b=p>>3,f&=(1<<(p-=b<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=f,r.bits=p},cF=function(e,t,r,n,i,o,a,s){var c,u,d,l,h,f,p,_,v,m=s.bits,y=0,g=0,S=0,b=0,E=0,k=0,T=0,I=0,A=0,R=0,w=null,C=0,O=new ZV.Buf16(16),x=new ZV.Buf16(16),N=null,D=0;for(y=0;y<=$V;y++)O[y]=0;for(g=0;g<n;g++)O[t[r+g]]++;for(E=m,b=$V;b>=1&&0===O[b];b--);if(E>b&&(E=b),0===b)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(S=1;S<b&&0===O[S];S++);for(E<S&&(E=S),I=1,y=1;y<=$V;y++)if(I<<=1,(I-=O[y])<0)return-1;if(I>0&&(0===e||1!==b))return-1;for(x[1]=0,y=1;y<$V;y++)x[y+1]=x[y]+O[y];for(g=0;g<n;g++)0!==t[r+g]&&(a[x[t[r+g]]++]=g);if(0===e?(w=N=a,f=19):1===e?(w=eF,C-=257,N=tF,D-=257,f=256):(w=rF,N=nF,f=-1),R=0,g=0,y=S,h=o,k=E,T=0,d=-1,l=(A=1<<E)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){p=y-T,a[g]<f?(_=0,v=a[g]):a[g]>f?(_=N[D+a[g]],v=w[C+a[g]]):(_=96,v=0),c=1<<y-T,S=u=1<<k;do{i[h+(R>>T)+(u-=c)]=p<<24|_<<16|v|0}while(0!==u);for(c=1<<y-1;R&c;)c>>=1;if(0!==c?(R&=c-1,R+=c):R=0,g++,0==--O[y]){if(y===b)break;y=t[r+a[g]]}if(y>E&&(R&l)!==d){for(0===T&&(T=E),h+=S,I=1<<(k=y-T);k+T<b&&!((I-=O[k+T])<=0);)k++,I<<=1;if(A+=1<<k,1===e&&A>852||2===e&&A>592)return 1;i[d=R&l]=E<<24|k<<16|h-o|0}}return 0!==R&&(i[h+R]=y-T<<24|64<<16|0),s.bits=E,0},uF=-2,dF=12,lF=30;function hF(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function fF(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new iF.Buf16(320),this.work=new iF.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function pF(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new iF.Buf32(852),t.distcode=t.distdyn=new iF.Buf32(592),t.sane=1,t.back=-1,0):uF}function _F(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,pF(e)):uF}function vF(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?uF:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,_F(e))):uF}function mF(e,t){var r,n;return e?(n=new fF,e.state=n,n.window=null,0!==(r=vF(e,t))&&(e.state=null),r):uF}var yF,gF,SF=!0;function bF(e){if(SF){var t;for(yF=new iF.Buf32(512),gF=new iF.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(cF(1,e.lens,0,288,yF,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;cF(2,e.lens,0,32,gF,0,e.work,{bits:5}),SF=!1}e.lencode=yF,e.lenbits=9,e.distcode=gF,e.distbits=5}function EF(e,t,r,n){var i,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new iF.Buf8(o.wsize)),n>=o.wsize?(iF.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>n&&(i=n),iF.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(iF.arraySet(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0}QV.inflateReset=_F,QV.inflateReset2=vF,QV.inflateResetKeep=pF,QV.inflateInit=function(e){return mF(e,15)},QV.inflateInit2=mF,QV.inflate=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,y,g,S,b,E,k,T,I,A=0,R=new iF.Buf8(4),w=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return uF;(r=e.state).mode===dF&&(r.mode=13),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,l=s,h=c,k=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(2&r.wrap&&35615===u){r.check=0,R[0]=255&u,R[1]=u>>>8&255,r.check=aF(r.check,R,2,0),u=0,d=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=lF;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=lF;break}if(d-=4,E=8+(15&(u>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=lF;break}r.dmax=1<<E,e.adler=r.check=1,r.mode=512&u?10:dF,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.flags=u,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=lF;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=lF;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&(R[0]=255&u,R[1]=u>>>8&255,r.check=aF(r.check,R,2,0)),u=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.head&&(r.head.time=u),512&r.flags&&(R[0]=255&u,R[1]=u>>>8&255,R[2]=u>>>16&255,R[3]=u>>>24&255,r.check=aF(r.check,R,4,0)),u=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&(R[0]=255&u,R[1]=u>>>8&255,r.check=aF(r.check,R,2,0)),u=0,d=0,r.mode=5;case 5:if(1024&r.flags){for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&(R[0]=255&u,R[1]=u>>>8&255,r.check=aF(r.check,R,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((f=r.length)>s&&(f=s),f&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),iF.arraySet(r.head.extra,n,o,f,E)),512&r.flags&&(r.check=aF(r.check,n,f,o)),s-=f,o+=f,r.length-=f),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break e;f=0;do{E=n[o+f++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E))}while(E&&f<s);if(512&r.flags&&(r.check=aF(r.check,n,f,o)),s-=f,o+=f,E)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===s)break e;f=0;do{E=n[o+f++],r.head&&E&&r.length<65536&&(r.head.comment+=String.fromCharCode(E))}while(E&&f<s);if(512&r.flags&&(r.check=aF(r.check,n,f,o)),s-=f,o+=f,E)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=lF;break}u=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=dF;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}e.adler=r.check=hF(u),u=0,d=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,2;e.adler=r.check=1,r.mode=dF;case dF:if(5===t||6===t)break e;case 13:if(r.last){u>>>=7&d,d-=7&d,r.mode=27;break}for(;d<3;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}switch(r.last=1&u,d-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(bF(r),r.mode=20,6===t){u>>>=2,d-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=lF}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=lF;break}if(r.length=65535&u,u=0,d=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(f=r.length){if(f>s&&(f=s),f>c&&(f=c),0===f)break e;iF.arraySet(i,n,o,f,a),s-=f,o+=f,c-=f,a+=f,r.length-=f;break}r.mode=dF;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.nlen=257+(31&u),u>>>=5,d-=5,r.ndist=1+(31&u),u>>>=5,d-=5,r.ncode=4+(15&u),u>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=lF;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.lens[w[r.have++]]=7&u,u>>>=3,d-=3}for(;r.have<19;)r.lens[w[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,T={bits:r.lenbits},k=cF(0,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid code lengths set",r.mode=lF;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,y=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(y<16)u>>>=v,d-=v,r.lens[r.have++]=y;else{if(16===y){for(I=v+2;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u>>>=v,d-=v,0===r.have){e.msg="invalid bit length repeat",r.mode=lF;break}E=r.lens[r.have-1],f=3+(3&u),u>>>=2,d-=2}else if(17===y){for(I=v+3;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=v,E=0,f=3+(7&(u>>>=v)),u>>>=3,d-=3}else{for(I=v+7;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=v,E=0,f=11+(127&(u>>>=v)),u>>>=7,d-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=lF;break}for(;f--;)r.lens[r.have++]=E}}if(r.mode===lF)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=lF;break}if(r.lenbits=9,T={bits:r.lenbits},k=cF(1,r.lens,0,r.nlen,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid literal/lengths set",r.mode=lF;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},k=cF(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,T),r.distbits=T.bits,k){e.msg="invalid distances set",r.mode=lF;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,sF(e,h),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,r.mode===dF&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,y=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(g=v,S=m,b=y;m=(A=r.lencode[b+((u&(1<<g+S)-1)>>g)])>>>16&255,y=65535&A,!(g+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=g,d-=g,r.back+=g}if(u>>>=v,d-=v,r.back+=v,r.length=y,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=dF;break}if(64&m){e.msg="invalid literal/length code",r.mode=lF;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(I=r.extra;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(A=r.distcode[u&(1<<r.distbits)-1])>>>16&255,y=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(0==(240&m)){for(g=v,S=m,b=y;m=(A=r.distcode[b+((u&(1<<g+S)-1)>>g)])>>>16&255,y=65535&A,!(g+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=g,d-=g,r.back+=g}if(u>>>=v,d-=v,r.back+=v,64&m){e.msg="invalid distance code",r.mode=lF;break}r.offset=y,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(I=r.extra;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=lF;break}r.mode=25;case 25:if(0===c)break e;if(f=h-c,r.offset>f){if((f=r.offset-f)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=lF;break}f>r.wnext?(f-=r.wnext,p=r.wsize-f):p=r.wnext-f,f>r.length&&(f=r.length),_=r.window}else _=i,p=a-r.offset,f=r.length;f>c&&(f=c),c-=f,r.length-=f;do{i[a++]=_[p++]}while(--f);0===r.length&&(r.mode=21);break;case 26:if(0===c)break e;i[a++]=r.length,c--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,u|=n[o++]<<d,d+=8}if(h-=c,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=r.flags?aF(r.check,i,h,a-h):oF(r.check,i,h,a-h)),h=c,(r.flags?u:hF(u))!==r.check){e.msg="incorrect data check",r.mode=lF;break}u=0,d=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=lF;break}u=0,d=0}r.mode=29;case 29:k=1;break e;case lF:k=-3;break e;case 31:return-4;default:return uF}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,(r.wsize||h!==e.avail_out&&r.mode<lF&&(r.mode<27||4!==t))&&EF(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,r.total+=h,r.wrap&&h&&(e.adler=r.check=r.flags?aF(r.check,i,h,e.next_out-h):oF(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===dF?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===k&&(k=-5),k},QV.inflateEnd=function(e){if(!e||!e.state)return uF;var t=e.state;return t.window&&(t.window=null),e.state=null,0},QV.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?uF:(r.head=t,t.done=!1,0):uF},QV.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?uF:11===r.mode&&oF(1,t,n,0)!==r.check?-3:EF(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):uF},QV.inflateInfo="pako inflate (from Nodeca project)";var kF={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var TF=QV,IF=cL,AF=RV,RF=kF,wF=$L,CF=PV,OF=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},xF=Object.prototype.toString;function NF(e){if(!(this instanceof NF))return new NF(e);this.options=IF.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new CF,this.strm.avail_out=0;var r=TF.inflateInit2(this.strm,t.windowBits);if(r!==RF.Z_OK)throw new Error(wF[r]);if(this.header=new OF,TF.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=AF.string2buf(t.dictionary):"[object ArrayBuffer]"===xF.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=TF.inflateSetDictionary(this.strm,t.dictionary))!==RF.Z_OK))throw new Error(wF[r])}function DF(e,t){var r=new NF(t);if(r.push(e,!0),r.err)throw r.msg||wF[r.err];return r.result}NF.prototype.push=function(e,t){var r,n,i,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?RF.Z_FINISH:RF.Z_NO_FLUSH,"string"==typeof e?s.input=AF.binstring2buf(e):"[object ArrayBuffer]"===xF.call(e)?s.input=new Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new IF.Buf8(c),s.next_out=0,s.avail_out=c),(r=TF.inflate(s,RF.Z_NO_FLUSH))===RF.Z_NEED_DICT&&u&&(r=TF.inflateSetDictionary(this.strm,u)),r===RF.Z_BUF_ERROR&&!0===d&&(r=RF.Z_OK,d=!1),r!==RF.Z_STREAM_END&&r!==RF.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==RF.Z_STREAM_END&&(0!==s.avail_in||n!==RF.Z_FINISH&&n!==RF.Z_SYNC_FLUSH)||("string"===this.options.to?(i=AF.utf8border(s.output,s.next_out),o=s.next_out-i,a=AF.buf2string(s.output,i),s.next_out=o,s.avail_out=c-o,o&&IF.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(IF.shrinkBuf(s.output,s.next_out)))),0===s.avail_in&&0===s.avail_out&&(d=!0)}while((s.avail_in>0||0===s.avail_out)&&r!==RF.Z_STREAM_END);return r===RF.Z_STREAM_END&&(n=RF.Z_FINISH),n===RF.Z_FINISH?(r=TF.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===RF.Z_OK):n!==RF.Z_SYNC_FLUSH||(this.onEnd(RF.Z_OK),s.avail_out=0,!0)},NF.prototype.onData=function(e){this.chunks.push(e)},NF.prototype.onEnd=function(e){e===RF.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=IF.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},HV.Inflate=NF,HV.inflate=DF,HV.inflateRaw=function(e,t){return(t=t||{}).raw=!0,DF(e,t)},HV.ungzip=DF;var PF={};(0,cL.assign)(PF,uL,HV,kF);var MF=PF,UF=function(e){return e.RTC="rtc",e}(UF||{}),LF=function(e){return e.W_5="5",e}(LF||{}),VF=function(e){return e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux",e}(VF||{}),FF=function(e){return e.REQUEST="request",e.RESPONSE="response",e}(FF||{}),BF=function(e){return e.WEBSOCKET_RECONNECTING="websocket reconnecting",e.PEERCONNECTION_RECONNECTING="peerconnection reconnecting",e.DISCONNECTED="DISCONNECTED",e.LAN="LAN",e.WIFI="WIFI",e.W_2="2G",e.W_3="3G",e.W_4="4G",e.W_5="5G",e.UNKNOWN="UNKNOWN",e}(BF||{}),jF=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(jF||{}),GF=function(e){return e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected",e}(GF||{}),HF=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(HF||{}),zF=function(e){return e.REQUEST="request",e.RESPONSE="response",e.KCP_REQUEST="kcp request",e.KCP_RESPONSE="kcp response",e.QUIC_REQUEST="quic request",e.QUIC_RESPONSE="quic response",e}(zF||{}),KF=function(e){return e.NEW="NEW",e.CHECKING="CHECKING",e.CONNECTED="CONNECTED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.DISCONNECTED="DISCONNECTED",e.CLOSED="CLOSED",e.DATACHANNEL_CONNECTING="DATACHANNEL_CONNECTING",e.DATACHANNEL_OPEN="DATACHANNEL_OPEN",e.DATACHANNEL_CLOSING="DATACHANNEL_CLOSING",e.DATACHANNEL_CLOSED="DATACHANNEL_CLOSED",e}(KF||{}),WF=function(e){return e.SUCCEED="succeed",e.MESSAGE_ID_ERROR="message id error",e.ZIP_FAILED="zip failed",e.UNZIP_FAILED="unzip failed",e.MESSAGE_KEY_EMPTY="message key empty",e.MESSAGE_KEY_PARSE_FAILED="message key parse failed",e.MESSAGE_KEY_INVALID="message key invalid",e.ENCRYPT_FAILED="encrypt failed",e.DECRYPT_FAILED="decrypt failed",e.MESSAGE_TOO_BIG="message too big",e.INVALID_DATA="invalid data",e.MESSAGE_PARSE_FAILED="message parse failed",e}(WF||{}),XF=function(e){return e.UP="up",e.DOWN="down",e.DIRECT="direct",e}(XF||{}),qF=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(qF||{}),YF=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(YF||{}),JF=function(e){return e.W_0="0",e.W_1="1",e}(JF||{}),QF=function(e){return e.UP="up",e.DOWN="down",e}(QF||{}),ZF=function(e){return e.ANSWER="answer",e.INCRANSWER="incranswer",e}(ZF||{}),$F=function(e){return e.UP="up",e.DOWN="down",e}($F||{}),eB=function(e){return e.SUCCESS="success",e.FAIL="fail",e}(eB||{}),tB=function(e){return e.W_0="0",e.W_1="1",e}(tB||{}),rB=function(e){return e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.JOIN_ROOM_ACK_FAILED="join room ack failed",e.UNKNOWN="unknown",e}(rB||{}),nB=function(e){return e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore",e}(nB||{}),iB=function(e){return e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.ON_STREAM_REMOVE="on stream remove",e.PUBLISH_MUTE="publish mute",e.UNKNOWN="unknown",e.ON_STREAM_REMOVE_CLIENT_UNPUBLISHED="on stream remove:client unpublished",e.ON_STREAM_REMOVE_PUBLISH_FAILED="on stream remove:publish failed",e.ON_STREAM_REMOVE_STREAM_REMOVED="on stream remove:stream removed",e.ON_STREAM_REMOVE_CLIENT_DISCONNECTED="on stream remove:client disconnected",e.ON_STREAM_REMOVE_CLIENT_REPUBLISH="on stream remove:client republish",e}(iB||{}),oB=function(e){return e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown",e}(oB||{}),aB=function(e){return e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end",e}(aB||{}),sB=function(e){return e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio",e}(sB||{}),cB=function(e){return e.LOGIN="login",e.PUBLISHER="publisher",e.UNMUTE="unmute",e.ENABLE="enable",e.PUSH="push",e.PUBLISH="publish",e.ONDEMAND="ondemand",e.SUBSCRIBE="subscribe",e.PUSH_TRACK="push_track",e.REMOTE_UNMUTE="remote_unmute",e.P2P="p2p",e}(cB||{}),uB=function(e){return e.TIMEOUT="timeout",e.AUDIENCE="audience",e.MUTE="mute",e.DISABLE="disable",e.STOP_PUSH="stop_push",e.UNPUBLISH="unpublish",e.NO_DEMAND="no_demand",e.LEAVE_ROOM="leave_room",e.UNSUBSCRIBE="unsubscribe",e.REMOVE_TRACK="remove_track",e.REMOTE_MUTE="remote_mute",e.USER_LEAVE="user_leave",e}(uB||{}),dB=function(e){return e.BEGIN="begin",e.END="end",e}(dB||{}),lB=function(e){return e.BEGIN="begin",e.END="end",e}(lB||{}),hB=function(e){return e.LEAVE_ROOM="leave_room",e.ACK_FAILED="ack_failed",e.TOKEN_ERROR="token_error",e.SIGNALING_ERROR="signaling_error",e.TIMEOUT_10="timeout_10",e.TIMEOUT_60="timeout_60",e}(hB||{}),fB=function(e){return e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server",e}(fB||{}),pB=function(e){return e.START="start",e.START_CAPTURE_RESULT="start_capture_result",e.STARTED="started",e.RUNNING_FAILED="running_failed",e.STOP="stop",e.STOPPED="stopped",e}(pB||{}),_B=function(e){return e.SUCCESS="success",e.CAMERA_DEVICE_NO_PERMISSION="camera_device_no_permission",e.CAMERA_DEVICE_BUSY="camera_device_busy",e.CAMERA_DEVICE_FAILURE="camera_device_failure",e.CAMERA_DEVICE_NOT_FOUND="camera_device_not_found",e.CAMERA_DEVICE_DISCONNECTED="camera_device_disconnected",e.TIMEOUT="timeout",e.ABORT="abort",e}(_B||{}),vB=function(){function e(t){u(this,e),h(this,"_event_key",void 0),h(this,"_device_id",void 0),h(this,"_rtc_app_id",void 0),h(this,"_product_line",void 0),h(this,"_report_version",void 0),h(this,"_os",void 0),h(this,"_rtc_sdk_version",void 0),h(this,"_rtc_timestamp",void 0),h(this,"_rtc_sdk_git_commit",void 0),h(this,"_report_id",void 0),h(this,"_connection_id",void 0),h(this,"_rtc_sid",void 0),h(this,"_engine_session_id",void 0),h(this,"_rtc_business_id",void 0),h(this,"_project_key",void 0),h(this,"_network_type",void 0),h(this,"_app_version",void 0),h(this,"_aid",void 0),h(this,"_device_model",void 0),h(this,"_device_brand",void 0),h(this,"_common_extra_info",void 0),h(this,"_had_selected_p2p",void 0),h(this,"_rtc_env_type",void 0),h(this,"_room_id",void 0),h(this,"_user_id",void 0),h(this,"_rtc_session_id",void 0),h(this,"_user_agent",void 0),h(this,"_auto_play_policy",void 0),this.monitor=t}return l(e,[{key:"setStats",value:function(e){var t=this;Object.keys(e).forEach((function(r){t["_"+r]=e[r]})),this.monitor.StartUp()}},{key:"event_key",get:function(){return this._event_key}},{key:"device_id",get:function(){return this._device_id}},{key:"rtc_app_id",get:function(){return this._rtc_app_id}},{key:"product_line",get:function(){return this._product_line}},{key:"report_version",get:function(){return this._report_version}},{key:"os",get:function(){return this._os}},{key:"rtc_sdk_version",get:function(){return this._rtc_sdk_version}},{key:"rtc_timestamp",get:function(){return this._rtc_timestamp}},{key:"rtc_sdk_git_commit",get:function(){return this._rtc_sdk_git_commit}},{key:"report_id",get:function(){return this._report_id}},{key:"connection_id",get:function(){return this._connection_id}},{key:"rtc_sid",get:function(){return this._rtc_sid}},{key:"engine_session_id",get:function(){return this._engine_session_id}},{key:"rtc_business_id",get:function(){return this._rtc_business_id}},{key:"project_key",get:function(){return this._project_key}},{key:"network_type",get:function(){return this._network_type}},{key:"app_version",get:function(){return this._app_version}},{key:"aid",get:function(){return this._aid}},{key:"device_model",get:function(){return this._device_model}},{key:"device_brand",get:function(){return this._device_brand}},{key:"common_extra_info",get:function(){return this._common_extra_info}},{key:"had_selected_p2p",get:function(){return this._had_selected_p2p}},{key:"rtc_env_type",get:function(){return this._rtc_env_type}},{key:"room_id",get:function(){return this._room_id}},{key:"user_id",get:function(){return this._user_id}},{key:"rtc_session_id",get:function(){return this._rtc_session_id}},{key:"user_agent",get:function(){return this._user_agent}},{key:"auto_play_policy",get:function(){return this._auto_play_policy}}]),e}(),mB=function(e){f(r,e);var t=g(r);function r(){var e;return u(this,r),h(m(e=t.call(this)),"report_id",void 0),h(m(e),"report_common",void 0),h(m(e),"modify_ids",void 0),h(m(e),"dataBuffer",void 0),h(m(e),"posting",void 0),h(m(e),"sucSendTimer",void 0),h(m(e),"preSucTime",void 0),h(m(e),"errSendTimer",void 0),h(m(e),"errSendDelay",void 0),h(m(e),"commonStats",void 0),e.report_id=0,e.dataBuffer=[],e.posting=!1,e.report_common={},e.modify_ids={},e.preSucTime=0,e.errSendDelay=100,e.commonStats=new vB(m(e)),lP()||window.addEventListener("beforeunload",(function(){clearTimeout(e.errSendTimer),clearTimeout(e.sucSendTimer),e.send(null,!0)})),e}return l(r,[{key:"push",value:function(e,t){t?this.send(e):(this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this.send()))}},{key:"unshift",value:function(e){this.dataBuffer=e.concat(this.dataBuffer)}},{key:"send",value:function(e,t){var r=this;if(e||this.dataBuffer.length){var n={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},i=new XMLHttpRequest;i.timeout=1e4,i.onreadystatechange=function(){if(4===i.readyState){var o;if(e||(r.posting=!1),200===i.status||304===i.status)try{o=JSON.parse(i.responseText)}catch(RJ){}o&&0===o.StatusCode?e||t||r.sucSend():e?r.send(e):(r.unshift(n.data),t?r.send():r.errSend())}};var o=jB.LOG_SERVER_URL;if(i.open("POST",o,!0),e||(this.posting=!0),!lP()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",n),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!lP()&&location.search.includes("_rtc_debug_"))i.send(JSON.stringify(n));else{var a=MF.gzip(JSON.stringify(n));i.setRequestHeader("Content-Encoding","gzip"),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),i.send(a)}}}},{key:"sucSend",value:function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)}},{key:"errSend",value:function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2}},{key:"StartUp",value:function(){var e=this.report_common,t=this.commonStats,r=t.event_key,n=t.device_id,i=t.rtc_app_id,o=t.product_line,a=t.report_version,s=t.os,c=t.rtc_sdk_version,u=t.rtc_timestamp,d=t.rtc_sdk_git_commit,l=t.report_id,h=t.rtc_sid,f=t.engine_session_id,p=t.rtc_business_id,_=t.project_key,v=t.network_type,m=t.app_version,y=t.aid,g=t.device_model,S=t.device_brand,b=t.common_extra_info,E=t.had_selected_p2p,k=t.rtc_env_type,T=t.user_agent,I=t.auto_play_policy;Object.assign(e,{event_key:r,device_id:n,rtc_app_id:i,product_line:o,report_version:a,os:s,rtc_sdk_version:c,rtc_timestamp:u,rtc_sdk_git_commit:d,report_id:l,rtc_sid:h,engine_session_id:f,rtc_business_id:p,project_key:_,network_type:v,app_version:m,aid:y,device_model:g,device_brand:S,common_extra_info:b,had_selected_p2p:E,rtc_env_type:k,user_agent:T,auto_play_policy:I}),this.commonStats.room_id&&(this.modify_ids.room_id=this.commonStats.room_id),this.commonStats.user_id&&(this.modify_ids.user_id=this.commonStats.user_id),this.commonStats.rtc_session_id&&(this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id),this.commonStats.connection_id&&(this.modify_ids.connection_id=this.commonStats.connection_id)}},{key:"rtcSdkApiCall",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcSdkCallback",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcGetConfig",value:function(e,t,r,n,o,a,s){var c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},u=i(i({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,host:n,type:o,config_id:a,enable_cloud_proxy:s},this.modify_ids),{},{common_extra_info:JSON.stringify(c)});this.push(u)}},{key:"rtcReconnect",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:r,reconnect_type:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcReconnected",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcGetAccess",value:function(e,t,r,n,o,a){var s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},c=i(i({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,type:n,host:o,connect_session_id:a},this.modify_ids),{},{common_extra_info:JSON.stringify(s)});this.push(c)}},{key:"rtcPreIceState",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcNodeChange",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcSignalingMsgError",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcSignaling",value:function(e,t,r,n,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=i(i({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:r,signaling_type:n,direction:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{key:"rtcJoinRoom",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:r,elapse:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcLeaveRoom",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcBeginCreateOffer",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcCreateOffer",value:function(e,t,r,n,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=i(i({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:r,stream_user_id:n,elapse:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{key:"rtcSetDescription",value:function(e,t,r,n,o,a,s){var c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},u=i(i({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:r,direction:n,stream_id:o,stream_user_id:a,elapse:s},this.modify_ids),{},{common_extra_info:JSON.stringify(c)});this.push(u)}},{key:"rtcRecvAnswer",value:function(e,t,r,n,o,a,s){var c=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},u=i(i({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:r,message:n,direction:o,stream_id:a,stream_user_id:s},this.modify_ids),{},{common_extra_info:JSON.stringify(c)});this.push(u)}},{key:"firstRemoteAudioRender",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"first_remote_audio_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"firstRemoteVideoRender",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"first_remote_video_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcPublishStat",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:r,message:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcSubscribeStat",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:r,stream_user_id:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcAudioDevice",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcMediaStatistics",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcMessageStatistics",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now(),dc_user_message:e,dc_room_message:t,media_server_ip:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcError",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcInvokeStatus",value:function(e,t,r,n,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=i(i({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:r,stream_id:n,elapse:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{key:"rtcFirstFrame",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i(i(i({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:JSON.stringify(t)});this.push(r)}},{key:"rtcMuteRemote",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now(),mute_info:e,media_type:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"sdkInitEngine",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"joinRoom",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:r,reason:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"p2pConnectionStatus",value:function(e,t,r,n,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=i(i({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:r,status:n,elapse:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{key:"p2pConnectClosed",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i(i({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{},{common_extra_info:JSON.stringify(t)});this.push(r)}},{key:"rtcDeviceError",value:function(e,t,r,n,o,a,s,c,u,d,l,h,f,p,_,v){var m=arguments.length>16&&void 0!==arguments[16]?arguments[16]:{},y=i(i({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:r,system_error_code:n,system_api:o,call_parameters:a,location:s,message:c,media_device_id:u,media_device_name:d,elapse:l,scenario:h,event_session_id:f,device_pid:p,device_vid:_,media_mode:v},this.modify_ids),{},{common_extra_info:JSON.stringify(m)});this.push(y)}},{key:"rtcVideoDevice",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcVideoCaptureEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i(i(i({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:JSON.stringify(t)});this.push(r)}},{key:"rtcEncodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcFirstFrameEncoded",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcSendFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcRecvFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcRecvFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcDecodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}}]),r}(DU),yB=new mB,gB=new mB,SB=new mB,bB=yB.commonStats,EB=gB.commonStats,kB=SB.commonStats,TB={default:yB,rtm:gB,outsideRoom:SB};function IB(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return function(t,n,i){if("function"==typeof i.value){var o=i.value;i.value=function(){for(var t=arguments.length,i=new Array(t),a=0;a<t;a++)i[a]=arguments[a];var s={};r.forEach((function(e,t){s[e]=i[t]})),"joinRoom"===n&&bB.setStats({room_id:i[1]}),TB[e].rtcSdkApiCall(n,0,JSON.stringify(bP(i)),s);var c=o.apply(this,i);return"function"==typeof(null==c?void 0:c.then)?c.then((function(t){return TB[e].rtcSdkCallback(n,0,JSON.stringify(bP([t||{}]))),t})).catch((function(t){throw TB[e].rtcSdkCallback(n,t.code,JSON.stringify(t.message)),t})):(TB[e].rtcSdkCallback(n,0,JSON.stringify(bP([c||{}]))),c)}}}}function AB(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e===ne.onUserMessageReceivedOutsideRoom||e===ne.onUserBinaryMessageReceivedOutsideRoom;(n?gB:yB).rtcSdkCallback(e,r,JSON.stringify(t))}function RB(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];(n?gB:yB).rtcInvokeStatus(JSON.stringify(t),r,e,"",0)}var wB="BytePlus",CB="RTC_DEVICE_ID",OB="RTC_ACCESS_NODE",xB="RTC_ACCESS_URLS",NB="RTC_H264_BLACK_LIST",DB="engine_BAC",PB=function(){function e(){u(this,e)}return l(e,[{key:"get",value:function(e){var t=localStorage.getItem(e);if(!t)return null;try{var r=JSON.parse(t);return r.ttl>0&&Date.now()-r.saveTime>r.ttl?(this.delete(e),null):r.message}catch(n){return null}}},{key:"set",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,n={ttl:r,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(n)),!0}catch(i){return!1}}},{key:"delete",value:function(e){try{return localStorage.removeItem(e),!0}catch(t){return!1}}}]),e}(),MB=function(e){f(r,e);var t=g(r);function r(){return u(this,r),t.apply(this,arguments)}return l(r,[{key:"getDeviceId",value:function(){if(lP())return"";var e=this.get(CB);return e||(e=oP()),this.set(CB,e),e}},{key:"setDeviceId",value:function(e){return[bB,EB,kB].forEach((function(t){return t.setStats({device_id:e})})),this.set(CB,e),e}},{key:"getAccessNode",value:function(e){return this.get("".concat(OB,"_").concat(e,"-").concat(wB))}},{key:"setAccessNode",value:function(e,t,r){return this.set("".concat(OB,"_").concat(e,"-").concat(wB),t,1e3*r)}},{key:"clearAccessNode",value:function(e){this.delete("".concat(OB,"_").concat(e,"-").concat(wB))}},{key:"getAccessUrls",value:function(){return this.get("".concat(xB,"-").concat(wB))}},{key:"setAccessUrls",value:function(e){var t=e.map((function(e){var t=e.host,r=e.path;return"https://".concat(t).concat(r)}));return this.set("".concat(xB,"-").concat(wB),t)}},{key:"clearAccessUrls",value:function(){this.delete("".concat(xB,"-").concat(wB))}},{key:"getH264BlackList",value:function(){return this.get(NB)}},{key:"setH264BlackList",value:function(e){return this.set(NB,e)}},{key:"getAudioProfile",value:function(){return this.get(DB)}},{key:"setAudioProfile",value:function(e){return this.set(DB,e)}}]),r}(PB),UB=new MB,LB="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function VB(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^https?:\/\/.+/.test(e)||(e="https://"+e),"".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var FB="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",BB="rtc.rtcplus.com".split(","),jB={VERSION:"4.46.12",ICE_CONFIG_REQUEST_URLS_INTERNAL:LB.map(VB),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:FB,CONFIG_REQUEST_DOMAINS:BB,DEVICE_ID:"",OVERSEA:!1};function GB(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(jB.ICE_CONFIG_REQUEST_URLS=t.map(VB))):void("LOG_SERVER_URL"!==e||t!==j.overseas?"LOG_SERVER_URL"!==e||t!==j.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?"OVERSEA"!==e?("DEVICE_ID"===e&&UB.setDeviceId(t),jB[e]=t):jB.OVERSEA=t:jB.LOG_SERVER_URL=t:jB.LOG_SERVER_URL=FB:jB.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function HB(e){return"DEVICE_ID"===e?UB.getDeviceId():jB[e]}function zB(e,t){var r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,y;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},control:{protocol:"2.0"},audio:{codec:(null===(r=t.audio)||void 0===r?void 0:r.codec)||XB.audio.codec,bitRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.kBitRate)||XB.audio.kBitRate),sampleRate:1e3*((null===(i=t.audio)||void 0===i?void 0:i.sampleRate)||XB.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||XB.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||XB.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||XB.video.codec,fps:(null===(c=t.video)||void 0===c?void 0:c.fps)||XB.video.fps,gop:(null===(u=t.video)||void 0===u?void 0:u.gop)||XB.video.gop,lowLatency:null!==(d=null===(l=t.video)||void 0===l?void 0:l.lowLatency)&&void 0!==d?d:XB.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||XB.video.kBitRate),width:(null===(f=t.video)||void 0===f?void 0:f.width)||XB.video.width,height:(null===(p=t.video)||void 0===p?void 0:p.height)||XB.video.height},layout:{canvas:{bgnd:(null===(_=t.layout)||void 0===_?void 0:_.backgroundColor)||XB.layout.backgroundColor},regions:(null===(v=t.layout)||void 0===v||null===(m=v.regions)||void 0===m?void 0:m.map((function(e){return{alpha:Math.min(Math.max(+e.alpha,0),1),uid:e.userId,zorder:e.zorder,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),renderMode:e.renderMode||1,contentControl:e.contentControl||0,screen:e.isScreenStream,local_user:e.isLocalUser}})))||[],app_data:(null===(y=t.layout)||void 0===y?void 0:y.appData)||XB.layout.appData}}}}function KB(e,t,r){var n,i,o,a,s,c,u,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(n=r.video)||void 0===n?void 0:n.fps)||15,bitrate:1e3*((null===(i=r.video)||void 0===i?void 0:i.kBitRate)||40),width:(null===(o=r.video)||void 0===o?void 0:o.width)||640,height:(null===(a=r.video)||void 0===a?void 0:a.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=r.layout)||void 0===s?void 0:s.interpolationMode)||z.PREV_FRAME,canvas:{bgColor:(null===(c=r.layout)||void 0===c?void 0:c.backgroundColor)||"#000000",bgImage:(null===(u=r.layout)||void 0===u?void 0:u.backgroundImage)||""},regions:(null===(d=r.layout)||void 0===d||null===(l=d.regions)||void 0===l?void 0:l.map((function(e){return{roomId:e.roomId,userId:e.userId,alterImage:e.alertImage||"",alpha:e.alpha,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),zorder:e.zorder,renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var WB,XB={url:"",video:{codec:"H264",width:640,height:360,fps:30,gop:60,kBitRate:600,lowLatency:!0},audio:{codec:"AAC",kBitRate:64,sampleRate:48,channels:2,AACProfile:"LC"},layout:{regions:[],appData:"",backgroundColor:"#000000"}},qB={width:640,height:360,frameRate:30,maxKbps:600},YB={width:1920,height:1080,frameRate:15,maxKbps:3e3},JB=function(e){return e.streamRemovedBySchedule308="stream removed",e.clientRePublish="client republish",e.publishStreamFaied="publish failed",e.clientUnPublish="client unpublished",e.clientDisconnected="client disconnected",e.videoMuted="video muted",e}(JB||{}),QB=function(e){return e.PushLimitWarn="PushLimitWarn",e}(QB||{}),ZB=function(e){return e.ON_ADD_STREAM="onAddStream",e.ON_REMOVE_STREAM="onRemoveStream",e.USER_DISCONNECTION="userDisconnection",e.USER_CONNECTION="userConnection",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_UPDATE_USER_ATTRIBUTES="onUpdateUserAttributes",e.ON_PUSH_TRACK="onPushTrack",e.ON_REMOVE_TRACK="onRemoveTrack",e.ON_CUSTOM_MESSAGE="onCustomMessage",e.NODE_CHANGE="nodeChange",e.USER_MESSAGE_RECEIVED="userMessageReceived",e.USER_BINARY_MESSAGE_RECEIVED="userBinaryMessageReceived",e.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM="userMessageReceivedOutsideRoom",e.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM="userBinaryMessageReceivedOutsideRoom",e.POST_PROCESSING_MESSAGE="postProcessingMessage",e.ON_USER_TOKEN_WILL_EXPIRE="onUserTokenWillExpire",e.STREAM_CONTROL_MESSAGE="streamControlMessage",e.ON_SCENE_CONFIG="onSceneConfig",e.ON_STREAM_FAILED="streamFailed",e}(ZB||{}),$B=function(e){return e.RSCP="RSCP",e}($B||{}),ej=function(e){return e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection",e}(ej||{}),tj=function(e){return e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire",e}(tj||{}),rj=function(e){return e[e.roomDismissByAdmin=2]="roomDismissByAdmin",e}(rj||{}),nj=function(e){return e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK",e}(nj||{}),ij=function(e){return e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER",e}(ij||{}),oj=function(e){return e[e.SUCCESS=0]="SUCCESS",e[e.TIMEOUT=1]="TIMEOUT",e[e.BROKEN=2]="BROKEN",e[e.NO_RECEIVER=3]="NO_RECEIVER",e[e.NO_RELAYPATH=4]="NO_RELAYPATH",e[e.SEND_TO_SERVER_ERROR=17]="SEND_TO_SERVER_ERROR",e[e.SERVER_RESPONSE_ERROR=18]="SERVER_RESPONSE_ERROR",e[e.NOT_JOIN=100]="NOT_JOIN",e[e.INIT=101]="INIT",e[e.NO_CONNECTION=102]="NO_CONNECTION",e[e.NOT_LOGIN=105]="NOT_LOGIN",e[e.SERVER_PARAMS_NOTSET=106]="SERVER_PARAMS_NOTSET",e[e.UNKNOWN=1e3]="UNKNOWN",e}(oj||{}),aj=(h(WB={},0,[0,"success"]),h(WB,1,[qN.USER_MESSAGE_TIMEOUT,"timeout, failed to send."]),h(WB,2,[qN.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."]),h(WB,3,[qN.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."]),h(WB,4,[qN.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."]),h(WB,17,[qN.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."]),h(WB,18,[qN.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."]),h(WB,100,[qN.USER_MESSAGE_NOT_JOIN,"not join room"]),h(WB,101,[qN.USER_MESSAGE_INIT,"not init."]),h(WB,102,[qN.USER_MESSAGE_NO_CONNECTION,"no connection."]),h(WB,105,[qN.USER_MESSAGE_NOT_LOGIN,"not login."]),h(WB,106,[qN.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."]),h(WB,1e3,[qN.USER_MESSAGE_UNKNOWN,"unknown."]),WB),sj=["msg"],cj=new xU("DataChannelSignaling",3),uj=function(e){return e[e.C2S=0]="C2S",e[e.C2C=1]="C2C",e[e.C2GW=2]="C2GW",e[e.C2CDirect=3]="C2CDirect",e[e.C2RTM=4]="C2RTM",e}(uj||{}),dj=6e4,lj=function(e){f(a,e);var t,r,n=g(a);function a(e){var t;return u(this,a),h(m(t=n.call(this)),"_singlingCache",new Map),h(m(t),"_p2pCache",new Map),h(m(t),"_rttIds",{}),h(m(t),"_p2pMessageId",0),h(m(t),"_clearDataChannelListener",void 0),t._dataChannel=e,t._clearDataChannelListener=t._handleHandler(),window.__rtc_mock_signaling__=t.emit.bind(m(t)),t}return l(a,[{key:"destroy",value:function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=0,this._rttIds={}}},{key:"sendSignaling",value:function(e,t,r){var n=this;return yB.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",XF.UP),new Promise((function(i,o){var a=n._genHeader(r);a.id=yP();var s=a.id.join("-"),c=setTimeout((function(){n._singlingCache.delete(s),o(new JN(qN.TIME_OUT,"".concat(e," message time out")))}),dj);n._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(c),i(e)},error:function(e){clearTimeout(c),o(e)}}),cj.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),n._sendMessage(e,a,t)}))}},{key:"sendPingSignaling",value:function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:2})}},{key:"sendP2PMessage",value:(r=c(o().mark((function e(t,r){var n,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.msg,a=v(t,sj),s=n instanceof ArrayBuffer,e.t0=this,e.t1=i,e.t2=i({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:nj.SEND,type:ij.P2P,err:oj.SUCCESS},a),e.t3={},e.t4=s,!s){e.next=13;break}return e.next=10,hP.ab2b64str(n);case 10:e.t5=e.sent,e.next=14;break;case 13:e.t5=n;case 14:return e.t6=e.t5,e.t7={binary:e.t4,msg:e.t6},e.t8=(0,e.t1)(e.t2,e.t3,e.t7),e.t9=r,e.abrupt("return",e.t0._sendP2PMessage.call(e.t0,e.t8,e.t9));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"_sendP2PMessage",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return SP(e.msg)?this._rttIds[e.id]=e.id:e.dir===nj.SEND&&cj.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(n,o){var a=t._genHeader(i(i({needAck:!0,functionType:1},r),{},{id:yP()}));if(e.dir===nj.SEND){var s=setTimeout((function(){t._p2pCache.delete(e.id),o(new JN(qN.TIME_OUT,"P2P message timeout"))}),dj);t._p2pCache.set(e.id,{success:function(e,t){clearTimeout(s),n(t)},error:function(e){clearTimeout(s);var t=E(aj[e.err]||[qN.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),r=t[0],n=t[1];o({code:r,message:e.msg||n})}})}t._sendMessage("p2p",a,e)}))}},{key:"_sendMessage",value:function(e,t,r){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new JN(qN.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var n=t.version+(+t.zip<<5)+(+t.encrypt<<6),i=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=hP.str2ab(JSON.stringify([e,r])),a=dP(Uint8Array,[n,i].concat(k(t.id||[])),new Uint8Array(o));this._dataChannel.send(a.buffer)}},{key:"_dispartData",value:function(e){var t=new Uint8Array(e),r=0,n=t[r++],i=t[r++],o={version:15&n,zip:16==(16&n),encrypt:32==(32&n),needAck:1==(1&i),direction:(2&i)>>1,functionType:(60&i)>>2,binary:64==(64&i)};if(o.needAck||1===o.direction){for(;r<=6;r++)if(128!=(128&t[r])){r++;break}o.id=Array.from(t.slice(2,r))}return{header:o,data:t.slice(r)}}},{key:"_feedbackSignaling",value:function(e,t,r){var n=this._genHeader({needAck:!0,direction:1,id:e.split("-").map((function(e){return+e}))});cj.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),n,r)}},{key:"_handleMessage",value:(t=c(o().mark((function e(t){var r,n,a,s,c,u,d,l,h,f,p,_,v,m,y,g,S,b,k,T,I,A,R,w,C,O,x,N,D,P,M;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:u=this._dispartData(t),d=u.data,(l=u.header).zip&&((h=new MF.Inflate).push(d,!0),d=h.result),f=hP.ab2str(d),p=[],e.prev=6,p=JSON.parse(f),e.next=14;break;case 10:return e.prev=10,e.t0=e.catch(6),e.t0 instanceof Error&&yB.rtcSignalingMsgError(-1,e.t0.message,WF.MESSAGE_PARSE_FAILED),e.abrupt("return");case 14:e.t1=l.functionType,e.next=0===e.t1?17:1===e.t1?34:2===e.t1?83:99;break;case 17:if(_=(null===(r=l.id)||void 0===r?void 0:r.join("-"))||"",1!==l.direction){e.next=22;break}this._handleAckMessage(_,p[0]||{},f),e.next=33;break;case 22:if(!Array.isArray(p)){e.next=33;break}if(v=p[0],p=p[1],cj.print("Signal","<<<<<< ".concat(v),p,_),this._feedbackSignaling(_,v,v===ZB.ON_CUSTOM_MESSAGE?i(i({},p),{},{message:""}):""),!p.binary||"string"!=typeof p.message){e.next=31;break}return e.next=30,hP.b64str2ab(p.message);case 30:p.message=e.sent;case 31:this.emit(v,i({},p)),yB.rtcSignaling(0,f,"on-".concat(v),"Recv",XF.DOWN);case 33:return e.abrupt("break",100);case 34:Array.isArray(p)&&(p=p[1]),m=null===(n=p)||void 0===n?void 0:n.id,this._rttIds[m]||(null===(a=p)||void 0===a?void 0:a.dir)===nj.FEEDBACK||SP(null===(s=p)||void 0===s?void 0:s.msg)?delete this._rttIds[m]:cj.print("Signal","<<<<<< p2p response",p),e.t2=p.dir,e.next=e.t2===nj.SEND?40:e.t2===nj.FEEDBACK?78:81;break;case 40:if(SP(null===(c=p)||void 0===c?void 0:c.msg)){e.next=76;break}if(g=(y=p).binary,S=y.msg,b=y.room,k=y.to,T=y.from,I=""===b?g?ZB.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:ZB.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:g?ZB.USER_BINARY_MESSAGE_RECEIVED:ZB.USER_MESSAGE_RECEIVED,k){e.next=60;break}if(e.t3=this,e.t4=ZB.ON_CUSTOM_MESSAGE,e.t5=T,e.t6=g,!g){e.next=54;break}return e.next=51,hP.b64str2ab(S);case 51:e.t7=e.sent,e.next=55;break;case 54:e.t7=S;case 55:e.t8=e.t7,e.t9={clientId:e.t5,binary:e.t6,message:e.t8},e.t3.emit.call(e.t3,e.t4,e.t9),e.next=76;break;case 60:if(e.t10=this,e.t11=I,e.t12=i,e.t13=i({},p),e.t14={},!g){e.next=71;break}return e.next=68,hP.b64str2ab(S);case 68:e.t15=e.sent,e.next=72;break;case 71:e.t15=S;case 72:e.t16=e.t15,e.t17={msg:e.t16},e.t18=(0,e.t12)(e.t13,e.t14,e.t17),e.t10.emit.call(e.t10,e.t11,e.t18);case 76:return this._sendP2PMessage(i(i({},p),{},{dir:nj.FEEDBACK,msg:""})),e.abrupt("break",82);case 78:return(A=this._p2pCache.get(p.id))&&(this._p2pCache.delete(p.id),p.err===oj.SUCCESS?A.success(p.id,p):A.error(p)),e.abrupt("break",82);case 81:return e.abrupt("break",82);case 82:return e.abrupt("break",100);case 83:if(1!==l.direction){e.next=88;break}w=(null===(R=l.id)||void 0===R?void 0:R.join("-"))||"",this._handleAckMessage(w,p[0]||{},f),e.next=98;break;case 88:if(C=E(p,2),O=C[0],x=C[1],N=void 0===x?{}:x,"RXMediaMsg"!==O){e.next=98;break}D=N.type,P=N.data,yB.rtcSignaling(0,f,"on-".concat(D),"Recv",XF.DOWN),e.t19=D,e.next="RSCP"===e.t19?95:97;break;case 95:try{M=JSON.parse(P),Array.isArray(M)&&this.emit(D,M)}catch(o){}return e.abrupt("break",98);case 97:return e.abrupt("break",98);case 98:case 99:return e.abrupt("break",100);case 100:case"end":return e.stop()}}),e,this,[[6,10]])}))),function(e){return t.apply(this,arguments)})},{key:"_handleHandler",value:function(){var e=this,t=function(t){cj.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){cj.print("_handleHandler","dataChannel error",t),e.emit("close",t)},n=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",r),this._dataChannel.addEventListener("message",n),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",r),e._dataChannel.removeEventListener("message",n)}}},{key:"_genHeader",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i({version:2,zip:!1,encrypt:!1,needAck:!0,direction:0,functionType:0,binary:!1},e)}},{key:"_handleAckMessage",value:function(e,t,r){var n=this._singlingCache.get(e);n&&(this._singlingCache.delete(e),200===t.code?n.success(t):n.error(t),cj.print("Signal","<<<<<< [".concat(n.signalingType,"-ack]"),t)),yB.rtcSignaling(0,r,null==n?void 0:n.signalingType,"Ack",XF.DOWN)}}]),a}(AU.exports.EventEmitter),hj=function(){function e(){u(this,e),h(this,"xhr",void 0),h(this,"isSending",void 0),h(this,"timeout",void 0),this.isSending=!1}return l(e,[{key:"ajax",value:function(e){var t=this,r=e.method,n=e.url,i=e.body,o=void 0===i?{}:i,a=e.headers,s=void 0===a?{}:a,c=e.stringify,u=void 0===c||c;return new Promise((function(e,i){t.isSending=!0;var a=new XMLHttpRequest;a.open(r,n,!0);for(var c=0,d=Object.entries(s);c<d.length;c++){var l=E(d[c],2),h=l[0],f=l[1];a.setRequestHeader(h,f)}a.onreadystatechange=function(){4===a.readyState&&(t.isSending=!1,200===a.status?e(JSON.parse(a.responseText)):i({message:a.statusText,code:a.status})),0===a.status&&i({code:0,message:"Request abort"})},a.onerror=function(e){t.isSending=!1,i({code:-1,message:a.responseText||"unknown"})},t.timeout&&(a.timeout=t.timeout),u&&(o=JSON.stringify(o)),a.send(o),t.xhr=a}))}},{key:"get",value:function(e,t){return this.ajax({method:"GET",url:e,headers:t})}},{key:"post",value:function(e,t,r,n){return this.ajax({method:"POST",url:e,body:t,headers:r,stringify:n})}},{key:"abort",value:function(){var e;null===(e=this.xhr)||void 0===e||e.abort()}}]),e}(),fj=new xU("ICE Request",3),pj=function(){function e(){u(this,e),h(this,"_request",void 0),this._request=new hj}var t,r,n;return l(e,[{key:"getAccessNode",value:(n=c(o().mark((function e(t,r,n,i,a,s,c){var u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(u=UB.getAccessNode(t))){e.next=9;break}if(this.getAccessNodeFromServer(t,r,n,i,a,s,c),RB("es.R.node.cache",u),!Array.isArray(u)){e.next=8;break}return e.abrupt("return",Promise.resolve(u));case 8:return e.abrupt("return",Promise.resolve([u]));case 9:return e.abrupt("return",this.getAccessNodeFromServer(t,r,n,i,a,s,c));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i,o,a,s){return n.apply(this,arguments)})},{key:"getAccessNodeFromServer",value:(r=c(o().mark((function e(t,r,n,i,a,s,c){var u,d,l,h,f=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=UB.getAccessUrls(),h=!0,RB("es.R.req.cache.urls",l),(null===(u=l)||void 0===u?void 0:u.length)>0||(l=jB.ICE_CONFIG_REQUEST_URLS,h=!1,RB("es.R.req.external.urls",l)),(null===(d=l)||void 0===d?void 0:d.length)>0||(l=jB.ICE_CONFIG_REQUEST_URLS_INTERNAL,h=!1,RB("es.R.req.internal.urls",l)),e.abrupt("return",this.getICEConfigFromServer(l,t,r,n,i,a,s,c).then((function(e){var r=e.nodes;return UB.setAccessNode(t,r,e.ttl||11200),e.dispatchDomains&&UB.setAccessUrls(e.dispatchDomains),r})).catch((function(e){if(h)return RB("es.R.req.fallback",""),UB.clearAccessUrls(),f.getAccessNodeFromServer(t,r,n,i,a,s,c);throw e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,n,i,o,a,s){return r.apply(this,arguments)})},{key:"getICEConfigFromServer",value:(t=c(o().mark((function e(t,r,n,i,a,s,u,d){var l,h,f,p,_=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l={appID:r,userID:i,deviceID:a,connectSessionID:cP(),os:"web",sdkVersion:jB.VERSION,isOversea:jB.OVERSEA,expectedAddr:HB("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:d},s&&u&&(l.feedbackInfo=[{feedbackIP:null===(h=u.publicIPs[0])||void 0===h?void 0:h.ip,feedbackReason:{type:"NODE_CHANGED",reason:s}}],delete l.expectedAddr),f=Date.now(),yB.rtcGetAccess(0,JSON.stringify(l),0,zF.REQUEST,t.join(","),l.connectSessionID),p=t.map(function(){var e=c(o().mark((function e(t,r){var n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,_._request.post(t,l);case 3:n=e.sent,e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new JN(qN.ICE_SERVER_WRONG,"get ICE config failed",e.t0);case 9:if(200===n.code){e.next=11;break}throw new JN(qN.ICE_SERVER_WRONG,"get ICE config failed",{server_code:n.code,message:JSON.stringify(n)});case 11:if(i=n.nodes[0]){e.next=14;break}throw new JN(qN.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:n.code,message:JSON.stringify(n)});case 14:return e.abrupt("return",{result:n,firstNode:i,index:r});case 15:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t,r){return e.apply(this,arguments)}}()),e.abrupt("return",kP(p).then((function(e){var r=e.result;e.firstNode;var n=e.index;return yB.rtcGetAccess(200,JSON.stringify(r),Date.now()-f,zF.RESPONSE,t[n],l.connectSessionID),r})).catch((function(e){var r,n,i=null===(r=e[0])||void 0===r?void 0:r.error;throw yB.rtcGetAccess(+((null==i?void 0:i.code)||(null==i?void 0:i.server_code)),null===(n=e[0])||void 0===n?void 0:n.message,Date.now()-f,zF.RESPONSE,t.join(","),l.connectSessionID,{error:JSON.stringify(i)}),i})));case 6:case"end":return e.stop()}}),e)}))),function(e,r,n,i,o,a,s,c){return t.apply(this,arguments)})},{key:"abort",value:function(){this._request.isSending&&(fj.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())}}]),e}(),_j=function(){function e(){u(this,e),h(this,"_request",void 0),this._request=new hj}return l(e,[{key:"getH264BlackList",value:function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.46.12",deviceType:"web"};this._request.timeout=800;var r=jB.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));yB.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),FF.REQUEST,"",!1);var n=r.map(function(){var r=c(o().mark((function r(n,i){var a,s;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,e._request.post(n,t);case 3:s=r.sent,r.next=9;break;case 6:throw r.prev=6,r.t0=r.catch(0),new JN(qN.ICE_SERVER_WRONG,"get config failed");case 9:if(Array.isArray(null===(a=s)||void 0===a?void 0:a.web_h264_black_list)){r.next=11;break}throw new JN(qN.ICE_SERVER_WRONG,"get config failed");case 11:return r.abrupt("return",{result:s,index:i});case 12:case"end":return r.stop()}}),r,null,[[0,6]])})));return function(e,t){return r.apply(this,arguments)}}());return new Promise((function(e){kP(n).then((function(t){var n=t.result,i=t.index;UB.setH264BlackList(n.web_h264_black_list),yB.rtcGetConfig(200,JSON.stringify(n),0,r[i],FF.RESPONSE,"",!1),e(n.web_h264_black_list)})).catch((function(t){yB.rtcGetConfig(500,t.message,0,"",FF.RESPONSE,"",!1),e(UB.getH264BlackList()||[])}))}))}},{key:"getAudioProfile",value:function(){var e=this,t={keys:["engine_BAC"],labelSelector:"",sdkVersion:"4.46.12",deviceType:"web"},r=jB.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));yB.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),FF.REQUEST,"",!1);var n=r.map(function(){var r=c(o().mark((function r(n,i){var a,s;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,e._request.post(n,t);case 3:s=r.sent,r.next=9;break;case 6:throw r.prev=6,r.t0=r.catch(0),new JN(qN.ICE_SERVER_WRONG,"get config failed");case 9:if(Array.isArray(null===(a=s)||void 0===a?void 0:a.engine_BAC)){r.next=11;break}throw new JN(qN.ICE_SERVER_WRONG,"get config failed");case 11:return r.abrupt("return",{result:s,index:i});case 12:case"end":return r.stop()}}),r,null,[[0,6]])})));return function(e,t){return r.apply(this,arguments)}}());return new Promise((function(e){kP(n).then((function(t){var n=t.result,i=t.index;UB.setAudioProfile(n.engine_BAC),yB.rtcGetConfig(200,JSON.stringify(n),0,r[i],FF.RESPONSE,"",!1),e(n.engine_BAC)})).catch((function(t){yB.rtcGetConfig(500,t.message,0,"",FF.RESPONSE,"",!1),e(UB.getAudioProfile()||[])}))}))}}]),e}();function vj(e,t){var r=1,n=e;(e.width>t.width||e.height>t.height)&&(r=e.width/e.height>t.width/t.height?e.width/t.width:e.height/t.height,n={width:Math.floor(e.width/r),height:Math.floor(e.height/r)});return i(i({},n),{},{scaleResolutionDownBy:r})}var mj=[{sub_index:0,video_index:0,framerate:30,height:1080,maxkbps:3e3,width:1920},{sub_index:1,video_index:0,framerate:30,height:720,maxkbps:1200,width:1280},{sub_index:2,video_index:0,framerate:30,height:630,maxkbps:1100,width:1120},{sub_index:3,video_index:0,framerate:30,height:540,maxkbps:1e3,width:960},{sub_index:4,video_index:1,framerate:30,height:450,maxkbps:800,width:800},{sub_index:5,video_index:1,framerate:30,height:360,maxkbps:600,width:640},{sub_index:6,video_index:1,framerate:30,height:270,maxkbps:400,width:480},{sub_index:7,video_index:2,framerate:15,height:180,maxkbps:300,width:320},{sub_index:8,video_index:2,framerate:15,height:144,maxkbps:200,width:256},{sub_index:9,video_index:3,framerate:15,height:90,maxkbps:100,width:160}],yj=[{width:1920,height:1080,maxLayers:3,totalPixels:2073600},{width:1280,height:720,maxLayers:3,totalPixels:921600},{width:960,height:540,maxLayers:3,totalPixels:518400},{width:640,height:360,maxLayers:2,totalPixels:230400},{width:480,height:270,maxLayers:2,totalPixels:129600},{width:320,height:180,maxLayers:1,totalPixels:57600},{width:0,height:0,maxLayers:1,totalPixels:0}];var gj={width:160,height:90,frameRate:15,maxkbps:100},Sj={width:480,height:270,frameRate:15,maxkbps:400};function bj(e){if(!e.length)return[];var t=e.shift(),r=t.width/t.height,n=0,o=0,a=i(i({},t),{},{video_index:o,sub_index:n++});delete a.rid;for(var s=[a],c=0,u=0;u<mj.length;u++)if(mj[u].height<t.height){c=u;break}for(var d=e.shift(),l=c;l<mj.length;l++){var h,f=mj[l];if(d&&f.height<=(null===(h=d)||void 0===h?void 0:h.height)){var p,_=f.height===(null===(p=d)||void 0===p?void 0:p.height),v=i(i({},d),{},{video_index:++o,sub_index:n++});if(delete v.rid,s.push(v),d=e.shift(),_)continue}s.push(i(i({},f),{},{width:Math.floor(f.height*r),video_index:o,sub_index:n++}))}return s}var Ej,kj,Tj="chrome-stable"===pP(),Ij=function(){function e(t){u(this,e),h(this,"peer",void 0),h(this,"stats",void 0),this.peer=t,this.stats=[]}var t,r;return l(e,[{key:"handleCodec",value:function(e){return e}},{key:"handleInboundRtp",value:function(e){return e}},{key:"handleOutboundRtp",value:function(e){var t=e.ssrc;return t&&(e.rtxSsrc=t),e}},{key:"handleRemoteInboundRtp",value:function(e){return e}},{key:"handleRemoteOutboundRtp",value:function(e){return e}},{key:"handleMediaSource",value:function(e){return e}},{key:"handleCsrc",value:function(e){return e}},{key:"handlePeerConnection",value:function(e){return e}},{key:"handleDataChannel",value:function(e){return e}},{key:"handleStream",value:function(e){return e}},{key:"handleTrack",value:function(e){return e}},{key:"handleTransceiver",value:function(e){return e}},{key:"handleSender",value:function(e){return e}},{key:"handleReceiver",value:function(e){return e}},{key:"handleTransport",value:function(e){return e}},{key:"handleSctpTransport",value:function(e){return e}},{key:"handleCandidatePair",value:function(e){return e}},{key:"handleLocalCandidate",value:function(e){return e}},{key:"handleRemoteCandidate",value:function(e){return e}},{key:"handleCertificate",value:function(e){return e}},{key:"handleIceServer",value:function(e){return e}},{key:"processStats",value:function(e){var t=this;e.forEach((function(e){var r;switch(e.type){case"candidate-pair":r=t.handleCandidatePair;break;case"certificate":r=t.handleCertificate;break;case"remote-candidate":r=t.handleRemoteCandidate;break;case"remote-inbound-rtp":case"inbound-rtp":r=t.handleInboundRtp;break;case"remote-outbound-rtp":case"outbound-rtp":r=t.handleOutboundRtp;break;case"sctp-transport":r=t.handleSctpTransport;break;case"sender":r=t.handleSender;break;case"stream":r=t.handleStream;break;case"track":r=t.handleTrack;break;case"transceiver":r=t.handleTransceiver;break;case"transport":r=t.handleTransport;break;case"codec":r=t.handleCodec;break;case"csrc":r=t.handleCsrc;break;case"data-channel":r=t.handleDataChannel;break;case"ice-server":r=t.handleIceServer;break;case"media-source":r=t.handleMediaSource;break;case"peer-connection":r=t.handlePeerConnection;break;case"receiver":r=t.handleReceiver;break;case"local-candidate":r=t.handleLocalCandidate;break;default:r=function(e){return e}}r=r.bind(t),t.stats.push(r(e))}))}},{key:"getExtraStats",value:(r=c(o().mark((function e(t){var r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){if(!Tj||void 0!==window.InstallTrigger)return e(r.stats);try{r.peer.getStats((function(n){n.result().forEach((function(e){if(!Aj.includes(e.type)){var n={};e.names().forEach((function(t){n[t]=e.stat(t)})),n.id=e.id,n.type=e.type,n.timestamp=e.timestamp,"ssrc"===n.type&&t&&t.id?t.id===n.googTrackId&&r.stats.push(n):r.stats.push(n)}})),e(r.stats)}))}catch(RJ){n(RJ)}})));case 1:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"getStats",value:(t=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.peer.getStats(t);case 3:if(n=e.sent,this.processStats(n),e.prev=5,r){e.next=9;break}return e.next=9,this.getExtraStats(t);case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:e.next=17;break;case 15:e.prev=15,e.t1=e.catch(0);case 17:return e.abrupt("return",this.stats);case 18:case"end":return e.stop()}}),e,this,[[0,15],[5,11]])}))),function(e,r){return t.apply(this,arguments)})}]),e}(),Aj=["codec","inbound-rtp","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp","media-source","csrc","peer-connection","data-channel","stream","track","transceiver","sender","receiver","transport","sctp-transport","candidate-pair","local-candidate","remote-candidate","certificate","ice-server"],Rj=function(){var e=c(o().mark((function e(t,r,n){var i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=[],t instanceof RTCPeerConnection){e.next=3;break}return e.abrupt("return",i);case 3:return a=new Ij(t),e.next=6,a.getStats(r,n);case 6:return i=e.sent,e.abrupt("return",i);case 8:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),wj=function(){var e=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!lP()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel){e.next=3;break}return e.abrupt("return",!1);case 3:return e.next=5,Cj();case 5:return t=e.sent,e.abrupt("return",null==t?void 0:t.includes("H264"));case 9:return e.prev=9,e.t0=e.catch(0),e.abrupt("return",!1);case 12:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(){return e.apply(this,arguments)}}(),Cj=function(){var e=c(o().mark((function e(){var t,r,n,i,a,s,c,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Ej){e.next=2;break}return e.abrupt("return",Ej);case 2:return t=[],e.prev=3,e.next=6,EP();case 6:if(r=e.sent){e.next=9;break}return e.abrupt("return",t);case 9:if(!(null!=r&&r.includes("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f")||null!=r&&r.includes("profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1")||null!=r&&r.includes("packetization-mode=1;profile-level-id=42e01f;level-asymmetry-allowed=1"))){e.next=20;break}return n=navigator.userAgent.toLowerCase(),i=!1,a=["heytapbrowser","mqqbrowser","miuibrowser"],s=new _j,e.next=16,s.getH264BlackList();case 16:for(c=e.sent,a.push.apply(a,k(c)),u=0;u<a.length;u++)n.includes(a[u])&&(i=!0);!i&&t.push("H264");case 20:return null!=r&&r.includes("VP8")&&t.push("vp8"),Ej=t,e.abrupt("return",t);case 25:return e.prev=25,e.t0=e.catch(3),e.abrupt("return",t);case 28:case"end":return e.stop()}}),e,null,[[3,25]])})));return function(){return e.apply(this,arguments)}}(),Oj=function(){var e=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Cj();case 2:return t=e.sent,e.abrupt("return",t.map((function(e){return e.toUpperCase()})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),xj=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},Nj=new xU("BasicHandler",3),Dj={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!xj()||void 0};function Pj(e){if(void 0===kj){var t=navigator.userAgent.toLowerCase();kj=t.includes("chrome")&&t.includes("mobile")}return kj?Math.ceil(e):e}var Mj=function(e){f(d,e);var t,r,n,a,s=g(d);function d(e,t){var r;return u(this,d),h(m(r=s.call(this)),"_peerConnection",void 0),h(m(r),"_dataChannel",void 0),h(m(r),"_context",void 0),h(m(r),"monitor",void 0),h(m(r),"_offerIce",{}),h(m(r),"_answerIce",{}),h(m(r),"_initSctpEvents",!1),r.monitor=e,r._peerConnection=new RTCPeerConnection(Dj),r._dataChannel=r._peerConnection.createDataChannel("signaling",{negotiated:!0,id:100}),r._context=t,r._dataChannel.binaryType="arraybuffer",r._peerConnection.ontrack=function(e){var t,n;Nj.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(null===(t=e.streams)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.id)),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){Nj.print("constructor","onconnectionstatechange ".concat(r._peerConnection.iceConnectionState," -> ").concat(r._peerConnection.connectionState)),"failed"!==r._peerConnection.iceConnectionState&&"closed"!==r._peerConnection.iceConnectionState&&"failed"!==r._peerConnection.connectionState||r.emit("disconnect")},r._peerConnection.oniceconnectionstatechange=function(){var t=r._peerConnection.iceConnectionState;e.rtcPreIceState(t,KF["".concat(t.toUpperCase())])},r}return l(d,[{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){Nj.print("destroy"),this.disconnect(),this._context=void 0}},{key:"_simulcast",value:function(e,t,r,n,o){var a=[],s=function(e){for(var t=0,r=e.width*e.height,n=0;n<yj.length;n++)if(r>=yj[n].totalPixels){t=n;break}if(0===t)return yj[t].maxLayers;var i=yj[t-1].totalPixels;return(i-r)/(i-yj[t].totalPixels)<.1?yj[t-1].maxLayers:yj[t].maxLayers}(t);Nj.print("simulcast() ","maxLayers: %o",s),1===e.videoEncodeConfig.length?(a=function(e,t){var r=[];if(t<=1)return r;var n=1,i=1;return e.width/e.height>16/9?(n=e.width/gj.width,i=e.width/Sj.width):(n=e.height/gj.height,i=e.height/Sj.height),r.push({maxkbps:gj.maxkbps,scaleResolutionDownBy:n,frameRate:gj.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),t<=2||n>2&&r.unshift({maxkbps:Sj.maxkbps,scaleResolutionDownBy:i,frameRate:Sj.frameRate,width:Math.floor(e.width/i),height:Math.floor(e.height/i)}),r}(r,s),Nj.print("simulcast() ","simulcastLayers: %o",a)):(a=e.videoEncodeConfig.slice(1).slice(1-s).map((function(e){return i({frameRate:e.frameRate||15,maxkbps:e.maxKbps||600},vj(r,e))})),Nj.print("simulcast() ","simulcastLayers2: %o",a)),a.forEach((function(e,t){var r,i={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:Pj(e.scaleResolutionDownBy),rid:"".concat(t+1),maxFramerate:e.frameRate};null===(r=n.sendEncodings)||void 0===r||r.unshift(i),o.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)})}))}},{key:"internalPublish",value:function(e,t){var r=e.stream,n=e.videoTrack,i=e.audioTrack,o=e.enableSimulcast,a=e.pubAudio,s=e.pubVideo,c={direction:"sendonly",streams:[r]},u={direction:"sendonly",streams:[r]},d=[],l=[];if(Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length){var h=null==n?void 0:n.getTrack(),f={width:640,height:360,frameRate:30};if(h){var p=null==h?void 0:h.getSettings();f={width:Math.floor(p.width),height:Math.floor(p.height),frameRate:Math.floor(p.frameRate)}}var _=null==e?void 0:e.videoEncodeConfig[0],v=vj(f,_);e.prevScaleResolutionDownBy=v.scaleResolutionDownBy,e.videoInputConfig=f;var m={maxBitrate:1e3*_.maxKbps,scaleResolutionDownBy:Pj(v.scaleResolutionDownBy),rid:"0",maxFramerate:_.frameRate||15};u.sendEncodings=[m],d.push({width:v.width,height:v.height,framerate:_.frameRate,maxkbps:_.maxKbps,rid:"0"}),o&&(this._simulcast(e,v,f,u,d),null!=t&&t.simulcastOnDemand&&(l=bj([].concat(d))),Nj.print("subVideoDesc","desc: %o ",l))}Nj.print("publish videoTransceiverInit videoDescriptions","",u,d);var y=null==i?void 0:i.getTrack();(null==i?void 0:i.mixType)!==ee.PLAYOUT&&null!=i&&i.mixedAudioTrack&&(y=null==i?void 0:i.mixedAudioTrack),y=a&&y?y:"audio";var g=null==n?void 0:n.getTrack();return{semantics:"unified-plan",videoDescriptions:d,subVideoDescriptions:l,transceiverInit:{aTrack:y,vTrack:g=s&&g?g:"video",audioTransceiverInit:c,videoTransceiverInit:u}}}},{key:"updateScaleResolutionDownBy",value:(a=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Nj.print("updateScaleResolutionDownBy()"),i=null===(r=t.videoTrack)||void 0===r?void 0:r.getTrack(),a=t.videoTransceiver,i&&t.pubVideo&&a){e.next=6;break}return Nj.print("updateScaleResolutionDownBy()","no pub"),e.abrupt("return");case 6:s=null==i?void 0:i.getSettings(),c={width:Math.floor(s.width),height:Math.floor(s.height),frameRate:Math.floor(s.frameRate)},(u=vj(c,t.videoEncodeConfig[0])).scaleResolutionDownBy===t.prevScaleResolutionDownBy&&Nj.print("updateScaleResolutionDownBy()","no change %o",t.prevScaleResolutionDownBy),(d=null===(n=a.sender)||void 0===n?void 0:n.getParameters())&&(h=u.scaleResolutionDownBy/t.prevScaleResolutionDownBy,d.encodings=null==d||null===(l=d.encodings)||void 0===l?void 0:l.map((function(e){var r,n;Math.max(e.scaleResolutionDownBy=(e.scaleResolutionDownBy||1)*h,1);var i=+e.rid||0;e.maxFramerate=(null===(r=t.videoEncodeConfig[i])||void 0===r?void 0:r.frameRate)||e.maxFramerate;var o=null===(n=t.videoEncodeConfig[i])||void 0===n?void 0:n.maxKbps;return"number"==typeof o&&(e.maxBitrate=1e3*o),e})),t.prevScaleResolutionDownBy=u.scaleResolutionDownBy,t.videoInputConfig=c,null==a||a.sender.setParameters(d));case 12:case"end":return e.stop()}}),e)}))),function(e){return a.apply(this,arguments)})},{key:"getStats",value:function(e,t){return Rj(this._peerConnection,e,t)}},{key:"setLocalDescription",value:(n=c(o().mark((function e(t,r){var n,i,a,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=uP(),e.prev=1,e.next=4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,JF.W_1,"local"===(null==r?void 0:r.streamUserId)?QF.UP:QF.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",uP()-n,{type:"offer"}),this._initSctpEvents||(this._initSctpEvents=!0,(a=null===(i=this._peerConnection)||void 0===i?void 0:i.sctp)&&(a.onstatechange=function(){s.monitor.rtcInvokeStatus("sctp state change TO: ".concat(a.state),0,"sctp","",0)},a.transport&&(a.transport.onstatechange=function(){var e;s.monitor.rtcInvokeStatus("dtls state change TO: ".concat(null==a||null===(e=a.transport)||void 0===e?void 0:e.state),0,"dtls","",0)}))),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error("setLocal",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message+t,JF.W_1,"local"===(null==r?void 0:r.streamUserId)?QF.UP:QF.DOWN,"","",uP()-n,{type:"offer"});case 12:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e,t){return n.apply(this,arguments)})},{key:"setRemoteDescription",value:(r=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=uP(),e.prev=1,e.next=4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,JF.W_0,"local"===(null==r?void 0:r.streamUserId)?QF.UP:QF.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",uP()-n,{type:"answer"}),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(1),console.error("setRemote",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message+t,JF.W_1,"local"===(null==r?void 0:r.streamUserId)?QF.UP:QF.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",uP()-n,{type:"answer"});case 11:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})},{key:"pc",get:function(){return this._peerConnection}},{key:"addBitrateLimit",value:function(e,t){null==e||e.rtp.forEach((function(r){var n=r.codec,i=r.payload;if(["vp8","h264"].includes(n.toLocaleLowerCase())){var o=e.fmtp.find((function(e){return e.payload===i}));o&&(o.config=[].concat(k(o.config.split(";")),["x-google-min-bitrate=100","x-google-start-bitrate=".concat(t)]).join(";"))}}))}}]),d}(AU.exports.EventEmitter),Uj={},Lj=ff,Vj=Ut,Fj=ke,Bj=Qs,jj=Dt,Gj=Te,Hj=Xa,zj=Re,Kj=lv,Wj=Tc,Xj=ui,qj=$a,Yj=Qt,Jj=Nd,Qj=oc,Zj=Gs,$j=me,eG=_s.UNSUPPORTED_Y,tG=4294967295,rG=Math.min,nG=[].push,iG=Fj(/./.exec),oG=Fj(nG),aG=Fj("".slice),sG=!$j((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return 2!==r.length||"a"!==r[0]||"b"!==r[1]}));Bj("split",(function(e,t,r){var n;return n="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,r){var n=qj(zj(this)),i=void 0===r?tG:r>>>0;if(0===i)return[];if(void 0===e)return[n];if(!Hj(e))return Vj(t,n,e,i);for(var o,a,s,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,u+"g");(o=Vj(Zj,l,n))&&!((a=l.lastIndex)>d&&(oG(c,aG(n,d,o.index)),o.length>1&&o.index<n.length&&Lj(nG,c,Jj(o,1)),s=o[0].length,d=a,c.length>=i));)l.lastIndex===o.index&&l.lastIndex++;return d===n.length?!s&&iG(l,"")||oG(c,""):oG(c,aG(n,d)),c.length>i?Jj(c,0,i):c}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:Vj(t,this,e,r)}:t,[function(t,r){var i=zj(this),o=Gj(t)?void 0:Yj(t,e);return o?Vj(o,t,i,r):Vj(n,qj(i),t,r)},function(e,i){var o=jj(this),a=qj(e),s=r(n,o,a,i,n!==t);if(s.done)return s.value;var c=Kj(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(eG?"g":"y"),l=new c(eG?"^(?:"+o.source+")":o,d),h=void 0===i?tG:i>>>0;if(0===h)return[];if(0===a.length)return null===Qj(l,a)?[a]:[];for(var f=0,p=0,_=[];p<a.length;){l.lastIndex=eG?0:p;var v,m=Qj(l,eG?aG(a,p):a);if(null===m||(v=rG(Xj(l.lastIndex+(eG?p:0)),a.length))===f)p=Wj(a,p,u);else{if(oG(_,aG(a,f,p)),_.length===h)return _;for(var y=1;y<=m.length-1;y++)if(oG(_,m[y]),_.length===h)return _;p=f=v}}return oG(_,aG(a,f)),_}]}),!sG,eG);var cG={},uG={exports:{}},dG=uG.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(dG).forEach((function(e){dG[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))})),function(e){var t=function(e){return String(Number(e))===e?Number(e):e},r=function(e,r,n){var i=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:i&&!r[e.name]&&(r[e.name]={});var o=e.push?{}:i?r[e.name]:r;!function(e,r,n,i){if(i&&!n)r[i]=t(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(r[n[o]]=t(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&r[e.push].push(o)},n=uG.exports,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(n[t]||[]).length;s+=1){var c=n[t][s];if(c.reg.test(i))return r(c,a,i)}})),t.media=o,t};var o=function(e,r){var n=r.split(/=(.+)/,2);return 2===n.length?e[n[0]]=t(n[1]):1===n.length&&r.length>1&&(e[n[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var r=[],n=e.split(" ").map(t),i=0;i<n.length;i+=3)r.push({component:n[i],ip:n[i+1],port:n[i+2]});return r},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var r,n=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),n=!0),{scid:r,paused:n}}))}))}}(cG);var lG=uG.exports,hG=/%[sdv%]/g,fG=function(e){var t=1,r=arguments,n=r.length;return e.replace(hG,(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""}}))},pG=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 fG.apply(null,n)},_G=["v","o","s","i","u","e","p","c","b","t","r","z","a"],vG=["i","c","b","a"],mG=cG,yG=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||_G,n=t.innerOrder||vG,i=[];return r.forEach((function(t){lG[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(pG(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(pG(t,r,e))}))}))})),e.media.forEach((function(e){i.push(pG("m",lG.m[0],e)),n.forEach((function(t){lG[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(pG(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(pG(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};Uj.write=yG,Uj.parse=mG.parse,Uj.parseParams=mG.parseParams,Uj.parseFmtpConfig=mG.parseFmtpConfig,Uj.parsePayloads=mG.parsePayloads,Uj.parseRemoteCandidates=mG.parseRemoteCandidates,Uj.parseImageAttributes=mG.parseImageAttributes,Uj.parseSimulcastStreamList=mG.parseSimulcastStreamList;var gG=Math.pow(2,32),SG=function(){return Math.floor(Math.random()*gG+1e3)},bG=function(e,t,r){return r||(r=SG()),[{id:r,attribute:"cname",value:"kp34Za0H+aVf862l"},{id:r,attribute:"msid",value:"".concat(e.id," ").concat(e.id,"-").concat(t)},{id:r,attribute:"mslabel",value:"".concat(e.id)},{id:r,attribute:"label",value:"".concat(e.id,"-").concat(t)}]},EG=function(e,t){var r=SG(),n=SG();return{ssrcs:[r,n].reduce((function(r,n){return r.concat(bG(e,t,n))}),[]),ssrcGroups:[{semantics:"FID",ssrcs:"".concat(r," ").concat(n)}]}};function kG(e){return e.direction="inactive",e.port=0,delete e.ext,delete e.ssrcs,delete e.ssrcGroups,delete e.simulcast,delete e.simulcast_03,delete e.rids,delete e.extmapAllowMixed,delete e.bundleOnly,e}var TG=function(e,t,r){var n=i(i({},e),{},{invalid:[{value:"realx-exts:rscp"}],media:[t,r]});return delete n.groups,delete n.msidSemantic,Uj.write(n)};function IG(e){return AG.apply(this,arguments)}function AG(){return(AG=c(o().mark((function e(t){var r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={},n=t.publicIPs,i=t.certFingerprint,a=t.iceParams,r.fingerprint={type:"sha-256",hash:i},r.icePwd=a.serverIcePwd,e.next=6,wG(a.serverIceUfrag);case 6:return r.iceUfrag=e.sent,bB.setStats({connection_id:r.iceUfrag}),r.candidates=RG(n),r.setup="active",r.iceOptions="renomination",e.abrupt("return",r);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function RG(e){if(!Array.isArray(e))return[];var t=0,r=2130706431,n=[];return e.forEach((function(e){var o={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){n.push(i(i({},o),{},{foundation:t++,transport:"udp",port:e,priority:r}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){n.push(i(i({},o),{},{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),n}var wG=function(){var e=c(o().mark((function e(t){var r,n,i,a,s,c,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new TextEncoder,n=r.encode("PREC"),e.t0=Uint8Array,e.next=5,hP.b64str2ab(t);case 5:return e.t1=e.sent,i=new e.t0(e.t1),a=r.encode(Date.now().toString()).slice(-4),(s=new Uint8Array(2))[0]=0,s[1]=1,c=dP(Uint8Array,n,i,a,s),e.next=14,hP.ab2b64str(c.buffer);case 14:return u=e.sent,e.abrupt("return",u);case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),CG=ke,OG=mh,xG=bd.exports.getWeakData,NG=zl,DG=Dt,PG=Te,MG=Et,UG=jl,LG=De,VG=dn.set,FG=dn.getterFor,BG=Gi.find,jG=Gi.findIndex,GG=CG([].splice),HG=0,zG=function(e){return e.frozen||(e.frozen=new KG)},KG=function(){this.entries=[]},WG=function(e,t){return BG(e.entries,(function(e){return e[0]===t}))};KG.prototype={get:function(e){var t=WG(this,e);if(t)return t[1]},has:function(e){return!!WG(this,e)},set:function(e,t){var r=WG(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=jG(this.entries,(function(t){return t[0]===e}));return~t&&GG(this.entries,t,1),!!~t}};var XG,qG={getConstructor:function(e,t,r,n){var i=e((function(e,i){NG(e,o),VG(e,{type:t,id:HG++,frozen:void 0}),PG(i)||UG(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=FG(t),s=function(e,t,r){var n=a(e),i=xG(DG(t),!0);return!0===i?zG(n).set(t,r):i[n.id]=r,e};return OG(o,{delete:function(e){var t=a(this);if(!MG(e))return!1;var r=xG(e);return!0===r?zG(t).delete(e):r&&LG(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!MG(e))return!1;var r=xG(e);return!0===r?zG(t).has(e):r&&LG(r,t.id)}}),OG(o,r?{get:function(e){var t=a(this);if(MG(e)){var r=xG(e);return!0===r?zG(t).get(e):r?r[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),i}},YG=ae,JG=ke,QG=mh,ZG=bd.exports,$G=_h,eH=qG,tH=Et,rH=zd,nH=dn.enforce,iH=Br,oH=!YG.ActiveXObject&&"ActiveXObject"in YG,aH=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},sH=$G("WeakMap",aH,eH);if(iH&&oH){XG=eH.getConstructor(aH,"WeakMap",!0),ZG.enable();var cH=sH.prototype,uH=JG(cH.delete),dH=JG(cH.has),lH=JG(cH.get),hH=JG(cH.set);QG(cH,{delete:function(e){if(tH(e)&&!rH(e)){var t=nH(this);return t.frozen||(t.frozen=new XG),uH(this,e)||t.frozen.delete(e)}return uH(this,e)},has:function(e){if(tH(e)&&!rH(e)){var t=nH(this);return t.frozen||(t.frozen=new XG),dH(this,e)||t.frozen.has(e)}return dH(this,e)},get:function(e){if(tH(e)&&!rH(e)){var t=nH(this);return t.frozen||(t.frozen=new XG),dH(this,e)?lH(this,e):t.frozen.get(e)}return lH(this,e)},set:function(e,t){if(tH(e)&&!rH(e)){var r=nH(this);r.frozen||(r.frozen=new XG),dH(this,e)?hH(this,e,t):r.frozen.set(e,t)}else hH(this,e,t);return this}})}var fH=function(e){f(T,e);var t,r,n,i,a,s,d,p,_,v,y,S,b,E=g(T);function T(){var e;return u(this,T),h(m(e=E.call(this)),"inited",!1),h(m(e),"deviceMap",{audioinput:new Map,audiooutput:new Map,videoinput:new Map}),e._handleDeviceChange=e._handleDeviceChange.bind(m(e)),!lP()&&e.refreshDevices(),e}return l(T,[{key:"refreshDevices",value:(b=c(o().mark((function e(){var t,r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices){e.next=2;break}return e.abrupt("return");case 2:if(t=void 0,!_P){e.next=7;break}return e.next=6,navigator.mediaDevices.getUserMedia({audio:!0});case 6:t=e.sent;case 7:return e.next=9,navigator.mediaDevices.enumerateDevices();case 9:r=e.sent,t&&t.getTracks().forEach((function(e){return e.stop()})),r.forEach((function(e){var t;e.deviceId&&(null===(t=n.deviceMap[e.kind])||void 0===t||t.set(e.deviceId,e))})),this.inited||this.initListener(),this.inited=!0;case 14:case"end":return e.stop()}}),e,this)}))),function(){return b.apply(this,arguments)})},{key:"initListener",value:(S=c(o().mark((function e(){var t,r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"function"==typeof(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.addEventListener)&&navigator.mediaDevices.addEventListener("devicechange",(function(){r._handleDeviceChange(),setTimeout((function(){r._handleDeviceChange()}),300)}));case 1:case"end":return e.stop()}}),e)}))),function(){return S.apply(this,arguments)})},{key:"_handleDeviceChange",value:(y=c(o().mark((function e(){var t,r,n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=void 0,!_P){e.next=5;break}return e.next=4,navigator.mediaDevices.getUserMedia({audio:!0});case 4:t=e.sent;case 5:return e.next=7,navigator.mediaDevices.enumerateDevices();case 7:r=e.sent,t&&t.getTracks().forEach((function(e){return e.stop()})),n=Array.from([].concat(k(this.deviceMap.audioinput.values()),k(this.deviceMap.videoinput.values()),k(this.deviceMap.audiooutput.values()))),r.forEach((function(e){var t=i.deviceMap[e.kind].get(e.deviceId);i.deviceMap[e.kind].set(e.deviceId,e),t||(e.kind.includes("video")?i.emit(ne.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):e.kind.includes("audio")&&i.emit(ne.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),n.forEach((function(e){r.find((function(t){return t.deviceId===e.deviceId&&t.kind===e.kind}))||(i.deviceMap[e.kind].delete(e.deviceId),e.kind.includes("video")?i.emit(ne.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):e.kind.includes("audio")&&i.emit(ne.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))}));case 12:case"end":return e.stop()}}),e,this)}))),function(){return y.apply(this,arguments)})},{key:"getVideoPermission",value:(v=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._getVideoPermission(),e.next=3,this.refreshDevices();case 3:return e.abrupt("return",t);case 4:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"_getVideoPermission",value:(_=c(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getNavigatorPermission("camera");case 2:if(!e.sent){e.next=4;break}return e.abrupt("return",!0);case 4:if(r=!1,null===(t=navigator.mediaDevices)||void 0===t||!t.getUserMedia){e.next=8;break}return e.next=8,navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),r=!0)})).catch((function(){}));case 8:return e.abrupt("return",r);case 9:case"end":return e.stop()}}),e,this)}))),function(){return _.apply(this,arguments)})},{key:"getAudioPermission",value:(p=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._getAudioPermission(),e.next=3,this.refreshDevices();case 3:return e.abrupt("return",t);case 4:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"_getAudioPermission",value:(d=c(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getNavigatorPermission("microphone");case 2:if(!e.sent){e.next=4;break}return e.abrupt("return",!0);case 4:if(r=!1,null===(t=navigator.mediaDevices)||void 0===t||!t.getUserMedia){e.next=8;break}return e.next=8,navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),r=!0)})).catch((function(){}));case 8:return e.abrupt("return",r);case 9:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"enumerateDevices",value:(s=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getVideoPermission();case 2:return e.next=4,this._getAudioPermission();case 4:return e.abrupt("return",Array.from([].concat(k(this.deviceMap.audioinput.values()),k(this.deviceMap.videoinput.values()),k(this.deviceMap.audiooutput.values()))));case 5:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"enumerateAudioCaptureDevices",value:(a=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getAudioPermission();case 2:return e.abrupt("return",Array.from(this.deviceMap.audioinput.values()));case 3:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"enumerateVideoCaptureDevices",value:(i=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getVideoPermission();case 2:return e.abrupt("return",Array.from(this.deviceMap.videoinput.values()));case 3:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"enumerateAudioPlaybackDevices",value:(n=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getAudioPermission();case 2:return e.abrupt("return",Array.from(this.deviceMap.audiooutput.values()));case 3:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"getDeviceById",value:(r=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.enumerateDevices();case 2:return r=e.sent,e.abrupt("return",r.find((function(e){return e.deviceId===t})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_getNavigatorPermission",value:(t=c(o().mark((function e(t){var r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!1,null===(r=navigator.permissions)||void 0===r||!r.query){e.next=12;break}return e.prev=2,e.next=5,navigator.permissions.query({name:t});case 5:i=e.sent,a=i.state,n="granted"===a,e.next=12;break;case 10:e.prev=10,e.t0=e.catch(2);case 12:return e.abrupt("return",n);case 13:case"end":return e.stop()}}),e,null,[[2,10]])}))),function(e){return t.apply(this,arguments)})}]),T}(DU),pH=new fH,_H=function(){function e(){u(this,e),h(this,"_audioContextInstance",void 0)}return l(e,[{key:"getAudioContextInstance",value:function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance}}]),e}(),vH=function(){function e(t){u(this,e),h(this,"_ctx",void 0),h(this,"_analyserNode",void 0),h(this,"_audioSource",void 0);var r=yH.getAudioContextInstance();if(t instanceof MediaStreamTrack){var n=new MediaStream;n.addTrack(t),this._audioSource=r.createMediaStreamSource(n)}else t instanceof AudioNode?this._audioSource=t:(this._audioSource=r.createMediaElementSource(t),this._audioSource.connect(r.destination));var i=r.createAnalyser();this._audioSource.connect(i),this._analyserNode=i,this._ctx=r}return l(e,[{key:"getAudioLevel",value:function(){var e;"suspended"===(null===(e=this._ctx)||void 0===e?void 0:e.state)&&this._ctx.resume();var t=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(t);var r=0;return t.forEach((function(e){return r=Math.max(r,Math.abs(e-128))})),r/128*255}},{key:"destroy",value:function(){this._audioSource.disconnect(),this._analyserNode.disconnect()}}]),e}(),mH=function(){function e(t){u(this,e),h(this,"_gainNode",void 0),h(this,"_audioDestination",void 0),h(this,"_audioSource",void 0);var r=yH.getAudioContextInstance();this._audioDestination=r.createMediaStreamDestination();var n=new MediaStream;n.addTrack(t),this._audioSource=r.createMediaStreamSource(n),this._gainNode=r.createGain(),this._audioSource.connect(this._gainNode).connect(this._audioDestination)}return l(e,[{key:"setVolumeGain",value:function(e){this._gainNode.gain.value=e}},{key:"getAudioTrack",value:function(){return this._audioDestination.stream.getAudioTracks()[0]}},{key:"destroy",value:function(){this._audioSource.disconnect(),this._gainNode.disconnect()}}]),e}(),yH=new _H,gH=new xU("VERTC",0),SH=new WeakMap,bH=function(e){return SH.get(e)},EH=function(e){f(r,e);var t=g(r);function r(e,n){var i;return u(this,r),h(m(i=t.call(this)),"mediaType",void 0),h(m(i),"_trackId",void 0),i._trackId=e,i.mediaType=n,i}return l(r,[{key:"getId",value:function(){return this._trackId}}]),r}(DU),kH=function(e){f(r,e);var t=g(r);function r(e,n,i){var o;return u(this,r),h(m(o=t.call(this,n,i)),"_mediaTrack",void 0),o._mediaTrack=e,o._initListeners(),o}return l(r,[{key:"getTrack",value:function(){return this._mediaTrack}},{key:"setTrack",value:function(e){this._mediaTrack=e}},{key:"close",value:function(){var e;return null===(e=this._mediaTrack)||void 0===e?void 0:e.stop()}},{key:"_initListeners",value:function(){var e=this;this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",(function(){yB.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))}}]),r}(EH),TH=function(e){f(r,e);var t=g(r);function r(e,n,i){var o;return u(this,r),h(m(o=t.call(this,n,i)),"_mediaTrack",void 0),o._mediaTrack=e,o}return l(r,[{key:"getTrack",value:function(){return this._mediaTrack}}]),r}(EH),IH=function(e){f(n,e);var t,r=g(n);function n(e,t){var i;return u(this,n),h(m(i=r.call(this,e,t,"video")),"resolution",void 0),h(m(i),"videoCaptureConfig",void 0),h(m(i),"dummy",!1),i.resolution={width:0,height:0},i}return l(n,[{key:"updateVideoCaptureConfig",value:(t=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.videoCaptureConfig&&this.getTrack()){e.next=2;break}return e.abrupt("return");case 2:return gH.print("updateVideoEncoderConfig","update localVideoTrack: ",this.videoCaptureConfig),delete i({},this.videoCaptureConfig).contentHint,e.next=7,this.getTrack().applyConstraints(this.videoCaptureConfig);case 7:((t=this.getTrack().getSettings()).width&&t.width!==this.resolution.width||t.height&&t.height!==this.resolution.height)&&(this.resolution={width:t.width,height:t.height},this.emit("resolution-change",this.resolution));case 9:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"replaceTrack",value:function(e){this.setTrack(e)}},{key:"setContentHint",value:function(e){this._mediaTrack&&"contentHint"in this._mediaTrack&&["text","motion","detail"].includes(e)&&(this._mediaTrack.contentHint=e)}}]),n}(kH),AH=function(e){f(n,e);var t,r=g(n);function n(e,t){var i;return u(this,n),h(m(i=r.call(this,e,t,"audio")),"audioCaptureConfig",void 0),h(m(i),"_audioLevelFetcher",void 0),h(m(i),"mixedAudioTrack",void 0),h(m(i),"mixType",ee.PLAYOUT_AND_PUBLISH),h(m(i),"_audioVolumeGain",void 0),h(m(i),"gainAudioTrack",void 0),i}return l(n,[{key:"getPublishTrack",value:function(){var e=null==this?void 0:this.getTrack();return(null==this?void 0:this.mixType)!==ee.PLAYOUT&&null!=this&&this.mixedAudioTrack?e=null==this?void 0:this.mixedAudioTrack:null!=this&&this.gainAudioTrack&&(e=this.gainAudioTrack),e}},{key:"setCaptureVolume",value:function(e){this._audioVolumeGain||(this._audioVolumeGain=new mH(this.getTrack()),this.gainAudioTrack=this._audioVolumeGain.getAudioTrack()),this._audioVolumeGain.setVolumeGain(e/100)}},{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new vH(this.getTrack())),this._audioLevelFetcher.getAudioLevel()}},{key:"updateAudioCaptureConfig",value:(t=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.audioCaptureConfig){e.next=2;break}return e.abrupt("return");case 2:return gH.print("updateAudioCaptureConfig","update localAudioTrack: ",this.audioCaptureConfig),e.next=5,null===(t=this.getTrack())||void 0===t?void 0:t.applyConstraints(this.audioCaptureConfig);case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),n}(kH),RH=function(e){f(r,e);var t=g(r);function r(e,n){return u(this,r),t.call(this,e,n,"video")}return l(r)}(TH),wH=function(e){f(r,e);var t=g(r);function r(e,n){var i;return u(this,r),h(m(i=t.call(this,e,n,"audio")),"_audioLevelFetcher",void 0),i}return l(r,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new vH(this.getTrack())),this._audioLevelFetcher.getAudioLevel()}}]),r}(TH),CH=function(e){f(r,e);var t=g(r);function r(){return u(this,r),t.apply(this,arguments)}return l(r)}(AH),OH=function(e){f(r,e);var t=g(r);function r(){return u(this,r),t.apply(this,arguments)}return l(r)}(IH),xH=function(e){f(r,e);var t=g(r);function r(){return u(this,r),t.apply(this,arguments)}return l(r)}(IH),NH=function(e){f(r,e);var t=g(r);function r(){return u(this,r),t.apply(this,arguments)}return l(r)}(AH),DH=function(e){f(r,e);var t=g(r);function r(){return u(this,r),t.apply(this,arguments)}return l(r)}(IH),PH=function(e){f(r,e);var t=g(r);function r(){return u(this,r),t.apply(this,arguments)}return l(r)}(AH);function MH(e){return UH.apply(this,arguments)}function UH(){return(UH=c(o().mark((function e(t){var r,n,i,a,s,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=(null==t||null===(r=t.deviceId)||void 0===r?void 0:r.exact)||"default",e.prev=1,gH.print("createCameraVideoTrack","constraints:",t),yB.rtcVideoCaptureEvent({event_type:pB.START,media_device_id:i}),a=uP(),e.next=7,navigator.mediaDevices.getUserMedia({video:t});case 7:n=e.sent,yB.rtcVideoCaptureEvent({event_type:pB.START_CAPTURE_RESULT,media_device_id:i,reason:_B.SUCCESS,elapse:uP()-a}),pH.refreshDevices(),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(1),yB.rtcVideoCaptureEvent({event_type:pB.RUNNING_FAILED,media_device_id:i,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new JN(qN.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",e.t0);case 16:return s=n.getVideoTracks()[0],SH.set(s,n),(c=new OH(s,cP())).videoCaptureConfig=t,e.abrupt("return",c);case 21:case"end":return e.stop()}}),e,null,[[1,12]])})))).apply(this,arguments)}function LH(e,t){return VH.apply(this,arguments)}function VH(){return VH=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return gH.print("createCameraVideoTrack","constraints:",t),a=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",c=(s=r||{}).sampleRate,u=s.channel,d=s.agc,l=s.ans,h=s.aec,void 0===t.sampleRate&&(t.sampleRate=c),void 0===t.channelCount&&(t.channelCount=u),void 0===t.autoGainControl&&(t.autoGainControl=d),void 0===t.noiseSuppression&&(t.noiseSuppression=l),void 0===t.echoCancellation&&(t.echoCancellation=h),e.prev=8,yB.rtcVideoCaptureEvent({event_type:pB.START,media_device_id:a}),f=uP(),e.next=13,navigator.mediaDevices.getUserMedia({audio:t});case 13:i=e.sent,yB.rtcVideoCaptureEvent({event_type:pB.START_CAPTURE_RESULT,media_device_id:a,reason:_B.SUCCESS,elapse:uP()-f}),pH.refreshDevices(),e.next=22;break;case 18:throw e.prev=18,e.t0=e.catch(8),yB.rtcVideoCaptureEvent({event_type:pB.RUNNING_FAILED,media_device_id:a,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new JN(qN.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",e.t0);case 22:return p=i.getAudioTracks()[0],SH.set(p,i),e.abrupt("return",new CH(p,cP()));case 25:case"end":return e.stop()}}),e,null,[[8,18]])}))),VH.apply(this,arguments)}function FH(){return BH.apply(this,arguments)}function BH(){return BH=c(o().mark((function e(){var t,r,n,i,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.length>0&&void 0!==a[0]&&a[0],r=a.length>1?a[1]:void 0,gH.print("createScreenTracks","withAudio: %o, constraints: %o",t,r),e.prev=3,yB.rtcVideoCaptureEvent({event_type:pB.START,media_device_id:"screen"}),i=uP(),e.next=8,navigator.mediaDevices.getDisplayMedia({video:!(r&&!vP)||r,audio:!!t&&{channelCount:2,noiseSuppression:!1,echoCancellation:!1,autoGainControl:!1}});case 8:n=e.sent,yB.rtcVideoCaptureEvent({event_type:pB.START_CAPTURE_RESULT,media_device_id:"screen",reason:_B.SUCCESS,elapse:uP()-i}),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(3),yB.rtcVideoCaptureEvent({event_type:pB.RUNNING_FAILED,media_device_id:"screen",error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new JN(qN.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",e.t0);case 16:return e.abrupt("return",n);case 17:case"end":return e.stop()}}),e,null,[[3,12]])}))),BH.apply(this,arguments)}var jH=function(e){return e[e.NONE=0]="NONE",e}(jH||{}),GH=function(){function e(){u(this,e)}return l(e,null,[{key:"getNalunits",value:function(t){if(t.length-t.position<4)return[];var r=t.position;return 1===t.getInt32(r)||0===t.getInt16(r)&&1===t.getInt8(r+2)?e.getAnnexbNals(t):e.getAvccNals(t)}},{key:"getAnnexbNals",value:function(t){for(var r=[],n=e.getHeaderPositionAnnexB(t),i=n.pos,o=i;i<t.length-4;){var a=new Uint8Array(t.buffer.slice(i,i+n.headerLength));n.pos===t.position&&t.skip(n.headerLength),o=(n=e.getHeaderPositionAnnexB(t)).pos;var s={header:a,body:new Uint8Array(t.buffer.slice(i+a.byteLength,o)),type:-1};e.analyseNal(s),s.type<=9&&0!==s.type&&r.push(s),t.skip(o-t.position),i=o}return r}},{key:"getAvccNals",value:function(t){for(var r=[];t.position<t.length-4;){var n=t.getInt32(t.position);if(!(t.length-t.position>=n))break;var i=new Uint8Array(t.buffer.slice(t.position,t.position+4));t.skip(4);var o=new Uint8Array(t.buffer.slice(t.position,t.position+n));t.skip(n);var a={header:i,body:o,type:-1};e.analyseNal(a),a.type<=9&&0!==a.type&&r.push(a)}return r}},{key:"analyseNal",value:function(e){var t=31&e.body[0];switch(e.type=t,t){case 1:e.ndr=!0;break;case 5:e.idr=!0;break;case 6:e.sei=!0;break;case 7:e.sps=!0;break;case 8:e.pps=!0}}},{key:"getHeaderPositionAnnexB",value:function(e){for(var t=e.position,r=0,n=e.length;3!==r&&4!==r&&t<n-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:1===e.getInt8(t+2)?r=3:t++:t++;return t===n-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:t=n:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?r=3:t=n)),{pos:t,headerLength:r}}},{key:"getAvcc",value:function(e,t){var r=new Uint8Array(e.byteLength+t.byteLength+11);r[0]=1,r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=255,r[5]=225;var n=6;return r.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),n),n+=2,r.set(e,n),r[n+=e.byteLength]=1,n++,r.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),n),n+=2,r.set(t,n),r}}]),e}(),HH=function(){function e(t){u(this,e),h(this,"_position",0),h(this,"_dataview",void 0),this._dataview=new DataView(t)}return l(e,[{key:"length",get:function(){return this.buffer.byteLength}},{key:"buffer",get:function(){return this._dataview.buffer}},{key:"position",get:function(){return this._position},set:function(e){this._position=e}},{key:"back",value:function(e){this.position-=e}},{key:"getUint8",value:function(e){return this._dataview.getUint8(e)}},{key:"getInt8",value:function(e){return this._dataview.getInt8(e)}},{key:"getInt16",value:function(e){return this._dataview.getInt16(e)}},{key:"getUint16",value:function(e){return this._dataview.getUint16(e)}},{key:"getUint32",value:function(e){return this._dataview.getUint32(e)}},{key:"getInt32",value:function(e){return this._dataview.getInt32(e)}},{key:"skip",value:function(t){for(var r=Math.floor(t/4),n=t%4,i=0;i<r;i++)e.readByte(this,4);n>0&&e.readByte(this,n)}},{key:"readUint8",value:function(){return e.readByte(this,1)}},{key:"readUint16",value:function(){return e.readByte(this,2)}},{key:"readUint24",value:function(){return e.readByte(this,3)}},{key:"readUint32",value:function(){return e.readByte(this,4)}},{key:"readUint64",value:function(){return e.readByte(this,8)}},{key:"readInt8",value:function(){return e.readByte(this,1,!0)}},{key:"readInt16",value:function(){return e.readByte(this,2,!0)}},{key:"readInt32",value:function(){return e.readByte(this,4,!0)}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}}],[{key:"readByte",value:function(e,t,r){var n;switch(t){case 1:n=r?e.getInt8(e.position):e.getUint8(e.position);break;case 2:n=r?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(r)throw new Error("not supported for readByte 3");n=e.getUint8(e.position)<<16,n|=e.getUint8(e.position+1)<<8,n|=e.getUint8(e.position+2);break;case 4:n=r?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(r)throw new Error("not supported for readBody 8");n=e.getUint32(e.position)<<32,n|=e.getUint32(e.position+4);break;default:n=""}return e.position+=t,n}}]),e}(),zH=function(e){return e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass",e}(zH||{}),KH=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),WH=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]),XH=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]&&t.push(3),t.push(e[r]);return new Uint8Array(t)};function qH(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function YH(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=0;255===e[t]&&t<e.byteLength;)t++,r+=255;return t<e.byteLength&&(r+=e[t++]),[r,t]}var JH=function(){function e(){u(this,e)}return l(e,null,[{key:"generateSEI",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=new Uint8Array([0,0,0,1]),n=new Uint8Array([6]),i=new Uint8Array([5]),o=t?KH:WH,a=qH(e.byteLength+o.byteLength),s=XH(e);return new Uint8Array([].concat(k(r),k(n),k(i),k(a),k(o),k(s),[128]))}},{key:"decodeSeiBody",value:function(e){var t=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]||t.push(e[r]);return new Uint8Array(t)}(e=e.slice(0,e.length-1));if(!(t.byteLength<2)){var r=0;if(5===t[1]||100===t[1]){var n=E(YH(t,r+=2),2),i=n[0],o=2,a=(r=n[1])+i;return t.byteLength>=WH.byteLength&&i>=WH.byteLength&&t.slice(r,r+WH.byteLength).toString()===WH.toString()?(r+=WH.byteLength,o=1):t.byteLength>=WH.byteLength&&i>=WH.byteLength&&t.slice(r,r+KH.byteLength).toString()===KH.toString()&&(r+=KH.byteLength,o=0),{type:o,payload:t.slice(r,a)}}}}},{key:"parseInternalSEI",value:function(e){var t=new Map,r=0;if(0===e.type){for(;e.payload.byteLength-r>=2;){var n=E(YH(e.payload,r),2),i=n[0];r=n[1];var o=E(YH(e.payload,r),2),a=o[0];if(r=o[1],t.get(i)||!(a<e.payload.byteLength-r))break;t.set(i,e.payload.slice(r,r+a))}return t}}},{key:"makeInternalSei",value:function(e){var t,r=[],n=A(e);try{for(n.s();!(t=n.n()).done;){var i=E(t.value,2),o=i[0],a=i[1],s=qH(o),c=qH(a.byteLength);r.push(s,c,a)}}catch(lV){n.e(lV)}finally{n.f()}var u=r.reduce((function(e,t){return e+t.byteLength}),0),d=new Uint8Array(u);return r.reduce((function(e,t){return d.set(t,e),e+t.byteLength}),0),d}}]),e}(),QH=function(){function e(t){u(this,e),h(this,"_stream",void 0),h(this,"_timer",void 0),h(this,"client",void 0),h(this,"handler",void 0),h(this,"monitor",void 0),this._stream=t}return l(e,[{key:"setVar",value:function(e,t,r){this.client=e,this.handler=t,this.monitor=r}},{key:"delStatsEvtInterval",value:function(){clearTimeout(this._timer),this._timer=void 0}},{key:"destroy",value:function(){this.delStatsEvtInterval()}}]),e}(),ZH=function(e){f(i,e);var t,r,n=g(i);function i(e){var t;return u(this,i),(t=n.call(this,e))._stream=e,t}return l(i,[{key:"setLocalStreamStatsEvtInterval",value:function(e,t,r){var n,i,a,s=this;if(!this._timer){this.setVar(e,t,r),e.once(ej.ABNORMAL_DISCONNECTION,(function(){s.destroy()}));var u={audio:{},video:{}},d=this._stream,l=null===(n=d.audioTrack)||void 0===n?void 0:n.getPublishTrack(),h=null===(i=d.videoTrack)||void 0===i?void 0:i.getTrack();this.getAudioStats(l,u,null===(a=d.audioTrack)||void 0===a?void 0:a.getAudioLevel()),this.getVideoStats(h,u),this.delStatsEvtInterval();var f=function(){var e=c(o().mark((function e(){var t,r,n,i,a,c,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null===(t=d.audioTrack)||void 0===t?void 0:t.getPublishTrack(),a=null===(r=d.videoTrack)||void 0===r?void 0:r.getTrack(),e.next=4,s.getAudioStats(i,u,null===(n=d.audioTrack)||void 0===n?void 0:n.getAudioLevel());case 4:return c=e.sent,e.next=7,s.getVideoStats(a,u);case 7:return l=e.sent,e.abrupt("return",{audioStats:c,videoStats:l,isScreen:d.isScreen});case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),p=function(){var e=c(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,f();case 2:r=e.sent,null===(t=s.client)||void 0===t||t.emit("onLocalStreamStats",r),s._timer=setTimeout(p,2e3);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();this._timer=setTimeout(p,2e3)}}},{key:"unpublish",value:function(){this.delStatsEvtInterval()}},{key:"getAudioStats",value:(r=c(o().mark((function e(t,r,n){var i,a,s,c,u,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i={},a={timestamp:Date.now()},s=this._stream,c=s.streamId,u=s.audioMid,d=s.isScreen,l=s.pubAttributes,h={media_type:"audio",is_screen:!!d,direction:"up",stream_id:c,vid:u,connection_status:navigator.onLine,capture_state:l.localaudio?"capture_state_on":"capture_state_off"},t&&this.handler){e.next=6;break}return e.abrupt("return",i);case 6:return e.next=8,this.handler.getStats(t);case 8:if((f=e.sent).length){e.next=11;break}return e.abrupt("return",i);case 11:if(f.forEach((function(e){var t=e.type,r=e.packetsSent,n=e.packetsLost,o=e.bytesSent,s=e.clockRate,c=e.roundTripTime,u=e.channels,d=e.audioLevel,l=e.googRtt,f=e.mimeType,p=e.availableIncomingBitrate,_=e.availableOutgoingBitrate,v=e.bytesReceived,m=e.nominated,y=e.id,g=e.currentRoundTripTime,S=e.state,b=e.writable,E=e.requestsReceived,k=e.responsesReceived,T=e.requestsSent,I=e.consentRequestsSent,A=e.responsesSent,R=e.jitter,w=e.candidateType,C=e.ip,O=e.address,x=e.networkType,N=e.port,D=e.protocol,P=e.nackCount,M=e.retransmittedBytesSent,U=e.retransmittedPacketsSent,L=e.roundTripTimeMeasurements,V=e.audioInputLevel,F=e.ssrc,B=e.totalAudioEnergy,j=e.totalSamplesDuration,G=e.mediaType,H=e.fractionLost;"outbound-rtp"===t?(a.packetsSent=r,a.bytesSent=o,h.bytes=o,h.packetsSent=r,h.nackCount=P,h.ssrc=F,h.retransmitted_bytes_sent=M,h.retransmitted_packets_sent=U,a.retransmittedPacketsSent=U):"remote-inbound-rtp"===t?(a.packetsLost=n,h.packetsLost=n,h.jitter=1e3*R,i.rtt=1e3*c,h.rtt=i.rtt,h.round_trip_time_measurements=L,i._fractionLost=H||0):"codec"===t?(i.recordSampleRate=s,i.numChannels=u,h.codecName=f):"media-source"===t&&void 0!==d?(h.audio_level=d?-10*Math.log10(Math.pow(d,2)):d,h.volume=255*d,h.total_audio_energy=B,h.total_samples_duration=j):"ssrc"===t&&"audio"===G?(h.audio_network_elapse=l,h.send_level=V):"candidate-pair"===t?(h.ice_available_incoming_bitrate=p,h.ice_available_outgoing_bitrate=_,h.ice_bytes_received=v,h.ice_bytes_sent=o,h.ice_nominated=+m,h.ice_pair_id=y,h.ice_pair_rtt=g,h.ice_pair_state=S,h.ice_pair_writable=b,h.recv_ping_requests=E,h.recv_ping_responses=k,h.sent_ping_requests_before_first_response=T,h.sent_ping_requests_total=T+(I||0),h.sent_ping_responses=A):"local-candidate"===t?(h.local_candidate_type=w,h.local_ip=C||O,h.local_network_type=x,h.local_port=N,h.protocol=D):"remote-candidate"===t&&(h.remote_candidate_type=w,h.remote_ip=C||O,h.remote_port=N)})),void 0===h.volume&&void 0!==n&&(h.volume=n,h.audio_level=n?-10*Math.log10(Math.pow(n/255,2)):n),(p=r.audio).timestamp){e.next=17;break}return r.audio=a,e.abrupt("return",i);case 17:return void 0!==a.packetsLost&&(i.audioLossRate=(a.packetsLost-p.packetsLost)/(a.packetsSent-p.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,h.fraction_lost=i.audioLossRate),i.statsInterval=a.timestamp-p.timestamp,h.stats_interval=i.statsInterval,i.sendKBitrate=(a.bytesSent-p.bytesSent||0)/i.statsInterval*8,h.bitrate=Math.round(1e3*i.sendKBitrate),h.bandwidth=Math.round(h.bitrate/1024),r.audio=a,this.monitor.rtcMediaStatistics(h,{}),i._retransmittedRate=(a.retransmittedPacketsSent-p.retransmittedPacketsSent)/(a.packetsSent-p.packetsSent),i._fractionLost=Math.max(i._fractionLost,i.audioLossRate),e.abrupt("return",i);case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"getVideoStats",value:(t=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f,p,_,v,m;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={timestamp:Date.now(),simulcast:{}},a=this._stream,s=a.streamId,c=a.videoMid,u=a.isScreen,d=a.pubAttributes,l=a.enableSimulcast,h={media_type:"video",is_screen:!!u,direction:"up",stream_id:s,vid:c,connection_status:navigator.onLine,capture_state:d.localvideo?"capture_state_on":"capture_state_off"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return n.isScreen=u,e.next=9,this.handler.getStats(t);case 9:if((f=e.sent).length){e.next=12;break}return e.abrupt("return",n);case 12:if(p=0,f.forEach((function(e){var t=e.type,r=e.framesEncoded,o=e.packetsLost,a=e.bytesSent,s=e.framesSent,c=e.roundTripTime,u=e.mimeType,d=e.frameWidth,f=e.frameHeight,_=e.packetsSent,v=e.googActualEncBitrate,m=e.googAvailableReceiveBandwidth,y=e.googAvailableSendBandwidth,g=e.googAvgEncodeMs,S=e.googBucketDelay,b=e.googEncodeUsagePercent,E=e.googFrameRateInput,k=e.availableIncomingBitrate,T=e.availableOutgoingBitrate,I=e.bytesReceived,A=e.nominated,R=e.id,w=e.currentRoundTripTime,C=e.state,O=e.writable,x=e.candidateType,N=e.ip,D=e.address,P=e.networkType,M=e.port,U=e.nackCount,L=e.pliCount,V=e.protocol,F=e.qpSum,B=e.requestsReceived,j=e.responsesReceived,G=e.googRetransmitBitrate,H=e.requestsSent,z=e.consentRequestsSent,K=e.responsesSent,W=e.ssrc,X=e.googTargetEncBitrate,q=e.googTransmitBitrate,Y=e.googRtt,J=e.retransmittedPacketsSent,Q=e.encoderImplementation,Z=e.jitter,$=e.rid,ee=e.fractionLost;"outbound-rtp"===t?(l&&($?i.simulcast[$]=e:i.simulcast[p]=e,p++),i.framesEncoded=r,i.bytesSent=a,i.framesSent=s,h.bytes=a,i.packetsSent=_,h.packetsSent=_,h.nackCount=U,h.pli_count=L,h.qp_sum=F,h.ssrc=W,h.retransmitted_packets_sent=J,i.retransmittedPacketsSent=J,h.encoder_implementation=Q,void 0!==d&&(n.encodedFrameWidth=d,n.encodedFrameHeight=f,h.frame_size_height=f,h.frame_size_width=d)):"track"===t?(n.encodedFrameWidth=d,n.encodedFrameHeight=f,h.frame_size_height=f,h.frame_size_width=d):"remote-inbound-rtp"===t?(i.packetsLost=o,n.rtt=1e3*c,h.rtt=n.rtt,h.jitter=Z,h.packetsLost=o,n._fractionLost=ee||0):"codec"===t?(n.codecType=u,h.codecName=u):"candidate-pair"===t?(h.ice_available_incoming_bitrate=k,h.ice_available_outgoing_bitrate=T,h.ice_bytes_received=I,h.ice_bytes_sent=a,h.ice_nominated=+A,h.ice_pair_id=R,h.ice_pair_rtt=w,h.ice_pair_state=C,h.ice_pair_writable=O,h.recv_ping_requests=B,h.recv_ping_responses=j,h.sent_ping_requests_before_first_response=H,h.sent_ping_requests_total=H+z,h.sent_ping_responses=K):"local-candidate"===t?(h.local_candidate_type=x,h.local_ip=N||D,h.local_network_type=P,h.local_port=M,h.protocol=V):"remote-candidate"===t?(h.remote_candidate_type=x,h.remote_ip=N||D,h.remote_port=M):"VideoBwe"===t?(h.encBitratebps=v,h.available_receive_bandwidth=m,h.available_send_bandwidth=y,h.bucket_delay=S,h.retransmitBitratebps=G,h.targetEncBitratebps=X,h.transmit_bitrate=q,n._sendBandWidth=+y):"ssrc"===t&&(h.video_network_elapse=Y,h.avg_encode_ms=g,h.encodeUsage=b,h.frame_rate_input=E,h.orignal_input_Framerate=+E)})),(_=r.video).timestamp){e.next=18;break}return r.video=i,e.abrupt("return",n);case 18:return n.statsInterval=i.timestamp-_.timestamp,h.stats_interval=n.statsInterval,v=Object.keys(i.simulcast),l?(h.sim_enc_width=[],h.sim_enc_height=[],h.sim_enc_bps=[],h.sim_enc_framerate=[],h.sim_rids=[],h.sim_enc_bandwidth=[],h.sim_sent_framerate=[],h.sim_fraction_lost=[],m=!1,v.sort((function(e,t){return+e-+t})).forEach((function(e){var t=i.simulcast[e],r=t.frameWidth,o=t.frameHeight,a=t.bytesSent,s=t.framesEncoded,c=t.framesSent,u=t.packetsLost,d=t.packetsSent,l=t.qualityLimitationReason,f=t.qualityLimitationDurations,p=t.qualityLimitationResolutionChanges,v=t.retransmittedPacketsSent;void 0!==l&&(h.sim_qualityLimitationReason||(h.sim_qualityLimitationReason=[],h.sim_qualityLimitationDurations=[],h.sim_qualityLimitationResolutionChanges=[]),h.sim_qualityLimitationReason.push(l),h.sim_qualityLimitationDurations.push(f),h.sim_qualityLimitationResolutionChanges.push(p));var y=_.simulcast[e];if(h.sim_enc_width.push(r||0),h.sim_enc_height.push(o||0),y){var g=(a-y.bytesSent||0)/n.statsInterval;h.sim_enc_bps.push(Math.round(8e3*g)),h.sim_enc_bandwidth.push(Math.round(8e3*g/1024));var S=1e3*(s-y.framesEncoded)/n.statsInterval;h.sim_enc_framerate.push(Math.round(S)),h.sim_rids.push(e);var b=void 0!==c?c-y.framesSent:s-y.framesEncoded,E=1e3*b/n.statsInterval;h.sim_sent_framerate.push(Math.round(E));var k=(u-y.packetsLost)/(d-y.packetsSent);n._retransmittedRate=(v-y.retransmittedPacketsSent)/(d-y.packetsSent),k=Number.isNaN(k)?0:k,h.sim_fraction_lost.push(k),r>0&&!m&&(n.sentKBitrate=8*g,n.encoderOutputFrameRate=S,n.encodedFrameCount=b,n.sentFrameRate=E,n.videoLossRate=k,m=!0)}})),this.monitor.rtcMediaStatistics(h,{})):(n.encodedFrameCount=void 0!==i.framesSent?i.framesSent-_.framesSent:i.framesEncoded-_.framesEncoded,n.sentKBitrate=(i.bytesSent-_.bytesSent||0)/n.statsInterval*8,h.bitrate=Math.round(1e3*n.sentKBitrate),h.bandwidth=Math.round(h.bitrate/1024),n.encoderOutputFrameRate=1e3*(i.framesEncoded-_.framesEncoded)/n.statsInterval,h.frame_rate_encoded=Math.round(n.encoderOutputFrameRate),n.sentFrameRate=1e3*n.encodedFrameCount/n.statsInterval,h.frame_rate_sent=Math.round(n.sentFrameRate),n.videoLossRate=(i.packetsLost-_.packetsLost)/(i.packetsSent-_.packetsSent),n.videoLossRate=Number.isNaN(n.videoLossRate)?0:n.videoLossRate,h.fraction_lost=n.videoLossRate,n._retransmittedRate=(i.retransmittedPacketsSent-_.retransmittedPacketsSent)/(i.packetsSent-_.packetsSent),this.monitor.rtcMediaStatistics(h,{})),r.video=i,n._fractionLost=Math.max(n._fractionLost,n.videoLossRate),e.abrupt("return",n);case 25:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),i}(QH),$H=function(e){f(a,e);var t,r,n,i=g(a);function a(e){var t;return u(this,a),h(m(t=i.call(this,e)),"_audioStallCount",void 0),h(m(t),"_setAudioStallCount",void 0),h(m(t),"_audioStallTimer",void 0),h(m(t),"_audioStallInterval",void 0),h(m(t),"_audioStallRatio",void 0),h(m(t),"_videoInWaiting",void 0),t._videoInWaiting=!1,t}return l(a,[{key:"setRemoteStreamStatsEvtInterval",value:(n=c(o().mark((function e(t,r,n){var i,s,u,d,l,h,f,p,_,v,m,y,g,S,b=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._timer){e.next=2;break}return e.abrupt("return");case 2:return this.setVar(t,r,n),t.once(ej.ABNORMAL_DISCONNECTION,(function(){b.destroy()})),this._audioStallInterval=a.audioStallInterval||100,this._audioStallRatio=a.audioStallRatio||.6,u={audio:{},video:{}},d=this._stream,l=null===(i=d.audioTrack)||void 0===i?void 0:i.getTrack(),h=null===(s=d.videoTrack)||void 0===s?void 0:s.getTrack(),this.getRemoteVideoStats(h,u),e.next=13,this.getRemoteAudioStats(l,u);case 13:this.delStatsEvtInterval(),f=0,p=0,v=[],m=0,y=uP(),this._setAudioStallCount=function(){if(b._audioStallInterval>0&&void 0!==u.audio.concealedSamples){var e=u.audio.concealedSamples,t=u.audio.totalSamplesReceived;y=uP();var r={isStall:!1,counted:!1,diff:0},n=.5*b._audioStallInterval;b._audioStallCount=c(o().mark((function i(){var a,s,c,u,l,h,_,g,S,E,k,T,I,A,R;return o().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(s=d.hasAudio,c=d.subAudio,s&&c){i.next=7;break}return r.isStall=!1,r.counted=!1,v.push({reason:"hasAudio: ".concat(s,", subAudio: ").concat(c)}),y=uP(),i.abrupt("return",{stall_count:f,stall_duration:p,stall_list:v,stats_count:m});case 7:return u=null===(a=d.audioTrack)||void 0===a?void 0:a.getTrack(),l=Date.now(),i.next=11,b.handler.getStats(u,!0);case 11:if(h=i.sent,_=Date.now(),g=uP(),!((S=g-y)<n)){i.next=18;break}return v.push({diff:S,start:y,end:g,get_stats_cost:_-l,get_stats_start:l,get_stats_end:_,reason:"diff(".concat(S,") < minInterval(").concat(n,")")}),i.abrupt("return",{stall_count:f,stall_duration:p,stall_list:v,stats_count:m});case 18:if(E=h.length,k=h.find((function(e){return"inbound-rtp"===e.type}))){i.next=23;break}return v.push({diff:S,start:y,end:g,get_stats_cost:_-l,get_stats_start:l,get_stats_end:_,reason:E?"no inbound-rtp":"no report"}),i.abrupt("return",{stall_count:f,stall_duration:p,stall_list:v,stats_count:m});case 23:return T=k.concealedSamples,I=k.totalSamplesReceived,R=I-t,(A=T-e)>=0&&R>=0&&A>=b._audioStallRatio*R?(v.push({concealed:A,received:R,diff:S,start:y,end:g,get_stats_cost:_-l,get_stats_start:l,get_stats_end:_,is_stall:!0}),r.isStall?(r.counted?p+=S:(p=p+r.diff+S,f++),r.counted=!0):S>=200?(p+=S,f++,r.counted=!0):(r.counted=!1,r.diff=S),r.isStall=!0):(v.push({concealed:A,received:R,diff:S,start:y,end:g,get_stats_cost:_-l,get_stats_start:l,get_stats_end:_}),r.isStall=!1,r.counted=!1),e=T,t=I,y=g,m++,i.abrupt("return",{stall_count:f,stall_duration:p,stall_list:v,stats_count:m});case 32:case"end":return i.stop()}}),i)}))),_=function(){var e=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!b._audioStallCount&&b._setAudioStallCount&&b._setAudioStallCount(),!b._audioStallCount){e.next=5;break}return e.next=4,b._audioStallCount();case 4:b._audioStallTimer=setTimeout(_,b._audioStallInterval);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),b._audioStallTimer=setTimeout(_,b._audioStallInterval)}},this._setAudioStallCount(),g=function(){var e=c(o().mark((function e(){var t,r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null===(t=d.audioTrack)||void 0===t?void 0:t.getTrack(),i=null===(r=d.videoTrack)||void 0===r?void 0:r.getTrack(),e.next=4,b.getRemoteAudioStats(n,u);case 4:return a=e.sent,f=0,p=0,v=[],m=0,e.next=11,b.getRemoteVideoStats(i,u);case 11:return s=e.sent,e.abrupt("return",{audioStats:a,videoStats:s,isScreen:d.isScreen,userId:d.userId});case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),S=function(){var e=c(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g();case 2:r=e.sent,null===(t=b.client)||void 0===t||t.emit("onRemoteStreamStats",r),_&&(y=uP(),b._audioStallTimer=setTimeout(_,b._audioStallInterval)),b._timer=setTimeout(S,2e3);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this._timer=setTimeout(S,2e3);case 24:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"delStatsEvtInterval",value:function(){b(p(a.prototype),"delStatsEvtInterval",this).call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0}},{key:"unsubscribe",value:function(){this.delStatsEvtInterval(),this._videoInWaiting=!1}},{key:"getRemoteAudioStats",value:(r=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f,p,_,v,m,y,g,S,b;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={},a=this._stream,s=a.streamId,c=a.userId,u=a.isScreen,d=a.audioMid,l=a.subMediaType,h=a._attributes,f={media_type:"audio",is_screen:!!u,direction:"down",stream_id:s,stream_user_id:c,vid:d,connection_status:navigator.onLine,mute_state:IP(l)?"mute_state_off":"mute_state_on",remote_user_capture_state:h.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:h.localaudio&&h.audiostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return e.next=8,this.handler.getStats(t);case 8:if((p=e.sent).length){e.next=11;break}return e.abrupt("return",n);case 11:if(p.forEach((function(e){var t=e.type,r=e.packetsLost,o=e.packetsReceived,a=e.bytesReceived,s=e.jitterBufferDelay,c=e.jitterBufferEmittedCount,u=e.clockRate,d=e.channels,l=e.totalSamplesReceived,h=e.concealedSamples,p=e.silentConcealedSamples,_=e.concealmentEvents,v=e.totalRoundTripTime,m=e.state,y=e.currentRoundTripTime,g=e.audioLevel,S=e.totalAudioEnergy,b=e.totalSamplesDuration,E=e.mimeType,k=e.googDecodingNormal,T=e.fecPacketsReceived,I=e.availableIncomingBitrate,A=e.availableOutgoingBitrate,R=e.bytesSent,w=e.nominated,C=e.id,O=e.writable,x=e.jitter,N=e.candidateType,D=e.ip,P=e.address,M=e.networkType,U=e.port,L=e.protocol,V=e.audioOutputLevel,F=e.requestsReceived,B=e.responsesReceived,j=e.requestsSent,G=e.consentRequestsSent,H=e.responsesSent,z=e.ssrc;e.kind,"inbound-rtp"===t?(i.packetsLost=r,i.packetsReceived=o,f.packetsReceived=o,i.bytesReceived=a,f.bytes=a,void 0!==s&&(n.jitterBufferDelay=s/c*1e3,f.average_jitter_buffer_delay_ms=n.jitterBufferDelay),void 0!==l&&(i.totalSamplesReceived=l,n.concealedSamples=h,i.concealedSamples=h,i.silentConcealedSamples=p,f.concealedSamples=h,n.concealmentEvents=_,f.totalSamplesReceived=l),void 0!==T&&(f.fec_packets_received=T),f.jitter=1e3*x,f.ssrc=z):"codec"===t?(n.recordSampleRate=u,d&&(n.numChannels=d),f.codecName=E):"candidate-pair"===t?(f.ice_available_incoming_bitrate=I,f.ice_available_outgoing_bitrate=A,f.ice_bytes_received=a,f.ice_bytes_sent=R,f.ice_nominated=+w,f.ice_pair_id=C,f.ice_pair_rtt=y,f.rtt=1e3*y,f.ice_pair_state=m,f.ice_pair_writable=O,f.recv_ping_requests=F,f.recv_ping_responses=B,f.sent_ping_requests_before_first_response=j,f.sent_ping_requests_total=j+(G||0),f.sent_ping_responses=H,"succeeded"===m&&(n.rtt=1e3*y,n.total_rtt=1e3*v)):"track"===t&&void 0!==g?(f.audio_level=g?-10*Math.log10(Math.pow(g,2)):g,f.volume=255*g,f.total_audio_energy=S,f.totalAudioDuration=b):"ssrc"===t?(f.decodingNormal=k,f.recvAudioLevel=V):"local-candidate"===t?(f.local_candidate_type=N,f.local_ip=D||P,f.local_network_type=M,f.local_port=U,f.protocol=L):"remote-candidate"===t&&(f.remote_candidate_type=N,f.remote_ip=D||P,f.remote_port=U)})),(_=r.audio).timestamp){e.next=17;break}return i.timestamp=Date.now(),r.audio=i,e.abrupt("return",n);case 17:if(v={},void 0!==i.concealedSamples&&(f.interval_concealed_samples=i.concealedSamples-_.concealedSamples,f.interval_samples_received=i.totalSamplesReceived-_.totalSamplesReceived,f.interval_silent_concealed_samples=i.silentConcealedSamples-_.silentConcealedSamples),!(this._audioStallInterval>0&&void 0!==_.concealedSamples)){e.next=35;break}if(!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),clearTimeout(this._audioStallTimer),!this._audioStallCount){e.next=35;break}return e.next=25,this._audioStallCount();case 25:m=e.sent,y=m.stall_count,g=m.stall_duration,S=m.stall_list,b=m.stats_count,v.stall_list=S,v.stats_count=b,f.concealedSamples===f.interval_concealed_samples&&f.totalSamplesReceived===f.interval_samples_received?(f.stall_count=0,f.stall_duration=0):(f.stall_count=y,f.stall_duration=g),n.stallCount=f.stall_count,n.stallDuration=f.stall_duration;case 35:return i.timestamp=Date.now(),n.audioLossRate=(i.packetsLost-_.packetsLost)/(i.packetsReceived-_.packetsReceived+(i.packetsLost-_.packetsLost)),n.audioLossRate=Number.isNaN(n.audioLossRate)?0:n.audioLossRate,f.packetsLost=Math.round(i.packetsLost-_.packetsLost),f.fraction_lost=n.audioLossRate,f.packets_lost_rate=n.audioLossRate,n.statsInterval=i.timestamp-_.timestamp,f.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-_.bytesReceived||0)/n.statsInterval*8,f.bitrate=Math.round(1e3*n.receivedKBitrate),f.bandwidth=Math.round(f.bitrate/1024),void 0!==i.concealedSamples&&(n.receivedSampleRate=1e3*f.interval_samples_received/n.statsInterval),r.audio=i,this.monitor.rtcMediaStatistics(f,{},v),e.abrupt("return",n);case 50:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getRemoteVideoStats",value:(t=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={timestamp:Date.now()},a=this._stream,s=a.streamId,c=a.userId,u=a.isScreen,d=a.subMediaType,l=a._attributes,h={media_type:"video",is_screen:!!u,direction:"down",stream_id:s,stream_user_id:c,vid:this._stream.videoMid,connection_status:navigator.onLine,mute_state:AP(d)?"mute_state_off":"mute_state_on",remote_user_capture_state:l.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:l.localvideo&&l.videostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return n.isScreen=u,e.next=9,this.handler.getStats(t);case 9:if((f=e.sent).length){e.next=12;break}return e.abrupt("return",n);case 12:if(f.forEach((function(e){var t=e.type,r=e.frameHeight,o=e.frameWidth,a=e.packetsLost,s=e.packetsReceived,c=e.bytesReceived,u=e.framesDecoded,d=e.jitterBufferDelay,l=e.jitterBufferEmittedCount,f=e.mimeType,p=e.firCount,_=e.availableIncomingBitrate,v=e.availableOutgoingBitrate,m=e.bytesSent,y=e.nominated,g=e.id,S=e.currentRoundTripTime,b=e.state,E=e.writable,k=e.candidateType,T=e.ip,I=e.address,A=e.networkType,R=e.port,w=e.nackCount,C=e.pliCount,O=e.protocol,x=e.requestsReceived,N=e.responsesReceived,D=e.requestsSent,P=e.consentRequestsSent,M=e.responsesSent,U=e.ssrc;e.kind;var L=e.jitter,V=e.framesReceived,F=e.keyFramesDecoded,B=e.totalDecodeTime,j=e.decoderImplementation,G=e.lastPacketReceivedTimestamp;"inbound-rtp"===t?(i.packetsLost=a,h.packetsLost=a,i.packetsReceived=s,h.packetsReceived=s,i.bytesReceived=c,h.bytes=c,i.framesDecoded=u,void 0!==d&&(i.jitterBufferDelay=d/l*1e3,h.average_jitter_buffer_delay_ms=i.jitterBufferDelay),h.fir_count=p,h.nackCount=w,i.nackCount=w,h.pli_count=C,h.ssrc=U,h.jitter=L,h.framesReceived=V,i.framesReceived=V,h.framesDecoded=u,h.key_frames_decoded=F,h.total_decode_time=B,h.decoder_name=j,h.last_packet_received_timestamp=G,void 0!==o&&(n.width=o,h.frame_size_width=o,n.height=r,h.frame_size_height=r)):"track"===t&&void 0!==o?(n.width=o,h.frame_size_width=o,n.height=r,h.frame_size_height=r,void 0!==V&&(h.framesReceived=V,i.framesReceived=V)):"codec"===t?h.codecName=f:"candidate-pair"===t?(h.ice_available_incoming_bitrate=_,h.ice_available_outgoing_bitrate=v,h.ice_bytes_received=c,h.ice_bytes_sent=m,h.ice_nominated=+y,h.ice_pair_id=g,h.ice_pair_rtt=S,h.rtt=1e3*S,n.rtt=h.rtt,h.ice_pair_state=b,h.ice_pair_writable=E,h.recv_ping_requests=x,h.recv_ping_responses=N,h.sent_ping_requests_before_first_response=D,h.sent_ping_requests_total=D+(P||0),h.sent_ping_responses=M):"local-candidate"===t?(h.local_candidate_type=k,h.local_ip=T||I,h.local_network_type=A,h.local_port=R,h.protocol=O):"remote-candidate"===t&&(h.remote_candidate_type=k,h.remote_ip=T||I,h.remote_port=R)})),(p=r.video).timestamp){e.next=17;break}return r.video=i,e.abrupt("return",n);case 17:return n.videoLossRate=(i.packetsLost-p.packetsLost)/(i.packetsReceived-p.packetsReceived+(i.packetsLost-p.packetsLost)),n._retransmittedRate=(i.nackCount-p.nackCount)/(i.packetsReceived-p.packetsReceived+(i.packetsLost-p.packetsLost)),n.videoLossRate=Number.isNaN(n.videoLossRate)?0:n.videoLossRate,h.fraction_lost=n.videoLossRate,h.packets_lost_rate=n.videoLossRate,n.statsInterval=i.timestamp-p.timestamp,h.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-p.bytesReceived||0)/n.statsInterval*8,h.bitrate=Math.round(1e3*n.receivedKBitrate),h.bandwidth=Math.round(h.bitrate/1024),n.decoderOutputFrameRate=1e3*(i.framesDecoded-p.framesDecoded)/n.statsInterval,n.receivedFrameRate=1e3*(i.framesReceived-p.framesReceived)/n.statsInterval,h.frame_rate_decoded=Math.round(n.decoderOutputFrameRate),h.frame_rate_received=h.frame_rate_decoded,r.video=i,this.processStall(this._stream,h,n,u),this.monitor.rtcMediaStatistics(h,{}),e.abrupt("return",n);case 35:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"processStall",value:function(e,t,r,n){var i=0,o=0,a=0;if(e.recordedVideoFrames){e.recordedVideoFrames.forEach((function(e){e.isStall&&(i+=e.stallCount,o+=e.stallDuration),a=e.playTime})),e.recordedVideoFrames.length||(o=2e3,i=this._videoInWaiting?0:1,this._videoInWaiting=!0);var s=e.recordedVideoFrames.pop();s&&(s.isStall?this._videoInWaiting=!0:this._videoInWaiting=!1),e.recordedVideoFrames=[]}t.stall_count=i,n?(t.stuck_length=o,t.stall_duration=void 0):(t.stall_duration=o,t.stuck_length=void 0),t.play_time=a,r.stallCount=i,r.stallDuration=o}},{key:"destroy",value:function(){b(p(a.prototype),"destroy",this).call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1}}],[{key:"audioStallConfig",set:function(e){a.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,a.audioStallRatio=null==e?void 0:e.audio_stall_ratio}}]),a}(QH);h($H,"audioStallInterval",void 0),h($H,"audioStallRatio",void 0);var ez,tz,rz,nz=function(e){return e.RESUBSCRIBE="resubscribe",e.STREAM_FAILED="stream_failed",e.SUBSCRIBE_PUSH_TRACK="subscribe_push_track",e.REMOVE_PUSH_TRACK="remove_push_track",e.VIDEO_FIRST_FRAME="video_first_frame",e.ON_USER_PUBLISH_STATE_CHANGE="on_user_publish_state_change",e.ON_USER_START_AUDIO_CAPTURE="on_user_start_audio_capture",e.ON_USER_STOP_AUDIO_CAPTURE="on_user_stop_audio_capture",e.ON_USER_START_VIDEO_CAPTURE="on_user_start_video_capture",e.ON_USER_STOP_VIDEO_CAPTURE="on_user_stop_video_capture",e.ON_SEI_MESSAGED_RECEIVED="on_sei_messaged_received",e.ON_PUBLISH_RESULT="on_publish_result",e.ON_UPDATE_TOKEN_SUCCESS="on_update_token_success",e.ON_REMOTE_STREAM_STATS="ON_REMOTE_STREAM_STATS",e.ON_LOCAL_STREAM_STATS="ON_LOCAL_STREAM_STATS",e.ON_USER_LEAVE="on_user_leave",e.ON_ROOM_ERROR="on_room_error",e.ON_NETWORK_QUALITY="on_network_quality",e.ON_SIMULCAST_SUBSCRIBE_FALLBACK="on_simulcast_subscribe_fallback",e.ON_REMOTE_VIDEO_SIZE_CHANGED="on_remote_video_size_changed",e.RECONNECT_FAILED="reconnect_failed",e.ON_VIDEO_STREAM_BANNED="ON_VIDEO_STREAM_BANNED",e.ON_AUDIO_STREAM_BANNED="ON_AUDIO_STREAM_BANNED",e}(nz||{}),iz=function(e){return e[e.START=1]="START",e[e.START_SUCCESS=2]="START_SUCCESS",e[e.START_FAILED=3]="START_FAILED",e[e.UPDATE=4]="UPDATE",e[e.UPDATE_SUCCESS=5]="UPDATE_SUCCESS",e[e.UPDATE_FAILED=6]="UPDATE_FAILED",e[e.STOP=7]="STOP",e[e.STOP_SUCCESS=8]="STOP_SUCCESS",e[e.STOP_FAILED=9]="STOP_FAILED",e}(iz||{}),oz=function(e){return e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB",e}(oz||{}),az=function(e){return e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB",e}(az||{}),sz=new xU("Stream",0),cz=function(e){return e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED",e}(cz||{}),uz=function(){function e(){u(this,e),h(this,"isScreen",!1),h(this,"stream",void 0),h(this,"streamId",void 0),h(this,"audioMid",void 0),h(this,"videoMid",void 0),h(this,"seiList",[]),h(this,"videoTrack",void 0),h(this,"audioTrack",void 0),h(this,"videoTransceiver",void 0),h(this,"audioTransceiver",void 0),h(this,"videoInputConfig",void 0),h(this,"videoEncodeConfig",[qB]),h(this,"subVideoDescriptions",[]),h(this,"enableSimulcast",!1),h(this,"observer",void 0),h(this,"statsReport",void 0),h(this,"prevScaleResolutionDownBy",1),h(this,"pubAudio",!1),h(this,"pubVideo",!1),h(this,"pubAttributes",void 0),this.stream=new MediaStream,this.videoInputConfig={width:640,height:360,frameRate:30},this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},this.statsReport=new ZH(this)}return l(e,[{key:"hasPublished",get:function(){return this.videoTransceiver&&this.audioTransceiver}},{key:"isEmptyStream",get:function(){return!this.audioTrack&&!this.videoTrack}},{key:"initStreamId",get:function(){return this.stream.id}},{key:"initVideoEncodedTransform",value:function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(xj()){var r=t.createEncodedStreams(),n=r.readable,i=r.writable,o=new TransformStream({transform:function(t,r){var n=e.seiList[0];if(n){var i=JH.generateSEI(n.content),o=new Uint8Array(i.byteLength+t.data.byteLength);0===n.repeatCount&&e.seiList.splice(0,1),n.repeatCount--,o.set(new Uint8Array(t.data)),o.set(i,t.data.byteLength),t.data=o.buffer,r.enqueue(t)}else r.enqueue(t)}});n.pipeThrough(o).pipeTo(i)}}else sz.print("no sender found when trying to bind encodedTransform")}},{key:"initAudioEncodedTransform",value:function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else sz.print("no sender found when trying to bind encodedTransform")}},{key:"clean",value:function(){var e;this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy(),this.prevScaleResolutionDownBy=1,this.subVideoDescriptions=[]}},{key:"switchTrackEnableState",value:function(e,t){var r,n;"audio"===e?n=this.audioTrack:"video"===e&&(n=this.videoTrack);var i=null===(r=n)||void 0===r?void 0:r.getTrack();return!(!i||(null==i?void 0:i.enabled)===t)&&(i.enabled=t,!0)}}]),e}(),dz=function(e){f(r,e);var t=g(r);function r(e,n,i,o){var a,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:W.LOW;return u(this,r),h(m(a=t.call(this)),"streamId",void 0),h(m(a),"userId",void 0),h(m(a),"isScreen",void 0),h(m(a),"hasVideo",void 0),h(m(a),"hasAudio",void 0),h(m(a),"_attributes",void 0),h(m(a),"streamState",void 0),h(m(a),"observer",void 0),h(m(a),"statsReport",void 0),h(m(a),"subVideo",void 0),h(m(a),"subAudio",void 0),h(m(a),"subMediaType",void 0),h(m(a),"subLayer",void 0),h(m(a),"audioMid",void 0),h(m(a),"videoMid",void 0),h(m(a),"autosubAudioMid",void 0),h(m(a),"autosubVideoMid",void 0),h(m(a),"_sequenceId",void 0),h(m(a),"stream",void 0),h(m(a),"videoTrack",void 0),h(m(a),"audioTrack",void 0),h(m(a),"videoTransceiver",void 0),h(m(a),"audioTransceiver",void 0),h(m(a),"recordedVideoFrames",void 0),h(m(a),"stillExist",void 0),h(m(a),"_workaround_1_",void 0),h(m(a),"paused",void 0),h(m(a),"originalMediaType",void 0),h(m(a),"originalStreamIndex",0),a.userPriority=s,a.userId=e,a.isScreen=i,a.streamId=n,a.hasAudio=o.audiostream&&o.localaudio,a.hasVideo=o.videostream&&o.localvideo,a._attributes=o,a.subVideo=!1,a.subAudio=!1,a._sequenceId=0,a.subMediaType=jH.NONE,a.subLayer={spatialLayer:0,spatialSubLayer:-1},a.streamState=0,a.statsReport=new $H(m(a)),a}return l(r,[{key:"sequenceId",get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)}},{key:"hasSubscribed",get:function(){return 2===this.streamState}},{key:"attributes",get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e}},{key:"initVideoEncodedTransform",value:function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),r=t.readable,n=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){GH.getNalunits(new HH(t.data)).forEach((function(t){if(t.sei){var r=JH.decodeSeiBody(t.body);r&&r.type!==zH.internal&&e.safeEmit("onSEIMessage",r.payload)}})),r.enqueue(t)}})).pipeTo(n)}else sz.print("no receiver found when trying to bind encodedTransform")}},{key:"initAudioEncodedTransform",value:function(){if(this.audioTransceiver&&this.audioTransceiver.receiver){var e=this.audioTransceiver.receiver.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else sz.print("no receiver found when trying to bind encodedTransform")}},{key:"ontrack",value:function(e){var t,r;if((null===(t=e.streams)||void 0===t||null===(r=t[0])||void 0===r?void 0:r.id)===this.streamId){var n,i=e.track;"video"===(null==i?void 0:i.kind)?this._setVideoTrack(i):"audio"===(null===(n=e.track)||void 0===n?void 0:n.kind)&&this._setAudioTrack(i),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)}},{key:"clean",value:function(){var e;sz.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=void 0,this.paused=!1,this._workaround_1_=!1,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy()}},{key:"resetHasSubscribed",value:function(){this.streamState=0}},{key:"setRemoteUserPriority",value:function(e){this.userPriority=e}},{key:"getStreamPriority",value:function(){var e=this.isScreen?20:this.hasAudio||this.hasVideo?this.attributes.videoDescriptions.length>1?10-this.subLayer.spatialLayer:9:0;return 1e4*this.userPriority+100*e}},{key:"getSubscribeFallbackParams",value:function(e){if(e!==K.DISABLE&&this.subVideo){if(this.attributes.videoDescriptions.length-1>this.subLayer.spatialLayer)return[this.originalMediaType,az.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer+1)];if(e===K.AUDIO_ONLY)return[L.VIDEO,az.UNSUB]}return null}},{key:"getSubscribeRecoverParams",value:function(){if(this.originalMediaType&&AP(this.originalMediaType)){if(!1===this.subVideo)return[this.originalMediaType,az.SUB,this.subLayer];if("number"==typeof this.originalStreamIndex&&this.subLayer.spatialLayer>this.originalStreamIndex)return[this.originalMediaType,az.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer-1)]}return null}},{key:"_setStream",value:function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}}},{key:"_setAudioTrack",value:function(e){var t,r;(null===(t=this.audioTrack)||void 0===t||null===(r=t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.audioTrack=new wH(e,cP()),this.emit("ontrack",this.audioTrack))}},{key:"_setVideoTrack",value:function(e){var t,r;(null===(t=this.videoTrack)||void 0===t||null===(r=t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.videoTrack=new RH(e,cP()),this.emit("ontrack",this.videoTrack))}},{key:"_getSubLayerBySpatialLayer",value:function(e){var t=this._attributes,r=t.videoDescriptions,n=t.subVideoDescriptions,i=void 0===n?[]:n,o=r[e],a=o.width,s=o.height,c=i.find((function(e){return e.width===a&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==c?void 0:c.sub_index)||-1}}}]),r}(DU),lz=new xU("queue",4),hz=function(e){return e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE",e}(hz||{}),fz=function(e){return e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack",e}(fz||{}),pz=(h(ez={},"publish","unpublish"),h(ez,"subscribe","unsubscribe"),h(ez,"pushtrack","removetrack"),ez),_z=(h(tz={},"publish",0),h(tz,"subscribe",0),h(tz,"pushtrack",0),h(tz,"unpublish",1),h(tz,"unsubscribe",1),h(tz,"removetrack",1),tz),vz=function(e){f(r,e);var t=g(r);function r(){var e;return u(this,r),h(m(e=t.call(this)),"_queue",void 0),e._queue=[],e}return l(r,[{key:"queue",get:function(){return this._queue}},{key:"enqueue",value:function(e){var t=this._queue.length,r="";return this._queue=this._queue.filter((function(t){return t.streamId!==e.streamId||e.action!==pz[t.action]||(r=t.streamId,lz.print("offsetStreamId",r),!1)})),this._queue.length===t&&this._queue.push(e),this.emit("start"),r}},{key:"dequeue",value:function(){if(!this._queue.length)return null;for(var e=_z[this._queue[0].action],t=1;t<this._queue.length;t++)if(_z[this._queue[t].action]!==e)return{sdpStrategy:e,items:this._queue.splice(0,t)};return{sdpStrategy:e,items:this._queue.splice(0,this._queue.length)}}}]),r}(RU),mz=new xU("ChromeHandler",3),yz=xj(),gz=function(e){f(k,e);var r,n,a,s,d,_,v,y,S=g(k);function k(e,t){var r;return u(this,k),h(m(r=S.call(this,e,t)),"name","chrome"),h(m(r),"_queueBusy",!1),h(m(r),"_sdpQueue",void 0),h(m(r),"_aSendonlyOfferTpl",void 0),h(m(r),"_vSendonlyOfferTpl",void 0),h(m(r),"_aRecvonlyOfferTpl",void 0),h(m(r),"_vRecvonlyOfferTpl",void 0),h(m(r),"_mid",0),h(m(r),"_offerSession",void 0),h(m(r),"_answerSession",void 0),h(m(r),"_offerMlines",[]),h(m(r),"_answerMlines",[]),h(m(r),"_inactiveMlineIndex",[]),h(m(r),"_msidIndexMap",{}),h(m(r),"_mlinesCache",{}),r._sdpQueue=new vz,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(mz.print("dequeue start"),r.dequeue())})),r}return l(k,[{key:"connect",value:(y=c(o().mark((function e(t){var r,n,a,s,c,u,d,l=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return mz.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=4,IG(t);case 4:return this._answerIce=e.sent,e.next=7,this._peerConnection.createOffer();case 7:return a=e.sent,s=Uj.parse(a.sdp),c=E(s.media,1),u=c[0],this._offerIce.fingerprint=s.fingerprint||u.fingerprint,delete s.media,this._offerSession=i({},s),this._answerSession=i({},s),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),d=this._mid++,this._offerMlines=[i(i(i({},u),this._offerIce),{},{mid:"".concat(d)})],this._answerMlines=[i(i(i({},u),this._answerIce),{},{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(d)})],this.setDescription(),e.next=21,new Promise((function(e,t){l._dataChannel.onopen=function(){mz.print("connect","dataChannel open"),RB("es.dc.open",""),e("")},l._dataChannel.onerror=function(e){yB.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,WF.INVALID_DATA),RB("es.dc.error",""),t(e)},l._dataChannel.onclose=function(e){RB("es.dc.close",""),t(e)},l._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==l._peerConnection.iceConnectionState&&"closed"!==l._peerConnection.iceConnectionState&&"failed"!==l._peerConnection.connectionState||t(e)}))}));case 21:return mz.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 23:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){b(p(k.prototype),"destroy",this).call(this),this._mlinesCache={}}},{key:"publish",value:(v=c(o().mark((function e(t,r){var n,a,s,c,u,d,l,h,f,_,v,m,y,g,S,T,I,A,R,w;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.stream,a=t.enableSimulcast,s=b(p(k.prototype),"internalPublish",this).call(this,t,r),c=s.videoDescriptions,u=s.subVideoDescriptions,d=s.transceiverInit,l="".concat(this._mid++),h="".concat(this._mid++),f=i(i(i({},this._aSendonlyOfferTpl),this._offerIce),{},{mid:l,msid:"".concat(n.id," ").concat(n.id,"-audio"),ssrcs:bG(n,"audio")}),_=i(i(i({},this._vSendonlyOfferTpl),this._offerIce),{},{mid:h,msid:"".concat(n.id," ").concat(n.id,"-video")}),a?(mz.print("subVideoDesc","desc: %o ",u),delete _.ssrcGroups,delete _.ssrcs,v=[],_.rids=c.map((function(e){var t=e.rid;return v.unshift(t),{id:t,direction:"send"}})),_.simulcast={dir1:"send",list1:v.join(";")}):(m=EG(n,"video"),y=m.ssrcs,g=m.ssrcGroups,_.ssrcs=y,_.ssrcGroups=g),vP&&mP&&Array.isArray(_.ext)&&(_.ext=_.ext.filter((function(e){var t;return!(null!=e&&null!==(t=e.uri)&&void 0!==t&&t.includes("video-orientation"))}))),null!=r&&r.audioRed&&Array.isArray(f.rtp)&&-1!==(S=f.rtp.findIndex((function(e){return"red"===e.codec})))&&(T=f.rtp.splice(S,1),I=E(T,1),A=I[0],f.rtp.unshift(A)),(R=null==f?void 0:f.rtp.find((function(e){return"opus"===e.codec})))&&f.fmtp&&(w=f.fmtp.find((function(e){return e.payload===R.payload})))&&this._context&&(w.config+=this._context.audioProfileManager.getOpusConfigStr()),this.addBitrateLimit(_,t.videoEncodeConfig[0].maxKbps),this._mlinesCache[t.stream.id]=[f,_],e.abrupt("return",{partialSdp:TG(this._offerSession,f,_),audioMid:l,videoMid:h,type:"incroffer",semantics:"unified-plan",videoDescriptions:c,subVideoDescriptions:u,transceiverInit:d});case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"subscribe",value:(_=c(o().mark((function e(t,r){var n,a,s,c,u,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(mz.print("subscribe","mids: ",r),n="incroffer",a="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl){e.next=11;break}return e.next=6,EP(!0);case 6:if(s=e.sent){e.next=9;break}throw new JN(qN.NOT_SUPPORTED,"Get offer Error");case 9:return e.next=11,this.createAVMlineOfferTpl(s);case 11:if(!this._mlinesCache[t.streamId]){e.next=16;break}return c=E(this._mlinesCache[t.streamId],2),u=c[0],d=c[1],u.mid=t.audioMid,d.mid=t.videoMid,e.abrupt("return",{partialSdp:TG(this._offerSession,u,d),audioMid:u.mid,videoMid:d.mid,type:n,semantics:a});case 16:return l="".concat(this._mid++),h="".concat(this._mid++),f=i(i(i({},this._aRecvonlyOfferTpl),this._offerIce),{},{mid:l}),p=i(i(i({},this._vRecvonlyOfferTpl),this._offerIce),{},{mid:h}),this._mlinesCache[t.streamId]=[f,p],e.abrupt("return",{partialSdp:TG(this._offerSession,f,p),audioMid:l,videoMid:h,type:n,semantics:a,transceiverInit:{aTrack:"audio",vTrack:"video",audioTransceiverInit:{direction:"recvonly"},videoTransceiverInit:{direction:"recvonly"}}});case 22:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"handleAck",value:(d=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return mz.print("handleAck()","item: %o",t),e.abrupt("return",this._sdpQueue.enqueue(t));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"dequeue",value:(s=c(o().mark((function e(){var r,n,a,s,c,u,d,l,h,f,p,_=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._queueBusy=!0,r=this._sdpQueue.dequeue(),mz.print("dequeue()","ret: %o",r),r){e.next=6;break}return this._queueBusy=!1,e.abrupt("return");case 6:if(e.prev=6,n=r.items,a=r.sdpStrategy,s=[],c=[],a!==hz.ADD){e.next=14;break}return e.delegateYield(o().mark((function e(){var r,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete(r=i({},_._answerIce)).candidates,u=!1,d=!1,e.prev=4,h=t(n);case 6:return e.next=8,h.next();case 8:if(!(u=!(f=e.sent).done)){e.next=17;break}return a=f.value,e.delegateYield(o().mark((function e(){var t,n,u,d,l,h,f,p,v,m,y,g,S,b,k,T,I,A,R,w,C;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.action,n=a.transceiverInit,u=a.signalingAck,d=a.stream,!((l=d instanceof dz)&&(null==u?void 0:u.sequenceId)<d.sequenceId)){e.next=4;break}return e.abrupt("return","break");case 4:if(h={},f={},p=Uj.parse(u.sdp),Array.isArray(p.media)&&(v="",p.media.sort((function(e,t){var r;return null==e||null===(r=e.type)||void 0===r?void 0:r.localeCompare(null==t?void 0:t.type)})).forEach((function(e){"audio"===(e=i(i({},e),r)).type?(h=e,mz.print("audioMsid",e.msid),e.msid&&(v=e.msid.replace("audio","video"))):(f=e,mz.print("videoMsid",v),v&&(f.msid=v,v=""))}))),m=d.streamId,t===fz.publish&&(m=null===(y=d.stream)||void 0===y?void 0:y.id),_._mlinesCache[m]){e.next=12;break}return e.abrupt("return","break");case 12:if(g=E(_._mlinesCache[m],2),S=g[0],b=g[1],!n){e.next=30;break}d.audioTransceiver=_._peerConnection.addTransceiver(n.aTrack,n.audioTransceiverInit),d.videoTransceiver=_._peerConnection.addTransceiver(n.vTrack,n.videoTransceiverInit),(k=_._inactiveMlineIndex.shift())||(k=_._offerMlines.length),_._offerMlines[k]=i(i({},S),{},{mid:h.mid}),_._answerMlines[k]=h,(T=_._inactiveMlineIndex.shift())||(T=_._offerMlines.length),_._offerMlines[T]=i(i({},b),{},{mid:f.mid}),_._answerMlines[T]=f,_._msidIndexMap[d.streamId]=[k,T],yz&&(d.initAudioEncodedTransform(),d.initVideoEncodedTransform()),s.push(d.streamId||""),c.push(l?d.userId:"local"),e.next=48;break;case 30:if(!l){e.next=48;break}if(I=_._msidIndexMap[d.streamId]||[],A=E(I,2),R=A[0],w=A[1],!R||!w){e.next=47;break}if((null===(C=_._offerMlines[R])||void 0===C?void 0:C.mid)===h.mid){e.next=43;break}return _._offerMlines[R]=kG(_._offerMlines[R]),_._offerMlines[w]=kG(_._offerMlines[w]),_._answerMlines[R]=kG(_._answerMlines[R]),_._answerMlines[w]=kG(_._answerMlines[w]),e.next=40,_.setDescription();case 40:_._offerMlines[R]=i(i({},_._aRecvonlyOfferTpl),{},{mid:h.mid}),_._offerMlines[w]=i(i({},_._vRecvonlyOfferTpl),{},{mid:f.mid}),mz.print("enqueue","hack: %o",d.streamId);case 43:_._answerMlines[R]=h,_._answerMlines[w]=f,e.next=48;break;case 47:mz.print("dequeue","pushtrack before subscribe: %o",d.userId);case 48:l&&(d.sequenceId=null==u?void 0:u.sequenceId);case 49:case"end":return e.stop()}}),e)}))(),"t0",11);case 11:if("break"!==e.t0){e.next=14;break}return e.abrupt("break",17);case 14:u=!1,e.next=6;break;case 17:e.next=23;break;case 19:e.prev=19,e.t1=e.catch(4),d=!0,l=e.t1;case 23:if(e.prev=23,e.prev=24,!u||null==h.return){e.next=28;break}return e.next=28,h.return();case 28:if(e.prev=28,!d){e.next=31;break}throw l;case 31:return e.finish(28);case 32:return e.finish(23);case 33:case"end":return e.stop()}}),e,null,[[4,19,23,33],[24,,28,32]])}))(),"t0",12);case 12:e.next=19;break;case 14:p={},n.forEach((function(e){var t,r,n=e.audioMid,i=e.videoMid,o=e.stream;p[n]=n,p[i]=i,delete _._msidIndexMap[null===(t=e.stream)||void 0===t?void 0:t.streamId],o instanceof uz?delete _._mlinesCache[null==o||null===(r=o.stream)||void 0===r?void 0:r.id]:delete _._mlinesCache[null==o?void 0:o.streamId]})),this._offerMlines=this._offerMlines.map((function(e,t){return p[e.mid]&&(e=kG(e),_._inactiveMlineIndex.push(t)),e})),this._inactiveMlineIndex.sort((function(e,t){return e-t})),this._answerMlines=this._answerMlines.map((function(e){return p[e.mid]&&(e=kG(e)),e}));case 19:return e.next=21,this.setDescription(s.length?{streamId:s.join(","),streamUserId:c.join(",")}:void 0);case 21:mz.print("dequeue","loop"),e.next=27;break;case 24:e.prev=24,e.t1=e.catch(6),mz.print("dequeue","unknown error: %o",e.t1);case 27:return e.prev=27,this.dequeue(),e.finish(27);case 30:case"end":return e.stop()}}),e,this,[[6,24,27,30]])}))),function(){return s.apply(this,arguments)})},{key:"setDescription",value:(a=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return mz.print("setDescription","_offerMlines: %o, _answerMlines: %o",this._offerMlines,this._answerMlines),this._offerSession.media=this._offerMlines,this._answerSession.media=this._answerMlines,r=[],this._offerMlines.forEach((function(e){"inactive"!==e.direction&&r.push(e.mid)})),this._offerSession.groups&&this._answerSession.groups&&(this._offerSession.groups[0].mids=r.join(" "),this._answerSession.groups[0].mids=r.join(" ")),n=uP(),t&&yB.rtcBeginCreateOffer("local"===t.streamUserId?qF.UP:qF.DOWN,t.streamId,t.streamUserId),e.next=10,this._peerConnection.createOffer();case 10:return t&&yB.rtcCreateOffer(0,"local"===t.streamUserId?YF.UP:YF.DOWN,t.streamId,t.streamUserId,uP()-n),e.next=13,this.setLocalDescription(Uj.write(this._offerSession),t);case 13:return e.next=15,this.setRemoteDescription(Uj.write(this._answerSession),t);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"getDefaultSdp",value:(n=c(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,EP(!0);case 2:if(t=e.sent){e.next=5;break}throw new JN(qN.NOT_SUPPORTED,"Get offer Error");case 5:return this.createAVMlineOfferTpl(t),r=Uj.parse(t),n=[],r.media=r.media.filter((function(e){return"recvonly"===e.direction&&(n.push(e.mid+""),!0)})),r.groups=[{mids:n.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:Uj.write(r),semantics:"unified-plan",type:"offer"});case 11:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"rollback",value:(r=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete this._mlinesCache[t];case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;Uj.parse(e).media.forEach((function(e){"audio"===e.type?"sendonly"===e.direction?t._aSendonlyOfferTpl=e:t._aRecvonlyOfferTpl=e:"video"===e.type&&("sendonly"===e.direction?t._vSendonlyOfferTpl=e:t._vRecvonlyOfferTpl=e)}))}}]),k}(Mj),Sz=new xU("FirefoxHandler",3),bz=function(e){f(S,e);var t,r,n,a,s,d,_,v,y=g(S);function S(){var e;u(this,S);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return h(m(e=y.call.apply(y,[this].concat(r))),"name","firefox"),e}return l(S,[{key:"connect",value:(v=c(o().mark((function e(t){var r,n,a,s,c,u,d,l=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Sz.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=4,IG(t);case 4:return this._answerIce=e.sent,this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),e.next=9,this._peerConnection.createOffer();case 9:return a=e.sent,s=Uj.parse(a.sdp),c=E(s.media,1),u=c[0],this._offerIce.fingerprint=s.fingerprint||u.fingerprint,s.media=s.media.map((function(e){return i(i({},e),l._offerIce)})),(d=i({},s)).fingerprint=this._answerIce.fingerprint,d.media=d.media.map((function(e){return delete(e=i(i({},e),l._answerIce)).bundleOnly,e.port=9,"application"===e.type?e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}:e.direction="sendonly",e})),e.next=19,this.setLocalDescription(Uj.write(s));case 19:return e.next=21,this.setRemoteDescription(Uj.write(d));case 21:return e.next=23,new Promise((function(e,t){l._dataChannel.onopen=function(){Sz.print("connect","dataChannel open"),RB("es.dc.open",""),e("")},l._dataChannel.onerror=function(e){yB.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,WF.INVALID_DATA),RB("es.dc.error",""),t(e)},l._dataChannel.onclose=function(e){RB("es.dc.close",""),t(e)},l._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==l._peerConnection.iceConnectionState&&"closed"!==l._peerConnection.iceConnectionState&&"failed"!==l._peerConnection.connectionState||t(e)}))}));case 23:return Sz.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 25:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"publish",value:(_=c(o().mark((function e(t,r){var n,a,s,c,u,d,l,h,f,_,v,m,y,g=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=b(p(S.prototype),"internalPublish",this).call(this,t,r),c=s.videoDescriptions,u=s.subVideoDescriptions,d=s.transceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(d.aTrack,d.audioTransceiverInit),t.videoTransceiver=this._peerConnection.addTransceiver(d.vTrack,d.videoTransceiverInit),l=uP(),yB.rtcBeginCreateOffer(qF.UP,"",""),e.next=7,this._peerConnection.createOffer();case 7:return h=e.sent,yB.rtcCreateOffer(0,YF.UP,"","",uP()-l),(f=Uj.parse(h.sdp)).media=null===(n=f.media)||void 0===n?void 0:n.map((function(e){return i(i({},e),g._offerIce)})),e.next=13,this.setLocalDescription(Uj.write(f));case 13:return _=t.audioTransceiver.mid,v=t.videoTransceiver.mid,m=null,y=null,f.media=null===(a=f.media)||void 0===a?void 0:a.map((function(e){if("".concat(e.mid)===_){var t,r=null===(t=m=e)||void 0===t?void 0:t.rtp.find((function(e){return"opus"===e.codec}));if(r&&m.fmtp){var n=m.fmtp.find((function(e){return e.payload===r.payload}));n&&g._context&&(n.config+=g._context.audioProfileManager.getOpusConfigStr())}}else"".concat(e.mid)===v&&(y=e);return e})),this.addBitrateLimit(y,t.videoEncodeConfig[0].maxKbps),e.next=21,this.setLocalDescription(Uj.write(f));case 21:return e.abrupt("return",{partialSdp:TG(f,m,y),audioMid:_,videoMid:v,type:"incroffer",semantics:"unified-plan",videoDescriptions:c,subVideoDescriptions:u,transceiverInit:d});case 22:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"subscribe",value:(d=c(o().mark((function e(t){var r,n,a,s,c,u,d,l,h,f,p,_,v,m,y=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Sz.print("subscribe()"),!t.audioMid||!t.videoMid){e.next=11;break}return c=Uj.parse(null===(a=this._peerConnection.localDescription)||void 0===a?void 0:a.sdp),u=null,d=null,c.media.forEach((function(e){"".concat(e.mid)===t.audioMid?(u=e,t.autosubAudioMid&&(u.mid=t.autosubAudioMid)):"".concat(e.mid)===t.videoMid&&(d=e,t.autosubVideoMid&&(d.mid=t.autosubVideoMid))})),e.next=8,this._peerConnection.createOffer();case 8:return e.next=10,this.setLocalDescription(null===(s=this._peerConnection.localDescription)||void 0===s?void 0:s.sdp,{streamId:t.streamId||"",streamUserId:t.userId});case 10:return e.abrupt("return",{partialSdp:TG(c,u,d),audioMid:t.audioMid,videoMid:t.videoMid,autosubAudioMid:t.autosubAudioMid,autosubVideoMid:t.autosubVideoMid,type:"incroffer",semantics:"unified-plan"});case 11:return t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),l=uP(),yB.rtcBeginCreateOffer(qF.UP,t.streamId,t.userId),e.next=17,this._peerConnection.createOffer();case 17:return h=e.sent,yB.rtcCreateOffer(0,YF.UP,t.streamId,t.userId,uP()-l),(f=Uj.parse(h.sdp)).media=null===(r=f.media)||void 0===r?void 0:r.map((function(e){return i(i({},e),y._offerIce)})),e.next=23,this.setLocalDescription(Uj.write(f),{streamId:t.streamId||"",streamUserId:t.userId});case 23:return p=t.audioTransceiver.mid,_=t.videoTransceiver.mid,v=null,m=null,null===(n=f.media)||void 0===n||n.forEach((function(e){"".concat(e.mid)===p?v=e:"".concat(e.mid)===_&&(m=e)})),e.abrupt("return",{partialSdp:TG(f,v,m),audioMid:p,videoMid:_,type:"incroffer",semantics:"unified-plan"});case 29:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"handleAck",value:(s=c(o().mark((function e(t){var r,n,a,s,c,u,d,l,h,f=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.signalingAck,s=t.stream,(c=t.action)!==fz.unpublish&&c!==fz.unsubscribe&&c!==fz.removetrack){e.next=5;break}return e.next=4,this.close(s.streamId,s);case 4:return e.abrupt("return",s.streamId);case 5:return u={},(d=Uj.parse(null===(r=this._peerConnection.remoteDescription)||void 0===r?void 0:r.sdp)).media.forEach((function(e){void 0!==e.mid&&(u[e.mid]=e)})),Uj.parse(null==a?void 0:a.sdp).media.forEach((function(e){"audio"===(e=i(i({},e),f._answerIce)).type&&(s.audioMid?(e.mid=s.audioMid,u[s.audioMid]=e):u[e.mid]=e),"video"===e.type&&(s.videoMid?(e.mid=s.videoMid,u[s.videoMid]=e):u[e.mid]=e)})),l=Uj.parse(null===(n=this._peerConnection.localDescription)||void 0===n?void 0:n.sdp),h=l.media.map((function(e){var t=u[e.mid];return"inactive"===e.direction?e:t})),d.groups=l.groups,d.media=h,this.setRemoteDescription(Uj.write(d)),e.abrupt("return","");case 16:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"getDefaultSdp",value:(a=c(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Uj.parse(null===(t=this._peerConnection.localDescription)||void 0===t?void 0:t.sdp),n=[],r.media=r.media.filter((function(e){return"recvonly"===e.direction&&(n.push(e.mid+""),!0)})),r.groups=[{mids:n.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:Uj.write(r),semantics:"unified-plan",type:"offer"});case 5:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"rollback",value:(n=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.close(t,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"close",value:(r=c(o().mark((function e(t,r){var n,a,s,c,u,d,l=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Sz.print("close()"),!r.audioTransceiver||!r.videoTransceiver){e.next=19;break}return r.audioTransceiver.stop(),r.videoTransceiver.stop(),a=[],e.next=7,this._peerConnection.createOffer();case 7:return s=e.sent,(c=Uj.parse(null==s?void 0:s.sdp)).media=c.media.map((function(e){return"".concat(e.mid)!==r.audioMid&&"".concat(e.mid)!==r.videoMid||(e=kG(e)),"inactive"!==e.direction&&a.push(e.mid),i(i({},e),l._offerIce)})),u=Uj.parse(null===(n=this._peerConnection.remoteDescription)||void 0===n?void 0:n.sdp),d={},u.media.forEach((function(e){d[e.mid]=e})),u.media=c.media.map((function(e){return"inactive"===e.direction?e:d[e.mid]})),c.groups&&u.groups&&(c.groups[0].mids=a.join(" "),u.groups[0].mids=a.join(" ")),e.next=17,this.setLocalDescription(Uj.write(c));case 17:return e.next=19,this.setRemoteDescription(Uj.write(u));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._peerConnection.createOffer();case 2:if(!this._peerConnection.localDescription||!this._peerConnection.remoteDescription){e.next=7;break}return e.next=5,this._peerConnection.setLocalDescription(this._peerConnection.localDescription);case 5:return e.next=7,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription);case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),S}(Mj),Ez=function(e,t){return _P?new bz(e,t):new gz(e,t)},kz=new xU("Locker",2),Tz=1,Iz=function(){function e(t){u(this,e),h(this,"lockingPromise",Promise.resolve()),h(this,"locks",0),h(this,"name",""),h(this,"lockId",void 0),this.lockId=Tz++,t&&(this.name=t),kz.print("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}return l(e,[{key:"isLocked",get:function(){return this.locks>0}},{key:"lock",value:function(){var e,t=this;this.locks+=1,kz.print("[lock-".concat(this.name,"-").concat(this.lockId,"] locked, current queue ").concat(this.locks,"."));var r=new Promise((function(r){e=function(){t.locks-=1,kz.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),r()}})),n=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return r})),n}}]),e}(),Az=(h(rz={},Y.communication,[0]),h(rz,Y.chat,[0]),h(rz,Y.chatRoom,[1,"IES_chatroom"]),h(rz,Y.coHost,[1,"IES_PK"]),h(rz,Y.meeting,[16]),h(rz,Y.classRoom,[0]),rz),Rz=Object.defineProperty,wz=Object.getOwnPropertyDescriptor,Cz=function(e,t,r,n){for(var i,o=n>1?void 0:n?wz(t,r):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&Rz(t,r,o),o},Oz=new xU("MediaServerClient",2),xz=6e4,Nz=function(e){return e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting",e}(Nz||{}),Dz=function(e,t){Oz.print(e,"userId: %o, subAudio: %o, subVideo: %o, paused: %o, audioMid: %o, videoMid: %o, workaround_1_: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.paused,t.audioMid,t.videoMid,t._workaround_1_,t.sequenceId)},Pz=function(e){f(O,e);var t,r,n,a,s,d,p,_,v,y,S,b,k,T,I,A,R,w,C=g(O);function O(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:yB;return u(this,O),h(m(t=C.call(this)),"_token",void 0),h(m(t),"_appId",void 0),h(m(t),"_roomId",void 0),h(m(t),"_roomAttributes",void 0),h(m(t),"_clientId",void 0),h(m(t),"_businessId",void 0),h(m(t),"_userInfo",void 0),h(m(t),"_useCloudProxy",void 0),h(m(t),"_authorization",void 0),h(m(t),"_sessionId",void 0),h(m(t),"_iceConfigRequestManager",void 0),h(m(t),"_ontrackCallbackMap",new Map),h(m(t),"_subResolves",{}),h(m(t),"supportConcurrent",!1),h(m(t),"_handler",void 0),h(m(t),"_pubSubLock",void 0),h(m(t),"_joinLeaveLock",void 0),h(m(t),"_state",void 0),h(m(t),"_dataChannelSignal",void 0),h(m(t),"_pubConfig",{}),h(m(t),"_subConfig",{}),h(m(t),"monitor",void 0),h(m(t),"_roomProfile",Y.communication),h(m(t),"_context",void 0),h(m(t),"_subStreamQueue",{}),t.monitor=r,t._pubSubLock=new Iz("pubSubLock"),t._joinLeaveLock=new Iz("joinLeaveLock"),t._state="disconnected",t._roomAttributes={multiChatMode:!1,bigRoomMode:!1},t._context=e,t.on("SUB_END",(function(e){return t._handleSubStreamQueue(e)})),t}return l(O,[{key:"_addHandlerEvents",value:function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){Oz.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(ej.ABNORMAL_DISCONNECTION)}))}},{key:"_addSignalEventHandler",value:function(){var e,t=this;[ZB.ON_ADD_STREAM,ZB.ON_REMOVE_STREAM,ZB.USER_CONNECTION,ZB.USER_DISCONNECTION,ZB.ON_UPDATE_STREAM_ATTRIBUTES,ZB.ON_UPDATE_ROOM_ATTRIBUTES,ZB.ON_PUSH_TRACK,ZB.ON_REMOVE_TRACK,ZB.NODE_CHANGE,ZB.ON_CUSTOM_MESSAGE,ZB.USER_MESSAGE_RECEIVED,ZB.USER_BINARY_MESSAGE_RECEIVED,ZB.POST_PROCESSING_MESSAGE,ZB.ON_USER_TOKEN_WILL_EXPIRE,ZB.STREAM_CONTROL_MESSAGE,ZB.ON_SCENE_CONFIG,ZB.ON_UPDATE_USER_ATTRIBUTES,$B.RSCP,ZB.ON_STREAM_FAILED].forEach((function(e){var r;null===(r=t._dataChannelSignal)||void 0===r||r.on(e,(function(r){t.safeEmit(e,r)}))})),null===(e=this._dataChannelSignal)||void 0===e||e.once("close",(function(){Oz.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(ej.ABNORMAL_DISCONNECTION)}))}},{key:"_removeSignalEventHandler",value:function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.removeAllListeners(),null===(t=this._handler)||void 0===t||t.removeAllListeners()}},{key:"connectionState",get:function(){return this._state},set:function(e){this._state!==e&&(this.safeEmit(ej.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)}},{key:"connect",value:(w=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l=this,h=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=h.length>1&&void 0!==h[1]?h[1]:"",n=h.length>2&&void 0!==h[2]?h[2]:"",i=h.length>3&&void 0!==h[3]?h[3]:{},this.connectionState="connecting",this._appId=t,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),!i.node){e.next=11;break}a=[i.node],RB("es.join.nodeChange",i),e.next=20;break;case 11:return Promise.resolve().then((function(){return l.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new pj,e.next=15,null===(s=this._iceConfigRequestManager)||void 0===s?void 0:s.getAccessNode(t,r,n,UB.getDeviceId(),null==i?void 0:i.reason,null==i?void 0:i.feedbackNode,this._useCloudProxy);case 15:if(a=e.sent){e.next=19;break}throw RB("es.join.getNodeFailed",""),new JN(qN.ICE_SERVER_WRONG,"get ICE config failed");case 19:RB("es.join.getNodeSuccess",a);case 20:return this._addHandlerEvents(),Promise.resolve().then((function(){return l.emit("onEstablishConnectionHook")})),e.prev=22,u=!1,d=a.map((function(e){var t=Ez(l.monitor,l._context);return t.connect(e).then((function(r){u?t.destroy():(u=!0,c=r,l.safeEmit("prevIceNode",e),l._handler=t,l.supportConcurrent="chrome"===t.name,l._addHandlerEvents())})).catch((function(){t.destroy()}))})),e.next=27,kP(d);case 27:Oz.print("join","establish peerConnection success"),e.next=34;break;case 30:throw e.prev=30,e.t0=e.catch(22),this.connectionState="disconnected",new JN(qN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t0);case 34:if(!c){e.next=40;break}this._dataChannelSignal=new lj(c),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),e.next=42;break;case 40:throw this.connectionState="disconnected",new JN(qN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");case 42:case"end":return e.stop()}}),e,this,[[22,30]])}))),function(e){return w.apply(this,arguments)})},{key:"join",value:(R=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h,f,p,_,v,m,y,g=this,S=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=S.length>1&&void 0!==S[1]?S[1]:{},i=S.length>2&&void 0!==S[2]&&S[2],a=S.length>3?S[3]:void 0,Oz.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",t,n,i,a),this._appId=t.appId,this._token=t.token,this._roomId=t.roomId,this._clientId=t.userInfo.userId,this._businessId=t.userInfo.businessId,this._userInfo=t.userInfo,this._useCloudProxy=t.useCloudProxy,this._roomProfile=t.roomProfile,this._sessionId=n.sessionId,e.next=15,this.connect(this._appId,this._roomId,this._clientId,n);case 15:return e.t0=hP.token2auth(this._appId,this._roomId,this._clientId,this._token),e.t1=this._sessionId||"",e.t2=Date.now(),e.t3=a,e.t4={extra_info:this._userInfo.extraInfo,role:this._userInfo.role},e.next=22,null===(r=this._handler)||void 0===r?void 0:r.getDefaultSdp();case 22:return e.t5=e.sent,e.next=25,Cj();case 25:return e.t6=e.sent,e.t7=window.navigator.userAgent,e.t8=jB.VERSION,e.t9=UB.getDeviceId(),e.t10=this._appId,e.t11=this._roomId,e.t12=this._clientId,e.t13=this._businessId,e.t14=this._useCloudProxy,e.t15=Az[this._roomProfile]?Az[this._roomProfile][0]+"":"0",e.t16={supportedCodecs:e.t6,deviceType:"web",userAgent:e.t7,sdkVersion:e.t8,deviceId:e.t9,appId:e.t10,roomId:e.t11,userId:e.t12,businessId:e.t13,enable_cloud_proxy:e.t14,channelProfile:e.t15},e.t17={supportTokenExpireCallBack:!0,enableSceneConfigV2:!0,enableUnBundleMode:!0},s={Authorization:e.t0,sessionId:e.t1,timestamp:e.t2,controlMessage:e.t3,userAttributes:e.t4,sdpInfo:e.t5,params:e.t16,options:e.t17},Promise.resolve().then((function(){return g.emit("onSendingJoinMessageHook")})),e.prev=39,m=i?"reconnected":"joinRoom",e.next=43,this._dataChannelSignal.sendSignaling(m,s);case 43:return y=e.sent,Oz.print("join","send join message success"),this._authorization=s.Authorization,this.connectionState="connected",$H.audioStallConfig=null===(c=y.config)||void 0===c?void 0:c.engine_WEB,this._pubConfig.audioRed=!(null===(u=y.config)||void 0===u||null===(d=u.engine_WEB)||void 0===d||!d.pub_audio_red),this._subConfig.muteReplaceUnsub=!(null===(l=y.config)||void 0===l||!l.mute_replace_unsub),this._pubConfig.simulcastOnDemand=!(!1===(null===(h=y.config)||void 0===h||null===(f=h.engine_VPM)||void 0===f||null===(p=f.ondemand)||void 0===p?void 0:p.enable)),null===(_=this._context)||void 0===_||_.audioProfileManager.updateEngineBAC(null===(v=y.config)||void 0===v?void 0:v.engine_BAC),e.abrupt("return",y);case 55:if(e.prev=55,e.t18=e.catch(39),this.connectionState="disconnected",!((null===e.t18||void 0===e.t18?void 0:e.t18.code)>=700&&(null===e.t18||void 0===e.t18?void 0:e.t18.code)<800)){e.next=60;break}throw new JN(qN.INVALID_TOKEN,(null===e.t18||void 0===e.t18?void 0:e.t18.message)||"Invalid token");case 60:if(200===(null===e.t18||void 0===e.t18?void 0:e.t18.code)){e.next=62;break}throw new JN(qN.JOIN_ROOM_FAILED,(null===e.t18||void 0===e.t18?void 0:e.t18.message)||"Join room failed");case 62:case"end":return e.stop()}}),e,this,[[39,55]])}))),function(e){return R.apply(this,arguments)})},{key:"publish",value:(A=c(o().mark((function e(t){var r,n,a,s,c,u,d,l,h,f,p,_,v,m,y,g,S,b;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Oz.print("publish()","localStream: %o",t),r=t.videoTrack,n=t.audioTrack,a=uP(),s="",c="",e.prev=6,e.next=9,null===(u=this._handler)||void 0===u?void 0:u.publish(t,this._pubConfig);case 9:if(y=e.sent){e.next=12;break}throw new JN(qN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 12:return s=y.audioMid,c=y.videoMid,t.pubAttributes={localaudio:!!n,localvideo:!!r,videostream:t.pubVideo,audiostream:t.pubAudio,extvideo:!!(r instanceof DH),extaudio:!!(n instanceof PH)},g={attributes:i({videoDescriptions:y.videoDescriptions},t.pubAttributes),audio:!0,video:!0,screen:t.isScreen,audioMid:s,videoMid:c,sdpInfo:{msid:t.stream.id,type:y.type,sdp:y.partialSdp,semantics:y.semantics}},t.enableSimulcast&&this._pubConfig.simulcastOnDemand&&(g.attributes.subVideoDescriptions=y.subVideoDescriptions),e.next=19,null===(d=this._dataChannelSignal)||void 0===d?void 0:d.sendSignaling("publish",g);case 19:if(200===(null==(S=e.sent)?void 0:S.code)){e.next=22;break}throw new JN(qN.PUBLISH_FAILED,(null==S?void 0:S.message)||"publish failed");case 22:return yB.rtcRecvAnswer(0,ZF.INCRANSWER,(null==S||null===(l=S.relayMessage)||void 0===l?void 0:l.sequenceId)||0,null==S||null===(h=S.relayMessage)||void 0===h?void 0:h.sdp,$F.UP,"",""),e.next=25,null===(f=this._handler)||void 0===f?void 0:f.handleAck({action:fz.publish,streamId:S.streamId,audioMid:s,videoMid:c,transceiverInit:y.transceiverInit,signalingAck:{audioMid:null==S||null===(p=S.relayMessage)||void 0===p?void 0:p.audioMid,videoMid:null==S||null===(_=S.relayMessage)||void 0===_?void 0:_.videoMid,sdp:null==S||null===(v=S.relayMessage)||void 0===v?void 0:v.sdp,sequenceId:null==S||null===(m=S.relayMessage)||void 0===m?void 0:m.sequenceId},stream:t});case 25:return t.streamId=S.streamId,t.videoMid=c,t.audioMid=s,t.subVideoDescriptions=y.subVideoDescriptions,this.monitor.rtcPublishStat(eB.SUCCESS,tB.W_0,a,rB.UNKNOWN),t.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor),e.abrupt("return");case 34:return e.prev=34,e.t0=e.catch(6),e.t0 instanceof Error&&this.monitor.rtcPublishStat(eB.FAIL,tB.W_0,a,e.t0.message),e.next=39,null===(b=this._handler)||void 0===b?void 0:b.rollback(t.stream.id,t);case 39:throw e.t0;case 40:case"end":return e.stop()}}),e,this,[[6,34]])}))),function(e){return A.apply(this,arguments)})},{key:"updatePubTrack",value:(I=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h,f,p,_,v,m,y,g,S,b,k,T,I,A,R,w,C,O,x,N,D,P,M;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(Oz.print("updatePubTrack()","localStream: %o",t),i=t.videoTrack,a=t.audioTrack,s=t.pubAudio,c=t.pubVideo,u=null==a?void 0:a.getTrack(),d=null==i?void 0:i.getTrack(),c&&d?null===(l=t.videoTransceiver)||void 0===l||l.sender.replaceTrack(d):null===(h=t.videoTransceiver)||void 0===h||h.sender.replaceTrack(null),null===(r=this._handler)||void 0===r||r.updateScaleResolutionDownBy(t),s&&u?(p=a.mixType,_=a.mixedAudioTrack,v=a.gainAudioTrack,_&&p!==ee.PLAYOUT&&!0===u.enabled?u=_:v&&"safari"!==pP()&&(u=v),null===(f=t.audioTransceiver)||void 0===f||f.sender.replaceTrack(u)):null===(m=t.audioTransceiver)||void 0===m||m.sender.replaceTrack(null),y={localaudio:!!a,localvideo:!!i,videostream:c,audiostream:s,extvideo:!!(i instanceof DH),extaudio:!!(a instanceof PH)},g={},S=0,b=Object.entries(y);S<b.length;S++)k=E(b[S],2),T=k[0],(I=k[1])!==Reflect.get(t.pubAttributes,T)&&Reflect.set(g,T,I);if(Object.keys(g).length){e.next=12;break}return e.abrupt("return");case 12:return t.observer&&(A=t.observer,R=g.audiostream,w=g.videostream,C=g.localaudio,O=g.localvideo,x=g.extaudio,N=g.extvideo,void 0!==O?void 0!==N?A.setPushVideo(N):A.setEnableVideo(O):void 0!==w&&A.setUnmuteVideo(w),void 0!==C?void 0!==x?A.setPushAudio(x):A.setEnableAudio(C):void 0!==R&&A.setUnmuteAudio(R)),t.pubAttributes=y,D={roomId:this._roomId,streamId:t.streamId,attributes:g},e.next=17,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateStreamAttributes",D);case 17:if(200===(null==(P=e.sent)?void 0:P.code)){e.next=20;break}throw new JN(qN.UPDATE_TRACK_FAILED,(null==P?void 0:P.message)||"update track failed");case 20:if(!_P){e.next=23;break}return e.next=23,null===(M=this._handler)||void 0===M?void 0:M.setCurrentDescription();case 23:case"end":return e.stop()}}),e,this)}))),function(e){return I.apply(this,arguments)})},{key:"updateToken",value:(T=c(o().mark((function e(t){var r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Oz.print("updateToken()","newToken: %o",t),this._token=t,this._appId&&null!==(r=this._userInfo)&&void 0!==r&&r.userId&&this._roomId){e.next=4;break}return e.abrupt("return");case 4:return i={roomId:this._roomId,userId:null===(n=this._userInfo)||void 0===n?void 0:n.userId,appId:this._appId,token:"Bearer ".concat(t)},e.prev=5,e.next=8,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateToken",i);case 8:if(200===(null==(s=e.sent)?void 0:s.code)){e.next=11;break}throw new JN(qN.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 11:e.next=16;break;case 13:throw e.prev=13,e.t0=e.catch(5),new JN(qN.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 16:case"end":return e.stop()}}),e,this,[[5,13]])}))),function(e){return T.apply(this,arguments)})},{key:"unpublish",value:(k=c(o().mark((function e(t){var r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Oz.print("unpublish()","localStream: %o",t),i={roomId:this._roomId,initStreamId:t.initStreamId,streamId:t.streamId},null===(r=this._dataChannelSignal)||void 0===r||r.sendSignaling("unpublish",i),e.next=5,null===(n=this._handler)||void 0===n?void 0:n.handleAck({action:fz.unpublish,audioMid:t.audioMid,videoMid:t.videoMid,stream:t,streamId:t.streamId});case 5:t.statsReport.unpublish();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"subscribe",value:(b=c(o().mark((function e(t,r,n){var i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=c(o().mark((function e(a,s){var c,u,d,l,f,p,_,v,m,y,g,S,b,E,k,T,I,A,R,w,C,O,x,N,D,P,M,U,L,V,F,B,j,G,H,z,K,W;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.streamState!==cz.SUB_ED){e.next=2;break}return e.abrupt("return",i._updateSubTrack(t,r,az.SUB,n).then(a,s));case 2:if(t.streamState!==cz.SUB_ING){e.next=7;break}return i._subStreamQueue[t.streamId]||(i._subStreamQueue[t.streamId]=[]),Oz.print("_subStreamQueue","streamId: %o, enqueue",t.streamId),i._subStreamQueue[t.streamId].push({fn:i.subscribe,args:[t,r,n],resolve:a,reject:s}),e.abrupt("return");case 7:if(Oz.print("subscribe()","mediaType: %o",r),Dz("subscribe()",t),t.streamState=cz.SUB_ING,c=!1,u=!1,IP(r)&&(u=!0),AP(r)&&(c=!0),c||!i._multiChatMode()){e.next=17;break}return t.streamState=cz.INIT,i.emit("SUB_END",t.streamId),e.abrupt("return",a(null));case 17:if(d=uP(),l=t.audioMid,f=t.videoMid,_=t.paused,v=t.subVideo,e.prev=22,!l||!f){e.next=29;break}return e.next=26,null===(D=i._handler)||void 0===D?void 0:D.subscribe(t,{audioMid:l,videoMid:f});case 26:p=e.sent,e.next=36;break;case 29:return e.next=31,null===(P=i._handler)||void 0===P?void 0:P.subscribe(t);case 31:if(p=e.sent){e.next=34;break}throw new JN(qN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 34:l=p.audioMid,f=p.videoMid;case 36:return t.paused=!c,t.subVideo=c,M={spatialLayer:(null==n?void 0:n.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==n?void 0:n.spatialSubLayer)||-1},U={audio:!i._multiChatMode(),video:!0,data:!0,screen:t.isScreen,browser:"chrome-stable",videoMid:(null===(m=p)||void 0===m?void 0:m.autosubVideoMid)||f,audioMid:(null===(y=p)||void 0===y?void 0:y.autosubAudioMid)||l,sdpInfo:{sdp:null===(g=p)||void 0===g?void 0:g.partialSdp,semantics:null===(S=p)||void 0===S?void 0:S.semantics,type:null===(b=p)||void 0===b?void 0:b.type},streamUserId:t.userId,streamId:t.streamId,config:{enableMediaType:{audio:!!i._multiChatMode()||u,video:c},qualityLayer:M}},e.next=42,null===(E=i._dataChannelSignal)||void 0===E?void 0:E.sendSignaling("subscribe",U);case 42:if(200===(null==(L=e.sent)?void 0:L.code)){e.next=45;break}throw new JN(qN.SUBSCRIBE_FAILED,(null==L?void 0:L.message)||"subscribe failed");case 45:return V=[],F=!i._multiChatMode(),B=!t.videoTrack,i._subResolves[t.streamId]||(i._subResolves[t.streamId]=[]),B&&V.push(new Promise((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new JN(qN.TIME_OUT,"wait video timeout for userId: ".concat(t.userId)))}),xz);t.on("ontrack",(function r(i){"video"===i.mediaType&&(Oz.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),F&&V.push(new Promise((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new JN(qN.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),xz);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(Oz.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),j=function(e){t.ontrack(e)},null===(k=i._handler)||void 0===k||k.on("ontrack",j),i._ontrackCallbackMap.set(t,j),G=null==L?void 0:L.relayMessage,H=G.audioMid,z=G.videoMid,h(T={},l,H),h(T,f,z),K=T,Oz.print("sub midmap",t.userId,K),_P?(t.videoMid=f,t.audioMid=l):(t.videoMid=z,t.audioMid=H),t._workaround_1_=!1,t.subMediaType=r,t.streamState=cz.SUB_ED,t.subLayer=M,yB.rtcRecvAnswer(0,ZF.INCRANSWER,(null==L||null===(I=L.relayMessage)||void 0===I?void 0:I.sequenceId)||0,null==L||null===(A=L.relayMessage)||void 0===A?void 0:A.sdp,$F.DOWN,t.streamId,t.userId),e.next=65,null===(R=i._handler)||void 0===R?void 0:R.handleAck({action:fz.subscribe,streamId:t.streamId,audioMid:l,videoMid:f,transceiverInit:null===(w=p)||void 0===w?void 0:w.transceiverInit,signalingAck:{audioMid:null==L||null===(C=L.relayMessage)||void 0===C?void 0:C.audioMid,videoMid:null==L||null===(O=L.relayMessage)||void 0===O?void 0:O.videoMid,sdp:null==L||null===(x=L.relayMessage)||void 0===x?void 0:x.sdp,sequenceId:null==L||null===(N=L.relayMessage)||void 0===N?void 0:N.sequenceId},stream:t});case 65:return e.next=67,Promise.all(V);case 67:i._multiChatMode()||(t.subAudio=u),i.monitor.rtcSubscribeStat(nB.SUCCESS,d,iB.UNKNOWN,t.userId),t.statsReport.setRemoteStreamStatsEvtInterval(i,i._handler,i.monitor),a(null),i.emit("SUB_END",t.streamId),e.next=84;break;case 74:return e.prev=74,e.t0=e.catch(22),e.t0 instanceof Error&&i.monitor.rtcSubscribeStat(nB.FAIL,d,e.t0.message,t.userId),t.paused=_,t.subVideo=v,t.streamState=cz.INIT,e.next=82,null===(W=i._handler)||void 0===W?void 0:W.rollback(t.streamId,t);case 82:s(e.t0),i.emit("SUB_END",t.streamId);case 84:case"end":return e.stop()}}),e,null,[[22,74]])})));return function(t,r){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)}))),function(e,t,r){return b.apply(this,arguments)})},{key:"_handleSubStreamQueue",value:function(e){var t,r=this;if(null!==(t=this._subStreamQueue[e])&&void 0!==t&&t.length){Oz.print("_subStreamQueue","streamId: %o, exec",e);var n=this._subStreamQueue[e].shift(),i=n.fn,o=n.args,a=n.resolve,s=n.reject;i.apply(this,o).then(a,s).finally((function(){return r._handleSubStreamQueue(e)}))}else Oz.print("_subStreamQueue","streamId: %o, END",e)}},{key:"controlMessage",value:(S=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Oz.print("controlMessage()","params: %o",t),n=t,"transcode"===t.type&&(n.roomId=this._roomId),e.next=5,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("controlMessage",n);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"updateUserAttributes",value:(y=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Oz.print("updateUserAttributes()","attributes: %o",t),e.next=3,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("updateUserAttributes",{roomId:this._roomId,sessionId:this._sessionId,attributes:t});case 3:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"updateSubTrack",value:(v=c(o().mark((function e(t,r,n,i){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._updateSubTrack(t,r,n,i||t.subLayer));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return v.apply(this,arguments)})},{key:"_updateSubTrack",value:(_=c(o().mark((function e(t,r,n,i){var a,s,c,u,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Oz.print("updateSubTrack()","mediaType: %o, subLayer: %o",r,i),Dz("updateSubTrack()",t),c=0,c=n===az.SUB?t.subMediaType|r:t.subMediaType-(t.subMediaType&r),Oz.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",t.subMediaType,n,r,c),t.subMediaType===c&&Oz.print("updateSubTrack","mediaType no change"),u=!1,d=!1,IP(c)&&(d=!0),AP(c)&&(u=!0),l=i||t.subLayer,h={roomId:this._roomId,streamList:[t.streamId],config:{enableMediaType:{video:u,audio:!!this._multiChatMode()||d},qualityLayer:l}},e.next=13,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateSubscribe",h);case 13:if(200===(null==(f=e.sent)?void 0:f.code)){e.next=16;break}throw new JN(qN.UPDATE_TRACK_FAILED,(null==f?void 0:f.message)||"update track failed");case 16:return t.paused=!u,this._multiChatMode()||(null===(p=t.observer)||void 0===p||p.setUnmuteAudio(d),t.subAudio=d),null===(s=t.observer)||void 0===s||s.setUnmuteVideo(u),t.subVideo=u,t.subMediaType=c,t.subLayer=l,e.abrupt("return",t);case 23:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return _.apply(this,arguments)})},{key:"subscribe4pushTrack",value:(p=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,f,p,_,v,m,y,g,S,b,E=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Oz.print("subscribe4pushTrack()","streamInfo: %o",r),Dz("subscribe4pushTrack()",t),u=null==r?void 0:r.message,d=u.audioMid,l=u.videoMid,f=u.sequenceId,t.subAudio=!0,!(f<t.sequenceId)){e.next=7;break}return Oz.print("subscribe4pushTrack","sequenceId return",f,t.sequenceId),e.abrupt("return");case 7:if(p=t.audioMid,_=t.videoMid,null===(n=t.observer)||void 0===n||n.setPushTrack(!0),!p||!_){e.next=16;break}return e.next=13,null===(m=this._handler)||void 0===m?void 0:m.subscribe(t,{audioMid:p,videoMid:_});case 13:v=e.sent,e.next=23;break;case 16:return e.next=18,null===(y=this._handler)||void 0===y?void 0:y.subscribe(t);case 18:if(v=e.sent){e.next=21;break}throw new JN(qN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 21:p=v.audioMid,_=v.videoMid;case 23:return h(i={},p,d),h(i,_,l),g=i,Oz.print("onpushtrack midmap",t.userId,g),_P?(t.audioMid=p,t.videoMid=_):(t.audioMid=d,t.videoMid=l),t.autosubAudioMid=d,t.autosubVideoMid=l,t.sequenceId=f,this._subResolves[t.streamId]||(this._subResolves[t.streamId]=[]),S=[],t.audioTrack||S.push(new Promise((function(e,r){E._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new JN(qN.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),xz);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(Oz.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),b=function(e){t.ontrack(e)},null===(a=this._handler)||void 0===a||a.on("ontrack",b),this._ontrackCallbackMap.set(t,b),e.next=37,null===(s=this._handler)||void 0===s?void 0:s.handleAck({action:fz.pushtrack,streamId:t.streamId,audioMid:p,videoMid:_,stream:t,transceiverInit:null===(c=v)||void 0===c?void 0:c.transceiverInit,signalingAck:null==r?void 0:r.message});case 37:return e.next=39,Promise.all(S);case 39:t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor);case 40:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"unsubscribe4removeTrack",value:(d=c(o().mark((function e(t,r){var n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Dz("unsubscribe4removeTrack()",t),Oz.print("unsubscribe4removeTrack()","sequenceId: ",r.sequenceId),!(r.sequenceId<t.sequenceId)){e.next=5;break}return Oz.print("unsubscribe4removeTrack()","sequenceId return"),e.abrupt("return");case 5:if(t.subAudio=!1,!t.subVideo&&!t.paused){e.next=10;break}return t.sequenceId=r.sequenceId,Oz.print("unsubscribe4removeTrack()","foo %o",t.userId),e.abrupt("return");case 10:return null===(n=t.observer)||void 0===n||n.setPushTrack(!1),e.next=13,null===(i=this._handler)||void 0===i?void 0:i.handleAck({action:fz.removetrack,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 13:this._subResolves[t.streamId]&&this._subResolves[t.streamId].forEach((function(e){return e(0)})),Oz.print("clean unsubscribe4removeTrack"),t.clean(),t.resetHasSubscribed(),t.statsReport.unsubscribe();case 18:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"unsubscribe",value:(s=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=h.length>2&&void 0!==h[2]&&h[2],Dz("unsubscribe()",t),s=t.subMediaType-(t.subMediaType&r),a||!this._subConfig.muteReplaceUnsub&&s===jH.NONE){e.next=5;break}return e.abrupt("return",this._updateSubTrack(t,r,az.UNSUB));case 5:if(c={roomId:this._roomId,streamId:t.streamId,userId:t.userId},null===(n=this._dataChannelSignal)||void 0===n||n.sendSignaling("unsubscribe",c).catch((function(){})),t.streamState=cz.INIT,this._subStreamQueue[t.streamId]&&(this._subStreamQueue[t.streamId].forEach((function(e){return(0,e.resolve)(null)})),delete this._subStreamQueue[t.streamId]),t.subVideo=!1,t.paused=!1,t._workaround_1_||(t.subAudio=!1),null===(i=t.observer)||void 0===i||i.setSubscribeVideo(!1),t.subAudio){e.next=23;break}return null===(u=t.observer)||void 0===u||u.setSubscribeAudio(!1),e.next=17,null===(d=this._handler)||void 0===d?void 0:d.handleAck({action:fz.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 17:l=e.sent,this._subResolves[l]&&this._subResolves[l].forEach((function(e){return e(0)})),Oz.print("unsubscribe","clean unsub ".concat(t.userId)),t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 23:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"removeOnTrackListener",value:function(e){var t,r=this._ontrackCallbackMap.get(e);r&&(null===(t=this._handler)||void 0===t||t.off("ontrack",r),this._ontrackCallbackMap.delete(e))}},{key:"handleRemoveStream",value:(a=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Dz("handleRemoveStream()",t),t.subVideo=!1,r.message&&r.message!==JB.videoMuted?t._workaround_1_=!1:t._workaround_1_=!0,t.hasSubscribed){e.next=5;break}return e.abrupt("return");case 5:this.unsubscribe(t,L.AUDIO_AND_VIDEO,!0);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"leave",value:(n=c(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Oz.print("leave()"),"connected"!==this.connectionState){e.next=22;break}return this.connectionState="disconnecting",t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},e.next=6,this._joinLeaveLock.lock();case 6:return r=e.sent,e.prev=7,e.next=10,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("leaveRoom",t);case 10:this.connectionState="disconnected",e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(7),this.connectionState="connected",e.t0;case 17:return e.prev=17,r(),e.finish(17);case 20:e.next=23;break;case 22:return e.abrupt("return",Promise.reject(new JN(qN.NOT_CONNECTED_YET,"server not connected")));case 23:case"end":return e.stop()}}),e,this,[[7,13,17,20]])}))),function(){return n.apply(this,arguments)})},{key:"subscribePublicStream",value:(r=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h,f,p,_,v,m,y,g,S=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(r=this._handler)||void 0===r?void 0:r.subscribe(t);case 2:if(s=e.sent){e.next=5;break}throw new JN(qN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 5:return c=uP(),u=s.audioMid,d=s.videoMid,l={appId:this._appId,streamId:t.streamId,audio:!0,video:!0,data:!0,audioMid:u,videoMid:d,sdpInfo:{sdp:null==s?void 0:s.partialSdp,semantics:null==s?void 0:s.semantics,type:null==s?void 0:s.type},config:{enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}},params:{appId:this._appId}},e.next=11,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("startPullStream",l);case 11:return h=e.sent,f=[],this._subResolves[t.streamId]=[],f.push(new Promise((function(e,r){S._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new JN(qN.TIME_OUT,"wait video timeout for streamId: ".concat(t.streamId)))}),xz);t.on("ontrack",(function r(i){"video"===i.mediaType&&(Oz.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),f.push(new Promise((function(e,r){S._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new JN(qN.TIME_OUT,"wait audio timeout for streamId: ".concat(t.streamId)))}),xz);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(Oz.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),p=function(e){t.ontrack(e)},null===(i=this._handler)||void 0===i||i.on("ontrack",p),this._ontrackCallbackMap.set(t,p),_=null==h?void 0:h.relayMessage,v=_.audioMid,m=_.videoMid,y=_.sequenceId,g=_.sdp,t.videoMid=m,t.audioMid=v,t.sequenceId=y,t._workaround_1_=!1,t.paused=!1,t.streamState=cz.SUB_ED,t.subAudio=!0,t.subVideo=!0,e.next=30,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:fz.subscribe,streamId:t.streamId,audioMid:u,videoMid:d,transceiverInit:null==s?void 0:s.transceiverInit,signalingAck:{audioMid:v,videoMid:m,sdp:g,sequenceId:y},stream:t});case 30:return e.next=32,Promise.all(f);case 32:this.monitor.rtcSubscribeStat(nB.SUCCESS,c,iB.UNKNOWN,t.userId),t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor);case 34:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"unsubscribePublicStream",value:(t=c(o().mark((function e(t){var r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Dz("unsubscribePublicStream()",t),n={appId:this._appId,streamId:t.streamId},e.prev=2,e.next=5,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("stopPullStream",n);case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(2);case 9:return t.streamState=cz.INIT,t.subVideo=!1,t.subAudio=!1,e.next=14,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:fz.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 14:t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 17:case"end":return e.stop()}}),e,this,[[2,7]])}))),function(e){return t.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;Oz.print("destroy()"),this._token=void 0,this._appId=void 0,this._roomId=void 0,this._clientId=void 0,this._authorization=void 0,this._sessionId=void 0,this._context=void 0,null===(e=this._handler)||void 0===e||e.destroy(),null===(t=this._dataChannelSignal)||void 0===t||t.destroy(),null===(r=this._iceConfigRequestManager)||void 0===r||r.abort(),this._handler=void 0,this._dataChannelSignal=void 0,this._iceConfigRequestManager=void 0,this._removeSignalEventHandler(),this.connectionState="disconnected",this.emit("INTERRUPT")}},{key:"sendUserMessage",value:function(e,t){var r;return null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendP2PMessage({to:e,from:this._userInfo.userId,room:this._roomId,app:this._appId,msg:t})}},{key:"sendRoomMessage",value:function(e){var t;return null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("customMessage",e)}},{key:"_multiChatMode",value:function(){var e;return null===(e=this._roomAttributes)||void 0===e?void 0:e.multiChatMode}},{key:"handler",get:function(){return this._handler}},{key:"roomAttributes",get:function(){return this._roomAttributes},set:function(e){this._roomAttributes=e}}]),O}(DU);function Mz(e,t,r){var n=r.value;return r.value=c(o().mark((function e(){var r,i,a,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._handler||"connected"!==this._state){e.next=6;break}for(r=s.length,i=new Array(r),a=0;a<r;a++)i[a]=s[a];return e.next=4,n.apply(this,i);case 4:e.next=7;break;case 6:throw new JN(qN.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 7:case"end":return e.stop()}}),e,this)}))),r}function Uz(e,t,r){var n=r.value;return r.value=c(o().mark((function e(){var t,r,i,a,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._pubSubLock.lock();case 2:for(t=e.sent,this.supportConcurrent&&t(),e.prev=4,r=s.length,i=new Array(r),a=0;a<r;a++)i[a]=s[a];return e.next=8,n.apply(this,i);case 8:return e.abrupt("return",e.sent);case 9:return e.prev=9,this.supportConcurrent||t(),e.finish(9);case 12:case"end":return e.stop()}}),e,this,[[4,,9,12]])}))),r}Cz([function(e,t,r){var n=r.value;return r.value=c(o().mark((function e(){var t,r,i,a,s=this,u=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=u.length,r=new Array(t),i=0;i<t;i++)r[i]=u[i];return a=!1,e.abrupt("return",new Promise(function(){var e=c(o().mark((function e(t,i){var c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s.on("INTERRUPT",(function(){a=!0,i(new JN(qN.OPERATION_CANCEL,"operation not finish when leave"))})),e.prev=1,e.next=4,n.apply(s,r);case 4:c=e.sent,t(c),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),a||i(e.t0);case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,r){return e.apply(this,arguments)}}()));case 3:case"end":return e.stop()}}),e)}))),r}],Pz.prototype,"join",1),Cz([Uz,Mz],Pz.prototype,"publish",1),Cz([Uz,Mz],Pz.prototype,"updatePubTrack",1),Cz([Uz,Mz],Pz.prototype,"unpublish",1),Cz([Uz,Mz],Pz.prototype,"subscribe",1),Cz([Mz],Pz.prototype,"controlMessage",1),Cz([Mz],Pz.prototype,"updateUserAttributes",1),Cz([Mz],Pz.prototype,"updateSubTrack",1),Cz([Uz,Mz],Pz.prototype,"subscribe4pushTrack",1),Cz([Uz,Mz],Pz.prototype,"unsubscribe4removeTrack",1),Cz([Uz,Mz],Pz.prototype,"unsubscribe",1),Cz([Mz],Pz.prototype,"handleRemoveStream",1),Cz([Uz],Pz.prototype,"subscribePublicStream",1),Cz([Uz],Pz.prototype,"unsubscribePublicStream",1);var Lz,Vz=function(){function e(t,r){u(this,e),h(this,"_audioEventSessionId",gP()),h(this,"_videoEventSessionId",gP()),h(this,"_handler",void 0),h(this,"_stream",void 0),h(this,"_firstAudioFrameTimer",void 0),h(this,"_firstVideoFrameTimer",void 0),h(this,"_transportDelayInterval",void 0),h(this,"_transportDelay",void 0),h(this,"_firstVideoFrameInterval",void 0),h(this,"_firstAudioFrameInterval",void 0),h(this,"_isScreen",!1),h(this,"_audioFirstFrameState",0),h(this,"_videoFirstFrameState",0),h(this,"_timeout",1e4),h(this,"_currentAudioRecv",{startTime:0,eventSessionId:0,type:cB.LOGIN}),h(this,"_currentVideoRecv",{startTime:0,eventSessionId:0,type:cB.LOGIN}),h(this,"_login",!1),h(this,"_unMuteAudio",!1),h(this,"_enableAudio",!1),h(this,"_unMuteVideo",!1),h(this,"_enableVideo",!1),h(this,"_remoteUnmuteAudio",!1),h(this,"_remoteUnmuteVideo",!1),h(this,"_audioExternal",!1),h(this,"_pushAudio",!1),h(this,"_videoExternal",!1),h(this,"_pushVideo",!1),h(this,"_autoSubscribeVideo",!1),h(this,"_autoSubscribeAudio",!1),h(this,"_autoSubscribe",!1),h(this,"_publishVideo",!1),h(this,"_publishAudio",!1),h(this,"_subscribeAudio",!1),h(this,"_subscribeVideo",!1),h(this,"_subscribe",!1),h(this,"_pushTrack",!1),h(this,"_multiChatMode",!1),this._stream=t,this._handler=r,this.getTransportDelay()}var t,r,n,i;return l(e,[{key:"beginRecvFrame",value:(i=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f,p,_,v,m=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:n=this._transportDelay,i=!0,a=cB.LOGIN,s=cB.UNMUTE,c=cB.SUBSCRIBE,u=cB.PUSH_TRACK,[a,s,c,u].indexOf(r)>=0&&(n=0,i=!1),t===sB.AUDIO?(i||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:r},h={media_type:t,event_type:aB.BEGIN_RECV,type:r,start:null===(d=this._currentAudioRecv)||void 0===d?void 0:d.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(l=this._stream)||void 0===l?void 0:l.userId,transport_delay:n},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){m.stopRecvFrame(sB.AUDIO,uB.TIMEOUT),m._firstAudioFrameInterval&&window.clearInterval(m._firstAudioFrameInterval)}),this._timeout),yB.rtcFirstFrame(h),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=1,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):t===sB.VIDEO&&(i||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:r},v={media_type:null!==(f=this._stream)&&void 0!==f&&f.isScreen?sB.SCREEN_VIDEO:t,event_type:aB.BEGIN_RECV,type:r,start:null===(p=this._currentVideoRecv)||void 0===p?void 0:p.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(_=this._stream)||void 0===_?void 0:_.userId,transport_delay:n},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){m.stopRecvFrame(sB.VIDEO,uB.TIMEOUT),m._firstVideoFrameInterval&&window.clearInterval(m._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),yB.rtcFirstFrame(v),this._videoFirstFrameState=1,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"stopRecvFrame",value:function(e,t){if(e===sB.AUDIO){var r,n,i;if(1!==this._audioFirstFrameState)return;var o={event_type:aB.RECV_END,media_type:e,start:null===(r=this._currentAudioRecv)||void 0===r?void 0:r.startTime,reason:t,result:!1,stream_user_id:null===(n=this._stream)||void 0===n?void 0:n.userId,event_session_id:this._audioEventSessionId,type:null===(i=this._currentAudioRecv)||void 0===i?void 0:i.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,yB.rtcFirstFrame(o),this._audioFirstFrameState=2}else if(e===sB.VIDEO){var a,s,c,u;if(1!==this._videoFirstFrameState)return;var d={event_type:aB.RECV_END,media_type:null!==(a=this._stream)&&void 0!==a&&a.isScreen?sB.SCREEN_VIDEO:e,start:null===(s=this._currentVideoRecv)||void 0===s?void 0:s.startTime,reason:t,result:!1,stream_user_id:null===(c=this._stream)||void 0===c?void 0:c.userId,event_session_id:this._videoEventSessionId,type:null===(u=this._currentVideoRecv)||void 0===u?void 0:u.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,yB.rtcFirstFrame(d),this._videoFirstFrameState=2}}},{key:"recvFrameFinish",value:(n=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h,f,p,_,v,m,y;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:if(r=this._transportDelay,n=cB.LOGIN,i=cB.UNMUTE,a=cB.SUBSCRIBE,s=cB.PUSH_TRACK,t!==sB.AUDIO){e.next=18;break}if(1===this._audioFirstFrameState){e.next=7;break}return e.abrupt("return");case 7:if(this._currentAudioRecv){e.next=9;break}return e.abrupt("return");case 9:u=this._currentAudioRecv,d=u.type,l=u.startTime,[n,i,a,s].indexOf(d)>=0&&(r=0),h={event_type:aB.RECV_END,media_type:t,start:l,result:!0,stream_user_id:null===(c=this._stream)||void 0===c?void 0:c.userId,event_session_id:this._audioEventSessionId,type:d,transport_delay:r},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),yB.rtcFirstFrame(h),this._audioFirstFrameState=3,e.next=30;break;case 18:if(t!==sB.VIDEO){e.next=30;break}if(1===this._videoFirstFrameState){e.next=21;break}return e.abrupt("return");case 21:if(this._currentVideoRecv){e.next=23;break}return e.abrupt("return");case 23:_=this._currentVideoRecv,v=_.type,m=_.startTime,[n,i,a,s].indexOf(v)>=0&&(r=0),y={event_type:aB.RECV_END,media_type:null!==(f=this._stream)&&void 0!==f&&f.isScreen?sB.SCREEN_VIDEO:t,start:m,result:!0,stream_user_id:null===(p=this._stream)||void 0===p?void 0:p.userId,event_session_id:this._videoEventSessionId,type:v,transport_delay:r},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),yB.rtcFirstFrame(y),this._videoFirstFrameState=3;case 30:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setLogin",value:function(e){var t,r,n,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{audio:!0,video:!0};this._login!==e&&(this._login=e,e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&o.audio&&this.beginRecvFrame(sB.AUDIO,cB.LOGIN),e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&o.video&&this.beginRecvFrame(sB.VIDEO,cB.LOGIN),!e&&null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame(sB.AUDIO,uB.LEAVE_ROOM),!e&&null!==(i=this._stream)&&void 0!==i&&i.hasVideo&&this.stopRecvFrame(sB.VIDEO,uB.LEAVE_ROOM))}},{key:"setUnmuteAudio",value:function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(sB.AUDIO,cB.UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(sB.AUDIO,uB.MUTE))}},{key:"setRemoteUnmuteAudio",value:function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(sB.AUDIO,cB.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(sB.AUDIO,uB.REMOTE_MUTE))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(sB.AUDIO,cB.ENABLE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(sB.AUDIO,uB.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(sB.VIDEO,cB.UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(sB.VIDEO,uB.MUTE))}},{key:"setRemoteUnmuteVideo",value:function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(sB.VIDEO,cB.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(sB.VIDEO,uB.REMOTE_MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(sB.VIDEO,cB.ENABLE):this.stopRecvFrame(sB.VIDEO,uB.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal=e}},{key:"setPushAudio",value:function(e){var t;this._audioExternal&&this._pushAudio!==e&&(this._pushAudio=e),this._pushAudio&&this.beginRecvFrame(sB.AUDIO,cB.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.beginRecvFrame(sB.AUDIO,cB.PUSH)}},{key:"setExternalVideoSource",value:function(e){this._videoExternal=e}},{key:"setPushVideo",value:function(e){var t;this._videoExternal&&this._pushVideo!==e&&(this._pushVideo=e),this._pushVideo&&this.beginRecvFrame(sB.VIDEO,cB.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.beginRecvFrame(sB.VIDEO,cB.PUSH)}},{key:"setPublishVideo",value:function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(sB.VIDEO,cB.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(sB.VIDEO,uB.UNPUBLISH)}},{key:"setPublishAudio",value:function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(sB.AUDIO,cB.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(sB.AUDIO,uB.UNPUBLISH)}},{key:"setAutoSubscribe",value:function(e){this._autoSubscribe=e}},{key:"setAutoSubscribeVideo",value:function(e){this._autoSubscribeVideo=e}},{key:"setAutoSubscribeAudio",value:function(e){this._autoSubscribeAudio=e}},{key:"setSubscribeAudio",value:function(e){var t,r;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&null!==(r=this._stream)&&void 0!==r&&r.hasAudio&&this.beginRecvFrame(sB.AUDIO,cB.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(sB.AUDIO,uB.UNSUBSCRIBE)}},{key:"setSubscribeVideo",value:function(e){var t,r;this._autoSubscribeVideo||this._subscribeVideo===e||(this._subscribeVideo=e,e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&this.beginRecvFrame(sB.VIDEO,cB.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(sB.VIDEO,uB.UNSUBSCRIBE)}},{key:"setPushTrack",value:function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(sB.AUDIO,cB.PUSH_TRACK),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(sB.AUDIO,uB.REMOVE_TRACK))}},{key:"setMultiChatMode",value:function(e){this._multiChatMode=e}},{key:"setTimeout",value:function(e){this._timeout=e}},{key:"_watchForFirstVideoFrameRecv",value:function(){var e=this,t=-1,r=-1;this._firstVideoFrameInterval=window.setInterval(c(o().mark((function n(){var i,a,s,c,u,d,l,h;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(a=e._stream)||void 0===a||null===(s=a.videoTrack)||void 0===s||!s.getTrack()){n.next=12;break}return n.next=3,Rj(null===(c=e._handler)||void 0===c?void 0:c.pc,null===(u=e._stream)||void 0===u||null===(d=u.videoTrack)||void 0===d?void 0:d.getTrack());case 3:if(l=n.sent,!(h=l.find((function(e){return"inbound-rtp"===e.type})))||!(h.framesReceived>t||h.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=h.framesReceived,r=h.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(sB.VIDEO),window.clearInterval(e._firstVideoFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"_watchForFirstAudioFrameRecv",value:function(){var e=this,t=-1,r=-1;this._firstAudioFrameInterval=window.setInterval(c(o().mark((function n(){var i,a,s,c,u,d,l,h;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(a=e._stream)||void 0===a||null===(s=a.audioTrack)||void 0===s||!s.getTrack()){n.next=12;break}return n.next=3,Rj(null===(c=e._handler)||void 0===c?void 0:c.pc,null===(u=e._stream)||void 0===u||null===(d=u.audioTrack)||void 0===d?void 0:d.getTrack());case 3:if(l=n.sent,!(h=l.find((function(e){return"inbound-rtp"===e.type})))||!(h.totalSamplesReceived>t||h.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=h.totalSamplesReceived,r=h.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(sB.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"getTransportDelay",value:(r=c(o().mark((function e(){var t=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelayIntl();case 2:window.clearInterval(this._transportDelayInterval),this._transportDelayInterval=window.setInterval(c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getTransportDelayIntl();case 2:case"end":return e.stop()}}),e)}))),2e3);case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getTransportDelayIntl",value:(t=c(o().mark((function e(){var t,r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc){e.next=7;break}return e.next=3,Rj(null===(r=this._handler)||void 0===r?void 0:r.pc);case 3:n=e.sent,i=n.find((function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(a=n.find((function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==i?void 0:i.selectedCandidatePairId)})))&&(this._transportDelay=Math.round(1e3*a.currentRoundTripTime/2));case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"reset",value:function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:cB.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:cB.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._transportDelayInterval&&window.clearInterval(this._transportDelayInterval)}}]),e}(),Fz=function(){function e(t,r){u(this,e),h(this,"_audioEventSessionId",gP()),h(this,"_videoEventSessionId",gP()),h(this,"_pcSessionId",void 0),h(this,"_handler",void 0),h(this,"_firstAudioFrameTimer",void 0),h(this,"_firstVideoFrameTimer",void 0),h(this,"_stream",void 0),h(this,"_firstVideoFrameInterval",void 0),h(this,"_firstAudioFrameInterval",void 0),h(this,"_currentAudioSend",{startTime:0,eventSessionId:0,type:cB.LOGIN}),h(this,"_currentVideoSend",{startTime:0,eventSessionId:0,type:cB.LOGIN}),h(this,"_login",!1),h(this,"_publisher",!1),h(this,"_unMuteAudio",!1),h(this,"_enableAudio",!1),h(this,"_unMuteVideo",!1),h(this,"_enableVideo",!1),h(this,"_audioExternal",!1),h(this,"_pushAudio",!1),h(this,"_videoExternal",!1),h(this,"_pushVideo",!1),h(this,"_autoPublish",!1),h(this,"_publish",!1),h(this,"_timeout",1e4),h(this,"_audioFirstFrameState",0),h(this,"_videoFirstFrameState",0),this._stream=t,this._handler=r}var t,r;return l(e,[{key:"beginSendFrame",value:function(e,t){var r=this;if(e===sB.AUDIO){var n;this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var i={media_type:e,event_type:aB.BEGIN_SEND,type:t,start:null===(n=this._currentAudioSend)||void 0===n?void 0:n.startTime,event_session_id:this._audioEventSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){r.stopSendFrame(sB.AUDIO,uB.TIMEOUT),r._firstAudioFrameInterval&&window.clearInterval(r._firstAudioFrameInterval)}),this._timeout),yB.rtcFirstFrame(i),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=1,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===sB.VIDEO){var o,a;this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};var s={media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?sB.SCREEN_VIDEO:e,event_type:aB.BEGIN_SEND,type:t,start:null===(a=this._currentVideoSend)||void 0===a?void 0:a.startTime,event_session_id:this._videoEventSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){r.stopSendFrame(sB.VIDEO,uB.TIMEOUT),r._firstVideoFrameInterval&&window.clearInterval(r._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),yB.rtcFirstFrame(s),this._videoFirstFrameState=1,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteVideo=!0,this._pushVideo||(this._enableVideo=!0)}}},{key:"stopSendFrame",value:function(e,t){if(e===sB.AUDIO){var r,n;if(1!==this._audioFirstFrameState)return;var i={event_type:aB.SENT_END,media_type:e,start:null===(r=this._currentAudioSend)||void 0===r?void 0:r.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(n=this._currentAudioSend)||void 0===n?void 0:n.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,yB.rtcFirstFrame(i),this._audioFirstFrameState=2}else if(e===sB.VIDEO){var o,a,s;if(1!==this._videoFirstFrameState)return;var c={event_type:aB.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?sB.SCREEN_VIDEO:e,start:null===(a=this._currentVideoSend)||void 0===a?void 0:a.startTime,reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(s=this._currentVideoSend)||void 0===s?void 0:s.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,yB.rtcFirstFrame(c),this._videoFirstFrameState=2}}},{key:"sendFrameFinish",value:function(e){if(e===sB.AUDIO){if(1!==this._audioFirstFrameState)return;if(!this._currentAudioSend)return;var t=this._currentAudioSend,r=t.type,n=t.startTime,i={event_type:aB.SENT_END,media_type:e,start:n,result:!0,event_session_id:this._audioEventSessionId,type:r};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),yB.rtcFirstFrame(i),this._audioFirstFrameState=3}else if(e===sB.VIDEO){var o;if(1!==this._videoFirstFrameState)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend,s=a.type,c=a.startTime,u={event_type:aB.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?sB.SCREEN_VIDEO:e,start:c,result:!0,event_session_id:this._videoEventSessionId,type:s};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),yB.rtcFirstFrame(u),this._videoFirstFrameState=3}}},{key:"setLogin",value:function(e){if(this._login!==e){var t,r;if(this._login=e,e)null!==(t=this._stream)&&void 0!==t&&t.videoTrack&&this.beginSendFrame(sB.VIDEO,cB.LOGIN),null!==(r=this._stream)&&void 0!==r&&r.audioTrack&&this.beginSendFrame(sB.AUDIO,cB.LOGIN);!e&&this._audioSending&&this.stopSendFrame(sB.AUDIO,uB.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(sB.VIDEO,uB.LEAVE_ROOM)}}},{key:"setPublish",value:function(e){if(this._publish!==e){var t,r;if(this._publish=e,e)(null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(sB.VIDEO,cB.PUBLISH),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(sB.AUDIO,cB.PUBLISH);!e&&this._audioSending&&this.stopSendFrame(sB.AUDIO,uB.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(sB.VIDEO,uB.UNPUBLISH)}}},{key:"setUnmuteAudio",value:function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(sB.AUDIO,cB.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(sB.AUDIO,uB.MUTE))}},{key:"setEnableAudio",value:function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(sB.AUDIO,cB.ENABLE),!e&&this._audioSending&&this.stopSendFrame(sB.AUDIO,uB.DISABLE))}},{key:"setUnmuteVideo",value:function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(sB.VIDEO,cB.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(sB.VIDEO,uB.MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(sB.VIDEO,cB.ENABLE),!e&&this._videoSending&&this.stopSendFrame(sB.VIDEO,uB.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(sB.AUDIO,uB.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(sB.AUDIO,uB.STOP_PUSH),this._pushAudio=!1))}},{key:"setPushAudio",value:function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(sB.AUDIO,cB.PUSH),!e&&this._audioSending&&this.stopSendFrame(sB.AUDIO,uB.STOP_PUSH))}},{key:"setExternalVideoSource",value:function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(sB.VIDEO,uB.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(sB.VIDEO,uB.STOP_PUSH),this._pushVideo=!1))}},{key:"setPushVideo",value:function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(sB.VIDEO,cB.PUSH),!e&&this._videoSending&&this.stopSendFrame(sB.VIDEO,uB.STOP_PUSH))}},{key:"setAutoPublish",value:function(e){this._autoPublish=e}},{key:"setPublisher",value:function(e){this._publisher!==e&&(this._publisher=e,!e&&this._audioSending&&this.stopSendFrame(sB.AUDIO,uB.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(sB.VIDEO,uB.AUDIENCE))}},{key:"setTimeout",value:function(e){this._timeout=e}},{key:"setPCSessionId",value:function(e){this._pcSessionId=e}},{key:"setHandler",value:function(e){this._handler=e}},{key:"_getFirstVideoFrameStats",value:(r=c(o().mark((function e(){var t,r,n,i,a,s,c,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc||null===(r=this._stream)||void 0===r||null===(n=r.videoTrack)||void 0===n||!n.getTrack()){e.next=6;break}return e.next=3,Rj(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(a=this._stream)||void 0===a||null===(s=a.videoTrack)||void 0===s?void 0:s.getTrack());case 3:return c=e.sent,u=c.find((function(e){return"outbound-rtp"===e.type})),e.abrupt("return",u);case 6:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_getFirstAudioFrameStats",value:(t=c(o().mark((function e(){var t,r,n,i,a,s,c,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc||null===(r=this._stream)||void 0===r||null===(n=r.audioTrack)||void 0===n||!n.getPublishTrack()){e.next=6;break}return e.next=3,Rj(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(a=this._stream)||void 0===a||null===(s=a.audioTrack)||void 0===s?void 0:s.getPublishTrack());case 3:return c=e.sent,u=c.find((function(e){return"outbound-rtp"===e.type})),e.abrupt("return",u);case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_watchForFirstVideoFrameSend",value:function(){var e=this,t=-1,r=-1;this._firstVideoFrameInterval=window.setInterval(c(o().mark((function n(){var i;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e._getFirstVideoFrameStats();case 2:if(!(i=n.sent)||!(i.framesSent>t||i.packetsSent>r)){n.next=10;break}if(-1!==t||-1!==r){n.next=8;break}return t=i.framesSent,r=i.packetsSent,n.abrupt("return");case 8:e.sendFrameFinish(sB.VIDEO),window.clearInterval(e._firstVideoFrameInterval);case 10:case"end":return n.stop()}}),n)}))),100)}},{key:"_watchForFirstAudioFrameSend",value:function(){var e=this,t=-1;this._firstAudioFrameInterval=window.setInterval(c(o().mark((function r(){var n;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e._getFirstAudioFrameStats();case 2:if(!((n=r.sent)&&n.packetsSent>t)){r.next=9;break}if(-1!==t){r.next=7;break}return t=n.packetsSent,r.abrupt("return");case 7:e.sendFrameFinish(sB.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 9:case"end":return r.stop()}}),r)}))),100)}},{key:"reset",value:function(){this._login=!1,this._publisher=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoPublish=!1,this._publish=!1,this._audioFirstFrameState=0,this._videoFirstFrameState=0,this._currentAudioSend={startTime:0,eventSessionId:0,type:cB.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:cB.LOGIN},window.clearTimeout(this._firstAudioFrameTimer),window.clearTimeout(this._firstVideoFrameTimer),window.clearInterval(this._firstAudioFrameInterval),window.clearInterval(this._firstVideoFrameInterval)}},{key:"destroy",value:function(){this.reset(),delete this._stream,delete this._handler}},{key:"_audioSending",get:function(){return 1===this._audioFirstFrameState}},{key:"_videoSending",get:function(){return 1===this._videoFirstFrameState}}]),e}(),Bz=(h(Lz={},"audio",{delay:1200,stallRadio:.3}),h(Lz,"video",{delay:1200,stallRadio:.6}),h(Lz,"screen_audio",{delay:1600,stallRadio:.8}),h(Lz,"screen_video",{delay:1600,stallRadio:.8}),Lz),jz=function(){function e(){u(this,e),h(this,"_preUplinkStats",new Map),h(this,"_preDownlinkStats",new Map),h(this,"_timer",void 0),h(this,"_delayTimer",void 0),h(this,"_connectionState",Nz.CONNECTED),h(this,"reportor",void 0)}return l(e,[{key:"updateUplinkStats",value:function(e){var t=e.audioStats,r=e.videoStats,n=e.isScreen;if(t.sendKBitrate>0&&t.rtt){var i=n?"screen_audio":"audio",o=t.rtt,a=t._fractionLost,s=t._retransmittedRate,c=this._getQosLevel(o,a||0,s||0),u=this._preUplinkStats.get(i)||[c];this._preUplinkStats.set(i,[].concat(k(u),[c]).slice(-2))}if(r.sentKBitrate>0&&r.rtt){var d=n?"screen_video":"video",l=r._fractionLost,h=r.rtt,f=r._sendBandWidth,p=r._retransmittedRate;0===f&&(l=Math.max(.65,l));var _=this._getQosLevel(h,l||0,p||0),v=this._preUplinkStats.get(d)||[_];this._preUplinkStats.set(d,[].concat(k(v),[_]).slice(-2))}this._startNetworkQualityReport()}},{key:"updateDownlinkStats",value:function(e,t){if(t){var r,n,i=this._getStreamActiveState(t),o=i.audioActive,a=i.videoActive,s=e.audioStats,c=e.videoStats,u=e.isScreen,d=e.userId;if(o&&s.rtt)if(0===s.receivedKBitrate)r=X.VBAD;else{var l=s.rtt,h=s.audioLossRate,f=s.stallDuration,p=s.statsInterval,_=s.e2eDelay,v=f/p,m=u?"screen_audio":"audio",y=this._getQosLevel(l,h||0,c._retransmittedRate||0),g=this._getDownlinkQoE(m,v,_);r=this._getNetworkQuality(y,g)}if(a)if(0===c.receivedKBitrate||0===c.rtt)n=X.VBAD;else{var S=c.rtt,b=c.videoLossRate,E=c.stallDuration,T=c.statsInterval,I=c.e2eDelay,A=c._retransmittedRate,R=E/T,w=u?"screen_video":"video",C=this._getQosLevel(S,b||0,A||0),O=this._getDownlinkQoE(w,R,I);n=this._getNetworkQuality(C,O)}var x=r&&n?Math.ceil((r+n)/2):r||n;if(x){var N="".concat(d).concat(u?"_screen":""),D=this._preDownlinkStats.get(N)||[x];this._preDownlinkStats.set(N,[].concat(k(D),[x]).slice(-2)),this._startNetworkQualityReport()}}}},{key:"setConnectionState",value:function(e){this._connectionState=e}},{key:"destroy",value:function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._delayTimer&&(window.clearTimeout(this._delayTimer),delete this._delayTimer),this._preUplinkStats.clear(),this._preDownlinkStats.clear()}},{key:"_startNetworkQualityReport",value:function(){var e=this;this._delayTimer||this._timer||(this._preUplinkStats.size>0||this._preDownlinkStats.size>0)&&(this._delayTimer=window.setTimeout((function(){delete e._delayTimer,e._reportNetworkQuality(),e._timer=window.setInterval((function(){e._reportNetworkQuality()}),2e3)}),300))}},{key:"_reportNetworkQuality",value:function(){var e,t,r=this;if(this._connectionState!==Nz.CONNECTED)e=t=X.VBAD;else{var n=this._getBetterQualityAndRemoveOldest("audio","up"),i=this._getBetterQualityAndRemoveOldest("video","up");e=n&&i?Math.ceil((n+i)/2):n||i||this._getBetterQualityAndRemoveOldest("screen_video","up")||this._getBetterQualityAndRemoveOldest("screen_audio","up")||X.UNKNOWN;var o=Array.from(this._preDownlinkStats.keys()).map((function(e){return r._getBetterQualityAndRemoveOldest(e,"down")})).filter((function(e){return e}));t=Math.ceil(o.reduce((function(e,t){return t+e}),0)/o.length)||X.UNKNOWN}this.reportor&&this.reportor(e,t)}},{key:"_getNetworkQuality",value:function(e,t){return 1===t?Math.max(e-2,1):2===t?e:Math.min(e+1,5)}},{key:"_getQosLevel",value:function(e,t,r){var n;return n=e<=250&&t<=.15?1:e<=500&&t<=.3?2:e<=750&&t<=.45?3:e<=1e3&&t<=.6?4:5,r>.5?n=Math.max(n,4):r>.35?n=Math.max(n,3):r>.15&&(n=Math.max(n,2)),n}},{key:"_getUplinkQoE",value:function(e,t){var r=0;switch(e){case"audio":case"video":r=t<.05?1:t<.1?2:3;break;case"screen_video":case"screen_audio":r=t<.04?1:t<.08?2:3}return r}},{key:"_getDownlinkQoE",value:function(e,t,r){var n=Bz[e];return t>n.stallRadio||r>n.delay||t>n.stallRadio/2&&r>n.delay/2?3:(t>n.stallRadio/2||n.delay,2)}},{key:"_getBetterQualityAndRemoveOldest",value:function(e,t){var r=X.UNKNOWN,n="up"===t?this._preUplinkStats:this._preDownlinkStats,i=n.get(e);if(i){var o=i.filter((function(e){return e}));o.length>0&&(r=Math.min.apply(Math,k(o))),i.shift(),0===i.length&&n.delete(e)}return r}},{key:"_getStreamActiveState",value:function(e){var t=e.subMediaType,r=e._attributes,n=e.subVideo;return{audioActive:e.subAudio&&IP(t)&&r.localaudio&&r.audiostream,videoActive:n&&AP(t)&&r.localvideo&&r.videostream}}}]),e}(),Gz=function(){function e(t){u(this,e),h(this,"_timer",void 0),h(this,"_remoteVideoSizeCache",{}),h(this,"_remoteScreenSizeCache",{}),h(this,"onchange",void 0),this._room=t,this._start()}return l(e,[{key:"destroy",value:function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._remoteVideoSizeCache={},this._remoteScreenSizeCache={}}},{key:"_start",value:function(){var e=this;this._timer||(this._timer=window.setInterval((function(){var t={},r={};e._room.remoteStreams.forEach((function(n,i){n.forEach((function(n){var o,a=null===(o=n.videoTrack)||void 0===o?void 0:o.getTrack();if(a){var s=n.isScreen?e._remoteScreenSizeCache:e._remoteVideoSizeCache,c=s[i]||{},u=c.width,d=void 0===u?0:u,l=c.height,h=void 0===l?0:l,f=a.getSettings(),p=f.width,_=void 0===p?0:p,v=f.height,m=void 0===v?0:v;h===m&&d===_||e.onchange&&e.onchange(i,n.isScreen,_,m),delete s[i],(n.isScreen?r:t)[i]={width:_,height:m}}}))})),Object.keys(e._remoteVideoSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!1,0,0)})),Object.keys(e._remoteScreenSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!0,0,0)})),e._remoteVideoSizeCache=t,e._remoteScreenSizeCache=r}),1e3))}}]),e}(),Hz=new xU("SubscribeFallbackManager",2),zz=1e4,Kz=function(){function e(t){u(this,e),h(this,"_preDownlinkNetworkQuality",[]),h(this,"_isSubscribeFallbackOrRecover",!1),h(this,"_inSubscribeRecoverChecking",!1),h(this,"_subRecoverCheckTimer",void 0),h(this,"_forbidSubRecover",!1),h(this,"_forbidSubRecoverTimer",void 0),h(this,"_forbidSubRecoverDuration",zz),h(this,"onSubscribeFallback",void 0),this._room=t}var t;return l(e,[{key:"updateNetworkQuality",value:function(e,t){this._preDownlinkNetworkQuality.push(t),this._preDownlinkNetworkQuality=this._preDownlinkNetworkQuality.slice(-10),this._inSubscribeRecoverChecking&&this._preDownlinkNetworkQuality.find((function(e){return e===X.BAD||e===X.VBAD}))&&this._startForbidSubRecover(),this._preDownlinkNetworkQuality.slice(-3).reduce((function(e,t){return e+t}),0)>3*X.POOR&&this._subscribeFallbackOrRecover("fallback"),!this._forbidSubRecover&&10===this._preDownlinkNetworkQuality.length&&this._preDownlinkNetworkQuality.every((function(e){return e===X.EXCELLENT}))&&this._subscribeFallbackOrRecover("recover")}},{key:"destroy",value:function(){this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),delete this.onSubscribeFallback}},{key:"_subscribeFallbackOrRecover",value:(t=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h,f=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isSubscribeFallbackOrRecover&&this._room.connectionState===Nz.CONNECTED){e.next=2;break}return e.abrupt("return");case 2:if(this._room.subscribeFallbackOption!==K.AUDIO_ONLY&&this._room.subscribeFallbackOption!==K.VIDEO_STREAM_LOW){e.next=24;break}if(r=new Map,this._room.remoteStreams.forEach((function(e){e.forEach((function(e){if(e.hasSubscribed){var n="fallback"===t?e.getSubscribeFallbackParams(f._room.subscribeFallbackOption):e.getSubscribeRecoverParams();if(n){var i=e.getStreamPriority(),o=r.get(i)||[];o.push({stream:e,fallbackOrRecoverOption:n}),r.set(i,o)}}}))})),!(r.size>0)){e.next=24;break}if(Hz.print("_subscribeFallbackOrRecover()","start subscribe ".concat(t,".")),n=Array.from(r.keys()).sort((function(e,t){return e-t}))["fallback"===t?0:r.size-1],i=r.get(n)||[],a=E(i,1),!(s=a[0])){e.next=24;break}return c=s.stream,u=s.fallbackOrRecoverOption,this._isSubscribeFallbackOrRecover=!0,d=c.subLayer.spatialLayer,l=c.subVideo,Hz.print("_subscribeFallbackOrRecover()","".concat(c.userId,"'s stream will be ").concat(t," to: MediaType=").concat(u[0]," subState=").concat(u[1]," subLayer=").concat(u[2])),e.prev=15,e.next=18,kP([(h=this._room).updateSubTrack.apply(h,[c].concat(k(u))).then((function(){"recover"===t?f._startSubscribeRecoverCheck():Hz.print("_subscribeFallbackOrRecover()","fallback success."),f.onSubscribeFallback&&f.onSubscribeFallback({userId:c.userId,isScreen:c.isScreen,beforeEnable:l,beforeVideoIndex:d,afterEnable:c.subVideo,afterVideoIndex:c.subLayer.spatialLayer,reason:"fallback"===t?q.SubscribeFallbackByBandwidth:q.SubscribeRecoverByBandwidth})})),fP(2e3)]);case 18:e.next=22;break;case 20:e.prev=20,e.t0=e.catch(15);case 22:this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1;case 24:case"end":return e.stop()}}),e,this,[[15,20]])}))),function(e){return t.apply(this,arguments)})},{key:"_startSubscribeRecoverCheck",value:function(){var e=this;this._stopSubscribeRecoverCheck(),this._inSubscribeRecoverChecking=!0,this._subRecoverCheckTimer=window.setTimeout((function(){e._inSubscribeRecoverChecking=!1,e._forbidSubRecoverDuration=zz,delete e._subRecoverCheckTimer,Hz.print("_subscribeFallbackOrRecover()","recover success.")}),2e4)}},{key:"_stopSubscribeRecoverCheck",value:function(){this._subRecoverCheckTimer&&(window.clearTimeout(this._subRecoverCheckTimer),delete this._subRecoverCheckTimer),this._inSubscribeRecoverChecking=!1}},{key:"_startForbidSubRecover",value:function(){var e=this;this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),this._forbidSubRecoverDuration=Math.min(this._forbidSubRecoverDuration+2e4,12e4),Hz.print("_subscribeFallbackOrRecover()","subscribe-recover failed, and subscribe-recover not allowed within ".concat(this._forbidSubRecoverDuration/1e3,"s")),this._forbidSubRecover=!0,this._forbidSubRecoverTimer=window.setTimeout((function(){e._forbidSubRecover=!1,delete e._forbidSubRecoverTimer}),this._forbidSubRecoverDuration)}},{key:"_stopForbidSubRecover",value:function(){this._forbidSubRecoverTimer&&(window.clearTimeout(this._forbidSubRecoverTimer),delete this._forbidSubRecoverTimer)}}]),e}(),Wz=new xU("Room",1),Xz=function(e){f(V,e);var t,r,n,a,s,d,p,_,v,y,S,b,k,T,I,R,w,O,x,N,P,M=g(V);function V(e,t){var r;return u(this,V),h(m(r=M.call(this)),"_mediaServerClient",void 0),h(m(r),"_localStream",void 0),h(m(r),"_localScreenStream",void 0),h(m(r),"_remoteUsers",new Map),h(m(r),"_remoteStreams",new Map),h(m(r),"_remoteStreamStreamIdUserIdMap",{}),h(m(r),"_joinResolveCallback",void 0),h(m(r),"_joinRejectCallback",void 0),h(m(r),"_getAccessNode",void 0),h(m(r),"_getAccessFeedback",void 0),h(m(r),"_getAccessFeedbackIceNode",void 0),h(m(r),"_reconnectTimer",void 0),h(m(r),"_isReconnecting",void 0),h(m(r),"_context",void 0),h(m(r),"_sessionId",void 0),h(m(r),"_reconnectRecord",void 0),h(m(r),"_connectionLostTimer",void 0),h(m(r),"_liveControlMessage",void 0),h(m(r),"_serverConfig",void 0),h(m(r),"_roomConfig",void 0),h(m(r),"_roomInfo",void 0),h(m(r),"_waitForNewToken",!1),h(m(r),"_userDuplicateLoginTimerMap",new Map),h(m(r),"_networkQualityManager",void 0),h(m(r),"userPriorityMap",void 0),h(m(r),"subscribeFallbackOption",void 0),h(m(r),"_videoSizeObserver",void 0),h(m(r),"_subFallbackManager",void 0),h(m(r),"_hasPublished",!1),r._roomConfig=e,r._mediaServerClient=new Pz(t),r._reconnectRecord=new qz,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new jz,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(m(r)),r._videoSizeObserver=new Gz(m(r)),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(m(r)),r._subFallbackManager=new Kz(m(r)),r._subFallbackManager.onSubscribeFallback=r._emitSubscribeFallback.bind(m(r)),r._context=t,r}return l(V,[{key:"hasScreenPublished",get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished}},{key:"hasPublished",get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished}},{key:"connectionState",get:function(){return this._mediaServerClient.connectionState}},{key:"remoteUsers",get:function(){return this._remoteUsers}},{key:"remoteStreams",get:function(){return this._remoteStreams}},{key:"localStream",get:function(){return this._localStream}},{key:"localScreenStream",get:function(){return this._localScreenStream}},{key:"roomInfo",get:function(){return this._roomInfo}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,y,g,S,b,E,k,T,I=this;null===(e=this._mediaServerClient)||void 0===e||e.on(ZB.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(ZB.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(ZB.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(ZB.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(ZB.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(ZB.ON_UPDATE_USER_ATTRIBUTES,this._onUpdateUserAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(ZB.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(ZB.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(ZB.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(ZB.NODE_CHANGE,this._nodeChange.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(ZB.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(ZB.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(ZB.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(ZB.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(ZB.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(ZB.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(ZB.ON_SCENE_CONFIG,this._onSceneConfig.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(ZB.ON_STREAM_FAILED,this._onStreamFailed.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on($B.RSCP,this._onPublishOnDemand.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on(ej.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on(ej.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(b=this._mediaServerClient)||void 0===b||b.on("onRemoteStreamStats",(function(e){I._networkQualityManager.updateDownlinkStats(e,I._findRemoteStreamByScreen(e.userId,e.isScreen)),I.emit(nz.ON_REMOTE_STREAM_STATS,RP(e))})),null===(E=this._mediaServerClient)||void 0===E||E.on("onLocalStreamStats",(function(e){I._networkQualityManager.updateUplinkStats(e),I.emit(nz.ON_LOCAL_STREAM_STATS,RP(e))})),null===(k=this._mediaServerClient)||void 0===k||k.on("prevIceNode",(function(e){I._getAccessFeedbackIceNode=e})),null===(T=this._mediaServerClient)||void 0===T||T.on("prevIceNode",(function(e){I._getAccessFeedbackIceNode=e}))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()}},{key:"join",value:(P=c(o().mark((function e(t,r,n,i,a,s){var c=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return bB.setStats({rtc_app_id:t,room_id:r,user_id:i.userId}),Wz.print("join()"),e.abrupt("return",new Promise((function(e,o){var u;c._joinResolveCallback=function(t){var r;yB.joinRoom(lB.END,d,!0,"",{enable_cloud_proxy:null===(r=c._roomInfo)||void 0===r?void 0:r.useCloudProxy}),e(t)},c._joinRejectCallback=function(e){var t;yB.joinRoom(lB.END,d,!1,e.message,{enable_cloud_proxy:null===(t=c._roomInfo)||void 0===t?void 0:t.useCloudProxy}),o(e)},c._liveControlMessage=a,c._roomInfo={appId:t,roomId:r,token:n,userInfo:i,useCloudProxy:s,roomProfile:c._roomConfig.roomProfileType};var d=uP();c.setSessionId(),yB.joinRoom(lB.BEGIN,d,!1,"",{enable_cloud_proxy:null===(u=c._roomInfo)||void 0===u?void 0:u.useCloudProxy}),c._join(c._joinResolveCallback,c._joinRejectCallback,!1)})));case 3:case"end":return e.stop()}}),e)}))),function(e,t,r,n,i,o){return P.apply(this,arguments)})},{key:"_join",value:(N=c(o().mark((function e(t,r){var n,i,a,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>2&&void 0!==s[2]&&s[2],i=uP(),Wz.print("_join()"),e.prev=3,e.next=6,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback,sessionId:this._sessionId,feedbackNode:this._getAccessFeedbackIceNode},n,this._liveControlMessage);case 6:a=e.sent,this._mediaServerClient.roomAttributes=a.roomAttributes,this._reconnectRecord.clear(),this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof t&&t({users:a.clients,streams:a.streams}),this._isReconnecting=!1,yB.rtcJoinRoom(0,"web","web",uP()-i),this._onJoinSucc(a,n),e.next=23;break;case 19:if(e.prev=19,e.t0=e.catch(3),e.t0.code===qN.OPERATION_CANCEL||"function"!=typeof r){e.next=23;break}return e.abrupt("return",r(e.t0));case 23:case"end":return e.stop()}}),e,this,[[3,19]])}))),function(e,t){return N.apply(this,arguments)})},{key:"publishScreen",value:(x=c(o().mark((function e(t,r,n,i,a){var s,c,u,d,l,h,f,p,_,v;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Wz.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new uz,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new Fz(this._localScreenStream,this._mediaServerClient.handler))),s=!1,c=!1,u=!1,d=!1,!this._localScreenStream.videoTrack&&r?(r instanceof DH&&(c=!0),s=!0):this._localScreenStream.videoTrack&&!r&&(s=!1),!this._localScreenStream.audioTrack&&n?(n instanceof PH&&(d=!0),u=!0):this._localScreenStream.audioTrack&&!n&&(u=!1),this._localScreenStream.videoTrack=r,this._localScreenStream.audioTrack=n,this._localScreenStream.videoEncodeConfig=t,i&&(IP(i)&&(this._localScreenStream.pubAudio=a===oz.PUB),AP(i)&&(this._localScreenStream.pubVideo=a===oz.PUB),Wz.print("publishScreen mediaType","pubAudio: %o, pubVideo: %o",this._localScreenStream.pubAudio,this._localScreenStream.pubVideo)),this._localScreenStream.pubAudio||this._localScreenStream.pubVideo){e.next=18;break}if(null===(l=this._localScreenStream)||void 0===l||!l.hasPublished){e.next=17;break}return e.abrupt("return",this.unpublishScreen());case 17:return e.abrupt("return");case 18:if(this._localScreenStream.hasPublished){e.next=24;break}return null===(h=this._localScreenStream.observer)||void 0===h||h.setPublish(!0),e.next=22,this._mediaServerClient.publish(this._localScreenStream);case 22:e.next=28;break;case 24:return c?null===(f=this._localScreenStream.observer)||void 0===f||f.setPushVideo(s):null===(p=this._localScreenStream.observer)||void 0===p||p.setEnableVideo(s),d?null===(_=this._localScreenStream.observer)||void 0===_||_.setPushAudio(u):null===(v=this._localScreenStream.observer)||void 0===v||v.setEnableAudio(u),e.next=28,this.updatePubScreenTrack();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return x.apply(this,arguments)})},{key:"updatePubScreenTrack",value:(O=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Wz.print("updatePubScreenTrack","Invoke updatePubScreenTrack"),!this._localScreenStream){e.next=4;break}return e.next=4,this._mediaServerClient.updatePubTrack(this._localScreenStream);case 4:case"end":return e.stop()}}),e,this)}))),function(){return O.apply(this,arguments)})},{key:"unpublishScreen",value:(w=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Wz.print("unpublish","Invoke unpublishScreen"),!this._localScreenStream){e.next=7;break}return null===(t=this._localScreenStream.observer)||void 0===t||t.setPublish(!1),e.next=5,this._mediaServerClient.unpublish(this._localScreenStream);case 5:this._localScreenStream.clean(),this._localScreenStream=void 0;case 7:case"end":return e.stop()}}),e,this)}))),function(){return w.apply(this,arguments)})},{key:"liveControlMessage",value:(R=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Wz.print("controlMessage","Invoke controlMessage"),null===(r=t.transcodeMeta)||void 0===r||r.layout.regions.forEach((function(e){n.roomInfo&&(e.roomID=n.roomInfo.roomId)})),this._liveControlMessage=t,e.next=5,this._mediaServerClient.controlMessage(t);case 5:"stopped"===t.action&&delete this._liveControlMessage;case 6:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"publicStreamControlMessage",value:(I=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"stopped"===t.action&&delete t.publicStreamMeta,e.next=3,this._mediaServerClient.controlMessage(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return I.apply(this,arguments)})},{key:"updateUserAttributes",value:(T=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Wz.print("updateUserAttributes","Invoke updateUserAttributes"),t.role&&this._roomInfo&&(this._roomInfo.userInfo.role=t.role),e.next=4,this._mediaServerClient.updateUserAttributes(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"publish",value:(k=c(o().mark((function e(t,r,n,i,a,s){var c,u,d,l,h,f,p,_,v,m,y,g,S=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c=S.length>6&&void 0!==S[6]&&S[6],Wz.print("publish","Invoke publish"),u=!1,this._localStream||(this._localStream=new uz,this._mediaServerClient.handler&&(this._localStream.observer=new Fz(this._localStream,this._mediaServerClient.handler)),u=!0),this._localStream.videoTrack=n,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=t,this._localStream.enableSimulcast=r,a&&(IP(a)&&(this._localStream.pubAudio=s===oz.PUB),AP(a)&&(this._localStream.pubVideo=s===oz.PUB),Wz.print("publish mediaType","pubAudio: %o, pubVideo: %o",this._localStream.pubAudio,this._localStream.pubVideo)),this._localStream.hasPublished){e.next=26;break}if(this._localStream.pubAudio||this._localStream.pubVideo){e.next=12;break}return e.abrupt("return");case 12:return e.prev=12,c?null===(d=this._localStream.observer)||void 0===d||d.setLogin(!0):u&&(l=!!this._localStream.videoTrack,h=!!this._localStream.audioTrack,f=this._localStream.videoTrack instanceof DH,p=this._localStream.audioTrack instanceof PH,this._roomConfig.isAutoPublish&&!this._hasPublished?(l&&(f?null===(_=this._localStream.observer)||void 0===_||_.setPushVideo(!0):null===(v=this._localStream.observer)||void 0===v||v.setEnableVideo(!0)),h&&(p?null===(m=this._localStream.observer)||void 0===m||m.setPushAudio(!0):null===(y=this._localStream.observer)||void 0===y||y.setEnableAudio(!0))):null===(g=this._localStream.observer)||void 0===g||g.setPublish(!0)),e.next=16,this._mediaServerClient.publish(this._localStream);case 16:this._hasPublished=!0,this.emit(nz.ON_PUBLISH_RESULT,{isScreen:!1,state:D.PUBLISH_SUCC}),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(12),this.emit(nz.ON_PUBLISH_RESULT,{isScreen:!1,state:D.PUBLISH_FAIL}),e.t0;case 24:e.next=28;break;case 26:return e.next=28,this.updatePubTrack();case 28:case"end":return e.stop()}}),e,this,[[12,20]])}))),function(e,t,r,n,i,o){return k.apply(this,arguments)})},{key:"updatePubTrack",value:(b=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Wz.print("updatePubTrack","Invoke updatePubTrack"),!this._localStream){e.next=4;break}return e.next=4,this._mediaServerClient.updatePubTrack(this._localStream);case 4:case"end":return e.stop()}}),e,this)}))),function(){return b.apply(this,arguments)})},{key:"unpublish",value:(S=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Wz.print("unpublish","Invoke unpublish"),!this._localStream){e.next=6;break}return e.next=4,this._mediaServerClient.unpublish(this._localStream);case 4:this._localStream.clean(),this._localStream=void 0;case 6:case"end":return e.stop()}}),e,this)}))),function(){return S.apply(this,arguments)})},{key:"subscribe",value:(y=c(o().mark((function e(t,r,n){var i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Wz.print("subscribe","remoteStream %o",t),i=void 0,n&&(i=this._getSubLayer(n,t)),e.next=5,this._mediaServerClient.subscribe(t,r,i);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return y.apply(this,arguments)})},{key:"updateSubTrack",value:(v=c(o().mark((function e(t,r,n,i){var a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Wz.print("updateSubTrack","Invoke updateSubTrack"),e.abrupt("return",null===(a=this._mediaServerClient)||void 0===a?void 0:a.updateSubTrack(t,r,n,i));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return v.apply(this,arguments)})},{key:"updateSubVideoConfig",value:(_=c(o().mark((function e(t,r){var n,i,a,s,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((s=this._findRemoteStreamByScreen(t,!1))&&s.hasSubscribed&&!((null==s||null===(n=s.attributes)||void 0===n||null===(i=n.videoDescriptions)||void 0===i?void 0:i.length)<=1)){e.next=3;break}return e.abrupt("return");case 3:return c=this._getSubLayer(r,s),s.originalStreamIndex=c.spatialLayer,e.abrupt("return",null===(a=this._mediaServerClient)||void 0===a?void 0:a.updateSubTrack(s,s.subMediaType,az.SUB,c));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"_getSubLayer",value:function(e,t){for(var r,n,i,o,a,s=null==t?void 0:t.attributes,c=s.videoDescriptions,u=s.subVideoDescriptions,d=Array.isArray(u)?u:c,l=-1,h=e.width*e.height,f=0;f<(null==d?void 0:d.length);f++){var p,_;if(h>=(null===(p=d[f])||void 0===p?void 0:p.width)*(null===(_=d[f])||void 0===_?void 0:_.height)){l=f;break}}var v=d[0];if(-1===l)v=d[l=d.length-1];else if(0!==l){var m=d[l-1].width*d[l-1].height,y=(m-h)/(m-d[l].width*d[l].height);v=y<.1?d[l-1]:d[l],l=y<.1?l-1:l}return a=null!==(r=null===(n=v)||void 0===n?void 0:n.sub_index)&&void 0!==r?r:-1,{spatialLayer:null!==(i=null===(o=v)||void 0===o?void 0:o.video_index)&&void 0!==i?i:l,spatialSubLayer:a}}},{key:"unsubscribe",value:(p=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Wz.print("unsubscribe","Invoke unsubscribe"),e.next=3,this._mediaServerClient.unsubscribe(t,r);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"leave",value:(d=c(o().mark((function e(){var t,r,n,i,a,s,c=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=c.length>0&&void 0!==c[0]&&c[0],Wz.print("leave","Invoke leave"),r=uP(),e.prev=3,clearTimeout(this._reconnectTimer),n=A(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)a=i.value,Array.isArray(a)&&a.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(lV){n.e(lV)}finally{n.f()}return this._localStream&&(null===(s=this._localStream.observer)||void 0===s||s.setLogin(!1)),e.next=10,this._mediaServerClient.leave();case 10:this.destroy(),yB.rtcLeaveRoom(0,"",uP()-r),e.next=23;break;case 14:if(e.prev=14,e.t0=e.catch(3),e.t0 instanceof JN&&e.t0.code===qN.NOT_CONNECTED_YET&&this._joinRejectCallback&&this._joinRejectCallback(new Error(hB.LEAVE_ROOM)),!t){e.next=21;break}throw e.t0;case 21:this.destroy();case 22:e.t0 instanceof Error&&yB.rtcLeaveRoom(-1,e.t0.message,uP()-r);case 23:case"end":return e.stop()}}),e,this,[[3,14]])}))),function(){return d.apply(this,arguments)})},{key:"setRemoteUserPriority",value:function(e,t){var r,n;null===(r=this.remoteStreams.get(e))||void 0===r||r.forEach((function(e){return e.setRemoteUserPriority(t)})),null===(n=this.userPriorityMap)||void 0===n||n.set(e,t)}},{key:"destroy",value:function(){Wz.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;var e,t,r,n=A(this._remoteStreams);try{for(n.s();!(e=n.n()).done;){var i=E(e.value,2)[1];Array.isArray(i)&&i.forEach((function(e){e&&e.clean()}))}}catch(lV){n.e(lV)}finally{n.f()}(this._remoteStreams=new Map,this._localStream)&&(null===(t=this._localStream)||void 0===t||t.clean(),this._localStream=void 0);this._localScreenStream&&(null===(r=this._localScreenStream)||void 0===r||r.clean(),this._localScreenStream=void 0);this._context=void 0,this._reconnectRecord=new qz,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._subFallbackManager.destroy(),this._remoteStreamStreamIdUserIdMap={}}},{key:"updateToken",value:(s=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Wz.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=t),e.next=4,this._mediaServerClient.updateToken(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(a=c(o().mark((function e(t){var r,n,i,a,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],n=A(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)a=i.value,Array.isArray(a)&&a.forEach((function(e){if(e.hasSubscribed){var n=s.updateSubTrack(e,t,az.UNSUB);n&&r.push(n)}}))}catch(lV){n.e(lV)}finally{n.f()}return e.abrupt("return",Promise.all(r));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(n=c(o().mark((function e(t){var r,n,i,a,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],n=A(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)a=i.value,Array.isArray(a)&&a.forEach((function(e){if(e.hasSubscribed&&e.hasSubscribed){var n=s.updateSubTrack(e,t,az.SUB);n&&r.push(n)}}))}catch(lV){n.e(lV)}finally{n.f()}return e.abrupt("return",Promise.all(r));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendUserMessage",value:function(e,t){var r;return null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendUserMessage(e,t)}},{key:"setSessionId",value:function(){this._sessionId=oP(),bB.setStats({rtc_session_id:this._sessionId})}},{key:"sendRoomMessage",value:(r=c(o().mark((function e(t){var r,n,i,a,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=s.length>1&&void 0!==s[1]&&s[1],a={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:i,message:""},!i){e.next=8;break}return e.next=5,hP.ab2b64str(t);case 5:a.message=e.sent,e.next=9;break;case 8:a.message=t;case 9:return e.abrupt("return",null===(n=this._mediaServerClient)||void 0===n?void 0:n.sendRoomMessage(a));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_destroyAndInitMediaServerClient",value:function(){Wz.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new Pz(this._context),this._addHandlerEventHandler()}},{key:"_onJoinSucc",value:function(e,t){var r,n=this;Wz.print("JoinSuccess()"),this._serverConfig=e.config;var i=[],o=[],a=[],s=[];null===(r=e.clientsDetail)||void 0===r||r.forEach((function(t){if(t.attributes&&(t.attributes.serverMuteVideo&&n.safeEmit(nz.ON_VIDEO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteVideo}),t.attributes.serverMuteAudio&&n.safeEmit(nz.ON_AUDIO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteAudio})),t.clientId!==e.clientId){var r=n._remoteUsers.get(t.clientId);r?r._stillExist=!0:i.push(t)}}));var c,u=A(this._remoteUsers.values());try{for(u.s();!(c=u.n()).done;){var d=c.value;d._stillExist||o.push({clientId:d.userId}),delete d._stillExist}}catch(lV){u.e(lV)}finally{u.f()}e.streams.forEach((function(e){var t=n._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId):s.push(e)}));var l,h=A(this._remoteStreams.values());try{for(h.s();!(l=h.n()).done;){var f=l.value;Array.isArray(f)&&f.forEach((function(e){e.stillExist?delete e.stillExist:a.push({clientId:e.userId,streamId:e.streamId,message:JB.clientDisconnected})}))}}catch(lV){h.e(lV)}finally{h.f()}setTimeout((function(){o.forEach((function(e){return n._onUserDisconnection(e)})),i.forEach((function(e){return n._onUserConnection(e)})),a.forEach((function(e){return n._onRemoveStream(e)})),s.forEach((function(e){return n._onAddStream(e,!0,!1)})),t&&n._handleSendOrRecvStreamAfterReconnect()}))}},{key:"_handleSendOrRecvStreamAfterReconnect",value:function(){var e=this;this._localStream&&(this._localStream.clean(),this._mediaServerClient.publish(this._localStream).catch((function(e){}))),this._localScreenStream&&(this._localScreenStream.clean(),this._mediaServerClient.publish(this._localScreenStream).catch((function(e){})));var t,r=A(this._remoteStreams.values());try{for(r.s();!(t=r.n()).done;){var n=t.value;Array.isArray(n)&&n.forEach(function(){var t=c(o().mark((function t(r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!r.hasSubscribed){t.next=15;break}return r.resetHasSubscribed(),t.prev=2,Wz.print("start resubscribe ".concat(r.userId," with ").concat(r.subMediaType)),t.next=6,e._mediaServerClient.subscribe(r,r.subMediaType);case 6:Wz.print("success resubscribe ".concat(r.userId," with ").concat(r.subMediaType)),e.safeEmit(nz.RESUBSCRIBE,{stream:r}),t.next=15;break;case 10:t.prev=10,t.t0=t.catch(2),Wz.print("failed resubscribe ".concat(r.userId," with ").concat(r.subMediaType,", error:").concat(t.t0)),r.clean(),null==r||r.resetHasSubscribed();case 15:case"end":return t.stop()}}),t,null,[[2,10]])})));return function(e){return t.apply(this,arguments)}}())}}catch(lV){r.e(lV)}finally{r.f()}}},{key:"_findRemoteStream",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.streamId===t})):null}},{key:"_findRemoteStreamByScreen",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.isScreen===t})):null}},{key:"_onAddStream",value:function(e){var t,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var i=this._roomConfig,o=i.isAutoSubscribeAudio,a=i.isAutoSubscribeVideo,s=this._findRemoteStreamByScreen(e.clientId,e.screen);if(s&&s.streamId!==e.streamId){var c,u=null===(c=this._remoteStreams.get(e.clientId))||void 0===c?void 0:c.filter((function(e){return e.streamId!==s.streamId}));s.clean(),this._remoteStreams.set(e.clientId,u||[])}var d=this._findRemoteStream(e.clientId,e.streamId);if(this._remoteStreamStreamIdUserIdMap[e.streamId]=e.clientId,d)d.attributes=e.attributes;else{var l;d=new dz(e.clientId,e.streamId,e.screen,e.attributes,null===(l=this.userPriorityMap)||void 0===l?void 0:l.get(e.clientId)),this._initStreamListeners(d);var h=this._remoteStreams.get(e.clientId);h?h.push(d):this._remoteStreams.set(e.clientId,[d])}if(this._mediaServerClient.handler&&(d.observer=new Vz(d,this._mediaServerClient.handler)),!d.isScreen&&a){var f,p,_,v,m,y,g,S;if(n&&d.hasVideo)if(d.attributes.extvideo)null===(f=d.observer)||void 0===f||f.setExternalVideoSource(!0),null===(p=d.observer)||void 0===p||p.setPushVideo(!0);else null===(_=d.observer)||void 0===_||_.setExternalVideoSource(!1),null===(v=d.observer)||void 0===v||v.setPublishVideo(!0);if(n&&d.hasAudio&&o&&!this._mediaServerClient.roomAttributes.multiChatMode)if(d.attributes.extaudio)null===(m=d.observer)||void 0===m||m.setExternalAudioSource(!0),null===(y=d.observer)||void 0===y||y.setPushAudio(!0);else null===(g=d.observer)||void 0===g||g.setExternalAudioSource(!1),null===(S=d.observer)||void 0===S||S.setPublishAudio(!0);if(!0===r&&!1===n){var b,E=this._roomConfig,k=E.isAutoSubscribeAudio,T=E.isAutoSubscribeVideo;null===(b=d.observer)||void 0===b||b.setLogin(!0,{audio:!!k,video:!!T})}}return r&&this.safeEmit(ZB.ON_ADD_STREAM,{stream:d}),d}}},{key:"_onUserConnection",value:function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var r=this._userDuplicateLoginTimerMap.get(e.clientId);if("number"==typeof r)return this._userDuplicateLoginTimerMap.delete(e.clientId),void self.clearTimeout(r);var n={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,i({},n)),this.safeEmit(ZB.USER_CONNECTION,{userInfo:n}),e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(nz.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(nz.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}}},{key:"_onUserDisconnection",value:function(e){var t,r=this,n=e.clientId,i=e.tag,o=e.code;if(n)if(n===(null===(t=this.roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=null;i===tj.kickedByAdmin?a=qN.KICKED_OUT:i===tj.onUserTokenDidExpire?a=qN.TOKEN_EXPIRED:i===tj.userDuplicateLogin&&(a=qN.DUPLICATE_LOGIN),o===rj.roomDismissByAdmin&&(a=qN.ROOM_DISMISS),a&&this.safeEmit(nz.ON_ROOM_ERROR,{errorCode:a})}else{var s=C.DROPPED;i===tj.userLeave?s=C.QUIT:i===tj.kickedByAdmin?s=C.KICKED_BY_ADMIN:i===tj.roleChanged&&(s=C.SWITCH_TO_INVISIBLE);var c=function(){var e;r._remoteUsers.delete(n),null===(e=r._remoteStreams.get(n))||void 0===e||e.forEach((function(e){r._onRemoveStream({clientId:e.userId,streamId:e.streamId,message:"client disconnected"})})),r._remoteStreams.delete(n),r.safeEmit(nz.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===tj.userDuplicateLogin){var u=this._userDuplicateLoginTimerMap.get(n);null!=u||self.clearTimeout(u);var d=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(n,d)}else c()}}},{key:"_onRemoveStream",value:function(e){var t,r=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var n=this._remoteStreams.get(e.clientId);if(n){var i=n.find((function(t){return t.streamId===e.streamId}));if(i){var o,a,s;if(null===(o=this._mediaServerClient)||void 0===o||o.handleRemoveStream(i,e).then((function(){if(null==i||!i._workaround_1_){var t=r._remoteStreams.get(e.clientId);if(!t)return;t=t.filter((function(t){return t.streamId!==e.streamId})),r._remoteStreams.set(e.clientId,t)}})).finally((function(){r.safeEmit(ZB.ON_REMOVE_STREAM,{stream:i,reason:e.message})})),i.hasVideo)null===(a=i.observer)||void 0===a||a.setPublishVideo(!1);if(i.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode)null===(s=i.observer)||void 0===s||s.setPublishAudio(!1)}}}}},{key:"_onUpdateUserAttributes",value:function(e){e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(nz.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(nz.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}},{key:"_onUpdateRoomAttributes",value:function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=i(i({},this._mediaServerClient.roomAttributes),e.roomAttributes))}},{key:"_onUpdateStreamAttributes",value:function(e){var t=this._roomConfig,r=t.isAutoSubscribeAudio,n=t.isAutoSubscribeVideo,o=e.clientId,a=e.streamId,s=e.attributes,c=this._findRemoteStream(o,a);if(c){var u,d,l=c.attributes,h=i(i({},l),s),f=!1,p=h.localaudio!==l.localaudio,_=!1,v=!1,m=h.localvideo!==l.localvideo,y=!1,g=jH.NONE,S=jH.NONE;if(h.audiostream!==l.audiostream&&(f=h.localaudio,_=!!h.audiostream,h.audiostream?g|=L.AUDIO:S|=L.AUDIO),h.videostream!==l.videostream&&(v=h.localvideo,y=!!h.videostream,h.videostream?g|=L.VIDEO:S|=L.VIDEO),g&&this.safeEmit(nz.ON_USER_PUBLISH_STATE_CHANGE,{userId:o,mediaType:g,isScreen:c.isScreen,pubState:oz.PUB,remoteStream:c}),S&&this.safeEmit(nz.ON_USER_PUBLISH_STATE_CHANGE,{userId:o,mediaType:S,isScreen:c.isScreen,pubState:oz.UNPUB,remoteStream:c}),h.localaudio!==l.localaudio)if(h.localaudio&&r){var b,E,k,T;if(h.extaudio)null===(b=c.observer)||void 0===b||b.setExternalAudioSource(!0),null===(E=c.observer)||void 0===E||E.setPushAudio(!0);else null===(k=c.observer)||void 0===k||k.setExternalAudioSource(!1),null===(T=c.observer)||void 0===T||T.setEnableAudio(!0);this.safeEmit(nz.ON_USER_START_AUDIO_CAPTURE,{userId:o})}else{var I,A,R,w;if(h.extaudio)null===(I=c.observer)||void 0===I||I.setExternalAudioSource(!0),null===(A=c.observer)||void 0===A||A.setPushAudio(!1);else null===(R=c.observer)||void 0===R||R.setExternalAudioSource(!1),null===(w=c.observer)||void 0===w||w.setEnableAudio(!1);!c.isScreen&&this.safeEmit(nz.ON_USER_STOP_AUDIO_CAPTURE,{userId:o})}if(h.localvideo!==l.localvideo)if(h.localvideo&&n){var C,O,x,N;if(h.extvideo)null===(C=c.observer)||void 0===C||C.setExternalVideoSource(!0),null===(O=c.observer)||void 0===O||O.setPushVideo(!0);else null===(x=c.observer)||void 0===x||x.setExternalVideoSource(!1),null===(N=c.observer)||void 0===N||N.setEnableVideo(!0);this.safeEmit(nz.ON_USER_START_VIDEO_CAPTURE,{userId:o})}else{var D,P,M,U;if(h.extvideo)null===(D=c.observer)||void 0===D||D.setExternalVideoSource(!0),null===(P=c.observer)||void 0===P||P.setPushVideo(!1);else null===(M=c.observer)||void 0===M||M.setExternalVideoSource(!1),null===(U=c.observer)||void 0===U||U.setEnableVideo(!1);!c.isScreen&&this.safeEmit(nz.ON_USER_STOP_VIDEO_CAPTURE,{userId:o})}if(f&&!p)null===(u=c.observer)||void 0===u||u.setRemoteUnmuteAudio(_);if(v&&!m)null===(d=c.observer)||void 0===d||d.setRemoteUnmuteVideo(y);c.attributes=h}}},{key:"_onPushTrack",value:function(e){var t=this,r=e.clientId,n=e.streamId,i=this._findRemoteStream(r,n);i||(i=this._onAddStream(e,!1,!1)),this._mediaServerClient.subscribe4pushTrack(i,e).then((function(){return t.safeEmit(nz.SUBSCRIBE_PUSH_TRACK,{stream:i})})).catch((function(e){Wz.print("subscribe push track failed: ".concat(e))}))}},{key:"_onRemoveTrack",value:function(e){var t=this,r=e.clientId,n=e.streamId,i=e.message,o=this._findRemoteStream(r,n);o&&this._mediaServerClient.unsubscribe4removeTrack(o,i).then((function(){if(o._workaround_1_){var e,i=null===(e=t._remoteStreams.get(r))||void 0===e?void 0:e.filter((function(e){return e.streamId!==n}));t._remoteStreams.set(r,i||[])}t.safeEmit(nz.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){Wz.print("remove push track failed: ".concat(e))}))}},{key:"_nodeChange",value:function(e){var t,r=e.nodes,n=e.reason;UB.clearAccessNode(null===(t=this._roomInfo)||void 0===t?void 0:t.appId),this._destroyAndInitMediaServerClient(),Array.isArray(r)&&r.length?this._getAccessNode=r[0]:this._getAccessFeedback=n,yB.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(n)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()}},{key:"_reconnect",value:function(){var e=this;this._isReconnecting=!0;var t,r=A(this._remoteStreams.values());try{for(r.s();!(t=r.n()).done;){var n=t.value;Array.isArray(n)&&n.forEach((function(e){return e.clean()}))}}catch(lV){r.e(lV)}finally{r.f()}yB.rtcReconnect(1002,BF.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,jF.PEERCONNECTION),this._join((function(){yB.rtcReconnected(GF.PEERCONNECTION_RECONNECTED,HF.PEERCONNECTION)}),(function(t){e._reconnectRecord.record(t),e._reconnectRecord.shouldReconnect?(Wz.print("Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=window.setTimeout(e._reconnect.bind(e),3e3)):(e.safeEmit(nz.RECONNECT_FAILED),e.destroy())}),!0)}},{key:"_handleAbnormalDisconnection",value:function(){Wz.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=window.setTimeout(this._reconnect.bind(this),3e3)}},{key:"_onConnectionStateChange",value:function(e){var t,r=this;if(e.next===Nz.DISCONNECTED)t=F.CONNECTION_STATE_DISCONNECTED;else if(e.next===Nz.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?F.CONNECTION_STATE_RECONNECTED:F.CONNECTION_STATE_CONNECTED;else{if(e.next!==Nz.CONNECTING)return;t=this._isReconnecting?F.CONNECTION_STATE_RECONNECTING:F.CONNECTION_STATE_CONNECTING}e.prev===Nz.CONNECTED&&e.next===Nz.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){r.safeEmit(ej.ON_CONNECTION_STATE_CHANGE,{state:F.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(ej.ON_CONNECTION_STATE_CHANGE,{state:t})}},{key:"_initStreamListeners",value:function(e){var t=this;e.on("ontrack",(function(e){e.track})),e.on("onSEIMessage",(function(r){var n;t.emit(nz.ON_SEI_MESSAGED_RECEIVED,{sei:r,remoteStreamKey:{userId:e.userId,roomId:null===(n=t._roomInfo)||void 0===n?void 0:n.roomId,streamIndex:e.isScreen?U.STREAM_INDEX_SCREEN:U.STREAM_INDEX_MAIN}})}))}},{key:"_onCustomMessage",value:function(e){this.safeEmit(ZB.ON_CUSTOM_MESSAGE,e)}},{key:"_onUserMessageReceived",value:function(e){this.safeEmit(ZB.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onUserBinaryMessageReceived",value:function(e){this.safeEmit(ZB.USER_BINARY_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onPostProcessingMessage",value:function(e){if(e.body){var t=e.body,r=t.error||0,n=iz.START,i=["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"];if("2.0"===t.protocol){switch(t.eventType){case"TranscodeStarted":0!==t.error&&(n=iz.START_FAILED);break;case"TranscodeStateChanged":n=0!==t.error?iz.START_FAILED:iz.START_SUCCESS;break;case"TranscodeStopped":n=0!==t.error?iz.STOP_FAILED:iz.STOP_SUCCESS;break;case"TranscodeUpdated":n=0!==t.error?iz.UPDATE_FAILED:iz.UPDATE_SUCCESS}this.safeEmit(ZB.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:n,message:i[r]})}this.safeEmit(ZB.POST_PROCESSING_MESSAGE,{code:r,message:i[r],type:e.type})}}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(ZB.ON_USER_TOKEN_WILL_EXPIRE,null)}},{key:"_onSceneConfig",value:function(e){var t=e.multiSceneConfig,r=Az[this._roomConfig.roomProfileType][1];if(t){var n,i,o=t[r];if(o&&o.engine_BAC)null===(n=this._context)||void 0===n||n.audioProfileManager.updateEngineBAC(o.engine_BAC);if(o&&o.engine_ANM)null===(i=this._context)||void 0===i||i.audioProfileManager.updateEngineANM(o.engine_ANM)}}},{key:"_onStreamFailed",value:(t=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("publish"!==t.type){e.next=11;break}if(c=void 0,(null===(r=this.localStream)||void 0===r?void 0:r.streamId)===t.streamId?c=this.localStream:(null===(n=this.localScreenStream)||void 0===n?void 0:n.streamId)===t.streamId&&(c=this.localScreenStream),c){e.next=5;break}return e.abrupt("return");case 5:return null===(i=c)||void 0===i||i.clean(),e.next=8,null===(a=this._mediaServerClient)||void 0===a?void 0:a.unpublish(c).catch((function(){}));case 8:null===(s=this._mediaServerClient)||void 0===s||s.publish(c).catch((function(){})),e.next=20;break;case 11:if("subscribe"!==t.type){e.next=20;break}if(u=this._remoteStreamStreamIdUserIdMap[t.streamId],!(d=this._findRemoteStream(u,t.streamId))){e.next=20;break}return e.next=17,null===(l=this._mediaServerClient)||void 0===l?void 0:l.unsubscribe(d,L.AUDIO_AND_VIDEO);case 17:return e.next=19,null===(h=this._mediaServerClient)||void 0===h?void 0:h.subscribe(d,d.subMediaType,d.subLayer);case 19:this.safeEmit(nz.RESUBSCRIBE,{stream:d});case 20:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_onStreamControlMessage",value:function(e){var t,r;e.type===QB.PushLimitWarn&&(null!==(t=this._localStream)&&void 0!==t&&t.pubAudio||null!==(r=this._localStream)&&void 0!==r&&r.pubVideo||this.unpublish())}},{key:"_onPublishOnDemand",value:function(e){var t,r,n,i,o;if(!1!==(null===(t=this._serverConfig)||void 0===t||null===(r=t.engine_VPM)||void 0===r||null===(n=r.ondemand)||void 0===n?void 0:n.enable)&&null!==(i=this._localStream)&&void 0!==i&&i.enableSimulcast&&null!==(o=this._localStream)&&void 0!==o&&o.videoTransceiver){var a,s,c=null===(a=this._localStream)||void 0===a?void 0:a.stream.id,u=null===(s=this._localStream)||void 0===s?void 0:s.videoTransceiver.sender,d=u.getParameters();if(Array.isArray(d.encodings)&&Array.isArray(e)){var l,h,f,p,_={};Wz.print("_onPublishOnDemand","usedDescriptions: %o",e),e.forEach((function(e){var t;if(null!=e&&null!==(t=e.StreamIds)&&void 0!==t&&t.includes(c)){var r=null==e?void 0:e.Metadata.SubvideoIndex;_[r]=r}}));var v={};null===(l=this._localStream)||void 0===l||null===(h=l.subVideoDescriptions)||void 0===h||h.forEach((function(e){void 0!==_[e.sub_index]&&(v[e.video_index]=e)}));var m=(null===(f=u.track)||void 0===f||null===(p=f.getSettings())||void 0===p?void 0:p.height)||720,y=[];d.encodings=d.encodings.map((function(e){return e.rid&&(v[e.rid]?(e.active=!0,e.scaleResolutionDownBy=Math.max(m/v[e.rid].height,1),y.push({type:1,rid:e.rid,downBy:e.scaleResolutionDownBy})):(y.push({type:0,rid:e.rid}),e.active=!1)),e})),yB.rtcInvokeStatus(JSON.stringify(y),0,"rscp",c,0)}u.setParameters(d)}}},{key:"_reportNetworkQuality",value:function(e,t){this._subFallbackManager.updateNetworkQuality(e,t),this.emit(nz.ON_NETWORK_QUALITY,e,t)}},{key:"_emitVideoSizeChange",value:function(e,t,r,n){var i;this.emit(nz.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(i=this.roomInfo)||void 0===i?void 0:i.roomId,userId:e,streamIndex:t?U.STREAM_INDEX_SCREEN:U.STREAM_INDEX_MAIN},{width:r,height:n})}},{key:"_emitSubscribeFallback",value:function(e){this.emit(nz.ON_SIMULCAST_SUBSCRIBE_FALLBACK,e)}}]),V}(DU),qz=function(){function e(){u(this,e),h(this,"_all_201_count",void 0),h(this,"_has_4xx",void 0),this._all_201_count=0,this._has_4xx=!1}return l(e,[{key:"shouldReconnect",get:function(){return!(this._all_201_count>=3||this._has_4xx)}},{key:"record",value:function(e){var t=!1,r=!1;if(Array.isArray(e)){var n=0;e.map((function(e){var t,i,o;400<=(null===(t=e.error)||void 0===t?void 0:t.code)&&(null===(i=e.error)||void 0===i?void 0:i.code)<500&&(r=!0),201===(null===(o=e.error)||void 0===o?void 0:o.code)&&n++})),n===e.length&&(t=!0),t&&this._all_201_count++,r&&(this._has_4xx=!0)}}},{key:"clear",value:function(){this._all_201_count=0,this._has_4xx=!1}}]),e}(),Yz=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=document.createElement(e);return t.id&&(r.id=t.id),t.classList&&t.classList.forEach((function(e){r.classList.add(e)})),t.style&&Object.assign(r.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=E(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r},Jz=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.id&&(e.id=t.id),t.classList&&t.classList.forEach((function(t){e.classList.add(t)})),t.style&&Object.assign(e.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(t){var r=E(t,2),n=r[0],i=r[1];e.setAttribute(n,i)})),e},Qz=new xU("Player",0),Zz=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],$z={playsinline:"","webkit-playsinline":""},eK={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},tK=new(function(){function e(){u(this,e),h(this,"videoCache",[]),h(this,"audioCache",[])}return l(e,[{key:"getOrCreate",value:function(e,t){var r="audio"===e?$z:eK;if("video"===e&&this.videoCache.length>0){var n=this.videoCache.pop();if(n)return Jz(n,{style:t,attributes:r}),n}else if("audio"===e&&this.audioCache.length>0){var i=this.audioCache.pop();if(i)return Jz(i,{style:t,attributes:r}),i}return Yz(e,{style:t,attributes:r})}},{key:"recycle",value:function(e){for(;e.attributes.length>0;)e.removeAttribute(e.attributes[0].name);e instanceof HTMLVideoElement?this.videoCache.push(e):this.audioCache.push(e)}}]),e}()),rK=function(e){f(n,e);var t,r=g(n);function n(e){var t;u(this,n),h(m(t=r.call(this)),"_containerDom",void 0),h(m(t),"_videoDom",void 0),h(m(t),"__cumulativeTime",void 0),h(m(t),"userId",void 0),h(m(t),"renderMode",void 0),h(m(t),"mirrorType",B.MIRROR_TYPE_NONE),h(m(t),"isScreen",void 0),h(m(t),"played",!1),h(m(t),"_emitPlayFailed",!1),h(m(t),"emitVideoEvent",(function(e){var r,n,i={type:"video",rawEvent:e,readyState:(null===(r=t._videoDom)||void 0===r?void 0:r.readyState)||0,userId:t.userId,eventName:e.type,currentTime:(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime)||0,isScreen:t.isScreen};t.emit("playback_event",i)})),h(m(t),"_internalPlay",(function(){var e;if(null!==(e=t._videoDom)&&void 0!==e&&e.paused){var r=t._videoDom.play();null!=r&&r.then&&r.catch((function(e){var r,n;t._emitPlayFailed||(t._emitPlayFailed=!0,yB.rtcError("video autoplay failed, userId: ".concat(t.userId),-1e3),t.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(r=t._videoDom)||void 0===r?void 0:r.readyState)||0,userId:t.userId,eventName:"autoplay-error",currentTime:(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime)||0}))}))}}));var i=e.renderDom,o=e.userId;t.renderMode=void 0!==e.renderMode?e.renderMode:M.RENDER_MODE_FIT;var a="string"==typeof i?document.getElementById(i):i;if(!a)throw new JN(qN.CANT_FIND_DOM,"can't find dom");return t._containerDom=a,t.userId=o,t.isScreen=!!e.isScreen,t._initVideo(),t}return l(n,[{key:"_initVideo",value:function(){this._videoDom||(this._videoDom=tK.getOrCreate("video",{width:"100%",height:"100%"}),this._videoDom.id="".concat(this.userId,"_").concat(cP()),this.renderMode===M.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===B.MIRROR_TYPE_RENDER)),this._containerDom.appendChild(this._videoDom),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._videoDom&&Zz.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))}},{key:"_removeListeners",value:function(){var e=this;this._videoDom&&(Zz.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)})),this._videoDom.addEventListener("canplay",this._internalPlay),this._videoDom.addEventListener("loadeddata",this._internalPlay))}},{key:"_recordFrame",value:function(e){var t=this;this.on("playback_event",(function(r){var n,i=e.isScreen?1.5:.5;if("timeupdate"===r.eventName){if(e.isScreen,0===(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime))return;if(void 0===t.__cumulativeTime)return void(t.__cumulativeTime=t._videoDom.currentTime);if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t._videoDom.currentTime>t.__cumulativeTime){var o=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),a=t._videoDom.currentTime-t.__cumulativeTime>i;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))}},{key:"playVideo",value:(t=c(o().mark((function e(t,r){var n,i,a,s,c=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=this._videoDom,Qz.print("playVideo","play video track: ".concat(this.userId)),!(a&&a.srcObject instanceof MediaStream&&a.srcObject.getTrackById(null===(n=t.getTrack())||void 0===n?void 0:n.id))){e.next=4;break}return e.abrupt("return");case 4:a||(this._initVideo(),a=this._videoDom),Qz.print("playVideo","play video by dom: ".concat(null===(i=a)||void 0===i?void 0:i.id)),(s=new MediaStream).addTrack(t.getTrack()),a.srcObject=s,a&&!this._containerDom.contains(a)&&this._containerDom.appendChild(a),a.addEventListener("canplay",this._internalPlay),a.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return c._internalPlay()})),r&&this._recordFrame(r),this.played=!0;case 15:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"updateSrcObject",value:function(e){var t=e.getTrack();if(t&&this._videoDom){var r=new MediaStream;r.addTrack(t),this._videoDom.srcObject=r}}},{key:"manuallyPlay",value:function(){if(Qz.print("Invoke VideoPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._videoDom)throw new JN(qN.INVALID_PARAMS,"Player not found");return this._videoDom.play()}},{key:"mirror",value:function(e){Qz.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?B.MIRROR_TYPE_RENDER:B.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")}},{key:"stop",value:function(){var e=this._containerDom;Qz.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,e&&e.contains(this._videoDom)&&e.removeChild(this._videoDom)),this.__cumulativeTime=void 0,this.played=!1}},{key:"destroy",value:function(){Qz.print("destroy","video player: ".concat(this.userId)),this.stop(),b(p(n.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._videoDom&&(tK.recycle(this._videoDom),delete this._videoDom)}},{key:"domElement",get:function(){return this._videoDom}}]),n}(AU.exports.EventEmitter),nK=function(e){f(i,e);var t,r,n=g(i);function i(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{divId:void 0,muted:!1},o=r.divId,a=r.muted;if(u(this,i),h(m(t=n.call(this)),"_containerDom",void 0),h(m(t),"_audioDom",void 0),h(m(t),"_fakeAudioDom",void 0),h(m(t),"userId",void 0),h(m(t),"muted",!1),h(m(t),"_emitPlayFailed",!1),h(m(t),"played",!1),h(m(t),"emitAudioEvent",(function(e){var r,n,i={type:"audio",rawEvent:e,readyState:(null===(r=t._audioDom)||void 0===r?void 0:r.readyState)||0,userId:t.userId,eventName:e.type,currentTime:(null===(n=t._audioDom)||void 0===n?void 0:n.currentTime)||0};t.emit("playback_event",i)})),h(m(t),"_internalPlay",(function(){var e,r;if(RB("_internalPlay",{paused:null===(e=t._audioDom)||void 0===e?void 0:e.paused}),null!==(r=t._audioDom)&&void 0!==r&&r.paused)try{var n=t._audioDom.play();null!=n&&n.then&&n.catch((function(e){t._autoPlayError(e)})).then((function(){RB("_internalPlay successfully",{userId:t.userId})}))}catch(i){t._autoPlayError(i)}})),o){var s=document.getElementById(o);if(!s)throw new JN(qN.CANT_FIND_DOM,"can't find dom");t._containerDom=s}else t._containerDom=document.body;return t.userId=e,t.muted=a,t._initAudio(),t}return l(i,[{key:"_initAudio",value:function(){this._audioDom||(this._audioDom=tK.getOrCreate("audio",{display:"none"}),this._audioDom.volume=this.muted?0:1,this._audioDom.id="".concat(this.userId,"_").concat(cP()),this._containerDom.appendChild(this._audioDom)),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._audioDom&&Zz.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.addEventListener(t,e.emitAudioEvent)}))}},{key:"_removeListeners",value:function(){var e=this;this._audioDom&&(Zz.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.removeEventListener(t,e.emitAudioEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))}},{key:"playAudio",value:(r=c(o().mark((function e(t){var r,n,i,a,s,c=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Qz.print("playAudio","play audio track: ".concat(this.userId)),!((a=this._audioDom)&&a.srcObject instanceof MediaStream&&a.srcObject.getTrackById(null===(r=t.getTrack())||void 0===r?void 0:r.id))){e.next=4;break}return e.abrupt("return");case 4:a||(this._initAudio(),a=this._audioDom),(s=new MediaStream).addTrack(t.getTrack()),a.srcObject=s,null===(n=a)||void 0===n||n.addEventListener("canplay",this._internalPlay),null===(i=a)||void 0===i||i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return c._internalPlay()})),this.played=!0;case 12:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_autoPlayError",value:function(e){var t,r;this._emitPlayFailed||(this._emitPlayFailed=!0,yB.rtcError("audio autoplay failed, userId: ".concat(this.userId,": ").concat(e.message),-1e3),this.emit("playback_event",{type:"audio",rawEvent:e,readyState:(null===(t=this._audioDom)||void 0===t?void 0:t.readyState)||0,userId:this.userId,eventName:"autoplay-error",currentTime:(null===(r=this._audioDom)||void 0===r?void 0:r.currentTime)||0}))}},{key:"manuallyPlay",value:function(){var e;if(Qz.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new JN(qN.INVALID_PARAMS,"Player not found");this._audioDom.volume=1,null===(e=this._fakeAudioDom)||void 0===e||e.play();var t=this._audioDom.play();return null!=t&&t.then?t:Promise.resolve(t)}},{key:"setPlaybackDevice",value:(t=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Qz.print("setPlaybackDevice","setPlaybackDevice: ".concat(t)),e.next=3,pH.enumerateAudioPlaybackDevices();case 3:if(e.sent.map((function(e){return e.deviceId})).includes(t)&&this._audioDom&&this._audioDom.setSinkId){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,this._audioDom.setSinkId(t);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"stop",value:function(){var e=this._containerDom;Qz.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom)),this._fakeAudioDom&&(this._fakeAudioDom.srcObject=null,this._fakeAudioDom=void 0)}},{key:"domElement",get:function(){return this._audioDom}},{key:"destroy",value:function(){Qz.print("destroy","audio player: ".concat(this.userId)),this.stop(),b(p(i.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._audioDom&&(tK.recycle(this._audioDom),delete this._audioDom)}}]),i}(AU.exports.EventEmitter),iK=function(){function e(){u(this,e),h(this,"_timer",void 0),h(this,"userMessage",void 0),h(this,"roomMessage",void 0),this.userMessage={},this.roomMessage={},this._setTimer()}return l(e,[{key:"_setTimer",value:function(){var e=this;!function t(){e._reportAndgReset(),clearTimeout(e._timer),e._timer=setTimeout(t,1e4)}()}},{key:"_reportAndgReset",value:function(){this._report(),this._reset()}},{key:"_report",value:function(){var e=this;yB.rtcMessageStatistics(Object.keys(this.userMessage).map((function(t){return e.userMessage[t]})),Object.keys(this.roomMessage).map((function(t){return e.roomMessage[t]})),"")}},{key:"_reset",value:function(){this.userMessage={},this.roomMessage={}}},{key:"_checkInitUserMessage",value:function(e,t){this.userMessage["".concat(t,"-").concat(e)]||(this.userMessage["".concat(t,"-").concat(e)]={dc_peer_user_id:e,dc_send_total:0,dc_recv_total:0,dc_send_ack:0,dc_send_fail:0,dc_cost_time:0,dc_cost_e2s:0,dc_cost_s2s:0,dc_least_time:1/0,dc_most_time:0,dc_cost_peer_s2e:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_message_type:t,dc_send_binary:0})}},{key:"_sendUserMessage",value:function(e,t,r){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_send_total++,r&&this.userMessage["".concat(t,"-").concat(e)].dc_send_binary++}},{key:"_recvUserMessage",value:function(e,t){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_recv_total++}},{key:"_sendUserFail",value:function(e,t){var r=this.userMessage["".concat(t,"-").concat(e)];r&&r.dc_send_fail++}},{key:"_sendUserAck",value:function(e,t,r,n,i){var o=this.userMessage["".concat(t,"-").concat(e)];o&&(o.dc_send_ack++,o.dc_cost_time+=r,o.dc_cost_s2s+=n||0,o.dc_cost_peer_s2e+=i,o.dc_cost_e2s+=r-(n||0)-i,r<=100?(o.dc_send_ack_100++,o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):r<=200?(o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):r<=400?(o.dc_send_ack_400++,o.dc_send_ack_1s++):r<=1e3&&o.dc_send_ack_1s++,r<o.dc_least_time&&(o.dc_least_time=r),r>o.dc_most_time&&(o.dc_most_time=r))}},{key:"sendRoomMessage",value:function(e,t){this.roomMessage[e]||(this.roomMessage[e]={dc_room_id:e,dc_send_total:0,dc_send_ack:0,dc_cost_time:0,dc_least_time:1/0,dc_most_time:0,dc_send_fail:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_send_binary:0}),this.roomMessage[e].dc_send_total++,t&&this.roomMessage[e].dc_send_binary++}},{key:"sendRoomFail",value:function(e){var t=this.roomMessage[e];t&&t.dc_send_fail++}},{key:"sendRoomAck",value:function(e,t){var r=this.roomMessage[e];r&&(r.dc_send_ack++,r.dc_cost_time+=t,t<r.dc_least_time&&(r.dc_least_time=t),t>r.dc_most_time&&(r.dc_most_time=t),t<=100?(r.dc_send_ack_100++,r.dc_send_ack_200++,r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=200?(r.dc_send_ack_200++,r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=400?(r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=1e3&&r.dc_send_ack_1s++)}},{key:"sendP2PMessage",value:function(e,t){this._sendUserMessage(e,fB.P2P,t)}},{key:"recvP2PMessage",value:function(e){this._recvUserMessage(e,fB.P2P)}},{key:"sendP2PFail",value:function(e){this._sendUserFail(e,fB.P2P)}},{key:"sendP2PAck",value:function(e,t,r,n){this._sendUserAck(e,fB.P2P,t,r,n)}},{key:"sendP2POutRoomMessage",value:function(e,t){this._sendUserMessage(e,fB.P2P_OUTSIDE_ROOM,t)}},{key:"recvP2POutRoomMessage",value:function(e){this._recvUserMessage(e,fB.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomFail",value:function(e){this._sendUserFail(e,fB.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomAck",value:function(e,t,r,n){this._sendUserAck(e,fB.P2P_OUTSIDE_ROOM,t,r,n)}},{key:"sendP2serverMessage",value:function(e){this._sendUserMessage("",fB.P2SERVER,e)}},{key:"sendP2serverFail",value:function(){this._sendUserFail("",fB.P2SERVER)}},{key:"sendP2serveAck",value:function(e){this._sendUserAck("",fB.P2SERVER,e,0,0)}},{key:"countP2PMessage",value:function(e,t,r,n,i){this.sendP2PMessage(t,r),e?this.sendP2PAck(t,Date.now()-n,i.s2s_time,i.s2e_time):this.sendP2PFail(t)}},{key:"countRoomMessage",value:function(e,t,r,n){this.sendRoomMessage(t,r),e?this.sendRoomAck(t,Date.now()-n):this.sendRoomFail(t)}},{key:"countUserMessageOutsideRoom",value:function(e,t,r,n,i){this.sendP2POutRoomMessage(t,r),e?this.sendP2POutRoomAck(t,Date.now()-n,i.s2s_time,i.s2e_time):this.sendP2POutRoomFail(t)}},{key:"countServerMessage",value:function(e,t,r){this.sendP2serverMessage(t),e?this.sendP2serveAck(Date.now()-r):this.sendP2serverFail()}},{key:"destroy",value:function(){this._reset(),clearTimeout(this._timer)}}]),e}(),oK="object"==typeof global&&global&&global.Object===Object&&global,aK="object"==typeof self&&self&&self.Object===Object&&self,sK=oK||aK||Function("return this")(),cK=sK.Symbol,uK=Object.prototype,dK=uK.hasOwnProperty,lK=uK.toString,hK=cK?cK.toStringTag:void 0;var fK=Object.prototype.toString;var pK=cK?cK.toStringTag:void 0;function _K(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":pK&&pK in Object(e)?function(e){var t=dK.call(e,hK),r=e[hK];try{e[hK]=void 0;var n=!0}catch(o){}var i=lK.call(e);return n&&(t?e[hK]=r:delete e[hK]),i}(e):function(e){return fK.call(e)}(e)}function vK(e){return null!=e&&"object"==typeof e}var mK=Array.isArray;function yK(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function gK(e){return e}function SK(e){if(!yK(e))return!1;var t=_K(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var bK=sK["__core-js_shared__"],EK=function(){var e=/[^.]+$/.exec(bK&&bK.keys&&bK.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var kK=Function.prototype.toString;var TK=/^\[object .+?Constructor\]$/,IK=Function.prototype,AK=Object.prototype,RK=IK.toString,wK=AK.hasOwnProperty,CK=RegExp("^"+RK.call(wK).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function OK(e){return!(!yK(e)||(t=e,EK&&EK in t))&&(SK(e)?CK:TK).test(function(e){if(null!=e){try{return kK.call(e)}catch(t){}try{return e+""}catch(t){}}return""}(e));var t}function xK(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var NK=Date.now;var DK,PK,MK,UK=function(){try{var e=function(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return OK(r)?r:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),LK=UK,VK=LK?function(e,t){return LK(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:gK,FK=(DK=VK,PK=0,MK=0,function(){var e=NK(),t=16-(e-MK);if(MK=e,t>0){if(++PK>=800)return arguments[0]}else PK=0;return DK.apply(void 0,arguments)}),BK=FK,jK=/^(?:0|[1-9]\d*)$/;function GK(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&jK.test(e))&&e>-1&&e%1==0&&e<t}function HK(e,t,r){"__proto__"==t&&LK?LK(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function zK(e,t){return e===t||e!=e&&t!=t}var KK=Object.prototype.hasOwnProperty;function WK(e,t,r){var n=e[t];KK.call(e,t)&&zK(n,r)&&(void 0!==r||t in e)||HK(e,t,r)}var XK=Math.max;function qK(e,t){return BK(function(e,t,r){return t=XK(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=XK(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),xK(e,this,s)}}(e,t,gK),e+"")}function YK(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function JK(e){return null!=e&&YK(e.length)&&!SK(e)}var QK=Object.prototype;function ZK(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||QK)}function $K(e){return vK(e)&&"[object Arguments]"==_K(e)}var eW=Object.prototype,tW=eW.hasOwnProperty,rW=eW.propertyIsEnumerable,nW=$K(function(){return arguments}())?$K:function(e){return vK(e)&&tW.call(e,"callee")&&!rW.call(e,"callee")},iW=nW;var oW="object"==typeof exports&&exports&&!exports.nodeType&&exports,aW=oW&&"object"==typeof module&&module&&!module.nodeType&&module,sW=aW&&aW.exports===oW?sK.Buffer:void 0,cW=(sW?sW.isBuffer:void 0)||function(){return!1},uW={};uW["[object Float32Array]"]=uW["[object Float64Array]"]=uW["[object Int8Array]"]=uW["[object Int16Array]"]=uW["[object Int32Array]"]=uW["[object Uint8Array]"]=uW["[object Uint8ClampedArray]"]=uW["[object Uint16Array]"]=uW["[object Uint32Array]"]=!0,uW["[object Arguments]"]=uW["[object Array]"]=uW["[object ArrayBuffer]"]=uW["[object Boolean]"]=uW["[object DataView]"]=uW["[object Date]"]=uW["[object Error]"]=uW["[object Function]"]=uW["[object Map]"]=uW["[object Number]"]=uW["[object Object]"]=uW["[object RegExp]"]=uW["[object Set]"]=uW["[object String]"]=uW["[object WeakMap]"]=!1;var dW="object"==typeof exports&&exports&&!exports.nodeType&&exports,lW=dW&&"object"==typeof module&&module&&!module.nodeType&&module,hW=lW&&lW.exports===dW&&oK.process,fW=function(){try{var e=lW&&lW.require&&lW.require("util").types;return e||hW&&hW.binding&&hW.binding("util")}catch(t){}}(),pW=fW&&fW.isTypedArray,_W=pW?function(e){return function(t){return e(t)}}(pW):function(e){return vK(e)&&YK(e.length)&&!!uW[_K(e)]},vW=_W,mW=Object.prototype.hasOwnProperty;function yW(e,t){var r=mK(e),n=!r&&iW(e),i=!r&&!n&&cW(e),o=!r&&!n&&!i&&vW(e),a=r||n||i||o,s=a?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var u in e)!t&&!mW.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||GK(u,c))||s.push(u);return s}var gW=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),SW=gW,bW=Object.prototype.hasOwnProperty;function EW(e){return JK(e)?yW(e):function(e){if(!ZK(e))return SW(e);var t=[];for(var r in Object(e))bW.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var kW=Object.prototype.hasOwnProperty;function TW(e){if(!yK(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=ZK(e),r=[];for(var n in e)("constructor"!=n||!t&&kW.call(e,n))&&r.push(n);return r}var IW,AW=(IW=function(e,t){!function(e,t,r,n){var i=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),i?HK(r,s,c):WK(r,s,c)}}(t,function(e){return JK(e)?yW(e,!0):TW(e)}(t),e)},qK((function(e,t){var r=-1,n=t.length,i=n>1?t[n-1]:void 0,o=n>2?t[2]:void 0;for(i=IW.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!yK(r))return!1;var n=typeof t;return!!("number"==n?JK(r)&&GK(t,r.length):"string"==n&&t in r)&&zK(r[t],e)}(t[0],t[1],o)&&(i=n<3?void 0:i,n=1),e=Object(e);++r<n;){var a=t[r];a&&IW(e,a,r,i)}return e}))),RW=AW;function wW(e,t){return function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(t,(function(t){return e[t]}))}function CW(e){return null==e?[]:wW(e,EW(e))}var OW=me,xW=_t("iterator"),NW=!OW((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})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[xW]||"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})),DW=ke,PW=2147483647,MW=/[^\0-\u007E]/,UW=/[.\u3002\uFF0E\uFF61]/g,LW="Overflow: input needs wider integers to process",VW=RangeError,FW=DW(UW.exec),BW=Math.floor,jW=String.fromCharCode,GW=DW("".charCodeAt),HW=DW([].join),zW=DW([].push),KW=DW("".replace),WW=DW("".split),XW=DW("".toLowerCase),qW=function(e){return e+22+75*(e<26)},YW=function(e,t,r){var n=0;for(e=r?BW(e/700):e>>1,e+=BW(e/t);e>455;)e=BW(e/35),n+=36;return BW(n+36*e/(e+38))},JW=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=GW(e,r++);if(i>=55296&&i<=56319&&r<n){var o=GW(e,r++);56320==(64512&o)?zW(t,((1023&i)<<10)+(1023&o)+65536):(zW(t,i),r--)}else zW(t,i)}return t}(e);var r,n,i=e.length,o=128,a=0,s=72;for(r=0;r<e.length;r++)(n=e[r])<128&&zW(t,jW(n));var c=t.length,u=c;for(c&&zW(t,"-");u<i;){var d=PW;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=u+1;if(d-o>BW((PW-a)/l))throw VW(LW);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>PW)throw VW(LW);if(n==o){for(var h=a,f=36;;){var p=f<=s?1:f>=s+26?26:f-s;if(h<p)break;var _=h-p,v=36-p;zW(t,jW(qW(p+_%v))),h=BW(_/v),f+=36}zW(t,jW(qW(h))),s=YW(a,l,u==c),a=0,u++}}a++,o++}return HW(t,"")},QW=la,ZW=ae,$W=Ut,eX=ke,tX=gt,rX=NW,nX=Rn,iX=mh,oX=Au,aX=Du,sX=dn,cX=zl,uX=Ge,dX=De,lX=Qn,hX=Vn,fX=Dt,pX=Et,_X=$a,vX=Ma,mX=jr,yX=kl,gX=vl,SX=fv,bX=OI,EX=_t("iterator"),kX="URLSearchParams",TX="URLSearchParamsIterator",IX=sX.set,AX=sX.getterFor(kX),RX=sX.getterFor(TX),wX=Object.getOwnPropertyDescriptor,CX=function(e){if(!tX)return ZW[e];var t=wX(ZW,e);return t&&t.value},OX=CX("fetch"),xX=CX("Request"),NX=CX("Headers"),DX=xX&&xX.prototype,PX=NX&&NX.prototype,MX=ZW.RegExp,UX=ZW.TypeError,LX=ZW.decodeURIComponent,VX=ZW.encodeURIComponent,FX=eX("".charAt),BX=eX([].join),jX=eX([].push),GX=eX("".replace),HX=eX([].shift),zX=eX([].splice),KX=eX("".split),WX=eX("".slice),XX=/\+/g,qX=Array(4),YX=function(e){return qX[e-1]||(qX[e-1]=MX("((?:%[\\da-f]{2}){"+e+"})","gi"))},JX=function(e){try{return LX(e)}catch(RJ){return e}},QX=function(e){var t=GX(e,XX," "),r=4;try{return LX(t)}catch(RJ){for(;r;)t=GX(t,YX(r--),JX);return t}},ZX=/[!'()~]|%20/g,$X={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},eq=function(e){return $X[e]},tq=function(e){return GX(VX(e),ZX,eq)},rq=aX((function(e,t){IX(this,{type:TX,iterator:yX(AX(e).entries),kind:t})}),"Iterator",(function(){var e=RX(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),nq=function(e){this.entries=[],this.url=null,void 0!==e&&(pX(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===FX(e,0)?WX(e,1):e:_X(e)))};nq.prototype={type:kX,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,c=gX(e);if(c)for(r=(t=yX(e,c)).next;!(n=$W(r,t)).done;){if(o=(i=yX(fX(n.value))).next,(a=$W(o,i)).done||(s=$W(o,i)).done||!$W(o,i).done)throw UX("Expected sequence with length 2");jX(this.entries,{key:_X(a.value),value:_X(s.value)})}else for(var u in e)dX(e,u)&&jX(this.entries,{key:u,value:_X(e[u])})},parseQuery:function(e){if(e)for(var t,r,n=KX(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=KX(t,"="),jX(this.entries,{key:QX(HX(r)),value:QX(BX(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],jX(r,tq(e.key)+"="+tq(e.value));return BX(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var iq=function(){cX(this,oq);var e=arguments.length>0?arguments[0]:void 0;IX(this,new nq(e))},oq=iq.prototype;if(iX(oq,{append:function(e,t){SX(arguments.length,2);var r=AX(this);jX(r.entries,{key:_X(e),value:_X(t)}),r.updateURL()},delete:function(e){SX(arguments.length,1);for(var t=AX(this),r=t.entries,n=_X(e),i=0;i<r.length;)r[i].key===n?zX(r,i,1):i++;t.updateURL()},get:function(e){SX(arguments.length,1);for(var t=AX(this).entries,r=_X(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){SX(arguments.length,1);for(var t=AX(this).entries,r=_X(e),n=[],i=0;i<t.length;i++)t[i].key===r&&jX(n,t[i].value);return n},has:function(e){SX(arguments.length,1);for(var t=AX(this).entries,r=_X(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){SX(arguments.length,1);for(var r,n=AX(this),i=n.entries,o=!1,a=_X(e),s=_X(t),c=0;c<i.length;c++)(r=i[c]).key===a&&(o?zX(i,c--,1):(o=!0,r.value=s));o||jX(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=AX(this);bX(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=AX(this).entries,n=lX(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 rq(this,"keys")},values:function(){return new rq(this,"values")},entries:function(){return new rq(this,"entries")}},{enumerable:!0}),nX(oq,EX,oq.entries,{name:"entries"}),nX(oq,"toString",(function(){return AX(this).serialize()}),{enumerable:!0}),oX(iq,kX),QW({global:!0,constructor:!0,forced:!rX},{URLSearchParams:iq}),!rX&&uX(NX)){var aq=eX(PX.has),sq=eX(PX.set),cq=function(e){if(pX(e)){var t,r=e.body;if(hX(r)===kX)return t=e.headers?new NX(e.headers):new NX,aq(t,"content-type")||sq(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),vX(e,{body:mX(0,_X(r)),headers:mX(0,t)})}return e};if(uX(OX)&&QW({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return OX(e,arguments.length>1?cq(arguments[1]):{})}}),uX(xX)){var uq=function(e){return cX(this,DX),new xX(e,arguments.length>1?cq(arguments[1]):{})};DX.constructor=uq,uq.prototype=DX,QW({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:uq})}}var dq,lq=la,hq=gt,fq=NW,pq=ae,_q=Qn,vq=ke,mq=Rn,yq=fg,gq=zl,Sq=De,bq=yp,Eq=MD,kq=Nd,Tq=Ec.codeAt,Iq=function(e){var t,r,n=[],i=WW(KW(XW(e),UW,"."),".");for(t=0;t<i.length;t++)r=i[t],zW(n,FW(MW,r)?"xn--"+JW(r):r);return HW(n,".")},Aq=$a,Rq=Au,wq=fv,Cq={URLSearchParams:iq,getState:AX},Oq=dn,xq=Oq.set,Nq=Oq.getterFor("URL"),Dq=Cq.URLSearchParams,Pq=Cq.getState,Mq=pq.URL,Uq=pq.TypeError,Lq=pq.parseInt,Vq=Math.floor,Fq=Math.pow,Bq=vq("".charAt),jq=vq(/./.exec),Gq=vq([].join),Hq=vq(1..toString),zq=vq([].pop),Kq=vq([].push),Wq=vq("".replace),Xq=vq([].shift),qq=vq("".split),Yq=vq("".slice),Jq=vq("".toLowerCase),Qq=vq([].unshift),Zq="Invalid scheme",$q="Invalid host",eY="Invalid port",tY=/[a-z]/i,rY=/[\d+-.a-z]/i,nY=/\d/,iY=/^0x/i,oY=/^[0-7]+$/,aY=/^\d+$/,sY=/^[\da-f]+$/i,cY=/[\0\t\n\r #%/:<>?@[\\\]^|]/,uY=/[\0\t\n\r #/:<>?@[\\\]^|]/,dY=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,lY=/[\t\n\r]/g,hY=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)Qq(t,e%256),e=Vq(e/256);return Gq(t,".")}if("object"==typeof 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+=Hq(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},fY={},pY=bq({},fY,{" ":1,'"':1,"<":1,">":1,"`":1}),_Y=bq({},pY,{"#":1,"?":1,"{":1,"}":1}),vY=bq({},_Y,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),mY=function(e,t){var r=Tq(e,0);return r>32&&r<127&&!Sq(t,e)?e:encodeURIComponent(e)},yY={ftp:21,file:null,http:80,https:443,ws:80,wss:443},gY=function(e,t){var r;return 2==e.length&&jq(tY,Bq(e,0))&&(":"==(r=Bq(e,1))||!t&&"|"==r)},SY=function(e){var t;return e.length>1&&gY(Yq(e,0,2))&&(2==e.length||"/"===(t=Bq(e,2))||"\\"===t||"?"===t||"#"===t)},bY=function(e){return"."===e||"%2e"===Jq(e)},EY={},kY={},TY={},IY={},AY={},RY={},wY={},CY={},OY={},xY={},NY={},DY={},PY={},MY={},UY={},LY={},VY={},FY={},BY={},jY={},GY={},HY=function(e,t,r){var n,i,o,a=Aq(e);if(t){if(i=this.parse(a))throw Uq(i);this.searchParams=null}else{if(void 0!==r&&(n=new HY(r,!0)),i=this.parse(a,null,n))throw Uq(i);(o=Pq(new Dq)).bindURL(this),this.searchParams=o}};HY.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,c=this,u=t||EY,d=0,l="",h=!1,f=!1,p=!1;for(e=Aq(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=Wq(e,dY,"")),e=Wq(e,lY,""),n=Eq(e);d<=n.length;){switch(i=n[d],u){case EY:if(!i||!jq(tY,i)){if(t)return Zq;u=TY;continue}l+=Jq(i),u=kY;break;case kY:if(i&&(jq(rY,i)||"+"==i||"-"==i||"."==i))l+=Jq(i);else{if(":"!=i){if(t)return Zq;l="",u=TY,d=0;continue}if(t&&(c.isSpecial()!=Sq(yY,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&yY[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=MY:c.isSpecial()&&r&&r.scheme==c.scheme?u=IY:c.isSpecial()?u=CY:"/"==n[d+1]?(u=AY,d++):(c.cannotBeABaseURL=!0,Kq(c.path,""),u=BY)}break;case TY:if(!r||r.cannotBeABaseURL&&"#"!=i)return Zq;if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=kq(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=GY;break}u="file"==r.scheme?MY:RY;continue;case IY:if("/"!=i||"/"!=n[d+1]){u=RY;continue}u=OY,d++;break;case AY:if("/"==i){u=xY;break}u=FY;continue;case RY:if(c.scheme=r.scheme,i==dq)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=kq(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())u=wY;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=kq(r.path),c.query="",u=jY;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=kq(r.path),c.path.length--,u=FY;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=kq(r.path),c.query=r.query,c.fragment="",u=GY}break;case wY:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=FY;continue}u=xY}else u=OY;break;case CY:if(u=OY,"/"!=i||"/"!=Bq(l,d+1))continue;d++;break;case OY:if("/"!=i&&"\\"!=i){u=xY;continue}break;case xY:if("@"==i){h&&(l="%40"+l),h=!0,o=Eq(l);for(var _=0;_<o.length;_++){var v=o[_];if(":"!=v||p){var m=mY(v,vY);p?c.password+=m:c.username+=m}else p=!0}l=""}else if(i==dq||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=Eq(l).length+1,l="",u=NY}else l+=i;break;case NY:case DY:if(t&&"file"==c.scheme){u=LY;continue}if(":"!=i||f){if(i==dq||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return $q;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=VY,t)return;continue}"["==i?f=!0:"]"==i&&(f=!1),l+=i}else{if(""==l)return $q;if(a=c.parseHost(l))return a;if(l="",u=PY,t==DY)return}break;case PY:if(!jq(nY,i)){if(i==dq||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var y=Lq(l,10);if(y>65535)return eY;c.port=c.isSpecial()&&y===yY[c.scheme]?null:y,l=""}if(t)return;u=VY;continue}return eY}l+=i;break;case MY:if(c.scheme="file","/"==i||"\\"==i)u=UY;else{if(!r||"file"!=r.scheme){u=FY;continue}if(i==dq)c.host=r.host,c.path=kq(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=kq(r.path),c.query="",u=jY;else{if("#"!=i){SY(Gq(kq(n,d),""))||(c.host=r.host,c.path=kq(r.path),c.shortenPath()),u=FY;continue}c.host=r.host,c.path=kq(r.path),c.query=r.query,c.fragment="",u=GY}}break;case UY:if("/"==i||"\\"==i){u=LY;break}r&&"file"==r.scheme&&!SY(Gq(kq(n,d),""))&&(gY(r.path[0],!0)?Kq(c.path,r.path[0]):c.host=r.host),u=FY;continue;case LY:if(i==dq||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&gY(l))u=FY;else if(""==l){if(c.host="",t)return;u=VY}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=VY}continue}l+=i;break;case VY:if(c.isSpecial()){if(u=FY,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=dq&&(u=FY,"/"!=i))continue}else c.fragment="",u=GY;else c.query="",u=jY;break;case FY:if(i==dq||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=Jq(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||Kq(c.path,"")):bY(l)?"/"==i||"\\"==i&&c.isSpecial()||Kq(c.path,""):("file"==c.scheme&&!c.path.length&&gY(l)&&(c.host&&(c.host=""),l=Bq(l,0)+":"),Kq(c.path,l)),l="","file"==c.scheme&&(i==dq||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)Xq(c.path);"?"==i?(c.query="",u=jY):"#"==i&&(c.fragment="",u=GY)}else l+=mY(i,_Y);break;case BY:"?"==i?(c.query="",u=jY):"#"==i?(c.fragment="",u=GY):i!=dq&&(c.path[0]+=mY(i,fY));break;case jY:t||"#"!=i?i!=dq&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":mY(i,fY)):(c.fragment="",u=GY);break;case GY:i!=dq&&(c.fragment+=mY(i,pY))}d++}},parseHost:function(e){var t,r,n;if("["==Bq(e,0)){if("]"!=Bq(e,e.length-1))return $q;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,h=function(){return Bq(e,l)};if(":"==h()){if(":"!=Bq(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&jq(sY,h());)t=16*t+Lq(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,u>6)return;for(n=0;h();){if(i=null,n>0){if(!("."==h()&&n<4))return;l++}if(!jq(nY,h()))return;for(;jq(nY,h());){if(o=Lq(h(),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(":"==h()){if(l++,!h())return}else if(h())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}(Yq(e,1,-1)),!t)return $q;this.host=t}else if(this.isSpecial()){if(e=Iq(e),jq(cY,e))return $q;if(t=function(e){var t,r,n,i,o,a,s,c=qq(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"==Bq(i,0)&&(o=jq(iY,i)?16:8,i=Yq(i,8==o?1:2)),""===i)a=0;else{if(!jq(10==o?aY:8==o?oY:sY,i))return e;a=Lq(i,o)}Kq(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=Fq(256,5-t))return null}else if(a>255)return null;for(s=zq(r),n=0;n<r.length;n++)s+=r[n]*Fq(256,3-n);return s}(e),null===t)return $q;this.host=t}else{if(jq(uY,e))return $q;for(t="",r=Eq(e),n=0;n<r.length;n++)t+=mY(r[n],fY);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return Sq(yY,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&gY(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+=hY(i),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+Gq(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw Uq(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new zY(e.path[0]).origin}catch(RJ){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+hY(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(Aq(e)+":",EY)},getUsername:function(){return this.username},setUsername:function(e){var t=Eq(Aq(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=mY(t[r],vY)}},getPassword:function(){return this.password},setPassword:function(e){var t=Eq(Aq(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=mY(t[r],vY)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?hY(e):hY(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,NY)},getHostname:function(){var e=this.host;return null===e?"":hY(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,DY)},getPort:function(){var e=this.port;return null===e?"":Aq(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=Aq(e))?this.port=null:this.parse(e,PY))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+Gq(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,VY))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=Aq(e))?this.query=null:("?"==Bq(e,0)&&(e=Yq(e,1)),this.query="",this.parse(e,jY)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=Aq(e))?("#"==Bq(e,0)&&(e=Yq(e,1)),this.fragment="",this.parse(e,GY)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var zY=function(e){var t=gq(this,KY),r=wq(arguments.length,1)>1?arguments[1]:void 0,n=xq(t,new HY(e,!1,r));hq||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},KY=zY.prototype,WY=function(e,t){return{get:function(){return Nq(this)[e]()},set:t&&function(e){return Nq(this)[t](e)},configurable:!0,enumerable:!0}};if(hq&&(yq(KY,"href",WY("serialize","setHref")),yq(KY,"origin",WY("getOrigin")),yq(KY,"protocol",WY("getProtocol","setProtocol")),yq(KY,"username",WY("getUsername","setUsername")),yq(KY,"password",WY("getPassword","setPassword")),yq(KY,"host",WY("getHost","setHost")),yq(KY,"hostname",WY("getHostname","setHostname")),yq(KY,"port",WY("getPort","setPort")),yq(KY,"pathname",WY("getPathname","setPathname")),yq(KY,"search",WY("getSearch","setSearch")),yq(KY,"searchParams",WY("getSearchParams")),yq(KY,"hash",WY("getHash","setHash"))),mq(KY,"toJSON",(function(){return Nq(this).serialize()}),{enumerable:!0}),mq(KY,"toString",(function(){return Nq(this).serialize()}),{enumerable:!0}),Mq){var XY=Mq.createObjectURL,qY=Mq.revokeObjectURL;XY&&mq(zY,"createObjectURL",_q(XY,Mq)),qY&&mq(zY,"revokeObjectURL",_q(qY,Mq))}Rq(zY,"URL"),lq({global:!0,constructor:!0,forced:!fq,sham:!hq},{URL:zY});var YY=function(){var e=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Audio(URL.createObjectURL(new Blob([t],r))),e.prev=1,n.muted=!0,e.next=5,n.play();case 5:return n.pause(),e.abrupt("return",!0);case 9:return e.prev=9,e.t0=e.catch(1),e.abrupt("return",!1);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t,r){return e.apply(this,arguments)}}(),JY=Object.defineProperty,QY=Object.getOwnPropertyDescriptor,ZY=function(e,t,r,n){for(var i,o=n>1?void 0:n?QY(t,r):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&JY(t,r,o),o},$Y=function(){function e(t){u(this,e),h(this,"_sharedAudioContext",new AudioContext),h(this,"_audioDestination",this._sharedAudioContext.createMediaStreamDestination()),h(this,"_localGainNode",this._sharedAudioContext.createGain()),h(this,"_bufferGainNode",this._sharedAudioContext.createGain()),h(this,"_audioBufferSource",void 0),h(this,"_localSource",void 0),h(this,"_context",void 0),h(this,"_failedAudioList",[]),h(this,"mixingMap",new Map),h(this,"resourcesCache",new Map),h(this,"volumeConfig",new Map),h(this,"cachedBuffer",[]),this._context=t,this._localGainNode.gain.value=1}var t,r,n;return l(e,[{key:"mixMediaStream",value:function(e){this._localSource&&this._localSource.disconnect(this._localGainNode),this._localSource=this._sharedAudioContext.createMediaStreamSource(e),this._localSource.connect(this._localGainNode).connect(this._audioDestination)}},{key:"startAudioMixing",value:(n=c(o().mark((function e(t,r,n){var i,a,s,c,u,d,l,h,f,p,_,v,m,y=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.playCount,NP(a=n.type,"mixingType",CW(ee)),s=this._context.getLocalAudioTrack()){e.next=5;break}return e.abrupt("return");case 5:if(s.gainAudioTrack?(c=new MediaStream).addTrack(s.gainAudioTrack):c=bH(s.getTrack()),c&&this.mixMediaStream(c),(u=this.mixingMap.get(t))&&u.audioNode){u.audioNode.pause(),this._context.emitMessage({mixId:t,state:te.AUDIO_MIXING_STATE_STOPPED,error:YN.AUDIO_MIXING_ERROR_OK});try{u.gainNode.disconnect(this._audioDestination),u.audioSource.disconnect(u.gainNode)}catch(o){}}if(!(l=this.resourcesCache.get(t))||l.filePath!==r){e.next=14;break}d=l.getAudioNode(),e.next=28;break;case 14:return e.next=16,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw y._context.emitMessage({mixId:t,state:te.AUDIO_MIXING_STATE_FAILED,error:YN.AUDIO_MIXING_ERROR_START_FAILED}),new JN(qN.LOAD_RESOURCES_FAILED,e.statusText)}));case 16:return h=e.sent,r.endsWith("mp3")?f={type:"audio/mpeg"}:r.endsWith("aac")&&(f={type:"audio/aac"}),e.next=20,YY(h,f);case 20:if(e.sent){e.next=25;break}throw this._context.emitMessage({mixId:t,state:te.AUDIO_MIXING_STATE_FAILED,error:YN.AUDIO_MIXING_ERROR_START_FAILED}),new JN(qN.LOAD_RESOURCES_FAILED,"invalid audio resource");case 25:(d=new Audio).crossOrigin="anonymous",d.src=URL.createObjectURL(new Blob([h],f));case 28:return i<=0?d.loop=!0:i>0&&(p=i,d.onended=function(){--p>0?d.play():(y.mixingMap.delete(t),y._context.emitMessage({mixId:t,state:te.AUDIO_MIXING_STATE_FINISHED,error:YN.AUDIO_MIXING_ERROR_OK}))}),e.prev=29,e.next=32,d.play();case 32:e.next=39;break;case 34:e.prev=34,e.t0=e.catch(29),console.error(e.t0),this._failedAudioList.push(d),this._context.onAutoPlayFailed();case 39:if(_=this._sharedAudioContext.createMediaElementSource(d),v=this._sharedAudioContext.createGain(),m=this.volumeConfig.get(t),v.gain.value=m?m/100:1,_.connect(v).connect(this._audioDestination),this.mixingMap.set(t,{audioSource:_,audioNode:d,gainNode:v,type:"file"}),a===ee.PUBLISH)try{v.disconnect(this._sharedAudioContext.destination)}catch(o){}else v.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],n.type),this._context.emitMessage({mixId:t,state:te.AUDIO_MIXING_STATE_PLAYING,error:YN.AUDIO_MIXING_ERROR_OK});case 48:case"end":return e.stop()}}),e,this,[[29,34]])}))),function(e,t,r){return n.apply(this,arguments)})},{key:"stopAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&"file"===t.type&&(this.mixingMap.delete(e),t.audioNode.pause(),t.audioSource.disconnect(t.gainNode),t.gainNode.disconnect(this._audioDestination),this._context.emitMessage({mixId:e,state:te.AUDIO_MIXING_STATE_STOPPED,error:YN.AUDIO_MIXING_ERROR_OK}))}},{key:"pauseAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:te.AUDIO_MIXING_STATE_PAUSED,error:YN.AUDIO_MIXING_ERROR_OK}),t.audioNode.pause())}},{key:"resumeAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:te.AUDIO_MIXING_STATE_PLAYING,error:YN.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())}},{key:"preloadAudioMixing",value:(r=c(o().mark((function e(t,r){var n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.stopAudioMixing(t),e.next=3,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw i._context.emitMessage({mixId:t,state:te.AUDIO_MIXING_STATE_FAILED,error:YN.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new JN(qN.LOAD_RESOURCES_FAILED,e.statusText)})).catch((function(e){throw i._context.emitMessage({mixId:t,state:te.AUDIO_MIXING_STATE_FAILED,error:YN.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new JN(qN.LOAD_RESOURCES_FAILED,"Load resources failed",e)}));case 3:return n=e.sent,e.next=6,YY(n);case 6:if(e.sent){e.next=10;break}throw this._context.emitMessage({mixId:t,state:te.AUDIO_MIXING_STATE_FAILED,error:YN.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new JN(qN.LOAD_RESOURCES_FAILED,"Load resources failed");case 10:this._context.emitMessage({mixId:t,state:te.AUDIO_MIXING_STATE_PRELOADED,error:YN.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(t,{getAudioNode:function(){return new Audio(URL.createObjectURL(new Blob([n])))},filePath:r});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"unloadAudioMixing",value:function(e){this.resourcesCache.has(e)&&this.resourcesCache.delete(e)}},{key:"getAudioMixingVolume",value:function(e){var t=this.mixingMap.get(e);return t?100*t.gainNode.gain.value:0}},{key:"setAudioMixingVolume",value:function(e,t){t<0?t=0:t>400&&(t=400),this.volumeConfig.set(e,t);var r=this.mixingMap.get(e);r&&(r.gainNode.gain.value=Number(t)/100)}},{key:"getAudioMixingDuration",value:function(e){var t=this.mixingMap.get(e),r=this.mixingMap.get(e);return t||r?t?1e3*t.audioNode.duration:r?1e3*r.audioNode.duration:0:0}},{key:"getAudioMixingCurrentPosition",value:function(e){var t=this.mixingMap.get(e);return t?1e3*t.audioNode.currentTime:0}},{key:"setAudioMixingPosition",value:function(e,t){var r=this.mixingMap.get(e);r&&(r.audioNode.currentTime=t/1e3,r.audioNode.play())}},{key:"enableAudioMixingBuffer",value:function(e){NP(e,"type",CW(ee));var t=this._context.getLocalAudioTrack();if(t){var r=bH(t.getTrack());if(r&&this.mixMediaStream(r),e===ee.PUBLISH)try{this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(n){}else this._bufferGainNode.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],e),this._bufferGainNode.connect(this._audioDestination),this._context.emitMessage({mixId:-1,state:te.AUDIO_MIXING_STATE_PCM_ENABLED,error:YN.AUDIO_MIXING_ERROR_OK})}}},{key:"disableAudioMixingBuffer",value:function(){if(this.cachedBuffer=[],this._audioBufferSource){try{this._audioBufferSource.disconnect(this._bufferGainNode),this._bufferGainNode.disconnect(this._audioDestination),this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}finally{this._audioBufferSource=void 0}this._context.updateLocalAudioTrack(),this._context.emitMessage({mixId:-1,state:te.AUDIO_MIXING_STATE_PCM_DISABLED,error:YN.AUDIO_MIXING_ERROR_OK})}}},{key:"pushAudioMixingBuffer",value:function(e){var t=this;if(!(this._audioBufferSource&&(this.cachedBuffer.push(e),this.cachedBuffer.length>0))){this._audioBufferSource=this._sharedAudioContext.createBufferSource(),this._audioBufferSource.buffer=e,this._audioBufferSource.connect(this._bufferGainNode);try{this._audioBufferSource.start()}catch(r){this._failedAudioList.push(this._audioBufferSource)}this._audioBufferSource.onended=function(){var e;if(null===(e=t._audioBufferSource)||void 0===e||e.disconnect(t._bufferGainNode),t._audioBufferSource=void 0,t.cachedBuffer.length){var r=t.cachedBuffer.shift();r&&t.pushAudioMixingBuffer(r)}}}}},{key:"stopAll",value:function(){var e=this;if(this._localSource)try{this._localSource.disconnect(this._localGainNode),delete this._localSource}catch(t){}this.mixingMap.forEach((function(t,r){e.stopAudioMixing(r)}))}},{key:"mixTrack",get:function(){return this._audioDestination.stream.getAudioTracks()[0]}},{key:"sharedAudioContext",get:function(){return this._sharedAudioContext}},{key:"resumeLocalPlay",value:(t=c(o().mark((function e(){var t,r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],r=A(this._failedAudioList),e.prev=2,r.s();case 4:if((n=r.n()).done){e.next=24;break}if(i=n.value,e.prev=6,!(i instanceof HTMLAudioElement)){e.next=13;break}return i.muted=!1,e.next=11,i.play();case 11:e.next=14;break;case 13:i.start();case 14:e.next=22;break;case 16:return e.prev=16,e.t0=e.catch(6),t.push(i),console.error(e.t0),this._context.onAutoPlayFailed(),e.abrupt("break",24);case 22:e.next=4;break;case 24:e.next=29;break;case 26:e.prev=26,e.t1=e.catch(2),r.e(e.t1);case 29:return e.prev=29,r.f(),e.finish(29);case 32:this._failedAudioList=t;case 33:case"end":return e.stop()}}),e,this,[[2,26,29,32],[6,16]])}))),function(){return t.apply(this,arguments)})},{key:"destroy",value:function(){var e=this._sharedAudioContext;"closed"!==e.state&&"function"==typeof e.close&&e.close(),this.cachedBuffer=[],this.mixingMap.clear(),this.resourcesCache.clear(),this.volumeConfig.clear()}}]),e}();ZY([IB("default","id","filePath","options")],$Y.prototype,"startAudioMixing",1),ZY([IB("default","id")],$Y.prototype,"stopAudioMixing",1),ZY([IB("default","id")],$Y.prototype,"pauseAudioMixing",1),ZY([IB("default","id")],$Y.prototype,"resumeAudioMixing",1),ZY([IB("default","id")],$Y.prototype,"preloadAudioMixing",1),ZY([IB("default","id")],$Y.prototype,"unloadAudioMixing",1),ZY([IB("default","id")],$Y.prototype,"getAudioMixingVolume",1),ZY([IB("default","id","volume")],$Y.prototype,"setAudioMixingVolume",1),ZY([IB("default","id")],$Y.prototype,"getAudioMixingDuration",1),ZY([IB("default","id")],$Y.prototype,"getAudioMixingCurrentPosition",1),ZY([IB("default","id","position")],$Y.prototype,"setAudioMixingPosition",1),ZY([IB("default","type")],$Y.prototype,"enableAudioMixingBuffer",1),ZY([IB()],$Y.prototype,"disableAudioMixingBuffer",1),ZY([IB("default","buffer")],$Y.prototype,"pushAudioMixingBuffer",1);var eJ=function(e){return e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser",e}(eJ||{}),tJ=new xU("RTMClient",1),rJ=function(e){f(v,e);var t,r,n,i,a,s,d,_=g(v);function v(e){var t;return u(this,v),h(m(t=_.call(this)),"_dataChannelSignal",null),h(m(t),"_handler",null),h(m(t),"_dataChannelSignalState",Nz.DISCONNECTED),h(m(t),"_loginSessionId",null),h(m(t),"_userId",null),h(m(t),"_token",null),h(m(t),"_isReconnecting",!1),h(m(t),"_reconnectTimer",null),h(m(t),"_loginResolveCallback",null),h(m(t),"_loginRejectCallback",null),h(m(t),"_iceConfigNode",null),h(m(t),"_wait_login_token",!1),h(m(t),"_serverParamsCache",void 0),t._appId=e,t}return l(v,[{key:"login",value:function(e,t){var r=this;return new Promise((function(n,i){if(tJ.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new JN(qN.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new JN(qN.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,EB.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(tJ.print("login","init dataChannelSingling"),r._dataChannelSignalState=Nz.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))}},{key:"logout",value:(d=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new JN(qN.NOT_LOGIN,"login first");case 2:return e.next=4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:uj.C2RTM}).catch((function(){}));case 4:this._closeDataChannelSignaling(),this._clearState();case 6:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"updateLoginToken",value:(s=c(o().mark((function e(t){var r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._token=t,e.abrupt("return",new Promise((function(e,t){r._wait_login_token?(r._loginResolveCallback=e,r._loginRejectCallback=t,r._login()):e()})));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(a=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new JN(qN.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.next=5,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:t},{functionType:uj.C2RTM});case 5:return r=e.sent,e.abrupt("return",null==r?void 0:r.status);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(i=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new JN(qN.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:t,room:"",msg:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"setServerParams",value:(n=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,xP(t,"signature"),xP(r,"url"),this._loginSessionId&&this._userId){e.next=5;break}throw new JN(qN.NOT_LOGIN,"login first");case 5:return this._checkDataChannelSignal(),e.next=8,this._dataChannelSignal.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,signature:t,url:r},{functionType:uj.C2RTM}).catch((function(e){throw new JN(qN.UNEXPECTED_ERROR,e.msg)}));case 8:this._serverParamsCache={signature:t,url:r},this.emit("onServerParamsSetResult"),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(0),this.emit("onServerParamsSetResult",e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[0,12]])}))),function(e,t){return n.apply(this,arguments)})},{key:"sendServerMessage",value:(r=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new JN(qN.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:ij.BUSINESS_SERVER,msg:t}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"destroy",value:function(){this._clearState(),this._closeDataChannelSignaling(),b(p(v.prototype),"removeAllListeners",this).call(this),delete this._serverParamsCache}},{key:"_login",value:function(){var e=this;if(this._userId){var t=cP();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:hP.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:jB.VERSION,deviceId:UB.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:uj.C2RTM}).then((function(){e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1,e._serverParamsCache&&e.setServerParams(e._serverParamsCache.signature,e._serverParamsCache.url)})).catch((function(t){var r,n,i=t||{},o=i.code,a=i.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(r=qN.INVALID_PARAMS,n="Invalid userId"):(r=qN.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=qN.LOGIN_FAILED,n="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new JN(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}}},{key:"_createDataChannelSignaling",value:(t=c(o().mark((function e(t){var r,n,i,a,s,c,u,d=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=new pj,i=this._iceConfigNode){e.next=16;break}return e.prev=3,e.next=6,null==n?void 0:n.getAccessNode(this._appId,"",t,UB.getDeviceId(),"");case 6:if(a=e.sent,i=a[0]){e.next=10;break}throw new Error;case 10:e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(3),RB("rtm.login.getNodeFailed","",0,!0),new JN(qN.ICE_SERVER_WRONG,"get ICE config failed");case 16:return RB("rtm.login.getNodeSuccess",i,0,!0),tJ.print("_createDataChannelSignaling()","get node success",i),this._handler=Ez(gB),null===(r=this._handler)||void 0===r||r.once("disconnect",(function(){tJ.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),d._onDisconnect()})),e.prev=20,e.next=23,null===(c=this._handler)||void 0===c?void 0:c.connect(i);case 23:s=e.sent,tJ.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=Nz.CONNECTED,e.next=33;break;case 28:throw e.prev=28,e.t1=e.catch(20),this._iceConfigNode=null,this._dataChannelSignalState=Nz.DISCONNECTED,new JN(qN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t1);case 33:return u=new lj(s),tJ.print("_createDataChannelSignaling()","send ping"),u.sendPingSignaling(),u.once("close",(function(){tJ.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),d._onDisconnect()})),u.on(ZB.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){d.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),u.on(ZB.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){d.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),u.on(ZB.USER_DISCONNECTION,(function(){d.emit("onUserDisconnection"),d._clearState()})),u.on(ZB.NODE_CHANGE,(function(e){RB("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(d._iceConfigNode=e.nodes[0]),d._loginResolveCallback&&d._loginRejectCallback?d._login():d._reconnect()})),e.abrupt("return",u);case 42:case"end":return e.stop()}}),e,this,[[3,12],[20,28]])}))),function(e){return t.apply(this,arguments)})},{key:"_closeDataChannelSignaling",value:function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._dataChannelSignal=null,null===(t=this._handler)||void 0===t||t.destroy(),this._handler=null}},{key:"_checkDataChannelSignal",value:function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==Nz.CONNECTED)throw new JN(qN.NOT_CONNECTED_YET,"datachannel not connect")}},{key:"_onDisconnect",value:function(){this._dataChannelSignalState=Nz.DISCONNECTED,this._closeDataChannelSignaling(),navigator.onLine?this._reconnect():this._reconnectTimer=self.setTimeout(this._reconnect.bind(this),3e3)}},{key:"_reconnect",value:function(){var e=this;!this._isReconnecting&&this._userId&&(tJ.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){tJ.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){tJ.print("_reconnect()","Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=self.setTimeout(e._reconnect.bind(e),3e3)})).finally((function(){e._isReconnecting=!1})))}},{key:"_clearState",value:function(){this._userId=null,this._token=null,this._loginSessionId=null,null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)}}]),v}(AU.exports.EventEmitter),nJ=function(e){f(a,e);var t,r,n,i=g(a);function a(e){var t;return u(this,a),h(m(t=i.call(this)),"_mediaServerClient",void 0),h(m(t),"_appId",void 0),h(m(t),"_reconnectTimer",void 0),h(m(t),"remoteStreams",void 0),t._appId=e,t.remoteStreams=new Map,t}return l(a,[{key:"connect",value:(n=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._mediaServerClient=new Pz,this._bindEvents(),e.next=4,this._mediaServerClient.connect(this._appId);case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"startPlayPublicStream",value:(r=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.remoteStreams.get(t)){e.next=2;break}throw new JN(qN.REPEAT_PLAY,"repeat play public media stream");case 2:return(r=new dz(t,t,!1,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]})).on("onSEIMessage",(function(e){if(e instanceof Uint8Array)for(var t=wP(e),i=0;i<t.seiCount;i++)n.emit(nz.ON_SEI_MESSAGED_RECEIVED,{sei:t.seis[i],publicStreamId:r.streamId})})),e.next=6,this._mediaServerClient.subscribePublicStream(r);case 6:return this.remoteStreams.set(t,r),e.abrupt("return",r);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"stopPlayPublicStream",value:function(e){var t=this.remoteStreams.get(e);if(t)return this.remoteStreams.delete(e),this._mediaServerClient.unsubscribePublicStream(t)}},{key:"destroy",value:function(){this.remoteStreams=new Map,this._mediaServerClient&&this._mediaServerClient.destroy()}},{key:"_handleReconnected",value:(t=c(o().mark((function e(){var t,r,n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:clearTimeout(this._reconnectTimer),t=A(this.remoteStreams);try{for(n=function(){var e=E(r.value,1)[0];i.remoteStreams.delete(e),i.startPlayPublicStream(e).then((function(){var t=i.remoteStreams.get(e);i.safeEmit(nz.RESUBSCRIBE,{stream:t})}))},t.s();!(r=t.n()).done;)n()}catch(lV){t.e(lV)}finally{t.f()}case 3:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_reconnect",value:function(){var e=this;this._mediaServerClient.removeAllListeners(),this._mediaServerClient.destroy(),navigator.onLine?this.connect().then(this._handleReconnected.bind(this)):this._reconnectTimer=setTimeout((function(){return e.connect().then(e._handleReconnected.bind(e))}),3e3)}},{key:"_bindEvents",value:function(){var e,t,r=this;null===(e=this._mediaServerClient)||void 0===e||e.on(ej.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))}}]),a}(DU),iJ=new xU("AudioDeviceManager",1),oJ=function(e){f(a,e);var t,r,n,i=g(a);function a(){var e;u(this,a);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return h(m(e=i.call.apply(i,[this].concat(r))),"_audioLevelFetcher",void 0),h(m(e),"_playbackDeviceTestTimer",void 0),h(m(e),"_audioElement",void 0),h(m(e),"_audioTrack",void 0),h(m(e),"_mediaRecorder",void 0),h(m(e),"_recoderTimer",void 0),h(m(e),"_isAudioPlaybackDeviceTesting",!1),h(m(e),"_isAudioDeviceRecordTesting",!1),h(m(e),"_audioCaptureAndRecoderResolve",void 0),e}return l(a,[{key:"startAudioPlaybackDeviceTest",value:(n=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioPlaybackDeviceTesting&&!this._isAudioDeviceRecordTesting){e.next=2;break}throw new JN(qN.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioPlaybackDeviceTesting=!0,iJ.print("startAudioPlaybackDeviceTest()","Invoke"),e.prev=4,e.next=7,this._playAudioFile(t,{loop:!0});case 7:e.next=13;break;case 9:throw e.prev=9,e.t0=e.catch(4),this.stopAudioPlaybackDeviceTest(),e.t0;case 13:this._startEmitAudioPlaybackDeviceTestVolume(r);case 14:case"end":return e.stop()}}),e,this,[[4,9]])}))),function(e,t){return n.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){this._isAudioPlaybackDeviceTesting&&(iJ.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"startAudioDeviceRecordTest",value:(r=c(o().mark((function e(t){var r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioDeviceRecordTesting){e.next=2;break}throw new JN(qN.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioDeviceRecordTesting=!0,iJ.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){iJ.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),r._stopAudioCaptureAndRecoder()}),3e4),e.next=7,this._startAudioCaptureAndRecoder(t);case 7:delete this._audioCaptureAndRecoderResolve;case 8:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){iJ.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()}},{key:"stopAudioDevicePlayTest",value:function(){this._isAudioDeviceRecordTesting&&(iJ.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"getRecordTrack",value:function(){return this._audioTrack}},{key:"destroy",value:function(){iJ.print("destroy()","Invoke"),b(p(a.prototype),"removeAllListeners",this).call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()}},{key:"_playAudioFile",value:function(e,t){var r=this;return new Promise((function(n,i){r._audioElement=Yz("audio",{attributes:{src:e,crossOrigin:"",autoplay:"true"}}),r._audioElement.loop=t.loop,iJ.print("_playAudioFile()","url=".concat(e,";loop=").concat(t.loop)),r._audioElement.oncanplay=function(){iJ.print("_playAudioFile()","oncanplay"),n()},r._audioElement.onerror=function(e){var t,n;i(new JN(qN.LOAD_RESOURCES_FAILED,"audio error: ".concat(e.message||(null===(t=r._audioElement)||void 0===t||null===(n=t.error)||void 0===n?void 0:n.message))))}}))}},{key:"_destroyAudioElement",value:function(){this._audioElement&&(iJ.print("_destroyAudioElement()","Invoke"),this._audioElement.src="",delete this._audioElement,this._audioCaptureAndRecoderResolve&&this._audioCaptureAndRecoderResolve())}},{key:"_startEmitAudioPlaybackDeviceTestVolume",value:function(e){var t=this;e=Math.max(e,100),this._audioElement&&(iJ.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._audioLevelFetcher=new vH(this._audioElement),this._playbackDeviceTestTimer=self.setInterval((function(){t._audioLevelFetcher&&t.emit("onAudioPlaybackDeviceTestVolume",t._audioLevelFetcher.getAudioLevel())}),e))}},{key:"_stopEmitAudioPlaybackDeviceTestVolume",value:function(){var e;void 0!==this._playbackDeviceTestTimer&&(iJ.print("_stopEmitAudioPlaybackDeviceTestVolume()","stop timer"),self.clearInterval(this._playbackDeviceTestTimer),delete this._playbackDeviceTestTimer),null===(e=this._audioLevelFetcher)||void 0===e||e.destroy(),delete this._audioLevelFetcher}},{key:"_startAudioCaptureAndRecoder",value:(t=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,LH({});case 2:return this._audioTrack=e.sent,r=bH(this._audioTrack.getTrack()),iJ.print("startAudioDeviceRecordTest()","create microphone track success!"),e.abrupt("return",new Promise((function(e,i){n._mediaRecorder=new MediaRecorder(r),n._mediaRecorder.ondataavailable=function(){var r=c(o().mark((function r(a){var s,c;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!n._isAudioDeviceRecordTesting){r.next=16;break}return iJ.print("startAudioDeviceRecordTest()","get recorded file."),c=new Blob([a.data]),r.prev=3,r.next=6,n._playAudioFile(URL.createObjectURL(c),{loop:!1});case 6:r.next=11;break;case 8:return r.prev=8,r.t0=r.catch(3),r.abrupt("return",i(r.t0));case 11:n._startEmitAudioPlaybackDeviceTestVolume(t),null===(s=n._audioElement)||void 0===s||s.addEventListener("ended",(function(){n.stopAudioDevicePlayTest(),e()})),n._audioCaptureAndRecoderResolve=e,r.next=17;break;case 16:e();case 17:case"end":return r.stop()}}),r,null,[[3,8]])})));return function(e){return r.apply(this,arguments)}}(),n._mediaRecorder.onerror=function(e){i(new JN(qN.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},n._mediaRecorder.start()})));case 6:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_stopAudioCaptureAndRecoder",value:function(){var e;this._mediaRecorder&&("recording"===this._mediaRecorder.state&&this._mediaRecorder.stop(),delete this._mediaRecorder),null===(e=this._audioTrack)||void 0===e||e.close(),delete this._audioTrack}}]),a}(AU.exports.EventEmitter),aJ=function(){function e(){u(this,e),h(this,"engineBAC",{adm:{},agc:{},ans:{}}),h(this,"engineANM",{}),h(this,"bitrate",void 0),h(this,"sampleRate",void 0),h(this,"channel",void 0),h(this,"aec",void 0),h(this,"agc",void 0),h(this,"ans",void 0),this._init()}var t;return l(e,[{key:"_init",value:(t=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new _j,e.next=3,t.getAudioProfile();case 3:this.engineBAC=e.sent;case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"updateEngineBAC",value:function(e){e&&(this.engineBAC={codec:this.engineBAC.codec,adm:i(i({},this.engineBAC.adm),e.adm)},this.setAEC(!!e.aec),this.setAGC(!!e.agc))}},{key:"updateEngineANM",value:function(e){e&&(this.engineANM=e)}},{key:"setAudioProfile",value:function(e){var t,r,n;switch(e){case J.fluent:r=16e3,t=24e3;break;case J.standard:r=48e3,t=48e3;break;case J.hd:r=48e3,t=128e3,n=2;break;case J.standardStereo:r=48e3,t=8e4,n=2;break;case J.hdMono:r=48e3,t=128e3}t&&(this.bitrate=t),n&&(this.channel=n),r&&(this.sampleRate=r)}},{key:"setBitrate",value:function(e){e>128e3&&(e=128e3),this.bitrate=e}},{key:"setAEC",value:function(e){this.aec=e}},{key:"setAGC",value:function(e){this.agc=e}},{key:"setANS",value:function(e){this.ans=e}},{key:"getOpusConfigStr",value:function(){var e=";",t=this.config;return t.bitrate&&(e+="maxaveragebitrate=".concat(t.bitrate,";")),t.sampleRate&&(e+="sprop-maxcapturerate=".concat(t.sampleRate,";")),t.playbackRate&&(e+="maxplaybackrate=".concat(t.playbackRate,";")),t.channel&&t.channel>1&&(e+="sprop-stereo=1;"),t.playChannel&&t.playChannel>1&&(e+="stereo=1;"),e.slice(0,-1)}},{key:"config",get:function(){var e,t,r,n,i,o,a,s,c,u,d,l,h;return{bitrate:this.bitrate||(null===(e=this.engineANM.enc_param)||void 0===e?void 0:e.bitrate)||0,playChannel:(null===(t=this.engineBAC.adm)||void 0===t||null===(r=t.play)||void 0===r?void 0:r.chn)||1,channel:this.channel||(null===(n=this.engineBAC.adm)||void 0===n||null===(i=n.record)||void 0===i?void 0:i.chn)||(null===(o=this.engineANM)||void 0===o||null===(a=o.enc_param)||void 0===a?void 0:a.chn),aec:this.aec,agc:this.agc,ans:this.ans,sampleRate:this.sampleRate||(null===(s=this.engineBAC.adm)||void 0===s||null===(c=s.record)||void 0===c?void 0:c.sr)||(null===(u=this.engineBAC.codec)||void 0===u?void 0:u.enc_fs)||(null===(d=this.engineANM.enc_param)||void 0===d?void 0:d.sr),playbackRate:null===(l=this.engineBAC.adm)||void 0===l||null===(h=l.play)||void 0===h?void 0:h.sr}}}]),e}(),sJ=new xU("VideoSnapshot",1),cJ=function(e){var t=null==e?void 0:e.domElement;if(t&&!t.paused&&4===t.readyState)return t},uJ=function(){var e=c(o().mark((function e(t,r,n){var i,a,s,c,u,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=document.createElement("canvas"),a=i.getContext("2d")){e.next=4;break}throw new Error("canvas.getContext error");case 4:if(s=function(e,t,n){return t=t||e.width,n=n||e.height,i.width=t,i.height=n,r?a.setTransform(-1,0,0,1,t,0):a.setTransform(1,0,0,1,0,0),a.drawImage(e,0,0,t,n),a.getImageData(0,0,t,n)},c=Date.now(),!(u=cJ(n))){e.next=16;break}return sJ.print("takeSnapshot","VideoPlayer already set."),e.next=11,s(u,u.videoWidth,u.videoHeight);case 11:return d=e.sent,sJ.print("takeSnapshot","success, cost ".concat(Date.now()-c,"ms")),e.abrupt("return",d);case 16:if(!window.ImageCapture){e.next=29;break}if("live"!==(l=new window.ImageCapture(t)).track.readyState||!l.track.enabled||l.track.muted){e.next=29;break}return sJ.print("takeSnapshot","use ImageCapture"),e.t0=s,e.next=23,l.grabFrame();case 23:return e.t1=e.sent,e.next=26,(0,e.t0)(e.t1);case 26:return h=e.sent,sJ.print("takeSnapshot","success, cost ".concat(Date.now()-c,"ms")),e.abrupt("return",h);case 29:return sJ.print("takeSnapshot","use temp video"),e.abrupt("return",new Promise((function(e,r){var n=new MediaStream([t]),i=document.createElement("video");i.setAttribute("playsinline",""),i.muted=!0,document.body.appendChild(i),i.onplaying=function(){var r=s(i,i.videoWidth,i.videoHeight);sJ.print("takeSnapshot","success, cost ".concat(Date.now()-c,"ms")),e(r),n.removeTrack(t),i.srcObject=null,i.load()},i.onerror=r,i.srcObject=n,i.play()})));case 31:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),dJ=Object.defineProperty,lJ=Object.getOwnPropertyDescriptor,hJ=function(e,t,r,n){for(var i,o=n>1?void 0:n?lJ(t,r):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&dJ(t,r,o),o},fJ=new xU("Engine",0),pJ=function(e){f(Le,e);var t,r,n,a,s,d,_,v,y,S,E,k,T,I,A,C,O,x,P,M,j,G,H,z,X,q,J,Z,$,te,re,ie,oe,ae,se,ce,ue,de,le,he,fe,pe,_e,ve,me,ye,ge,Se,be,Ee,ke,Te,Ie,Ae,Re,we,Ce,Oe,xe,Ne,De,Pe,Me,Ue=g(Le);function Le(e,t){var r;return u(this,Le),h(m(r=Ue.call(this)),"_room",void 0),h(m(r),"_outsideRoom",void 0),h(m(r),"_appId",void 0),h(m(r),"_businessId",void 0),h(m(r),"_visibility",!0),h(m(r),"_localVideoTrack",void 0),h(m(r),"_localAudioTrack",void 0),h(m(r),"_localImgVideoTrack",void 0),h(m(r),"_localImgScreenTrack",void 0),h(m(r),"_localScreenVideoTrack",void 0),h(m(r),"_localScreenAudioTrack",void 0),h(m(r),"_tempMixingAudioTrack",void 0),h(m(r),"_localAudioTrackVolume",void 0),h(m(r),"_localScreenAudioTrackVolume",void 0),h(m(r),"_remoteAudioTrackVolumeMap",new Map),h(m(r),"_remoteScreenAudioTrackVolumeMap",new Map),h(m(r),"_remotePublicAudioTrackVolumeMap",new Map),h(m(r),"_audioPlaybackDeviceId",void 0),h(m(r),"_videoPlayer",void 0),h(m(r),"_screenPlayer",void 0),h(m(r),"_remoteVideoPlayer",new Map),h(m(r),"_remoteScreenPlayer",new Map),h(m(r),"_remoteAudioPlayer",new Map),h(m(r),"_publicStreamAudioPlayer",new Map),h(m(r),"_publicStreamVideoPlayer",new Map),h(m(r),"_publicStreamIds",new Map),h(m(r),"_roomConfig",void 0),h(m(r),"_videoStreamConstraints",{}),h(m(r),"_audioStreamConstraints",{}),h(m(r),"_enableSimulcast",!1),h(m(r),"_videoStreamEncodeConfig",[qB]),h(m(r),"_screenStreamEncodeConfig",[YB]),h(m(r),"_trackSourceType",void 0),h(m(r),"_liveTranscodeConfig",void 0),h(m(r),"_useCloudProxy",void 0),h(m(r),"_startCloudProxyTimestamp",void 0),h(m(r),"_localVideoDeviceId",void 0),h(m(r),"_localAudioDeviceId",void 0),h(m(r),"_pauseAllSubscribeState",{audio:!1,video:!1}),h(m(r),"_audioVolumeIndicationTimer",void 0),h(m(r),"_dummyTimer",void 0),h(m(r),"_audioPropertiesReportTimer",null),h(m(r),"_mirrorType",B.MIRROR_TYPE_RENDER),h(m(r),"_audioMixingManager",void 0),h(m(r),"_pubLock",void 0),h(m(r),"_rtmClient",void 0),h(m(r),"_messageStatisticsObserver",void 0),h(m(r),"_tempRoomConfig",void 0),h(m(r),"_originIceConfigRequestUrls",void 0),h(m(r),"_originConfigServerUrls",void 0),h(m(r),"_originLogServerUrl",void 0),h(m(r),"_audioDeviceManager",new oJ),h(m(r),"_audioProfileManager",new aJ),h(m(r),"_remoteVideoConfig",new Map),h(m(r),"_userPriorityMap",new Map),h(m(r),"_subscribeFallbackOption",K.DISABLE),h(m(r),"_cameraCapturing",!1),h(m(r),"_interruptCameraCapture",!1),h(m(r),"_micCapturing",!1),h(m(r),"_interruptMicCapture",!1),h(m(r),"_config",void 0),h(m(r),"_updateMixAudioTrack",function(){var e=c(o().mark((function e(t){var n,i,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=a.length>1&&void 0!==a[1]?a[1]:ee.PLAYOUT_AND_PUBLISH,fJ.print("_updateMixAudioTrack()"),r._localAudioTrack){e.next=5;break}return t&&(r._tempMixingAudioTrack={track:t,type:i}),e.abrupt("return");case 5:if(t?(r._localAudioTrack.mixType=i,r._localAudioTrack.mixedAudioTrack=t):(delete r._localAudioTrack.mixType,delete r._localAudioTrack.mixedAudioTrack),null===(n=r._room)||void 0===n||!n.hasPublished){e.next=9;break}return e.next=9,r._updatePublish();case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),h(m(r),"_onAudioMixingMessage",(function(e){r.safeEmit(ne.onAudioMixingStateChanged,e)})),h(m(r),"_onAudioMixingAutoplayFailed",(function(){r.safeEmit(ne.onAutoplayFailed,{})})),r._appId=e,r._pubLock=new Iz("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new $Y({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage,onAutoPlayFailed:r._onAudioMixingAutoplayFailed}),window.__rtc_engine__=m(r),window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=m(r),r._trackSourceType={video:R.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:R.VIDEO_SOURCE_TYPE_INTERNAL,audio:w.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:w.AUDIO_SOURCE_TYPE_INTERNAL},r._config=t,r._rtmClient=new rJ(e),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new iK,r}return l(Le,[{key:"appId",get:function(){return this._appId},set:function(e){this._appId=e}},{key:"updateToken",value:(Me=c(o().mark((function e(t){var r,n,i,a,s,c,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("updateToken()","token: %s",t),xP(t,"token"),!(this.waitForNewToken&&null!==(r=this._room)&&void 0!==r&&r._roomInfo&&this._tempRoomConfig)){e.next=9;break}return a=null===(i=this._room)||void 0===i?void 0:i._roomInfo,s=a.roomId,c=a.userInfo,u=this._tempRoomConfig,delete this._tempRoomConfig,e.next=8,this.joinRoom(t,s,c,u);case 8:return e.abrupt("return",e.sent);case 9:if(this._room){e.next=11;break}throw new JN(qN.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");case 11:return e.next=13,null===(n=this._room)||void 0===n?void 0:n.updateToken(t);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return Me.apply(this,arguments)})},{key:"setVideoCaptureDevice",value:(Pe=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("setVideoCaptureDevice()","deviceId: %s",t),xP(t,"deviceId"),this._localVideoDeviceId=t,this._localVideoTrack){e.next=5;break}return e.abrupt("return");case 5:return r=this._videoStreamConstraints,"user"===t||"environment"===t||"left"===t||"right"===t?(delete r.deviceId,r.facingMode=t):r.deviceId={exact:t},this._videoStreamConstraints=r,e.next=10,MH(r);case 10:if(n=e.sent,this._initLocalTrackEvents(n),this._localVideoTrack.close(),this._localVideoTrack=n,this._videoPlayer&&this._videoPlayer.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(n),this._videoPlayer.mirror(!!this._mirrorType)),this._room){e.next=17;break}return e.abrupt("return");case 17:if(!this._room.hasPublished){e.next=20;break}return e.next=20,this._updatePublish();case 20:case"end":return e.stop()}}),e,this)}))),function(e){return Pe.apply(this,arguments)})},{key:"setAudioCaptureDevice",value:(De=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("setAudioCaptureDevice()","deviceId: %s",t),xP(t,"deviceId"),this._localAudioDeviceId=t,this._localAudioTrack){e.next=5;break}return e.abrupt("return");case 5:return(r=this._audioStreamConstraints).deviceId={exact:t},this._audioStreamConstraints=r,this._localAudioTrack.close(),e.next=11,LH(r,this._audioProfileManager);case 11:if(n=e.sent,void 0!==this._localAudioTrackVolume&&n.setCaptureVolume(this._localAudioTrackVolume),this._initLocalTrackEvents(n),this._localAudioTrack=n,this._room){e.next=17;break}return e.abrupt("return");case 17:if(!this._room.hasPublished){e.next=20;break}return e.next=20,this._updatePublish();case 20:case"end":return e.stop()}}),e,this)}))),function(e){return De.apply(this,arguments)})},{key:"_addDeviceEventHandler",value:function(){pH.on(ne.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),pH.on(ne.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,f,p,_,v,m,y,g,S,b,E,k,T,I,A,R,w,C,O=this;null===(e=this._room)||void 0===e||e.on(ZB.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(ZB.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(ZB.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(nz.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(nz.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(nz.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(ZB.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(ZB.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(ZB.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(ZB.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(ZB.POST_PROCESSING_MESSAGE,(function(e){"2.0"===e.protocol?O._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message}):"publicStreamCallback"===e.type?O._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&O._onLiveTranscodingResult(e)})),null===(l=this._room)||void 0===l||l.on(ej.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(nz.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(f=this._room)||void 0===f||f.on(nz.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(p=this._room)||void 0===p||p.on(nz.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(_=this._room)||void 0===_||_.on(nz.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(v=this._room)||void 0===v||v.on(nz.ON_PUBLISH_RESULT,(function(e){var t;null!==(t=O._room)&&void 0!==t&&t._roomConfig.isAutoPublish&&O.safeEmit(ne.onAutoPublishResult,e)})),null===(m=this._room)||void 0===m||m.on(nz.ON_REMOTE_STREAM_STATS,(function(e){O.safeEmit(ne.onRemoteStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(nz.ON_LOCAL_STREAM_STATS,(function(e){O.safeEmit(ne.onLocalStreamStats,e)})),null===(g=this._room)||void 0===g||g.on(nz.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(S=this._room)||void 0===S||S.on(nz.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(ne.onUserStartAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(nz.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(ne.onUserStopAudioCapture,{userId:t})})),null===(E=this._room)||void 0===E||E.on(nz.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(ne.onUserStartVideoCapture,{userId:t})})),null===(k=this._room)||void 0===k||k.on(nz.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(ne.onUserStopVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(nz.ON_SEI_MESSAGED_RECEIVED,(function(e){O.safeEmit(ne.onSEIMessageReceived,e)})),null===(I=this._room)||void 0===I||I.on(nz.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){O.safeEmit(ne.onRemoteVideoSizeChanged,e,t)})),null===(A=this._room)||void 0===A||A.on(nz.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return O.safeEmit(ne.onSimulcastSubscribeFallback,e)})),null===(R=this._room)||void 0===R||R.on(nz.RECONNECT_FAILED,(function(){O.safeEmit(ne.onError,{errorCode:qN.RECONNECT_FAILED})})),null===(w=this._room)||void 0===w||w.on(nz.ON_VIDEO_STREAM_BANNED,(function(e){O.safeEmit(ne.onVideoStreamBanned,{uid:e.uid,banned:e.banned})})),null===(C=this._room)||void 0===C||C.on(nz.ON_AUDIO_STREAM_BANNED,(function(e){O.safeEmit(ne.onAudioStreamBanned,{uid:e.uid,banned:e.banned})}))}},{key:"safeEmit",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return KP(e)&&AB(e,bP(n)),(t=b(p(Le.prototype),"safeEmit",this)).call.apply(t,[this,e].concat(n))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()}},{key:"joinRoom",value:(Ne=c(o().mark((function e(t,r,n,a){var s,c,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",t,r,n,a),LP(t)||xP(t,"token"),VP(r),jP(n),s={isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:Y.communication},RW(s,a),GP(s),!this._room||this._room.connectionState===Nz.DISCONNECTED){e.next=11;break}throw new JN(qN.REPEAT_JOIN,"Already joined");case 11:return this._room=new Xz(a,{audioProfileManager:this._audioProfileManager}),this._room.userPriorityMap=this._userPriorityMap,this._room.subscribeFallbackOption=this._subscribeFallbackOption,this._addHandlerEventHandler(),c=this._liveTranscodeConfig&&zB("started",this._liveTranscodeConfig),e.prev=16,this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),e.next=20,this._room.join(this._appId,r,t,i(i({},n),{},{businessId:this._businessId,role:this._visibility?eJ.NORMAL_USER:eJ.SILENT_USER}),c,this._useCloudProxy);case 20:return u=e.sent,this._roomConfig=a,this._tempRoomConfig&&delete this._tempRoomConfig,null!=a&&a.isAutoPublish&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:L.AUDIO_AND_VIDEO}):this.safeEmit(ne.onAutoPublishResult,{isScreen:!1,state:D.PUBLISH_FAIL})),e.abrupt("return",u);case 27:throw e.prev=27,e.t0=e.catch(16),e.t0.code===qN.INVALID_TOKEN&&(this._tempRoomConfig=a),e.t0;case 31:case"end":return e.stop()}}),e,this,[[16,27]])}))),function(e,t,r,n){return Ne.apply(this,arguments)})},{key:"leaveRoom",value:(xe=c(o().mark((function e(){var t,r,n,i=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]&&i[0],fJ.print("leaveRoom()"),!t){e.next=7;break}return e.next=5,null===(r=this._room)||void 0===r?void 0:r.leave(t);case 5:e.next=8;break;case 7:null===(n=this._room)||void 0===n||n.leave(t).catch();case 8:this._removeHandlerEventHandler(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0,this._publicStreamIds=new Map;case 19:case"end":return e.stop()}}),e,this)}))),function(){return xe.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r,n,i,o;fJ.print("destroy()"),this.removeAllListeners(),this._removeHandlerEventHandler(),null===(e=this._room)||void 0===e||e.destroy(),this._room=void 0,null===(t=this._videoPlayer)||void 0===t||t.destroy(),this._videoPlayer=void 0,this._screenPlayer=void 0,this._videoStreamConstraints={},this._audioStreamConstraints={},this._videoStreamEncodeConfig=[qB],this._screenStreamEncodeConfig=[YB],this._pauseAllSubscribeState={audio:!1,video:!1},this._messageStatisticsObserver.destroy(),clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyTimer),this._audioVolumeIndicationTimer=void 0,this._stopAudioPropertiesReport(),this._localAudioTrack&&(this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._localScreenVideoTrack.close(),this._localScreenVideoTrack=void 0),this._localImgVideoTrack&&(this._localImgVideoTrack.stop(),this._localImgVideoTrack=void 0),this._localImgScreenTrack&&(this._localImgScreenTrack.stop(),this._localImgScreenTrack=void 0),this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new Map,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(r=this._outsideRoom)||void 0===r||r.destroy(),this._publicStreamIds=new Map,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new Map,this._userPriorityMap.clear(),this._localAudioTrackVolume=100,this._localScreenAudioTrackVolume=100,null===(n=this._remoteAudioTrackVolumeMap)||void 0===n||n.clear(),null===(i=this._remoteScreenAudioTrackVolumeMap)||void 0===i||i.clear(),null===(o=this._remotePublicAudioTrackVolumeMap)||void 0===o||o.clear(),this._cameraCapturing=!1,this._micCapturing=!1,this._interruptCameraCapture=!1,this._interruptMicCapture=!1}},{key:"publishStream",value:(Oe=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("publishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),AP(t)&&!this._localVideoTrack&&this._localImgVideoTrack&&(this._localVideoTrack=(r=this._localImgVideoTrack,new OH(r,cP())),this._localVideoTrack.dummy=!0),e.next=6,this._updatePublish({mediaType:t});case 6:case"end":return e.stop()}var r}),e,this)}))),function(e){return Oe.apply(this,arguments)})},{key:"unpublishStream",value:(Ce=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("unpublishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!r){e.next=5;break}return e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.unpublish());case 5:return e.next=7,this._updatePublish({mediaType:t,pubState:oz.UNPUB});case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ce.apply(this,arguments)})},{key:"publishScreen",value:(we=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("publishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.prev=3,AP(t)&&!this._localScreenVideoTrack&&this._localImgScreenTrack&&(this._localScreenVideoTrack=(r=this._localImgScreenTrack,new xH(r,cP())),this._localScreenVideoTrack.dummy=!0),e.next=7,this._updateScreenPublish({mediaType:t,pubState:oz.PUB});case 7:e.next=16;break;case 9:if(e.prev=9,e.t0=e.catch(3),!(e.t0 instanceof JN)){e.next=15;break}throw e.t0;case 15:throw new JN(qN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 16:case"end":return e.stop()}var r}),e,this,[[3,9]])}))),function(e){return we.apply(this,arguments)})},{key:"unpublishScreen",value:(Re=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("unpublishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.next=5,this._updateScreenPublish({mediaType:t,pubState:oz.UNPUB});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return Re.apply(this,arguments)})},{key:"subscribeStream",value:(Ae=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("subscribeStream()","userId: %o, mediaType: %o",t,r),e.abrupt("return",this._subscribe(!1,t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ae.apply(this,arguments)})},{key:"_subscribe",value:(Ie=c(o().mark((function e(t,r,n){var i,a,s,c,u,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._checkMediaType(n),this._assertNotInRoom(),c=this._room.remoteStreams.get(r),u=null==c?void 0:c.find((function(e){return e.isScreen===t}))){e.next=6;break}throw new JN(qN.STREAM_NOT_EXIST,"stream not exist");case 6:return this._pauseAllSubscribeState.audio&&(n-=n&L.AUDIO),this._pauseAllSubscribeState.video&&(n-=n&L.VIDEO),fJ.print("subscribeStream()","due to pauseAll mediaType: %o",n),d=u.hasSubscribed,l=this._remoteVideoConfig.get(r)||(null===(i=this._roomConfig)||void 0===i?void 0:i.remoteVideoConfig),u.originalMediaType=n,e.next=14,this._room.subscribe(u,n,l);case 14:IP(n)&&this._updateAudioPlayerState(u),AP(n)&&this._updateVideoPlayerState(u),!t&&(null!==(a=this._roomConfig)&&void 0!==a&&a.isAutoSubscribeAudio||null!==(s=this._roomConfig)&&void 0!==s&&s.isAutoSubscribeVideo)&&(u.audioTrack||u.videoTrack)&&(h={userId:r,isScreen:!1,state:N.SUBSCRIBE_SUCC},this.safeEmit(ne.onAutoSubscribeResult,h)),!d&&IP(n)&&u.hasAudio&&(null===(f=u.observer)||void 0===f||f.setSubscribeAudio(!0)),!d&&AP(n)&&u.hasVideo&&(null===(p=u.observer)||void 0===p||p.setSubscribeVideo(!0));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return Ie.apply(this,arguments)})},{key:"unsubscribeStream",value:(Te=c(o().mark((function e(t,r){var n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("unsubscribeStream()","userId: %o, mediaType: %o",t,r),this._checkMediaType(r),this._assertNotInRoom(),n=this._room.remoteStreams.get(t),null!=(i=null==n?void 0:n.find((function(e){return!e.isScreen})))&&i.hasSubscribed){e.next=7;break}throw new JN(qN.STREAM_NOT_EXIST,"stream not exist");case 7:this._room.unsubscribe(i,r);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return Te.apply(this,arguments)})},{key:"subscribeScreen",value:(ke=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("subscribeScreen() userId: %o, mediaType: %o",t,r),e.abrupt("return",this._subscribe(!0,t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return ke.apply(this,arguments)})},{key:"unsubscribeScreen",value:(Ee=c(o().mark((function e(t,r){var n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("unsubscribeScreen() userId: %o, mediaType: %o",t,r),this._checkMediaType(r),this._assertNotInRoom(),n=this._room.remoteStreams.get(t),null!=(i=null==n?void 0:n.find((function(e){return e.isScreen})))&&i.hasSubscribed){e.next=7;break}throw new JN(qN.STREAM_NOT_EXIST,"stream not exist");case 7:this._room.unsubscribe(i,r);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ee.apply(this,arguments)})},{key:"setRemoteVideoConfig",value:(be=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",t,r),FP(t),WP(r),this._remoteVideoConfig.set(t,r),e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.updateSubVideoConfig(t,r).then((function(){})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return be.apply(this,arguments)})},{key:"startVideoCapture",value:(Se=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l,h=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("startVideoCapture()","deviceId: %s",t),LP(t)||xP(t,"deviceId"),t=t||this._localVideoDeviceId,this._localVideoDeviceId=t,!(this._cameraCapturing||this._localVideoTrack&&!this._localVideoTrack.dummy)){e.next=6;break}throw new JN(qN.REPEAT_CAPTURE,"Has already capture");case 6:return i=this._videoStreamConstraints,t&&("user"===t||"environment"===t||"left"===t||"right"===t?i.facingMode=t:i.deviceId={exact:t},this._videoStreamConstraints=i),a={},e.prev=9,this._cameraCapturing=!0,e.next=13,MH(i);case 13:if(c=e.sent,!this._interruptCameraCapture){e.next=18;break}throw this._interruptCameraCapture=!1,c.close(),new JN(qN.INTERRUPT,"interrupt by stopVideoCapture");case 18:this._initLocalTrackEvents(c),this._localVideoTrack=c,null===(s=this._videoPlayer)||void 0===s||s.playVideo(c),(u=null==c?void 0:c.getTrack())&&(a=u.getSettings(),d={width:a.width,height:a.height},this._localVideoTrack.resolution=d,setTimeout((function(){return h.safeEmit(ne.onLocalVideoSizeChanged,{streamIndex:U.STREAM_INDEX_MAIN,info:d})})));case 23:return e.prev=23,this._cameraCapturing=!1,e.finish(23);case 26:if(this._room){e.next=28;break}return e.abrupt("return",a);case 28:return l=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||l)&&(this._visibility?this._updatePublish():this.safeEmit(ne.onAutoPublishResult,{isScreen:!1,state:D.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableVideo(!0),e.abrupt("return",a);case 32:case"end":return e.stop()}}),e,this,[[9,,23,26]])}))),function(e){return Se.apply(this,arguments)})},{key:"stopVideoCapture",value:(ge=c(o().mark((function e(){var t,r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("stopVideoCapture()"),!this._cameraCapturing){e.next=5;break}return this._interruptCameraCapture=!0,fJ.print("stopVideoCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.video!==R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new JN(qN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 7:if(null===(t=this._videoPlayer)||void 0===t||t.stop(),null===(r=this._localVideoTrack)||void 0===r||r.close(),this._localImgVideoTrack&&this._localVideoTrack?(null===(a=this._localVideoTrack)||void 0===a||a.setTrack(this._localImgVideoTrack),this._localVideoTrack.dummy=!0):this._localVideoTrack=void 0,this._room){e.next=12;break}return e.abrupt("return");case 12:if(!this._room.hasPublished){e.next=15;break}return e.next=15,this._updatePublish();case 15:null===(n=this._room.localStream)||void 0===n||null===(i=n.observer)||void 0===i||i.setEnableVideo(!1);case 16:case"end":return e.stop()}}),e,this)}))),function(){return ge.apply(this,arguments)})},{key:"startAudioCapture",value:(ye=c(o().mark((function e(t){var r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("startAudioCapture()","deviceId: $o",t),LP(t)||xP(t,"deviceId"),t=t||this._localAudioDeviceId,this._localAudioDeviceId=t,!this._micCapturing&&!this._localAudioTrack){e.next=6;break}throw new JN(qN.REPEAT_CAPTURE,"Has already capture");case 6:return i=this._audioStreamConstraints,t&&(i.deviceId={exact:t},this._audioStreamConstraints=i),e.prev=8,this._micCapturing=!0,e.next=12,LH(i,this._audioProfileManager);case 12:if(a=e.sent,!this._interruptMicCapture){e.next=17;break}throw this._interruptMicCapture=!1,a.close(),new JN(qN.INTERRUPT,"interrupt by stopAudioCapture");case 17:this._initLocalTrackEvents(a),this._localAudioTrack=a,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),void 0!==this._localAudioTrackVolume&&this._localAudioTrack.setCaptureVolume(this._localAudioTrackVolume);case 21:return e.prev=21,this._micCapturing=!1,e.finish(21);case 24:if(this._room){e.next=26;break}return e.abrupt("return");case 26:s=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||s)&&(this._visibility?this._updatePublish():this.safeEmit(ne.onAutoPublishResult,{isScreen:!1,state:D.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableAudio(!0);case 29:case"end":return e.stop()}}),e,this,[[8,,21,24]])}))),function(e){return ye.apply(this,arguments)})},{key:"stopAudioCapture",value:(me=c(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("stopAudioCapture()"),!this._micCapturing){e.next=5;break}return this._interruptMicCapture=!0,fJ.print("stopAudioCapture()","capturing"),e.abrupt("return");case 5:if(null===(t=this._localAudioTrack)||void 0===t||t.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio!==w.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=10;break}throw new JN(qN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 10:if(this._room){e.next=12;break}return e.abrupt("return");case 12:if(!this._room.hasPublished){e.next=15;break}return e.next=15,this._updatePublish();case 15:null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableAudio(!1);case 16:case"end":return e.stop()}}),e,this)}))),function(){return me.apply(this,arguments)})},{key:"getAudioMixingManager",value:function(){return fJ.print("getAudioMixingManager()"),this._audioMixingManager}},{key:"startScreenCapture",value:(ve=c(o().mark((function e(){var t,r,n,i,a,s,c,u,d,l,h,f,p,_,v,m,y,g=this,S=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=S.length>0&&void 0!==S[0]?S[0]:{},fJ.print("startScreenCapture()","config: %o",u),!this._localScreenVideoTrack||null!==(t=this._localScreenVideoTrack)&&void 0!==t&&t.dummy||(d=this._localScreenVideoTrack),l=u.enableAudio,h=void 0!==l&&l,this._trackSourceType.screenVideo!==R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new JN(qN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 6:if(this._trackSourceType.screenAudio!==w.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=8;break}throw new JN(qN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 8:return e.next=10,FH(h,this._screenStreamEncodeConfig[0]);case 10:if(f=e.sent,this._localScreenVideoTrack=new xH(f.getVideoTracks()[0],cP()),null===(r=d)||void 0===r||r.close(),null===(n=this.localScreenAudioTrack)||void 0===n||n.close(),this._localScreenAudioTrack=void 0,null!==(i=this._screenStreamEncodeConfig[0])&&void 0!==i&&i.contentHint&&this._localScreenVideoTrack.setContentHint(null===(p=this._screenStreamEncodeConfig[0])||void 0===p?void 0:p.contentHint),(_=null===(a=this._localScreenVideoTrack)||void 0===a?void 0:a.getTrack())&&(v=_.getSettings(),m={width:v.width,height:v.height},this._localScreenVideoTrack.resolution=m,setTimeout((function(){return g.safeEmit(ne.onLocalVideoSizeChanged,{streamIndex:U.STREAM_INDEX_SCREEN,info:{width:v.width,height:v.height}})}))),(y=f.getAudioTracks()).length&&(this._localScreenAudioTrack=new NH(y[0],cP()),this._initLocalTrackEvents(this._localScreenAudioTrack),void 0!==this._localScreenAudioTrackVolume&&this._localScreenAudioTrack.setCaptureVolume(this._localScreenAudioTrackVolume)),null===(s=this._screenPlayer)||void 0===s||s.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(c=this._room)||void 0===c||!c.hasScreenPublished){e.next=25;break}return e.next=25,this._updateScreenPublish();case 25:case"end":return e.stop()}}),e,this)}))),function(){return ve.apply(this,arguments)})},{key:"stopScreenCapture",value:(_e=c(o().mark((function e(){var t,r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("stopScreenCapture()"),null===(t=this._screenPlayer)||void 0===t||t.stop(),null===(r=this._localScreenVideoTrack)||void 0===r||r.close(),this._localImgScreenTrack&&this._localScreenVideoTrack?(this._localScreenVideoTrack.setTrack(this._localImgScreenTrack),this._localScreenVideoTrack.dummy=!0):this._localScreenVideoTrack=void 0,null===(n=this._localScreenAudioTrack)||void 0===n||n.close(),this._localScreenAudioTrack=void 0,null===(i=this._room)||void 0===i||!i.hasScreenPublished){e.next=9;break}return e.next=9,this._updateScreenPublish();case 9:case"end":return e.stop()}}),e,this)}))),function(){return _e.apply(this,arguments)})},{key:"setLocalVideoPlayer",value:function(e,t){if(fJ.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),NP(e,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),t&&t.renderDom){var r,n,o=i({userId:this._getUserId()},t);if(HP(o),e===U.STREAM_INDEX_MAIN&&!this._videoPlayer)return this._videoPlayer=new rK(o),this._initPlayerEvents(this._videoPlayer),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&(null===(r=this._config)||void 0===r?void 0:r.autoPlayPolicy)!==Q.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement;if(e===U.STREAM_INDEX_SCREEN&&!this._screenPlayer)return this._screenPlayer=new rK(i(i({},o),{},{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Q.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement}else{var a,s;e===U.STREAM_INDEX_MAIN?(null===(a=this._videoPlayer)||void 0===a||a.destroy(),delete this._videoPlayer):(null===(s=this._screenPlayer)||void 0===s||s.destroy(),delete this._screenPlayer)}}},{key:"startLiveTranscoding",value:(pe=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("startLiveTranscoding()","transcode: %o",t),xP(t.url,"liveTranscode.url"),this._liveTranscodeConfig=t,e.prev=3,this.safeEmit(ne.onStreamMixingEvent,{event:iz.START,error:0,message:""}),e.next=7,null===(r=this._room)||void 0===r?void 0:r.liveControlMessage(zB("started",this._liveTranscodeConfig));case 7:e.next=16;break;case 9:if(e.prev=9,e.t0=e.catch(3),!(e.t0 instanceof JN)){e.next=15;break}throw e.t0;case 15:throw new JN(qN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 16:case"end":return e.stop()}}),e,this,[[3,9]])}))),function(e){return pe.apply(this,arguments)})},{key:"updateLiveTranscoding",value:(fe=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("updateLiveTranscoding()","transcode: %o",t),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return this._liveTranscodeConfig=RW(this._liveTranscodeConfig,t),e.prev=4,this.safeEmit(ne.onStreamMixingEvent,{event:iz.UPDATE,error:0,message:""}),e.next=8,null===(r=this._room)||void 0===r?void 0:r.liveControlMessage(zB("layoutChanged",this._liveTranscodeConfig));case 8:e.next=17;break;case 10:if(e.prev=10,e.t0=e.catch(4),!(e.t0 instanceof JN)){e.next=16;break}throw e.t0;case 16:throw new JN(qN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(e){return fe.apply(this,arguments)})},{key:"stopLiveTranscoding",value:(he=c(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("stopLiveTranscoding()"),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete this._liveTranscodeConfig,e.prev=4,this.safeEmit(ne.onStreamMixingEvent,{event:iz.STOP,error:0,message:""}),e.next=8,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage({action:"stopped",type:"transcode"});case 8:e.next=17;break;case 10:if(e.prev=10,e.t0=e.catch(4),!(e.t0 instanceof JN)){e.next=16;break}throw e.t0;case 16:throw new JN(qN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return he.apply(this,arguments)})},{key:"setBusinessId",value:function(e){return fJ.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(bB.setStats({rtc_business_id:e}),this._businessId=e,!0)}},{key:"setUserVisibility",value:(le=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("setUserVisibility()","enable: %o",t),t=!!t,this._visibility!==t){e.next=4;break}return e.abrupt("return");case 4:if(this._room){e.next=7;break}return this._visibility=t,e.abrupt("return");case 7:if(this._room.connectionState===Nz.CONNECTED){e.next=9;break}throw new JN(qN.NOT_CONNECTED_YET,"server not connected");case 9:if(this._room.localStream&&(null===(n=this._room.localStream.observer)||void 0===n||n.setPublisher(t)),e.t0=!t,!e.t0){e.next=14;break}return e.next=14,this._room.unpublish();case 14:return e.next=16,this._room.updateUserAttributes({role:t?eJ.NORMAL_USER:eJ.SILENT_USER});case 16:this._visibility=t,t&&null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoPublish&&this._updatePublish({mediaType:L.AUDIO_AND_VIDEO});case 18:case"end":return e.stop()}}),e,this)}))),function(e){return le.apply(this,arguments)})},{key:"_initPlayerEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.on("playback_event",(function(n){switch(n.eventName){case"timeupdate":return;case"loadeddata":if("audio"===n.type)r?t.safeEmit(ne.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:e.userId}):t.safeEmit(ne.onAudioFirstFrameDecoded,{userId:e.userId}),yB.firstRemoteAudioRender("",n.userId||"");else{var i,o,a={userId:e.userId,height:(null===(i=e.domElement)||void 0===i?void 0:i.videoHeight)||0,width:(null===(o=e.domElement)||void 0===o?void 0:o.videoWidth)||0};r?(a.publicStreamId=a.userId,delete a.userId,t.safeEmit(ne.onFirstPublicStreamVideoFrameDecoded,a),t.safeEmit(ne.onFirstPublicStreamVideoFrameRendered,a)):(t.safeEmit(ne.onVideoFirstFrameDecoded,a),t.safeEmit(ne.onVideoFirstFrameRendered,a)),yB.firstRemoteVideoRender("",n.userId||"")}break;case"autoplay-error":return r&&(n.publicStreamId=n.userId),void t.safeEmit(ne.onAutoplayFailed,{userId:n.userId||n.publicStreamId,kind:e instanceof rK?"video":"audio"})}t.safeEmit(ne.onPlayerEvent,n)}))}},{key:"_initLocalTrackEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.on("track-ended",(function(e){var r=!1;e!==t._localScreenAudioTrack&&e!==t._localScreenVideoTrack||(r=!0),t.safeEmit(ne.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})})),e.on("resolution-change",(function(e){t.safeEmit(ne.onLocalVideoSizeChanged,{streamIndex:r?U.STREAM_INDEX_SCREEN:U.STREAM_INDEX_MAIN,info:e})}))}},{key:"setRemoteVideoPlayer",value:function(e,t){fJ.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),NP(e,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),HP(t);var r,n,o,a=t.userId;if(e===U.STREAM_INDEX_MAIN){var s,c,u;if(null===(s=this._remoteVideoPlayer.get(a))||void 0===s||s.destroy(),!t.renderDom)return;var d=new rK(t);this._initPlayerEvents(d),this._remoteVideoPlayer.set(a,d);var l=null===(c=this._room)||void 0===c||null===(u=c.remoteStreams.get(a))||void 0===u?void 0:u.find((function(e){return!e.isScreen}));return l&&this._updateVideoPlayerState(l),d.domElement}if(null===(r=this._remoteScreenPlayer.get(a))||void 0===r||r.destroy(),t.renderDom){var h=new rK(i(i({},t),{},{isScreen:!0}));this._remoteScreenPlayer.set(a,h),this._initPlayerEvents(h);var f=null===(n=this._room)||void 0===n||null===(o=n.remoteStreams.get(a))||void 0===o?void 0:o.find((function(e){return e.isScreen}));return f&&this._updateVideoPlayerState(f),h.domElement}}},{key:"setLocalVideoMirrorType",value:function(e){fJ.print("setLocalVideoMirrorType()","mirrorType: %o",e),NP(e,"mirrorType",[B.MIRROR_TYPE_NONE,B.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)}},{key:"setAudioPlaybackDevice",value:(de=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("setAudioPlaybackDevice()","deviceId: %s",t),xP(t,"deviceId"),void 0!==HTMLAudioElement.prototype.setSinkId){e.next=5;break}return fJ.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),e.abrupt("return");case 5:return e.next=7,pH.getDeviceById(t);case 7:if(r=e.sent){e.next=10;break}throw new JN(qN.INVALID_DEVICE_ID,"audio playback device id ".concat(t," is invalid"));case 10:this._remoteAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this._audioPlaybackDeviceId=t,r&&this.safeEmit(ne.onAudioPlaybackDeviceChanged,r),yB.rtcAudioDevice(oB.PLAYOUT_DEVICE_SWITCH,t,0);case 14:case"end":return e.stop()}}),e,this)}))),function(e){return de.apply(this,arguments)})},{key:"play",value:(ue=c(o().mark((function e(t){var r,n,i,a,s,c,u,d,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("play()","userId | publicStreamId: %s",t),s=null===(r=this._room)||void 0===r||null===(n=r.remoteStreams.get(t||""))||void 0===n?void 0:n.find((function(e){return!e.isScreen})),i=this._remoteAudioPlayer.get(t||""),a=this._remoteVideoPlayer.get(t||""),i||(i=this._publicStreamAudioPlayer.get(t||"")),a||(a=this._publicStreamVideoPlayer.get(t||"")),!t&&this._videoPlayer&&(a=this._videoPlayer),a&&(a.played?a.manuallyPlay():s&&s.videoTrack?a.playVideo(s.videoTrack,s):!t&&this._localVideoTrack&&(a.mirror(!!this._mirrorType),a.playVideo(this._localVideoTrack))),i&&(i.played?i.manuallyPlay():null!=s&&s.audioTrack&&(i.playAudio(s.audioTrack),(u=null==s||null===(c=s.audioTrack._audioLevelFetcher)||void 0===c?void 0:c._ctx)&&u.resume())),null!=s&&s.audioTrack&&(l=null==s||null===(d=s.audioTrack._audioLevelFetcher)||void 0===d?void 0:d._ctx)&&"suspended"===l.state&&l.resume(),t||!this._audioMixingManager){e.next=13;break}return e.next=13,this._audioMixingManager.resumeLocalPlay();case 13:case"end":return e.stop()}}),e,this)}))),function(e){return ue.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(ce=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("pauseAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),!this._pauseAllSubscribeState.audio||!this._pauseAllSubscribeState.video){e.next=4;break}return e.abrupt("return",Promise.resolve());case 4:if(r=function(){IP(t)&&(n._pauseAllSubscribeState.audio=!0),AP(t)&&(n._pauseAllSubscribeState.video=!0)},this._room){e.next=8;break}return r(),e.abrupt("return",Promise.resolve());case 8:return e.abrupt("return",this._room.pauseAllSubscribedStream(t).then((function(){r()})));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return ce.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(se=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("resumeAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),this._pauseAllSubscribeState.audio||this._pauseAllSubscribeState.video){e.next=4;break}return e.abrupt("return",Promise.resolve());case 4:if(r=function(){IP(t)&&(n._pauseAllSubscribeState.audio=!1),AP(t)&&(n._pauseAllSubscribeState.video=!1)},this._room){e.next=8;break}return r(),e.abrupt("return",Promise.resolve());case 8:return e.abrupt("return",this._room.resumeAllSubscribedStream(t).then((function(){var e,t;r(),null===(e=n._room)||void 0===e||null===(t=e.remoteStreams)||void 0===t||t.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){n._updateAudioPlayerState(e),n._updateVideoPlayerState(e)}))}))})));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return se.apply(this,arguments)})},{key:"sendUserMessage",value:(ae=c(o().mark((function e(t,r){var n,i,a=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(FP(t),zP(r),this._room&&this._room.connectionState===Nz.CONNECTED){e.next=4;break}throw new JN(qN.IM_BEFORE_JOIN,"join first");case 4:return i=Date.now(),e.abrupt("return",null===(n=this._room.sendUserMessage(t,r))||void 0===n?void 0:n.then((function(e){return a._messageStatisticsObserver.countP2PMessage(!0,t,!1,i,e),e.id})).catch((function(e){throw a._messageStatisticsObserver.countP2PMessage(!1,t,!1,i),e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return ae.apply(this,arguments)})},{key:"sendUserBinaryMessage",value:(oe=c(o().mark((function e(t,r){var n,i,a=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(FP(t),PP(r,"message"),zP(r),this._room&&this._room.connectionState===Nz.CONNECTED){e.next=5;break}throw new JN(qN.IM_BEFORE_JOIN,"join first");case 5:return i=Date.now(),e.abrupt("return",null===(n=this._room.sendUserMessage(t,r))||void 0===n?void 0:n.then((function(e){return a._messageStatisticsObserver.countP2PMessage(!0,t,!0,i,e),e.id})).catch((function(e){throw a._messageStatisticsObserver.countP2PMessage(!1,t,!0,i),e})));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return oe.apply(this,arguments)})},{key:"sendRoomMessage",value:(ie=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(zP(t),this._room&&this._room.connectionState===Nz.CONNECTED){e.next=3;break}throw new JN(qN.IM_BEFORE_JOIN,"join first");case 3:return r=Date.now(),e.abrupt("return",this._room.sendRoomMessage(t).then((function(e){var t,i;return n._messageStatisticsObserver.countRoomMessage(!0,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!1,r),e})).catch((function(e){var t,i;throw n._messageStatisticsObserver.countRoomMessage(!1,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!1,r),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return ie.apply(this,arguments)})},{key:"sendRoomBinaryMessage",value:(re=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(zP(t),this._room&&this._room.connectionState===Nz.CONNECTED){e.next=3;break}throw new JN(qN.IM_BEFORE_JOIN,"join first");case 3:return r=Date.now(),e.abrupt("return",this._room.sendRoomMessage(t,!0).then((function(e){var t,i;return n._messageStatisticsObserver.countRoomMessage(!0,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!0,r),e})).catch((function(e){var t,i;throw n._messageStatisticsObserver.countRoomMessage(!1,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!0,r),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return re.apply(this,arguments)})},{key:"setAudioCaptureConfig",value:(te=c(o().mark((function e(){var t,r,n,i=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},fJ.print("setAudioCaptureConfig()","config: %o",t),delete t.deviceId,MP(t),r=this._audioStreamConstraints.deviceId,this._audioStreamConstraints=t,r&&(this._audioStreamConstraints.deviceId=r),!this._localAudioTrack){e.next=11;break}return this._localAudioTrack.audioCaptureConfig=this._audioStreamConstraints,e.next=11,null===(n=this._localAudioTrack)||void 0===n?void 0:n.updateAudioCaptureConfig();case 11:case"end":return e.stop()}}),e,this)}))),function(){return te.apply(this,arguments)})},{key:"setVideoCaptureConfig",value:($=c(o().mark((function e(){var t,r,n,i=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},fJ.print("setVideoCaptureConfig()","config: %o",t),delete t.deviceId,MP(t),r=this._videoStreamConstraints.deviceId,this._videoStreamConstraints=t,r&&(this._videoStreamConstraints.deviceId=r),!this._localVideoTrack){e.next=12;break}return this._localVideoTrack.videoCaptureConfig=this._videoStreamConstraints,e.next=11,null===(n=this._localVideoTrack)||void 0===n?void 0:n.updateVideoCaptureConfig();case 11:this._updatePublish();case 12:case"end":return e.stop()}}),e,this)}))),function(){return $.apply(this,arguments)})},{key:"enableSimulcastMode",value:function(e){return fJ.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0}},{key:"setVideoEncoderConfig",value:(Z=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:fJ.print("setVideoEncoderConfig()"," descriptions: %o",t),Array.isArray(t)||(t=[t]),t.length>3&&(t=t.slice(0,3)),t.sort((function(e,t){return t.maxKbps-e.maxKbps})),this._videoStreamEncodeConfig=t,null!==(r=this._room)&&void 0!==r&&r.hasPublished&&this._updatePublish();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return Z.apply(this,arguments)})},{key:"setScreenEncoderConfig",value:(J=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:fJ.print("setScreenEncoderConfig()","description: %o",t),this._screenStreamEncodeConfig=[t],this._localScreenVideoTrack&&(this._localScreenVideoTrack.videoCaptureConfig=t,this._localScreenVideoTrack.updateVideoCaptureConfig(),t.contentHint&&this._localScreenVideoTrack.setContentHint(t.contentHint)),null!==(r=this._room)&&void 0!==r&&r.hasScreenPublished&&this._updateScreenPublish();case 4:case"end":return e.stop()}}),e,this)}))),function(e){return J.apply(this,arguments)})},{key:"sendSEIMessage",value:function(e,t,r){fJ.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),NP(e,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),OP(r,"repeatCount",0,30);var n="string"==typeof t?new Uint8Array(hP.str2ab(t)):t;if(t.length){var i;if(e===U.STREAM_INDEX_MAIN){var o,a,s;if(null===(o=this._room)||void 0===o||null===(a=o.localStream)||void 0===a||!a.hasPublished)return;i=null===(s=this._room)||void 0===s?void 0:s.localStream}else{var c,u,d;if(null===(c=this._room)||void 0===c||null===(u=c.localScreenStream)||void 0===u||!u.hasPublished)return;i=null===(d=this._room)||void 0===d?void 0:d.localScreenStream}if(n.byteLength>4096)fJ.print("sei size must not bigger than 4KB");else{var l=cP();i.seiList.push({content:n,uuid:l,repeatCount:r}),setTimeout((function(){if(i){var e=i.seiList.findIndex((function(e){return e.uuid===l}));e&&i.seiList.splice(e,1)}}),2e3)}}else fJ.print("sei message must not be empty")}},{key:"setAudioVolumeIndicationInterval",value:function(e){var t=this;fJ.print("setAudioVolumeIndicationInterval()","interval %o: ",e),("number"!=typeof e||e<200)&&(e=200);var r=[];this._audioVolumeIndicationTimer&&clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=setInterval((function(){var e,n;r=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var n;if(0!==e.length){var i=e.find((function(e){return!1===e.isScreen})),o=null==i||null===(n=i.audioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:t,volume:o||0})}}));var i=null===(n=t._localAudioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:t._getUserId(),volume:i||0}),t.safeEmit(ne.onAudioVolumeIndication,{speakers:r})}),e)}},{key:"_sendActiveSpeaker",value:function(e,t){if(this._room&&this._room.remoteUsers.size>=1){var r,n=e[0],i=t.reduce((function(e,t){return e&&e.audioPropertiesInfo.nonlinearVolume>t.audioPropertiesInfo.nonlinearVolume?e:t}),void 0);if((r=n?i?n.audioPropertiesInfo.nonlinearVolume>i.audioPropertiesInfo.nonlinearVolume?n:i:n:i)&&r.audioPropertiesInfo.nonlinearVolume>-60){var o,a;if(r.streamKey)o=this._room.remoteUsers.get(r.streamKey.userId);else o=null===(a=this._room._roomInfo)||void 0===a?void 0:a.userInfo;o&&this.safeEmit(ne.onActiveSpeaker,{userId:o.userId,extraInfo:o.extraInfo})}}}},{key:"enableAudioPropertiesReport",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};fJ.print("enableAudioPropertiesReport()","config %o: ",t);var r=t.enableInBackground,n=void 0===r||r,i=t.interval,o=void 0===i?100:i;this._stopAudioPropertiesReport(),o<=0||(o=Math.max(100,o),this._audioPropertiesReportTimer=self.setInterval((function(){if(n||"hidden"!==document.visibilityState){var t=[],r=e._audioDeviceManager.getRecordTrack()||e._localAudioTrack;if(r){var i=r.getAudioLevel();t.push({streamIndex:U.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:TP(i)}})}if(e._localScreenAudioTrack){var o=e._localScreenAudioTrack.getAudioLevel();t.push({streamIndex:U.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:o,nonlinearVolume:TP(o)}})}if(e.safeEmit(ne.onLocalAudioPropertiesReport,t),e._room){var a=[];e._room.remoteStreams.forEach((function(t,r){t.forEach((function(t){if(t.audioTrack){var n,i,o=t.audioTrack.getAudioLevel();a.push({streamKey:{userId:r,streamIndex:t.isScreen?U.STREAM_INDEX_SCREEN:U.STREAM_INDEX_MAIN,roomId:null===(n=e._room)||void 0===n||null===(i=n.roomInfo)||void 0===i?void 0:i.roomId},audioPropertiesInfo:{linearVolume:o,nonlinearVolume:TP(o)}})}}))})),e._sendActiveSpeaker(t,a.filter((function(e){return e.streamKey.streamIndex!==U.STREAM_INDEX_SCREEN}))),e.safeEmit(ne.onRemoteAudioPropertiesReport,a)}}}),o))}},{key:"setVideoSourceType",value:(q=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f,p,_,v,m,y,g,S,b,E,k,T;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("setVideoSourceType()","index: %o, videoSourceType: %o",t,r),NP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),NP(r,"VideoSourceType",[R.VIDEO_SOURCE_TYPE_EXTERNAL,R.VIDEO_SOURCE_TYPE_INTERNAL]),n=t===U.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[n]===r){e.next=26;break}if(this._trackSourceType[n]=r,fJ.print("setVideoSourceType","set ".concat(n," source type to ").concat(r)),!this._localVideoTrack||t!==U.STREAM_INDEX_MAIN){e.next=17;break}if(c=!1,r===R.VIDEO_SOURCE_TYPE_EXTERNAL&&(c=!0,this._localVideoTrack.close()),null===(i=this._videoPlayer)||void 0===i||i.stop(),this._localVideoTrack=void 0,u=null===(a=this._room)||void 0===a?void 0:a._roomConfig.isAutoPublish,c?null===(d=this._room)||void 0===d||null===(l=d.localStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setEnableVideo(!1):null===(f=this._room)||void 0===f||null===(p=f.localStream)||void 0===p||null===(_=p.observer)||void 0===_||_.setPushVideo(!1),!(null!==(s=this._room)&&void 0!==s&&s.hasPublished||u)){e.next=17;break}return e.next=17,this._updatePublish();case 17:if(!this._localScreenVideoTrack||t!==U.STREAM_INDEX_SCREEN){e.next=26;break}if(y=!1,r===R.VIDEO_SOURCE_TYPE_EXTERNAL&&(y=!0,this._localScreenVideoTrack.close()),null===(v=this._screenPlayer)||void 0===v||v.stop(),this._localScreenVideoTrack=void 0,y?null===(g=this._room)||void 0===g||null===(S=g.localScreenStream)||void 0===S||null===(b=S.observer)||void 0===b||b.setEnableVideo(!1):null===(E=this._room)||void 0===E||null===(k=E.localScreenStream)||void 0===k||null===(T=k.observer)||void 0===T||T.setPushVideo(!1),null===(m=this._room)||void 0===m||!m.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return q.apply(this,arguments)})},{key:"setExternalVideoTrack",value:(X=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("setExternalVideoTrack()","index: %o, track: %o",t,r),NP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),t!==U.STREAM_INDEX_MAIN){e.next=12;break}if(this._trackSourceType.video===R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new JN(qN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 5:if(this._localVideoTrack=new DH(r,cP()),this._initLocalTrackEvents(this._localVideoTrack),null===(n=this._videoPlayer)||void 0===n||n.playVideo(this._localVideoTrack),s=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,!(null!==(a=this._room)&&void 0!==a&&a.hasPublished||s)){e.next=12;break}return e.next=12,this._updatePublish();case 12:if(t!==U.STREAM_INDEX_SCREEN){e.next=22;break}if(this._trackSourceType.screenVideo===R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=15;break}throw new JN(qN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 15:if(this._localScreenVideoTrack=new DH(r,cP()),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(c=this._screenPlayer)||void 0===c||c.playVideo(this._localScreenVideoTrack),null===(u=this._room)||void 0===u||null===(d=u.localScreenStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setPushVideo(!0),null===(h=this._room)||void 0===h||!h.hasScreenPublished){e.next=22;break}return e.next=22,this._updateScreenPublish();case 22:case"end":return e.stop()}}),e,this)}))),function(e,t){return X.apply(this,arguments)})},{key:"setAudioSourceType",value:(z=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f,p,_,v,m,y,g,S,b,E;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("setAudioSourceType()","index: %o, audioSourceType: %o",t,r),NP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),NP(r,"audioSourceType",[w.AUDIO_SOURCE_TYPE_EXTERNAL,w.AUDIO_SOURCE_TYPE_INTERNAL]),n=t===U.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[n]===r){e.next=24;break}if(this._trackSourceType[n]=r,fJ.print("setVideoSourceType","set ".concat(n," source type to ").concat(r)),!this._localAudioTrack||t!==U.STREAM_INDEX_MAIN){e.next=16;break}if(s=!1,this._trackSourceType.audio===w.AUDIO_SOURCE_TYPE_EXTERNAL&&(s=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,c=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,s?null===(u=this._room)||void 0===u||null===(d=u.localStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setEnableAudio(!1):null===(h=this._room)||void 0===h||null===(f=h.localStream)||void 0===f||null===(p=f.observer)||void 0===p||p.setPushAudio(!1),!(null!==(a=this._room)&&void 0!==a&&a.hasPublished||c)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(!this._localScreenAudioTrack||t!==U.STREAM_INDEX_SCREEN){e.next=24;break}if(v=!1,this._trackSourceType.audio===w.AUDIO_SOURCE_TYPE_EXTERNAL&&(v=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,v?null===(m=this._room)||void 0===m||null===(y=m.localScreenStream)||void 0===y||null===(g=y.observer)||void 0===g||g.setEnableAudio(!1):null===(S=this._room)||void 0===S||null===(b=S.localScreenStream)||void 0===b||null===(E=b.observer)||void 0===E||E.setPushAudio(!1),null===(_=this._room)||void 0===_||!_.hasScreenPublished){e.next=24;break}return e.next=24,this._updateScreenPublish();case 24:case"end":return e.stop()}}),e,this)}))),function(e,t){return z.apply(this,arguments)})},{key:"setExternalAudioTrack",value:(H=c(o().mark((function e(t,r){var n,i,a,s,c,u,d,l,h,f;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("setExternalAudioTrack()","index: %o, track: %o",t,r),NP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),t!==U.STREAM_INDEX_MAIN){e.next=12;break}if(this._trackSourceType.audio===w.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new JN(qN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 5:if(this._localAudioTrack=new PH(r,cP()),this._initLocalTrackEvents(this._localAudioTrack),u=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,null===(i=this._room)||void 0===i||null===(a=i.localStream)||void 0===a||null===(s=a.observer)||void 0===s||s.setPushAudio(!0),!(null!==(c=this._room)&&void 0!==c&&c.hasPublished||u)){e.next=12;break}return e.next=12,this._updatePublish();case 12:if(t!==U.STREAM_INDEX_SCREEN){e.next=21;break}if(this._trackSourceType.screenAudio===w.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=15;break}throw new JN(qN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 15:if(this._localScreenAudioTrack=new PH(r,cP()),this._initLocalTrackEvents(this._localScreenAudioTrack),null===(d=this._room)||void 0===d||null===(l=d.localScreenStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setPushAudio(!0),null===(f=this._room)||void 0===f||!f.hasScreenPublished){e.next=21;break}return e.next=21,this._updateScreenPublish();case 21:case"end":return e.stop()}}),e,this)}))),function(e,t){return H.apply(this,arguments)})},{key:"login",value:(G=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("login()","token: %o, userInfo: %o",t,r),LP(t)||xP(t,"token"),FP(r),e.abrupt("return",this._rtmClient.login(t,r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return G.apply(this,arguments)})},{key:"logout",value:(j=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("logout()"),e.abrupt("return",this._rtmClient.logout());case 2:case"end":return e.stop()}}),e,this)}))),function(){return j.apply(this,arguments)})},{key:"updateLoginToken",value:(M=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("updateLoginToken()","token: %o",t),LP(t)||xP(t,"token"),e.abrupt("return",this._rtmClient.updateLoginToken(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return M.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(P=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("getPeerOnlineStatus()","userId: %o",t),FP(t),e.abrupt("return",this._rtmClient.getPeerOnlineStatus(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return P.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(x=c(o().mark((function e(t,r){var n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return FP(t),zP(r),n=Date.now(),e.prev=3,e.abrupt("return",this._rtmClient.sendUserMessageOutsideRoom(t,r).then((function(e){return i._messageStatisticsObserver.countUserMessageOutsideRoom(!0,t,!1,n,e),e.id})).catch((function(e){throw i._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!1,n),e})));case 7:throw e.prev=7,e.t0=e.catch(3),this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!1,n),e.t0;case 11:case"end":return e.stop()}}),e,this,[[3,7]])}))),function(e,t){return x.apply(this,arguments)})},{key:"sendUserBinaryMessageOutsideRoom",value:(O=c(o().mark((function e(t,r){var n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return FP(t),PP(r,"message"),zP(r),n=Date.now(),e.prev=4,e.abrupt("return",this._rtmClient.sendUserMessageOutsideRoom(t,r).then((function(e){return i._messageStatisticsObserver.countUserMessageOutsideRoom(!0,t,!0,n,e),e.id})).catch((function(e){throw i._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!0,n),e})));case 8:throw e.prev=8,e.t0=e.catch(4),this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!0,n),e.t0;case 12:case"end":return e.stop()}}),e,this,[[4,8]])}))),function(e,t){return O.apply(this,arguments)})},{key:"setServerParams",value:(C=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("setServerParams()","signature: %o, url: %0",t,r),e.abrupt("return",this._rtmClient.setServerParams(t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return C.apply(this,arguments)})},{key:"sendServerMessage",value:(A=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xP(t,"message"),zP(t),r=Date.now(),e.prev=3,e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(){n._messageStatisticsObserver.countServerMessage(!0,!1,r)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!1,r),e})));case 7:throw e.prev=7,e.t0=e.catch(3),this._messageStatisticsObserver.countServerMessage(!1,!1,r),e.t0;case 11:case"end":return e.stop()}}),e,this,[[3,7]])}))),function(e){return A.apply(this,arguments)})},{key:"sendServerBinaryMessage",value:(I=c(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return PP(t,"message"),zP(t),r=Date.now(),e.prev=3,e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(){n._messageStatisticsObserver.countServerMessage(!0,!0,r)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!0,r),e})));case 7:throw e.prev=7,e.t0=e.catch(3),this._messageStatisticsObserver.countServerMessage(!1,!0,r),e.t0;case 11:case"end":return e.stop()}}),e,this,[[3,7]])}))),function(e){return I.apply(this,arguments)})},{key:"startCloudProxy",value:function(e){if(this._room)throw new JN(qN.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");fJ.print("startCloudProxy()",e),xP(e.logProxy,"logProxy"),xP(e.accessProxy,"accessProxy"),xP(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=HB("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=HB("LOG_SERVER_URL"),this._originConfigServerUrls=HB("CONFIG_REQUEST_DOMAINS"),GB("ICE_CONFIG_REQUEST_URLS",e.accessProxy),GB("LOG_SERVER_URL",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^https?:\/\/.+/.test(e)||(e="https://"+e),"".concat(e,"/video/v1/webrtc_log/")}(e.logProxy)),GB("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0}},{key:"stopCloudProxy",value:function(){if(this._room)throw new JN(qN.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");fJ.print("stopCloudProxy()"),GB("ICE_CONFIG_REQUEST_URLS",[]),GB("LOG_SERVER_URL",this._originLogServerUrl),GB("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0}},{key:"startPushPublicStream",value:(T=c(o().mark((function e(t,r){var n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),BP(t),this._room&&this._room.connectionState===Nz.CONNECTED){e.next=4;break}throw new JN(qN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");case 4:if(!this._publicStreamIds.get(t)){e.next=6;break}throw new JN(qN.REPEAT_PUSH,"repeat push public media stream");case 6:return n=KB(t,"started",r),e.abrupt("return",this._room.publicStreamControlMessage(n).then((function(){i._publicStreamIds.set(t,t)})));case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return T.apply(this,arguments)})},{key:"updatePublicStreamParam",value:(k=c(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),BP(t),this._room&&this._room.connectionState===Nz.CONNECTED){e.next=4;break}throw new JN(qN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");case 4:return n=KB(t,"layoutChanged",r),e.abrupt("return",this._room.publicStreamControlMessage(n));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return k.apply(this,arguments)})},{key:"stopPushPublicStream",value:(E=c(o().mark((function e(t){var r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("startPushPublicStream()","publicStreamId: %o",t),BP(t),this._room&&this._room.connectionState===Nz.CONNECTED){e.next=4;break}throw new JN(qN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");case 4:return e.abrupt("return",this._room.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:t}).then((function(){r._publicStreamIds.delete(t)})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return E.apply(this,arguments)})},{key:"startPlayPublicStream",value:(S=c(o().mark((function e(t){var r,n,i,a,s,c,u=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BP(t),this._outsideRoom){e.next=8;break}return this._outsideRoom=new nJ(this._appId),this._outsideRoom.on(nz.RESUBSCRIBE,(function(e){var t=e.stream;if(t){var r,n=u._publicStreamAudioPlayer.get(t.streamId);n&&t.audioTrack&&(n.stop(),n.playAudio(null===(r=e.stream)||void 0===r?void 0:r.audioTrack));var i,o=u._publicStreamVideoPlayer.get(t.streamId);o&&t.videoTrack&&o.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(r=this._outsideRoom)||void 0===r||r.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,u.safeEmit(ne.onPublicStreamStats,e)})),null===(n=this._outsideRoom)||void 0===n||n.on(nz.ON_SEI_MESSAGED_RECEIVED,(function(e){u.safeEmit(ne.onPublicStreamSEIMessageReceived,e)})),e.next=8,this._outsideRoom.connect();case 8:return e.next=10,this._outsideRoom.startPlayPublicStream(t);case 10:i=e.sent,(a=this._publicStreamVideoPlayer.get(t))&&null!=i&&i.videoTrack&&a.playVideo(i.videoTrack,i),!(s=this._publicStreamAudioPlayer.get(t))&&null!=i&&i.audioTrack&&(s=new nK(t,{muted:(null===(c=this._config)||void 0===c?void 0:c.autoPlayPolicy)===Q.VIDEO_ONLY}),this._initPlayerEvents(s,!0),s.playAudio(i.audioTrack),this._publicStreamAudioPlayer.set(t,s));case 15:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"stopPlayPublicStream",value:(y=c(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._outsideRoom){e.next=2;break}return e.abrupt("return");case 2:this._outsideRoom.stopPlayPublicStream(t),(r=this._publicStreamAudioPlayer.get(t))&&(r.destroy(),this._publicStreamAudioPlayer.delete(t));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"setAudioProfile",value:(v=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._audioProfileManager.setAudioProfile(t);case 1:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"setPublicStreamVideoPlayer",value:function(e,t){var r,n,o,a;fJ.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var s=this._publicStreamVideoPlayer.get(e);if(null===(r=s)||void 0===r||r.destroy(),null!=t&&t.renderDom){s=new rK(i(i({},t),{},{userId:e})),this._initPlayerEvents(s,!0),this._publicStreamVideoPlayer.set(e,s);var c=null===(n=this._outsideRoom)||void 0===n||null===(o=n.remoteStreams)||void 0===o?void 0:o.get(e);null!=c&&c.videoTrack&&(null===(a=this._config)||void 0===a?void 0:a.autoPlayPolicy)!==Q.PLAY_MANUALLY&&s.playVideo(c.videoTrack,c)}else this._publicStreamVideoPlayer.delete(e)}},{key:"setDummyCaptureImagePath",value:(_=c(o().mark((function e(t,r){var n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,i){xP(r,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=r,o.onload=function(){try{var r=document.createElement("canvas"),a=r.getContext("2d");if(!a)return i(new JN(qN.UNEXPECTED_ERROR,"Not support canvas"));r.width=o.width,r.height=o.height,a.drawImage(o,0,0,o.width,o.height),clearInterval(n._dummyTimer),n._dummyTimer=window.setInterval((function(){a.drawImage(o,0,0,o.width,o.height)}),200);var s=r.captureStream(5).getVideoTracks()[0];t===U.STREAM_INDEX_MAIN?n._localImgVideoTrack=s:n._localImgScreenTrack=s,e()}catch(c){i(new JN(qN.UNEXPECTED_ERROR,c.message))}},o.onerror=function(){i(new JN(qN.UNEXPECTED_ERROR,"Load image error"))}})));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return _.apply(this,arguments)})},{key:"defaultTranscoding",value:function(){return JSON.parse(JSON.stringify(XB))}},{key:"_updatePublish",value:(d=c(o().mark((function e(){var t,r,n,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:{},fJ.print("_updatePublish()","config: %o",t),r={mediaType:void 0,invokeByJoinRoom:!1,pubState:oz.PUB},t=i(i({},r),t),this._visibility){e.next=6;break}throw new JN(qN.NO_PUBLISH_PERMISSION,"no publish permission");case 6:return e.next=8,this._pubLock.lock();case 8:if(n=e.sent,this._room&&this._room.connectionState===Nz.CONNECTED){e.next=12;break}return n(),e.abrupt("return");case 12:return e.prev=12,e.next=15,this._room.publish(this._videoStreamEncodeConfig,this._enableSimulcast,this._localVideoTrack,this._localAudioTrack,t.mediaType,t.pubState,t.invokeByJoinRoom);case 15:e.next=24;break;case 17:if(e.prev=17,e.t0=e.catch(12),!(e.t0 instanceof JN)){e.next=23;break}throw e.t0;case 23:throw new JN(qN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 24:return e.prev=24,n(),e.finish(24);case 27:case"end":return e.stop()}}),e,this,[[12,17,24,27]])}))),function(){return d.apply(this,arguments)})},{key:"startAudioPlaybackDeviceTest",value:(s=c(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",t,r),xP(t,"filePath"),OP(r,"indicationInterval"),e.next=5,this._audioDeviceManager.startAudioPlaybackDeviceTest(t,r);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){fJ.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()}},{key:"startAudioDeviceRecordTest",value:(a=c(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("startAudioDeviceRecordTest()","indicationInterval: %o",t),OP(t,"indicationInterval"),e.next=4,this._audioDeviceManager.startAudioDeviceRecordTest(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){fJ.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()}},{key:"stopAudioDevicePlayTest",value:function(){fJ.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()}},{key:"setRemoteUserPriority",value:function(e,t){var r;fJ.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{FP(e),NP(t,"priority",[W.HIGH,W.MEDIUM,W.LOW])}catch(n){return console.warn(n),!1}return this._userPriorityMap.set(e,t),null===(r=this._room)||void 0===r||r.setRemoteUserPriority(e,t),!0}},{key:"takeLocalSnapshot",value:(n=c(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("takeLocalSnapshot()","streamIndex: %o",t),NP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),r=t===U.STREAM_INDEX_MAIN?this.localVideoTrack:this.localScreenVideoTrack){e.next=5;break}throw new JN(qN.INVOKED_BEFORE_CAPTURE,"capture first");case 5:return n=t===U.STREAM_INDEX_MAIN?this._videoPlayer:this._screenPlayer,e.abrupt("return",uJ(r.getTrack(),(null==n?void 0:n.mirrorType)===B.MIRROR_TYPE_RENDER,n));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"takeRemoteSnapshot",value:(r=c(o().mark((function e(t,r){var n,i,a,s,c,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("takeRemoteSnapshot()","id: %o, streamIndex: %o",t,r),xP(t,"id"),NP(r,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),u=(null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(t))||void 0===i||null===(a=i.find((function(e){return e.isScreen===(r===U.STREAM_INDEX_SCREEN)})))||void 0===a?void 0:a.videoTrack)||(null===(s=this._outsideRoom)||void 0===s||null===(c=s.remoteStreams.get(t))||void 0===c?void 0:c.videoTrack)){e.next=6;break}throw new JN(qN.STREAM_NOT_EXIST,"stream not exist");case 6:return e.abrupt("return",uJ(u.getTrack(),!1,r===U.STREAM_INDEX_MAIN?this._remoteVideoPlayer.get(t):this._remoteScreenPlayer.get(t)));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setSubscribeFallbackOption",value:function(e){fJ.print("setSubscribeFallbackOption()","option: %o",e);try{NP(e,"option",[K.DISABLE,K.VIDEO_STREAM_LOW,K.AUDIO_ONLY])}catch(t){return console.warn(t),!1}return!this._room&&(this._subscribeFallbackOption=e,!0)}},{key:"_updateScreenPublish",value:(t=c(o().mark((function e(){var t,r,n,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.length>0&&void 0!==a[0]?a[0]:{},fJ.print("_updateScreenPublish()"),r={mediaType:void 0,pubState:oz.PUB},t=i(i({},r),t),e.next=6,this._pubLock.lock();case 6:if(n=e.sent,this._room&&this._room.connectionState===Nz.CONNECTED){e.next=10;break}return n(),e.abrupt("return");case 10:return e.prev=10,e.next=13,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack,t.mediaType,t.pubState);case 13:e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(10),!(e.t0 instanceof JN)){e.next=21;break}throw e.t0;case 21:throw new JN(qN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 22:return e.prev=22,n(),e.finish(22);case 25:case"end":return e.stop()}}),e,this,[[10,15,22,25]])}))),function(){return t.apply(this,arguments)})},{key:"_setCaptureVolume",value:function(e,t){var r;0===t&&fJ.print("setCaptureVolume: ",t),NP(e,"streamType",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),OP(t,"volume",0,400);var n=!1;e===U.STREAM_INDEX_MAIN?(this._localAudioTrack&&(n=!!this._localAudioTrack.gainAudioTrack,this._localAudioTrack.setCaptureVolume(t)),this._localAudioTrackVolume=t):e===U.STREAM_INDEX_SCREEN&&(this._localScreenAudioTrack&&(n=!!this._localScreenAudioTrack.gainAudioTrack,this._localScreenAudioTrack.setCaptureVolume(t)),this._localScreenAudioTrackVolume=t),null!==(r=this._room)&&void 0!==r&&r.hasPublished&&!n&&this._updatePublish()}},{key:"_updateAudioPlayerState",value:function(e){fJ.print("_updateAudioPlayerState()");var t,r=e.userId,n=e.isScreen;if(t=n?this._remoteAudioPlayer.get("".concat(r,"_screen")):this._remoteAudioPlayer.get(r),e.audioTrack&&(e.attributes.audiostream&&e.subAudio||this.multiChatMode)){var i;if(!t){var o,a=n?"".concat(r,"_screen"):r;t=new nK(a,{muted:(null===(o=this._config)||void 0===o?void 0:o.autoPlayPolicy)===Q.VIDEO_ONLY}),this._initPlayerEvents(t),this._remoteAudioPlayer.set(a,t),this._audioPlaybackDeviceId&&t.setPlaybackDevice(this._audioPlaybackDeviceId)}(null===(i=this._config)||void 0===i?void 0:i.autoPlayPolicy)!==Q.PLAY_MANUALLY&&t.playAudio(e.audioTrack)}else{var s;null===(s=t)||void 0===s||s.stop()}}},{key:"_updateVideoPlayerState",value:function(e){var t;fJ.print("_updateVideoPlayerState()");var r,n,i=e.userId;if(r=e.isScreen?this._remoteScreenPlayer.get(i):this._remoteVideoPlayer.get(i),e.videoTrack)r&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Q.PLAY_MANUALLY&&r.playVideo(e.videoTrack,e);else if(null!==(t=r)&&void 0!==t&&t.played){var o;null===(o=r)||void 0===o||o.stop()}}},{key:"_onAddStream",value:function(e){var t=e.stream,r=null==t?void 0:t.attributes,n=r.localaudio,i=r.audiostream,o=r.localvideo,a=r.videostream,s=jH.NONE;if(i&&(s|=L.AUDIO),a&&(s|=L.VIDEO),s){var c;if(null!=t&&t.isScreen)this.safeEmit(ne.onUserPublishScreen,{userId:t.userId,mediaType:s});else this.safeEmit(ne.onUserPublishStream,{userId:t.userId,mediaType:s,videoStreamDescriptions:null==t||null===(c=t.attributes)||void 0===c?void 0:c.videoDescriptions}),this._handleAutoSubscribe(t,!0);this.safeEmit("onAddStream",{userId:t.userId,mediaType:s,isScreen:!(null==t||!t.isScreen)}),null!=t&&t.isScreen||(n&&this.safeEmit(ne.onUserStartAudioCapture,{userId:t.userId}),o&&this.safeEmit(ne.onUserStartVideoCapture,{userId:t.userId}))}}},{key:"_handleAutoSubscribe",value:function(e,t){var r,n,i=jH.NONE;if(null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoSubscribeAudio&&(i|=L.AUDIO),null!==(n=this._roomConfig)&&void 0!==n&&n.isAutoSubscribeVideo&&(i|=L.VIDEO),fJ.print("_onAddStream","autoSubType: ".concat(i)),i){var o,a;if(t&&IP(i))null===(o=e.observer)||void 0===o||o.setAutoSubscribeAudio(!0);if(t&&AP(i))null===(a=e.observer)||void 0===a||a.setAutoSubscribeVideo(!0);this._subscribe(!1,e.userId,i)}}},{key:"_onRemoveStream",value:function(e){var t,r=this,n=e.stream,i=null!==(t=_J[e.reason])&&void 0!==t?t:V.STREAM_REMOVE_REASON_OTHER,o=n.isScreen?ne.onUserUnpublishScreen:ne.onUserUnpublishStream,a=jH.NONE;n.attributes.audiostream&&(a|=L.AUDIO),n.attributes.videostream&&(a|=L.VIDEO),null!=n&&n._workaround_1_&&(a=L.VIDEO),a!==jH.NONE&&(this.safeEmit(o,{userId:n.userId,mediaType:a,reason:i}),this.safeEmit("onRemoveStream",{userId:n.userId,isScreen:n.isScreen})),this._getRemotePlayer(n.userId,n.isScreen).forEach((function(e){if(null==n||!n._workaround_1_){var t=n.isScreen?"".concat(n.userId,"_screen"):n.userId;r._remoteAudioPlayer.delete(t),n.isScreen?r._remoteScreenPlayer.delete(n.userId):r._remoteVideoPlayer.delete(n.userId),null==e||e.destroy()}}))}},{key:"_onUserConnection",value:function(e){this.safeEmit(ne.onUserJoined,e)}},{key:"_onUserLeave",value:function(e){this.safeEmit(ne.onUserLeave,e)}},{key:"_onRoomError",value:function(e){var t;this.safeEmit(ne.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0}},{key:"_onNetworkQuality",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.safeEmit.apply(this,[ne.onNetworkQuality].concat(t))}},{key:"_onConnectionStateChange",value:function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===F.CONNECTION_STATE_CONNECTED&&this.safeEmit(ne.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(ne.onConnectionStateChanged,e)}},{key:"_getRemotePlayer",value:function(e,t){return[this._remoteAudioPlayer.get(t?"".concat(e,"_screen"):e),(t?this._remoteScreenPlayer:this._remoteVideoPlayer).get(e)]}},{key:"_stopAudioPropertiesReport",value:function(){null!==this._audioPropertiesReportTimer&&(clearInterval(this._audioPropertiesReportTimer),this._audioPropertiesReportTimer=null)}},{key:"_onResubscribe",value:function(e){e.stream&&(this._getRemotePlayer(e.stream.userId,e.stream.isScreen).forEach((function(e){return null==e?void 0:e.stop()})),this._updateAudioPlayerState(e.stream),this._updateVideoPlayerState(e.stream))}},{key:"_onSubscribePushTrack",value:function(e){e.stream&&this._updateAudioPlayerState(e.stream)}},{key:"_onRemovePushTrack",value:function(e){e.stream&&this._updateAudioPlayerState(e.stream)}},{key:"_onVideoFirstFrameDecoded",value:function(e){this.safeEmit(ne.onVideoFirstFrameDecoded,e)}},{key:"_onVideoDeviceStateChange",value:function(e){this.safeEmit(ne.onVideoDeviceStateChanged,e)}},{key:"_onAudioDeviceStateChange",value:function(e){this.safeEmit(ne.onAudioDeviceStateChanged,e)}},{key:"_onUserPublishStateChange",value:function(e){var t,r=e.userId,n=e.isScreen,o=e.mediaType,a=e.pubState,s=e.remoteStream,c={userId:r,mediaType:o};n?a===oz.PUB?this.safeEmit(ne.onUserPublishScreen,c):this.safeEmit(ne.onUserUnpublishScreen,i(i({},c),{},{reason:V.STREAM_REMOVE_REASON_UNPUBLISH})):a===oz.PUB?(c.videoStreamDescriptions=null==s||null===(t=s.attributes)||void 0===t?void 0:t.videoDescriptions,this.safeEmit(ne.onUserPublishStream,c),this._handleAutoSubscribe(s,!0)):this.safeEmit(ne.onUserUnpublishStream,i(i({},c),{},{reason:V.STREAM_REMOVE_REASON_UNPUBLISH}))}},{key:"_onCustomMessage",value:function(e){var t=e.message;e.binary?this.safeEmit(ne.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(ne.onRoomMessageReceived,{userId:e.clientId,message:t})}},{key:"_onUserMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(ne.onUserMessageReceived,e)}},{key:"_onUserBinaryMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(ne.onUserBinaryMessageReceived,e)}},{key:"_onLiveTranscodingResult",value:function(e){this.safeEmit(ne.onLiveTranscodingResult,e)}},{key:"_onStreamMixingEvent",value:function(e){this.safeEmit(ne.onStreamMixingEvent,e)}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(ne.onTokenWillExpire)}},{key:"_onPushPublicStreamResult",value:function(e){this.safeEmit(ne.onPushPublicStreamResult,e)}},{key:"_handleRTMClient",value:function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(ne.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(ne.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(ne.onError,{errorCode:qN.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(ne.onError,{errorCode:qN.RTM_TOKEN_ERROR})})),e.on("onServerParamsSetResult",(function(e){t.safeEmit(ne.onServerParamsSetResult,null==e?void 0:e.code)}))}},{key:"waitForNewToken",get:function(){return!!this._tempRoomConfig}},{key:"localAudioTrack",get:function(){return this._localAudioTrack}},{key:"localVideoTrack",get:function(){return this._localVideoTrack}},{key:"localScreenAudioTrack",get:function(){return this._localScreenAudioTrack}},{key:"localScreenVideoTrack",get:function(){return this._localScreenVideoTrack}},{key:"remoteStreams",get:function(){var e,t,r=[];null!==(e=this._room)&&void 0!==e&&e.remoteStreams&&(null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){r.push({userId:e.userId,isScreen:e.isScreen,hasVideo:e.hasVideo,hasAudio:e.hasAudio,videoStreamDescriptions:e.attributes.videoDescriptions})}))})));return r}},{key:"remoteUsers",get:function(){var e,t,r=[];null!==(e=this._room)&&void 0!==e&&e.remoteUsers&&(null===(t=this._room)||void 0===t||t.remoteUsers.forEach((function(e){r.push({userId:e.userId})})));return r}},{key:"multiChatMode",get:function(){var e,t;return!(null===(e=this._room)||void 0===e||null===(t=e._mediaServerClient)||void 0===t||!t.roomAttributes.multiChatMode)}},{key:"_handleAudioDeviceManager",value:function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(ne.onAudioPlaybackDeviceTestVolume,t)}))}},{key:"_assertNotInRoom",value:function(){if(!this._room||this._room.connectionState!==Nz.CONNECTED)throw new JN(qN.INVOKED_BEFORE_JOIN_ROOM,"join first")}},{key:"_checkMediaType",value:function(e){NP(e,"mediaType",[L.AUDIO,L.VIDEO,L.AUDIO_AND_VIDEO])}},{key:"_getUserId",value:function(){var e,t;return(null===(e=this._room)||void 0===e||null===(t=e.roomInfo)||void 0===t?void 0:t.userInfo.userId)||"local_user"}}]),Le}(DU);hJ([IB()],pJ.prototype,"updateToken",1),hJ([IB()],pJ.prototype,"setVideoCaptureDevice",1),hJ([IB()],pJ.prototype,"setAudioCaptureDevice",1),hJ([IB()],pJ.prototype,"joinRoom",1),hJ([IB()],pJ.prototype,"leaveRoom",1),hJ([IB()],pJ.prototype,"destroy",1),hJ([IB()],pJ.prototype,"publishStream",1),hJ([IB()],pJ.prototype,"unpublishStream",1),hJ([IB()],pJ.prototype,"publishScreen",1),hJ([IB()],pJ.prototype,"unpublishScreen",1),hJ([IB()],pJ.prototype,"subscribeStream",1),hJ([IB()],pJ.prototype,"unsubscribeStream",1),hJ([IB()],pJ.prototype,"subscribeScreen",1),hJ([IB()],pJ.prototype,"unsubscribeScreen",1),hJ([IB()],pJ.prototype,"setRemoteVideoConfig",1),hJ([IB()],pJ.prototype,"startVideoCapture",1),hJ([IB()],pJ.prototype,"stopVideoCapture",1),hJ([IB()],pJ.prototype,"startAudioCapture",1),hJ([IB()],pJ.prototype,"stopAudioCapture",1),hJ([IB()],pJ.prototype,"getAudioMixingManager",1),hJ([IB()],pJ.prototype,"startScreenCapture",1),hJ([IB()],pJ.prototype,"stopScreenCapture",1),hJ([IB()],pJ.prototype,"setLocalVideoPlayer",1),hJ([IB()],pJ.prototype,"startLiveTranscoding",1),hJ([IB()],pJ.prototype,"updateLiveTranscoding",1),hJ([IB()],pJ.prototype,"stopLiveTranscoding",1),hJ([IB()],pJ.prototype,"setBusinessId",1),hJ([IB()],pJ.prototype,"setUserVisibility",1),hJ([IB()],pJ.prototype,"setRemoteVideoPlayer",1),hJ([IB()],pJ.prototype,"setLocalVideoMirrorType",1),hJ([IB()],pJ.prototype,"setAudioPlaybackDevice",1),hJ([IB()],pJ.prototype,"play",1),hJ([IB()],pJ.prototype,"pauseAllSubscribedStream",1),hJ([IB()],pJ.prototype,"resumeAllSubscribedStream",1),hJ([IB()],pJ.prototype,"sendUserMessage",1),hJ([IB()],pJ.prototype,"sendUserBinaryMessage",1),hJ([IB()],pJ.prototype,"sendRoomMessage",1),hJ([IB()],pJ.prototype,"sendRoomBinaryMessage",1),hJ([IB()],pJ.prototype,"setAudioCaptureConfig",1),hJ([IB()],pJ.prototype,"setVideoCaptureConfig",1),hJ([IB()],pJ.prototype,"enableSimulcastMode",1),hJ([IB()],pJ.prototype,"setVideoEncoderConfig",1),hJ([IB()],pJ.prototype,"setScreenEncoderConfig",1),hJ([IB()],pJ.prototype,"sendSEIMessage",1),hJ([IB()],pJ.prototype,"setAudioVolumeIndicationInterval",1),hJ([IB()],pJ.prototype,"enableAudioPropertiesReport",1),hJ([IB()],pJ.prototype,"setVideoSourceType",1),hJ([IB()],pJ.prototype,"setExternalVideoTrack",1),hJ([IB()],pJ.prototype,"setAudioSourceType",1),hJ([IB()],pJ.prototype,"setExternalAudioTrack",1),hJ([IB("rtm")],pJ.prototype,"login",1),hJ([IB("rtm")],pJ.prototype,"logout",1),hJ([IB("rtm")],pJ.prototype,"updateLoginToken",1),hJ([IB("rtm")],pJ.prototype,"getPeerOnlineStatus",1),hJ([IB("rtm")],pJ.prototype,"sendUserMessageOutsideRoom",1),hJ([IB("rtm")],pJ.prototype,"sendUserBinaryMessageOutsideRoom",1),hJ([IB("rtm")],pJ.prototype,"setServerParams",1),hJ([IB("rtm")],pJ.prototype,"sendServerMessage",1),hJ([IB("rtm")],pJ.prototype,"sendServerBinaryMessage",1),hJ([IB()],pJ.prototype,"startCloudProxy",1),hJ([IB()],pJ.prototype,"stopCloudProxy",1),hJ([IB()],pJ.prototype,"startPushPublicStream",1),hJ([IB()],pJ.prototype,"updatePublicStreamParam",1),hJ([IB()],pJ.prototype,"stopPushPublicStream",1),hJ([IB("outsideRoom")],pJ.prototype,"startPlayPublicStream",1),hJ([IB("outsideRoom")],pJ.prototype,"stopPlayPublicStream",1),hJ([IB()],pJ.prototype,"setAudioProfile",1),hJ([IB("outsideRoom")],pJ.prototype,"setPublicStreamVideoPlayer",1),hJ([IB()],pJ.prototype,"setDummyCaptureImagePath",1),hJ([IB()],pJ.prototype,"startAudioPlaybackDeviceTest",1),hJ([IB()],pJ.prototype,"stopAudioPlaybackDeviceTest",1),hJ([IB()],pJ.prototype,"startAudioDeviceRecordTest",1),hJ([IB()],pJ.prototype,"stopAudioDeviceRecordAndPlayTest",1),hJ([IB()],pJ.prototype,"stopAudioDevicePlayTest",1),hJ([IB()],pJ.prototype,"setRemoteUserPriority",1),hJ([IB()],pJ.prototype,"takeLocalSnapshot",1),hJ([IB()],pJ.prototype,"takeRemoteSnapshot",1),hJ([IB()],pJ.prototype,"setSubscribeFallbackOption",1),hJ([IB()],pJ.prototype,"_setCaptureVolume",1);var _J={"client unpublished":V.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":V.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":V.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":V.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":V.STREAM_REMOVE_REASON_REPUBLISH},vJ=new xU("VERTC",0);[bB,EB,kB].forEach((function(e){var t;return e.setStats({rtc_sdk_version:jB.VERSION,product_line:UF.RTC,report_version:LF.W_5,os:VF.WEB,device_id:UB.getDeviceId(),user_agent:lP()?"":null===(t=navigator)||void 0===t?void 0:t.userAgent})}));var mJ=function(e,t){return vJ.print("createEngine","Invoke VERTC.createEngine"),xP(e,"appId"),[bB,EB,kB].forEach((function(r){return r.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),yB.sdkInitEngine(Date.now(),dB.BEGIN),new pJ(e,t)},yJ=function(e){if(vJ.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof pJ))throw new JN(qN.INVALID_ENGINE,"Invalid engine object");e.destroy(),yB.sdkInitEngine(Date.now(),dB.END)},gJ=function(){var e=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",pH.enumerateDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),SJ=function(){var e=c(o().mark((function e(){var t,r,n,i,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:{video:!0,audio:!0},r=t.video,n=t.audio,i={video:!1,audio:!1},!r){e.next=12;break}return e.prev=4,e.next=7,pH.getVideoPermission();case 7:i.video=e.sent,e.next=12;break;case 10:e.prev=10,e.t0=e.catch(4);case 12:if(!n){e.next=21;break}return e.prev=13,e.next=16,pH.getAudioPermission();case 16:i.audio=e.sent,e.next=21;break;case 19:e.prev=19,e.t1=e.catch(13);case 21:return e.abrupt("return",i);case 22:case"end":return e.stop()}}),e,null,[[4,10],[13,19]])})));return function(){return e.apply(this,arguments)}}(),bJ=function(){var e=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",pH.enumerateAudioCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),EJ=function(){var e=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",pH.enumerateVideoCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),kJ=function(){var e=c(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",pH.enumerateAudioPlaybackDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),TJ=function(){return jB.VERSION},IJ=function(){return yB.rtcSdkApiCall("isSupported",0,""),wj()},AJ=function(){return yB.rtcSdkApiCall("getSupportedCodecs",0,""),Oj()};return!lP()&&location.search.includes("_rtc_autotest_"),i(i(i(i({},new(l((function e(){u(this,e),h(this,"getSdkVersion",TJ),h(this,"createEngine",mJ),h(this,"destroyEngine",yJ),h(this,"enumerateDevices",gJ),h(this,"enableDevices",SJ),h(this,"enumerateAudioCaptureDevices",bJ),h(this,"enumerateVideoCaptureDevices",EJ),h(this,"enumerateAudioPlaybackDevices",kJ),h(this,"getParameter",HB),h(this,"setParameter",GB),h(this,"isSupported",IJ),h(this,"getSupportedCodecs",AJ),h(this,"events",ne),h(this,"ErrorCode",qN),h(this,"platform","".concat({}.PRODUCT_PLATFORM)),h(this,"_monitor",yB)})))),Z),re),{},{events:ne})}));
|
|
6
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).BytePlusRTC=t()}(this,(function(){"use strict";function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}function t(e){var t,n,i,o=2;for("undefined"!=typeof Symbol&&(n=Symbol.asyncIterator,i=Symbol.iterator);o--;){if(n&&null!=(t=e[n]))return t.call(e);if(i&&null!=(t=e[i]))return new r(t.call(e));n="@@asyncIterator",i="@@iterator"}throw new TypeError("Object is not async iterable")}function r(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then((function(e){return{value:e,done:t}}))}return r=function(e){this.s=e,this.n=e.next},r.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?Promise.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?Promise.reject(e):t(r.apply(this.s,arguments))}},new r(e)}function n(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 i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){h(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(){o=function(){return e};var e={},t=Object.prototype,r=t.hasOwnProperty,n=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",u=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(lV){c=function(e,t,r){return e[t]=r}}function d(e,t,r,i){var o=t&&t.prototype instanceof f?t:f,a=Object.create(o.prototype),s=new A(i||[]);return n(a,"_invoke",{value:E(e,r,s)}),a}function l(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(lV){return{type:"throw",arg:lV}}}e.wrap=d;var h={};function f(){}function p(){}function _(){}var v={};c(v,a,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(R([])));y&&y!==t&&r.call(y,a)&&(v=y);var g=_.prototype=f.prototype=Object.create(v);function S(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function b(e,t){function i(n,o,a,s){var u=l(e[n],e,o);if("throw"!==u.type){var c=u.arg,d=c.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){i("next",e,a,s)}),(function(e){i("throw",e,a,s)})):t.resolve(d).then((function(e){c.value=e,a(c)}),(function(e){return i("throw",e,a,s)}))}s(u.arg)}var o;n(this,"_invoke",{value:function(e,r){function n(){return new t((function(t,n){i(e,r,t,n)}))}return o=o?o.then(n,n):n()}})}function E(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return w()}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=k(a,r);if(s){if(s===h)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=l(e,t,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===h)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}function k(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method))return h;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var n=l(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,h;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,h):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,h)}function T(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 I(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function A(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function R(e){if(e){var t=e[a];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:w}}function w(){return{value:void 0,done:!0}}return p.prototype=_,n(g,"constructor",{value:_,configurable:!0}),n(_,"constructor",{value:p,configurable:!0}),p.displayName=c(_,u,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===p||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,c(e,u,"GeneratorFunction")),e.prototype=Object.create(g),e},e.awrap=function(e){return{__await:e}},S(b.prototype),c(b.prototype,s,(function(){return this})),e.AsyncIterator=b,e.async=function(t,r,n,i,o){void 0===o&&(o=Promise);var a=new b(d(t,r,n,i),o);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},S(g),c(g,u,"Generator"),c(g,a,(function(){return this})),c(g,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},e.values=R,A.prototype={constructor:A,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(I),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},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 t=this;function n(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return n("end");if(o.tryLoc<=this.prev){var s=r.call(o,"catchLoc"),u=r.call(o,"finallyLoc");if(s&&u){if(this.prev<o.catchLoc)return n(o.catchLoc,!0);if(this.prev<o.finallyLoc)return n(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return n(o.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return n(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var 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,h):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),h},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),I(r),h}},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;I(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},e}function a(e){return a="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},a(e)}function s(e,t,r,n,i,o,a){try{var s=e[o](a),u=s.value}catch(c){return void r(c)}s.done?t(u):Promise.resolve(u).then(n,i)}function u(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var o=e.apply(t,r);function a(e){s(o,n,i,a,u,"next",e)}function u(e){s(o,n,i,a,u,"throw",e)}a(void 0)}))}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(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)}}function l(e,t,r){return t&&d(e.prototype,t),r&&d(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(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&&_(e,t)}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},p(e)}function _(e,t){return _=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},_(e,t)}function v(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=Object.keys(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||(i[r]=e[r]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function g(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=p(e);if(t){var i=p(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return y(this,r)}}function S(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=p(e)););return e}function b(){return b="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var n=S(e,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}},b.apply(this,arguments)}function E(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==r)return;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(lV){s=!0,i=lV}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}(e,t)||T(e,t)||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.")}()}function k(e){return function(e){if(Array.isArray(e))return I(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||T(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function T(e,t){if(e){if("string"==typeof e)return I(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)?I(e,t):void 0}}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}function A(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=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}}}}var R=function(e){return e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL",e}(R||{}),w=function(e){return e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL",e}(w||{}),C=function(e){return e[e.QUIT=0]="QUIT",e[e.DROPPED=1]="DROPPED",e[e.SWITCH_TO_INVISIBLE=2]="SWITCH_TO_INVISIBLE",e[e.KICKED_BY_ADMIN=3]="KICKED_BY_ADMIN",e}(C||{}),O=function(e){return e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING",e}(O||{}),x=function(e){return e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE",e}(x||{}),N=function(e){return e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL",e}(N||{}),D=function(e){return e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL",e}(D||{}),P=function(e){return e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON",e}(P||{}),M=function(e){return e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT",e}(M||{}),U=function(e){return e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN",e}(U||{}),L=function(e){return e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO",e}(L||{}),V=function(e){return e[e.STREAM_REMOVE_REASON_UNPUBLISH=0]="STREAM_REMOVE_REASON_UNPUBLISH",e[e.STREAM_REMOVE_REASON_PUBLISH_FAILED=1]="STREAM_REMOVE_REASON_PUBLISH_FAILED",e[e.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED=2]="STREAM_REMOVE_REASON_KEEP_LIVE_FAILED",e[e.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED=3]="STREAM_REMOVE_REASON_CLIENT_DISCONNECTED",e[e.STREAM_REMOVE_REASON_REPUBLISH=4]="STREAM_REMOVE_REASON_REPUBLISH",e[e.STREAM_REMOVE_REASON_OTHER=5]="STREAM_REMOVE_REASON_OTHER",e}(V||{}),F=function(e){return e[e.CONNECTION_START=0]="CONNECTION_START",e[e.CONNECTION_STATE_DISCONNECTED=1]="CONNECTION_STATE_DISCONNECTED",e[e.CONNECTION_STATE_CONNECTING=2]="CONNECTION_STATE_CONNECTING",e[e.CONNECTION_STATE_CONNECTED=3]="CONNECTION_STATE_CONNECTED",e[e.CONNECTION_STATE_RECONNECTING=4]="CONNECTION_STATE_RECONNECTING",e[e.CONNECTION_STATE_RECONNECTED=5]="CONNECTION_STATE_RECONNECTED",e[e.CONNECTION_STATE_LOST=6]="CONNECTION_STATE_LOST",e}(F||{}),B=function(e){return e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER",e}(B||{}),j=function(e){return e[e.domestic=0]="domestic",e[e.overseas=1]="overseas",e}(j||{}),G=function(e){return e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE",e}(G||{}),H=function(e){return e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO_ONLY=1]="AUDIO_ONLY",e[e.VIDEO_ONLY=2]="VIDEO_ONLY",e}(H||{}),z=function(e){return e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME",e}(z||{}),K=function(e){return e[e.DISABLE=0]="DISABLE",e[e.VIDEO_STREAM_LOW=1]="VIDEO_STREAM_LOW",e[e.AUDIO_ONLY=2]="AUDIO_ONLY",e}(K||{}),W=function(e){return e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH",e}(W||{}),X=function(e){return e[e.UNKNOWN=0]="UNKNOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD",e}(X||{}),q=function(e){return e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth",e}(q||{}),Y=function(e){return e[e.communication=0]="communication",e[e.chat=5]="chat",e[e.chatRoom=6]="chatRoom",e[e.coHost=9]="coHost",e[e.meeting=16]="meeting",e[e.classRoom=18]="classRoom",e}(Y||{}),J=function(e){return e[e.default=0]="default",e[e.fluent=1]="fluent",e[e.standard=2]="standard",e[e.hd=3]="hd",e[e.standardStereo=4]="standardStereo",e[e.hdMono=5]="hdMono",e}(J||{}),Q=function(e){return e[e.AUTO_PLAY=0]="AUTO_PLAY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.PLAY_MANUALLY=2]="PLAY_MANUALLY",e}(Q||{}),Z=Object.freeze(Object.defineProperty({__proto__:null,VideoSourceType:R,AudioSourceType:w,UserOfflineReason:C,ChannelProfile:O,SubscribeMode:x,SubscribeState:N,PublishState:D,MirrorMode:P,VideoRenderMode:M,StreamIndex:U,MediaType:L,StreamRemoveReason:V,ConnectionState:F,MirrorType:B,LogChannel:j,USER_ONLINE_STATUS:G,PublicStreamType:H,PublicInterpolationMode:z,SubscribeFallbackOption:K,RemoteUserPriority:W,NetworkQuality:X,FallbackOrRecoverReason:q,RoomProfileType:Y,AudioProfileType:J,RTCAutoPlayPolicy:Q},Symbol.toStringTag,{value:"Module"})),$=function(e){return e[e.AUTO=0]="AUTO",e[e.MODE_L=1]="MODE_L",e[e.MODE_R=2]="MODE_R",e[e.MODE_MIX=3]="MODE_MIX",e}($||{}),ee=function(e){return e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH",e}(ee||{}),te=function(e){return e[e.AUDIO_MIXING_STATE_PRELOADED=0]="AUDIO_MIXING_STATE_PRELOADED",e[e.AUDIO_MIXING_STATE_PLAYING=1]="AUDIO_MIXING_STATE_PLAYING",e[e.AUDIO_MIXING_STATE_PAUSED=2]="AUDIO_MIXING_STATE_PAUSED",e[e.AUDIO_MIXING_STATE_STOPPED=3]="AUDIO_MIXING_STATE_STOPPED",e[e.AUDIO_MIXING_STATE_FAILED=4]="AUDIO_MIXING_STATE_FAILED",e[e.AUDIO_MIXING_STATE_FINISHED=5]="AUDIO_MIXING_STATE_FINISHED",e[e.AUDIO_MIXING_STATE_PCM_ENABLED=6]="AUDIO_MIXING_STATE_PCM_ENABLED",e[e.AUDIO_MIXING_STATE_PCM_DISABLED=7]="AUDIO_MIXING_STATE_PCM_DISABLED",e}(te||{}),re=Object.freeze(Object.defineProperty({__proto__:null,AudioMixingDualMonoMode:$,AudioMixingType:ee,AudioMixingState:te},Symbol.toStringTag,{value:"Module"})),ne=function(e){return e.onTrackEnded="onTrackEnded",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onUserPublishStream="onUserPublishStream",e.onUserUnpublishStream="onUserUnpublishStream",e.onUserPublishScreen="onUserPublishScreen",e.onUserUnpublishScreen="onUserUnpublishScreen",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onFirstPublicStreamVideoFrameRendered="onFirstPublicStreamVideoFrameRendered",e.onFirstPublicStreamVideoFrameDecoded="onFirstPublicStreamVideoFrameDecoded",e.onFirstPublicStreamAudioFrameDecoded="onFirstPublicStreamAudioFrameDecoded",e.onVideoDeviceStateChanged="onVideoDeviceStateChanged",e.onAudioDeviceStateChanged="onAudioDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onPublicStreamStats="onPublicStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",e.onLocalAudioPropertiesReport="onLocalAudioPropertiesReport",e.onRemoteAudioPropertiesReport="onRemoteAudioPropertiesReport",e.onActiveSpeaker="onActiveSpeaker",e.onAudioPlaybackDeviceChanged="onAudioPlaybackDeviceChanged",e.onUserStartVideoCapture="onUserStartVideoCapture",e.onUserStopVideoCapture="onUserStopVideoCapture",e.onUserStartAudioCapture="onUserStartAudioCapture",e.onUserStopAudioCapture="onUserStopAudioCapture",e.onAutoPublishResult="onAutoPublishResult",e.onAutoSubscribeResult="onAutoSubscribeResult",e.onLiveTranscodingResult="onLiveTranscodingResult",e.onStreamMixingEvent="onStreamMixingEvent",e.onAudioPlaybackDeviceTestVolume="onAudioPlaybackDeviceTestVolume",e.onSEIMessageReceived="onSEIMessageReceived",e.onError="onError",e.onAudioMixingStateChanged="onAudioMixingStateChanged",e.onUserMessageReceivedOutsideRoom="onUserMessageReceivedOutsideRoom",e.onUserBinaryMessageReceivedOutsideRoom="onUserBinaryMessageReceivedOutsideRoom",e.onTokenWillExpire="onTokenWillExpire",e.onCloudProxyConnected="onCloudProxyConnected",e.onPushPublicStreamResult="onPushPublicStreamResult",e.onPublicStreamSEIMessageReceived="onPublicStreamSEIMessageReceived",e.onNetworkQuality="onNetworkQuality",e.onSimulcastSubscribeFallback="onSimulcastSubscribeFallback",e.onRemoteVideoSizeChanged="onRemoteVideoSizeChanged",e.onVideoStreamBanned="onVideoStreamBanned",e.onAudioStreamBanned="onAudioStreamBanned",e.onLocalVideoSizeChanged="onLocalVideoSizeChanged",e.onServerParamsSetResult="onServerParamsSetResult",e}(ne||{}),ie="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},oe=function(e){return e&&e.Math==Math&&e},ae=oe("object"==typeof globalThis&&globalThis)||oe("object"==typeof window&&window)||oe("object"==typeof self&&self)||oe("object"==typeof ie&&ie)||function(){return this}()||Function("return this")(),se={exports:{}},ue=ae,ce=Object.defineProperty,de=function(e,t){try{ce(ue,e,{value:t,configurable:!0,writable:!0})}catch(r){ue[e]=t}return t},le=de,he="__core-js_shared__",fe=ae[he]||le(he,{}),pe=fe;(se.exports=function(e,t){return pe[e]||(pe[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.26.1",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE",source:"https://github.com/zloirock/core-js"});var _e,ve,me=function(e){try{return!!e()}catch(t){return!0}},ye=!me((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),ge=ye,Se=Function.prototype,be=Se.call,Ee=ge&&Se.bind.bind(be,be),ke=ge?Ee:function(e){return function(){return be.apply(e,arguments)}},Te=function(e){return null==e},Ie=Te,Ae=TypeError,Re=function(e){if(Ie(e))throw Ae("Can't call method on "+e);return e},we=Re,Ce=Object,Oe=function(e){return Ce(we(e))},xe=Oe,Ne=ke({}.hasOwnProperty),De=Object.hasOwn||function(e,t){return Ne(xe(e),t)},Pe=ke,Me=0,Ue=Math.random(),Le=Pe(1..toString),Ve=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Le(++Me+Ue,36)},Fe="object"==typeof document&&document.all,Be={all:Fe,IS_HTMLDDA:void 0===Fe&&void 0!==Fe},je=Be.all,Ge=Be.IS_HTMLDDA?function(e){return"function"==typeof e||e===je}:function(e){return"function"==typeof e},He=ae,ze=Ge,Ke=function(e){return ze(e)?e:void 0},We=function(e,t){return arguments.length<2?Ke(He[e]):He[e]&&He[e][t]},Xe=We("navigator","userAgent")||"",qe=ae,Ye=Xe,Je=qe.process,Qe=qe.Deno,Ze=Je&&Je.versions||Qe&&Qe.version,$e=Ze&&Ze.v8;$e&&(ve=(_e=$e.split("."))[0]>0&&_e[0]<4?1:+(_e[0]+_e[1])),!ve&&Ye&&(!(_e=Ye.match(/Edge\/(\d+)/))||_e[1]>=74)&&(_e=Ye.match(/Chrome\/(\d+)/))&&(ve=+_e[1]);var et=ve,tt=et,rt=me,nt=!!Object.getOwnPropertySymbols&&!rt((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&tt&&tt<41})),it=nt&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ot=ae,at=se.exports,st=De,ut=Ve,ct=nt,dt=it,lt=at("wks"),ht=ot.Symbol,ft=ht&&ht.for,pt=dt?ht:ht&&ht.withoutSetter||ut,_t=function(e){if(!st(lt,e)||!ct&&"string"!=typeof lt[e]){var t="Symbol."+e;ct&&st(ht,e)?lt[e]=ht[e]:lt[e]=dt&&ft?ft(t):pt(t)}return lt[e]},vt={};vt[_t("toStringTag")]="z";var mt="[object z]"===String(vt),yt={},gt=!me((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),St=Ge,bt=Be.all,Et=Be.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:St(e)||e===bt}:function(e){return"object"==typeof e?null!==e:St(e)},kt=Et,Tt=ae.document,It=kt(Tt)&&kt(Tt.createElement),At=function(e){return It?Tt.createElement(e):{}},Rt=At,wt=!gt&&!me((function(){return 7!=Object.defineProperty(Rt("div"),"a",{get:function(){return 7}}).a})),Ct=gt&&me((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Ot=Et,xt=String,Nt=TypeError,Dt=function(e){if(Ot(e))return e;throw Nt(xt(e)+" is not an object")},Pt=ye,Mt=Function.prototype.call,Ut=Pt?Mt.bind(Mt):function(){return Mt.apply(Mt,arguments)},Lt=ke({}.isPrototypeOf),Vt=We,Ft=Ge,Bt=Lt,jt=Object,Gt=it?function(e){return"symbol"==typeof e}:function(e){var t=Vt("Symbol");return Ft(t)&&Bt(t.prototype,jt(e))},Ht=String,zt=function(e){try{return Ht(e)}catch(t){return"Object"}},Kt=Ge,Wt=zt,Xt=TypeError,qt=function(e){if(Kt(e))return e;throw Xt(Wt(e)+" is not a function")},Yt=qt,Jt=Te,Qt=function(e,t){var r=e[t];return Jt(r)?void 0:Yt(r)},Zt=Ut,$t=Ge,er=Et,tr=TypeError,rr=Ut,nr=Et,ir=Gt,or=Qt,ar=function(e,t){var r,n;if("string"===t&&$t(r=e.toString)&&!er(n=Zt(r,e)))return n;if($t(r=e.valueOf)&&!er(n=Zt(r,e)))return n;if("string"!==t&&$t(r=e.toString)&&!er(n=Zt(r,e)))return n;throw tr("Can't convert object to primitive value")},sr=TypeError,ur=_t("toPrimitive"),cr=function(e,t){if(!nr(e)||ir(e))return e;var r,n=or(e,ur);if(n){if(void 0===t&&(t="default"),r=rr(n,e,t),!nr(r)||ir(r))return r;throw sr("Can't convert object to primitive value")}return void 0===t&&(t="number"),ar(e,t)},dr=cr,lr=Gt,hr=function(e){var t=dr(e,"string");return lr(t)?t:t+""},fr=gt,pr=wt,_r=Ct,vr=Dt,mr=hr,yr=TypeError,gr=Object.defineProperty,Sr=Object.getOwnPropertyDescriptor,br="enumerable",Er="configurable",kr="writable";yt.f=fr?_r?function(e,t,r){if(vr(e),t=mr(t),vr(r),"function"==typeof e&&"prototype"===t&&"value"in r&&kr in r&&!r.writable){var n=Sr(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:Er in r?r.configurable:n.configurable,enumerable:br in r?r.enumerable:n.enumerable,writable:!1})}return gr(e,t,r)}:gr:function(e,t,r){if(vr(e),t=mr(t),vr(r),pr)try{return gr(e,t,r)}catch(n){}if("get"in r||"set"in r)throw yr("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Tr={exports:{}},Ir=gt,Ar=De,Rr=Function.prototype,wr=Ir&&Object.getOwnPropertyDescriptor,Cr=Ar(Rr,"name"),Or={EXISTS:Cr,PROPER:Cr&&"something"===function(){}.name,CONFIGURABLE:Cr&&(!Ir||Ir&&wr(Rr,"name").configurable)},xr=Ge,Nr=fe,Dr=ke(Function.toString);xr(Nr.inspectSource)||(Nr.inspectSource=function(e){return Dr(e)});var Pr,Mr,Ur,Lr=Nr.inspectSource,Vr=Ge,Fr=ae.WeakMap,Br=Vr(Fr)&&/native code/.test(String(Fr)),jr=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Gr=yt,Hr=jr,zr=gt?function(e,t,r){return Gr.f(e,t,Hr(1,r))}:function(e,t,r){return e[t]=r,e},Kr=se.exports,Wr=Ve,Xr=Kr("keys"),qr=function(e){return Xr[e]||(Xr[e]=Wr(e))},Yr={},Jr=Br,Qr=ae,Zr=Et,$r=zr,en=De,tn=fe,rn=qr,nn=Yr,on="Object already initialized",an=Qr.TypeError,sn=Qr.WeakMap;if(Jr||tn.state){var un=tn.state||(tn.state=new sn);un.get=un.get,un.has=un.has,un.set=un.set,Pr=function(e,t){if(un.has(e))throw an(on);return t.facade=e,un.set(e,t),t},Mr=function(e){return un.get(e)||{}},Ur=function(e){return un.has(e)}}else{var cn=rn("state");nn[cn]=!0,Pr=function(e,t){if(en(e,cn))throw an(on);return t.facade=e,$r(e,cn,t),t},Mr=function(e){return en(e,cn)?e[cn]:{}},Ur=function(e){return en(e,cn)}}var dn={set:Pr,get:Mr,has:Ur,enforce:function(e){return Ur(e)?Mr(e):Pr(e,{})},getterFor:function(e){return function(t){var r;if(!Zr(t)||(r=Mr(t)).type!==e)throw an("Incompatible receiver, "+e+" required");return r}}},ln=me,hn=Ge,fn=De,pn=gt,_n=Or.CONFIGURABLE,vn=Lr,mn=dn.enforce,yn=dn.get,gn=Object.defineProperty,Sn=pn&&!ln((function(){return 8!==gn((function(){}),"length",{value:8}).length})),bn=String(String).split("String"),En=Tr.exports=function(e,t,r){"Symbol("===String(t).slice(0,7)&&(t="["+String(t).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),r&&r.getter&&(t="get "+t),r&&r.setter&&(t="set "+t),(!fn(e,"name")||_n&&e.name!==t)&&(pn?gn(e,"name",{value:t,configurable:!0}):e.name=t),Sn&&r&&fn(r,"arity")&&e.length!==r.arity&&gn(e,"length",{value:r.arity});try{r&&fn(r,"constructor")&&r.constructor?pn&&gn(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(i){}var n=mn(e);return fn(n,"source")||(n.source=bn.join("string"==typeof t?t:"")),e};Function.prototype.toString=En((function(){return hn(this)&&yn(this).source||vn(this)}),"toString");var kn=Ge,Tn=yt,In=Tr.exports,An=de,Rn=function(e,t,r,n){n||(n={});var i=n.enumerable,o=void 0!==n.name?n.name:t;if(kn(r)&&In(r,o,n),n.global)i?e[t]=r:An(t,r);else{try{n.unsafe?e[t]&&(i=!0):delete e[t]}catch(a){}i?e[t]=r:Tn.f(e,t,{value:r,enumerable:!1,configurable:!n.nonConfigurable,writable:!n.nonWritable})}return e},wn=ke,Cn=wn({}.toString),On=wn("".slice),xn=function(e){return On(Cn(e),8,-1)},Nn=mt,Dn=Ge,Pn=xn,Mn=_t("toStringTag"),Un=Object,Ln="Arguments"==Pn(function(){return arguments}()),Vn=Nn?Pn: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(r){}}(t=Un(e),Mn))?r:Ln?Pn(t):"Object"==(n=Pn(t))&&Dn(t.callee)?"Arguments":n},Fn=Vn,Bn=mt?{}.toString:function(){return"[object "+Fn(this)+"]"};mt||Rn(Object.prototype,"toString",Bn,{unsafe:!0});var jn={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},Gn=At("span").classList,Hn=Gn&&Gn.constructor&&Gn.constructor.prototype,zn=Hn===Object.prototype?void 0:Hn,Kn=xn,Wn=ke,Xn=function(e){if("Function"===Kn(e))return Wn(e)},qn=qt,Yn=ye,Jn=Xn(Xn.bind),Qn=function(e,t){return qn(e),void 0===t?e:Yn?Jn(e,t):function(){return e.apply(t,arguments)}},Zn=me,$n=xn,ei=Object,ti=ke("".split),ri=Zn((function(){return!ei("z").propertyIsEnumerable(0)}))?function(e){return"String"==$n(e)?ti(e,""):ei(e)}:ei,ni=Math.ceil,ii=Math.floor,oi=Math.trunc||function(e){var t=+e;return(t>0?ii:ni)(t)},ai=function(e){var t=+e;return t!=t||0===t?0:oi(t)},si=ai,ui=Math.min,ci=function(e){return e>0?ui(si(e),9007199254740991):0},di=ci,li=function(e){return di(e.length)},hi=xn,fi=Array.isArray||function(e){return"Array"==hi(e)},pi=ke,_i=me,vi=Ge,mi=Vn,yi=Lr,gi=function(){},Si=[],bi=We("Reflect","construct"),Ei=/^\s*(?:class|function)\b/,ki=pi(Ei.exec),Ti=!Ei.exec(gi),Ii=function(e){if(!vi(e))return!1;try{return bi(gi,Si,e),!0}catch(t){return!1}},Ai=function(e){if(!vi(e))return!1;switch(mi(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ti||!!ki(Ei,yi(e))}catch(t){return!0}};Ai.sham=!0;var Ri=!bi||_i((function(){var e;return Ii(Ii.call)||!Ii(Object)||!Ii((function(){e=!0}))||e}))?Ai:Ii,wi=fi,Ci=Ri,Oi=Et,xi=_t("species"),Ni=Array,Di=function(e){var t;return wi(e)&&(t=e.constructor,(Ci(t)&&(t===Ni||wi(t.prototype))||Oi(t)&&null===(t=t[xi]))&&(t=void 0)),void 0===t?Ni:t},Pi=function(e,t){return new(Di(e))(0===t?0:t)},Mi=Qn,Ui=ri,Li=Oe,Vi=li,Fi=Pi,Bi=ke([].push),ji=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(u,c,d,l){for(var h,f,p=Li(u),_=Ui(p),v=Mi(c,d),m=Vi(_),y=0,g=l||Fi,S=t?g(u,m):r||a?g(u,0):void 0;m>y;y++)if((s||y in _)&&(f=v(h=_[y],y,p),e))if(t)S[y]=f;else if(f)switch(e){case 3:return!0;case 5:return h;case 6:return y;case 2:Bi(S,h)}else switch(e){case 4:return!1;case 7:Bi(S,h)}return o?-1:n||i?i:S}},Gi={forEach:ji(0),map:ji(1),filter:ji(2),some:ji(3),every:ji(4),find:ji(5),findIndex:ji(6),filterReject:ji(7)},Hi=me,zi=function(e,t){var r=[][e];return!!r&&Hi((function(){r.call(null,t||function(){return 1},1)}))},Ki=Gi.forEach,Wi=zi("forEach")?[].forEach:function(e){return Ki(this,e,arguments.length>1?arguments[1]:void 0)},Xi=ae,qi=jn,Yi=zn,Ji=Wi,Qi=zr,Zi=function(e){if(e&&e.forEach!==Ji)try{Qi(e,"forEach",Ji)}catch(t){e.forEach=Ji}};for(var $i in qi)qi[$i]&&Zi(Xi[$i]&&Xi[$i].prototype);Zi(Yi);var eo={},to={},ro={}.propertyIsEnumerable,no=Object.getOwnPropertyDescriptor,io=no&&!ro.call({1:2},1);to.f=io?function(e){var t=no(this,e);return!!t&&t.enumerable}:ro;var oo=ri,ao=Re,so=function(e){return oo(ao(e))},uo=gt,co=Ut,lo=to,ho=jr,fo=so,po=hr,_o=De,vo=wt,mo=Object.getOwnPropertyDescriptor;eo.f=uo?mo:function(e,t){if(e=fo(e),t=po(t),vo)try{return mo(e,t)}catch(r){}if(_o(e,t))return ho(!co(lo.f,e,t),e[t])};var yo={},go=ai,So=Math.max,bo=Math.min,Eo=function(e,t){var r=go(e);return r<0?So(r+t,0):bo(r,t)},ko=so,To=Eo,Io=li,Ao=function(e){return function(t,r,n){var i,o=ko(t),a=Io(o),s=To(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}},Ro={includes:Ao(!0),indexOf:Ao(!1)},wo=De,Co=so,Oo=Ro.indexOf,xo=Yr,No=ke([].push),Do=function(e,t){var r,n=Co(e),i=0,o=[];for(r in n)!wo(xo,r)&&wo(n,r)&&No(o,r);for(;t.length>i;)wo(n,r=t[i++])&&(~Oo(o,r)||No(o,r));return o},Po=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Mo=Do,Uo=Po.concat("length","prototype");yo.f=Object.getOwnPropertyNames||function(e){return Mo(e,Uo)};var Lo={};Lo.f=Object.getOwnPropertySymbols;var Vo=We,Fo=yo,Bo=Lo,jo=Dt,Go=ke([].concat),Ho=Vo("Reflect","ownKeys")||function(e){var t=Fo.f(jo(e)),r=Bo.f;return r?Go(t,r(e)):t},zo=De,Ko=Ho,Wo=eo,Xo=yt,qo=function(e,t,r){for(var n=Ko(t),i=Xo.f,o=Wo.f,a=0;a<n.length;a++){var s=n[a];zo(e,s)||r&&zo(r,s)||i(e,s,o(t,s))}},Yo=me,Jo=Ge,Qo=/#|\.prototype\./,Zo=function(e,t){var r=ea[$o(e)];return r==ra||r!=ta&&(Jo(t)?Yo(t):!!t)},$o=Zo.normalize=function(e){return String(e).replace(Qo,".").toLowerCase()},ea=Zo.data={},ta=Zo.NATIVE="N",ra=Zo.POLYFILL="P",na=Zo,ia=ae,oa=eo.f,aa=zr,sa=Rn,ua=de,ca=qo,da=na,la=function(e,t){var r,n,i,o,a,s=e.target,u=e.global,c=e.stat;if(r=u?ia:c?ia[s]||ua(s,{}):(ia[s]||{}).prototype)for(n in t){if(o=t[n],i=e.dontCallGetSet?(a=oa(r,n))&&a.value:r[n],!da(u?n:s+(c?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;ca(o,i)}(e.sham||i&&i.sham)&&aa(o,"sham",!0),sa(r,n,o,e)}},ha={},fa=Do,pa=Po,_a=Object.keys||function(e){return fa(e,pa)},va=gt,ma=Ct,ya=yt,ga=Dt,Sa=so,ba=_a;ha.f=va&&!ma?Object.defineProperties:function(e,t){ga(e);for(var r,n=Sa(t),i=ba(t),o=i.length,a=0;o>a;)ya.f(e,r=i[a++],n[r]);return e};var Ea,ka=We("document","documentElement"),Ta=Dt,Ia=ha,Aa=Po,Ra=Yr,wa=ka,Ca=At,Oa=qr("IE_PROTO"),xa=function(){},Na=function(e){return"<script>"+e+"</"+"script>"},Da=function(e){e.write(Na("")),e.close();var t=e.parentWindow.Object;return e=null,t},Pa=function(){try{Ea=new ActiveXObject("htmlfile")}catch(n){}var e,t;Pa="undefined"!=typeof document?document.domain&&Ea?Da(Ea):((t=Ca("iframe")).style.display="none",wa.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Na("document.F=Object")),e.close(),e.F):Da(Ea);for(var r=Aa.length;r--;)delete Pa.prototype[Aa[r]];return Pa()};Ra[Oa]=!0;var Ma=Object.create||function(e,t){var r;return null!==e?(xa.prototype=Ta(e),r=new xa,xa.prototype=null,r[Oa]=e):r=Pa(),void 0===t?r:Ia.f(r,t)},Ua=_t,La=Ma,Va=yt.f,Fa=Ua("unscopables"),Ba=Array.prototype;null==Ba[Fa]&&Va(Ba,Fa,{configurable:!0,value:La(null)});var ja=function(e){Ba[Fa][e]=!0},Ga=Ro.includes,Ha=ja;la({target:"Array",proto:!0,forced:me((function(){return!Array(1).includes()}))},{includes:function(e){return Ga(this,e,arguments.length>1?arguments[1]:void 0)}}),Ha("includes");var za=Et,Ka=xn,Wa=_t("match"),Xa=function(e){var t;return za(e)&&(void 0!==(t=e[Wa])?!!t:"RegExp"==Ka(e))},qa=Xa,Ya=TypeError,Ja=function(e){if(qa(e))throw Ya("The method doesn't accept regular expressions");return e},Qa=Vn,Za=String,$a=function(e){if("Symbol"===Qa(e))throw TypeError("Cannot convert a Symbol value to a string");return Za(e)},es=_t("match"),ts=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[es]=!1,"/./"[e](t)}catch(n){}}return!1},rs=la,ns=Ja,is=Re,os=$a,as=ts,ss=ke("".indexOf);rs({target:"String",proto:!0,forced:!as("includes")},{includes:function(e){return!!~ss(os(is(this)),os(ns(e)),arguments.length>1?arguments[1]:void 0)}});var us=Dt,cs=function(){var e=us(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},ds=me,ls=ae.RegExp,hs=ds((function(){var e=ls("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),fs=hs||ds((function(){return!ls("a","y").sticky})),ps=hs||ds((function(){var e=ls("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),_s={BROKEN_CARET:ps,MISSED_STICKY:fs,UNSUPPORTED_Y:hs},vs=me,ms=ae.RegExp,ys=vs((function(){var e=ms(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),gs=me,Ss=ae.RegExp,bs=gs((function(){var e=Ss("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Es=Ut,ks=ke,Ts=$a,Is=cs,As=_s,Rs=se.exports,ws=Ma,Cs=dn.get,Os=ys,xs=bs,Ns=Rs("native-string-replace",String.prototype.replace),Ds=RegExp.prototype.exec,Ps=Ds,Ms=ks("".charAt),Us=ks("".indexOf),Ls=ks("".replace),Vs=ks("".slice),Fs=function(){var e=/a/,t=/b*/g;return Es(Ds,e,"a"),Es(Ds,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Bs=As.BROKEN_CARET,js=void 0!==/()??/.exec("")[1];(Fs||js||Bs||Os||xs)&&(Ps=function(e){var t,r,n,i,o,a,s,u=this,c=Cs(u),d=Ts(e),l=c.raw;if(l)return l.lastIndex=u.lastIndex,t=Es(Ps,l,d),u.lastIndex=l.lastIndex,t;var h=c.groups,f=Bs&&u.sticky,p=Es(Is,u),_=u.source,v=0,m=d;if(f&&(p=Ls(p,"y",""),-1===Us(p,"g")&&(p+="g"),m=Vs(d,u.lastIndex),u.lastIndex>0&&(!u.multiline||u.multiline&&"\n"!==Ms(d,u.lastIndex-1))&&(_="(?: "+_+")",m=" "+m,v++),r=new RegExp("^(?:"+_+")",p)),js&&(r=new RegExp("^"+_+"$(?!\\s)",p)),Fs&&(n=u.lastIndex),i=Es(Ds,f?r:u,m),f?i?(i.input=Vs(i.input,v),i[0]=Vs(i[0],v),i.index=u.lastIndex,u.lastIndex+=i[0].length):u.lastIndex=0:Fs&&i&&(u.lastIndex=u.global?i.index+i[0].length:n),js&&i&&i.length>1&&Es(Ns,i[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&h)for(i.groups=a=ws(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=i[s[1]];return i});var Gs=Ps;la({target:"RegExp",proto:!0,forced:/./.exec!==Gs},{exec:Gs});var Hs=Xn,zs=Rn,Ks=Gs,Ws=me,Xs=_t,qs=zr,Ys=Xs("species"),Js=RegExp.prototype,Qs=function(e,t,r,n){var i=Xs(e),o=!Ws((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!Ws((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[Ys]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!a||r){var s=Hs(/./[i]),u=t(i,""[e],(function(e,t,r,n,i){var a=Hs(e),u=t.exec;return u===Ks||u===Js.exec?o&&!i?{done:!0,value:s(t,r,n)}:{done:!0,value:a(r,t,n)}:{done:!1}}));zs(String.prototype,e,u[0]),zs(Js,i,u[1])}n&&qs(Js[i],"sham",!0)},Zs=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},$s=Ut,eu=Dt,tu=Ge,ru=xn,nu=Gs,iu=TypeError,ou=function(e,t){var r=e.exec;if(tu(r)){var n=$s(r,e,t);return null!==n&&eu(n),n}if("RegExp"===ru(e))return $s(nu,e,t);throw iu("RegExp#exec called on incompatible receiver")},au=Ut,su=Dt,uu=Te,cu=Re,du=Zs,lu=$a,hu=Qt,fu=ou;Qs("search",(function(e,t,r){return[function(t){var r=cu(this),n=uu(t)?void 0:hu(t,e);return n?au(n,t,r):new RegExp(t)[e](lu(r))},function(e){var n=su(this),i=lu(e),o=r(t,n,i);if(o.done)return o.value;var a=n.lastIndex;du(a,0)||(n.lastIndex=0);var s=fu(n,i);return du(n.lastIndex,a)||(n.lastIndex=a),null===s?-1:s.index}]}));var pu=ke,_u=ai,vu=$a,mu=Re,yu=pu("".charAt),gu=pu("".charCodeAt),Su=pu("".slice),bu=function(e){return function(t,r){var n,i,o=vu(mu(t)),a=_u(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=gu(o,a))<55296||n>56319||a+1===s||(i=gu(o,a+1))<56320||i>57343?e?yu(o,a):n:e?Su(o,a,a+2):i-56320+(n-55296<<10)+65536}},Eu={codeAt:bu(!1),charAt:bu(!0)},ku=Eu.charAt,Tu=function(e,t,r){return t+(r?ku(e,t).length:1)},Iu=Ut,Au=Dt,Ru=Te,wu=ci,Cu=$a,Ou=Re,xu=Qt,Nu=Tu,Du=ou;Qs("match",(function(e,t,r){return[function(t){var r=Ou(this),n=Ru(t)?void 0:xu(t,e);return n?Iu(n,t,r):new RegExp(t)[e](Cu(r))},function(e){var n=Au(this),i=Cu(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return Du(n,i);var a=n.unicode;n.lastIndex=0;for(var s,u=[],c=0;null!==(s=Du(n,i));){var d=Cu(s[0]);u[c]=d,""===d&&(n.lastIndex=Nu(i,wu(n.lastIndex),a)),c++}return 0===c?null:u}]}));var Pu="\t\n\v\f\r \u2028\u2029\ufeff",Mu=Re,Uu=$a,Lu=ke("".replace),Vu="[\t\n\v\f\r \u2028\u2029\ufeff]",Fu=RegExp("^"+Vu+Vu+"*"),Bu=RegExp(Vu+Vu+"*$"),ju=function(e){return function(t){var r=Uu(Mu(t));return 1&e&&(r=Lu(r,Fu,"")),2&e&&(r=Lu(r,Bu,"")),r}},Gu={start:ju(1),end:ju(2),trim:ju(3)},Hu=ae,zu=me,Ku=ke,Wu=$a,Xu=Gu.trim,qu=Pu,Yu=Hu.parseInt,Ju=Hu.Symbol,Qu=Ju&&Ju.iterator,Zu=/^[+-]?0x/i,$u=Ku(Zu.exec),ec=8!==Yu(qu+"08")||22!==Yu(qu+"0x16")||Qu&&!zu((function(){Yu(Object(Qu))}))?function(e,t){var r=Xu(Wu(e));return Yu(r,t>>>0||($u(Zu,r)?16:10))}:Yu;la({global:!0,forced:parseInt!=ec},{parseInt:ec});var tc,rc,nc,ic={},oc=!me((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),ac=De,sc=Ge,uc=Oe,cc=oc,dc=qr("IE_PROTO"),lc=Object,hc=lc.prototype,fc=cc?lc.getPrototypeOf:function(e){var t=uc(e);if(ac(t,dc))return t[dc];var r=t.constructor;return sc(r)&&t instanceof r?r.prototype:t instanceof lc?hc:null},pc=me,_c=Ge,vc=Et,mc=fc,yc=Rn,gc=_t("iterator"),Sc=!1;[].keys&&("next"in(nc=[].keys())?(rc=mc(mc(nc)))!==Object.prototype&&(tc=rc):Sc=!0);var bc=!vc(tc)||pc((function(){var e={};return tc[gc].call(e)!==e}));bc&&(tc={}),_c(tc[gc])||yc(tc,gc,(function(){return this}));var Ec={IteratorPrototype:tc,BUGGY_SAFARI_ITERATORS:Sc},kc=yt.f,Tc=De,Ic=_t("toStringTag"),Ac=function(e,t,r){e&&!r&&(e=e.prototype),e&&!Tc(e,Ic)&&kc(e,Ic,{configurable:!0,value:t})},Rc=Ec.IteratorPrototype,wc=Ma,Cc=jr,Oc=Ac,xc=ic,Nc=function(){return this},Dc=function(e,t,r,n){var i=t+" Iterator";return e.prototype=wc(Rc,{next:Cc(+!n,r)}),Oc(e,i,!1),xc[i]=Nc,e},Pc=Ge,Mc=String,Uc=TypeError,Lc=ke,Vc=Dt,Fc=function(e){if("object"==typeof e||Pc(e))return e;throw Uc("Can't set "+Mc(e)+" as a prototype")},Bc=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Lc(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(n){}return function(r,n){return Vc(r),Fc(n),t?e(r,n):r.__proto__=n,r}}():void 0),jc=la,Gc=Ut,Hc=Ge,zc=Dc,Kc=fc,Wc=Bc,Xc=Ac,qc=zr,Yc=Rn,Jc=ic,Qc=Or.PROPER,Zc=Or.CONFIGURABLE,$c=Ec.IteratorPrototype,ed=Ec.BUGGY_SAFARI_ITERATORS,td=_t("iterator"),rd="keys",nd="values",id="entries",od=function(){return this},ad=function(e,t,r,n,i,o,a){zc(r,t,n);var s,u,c,d=function(e){if(e===i&&_)return _;if(!ed&&e in f)return f[e];switch(e){case rd:case nd:case id:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,f=e.prototype,p=f[td]||f["@@iterator"]||i&&f[i],_=!ed&&p||d(i),v="Array"==t&&f.entries||p;if(v&&(s=Kc(v.call(new e)))!==Object.prototype&&s.next&&(Kc(s)!==$c&&(Wc?Wc(s,$c):Hc(s[td])||Yc(s,td,od)),Xc(s,l,!0)),Qc&&i==nd&&p&&p.name!==nd&&(Zc?qc(f,"name",nd):(h=!0,_=function(){return Gc(p,this)})),i)if(u={values:d(nd),keys:o?_:d(rd),entries:d(id)},a)for(c in u)(ed||h||!(c in f))&&Yc(f,c,u[c]);else jc({target:t,proto:!0,forced:ed||h},u);return f[td]!==_&&Yc(f,td,_,{name:i}),Jc[t]=_,u},sd=function(e,t){return{value:e,done:t}},ud=so,cd=ja,dd=ic,ld=dn,hd=yt.f,fd=ad,pd=sd,_d=gt,vd="Array Iterator",md=ld.set,yd=ld.getterFor(vd),gd=fd(Array,"Array",(function(e,t){md(this,{type:vd,target:ud(e),index:0,kind:t})}),(function(){var e=yd(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,pd(void 0,!0)):pd("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),Sd=dd.Arguments=dd.Array;if(cd("keys"),cd("values"),cd("entries"),_d&&"values"!==Sd.name)try{hd(Sd,"name",{value:"values"})}catch(RJ){}var bd={exports:{}},Ed={},kd=hr,Td=yt,Id=jr,Ad=function(e,t,r){var n=kd(t);n in e?Td.f(e,n,Id(0,r)):e[n]=r},Rd=Eo,wd=li,Cd=Ad,Od=Array,xd=Math.max,Nd=function(e,t,r){for(var n=wd(e),i=Rd(t,n),o=Rd(void 0===r?n:r,n),a=Od(xd(o-i,0)),s=0;i<o;i++,s++)Cd(a,s,e[i]);return a.length=s,a},Dd=xn,Pd=so,Md=yo.f,Ud=Nd,Ld="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Ed.f=function(e){return Ld&&"Window"==Dd(e)?function(e){try{return Md(e)}catch(RJ){return Ud(Ld)}}(e):Md(Pd(e))};var Vd=me((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Fd=me,Bd=Et,jd=xn,Gd=Vd,Hd=Object.isExtensible,zd=Fd((function(){Hd(1)}))||Gd?function(e){return!!Bd(e)&&((!Gd||"ArrayBuffer"!=jd(e))&&(!Hd||Hd(e)))}:Hd,Kd=!me((function(){return Object.isExtensible(Object.preventExtensions({}))})),Wd=la,Xd=ke,qd=Yr,Yd=Et,Jd=De,Qd=yt.f,Zd=yo,$d=Ed,el=zd,tl=Kd,rl=!1,nl=Ve("meta"),il=0,ol=function(e){Qd(e,nl,{value:{objectID:"O"+il++,weakData:{}}})},al=bd.exports={enable:function(){al.enable=function(){},rl=!0;var e=Zd.f,t=Xd([].splice),r={};r[nl]=1,e(r).length&&(Zd.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===nl){t(n,i,1);break}return n},Wd({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:$d.f}))},fastKey:function(e,t){if(!Yd(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Jd(e,nl)){if(!el(e))return"F";if(!t)return"E";ol(e)}return e[nl].objectID},getWeakData:function(e,t){if(!Jd(e,nl)){if(!el(e))return!0;if(!t)return!1;ol(e)}return e[nl].weakData},onFreeze:function(e){return tl&&rl&&el(e)&&!Jd(e,nl)&&ol(e),e}};qd[nl]=!0;var sl=ic,ul=_t("iterator"),cl=Array.prototype,dl=function(e){return void 0!==e&&(sl.Array===e||cl[ul]===e)},ll=Vn,hl=Qt,fl=Te,pl=ic,_l=_t("iterator"),vl=function(e){if(!fl(e))return hl(e,_l)||hl(e,"@@iterator")||pl[ll(e)]},ml=Ut,yl=qt,gl=Dt,Sl=zt,bl=vl,El=TypeError,kl=function(e,t){var r=arguments.length<2?bl(e):t;if(yl(r))return gl(ml(r,e));throw El(Sl(e)+" is not iterable")},Tl=Ut,Il=Dt,Al=Qt,Rl=function(e,t,r){var n,i;Il(e);try{if(!(n=Al(e,"return"))){if("throw"===t)throw r;return r}n=Tl(n,e)}catch(RJ){i=!0,n=RJ}if("throw"===t)throw r;if(i)throw n;return Il(n),r},wl=Qn,Cl=Ut,Ol=Dt,xl=zt,Nl=dl,Dl=li,Pl=Lt,Ml=kl,Ul=vl,Ll=Rl,Vl=TypeError,Fl=function(e,t){this.stopped=e,this.result=t},Bl=Fl.prototype,jl=function(e,t,r){var n,i,o,a,s,u,c,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),f=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),_=wl(t,d),v=function(e){return n&&Ll(n,"normal",e),new Fl(!0,e)},m=function(e){return l?(Ol(e),p?_(e[0],e[1],v):_(e[0],e[1])):p?_(e,v):_(e)};if(h)n=e.iterator;else if(f)n=e;else{if(!(i=Ul(e)))throw Vl(xl(e)+" is not iterable");if(Nl(i)){for(o=0,a=Dl(e);a>o;o++)if((s=m(e[o]))&&Pl(Bl,s))return s;return new Fl(!1)}n=Ml(e,i)}for(u=h?e.next:n.next;!(c=Cl(u,n)).done;){try{s=m(c.value)}catch(RJ){Ll(n,"throw",RJ)}if("object"==typeof s&&s&&Pl(Bl,s))return s}return new Fl(!1)},Gl=Lt,Hl=TypeError,zl=function(e,t){if(Gl(t,e))return e;throw Hl("Incorrect invocation")},Kl=_t("iterator"),Wl=!1;try{var Xl=0,ql={next:function(){return{done:!!Xl++}},return:function(){Wl=!0}};ql[Kl]=function(){return this},Array.from(ql,(function(){throw 2}))}catch(RJ){}var Yl=function(e,t){if(!t&&!Wl)return!1;var r=!1;try{var n={};n[Kl]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(RJ){}return r},Jl=Ge,Ql=Et,Zl=Bc,$l=function(e,t,r){var n,i;return Zl&&Jl(n=t.constructor)&&n!==r&&Ql(i=n.prototype)&&i!==r.prototype&&Zl(e,i),e},eh=la,th=ae,rh=ke,nh=na,ih=Rn,oh=bd.exports,ah=jl,sh=zl,uh=Ge,ch=Te,dh=Et,lh=me,hh=Yl,fh=Ac,ph=$l,_h=function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",a=th[e],s=a&&a.prototype,u=a,c={},d=function(e){var t=rh(s[e]);ih(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!dh(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!dh(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!dh(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(nh(e,!uh(a)||!(i||s.forEach&&!lh((function(){(new a).entries().next()})))))u=r.getConstructor(t,e,n,o),oh.enable();else if(nh(e,!0)){var l=new u,h=l[o](i?{}:-0,1)!=l,f=lh((function(){l.has(1)})),p=hh((function(e){new a(e)})),_=!i&&lh((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));p||((u=t((function(e,t){sh(e,s);var r=ph(new a,e,u);return ch(t)||ah(t,r[o],{that:r,AS_ENTRIES:n}),r}))).prototype=s,s.constructor=u),(f||_)&&(d("delete"),d("has"),n&&d("get")),(_||h)&&d(o),i&&s.clear&&delete s.clear}return c[e]=u,eh({global:!0,constructor:!0,forced:u!=a},c),fh(u,e),i||r.setStrong(u,e,n),u},vh=Rn,mh=function(e,t,r){for(var n in t)vh(e,n,t[n],r);return e},yh=We,gh=yt,Sh=gt,bh=_t("species"),Eh=function(e){var t=yh(e),r=gh.f;Sh&&t&&!t[bh]&&r(t,bh,{configurable:!0,get:function(){return this}})},kh=yt.f,Th=Ma,Ih=mh,Ah=Qn,Rh=zl,wh=Te,Ch=jl,Oh=ad,xh=sd,Nh=Eh,Dh=gt,Ph=bd.exports.fastKey,Mh=dn.set,Uh=dn.getterFor,Lh={getConstructor:function(e,t,r,n){var i=e((function(e,i){Rh(e,o),Mh(e,{type:t,index:Th(null),first:void 0,last:void 0,size:0}),Dh||(e.size=0),wh(i)||Ch(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=Uh(t),s=function(e,t,r){var n,i,o=a(e),s=u(e,t);return s?s.value=r:(o.last=s={index:i=Ph(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),Dh?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},u=function(e,t){var r,n=a(e),i=Ph(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return Ih(o,{clear:function(){for(var e=a(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,Dh?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),n=u(t,e);if(n){var i=n.next,o=n.previous;delete r.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),r.first==n&&(r.first=i),r.last==n&&(r.last=o),Dh?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=Ah(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!u(this,e)}}),Ih(o,r?{get:function(e){var t=u(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),Dh&&kh(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=Uh(t),o=Uh(n);Oh(e,t,(function(e,t){Mh(this,{type:n,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?xh("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,xh(void 0,!0))}),r?"entries":"values",!r,!0),Nh(t)}};_h("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Lh);var Vh=Eu.charAt,Fh=$a,Bh=dn,jh=ad,Gh=sd,Hh="String Iterator",zh=Bh.set,Kh=Bh.getterFor(Hh);jh(String,"String",(function(e){zh(this,{type:Hh,string:Fh(e),index:0})}),(function(){var e,t=Kh(this),r=t.string,n=t.index;return n>=r.length?Gh(void 0,!0):(e=Vh(r,n),t.index+=e.length,Gh(e,!1))}));var Wh=ae,Xh=jn,qh=zn,Yh=gd,Jh=zr,Qh=_t,Zh=Qh("iterator"),$h=Qh("toStringTag"),ef=Yh.values,tf=function(e,t){if(e){if(e[Zh]!==ef)try{Jh(e,Zh,ef)}catch(RJ){e[Zh]=ef}if(e[$h]||Jh(e,$h,t),Xh[t])for(var r in Yh)if(e[r]!==Yh[r])try{Jh(e,r,Yh[r])}catch(RJ){e[r]=Yh[r]}}};for(var rf in Xh)tf(Wh[rf]&&Wh[rf].prototype,rf);tf(qh,"DOMTokenList");var nf=Oe,of=_a;la({target:"Object",stat:!0,forced:me((function(){of(1)}))},{keys:function(e){return of(nf(e))}});var af=la,sf=gt,uf=yt.f;af({target:"Object",stat:!0,forced:Object.defineProperty!==uf,sham:!sf},{defineProperty:uf});var cf=ye,df=Function.prototype,lf=df.apply,hf=df.call,ff="object"==typeof Reflect&&Reflect.apply||(cf?hf.bind(lf):function(){return hf.apply(lf,arguments)}),pf=yt.f,_f=function(e,t,r){r in e||pf(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})},vf=$a,mf=function(e,t){return void 0===e?arguments.length<2?"":t:vf(e)},yf=Et,gf=zr,Sf=Error,bf=ke("".replace),Ef=String(Sf("zxcasd").stack),kf=/\n\s*at [^:]*:[^\n]*/,Tf=kf.test(Ef),If=function(e,t){if(Tf&&"string"==typeof e&&!Sf.prepareStackTrace)for(;t--;)e=bf(e,kf,"");return e},Af=jr,Rf=!me((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Af(1,7)),7!==e.stack)})),wf=We,Cf=De,Of=zr,xf=Lt,Nf=Bc,Df=qo,Pf=_f,Mf=$l,Uf=mf,Lf=function(e,t){yf(t)&&"cause"in t&&gf(e,"cause",t.cause)},Vf=If,Ff=Rf,Bf=gt,jf=la,Gf=ff,Hf=function(e,t,r,n){var i="stackTraceLimit",o=n?2:1,a=e.split("."),s=a[a.length-1],u=wf.apply(null,a);if(u){var c=u.prototype;if(Cf(c,"cause")&&delete c.cause,!r)return u;var d=wf("Error"),l=t((function(e,t){var r=Uf(n?t:e,void 0),i=n?new u(e):new u;return void 0!==r&&Of(i,"message",r),Ff&&Of(i,"stack",Vf(i.stack,2)),this&&xf(c,this)&&Mf(i,this,l),arguments.length>o&&Lf(i,arguments[o]),i}));l.prototype=c,"Error"!==s?Nf?Nf(l,d):Df(l,d,{name:!0}):Bf&&i in u&&(Pf(l,u,i),Pf(l,u,"prepareStackTrace")),Df(l,u);try{c.name!==s&&Of(c,"name",s),c.constructor=l}catch(RJ){}return l}},zf="WebAssembly",Kf=ae.WebAssembly,Wf=7!==Error("e",{cause:7}).cause,Xf=function(e,t){var r={};r[e]=Hf(e,t,Wf),jf({global:!0,constructor:!0,arity:1,forced:Wf},r)},qf=function(e,t){if(Kf&&Kf[e]){var r={};r[e]=Hf("WebAssembly."+e,t,Wf),jf({target:zf,stat:!0,constructor:!0,arity:1,forced:Wf},r)}};Xf("Error",(function(e){return function(t){return Gf(e,this,arguments)}})),Xf("EvalError",(function(e){return function(t){return Gf(e,this,arguments)}})),Xf("RangeError",(function(e){return function(t){return Gf(e,this,arguments)}})),Xf("ReferenceError",(function(e){return function(t){return Gf(e,this,arguments)}})),Xf("SyntaxError",(function(e){return function(t){return Gf(e,this,arguments)}})),Xf("TypeError",(function(e){return function(t){return Gf(e,this,arguments)}})),Xf("URIError",(function(e){return function(t){return Gf(e,this,arguments)}})),qf("CompileError",(function(e){return function(t){return Gf(e,this,arguments)}})),qf("LinkError",(function(e){return function(t){return Gf(e,this,arguments)}})),qf("RuntimeError",(function(e){return function(t){return Gf(e,this,arguments)}}));var Yf=qt,Jf=Oe,Qf=ri,Zf=li,$f=TypeError,ep=function(e){return function(t,r,n,i){Yf(r);var o=Jf(t),a=Qf(o),s=Zf(o),u=e?s-1:0,c=e?-1:1;if(n<2)for(;;){if(u in a){i=a[u],u+=c;break}if(u+=c,e?u<0:s<=u)throw $f("Reduce of empty array with no initial value")}for(;e?u>=0:s>u;u+=c)u in a&&(i=r(i,a[u],u,o));return i}},tp={left:ep(!1),right:ep(!0)},rp="process"==xn(ae.process),np=tp.left,ip=et,op=rp;la({target:"Array",proto:!0,forced:!zi("reduce")||!op&&ip>79&&ip<83},{reduce:function(e){var t=arguments.length;return np(this,e,t,t>1?arguments[1]:void 0)}});var ap=gt,sp=ke,up=Ut,cp=me,dp=_a,lp=Lo,hp=to,fp=Oe,pp=ri,_p=Object.assign,vp=Object.defineProperty,mp=sp([].concat),yp=!_p||cp((function(){if(ap&&1!==_p({b:1},_p(vp({},"a",{enumerable:!0,get:function(){vp(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!=_p({},e)[r]||dp(_p({},t)).join("")!=n}))?function(e,t){for(var r=fp(e),n=arguments.length,i=1,o=lp.f,a=hp.f;n>i;)for(var s,u=pp(arguments[i++]),c=o?mp(dp(u),o(u)):dp(u),d=c.length,l=0;d>l;)s=c[l++],ap&&!up(a,u,s)||(r[s]=u[s]);return r}:_p,gp=yp;la({target:"Object",stat:!0,arity:2,forced:Object.assign!==gp},{assign:gp});var Sp=la,bp=Xn,Ep=eo.f,kp=ci,Tp=$a,Ip=Ja,Ap=Re,Rp=ts,wp=bp("".endsWith),Cp=bp("".slice),Op=Math.min,xp=Rp("endsWith"),Np=!xp&&!!function(){var e=Ep(String.prototype,"endsWith");return e&&!e.writable}();Sp({target:"String",proto:!0,forced:!Np&&!xp},{endsWith:function(e){var t=Tp(Ap(this));Ip(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:Op(kp(r),n),o=Tp(e);return wp?wp(t,o,i):Cp(t,i-o.length,i)===o}});var Dp=gt,Pp=fi,Mp=TypeError,Up=Object.getOwnPropertyDescriptor,Lp=Dp&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(RJ){return RJ instanceof TypeError}}()?function(e,t){if(Pp(e)&&!Up(e,"length").writable)throw Mp("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},Vp=TypeError,Fp=function(e){if(e>9007199254740991)throw Vp("Maximum allowed index exceeded");return e},Bp=la,jp=Oe,Gp=li,Hp=Lp,zp=Fp,Kp=me((function(){return 4294967297!==[].push.call({length:4294967296},1)})),Wp=!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(RJ){return RJ instanceof TypeError}}();Bp({target:"Array",proto:!0,arity:1,forced:Kp||Wp},{push:function(e){var t=jp(this),r=Gp(t),n=arguments.length;zp(r+n);for(var i=0;i<n;i++)t[r]=arguments[i],r++;return Hp(t,r),r}});var Xp=!0,qp=!0;function Yp(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function Jp(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 Qp(e){return"boolean"!=typeof e?new Error("Argument type: "+a(e)+". Please use a boolean."):(Xp=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function Zp(e){return"boolean"!=typeof e?new Error("Argument type: "+a(e)+". Please use a boolean."):(qp=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function $p(){if("object"===("undefined"==typeof window?"undefined":a(window))){if(Xp)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function e_(e,t){qp&&console.warn(e+" is deprecated, please use "+t+" instead.")}function t_(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=Yp(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=Yp(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=Yp(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function r_(e){return"[object Object]"===Object.prototype.toString.call(e)}function n_(e){return r_(e)?Object.keys(e).reduce((function(t,r){var n=r_(e[r]),i=n?n_(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,h({},r,i))}),{}):e}function i_(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((function(n){n.endsWith("Id")?i_(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((function(t){i_(e,e.get(t),r)}))})))}function o_(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&&i_(e,r,i)}))})),i}var a_=la,s_=Gi.find,u_=ja,c_="find",d_=!0;c_ in[]&&Array(1).find((function(){d_=!1})),a_({target:"Array",proto:!0,forced:d_},{find:function(e){return s_(this,e,arguments.length>1?arguments[1]:void 0)}}),u_(c_);var l_=me,h_=et,f_=_t("species"),p_=function(e){return h_>=51||!l_((function(){var t=[];return(t.constructor={})[f_]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},__=ke([].slice),v_=la,m_=fi,y_=Ri,g_=Et,S_=Eo,b_=li,E_=so,k_=Ad,T_=_t,I_=__,A_=p_("slice"),R_=T_("species"),w_=Array,C_=Math.max;v_({target:"Array",proto:!0,forced:!A_},{slice:function(e,t){var r,n,i,o=E_(this),a=b_(o),s=S_(e,a),u=S_(void 0===t?a:t,a);if(m_(o)&&(r=o.constructor,(y_(r)&&(r===w_||m_(r.prototype))||g_(r)&&null===(r=r[R_]))&&(r=void 0),r===w_||void 0===r))return I_(o,s,u);for(n=new(void 0===r?w_:r)(C_(u-s,0)),i=0;s<u;s++,i++)s in o&&k_(n,i,o[s]);return n.length=i,n}});var O_=la,x_=Ro.indexOf,N_=zi,D_=Xn([].indexOf),P_=!!D_&&1/D_([1],1,-0)<0,M_=N_("indexOf");O_({target:"Array",proto:!0,forced:P_||!M_},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return P_?D_(this,e,t)||0:x_(this,e,t)}});var U_=zt,L_=TypeError,V_=function(e,t){if(!delete e[t])throw L_("Cannot delete property "+U_(t)+" of "+U_(e))},F_=la,B_=Oe,j_=Eo,G_=ai,H_=li,z_=Lp,K_=Fp,W_=Pi,X_=Ad,q_=V_,Y_=p_("splice"),J_=Math.max,Q_=Math.min;F_({target:"Array",proto:!0,forced:!Y_},{splice:function(e,t){var r,n,i,o,a,s,u=B_(this),c=H_(u),d=j_(e,c),l=arguments.length;for(0===l?r=n=0:1===l?(r=0,n=c-d):(r=l-2,n=Q_(J_(G_(t),0),c-d)),K_(c+r-n),i=W_(u,n),o=0;o<n;o++)(a=d+o)in u&&X_(i,o,u[a]);if(i.length=n,r<n){for(o=d;o<c-n;o++)s=o+r,(a=o+n)in u?u[s]=u[a]:q_(u,s);for(o=c;o>c-n+r;o--)q_(u,o-1)}else if(r>n)for(o=c-n;o>d;o--)s=o+r-1,(a=o+n-1)in u?u[s]=u[a]:q_(u,s);for(o=0;o<r;o++)u[o+d]=arguments[o+2];return z_(u,c-n+r),i}});var Z_=Gi.map;la({target:"Array",proto:!0,forced:!p_("map")},{map:function(e){return Z_(this,e,arguments.length>1?arguments[1]:void 0)}});var $_,ev,tv,rv,nv=Ri,iv=zt,ov=TypeError,av=function(e){if(nv(e))return e;throw ov(iv(e)+" is not a constructor")},sv=Dt,uv=av,cv=Te,dv=_t("species"),lv=function(e,t){var r,n=sv(e).constructor;return void 0===n||cv(r=sv(n)[dv])?t:uv(r)},hv=TypeError,fv=function(e,t){if(e<t)throw hv("Not enough arguments");return e},pv=/(?:ipad|iphone|ipod).*applewebkit/i.test(Xe),_v=ae,vv=ff,mv=Qn,yv=Ge,gv=De,Sv=me,bv=ka,Ev=__,kv=At,Tv=fv,Iv=pv,Av=rp,Rv=_v.setImmediate,wv=_v.clearImmediate,Cv=_v.process,Ov=_v.Dispatch,xv=_v.Function,Nv=_v.MessageChannel,Dv=_v.String,Pv=0,Mv={},Uv="onreadystatechange";try{$_=_v.location}catch(RJ){}var Lv=function(e){if(gv(Mv,e)){var t=Mv[e];delete Mv[e],t()}},Vv=function(e){return function(){Lv(e)}},Fv=function(e){Lv(e.data)},Bv=function(e){_v.postMessage(Dv(e),$_.protocol+"//"+$_.host)};Rv&&wv||(Rv=function(e){Tv(arguments.length,1);var t=yv(e)?e:xv(e),r=Ev(arguments,1);return Mv[++Pv]=function(){vv(t,void 0,r)},ev(Pv),Pv},wv=function(e){delete Mv[e]},Av?ev=function(e){Cv.nextTick(Vv(e))}:Ov&&Ov.now?ev=function(e){Ov.now(Vv(e))}:Nv&&!Iv?(rv=(tv=new Nv).port2,tv.port1.onmessage=Fv,ev=mv(rv.postMessage,rv)):_v.addEventListener&&yv(_v.postMessage)&&!_v.importScripts&&$_&&"file:"!==$_.protocol&&!Sv(Bv)?(ev=Bv,_v.addEventListener("message",Fv,!1)):ev=Uv in kv("script")?function(e){bv.appendChild(kv("script")).onreadystatechange=function(){bv.removeChild(this),Lv(e)}}:function(e){setTimeout(Vv(e),0)});var jv,Gv,Hv,zv,Kv,Wv,Xv,qv,Yv={set:Rv,clear:wv},Jv=ae,Qv=/ipad|iphone|ipod/i.test(Xe)&&void 0!==Jv.Pebble,Zv=/web0s(?!.*chrome)/i.test(Xe),$v=ae,em=Qn,tm=eo.f,rm=Yv.set,nm=pv,im=Qv,om=Zv,am=rp,sm=$v.MutationObserver||$v.WebKitMutationObserver,um=$v.document,cm=$v.process,dm=$v.Promise,lm=tm($v,"queueMicrotask"),hm=lm&&lm.value;hm||(jv=function(){var e,t;for(am&&(e=cm.domain)&&e.exit();Gv;){t=Gv.fn,Gv=Gv.next;try{t()}catch(RJ){throw Gv?zv():Hv=void 0,RJ}}Hv=void 0,e&&e.enter()},nm||am||om||!sm||!um?!im&&dm&&dm.resolve?((Xv=dm.resolve(void 0)).constructor=dm,qv=em(Xv.then,Xv),zv=function(){qv(jv)}):am?zv=function(){cm.nextTick(jv)}:(rm=em(rm,$v),zv=function(){rm(jv)}):(Kv=!0,Wv=um.createTextNode(""),new sm(jv).observe(Wv,{characterData:!0}),zv=function(){Wv.data=Kv=!Kv}));var fm=hm||function(e){var t={fn:e,next:void 0};Hv&&(Hv.next=t),Gv||(Gv=t,zv()),Hv=t},pm=ae,_m=function(e){try{return{error:!1,value:e()}}catch(RJ){return{error:!0,value:RJ}}},vm=function(){this.head=null,this.tail=null};vm.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 mm=vm,ym=ae.Promise,gm="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Sm=!gm&&!rp&&"object"==typeof window&&"object"==typeof document,bm=ae,Em=ym,km=Ge,Tm=na,Im=Lr,Am=_t,Rm=Sm,wm=gm,Cm=et;Em&&Em.prototype;var Om=Am("species"),xm=!1,Nm=km(bm.PromiseRejectionEvent),Dm=Tm("Promise",(function(){var e=Im(Em),t=e!==String(Em);if(!t&&66===Cm)return!0;if(!Cm||Cm<51||!/native code/.test(e)){var r=new Em((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[Om]=n,!(xm=r.then((function(){}))instanceof n))return!0}return!t&&(Rm||wm)&&!Nm})),Pm={CONSTRUCTOR:Dm,REJECTION_EVENT:Nm,SUBCLASSING:xm},Mm={},Um=qt,Lm=TypeError,Vm=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw Lm("Bad Promise constructor");t=e,r=n})),this.resolve=Um(t),this.reject=Um(r)};Mm.f=function(e){return new Vm(e)};var Fm,Bm,jm,Gm=la,Hm=rp,zm=ae,Km=Ut,Wm=Rn,Xm=Bc,qm=Ac,Ym=Eh,Jm=qt,Qm=Ge,Zm=Et,$m=zl,ey=lv,ty=Yv.set,ry=fm,ny=function(e,t){var r=pm.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},iy=_m,oy=mm,ay=dn,sy=ym,uy=Mm,cy="Promise",dy=Pm.CONSTRUCTOR,ly=Pm.REJECTION_EVENT,hy=Pm.SUBCLASSING,fy=ay.getterFor(cy),py=ay.set,_y=sy&&sy.prototype,vy=sy,my=_y,yy=zm.TypeError,gy=zm.document,Sy=zm.process,by=uy.f,Ey=by,ky=!!(gy&&gy.createEvent&&zm.dispatchEvent),Ty="unhandledrejection",Iy=function(e){var t;return!(!Zm(e)||!Qm(t=e.then))&&t},Ay=function(e,t){var r,n,i,o=t.value,a=1==t.state,s=a?e.ok:e.fail,u=e.resolve,c=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&xy(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?c(yy("Promise-chain cycle")):(n=Iy(r))?Km(n,r,u,c):u(r)):c(o)}catch(RJ){d&&!i&&d.exit(),c(RJ)}},Ry=function(e,t){e.notified||(e.notified=!0,ry((function(){for(var r,n=e.reactions;r=n.get();)Ay(r,e);e.notified=!1,t&&!e.rejection&&Cy(e)})))},wy=function(e,t,r){var n,i;ky?((n=gy.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),zm.dispatchEvent(n)):n={promise:t,reason:r},!ly&&(i=zm["on"+e])?i(n):e===Ty&&ny("Unhandled promise rejection",r)},Cy=function(e){Km(ty,zm,(function(){var t,r=e.facade,n=e.value;if(Oy(e)&&(t=iy((function(){Hm?Sy.emit("unhandledRejection",n,r):wy(Ty,r,n)})),e.rejection=Hm||Oy(e)?2:1,t.error))throw t.value}))},Oy=function(e){return 1!==e.rejection&&!e.parent},xy=function(e){Km(ty,zm,(function(){var t=e.facade;Hm?Sy.emit("rejectionHandled",t):wy("rejectionhandled",t,e.value)}))},Ny=function(e,t,r){return function(n){e(t,n,r)}},Dy=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Ry(e,!0))},Py=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw yy("Promise can't be resolved itself");var n=Iy(t);n?ry((function(){var r={done:!1};try{Km(n,t,Ny(Py,r,e),Ny(Dy,r,e))}catch(RJ){Dy(r,RJ,e)}})):(e.value=t,e.state=1,Ry(e,!1))}catch(RJ){Dy({done:!1},RJ,e)}}};if(dy&&(my=(vy=function(e){$m(this,my),Jm(e),Km(Fm,this);var t=fy(this);try{e(Ny(Py,t),Ny(Dy,t))}catch(RJ){Dy(t,RJ)}}).prototype,(Fm=function(e){py(this,{type:cy,done:!1,notified:!1,parent:!1,reactions:new oy,rejection:!1,state:0,value:void 0})}).prototype=Wm(my,"then",(function(e,t){var r=fy(this),n=by(ey(this,vy));return r.parent=!0,n.ok=!Qm(e)||e,n.fail=Qm(t)&&t,n.domain=Hm?Sy.domain:void 0,0==r.state?r.reactions.add(n):ry((function(){Ay(n,r)})),n.promise})),Bm=function(){var e=new Fm,t=fy(e);this.promise=e,this.resolve=Ny(Py,t),this.reject=Ny(Dy,t)},uy.f=by=function(e){return e===vy||undefined===e?new Bm(e):Ey(e)},Qm(sy)&&_y!==Object.prototype)){jm=_y.then,hy||Wm(_y,"then",(function(e,t){var r=this;return new vy((function(e,t){Km(jm,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete _y.constructor}catch(RJ){}Xm&&Xm(_y,my)}Gm({global:!0,constructor:!0,wrap:!0,forced:dy},{Promise:vy}),qm(vy,cy,!1),Ym(cy);var My=ym,Uy=Pm.CONSTRUCTOR||!Yl((function(e){My.all(e).then(void 0,(function(){}))})),Ly=Ut,Vy=qt,Fy=Mm,By=_m,jy=jl;la({target:"Promise",stat:!0,forced:Uy},{all:function(e){var t=this,r=Fy.f(t),n=r.resolve,i=r.reject,o=By((function(){var r=Vy(t.resolve),o=[],a=0,s=1;jy(e,(function(e){var u=a++,c=!1;s++,Ly(r,t,e).then((function(e){c||(c=!0,o[u]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise}});var Gy=la,Hy=Pm.CONSTRUCTOR,zy=ym,Ky=We,Wy=Ge,Xy=Rn,qy=zy&&zy.prototype;if(Gy({target:"Promise",proto:!0,forced:Hy,real:!0},{catch:function(e){return this.then(void 0,e)}}),Wy(zy)){var Yy=Ky("Promise").prototype.catch;qy.catch!==Yy&&Xy(qy,"catch",Yy,{unsafe:!0})}var Jy=Ut,Qy=qt,Zy=Mm,$y=_m,eg=jl;la({target:"Promise",stat:!0,forced:Uy},{race:function(e){var t=this,r=Zy.f(t),n=r.reject,i=$y((function(){var i=Qy(t.resolve);eg(e,(function(e){Jy(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var tg=Ut,rg=Mm;la({target:"Promise",stat:!0,forced:Pm.CONSTRUCTOR},{reject:function(e){var t=rg.f(this);return tg(t.reject,void 0,e),t.promise}});var ng=Dt,ig=Et,og=Mm,ag=function(e,t){if(ng(e),ig(t)&&t.constructor===e)return t;var r=og.f(e);return(0,r.resolve)(t),r.promise},sg=la,ug=Pm.CONSTRUCTOR,cg=ag;We("Promise"),sg({target:"Promise",stat:!0,forced:ug},{resolve:function(e){return cg(this,e)}});var dg=rp,lg=Tr.exports,hg=yt,fg=function(e,t,r){return r.get&&lg(r.get,t,{getter:!0}),r.set&&lg(r.set,t,{setter:!0}),hg.f(e,t,r)},pg=gt,_g=me,vg=Dt,mg=Ma,yg=mf,gg=Error.prototype.toString,Sg=_g((function(){if(pg){var e=mg(Object.defineProperty({},"name",{get:function(){return this===e}}));if("true"!==gg.call(e))return!0}return"2: 1"!==gg.call({message:1,name:2})||"Error"!==gg.call({})}))?function(){var e=vg(this),t=yg(e.name,"Error"),r=yg(e.message);return t?r?t+": "+r:t:r}:gg,bg={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}},Eg=la,kg=function(e){try{if(dg)return Function('return require("'+e+'")')()}catch(RJ){}},Tg=We,Ig=me,Ag=Ma,Rg=jr,wg=yt.f,Cg=Rn,Og=fg,xg=De,Ng=zl,Dg=Dt,Pg=Sg,Mg=mf,Ug=bg,Lg=If,Vg=dn,Fg=gt,Bg="DOMException",jg="DATA_CLONE_ERR",Gg=Tg("Error"),Hg=Tg(Bg)||function(){try{(new(Tg("MessageChannel")||kg("worker_threads").MessageChannel)).port1.postMessage(new WeakMap)}catch(RJ){if(RJ.name==jg&&25==RJ.code)return RJ.constructor}}(),zg=Hg&&Hg.prototype,Kg=Gg.prototype,Wg=Vg.set,Xg=Vg.getterFor(Bg),qg="stack"in Gg(Bg),Yg=function(e){return xg(Ug,e)&&Ug[e].m?Ug[e].c:0},Jg=function(){Ng(this,Qg);var e=arguments.length,t=Mg(e<1?void 0:arguments[0]),r=Mg(e<2?void 0:arguments[1],"Error"),n=Yg(r);if(Wg(this,{type:Bg,name:r,message:t,code:n}),Fg||(this.name=r,this.message=t,this.code=n),qg){var i=Gg(t);i.name=Bg,wg(this,"stack",Rg(1,Lg(i.stack,1)))}},Qg=Jg.prototype=Ag(Kg),Zg=function(e){return{enumerable:!0,configurable:!0,get:e}},$g=function(e){return Zg((function(){return Xg(this)[e]}))};Fg&&(Og(Qg,"code",$g("code")),Og(Qg,"message",$g("message")),Og(Qg,"name",$g("name"))),wg(Qg,"constructor",Rg(1,Jg));var eS=Ig((function(){return!(new Hg instanceof Gg)})),tS=eS||Ig((function(){return Kg.toString!==Pg||"2: 1"!==String(new Hg(1,2))})),rS=eS||Ig((function(){return 25!==new Hg(1,"DataCloneError").code}));eS||25!==Hg.DATA_CLONE_ERR||zg.DATA_CLONE_ERR;Eg({global:!0,constructor:!0,forced:eS},{DOMException:eS?Jg:Hg});var nS=Tg(Bg),iS=nS.prototype;for(var oS in tS&&Hg===nS&&Cg(iS,"toString",Pg),rS&&Fg&&Hg===nS&&Og(iS,"code",Zg((function(){return Yg(Dg(this).name)}))),Ug)if(xg(Ug,oS)){var aS=Ug[oS],sS=aS.s,uS=Rg(6,aS.c);xg(nS,sS)||wg(nS,sS,uS),xg(iS,sS)||wg(iS,sS,uS)}var cS=la,dS=ae,lS=We,hS=jr,fS=yt.f,pS=De,_S=zl,vS=$l,mS=mf,yS=bg,gS=If,SS=gt,bS="DOMException",ES=lS("Error"),kS=lS(bS),TS=function(){_S(this,IS);var e=arguments.length,t=mS(e<1?void 0:arguments[0]),r=mS(e<2?void 0:arguments[1],"Error"),n=new kS(t,r),i=ES(t);return i.name=bS,fS(n,"stack",hS(1,gS(i.stack,1))),vS(n,this,TS),n},IS=TS.prototype=kS.prototype,AS="stack"in ES(bS),RS="stack"in new kS(1,2),wS=kS&&SS&&Object.getOwnPropertyDescriptor(dS,bS),CS=!(!wS||wS.writable&&wS.configurable),OS=AS&&!CS&&!RS;cS({global:!0,constructor:!0,forced:OS},{DOMException:OS?TS:kS});var xS=lS(bS),NS=xS.prototype;if(NS.constructor!==xS)for(var DS in fS(NS,"constructor",hS(1,xS)),yS)if(pS(yS,DS)){var PS=yS[DS],MS=PS.s;pS(xS,MS)||fS(xS,MS,hS(6,PS.c))}var US="DOMException";Ac(We(US),US);var LS=Gi.filter;la({target:"Array",proto:!0,forced:!p_("filter")},{filter:function(e){return LS(this,e,arguments.length>1?arguments[1]:void 0)}});var VS=la,FS=me,BS=fi,jS=Et,GS=Oe,HS=li,zS=Fp,KS=Ad,WS=Pi,XS=p_,qS=et,YS=_t("isConcatSpreadable"),JS=qS>=51||!FS((function(){var e=[];return e[YS]=!1,e.concat()[0]!==e})),QS=XS("concat"),ZS=function(e){if(!jS(e))return!1;var t=e[YS];return void 0!==t?!!t:BS(e)};VS({target:"Array",proto:!0,arity:1,forced:!JS||!QS},{concat:function(e){var t,r,n,i,o,a=GS(this),s=WS(a,0),u=0;for(t=-1,n=arguments.length;t<n;t++)if(ZS(o=-1===t?a:arguments[t]))for(i=HS(o),zS(u+i),r=0;r<i;r++,u++)r in o&&KS(s,u,o[r]);else zS(u+1),KS(s,u++,o);return s.length=u,s}});var $S=ke,eb=Oe,tb=Math.floor,rb=$S("".charAt),nb=$S("".replace),ib=$S("".slice),ob=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,ab=/\$([$&'`]|\d{1,2})/g,sb=ff,ub=Ut,cb=ke,db=Qs,lb=me,hb=Dt,fb=Ge,pb=Te,_b=ai,vb=ci,mb=$a,yb=Re,gb=Tu,Sb=Qt,bb=function(e,t,r,n,i,o){var a=r+e.length,s=n.length,u=ab;return void 0!==i&&(i=eb(i),u=ob),nb(o,u,(function(o,u){var c;switch(rb(u,0)){case"$":return"$";case"&":return e;case"`":return ib(t,0,r);case"'":return ib(t,a);case"<":c=i[ib(u,1,-1)];break;default:var d=+u;if(0===d)return o;if(d>s){var l=tb(d/10);return 0===l?o:l<=s?void 0===n[l-1]?rb(u,1):n[l-1]+rb(u,1):o}c=n[d-1]}return void 0===c?"":c}))},Eb=ou,kb=_t("replace"),Tb=Math.max,Ib=Math.min,Ab=cb([].concat),Rb=cb([].push),wb=cb("".indexOf),Cb=cb("".slice),Ob="$0"==="a".replace(/./,"$0"),xb=!!/./[kb]&&""===/./[kb]("a","$0"),Nb=!lb((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}));db("replace",(function(e,t,r){var n=xb?"$":"$0";return[function(e,r){var n=yb(this),i=pb(e)?void 0:Sb(e,kb);return i?ub(i,e,n,r):ub(t,mb(n),e,r)},function(e,i){var o=hb(this),a=mb(e);if("string"==typeof i&&-1===wb(i,n)&&-1===wb(i,"$<")){var s=r(t,o,a,i);if(s.done)return s.value}var u=fb(i);u||(i=mb(i));var c=o.global;if(c){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=Eb(o,a);if(null===h)break;if(Rb(l,h),!c)break;""===mb(h[0])&&(o.lastIndex=gb(a,vb(o.lastIndex),d))}for(var f,p="",_=0,v=0;v<l.length;v++){for(var m=mb((h=l[v])[0]),y=Tb(Ib(_b(h.index),a.length),0),g=[],S=1;S<h.length;S++)Rb(g,void 0===(f=h[S])?f:String(f));var b=h.groups;if(u){var E=Ab([m],g,y,a);void 0!==b&&Rb(E,b);var k=mb(sb(i,void 0,E))}else k=bb(m,a,y,g,b,i);y>=_&&(p+=Cb(a,_,y)+k,_=y+m.length)}return p+Cb(a,_)}]}),!Nb||!Ob||xb);var Db=Ut,Pb=De,Mb=Lt,Ub=cs,Lb=RegExp.prototype,Vb=function(e){var t=e.flags;return void 0!==t||"flags"in Lb||Pb(e,"flags")||!Mb(Lb,e)?t:Db(Ub,e)},Fb=gt,Bb=ae,jb=ke,Gb=na,Hb=$l,zb=zr,Kb=yo.f,Wb=Lt,Xb=Xa,qb=$a,Yb=Vb,Jb=_s,Qb=_f,Zb=Rn,$b=me,eE=De,tE=dn.enforce,rE=Eh,nE=ys,iE=bs,oE=_t("match"),aE=Bb.RegExp,sE=aE.prototype,uE=Bb.SyntaxError,cE=jb(sE.exec),dE=jb("".charAt),lE=jb("".replace),hE=jb("".indexOf),fE=jb("".slice),pE=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,_E=/a/g,vE=/a/g,mE=new aE(_E)!==_E,yE=Jb.MISSED_STICKY,gE=Jb.UNSUPPORTED_Y,SE=Fb&&(!mE||yE||nE||iE||$b((function(){return vE[oE]=!1,aE(_E)!=_E||aE(vE)==vE||"/a/i"!=aE(_E,"i")})));if(Gb("RegExp",SE)){for(var bE=function(e,t){var r,n,i,o,a,s,u=Wb(sE,this),c=Xb(e),d=void 0===t,l=[],h=e;if(!u&&c&&d&&e.constructor===bE)return e;if((c||Wb(sE,e))&&(e=e.source,d&&(t=Yb(h))),e=void 0===e?"":qb(e),t=void 0===t?"":qb(t),h=e,nE&&"dotAll"in _E&&(n=!!t&&hE(t,"s")>-1)&&(t=lE(t,/s/g,"")),r=t,yE&&"sticky"in _E&&(i=!!t&&hE(t,"y")>-1)&&gE&&(t=lE(t,/y/g,"")),iE&&(o=function(e){for(var t,r=e.length,n=0,i="",o=[],a={},s=!1,u=!1,c=0,d="";n<=r;n++){if("\\"===(t=dE(e,n)))t+=dE(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:cE(pE,fE(e,n+1))&&(n+=2,u=!0),i+=t,c++;continue;case">"===t&&u:if(""===d||eE(a,d))throw new uE("Invalid capture group name");a[d]=!0,o[o.length]=[d,c],u=!1,d="";continue}u?d+=t:i+=t}return[i,o]}(e),e=o[0],l=o[1]),a=Hb(aE(e,t),u?this:sE,bE),(n||i||l.length)&&(s=tE(a),n&&(s.dotAll=!0,s.raw=bE(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=dE(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+dE(e,++n);return i}(e),r)),i&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{zb(a,"source",""===h?"(?:)":h)}catch(RJ){}return a},EE=Kb(aE),kE=0;EE.length>kE;)Qb(bE,aE,EE[kE++]);sE.constructor=bE,bE.prototype=sE,Zb(Bb,"RegExp",bE,{constructor:!0})}rE("RegExp");var TE=gt,IE=ys,AE=xn,RE=fg,wE=dn.get,CE=RegExp.prototype,OE=TypeError;TE&&IE&&RE(CE,"dotAll",{configurable:!0,get:function(){if(this!==CE){if("RegExp"===AE(this))return!!wE(this).dotAll;throw OE("Incompatible receiver, RegExp required")}}});var xE=gt,NE=_s.MISSED_STICKY,DE=xn,PE=fg,ME=dn.get,UE=RegExp.prototype,LE=TypeError;xE&&NE&&PE(UE,"sticky",{configurable:!0,get:function(){if(this!==UE){if("RegExp"===DE(this))return!!ME(this).sticky;throw LE("Incompatible receiver, RegExp required")}}});var VE=Or.PROPER,FE=Rn,BE=Dt,jE=$a,GE=me,HE=Vb,zE="toString",KE=RegExp.prototype.toString,WE=GE((function(){return"/a/b"!=KE.call({source:"a",flags:"b"})})),XE=VE&&KE.name!=zE;(WE||XE)&&FE(RegExp.prototype,zE,(function(){var e=BE(this);return"/"+jE(e.source)+"/"+jE(HE(e))}),{unsafe:!0});var qE=la,YE=me,JE=so,QE=eo.f,ZE=gt,$E=YE((function(){QE(1)}));qE({target:"Object",stat:!0,forced:!ZE||$E,sham:!ZE},{getOwnPropertyDescriptor:function(e,t){return QE(JE(e),t)}});var ek=la,tk=We,rk=ff,nk=Ut,ik=ke,ok=me,ak=fi,sk=Ge,uk=Et,ck=Gt,dk=__,lk=nt,hk=tk("JSON","stringify"),fk=ik(/./.exec),pk=ik("".charAt),_k=ik("".charCodeAt),vk=ik("".replace),mk=ik(1..toString),yk=/[\uD800-\uDFFF]/g,gk=/^[\uD800-\uDBFF]$/,Sk=/^[\uDC00-\uDFFF]$/,bk=!lk||ok((function(){var e=tk("Symbol")();return"[null]"!=hk([e])||"{}"!=hk({a:e})||"{}"!=hk(Object(e))})),Ek=ok((function(){return'"\\udf06\\ud834"'!==hk("\udf06\ud834")||'"\\udead"'!==hk("\udead")})),kk=function(e,t){var r=dk(arguments),n=t;if((uk(t)||void 0!==e)&&!ck(e))return ak(t)||(t=function(e,t){if(sk(n)&&(t=nk(n,this,e,t)),!ck(t))return t}),r[1]=t,rk(hk,null,r)},Tk=function(e,t,r){var n=pk(r,t-1),i=pk(r,t+1);return fk(gk,e)&&!fk(Sk,i)||fk(Sk,e)&&!fk(gk,n)?"\\u"+mk(_k(e,0),16):e};hk&&ek({target:"JSON",stat:!0,arity:3,forced:bk||Ek},{stringify:function(e,t,r){var n=dk(arguments),i=rk(bk?kk:hk,null,n);return Ek&&"string"==typeof i?vk(i,yk,Tk):i}});var Ik=$p;function Ak(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==a(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"===a(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"===a(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"===a(e.video)){var s=e.video.facingMode;s=s&&("object"===a(s)?s:{ideal:s});var u,c=t.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||c))if(delete e.video.facingMode,"environment"===s.exact||"environment"===s.ideal?u=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(u=["front"]),u)return r.mediaDevices.enumerateDevices().then((function(t){var r=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return u.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!r&&t.length&&u.includes("back")&&(r=t[t.length-1]),r&&(e.video.deviceId=s.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),Ik("chrome: "+JSON.stringify(e)),i(e)}));e.video=n(e.video)}return Ik("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 s=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return i(e,(function(e){return s(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 Promise.reject(o(e))}))}))}}}}function Rk(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function wk(e){if("object"===a(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 Jp(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function Ck(e){if("object"===a(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"===a(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var s=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=s.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 Ok(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 u=function(e){i(s(a(e)))};return t.apply(this,[u,n])}return new Promise((function(r,n){t.apply(e,[function(e){r(s(a(e)))},n])})).then(i,o)}}}function xk(e){if("object"===a(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 o_(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}),Jp(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 o_(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?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}}}function Nk(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 Dk(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Nk(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),Promise.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=h({},t,(function(){var e=this,t=arguments,n=arguments.length&&"function"==typeof arguments[0];return n?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]=u(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 u(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 Pk(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=h({},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 Mk(e,t){Jp(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 Uk,Lk,Vk=Object.freeze(Object.defineProperty({__proto__:null,shimMediaStream:Rk,shimOnTrack:wk,shimGetSendersWithDtmf:Ck,shimGetStats:Ok,shimSenderReceiverGetStats:xk,shimAddTrackRemoveTrackWithNative:Nk,shimAddTrackRemoveTrack:Dk,shimPeerConnection:Pk,fixNegotiationNeeded:Mk,shimGetUserMedia:Ak,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"))}},Symbol.toStringTag,{value:"Module"})),Fk=la,Bk=Ut,jk=Ge,Gk=Dt,Hk=$a,zk=(Uk=!1,(Lk=/[ac]/).exec=function(){return Uk=!0,/./.exec.apply(this,arguments)},!0===Lk.test("abc")&&Uk),Kk=/./.test;Fk({target:"RegExp",proto:!0,forced:!zk},{test:function(e){var t=Gk(this),r=Hk(e),n=t.exec;if(!jk(n))return Bk(Kk,t,r);var i=Bk(n,t,r);return null!==i&&(Gk(i),!0)}});var Wk=ae,Xk=me,qk=$a,Yk=Gu.trim,Jk=ke("".charAt),Qk=Wk.parseFloat,Zk=Wk.Symbol,$k=Zk&&Zk.iterator,eT=1/Qk("\t\n\v\f\r \u2028\u2029\ufeff-0")!=-1/0||$k&&!Xk((function(){Qk(Object($k))}))?function(e){var t=Yk(qk(e)),r=Qk(t);return 0===r&&"-"==Jk(t,0)?-0:r}:Qk;la({global:!0,forced:parseFloat!=eT},{parseFloat:eT});var tT=la,rT=ym,nT=me,iT=We,oT=Ge,aT=lv,sT=ag,uT=Rn,cT=rT&&rT.prototype;if(tT({target:"Promise",proto:!0,real:!0,forced:!!rT&&nT((function(){cT.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=aT(this,iT("Promise")),r=oT(e);return this.then(r?function(r){return sT(t,e()).then((function(){return r}))}:e,r?function(r){return sT(t,e()).then((function(){throw r}))}:e)}}),oT(rT)){var dT=iT("Promise").prototype.finally;cT.finally!==dT&&uT(cT,"finally",dT,{unsafe:!0})}function lT(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){e_("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"===a(e)&&"object"===a(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 s=n.prototype.getSettings;n.prototype.getSettings=function(){var e=s.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var u=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===a(e)&&(e=JSON.parse(JSON.stringify(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),u.apply(this,[e])}}}}function hT(e){"object"===a(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 fT(e,t){if("object"===a(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=h({},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(n){if("TypeError"!==n.name)throw n;e.forEach((function(t,n){e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function pT(e){if("object"===a(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):Promise.resolve(new Map)}}}function _T(e){if("object"===a(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}),Jp(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function vT(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;e_("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function mT(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function yT(e){if("object"===a(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]);var r=(e=k(e)).length>0;r&&e.forEach((function(e){if("rid"in e){if(!/^[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,i.sendEncodings=e,this.setParametersPromises.push(i.setParameters(o).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return n})}}function gT(e){if("object"===a(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 ST(e){if("object"===a(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?Promise.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}function bT(e){if("object"===a(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?Promise.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}var ET=Object.freeze(Object.defineProperty({__proto__:null,shimOnTrack:hT,shimPeerConnection:fT,shimSenderGetStats:pT,shimReceiverGetStats:_T,shimRemoveStream:vT,shimRTCDataChannel:mT,shimAddTransceiver:yT,shimGetParameters:gT,shimCreateOffer:ST,shimCreateAnswer:bT,shimGetUserMedia:lT,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,Promise.reject(n)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}},Symbol.toStringTag,{value:"Module"}));function kT(e){if("object"===a(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 TT(e){if("object"===a(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 IT(e){if("object"===a(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,s=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),Promise.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),Promise.resolve()):i};var u=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=u,u=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=u,u=function(e,t,r){var n=s.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=u}}function AT(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(RT(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function RT(e){return e&&void 0!==e.video?Object.assign({},e,{video:n_(e.video)}):e}function wT(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")?(e_("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 CT(e){"object"===a(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 OT(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",{direction:"recvonly"}),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",{direction:"recvonly"})}return t.apply(this,arguments)}}function xT(e){"object"!==a(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var NT=Object.freeze(Object.defineProperty({__proto__:null,shimLocalStreamsAPI:kT,shimRemoteStreamsAPI:TT,shimCallbacksAPI:IT,shimGetUserMedia:AT,shimConstraints:RT,shimRTCIceServerUrls:wT,shimTrackEventTransceiver:CT,shimCreateOfferLegacy:OT,shimAudioContext:xT},Symbol.toStringTag,{value:"Module"})),DT=Ut;la({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return DT(URL.prototype.toString,this)}});var PT=ke(1..valueOf),MT=gt,UT=ae,LT=ke,VT=na,FT=Rn,BT=De,jT=$l,GT=Lt,HT=Gt,zT=cr,KT=me,WT=yo.f,XT=eo.f,qT=yt.f,YT=PT,JT=Gu.trim,QT="Number",ZT=UT.Number,$T=ZT.prototype,eI=UT.TypeError,tI=LT("".slice),rI=LT("".charCodeAt),nI=function(e){var t=zT(e,"number");return"bigint"==typeof t?t:iI(t)},iI=function(e){var t,r,n,i,o,a,s,u,c=zT(e,"number");if(HT(c))throw eI("Cannot convert a Symbol value to a number");if("string"==typeof c&&c.length>2)if(c=JT(c),43===(t=rI(c,0))||45===t){if(88===(r=rI(c,2))||120===r)return NaN}else if(48===t){switch(rI(c,1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+c}for(a=(o=tI(c,2)).length,s=0;s<a;s++)if((u=rI(o,s))<48||u>i)return NaN;return parseInt(o,n)}return+c};if(VT(QT,!ZT(" 0o1")||!ZT("0b1")||ZT("+0x1"))){for(var oI,aI=function(e){var t=arguments.length<1?0:ZT(nI(e)),r=this;return GT($T,r)&&KT((function(){YT(r)}))?jT(Object(t),r,aI):t},sI=MT?WT(ZT):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),uI=0;sI.length>uI;uI++)BT(ZT,oI=sI[uI])&&!BT(aI,oI)&&qT(aI,oI,XT(ZT,oI));aI.prototype=$T,$T.constructor=aI,FT(UT,QT,aI,{constructor:!0})}var cI=Or.PROPER,dI=me,lI=Pu,hI=Gu.trim;la({target:"String",proto:!0,forced:function(e){return dI((function(){return!!lI[e]()||"
"!=="
"[e]()||cI&&lI[e].name!==e}))}("trim")},{trim:function(){return hI(this)}});var fI={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:{1:"rtp",2:"rtcp"}[t[1]]||t[1],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:void 0===r[t[n]]&&(r[t[n]]=t[n+1])}return r},t.writeCandidate=function(e){var t=[];t.push(e.foundation);var r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&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){void 0!==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].toUpperCase()}},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"===a(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){var t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},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),u=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=u.length?t.parseFmtp(u[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"),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})),u=s.length>0&&s[0].ssrc,c=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));c.length>0&&c[0].length>1&&c[0][0]===u&&(r=c[0][1]),i.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:u,codecPayloadType:parseInt(e.parameters.apt,10)};u&&r&&(t.rtx={ssrc:r}),n.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:u,mechanism:a?"red+ulpfec":"red"},n.push(t))}})),0===n.length&&u&&n.push({ssrc:u});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.writeRtcpParameters=function(e){var t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},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};var a=t.matchPrefix(e,"a=sctpmap:");if(a.length>0){var s=a[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[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.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}(fI);var pI=fI.exports,_I=e({__proto__:null,default:pI},[fI.exports]);function vI(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===a(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=pI.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,Jp(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function mI(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||Jp(e,"icecandidate",(function(e){if(e.candidate){var t=pI.parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function yI(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=pI.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=pI.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=pI.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){var e=this.getConfiguration(),s=e.sdpSemantics;"plan-b"===s&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){var u,c=n(arguments[0]),d=i(c),l=o(arguments[0],c);u=0===d&&0===l?Number.POSITIVE_INFINITY:0===d||0===l?Math.max(d,l):Math.min(d,l);var h={};Object.defineProperty(h,"maxMessageSize",{get:function(){return u}}),this._sctp=h}return a.apply(this,arguments)}}}function gI(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},Jp(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 SI(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 bI(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"!==e.trim()})).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 EI(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?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function kI(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,t=arguments[0]||{};if("object"!==a(t)||t.type&&t.sdp)return r.apply(this,arguments);if(!(t={type:t.type,sdp:t.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return r.apply(this,[t]);var n="offer"===t.type?this.createOffer:this.createAnswer;return n.apply(this).then((function(t){return r.apply(e,[t])}))})}}var TI=Object.freeze(Object.defineProperty({__proto__:null,shimRTCIceCandidate:vI,shimRTCIceCandidateRelayProtocol:mI,shimMaxMessageSize:yI,shimSendThrowTypeError:gI,shimConnectionState:SI,removeExtmapAllowMixed:bI,shimAddIceCandidateNullOrEmpty:EI,shimParameterlessSetLocalDescription:kI},Symbol.toStringTag,{value:"Module"}));!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},n=$p,i=t_(t),o={browserDetails:i,commonShim:TI,extractVersion:Yp,disableLog:Qp,disableWarnings:Zp,sdp:_I};switch(i.browser){case"chrome":if(!Vk||!Pk||!r.shimChrome)return n("Chrome shim is not included in this adapter release."),o;if(null===i.version)return n("Chrome shim can not determine version, not shimming."),o;n("adapter.js shimming chrome."),o.browserShim=Vk,EI(t,i),kI(t),Ak(t,i),Rk(t),Pk(t,i),wk(t),Dk(t,i),Ck(t),Ok(t),xk(t),Mk(t,i),vI(t),mI(t),SI(t),yI(t,i),gI(t),bI(t,i);break;case"firefox":if(!ET||!fT||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=ET,EI(t,i),kI(t),lT(t,i),fT(t,i),hT(t),vT(t),pT(t),_T(t),mT(t),yT(t),gT(t),ST(t),bT(t),vI(t),SI(t),yI(t,i),gI(t);break;case"safari":if(!NT||!r.shimSafari)return n("Safari shim is not included in this adapter release."),o;n("adapter.js shimming safari."),o.browserShim=NT,EI(t,i),kI(t),wT(t),OT(t),IT(t),kT(t),TT(t),CT(t),AT(t),xT(t),vI(t),mI(t),yI(t,i),gI(t),bI(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var II=Nd,AI=Math.floor,RI=function(e,t){var r=e.length,n=AI(r/2);return r<8?wI(e,t):CI(e,RI(II(e,0,n),t),RI(II(e,n),t),t)},wI=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},CI=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},OI=RI,xI=Xe.match(/firefox\/(\d+)/i),NI=!!xI&&+xI[1],DI=/MSIE|Trident/.test(Xe),PI=Xe.match(/AppleWebKit\/(\d+)\./),MI=!!PI&&+PI[1],UI=la,LI=ke,VI=qt,FI=Oe,BI=li,jI=V_,GI=$a,HI=me,zI=OI,KI=zi,WI=NI,XI=DI,qI=et,YI=MI,JI=[],QI=LI(JI.sort),ZI=LI(JI.push),$I=HI((function(){JI.sort(void 0)})),eA=HI((function(){JI.sort(null)})),tA=KI("sort"),rA=!HI((function(){if(qI)return qI<70;if(!(WI&&WI>3)){if(XI)return!0;if(YI)return YI<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++)JI.push({k:t+n,v:r})}for(JI.sort((function(e,t){return t.v-e.v})),n=0;n<JI.length;n++)t=JI[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));UI({target:"Array",proto:!0,forced:$I||!eA||!tA||!rA},{sort:function(e){void 0!==e&&VI(e);var t=FI(this);if(rA)return void 0===e?QI(t):QI(t,e);var r,n,i=[],o=BI(t);for(n=0;n<o;n++)n in t&&ZI(i,t[n]);for(zI(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:GI(t)>GI(r)?1:-1}}(e)),r=BI(i),n=0;n<r;)t[n]=i[n++];for(;n<o;)jI(t,n++);return t}});var nA,iA,oA,aA={exports:{}},sA="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,uA=sA,cA=gt,dA=ae,lA=Ge,hA=Et,fA=De,pA=Vn,_A=zt,vA=zr,mA=Rn,yA=yt.f,gA=Lt,SA=fc,bA=Bc,EA=_t,kA=Ve,TA=dn.enforce,IA=dn.get,AA=dA.Int8Array,RA=AA&&AA.prototype,wA=dA.Uint8ClampedArray,CA=wA&&wA.prototype,OA=AA&&SA(AA),xA=RA&&SA(RA),NA=Object.prototype,DA=dA.TypeError,PA=EA("toStringTag"),MA=kA("TYPED_ARRAY_TAG"),UA="TypedArrayConstructor",LA=uA&&!!bA&&"Opera"!==pA(dA.opera),VA=!1,FA={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},BA={BigInt64Array:8,BigUint64Array:8},jA=function(e){var t=SA(e);if(hA(t)){var r=IA(t);return r&&fA(r,UA)?r.TypedArrayConstructor:jA(t)}},GA=function(e){if(!hA(e))return!1;var t=pA(e);return fA(FA,t)||fA(BA,t)};for(nA in FA)(oA=(iA=dA[nA])&&iA.prototype)?TA(oA).TypedArrayConstructor=iA:LA=!1;for(nA in BA)(oA=(iA=dA[nA])&&iA.prototype)&&(TA(oA).TypedArrayConstructor=iA);if((!LA||!lA(OA)||OA===Function.prototype)&&(OA=function(){throw DA("Incorrect invocation")},LA))for(nA in FA)dA[nA]&&bA(dA[nA],OA);if((!LA||!xA||xA===NA)&&(xA=OA.prototype,LA))for(nA in FA)dA[nA]&&bA(dA[nA].prototype,xA);if(LA&&SA(CA)!==xA&&bA(CA,xA),cA&&!fA(xA,PA))for(nA in VA=!0,yA(xA,PA,{get:function(){return hA(this)?this[MA]:void 0}}),FA)dA[nA]&&vA(dA[nA],MA,nA);var HA={NATIVE_ARRAY_BUFFER_VIEWS:LA,TYPED_ARRAY_TAG:VA&&MA,aTypedArray:function(e){if(GA(e))return e;throw DA("Target is not a typed array")},aTypedArrayConstructor:function(e){if(lA(e)&&(!bA||gA(OA,e)))return e;throw DA(_A(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(cA){if(r)for(var i in FA){var o=dA[i];if(o&&fA(o.prototype,e))try{delete o.prototype[e]}catch(RJ){try{o.prototype[e]=t}catch(a){}}}xA[e]&&!r||mA(xA,e,r?t:LA&&RA[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(cA){if(bA){if(r)for(n in FA)if((i=dA[n])&&fA(i,e))try{delete i[e]}catch(RJ){}if(OA[e]&&!r)return;try{return mA(OA,e,r?t:LA&&OA[e]||t)}catch(RJ){}}for(n in FA)!(i=dA[n])||i[e]&&!r||mA(i,e,t)}},getTypedArrayConstructor:jA,isView:function(e){if(!hA(e))return!1;var t=pA(e);return"DataView"===t||fA(FA,t)||fA(BA,t)},isTypedArray:GA,TypedArray:OA,TypedArrayPrototype:xA},zA=ae,KA=me,WA=Yl,XA=HA.NATIVE_ARRAY_BUFFER_VIEWS,qA=zA.ArrayBuffer,YA=zA.Int8Array,JA=!XA||!KA((function(){YA(1)}))||!KA((function(){new YA(-1)}))||!WA((function(e){new YA,new YA(null),new YA(1.5),new YA(e)}),!0)||KA((function(){return 1!==new YA(new qA(2),1,void 0).length})),QA=ai,ZA=ci,$A=RangeError,eR=function(e){if(void 0===e)return 0;var t=QA(e),r=ZA(t);if(t!==r)throw $A("Wrong length or index");return r},tR=Array,rR=Math.abs,nR=Math.pow,iR=Math.floor,oR=Math.log,aR=Math.LN2,sR={pack:function(e,t,r){var n,i,o,a=tR(r),s=8*r-t-1,u=(1<<s)-1,c=u>>1,d=23===t?nR(2,-24)-nR(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=rR(e))!=e||e===1/0?(i=e!=e?1:0,n=u):(n=iR(oR(e)/aR),e*(o=nR(2,-n))<1&&(n--,o*=2),(e+=n+c>=1?d/o:d*nR(2,1-c))*o>=2&&(n++,o/=2),n+c>=u?(i=0,n=u):n+c>=1?(i=(e*o-1)*nR(2,t),n+=c):(i=e*nR(2,c-1)*nR(2,t),n=0));t>=8;)a[h++]=255&i,i/=256,t-=8;for(n=n<<t|i,s+=t;s>0;)a[h++]=255&n,n/=256,s-=8;return a[--h]|=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,u=n-1,c=e[u--],d=127&c;for(c>>=7;s>0;)d=256*d+e[u--],s-=8;for(r=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)r=256*r+e[u--],s-=8;if(0===d)d=1-a;else{if(d===o)return r?NaN:c?-1/0:1/0;r+=nR(2,t),d-=a}return(c?-1:1)*r*nR(2,d-t)}},uR=Oe,cR=Eo,dR=li,lR=function(e){for(var t=uR(this),r=dR(t),n=arguments.length,i=cR(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:cR(o,r);a>i;)t[i++]=e;return t},hR=ae,fR=ke,pR=gt,_R=sA,vR=Or,mR=zr,yR=mh,gR=me,SR=zl,bR=ai,ER=ci,kR=eR,TR=sR,IR=fc,AR=Bc,RR=yo.f,wR=yt.f,CR=lR,OR=Nd,xR=Ac,NR=vR.PROPER,DR=vR.CONFIGURABLE,PR=dn.get,MR=dn.set,UR="ArrayBuffer",LR="DataView",VR="Wrong index",FR=hR.ArrayBuffer,BR=FR,jR=BR&&BR.prototype,GR=hR.DataView,HR=GR&&GR.prototype,zR=Object.prototype,KR=hR.Array,WR=hR.RangeError,XR=fR(CR),qR=fR([].reverse),YR=TR.pack,JR=TR.unpack,QR=function(e){return[255&e]},ZR=function(e){return[255&e,e>>8&255]},$R=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},ew=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},tw=function(e){return YR(e,23,4)},rw=function(e){return YR(e,52,8)},nw=function(e,t){wR(e.prototype,t,{get:function(){return PR(this)[t]}})},iw=function(e,t,r,n){var i=kR(r),o=PR(e);if(i+t>o.byteLength)throw WR(VR);var a=PR(o.buffer).bytes,s=i+o.byteOffset,u=OR(a,s,s+t);return n?u:qR(u)},ow=function(e,t,r,n,i,o){var a=kR(r),s=PR(e);if(a+t>s.byteLength)throw WR(VR);for(var u=PR(s.buffer).bytes,c=a+s.byteOffset,d=n(+i),l=0;l<t;l++)u[c+l]=d[o?l:t-l-1]};if(_R){var aw=NR&&FR.name!==UR;if(gR((function(){FR(1)}))&&gR((function(){new FR(-1)}))&&!gR((function(){return new FR,new FR(1.5),new FR(NaN),1!=FR.length||aw&&!DR})))aw&&DR&&mR(FR,"name",UR);else{(BR=function(e){return SR(this,jR),new FR(kR(e))}).prototype=jR;for(var sw,uw=RR(FR),cw=0;uw.length>cw;)(sw=uw[cw++])in BR||mR(BR,sw,FR[sw]);jR.constructor=BR}AR&&IR(HR)!==zR&&AR(HR,zR);var dw=new GR(new BR(2)),lw=fR(HR.setInt8);dw.setInt8(0,2147483648),dw.setInt8(1,2147483649),!dw.getInt8(0)&&dw.getInt8(1)||yR(HR,{setInt8:function(e,t){lw(this,e,t<<24>>24)},setUint8:function(e,t){lw(this,e,t<<24>>24)}},{unsafe:!0})}else jR=(BR=function(e){SR(this,jR);var t=kR(e);MR(this,{bytes:XR(KR(t),0),byteLength:t}),pR||(this.byteLength=t)}).prototype,HR=(GR=function(e,t,r){SR(this,HR),SR(e,jR);var n=PR(e).byteLength,i=bR(t);if(i<0||i>n)throw WR("Wrong offset");if(i+(r=void 0===r?n-i:ER(r))>n)throw WR("Wrong length");MR(this,{buffer:e,byteLength:r,byteOffset:i}),pR||(this.buffer=e,this.byteLength=r,this.byteOffset=i)}).prototype,pR&&(nw(BR,"byteLength"),nw(GR,"buffer"),nw(GR,"byteLength"),nw(GR,"byteOffset")),yR(HR,{getInt8:function(e){return iw(this,1,e)[0]<<24>>24},getUint8:function(e){return iw(this,1,e)[0]},getInt16:function(e){var t=iw(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=iw(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return ew(iw(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return ew(iw(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return JR(iw(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return JR(iw(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){ow(this,1,e,QR,t)},setUint8:function(e,t){ow(this,1,e,QR,t)},setInt16:function(e,t){ow(this,2,e,ZR,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){ow(this,2,e,ZR,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){ow(this,4,e,$R,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){ow(this,4,e,$R,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){ow(this,4,e,tw,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){ow(this,8,e,rw,t,arguments.length>2?arguments[2]:void 0)}});xR(BR,UR),xR(GR,LR);var hw={ArrayBuffer:BR,DataView:GR},fw=Et,pw=Math.floor,_w=Number.isInteger||function(e){return!fw(e)&&isFinite(e)&&pw(e)===e},vw=ai,mw=RangeError,yw=function(e){var t=vw(e);if(t<0)throw mw("The argument can't be less than 0");return t},gw=RangeError,Sw=function(e,t){var r=yw(e);if(r%t)throw gw("Wrong offset");return r},bw=Vn,Ew=ke("".slice),kw=function(e){return"Big"===Ew(bw(e),0,3)},Tw=cr,Iw=TypeError,Aw=function(e){var t=Tw(e,"number");if("number"==typeof t)throw Iw("Can't convert number to bigint");return BigInt(t)},Rw=Qn,ww=Ut,Cw=av,Ow=Oe,xw=li,Nw=kl,Dw=vl,Pw=dl,Mw=kw,Uw=HA.aTypedArrayConstructor,Lw=Aw,Vw=la,Fw=ae,Bw=Ut,jw=gt,Gw=JA,Hw=HA,zw=hw,Kw=zl,Ww=jr,Xw=zr,qw=_w,Yw=ci,Jw=eR,Qw=Sw,Zw=hr,$w=De,eC=Vn,tC=Et,rC=Gt,nC=Ma,iC=Lt,oC=Bc,aC=yo.f,sC=function(e){var t,r,n,i,o,a,s,u,c=Cw(this),d=Ow(e),l=arguments.length,h=l>1?arguments[1]:void 0,f=void 0!==h,p=Dw(d);if(p&&!Pw(p))for(u=(s=Nw(d,p)).next,d=[];!(a=ww(u,s)).done;)d.push(a.value);for(f&&l>2&&(h=Rw(h,arguments[2])),r=xw(d),n=new(Uw(c))(r),i=Mw(n),t=0;r>t;t++)o=f?h(d[t],t):d[t],n[t]=i?Lw(o):+o;return n},uC=Gi.forEach,cC=Eh,dC=yt,lC=eo,hC=$l,fC=dn.get,pC=dn.set,_C=dn.enforce,vC=dC.f,mC=lC.f,yC=Math.round,gC=Fw.RangeError,SC=zw.ArrayBuffer,bC=SC.prototype,EC=zw.DataView,kC=Hw.NATIVE_ARRAY_BUFFER_VIEWS,TC=Hw.TYPED_ARRAY_TAG,IC=Hw.TypedArray,AC=Hw.TypedArrayPrototype,RC=Hw.aTypedArrayConstructor,wC=Hw.isTypedArray,CC="BYTES_PER_ELEMENT",OC="Wrong length",xC=function(e,t){RC(e);for(var r=0,n=t.length,i=new e(n);n>r;)i[r]=t[r++];return i},NC=function(e,t){vC(e,t,{get:function(){return fC(this)[t]}})},DC=function(e){var t;return iC(bC,e)||"ArrayBuffer"==(t=eC(e))||"SharedArrayBuffer"==t},PC=function(e,t){return wC(e)&&!rC(t)&&t in e&&qw(+t)&&t>=0},MC=function(e,t){return t=Zw(t),PC(e,t)?Ww(2,e[t]):mC(e,t)},UC=function(e,t,r){return t=Zw(t),!(PC(e,t)&&tC(r)&&$w(r,"value"))||$w(r,"get")||$w(r,"set")||r.configurable||$w(r,"writable")&&!r.writable||$w(r,"enumerable")&&!r.enumerable?vC(e,t,r):(e[t]=r.value,e)};jw?(kC||(lC.f=MC,dC.f=UC,NC(AC,"buffer"),NC(AC,"byteOffset"),NC(AC,"byteLength"),NC(AC,"length")),Vw({target:"Object",stat:!0,forced:!kC},{getOwnPropertyDescriptor:MC,defineProperty:UC}),aA.exports=function(e,t,r){var n=e.match(/\d+$/)[0]/8,i=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=Fw[i],u=s,c=u&&u.prototype,d={},l=function(e,t){vC(e,t,{get:function(){return function(e,t){var r=fC(e);return r.view[o](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=fC(e);r&&(i=(i=yC(i))<0?0:i>255?255:255&i),o.view[a](t*n+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};kC?Gw&&(u=t((function(e,t,r,i){return Kw(e,c),hC(tC(t)?DC(t)?void 0!==i?new s(t,Qw(r,n),i):void 0!==r?new s(t,Qw(r,n)):new s(t):wC(t)?xC(u,t):Bw(sC,u,t):new s(Jw(t)),e,u)})),oC&&oC(u,IC),uC(aC(s),(function(e){e in u||Xw(u,e,s[e])})),u.prototype=c):(u=t((function(e,t,r,i){Kw(e,c);var o,a,s,d=0,h=0;if(tC(t)){if(!DC(t))return wC(t)?xC(u,t):Bw(sC,u,t);o=t,h=Qw(r,n);var f=t.byteLength;if(void 0===i){if(f%n)throw gC(OC);if((a=f-h)<0)throw gC(OC)}else if((a=Yw(i)*n)+h>f)throw gC(OC);s=a/n}else s=Jw(t),o=new SC(a=s*n);for(pC(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new EC(o)});d<s;)l(e,d++)})),oC&&oC(u,IC),c=u.prototype=nC(AC)),c.constructor!==u&&Xw(c,"constructor",u),_C(c).TypedArrayConstructor=u,TC&&Xw(c,TC,i);var h=u!=s;d[i]=u,Vw({global:!0,constructor:!0,forced:h,sham:!kC},d),CC in u||Xw(u,CC,n),CC in c||Xw(c,CC,n),cC(i)}):aA.exports=function(){},(0,aA.exports)("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var LC=li,VC=ai,FC=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("at",(function(e){var t=FC(this),r=LC(t),n=VC(e),i=n>=0?n:r+n;return i<0||i>=r?void 0:t[i]}));var BC=Oe,jC=Eo,GC=li,HC=V_,zC=Math.min,KC=[].copyWithin||function(e,t){var r=BC(this),n=GC(r),i=jC(e,n),o=jC(t,n),a=arguments.length>2?arguments[2]:void 0,s=zC((void 0===a?n:jC(a,n))-o,n-i),u=1;for(o<i&&i<o+s&&(u=-1,o+=s-1,i+=s-1);s-- >0;)o in r?r[i]=r[o]:HC(r,i),i+=u,o+=u;return r},WC=HA,XC=ke(KC),qC=WC.aTypedArray;(0,WC.exportTypedArrayMethod)("copyWithin",(function(e,t){return XC(qC(this),e,t,arguments.length>2?arguments[2]:void 0)}));var YC=Gi.every,JC=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("every",(function(e){return YC(JC(this),e,arguments.length>1?arguments[1]:void 0)}));var QC=lR,ZC=Aw,$C=Vn,eO=Ut,tO=me,rO=HA.aTypedArray,nO=HA.exportTypedArrayMethod,iO=ke("".slice),oO=tO((function(){var e=0;return new Int8Array(2).fill({valueOf:function(){return e++}}),1!==e}));nO("fill",(function(e){var t=arguments.length;rO(this);var r="Big"===iO($C(this),0,3)?ZC(e):+e;return eO(QC,this,r,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}),oO);var aO=li,sO=function(e,t){for(var r=0,n=aO(t),i=new e(n);n>r;)i[r]=t[r++];return i},uO=lv,cO=HA.aTypedArrayConstructor,dO=HA.getTypedArrayConstructor,lO=function(e){return cO(uO(e,dO(e)))},hO=sO,fO=lO,pO=Gi.filter,_O=function(e,t){return hO(fO(e),t)},vO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("filter",(function(e){var t=pO(vO(this),e,arguments.length>1?arguments[1]:void 0);return _O(this,t)}));var mO=Gi.find,yO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("find",(function(e){return mO(yO(this),e,arguments.length>1?arguments[1]:void 0)}));var gO=Gi.findIndex,SO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("findIndex",(function(e){return gO(SO(this),e,arguments.length>1?arguments[1]:void 0)}));var bO=Qn,EO=ri,kO=Oe,TO=li,IO=function(e){var t=1==e;return function(r,n,i){for(var o,a=kO(r),s=EO(a),u=bO(n,i),c=TO(s);c-- >0;)if(u(o=s[c],c,a))switch(e){case 0:return o;case 1:return c}return t?-1:void 0}},AO={findLast:IO(0),findLastIndex:IO(1)},RO=AO.findLast,wO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("findLast",(function(e){return RO(wO(this),e,arguments.length>1?arguments[1]:void 0)}));var CO=AO.findLastIndex,OO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("findLastIndex",(function(e){return CO(OO(this),e,arguments.length>1?arguments[1]:void 0)}));var xO=Gi.forEach,NO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("forEach",(function(e){xO(NO(this),e,arguments.length>1?arguments[1]:void 0)}));var DO=Ro.includes,PO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("includes",(function(e){return DO(PO(this),e,arguments.length>1?arguments[1]:void 0)}));var MO=Ro.indexOf,UO=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("indexOf",(function(e){return MO(UO(this),e,arguments.length>1?arguments[1]:void 0)}));var LO=ae,VO=me,FO=ke,BO=HA,jO=gd,GO=_t("iterator"),HO=LO.Uint8Array,zO=FO(jO.values),KO=FO(jO.keys),WO=FO(jO.entries),XO=BO.aTypedArray,qO=BO.exportTypedArrayMethod,YO=HO&&HO.prototype,JO=!VO((function(){YO[GO].call([1])})),QO=!!YO&&YO.values&&YO[GO]===YO.values&&"values"===YO.values.name,ZO=function(){return zO(XO(this))};qO("entries",(function(){return WO(XO(this))}),JO),qO("keys",(function(){return KO(XO(this))}),JO),qO("values",ZO,JO||!QO,{name:"values"}),qO(GO,ZO,JO||!QO,{name:"values"});var $O=HA.aTypedArray,ex=HA.exportTypedArrayMethod,tx=ke([].join);ex("join",(function(e){return tx($O(this),e)}));var rx=ff,nx=so,ix=ai,ox=li,ax=zi,sx=Math.min,ux=[].lastIndexOf,cx=!!ux&&1/[1].lastIndexOf(1,-0)<0,dx=ax("lastIndexOf"),lx=cx||!dx?function(e){if(cx)return rx(ux,this,arguments)||0;var t=nx(this),r=ox(t),n=r-1;for(arguments.length>1&&(n=sx(n,ix(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:ux,hx=ff,fx=lx,px=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return hx(fx,px(this),t>1?[e,arguments[1]]:[e])}));var _x=Gi.map,vx=lO,mx=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("map",(function(e){return _x(mx(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(vx(e))(t)}))}));var yx=tp.left,gx=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return yx(gx(this),e,t,t>1?arguments[1]:void 0)}));var Sx=tp.right,bx=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return Sx(bx(this),e,t,t>1?arguments[1]:void 0)}));var Ex=HA.aTypedArray,kx=HA.exportTypedArrayMethod,Tx=Math.floor;kx("reverse",(function(){for(var e,t=this,r=Ex(t).length,n=Tx(r/2),i=0;i<n;)e=t[i],t[i++]=t[--r],t[r]=e;return t}));var Ix=ae,Ax=Ut,Rx=HA,wx=li,Cx=Sw,Ox=Oe,xx=me,Nx=Ix.RangeError,Dx=Ix.Int8Array,Px=Dx&&Dx.prototype,Mx=Px&&Px.set,Ux=Rx.aTypedArray,Lx=Rx.exportTypedArrayMethod,Vx=!xx((function(){var e=new Uint8ClampedArray(2);return Ax(Mx,e,{length:1,0:3},1),3!==e[1]})),Fx=Vx&&Rx.NATIVE_ARRAY_BUFFER_VIEWS&&xx((function(){var e=new Dx(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));Lx("set",(function(e){Ux(this);var t=Cx(arguments.length>1?arguments[1]:void 0,1),r=Ox(e);if(Vx)return Ax(Mx,this,r,t);var n=this.length,i=wx(r),o=0;if(i+t>n)throw Nx("Wrong length");for(;o<i;)this[t+o]=r[o++]}),!Vx||Fx);var Bx=lO,jx=__,Gx=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("slice",(function(e,t){for(var r=jx(Gx(this),e,t),n=Bx(this),i=0,o=r.length,a=new n(o);o>i;)a[i]=r[i++];return a}),me((function(){new Int8Array(1).slice()})));var Hx=Gi.some,zx=HA.aTypedArray;(0,HA.exportTypedArrayMethod)("some",(function(e){return Hx(zx(this),e,arguments.length>1?arguments[1]:void 0)}));var Kx=Xn,Wx=me,Xx=qt,qx=OI,Yx=NI,Jx=DI,Qx=et,Zx=MI,$x=HA.aTypedArray,eN=HA.exportTypedArrayMethod,tN=ae.Uint16Array,rN=tN&&Kx(tN.prototype.sort),nN=!(!rN||Wx((function(){rN(new tN(2),null)}))&&Wx((function(){rN(new tN(2),{})}))),iN=!!rN&&!Wx((function(){if(Qx)return Qx<74;if(Yx)return Yx<67;if(Jx)return!0;if(Zx)return Zx<602;var e,t,r=new tN(516),n=Array(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(rN(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0}));eN("sort",(function(e){return void 0!==e&&Xx(e),iN?rN(this,e):qx($x(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))}),!iN||nN);var oN=ff,aN=HA,sN=me,uN=__,cN=ae.Int8Array,dN=aN.aTypedArray,lN=aN.exportTypedArrayMethod,hN=[].toLocaleString,fN=!!cN&&sN((function(){hN.call(new cN(1))}));lN("toLocaleString",(function(){return oN(hN,fN?uN(dN(this)):dN(this),uN(arguments))}),sN((function(){return[1,2].toLocaleString()!=new cN([1,2]).toLocaleString()}))||!sN((function(){cN.prototype.toLocaleString.call([1,2])})));var pN=HA.exportTypedArrayMethod,_N=me,vN=ke,mN=ae.Uint8Array,yN=mN&&mN.prototype||{},gN=[].toString,SN=vN([].join);_N((function(){gN.call({})}))&&(gN=function(){return SN(this)});var bN=yN.toString!=gN;pN("toString",gN,bN);var EN=li,kN=function(e,t){for(var r=EN(e),n=new t(r),i=0;i<r;i++)n[i]=e[r-i-1];return n},TN=HA.aTypedArray,IN=HA.getTypedArrayConstructor;(0,HA.exportTypedArrayMethod)("toReversed",(function(){return kN(TN(this),IN(this))}));var AN=qt,RN=sO,wN=HA.aTypedArray,CN=HA.getTypedArrayConstructor,ON=HA.exportTypedArrayMethod,xN=ke(HA.TypedArrayPrototype.sort);ON("toSorted",(function(e){void 0!==e&&AN(e);var t=wN(this),r=RN(CN(t),t);return xN(r,e)}));var NN=li,DN=ai,PN=RangeError,MN=function(e,t,r,n){var i=NN(e),o=DN(r),a=o<0?i+o:o;if(a>=i||a<0)throw PN("Incorrect index");for(var s=new t(i),u=0;u<i;u++)s[u]=u===a?n:e[u];return s},UN=kw,LN=ai,VN=Aw,FN=HA.aTypedArray,BN=HA.getTypedArrayConstructor,jN=HA.exportTypedArrayMethod,GN=!!function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(RJ){return 8===RJ}}();jN("with",{with:function(e,t){var r=FN(this),n=LN(e),i=UN(r)?VN(t):+t;return MN(r,BN(r),n,i)}}.with,!GN);var HN=la,zN=Gi.findIndex,KN=ja,WN="findIndex",XN=!0;WN in[]&&Array(1).findIndex((function(){XN=!1})),HN({target:"Array",proto:!0,forced:XN},{findIndex:function(e){return zN(this,e,arguments.length>1?arguments[1]:void 0)}}),KN(WN);var qN=function(e){return e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVOKED_BEFORE_JOIN_ROOM="INVOKED_BEFORE_JOIN_ROOM",e.INVALID_TOKEN="INVALID_TOKEN",e.EXPIRED_TOKEN="EXPIRED_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.UPDATE_TOKEN_WITH_INVALID_TOKEN="UPDATE_TOKEN_WITH_INVALID_TOKEN",e.UPDATE_TOKEN_BEFORE_JOIN="UPDATE_TOKEN_BEFORE_JOIN",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",e.REPEAT_PUSH="REPEAT_PUSH",e.REPEAT_PLAY="REPEAT_PLAY",e.PUBLISH_BEFORE_JOIN="PUBLISH_BEFORE_JOIN",e.UNPUBLISH_BEFORE_JOIN="UNPUBLISH_BEFORE_JOIN",e.SUBSCRIBE_BEFORE_JOIN="SUBSCRIBE_BEFORE_JOIN",e.UNSUBSCRIBE_BEFORE_JOIN="UNSUBSCRIBE_BEFORE_JOIN",e.NO_PUBLISH_PERMISSION="NO_PUBLISH_PERMISSION",e.STREAM_NOT_EXIST="STREAM_NOT_EXIST",e.EMPTY_STREAM="EMPTY_STREAM",e.NOT_CONNECTED_YET="NOT_CONNECTED_YET",e.IM_BEFORE_JOIN="IM_BEFORE_JOIN",e.USER_NOT_EXIST="USER_NOT_EXIST",e.ALREADY_IN_ROOM="ALREADY_IN_ROOM",e.KICKED_OUT="KICKED_OUT",e.ROOM_DISMISS="ROOM_DISMISS",e.TOKEN_EXPIRED="TOKEN_EXPIRED",e.DUPLICATE_LOGIN="DUPLICATE_LOGIN",e.INVOKED_BEFORE_CAPTURE="INVOKED_BEFORE_CAPTURE",e.REPEAT_CAPTURE="REPEAT_CAPTURE",e.GET_VIDEO_TRACK_FAILED="GET_VIDEO_TRACK_FAILED",e.GET_AUDIO_TRACK_FAILED="GET_AUDIO_TRACK_FAILED",e.GET_SCREEN_TRACK_FAILED="GET_SCREEN_TRACK_FAILED",e.STREAM_TYPE_NOT_MATCH="STREAM_TYPE_NOT_MATCH",e.CANT_FIND_DOM="CANT_FIND_DOM",e.INVALID_DEVICE_ID="INVALID_DEVICE_ID",e.NO_PERMISSION="NO_PERMISSION",e.NOT_SUPPORTED="NOT_SUPPORTED",e.INTERRUPT="INTERRUPT",e.ICE_SERVER_WRONG="ICE_SERVER_WRONG",e.ESTABLISH_DATACHANNEL_FAILED="ESTABLISH_DATACHANNEL_FAILED",e.LOAD_RESOURCES_FAILED="LOAD_RESOURCES_FAILED",e.SIGNALING_CHANNEL_NOT_OPEN="SIGNALING_CHANNEL_NOT_OPEN",e.TIME_OUT="TIME_OUT",e.REFUSE_OPERATION_IN_DISCONNECT="REFUSE_OPERATION_IN_DISCONNECT",e.ADD_TRANSCEIVER_FAILED="ADD_TRANSCEIVER_FAILED",e.UPDATE_TRACK_FAILED="UPDATE_TRACK_FAILED",e.PUBLISH_FAILED="PUBLISH_FAILED",e.UNPUBLISH_FAILED="UNPUBLISH_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.OPERATION_CANCEL="OPERATION_CANCEL",e.START_CLOUD_PROXY_AFTER_JOIN="START_CLOUD_PROXY_AFTER_JOIN",e.STOP_CLOUD_PROXY_BEFORE_LEAVE="STOP_CLOUD_PROXY_BEFORE_LEAVE",e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.REPEAT_DEVICE_TEST="REPEAT_DEVICE_TEST",e.AUDIO_DEVICE_TEST_FAILED="AUDIO_DEVICE_RECORD_FAILED",e.ALREADY_LOGIN="ALREADY_LOGIN",e.LOGIN_FAILED="LOGIN_FAILED",e.NOT_LOGIN="NOT_LOGIN",e.RTM_DUPLICATE_LOGIN="RTM_DUPLICATE_LOGIN",e.RTM_TOKEN_ERROR="RTM_TOKEN_ERROR",e.USER_MESSAGE_TIMEOUT="USER_MESSAGE_TIMEOUT",e.USER_MESSAGE_BROKEN="USER_MESSAGE_BROKEN",e.USER_MESSAGE_NO_RECEIVER="USER_MESSAGE_NO_RECEIVER",e.USER_MESSAGE_NO_RELAYPATH="USER_MESSAGE_NO_RELAYPATH",e.USER_MESSAGE_SEND_TO_SERVER_ERROR="USER_MESSAGE_SEND_TO_SERVER_ERROR",e.USER_MESSAGE_SERVER_RESPONSE_ERROR="USER_MESSAGE_SERVER_RESPONSE_ERROR",e.USER_MESSAGE_NOT_JOIN="USER_MESSAGE_NOT_JOIN",e.USER_MESSAGE_INIT="USER_MESSAGE_INIT",e.USER_MESSAGE_NO_CONNECTION="USER_MESSAGE_NO_CONNECTION",e.USER_MESSAGE_NOT_LOGIN="USER_MESSAGE_NOT_LOGIN",e.USER_MESSAGE_SERVER_PARAMS_NOTSET="USER_MESSAGE_SERVER_PARAMS_NOTSET",e.USER_MESSAGE_UNKNOWN="USER_MESSAGE_UNKNOWN",e.START_PUBLIC_STREAM_BEFORE_JOIN="START_PUBLIC_STREAM_BEFORE_JOIN",e.RECONNECT_FAILED="RECONNECT_FAILED",e}(qN||{}),YN=function(e){return e[e.AUDIO_MIXING_ERROR_OK=0]="AUDIO_MIXING_ERROR_OK",e[e.AUDIO_MIXING_ERROR_PRELOAD_FAILED=1]="AUDIO_MIXING_ERROR_PRELOAD_FAILED",e[e.AUDIO_MIXING_ERROR_START_FAILED=2]="AUDIO_MIXING_ERROR_START_FAILED",e[e.AUDIO_MIXING_ERROR_ID_NOT_FOUND=3]="AUDIO_MIXING_ERROR_ID_NOT_FOUND",e[e.AUDIO_MIXING_ERROR_SET_POSITION_FAILED=4]="AUDIO_MIXING_ERROR_SET_POSITION_FAILED",e[e.AUDIO_MIXING_ERROR_INVALID_VOLUME=5]="AUDIO_MIXING_ERROR_INVALID_VOLUME",e[e.AUDIO_MIXING_ERROR_LOAD_CONFLICT=6]="AUDIO_MIXING_ERROR_LOAD_CONFLICT",e[e.AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH=7]="AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH",e[e.AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH=8]="AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH",e[e.AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK=9]="AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK",e}(YN||{}),JN=l((function e(t,r,n){c(this,e),h(this,"code",void 0),h(this,"message",void 0),h(this,"error",void 0),this.code=t,this.message=r,this.error=n})),QN=gt,ZN=ke,$N=_a,eD=so,tD=ZN(to.f),rD=ZN([].push),nD=function(e){return function(t){for(var r,n=eD(t),i=$N(n),o=i.length,a=0,s=[];o>a;)r=i[a++],QN&&!tD(n,r)||rD(s,e?[r,n[r]]:n[r]);return s}},iD={entries:nD(!0),values:nD(!1)}.entries;la({target:"Object",stat:!0},{entries:function(e){return iD(e)}});var oD=ai,aD=$a,sD=Re,uD=RangeError,cD=ke,dD=ci,lD=$a,hD=function(e){var t=aD(sD(this)),r="",n=oD(e);if(n<0||n==1/0)throw uD("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},fD=Re,pD=cD(hD),_D=cD("".slice),vD=Math.ceil,mD=function(e){return function(t,r,n){var i,o,a=lD(fD(t)),s=dD(r),u=a.length,c=void 0===n?" ":lD(n);return s<=u||""==c?a:((o=pD(c,vD((i=s-u)/c.length))).length>i&&(o=_D(o,0,i)),e?a+o:o+a)}},yD={start:mD(!1),end:mD(!0)},gD=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Xe),SD=yD.end;la({target:"String",proto:!0,forced:gD},{padEnd:function(e){return SD(this,e,arguments.length>1?arguments[1]:void 0)}});var bD=ec;la({target:"Number",stat:!0,forced:Number.parseInt!=bD},{parseInt:bD});var ED=Dt,kD=Rl,TD=Qn,ID=Ut,AD=Oe,RD=function(e,t,r,n){try{return n?t(ED(r)[0],r[1]):t(r)}catch(RJ){kD(e,"throw",RJ)}},wD=dl,CD=Ri,OD=li,xD=Ad,ND=kl,DD=vl,PD=Array,MD=function(e){var t=AD(e),r=CD(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=TD(i,n>2?arguments[2]:void 0));var a,s,u,c,d,l,h=DD(t),f=0;if(!h||this===PD&&wD(h))for(a=OD(t),s=r?new this(a):PD(a);a>f;f++)l=o?i(t[f],f):t[f],xD(s,f,l);else for(d=(c=ND(t,h)).next,s=r?new this:[];!(u=ID(d,c)).done;f++)l=o?RD(c,i,[u.value,f],!0):u.value,xD(s,f,l);return s.length=f,s},UD=MD;la({target:"Array",stat:!0,forced:!Yl((function(e){Array.from(e)}))},{from:UD});var LD=Math.log,VD=Math.LOG10E;la({target:"Math",stat:!0},{log10:Math.log10||function(e){return LD(e)*VD}});var FD,BD=la,jD=Xn,GD=eo.f,HD=ci,zD=$a,KD=Ja,WD=Re,XD=ts,qD=jD("".startsWith),YD=jD("".slice),JD=Math.min,QD=XD("startsWith"),ZD=!QD&&!!function(){var e=GD(String.prototype,"startsWith");return e&&!e.writable}();BD({target:"String",proto:!0,forced:!ZD&&!QD},{startsWith:function(e){var t=zD(WD(this));KD(e);var r=HD(JD(arguments.length>1?arguments[1]:void 0,t.length)),n=zD(e);return qD?qD(t,n,r):YD(t,r,r+n.length)===n}});var $D=new Uint8Array(16);function eP(){if(!FD&&!(FD="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return FD($D)}var tP=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function rP(e){return"string"==typeof e&&tP.test(e)}for(var nP=[],iP=0;iP<256;++iP)nP.push((iP+256).toString(16).substr(1));function oP(e,t,r){var n=(e=e||{}).random||(e.rng||eP)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(nP[e[t+0]]+nP[e[t+1]]+nP[e[t+2]]+nP[e[t+3]]+"-"+nP[e[t+4]]+nP[e[t+5]]+"-"+nP[e[t+6]]+nP[e[t+7]]+"-"+nP[e[t+8]]+nP[e[t+9]]+"-"+nP[e[t+10]]+nP[e[t+11]]+nP[e[t+12]]+nP[e[t+13]]+nP[e[t+14]]+nP[e[t+15]]).toLowerCase();if(!rP(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var aP=new TextDecoder,sP=new TextEncoder,uP=function(){return oP()},cP=function(){return Date.now()};function dP(e){for(var t=0,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,a=n;o<a.length;o++){var s=a[o];t+=s.length}for(var u=new e(t),c=0,d=0,l=n;d<l.length;d++){var h=l[d];u.set(h,c),c+=h.length}return u}var lP=function(){return"undefined"==typeof window},hP=function(){function e(){c(this,e)}var t,r;return l(e,null,[{key:"token2auth",value:function(t,r,n,i){return i?"Bearer ".concat(i):"Basic ".concat(e.createUnsafeToken(t,r,n))}},{key:"createUnsafeToken",value:function(e,t,r){return window.btoa([e,t,r].filter((function(e){return null!==e})).join(":"))}},{key:"merge",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=0,i=Object.entries(t);n<i.length;n++){var o=E(i[n],2),s=o[0],u=o[1];null!==u&&"object"===a(u)?e.merge(t[s],r[s]):void 0!==r[s]&&(t[s]=r[s])}}},{key:"ab2str",value:function(e){return aP.decode(e)}},{key:"ab2obj",value:function(t){try{var r=e.ab2str(t);return JSON.parse(r)}catch(n){return{}}}},{key:"str2ab",value:function(e){return sP.encode(e).buffer}},{key:"ab2b64str",value:(r=u(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e){var r=new FileReader;r.onload=function(){return e(r.result)},r.readAsDataURL(new Blob([t]))}));case 2:return r=e.sent,e.abrupt("return",r.split(",",2)[1]);case 4:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"b64str2ab",value:(t=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",fetch("data:application/octet;base64,"+t).then((function(e){return e.arrayBuffer()})));case 1:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),e}();function fP(e){return new Promise((function(t){window.setTimeout(t,e)}))}function pP(){var e="none";return lP()||(null!==window.navigator.userAgent.match("Firefox")?e="mozilla":null!==window.navigator.userAgent.match("Chrome")?(e="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(e="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(e="safari")),e}var _P="mozilla"===pP(),vP="safari"===pP(),mP=!lP()&&navigator.userAgent.toLowerCase().includes("mobile");function yP(){for(var e=(+"".concat(Math.random()).slice(-7).padEnd(7,"0")).toString(2).padEnd(28,"1").split(""),t=[];e.length;)t.push(e.splice(0,7));return t.map((function(e,r){var n=r===t.length-1?"0":"1";return Number.parseInt(n+e.join(""),2)}))}var gP=function(){return Math.floor(65535*Math.random())};function SP(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function bP(e){return e.map((function e(t){if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var r=ArrayBuffer.isView(t)?t.buffer:t,n=r.byteLength,i=[];if(n>10){var o=new DataView(r),a=Array.from({length:5}).map((function(e,t){return o.getUint8(t)})),s=Array.from({length:5}).map((function(e,t){return n-1-t})).reverse().map((function(e){return o.getUint8(e)}));i=[].concat(k(a),["..."],k(s))}else i=Array.from(new Uint8Array(r));return"".concat(t.constructor.name,"(").concat(n,") [").concat(i.join(", "),"]")}if(t instanceof ImageData)return"ImageData";if(Array.isArray(t))return t.map(e);if("[object Object]"===Object.prototype.toString.call(t)){var u={};for(var c in t)u[c]=e(t[c]);return u}return t}))}var EP=function(){var e=u(o().mark((function e(){var t,r,n,i=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]&&i[0],e.prev=1,(r=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),r.addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),t&&(r.addTransceiver("audio",{direction:"sendonly"}),r.addTransceiver("video",{direction:"sendonly"})),e.next=9,r.createOffer();case 9:return n=e.sent,r.close(),e.abrupt("return",n.sdp);case 14:e.prev=14,e.t0=e.catch(1);case 16:case"end":return e.stop()}}),e,null,[[1,14]])})));return function(){return e.apply(this,arguments)}}(),kP=function(e){return new Promise((function(t,r){var n=(e=Array.isArray(e)?e:[]).length,i=[];0===n?r([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){n--,i.push(e),0===n&&r(i)}))}))}))};function TP(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function IP(e){return(e&L.AUDIO)===L.AUDIO}function AP(e){return(e&L.VIDEO)===L.VIDEO}function RP(e){var t={};return Object.keys(e).forEach((function(r){"object"===a(e[r])?t[r]=RP(e[r]):r.startsWith("_")||(t[r]=e[r])})),t}function wP(e){var t=new DataView(e.buffer);if(t.byteLength<=4||65535!==t.getUint16(0))return{seiCount:1,seis:[e]};for(var r={seiCount:0,seis:[]},n=!1,i=2;i<t.byteLength;){var o=t.getUint16(i);if(i+=2,t.byteLength-i<o){n=!0;break}var a=new Uint8Array(e.buffer,i,o);if(i+=o,t.byteLength-i>0&&t.byteLength-i<=2){n=!0;break}r.seiCount++,r.seis.push(a)}return n&&(r.seiCount=1,r.seis=[e]),r}function CP(e,t){if("boolean"!=typeof e)throw new JN(qN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function OP(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(e<r||e>n||"number"!=typeof e){var i=new JN(qN.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"));throw i}}function xP(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(null==e)throw new JN(qN.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!UP(e,r,n))throw new JN(qN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(n,"]"))}function NP(e,t,r){if(!r.includes(e))throw new JN(qN.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function DP(e,t){if(LP(e))throw new JN(qN.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function PP(e,t){if(!(e instanceof ArrayBuffer))throw new JN(qN.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function MP(e){try{for(var t=navigator.mediaDevices.getSupportedConstraints(),r=0,n=Object.keys(e);r<n.length;r++){var i=n[r];t[i]||delete e[i]}}catch(o){}}function UP(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.POSITIVE_INFINITY;return"string"==typeof e&&e.length<=r&&e.length>=t}function LP(e){return null==e}function VP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new JN(qN.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function FP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new JN(qN.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function BP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new JN(qN.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function jP(e){DP(e,"userInfo"),FP(e.userId),LP(e.extraInfo)||xP(e.extraInfo,"userInfo.extraInfo",1,200)}function GP(e){DP(e,"roomConfig"),CP(e.isAutoPublish,"roomConfig.isAutoPublish"),CP(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),CP(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}function HP(e){DP(e,"videoPlayerOption")}function zP(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64;if(!e||0===(null==e?void 0:e.byteLength))throw new JN(qN.INVALID_PARAMS,"The message cannot be empty");if((null===(t=e instanceof ArrayBuffer?e:hP.str2ab(JSON.stringify(e)))||void 0===t?void 0:t.byteLength)>1e3*r)throw new JN(qN.INVALID_PARAMS,"The message length must be less than ".concat(r,"K"))}function KP(e){return![ne.onRemoteStreamStats,ne.onLocalStreamStats,ne.onAudioVolumeIndication,ne.onLocalAudioPropertiesReport,ne.onRemoteAudioPropertiesReport].includes(e)}function WP(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new JN(qN.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}var XP={},qP=_t;XP.f=qP;var YP=ae,JP=De,QP=XP,ZP=yt.f,$P=Ut,eM=We,tM=_t,rM=Rn,nM=la,iM=ae,oM=Ut,aM=ke,sM=gt,uM=nt,cM=me,dM=De,lM=Lt,hM=Dt,fM=so,pM=hr,_M=$a,vM=jr,mM=Ma,yM=_a,gM=yo,SM=Ed,bM=Lo,EM=eo,kM=yt,TM=ha,IM=to,AM=Rn,RM=se.exports,wM=Yr,CM=Ve,OM=_t,xM=XP,NM=function(e){var t=YP.Symbol||(YP.Symbol={});JP(t,e)||ZP(t,e,{value:QP.f(e)})},DM=function(){var e=eM("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=tM("toPrimitive");t&&!t[n]&&rM(t,n,(function(e){return $P(r,this)}),{arity:1})},PM=Ac,MM=dn,UM=Gi.forEach,LM=qr("hidden"),VM="Symbol",FM=MM.set,BM=MM.getterFor(VM),jM=Object.prototype,GM=iM.Symbol,HM=GM&&GM.prototype,zM=iM.TypeError,KM=iM.QObject,WM=EM.f,XM=kM.f,qM=SM.f,YM=IM.f,JM=aM([].push),QM=RM("symbols"),ZM=RM("op-symbols"),$M=RM("wks"),eU=!KM||!KM.prototype||!KM.prototype.findChild,tU=sM&&cM((function(){return 7!=mM(XM({},"a",{get:function(){return XM(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=WM(jM,t);n&&delete jM[t],XM(e,t,r),n&&e!==jM&&XM(jM,t,n)}:XM,rU=function(e,t){var r=QM[e]=mM(HM);return FM(r,{type:VM,tag:e,description:t}),sM||(r.description=t),r},nU=function(e,t,r){e===jM&&nU(ZM,t,r),hM(e);var n=pM(t);return hM(r),dM(QM,n)?(r.enumerable?(dM(e,LM)&&e[LM][n]&&(e[LM][n]=!1),r=mM(r,{enumerable:vM(0,!1)})):(dM(e,LM)||XM(e,LM,vM(1,{})),e[LM][n]=!0),tU(e,n,r)):XM(e,n,r)},iU=function(e,t){hM(e);var r=fM(t),n=yM(r).concat(uU(r));return UM(n,(function(t){sM&&!oM(oU,r,t)||nU(e,t,r[t])})),e},oU=function(e){var t=pM(e),r=oM(YM,this,t);return!(this===jM&&dM(QM,t)&&!dM(ZM,t))&&(!(r||!dM(this,t)||!dM(QM,t)||dM(this,LM)&&this[LM][t])||r)},aU=function(e,t){var r=fM(e),n=pM(t);if(r!==jM||!dM(QM,n)||dM(ZM,n)){var i=WM(r,n);return!i||!dM(QM,n)||dM(r,LM)&&r[LM][n]||(i.enumerable=!0),i}},sU=function(e){var t=qM(fM(e)),r=[];return UM(t,(function(e){dM(QM,e)||dM(wM,e)||JM(r,e)})),r},uU=function(e){var t=e===jM,r=qM(t?ZM:fM(e)),n=[];return UM(r,(function(e){!dM(QM,e)||t&&!dM(jM,e)||JM(n,QM[e])})),n};uM||(GM=function(){if(lM(HM,this))throw zM("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?_M(arguments[0]):void 0,t=CM(e),r=function(e){this===jM&&oM(r,ZM,e),dM(this,LM)&&dM(this[LM],t)&&(this[LM][t]=!1),tU(this,t,vM(1,e))};return sM&&eU&&tU(jM,t,{configurable:!0,set:r}),rU(t,e)},AM(HM=GM.prototype,"toString",(function(){return BM(this).tag})),AM(GM,"withoutSetter",(function(e){return rU(CM(e),e)})),IM.f=oU,kM.f=nU,TM.f=iU,EM.f=aU,gM.f=SM.f=sU,bM.f=uU,xM.f=function(e){return rU(OM(e),e)},sM&&(XM(HM,"description",{configurable:!0,get:function(){return BM(this).description}}),AM(jM,"propertyIsEnumerable",oU,{unsafe:!0}))),nM({global:!0,constructor:!0,wrap:!0,forced:!uM,sham:!uM},{Symbol:GM}),UM(yM($M),(function(e){NM(e)})),nM({target:VM,stat:!0,forced:!uM},{useSetter:function(){eU=!0},useSimple:function(){eU=!1}}),nM({target:"Object",stat:!0,forced:!uM,sham:!sM},{create:function(e,t){return void 0===t?mM(e):iU(mM(e),t)},defineProperty:nU,defineProperties:iU,getOwnPropertyDescriptor:aU}),nM({target:"Object",stat:!0,forced:!uM},{getOwnPropertyNames:sU}),DM(),PM(GM,VM),wM[LM]=!0;var cU=nt&&!!Symbol.for&&!!Symbol.keyFor,dU=la,lU=We,hU=De,fU=$a,pU=se.exports,_U=cU,vU=pU("string-to-symbol-registry"),mU=pU("symbol-to-string-registry");dU({target:"Symbol",stat:!0,forced:!_U},{for:function(e){var t=fU(e);if(hU(vU,t))return vU[t];var r=lU("Symbol")(t);return vU[t]=r,mU[r]=t,r}});var yU=la,gU=De,SU=Gt,bU=zt,EU=cU,kU=(0,se.exports)("symbol-to-string-registry");yU({target:"Symbol",stat:!0,forced:!EU},{keyFor:function(e){if(!SU(e))throw TypeError(bU(e)+" is not a symbol");if(gU(kU,e))return kU[e]}});var TU=Lo,IU=Oe;la({target:"Object",stat:!0,forced:!nt||me((function(){TU.f(1)}))},{getOwnPropertySymbols:function(e){var t=TU.f;return t?t(IU(e)):[]}});var AU={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,o||e,a),u=r?r+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);i<o;i++)a[i]=n[i].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,i,o,a){var s=r?r+e:e;if(!this._events[s])return!1;var u,c,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,n),!0;case 4:return d.fn.call(d.context,t,n,i),!0;case 5:return d.fn.call(d.context,t,n,i,o),!0;case 6:return d.fn.call(d.context,t,n,i,o,a),!0}for(c=1,u=new Array(l-1);c<l;c++)u[c-1]=arguments[c];d.fn.apply(d.context,u)}else{var h,f=d.length;for(c=0;c<f;c++)switch(d[c].once&&this.removeListener(e,d[c].fn,void 0,!0),l){case 1:d[c].fn.call(d[c].context);break;case 2:d[c].fn.call(d[c].context,t);break;case 3:d[c].fn.call(d[c].context,t,n);break;case 4:d[c].fn.call(d[c].context,t,n,i);break;default:if(!u)for(h=1,u=new Array(l-1);h<l;h++)u[h-1]=arguments[h];d[c].fn.apply(d[c].context,u)}}return!0},s.prototype.on=function(e,t,r){return o(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,i){var o=r?r+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||a(this,o);else{for(var u=0,c=[],d=s.length;u<d;u++)(s[u].fn!==t||i&&!s[u].once||n&&s[u].context!==n)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(AU);var RU=AU.exports,wU="[VERTC]",CU=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],OU=!lP()&&window.location.search.includes("_rtc_debug_"),xU=function(){function e(t,r,n){c(this,e),h(this,"_indent",void 0),h(this,"_module",void 0),h(this,"_id",void 0),this._module=t,this._indent=r}return l(e,[{key:"print",value:function(e){var t;if(OU){for(var r="",n=0;n<this._indent;n++)r+=" ";for(var i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];(t=console).log.apply(t,["%c".concat(wU).concat(r,"[").concat(this._module,".").concat(e,"] ").concat(o.shift()),"color:".concat(CU[this._indent],";")].concat(o))}}}]),e}(),NU=new xU("VERTC",0),DU=function(e){f(n,e);var t,r=g(n);function n(){return c(this,n),r.apply(this,arguments)}return l(n,[{key:"safeEmit",value:function(e){var t=this.listenerCount(e);try{for(var r,i=arguments.length,o=new Array(i>1?i-1:0),a=1;a<i;a++)o[a-1]=arguments[a];return(r=b(p(n.prototype),"emit",this)).call.apply(r,[this,e].concat(o))}catch(RJ){return NU.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",e,RJ),Boolean(t)}}},{key:"safeEmitAsPromise",value:(t=u(o().mark((function e(t){var r,n,i,a=this,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(r=s.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=s[i];return e.abrupt("return",new Promise((function(e,r){try{a.emit.apply(a,[t].concat(n,[e,r]))}catch(RJ){NU.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",t,RJ),r(RJ)}})));case 2:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),n}(AU.exports.EventEmitter),PU=De,MU=function(e){return void 0!==e&&(PU(e,"value")||PU(e,"writable"))},UU=Ut,LU=Et,VU=Dt,FU=MU,BU=eo,jU=fc;la({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return VU(t)===o?t[r]:(n=BU.f(t,r))?FU(n)?n.value:void 0===n.get?void 0:UU(n.get,o):LU(i=jU(t))?e(i,r,o):void 0}});var GU=ae,HU=Ac;la({global:!0},{Reflect:{}}),HU(GU.Reflect,"Reflect",!0);var zU=la,KU=Ut,WU=Dt,XU=Et,qU=MU,YU=yt,JU=eo,QU=fc,ZU=jr;var $U=me((function(){var e=function(){},t=YU.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));zU({target:"Reflect",stat:!0,forced:$U},{set:function e(t,r,n){var i,o,a,s=arguments.length<4?t:arguments[3],u=JU.f(WU(t),r);if(!u){if(XU(o=QU(t)))return e(o,r,n,s);u=ZU(0)}if(qU(u)){if(!1===u.writable||!XU(s))return!1;if(i=JU.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,YU.f(s,r,i)}else YU.f(s,r,ZU(0,n))}else{if(void 0===(a=u.set))return!1;KU(a,s,n)}return!0}});var eL=la,tL=Oe,rL=li,nL=Lp,iL=V_,oL=Fp,aL=1!==[].unshift(0),sL=!function(){try{Object.defineProperty([],"length",{writable:!1}).unshift()}catch(RJ){return RJ instanceof TypeError}}();eL({target:"Array",proto:!0,arity:1,forced:aL||sL},{unshift:function(e){var t=tL(this),r=rL(t),n=arguments.length;if(n){oL(r+n);for(var i=r;i--;){var o=i+n;i in t?t[o]=t[i]:iL(t,o)}for(var a=0;a<n;a++)t[a]=arguments[a]}return nL(t,r+n)}}),(0,aA.exports)("Uint16",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,aA.exports)("Int32",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var uL={};!function(e){var t="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!==a(n))throw new TypeError(n+"must be non-object");for(var i in n)r(n,i)&&(e[i]=n[i])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){var t,r,n,i,o,a;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(a=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,i),i+=o.length;return a}},i={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){return[].concat.apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,n)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,i))},e.setTyped(t)}(uL);var cL={},dL={},lL={},hL=uL;function fL(e){for(var t=e.length;--t>=0;)e[t]=0}var pL=256,_L=286,vL=30,mL=15,yL=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],gL=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],SL=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],bL=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],EL=new Array(576);fL(EL);var kL=new Array(60);fL(kL);var TL=new Array(512);fL(TL);var IL=new Array(256);fL(IL);var AL=new Array(29);fL(AL);var RL,wL,CL,OL=new Array(vL);function xL(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function NL(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function DL(e){return e<256?TL[e]:TL[256+(e>>>7)]}function PL(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function ML(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,PL(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function UL(e,t,r){ML(e,r[2*t],r[2*t+1])}function LL(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function VL(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=mL;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=LL(o[s]++,s))}}function FL(e){var t;for(t=0;t<_L;t++)e.dyn_ltree[2*t]=0;for(t=0;t<vL;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function BL(e){e.bi_valid>8?PL(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function jL(e,t,r,n){var i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]}function GL(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&jL(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!jL(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function HL(e,t,r){var n,i,o,a,s=0;if(0!==e.last_lit)do{n=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],i=e.pending_buf[e.l_buf+s],s++,0===n?UL(e,i,t):(UL(e,(o=IL[i])+pL+1,t),0!==(a=yL[o])&&ML(e,i-=AL[o],a),UL(e,o=DL(--n),r),0!==(a=gL[o])&&ML(e,n-=OL[o],a))}while(s<e.last_lit);UL(e,256,t)}function zL(e,t){var r,n,i,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,u=t.stat_desc.elems,c=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<u;r++)0!==o[2*r]?(e.heap[++e.heap_len]=c=r,e.depth[r]=0):o[2*r+1]=0;for(;e.heap_len<2;)o[2*(i=e.heap[++e.heap_len]=c<2?++c:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=a[2*i+1]);for(t.max_code=c,r=e.heap_len>>1;r>=1;r--)GL(e,o,r);i=u;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],GL(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,GL(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,o,a,s,u=t.dyn_tree,c=t.max_code,d=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,p=t.stat_desc.max_length,_=0;for(o=0;o<=mL;o++)e.bl_count[o]=0;for(u[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(o=u[2*u[2*(n=e.heap[r])+1]+1]+1)>p&&(o=p,_++),u[2*n+1]=o,n>c||(e.bl_count[o]++,a=0,n>=f&&(a=h[n-f]),s=u[2*n],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*n+1]+a)));if(0!==_){do{for(o=p-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[p]--,_-=2}while(_>0);for(o=p;0!==o;o--)for(n=e.bl_count[o];0!==n;)(i=e.heap[--r])>c||(u[2*i+1]!==o&&(e.opt_len+=(o-u[2*i+1])*u[2*i],u[2*i+1]=o),n--)}}(e,t),VL(o,c,e.bl_count)}function KL(e,t,r){var n,i,o=-1,a=t[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<u&&i===a||(s<c?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4))}function WL(e,t,r){var n,i,o=-1,a=t[1],s=0,u=7,c=4;for(0===a&&(u=138,c=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<u&&i===a)){if(s<c)do{UL(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(UL(e,i,e.bl_tree),s--),UL(e,16,e.bl_tree),ML(e,s-3,2)):s<=10?(UL(e,17,e.bl_tree),ML(e,s-3,3)):(UL(e,18,e.bl_tree),ML(e,s-11,7));s=0,o=i,0===a?(u=138,c=3):i===a?(u=6,c=3):(u=7,c=4)}}fL(OL);var XL=!1;function qL(e,t,r,n){ML(e,0+(n?1:0),3),function(e,t,r,n){BL(e),n&&(PL(e,r),PL(e,~r)),hL.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}lL._tr_init=function(e){XL||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(AL[n]=r,e=0;e<1<<yL[n];e++)IL[r++]=n;for(IL[r-1]=n,i=0,n=0;n<16;n++)for(OL[n]=i,e=0;e<1<<gL[n];e++)TL[i++]=n;for(i>>=7;n<vL;n++)for(OL[n]=i<<7,e=0;e<1<<gL[n]-7;e++)TL[256+i++]=n;for(t=0;t<=mL;t++)o[t]=0;for(e=0;e<=143;)EL[2*e+1]=8,e++,o[8]++;for(;e<=255;)EL[2*e+1]=9,e++,o[9]++;for(;e<=279;)EL[2*e+1]=7,e++,o[7]++;for(;e<=287;)EL[2*e+1]=8,e++,o[8]++;for(VL(EL,287,o),e=0;e<vL;e++)kL[2*e+1]=5,kL[2*e]=LL(e,5);RL=new xL(EL,yL,257,_L,mL),wL=new xL(kL,gL,0,vL,mL),CL=new xL(new Array(0),SL,0,19,7)}(),XL=!0),e.l_desc=new NL(e.dyn_ltree,RL),e.d_desc=new NL(e.dyn_dtree,wL),e.bl_desc=new NL(e.bl_tree,CL),e.bi_buf=0,e.bi_valid=0,FL(e)},lL._tr_stored_block=qL,lL._tr_flush_block=function(e,t,r,n){var i,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<pL;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),zL(e,e.l_desc),zL(e,e.d_desc),a=function(e){var t;for(KL(e,e.dyn_ltree,e.l_desc.max_code),KL(e,e.dyn_dtree,e.d_desc.max_code),zL(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*bL[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?qL(e,t,r,n):4===e.strategy||o===i?(ML(e,2+(n?1:0),3),HL(e,EL,kL)):(ML(e,4+(n?1:0),3),function(e,t,r,n){var i;for(ML(e,t-257,5),ML(e,r-1,5),ML(e,n-4,4),i=0;i<n;i++)ML(e,e.bl_tree[2*bL[i]+1],3);WL(e,e.dyn_ltree,t-1),WL(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),HL(e,e.dyn_ltree,e.dyn_dtree)),FL(e),n&&BL(e)},lL._tr_tally=function(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(IL[r]+pL+1)]++,e.dyn_dtree[2*DL(t)]++),e.last_lit===e.lit_bufsize-1},lL._tr_align=function(e){ML(e,2,3),UL(e,256,EL),function(e){16===e.bi_valid?(PL(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)};var YL=function(e,t,r,n){for(var i=65535&e|0,o=e>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+t[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0};var JL=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var QL,ZL=function(e,t,r,n){var i=JL,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},$L={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},eV=uL,tV=lL,rV=YL,nV=ZL,iV=$L,oV=-2,aV=258,sV=262,uV=103,cV=113,dV=666;function lV(e,t){return e.msg=iV[t],t}function hV(e){return(e<<1)-(e>4?9:0)}function fV(e){for(var t=e.length;--t>=0;)e[t]=0}function pV(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(eV.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function _V(e,t){tV._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,pV(e.strm)}function vV(e,t){e.pending_buf[e.pending++]=t}function mV(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function yV(e,t){var r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,u=e.strstart>e.w_size-sV?e.strstart-(e.w_size-sV):0,c=e.window,d=e.w_mask,l=e.prev,h=e.strstart+aV,f=c[o+a-1],p=c[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(c[(r=t)+a]===p&&c[r+a-1]===f&&c[r]===c[o]&&c[++r]===c[o+1]){o+=2,r++;do{}while(c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&c[++o]===c[++r]&&o<h);if(n=aV-(h-o),o=h-aV,n>a){if(e.match_start=t,a=n,n>=s)break;f=c[o+a-1],p=c[o+a]}}}while((t=l[t&d])>u&&0!=--i);return a<=e.lookahead?a:e.lookahead}function gV(e){var t,r,n,i,o,a,s,u,c,d,l=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-sV)){eV.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=r=e.hash_size;do{n=e.head[--t],e.head[t]=n>=l?n-l:0}while(--r);t=r=l;do{n=e.prev[--t],e.prev[t]=n>=l?n-l:0}while(--r);i+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,u=e.strstart+e.lookahead,c=i,d=void 0,(d=a.avail_in)>c&&(d=c),r=0===d?0:(a.avail_in-=d,eV.arraySet(s,a.input,a.next_in,d,u),1===a.state.wrap?a.adler=rV(a.adler,s,d,u):2===a.state.wrap&&(a.adler=nV(a.adler,s,d,u)),a.next_in+=d,a.total_in+=d,d),e.lookahead+=r,e.lookahead+e.insert>=3)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+3-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<sV&&0!==e.strm.avail_in)}function SV(e,t){for(var r,n;;){if(e.lookahead<sV){if(gV(e),e.lookahead<sV&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-sV&&(e.match_length=yV(e,r)),e.match_length>=3)if(n=tV._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=tV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(_V(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(_V(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(_V(e,!1),0===e.strm.avail_out)?1:2}function bV(e,t){for(var r,n,i;;){if(e.lookahead<sV){if(gV(e),e.lookahead<sV&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-sV&&(e.match_length=yV(e,r),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,n=tV._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(_V(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=tV._tr_tally(e,0,e.window[e.strstart-1]))&&_V(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=tV._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(_V(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(_V(e,!1),0===e.strm.avail_out)?1:2}function EV(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function kV(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new eV.Buf16(1146),this.dyn_dtree=new eV.Buf16(122),this.bl_tree=new eV.Buf16(78),fV(this.dyn_ltree),fV(this.dyn_dtree),fV(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new eV.Buf16(16),this.heap=new eV.Buf16(573),fV(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new eV.Buf16(573),fV(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function TV(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:cV,e.adler=2===t.wrap?0:1,t.last_flush=0,tV._tr_init(t),0):lV(e,oV)}function IV(e){var t,r=TV(e);return 0===r&&((t=e.state).window_size=2*t.w_size,fV(t.head),t.max_lazy_match=QL[t.level].max_lazy,t.good_match=QL[t.level].good_length,t.nice_match=QL[t.level].nice_length,t.max_chain_length=QL[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),r}function AV(e,t,r,n,i,o){if(!e)return oV;var a=1;if(-1===t&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>9||8!==r||n<8||n>15||t<0||t>9||o<0||o>4)return lV(e,oV);8===n&&(n=9);var s=new kV;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new eV.Buf8(2*s.w_size),s.head=new eV.Buf16(s.hash_size),s.prev=new eV.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new eV.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=o,s.method=r,IV(e)}QL=[new EV(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(gV(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,_V(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-sV&&(_V(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(_V(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(_V(e,!1),e.strm.avail_out),1)})),new EV(4,4,8,4,SV),new EV(4,5,16,8,SV),new EV(4,6,32,32,SV),new EV(4,4,16,16,bV),new EV(8,16,32,32,bV),new EV(8,16,128,128,bV),new EV(8,32,128,256,bV),new EV(32,128,258,1024,bV),new EV(32,258,258,4096,bV)],dL.deflateInit=function(e,t){return AV(e,t,8,15,8,0)},dL.deflateInit2=AV,dL.deflateReset=IV,dL.deflateResetKeep=TV,dL.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?oV:(e.state.gzhead=t,0):oV},dL.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?lV(e,oV):oV;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===dV&&4!==t)return lV(e,0===e.avail_out?-5:oV);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,vV(n,31),vV(n,139),vV(n,8),n.gzhead?(vV(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),vV(n,255&n.gzhead.time),vV(n,n.gzhead.time>>8&255),vV(n,n.gzhead.time>>16&255),vV(n,n.gzhead.time>>24&255),vV(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),vV(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(vV(n,255&n.gzhead.extra.length),vV(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=nV(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(vV(n,0),vV(n,0),vV(n,0),vV(n,0),vV(n,0),vV(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),vV(n,3),n.status=cV);else{var a=8+(n.w_bits-8<<4)<<8;a|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=cV,mV(n,a),0!==n.strstart&&(mV(n,e.adler>>>16),mV(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=nV(e.adler,n.pending_buf,n.pending-i,i)),pV(e),i=n.pending,n.pending!==n.pending_buf_size));)vV(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=nV(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=nV(e.adler,n.pending_buf,n.pending-i,i)),pV(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,vV(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=nV(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=nV(e.adler,n.pending_buf,n.pending-i,i)),pV(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,vV(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=nV(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=uV)}else n.status=uV;if(n.status===uV&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&pV(e),n.pending+2<=n.pending_buf_size&&(vV(n,255&e.adler),vV(n,e.adler>>8&255),e.adler=0,n.status=cV)):n.status=cV),0!==n.pending){if(pV(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&hV(t)<=hV(r)&&4!==t)return lV(e,-5);if(n.status===dV&&0!==e.avail_in)return lV(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==dV){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(gV(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=tV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(_V(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(_V(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(_V(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,a=e.window;;){if(e.lookahead<=aV){if(gV(e),e.lookahead<=aV&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=a[i=e.strstart-1])===a[++i]&&n===a[++i]&&n===a[++i]){o=e.strstart+aV;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=aV-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=tV._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=tV._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(_V(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(_V(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(_V(e,!1),0===e.strm.avail_out)?1:2}(n,t):QL[n.level].func(n,t);if(3!==s&&4!==s||(n.status=dV),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?tV._tr_align(n):5!==t&&(tV._tr_stored_block(n,0,0,!1),3===t&&(fV(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),pV(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(vV(n,255&e.adler),vV(n,e.adler>>8&255),vV(n,e.adler>>16&255),vV(n,e.adler>>24&255),vV(n,255&e.total_in),vV(n,e.total_in>>8&255),vV(n,e.total_in>>16&255),vV(n,e.total_in>>24&255)):(mV(n,e.adler>>>16),mV(n,65535&e.adler)),pV(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},dL.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==uV&&t!==cV&&t!==dV?lV(e,oV):(e.state=null,t===cV?lV(e,-3):0):oV},dL.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,u,c,d=t.length;if(!e||!e.state)return oV;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return oV;for(1===o&&(e.adler=rV(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(fV(r.head),r.strstart=0,r.block_start=0,r.insert=0),c=new eV.Buf8(r.w_size),eV.arraySet(c,t,d-r.w_size,r.w_size,0),t=c,d=r.w_size),a=e.avail_in,s=e.next_in,u=e.input,e.avail_in=d,e.next_in=0,e.input=t,gV(r);r.lookahead>=3;){n=r.strstart,i=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++}while(--i);r.strstart=n,r.lookahead=2,gV(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=s,e.input=u,e.avail_in=a,r.wrap=o,0},dL.deflateInfo="pako deflate (from Nodeca project)";var RV={},wV=uL,CV=!0,OV=!0;try{String.fromCharCode.apply(null,[0])}catch(wJ){CV=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(wJ){OV=!1}for(var xV=new wV.Buf8(256),NV=0;NV<256;NV++)xV[NV]=NV>=252?6:NV>=248?5:NV>=240?4:NV>=224?3:NV>=192?2:1;function DV(e,t){if(t<65534&&(e.subarray&&OV||!e.subarray&&CV))return String.fromCharCode.apply(null,wV.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}xV[254]=xV[254]=1,RV.string2buf=function(e){var t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new wV.Buf8(s),o=0,i=0;o<s;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},RV.buf2binstring=function(e){return DV(e,e.length)},RV.binstring2buf=function(e){for(var t=new wV.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},RV.buf2string=function(e,t){var r,n,i,o,a=t||e.length,s=new Array(2*a);for(n=0,r=0;r<a;)if((i=e[r++])<128)s[n++]=i;else if((o=xV[i])>4)s[n++]=65533,r+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&r<a;)i=i<<6|63&e[r++],o--;o>1?s[n++]=65533:i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|1023&i)}return DV(s,n)},RV.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+xV[e[r]]>t?r:t};var PV=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},MV=dL,UV=uL,LV=RV,VV=$L,FV=PV,BV=Object.prototype.toString;function jV(e){if(!(this instanceof jV))return new jV(e);this.options=UV.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new FV,this.strm.avail_out=0;var r=MV.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(VV[r]);if(t.header&&MV.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?LV.string2buf(t.dictionary):"[object ArrayBuffer]"===BV.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=MV.deflateSetDictionary(this.strm,n)))throw new Error(VV[r]);this._dict_set=!0}}function GV(e,t){var r=new jV(t);if(r.push(e,!0),r.err)throw r.msg||VV[r.err];return r.result}jV.prototype.push=function(e,t){var r,n,i=this.strm,o=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:!0===t?4:0,"string"==typeof e?i.input=LV.string2buf(e):"[object ArrayBuffer]"===BV.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new UV.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=MV.deflate(i,n))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==i.avail_out&&(0!==i.avail_in||4!==n&&2!==n)||("string"===this.options.to?this.onData(LV.buf2binstring(UV.shrinkBuf(i.output,i.next_out))):this.onData(UV.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=MV.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},jV.prototype.onData=function(e){this.chunks.push(e)},jV.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=UV.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},cL.Deflate=jV,cL.deflate=GV,cL.deflateRaw=function(e,t){return(t=t||{}).raw=!0,GV(e,t)},cL.gzip=function(e,t){return(t=t||{}).gzip=!0,GV(e,t)};var HV={},zV=gt,KV=fg,WV=cs,XV=me,qV=ae.RegExp,YV=qV.prototype,JV=zV&&XV((function(){var e=!0;try{qV(".","d")}catch(RJ){e=!1}var t={},r="",n=e?"dgimsy":"gimsy",i=function(e,n){Object.defineProperty(t,e,{get:function(){return r+=n,!0}})},o={dotAll:"s",global:"g",ignoreCase:"i",multiline:"m",sticky:"y"};for(var a in e&&(o.hasIndices="d"),o)i(a,o[a]);return Object.getOwnPropertyDescriptor(YV,"flags").get.call(t)!==n||r!==n}));JV&&KV(YV,"flags",{configurable:!0,get:WV});var QV={},ZV=uL,$V=15,eF=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],tF=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],rF=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],nF=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],iF=uL,oF=YL,aF=ZL,sF=function(e,t){var r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,y,g,S,b,E,k,T,I,A;r=e.state,n=e.next_in,I=e.input,i=n+(e.avail_in-5),o=e.next_out,A=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),u=r.dmax,c=r.wsize,d=r.whave,l=r.wnext,h=r.window,f=r.hold,p=r.bits,_=r.lencode,v=r.distcode,m=(1<<r.lenbits)-1,y=(1<<r.distbits)-1;e:do{p<15&&(f+=I[n++]<<p,p+=8,f+=I[n++]<<p,p+=8),g=_[f&m];t:for(;;){if(f>>>=S=g>>>24,p-=S,0===(S=g>>>16&255))A[o++]=65535&g;else{if(!(16&S)){if(0==(64&S)){g=_[(65535&g)+(f&(1<<S)-1)];continue t}if(32&S){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}b=65535&g,(S&=15)&&(p<S&&(f+=I[n++]<<p,p+=8),b+=f&(1<<S)-1,f>>>=S,p-=S),p<15&&(f+=I[n++]<<p,p+=8,f+=I[n++]<<p,p+=8),g=v[f&y];r:for(;;){if(f>>>=S=g>>>24,p-=S,!(16&(S=g>>>16&255))){if(0==(64&S)){g=v[(65535&g)+(f&(1<<S)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(E=65535&g,p<(S&=15)&&(f+=I[n++]<<p,(p+=8)<S&&(f+=I[n++]<<p,p+=8)),(E+=f&(1<<S)-1)>u){e.msg="invalid distance too far back",r.mode=30;break e}if(f>>>=S,p-=S,E>(S=o-a)){if((S=E-S)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(k=0,T=h,0===l){if(k+=c-S,S<b){b-=S;do{A[o++]=h[k++]}while(--S);k=o-E,T=A}}else if(l<S){if(k+=c+l-S,(S-=l)<b){b-=S;do{A[o++]=h[k++]}while(--S);if(k=0,l<b){b-=S=l;do{A[o++]=h[k++]}while(--S);k=o-E,T=A}}}else if(k+=l-S,S<b){b-=S;do{A[o++]=h[k++]}while(--S);k=o-E,T=A}for(;b>2;)A[o++]=T[k++],A[o++]=T[k++],A[o++]=T[k++],b-=3;b&&(A[o++]=T[k++],b>1&&(A[o++]=T[k++]))}else{k=o-E;do{A[o++]=A[k++],A[o++]=A[k++],A[o++]=A[k++],b-=3}while(b>2);b&&(A[o++]=A[k++],b>1&&(A[o++]=A[k++]))}break}}break}}while(n<i&&o<s);n-=b=p>>3,f&=(1<<(p-=b<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=f,r.bits=p},uF=function(e,t,r,n,i,o,a,s){var u,c,d,l,h,f,p,_,v,m=s.bits,y=0,g=0,S=0,b=0,E=0,k=0,T=0,I=0,A=0,R=0,w=null,C=0,O=new ZV.Buf16(16),x=new ZV.Buf16(16),N=null,D=0;for(y=0;y<=$V;y++)O[y]=0;for(g=0;g<n;g++)O[t[r+g]]++;for(E=m,b=$V;b>=1&&0===O[b];b--);if(E>b&&(E=b),0===b)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(S=1;S<b&&0===O[S];S++);for(E<S&&(E=S),I=1,y=1;y<=$V;y++)if(I<<=1,(I-=O[y])<0)return-1;if(I>0&&(0===e||1!==b))return-1;for(x[1]=0,y=1;y<$V;y++)x[y+1]=x[y]+O[y];for(g=0;g<n;g++)0!==t[r+g]&&(a[x[t[r+g]]++]=g);if(0===e?(w=N=a,f=19):1===e?(w=eF,C-=257,N=tF,D-=257,f=256):(w=rF,N=nF,f=-1),R=0,g=0,y=S,h=o,k=E,T=0,d=-1,l=(A=1<<E)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){p=y-T,a[g]<f?(_=0,v=a[g]):a[g]>f?(_=N[D+a[g]],v=w[C+a[g]]):(_=96,v=0),u=1<<y-T,S=c=1<<k;do{i[h+(R>>T)+(c-=u)]=p<<24|_<<16|v|0}while(0!==c);for(u=1<<y-1;R&u;)u>>=1;if(0!==u?(R&=u-1,R+=u):R=0,g++,0==--O[y]){if(y===b)break;y=t[r+a[g]]}if(y>E&&(R&l)!==d){for(0===T&&(T=E),h+=S,I=1<<(k=y-T);k+T<b&&!((I-=O[k+T])<=0);)k++,I<<=1;if(A+=1<<k,1===e&&A>852||2===e&&A>592)return 1;i[d=R&l]=E<<24|k<<16|h-o|0}}return 0!==R&&(i[h+R]=y-T<<24|64<<16|0),s.bits=E,0},cF=-2,dF=12,lF=30;function hF(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function fF(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new iF.Buf16(320),this.work=new iF.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function pF(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new iF.Buf32(852),t.distcode=t.distdyn=new iF.Buf32(592),t.sane=1,t.back=-1,0):cF}function _F(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,pF(e)):cF}function vF(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?cF:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,_F(e))):cF}function mF(e,t){var r,n;return e?(n=new fF,e.state=n,n.window=null,0!==(r=vF(e,t))&&(e.state=null),r):cF}var yF,gF,SF=!0;function bF(e){if(SF){var t;for(yF=new iF.Buf32(512),gF=new iF.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(uF(1,e.lens,0,288,yF,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;uF(2,e.lens,0,32,gF,0,e.work,{bits:5}),SF=!1}e.lencode=yF,e.lenbits=9,e.distcode=gF,e.distbits=5}function EF(e,t,r,n){var i,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new iF.Buf8(o.wsize)),n>=o.wsize?(iF.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>n&&(i=n),iF.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(iF.arraySet(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0}QV.inflateReset=_F,QV.inflateReset2=vF,QV.inflateResetKeep=pF,QV.inflateInit=function(e){return mF(e,15)},QV.inflateInit2=mF,QV.inflate=function(e,t){var r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,y,g,S,b,E,k,T,I,A=0,R=new iF.Buf8(4),w=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return cF;(r=e.state).mode===dF&&(r.mode=13),a=e.next_out,i=e.output,u=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,c=r.hold,d=r.bits,l=s,h=u,k=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;d<16;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(2&r.wrap&&35615===c){r.check=0,R[0]=255&c,R[1]=c>>>8&255,r.check=aF(r.check,R,2,0),c=0,d=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&c)<<8)+(c>>8))%31){e.msg="incorrect header check",r.mode=lF;break}if(8!=(15&c)){e.msg="unknown compression method",r.mode=lF;break}if(d-=4,E=8+(15&(c>>>=4)),0===r.wbits)r.wbits=E;else if(E>r.wbits){e.msg="invalid window size",r.mode=lF;break}r.dmax=1<<E,e.adler=r.check=1,r.mode=512&c?10:dF,c=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(r.flags=c,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=lF;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=lF;break}r.head&&(r.head.text=c>>8&1),512&r.flags&&(R[0]=255&c,R[1]=c>>>8&255,r.check=aF(r.check,R,2,0)),c=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.head&&(r.head.time=c),512&r.flags&&(R[0]=255&c,R[1]=c>>>8&255,R[2]=c>>>16&255,R[3]=c>>>24&255,r.check=aF(r.check,R,4,0)),c=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.head&&(r.head.xflags=255&c,r.head.os=c>>8),512&r.flags&&(R[0]=255&c,R[1]=c>>>8&255,r.check=aF(r.check,R,2,0)),c=0,d=0,r.mode=5;case 5:if(1024&r.flags){for(;d<16;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.length=c,r.head&&(r.head.extra_len=c),512&r.flags&&(R[0]=255&c,R[1]=c>>>8&255,r.check=aF(r.check,R,2,0)),c=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((f=r.length)>s&&(f=s),f&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),iF.arraySet(r.head.extra,n,o,f,E)),512&r.flags&&(r.check=aF(r.check,n,f,o)),s-=f,o+=f,r.length-=f),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break e;f=0;do{E=n[o+f++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E))}while(E&&f<s);if(512&r.flags&&(r.check=aF(r.check,n,f,o)),s-=f,o+=f,E)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===s)break e;f=0;do{E=n[o+f++],r.head&&E&&r.length<65536&&(r.head.comment+=String.fromCharCode(E))}while(E&&f<s);if(512&r.flags&&(r.check=aF(r.check,n,f,o)),s-=f,o+=f,E)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;d<16;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(c!==(65535&r.check)){e.msg="header crc mismatch",r.mode=lF;break}c=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=dF;break;case 10:for(;d<32;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}e.adler=r.check=hF(c),c=0,d=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=a,e.avail_out=u,e.next_in=o,e.avail_in=s,r.hold=c,r.bits=d,2;e.adler=r.check=1,r.mode=dF;case dF:if(5===t||6===t)break e;case 13:if(r.last){c>>>=7&d,d-=7&d,r.mode=27;break}for(;d<3;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}switch(r.last=1&c,d-=1,3&(c>>>=1)){case 0:r.mode=14;break;case 1:if(bF(r),r.mode=20,6===t){c>>>=2,d-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=lF}c>>>=2,d-=2;break;case 14:for(c>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if((65535&c)!=(c>>>16^65535)){e.msg="invalid stored block lengths",r.mode=lF;break}if(r.length=65535&c,c=0,d=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(f=r.length){if(f>s&&(f=s),f>u&&(f=u),0===f)break e;iF.arraySet(i,n,o,f,a),s-=f,o+=f,u-=f,a+=f,r.length-=f;break}r.mode=dF;break;case 17:for(;d<14;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(r.nlen=257+(31&c),c>>>=5,d-=5,r.ndist=1+(31&c),c>>>=5,d-=5,r.ncode=4+(15&c),c>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=lF;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.lens[w[r.have++]]=7&c,c>>>=3,d-=3}for(;r.have<19;)r.lens[w[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,T={bits:r.lenbits},k=uF(0,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid code lengths set",r.mode=lF;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(A=r.lencode[c&(1<<r.lenbits)-1])>>>16&255,y=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(y<16)c>>>=v,d-=v,r.lens[r.have++]=y;else{if(16===y){for(I=v+2;d<I;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(c>>>=v,d-=v,0===r.have){e.msg="invalid bit length repeat",r.mode=lF;break}E=r.lens[r.have-1],f=3+(3&c),c>>>=2,d-=2}else if(17===y){for(I=v+3;d<I;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}d-=v,E=0,f=3+(7&(c>>>=v)),c>>>=3,d-=3}else{for(I=v+7;d<I;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}d-=v,E=0,f=11+(127&(c>>>=v)),c>>>=7,d-=7}if(r.have+f>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=lF;break}for(;f--;)r.lens[r.have++]=E}}if(r.mode===lF)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=lF;break}if(r.lenbits=9,T={bits:r.lenbits},k=uF(1,r.lens,0,r.nlen,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid literal/lengths set",r.mode=lF;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},k=uF(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,T),r.distbits=T.bits,k){e.msg="invalid distances set",r.mode=lF;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(s>=6&&u>=258){e.next_out=a,e.avail_out=u,e.next_in=o,e.avail_in=s,r.hold=c,r.bits=d,sF(e,h),a=e.next_out,i=e.output,u=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,c=r.hold,d=r.bits,r.mode===dF&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[c&(1<<r.lenbits)-1])>>>16&255,y=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(g=v,S=m,b=y;m=(A=r.lencode[b+((c&(1<<g+S)-1)>>g)])>>>16&255,y=65535&A,!(g+(v=A>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}c>>>=g,d-=g,r.back+=g}if(c>>>=v,d-=v,r.back+=v,r.length=y,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=dF;break}if(64&m){e.msg="invalid literal/length code",r.mode=lF;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(I=r.extra;d<I;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.length+=c&(1<<r.extra)-1,c>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(A=r.distcode[c&(1<<r.distbits)-1])>>>16&255,y=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(0==(240&m)){for(g=v,S=m,b=y;m=(A=r.distcode[b+((c&(1<<g+S)-1)>>g)])>>>16&255,y=65535&A,!(g+(v=A>>>24)<=d);){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}c>>>=g,d-=g,r.back+=g}if(c>>>=v,d-=v,r.back+=v,64&m){e.msg="invalid distance code",r.mode=lF;break}r.offset=y,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(I=r.extra;d<I;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}r.offset+=c&(1<<r.extra)-1,c>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=lF;break}r.mode=25;case 25:if(0===u)break e;if(f=h-u,r.offset>f){if((f=r.offset-f)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=lF;break}f>r.wnext?(f-=r.wnext,p=r.wsize-f):p=r.wnext-f,f>r.length&&(f=r.length),_=r.window}else _=i,p=a-r.offset,f=r.length;f>u&&(f=u),u-=f,r.length-=f;do{i[a++]=_[p++]}while(--f);0===r.length&&(r.mode=21);break;case 26:if(0===u)break e;i[a++]=r.length,u--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,c|=n[o++]<<d,d+=8}if(h-=u,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=r.flags?aF(r.check,i,h,a-h):oF(r.check,i,h,a-h)),h=u,(r.flags?c:hF(c))!==r.check){e.msg="incorrect data check",r.mode=lF;break}c=0,d=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;d<32;){if(0===s)break e;s--,c+=n[o++]<<d,d+=8}if(c!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=lF;break}c=0,d=0}r.mode=29;case 29:k=1;break e;case lF:k=-3;break e;case 31:return-4;default:return cF}return e.next_out=a,e.avail_out=u,e.next_in=o,e.avail_in=s,r.hold=c,r.bits=d,(r.wsize||h!==e.avail_out&&r.mode<lF&&(r.mode<27||4!==t))&&EF(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,r.total+=h,r.wrap&&h&&(e.adler=r.check=r.flags?aF(r.check,i,h,e.next_out-h):oF(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===dF?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===k&&(k=-5),k},QV.inflateEnd=function(e){if(!e||!e.state)return cF;var t=e.state;return t.window&&(t.window=null),e.state=null,0},QV.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?cF:(r.head=t,t.done=!1,0):cF},QV.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?cF:11===r.mode&&oF(1,t,n,0)!==r.check?-3:EF(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):cF},QV.inflateInfo="pako inflate (from Nodeca project)";var kF={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var TF=QV,IF=uL,AF=RV,RF=kF,wF=$L,CF=PV,OF=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},xF=Object.prototype.toString;function NF(e){if(!(this instanceof NF))return new NF(e);this.options=IF.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new CF,this.strm.avail_out=0;var r=TF.inflateInit2(this.strm,t.windowBits);if(r!==RF.Z_OK)throw new Error(wF[r]);if(this.header=new OF,TF.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=AF.string2buf(t.dictionary):"[object ArrayBuffer]"===xF.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=TF.inflateSetDictionary(this.strm,t.dictionary))!==RF.Z_OK))throw new Error(wF[r])}function DF(e,t){var r=new NF(t);if(r.push(e,!0),r.err)throw r.msg||wF[r.err];return r.result}NF.prototype.push=function(e,t){var r,n,i,o,a,s=this.strm,u=this.options.chunkSize,c=this.options.dictionary,d=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?RF.Z_FINISH:RF.Z_NO_FLUSH,"string"==typeof e?s.input=AF.binstring2buf(e):"[object ArrayBuffer]"===xF.call(e)?s.input=new Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new IF.Buf8(u),s.next_out=0,s.avail_out=u),(r=TF.inflate(s,RF.Z_NO_FLUSH))===RF.Z_NEED_DICT&&c&&(r=TF.inflateSetDictionary(this.strm,c)),r===RF.Z_BUF_ERROR&&!0===d&&(r=RF.Z_OK,d=!1),r!==RF.Z_STREAM_END&&r!==RF.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==RF.Z_STREAM_END&&(0!==s.avail_in||n!==RF.Z_FINISH&&n!==RF.Z_SYNC_FLUSH)||("string"===this.options.to?(i=AF.utf8border(s.output,s.next_out),o=s.next_out-i,a=AF.buf2string(s.output,i),s.next_out=o,s.avail_out=u-o,o&&IF.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(IF.shrinkBuf(s.output,s.next_out)))),0===s.avail_in&&0===s.avail_out&&(d=!0)}while((s.avail_in>0||0===s.avail_out)&&r!==RF.Z_STREAM_END);return r===RF.Z_STREAM_END&&(n=RF.Z_FINISH),n===RF.Z_FINISH?(r=TF.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===RF.Z_OK):n!==RF.Z_SYNC_FLUSH||(this.onEnd(RF.Z_OK),s.avail_out=0,!0)},NF.prototype.onData=function(e){this.chunks.push(e)},NF.prototype.onEnd=function(e){e===RF.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=IF.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},HV.Inflate=NF,HV.inflate=DF,HV.inflateRaw=function(e,t){return(t=t||{}).raw=!0,DF(e,t)},HV.ungzip=DF;var PF={};(0,uL.assign)(PF,cL,HV,kF);var MF=PF,UF=function(e){return e.RTC="rtc",e}(UF||{}),LF=function(e){return e.W_5="5",e}(LF||{}),VF=function(e){return e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux",e}(VF||{}),FF=function(e){return e.REQUEST="request",e.RESPONSE="response",e}(FF||{}),BF=function(e){return e.WEBSOCKET_RECONNECTING="websocket reconnecting",e.PEERCONNECTION_RECONNECTING="peerconnection reconnecting",e.DISCONNECTED="DISCONNECTED",e.LAN="LAN",e.WIFI="WIFI",e.W_2="2G",e.W_3="3G",e.W_4="4G",e.W_5="5G",e.UNKNOWN="UNKNOWN",e}(BF||{}),jF=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(jF||{}),GF=function(e){return e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected",e}(GF||{}),HF=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(HF||{}),zF=function(e){return e.REQUEST="request",e.RESPONSE="response",e.KCP_REQUEST="kcp request",e.KCP_RESPONSE="kcp response",e.QUIC_REQUEST="quic request",e.QUIC_RESPONSE="quic response",e}(zF||{}),KF=function(e){return e.NEW="NEW",e.CHECKING="CHECKING",e.CONNECTED="CONNECTED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.DISCONNECTED="DISCONNECTED",e.CLOSED="CLOSED",e.DATACHANNEL_CONNECTING="DATACHANNEL_CONNECTING",e.DATACHANNEL_OPEN="DATACHANNEL_OPEN",e.DATACHANNEL_CLOSING="DATACHANNEL_CLOSING",e.DATACHANNEL_CLOSED="DATACHANNEL_CLOSED",e}(KF||{}),WF=function(e){return e.SUCCEED="succeed",e.MESSAGE_ID_ERROR="message id error",e.ZIP_FAILED="zip failed",e.UNZIP_FAILED="unzip failed",e.MESSAGE_KEY_EMPTY="message key empty",e.MESSAGE_KEY_PARSE_FAILED="message key parse failed",e.MESSAGE_KEY_INVALID="message key invalid",e.ENCRYPT_FAILED="encrypt failed",e.DECRYPT_FAILED="decrypt failed",e.MESSAGE_TOO_BIG="message too big",e.INVALID_DATA="invalid data",e.MESSAGE_PARSE_FAILED="message parse failed",e}(WF||{}),XF=function(e){return e.UP="up",e.DOWN="down",e.DIRECT="direct",e}(XF||{}),qF=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(qF||{}),YF=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(YF||{}),JF=function(e){return e.W_0="0",e.W_1="1",e}(JF||{}),QF=function(e){return e.UP="up",e.DOWN="down",e}(QF||{}),ZF=function(e){return e.ANSWER="answer",e.INCRANSWER="incranswer",e}(ZF||{}),$F=function(e){return e.UP="up",e.DOWN="down",e}($F||{}),eB=function(e){return e.SUCCESS="success",e.FAIL="fail",e}(eB||{}),tB=function(e){return e.W_0="0",e.W_1="1",e}(tB||{}),rB=function(e){return e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.JOIN_ROOM_ACK_FAILED="join room ack failed",e.UNKNOWN="unknown",e}(rB||{}),nB=function(e){return e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore",e}(nB||{}),iB=function(e){return e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.ON_STREAM_REMOVE="on stream remove",e.PUBLISH_MUTE="publish mute",e.UNKNOWN="unknown",e.ON_STREAM_REMOVE_CLIENT_UNPUBLISHED="on stream remove:client unpublished",e.ON_STREAM_REMOVE_PUBLISH_FAILED="on stream remove:publish failed",e.ON_STREAM_REMOVE_STREAM_REMOVED="on stream remove:stream removed",e.ON_STREAM_REMOVE_CLIENT_DISCONNECTED="on stream remove:client disconnected",e.ON_STREAM_REMOVE_CLIENT_REPUBLISH="on stream remove:client republish",e}(iB||{}),oB=function(e){return e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown",e}(oB||{}),aB=function(e){return e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end",e}(aB||{}),sB=function(e){return e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio",e}(sB||{}),uB=function(e){return e.LOGIN="login",e.PUBLISHER="publisher",e.UNMUTE="unmute",e.ENABLE="enable",e.PUSH="push",e.PUBLISH="publish",e.ONDEMAND="ondemand",e.SUBSCRIBE="subscribe",e.PUSH_TRACK="push_track",e.REMOTE_UNMUTE="remote_unmute",e.P2P="p2p",e}(uB||{}),cB=function(e){return e.TIMEOUT="timeout",e.AUDIENCE="audience",e.MUTE="mute",e.DISABLE="disable",e.STOP_PUSH="stop_push",e.UNPUBLISH="unpublish",e.NO_DEMAND="no_demand",e.LEAVE_ROOM="leave_room",e.UNSUBSCRIBE="unsubscribe",e.REMOVE_TRACK="remove_track",e.REMOTE_MUTE="remote_mute",e.USER_LEAVE="user_leave",e}(cB||{}),dB=function(e){return e.BEGIN="begin",e.END="end",e}(dB||{}),lB=function(e){return e.BEGIN="begin",e.END="end",e}(lB||{}),hB=function(e){return e.LEAVE_ROOM="leave_room",e.ACK_FAILED="ack_failed",e.TOKEN_ERROR="token_error",e.SIGNALING_ERROR="signaling_error",e.TIMEOUT_10="timeout_10",e.TIMEOUT_60="timeout_60",e}(hB||{}),fB=function(e){return e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server",e}(fB||{}),pB=function(e){return e.START="start",e.START_CAPTURE_RESULT="start_capture_result",e.STARTED="started",e.RUNNING_FAILED="running_failed",e.STOP="stop",e.STOPPED="stopped",e}(pB||{}),_B=function(e){return e.SUCCESS="success",e.CAMERA_DEVICE_NO_PERMISSION="camera_device_no_permission",e.CAMERA_DEVICE_BUSY="camera_device_busy",e.CAMERA_DEVICE_FAILURE="camera_device_failure",e.CAMERA_DEVICE_NOT_FOUND="camera_device_not_found",e.CAMERA_DEVICE_DISCONNECTED="camera_device_disconnected",e.TIMEOUT="timeout",e.ABORT="abort",e}(_B||{}),vB=function(){function e(t){c(this,e),h(this,"_event_key",void 0),h(this,"_device_id",void 0),h(this,"_rtc_app_id",void 0),h(this,"_product_line",void 0),h(this,"_report_version",void 0),h(this,"_os",void 0),h(this,"_rtc_sdk_version",void 0),h(this,"_rtc_timestamp",void 0),h(this,"_rtc_sdk_git_commit",void 0),h(this,"_report_id",void 0),h(this,"_connection_id",void 0),h(this,"_rtc_sid",void 0),h(this,"_engine_session_id",void 0),h(this,"_rtc_business_id",void 0),h(this,"_project_key",void 0),h(this,"_network_type",void 0),h(this,"_app_version",void 0),h(this,"_aid",void 0),h(this,"_device_model",void 0),h(this,"_device_brand",void 0),h(this,"_common_extra_info",void 0),h(this,"_had_selected_p2p",void 0),h(this,"_rtc_env_type",void 0),h(this,"_room_id",void 0),h(this,"_user_id",void 0),h(this,"_rtc_session_id",void 0),h(this,"_user_agent",void 0),h(this,"_auto_play_policy",void 0),this.monitor=t}return l(e,[{key:"setStats",value:function(e){var t=this;Object.keys(e).forEach((function(r){t["_"+r]=e[r]})),this.monitor.StartUp()}},{key:"event_key",get:function(){return this._event_key}},{key:"device_id",get:function(){return this._device_id}},{key:"rtc_app_id",get:function(){return this._rtc_app_id}},{key:"product_line",get:function(){return this._product_line}},{key:"report_version",get:function(){return this._report_version}},{key:"os",get:function(){return this._os}},{key:"rtc_sdk_version",get:function(){return this._rtc_sdk_version}},{key:"rtc_timestamp",get:function(){return this._rtc_timestamp}},{key:"rtc_sdk_git_commit",get:function(){return this._rtc_sdk_git_commit}},{key:"report_id",get:function(){return this._report_id}},{key:"connection_id",get:function(){return this._connection_id}},{key:"rtc_sid",get:function(){return this._rtc_sid}},{key:"engine_session_id",get:function(){return this._engine_session_id}},{key:"rtc_business_id",get:function(){return this._rtc_business_id}},{key:"project_key",get:function(){return this._project_key}},{key:"network_type",get:function(){return this._network_type}},{key:"app_version",get:function(){return this._app_version}},{key:"aid",get:function(){return this._aid}},{key:"device_model",get:function(){return this._device_model}},{key:"device_brand",get:function(){return this._device_brand}},{key:"common_extra_info",get:function(){return this._common_extra_info}},{key:"had_selected_p2p",get:function(){return this._had_selected_p2p}},{key:"rtc_env_type",get:function(){return this._rtc_env_type}},{key:"room_id",get:function(){return this._room_id}},{key:"user_id",get:function(){return this._user_id}},{key:"rtc_session_id",get:function(){return this._rtc_session_id}},{key:"user_agent",get:function(){return this._user_agent}},{key:"auto_play_policy",get:function(){return this._auto_play_policy}}]),e}(),mB=function(e){f(r,e);var t=g(r);function r(){var e;return c(this,r),h(m(e=t.call(this)),"report_id",void 0),h(m(e),"report_common",void 0),h(m(e),"modify_ids",void 0),h(m(e),"dataBuffer",void 0),h(m(e),"posting",void 0),h(m(e),"sucSendTimer",void 0),h(m(e),"preSucTime",void 0),h(m(e),"errSendTimer",void 0),h(m(e),"errSendDelay",void 0),h(m(e),"commonStats",void 0),e.report_id=0,e.dataBuffer=[],e.posting=!1,e.report_common={},e.modify_ids={},e.preSucTime=0,e.errSendDelay=100,e.commonStats=new vB(m(e)),lP()||window.addEventListener("beforeunload",(function(){clearTimeout(e.errSendTimer),clearTimeout(e.sucSendTimer),e.send(null,!0)})),e}return l(r,[{key:"push",value:function(e,t){t?this.send(e):(this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this.send()))}},{key:"unshift",value:function(e){this.dataBuffer=e.concat(this.dataBuffer)}},{key:"send",value:function(e,t){var r=this;if(e||this.dataBuffer.length){var n={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},i=new XMLHttpRequest;i.timeout=1e4,i.onreadystatechange=function(){if(4===i.readyState){var o;if(e||(r.posting=!1),200===i.status||304===i.status)try{o=JSON.parse(i.responseText)}catch(RJ){}o&&0===o.StatusCode?e||t||r.sucSend():e?r.send(e):(r.unshift(n.data),t?r.send():r.errSend())}};var o=jB.LOG_SERVER_URL;if(i.open("POST",o,!0),e||(this.posting=!0),!lP()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",n),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!lP()&&location.search.includes("_rtc_debug_"))i.send(JSON.stringify(n));else{var a=MF.gzip(JSON.stringify(n));i.setRequestHeader("Content-Encoding","gzip"),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),i.send(a)}}}},{key:"sucSend",value:function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)}},{key:"errSend",value:function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2}},{key:"StartUp",value:function(){var e=this.report_common,t=this.commonStats,r=t.event_key,n=t.device_id,i=t.rtc_app_id,o=t.product_line,a=t.report_version,s=t.os,u=t.rtc_sdk_version,c=t.rtc_timestamp,d=t.rtc_sdk_git_commit,l=t.report_id,h=t.rtc_sid,f=t.engine_session_id,p=t.rtc_business_id,_=t.project_key,v=t.network_type,m=t.app_version,y=t.aid,g=t.device_model,S=t.device_brand,b=t.common_extra_info,E=t.had_selected_p2p,k=t.rtc_env_type,T=t.user_agent,I=t.auto_play_policy;Object.assign(e,{event_key:r,device_id:n,rtc_app_id:i,product_line:o,report_version:a,os:s,rtc_sdk_version:u,rtc_timestamp:c,rtc_sdk_git_commit:d,report_id:l,rtc_sid:h,engine_session_id:f,rtc_business_id:p,project_key:_,network_type:v,app_version:m,aid:y,device_model:g,device_brand:S,common_extra_info:b,had_selected_p2p:E,rtc_env_type:k,user_agent:T,auto_play_policy:I}),this.commonStats.room_id&&(this.modify_ids.room_id=this.commonStats.room_id),this.commonStats.user_id&&(this.modify_ids.user_id=this.commonStats.user_id),this.commonStats.rtc_session_id&&(this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id),this.commonStats.connection_id&&(this.modify_ids.connection_id=this.commonStats.connection_id)}},{key:"rtcSdkApiCall",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcSdkCallback",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcGetConfig",value:function(e,t,r,n,o,a,s){var u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=i(i({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,host:n,type:o,config_id:a,enable_cloud_proxy:s},this.modify_ids),{},{common_extra_info:JSON.stringify(u)});this.push(c)}},{key:"rtcReconnect",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:r,reconnect_type:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcReconnected",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcGetAccess",value:function(e,t,r,n,o,a){var s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},u=i(i({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,type:n,host:o,connect_session_id:a},this.modify_ids),{},{common_extra_info:JSON.stringify(s)});this.push(u)}},{key:"rtcPreIceState",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcNodeChange",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcSignalingMsgError",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcSignaling",value:function(e,t,r,n,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=i(i({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:r,signaling_type:n,direction:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{key:"rtcJoinRoom",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:r,elapse:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcLeaveRoom",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcBeginCreateOffer",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcCreateOffer",value:function(e,t,r,n,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=i(i({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:r,stream_user_id:n,elapse:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{key:"rtcSetDescription",value:function(e,t,r,n,o,a,s){var u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=i(i({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:r,direction:n,stream_id:o,stream_user_id:a,elapse:s},this.modify_ids),{},{common_extra_info:JSON.stringify(u)});this.push(c)}},{key:"rtcRecvAnswer",value:function(e,t,r,n,o,a,s){var u=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=i(i({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:r,message:n,direction:o,stream_id:a,stream_user_id:s},this.modify_ids),{},{common_extra_info:JSON.stringify(u)});this.push(c)}},{key:"firstRemoteAudioRender",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"first_remote_audio_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"firstRemoteVideoRender",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"first_remote_video_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcPublishStat",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:r,message:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcSubscribeStat",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:r,stream_user_id:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"rtcAudioDevice",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcMediaStatistics",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcMessageStatistics",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i(i({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now(),dc_user_message:e,dc_room_message:t,media_server_ip:r},this.modify_ids),{},{common_extra_info:JSON.stringify(n)});this.push(o)}},{key:"rtcError",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcInvokeStatus",value:function(e,t,r,n,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=i(i({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:r,stream_id:n,elapse:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{key:"rtcFirstFrame",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i(i(i({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:JSON.stringify(t)});this.push(r)}},{key:"rtcMuteRemote",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now(),mute_info:e,media_type:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"sdkInitEngine",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"joinRoom",value:function(e,t,r,n){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=i(i({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:r,reason:n},this.modify_ids),{},{common_extra_info:JSON.stringify(o)});this.push(a)}},{key:"p2pConnectionStatus",value:function(e,t,r,n,o){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},s=i(i({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:r,status:n,elapse:o},this.modify_ids),{},{common_extra_info:JSON.stringify(a)});this.push(s)}},{key:"p2pConnectClosed",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i(i({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{},{common_extra_info:JSON.stringify(t)});this.push(r)}},{key:"rtcDeviceError",value:function(e,t,r,n,o,a,s,u,c,d,l,h,f,p,_,v){var m=arguments.length>16&&void 0!==arguments[16]?arguments[16]:{},y=i(i({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:r,system_error_code:n,system_api:o,call_parameters:a,location:s,message:u,media_device_id:c,media_device_name:d,elapse:l,scenario:h,event_session_id:f,device_pid:p,device_vid:_,media_mode:v},this.modify_ids),{},{common_extra_info:JSON.stringify(m)});this.push(y)}},{key:"rtcVideoDevice",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcVideoCaptureEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=i(i(i({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:JSON.stringify(t)});this.push(r)}},{key:"rtcEncodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcFirstFrameEncoded",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcSendFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcRecvFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcRecvFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}},{key:"rtcDecodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=i(i(i(i({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:JSON.stringify(r)});this.push(n)}}]),r}(DU),yB=new mB,gB=new mB,SB=new mB,bB=yB.commonStats,EB=gB.commonStats,kB=SB.commonStats,TB={default:yB,rtm:gB,outsideRoom:SB};function IB(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return function(t,n,i){if("function"==typeof i.value){var o=i.value;i.value=function(){for(var t=arguments.length,i=new Array(t),a=0;a<t;a++)i[a]=arguments[a];var s={};r.forEach((function(e,t){s[e]=i[t]})),"joinRoom"===n&&bB.setStats({room_id:i[1]}),TB[e].rtcSdkApiCall(n,0,JSON.stringify(bP(i)),s);var u=o.apply(this,i);return"function"==typeof(null==u?void 0:u.then)?u.then((function(t){return TB[e].rtcSdkCallback(n,0,JSON.stringify(bP([t||{}]))),t})).catch((function(t){throw TB[e].rtcSdkCallback(n,t.code,JSON.stringify(t.message)),t})):(TB[e].rtcSdkCallback(n,0,JSON.stringify(bP([u||{}]))),u)}}}}function AB(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e===ne.onUserMessageReceivedOutsideRoom||e===ne.onUserBinaryMessageReceivedOutsideRoom;(n?gB:yB).rtcSdkCallback(e,r,JSON.stringify(t))}function RB(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];(n?gB:yB).rtcInvokeStatus(JSON.stringify(t),r,e,"",0)}var wB="BytePlus",CB="RTC_DEVICE_ID",OB="RTC_ACCESS_NODE",xB="RTC_ACCESS_URLS",NB="RTC_H264_BLACK_LIST",DB="engine_BAC",PB=function(){function e(){c(this,e)}return l(e,[{key:"get",value:function(e){var t=localStorage.getItem(e);if(!t)return null;try{var r=JSON.parse(t);return r.ttl>0&&Date.now()-r.saveTime>r.ttl?(this.delete(e),null):r.message}catch(n){return null}}},{key:"set",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,n={ttl:r,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(n)),!0}catch(i){return!1}}},{key:"delete",value:function(e){try{return localStorage.removeItem(e),!0}catch(t){return!1}}}]),e}(),MB=function(e){f(r,e);var t=g(r);function r(){return c(this,r),t.apply(this,arguments)}return l(r,[{key:"getDeviceId",value:function(){if(lP())return"";var e=this.get(CB);return e||(e=oP()),this.set(CB,e),e}},{key:"setDeviceId",value:function(e){return[bB,EB,kB].forEach((function(t){return t.setStats({device_id:e})})),this.set(CB,e),e}},{key:"getAccessNode",value:function(e){return this.get("".concat(OB,"_").concat(e,"-").concat(wB))}},{key:"setAccessNode",value:function(e,t,r){return this.set("".concat(OB,"_").concat(e,"-").concat(wB),t,1e3*r)}},{key:"clearAccessNode",value:function(e){this.delete("".concat(OB,"_").concat(e,"-").concat(wB))}},{key:"getAccessUrls",value:function(){return this.get("".concat(xB,"-").concat(wB))}},{key:"setAccessUrls",value:function(e){var t=e.map((function(e){var t=e.host,r=e.path;return"https://".concat(t).concat(r)}));return this.set("".concat(xB,"-").concat(wB),t)}},{key:"clearAccessUrls",value:function(){this.delete("".concat(xB,"-").concat(wB))}},{key:"getH264BlackList",value:function(){return this.get(NB)}},{key:"setH264BlackList",value:function(e){return this.set(NB,e)}},{key:"getAudioProfile",value:function(){return this.get(DB)}},{key:"setAudioProfile",value:function(e){return this.set(DB,e)}}]),r}(PB),UB=new MB,LB="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function VB(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^https?:\/\/.+/.test(e)||(e="https://"+e),"".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var FB="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",BB="rtc.rtcplus.com".split(","),jB={VERSION:"4.46.13",ICE_CONFIG_REQUEST_URLS_INTERNAL:LB.map(VB),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:FB,CONFIG_REQUEST_DOMAINS:BB,DEVICE_ID:"",OVERSEA:!1};function GB(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(jB.ICE_CONFIG_REQUEST_URLS=t.map(VB))):void("LOG_SERVER_URL"!==e||t!==j.overseas?"LOG_SERVER_URL"!==e||t!==j.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?"OVERSEA"!==e?("DEVICE_ID"===e&&UB.setDeviceId(t),jB[e]=t):jB.OVERSEA=t:jB.LOG_SERVER_URL=t:jB.LOG_SERVER_URL=FB:jB.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function HB(e){return"DEVICE_ID"===e?UB.getDeviceId():jB[e]}function zB(e,t){var r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,y;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},control:{protocol:"2.0"},audio:{codec:(null===(r=t.audio)||void 0===r?void 0:r.codec)||XB.audio.codec,bitRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.kBitRate)||XB.audio.kBitRate),sampleRate:1e3*((null===(i=t.audio)||void 0===i?void 0:i.sampleRate)||XB.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||XB.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||XB.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||XB.video.codec,fps:(null===(u=t.video)||void 0===u?void 0:u.fps)||XB.video.fps,gop:(null===(c=t.video)||void 0===c?void 0:c.gop)||XB.video.gop,lowLatency:null!==(d=null===(l=t.video)||void 0===l?void 0:l.lowLatency)&&void 0!==d?d:XB.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||XB.video.kBitRate),width:(null===(f=t.video)||void 0===f?void 0:f.width)||XB.video.width,height:(null===(p=t.video)||void 0===p?void 0:p.height)||XB.video.height},layout:{canvas:{bgnd:(null===(_=t.layout)||void 0===_?void 0:_.backgroundColor)||XB.layout.backgroundColor},regions:(null===(v=t.layout)||void 0===v||null===(m=v.regions)||void 0===m?void 0:m.map((function(e){return{alpha:Math.min(Math.max(+e.alpha,0),1),uid:e.userId,zorder:e.zorder,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),renderMode:e.renderMode||1,contentControl:e.contentControl||0,screen:e.isScreenStream,local_user:e.isLocalUser}})))||[],app_data:(null===(y=t.layout)||void 0===y?void 0:y.appData)||XB.layout.appData}}}}function KB(e,t,r){var n,i,o,a,s,u,c,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(n=r.video)||void 0===n?void 0:n.fps)||15,bitrate:1e3*((null===(i=r.video)||void 0===i?void 0:i.kBitRate)||40),width:(null===(o=r.video)||void 0===o?void 0:o.width)||640,height:(null===(a=r.video)||void 0===a?void 0:a.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=r.layout)||void 0===s?void 0:s.interpolationMode)||z.PREV_FRAME,canvas:{bgColor:(null===(u=r.layout)||void 0===u?void 0:u.backgroundColor)||"#000000",bgImage:(null===(c=r.layout)||void 0===c?void 0:c.backgroundImage)||""},regions:(null===(d=r.layout)||void 0===d||null===(l=d.regions)||void 0===l?void 0:l.map((function(e){return{roomId:e.roomId,userId:e.userId,alterImage:e.alertImage||"",alpha:e.alpha,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),zorder:e.zorder,renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var WB,XB={url:"",video:{codec:"H264",width:640,height:360,fps:30,gop:60,kBitRate:600,lowLatency:!0},audio:{codec:"AAC",kBitRate:64,sampleRate:48,channels:2,AACProfile:"LC"},layout:{regions:[],appData:"",backgroundColor:"#000000"}},qB={width:640,height:360,frameRate:30,maxKbps:600},YB={width:1920,height:1080,frameRate:15,maxKbps:3e3},JB=function(e){return e.streamRemovedBySchedule308="stream removed",e.clientRePublish="client republish",e.publishStreamFaied="publish failed",e.clientUnPublish="client unpublished",e.clientDisconnected="client disconnected",e.videoMuted="video muted",e}(JB||{}),QB=function(e){return e.PushLimitWarn="PushLimitWarn",e}(QB||{}),ZB=function(e){return e.ON_ADD_STREAM="onAddStream",e.ON_REMOVE_STREAM="onRemoveStream",e.USER_DISCONNECTION="userDisconnection",e.USER_CONNECTION="userConnection",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_UPDATE_USER_ATTRIBUTES="onUpdateUserAttributes",e.ON_PUSH_TRACK="onPushTrack",e.ON_REMOVE_TRACK="onRemoveTrack",e.ON_CUSTOM_MESSAGE="onCustomMessage",e.NODE_CHANGE="nodeChange",e.USER_MESSAGE_RECEIVED="userMessageReceived",e.USER_BINARY_MESSAGE_RECEIVED="userBinaryMessageReceived",e.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM="userMessageReceivedOutsideRoom",e.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM="userBinaryMessageReceivedOutsideRoom",e.POST_PROCESSING_MESSAGE="postProcessingMessage",e.ON_USER_TOKEN_WILL_EXPIRE="onUserTokenWillExpire",e.STREAM_CONTROL_MESSAGE="streamControlMessage",e.ON_SCENE_CONFIG="onSceneConfig",e.ON_STREAM_FAILED="streamFailed",e}(ZB||{}),$B=function(e){return e.RSCP="RSCP",e}($B||{}),ej=function(e){return e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection",e}(ej||{}),tj=function(e){return e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire",e}(tj||{}),rj=function(e){return e[e.roomDismissByAdmin=2]="roomDismissByAdmin",e}(rj||{}),nj=function(e){return e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK",e}(nj||{}),ij=function(e){return e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER",e}(ij||{}),oj=function(e){return e[e.SUCCESS=0]="SUCCESS",e[e.TIMEOUT=1]="TIMEOUT",e[e.BROKEN=2]="BROKEN",e[e.NO_RECEIVER=3]="NO_RECEIVER",e[e.NO_RELAYPATH=4]="NO_RELAYPATH",e[e.SEND_TO_SERVER_ERROR=17]="SEND_TO_SERVER_ERROR",e[e.SERVER_RESPONSE_ERROR=18]="SERVER_RESPONSE_ERROR",e[e.NOT_JOIN=100]="NOT_JOIN",e[e.INIT=101]="INIT",e[e.NO_CONNECTION=102]="NO_CONNECTION",e[e.NOT_LOGIN=105]="NOT_LOGIN",e[e.SERVER_PARAMS_NOTSET=106]="SERVER_PARAMS_NOTSET",e[e.UNKNOWN=1e3]="UNKNOWN",e}(oj||{}),aj=(h(WB={},0,[0,"success"]),h(WB,1,[qN.USER_MESSAGE_TIMEOUT,"timeout, failed to send."]),h(WB,2,[qN.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."]),h(WB,3,[qN.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."]),h(WB,4,[qN.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."]),h(WB,17,[qN.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."]),h(WB,18,[qN.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."]),h(WB,100,[qN.USER_MESSAGE_NOT_JOIN,"not join room"]),h(WB,101,[qN.USER_MESSAGE_INIT,"not init."]),h(WB,102,[qN.USER_MESSAGE_NO_CONNECTION,"no connection."]),h(WB,105,[qN.USER_MESSAGE_NOT_LOGIN,"not login."]),h(WB,106,[qN.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."]),h(WB,1e3,[qN.USER_MESSAGE_UNKNOWN,"unknown."]),WB),sj=["msg"],uj=new xU("DataChannelSignaling",3),cj=function(e){return e[e.C2S=0]="C2S",e[e.C2C=1]="C2C",e[e.C2GW=2]="C2GW",e[e.C2CDirect=3]="C2CDirect",e[e.C2RTM=4]="C2RTM",e}(cj||{}),dj=6e4,lj=function(e){f(a,e);var t,r,n=g(a);function a(e){var t;return c(this,a),h(m(t=n.call(this)),"_singlingCache",new Map),h(m(t),"_p2pCache",new Map),h(m(t),"_rttIds",{}),h(m(t),"_p2pMessageId",0),h(m(t),"_clearDataChannelListener",void 0),t._dataChannel=e,t._clearDataChannelListener=t._handleHandler(),window.__rtc_mock_signaling__=t.emit.bind(m(t)),t}return l(a,[{key:"destroy",value:function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=0,this._rttIds={}}},{key:"sendSignaling",value:function(e,t,r){var n=this;return yB.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",XF.UP),new Promise((function(i,o){var a=n._genHeader(r);a.id=yP();var s=a.id.join("-"),u=setTimeout((function(){n._singlingCache.delete(s),o(new JN(qN.TIME_OUT,"".concat(e," message time out")))}),dj);n._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(u),i(e)},error:function(e){clearTimeout(u),o(e)}}),uj.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),n._sendMessage(e,a,t)}))}},{key:"sendPingSignaling",value:function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:2})}},{key:"sendP2PMessage",value:(r=u(o().mark((function e(t,r){var n,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.msg,a=v(t,sj),s=n instanceof ArrayBuffer,e.t0=this,e.t1=i,e.t2=i({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:nj.SEND,type:ij.P2P,err:oj.SUCCESS},a),e.t3={},e.t4=s,!s){e.next=13;break}return e.next=10,hP.ab2b64str(n);case 10:e.t5=e.sent,e.next=14;break;case 13:e.t5=n;case 14:return e.t6=e.t5,e.t7={binary:e.t4,msg:e.t6},e.t8=(0,e.t1)(e.t2,e.t3,e.t7),e.t9=r,e.abrupt("return",e.t0._sendP2PMessage.call(e.t0,e.t8,e.t9));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"_sendP2PMessage",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return SP(e.msg)?this._rttIds[e.id]=e.id:e.dir===nj.SEND&&uj.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(n,o){var a=t._genHeader(i(i({needAck:!0,functionType:1},r),{},{id:yP()}));if(e.dir===nj.SEND){var s=setTimeout((function(){t._p2pCache.delete(e.id),o(new JN(qN.TIME_OUT,"P2P message timeout"))}),dj);t._p2pCache.set(e.id,{success:function(e,t){clearTimeout(s),n(t)},error:function(e){clearTimeout(s);var t=E(aj[e.err]||[qN.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),r=t[0],n=t[1];o({code:r,message:e.msg||n})}})}t._sendMessage("p2p",a,e)}))}},{key:"_sendMessage",value:function(e,t,r){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new JN(qN.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var n=t.version+(+t.zip<<5)+(+t.encrypt<<6),i=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=hP.str2ab(JSON.stringify([e,r])),a=dP(Uint8Array,[n,i].concat(k(t.id||[])),new Uint8Array(o));this._dataChannel.send(a.buffer)}},{key:"_dispartData",value:function(e){var t=new Uint8Array(e),r=0,n=t[r++],i=t[r++],o={version:15&n,zip:16==(16&n),encrypt:32==(32&n),needAck:1==(1&i),direction:(2&i)>>1,functionType:(60&i)>>2,binary:64==(64&i)};if(o.needAck||1===o.direction){for(;r<=6;r++)if(128!=(128&t[r])){r++;break}o.id=Array.from(t.slice(2,r))}return{header:o,data:t.slice(r)}}},{key:"_feedbackSignaling",value:function(e,t,r){var n=this._genHeader({needAck:!0,direction:1,id:e.split("-").map((function(e){return+e}))});uj.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),n,r)}},{key:"_handleMessage",value:(t=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h,f,p,_,v,m,y,g,S,b,k,T,I,A,R,w,C,O,x,N,D,P,M;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:c=this._dispartData(t),d=c.data,(l=c.header).zip&&((h=new MF.Inflate).push(d,!0),d=h.result),f=hP.ab2str(d),p=[],e.prev=6,p=JSON.parse(f),e.next=14;break;case 10:return e.prev=10,e.t0=e.catch(6),e.t0 instanceof Error&&yB.rtcSignalingMsgError(-1,e.t0.message,WF.MESSAGE_PARSE_FAILED),e.abrupt("return");case 14:e.t1=l.functionType,e.next=0===e.t1?17:1===e.t1?34:2===e.t1?83:99;break;case 17:if(_=(null===(r=l.id)||void 0===r?void 0:r.join("-"))||"",1!==l.direction){e.next=22;break}this._handleAckMessage(_,p[0]||{},f),e.next=33;break;case 22:if(!Array.isArray(p)){e.next=33;break}if(v=p[0],p=p[1],uj.print("Signal","<<<<<< ".concat(v),p,_),this._feedbackSignaling(_,v,v===ZB.ON_CUSTOM_MESSAGE?i(i({},p),{},{message:""}):""),!p.binary||"string"!=typeof p.message){e.next=31;break}return e.next=30,hP.b64str2ab(p.message);case 30:p.message=e.sent;case 31:this.emit(v,i({},p)),yB.rtcSignaling(0,f,"on-".concat(v),"Recv",XF.DOWN);case 33:return e.abrupt("break",100);case 34:Array.isArray(p)&&(p=p[1]),m=null===(n=p)||void 0===n?void 0:n.id,this._rttIds[m]||(null===(a=p)||void 0===a?void 0:a.dir)===nj.FEEDBACK||SP(null===(s=p)||void 0===s?void 0:s.msg)?delete this._rttIds[m]:uj.print("Signal","<<<<<< p2p response",p),e.t2=p.dir,e.next=e.t2===nj.SEND?40:e.t2===nj.FEEDBACK?78:81;break;case 40:if(SP(null===(u=p)||void 0===u?void 0:u.msg)){e.next=76;break}if(g=(y=p).binary,S=y.msg,b=y.room,k=y.to,T=y.from,I=""===b?g?ZB.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:ZB.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:g?ZB.USER_BINARY_MESSAGE_RECEIVED:ZB.USER_MESSAGE_RECEIVED,k){e.next=60;break}if(e.t3=this,e.t4=ZB.ON_CUSTOM_MESSAGE,e.t5=T,e.t6=g,!g){e.next=54;break}return e.next=51,hP.b64str2ab(S);case 51:e.t7=e.sent,e.next=55;break;case 54:e.t7=S;case 55:e.t8=e.t7,e.t9={clientId:e.t5,binary:e.t6,message:e.t8},e.t3.emit.call(e.t3,e.t4,e.t9),e.next=76;break;case 60:if(e.t10=this,e.t11=I,e.t12=i,e.t13=i({},p),e.t14={},!g){e.next=71;break}return e.next=68,hP.b64str2ab(S);case 68:e.t15=e.sent,e.next=72;break;case 71:e.t15=S;case 72:e.t16=e.t15,e.t17={msg:e.t16},e.t18=(0,e.t12)(e.t13,e.t14,e.t17),e.t10.emit.call(e.t10,e.t11,e.t18);case 76:return this._sendP2PMessage(i(i({},p),{},{dir:nj.FEEDBACK,msg:""})),e.abrupt("break",82);case 78:return(A=this._p2pCache.get(p.id))&&(this._p2pCache.delete(p.id),p.err===oj.SUCCESS?A.success(p.id,p):A.error(p)),e.abrupt("break",82);case 81:return e.abrupt("break",82);case 82:return e.abrupt("break",100);case 83:if(1!==l.direction){e.next=88;break}w=(null===(R=l.id)||void 0===R?void 0:R.join("-"))||"",this._handleAckMessage(w,p[0]||{},f),e.next=98;break;case 88:if(C=E(p,2),O=C[0],x=C[1],N=void 0===x?{}:x,"RXMediaMsg"!==O){e.next=98;break}D=N.type,P=N.data,yB.rtcSignaling(0,f,"on-".concat(D),"Recv",XF.DOWN),e.t19=D,e.next="RSCP"===e.t19?95:97;break;case 95:try{M=JSON.parse(P),Array.isArray(M)&&this.emit(D,M)}catch(o){}return e.abrupt("break",98);case 97:return e.abrupt("break",98);case 98:case 99:return e.abrupt("break",100);case 100:case"end":return e.stop()}}),e,this,[[6,10]])}))),function(e){return t.apply(this,arguments)})},{key:"_handleHandler",value:function(){var e=this,t=function(t){uj.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){uj.print("_handleHandler","dataChannel error",t),e.emit("close",t)},n=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",r),this._dataChannel.addEventListener("message",n),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",r),e._dataChannel.removeEventListener("message",n)}}},{key:"_genHeader",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i({version:2,zip:!1,encrypt:!1,needAck:!0,direction:0,functionType:0,binary:!1},e)}},{key:"_handleAckMessage",value:function(e,t,r){var n=this._singlingCache.get(e);n&&(this._singlingCache.delete(e),200===t.code?n.success(t):n.error(t),uj.print("Signal","<<<<<< [".concat(n.signalingType,"-ack]"),t)),yB.rtcSignaling(0,r,null==n?void 0:n.signalingType,"Ack",XF.DOWN)}}]),a}(AU.exports.EventEmitter),hj=function(){function e(){c(this,e),h(this,"xhr",void 0),h(this,"isSending",void 0),h(this,"timeout",void 0),this.isSending=!1}return l(e,[{key:"ajax",value:function(e){var t=this,r=e.method,n=e.url,i=e.body,o=void 0===i?{}:i,a=e.headers,s=void 0===a?{}:a,u=e.stringify,c=void 0===u||u;return new Promise((function(e,i){t.isSending=!0;var a=new XMLHttpRequest;a.open(r,n,!0);for(var u=0,d=Object.entries(s);u<d.length;u++){var l=E(d[u],2),h=l[0],f=l[1];a.setRequestHeader(h,f)}a.onreadystatechange=function(){4===a.readyState&&(t.isSending=!1,200===a.status?e(JSON.parse(a.responseText)):i({message:a.statusText,code:a.status})),0===a.status&&i({code:0,message:"Request abort"})},a.onerror=function(e){t.isSending=!1,i({code:-1,message:a.responseText||"unknown"})},t.timeout&&(a.timeout=t.timeout),c&&(o=JSON.stringify(o)),a.send(o),t.xhr=a}))}},{key:"get",value:function(e,t){return this.ajax({method:"GET",url:e,headers:t})}},{key:"post",value:function(e,t,r,n){return this.ajax({method:"POST",url:e,body:t,headers:r,stringify:n})}},{key:"abort",value:function(){var e;null===(e=this.xhr)||void 0===e||e.abort()}}]),e}(),fj=new xU("ICE Request",3),pj=function(){function e(){c(this,e),h(this,"_request",void 0),this._request=new hj}var t,r,n;return l(e,[{key:"getAccessNode",value:(n=u(o().mark((function e(t,r,n,i,a,s,u){var c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(c=UB.getAccessNode(t))){e.next=9;break}if(this.getAccessNodeFromServer(t,r,n,i,a,s,u),RB("es.R.node.cache",c),!Array.isArray(c)){e.next=8;break}return e.abrupt("return",Promise.resolve(c));case 8:return e.abrupt("return",Promise.resolve([c]));case 9:return e.abrupt("return",this.getAccessNodeFromServer(t,r,n,i,a,s,u));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i,o,a,s){return n.apply(this,arguments)})},{key:"getAccessNodeFromServer",value:(r=u(o().mark((function e(t,r,n,i,a,s,u){var c,d,l,h,f=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=UB.getAccessUrls(),h=!0,RB("es.R.req.cache.urls",l),(null===(c=l)||void 0===c?void 0:c.length)>0||(l=jB.ICE_CONFIG_REQUEST_URLS,h=!1,RB("es.R.req.external.urls",l)),(null===(d=l)||void 0===d?void 0:d.length)>0||(l=jB.ICE_CONFIG_REQUEST_URLS_INTERNAL,h=!1,RB("es.R.req.internal.urls",l)),e.abrupt("return",this.getICEConfigFromServer(l,t,r,n,i,a,s,u).then((function(e){var r=e.nodes;return UB.setAccessNode(t,r,e.ttl||11200),e.dispatchDomains&&UB.setAccessUrls(e.dispatchDomains),r})).catch((function(e){if(h)return RB("es.R.req.fallback",""),UB.clearAccessUrls(),f.getAccessNodeFromServer(t,r,n,i,a,s,u);throw e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,n,i,o,a,s){return r.apply(this,arguments)})},{key:"getICEConfigFromServer",value:(t=u(o().mark((function e(t,r,n,i,a,s,c,d){var l,h,f,p,_=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l={appID:r,userID:i,deviceID:a,connectSessionID:uP(),os:"web",sdkVersion:jB.VERSION,isOversea:jB.OVERSEA,expectedAddr:HB("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:d},s&&c&&(l.feedbackInfo=[{feedbackIP:null===(h=c.publicIPs[0])||void 0===h?void 0:h.ip,feedbackReason:{type:"NODE_CHANGED",reason:s}}],delete l.expectedAddr),f=Date.now(),yB.rtcGetAccess(0,JSON.stringify(l),0,zF.REQUEST,t.join(","),l.connectSessionID),p=t.map(function(){var e=u(o().mark((function e(t,r){var n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,_._request.post(t,l);case 3:n=e.sent,e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new JN(qN.ICE_SERVER_WRONG,"get ICE config failed",e.t0);case 9:if(200===n.code){e.next=11;break}throw new JN(qN.ICE_SERVER_WRONG,"get ICE config failed",{server_code:n.code,message:JSON.stringify(n)});case 11:if(i=n.nodes[0]){e.next=14;break}throw new JN(qN.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:n.code,message:JSON.stringify(n)});case 14:return e.abrupt("return",{result:n,firstNode:i,index:r});case 15:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t,r){return e.apply(this,arguments)}}()),e.abrupt("return",kP(p).then((function(e){var r=e.result;e.firstNode;var n=e.index;return yB.rtcGetAccess(200,JSON.stringify(r),Date.now()-f,zF.RESPONSE,t[n],l.connectSessionID),r})).catch((function(e){var r,n,i=null===(r=e[0])||void 0===r?void 0:r.error;throw yB.rtcGetAccess(+((null==i?void 0:i.code)||(null==i?void 0:i.server_code)),null===(n=e[0])||void 0===n?void 0:n.message,Date.now()-f,zF.RESPONSE,t.join(","),l.connectSessionID,{error:JSON.stringify(i)}),i})));case 6:case"end":return e.stop()}}),e)}))),function(e,r,n,i,o,a,s,u){return t.apply(this,arguments)})},{key:"abort",value:function(){this._request.isSending&&(fj.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())}}]),e}(),_j=function(){function e(){c(this,e),h(this,"_request",void 0),this._request=new hj}return l(e,[{key:"getH264BlackList",value:function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.46.13",deviceType:"web"};this._request.timeout=800;var r=jB.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));yB.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),FF.REQUEST,"",!1);var n=r.map(function(){var r=u(o().mark((function r(n,i){var a,s;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,e._request.post(n,t);case 3:s=r.sent,r.next=9;break;case 6:throw r.prev=6,r.t0=r.catch(0),new JN(qN.ICE_SERVER_WRONG,"get config failed");case 9:if(Array.isArray(null===(a=s)||void 0===a?void 0:a.web_h264_black_list)){r.next=11;break}throw new JN(qN.ICE_SERVER_WRONG,"get config failed");case 11:return r.abrupt("return",{result:s,index:i});case 12:case"end":return r.stop()}}),r,null,[[0,6]])})));return function(e,t){return r.apply(this,arguments)}}());return new Promise((function(e){kP(n).then((function(t){var n=t.result,i=t.index;UB.setH264BlackList(n.web_h264_black_list),yB.rtcGetConfig(200,JSON.stringify(n),0,r[i],FF.RESPONSE,"",!1),e(n.web_h264_black_list)})).catch((function(t){yB.rtcGetConfig(500,t.message,0,"",FF.RESPONSE,"",!1),e(UB.getH264BlackList()||[])}))}))}},{key:"getAudioProfile",value:function(){var e=this,t={keys:["engine_BAC"],labelSelector:"",sdkVersion:"4.46.13",deviceType:"web"},r=jB.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));yB.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),FF.REQUEST,"",!1);var n=r.map(function(){var r=u(o().mark((function r(n,i){var a,s;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,e._request.post(n,t);case 3:s=r.sent,r.next=9;break;case 6:throw r.prev=6,r.t0=r.catch(0),new JN(qN.ICE_SERVER_WRONG,"get config failed");case 9:if(Array.isArray(null===(a=s)||void 0===a?void 0:a.engine_BAC)){r.next=11;break}throw new JN(qN.ICE_SERVER_WRONG,"get config failed");case 11:return r.abrupt("return",{result:s,index:i});case 12:case"end":return r.stop()}}),r,null,[[0,6]])})));return function(e,t){return r.apply(this,arguments)}}());return new Promise((function(e){kP(n).then((function(t){var n=t.result,i=t.index;UB.setAudioProfile(n.engine_BAC),yB.rtcGetConfig(200,JSON.stringify(n),0,r[i],FF.RESPONSE,"",!1),e(n.engine_BAC)})).catch((function(t){yB.rtcGetConfig(500,t.message,0,"",FF.RESPONSE,"",!1),e(UB.getAudioProfile()||[])}))}))}}]),e}();function vj(e,t){var r=1,n=e;(e.width>t.width||e.height>t.height)&&(r=e.width/e.height>t.width/t.height?e.width/t.width:e.height/t.height,n={width:Math.floor(e.width/r),height:Math.floor(e.height/r)});return i(i({},n),{},{scaleResolutionDownBy:r})}var mj=[{sub_index:0,video_index:0,framerate:30,height:1080,maxkbps:3e3,width:1920},{sub_index:1,video_index:0,framerate:30,height:720,maxkbps:1200,width:1280},{sub_index:2,video_index:0,framerate:30,height:630,maxkbps:1100,width:1120},{sub_index:3,video_index:0,framerate:30,height:540,maxkbps:1e3,width:960},{sub_index:4,video_index:1,framerate:30,height:450,maxkbps:800,width:800},{sub_index:5,video_index:1,framerate:30,height:360,maxkbps:600,width:640},{sub_index:6,video_index:1,framerate:30,height:270,maxkbps:400,width:480},{sub_index:7,video_index:2,framerate:15,height:180,maxkbps:300,width:320},{sub_index:8,video_index:2,framerate:15,height:144,maxkbps:200,width:256},{sub_index:9,video_index:3,framerate:15,height:90,maxkbps:100,width:160}],yj=[{width:1920,height:1080,maxLayers:3,totalPixels:2073600},{width:1280,height:720,maxLayers:3,totalPixels:921600},{width:960,height:540,maxLayers:3,totalPixels:518400},{width:640,height:360,maxLayers:2,totalPixels:230400},{width:480,height:270,maxLayers:2,totalPixels:129600},{width:320,height:180,maxLayers:1,totalPixels:57600},{width:0,height:0,maxLayers:1,totalPixels:0}];var gj={width:160,height:90,frameRate:15,maxkbps:100},Sj={width:480,height:270,frameRate:15,maxkbps:400};function bj(e){if(!e.length)return[];var t=e.shift(),r=t.width/t.height,n=0,o=0,a=i(i({},t),{},{video_index:o,sub_index:n++});delete a.rid;for(var s=[a],u=0,c=0;c<mj.length;c++)if(mj[c].height<t.height){u=c;break}for(var d=e.shift(),l=u;l<mj.length;l++){var h,f=mj[l];if(d&&f.height<=(null===(h=d)||void 0===h?void 0:h.height)){var p,_=f.height===(null===(p=d)||void 0===p?void 0:p.height),v=i(i({},d),{},{video_index:++o,sub_index:n++});if(delete v.rid,s.push(v),d=e.shift(),_)continue}s.push(i(i({},f),{},{width:Math.floor(f.height*r),video_index:o,sub_index:n++}))}return s}var Ej,kj,Tj="chrome-stable"===pP(),Ij=function(){function e(t){c(this,e),h(this,"peer",void 0),h(this,"stats",void 0),this.peer=t,this.stats=[]}var t,r;return l(e,[{key:"handleCodec",value:function(e){return e}},{key:"handleInboundRtp",value:function(e){return e}},{key:"handleOutboundRtp",value:function(e){var t=e.ssrc;return t&&(e.rtxSsrc=t),e}},{key:"handleRemoteInboundRtp",value:function(e){return e}},{key:"handleRemoteOutboundRtp",value:function(e){return e}},{key:"handleMediaSource",value:function(e){return e}},{key:"handleCsrc",value:function(e){return e}},{key:"handlePeerConnection",value:function(e){return e}},{key:"handleDataChannel",value:function(e){return e}},{key:"handleStream",value:function(e){return e}},{key:"handleTrack",value:function(e){return e}},{key:"handleTransceiver",value:function(e){return e}},{key:"handleSender",value:function(e){return e}},{key:"handleReceiver",value:function(e){return e}},{key:"handleTransport",value:function(e){return e}},{key:"handleSctpTransport",value:function(e){return e}},{key:"handleCandidatePair",value:function(e){return e}},{key:"handleLocalCandidate",value:function(e){return e}},{key:"handleRemoteCandidate",value:function(e){return e}},{key:"handleCertificate",value:function(e){return e}},{key:"handleIceServer",value:function(e){return e}},{key:"processStats",value:function(e){var t=this;e.forEach((function(e){var r;switch(e.type){case"candidate-pair":r=t.handleCandidatePair;break;case"certificate":r=t.handleCertificate;break;case"remote-candidate":r=t.handleRemoteCandidate;break;case"remote-inbound-rtp":case"inbound-rtp":r=t.handleInboundRtp;break;case"remote-outbound-rtp":case"outbound-rtp":r=t.handleOutboundRtp;break;case"sctp-transport":r=t.handleSctpTransport;break;case"sender":r=t.handleSender;break;case"stream":r=t.handleStream;break;case"track":r=t.handleTrack;break;case"transceiver":r=t.handleTransceiver;break;case"transport":r=t.handleTransport;break;case"codec":r=t.handleCodec;break;case"csrc":r=t.handleCsrc;break;case"data-channel":r=t.handleDataChannel;break;case"ice-server":r=t.handleIceServer;break;case"media-source":r=t.handleMediaSource;break;case"peer-connection":r=t.handlePeerConnection;break;case"receiver":r=t.handleReceiver;break;case"local-candidate":r=t.handleLocalCandidate;break;default:r=function(e){return e}}r=r.bind(t),t.stats.push(r(e))}))}},{key:"getExtraStats",value:(r=u(o().mark((function e(t){var r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,n){if(!Tj||void 0!==window.InstallTrigger)return e(r.stats);try{r.peer.getStats((function(n){n.result().forEach((function(e){if(!Aj.includes(e.type)){var n={};e.names().forEach((function(t){n[t]=e.stat(t)})),n.id=e.id,n.type=e.type,n.timestamp=e.timestamp,"ssrc"===n.type&&t&&t.id?t.id===n.googTrackId&&r.stats.push(n):r.stats.push(n)}})),e(r.stats)}))}catch(RJ){n(RJ)}})));case 1:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"getStats",value:(t=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.peer.getStats(t);case 3:if(n=e.sent,this.processStats(n),e.prev=5,r){e.next=9;break}return e.next=9,this.getExtraStats(t);case 9:e.next=13;break;case 11:e.prev=11,e.t0=e.catch(5);case 13:e.next=17;break;case 15:e.prev=15,e.t1=e.catch(0);case 17:return e.abrupt("return",this.stats);case 18:case"end":return e.stop()}}),e,this,[[0,15],[5,11]])}))),function(e,r){return t.apply(this,arguments)})}]),e}(),Aj=["codec","inbound-rtp","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp","media-source","csrc","peer-connection","data-channel","stream","track","transceiver","sender","receiver","transport","sctp-transport","candidate-pair","local-candidate","remote-candidate","certificate","ice-server"],Rj=function(){var e=u(o().mark((function e(t,r,n){var i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=[],t instanceof RTCPeerConnection){e.next=3;break}return e.abrupt("return",i);case 3:return a=new Ij(t),e.next=6,a.getStats(r,n);case 6:return i=e.sent,e.abrupt("return",i);case 8:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),wj=function(){var e=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!lP()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel){e.next=3;break}return e.abrupt("return",!1);case 3:return e.next=5,Cj();case 5:return t=e.sent,e.abrupt("return",null==t?void 0:t.includes("H264"));case 9:return e.prev=9,e.t0=e.catch(0),e.abrupt("return",!1);case 12:case"end":return e.stop()}}),e,null,[[0,9]])})));return function(){return e.apply(this,arguments)}}(),Cj=function(){var e=u(o().mark((function e(){var t,r,n,i,a,s,u,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Ej){e.next=2;break}return e.abrupt("return",Ej);case 2:return t=[],e.prev=3,e.next=6,EP();case 6:if(r=e.sent){e.next=9;break}return e.abrupt("return",t);case 9:if(!(null!=r&&r.includes("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f")||null!=r&&r.includes("profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1")||null!=r&&r.includes("packetization-mode=1;profile-level-id=42e01f;level-asymmetry-allowed=1"))){e.next=20;break}return n=navigator.userAgent.toLowerCase(),i=!1,a=["heytapbrowser","mqqbrowser","miuibrowser"],s=new _j,e.next=16,s.getH264BlackList();case 16:for(u=e.sent,a.push.apply(a,k(u)),c=0;c<a.length;c++)n.includes(a[c])&&(i=!0);!i&&t.push("H264");case 20:return null!=r&&r.includes("VP8")&&t.push("vp8"),Ej=t,e.abrupt("return",t);case 25:return e.prev=25,e.t0=e.catch(3),e.abrupt("return",t);case 28:case"end":return e.stop()}}),e,null,[[3,25]])})));return function(){return e.apply(this,arguments)}}(),Oj=function(){var e=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Cj();case 2:return t=e.sent,e.abrupt("return",t.map((function(e){return e.toUpperCase()})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),xj=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},Nj=new xU("BasicHandler",3),Dj={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!xj()||void 0};function Pj(e){if(void 0===kj){var t=navigator.userAgent.toLowerCase();kj=t.includes("chrome")&&t.includes("mobile")}return kj?Math.ceil(e):e}var Mj=function(e){f(d,e);var t,r,n,a,s=g(d);function d(e,t){var r;return c(this,d),h(m(r=s.call(this)),"_peerConnection",void 0),h(m(r),"_dataChannel",void 0),h(m(r),"_context",void 0),h(m(r),"monitor",void 0),h(m(r),"_offerIce",{}),h(m(r),"_answerIce",{}),h(m(r),"_initSctpEvents",!1),r.monitor=e,r._peerConnection=new RTCPeerConnection(Dj),r._dataChannel=r._peerConnection.createDataChannel("signaling",{negotiated:!0,id:100}),r._context=t,r._dataChannel.binaryType="arraybuffer",r._peerConnection.ontrack=function(e){var t,n;Nj.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(null===(t=e.streams)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.id)),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){Nj.print("constructor","onconnectionstatechange ".concat(r._peerConnection.iceConnectionState," -> ").concat(r._peerConnection.connectionState)),"failed"!==r._peerConnection.iceConnectionState&&"closed"!==r._peerConnection.iceConnectionState&&"failed"!==r._peerConnection.connectionState||r.emit("disconnect")},r._peerConnection.oniceconnectionstatechange=function(){var t=r._peerConnection.iceConnectionState;e.rtcPreIceState(t,KF["".concat(t.toUpperCase())])},r}return l(d,[{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){Nj.print("destroy"),this.disconnect(),this._context=void 0}},{key:"_simulcast",value:function(e,t,r,n,o){var a=[],s=function(e){for(var t=0,r=e.width*e.height,n=0;n<yj.length;n++)if(r>=yj[n].totalPixels){t=n;break}if(0===t)return yj[t].maxLayers;var i=yj[t-1].totalPixels;return(i-r)/(i-yj[t].totalPixels)<.1?yj[t-1].maxLayers:yj[t].maxLayers}(t);Nj.print("simulcast() ","maxLayers: %o",s),1===e.videoEncodeConfig.length?(a=function(e,t){var r=[];if(t<=1)return r;var n=1,i=1;return e.width/e.height>16/9?(n=e.width/gj.width,i=e.width/Sj.width):(n=e.height/gj.height,i=e.height/Sj.height),r.push({maxkbps:gj.maxkbps,scaleResolutionDownBy:n,frameRate:gj.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),t<=2||n>2&&r.unshift({maxkbps:Sj.maxkbps,scaleResolutionDownBy:i,frameRate:Sj.frameRate,width:Math.floor(e.width/i),height:Math.floor(e.height/i)}),r}(r,s),Nj.print("simulcast() ","simulcastLayers: %o",a)):(a=e.videoEncodeConfig.slice(1).slice(1-s).map((function(e){return i({frameRate:e.frameRate||15,maxkbps:e.maxKbps||600},vj(r,e))})),Nj.print("simulcast() ","simulcastLayers2: %o",a)),a.forEach((function(e,t){var r,i={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:Pj(e.scaleResolutionDownBy),rid:"".concat(t+1),maxFramerate:e.frameRate};null===(r=n.sendEncodings)||void 0===r||r.unshift(i),o.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)})}))}},{key:"internalPublish",value:function(e,t){var r=e.stream,n=e.videoTrack,i=e.audioTrack,o=e.enableSimulcast,a=e.pubAudio,s=e.pubVideo,u={direction:"sendonly",streams:[r]},c={direction:"sendonly",streams:[r]},d=[],l=[];if(Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length){var h=null==n?void 0:n.getTrack(),f={width:640,height:360,frameRate:30};if(h){var p=null==h?void 0:h.getSettings();f={width:Math.floor(p.width),height:Math.floor(p.height),frameRate:Math.floor(p.frameRate)}}var _=null==e?void 0:e.videoEncodeConfig[0],v=vj(f,_);e.prevScaleResolutionDownBy=v.scaleResolutionDownBy,e.videoInputConfig=f;var m={maxBitrate:1e3*_.maxKbps,scaleResolutionDownBy:Pj(v.scaleResolutionDownBy),rid:"0",maxFramerate:_.frameRate||15};c.sendEncodings=[m],d.push({width:v.width,height:v.height,framerate:_.frameRate,maxkbps:_.maxKbps,rid:"0"}),o&&(this._simulcast(e,v,f,c,d),null!=t&&t.simulcastOnDemand&&(l=bj([].concat(d))),Nj.print("subVideoDesc","desc: %o ",l))}Nj.print("publish videoTransceiverInit videoDescriptions","",c,d);var y=null==i?void 0:i.getTrack();(null==i?void 0:i.mixType)!==ee.PLAYOUT&&null!=i&&i.mixedAudioTrack&&(y=null==i?void 0:i.mixedAudioTrack),y=a&&y?y:"audio";var g=null==n?void 0:n.getTrack();return{semantics:"unified-plan",videoDescriptions:d,subVideoDescriptions:l,transceiverInit:{aTrack:y,vTrack:g=s&&g?g:"video",audioTransceiverInit:u,videoTransceiverInit:c}}}},{key:"updateScaleResolutionDownBy",value:(a=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Nj.print("updateScaleResolutionDownBy()"),i=null===(r=t.videoTrack)||void 0===r?void 0:r.getTrack(),a=t.videoTransceiver,i&&t.pubVideo&&a){e.next=6;break}return Nj.print("updateScaleResolutionDownBy()","no pub"),e.abrupt("return");case 6:s=null==i?void 0:i.getSettings(),u={width:Math.floor(s.width),height:Math.floor(s.height),frameRate:Math.floor(s.frameRate)},(c=vj(u,t.videoEncodeConfig[0])).scaleResolutionDownBy===t.prevScaleResolutionDownBy&&Nj.print("updateScaleResolutionDownBy()","no change %o",t.prevScaleResolutionDownBy),(d=null===(n=a.sender)||void 0===n?void 0:n.getParameters())&&(h=c.scaleResolutionDownBy/t.prevScaleResolutionDownBy,d.encodings=null==d||null===(l=d.encodings)||void 0===l?void 0:l.map((function(e){var r,n;Math.max(e.scaleResolutionDownBy=(e.scaleResolutionDownBy||1)*h,1);var i=+e.rid||0;e.maxFramerate=(null===(r=t.videoEncodeConfig[i])||void 0===r?void 0:r.frameRate)||e.maxFramerate;var o=null===(n=t.videoEncodeConfig[i])||void 0===n?void 0:n.maxKbps;return"number"==typeof o&&(e.maxBitrate=1e3*o),e})),t.prevScaleResolutionDownBy=c.scaleResolutionDownBy,t.videoInputConfig=u,null==a||a.sender.setParameters(d));case 12:case"end":return e.stop()}}),e)}))),function(e){return a.apply(this,arguments)})},{key:"getStats",value:function(e,t){return Rj(this._peerConnection,e,t)}},{key:"setLocalDescription",value:(n=u(o().mark((function e(t,r){var n,i,a,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=cP(),e.prev=1,e.next=4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,JF.W_1,"local"===(null==r?void 0:r.streamUserId)?QF.UP:QF.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",cP()-n,{type:"offer"}),this._initSctpEvents||(this._initSctpEvents=!0,(a=null===(i=this._peerConnection)||void 0===i?void 0:i.sctp)&&(a.onstatechange=function(){s.monitor.rtcInvokeStatus("sctp state change TO: ".concat(a.state),0,"sctp","",0)},a.transport&&(a.transport.onstatechange=function(){var e;s.monitor.rtcInvokeStatus("dtls state change TO: ".concat(null==a||null===(e=a.transport)||void 0===e?void 0:e.state),0,"dtls","",0)}))),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error("setLocal",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message+t,JF.W_1,"local"===(null==r?void 0:r.streamUserId)?QF.UP:QF.DOWN,"","",cP()-n,{type:"offer"});case 12:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e,t){return n.apply(this,arguments)})},{key:"setRemoteDescription",value:(r=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=cP(),e.prev=1,e.next=4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,JF.W_0,"local"===(null==r?void 0:r.streamUserId)?QF.UP:QF.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",cP()-n,{type:"answer"}),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(1),console.error("setRemote",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message+t,JF.W_1,"local"===(null==r?void 0:r.streamUserId)?QF.UP:QF.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",cP()-n,{type:"answer"});case 11:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})},{key:"pc",get:function(){return this._peerConnection}},{key:"addBitrateLimit",value:function(e,t){null==e||e.rtp.forEach((function(r){var n=r.codec,i=r.payload;if(["vp8","h264"].includes(n.toLocaleLowerCase())){var o=e.fmtp.find((function(e){return e.payload===i}));o&&(o.config=[].concat(k(o.config.split(";")),["x-google-min-bitrate=100","x-google-start-bitrate=".concat(t)]).join(";"))}}))}}]),d}(AU.exports.EventEmitter),Uj={},Lj=ff,Vj=Ut,Fj=ke,Bj=Qs,jj=Dt,Gj=Te,Hj=Xa,zj=Re,Kj=lv,Wj=Tu,Xj=ci,qj=$a,Yj=Qt,Jj=Nd,Qj=ou,Zj=Gs,$j=me,eG=_s.UNSUPPORTED_Y,tG=4294967295,rG=Math.min,nG=[].push,iG=Fj(/./.exec),oG=Fj(nG),aG=Fj("".slice),sG=!$j((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return 2!==r.length||"a"!==r[0]||"b"!==r[1]}));Bj("split",(function(e,t,r){var n;return n="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,r){var n=qj(zj(this)),i=void 0===r?tG:r>>>0;if(0===i)return[];if(void 0===e)return[n];if(!Hj(e))return Vj(t,n,e,i);for(var o,a,s,u=[],c=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,c+"g");(o=Vj(Zj,l,n))&&!((a=l.lastIndex)>d&&(oG(u,aG(n,d,o.index)),o.length>1&&o.index<n.length&&Lj(nG,u,Jj(o,1)),s=o[0].length,d=a,u.length>=i));)l.lastIndex===o.index&&l.lastIndex++;return d===n.length?!s&&iG(l,"")||oG(u,""):oG(u,aG(n,d)),u.length>i?Jj(u,0,i):u}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:Vj(t,this,e,r)}:t,[function(t,r){var i=zj(this),o=Gj(t)?void 0:Yj(t,e);return o?Vj(o,t,i,r):Vj(n,qj(i),t,r)},function(e,i){var o=jj(this),a=qj(e),s=r(n,o,a,i,n!==t);if(s.done)return s.value;var u=Kj(o,RegExp),c=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(eG?"g":"y"),l=new u(eG?"^(?:"+o.source+")":o,d),h=void 0===i?tG:i>>>0;if(0===h)return[];if(0===a.length)return null===Qj(l,a)?[a]:[];for(var f=0,p=0,_=[];p<a.length;){l.lastIndex=eG?0:p;var v,m=Qj(l,eG?aG(a,p):a);if(null===m||(v=rG(Xj(l.lastIndex+(eG?p:0)),a.length))===f)p=Wj(a,p,c);else{if(oG(_,aG(a,f,p)),_.length===h)return _;for(var y=1;y<=m.length-1;y++)if(oG(_,m[y]),_.length===h)return _;p=f=v}}return oG(_,aG(a,f)),_}]}),!sG,eG);var uG={},cG={exports:{}},dG=cG.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(dG).forEach((function(e){dG[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))})),function(e){var t=function(e){return String(Number(e))===e?Number(e):e},r=function(e,r,n){var i=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:i&&!r[e.name]&&(r[e.name]={});var o=e.push?{}:i?r[e.name]:r;!function(e,r,n,i){if(i&&!n)r[i]=t(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(r[n[o]]=t(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&r[e.push].push(o)},n=cG.exports,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(n[t]||[]).length;s+=1){var u=n[t][s];if(u.reg.test(i))return r(u,a,i)}})),t.media=o,t};var o=function(e,r){var n=r.split(/=(.+)/,2);return 2===n.length?e[n[0]]=t(n[1]):1===n.length&&r.length>1&&(e[n[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var r=[],n=e.split(" ").map(t),i=0;i<n.length;i+=3)r.push({component:n[i],ip:n[i+1],port:n[i+2]});return r},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var r,n=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),n=!0),{scid:r,paused:n}}))}))}}(uG);var lG=cG.exports,hG=/%[sdv%]/g,fG=function(e){var t=1,r=arguments,n=r.length;return e.replace(hG,(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""}}))},pG=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 fG.apply(null,n)},_G=["v","o","s","i","u","e","p","c","b","t","r","z","a"],vG=["i","c","b","a"],mG=uG,yG=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||_G,n=t.innerOrder||vG,i=[];return r.forEach((function(t){lG[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(pG(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(pG(t,r,e))}))}))})),e.media.forEach((function(e){i.push(pG("m",lG.m[0],e)),n.forEach((function(t){lG[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(pG(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(pG(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};Uj.write=yG,Uj.parse=mG.parse,Uj.parseParams=mG.parseParams,Uj.parseFmtpConfig=mG.parseFmtpConfig,Uj.parsePayloads=mG.parsePayloads,Uj.parseRemoteCandidates=mG.parseRemoteCandidates,Uj.parseImageAttributes=mG.parseImageAttributes,Uj.parseSimulcastStreamList=mG.parseSimulcastStreamList;var gG=Math.pow(2,32),SG=function(){return Math.floor(Math.random()*gG+1e3)},bG=function(e,t,r){return r||(r=SG()),[{id:r,attribute:"cname",value:"kp34Za0H+aVf862l"},{id:r,attribute:"msid",value:"".concat(e.id," ").concat(e.id,"-").concat(t)},{id:r,attribute:"mslabel",value:"".concat(e.id)},{id:r,attribute:"label",value:"".concat(e.id,"-").concat(t)}]},EG=function(e,t){var r=SG(),n=SG();return{ssrcs:[r,n].reduce((function(r,n){return r.concat(bG(e,t,n))}),[]),ssrcGroups:[{semantics:"FID",ssrcs:"".concat(r," ").concat(n)}]}};function kG(e){return e.direction="inactive",e.port=0,delete e.ext,delete e.ssrcs,delete e.ssrcGroups,delete e.simulcast,delete e.simulcast_03,delete e.rids,delete e.extmapAllowMixed,delete e.bundleOnly,e}var TG=function(e,t,r){var n=i(i({},e),{},{invalid:[{value:"realx-exts:rscp"}],media:[t,r]});return delete n.groups,delete n.msidSemantic,Uj.write(n)};function IG(e){return AG.apply(this,arguments)}function AG(){return(AG=u(o().mark((function e(t){var r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={},n=t.publicIPs,i=t.certFingerprint,a=t.iceParams,r.fingerprint={type:"sha-256",hash:i},r.icePwd=a.serverIcePwd,e.next=6,wG(a.serverIceUfrag);case 6:return r.iceUfrag=e.sent,bB.setStats({connection_id:r.iceUfrag}),r.candidates=RG(n),r.setup="active",r.iceOptions="renomination",e.abrupt("return",r);case 12:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function RG(e){if(!Array.isArray(e))return[];var t=0,r=2130706431,n=[];return e.forEach((function(e){var o={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){n.push(i(i({},o),{},{foundation:t++,transport:"udp",port:e,priority:r}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){n.push(i(i({},o),{},{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),n}var wG=function(){var e=u(o().mark((function e(t){var r,n,i,a,s,u,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new TextEncoder,n=r.encode("PREC"),e.t0=Uint8Array,e.next=5,hP.b64str2ab(t);case 5:return e.t1=e.sent,i=new e.t0(e.t1),a=r.encode(Date.now().toString()).slice(-4),(s=new Uint8Array(2))[0]=0,s[1]=1,u=dP(Uint8Array,n,i,a,s),e.next=14,hP.ab2b64str(u.buffer);case 14:return c=e.sent,e.abrupt("return",c);case 16:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),CG=ke,OG=mh,xG=bd.exports.getWeakData,NG=zl,DG=Dt,PG=Te,MG=Et,UG=jl,LG=De,VG=dn.set,FG=dn.getterFor,BG=Gi.find,jG=Gi.findIndex,GG=CG([].splice),HG=0,zG=function(e){return e.frozen||(e.frozen=new KG)},KG=function(){this.entries=[]},WG=function(e,t){return BG(e.entries,(function(e){return e[0]===t}))};KG.prototype={get:function(e){var t=WG(this,e);if(t)return t[1]},has:function(e){return!!WG(this,e)},set:function(e,t){var r=WG(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=jG(this.entries,(function(t){return t[0]===e}));return~t&&GG(this.entries,t,1),!!~t}};var XG,qG={getConstructor:function(e,t,r,n){var i=e((function(e,i){NG(e,o),VG(e,{type:t,id:HG++,frozen:void 0}),PG(i)||UG(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=FG(t),s=function(e,t,r){var n=a(e),i=xG(DG(t),!0);return!0===i?zG(n).set(t,r):i[n.id]=r,e};return OG(o,{delete:function(e){var t=a(this);if(!MG(e))return!1;var r=xG(e);return!0===r?zG(t).delete(e):r&&LG(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!MG(e))return!1;var r=xG(e);return!0===r?zG(t).has(e):r&&LG(r,t.id)}}),OG(o,r?{get:function(e){var t=a(this);if(MG(e)){var r=xG(e);return!0===r?zG(t).get(e):r?r[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),i}},YG=ae,JG=ke,QG=mh,ZG=bd.exports,$G=_h,eH=qG,tH=Et,rH=zd,nH=dn.enforce,iH=Br,oH=!YG.ActiveXObject&&"ActiveXObject"in YG,aH=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},sH=$G("WeakMap",aH,eH);if(iH&&oH){XG=eH.getConstructor(aH,"WeakMap",!0),ZG.enable();var uH=sH.prototype,cH=JG(uH.delete),dH=JG(uH.has),lH=JG(uH.get),hH=JG(uH.set);QG(uH,{delete:function(e){if(tH(e)&&!rH(e)){var t=nH(this);return t.frozen||(t.frozen=new XG),cH(this,e)||t.frozen.delete(e)}return cH(this,e)},has:function(e){if(tH(e)&&!rH(e)){var t=nH(this);return t.frozen||(t.frozen=new XG),dH(this,e)||t.frozen.has(e)}return dH(this,e)},get:function(e){if(tH(e)&&!rH(e)){var t=nH(this);return t.frozen||(t.frozen=new XG),dH(this,e)?lH(this,e):t.frozen.get(e)}return lH(this,e)},set:function(e,t){if(tH(e)&&!rH(e)){var r=nH(this);r.frozen||(r.frozen=new XG),dH(this,e)?hH(this,e,t):r.frozen.set(e,t)}else hH(this,e,t);return this}})}var fH=function(e){f(T,e);var t,r,n,i,a,s,d,p,_,v,y,S,b,E=g(T);function T(){var e;return c(this,T),h(m(e=E.call(this)),"inited",!1),h(m(e),"deviceMap",{audioinput:new Map,audiooutput:new Map,videoinput:new Map}),e._handleDeviceChange=e._handleDeviceChange.bind(m(e)),!lP()&&e.refreshDevices(),e}return l(T,[{key:"refreshDevices",value:(b=u(o().mark((function e(){var t,r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices){e.next=2;break}return e.abrupt("return");case 2:if(t=void 0,!_P){e.next=7;break}return e.next=6,navigator.mediaDevices.getUserMedia({audio:!0});case 6:t=e.sent;case 7:return e.next=9,navigator.mediaDevices.enumerateDevices();case 9:r=e.sent,t&&t.getTracks().forEach((function(e){return e.stop()})),r.forEach((function(e){var t;e.deviceId&&(null===(t=n.deviceMap[e.kind])||void 0===t||t.set(e.deviceId,e))})),this.inited||this.initListener(),this.inited=!0;case 14:case"end":return e.stop()}}),e,this)}))),function(){return b.apply(this,arguments)})},{key:"initListener",value:(S=u(o().mark((function e(){var t,r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:"function"==typeof(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.addEventListener)&&navigator.mediaDevices.addEventListener("devicechange",(function(){r._handleDeviceChange(),setTimeout((function(){r._handleDeviceChange()}),300)}));case 1:case"end":return e.stop()}}),e)}))),function(){return S.apply(this,arguments)})},{key:"_handleDeviceChange",value:(y=u(o().mark((function e(){var t,r,n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=void 0,!_P){e.next=5;break}return e.next=4,navigator.mediaDevices.getUserMedia({audio:!0});case 4:t=e.sent;case 5:return e.next=7,navigator.mediaDevices.enumerateDevices();case 7:r=e.sent,t&&t.getTracks().forEach((function(e){return e.stop()})),n=Array.from([].concat(k(this.deviceMap.audioinput.values()),k(this.deviceMap.videoinput.values()),k(this.deviceMap.audiooutput.values()))),r.forEach((function(e){var t=i.deviceMap[e.kind].get(e.deviceId);i.deviceMap[e.kind].set(e.deviceId,e),t||(e.kind.includes("video")?i.emit(ne.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):e.kind.includes("audio")&&i.emit(ne.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),n.forEach((function(e){r.find((function(t){return t.deviceId===e.deviceId&&t.kind===e.kind}))||(i.deviceMap[e.kind].delete(e.deviceId),e.kind.includes("video")?i.emit(ne.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):e.kind.includes("audio")&&i.emit(ne.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))}));case 12:case"end":return e.stop()}}),e,this)}))),function(){return y.apply(this,arguments)})},{key:"getVideoPermission",value:(v=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._getVideoPermission(),e.next=3,this.refreshDevices();case 3:return e.abrupt("return",t);case 4:case"end":return e.stop()}}),e,this)}))),function(){return v.apply(this,arguments)})},{key:"_getVideoPermission",value:(_=u(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getNavigatorPermission("camera");case 2:if(!e.sent){e.next=4;break}return e.abrupt("return",!0);case 4:if(r=!1,null===(t=navigator.mediaDevices)||void 0===t||!t.getUserMedia){e.next=8;break}return e.next=8,navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),r=!0)})).catch((function(){}));case 8:return e.abrupt("return",r);case 9:case"end":return e.stop()}}),e,this)}))),function(){return _.apply(this,arguments)})},{key:"getAudioPermission",value:(p=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this._getAudioPermission(),e.next=3,this.refreshDevices();case 3:return e.abrupt("return",t);case 4:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"_getAudioPermission",value:(d=u(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getNavigatorPermission("microphone");case 2:if(!e.sent){e.next=4;break}return e.abrupt("return",!0);case 4:if(r=!1,null===(t=navigator.mediaDevices)||void 0===t||!t.getUserMedia){e.next=8;break}return e.next=8,navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),r=!0)})).catch((function(){}));case 8:return e.abrupt("return",r);case 9:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"enumerateDevices",value:(s=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getVideoPermission();case 2:return e.next=4,this._getAudioPermission();case 4:return e.abrupt("return",Array.from([].concat(k(this.deviceMap.audioinput.values()),k(this.deviceMap.videoinput.values()),k(this.deviceMap.audiooutput.values()))));case 5:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"enumerateAudioCaptureDevices",value:(a=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getAudioPermission();case 2:return e.abrupt("return",Array.from(this.deviceMap.audioinput.values()));case 3:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"enumerateVideoCaptureDevices",value:(i=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getVideoPermission();case 2:return e.abrupt("return",Array.from(this.deviceMap.videoinput.values()));case 3:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"enumerateAudioPlaybackDevices",value:(n=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getAudioPermission();case 2:return e.abrupt("return",Array.from(this.deviceMap.audiooutput.values()));case 3:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"getDeviceById",value:(r=u(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.enumerateDevices();case 2:return r=e.sent,e.abrupt("return",r.find((function(e){return e.deviceId===t})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_getNavigatorPermission",value:(t=u(o().mark((function e(t){var r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=!1,null===(r=navigator.permissions)||void 0===r||!r.query){e.next=12;break}return e.prev=2,e.next=5,navigator.permissions.query({name:t});case 5:i=e.sent,a=i.state,n="granted"===a,e.next=12;break;case 10:e.prev=10,e.t0=e.catch(2);case 12:return e.abrupt("return",n);case 13:case"end":return e.stop()}}),e,null,[[2,10]])}))),function(e){return t.apply(this,arguments)})}]),T}(DU),pH=new fH,_H=function(){function e(){c(this,e),h(this,"_audioContextInstance",void 0)}return l(e,[{key:"getAudioContextInstance",value:function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance}}]),e}(),vH=function(){function e(t){c(this,e),h(this,"_ctx",void 0),h(this,"_analyserNode",void 0),h(this,"_audioSource",void 0);var r=yH.getAudioContextInstance();if(t instanceof MediaStreamTrack){var n=new MediaStream;n.addTrack(t),this._audioSource=r.createMediaStreamSource(n)}else t instanceof AudioNode?this._audioSource=t:(this._audioSource=r.createMediaElementSource(t),this._audioSource.connect(r.destination));var i=r.createAnalyser();this._audioSource.connect(i),this._analyserNode=i,this._ctx=r}return l(e,[{key:"getAudioLevel",value:function(){var e;"suspended"===(null===(e=this._ctx)||void 0===e?void 0:e.state)&&this._ctx.resume();var t=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(t);var r=0;return t.forEach((function(e){return r=Math.max(r,Math.abs(e-128))})),r/128*255}},{key:"destroy",value:function(){this._audioSource.disconnect(),this._analyserNode.disconnect()}}]),e}(),mH=function(){function e(t){c(this,e),h(this,"_gainNode",void 0),h(this,"_audioDestination",void 0),h(this,"_audioSource",void 0);var r=yH.getAudioContextInstance();this._audioDestination=r.createMediaStreamDestination();var n=new MediaStream;n.addTrack(t),this._audioSource=r.createMediaStreamSource(n),this._gainNode=r.createGain(),this._audioSource.connect(this._gainNode).connect(this._audioDestination)}return l(e,[{key:"setVolumeGain",value:function(e){this._gainNode.gain.value=e}},{key:"getAudioTrack",value:function(){return this._audioDestination.stream.getAudioTracks()[0]}},{key:"destroy",value:function(){this._audioSource.disconnect(),this._gainNode.disconnect()}}]),e}(),yH=new _H,gH=new xU("VERTC",0),SH=new WeakMap,bH=function(e){return SH.get(e)},EH=function(e){f(r,e);var t=g(r);function r(e,n){var i;return c(this,r),h(m(i=t.call(this)),"mediaType",void 0),h(m(i),"_trackId",void 0),i._trackId=e,i.mediaType=n,i}return l(r,[{key:"getId",value:function(){return this._trackId}}]),r}(DU),kH=function(e){f(r,e);var t=g(r);function r(e,n,i){var o;return c(this,r),h(m(o=t.call(this,n,i)),"_mediaTrack",void 0),o._mediaTrack=e,o._initListeners(),o}return l(r,[{key:"getTrack",value:function(){return this._mediaTrack}},{key:"setTrack",value:function(e){this._mediaTrack=e}},{key:"close",value:function(){var e;return null===(e=this._mediaTrack)||void 0===e?void 0:e.stop()}},{key:"_initListeners",value:function(){var e=this;this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",(function(){yB.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))}}]),r}(EH),TH=function(e){f(r,e);var t=g(r);function r(e,n,i){var o;return c(this,r),h(m(o=t.call(this,n,i)),"_mediaTrack",void 0),o._mediaTrack=e,o}return l(r,[{key:"getTrack",value:function(){return this._mediaTrack}}]),r}(EH),IH=function(e){f(n,e);var t,r=g(n);function n(e,t){var i;return c(this,n),h(m(i=r.call(this,e,t,"video")),"resolution",void 0),h(m(i),"videoCaptureConfig",void 0),h(m(i),"dummy",!1),i.resolution={width:0,height:0},i}return l(n,[{key:"updateVideoCaptureConfig",value:(t=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.videoCaptureConfig&&this.getTrack()){e.next=2;break}return e.abrupt("return");case 2:return gH.print("updateVideoEncoderConfig","update localVideoTrack: ",this.videoCaptureConfig),delete i({},this.videoCaptureConfig).contentHint,e.next=7,this.getTrack().applyConstraints(this.videoCaptureConfig);case 7:((t=this.getTrack().getSettings()).width&&t.width!==this.resolution.width||t.height&&t.height!==this.resolution.height)&&(this.resolution={width:t.width,height:t.height},this.emit("resolution-change",this.resolution));case 9:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"replaceTrack",value:function(e){this.setTrack(e)}},{key:"setContentHint",value:function(e){this._mediaTrack&&"contentHint"in this._mediaTrack&&["text","motion","detail"].includes(e)&&(this._mediaTrack.contentHint=e)}}]),n}(kH),AH=function(e){f(n,e);var t,r=g(n);function n(e,t){var i;return c(this,n),h(m(i=r.call(this,e,t,"audio")),"audioCaptureConfig",void 0),h(m(i),"_audioLevelFetcher",void 0),h(m(i),"mixedAudioTrack",void 0),h(m(i),"mixType",ee.PLAYOUT_AND_PUBLISH),h(m(i),"_audioVolumeGain",void 0),h(m(i),"gainAudioTrack",void 0),i}return l(n,[{key:"getPublishTrack",value:function(){var e=null==this?void 0:this.getTrack();return(null==this?void 0:this.mixType)!==ee.PLAYOUT&&null!=this&&this.mixedAudioTrack?e=null==this?void 0:this.mixedAudioTrack:null!=this&&this.gainAudioTrack&&(e=this.gainAudioTrack),e}},{key:"setCaptureVolume",value:function(e){this._audioVolumeGain||(this._audioVolumeGain=new mH(this.getTrack()),this.gainAudioTrack=this._audioVolumeGain.getAudioTrack()),this._audioVolumeGain.setVolumeGain(e/100)}},{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new vH(this.getTrack())),this._audioLevelFetcher.getAudioLevel()}},{key:"updateAudioCaptureConfig",value:(t=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.audioCaptureConfig){e.next=2;break}return e.abrupt("return");case 2:return gH.print("updateAudioCaptureConfig","update localAudioTrack: ",this.audioCaptureConfig),e.next=5,null===(t=this.getTrack())||void 0===t?void 0:t.applyConstraints(this.audioCaptureConfig);case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),n}(kH),RH=function(e){f(r,e);var t=g(r);function r(e,n){return c(this,r),t.call(this,e,n,"video")}return l(r)}(TH),wH=function(e){f(r,e);var t=g(r);function r(e,n){var i;return c(this,r),h(m(i=t.call(this,e,n,"audio")),"_audioLevelFetcher",void 0),i}return l(r,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new vH(this.getTrack())),this._audioLevelFetcher.getAudioLevel()}}]),r}(TH),CH=function(e){f(r,e);var t=g(r);function r(){return c(this,r),t.apply(this,arguments)}return l(r)}(AH),OH=function(e){f(r,e);var t=g(r);function r(){return c(this,r),t.apply(this,arguments)}return l(r)}(IH),xH=function(e){f(r,e);var t=g(r);function r(){return c(this,r),t.apply(this,arguments)}return l(r)}(IH),NH=function(e){f(r,e);var t=g(r);function r(){return c(this,r),t.apply(this,arguments)}return l(r)}(AH),DH=function(e){f(r,e);var t=g(r);function r(){return c(this,r),t.apply(this,arguments)}return l(r)}(IH),PH=function(e){f(r,e);var t=g(r);function r(){return c(this,r),t.apply(this,arguments)}return l(r)}(AH);function MH(e){return UH.apply(this,arguments)}function UH(){return(UH=u(o().mark((function e(t){var r,n,i,a,s,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=(null==t||null===(r=t.deviceId)||void 0===r?void 0:r.exact)||"default",e.prev=1,gH.print("createCameraVideoTrack","constraints:",t),yB.rtcVideoCaptureEvent({event_type:pB.START,media_device_id:i}),a=cP(),e.next=7,navigator.mediaDevices.getUserMedia({video:t});case 7:n=e.sent,yB.rtcVideoCaptureEvent({event_type:pB.START_CAPTURE_RESULT,media_device_id:i,reason:_B.SUCCESS,elapse:cP()-a}),pH.refreshDevices(),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(1),yB.rtcVideoCaptureEvent({event_type:pB.RUNNING_FAILED,media_device_id:i,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new JN(qN.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",e.t0);case 16:return s=n.getVideoTracks()[0],SH.set(s,n),(u=new OH(s,uP())).videoCaptureConfig=t,e.abrupt("return",u);case 21:case"end":return e.stop()}}),e,null,[[1,12]])})))).apply(this,arguments)}function LH(e,t){return VH.apply(this,arguments)}function VH(){return VH=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return gH.print("createCameraVideoTrack","constraints:",t),a=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",u=(s=r||{}).sampleRate,c=s.channel,d=s.agc,l=s.ans,h=s.aec,void 0===t.sampleRate&&(t.sampleRate=u),void 0===t.channelCount&&(t.channelCount=c),void 0===t.autoGainControl&&(t.autoGainControl=d),void 0===t.noiseSuppression&&(t.noiseSuppression=l),void 0===t.echoCancellation&&(t.echoCancellation=h),e.prev=8,yB.rtcVideoCaptureEvent({event_type:pB.START,media_device_id:a}),f=cP(),e.next=13,navigator.mediaDevices.getUserMedia({audio:t});case 13:i=e.sent,yB.rtcVideoCaptureEvent({event_type:pB.START_CAPTURE_RESULT,media_device_id:a,reason:_B.SUCCESS,elapse:cP()-f}),pH.refreshDevices(),e.next=22;break;case 18:throw e.prev=18,e.t0=e.catch(8),yB.rtcVideoCaptureEvent({event_type:pB.RUNNING_FAILED,media_device_id:a,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new JN(qN.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",e.t0);case 22:return p=i.getAudioTracks()[0],SH.set(p,i),e.abrupt("return",new CH(p,uP()));case 25:case"end":return e.stop()}}),e,null,[[8,18]])}))),VH.apply(this,arguments)}function FH(){return BH.apply(this,arguments)}function BH(){return BH=u(o().mark((function e(){var t,r,n,i,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.length>0&&void 0!==a[0]&&a[0],r=a.length>1?a[1]:void 0,gH.print("createScreenTracks","withAudio: %o, constraints: %o",t,r),e.prev=3,yB.rtcVideoCaptureEvent({event_type:pB.START,media_device_id:"screen"}),i=cP(),e.next=8,navigator.mediaDevices.getDisplayMedia({video:!(r&&!vP)||r,audio:!!t&&{channelCount:2,noiseSuppression:!1,echoCancellation:!1,autoGainControl:!1}});case 8:n=e.sent,yB.rtcVideoCaptureEvent({event_type:pB.START_CAPTURE_RESULT,media_device_id:"screen",reason:_B.SUCCESS,elapse:cP()-i}),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(3),yB.rtcVideoCaptureEvent({event_type:pB.RUNNING_FAILED,media_device_id:"screen",error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new JN(qN.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",e.t0);case 16:return e.abrupt("return",n);case 17:case"end":return e.stop()}}),e,null,[[3,12]])}))),BH.apply(this,arguments)}var jH=function(e){return e[e.NONE=0]="NONE",e}(jH||{}),GH=function(){function e(){c(this,e)}return l(e,null,[{key:"getNalunits",value:function(t){if(t.length-t.position<4)return[];var r=t.position;return 1===t.getInt32(r)||0===t.getInt16(r)&&1===t.getInt8(r+2)?e.getAnnexbNals(t):e.getAvccNals(t)}},{key:"getAnnexbNals",value:function(t){for(var r=[],n=e.getHeaderPositionAnnexB(t),i=n.pos,o=i;i<t.length-4;){var a=new Uint8Array(t.buffer.slice(i,i+n.headerLength));n.pos===t.position&&t.skip(n.headerLength),o=(n=e.getHeaderPositionAnnexB(t)).pos;var s={header:a,body:new Uint8Array(t.buffer.slice(i+a.byteLength,o)),type:-1};e.analyseNal(s),s.type<=9&&0!==s.type&&r.push(s),t.skip(o-t.position),i=o}return r}},{key:"getAvccNals",value:function(t){for(var r=[];t.position<t.length-4;){var n=t.getInt32(t.position);if(!(t.length-t.position>=n))break;var i=new Uint8Array(t.buffer.slice(t.position,t.position+4));t.skip(4);var o=new Uint8Array(t.buffer.slice(t.position,t.position+n));t.skip(n);var a={header:i,body:o,type:-1};e.analyseNal(a),a.type<=9&&0!==a.type&&r.push(a)}return r}},{key:"analyseNal",value:function(e){var t=31&e.body[0];switch(e.type=t,t){case 1:e.ndr=!0;break;case 5:e.idr=!0;break;case 6:e.sei=!0;break;case 7:e.sps=!0;break;case 8:e.pps=!0}}},{key:"getHeaderPositionAnnexB",value:function(e){for(var t=e.position,r=0,n=e.length;3!==r&&4!==r&&t<n-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:1===e.getInt8(t+2)?r=3:t++:t++;return t===n-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:t=n:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?r=3:t=n)),{pos:t,headerLength:r}}},{key:"getAvcc",value:function(e,t){var r=new Uint8Array(e.byteLength+t.byteLength+11);r[0]=1,r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=255,r[5]=225;var n=6;return r.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),n),n+=2,r.set(e,n),r[n+=e.byteLength]=1,n++,r.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),n),n+=2,r.set(t,n),r}}]),e}(),HH=function(){function e(t){c(this,e),h(this,"_position",0),h(this,"_dataview",void 0),this._dataview=new DataView(t)}return l(e,[{key:"length",get:function(){return this.buffer.byteLength}},{key:"buffer",get:function(){return this._dataview.buffer}},{key:"position",get:function(){return this._position},set:function(e){this._position=e}},{key:"back",value:function(e){this.position-=e}},{key:"getUint8",value:function(e){return this._dataview.getUint8(e)}},{key:"getInt8",value:function(e){return this._dataview.getInt8(e)}},{key:"getInt16",value:function(e){return this._dataview.getInt16(e)}},{key:"getUint16",value:function(e){return this._dataview.getUint16(e)}},{key:"getUint32",value:function(e){return this._dataview.getUint32(e)}},{key:"getInt32",value:function(e){return this._dataview.getInt32(e)}},{key:"skip",value:function(t){for(var r=Math.floor(t/4),n=t%4,i=0;i<r;i++)e.readByte(this,4);n>0&&e.readByte(this,n)}},{key:"readUint8",value:function(){return e.readByte(this,1)}},{key:"readUint16",value:function(){return e.readByte(this,2)}},{key:"readUint24",value:function(){return e.readByte(this,3)}},{key:"readUint32",value:function(){return e.readByte(this,4)}},{key:"readUint64",value:function(){return e.readByte(this,8)}},{key:"readInt8",value:function(){return e.readByte(this,1,!0)}},{key:"readInt16",value:function(){return e.readByte(this,2,!0)}},{key:"readInt32",value:function(){return e.readByte(this,4,!0)}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}}],[{key:"readByte",value:function(e,t,r){var n;switch(t){case 1:n=r?e.getInt8(e.position):e.getUint8(e.position);break;case 2:n=r?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(r)throw new Error("not supported for readByte 3");n=e.getUint8(e.position)<<16,n|=e.getUint8(e.position+1)<<8,n|=e.getUint8(e.position+2);break;case 4:n=r?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(r)throw new Error("not supported for readBody 8");n=e.getUint32(e.position)<<32,n|=e.getUint32(e.position+4);break;default:n=""}return e.position+=t,n}}]),e}(),zH=function(e){return e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass",e}(zH||{}),KH=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),WH=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]),XH=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]&&t.push(3),t.push(e[r]);return new Uint8Array(t)};function qH(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function YH(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=0;255===e[t]&&t<e.byteLength;)t++,r+=255;return t<e.byteLength&&(r+=e[t++]),[r,t]}var JH=function(){function e(){c(this,e)}return l(e,null,[{key:"generateSEI",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=new Uint8Array([0,0,0,1]),n=new Uint8Array([6]),i=new Uint8Array([5]),o=t?KH:WH,a=qH(e.byteLength+o.byteLength),s=XH(e);return new Uint8Array([].concat(k(r),k(n),k(i),k(a),k(o),k(s),[128]))}},{key:"decodeSeiBody",value:function(e){var t=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]||t.push(e[r]);return new Uint8Array(t)}(e=e.slice(0,e.length-1));if(!(t.byteLength<2)){var r=0;if(5===t[1]||100===t[1]){var n=E(YH(t,r+=2),2),i=n[0],o=2,a=(r=n[1])+i;return t.byteLength>=WH.byteLength&&i>=WH.byteLength&&t.slice(r,r+WH.byteLength).toString()===WH.toString()?(r+=WH.byteLength,o=1):t.byteLength>=WH.byteLength&&i>=WH.byteLength&&t.slice(r,r+KH.byteLength).toString()===KH.toString()&&(r+=KH.byteLength,o=0),{type:o,payload:t.slice(r,a)}}}}},{key:"parseInternalSEI",value:function(e){var t=new Map,r=0;if(0===e.type){for(;e.payload.byteLength-r>=2;){var n=E(YH(e.payload,r),2),i=n[0];r=n[1];var o=E(YH(e.payload,r),2),a=o[0];if(r=o[1],t.get(i)||!(a<e.payload.byteLength-r))break;t.set(i,e.payload.slice(r,r+a))}return t}}},{key:"makeInternalSei",value:function(e){var t,r=[],n=A(e);try{for(n.s();!(t=n.n()).done;){var i=E(t.value,2),o=i[0],a=i[1],s=qH(o),u=qH(a.byteLength);r.push(s,u,a)}}catch(lV){n.e(lV)}finally{n.f()}var c=r.reduce((function(e,t){return e+t.byteLength}),0),d=new Uint8Array(c);return r.reduce((function(e,t){return d.set(t,e),e+t.byteLength}),0),d}}]),e}(),QH=function(){function e(t){c(this,e),h(this,"_stream",void 0),h(this,"_timer",void 0),h(this,"client",void 0),h(this,"handler",void 0),h(this,"monitor",void 0),this._stream=t}return l(e,[{key:"setVar",value:function(e,t,r){this.client=e,this.handler=t,this.monitor=r}},{key:"delStatsEvtInterval",value:function(){clearTimeout(this._timer),this._timer=void 0}},{key:"destroy",value:function(){this.delStatsEvtInterval()}}]),e}(),ZH=function(e){f(i,e);var t,r,n=g(i);function i(e){var t;return c(this,i),(t=n.call(this,e))._stream=e,t}return l(i,[{key:"setLocalStreamStatsEvtInterval",value:function(e,t,r){var n,i,a,s=this;if(!this._timer){this.setVar(e,t,r),e.once(ej.ABNORMAL_DISCONNECTION,(function(){s.destroy()}));var c={audio:{},video:{}},d=this._stream,l=null===(n=d.audioTrack)||void 0===n?void 0:n.getPublishTrack(),h=null===(i=d.videoTrack)||void 0===i?void 0:i.getTrack();this.getAudioStats(l,c,null===(a=d.audioTrack)||void 0===a?void 0:a.getAudioLevel()),this.getVideoStats(h,c),this.delStatsEvtInterval();var f=function(){var e=u(o().mark((function e(){var t,r,n,i,a,u,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null===(t=d.audioTrack)||void 0===t?void 0:t.getPublishTrack(),a=null===(r=d.videoTrack)||void 0===r?void 0:r.getTrack(),e.next=4,s.getAudioStats(i,c,null===(n=d.audioTrack)||void 0===n?void 0:n.getAudioLevel());case 4:return u=e.sent,e.next=7,s.getVideoStats(a,c);case 7:return l=e.sent,e.abrupt("return",{audioStats:u,videoStats:l,isScreen:d.isScreen});case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),p=function(){var e=u(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,f();case 2:r=e.sent,null===(t=s.client)||void 0===t||t.emit("onLocalStreamStats",r),s._timer=setTimeout(p,2e3);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();this._timer=setTimeout(p,2e3)}}},{key:"unpublish",value:function(){this.delStatsEvtInterval()}},{key:"getAudioStats",value:(r=u(o().mark((function e(t,r,n){var i,a,s,u,c,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i={},a={timestamp:Date.now()},s=this._stream,u=s.streamId,c=s.audioMid,d=s.isScreen,l=s.pubAttributes,h={media_type:"audio",is_screen:!!d,direction:"up",stream_id:u,vid:c,connection_status:navigator.onLine,capture_state:l.localaudio?"capture_state_on":"capture_state_off"},t&&this.handler){e.next=6;break}return e.abrupt("return",i);case 6:return e.next=8,this.handler.getStats(t);case 8:if((f=e.sent).length){e.next=11;break}return e.abrupt("return",i);case 11:if(f.forEach((function(e){var t=e.type,r=e.packetsSent,n=e.packetsLost,o=e.bytesSent,s=e.clockRate,u=e.roundTripTime,c=e.channels,d=e.audioLevel,l=e.googRtt,f=e.mimeType,p=e.availableIncomingBitrate,_=e.availableOutgoingBitrate,v=e.bytesReceived,m=e.nominated,y=e.id,g=e.currentRoundTripTime,S=e.state,b=e.writable,E=e.requestsReceived,k=e.responsesReceived,T=e.requestsSent,I=e.consentRequestsSent,A=e.responsesSent,R=e.jitter,w=e.candidateType,C=e.ip,O=e.address,x=e.networkType,N=e.port,D=e.protocol,P=e.nackCount,M=e.retransmittedBytesSent,U=e.retransmittedPacketsSent,L=e.roundTripTimeMeasurements,V=e.audioInputLevel,F=e.ssrc,B=e.totalAudioEnergy,j=e.totalSamplesDuration,G=e.mediaType,H=e.fractionLost;"outbound-rtp"===t?(a.packetsSent=r,a.bytesSent=o,h.bytes=o,h.packetsSent=r,h.nackCount=P,h.ssrc=F,h.retransmitted_bytes_sent=M,h.retransmitted_packets_sent=U,a.retransmittedPacketsSent=U):"remote-inbound-rtp"===t?(a.packetsLost=n,h.packetsLost=n,h.jitter=1e3*R,i.rtt=1e3*u,h.rtt=i.rtt,h.round_trip_time_measurements=L,i._fractionLost=H||0):"codec"===t?(i.recordSampleRate=s,i.numChannels=c,h.codecName=f):"media-source"===t&&void 0!==d?(h.audio_level=d?-10*Math.log10(Math.pow(d,2)):d,h.volume=255*d,h.total_audio_energy=B,h.total_samples_duration=j):"ssrc"===t&&"audio"===G?(h.audio_network_elapse=l,h.send_level=V):"candidate-pair"===t?(h.ice_available_incoming_bitrate=p,h.ice_available_outgoing_bitrate=_,h.ice_bytes_received=v,h.ice_bytes_sent=o,h.ice_nominated=+m,h.ice_pair_id=y,h.ice_pair_rtt=g,h.ice_pair_state=S,h.ice_pair_writable=b,h.recv_ping_requests=E,h.recv_ping_responses=k,h.sent_ping_requests_before_first_response=T,h.sent_ping_requests_total=T+(I||0),h.sent_ping_responses=A):"local-candidate"===t?(h.local_candidate_type=w,h.local_ip=C||O,h.local_network_type=x,h.local_port=N,h.protocol=D):"remote-candidate"===t&&(h.remote_candidate_type=w,h.remote_ip=C||O,h.remote_port=N)})),void 0===h.volume&&void 0!==n&&(h.volume=n,h.audio_level=n?-10*Math.log10(Math.pow(n/255,2)):n),(p=r.audio).timestamp){e.next=17;break}return r.audio=a,e.abrupt("return",i);case 17:return void 0!==a.packetsLost&&(i.audioLossRate=(a.packetsLost-p.packetsLost)/(a.packetsSent-p.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,h.fraction_lost=i.audioLossRate),i.statsInterval=a.timestamp-p.timestamp,h.stats_interval=i.statsInterval,i.sendKBitrate=(a.bytesSent-p.bytesSent||0)/i.statsInterval*8,h.bitrate=Math.round(1e3*i.sendKBitrate),h.bandwidth=Math.round(h.bitrate/1024),r.audio=a,this.monitor.rtcMediaStatistics(h,{}),i._retransmittedRate=(a.retransmittedPacketsSent-p.retransmittedPacketsSent)/(a.packetsSent-p.packetsSent),i._fractionLost=Math.max(i._fractionLost,i.audioLossRate),e.abrupt("return",i);case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"getVideoStats",value:(t=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p,_,v,m;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={timestamp:Date.now(),simulcast:{}},a=this._stream,s=a.streamId,u=a.videoMid,c=a.isScreen,d=a.pubAttributes,l=a.enableSimulcast,h={media_type:"video",is_screen:!!c,direction:"up",stream_id:s,vid:u,connection_status:navigator.onLine,capture_state:d.localvideo?"capture_state_on":"capture_state_off"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return n.isScreen=c,e.next=9,this.handler.getStats(t);case 9:if((f=e.sent).length){e.next=12;break}return e.abrupt("return",n);case 12:if(p=0,f.forEach((function(e){var t=e.type,r=e.framesEncoded,o=e.packetsLost,a=e.bytesSent,s=e.framesSent,u=e.roundTripTime,c=e.mimeType,d=e.frameWidth,f=e.frameHeight,_=e.packetsSent,v=e.googActualEncBitrate,m=e.googAvailableReceiveBandwidth,y=e.googAvailableSendBandwidth,g=e.googAvgEncodeMs,S=e.googBucketDelay,b=e.googEncodeUsagePercent,E=e.googFrameRateInput,k=e.availableIncomingBitrate,T=e.availableOutgoingBitrate,I=e.bytesReceived,A=e.nominated,R=e.id,w=e.currentRoundTripTime,C=e.state,O=e.writable,x=e.candidateType,N=e.ip,D=e.address,P=e.networkType,M=e.port,U=e.nackCount,L=e.pliCount,V=e.protocol,F=e.qpSum,B=e.requestsReceived,j=e.responsesReceived,G=e.googRetransmitBitrate,H=e.requestsSent,z=e.consentRequestsSent,K=e.responsesSent,W=e.ssrc,X=e.googTargetEncBitrate,q=e.googTransmitBitrate,Y=e.googRtt,J=e.retransmittedPacketsSent,Q=e.encoderImplementation,Z=e.jitter,$=e.rid,ee=e.fractionLost;"outbound-rtp"===t?(l&&($?i.simulcast[$]=e:i.simulcast[p]=e,p++),i.framesEncoded=r,i.bytesSent=a,i.framesSent=s,h.bytes=a,i.packetsSent=_,h.packetsSent=_,h.nackCount=U,h.pli_count=L,h.qp_sum=F,h.ssrc=W,h.retransmitted_packets_sent=J,i.retransmittedPacketsSent=J,h.encoder_implementation=Q,void 0!==d&&(n.encodedFrameWidth=d,n.encodedFrameHeight=f,h.frame_size_height=f,h.frame_size_width=d)):"track"===t?(n.encodedFrameWidth=d,n.encodedFrameHeight=f,h.frame_size_height=f,h.frame_size_width=d):"remote-inbound-rtp"===t?(i.packetsLost=o,n.rtt=1e3*u,h.rtt=n.rtt,h.jitter=Z,h.packetsLost=o,n._fractionLost=ee||0):"codec"===t?(n.codecType=c,h.codecName=c):"candidate-pair"===t?(h.ice_available_incoming_bitrate=k,h.ice_available_outgoing_bitrate=T,h.ice_bytes_received=I,h.ice_bytes_sent=a,h.ice_nominated=+A,h.ice_pair_id=R,h.ice_pair_rtt=w,h.ice_pair_state=C,h.ice_pair_writable=O,h.recv_ping_requests=B,h.recv_ping_responses=j,h.sent_ping_requests_before_first_response=H,h.sent_ping_requests_total=H+z,h.sent_ping_responses=K):"local-candidate"===t?(h.local_candidate_type=x,h.local_ip=N||D,h.local_network_type=P,h.local_port=M,h.protocol=V):"remote-candidate"===t?(h.remote_candidate_type=x,h.remote_ip=N||D,h.remote_port=M):"VideoBwe"===t?(h.encBitratebps=v,h.available_receive_bandwidth=m,h.available_send_bandwidth=y,h.bucket_delay=S,h.retransmitBitratebps=G,h.targetEncBitratebps=X,h.transmit_bitrate=q,n._sendBandWidth=+y):"ssrc"===t&&(h.video_network_elapse=Y,h.avg_encode_ms=g,h.encodeUsage=b,h.frame_rate_input=E,h.orignal_input_Framerate=+E)})),(_=r.video).timestamp){e.next=18;break}return r.video=i,e.abrupt("return",n);case 18:return n.statsInterval=i.timestamp-_.timestamp,h.stats_interval=n.statsInterval,v=Object.keys(i.simulcast),l?(h.sim_enc_width=[],h.sim_enc_height=[],h.sim_enc_bps=[],h.sim_enc_framerate=[],h.sim_rids=[],h.sim_enc_bandwidth=[],h.sim_sent_framerate=[],h.sim_fraction_lost=[],m=!1,v.sort((function(e,t){return+e-+t})).forEach((function(e){var t=i.simulcast[e],r=t.frameWidth,o=t.frameHeight,a=t.bytesSent,s=t.framesEncoded,u=t.framesSent,c=t.packetsLost,d=t.packetsSent,l=t.qualityLimitationReason,f=t.qualityLimitationDurations,p=t.qualityLimitationResolutionChanges,v=t.retransmittedPacketsSent;void 0!==l&&(h.sim_qualityLimitationReason||(h.sim_qualityLimitationReason=[],h.sim_qualityLimitationDurations=[],h.sim_qualityLimitationResolutionChanges=[]),h.sim_qualityLimitationReason.push(l),h.sim_qualityLimitationDurations.push(f),h.sim_qualityLimitationResolutionChanges.push(p));var y=_.simulcast[e];if(h.sim_enc_width.push(r||0),h.sim_enc_height.push(o||0),y){var g=(a-y.bytesSent||0)/n.statsInterval;h.sim_enc_bps.push(Math.round(8e3*g)),h.sim_enc_bandwidth.push(Math.round(8e3*g/1024));var S=1e3*(s-y.framesEncoded)/n.statsInterval;h.sim_enc_framerate.push(Math.round(S)),h.sim_rids.push(e);var b=void 0!==u?u-y.framesSent:s-y.framesEncoded,E=1e3*b/n.statsInterval;h.sim_sent_framerate.push(Math.round(E));var k=(c-y.packetsLost)/(d-y.packetsSent);n._retransmittedRate=(v-y.retransmittedPacketsSent)/(d-y.packetsSent),k=Number.isNaN(k)?0:k,h.sim_fraction_lost.push(k),r>0&&!m&&(n.sentKBitrate=8*g,n.encoderOutputFrameRate=S,n.encodedFrameCount=b,n.sentFrameRate=E,n.videoLossRate=k,m=!0)}})),this.monitor.rtcMediaStatistics(h,{})):(n.encodedFrameCount=void 0!==i.framesSent?i.framesSent-_.framesSent:i.framesEncoded-_.framesEncoded,n.sentKBitrate=(i.bytesSent-_.bytesSent||0)/n.statsInterval*8,h.bitrate=Math.round(1e3*n.sentKBitrate),h.bandwidth=Math.round(h.bitrate/1024),n.encoderOutputFrameRate=1e3*(i.framesEncoded-_.framesEncoded)/n.statsInterval,h.frame_rate_encoded=Math.round(n.encoderOutputFrameRate),n.sentFrameRate=1e3*n.encodedFrameCount/n.statsInterval,h.frame_rate_sent=Math.round(n.sentFrameRate),n.videoLossRate=(i.packetsLost-_.packetsLost)/(i.packetsSent-_.packetsSent),n.videoLossRate=Number.isNaN(n.videoLossRate)?0:n.videoLossRate,h.fraction_lost=n.videoLossRate,n._retransmittedRate=(i.retransmittedPacketsSent-_.retransmittedPacketsSent)/(i.packetsSent-_.packetsSent),this.monitor.rtcMediaStatistics(h,{})),r.video=i,n._fractionLost=Math.max(n._fractionLost,n.videoLossRate),e.abrupt("return",n);case 25:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),i}(QH),$H=function(e){f(a,e);var t,r,n,i=g(a);function a(e){var t;return c(this,a),h(m(t=i.call(this,e)),"_audioStallCount",void 0),h(m(t),"_setAudioStallCount",void 0),h(m(t),"_audioStallTimer",void 0),h(m(t),"_audioStallInterval",void 0),h(m(t),"_audioStallRatio",void 0),h(m(t),"_videoInWaiting",void 0),t._videoInWaiting=!1,t}return l(a,[{key:"setRemoteStreamStatsEvtInterval",value:(n=u(o().mark((function e(t,r,n){var i,s,c,d,l,h,f,p,_,v,m,y,g,S,b=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._timer){e.next=2;break}return e.abrupt("return");case 2:return this.setVar(t,r,n),t.once(ej.ABNORMAL_DISCONNECTION,(function(){b.destroy()})),this._audioStallInterval=a.audioStallInterval||100,this._audioStallRatio=a.audioStallRatio||.6,c={audio:{},video:{}},d=this._stream,l=null===(i=d.audioTrack)||void 0===i?void 0:i.getTrack(),h=null===(s=d.videoTrack)||void 0===s?void 0:s.getTrack(),this.getRemoteVideoStats(h,c),e.next=13,this.getRemoteAudioStats(l,c);case 13:this.delStatsEvtInterval(),f=0,p=0,v=[],m=0,y=cP(),this._setAudioStallCount=function(){if(b._audioStallInterval>0&&void 0!==c.audio.concealedSamples){var e=c.audio.concealedSamples,t=c.audio.totalSamplesReceived;y=cP();var r={isStall:!1,counted:!1,diff:0},n=.5*b._audioStallInterval;b._audioStallCount=u(o().mark((function i(){var a,s,u,c,l,h,_,g,S,E,k,T,I,A,R;return o().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(s=d.hasAudio,u=d.subAudio,s&&u){i.next=7;break}return r.isStall=!1,r.counted=!1,v.push({reason:"hasAudio: ".concat(s,", subAudio: ").concat(u)}),y=cP(),i.abrupt("return",{stall_count:f,stall_duration:p,stall_list:v,stats_count:m});case 7:return c=null===(a=d.audioTrack)||void 0===a?void 0:a.getTrack(),l=Date.now(),i.next=11,b.handler.getStats(c,!0);case 11:if(h=i.sent,_=Date.now(),g=cP(),!((S=g-y)<n)){i.next=18;break}return v.push({diff:S,start:y,end:g,get_stats_cost:_-l,get_stats_start:l,get_stats_end:_,reason:"diff(".concat(S,") < minInterval(").concat(n,")")}),i.abrupt("return",{stall_count:f,stall_duration:p,stall_list:v,stats_count:m});case 18:if(E=h.length,k=h.find((function(e){return"inbound-rtp"===e.type}))){i.next=23;break}return v.push({diff:S,start:y,end:g,get_stats_cost:_-l,get_stats_start:l,get_stats_end:_,reason:E?"no inbound-rtp":"no report"}),i.abrupt("return",{stall_count:f,stall_duration:p,stall_list:v,stats_count:m});case 23:return T=k.concealedSamples,I=k.totalSamplesReceived,R=I-t,(A=T-e)>=0&&R>=0&&A>=b._audioStallRatio*R?(v.push({concealed:A,received:R,diff:S,start:y,end:g,get_stats_cost:_-l,get_stats_start:l,get_stats_end:_,is_stall:!0}),r.isStall?(r.counted?p+=S:(p=p+r.diff+S,f++),r.counted=!0):S>=200?(p+=S,f++,r.counted=!0):(r.counted=!1,r.diff=S),r.isStall=!0):(v.push({concealed:A,received:R,diff:S,start:y,end:g,get_stats_cost:_-l,get_stats_start:l,get_stats_end:_}),r.isStall=!1,r.counted=!1),e=T,t=I,y=g,m++,i.abrupt("return",{stall_count:f,stall_duration:p,stall_list:v,stats_count:m});case 32:case"end":return i.stop()}}),i)}))),_=function(){var e=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!b._audioStallCount&&b._setAudioStallCount&&b._setAudioStallCount(),!b._audioStallCount){e.next=5;break}return e.next=4,b._audioStallCount();case 4:b._audioStallTimer=setTimeout(_,b._audioStallInterval);case 5:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),b._audioStallTimer=setTimeout(_,b._audioStallInterval)}},this._setAudioStallCount(),g=function(){var e=u(o().mark((function e(){var t,r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null===(t=d.audioTrack)||void 0===t?void 0:t.getTrack(),i=null===(r=d.videoTrack)||void 0===r?void 0:r.getTrack(),e.next=4,b.getRemoteAudioStats(n,c);case 4:return a=e.sent,f=0,p=0,v=[],m=0,e.next=11,b.getRemoteVideoStats(i,c);case 11:return s=e.sent,e.abrupt("return",{audioStats:a,videoStats:s,isScreen:d.isScreen,userId:d.userId});case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),S=function(){var e=u(o().mark((function e(){var t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g();case 2:r=e.sent,null===(t=b.client)||void 0===t||t.emit("onRemoteStreamStats",r),_&&(y=cP(),b._audioStallTimer=setTimeout(_,b._audioStallInterval)),b._timer=setTimeout(S,2e3);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this._timer=setTimeout(S,2e3);case 24:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"delStatsEvtInterval",value:function(){b(p(a.prototype),"delStatsEvtInterval",this).call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0}},{key:"unsubscribe",value:function(){this.delStatsEvtInterval(),this._videoInWaiting=!1}},{key:"getRemoteAudioStats",value:(r=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p,_,v,m,y,g,S,b;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={},a=this._stream,s=a.streamId,u=a.userId,c=a.isScreen,d=a.audioMid,l=a.subMediaType,h=a._attributes,f={media_type:"audio",is_screen:!!c,direction:"down",stream_id:s,stream_user_id:u,vid:d,connection_status:navigator.onLine,mute_state:IP(l)?"mute_state_off":"mute_state_on",remote_user_capture_state:h.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:h.localaudio&&h.audiostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return e.next=8,this.handler.getStats(t);case 8:if((p=e.sent).length){e.next=11;break}return e.abrupt("return",n);case 11:if(p.forEach((function(e){var t=e.type,r=e.packetsLost,o=e.packetsReceived,a=e.bytesReceived,s=e.jitterBufferDelay,u=e.jitterBufferEmittedCount,c=e.clockRate,d=e.channels,l=e.totalSamplesReceived,h=e.concealedSamples,p=e.silentConcealedSamples,_=e.concealmentEvents,v=e.totalRoundTripTime,m=e.state,y=e.currentRoundTripTime,g=e.audioLevel,S=e.totalAudioEnergy,b=e.totalSamplesDuration,E=e.mimeType,k=e.googDecodingNormal,T=e.fecPacketsReceived,I=e.availableIncomingBitrate,A=e.availableOutgoingBitrate,R=e.bytesSent,w=e.nominated,C=e.id,O=e.writable,x=e.jitter,N=e.candidateType,D=e.ip,P=e.address,M=e.networkType,U=e.port,L=e.protocol,V=e.audioOutputLevel,F=e.requestsReceived,B=e.responsesReceived,j=e.requestsSent,G=e.consentRequestsSent,H=e.responsesSent,z=e.ssrc;e.kind,"inbound-rtp"===t?(i.packetsLost=r,i.packetsReceived=o,f.packetsReceived=o,i.bytesReceived=a,f.bytes=a,void 0!==s&&(n.jitterBufferDelay=s/u*1e3,f.average_jitter_buffer_delay_ms=n.jitterBufferDelay),void 0!==l&&(i.totalSamplesReceived=l,n.concealedSamples=h,i.concealedSamples=h,i.silentConcealedSamples=p,f.concealedSamples=h,n.concealmentEvents=_,f.totalSamplesReceived=l),void 0!==T&&(f.fec_packets_received=T),f.jitter=1e3*x,f.ssrc=z,void 0!==g&&(f.audio_level=g?-10*Math.log10(Math.pow(g,2)):g),void 0!==g&&(f.volume=255*g),void 0!==S&&(f.total_audio_energy=S),void 0!==b&&(f.totalAudioDuration=b)):"codec"===t?(n.recordSampleRate=c,d&&(n.numChannels=d),f.codecName=E):"candidate-pair"===t?(f.ice_available_incoming_bitrate=I,f.ice_available_outgoing_bitrate=A,f.ice_bytes_received=a,f.ice_bytes_sent=R,f.ice_nominated=+w,f.ice_pair_id=C,f.ice_pair_rtt=y,f.rtt=1e3*y,f.ice_pair_state=m,f.ice_pair_writable=O,f.recv_ping_requests=F,f.recv_ping_responses=B,f.sent_ping_requests_before_first_response=j,f.sent_ping_requests_total=j+(G||0),f.sent_ping_responses=H,"succeeded"===m&&(n.rtt=1e3*y,n.total_rtt=1e3*v)):"track"===t&&void 0!==g?(f.audio_level=g?-10*Math.log10(Math.pow(g,2)):g,f.volume=255*g,f.total_audio_energy=S,f.totalAudioDuration=b):"ssrc"===t?(f.decodingNormal=k,f.recvAudioLevel=V):"local-candidate"===t?(f.local_candidate_type=N,f.local_ip=D||P,f.local_network_type=M,f.local_port=U,f.protocol=L):"remote-candidate"===t&&(f.remote_candidate_type=N,f.remote_ip=D||P,f.remote_port=U)})),(_=r.audio).timestamp){e.next=17;break}return i.timestamp=Date.now(),r.audio=i,e.abrupt("return",n);case 17:if(v={},void 0!==i.concealedSamples&&(f.interval_concealed_samples=i.concealedSamples-_.concealedSamples,f.interval_samples_received=i.totalSamplesReceived-_.totalSamplesReceived,f.interval_silent_concealed_samples=i.silentConcealedSamples-_.silentConcealedSamples),!(this._audioStallInterval>0&&void 0!==_.concealedSamples)){e.next=35;break}if(!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),clearTimeout(this._audioStallTimer),!this._audioStallCount){e.next=35;break}return e.next=25,this._audioStallCount();case 25:m=e.sent,y=m.stall_count,g=m.stall_duration,S=m.stall_list,b=m.stats_count,v.stall_list=S,v.stats_count=b,f.concealedSamples===f.interval_concealed_samples&&f.totalSamplesReceived===f.interval_samples_received?(f.stall_count=0,f.stall_duration=0):(f.stall_count=y,f.stall_duration=g),n.stallCount=f.stall_count,n.stallDuration=f.stall_duration;case 35:return i.timestamp=Date.now(),n.audioLossRate=(i.packetsLost-_.packetsLost)/(i.packetsReceived-_.packetsReceived+(i.packetsLost-_.packetsLost)),n.audioLossRate=Number.isNaN(n.audioLossRate)?0:n.audioLossRate,f.packetsLost=Math.round(i.packetsLost-_.packetsLost),f.fraction_lost=n.audioLossRate,f.packets_lost_rate=n.audioLossRate,n.statsInterval=i.timestamp-_.timestamp,f.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-_.bytesReceived||0)/n.statsInterval*8,f.bitrate=Math.round(1e3*n.receivedKBitrate),f.bandwidth=Math.round(f.bitrate/1024),void 0!==i.concealedSamples&&(n.receivedSampleRate=1e3*f.interval_samples_received/n.statsInterval),r.audio=i,this.monitor.rtcMediaStatistics(f,{},v),e.abrupt("return",n);case 50:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getRemoteVideoStats",value:(t=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={timestamp:Date.now()},a=this._stream,s=a.streamId,u=a.userId,c=a.isScreen,d=a.subMediaType,l=a._attributes,h={media_type:"video",is_screen:!!c,direction:"down",stream_id:s,stream_user_id:u,vid:this._stream.videoMid,connection_status:navigator.onLine,mute_state:AP(d)?"mute_state_off":"mute_state_on",remote_user_capture_state:l.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:l.localvideo&&l.videostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return n.isScreen=c,e.next=9,this.handler.getStats(t);case 9:if((f=e.sent).length){e.next=12;break}return e.abrupt("return",n);case 12:if(f.forEach((function(e){var t=e.type,r=e.frameHeight,o=e.frameWidth,a=e.packetsLost,s=e.packetsReceived,u=e.bytesReceived,c=e.framesDecoded,d=e.jitterBufferDelay,l=e.jitterBufferEmittedCount,f=e.mimeType,p=e.firCount,_=e.availableIncomingBitrate,v=e.availableOutgoingBitrate,m=e.bytesSent,y=e.nominated,g=e.id,S=e.currentRoundTripTime,b=e.state,E=e.writable,k=e.candidateType,T=e.ip,I=e.address,A=e.networkType,R=e.port,w=e.nackCount,C=e.pliCount,O=e.protocol,x=e.requestsReceived,N=e.responsesReceived,D=e.requestsSent,P=e.consentRequestsSent,M=e.responsesSent,U=e.ssrc;e.kind;var L=e.jitter,V=e.framesReceived,F=e.keyFramesDecoded,B=e.totalDecodeTime,j=e.decoderImplementation,G=e.lastPacketReceivedTimestamp;"inbound-rtp"===t?(i.packetsLost=a,h.packetsLost=a,i.packetsReceived=s,h.packetsReceived=s,i.bytesReceived=u,h.bytes=u,i.framesDecoded=c,void 0!==d&&(i.jitterBufferDelay=d/l*1e3,h.average_jitter_buffer_delay_ms=i.jitterBufferDelay),h.fir_count=p,h.nackCount=w,i.nackCount=w,h.pli_count=C,h.ssrc=U,h.jitter=L,h.framesReceived=V,i.framesReceived=V,h.framesDecoded=c,h.key_frames_decoded=F,h.total_decode_time=B,h.decoder_name=j,h.last_packet_received_timestamp=G,void 0!==o&&(n.width=o,h.frame_size_width=o,n.height=r,h.frame_size_height=r)):"track"===t&&void 0!==o?(n.width=o,h.frame_size_width=o,n.height=r,h.frame_size_height=r,void 0!==V&&(h.framesReceived=V,i.framesReceived=V)):"codec"===t?h.codecName=f:"candidate-pair"===t?(h.ice_available_incoming_bitrate=_,h.ice_available_outgoing_bitrate=v,h.ice_bytes_received=u,h.ice_bytes_sent=m,h.ice_nominated=+y,h.ice_pair_id=g,h.ice_pair_rtt=S,h.rtt=1e3*S,n.rtt=h.rtt,h.ice_pair_state=b,h.ice_pair_writable=E,h.recv_ping_requests=x,h.recv_ping_responses=N,h.sent_ping_requests_before_first_response=D,h.sent_ping_requests_total=D+(P||0),h.sent_ping_responses=M):"local-candidate"===t?(h.local_candidate_type=k,h.local_ip=T||I,h.local_network_type=A,h.local_port=R,h.protocol=O):"remote-candidate"===t&&(h.remote_candidate_type=k,h.remote_ip=T||I,h.remote_port=R)})),(p=r.video).timestamp){e.next=17;break}return r.video=i,e.abrupt("return",n);case 17:return n.videoLossRate=(i.packetsLost-p.packetsLost)/(i.packetsReceived-p.packetsReceived+(i.packetsLost-p.packetsLost)),n._retransmittedRate=(i.nackCount-p.nackCount)/(i.packetsReceived-p.packetsReceived+(i.packetsLost-p.packetsLost)),n.videoLossRate=Number.isNaN(n.videoLossRate)?0:n.videoLossRate,h.fraction_lost=n.videoLossRate,h.packets_lost_rate=n.videoLossRate,n.statsInterval=i.timestamp-p.timestamp,h.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-p.bytesReceived||0)/n.statsInterval*8,h.bitrate=Math.round(1e3*n.receivedKBitrate),h.bandwidth=Math.round(h.bitrate/1024),n.decoderOutputFrameRate=1e3*(i.framesDecoded-p.framesDecoded)/n.statsInterval,n.receivedFrameRate=1e3*(i.framesReceived-p.framesReceived)/n.statsInterval,h.frame_rate_decoded=Math.round(n.decoderOutputFrameRate),h.frame_rate_received=h.frame_rate_decoded,r.video=i,this.processStall(this._stream,h,n,c),this.monitor.rtcMediaStatistics(h,{}),e.abrupt("return",n);case 35:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"processStall",value:function(e,t,r,n){var i=0,o=0,a=0;if(e.recordedVideoFrames){e.recordedVideoFrames.forEach((function(e){e.isStall&&(i+=e.stallCount,o+=e.stallDuration),a=e.playTime})),e.recordedVideoFrames.length||(o=2e3,i=this._videoInWaiting?0:1,this._videoInWaiting=!0);var s=e.recordedVideoFrames.pop();s&&(s.isStall?this._videoInWaiting=!0:this._videoInWaiting=!1),e.recordedVideoFrames=[]}t.stall_count=i,n?(t.stuck_length=o,t.stall_duration=void 0):(t.stall_duration=o,t.stuck_length=void 0),t.play_time=a,r.stallCount=i,r.stallDuration=o}},{key:"destroy",value:function(){b(p(a.prototype),"destroy",this).call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1}}],[{key:"audioStallConfig",set:function(e){a.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,a.audioStallRatio=null==e?void 0:e.audio_stall_ratio}}]),a}(QH);h($H,"audioStallInterval",void 0),h($H,"audioStallRatio",void 0);var ez,tz,rz,nz=function(e){return e.RESUBSCRIBE="resubscribe",e.STREAM_FAILED="stream_failed",e.SUBSCRIBE_PUSH_TRACK="subscribe_push_track",e.REMOVE_PUSH_TRACK="remove_push_track",e.VIDEO_FIRST_FRAME="video_first_frame",e.ON_USER_PUBLISH_STATE_CHANGE="on_user_publish_state_change",e.ON_USER_START_AUDIO_CAPTURE="on_user_start_audio_capture",e.ON_USER_STOP_AUDIO_CAPTURE="on_user_stop_audio_capture",e.ON_USER_START_VIDEO_CAPTURE="on_user_start_video_capture",e.ON_USER_STOP_VIDEO_CAPTURE="on_user_stop_video_capture",e.ON_SEI_MESSAGED_RECEIVED="on_sei_messaged_received",e.ON_PUBLISH_RESULT="on_publish_result",e.ON_UPDATE_TOKEN_SUCCESS="on_update_token_success",e.ON_REMOTE_STREAM_STATS="ON_REMOTE_STREAM_STATS",e.ON_LOCAL_STREAM_STATS="ON_LOCAL_STREAM_STATS",e.ON_USER_LEAVE="on_user_leave",e.ON_ROOM_ERROR="on_room_error",e.ON_NETWORK_QUALITY="on_network_quality",e.ON_SIMULCAST_SUBSCRIBE_FALLBACK="on_simulcast_subscribe_fallback",e.ON_REMOTE_VIDEO_SIZE_CHANGED="on_remote_video_size_changed",e.RECONNECT_FAILED="reconnect_failed",e.ON_VIDEO_STREAM_BANNED="ON_VIDEO_STREAM_BANNED",e.ON_AUDIO_STREAM_BANNED="ON_AUDIO_STREAM_BANNED",e}(nz||{}),iz=function(e){return e[e.START=1]="START",e[e.START_SUCCESS=2]="START_SUCCESS",e[e.START_FAILED=3]="START_FAILED",e[e.UPDATE=4]="UPDATE",e[e.UPDATE_SUCCESS=5]="UPDATE_SUCCESS",e[e.UPDATE_FAILED=6]="UPDATE_FAILED",e[e.STOP=7]="STOP",e[e.STOP_SUCCESS=8]="STOP_SUCCESS",e[e.STOP_FAILED=9]="STOP_FAILED",e}(iz||{}),oz=function(e){return e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB",e}(oz||{}),az=function(e){return e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB",e}(az||{}),sz=new xU("Stream",0),uz=function(e){return e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED",e}(uz||{}),cz=function(){function e(){c(this,e),h(this,"isScreen",!1),h(this,"stream",void 0),h(this,"streamId",void 0),h(this,"audioMid",void 0),h(this,"videoMid",void 0),h(this,"seiList",[]),h(this,"videoTrack",void 0),h(this,"audioTrack",void 0),h(this,"videoTransceiver",void 0),h(this,"audioTransceiver",void 0),h(this,"videoInputConfig",void 0),h(this,"videoEncodeConfig",[qB]),h(this,"subVideoDescriptions",[]),h(this,"enableSimulcast",!1),h(this,"observer",void 0),h(this,"statsReport",void 0),h(this,"prevScaleResolutionDownBy",1),h(this,"pubAudio",!1),h(this,"pubVideo",!1),h(this,"pubAttributes",void 0),this.stream=new MediaStream,this.videoInputConfig={width:640,height:360,frameRate:30},this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},this.statsReport=new ZH(this)}return l(e,[{key:"hasPublished",get:function(){return this.videoTransceiver&&this.audioTransceiver}},{key:"isEmptyStream",get:function(){return!this.audioTrack&&!this.videoTrack}},{key:"initStreamId",get:function(){return this.stream.id}},{key:"initVideoEncodedTransform",value:function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(xj()){var r=t.createEncodedStreams(),n=r.readable,i=r.writable,o=new TransformStream({transform:function(t,r){var n=e.seiList[0];if(n){var i=JH.generateSEI(n.content),o=new Uint8Array(i.byteLength+t.data.byteLength);0===n.repeatCount&&e.seiList.splice(0,1),n.repeatCount--,o.set(new Uint8Array(t.data)),o.set(i,t.data.byteLength),t.data=o.buffer,r.enqueue(t)}else r.enqueue(t)}});n.pipeThrough(o).pipeTo(i)}}else sz.print("no sender found when trying to bind encodedTransform")}},{key:"initAudioEncodedTransform",value:function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else sz.print("no sender found when trying to bind encodedTransform")}},{key:"clean",value:function(){var e;this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy(),this.prevScaleResolutionDownBy=1,this.subVideoDescriptions=[]}},{key:"switchTrackEnableState",value:function(e,t){var r,n;"audio"===e?n=this.audioTrack:"video"===e&&(n=this.videoTrack);var i=null===(r=n)||void 0===r?void 0:r.getTrack();return!(!i||(null==i?void 0:i.enabled)===t)&&(i.enabled=t,!0)}}]),e}(),dz=function(e){f(r,e);var t=g(r);function r(e,n,i,o){var a,s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:W.LOW;return c(this,r),h(m(a=t.call(this)),"streamId",void 0),h(m(a),"userId",void 0),h(m(a),"isScreen",void 0),h(m(a),"hasVideo",void 0),h(m(a),"hasAudio",void 0),h(m(a),"_attributes",void 0),h(m(a),"streamState",void 0),h(m(a),"observer",void 0),h(m(a),"statsReport",void 0),h(m(a),"subVideo",void 0),h(m(a),"subAudio",void 0),h(m(a),"subMediaType",void 0),h(m(a),"subLayer",void 0),h(m(a),"audioMid",void 0),h(m(a),"videoMid",void 0),h(m(a),"autosubAudioMid",void 0),h(m(a),"autosubVideoMid",void 0),h(m(a),"_sequenceId",void 0),h(m(a),"stream",void 0),h(m(a),"videoTrack",void 0),h(m(a),"audioTrack",void 0),h(m(a),"videoTransceiver",void 0),h(m(a),"audioTransceiver",void 0),h(m(a),"recordedVideoFrames",void 0),h(m(a),"stillExist",void 0),h(m(a),"_workaround_1_",void 0),h(m(a),"paused",void 0),h(m(a),"originalMediaType",void 0),h(m(a),"originalStreamIndex",0),a.userPriority=s,a.userId=e,a.isScreen=i,a.streamId=n,a.hasAudio=o.audiostream&&o.localaudio,a.hasVideo=o.videostream&&o.localvideo,a._attributes=o,a.subVideo=!1,a.subAudio=!1,a._sequenceId=0,a.subMediaType=jH.NONE,a.subLayer={spatialLayer:0,spatialSubLayer:-1},a.streamState=0,a.statsReport=new $H(m(a)),a}return l(r,[{key:"sequenceId",get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)}},{key:"hasSubscribed",get:function(){return 2===this.streamState}},{key:"attributes",get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e}},{key:"initVideoEncodedTransform",value:function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),r=t.readable,n=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){GH.getNalunits(new HH(t.data)).forEach((function(t){if(t.sei){var r=JH.decodeSeiBody(t.body);r&&r.type!==zH.internal&&e.safeEmit("onSEIMessage",r.payload)}})),r.enqueue(t)}})).pipeTo(n)}else sz.print("no receiver found when trying to bind encodedTransform")}},{key:"initAudioEncodedTransform",value:function(){if(this.audioTransceiver&&this.audioTransceiver.receiver){var e=this.audioTransceiver.receiver.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else sz.print("no receiver found when trying to bind encodedTransform")}},{key:"ontrack",value:function(e){var t,r;if((null===(t=e.streams)||void 0===t||null===(r=t[0])||void 0===r?void 0:r.id)===this.streamId){var n,i=e.track;"video"===(null==i?void 0:i.kind)?this._setVideoTrack(i):"audio"===(null===(n=e.track)||void 0===n?void 0:n.kind)&&this._setAudioTrack(i),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)}},{key:"clean",value:function(){var e;sz.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=void 0,this.paused=!1,this._workaround_1_=!1,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy()}},{key:"resetHasSubscribed",value:function(){this.streamState=0}},{key:"setRemoteUserPriority",value:function(e){this.userPriority=e}},{key:"getStreamPriority",value:function(){var e=this.isScreen?20:this.hasAudio||this.hasVideo?this.attributes.videoDescriptions.length>1?10-this.subLayer.spatialLayer:9:0;return 1e4*this.userPriority+100*e}},{key:"getSubscribeFallbackParams",value:function(e){if(e!==K.DISABLE&&this.subVideo){if(this.attributes.videoDescriptions.length-1>this.subLayer.spatialLayer)return[this.originalMediaType,az.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer+1)];if(e===K.AUDIO_ONLY)return[L.VIDEO,az.UNSUB]}return null}},{key:"getSubscribeRecoverParams",value:function(){if(this.originalMediaType&&AP(this.originalMediaType)){if(!1===this.subVideo)return[this.originalMediaType,az.SUB,this.subLayer];if("number"==typeof this.originalStreamIndex&&this.subLayer.spatialLayer>this.originalStreamIndex)return[this.originalMediaType,az.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer-1)]}return null}},{key:"_setStream",value:function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}}},{key:"_setAudioTrack",value:function(e){var t,r;(null===(t=this.audioTrack)||void 0===t||null===(r=t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.audioTrack=new wH(e,uP()),this.emit("ontrack",this.audioTrack))}},{key:"_setVideoTrack",value:function(e){var t,r;(null===(t=this.videoTrack)||void 0===t||null===(r=t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.videoTrack=new RH(e,uP()),this.emit("ontrack",this.videoTrack))}},{key:"_getSubLayerBySpatialLayer",value:function(e){var t=this._attributes,r=t.videoDescriptions,n=t.subVideoDescriptions,i=void 0===n?[]:n,o=r[e],a=o.width,s=o.height,u=i.find((function(e){return e.width===a&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==u?void 0:u.sub_index)||-1}}}]),r}(DU),lz=new xU("queue",4),hz=function(e){return e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE",e}(hz||{}),fz=function(e){return e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack",e}(fz||{}),pz=(h(ez={},"publish","unpublish"),h(ez,"subscribe","unsubscribe"),h(ez,"pushtrack","removetrack"),ez),_z=(h(tz={},"publish",0),h(tz,"subscribe",0),h(tz,"pushtrack",0),h(tz,"unpublish",1),h(tz,"unsubscribe",1),h(tz,"removetrack",1),tz),vz=function(e){f(r,e);var t=g(r);function r(){var e;return c(this,r),h(m(e=t.call(this)),"_queue",void 0),e._queue=[],e}return l(r,[{key:"queue",get:function(){return this._queue}},{key:"enqueue",value:function(e){var t=this._queue.length,r="";return this._queue=this._queue.filter((function(t){return t.streamId!==e.streamId||e.action!==pz[t.action]||(r=t.streamId,lz.print("offsetStreamId",r),!1)})),this._queue.length===t&&this._queue.push(e),this.emit("start"),r}},{key:"dequeue",value:function(){if(!this._queue.length)return null;for(var e=_z[this._queue[0].action],t=1;t<this._queue.length;t++)if(_z[this._queue[t].action]!==e)return{sdpStrategy:e,items:this._queue.splice(0,t)};return{sdpStrategy:e,items:this._queue.splice(0,this._queue.length)}}}]),r}(RU),mz=new xU("ChromeHandler",3),yz=xj(),gz=function(e){f(k,e);var r,n,a,s,d,_,v,y,S=g(k);function k(e,t){var r;return c(this,k),h(m(r=S.call(this,e,t)),"name","chrome"),h(m(r),"_queueBusy",!1),h(m(r),"_sdpQueue",void 0),h(m(r),"_aSendonlyOfferTpl",void 0),h(m(r),"_vSendonlyOfferTpl",void 0),h(m(r),"_aRecvonlyOfferTpl",void 0),h(m(r),"_vRecvonlyOfferTpl",void 0),h(m(r),"_mid",0),h(m(r),"_offerSession",void 0),h(m(r),"_answerSession",void 0),h(m(r),"_offerMlines",[]),h(m(r),"_answerMlines",[]),h(m(r),"_inactiveMlineIndex",[]),h(m(r),"_msidIndexMap",{}),h(m(r),"_mlinesCache",{}),r._sdpQueue=new vz,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(mz.print("dequeue start"),r.dequeue())})),r}return l(k,[{key:"connect",value:(y=u(o().mark((function e(t){var r,n,a,s,u,c,d,l=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return mz.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=4,IG(t);case 4:return this._answerIce=e.sent,e.next=7,this._peerConnection.createOffer();case 7:return a=e.sent,s=Uj.parse(a.sdp),u=E(s.media,1),c=u[0],this._offerIce.fingerprint=s.fingerprint||c.fingerprint,delete s.media,this._offerSession=i({},s),this._answerSession=i({},s),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),d=this._mid++,this._offerMlines=[i(i(i({},c),this._offerIce),{},{mid:"".concat(d)})],this._answerMlines=[i(i(i({},c),this._answerIce),{},{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(d)})],this.setDescription(),e.next=21,new Promise((function(e,t){l._dataChannel.onopen=function(){mz.print("connect","dataChannel open"),RB("es.dc.open",""),e("")},l._dataChannel.onerror=function(e){yB.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,WF.INVALID_DATA),RB("es.dc.error",""),t(e)},l._dataChannel.onclose=function(e){RB("es.dc.close",""),t(e)},l._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==l._peerConnection.iceConnectionState&&"closed"!==l._peerConnection.iceConnectionState&&"failed"!==l._peerConnection.connectionState||t(e)}))}));case 21:return mz.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 23:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){b(p(k.prototype),"destroy",this).call(this),this._mlinesCache={}}},{key:"publish",value:(v=u(o().mark((function e(t,r){var n,a,s,u,c,d,l,h,f,_,v,m,y,g,S,T,I,A,R,w;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.stream,a=t.enableSimulcast,s=b(p(k.prototype),"internalPublish",this).call(this,t,r),u=s.videoDescriptions,c=s.subVideoDescriptions,d=s.transceiverInit,l="".concat(this._mid++),h="".concat(this._mid++),f=i(i(i({},this._aSendonlyOfferTpl),this._offerIce),{},{mid:l,msid:"".concat(n.id," ").concat(n.id,"-audio"),ssrcs:bG(n,"audio")}),_=i(i(i({},this._vSendonlyOfferTpl),this._offerIce),{},{mid:h,msid:"".concat(n.id," ").concat(n.id,"-video")}),a?(mz.print("subVideoDesc","desc: %o ",c),delete _.ssrcGroups,delete _.ssrcs,v=[],_.rids=u.map((function(e){var t=e.rid;return v.unshift(t),{id:t,direction:"send"}})),_.simulcast={dir1:"send",list1:v.join(";")}):(m=EG(n,"video"),y=m.ssrcs,g=m.ssrcGroups,_.ssrcs=y,_.ssrcGroups=g),vP&&mP&&Array.isArray(_.ext)&&(_.ext=_.ext.filter((function(e){var t;return!(null!=e&&null!==(t=e.uri)&&void 0!==t&&t.includes("video-orientation"))}))),null!=r&&r.audioRed&&Array.isArray(f.rtp)&&-1!==(S=f.rtp.findIndex((function(e){return"red"===e.codec})))&&(T=f.rtp.splice(S,1),I=E(T,1),A=I[0],f.rtp.unshift(A)),(R=null==f?void 0:f.rtp.find((function(e){return"opus"===e.codec})))&&f.fmtp&&(w=f.fmtp.find((function(e){return e.payload===R.payload})))&&this._context&&(w.config+=this._context.audioProfileManager.getOpusConfigStr()),this.addBitrateLimit(_,t.videoEncodeConfig[0].maxKbps),this._mlinesCache[t.stream.id]=[f,_],e.abrupt("return",{partialSdp:TG(this._offerSession,f,_),audioMid:l,videoMid:h,type:"incroffer",semantics:"unified-plan",videoDescriptions:u,subVideoDescriptions:c,transceiverInit:d});case 14:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"subscribe",value:(_=u(o().mark((function e(t,r){var n,a,s,u,c,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(mz.print("subscribe","mids: ",r),n="incroffer",a="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl){e.next=11;break}return e.next=6,EP(!0);case 6:if(s=e.sent){e.next=9;break}throw new JN(qN.NOT_SUPPORTED,"Get offer Error");case 9:return e.next=11,this.createAVMlineOfferTpl(s);case 11:if(!this._mlinesCache[t.streamId]){e.next=16;break}return u=E(this._mlinesCache[t.streamId],2),c=u[0],d=u[1],c.mid=t.audioMid,d.mid=t.videoMid,e.abrupt("return",{partialSdp:TG(this._offerSession,c,d),audioMid:c.mid,videoMid:d.mid,type:n,semantics:a});case 16:return l="".concat(this._mid++),h="".concat(this._mid++),f=i(i(i({},this._aRecvonlyOfferTpl),this._offerIce),{},{mid:l}),p=i(i(i({},this._vRecvonlyOfferTpl),this._offerIce),{},{mid:h}),this._mlinesCache[t.streamId]=[f,p],e.abrupt("return",{partialSdp:TG(this._offerSession,f,p),audioMid:l,videoMid:h,type:n,semantics:a,transceiverInit:{aTrack:"audio",vTrack:"video",audioTransceiverInit:{direction:"recvonly"},videoTransceiverInit:{direction:"recvonly"}}});case 22:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"handleAck",value:(d=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return mz.print("handleAck()","item: %o",t),e.abrupt("return",this._sdpQueue.enqueue(t));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"dequeue",value:(s=u(o().mark((function e(){var r,n,a,s,u,c,d,l,h,f,p,_=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._queueBusy=!0,r=this._sdpQueue.dequeue(),mz.print("dequeue()","ret: %o",r),r){e.next=6;break}return this._queueBusy=!1,e.abrupt("return");case 6:if(e.prev=6,n=r.items,a=r.sdpStrategy,s=[],u=[],a!==hz.ADD){e.next=14;break}return e.delegateYield(o().mark((function e(){var r,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete(r=i({},_._answerIce)).candidates,c=!1,d=!1,e.prev=4,h=t(n);case 6:return e.next=8,h.next();case 8:if(!(c=!(f=e.sent).done)){e.next=17;break}return a=f.value,e.delegateYield(o().mark((function e(){var t,n,c,d,l,h,f,p,v,m,y,g,S,b,k,T,I,A,R,w,C;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.action,n=a.transceiverInit,c=a.signalingAck,d=a.stream,!((l=d instanceof dz)&&(null==c?void 0:c.sequenceId)<d.sequenceId)){e.next=4;break}return e.abrupt("return","break");case 4:if(h={},f={},p=Uj.parse(c.sdp),Array.isArray(p.media)&&(v="",p.media.sort((function(e,t){var r;return null==e||null===(r=e.type)||void 0===r?void 0:r.localeCompare(null==t?void 0:t.type)})).forEach((function(e){"audio"===(e=i(i({},e),r)).type?(h=e,mz.print("audioMsid",e.msid),e.msid&&(v=e.msid.replace("audio","video"))):(f=e,mz.print("videoMsid",v),v&&(f.msid=v,v=""))}))),m=d.streamId,t===fz.publish&&(m=null===(y=d.stream)||void 0===y?void 0:y.id),_._mlinesCache[m]){e.next=12;break}return e.abrupt("return","break");case 12:if(g=E(_._mlinesCache[m],2),S=g[0],b=g[1],!n){e.next=30;break}d.audioTransceiver=_._peerConnection.addTransceiver(n.aTrack,n.audioTransceiverInit),d.videoTransceiver=_._peerConnection.addTransceiver(n.vTrack,n.videoTransceiverInit),(k=_._inactiveMlineIndex.shift())||(k=_._offerMlines.length),_._offerMlines[k]=i(i({},S),{},{mid:h.mid}),_._answerMlines[k]=h,(T=_._inactiveMlineIndex.shift())||(T=_._offerMlines.length),_._offerMlines[T]=i(i({},b),{},{mid:f.mid}),_._answerMlines[T]=f,_._msidIndexMap[d.streamId]=[k,T],yz&&(d.initAudioEncodedTransform(),d.initVideoEncodedTransform()),s.push(d.streamId||""),u.push(l?d.userId:"local"),e.next=48;break;case 30:if(!l){e.next=48;break}if(I=_._msidIndexMap[d.streamId]||[],A=E(I,2),R=A[0],w=A[1],!R||!w){e.next=47;break}if((null===(C=_._offerMlines[R])||void 0===C?void 0:C.mid)===h.mid){e.next=43;break}return _._offerMlines[R]=kG(_._offerMlines[R]),_._offerMlines[w]=kG(_._offerMlines[w]),_._answerMlines[R]=kG(_._answerMlines[R]),_._answerMlines[w]=kG(_._answerMlines[w]),e.next=40,_.setDescription();case 40:_._offerMlines[R]=i(i({},_._aRecvonlyOfferTpl),{},{mid:h.mid}),_._offerMlines[w]=i(i({},_._vRecvonlyOfferTpl),{},{mid:f.mid}),mz.print("enqueue","hack: %o",d.streamId);case 43:_._answerMlines[R]=h,_._answerMlines[w]=f,e.next=48;break;case 47:mz.print("dequeue","pushtrack before subscribe: %o",d.userId);case 48:l&&(d.sequenceId=null==c?void 0:c.sequenceId);case 49:case"end":return e.stop()}}),e)}))(),"t0",11);case 11:if("break"!==e.t0){e.next=14;break}return e.abrupt("break",17);case 14:c=!1,e.next=6;break;case 17:e.next=23;break;case 19:e.prev=19,e.t1=e.catch(4),d=!0,l=e.t1;case 23:if(e.prev=23,e.prev=24,!c||null==h.return){e.next=28;break}return e.next=28,h.return();case 28:if(e.prev=28,!d){e.next=31;break}throw l;case 31:return e.finish(28);case 32:return e.finish(23);case 33:case"end":return e.stop()}}),e,null,[[4,19,23,33],[24,,28,32]])}))(),"t0",12);case 12:e.next=19;break;case 14:p={},n.forEach((function(e){var t,r,n=e.audioMid,i=e.videoMid,o=e.stream;p[n]=n,p[i]=i,delete _._msidIndexMap[null===(t=e.stream)||void 0===t?void 0:t.streamId],o instanceof cz?delete _._mlinesCache[null==o||null===(r=o.stream)||void 0===r?void 0:r.id]:delete _._mlinesCache[null==o?void 0:o.streamId]})),this._offerMlines=this._offerMlines.map((function(e,t){return p[e.mid]&&(e=kG(e),_._inactiveMlineIndex.push(t)),e})),this._inactiveMlineIndex.sort((function(e,t){return e-t})),this._answerMlines=this._answerMlines.map((function(e){return p[e.mid]&&(e=kG(e)),e}));case 19:return e.next=21,this.setDescription(s.length?{streamId:s.join(","),streamUserId:u.join(",")}:void 0);case 21:mz.print("dequeue","loop"),e.next=27;break;case 24:e.prev=24,e.t1=e.catch(6),mz.print("dequeue","unknown error: %o",e.t1);case 27:return e.prev=27,this.dequeue(),e.finish(27);case 30:case"end":return e.stop()}}),e,this,[[6,24,27,30]])}))),function(){return s.apply(this,arguments)})},{key:"setDescription",value:(a=u(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return mz.print("setDescription","_offerMlines: %o, _answerMlines: %o",this._offerMlines,this._answerMlines),this._offerSession.media=this._offerMlines,this._answerSession.media=this._answerMlines,r=[],this._offerMlines.forEach((function(e){"inactive"!==e.direction&&r.push(e.mid)})),this._offerSession.groups&&this._answerSession.groups&&(this._offerSession.groups[0].mids=r.join(" "),this._answerSession.groups[0].mids=r.join(" ")),n=cP(),t&&yB.rtcBeginCreateOffer("local"===t.streamUserId?qF.UP:qF.DOWN,t.streamId,t.streamUserId),e.next=10,this._peerConnection.createOffer();case 10:return t&&yB.rtcCreateOffer(0,"local"===t.streamUserId?YF.UP:YF.DOWN,t.streamId,t.streamUserId,cP()-n),e.next=13,this.setLocalDescription(Uj.write(this._offerSession),t);case 13:return e.next=15,this.setRemoteDescription(Uj.write(this._answerSession),t);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"getDefaultSdp",value:(n=u(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,EP(!0);case 2:if(t=e.sent){e.next=5;break}throw new JN(qN.NOT_SUPPORTED,"Get offer Error");case 5:return this.createAVMlineOfferTpl(t),r=Uj.parse(t),n=[],r.media=r.media.filter((function(e){return"recvonly"===e.direction&&(n.push(e.mid+""),!0)})),r.groups=[{mids:n.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:Uj.write(r),semantics:"unified-plan",type:"offer"});case 11:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"rollback",value:(r=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete this._mlinesCache[t];case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;Uj.parse(e).media.forEach((function(e){"audio"===e.type?"sendonly"===e.direction?t._aSendonlyOfferTpl=e:t._aRecvonlyOfferTpl=e:"video"===e.type&&("sendonly"===e.direction?t._vSendonlyOfferTpl=e:t._vRecvonlyOfferTpl=e)}))}}]),k}(Mj),Sz=new xU("FirefoxHandler",3),bz=function(e){f(S,e);var t,r,n,a,s,d,_,v,y=g(S);function S(){var e;c(this,S);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return h(m(e=y.call.apply(y,[this].concat(r))),"name","firefox"),e}return l(S,[{key:"connect",value:(v=u(o().mark((function e(t){var r,n,a,s,u,c,d,l=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Sz.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=4,IG(t);case 4:return this._answerIce=e.sent,this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),e.next=9,this._peerConnection.createOffer();case 9:return a=e.sent,s=Uj.parse(a.sdp),u=E(s.media,1),c=u[0],this._offerIce.fingerprint=s.fingerprint||c.fingerprint,s.media=s.media.map((function(e){return i(i({},e),l._offerIce)})),(d=i({},s)).fingerprint=this._answerIce.fingerprint,d.media=d.media.map((function(e){return delete(e=i(i({},e),l._answerIce)).bundleOnly,e.port=9,"application"===e.type?e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}:e.direction="sendonly",e})),e.next=19,this.setLocalDescription(Uj.write(s));case 19:return e.next=21,this.setRemoteDescription(Uj.write(d));case 21:return e.next=23,new Promise((function(e,t){l._dataChannel.onopen=function(){Sz.print("connect","dataChannel open"),RB("es.dc.open",""),e("")},l._dataChannel.onerror=function(e){yB.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,WF.INVALID_DATA),RB("es.dc.error",""),t(e)},l._dataChannel.onclose=function(e){RB("es.dc.close",""),t(e)},l._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==l._peerConnection.iceConnectionState&&"closed"!==l._peerConnection.iceConnectionState&&"failed"!==l._peerConnection.connectionState||t(e)}))}));case 23:return Sz.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 25:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"publish",value:(_=u(o().mark((function e(t,r){var n,a,s,u,c,d,l,h,f,_,v,m,y,g=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=b(p(S.prototype),"internalPublish",this).call(this,t,r),u=s.videoDescriptions,c=s.subVideoDescriptions,d=s.transceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(d.aTrack,d.audioTransceiverInit),t.videoTransceiver=this._peerConnection.addTransceiver(d.vTrack,d.videoTransceiverInit),l=cP(),yB.rtcBeginCreateOffer(qF.UP,"",""),e.next=7,this._peerConnection.createOffer();case 7:return h=e.sent,yB.rtcCreateOffer(0,YF.UP,"","",cP()-l),(f=Uj.parse(h.sdp)).media=null===(n=f.media)||void 0===n?void 0:n.map((function(e){return i(i({},e),g._offerIce)})),e.next=13,this.setLocalDescription(Uj.write(f));case 13:return _=t.audioTransceiver.mid,v=t.videoTransceiver.mid,m=null,y=null,f.media=null===(a=f.media)||void 0===a?void 0:a.map((function(e){if("".concat(e.mid)===_){var t,r=null===(t=m=e)||void 0===t?void 0:t.rtp.find((function(e){return"opus"===e.codec}));if(r&&m.fmtp){var n=m.fmtp.find((function(e){return e.payload===r.payload}));n&&g._context&&(n.config+=g._context.audioProfileManager.getOpusConfigStr())}}else"".concat(e.mid)===v&&(y=e);return e})),this.addBitrateLimit(y,t.videoEncodeConfig[0].maxKbps),e.next=21,this.setLocalDescription(Uj.write(f));case 21:return e.abrupt("return",{partialSdp:TG(f,m,y),audioMid:_,videoMid:v,type:"incroffer",semantics:"unified-plan",videoDescriptions:u,subVideoDescriptions:c,transceiverInit:d});case 22:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"subscribe",value:(d=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h,f,p,_,v,m,y=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Sz.print("subscribe()"),!t.audioMid||!t.videoMid){e.next=11;break}return u=Uj.parse(null===(a=this._peerConnection.localDescription)||void 0===a?void 0:a.sdp),c=null,d=null,u.media.forEach((function(e){"".concat(e.mid)===t.audioMid?(c=e,t.autosubAudioMid&&(c.mid=t.autosubAudioMid)):"".concat(e.mid)===t.videoMid&&(d=e,t.autosubVideoMid&&(d.mid=t.autosubVideoMid))})),e.next=8,this._peerConnection.createOffer();case 8:return e.next=10,this.setLocalDescription(null===(s=this._peerConnection.localDescription)||void 0===s?void 0:s.sdp,{streamId:t.streamId||"",streamUserId:t.userId});case 10:return e.abrupt("return",{partialSdp:TG(u,c,d),audioMid:t.audioMid,videoMid:t.videoMid,autosubAudioMid:t.autosubAudioMid,autosubVideoMid:t.autosubVideoMid,type:"incroffer",semantics:"unified-plan"});case 11:return t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),l=cP(),yB.rtcBeginCreateOffer(qF.UP,t.streamId,t.userId),e.next=17,this._peerConnection.createOffer();case 17:return h=e.sent,yB.rtcCreateOffer(0,YF.UP,t.streamId,t.userId,cP()-l),(f=Uj.parse(h.sdp)).media=null===(r=f.media)||void 0===r?void 0:r.map((function(e){return i(i({},e),y._offerIce)})),e.next=23,this.setLocalDescription(Uj.write(f),{streamId:t.streamId||"",streamUserId:t.userId});case 23:return p=t.audioTransceiver.mid,_=t.videoTransceiver.mid,v=null,m=null,null===(n=f.media)||void 0===n||n.forEach((function(e){"".concat(e.mid)===p?v=e:"".concat(e.mid)===_&&(m=e)})),e.abrupt("return",{partialSdp:TG(f,v,m),audioMid:p,videoMid:_,type:"incroffer",semantics:"unified-plan"});case 29:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"handleAck",value:(s=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h,f=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.signalingAck,s=t.stream,(u=t.action)!==fz.unpublish&&u!==fz.unsubscribe&&u!==fz.removetrack){e.next=5;break}return e.next=4,this.close(s.streamId,s);case 4:return e.abrupt("return",s.streamId);case 5:return c={},(d=Uj.parse(null===(r=this._peerConnection.remoteDescription)||void 0===r?void 0:r.sdp)).media.forEach((function(e){void 0!==e.mid&&(c[e.mid]=e)})),Uj.parse(null==a?void 0:a.sdp).media.forEach((function(e){"audio"===(e=i(i({},e),f._answerIce)).type&&(s.audioMid?(e.mid=s.audioMid,c[s.audioMid]=e):c[e.mid]=e),"video"===e.type&&(s.videoMid?(e.mid=s.videoMid,c[s.videoMid]=e):c[e.mid]=e)})),l=Uj.parse(null===(n=this._peerConnection.localDescription)||void 0===n?void 0:n.sdp),h=l.media.map((function(e){var t=c[e.mid];return"inactive"===e.direction?e:t})),d.groups=l.groups,d.media=h,this.setRemoteDescription(Uj.write(d)),e.abrupt("return","");case 16:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"getDefaultSdp",value:(a=u(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Uj.parse(null===(t=this._peerConnection.localDescription)||void 0===t?void 0:t.sdp),n=[],r.media=r.media.filter((function(e){return"recvonly"===e.direction&&(n.push(e.mid+""),!0)})),r.groups=[{mids:n.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:Uj.write(r),semantics:"unified-plan",type:"offer"});case 5:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"rollback",value:(n=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.close(t,r));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"close",value:(r=u(o().mark((function e(t,r){var n,a,s,u,c,d,l=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Sz.print("close()"),!r.audioTransceiver||!r.videoTransceiver){e.next=19;break}return r.audioTransceiver.stop(),r.videoTransceiver.stop(),a=[],e.next=7,this._peerConnection.createOffer();case 7:return s=e.sent,(u=Uj.parse(null==s?void 0:s.sdp)).media=u.media.map((function(e){return"".concat(e.mid)!==r.audioMid&&"".concat(e.mid)!==r.videoMid||(e=kG(e)),"inactive"!==e.direction&&a.push(e.mid),i(i({},e),l._offerIce)})),c=Uj.parse(null===(n=this._peerConnection.remoteDescription)||void 0===n?void 0:n.sdp),d={},c.media.forEach((function(e){d[e.mid]=e})),c.media=u.media.map((function(e){return"inactive"===e.direction?e:d[e.mid]})),u.groups&&c.groups&&(u.groups[0].mids=a.join(" "),c.groups[0].mids=a.join(" ")),e.next=17,this.setLocalDescription(Uj.write(u));case 17:return e.next=19,this.setRemoteDescription(Uj.write(c));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._peerConnection.createOffer();case 2:if(!this._peerConnection.localDescription||!this._peerConnection.remoteDescription){e.next=7;break}return e.next=5,this._peerConnection.setLocalDescription(this._peerConnection.localDescription);case 5:return e.next=7,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription);case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),S}(Mj),Ez=function(e,t){return _P?new bz(e,t):new gz(e,t)},kz=new xU("Locker",2),Tz=1,Iz=function(){function e(t){c(this,e),h(this,"lockingPromise",Promise.resolve()),h(this,"locks",0),h(this,"name",""),h(this,"lockId",void 0),this.lockId=Tz++,t&&(this.name=t),kz.print("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}return l(e,[{key:"isLocked",get:function(){return this.locks>0}},{key:"lock",value:function(){var e,t=this;this.locks+=1,kz.print("[lock-".concat(this.name,"-").concat(this.lockId,"] locked, current queue ").concat(this.locks,"."));var r=new Promise((function(r){e=function(){t.locks-=1,kz.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),r()}})),n=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return r})),n}}]),e}(),Az=(h(rz={},Y.communication,[0]),h(rz,Y.chat,[0]),h(rz,Y.chatRoom,[1,"IES_chatroom"]),h(rz,Y.coHost,[1,"IES_PK"]),h(rz,Y.meeting,[16]),h(rz,Y.classRoom,[0]),rz),Rz=Object.defineProperty,wz=Object.getOwnPropertyDescriptor,Cz=function(e,t,r,n){for(var i,o=n>1?void 0:n?wz(t,r):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&Rz(t,r,o),o},Oz=new xU("MediaServerClient",2),xz=6e4,Nz=function(e){return e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting",e}(Nz||{}),Dz=function(e,t){Oz.print(e,"userId: %o, subAudio: %o, subVideo: %o, paused: %o, audioMid: %o, videoMid: %o, workaround_1_: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.paused,t.audioMid,t.videoMid,t._workaround_1_,t.sequenceId)},Pz=function(e){f(O,e);var t,r,n,a,s,d,p,_,v,y,S,b,k,T,I,A,R,w,C=g(O);function O(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:yB;return c(this,O),h(m(t=C.call(this)),"_token",void 0),h(m(t),"_appId",void 0),h(m(t),"_roomId",void 0),h(m(t),"_roomAttributes",void 0),h(m(t),"_clientId",void 0),h(m(t),"_businessId",void 0),h(m(t),"_userInfo",void 0),h(m(t),"_useCloudProxy",void 0),h(m(t),"_authorization",void 0),h(m(t),"_sessionId",void 0),h(m(t),"_iceConfigRequestManager",void 0),h(m(t),"_ontrackCallbackMap",new Map),h(m(t),"_subResolves",{}),h(m(t),"supportConcurrent",!1),h(m(t),"_handler",void 0),h(m(t),"_pubSubLock",void 0),h(m(t),"_joinLeaveLock",void 0),h(m(t),"_state",void 0),h(m(t),"_dataChannelSignal",void 0),h(m(t),"_pubConfig",{}),h(m(t),"_subConfig",{}),h(m(t),"monitor",void 0),h(m(t),"_roomProfile",Y.communication),h(m(t),"_context",void 0),h(m(t),"_subStreamQueue",{}),t.monitor=r,t._pubSubLock=new Iz("pubSubLock"),t._joinLeaveLock=new Iz("joinLeaveLock"),t._state="disconnected",t._roomAttributes={multiChatMode:!1,bigRoomMode:!1},t._context=e,t.on("SUB_END",(function(e){return t._handleSubStreamQueue(e)})),t}return l(O,[{key:"_addHandlerEvents",value:function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){Oz.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(ej.ABNORMAL_DISCONNECTION)}))}},{key:"_addSignalEventHandler",value:function(){var e,t=this;[ZB.ON_ADD_STREAM,ZB.ON_REMOVE_STREAM,ZB.USER_CONNECTION,ZB.USER_DISCONNECTION,ZB.ON_UPDATE_STREAM_ATTRIBUTES,ZB.ON_UPDATE_ROOM_ATTRIBUTES,ZB.ON_PUSH_TRACK,ZB.ON_REMOVE_TRACK,ZB.NODE_CHANGE,ZB.ON_CUSTOM_MESSAGE,ZB.USER_MESSAGE_RECEIVED,ZB.USER_BINARY_MESSAGE_RECEIVED,ZB.POST_PROCESSING_MESSAGE,ZB.ON_USER_TOKEN_WILL_EXPIRE,ZB.STREAM_CONTROL_MESSAGE,ZB.ON_SCENE_CONFIG,ZB.ON_UPDATE_USER_ATTRIBUTES,$B.RSCP,ZB.ON_STREAM_FAILED].forEach((function(e){var r;null===(r=t._dataChannelSignal)||void 0===r||r.on(e,(function(r){t.safeEmit(e,r)}))})),null===(e=this._dataChannelSignal)||void 0===e||e.once("close",(function(){Oz.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(ej.ABNORMAL_DISCONNECTION)}))}},{key:"_removeSignalEventHandler",value:function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.removeAllListeners(),null===(t=this._handler)||void 0===t||t.removeAllListeners()}},{key:"connectionState",get:function(){return this._state},set:function(e){this._state!==e&&(this.safeEmit(ej.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)}},{key:"connect",value:(w=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l=this,h=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=h.length>1&&void 0!==h[1]?h[1]:"",n=h.length>2&&void 0!==h[2]?h[2]:"",i=h.length>3&&void 0!==h[3]?h[3]:{},this.connectionState="connecting",this._appId=t,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),!i.node){e.next=11;break}a=[i.node],RB("es.join.nodeChange",i),e.next=20;break;case 11:return Promise.resolve().then((function(){return l.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new pj,e.next=15,null===(s=this._iceConfigRequestManager)||void 0===s?void 0:s.getAccessNode(t,r,n,UB.getDeviceId(),null==i?void 0:i.reason,null==i?void 0:i.feedbackNode,this._useCloudProxy);case 15:if(a=e.sent){e.next=19;break}throw RB("es.join.getNodeFailed",""),new JN(qN.ICE_SERVER_WRONG,"get ICE config failed");case 19:RB("es.join.getNodeSuccess",a);case 20:return this._addHandlerEvents(),Promise.resolve().then((function(){return l.emit("onEstablishConnectionHook")})),e.prev=22,c=!1,d=a.map((function(e){var t=Ez(l.monitor,l._context);return t.connect(e).then((function(r){c?t.destroy():(c=!0,u=r,l.safeEmit("prevIceNode",e),l._handler=t,l.supportConcurrent="chrome"===t.name,l._addHandlerEvents())})).catch((function(){t.destroy()}))})),e.next=27,kP(d);case 27:Oz.print("join","establish peerConnection success"),e.next=34;break;case 30:throw e.prev=30,e.t0=e.catch(22),this.connectionState="disconnected",new JN(qN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t0);case 34:if(!u){e.next=40;break}this._dataChannelSignal=new lj(u),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),e.next=42;break;case 40:throw this.connectionState="disconnected",new JN(qN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");case 42:case"end":return e.stop()}}),e,this,[[22,30]])}))),function(e){return w.apply(this,arguments)})},{key:"join",value:(R=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h,f,p,_,v,m,y,g=this,S=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=S.length>1&&void 0!==S[1]?S[1]:{},i=S.length>2&&void 0!==S[2]&&S[2],a=S.length>3?S[3]:void 0,Oz.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",t,n,i,a),this._appId=t.appId,this._token=t.token,this._roomId=t.roomId,this._clientId=t.userInfo.userId,this._businessId=t.userInfo.businessId,this._userInfo=t.userInfo,this._useCloudProxy=t.useCloudProxy,this._roomProfile=t.roomProfile,this._sessionId=n.sessionId,e.next=15,this.connect(this._appId,this._roomId,this._clientId,n);case 15:return e.t0=hP.token2auth(this._appId,this._roomId,this._clientId,this._token),e.t1=this._sessionId||"",e.t2=Date.now(),e.t3=a,e.t4={extra_info:this._userInfo.extraInfo,role:this._userInfo.role},e.next=22,null===(r=this._handler)||void 0===r?void 0:r.getDefaultSdp();case 22:return e.t5=e.sent,e.next=25,Cj();case 25:return e.t6=e.sent,e.t7=window.navigator.userAgent,e.t8=jB.VERSION,e.t9=UB.getDeviceId(),e.t10=this._appId,e.t11=this._roomId,e.t12=this._clientId,e.t13=this._businessId,e.t14=this._useCloudProxy,e.t15=Az[this._roomProfile]?Az[this._roomProfile][0]+"":"0",e.t16={supportedCodecs:e.t6,deviceType:"web",userAgent:e.t7,sdkVersion:e.t8,deviceId:e.t9,appId:e.t10,roomId:e.t11,userId:e.t12,businessId:e.t13,enable_cloud_proxy:e.t14,channelProfile:e.t15},e.t17={supportTokenExpireCallBack:!0,enableSceneConfigV2:!0,enableUnBundleMode:!0},s={Authorization:e.t0,sessionId:e.t1,timestamp:e.t2,controlMessage:e.t3,userAttributes:e.t4,sdpInfo:e.t5,params:e.t16,options:e.t17},Promise.resolve().then((function(){return g.emit("onSendingJoinMessageHook")})),e.prev=39,m=i?"reconnected":"joinRoom",e.next=43,this._dataChannelSignal.sendSignaling(m,s);case 43:return y=e.sent,Oz.print("join","send join message success"),this._authorization=s.Authorization,this.connectionState="connected",$H.audioStallConfig=null===(u=y.config)||void 0===u?void 0:u.engine_WEB,this._pubConfig.audioRed=!(null===(c=y.config)||void 0===c||null===(d=c.engine_WEB)||void 0===d||!d.pub_audio_red),this._subConfig.muteReplaceUnsub=!(null===(l=y.config)||void 0===l||!l.mute_replace_unsub),this._pubConfig.simulcastOnDemand=!(!1===(null===(h=y.config)||void 0===h||null===(f=h.engine_VPM)||void 0===f||null===(p=f.ondemand)||void 0===p?void 0:p.enable)),null===(_=this._context)||void 0===_||_.audioProfileManager.updateEngineBAC(null===(v=y.config)||void 0===v?void 0:v.engine_BAC),e.abrupt("return",y);case 55:if(e.prev=55,e.t18=e.catch(39),this.connectionState="disconnected",!((null===e.t18||void 0===e.t18?void 0:e.t18.code)>=700&&(null===e.t18||void 0===e.t18?void 0:e.t18.code)<800)){e.next=60;break}throw new JN(qN.INVALID_TOKEN,(null===e.t18||void 0===e.t18?void 0:e.t18.message)||"Invalid token");case 60:if(200===(null===e.t18||void 0===e.t18?void 0:e.t18.code)){e.next=62;break}throw new JN(qN.JOIN_ROOM_FAILED,(null===e.t18||void 0===e.t18?void 0:e.t18.message)||"Join room failed");case 62:case"end":return e.stop()}}),e,this,[[39,55]])}))),function(e){return R.apply(this,arguments)})},{key:"publish",value:(A=u(o().mark((function e(t){var r,n,a,s,u,c,d,l,h,f,p,_,v,m,y,g,S,b;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Oz.print("publish()","localStream: %o",t),r=t.videoTrack,n=t.audioTrack,a=cP(),s="",u="",e.prev=6,e.next=9,null===(c=this._handler)||void 0===c?void 0:c.publish(t,this._pubConfig);case 9:if(y=e.sent){e.next=12;break}throw new JN(qN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 12:return s=y.audioMid,u=y.videoMid,t.pubAttributes={localaudio:!!n,localvideo:!!r,videostream:t.pubVideo,audiostream:t.pubAudio,extvideo:!!(r instanceof DH),extaudio:!!(n instanceof PH)},g={attributes:i({videoDescriptions:y.videoDescriptions},t.pubAttributes),audio:!0,video:!0,screen:t.isScreen,audioMid:s,videoMid:u,sdpInfo:{msid:t.stream.id,type:y.type,sdp:y.partialSdp,semantics:y.semantics}},t.enableSimulcast&&this._pubConfig.simulcastOnDemand&&(g.attributes.subVideoDescriptions=y.subVideoDescriptions),e.next=19,null===(d=this._dataChannelSignal)||void 0===d?void 0:d.sendSignaling("publish",g);case 19:if(200===(null==(S=e.sent)?void 0:S.code)){e.next=22;break}throw new JN(qN.PUBLISH_FAILED,(null==S?void 0:S.message)||"publish failed");case 22:return yB.rtcRecvAnswer(0,ZF.INCRANSWER,(null==S||null===(l=S.relayMessage)||void 0===l?void 0:l.sequenceId)||0,null==S||null===(h=S.relayMessage)||void 0===h?void 0:h.sdp,$F.UP,"",""),e.next=25,null===(f=this._handler)||void 0===f?void 0:f.handleAck({action:fz.publish,streamId:S.streamId,audioMid:s,videoMid:u,transceiverInit:y.transceiverInit,signalingAck:{audioMid:null==S||null===(p=S.relayMessage)||void 0===p?void 0:p.audioMid,videoMid:null==S||null===(_=S.relayMessage)||void 0===_?void 0:_.videoMid,sdp:null==S||null===(v=S.relayMessage)||void 0===v?void 0:v.sdp,sequenceId:null==S||null===(m=S.relayMessage)||void 0===m?void 0:m.sequenceId},stream:t});case 25:return t.streamId=S.streamId,t.videoMid=u,t.audioMid=s,t.subVideoDescriptions=y.subVideoDescriptions,this.monitor.rtcPublishStat(eB.SUCCESS,tB.W_0,a,rB.UNKNOWN),t.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor),e.abrupt("return");case 34:return e.prev=34,e.t0=e.catch(6),e.t0 instanceof Error&&this.monitor.rtcPublishStat(eB.FAIL,tB.W_0,a,e.t0.message),e.next=39,null===(b=this._handler)||void 0===b?void 0:b.rollback(t.stream.id,t);case 39:throw e.t0;case 40:case"end":return e.stop()}}),e,this,[[6,34]])}))),function(e){return A.apply(this,arguments)})},{key:"updatePubTrack",value:(I=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h,f,p,_,v,m,y,g,S,b,k,T,I,A,R,w,C,O,x,N,D,P,M;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(Oz.print("updatePubTrack()","localStream: %o",t),i=t.videoTrack,a=t.audioTrack,s=t.pubAudio,u=t.pubVideo,c=null==a?void 0:a.getTrack(),d=null==i?void 0:i.getTrack(),u&&d?null===(l=t.videoTransceiver)||void 0===l||l.sender.replaceTrack(d):null===(h=t.videoTransceiver)||void 0===h||h.sender.replaceTrack(null),null===(r=this._handler)||void 0===r||r.updateScaleResolutionDownBy(t),s&&c?(p=a.mixType,_=a.mixedAudioTrack,v=a.gainAudioTrack,_&&p!==ee.PLAYOUT&&!0===c.enabled?c=_:v&&"safari"!==pP()&&(c=v),null===(f=t.audioTransceiver)||void 0===f||f.sender.replaceTrack(c)):null===(m=t.audioTransceiver)||void 0===m||m.sender.replaceTrack(null),y={localaudio:!!a,localvideo:!!i,videostream:u,audiostream:s,extvideo:!!(i instanceof DH),extaudio:!!(a instanceof PH)},g={},S=0,b=Object.entries(y);S<b.length;S++)k=E(b[S],2),T=k[0],(I=k[1])!==Reflect.get(t.pubAttributes,T)&&Reflect.set(g,T,I);if(Object.keys(g).length){e.next=12;break}return e.abrupt("return");case 12:return t.observer&&(A=t.observer,R=g.audiostream,w=g.videostream,C=g.localaudio,O=g.localvideo,x=g.extaudio,N=g.extvideo,void 0!==O?void 0!==N?A.setPushVideo(N):A.setEnableVideo(O):void 0!==w&&A.setUnmuteVideo(w),void 0!==C?void 0!==x?A.setPushAudio(x):A.setEnableAudio(C):void 0!==R&&A.setUnmuteAudio(R)),t.pubAttributes=y,D={roomId:this._roomId,streamId:t.streamId,attributes:g},e.next=17,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateStreamAttributes",D);case 17:if(200===(null==(P=e.sent)?void 0:P.code)){e.next=20;break}throw new JN(qN.UPDATE_TRACK_FAILED,(null==P?void 0:P.message)||"update track failed");case 20:if(!_P){e.next=23;break}return e.next=23,null===(M=this._handler)||void 0===M?void 0:M.setCurrentDescription();case 23:case"end":return e.stop()}}),e,this)}))),function(e){return I.apply(this,arguments)})},{key:"updateToken",value:(T=u(o().mark((function e(t){var r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Oz.print("updateToken()","newToken: %o",t),this._token=t,this._appId&&null!==(r=this._userInfo)&&void 0!==r&&r.userId&&this._roomId){e.next=4;break}return e.abrupt("return");case 4:return i={roomId:this._roomId,userId:null===(n=this._userInfo)||void 0===n?void 0:n.userId,appId:this._appId,token:"Bearer ".concat(t)},e.prev=5,e.next=8,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateToken",i);case 8:if(200===(null==(s=e.sent)?void 0:s.code)){e.next=11;break}throw new JN(qN.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 11:e.next=16;break;case 13:throw e.prev=13,e.t0=e.catch(5),new JN(qN.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 16:case"end":return e.stop()}}),e,this,[[5,13]])}))),function(e){return T.apply(this,arguments)})},{key:"unpublish",value:(k=u(o().mark((function e(t){var r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Oz.print("unpublish()","localStream: %o",t),i={roomId:this._roomId,initStreamId:t.initStreamId,streamId:t.streamId},null===(r=this._dataChannelSignal)||void 0===r||r.sendSignaling("unpublish",i),e.next=5,null===(n=this._handler)||void 0===n?void 0:n.handleAck({action:fz.unpublish,audioMid:t.audioMid,videoMid:t.videoMid,stream:t,streamId:t.streamId});case 5:t.statsReport.unpublish();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"subscribe",value:(b=u(o().mark((function e(t,r,n){var i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(){var e=u(o().mark((function e(a,s){var u,c,d,l,f,p,_,v,m,y,g,S,b,E,k,T,I,A,R,w,C,O,x,N,D,P,M,U,L,V,F,B,j,G,H,z,K,W;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.streamState!==uz.SUB_ED){e.next=2;break}return e.abrupt("return",i._updateSubTrack(t,r,az.SUB,n).then(a,s));case 2:if(t.streamState!==uz.SUB_ING){e.next=7;break}return i._subStreamQueue[t.streamId]||(i._subStreamQueue[t.streamId]=[]),Oz.print("_subStreamQueue","streamId: %o, enqueue",t.streamId),i._subStreamQueue[t.streamId].push({fn:i.subscribe,args:[t,r,n],resolve:a,reject:s}),e.abrupt("return");case 7:if(Oz.print("subscribe()","mediaType: %o",r),Dz("subscribe()",t),t.streamState=uz.SUB_ING,u=!1,c=!1,IP(r)&&(c=!0),AP(r)&&(u=!0),u||!i._multiChatMode()){e.next=17;break}return t.streamState=uz.INIT,i.emit("SUB_END",t.streamId),e.abrupt("return",a(null));case 17:if(d=cP(),l=t.audioMid,f=t.videoMid,_=t.paused,v=t.subVideo,e.prev=22,!l||!f){e.next=29;break}return e.next=26,null===(D=i._handler)||void 0===D?void 0:D.subscribe(t,{audioMid:l,videoMid:f});case 26:p=e.sent,e.next=36;break;case 29:return e.next=31,null===(P=i._handler)||void 0===P?void 0:P.subscribe(t);case 31:if(p=e.sent){e.next=34;break}throw new JN(qN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 34:l=p.audioMid,f=p.videoMid;case 36:return t.paused=!u,t.subVideo=u,M={spatialLayer:(null==n?void 0:n.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==n?void 0:n.spatialSubLayer)||-1},U={audio:!i._multiChatMode(),video:!0,data:!0,screen:t.isScreen,browser:"chrome-stable",videoMid:(null===(m=p)||void 0===m?void 0:m.autosubVideoMid)||f,audioMid:(null===(y=p)||void 0===y?void 0:y.autosubAudioMid)||l,sdpInfo:{sdp:null===(g=p)||void 0===g?void 0:g.partialSdp,semantics:null===(S=p)||void 0===S?void 0:S.semantics,type:null===(b=p)||void 0===b?void 0:b.type},streamUserId:t.userId,streamId:t.streamId,config:{enableMediaType:{audio:!!i._multiChatMode()||c,video:u},qualityLayer:M}},e.next=42,null===(E=i._dataChannelSignal)||void 0===E?void 0:E.sendSignaling("subscribe",U);case 42:if(200===(null==(L=e.sent)?void 0:L.code)){e.next=45;break}throw new JN(qN.SUBSCRIBE_FAILED,(null==L?void 0:L.message)||"subscribe failed");case 45:return V=[],F=!i._multiChatMode(),B=!t.videoTrack,i._subResolves[t.streamId]||(i._subResolves[t.streamId]=[]),B&&V.push(new Promise((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new JN(qN.TIME_OUT,"wait video timeout for userId: ".concat(t.userId)))}),xz);t.on("ontrack",(function r(i){"video"===i.mediaType&&(Oz.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),F&&V.push(new Promise((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new JN(qN.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),xz);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(Oz.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),j=function(e){t.ontrack(e)},null===(k=i._handler)||void 0===k||k.on("ontrack",j),i._ontrackCallbackMap.set(t,j),G=null==L?void 0:L.relayMessage,H=G.audioMid,z=G.videoMid,h(T={},l,H),h(T,f,z),K=T,Oz.print("sub midmap",t.userId,K),_P?(t.videoMid=f,t.audioMid=l):(t.videoMid=z,t.audioMid=H),t._workaround_1_=!1,t.subMediaType=r,t.streamState=uz.SUB_ED,t.subLayer=M,yB.rtcRecvAnswer(0,ZF.INCRANSWER,(null==L||null===(I=L.relayMessage)||void 0===I?void 0:I.sequenceId)||0,null==L||null===(A=L.relayMessage)||void 0===A?void 0:A.sdp,$F.DOWN,t.streamId,t.userId),e.next=65,null===(R=i._handler)||void 0===R?void 0:R.handleAck({action:fz.subscribe,streamId:t.streamId,audioMid:l,videoMid:f,transceiverInit:null===(w=p)||void 0===w?void 0:w.transceiverInit,signalingAck:{audioMid:null==L||null===(C=L.relayMessage)||void 0===C?void 0:C.audioMid,videoMid:null==L||null===(O=L.relayMessage)||void 0===O?void 0:O.videoMid,sdp:null==L||null===(x=L.relayMessage)||void 0===x?void 0:x.sdp,sequenceId:null==L||null===(N=L.relayMessage)||void 0===N?void 0:N.sequenceId},stream:t});case 65:return e.next=67,Promise.all(V);case 67:i._multiChatMode()||(t.subAudio=c),i.monitor.rtcSubscribeStat(nB.SUCCESS,d,iB.UNKNOWN,t.userId),t.statsReport.setRemoteStreamStatsEvtInterval(i,i._handler,i.monitor),a(null),i.emit("SUB_END",t.streamId),e.next=84;break;case 74:return e.prev=74,e.t0=e.catch(22),e.t0 instanceof Error&&i.monitor.rtcSubscribeStat(nB.FAIL,d,e.t0.message,t.userId),t.paused=_,t.subVideo=v,t.streamState=uz.INIT,e.next=82,null===(W=i._handler)||void 0===W?void 0:W.rollback(t.streamId,t);case 82:s(e.t0),i.emit("SUB_END",t.streamId);case 84:case"end":return e.stop()}}),e,null,[[22,74]])})));return function(t,r){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)}))),function(e,t,r){return b.apply(this,arguments)})},{key:"_handleSubStreamQueue",value:function(e){var t,r=this;if(null!==(t=this._subStreamQueue[e])&&void 0!==t&&t.length){Oz.print("_subStreamQueue","streamId: %o, exec",e);var n=this._subStreamQueue[e].shift(),i=n.fn,o=n.args,a=n.resolve,s=n.reject;i.apply(this,o).then(a,s).finally((function(){return r._handleSubStreamQueue(e)}))}else Oz.print("_subStreamQueue","streamId: %o, END",e)}},{key:"controlMessage",value:(S=u(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Oz.print("controlMessage()","params: %o",t),n=t,"transcode"===t.type&&(n.roomId=this._roomId),e.next=5,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("controlMessage",n);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"updateUserAttributes",value:(y=u(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Oz.print("updateUserAttributes()","attributes: %o",t),e.next=3,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("updateUserAttributes",{roomId:this._roomId,sessionId:this._sessionId,attributes:t});case 3:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"updateSubTrack",value:(v=u(o().mark((function e(t,r,n,i){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._updateSubTrack(t,r,n,i||t.subLayer));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return v.apply(this,arguments)})},{key:"_updateSubTrack",value:(_=u(o().mark((function e(t,r,n,i){var a,s,u,c,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Oz.print("updateSubTrack()","mediaType: %o, subLayer: %o",r,i),Dz("updateSubTrack()",t),u=0,u=n===az.SUB?t.subMediaType|r:t.subMediaType-(t.subMediaType&r),Oz.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",t.subMediaType,n,r,u),t.subMediaType===u&&Oz.print("updateSubTrack","mediaType no change"),c=!1,d=!1,IP(u)&&(d=!0),AP(u)&&(c=!0),l=i||t.subLayer,h={roomId:this._roomId,streamList:[t.streamId],config:{enableMediaType:{video:c,audio:!!this._multiChatMode()||d},qualityLayer:l}},e.next=13,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateSubscribe",h);case 13:if(200===(null==(f=e.sent)?void 0:f.code)){e.next=16;break}throw new JN(qN.UPDATE_TRACK_FAILED,(null==f?void 0:f.message)||"update track failed");case 16:return t.paused=!c,this._multiChatMode()||(null===(p=t.observer)||void 0===p||p.setUnmuteAudio(d),t.subAudio=d),null===(s=t.observer)||void 0===s||s.setUnmuteVideo(c),t.subVideo=c,t.subMediaType=u,t.subLayer=l,e.abrupt("return",t);case 23:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return _.apply(this,arguments)})},{key:"subscribe4pushTrack",value:(p=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,f,p,_,v,m,y,g,S,b,E=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Oz.print("subscribe4pushTrack()","streamInfo: %o",r),Dz("subscribe4pushTrack()",t),c=null==r?void 0:r.message,d=c.audioMid,l=c.videoMid,f=c.sequenceId,t.subAudio=!0,!(f<t.sequenceId)){e.next=7;break}return Oz.print("subscribe4pushTrack","sequenceId return",f,t.sequenceId),e.abrupt("return");case 7:if(p=t.audioMid,_=t.videoMid,null===(n=t.observer)||void 0===n||n.setPushTrack(!0),!p||!_){e.next=16;break}return e.next=13,null===(m=this._handler)||void 0===m?void 0:m.subscribe(t,{audioMid:p,videoMid:_});case 13:v=e.sent,e.next=23;break;case 16:return e.next=18,null===(y=this._handler)||void 0===y?void 0:y.subscribe(t);case 18:if(v=e.sent){e.next=21;break}throw new JN(qN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 21:p=v.audioMid,_=v.videoMid;case 23:return h(i={},p,d),h(i,_,l),g=i,Oz.print("onpushtrack midmap",t.userId,g),_P?(t.audioMid=p,t.videoMid=_):(t.audioMid=d,t.videoMid=l),t.autosubAudioMid=d,t.autosubVideoMid=l,t.sequenceId=f,this._subResolves[t.streamId]||(this._subResolves[t.streamId]=[]),S=[],t.audioTrack||S.push(new Promise((function(e,r){E._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new JN(qN.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),xz);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(Oz.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),b=function(e){t.ontrack(e)},null===(a=this._handler)||void 0===a||a.on("ontrack",b),this._ontrackCallbackMap.set(t,b),e.next=37,null===(s=this._handler)||void 0===s?void 0:s.handleAck({action:fz.pushtrack,streamId:t.streamId,audioMid:p,videoMid:_,stream:t,transceiverInit:null===(u=v)||void 0===u?void 0:u.transceiverInit,signalingAck:null==r?void 0:r.message});case 37:return e.next=39,Promise.all(S);case 39:t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor);case 40:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"unsubscribe4removeTrack",value:(d=u(o().mark((function e(t,r){var n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Dz("unsubscribe4removeTrack()",t),Oz.print("unsubscribe4removeTrack()","sequenceId: ",r.sequenceId),!(r.sequenceId<t.sequenceId)){e.next=5;break}return Oz.print("unsubscribe4removeTrack()","sequenceId return"),e.abrupt("return");case 5:if(t.subAudio=!1,!t.subVideo&&!t.paused){e.next=10;break}return t.sequenceId=r.sequenceId,Oz.print("unsubscribe4removeTrack()","foo %o",t.userId),e.abrupt("return");case 10:return null===(n=t.observer)||void 0===n||n.setPushTrack(!1),e.next=13,null===(i=this._handler)||void 0===i?void 0:i.handleAck({action:fz.removetrack,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 13:this._subResolves[t.streamId]&&this._subResolves[t.streamId].forEach((function(e){return e(0)})),Oz.print("clean unsubscribe4removeTrack"),t.clean(),t.resetHasSubscribed(),t.statsReport.unsubscribe();case 18:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"unsubscribe",value:(s=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=h.length>2&&void 0!==h[2]&&h[2],Dz("unsubscribe()",t),s=t.subMediaType-(t.subMediaType&r),a||!this._subConfig.muteReplaceUnsub&&s===jH.NONE){e.next=5;break}return e.abrupt("return",this._updateSubTrack(t,r,az.UNSUB));case 5:if(u={roomId:this._roomId,streamId:t.streamId,userId:t.userId},null===(n=this._dataChannelSignal)||void 0===n||n.sendSignaling("unsubscribe",u).catch((function(){})),t.streamState=uz.INIT,this._subStreamQueue[t.streamId]&&(this._subStreamQueue[t.streamId].forEach((function(e){return(0,e.resolve)(null)})),delete this._subStreamQueue[t.streamId]),t.subVideo=!1,t.paused=!1,t._workaround_1_||(t.subAudio=!1),null===(i=t.observer)||void 0===i||i.setSubscribeVideo(!1),t.subAudio){e.next=23;break}return null===(c=t.observer)||void 0===c||c.setSubscribeAudio(!1),e.next=17,null===(d=this._handler)||void 0===d?void 0:d.handleAck({action:fz.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 17:l=e.sent,this._subResolves[l]&&this._subResolves[l].forEach((function(e){return e(0)})),Oz.print("unsubscribe","clean unsub ".concat(t.userId)),t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 23:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"removeOnTrackListener",value:function(e){var t,r=this._ontrackCallbackMap.get(e);r&&(null===(t=this._handler)||void 0===t||t.off("ontrack",r),this._ontrackCallbackMap.delete(e))}},{key:"handleRemoveStream",value:(a=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Dz("handleRemoveStream()",t),t.subVideo=!1,r.message&&r.message!==JB.videoMuted?t._workaround_1_=!1:t._workaround_1_=!0,t.hasSubscribed){e.next=5;break}return e.abrupt("return");case 5:this.unsubscribe(t,L.AUDIO_AND_VIDEO,!0);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"leave",value:(n=u(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Oz.print("leave()"),"connected"!==this.connectionState){e.next=22;break}return this.connectionState="disconnecting",t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},e.next=6,this._joinLeaveLock.lock();case 6:return r=e.sent,e.prev=7,e.next=10,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("leaveRoom",t);case 10:this.connectionState="disconnected",e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(7),this.connectionState="connected",e.t0;case 17:return e.prev=17,r(),e.finish(17);case 20:e.next=23;break;case 22:return e.abrupt("return",Promise.reject(new JN(qN.NOT_CONNECTED_YET,"server not connected")));case 23:case"end":return e.stop()}}),e,this,[[7,13,17,20]])}))),function(){return n.apply(this,arguments)})},{key:"subscribePublicStream",value:(r=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h,f,p,_,v,m,y,g,S=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(r=this._handler)||void 0===r?void 0:r.subscribe(t);case 2:if(s=e.sent){e.next=5;break}throw new JN(qN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 5:return u=cP(),c=s.audioMid,d=s.videoMid,l={appId:this._appId,streamId:t.streamId,audio:!0,video:!0,data:!0,audioMid:c,videoMid:d,sdpInfo:{sdp:null==s?void 0:s.partialSdp,semantics:null==s?void 0:s.semantics,type:null==s?void 0:s.type},config:{enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}},params:{appId:this._appId}},e.next=11,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("startPullStream",l);case 11:return h=e.sent,f=[],this._subResolves[t.streamId]=[],f.push(new Promise((function(e,r){S._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new JN(qN.TIME_OUT,"wait video timeout for streamId: ".concat(t.streamId)))}),xz);t.on("ontrack",(function r(i){"video"===i.mediaType&&(Oz.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),f.push(new Promise((function(e,r){S._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new JN(qN.TIME_OUT,"wait audio timeout for streamId: ".concat(t.streamId)))}),xz);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(Oz.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),p=function(e){t.ontrack(e)},null===(i=this._handler)||void 0===i||i.on("ontrack",p),this._ontrackCallbackMap.set(t,p),_=null==h?void 0:h.relayMessage,v=_.audioMid,m=_.videoMid,y=_.sequenceId,g=_.sdp,t.videoMid=m,t.audioMid=v,t.sequenceId=y,t._workaround_1_=!1,t.paused=!1,t.streamState=uz.SUB_ED,t.subAudio=!0,t.subVideo=!0,e.next=30,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:fz.subscribe,streamId:t.streamId,audioMid:c,videoMid:d,transceiverInit:null==s?void 0:s.transceiverInit,signalingAck:{audioMid:v,videoMid:m,sdp:g,sequenceId:y},stream:t});case 30:return e.next=32,Promise.all(f);case 32:this.monitor.rtcSubscribeStat(nB.SUCCESS,u,iB.UNKNOWN,t.userId),t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor);case 34:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"unsubscribePublicStream",value:(t=u(o().mark((function e(t){var r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Dz("unsubscribePublicStream()",t),n={appId:this._appId,streamId:t.streamId},e.prev=2,e.next=5,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("stopPullStream",n);case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(2);case 9:return t.streamState=uz.INIT,t.subVideo=!1,t.subAudio=!1,e.next=14,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:fz.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 14:t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 17:case"end":return e.stop()}}),e,this,[[2,7]])}))),function(e){return t.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;Oz.print("destroy()"),this._token=void 0,this._appId=void 0,this._roomId=void 0,this._clientId=void 0,this._authorization=void 0,this._sessionId=void 0,this._context=void 0,null===(e=this._handler)||void 0===e||e.destroy(),null===(t=this._dataChannelSignal)||void 0===t||t.destroy(),null===(r=this._iceConfigRequestManager)||void 0===r||r.abort(),this._handler=void 0,this._dataChannelSignal=void 0,this._iceConfigRequestManager=void 0,this._removeSignalEventHandler(),this.connectionState="disconnected",this.emit("INTERRUPT")}},{key:"sendUserMessage",value:function(e,t){var r;return null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendP2PMessage({to:e,from:this._userInfo.userId,room:this._roomId,app:this._appId,msg:t})}},{key:"sendRoomMessage",value:function(e){var t;return null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("customMessage",e)}},{key:"_multiChatMode",value:function(){var e;return null===(e=this._roomAttributes)||void 0===e?void 0:e.multiChatMode}},{key:"handler",get:function(){return this._handler}},{key:"roomAttributes",get:function(){return this._roomAttributes},set:function(e){this._roomAttributes=e}}]),O}(DU);function Mz(e,t,r){var n=r.value;return r.value=u(o().mark((function e(){var r,i,a,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._handler||"connected"!==this._state){e.next=6;break}for(r=s.length,i=new Array(r),a=0;a<r;a++)i[a]=s[a];return e.next=4,n.apply(this,i);case 4:e.next=7;break;case 6:throw new JN(qN.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 7:case"end":return e.stop()}}),e,this)}))),r}function Uz(e,t,r){var n=r.value;return r.value=u(o().mark((function e(){var t,r,i,a,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._pubSubLock.lock();case 2:for(t=e.sent,this.supportConcurrent&&t(),e.prev=4,r=s.length,i=new Array(r),a=0;a<r;a++)i[a]=s[a];return e.next=8,n.apply(this,i);case 8:return e.abrupt("return",e.sent);case 9:return e.prev=9,this.supportConcurrent||t(),e.finish(9);case 12:case"end":return e.stop()}}),e,this,[[4,,9,12]])}))),r}Cz([function(e,t,r){var n=r.value;return r.value=u(o().mark((function e(){var t,r,i,a,s=this,c=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=c.length,r=new Array(t),i=0;i<t;i++)r[i]=c[i];return a=!1,e.abrupt("return",new Promise(function(){var e=u(o().mark((function e(t,i){var u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s.on("INTERRUPT",(function(){a=!0,i(new JN(qN.OPERATION_CANCEL,"operation not finish when leave"))})),e.prev=1,e.next=4,n.apply(s,r);case 4:u=e.sent,t(u),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),a||i(e.t0);case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,r){return e.apply(this,arguments)}}()));case 3:case"end":return e.stop()}}),e)}))),r}],Pz.prototype,"join",1),Cz([Uz,Mz],Pz.prototype,"publish",1),Cz([Uz,Mz],Pz.prototype,"updatePubTrack",1),Cz([Uz,Mz],Pz.prototype,"unpublish",1),Cz([Uz,Mz],Pz.prototype,"subscribe",1),Cz([Mz],Pz.prototype,"controlMessage",1),Cz([Mz],Pz.prototype,"updateUserAttributes",1),Cz([Mz],Pz.prototype,"updateSubTrack",1),Cz([Uz,Mz],Pz.prototype,"subscribe4pushTrack",1),Cz([Uz,Mz],Pz.prototype,"unsubscribe4removeTrack",1),Cz([Uz,Mz],Pz.prototype,"unsubscribe",1),Cz([Mz],Pz.prototype,"handleRemoveStream",1),Cz([Uz],Pz.prototype,"subscribePublicStream",1),Cz([Uz],Pz.prototype,"unsubscribePublicStream",1);var Lz,Vz=function(){function e(t,r){c(this,e),h(this,"_audioEventSessionId",gP()),h(this,"_videoEventSessionId",gP()),h(this,"_handler",void 0),h(this,"_stream",void 0),h(this,"_firstAudioFrameTimer",void 0),h(this,"_firstVideoFrameTimer",void 0),h(this,"_transportDelayInterval",void 0),h(this,"_transportDelay",void 0),h(this,"_firstVideoFrameInterval",void 0),h(this,"_firstAudioFrameInterval",void 0),h(this,"_isScreen",!1),h(this,"_audioFirstFrameState",0),h(this,"_videoFirstFrameState",0),h(this,"_timeout",1e4),h(this,"_currentAudioRecv",{startTime:0,eventSessionId:0,type:uB.LOGIN}),h(this,"_currentVideoRecv",{startTime:0,eventSessionId:0,type:uB.LOGIN}),h(this,"_login",!1),h(this,"_unMuteAudio",!1),h(this,"_enableAudio",!1),h(this,"_unMuteVideo",!1),h(this,"_enableVideo",!1),h(this,"_remoteUnmuteAudio",!1),h(this,"_remoteUnmuteVideo",!1),h(this,"_audioExternal",!1),h(this,"_pushAudio",!1),h(this,"_videoExternal",!1),h(this,"_pushVideo",!1),h(this,"_autoSubscribeVideo",!1),h(this,"_autoSubscribeAudio",!1),h(this,"_autoSubscribe",!1),h(this,"_publishVideo",!1),h(this,"_publishAudio",!1),h(this,"_subscribeAudio",!1),h(this,"_subscribeVideo",!1),h(this,"_subscribe",!1),h(this,"_pushTrack",!1),h(this,"_multiChatMode",!1),this._stream=t,this._handler=r,this.getTransportDelay()}var t,r,n,i;return l(e,[{key:"beginRecvFrame",value:(i=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p,_,v,m=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:n=this._transportDelay,i=!0,a=uB.LOGIN,s=uB.UNMUTE,u=uB.SUBSCRIBE,c=uB.PUSH_TRACK,[a,s,u,c].indexOf(r)>=0&&(n=0,i=!1),t===sB.AUDIO?(i||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:r},h={media_type:t,event_type:aB.BEGIN_RECV,type:r,start:null===(d=this._currentAudioRecv)||void 0===d?void 0:d.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(l=this._stream)||void 0===l?void 0:l.userId,transport_delay:n},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){m.stopRecvFrame(sB.AUDIO,cB.TIMEOUT),m._firstAudioFrameInterval&&window.clearInterval(m._firstAudioFrameInterval)}),this._timeout),yB.rtcFirstFrame(h),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=1,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):t===sB.VIDEO&&(i||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:r},v={media_type:null!==(f=this._stream)&&void 0!==f&&f.isScreen?sB.SCREEN_VIDEO:t,event_type:aB.BEGIN_RECV,type:r,start:null===(p=this._currentVideoRecv)||void 0===p?void 0:p.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(_=this._stream)||void 0===_?void 0:_.userId,transport_delay:n},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){m.stopRecvFrame(sB.VIDEO,cB.TIMEOUT),m._firstVideoFrameInterval&&window.clearInterval(m._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),yB.rtcFirstFrame(v),this._videoFirstFrameState=1,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"stopRecvFrame",value:function(e,t){if(e===sB.AUDIO){var r,n,i;if(1!==this._audioFirstFrameState)return;var o={event_type:aB.RECV_END,media_type:e,start:null===(r=this._currentAudioRecv)||void 0===r?void 0:r.startTime,reason:t,result:!1,stream_user_id:null===(n=this._stream)||void 0===n?void 0:n.userId,event_session_id:this._audioEventSessionId,type:null===(i=this._currentAudioRecv)||void 0===i?void 0:i.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,yB.rtcFirstFrame(o),this._audioFirstFrameState=2}else if(e===sB.VIDEO){var a,s,u,c;if(1!==this._videoFirstFrameState)return;var d={event_type:aB.RECV_END,media_type:null!==(a=this._stream)&&void 0!==a&&a.isScreen?sB.SCREEN_VIDEO:e,start:null===(s=this._currentVideoRecv)||void 0===s?void 0:s.startTime,reason:t,result:!1,stream_user_id:null===(u=this._stream)||void 0===u?void 0:u.userId,event_session_id:this._videoEventSessionId,type:null===(c=this._currentVideoRecv)||void 0===c?void 0:c.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,yB.rtcFirstFrame(d),this._videoFirstFrameState=2}}},{key:"recvFrameFinish",value:(n=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h,f,p,_,v,m,y;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:if(r=this._transportDelay,n=uB.LOGIN,i=uB.UNMUTE,a=uB.SUBSCRIBE,s=uB.PUSH_TRACK,t!==sB.AUDIO){e.next=18;break}if(1===this._audioFirstFrameState){e.next=7;break}return e.abrupt("return");case 7:if(this._currentAudioRecv){e.next=9;break}return e.abrupt("return");case 9:c=this._currentAudioRecv,d=c.type,l=c.startTime,[n,i,a,s].indexOf(d)>=0&&(r=0),h={event_type:aB.RECV_END,media_type:t,start:l,result:!0,stream_user_id:null===(u=this._stream)||void 0===u?void 0:u.userId,event_session_id:this._audioEventSessionId,type:d,transport_delay:r},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),yB.rtcFirstFrame(h),this._audioFirstFrameState=3,e.next=30;break;case 18:if(t!==sB.VIDEO){e.next=30;break}if(1===this._videoFirstFrameState){e.next=21;break}return e.abrupt("return");case 21:if(this._currentVideoRecv){e.next=23;break}return e.abrupt("return");case 23:_=this._currentVideoRecv,v=_.type,m=_.startTime,[n,i,a,s].indexOf(v)>=0&&(r=0),y={event_type:aB.RECV_END,media_type:null!==(f=this._stream)&&void 0!==f&&f.isScreen?sB.SCREEN_VIDEO:t,start:m,result:!0,stream_user_id:null===(p=this._stream)||void 0===p?void 0:p.userId,event_session_id:this._videoEventSessionId,type:v,transport_delay:r},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),yB.rtcFirstFrame(y),this._videoFirstFrameState=3;case 30:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setLogin",value:function(e){var t,r,n,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{audio:!0,video:!0};this._login!==e&&(this._login=e,e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&o.audio&&this.beginRecvFrame(sB.AUDIO,uB.LOGIN),e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&o.video&&this.beginRecvFrame(sB.VIDEO,uB.LOGIN),!e&&null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame(sB.AUDIO,cB.LEAVE_ROOM),!e&&null!==(i=this._stream)&&void 0!==i&&i.hasVideo&&this.stopRecvFrame(sB.VIDEO,cB.LEAVE_ROOM))}},{key:"setUnmuteAudio",value:function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(sB.AUDIO,uB.UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(sB.AUDIO,cB.MUTE))}},{key:"setRemoteUnmuteAudio",value:function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(sB.AUDIO,uB.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(sB.AUDIO,cB.REMOTE_MUTE))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(sB.AUDIO,uB.ENABLE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(sB.AUDIO,cB.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(sB.VIDEO,uB.UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(sB.VIDEO,cB.MUTE))}},{key:"setRemoteUnmuteVideo",value:function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(sB.VIDEO,uB.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(sB.VIDEO,cB.REMOTE_MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(sB.VIDEO,uB.ENABLE):this.stopRecvFrame(sB.VIDEO,cB.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal=e}},{key:"setPushAudio",value:function(e){var t;this._audioExternal&&this._pushAudio!==e&&(this._pushAudio=e),this._pushAudio&&this.beginRecvFrame(sB.AUDIO,uB.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.beginRecvFrame(sB.AUDIO,uB.PUSH)}},{key:"setExternalVideoSource",value:function(e){this._videoExternal=e}},{key:"setPushVideo",value:function(e){var t;this._videoExternal&&this._pushVideo!==e&&(this._pushVideo=e),this._pushVideo&&this.beginRecvFrame(sB.VIDEO,uB.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.beginRecvFrame(sB.VIDEO,uB.PUSH)}},{key:"setPublishVideo",value:function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(sB.VIDEO,uB.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(sB.VIDEO,cB.UNPUBLISH)}},{key:"setPublishAudio",value:function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(sB.AUDIO,uB.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(sB.AUDIO,cB.UNPUBLISH)}},{key:"setAutoSubscribe",value:function(e){this._autoSubscribe=e}},{key:"setAutoSubscribeVideo",value:function(e){this._autoSubscribeVideo=e}},{key:"setAutoSubscribeAudio",value:function(e){this._autoSubscribeAudio=e}},{key:"setSubscribeAudio",value:function(e){var t,r;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&null!==(r=this._stream)&&void 0!==r&&r.hasAudio&&this.beginRecvFrame(sB.AUDIO,uB.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(sB.AUDIO,cB.UNSUBSCRIBE)}},{key:"setSubscribeVideo",value:function(e){var t,r;this._autoSubscribeVideo||this._subscribeVideo===e||(this._subscribeVideo=e,e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&this.beginRecvFrame(sB.VIDEO,uB.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(sB.VIDEO,cB.UNSUBSCRIBE)}},{key:"setPushTrack",value:function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(sB.AUDIO,uB.PUSH_TRACK),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(sB.AUDIO,cB.REMOVE_TRACK))}},{key:"setMultiChatMode",value:function(e){this._multiChatMode=e}},{key:"setTimeout",value:function(e){this._timeout=e}},{key:"_watchForFirstVideoFrameRecv",value:function(){var e=this,t=-1,r=-1;this._firstVideoFrameInterval=window.setInterval(u(o().mark((function n(){var i,a,s,u,c,d,l,h;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(a=e._stream)||void 0===a||null===(s=a.videoTrack)||void 0===s||!s.getTrack()){n.next=12;break}return n.next=3,Rj(null===(u=e._handler)||void 0===u?void 0:u.pc,null===(c=e._stream)||void 0===c||null===(d=c.videoTrack)||void 0===d?void 0:d.getTrack());case 3:if(l=n.sent,!(h=l.find((function(e){return"inbound-rtp"===e.type})))||!(h.framesReceived>t||h.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=h.framesReceived,r=h.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(sB.VIDEO),window.clearInterval(e._firstVideoFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"_watchForFirstAudioFrameRecv",value:function(){var e=this,t=-1,r=-1;this._firstAudioFrameInterval=window.setInterval(u(o().mark((function n(){var i,a,s,u,c,d,l,h;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(a=e._stream)||void 0===a||null===(s=a.audioTrack)||void 0===s||!s.getTrack()){n.next=12;break}return n.next=3,Rj(null===(u=e._handler)||void 0===u?void 0:u.pc,null===(c=e._stream)||void 0===c||null===(d=c.audioTrack)||void 0===d?void 0:d.getTrack());case 3:if(l=n.sent,!(h=l.find((function(e){return"inbound-rtp"===e.type})))||!(h.totalSamplesReceived>t||h.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=h.totalSamplesReceived,r=h.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(sB.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"getTransportDelay",value:(r=u(o().mark((function e(){var t=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelayIntl();case 2:window.clearInterval(this._transportDelayInterval),this._transportDelayInterval=window.setInterval(u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getTransportDelayIntl();case 2:case"end":return e.stop()}}),e)}))),2e3);case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getTransportDelayIntl",value:(t=u(o().mark((function e(){var t,r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc){e.next=7;break}return e.next=3,Rj(null===(r=this._handler)||void 0===r?void 0:r.pc);case 3:n=e.sent,i=n.find((function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(a=n.find((function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==i?void 0:i.selectedCandidatePairId)})))&&(this._transportDelay=Math.round(1e3*a.currentRoundTripTime/2));case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"reset",value:function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:uB.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:uB.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._transportDelayInterval&&window.clearInterval(this._transportDelayInterval)}}]),e}(),Fz=function(){function e(t,r){c(this,e),h(this,"_audioEventSessionId",gP()),h(this,"_videoEventSessionId",gP()),h(this,"_pcSessionId",void 0),h(this,"_handler",void 0),h(this,"_firstAudioFrameTimer",void 0),h(this,"_firstVideoFrameTimer",void 0),h(this,"_stream",void 0),h(this,"_firstVideoFrameInterval",void 0),h(this,"_firstAudioFrameInterval",void 0),h(this,"_currentAudioSend",{startTime:0,eventSessionId:0,type:uB.LOGIN}),h(this,"_currentVideoSend",{startTime:0,eventSessionId:0,type:uB.LOGIN}),h(this,"_login",!1),h(this,"_publisher",!1),h(this,"_unMuteAudio",!1),h(this,"_enableAudio",!1),h(this,"_unMuteVideo",!1),h(this,"_enableVideo",!1),h(this,"_audioExternal",!1),h(this,"_pushAudio",!1),h(this,"_videoExternal",!1),h(this,"_pushVideo",!1),h(this,"_autoPublish",!1),h(this,"_publish",!1),h(this,"_timeout",1e4),h(this,"_audioFirstFrameState",0),h(this,"_videoFirstFrameState",0),this._stream=t,this._handler=r}var t,r;return l(e,[{key:"beginSendFrame",value:function(e,t){var r=this;if(e===sB.AUDIO){var n;this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var i={media_type:e,event_type:aB.BEGIN_SEND,type:t,start:null===(n=this._currentAudioSend)||void 0===n?void 0:n.startTime,event_session_id:this._audioEventSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){r.stopSendFrame(sB.AUDIO,cB.TIMEOUT),r._firstAudioFrameInterval&&window.clearInterval(r._firstAudioFrameInterval)}),this._timeout),yB.rtcFirstFrame(i),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=1,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===sB.VIDEO){var o,a;this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};var s={media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?sB.SCREEN_VIDEO:e,event_type:aB.BEGIN_SEND,type:t,start:null===(a=this._currentVideoSend)||void 0===a?void 0:a.startTime,event_session_id:this._videoEventSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){r.stopSendFrame(sB.VIDEO,cB.TIMEOUT),r._firstVideoFrameInterval&&window.clearInterval(r._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),yB.rtcFirstFrame(s),this._videoFirstFrameState=1,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteVideo=!0,this._pushVideo||(this._enableVideo=!0)}}},{key:"stopSendFrame",value:function(e,t){if(e===sB.AUDIO){var r,n;if(1!==this._audioFirstFrameState)return;var i={event_type:aB.SENT_END,media_type:e,start:null===(r=this._currentAudioSend)||void 0===r?void 0:r.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(n=this._currentAudioSend)||void 0===n?void 0:n.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,yB.rtcFirstFrame(i),this._audioFirstFrameState=2}else if(e===sB.VIDEO){var o,a,s;if(1!==this._videoFirstFrameState)return;var u={event_type:aB.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?sB.SCREEN_VIDEO:e,start:null===(a=this._currentVideoSend)||void 0===a?void 0:a.startTime,reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(s=this._currentVideoSend)||void 0===s?void 0:s.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,yB.rtcFirstFrame(u),this._videoFirstFrameState=2}}},{key:"sendFrameFinish",value:function(e){if(e===sB.AUDIO){if(1!==this._audioFirstFrameState)return;if(!this._currentAudioSend)return;var t=this._currentAudioSend,r=t.type,n=t.startTime,i={event_type:aB.SENT_END,media_type:e,start:n,result:!0,event_session_id:this._audioEventSessionId,type:r};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),yB.rtcFirstFrame(i),this._audioFirstFrameState=3}else if(e===sB.VIDEO){var o;if(1!==this._videoFirstFrameState)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend,s=a.type,u=a.startTime,c={event_type:aB.SENT_END,media_type:null!==(o=this._stream)&&void 0!==o&&o.isScreen?sB.SCREEN_VIDEO:e,start:u,result:!0,event_session_id:this._videoEventSessionId,type:s};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),yB.rtcFirstFrame(c),this._videoFirstFrameState=3}}},{key:"setLogin",value:function(e){if(this._login!==e){var t,r;if(this._login=e,e)null!==(t=this._stream)&&void 0!==t&&t.videoTrack&&this.beginSendFrame(sB.VIDEO,uB.LOGIN),null!==(r=this._stream)&&void 0!==r&&r.audioTrack&&this.beginSendFrame(sB.AUDIO,uB.LOGIN);!e&&this._audioSending&&this.stopSendFrame(sB.AUDIO,cB.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(sB.VIDEO,cB.LEAVE_ROOM)}}},{key:"setPublish",value:function(e){if(this._publish!==e){var t,r;if(this._publish=e,e)(null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(sB.VIDEO,uB.PUBLISH),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(sB.AUDIO,uB.PUBLISH);!e&&this._audioSending&&this.stopSendFrame(sB.AUDIO,cB.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(sB.VIDEO,cB.UNPUBLISH)}}},{key:"setUnmuteAudio",value:function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(sB.AUDIO,uB.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(sB.AUDIO,cB.MUTE))}},{key:"setEnableAudio",value:function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(sB.AUDIO,uB.ENABLE),!e&&this._audioSending&&this.stopSendFrame(sB.AUDIO,cB.DISABLE))}},{key:"setUnmuteVideo",value:function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(sB.VIDEO,uB.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(sB.VIDEO,cB.MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(sB.VIDEO,uB.ENABLE),!e&&this._videoSending&&this.stopSendFrame(sB.VIDEO,cB.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(sB.AUDIO,cB.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(sB.AUDIO,cB.STOP_PUSH),this._pushAudio=!1))}},{key:"setPushAudio",value:function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(sB.AUDIO,uB.PUSH),!e&&this._audioSending&&this.stopSendFrame(sB.AUDIO,cB.STOP_PUSH))}},{key:"setExternalVideoSource",value:function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(sB.VIDEO,cB.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(sB.VIDEO,cB.STOP_PUSH),this._pushVideo=!1))}},{key:"setPushVideo",value:function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(sB.VIDEO,uB.PUSH),!e&&this._videoSending&&this.stopSendFrame(sB.VIDEO,cB.STOP_PUSH))}},{key:"setAutoPublish",value:function(e){this._autoPublish=e}},{key:"setPublisher",value:function(e){this._publisher!==e&&(this._publisher=e,!e&&this._audioSending&&this.stopSendFrame(sB.AUDIO,cB.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(sB.VIDEO,cB.AUDIENCE))}},{key:"setTimeout",value:function(e){this._timeout=e}},{key:"setPCSessionId",value:function(e){this._pcSessionId=e}},{key:"setHandler",value:function(e){this._handler=e}},{key:"_getFirstVideoFrameStats",value:(r=u(o().mark((function e(){var t,r,n,i,a,s,u,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc||null===(r=this._stream)||void 0===r||null===(n=r.videoTrack)||void 0===n||!n.getTrack()){e.next=6;break}return e.next=3,Rj(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(a=this._stream)||void 0===a||null===(s=a.videoTrack)||void 0===s?void 0:s.getTrack());case 3:return u=e.sent,c=u.find((function(e){return"outbound-rtp"===e.type})),e.abrupt("return",c);case 6:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_getFirstAudioFrameStats",value:(t=u(o().mark((function e(){var t,r,n,i,a,s,u,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc||null===(r=this._stream)||void 0===r||null===(n=r.audioTrack)||void 0===n||!n.getPublishTrack()){e.next=6;break}return e.next=3,Rj(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(a=this._stream)||void 0===a||null===(s=a.audioTrack)||void 0===s?void 0:s.getPublishTrack());case 3:return u=e.sent,c=u.find((function(e){return"outbound-rtp"===e.type})),e.abrupt("return",c);case 6:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_watchForFirstVideoFrameSend",value:function(){var e=this,t=-1,r=-1;this._firstVideoFrameInterval=window.setInterval(u(o().mark((function n(){var i;return o().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e._getFirstVideoFrameStats();case 2:if(!(i=n.sent)||!(i.framesSent>t||i.packetsSent>r)){n.next=10;break}if(-1!==t||-1!==r){n.next=8;break}return t=i.framesSent,r=i.packetsSent,n.abrupt("return");case 8:e.sendFrameFinish(sB.VIDEO),window.clearInterval(e._firstVideoFrameInterval);case 10:case"end":return n.stop()}}),n)}))),100)}},{key:"_watchForFirstAudioFrameSend",value:function(){var e=this,t=-1;this._firstAudioFrameInterval=window.setInterval(u(o().mark((function r(){var n;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e._getFirstAudioFrameStats();case 2:if(!((n=r.sent)&&n.packetsSent>t)){r.next=9;break}if(-1!==t){r.next=7;break}return t=n.packetsSent,r.abrupt("return");case 7:e.sendFrameFinish(sB.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 9:case"end":return r.stop()}}),r)}))),100)}},{key:"reset",value:function(){this._login=!1,this._publisher=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoPublish=!1,this._publish=!1,this._audioFirstFrameState=0,this._videoFirstFrameState=0,this._currentAudioSend={startTime:0,eventSessionId:0,type:uB.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:uB.LOGIN},window.clearTimeout(this._firstAudioFrameTimer),window.clearTimeout(this._firstVideoFrameTimer),window.clearInterval(this._firstAudioFrameInterval),window.clearInterval(this._firstVideoFrameInterval)}},{key:"destroy",value:function(){this.reset(),delete this._stream,delete this._handler}},{key:"_audioSending",get:function(){return 1===this._audioFirstFrameState}},{key:"_videoSending",get:function(){return 1===this._videoFirstFrameState}}]),e}(),Bz=(h(Lz={},"audio",{delay:1200,stallRadio:.3}),h(Lz,"video",{delay:1200,stallRadio:.6}),h(Lz,"screen_audio",{delay:1600,stallRadio:.8}),h(Lz,"screen_video",{delay:1600,stallRadio:.8}),Lz),jz=function(){function e(){c(this,e),h(this,"_preUplinkStats",new Map),h(this,"_preDownlinkStats",new Map),h(this,"_timer",void 0),h(this,"_delayTimer",void 0),h(this,"_connectionState",Nz.CONNECTED),h(this,"reportor",void 0)}return l(e,[{key:"updateUplinkStats",value:function(e){var t=e.audioStats,r=e.videoStats,n=e.isScreen;if(t.sendKBitrate>0&&t.rtt){var i=n?"screen_audio":"audio",o=t.rtt,a=t._fractionLost,s=t._retransmittedRate,u=this._getQosLevel(o,a||0,s||0),c=this._preUplinkStats.get(i)||[u];this._preUplinkStats.set(i,[].concat(k(c),[u]).slice(-2))}if(r.sentKBitrate>0&&r.rtt){var d=n?"screen_video":"video",l=r._fractionLost,h=r.rtt,f=r._sendBandWidth,p=r._retransmittedRate;0===f&&(l=Math.max(.65,l));var _=this._getQosLevel(h,l||0,p||0),v=this._preUplinkStats.get(d)||[_];this._preUplinkStats.set(d,[].concat(k(v),[_]).slice(-2))}this._startNetworkQualityReport()}},{key:"updateDownlinkStats",value:function(e,t){if(t){var r,n,i=this._getStreamActiveState(t),o=i.audioActive,a=i.videoActive,s=e.audioStats,u=e.videoStats,c=e.isScreen,d=e.userId;if(o&&s.rtt)if(0===s.receivedKBitrate)r=X.VBAD;else{var l=s.rtt,h=s.audioLossRate,f=s.stallDuration,p=s.statsInterval,_=s.e2eDelay,v=f/p,m=c?"screen_audio":"audio",y=this._getQosLevel(l,h||0,u._retransmittedRate||0),g=this._getDownlinkQoE(m,v,_);r=this._getNetworkQuality(y,g)}if(a)if(0===u.receivedKBitrate||0===u.rtt)n=X.VBAD;else{var S=u.rtt,b=u.videoLossRate,E=u.stallDuration,T=u.statsInterval,I=u.e2eDelay,A=u._retransmittedRate,R=E/T,w=c?"screen_video":"video",C=this._getQosLevel(S,b||0,A||0),O=this._getDownlinkQoE(w,R,I);n=this._getNetworkQuality(C,O)}var x=r&&n?Math.ceil((r+n)/2):r||n;if(x){var N="".concat(d).concat(c?"_screen":""),D=this._preDownlinkStats.get(N)||[x];this._preDownlinkStats.set(N,[].concat(k(D),[x]).slice(-2)),this._startNetworkQualityReport()}}}},{key:"setConnectionState",value:function(e){this._connectionState=e}},{key:"destroy",value:function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._delayTimer&&(window.clearTimeout(this._delayTimer),delete this._delayTimer),this._preUplinkStats.clear(),this._preDownlinkStats.clear()}},{key:"_startNetworkQualityReport",value:function(){var e=this;this._delayTimer||this._timer||(this._preUplinkStats.size>0||this._preDownlinkStats.size>0)&&(this._delayTimer=window.setTimeout((function(){delete e._delayTimer,e._reportNetworkQuality(),e._timer=window.setInterval((function(){e._reportNetworkQuality()}),2e3)}),300))}},{key:"_reportNetworkQuality",value:function(){var e,t,r=this;if(this._connectionState!==Nz.CONNECTED)e=t=X.VBAD;else{var n=this._getBetterQualityAndRemoveOldest("audio","up"),i=this._getBetterQualityAndRemoveOldest("video","up");e=n&&i?Math.ceil((n+i)/2):n||i||this._getBetterQualityAndRemoveOldest("screen_video","up")||this._getBetterQualityAndRemoveOldest("screen_audio","up")||X.UNKNOWN;var o=Array.from(this._preDownlinkStats.keys()).map((function(e){return r._getBetterQualityAndRemoveOldest(e,"down")})).filter((function(e){return e}));t=Math.ceil(o.reduce((function(e,t){return t+e}),0)/o.length)||X.UNKNOWN}this.reportor&&this.reportor(e,t)}},{key:"_getNetworkQuality",value:function(e,t){return 1===t?Math.max(e-2,1):2===t?e:Math.min(e+1,5)}},{key:"_getQosLevel",value:function(e,t,r){var n;return n=e<=250&&t<=.15?1:e<=500&&t<=.3?2:e<=750&&t<=.45?3:e<=1e3&&t<=.6?4:5,r>.5?n=Math.max(n,4):r>.35?n=Math.max(n,3):r>.15&&(n=Math.max(n,2)),n}},{key:"_getUplinkQoE",value:function(e,t){var r=0;switch(e){case"audio":case"video":r=t<.05?1:t<.1?2:3;break;case"screen_video":case"screen_audio":r=t<.04?1:t<.08?2:3}return r}},{key:"_getDownlinkQoE",value:function(e,t,r){var n=Bz[e];return t>n.stallRadio||r>n.delay||t>n.stallRadio/2&&r>n.delay/2?3:(t>n.stallRadio/2||n.delay,2)}},{key:"_getBetterQualityAndRemoveOldest",value:function(e,t){var r=X.UNKNOWN,n="up"===t?this._preUplinkStats:this._preDownlinkStats,i=n.get(e);if(i){var o=i.filter((function(e){return e}));o.length>0&&(r=Math.min.apply(Math,k(o))),i.shift(),0===i.length&&n.delete(e)}return r}},{key:"_getStreamActiveState",value:function(e){var t=e.subMediaType,r=e._attributes,n=e.subVideo;return{audioActive:e.subAudio&&IP(t)&&r.localaudio&&r.audiostream,videoActive:n&&AP(t)&&r.localvideo&&r.videostream}}}]),e}(),Gz=function(){function e(t){c(this,e),h(this,"_timer",void 0),h(this,"_remoteVideoSizeCache",{}),h(this,"_remoteScreenSizeCache",{}),h(this,"onchange",void 0),this._room=t,this._start()}return l(e,[{key:"destroy",value:function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._remoteVideoSizeCache={},this._remoteScreenSizeCache={}}},{key:"_start",value:function(){var e=this;this._timer||(this._timer=window.setInterval((function(){var t={},r={};e._room.remoteStreams.forEach((function(n,i){n.forEach((function(n){var o,a=null===(o=n.videoTrack)||void 0===o?void 0:o.getTrack();if(a){var s=n.isScreen?e._remoteScreenSizeCache:e._remoteVideoSizeCache,u=s[i]||{},c=u.width,d=void 0===c?0:c,l=u.height,h=void 0===l?0:l,f=a.getSettings(),p=f.width,_=void 0===p?0:p,v=f.height,m=void 0===v?0:v;h===m&&d===_||e.onchange&&e.onchange(i,n.isScreen,_,m),delete s[i],(n.isScreen?r:t)[i]={width:_,height:m}}}))})),Object.keys(e._remoteVideoSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!1,0,0)})),Object.keys(e._remoteScreenSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!0,0,0)})),e._remoteVideoSizeCache=t,e._remoteScreenSizeCache=r}),1e3))}}]),e}(),Hz=new xU("SubscribeFallbackManager",2),zz=1e4,Kz=function(){function e(t){c(this,e),h(this,"_preDownlinkNetworkQuality",[]),h(this,"_isSubscribeFallbackOrRecover",!1),h(this,"_inSubscribeRecoverChecking",!1),h(this,"_subRecoverCheckTimer",void 0),h(this,"_forbidSubRecover",!1),h(this,"_forbidSubRecoverTimer",void 0),h(this,"_forbidSubRecoverDuration",zz),h(this,"onSubscribeFallback",void 0),this._room=t}var t;return l(e,[{key:"updateNetworkQuality",value:function(e,t){this._preDownlinkNetworkQuality.push(t),this._preDownlinkNetworkQuality=this._preDownlinkNetworkQuality.slice(-10),this._inSubscribeRecoverChecking&&this._preDownlinkNetworkQuality.find((function(e){return e===X.BAD||e===X.VBAD}))&&this._startForbidSubRecover(),this._preDownlinkNetworkQuality.slice(-3).reduce((function(e,t){return e+t}),0)>3*X.POOR&&this._subscribeFallbackOrRecover("fallback"),!this._forbidSubRecover&&10===this._preDownlinkNetworkQuality.length&&this._preDownlinkNetworkQuality.every((function(e){return e===X.EXCELLENT}))&&this._subscribeFallbackOrRecover("recover")}},{key:"destroy",value:function(){this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),delete this.onSubscribeFallback}},{key:"_subscribeFallbackOrRecover",value:(t=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h,f=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isSubscribeFallbackOrRecover&&this._room.connectionState===Nz.CONNECTED){e.next=2;break}return e.abrupt("return");case 2:if(this._room.subscribeFallbackOption!==K.AUDIO_ONLY&&this._room.subscribeFallbackOption!==K.VIDEO_STREAM_LOW){e.next=24;break}if(r=new Map,this._room.remoteStreams.forEach((function(e){e.forEach((function(e){if(e.hasSubscribed){var n="fallback"===t?e.getSubscribeFallbackParams(f._room.subscribeFallbackOption):e.getSubscribeRecoverParams();if(n){var i=e.getStreamPriority(),o=r.get(i)||[];o.push({stream:e,fallbackOrRecoverOption:n}),r.set(i,o)}}}))})),!(r.size>0)){e.next=24;break}if(Hz.print("_subscribeFallbackOrRecover()","start subscribe ".concat(t,".")),n=Array.from(r.keys()).sort((function(e,t){return e-t}))["fallback"===t?0:r.size-1],i=r.get(n)||[],a=E(i,1),!(s=a[0])){e.next=24;break}return u=s.stream,c=s.fallbackOrRecoverOption,this._isSubscribeFallbackOrRecover=!0,d=u.subLayer.spatialLayer,l=u.subVideo,Hz.print("_subscribeFallbackOrRecover()","".concat(u.userId,"'s stream will be ").concat(t," to: MediaType=").concat(c[0]," subState=").concat(c[1]," subLayer=").concat(c[2])),e.prev=15,e.next=18,kP([(h=this._room).updateSubTrack.apply(h,[u].concat(k(c))).then((function(){"recover"===t?f._startSubscribeRecoverCheck():Hz.print("_subscribeFallbackOrRecover()","fallback success."),f.onSubscribeFallback&&f.onSubscribeFallback({userId:u.userId,isScreen:u.isScreen,beforeEnable:l,beforeVideoIndex:d,afterEnable:u.subVideo,afterVideoIndex:u.subLayer.spatialLayer,reason:"fallback"===t?q.SubscribeFallbackByBandwidth:q.SubscribeRecoverByBandwidth})})),fP(2e3)]);case 18:e.next=22;break;case 20:e.prev=20,e.t0=e.catch(15);case 22:this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1;case 24:case"end":return e.stop()}}),e,this,[[15,20]])}))),function(e){return t.apply(this,arguments)})},{key:"_startSubscribeRecoverCheck",value:function(){var e=this;this._stopSubscribeRecoverCheck(),this._inSubscribeRecoverChecking=!0,this._subRecoverCheckTimer=window.setTimeout((function(){e._inSubscribeRecoverChecking=!1,e._forbidSubRecoverDuration=zz,delete e._subRecoverCheckTimer,Hz.print("_subscribeFallbackOrRecover()","recover success.")}),2e4)}},{key:"_stopSubscribeRecoverCheck",value:function(){this._subRecoverCheckTimer&&(window.clearTimeout(this._subRecoverCheckTimer),delete this._subRecoverCheckTimer),this._inSubscribeRecoverChecking=!1}},{key:"_startForbidSubRecover",value:function(){var e=this;this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),this._forbidSubRecoverDuration=Math.min(this._forbidSubRecoverDuration+2e4,12e4),Hz.print("_subscribeFallbackOrRecover()","subscribe-recover failed, and subscribe-recover not allowed within ".concat(this._forbidSubRecoverDuration/1e3,"s")),this._forbidSubRecover=!0,this._forbidSubRecoverTimer=window.setTimeout((function(){e._forbidSubRecover=!1,delete e._forbidSubRecoverTimer}),this._forbidSubRecoverDuration)}},{key:"_stopForbidSubRecover",value:function(){this._forbidSubRecoverTimer&&(window.clearTimeout(this._forbidSubRecoverTimer),delete this._forbidSubRecoverTimer)}}]),e}(),Wz=new xU("Room",1),Xz=function(e){f(V,e);var t,r,n,a,s,d,p,_,v,y,S,b,k,T,I,R,w,O,x,N,P,M=g(V);function V(e,t){var r;return c(this,V),h(m(r=M.call(this)),"_mediaServerClient",void 0),h(m(r),"_localStream",void 0),h(m(r),"_localScreenStream",void 0),h(m(r),"_remoteUsers",new Map),h(m(r),"_remoteStreams",new Map),h(m(r),"_remoteStreamStreamIdUserIdMap",{}),h(m(r),"_joinResolveCallback",void 0),h(m(r),"_joinRejectCallback",void 0),h(m(r),"_getAccessNode",void 0),h(m(r),"_getAccessFeedback",void 0),h(m(r),"_getAccessFeedbackIceNode",void 0),h(m(r),"_reconnectTimer",void 0),h(m(r),"_isReconnecting",void 0),h(m(r),"_context",void 0),h(m(r),"_sessionId",void 0),h(m(r),"_reconnectRecord",void 0),h(m(r),"_connectionLostTimer",void 0),h(m(r),"_liveControlMessage",void 0),h(m(r),"_serverConfig",void 0),h(m(r),"_roomConfig",void 0),h(m(r),"_roomInfo",void 0),h(m(r),"_waitForNewToken",!1),h(m(r),"_userDuplicateLoginTimerMap",new Map),h(m(r),"_networkQualityManager",void 0),h(m(r),"userPriorityMap",void 0),h(m(r),"subscribeFallbackOption",void 0),h(m(r),"_videoSizeObserver",void 0),h(m(r),"_subFallbackManager",void 0),h(m(r),"_hasPublished",!1),r._roomConfig=e,r._mediaServerClient=new Pz(t),r._reconnectRecord=new qz,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new jz,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(m(r)),r._videoSizeObserver=new Gz(m(r)),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(m(r)),r._subFallbackManager=new Kz(m(r)),r._subFallbackManager.onSubscribeFallback=r._emitSubscribeFallback.bind(m(r)),r._context=t,r}return l(V,[{key:"hasScreenPublished",get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished}},{key:"hasPublished",get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished}},{key:"connectionState",get:function(){return this._mediaServerClient.connectionState}},{key:"remoteUsers",get:function(){return this._remoteUsers}},{key:"remoteStreams",get:function(){return this._remoteStreams}},{key:"localStream",get:function(){return this._localStream}},{key:"localScreenStream",get:function(){return this._localScreenStream}},{key:"roomInfo",get:function(){return this._roomInfo}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,y,g,S,b,E,k,T,I=this;null===(e=this._mediaServerClient)||void 0===e||e.on(ZB.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(ZB.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(ZB.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(ZB.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(ZB.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(ZB.ON_UPDATE_USER_ATTRIBUTES,this._onUpdateUserAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(ZB.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(ZB.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(ZB.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(ZB.NODE_CHANGE,this._nodeChange.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(ZB.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(ZB.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(ZB.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(ZB.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(ZB.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(ZB.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(ZB.ON_SCENE_CONFIG,this._onSceneConfig.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(ZB.ON_STREAM_FAILED,this._onStreamFailed.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on($B.RSCP,this._onPublishOnDemand.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on(ej.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on(ej.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(b=this._mediaServerClient)||void 0===b||b.on("onRemoteStreamStats",(function(e){I._networkQualityManager.updateDownlinkStats(e,I._findRemoteStreamByScreen(e.userId,e.isScreen)),I.emit(nz.ON_REMOTE_STREAM_STATS,RP(e))})),null===(E=this._mediaServerClient)||void 0===E||E.on("onLocalStreamStats",(function(e){I._networkQualityManager.updateUplinkStats(e),I.emit(nz.ON_LOCAL_STREAM_STATS,RP(e))})),null===(k=this._mediaServerClient)||void 0===k||k.on("prevIceNode",(function(e){I._getAccessFeedbackIceNode=e})),null===(T=this._mediaServerClient)||void 0===T||T.on("prevIceNode",(function(e){I._getAccessFeedbackIceNode=e}))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()}},{key:"join",value:(P=u(o().mark((function e(t,r,n,i,a,s){var u=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return bB.setStats({rtc_app_id:t,room_id:r,user_id:i.userId}),Wz.print("join()"),e.abrupt("return",new Promise((function(e,o){var c;u._joinResolveCallback=function(t){var r;yB.joinRoom(lB.END,d,!0,"",{enable_cloud_proxy:null===(r=u._roomInfo)||void 0===r?void 0:r.useCloudProxy}),e(t)},u._joinRejectCallback=function(e){var t;yB.joinRoom(lB.END,d,!1,e.message,{enable_cloud_proxy:null===(t=u._roomInfo)||void 0===t?void 0:t.useCloudProxy}),o(e)},u._liveControlMessage=a,u._roomInfo={appId:t,roomId:r,token:n,userInfo:i,useCloudProxy:s,roomProfile:u._roomConfig.roomProfileType};var d=cP();u.setSessionId(),yB.joinRoom(lB.BEGIN,d,!1,"",{enable_cloud_proxy:null===(c=u._roomInfo)||void 0===c?void 0:c.useCloudProxy}),u._join(u._joinResolveCallback,u._joinRejectCallback,!1)})));case 3:case"end":return e.stop()}}),e)}))),function(e,t,r,n,i,o){return P.apply(this,arguments)})},{key:"_join",value:(N=u(o().mark((function e(t,r){var n,i,a,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>2&&void 0!==s[2]&&s[2],i=cP(),Wz.print("_join()"),e.prev=3,e.next=6,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback,sessionId:this._sessionId,feedbackNode:this._getAccessFeedbackIceNode},n,this._liveControlMessage);case 6:a=e.sent,this._mediaServerClient.roomAttributes=a.roomAttributes,this._reconnectRecord.clear(),this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof t&&t({users:a.clients,streams:a.streams}),this._isReconnecting=!1,yB.rtcJoinRoom(0,"web","web",cP()-i),this._onJoinSucc(a,n),e.next=23;break;case 19:if(e.prev=19,e.t0=e.catch(3),e.t0.code===qN.OPERATION_CANCEL||"function"!=typeof r){e.next=23;break}return e.abrupt("return",r(e.t0));case 23:case"end":return e.stop()}}),e,this,[[3,19]])}))),function(e,t){return N.apply(this,arguments)})},{key:"publishScreen",value:(x=u(o().mark((function e(t,r,n,i,a){var s,u,c,d,l,h,f,p,_,v;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Wz.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new cz,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new Fz(this._localScreenStream,this._mediaServerClient.handler))),s=!1,u=!1,c=!1,d=!1,!this._localScreenStream.videoTrack&&r?(r instanceof DH&&(u=!0),s=!0):this._localScreenStream.videoTrack&&!r&&(s=!1),!this._localScreenStream.audioTrack&&n?(n instanceof PH&&(d=!0),c=!0):this._localScreenStream.audioTrack&&!n&&(c=!1),this._localScreenStream.videoTrack=r,this._localScreenStream.audioTrack=n,this._localScreenStream.videoEncodeConfig=t,i&&(IP(i)&&(this._localScreenStream.pubAudio=a===oz.PUB),AP(i)&&(this._localScreenStream.pubVideo=a===oz.PUB),Wz.print("publishScreen mediaType","pubAudio: %o, pubVideo: %o",this._localScreenStream.pubAudio,this._localScreenStream.pubVideo)),this._localScreenStream.pubAudio||this._localScreenStream.pubVideo){e.next=18;break}if(null===(l=this._localScreenStream)||void 0===l||!l.hasPublished){e.next=17;break}return e.abrupt("return",this.unpublishScreen());case 17:return e.abrupt("return");case 18:if(this._localScreenStream.hasPublished){e.next=24;break}return null===(h=this._localScreenStream.observer)||void 0===h||h.setPublish(!0),e.next=22,this._mediaServerClient.publish(this._localScreenStream);case 22:e.next=28;break;case 24:return u?null===(f=this._localScreenStream.observer)||void 0===f||f.setPushVideo(s):null===(p=this._localScreenStream.observer)||void 0===p||p.setEnableVideo(s),d?null===(_=this._localScreenStream.observer)||void 0===_||_.setPushAudio(c):null===(v=this._localScreenStream.observer)||void 0===v||v.setEnableAudio(c),e.next=28,this.updatePubScreenTrack();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return x.apply(this,arguments)})},{key:"updatePubScreenTrack",value:(O=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Wz.print("updatePubScreenTrack","Invoke updatePubScreenTrack"),!this._localScreenStream){e.next=4;break}return e.next=4,this._mediaServerClient.updatePubTrack(this._localScreenStream);case 4:case"end":return e.stop()}}),e,this)}))),function(){return O.apply(this,arguments)})},{key:"unpublishScreen",value:(w=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Wz.print("unpublish","Invoke unpublishScreen"),!this._localScreenStream){e.next=7;break}return null===(t=this._localScreenStream.observer)||void 0===t||t.setPublish(!1),e.next=5,this._mediaServerClient.unpublish(this._localScreenStream);case 5:this._localScreenStream.clean(),this._localScreenStream=void 0;case 7:case"end":return e.stop()}}),e,this)}))),function(){return w.apply(this,arguments)})},{key:"liveControlMessage",value:(R=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Wz.print("controlMessage","Invoke controlMessage"),null===(r=t.transcodeMeta)||void 0===r||r.layout.regions.forEach((function(e){n.roomInfo&&(e.roomID=n.roomInfo.roomId)})),this._liveControlMessage=t,e.next=5,this._mediaServerClient.controlMessage(t);case 5:"stopped"===t.action&&delete this._liveControlMessage;case 6:case"end":return e.stop()}}),e,this)}))),function(e){return R.apply(this,arguments)})},{key:"publicStreamControlMessage",value:(I=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"stopped"===t.action&&delete t.publicStreamMeta,e.next=3,this._mediaServerClient.controlMessage(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return I.apply(this,arguments)})},{key:"updateUserAttributes",value:(T=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Wz.print("updateUserAttributes","Invoke updateUserAttributes"),t.role&&this._roomInfo&&(this._roomInfo.userInfo.role=t.role),e.next=4,this._mediaServerClient.updateUserAttributes(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return T.apply(this,arguments)})},{key:"publish",value:(k=u(o().mark((function e(t,r,n,i,a,s){var u,c,d,l,h,f,p,_,v,m,y,g,S=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=S.length>6&&void 0!==S[6]&&S[6],Wz.print("publish","Invoke publish"),c=!1,this._localStream||(this._localStream=new cz,this._mediaServerClient.handler&&(this._localStream.observer=new Fz(this._localStream,this._mediaServerClient.handler)),c=!0),this._localStream.videoTrack=n,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=t,this._localStream.enableSimulcast=r,a&&(IP(a)&&(this._localStream.pubAudio=s===oz.PUB),AP(a)&&(this._localStream.pubVideo=s===oz.PUB),Wz.print("publish mediaType","pubAudio: %o, pubVideo: %o",this._localStream.pubAudio,this._localStream.pubVideo)),this._localStream.hasPublished){e.next=26;break}if(this._localStream.pubAudio||this._localStream.pubVideo){e.next=12;break}return e.abrupt("return");case 12:return e.prev=12,u?null===(d=this._localStream.observer)||void 0===d||d.setLogin(!0):c&&(l=!!this._localStream.videoTrack,h=!!this._localStream.audioTrack,f=this._localStream.videoTrack instanceof DH,p=this._localStream.audioTrack instanceof PH,this._roomConfig.isAutoPublish&&!this._hasPublished?(l&&(f?null===(_=this._localStream.observer)||void 0===_||_.setPushVideo(!0):null===(v=this._localStream.observer)||void 0===v||v.setEnableVideo(!0)),h&&(p?null===(m=this._localStream.observer)||void 0===m||m.setPushAudio(!0):null===(y=this._localStream.observer)||void 0===y||y.setEnableAudio(!0))):null===(g=this._localStream.observer)||void 0===g||g.setPublish(!0)),e.next=16,this._mediaServerClient.publish(this._localStream);case 16:this._hasPublished=!0,this.emit(nz.ON_PUBLISH_RESULT,{isScreen:!1,state:D.PUBLISH_SUCC}),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(12),this.emit(nz.ON_PUBLISH_RESULT,{isScreen:!1,state:D.PUBLISH_FAIL}),e.t0;case 24:e.next=28;break;case 26:return e.next=28,this.updatePubTrack();case 28:case"end":return e.stop()}}),e,this,[[12,20]])}))),function(e,t,r,n,i,o){return k.apply(this,arguments)})},{key:"updatePubTrack",value:(b=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Wz.print("updatePubTrack","Invoke updatePubTrack"),!this._localStream){e.next=4;break}return e.next=4,this._mediaServerClient.updatePubTrack(this._localStream);case 4:case"end":return e.stop()}}),e,this)}))),function(){return b.apply(this,arguments)})},{key:"unpublish",value:(S=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Wz.print("unpublish","Invoke unpublish"),!this._localStream){e.next=6;break}return e.next=4,this._mediaServerClient.unpublish(this._localStream);case 4:this._localStream.clean(),this._localStream=void 0;case 6:case"end":return e.stop()}}),e,this)}))),function(){return S.apply(this,arguments)})},{key:"subscribe",value:(y=u(o().mark((function e(t,r,n){var i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Wz.print("subscribe","remoteStream %o",t),i=void 0,n&&(i=this._getSubLayer(n,t)),e.next=5,this._mediaServerClient.subscribe(t,r,i);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return y.apply(this,arguments)})},{key:"updateSubTrack",value:(v=u(o().mark((function e(t,r,n,i){var a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Wz.print("updateSubTrack","Invoke updateSubTrack"),e.abrupt("return",null===(a=this._mediaServerClient)||void 0===a?void 0:a.updateSubTrack(t,r,n,i));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return v.apply(this,arguments)})},{key:"updateSubVideoConfig",value:(_=u(o().mark((function e(t,r){var n,i,a,s,u;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((s=this._findRemoteStreamByScreen(t,!1))&&s.hasSubscribed&&!((null==s||null===(n=s.attributes)||void 0===n||null===(i=n.videoDescriptions)||void 0===i?void 0:i.length)<=1)){e.next=3;break}return e.abrupt("return");case 3:return u=this._getSubLayer(r,s),s.originalStreamIndex=u.spatialLayer,e.abrupt("return",null===(a=this._mediaServerClient)||void 0===a?void 0:a.updateSubTrack(s,s.subMediaType,az.SUB,u));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"_getSubLayer",value:function(e,t){for(var r,n,i,o,a,s=null==t?void 0:t.attributes,u=s.videoDescriptions,c=s.subVideoDescriptions,d=Array.isArray(c)?c:u,l=-1,h=e.width*e.height,f=0;f<(null==d?void 0:d.length);f++){var p,_;if(h>=(null===(p=d[f])||void 0===p?void 0:p.width)*(null===(_=d[f])||void 0===_?void 0:_.height)){l=f;break}}var v=d[0];if(-1===l)v=d[l=d.length-1];else if(0!==l){var m=d[l-1].width*d[l-1].height,y=(m-h)/(m-d[l].width*d[l].height);v=y<.1?d[l-1]:d[l],l=y<.1?l-1:l}return a=null!==(r=null===(n=v)||void 0===n?void 0:n.sub_index)&&void 0!==r?r:-1,{spatialLayer:null!==(i=null===(o=v)||void 0===o?void 0:o.video_index)&&void 0!==i?i:l,spatialSubLayer:a}}},{key:"unsubscribe",value:(p=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Wz.print("unsubscribe","Invoke unsubscribe"),e.next=3,this._mediaServerClient.unsubscribe(t,r);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return p.apply(this,arguments)})},{key:"leave",value:(d=u(o().mark((function e(){var t,r,n,i,a,s,u=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=u.length>0&&void 0!==u[0]&&u[0],Wz.print("leave","Invoke leave"),r=cP(),e.prev=3,clearTimeout(this._reconnectTimer),n=A(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)a=i.value,Array.isArray(a)&&a.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(lV){n.e(lV)}finally{n.f()}return this._localStream&&(null===(s=this._localStream.observer)||void 0===s||s.setLogin(!1)),e.next=10,this._mediaServerClient.leave();case 10:this.destroy(),yB.rtcLeaveRoom(0,"",cP()-r),e.next=23;break;case 14:if(e.prev=14,e.t0=e.catch(3),e.t0 instanceof JN&&e.t0.code===qN.NOT_CONNECTED_YET&&this._joinRejectCallback&&this._joinRejectCallback(new Error(hB.LEAVE_ROOM)),!t){e.next=21;break}throw e.t0;case 21:this.destroy();case 22:e.t0 instanceof Error&&yB.rtcLeaveRoom(-1,e.t0.message,cP()-r);case 23:case"end":return e.stop()}}),e,this,[[3,14]])}))),function(){return d.apply(this,arguments)})},{key:"setRemoteUserPriority",value:function(e,t){var r,n;null===(r=this.remoteStreams.get(e))||void 0===r||r.forEach((function(e){return e.setRemoteUserPriority(t)})),null===(n=this.userPriorityMap)||void 0===n||n.set(e,t)}},{key:"destroy",value:function(){Wz.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;var e,t,r,n=A(this._remoteStreams);try{for(n.s();!(e=n.n()).done;){var i=E(e.value,2)[1];Array.isArray(i)&&i.forEach((function(e){e&&e.clean()}))}}catch(lV){n.e(lV)}finally{n.f()}(this._remoteStreams=new Map,this._localStream)&&(null===(t=this._localStream)||void 0===t||t.clean(),this._localStream=void 0);this._localScreenStream&&(null===(r=this._localScreenStream)||void 0===r||r.clean(),this._localScreenStream=void 0);this._context=void 0,this._reconnectRecord=new qz,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._subFallbackManager.destroy(),this._remoteStreamStreamIdUserIdMap={}}},{key:"updateToken",value:(s=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Wz.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=t),e.next=4,this._mediaServerClient.updateToken(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(a=u(o().mark((function e(t){var r,n,i,a,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],n=A(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)a=i.value,Array.isArray(a)&&a.forEach((function(e){if(e.hasSubscribed){var n=s.updateSubTrack(e,t,az.UNSUB);n&&r.push(n)}}))}catch(lV){n.e(lV)}finally{n.f()}return e.abrupt("return",Promise.all(r));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(n=u(o().mark((function e(t){var r,n,i,a,s=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=[],n=A(this._remoteStreams.values());try{for(n.s();!(i=n.n()).done;)a=i.value,Array.isArray(a)&&a.forEach((function(e){if(e.hasSubscribed&&e.hasSubscribed){var n=s.updateSubTrack(e,t,az.SUB);n&&r.push(n)}}))}catch(lV){n.e(lV)}finally{n.f()}return e.abrupt("return",Promise.all(r));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"sendUserMessage",value:function(e,t){var r;return null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendUserMessage(e,t)}},{key:"setSessionId",value:function(){this._sessionId=oP(),bB.setStats({rtc_session_id:this._sessionId})}},{key:"sendRoomMessage",value:(r=u(o().mark((function e(t){var r,n,i,a,s=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=s.length>1&&void 0!==s[1]&&s[1],a={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:i,message:""},!i){e.next=8;break}return e.next=5,hP.ab2b64str(t);case 5:a.message=e.sent,e.next=9;break;case 8:a.message=t;case 9:return e.abrupt("return",null===(n=this._mediaServerClient)||void 0===n?void 0:n.sendRoomMessage(a));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_destroyAndInitMediaServerClient",value:function(){Wz.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new Pz(this._context),this._addHandlerEventHandler()}},{key:"_onJoinSucc",value:function(e,t){var r,n=this;Wz.print("JoinSuccess()"),this._serverConfig=e.config;var i=[],o=[],a=[],s=[];null===(r=e.clientsDetail)||void 0===r||r.forEach((function(t){if(t.attributes&&(t.attributes.serverMuteVideo&&n.safeEmit(nz.ON_VIDEO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteVideo}),t.attributes.serverMuteAudio&&n.safeEmit(nz.ON_AUDIO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteAudio})),t.clientId!==e.clientId){var r=n._remoteUsers.get(t.clientId);r?r._stillExist=!0:i.push(t)}}));var u,c=A(this._remoteUsers.values());try{for(c.s();!(u=c.n()).done;){var d=u.value;d._stillExist||o.push({clientId:d.userId}),delete d._stillExist}}catch(lV){c.e(lV)}finally{c.f()}e.streams.forEach((function(e){var t=n._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId):s.push(e)}));var l,h=A(this._remoteStreams.values());try{for(h.s();!(l=h.n()).done;){var f=l.value;Array.isArray(f)&&f.forEach((function(e){e.stillExist?delete e.stillExist:a.push({clientId:e.userId,streamId:e.streamId,message:JB.clientDisconnected})}))}}catch(lV){h.e(lV)}finally{h.f()}setTimeout((function(){o.forEach((function(e){return n._onUserDisconnection(e)})),i.forEach((function(e){return n._onUserConnection(e)})),a.forEach((function(e){return n._onRemoveStream(e)})),s.forEach((function(e){return n._onAddStream(e,!0,!1)})),t&&n._handleSendOrRecvStreamAfterReconnect()}))}},{key:"_handleSendOrRecvStreamAfterReconnect",value:function(){var e=this;this._localStream&&(this._localStream.clean(),this._mediaServerClient.publish(this._localStream).catch((function(e){}))),this._localScreenStream&&(this._localScreenStream.clean(),this._mediaServerClient.publish(this._localScreenStream).catch((function(e){})));var t,r=A(this._remoteStreams.values());try{for(r.s();!(t=r.n()).done;){var n=t.value;Array.isArray(n)&&n.forEach(function(){var t=u(o().mark((function t(r){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!r.hasSubscribed){t.next=15;break}return r.resetHasSubscribed(),t.prev=2,Wz.print("start resubscribe ".concat(r.userId," with ").concat(r.subMediaType)),t.next=6,e._mediaServerClient.subscribe(r,r.subMediaType);case 6:Wz.print("success resubscribe ".concat(r.userId," with ").concat(r.subMediaType)),e.safeEmit(nz.RESUBSCRIBE,{stream:r}),t.next=15;break;case 10:t.prev=10,t.t0=t.catch(2),Wz.print("failed resubscribe ".concat(r.userId," with ").concat(r.subMediaType,", error:").concat(t.t0)),r.clean(),null==r||r.resetHasSubscribed();case 15:case"end":return t.stop()}}),t,null,[[2,10]])})));return function(e){return t.apply(this,arguments)}}())}}catch(lV){r.e(lV)}finally{r.f()}}},{key:"_findRemoteStream",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.streamId===t})):null}},{key:"_findRemoteStreamByScreen",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.isScreen===t})):null}},{key:"_onAddStream",value:function(e){var t,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var i=this._roomConfig,o=i.isAutoSubscribeAudio,a=i.isAutoSubscribeVideo,s=this._findRemoteStreamByScreen(e.clientId,e.screen);if(s&&s.streamId!==e.streamId){var u,c=null===(u=this._remoteStreams.get(e.clientId))||void 0===u?void 0:u.filter((function(e){return e.streamId!==s.streamId}));s.clean(),this._remoteStreams.set(e.clientId,c||[])}var d=this._findRemoteStream(e.clientId,e.streamId);if(this._remoteStreamStreamIdUserIdMap[e.streamId]=e.clientId,d)d.attributes=e.attributes;else{var l;d=new dz(e.clientId,e.streamId,e.screen,e.attributes,null===(l=this.userPriorityMap)||void 0===l?void 0:l.get(e.clientId)),this._initStreamListeners(d);var h=this._remoteStreams.get(e.clientId);h?h.push(d):this._remoteStreams.set(e.clientId,[d])}if(this._mediaServerClient.handler&&(d.observer=new Vz(d,this._mediaServerClient.handler)),!d.isScreen&&a){var f,p,_,v,m,y,g,S;if(n&&d.hasVideo)if(d.attributes.extvideo)null===(f=d.observer)||void 0===f||f.setExternalVideoSource(!0),null===(p=d.observer)||void 0===p||p.setPushVideo(!0);else null===(_=d.observer)||void 0===_||_.setExternalVideoSource(!1),null===(v=d.observer)||void 0===v||v.setPublishVideo(!0);if(n&&d.hasAudio&&o&&!this._mediaServerClient.roomAttributes.multiChatMode)if(d.attributes.extaudio)null===(m=d.observer)||void 0===m||m.setExternalAudioSource(!0),null===(y=d.observer)||void 0===y||y.setPushAudio(!0);else null===(g=d.observer)||void 0===g||g.setExternalAudioSource(!1),null===(S=d.observer)||void 0===S||S.setPublishAudio(!0);if(!0===r&&!1===n){var b,E=this._roomConfig,k=E.isAutoSubscribeAudio,T=E.isAutoSubscribeVideo;null===(b=d.observer)||void 0===b||b.setLogin(!0,{audio:!!k,video:!!T})}}return r&&this.safeEmit(ZB.ON_ADD_STREAM,{stream:d}),d}}},{key:"_onUserConnection",value:function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var r=this._userDuplicateLoginTimerMap.get(e.clientId);if("number"==typeof r)return this._userDuplicateLoginTimerMap.delete(e.clientId),void self.clearTimeout(r);var n={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,i({},n)),this.safeEmit(ZB.USER_CONNECTION,{userInfo:n}),e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(nz.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(nz.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}}},{key:"_onUserDisconnection",value:function(e){var t,r=this,n=e.clientId,i=e.tag,o=e.code;if(n)if(n===(null===(t=this.roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=null;i===tj.kickedByAdmin?a=qN.KICKED_OUT:i===tj.onUserTokenDidExpire?a=qN.TOKEN_EXPIRED:i===tj.userDuplicateLogin&&(a=qN.DUPLICATE_LOGIN),o===rj.roomDismissByAdmin&&(a=qN.ROOM_DISMISS),a&&this.safeEmit(nz.ON_ROOM_ERROR,{errorCode:a})}else{var s=C.DROPPED;i===tj.userLeave?s=C.QUIT:i===tj.kickedByAdmin?s=C.KICKED_BY_ADMIN:i===tj.roleChanged&&(s=C.SWITCH_TO_INVISIBLE);var u=function(){var e;r._remoteUsers.delete(n),null===(e=r._remoteStreams.get(n))||void 0===e||e.forEach((function(e){r._onRemoveStream({clientId:e.userId,streamId:e.streamId,message:"client disconnected"})})),r._remoteStreams.delete(n),r.safeEmit(nz.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===tj.userDuplicateLogin){var c=this._userDuplicateLoginTimerMap.get(n);c&&self.clearTimeout(c);var d=self.setTimeout(u,5e3);this._userDuplicateLoginTimerMap.set(n,d)}else u()}}},{key:"_onRemoveStream",value:function(e){var t,r=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var n=this._remoteStreams.get(e.clientId);if(n){var i=n.find((function(t){return t.streamId===e.streamId}));if(i){var o,a,s;if(null===(o=this._mediaServerClient)||void 0===o||o.handleRemoveStream(i,e).then((function(){if(null==i||!i._workaround_1_){var t=r._remoteStreams.get(e.clientId);if(!t)return;t=t.filter((function(t){return t.streamId!==e.streamId})),r._remoteStreams.set(e.clientId,t)}})).finally((function(){r.safeEmit(ZB.ON_REMOVE_STREAM,{stream:i,reason:e.message})})),i.hasVideo)null===(a=i.observer)||void 0===a||a.setPublishVideo(!1);if(i.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode)null===(s=i.observer)||void 0===s||s.setPublishAudio(!1)}}}}},{key:"_onUpdateUserAttributes",value:function(e){e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(nz.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(nz.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}},{key:"_onUpdateRoomAttributes",value:function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=i(i({},this._mediaServerClient.roomAttributes),e.roomAttributes))}},{key:"_onUpdateStreamAttributes",value:function(e){var t=this._roomConfig,r=t.isAutoSubscribeAudio,n=t.isAutoSubscribeVideo,o=e.clientId,a=e.streamId,s=e.attributes,u=this._findRemoteStream(o,a);if(u){var c,d,l=u.attributes,h=i(i({},l),s),f=!1,p=h.localaudio!==l.localaudio,_=!1,v=!1,m=h.localvideo!==l.localvideo,y=!1,g=jH.NONE,S=jH.NONE;if(h.audiostream!==l.audiostream&&(f=h.localaudio,_=!!h.audiostream,h.audiostream?g|=L.AUDIO:S|=L.AUDIO),h.videostream!==l.videostream&&(v=h.localvideo,y=!!h.videostream,h.videostream?g|=L.VIDEO:S|=L.VIDEO),g&&this.safeEmit(nz.ON_USER_PUBLISH_STATE_CHANGE,{userId:o,mediaType:g,isScreen:u.isScreen,pubState:oz.PUB,remoteStream:u}),S&&this.safeEmit(nz.ON_USER_PUBLISH_STATE_CHANGE,{userId:o,mediaType:S,isScreen:u.isScreen,pubState:oz.UNPUB,remoteStream:u}),h.localaudio!==l.localaudio)if(h.localaudio&&r){var b,E,k,T;if(h.extaudio)null===(b=u.observer)||void 0===b||b.setExternalAudioSource(!0),null===(E=u.observer)||void 0===E||E.setPushAudio(!0);else null===(k=u.observer)||void 0===k||k.setExternalAudioSource(!1),null===(T=u.observer)||void 0===T||T.setEnableAudio(!0);this.safeEmit(nz.ON_USER_START_AUDIO_CAPTURE,{userId:o})}else{var I,A,R,w;if(h.extaudio)null===(I=u.observer)||void 0===I||I.setExternalAudioSource(!0),null===(A=u.observer)||void 0===A||A.setPushAudio(!1);else null===(R=u.observer)||void 0===R||R.setExternalAudioSource(!1),null===(w=u.observer)||void 0===w||w.setEnableAudio(!1);!u.isScreen&&this.safeEmit(nz.ON_USER_STOP_AUDIO_CAPTURE,{userId:o})}if(h.localvideo!==l.localvideo)if(h.localvideo&&n){var C,O,x,N;if(h.extvideo)null===(C=u.observer)||void 0===C||C.setExternalVideoSource(!0),null===(O=u.observer)||void 0===O||O.setPushVideo(!0);else null===(x=u.observer)||void 0===x||x.setExternalVideoSource(!1),null===(N=u.observer)||void 0===N||N.setEnableVideo(!0);this.safeEmit(nz.ON_USER_START_VIDEO_CAPTURE,{userId:o})}else{var D,P,M,U;if(h.extvideo)null===(D=u.observer)||void 0===D||D.setExternalVideoSource(!0),null===(P=u.observer)||void 0===P||P.setPushVideo(!1);else null===(M=u.observer)||void 0===M||M.setExternalVideoSource(!1),null===(U=u.observer)||void 0===U||U.setEnableVideo(!1);!u.isScreen&&this.safeEmit(nz.ON_USER_STOP_VIDEO_CAPTURE,{userId:o})}if(f&&!p)null===(c=u.observer)||void 0===c||c.setRemoteUnmuteAudio(_);if(v&&!m)null===(d=u.observer)||void 0===d||d.setRemoteUnmuteVideo(y);u.attributes=h}}},{key:"_onPushTrack",value:function(e){var t=this,r=e.clientId,n=e.streamId,i=this._findRemoteStream(r,n);i||(i=this._onAddStream(e,!1,!1)),this._mediaServerClient.subscribe4pushTrack(i,e).then((function(){return t.safeEmit(nz.SUBSCRIBE_PUSH_TRACK,{stream:i})})).catch((function(e){Wz.print("subscribe push track failed: ".concat(e))}))}},{key:"_onRemoveTrack",value:function(e){var t=this,r=e.clientId,n=e.streamId,i=e.message,o=this._findRemoteStream(r,n);o&&this._mediaServerClient.unsubscribe4removeTrack(o,i).then((function(){if(o._workaround_1_){var e,i=null===(e=t._remoteStreams.get(r))||void 0===e?void 0:e.filter((function(e){return e.streamId!==n}));t._remoteStreams.set(r,i||[])}t.safeEmit(nz.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){Wz.print("remove push track failed: ".concat(e))}))}},{key:"_nodeChange",value:function(e){var t,r=e.nodes,n=e.reason;UB.clearAccessNode(null===(t=this._roomInfo)||void 0===t?void 0:t.appId),this._destroyAndInitMediaServerClient(),Array.isArray(r)&&r.length?this._getAccessNode=r[0]:this._getAccessFeedback=n,yB.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(n)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()}},{key:"_reconnect",value:function(){var e=this;this._isReconnecting=!0;var t,r=A(this._remoteStreams.values());try{for(r.s();!(t=r.n()).done;){var n=t.value;Array.isArray(n)&&n.forEach((function(e){return e.clean()}))}}catch(lV){r.e(lV)}finally{r.f()}yB.rtcReconnect(1002,BF.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,jF.PEERCONNECTION),this._join((function(){yB.rtcReconnected(GF.PEERCONNECTION_RECONNECTED,HF.PEERCONNECTION)}),(function(t){e._reconnectRecord.record(t),e._reconnectRecord.shouldReconnect?(Wz.print("Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=window.setTimeout(e._reconnect.bind(e),3e3)):(e.safeEmit(nz.RECONNECT_FAILED),e.destroy())}),!0)}},{key:"_handleAbnormalDisconnection",value:function(){Wz.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=window.setTimeout(this._reconnect.bind(this),3e3)}},{key:"_onConnectionStateChange",value:function(e){var t,r=this;if(e.next===Nz.DISCONNECTED)t=F.CONNECTION_STATE_DISCONNECTED;else if(e.next===Nz.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?F.CONNECTION_STATE_RECONNECTED:F.CONNECTION_STATE_CONNECTED;else{if(e.next!==Nz.CONNECTING)return;t=this._isReconnecting?F.CONNECTION_STATE_RECONNECTING:F.CONNECTION_STATE_CONNECTING}e.prev===Nz.CONNECTED&&e.next===Nz.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){r.safeEmit(ej.ON_CONNECTION_STATE_CHANGE,{state:F.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(ej.ON_CONNECTION_STATE_CHANGE,{state:t})}},{key:"_initStreamListeners",value:function(e){var t=this;e.on("ontrack",(function(e){e.track})),e.on("onSEIMessage",(function(r){var n;t.emit(nz.ON_SEI_MESSAGED_RECEIVED,{sei:r,remoteStreamKey:{userId:e.userId,roomId:null===(n=t._roomInfo)||void 0===n?void 0:n.roomId,streamIndex:e.isScreen?U.STREAM_INDEX_SCREEN:U.STREAM_INDEX_MAIN}})}))}},{key:"_onCustomMessage",value:function(e){this.safeEmit(ZB.ON_CUSTOM_MESSAGE,e)}},{key:"_onUserMessageReceived",value:function(e){this.safeEmit(ZB.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onUserBinaryMessageReceived",value:function(e){this.safeEmit(ZB.USER_BINARY_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onPostProcessingMessage",value:function(e){if(e.body){var t=e.body,r=t.error||0,n=iz.START,i=["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"];if("2.0"===t.protocol){switch(t.eventType){case"TranscodeStarted":0!==t.error&&(n=iz.START_FAILED);break;case"TranscodeStateChanged":n=0!==t.error?iz.START_FAILED:iz.START_SUCCESS;break;case"TranscodeStopped":n=0!==t.error?iz.STOP_FAILED:iz.STOP_SUCCESS;break;case"TranscodeUpdated":n=0!==t.error?iz.UPDATE_FAILED:iz.UPDATE_SUCCESS}this.safeEmit(ZB.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:n,message:i[r]})}this.safeEmit(ZB.POST_PROCESSING_MESSAGE,{code:r,message:i[r],type:e.type})}}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(ZB.ON_USER_TOKEN_WILL_EXPIRE,null)}},{key:"_onSceneConfig",value:function(e){var t=e.multiSceneConfig,r=Az[this._roomConfig.roomProfileType][1];if(t){var n,i,o=t[r];if(o&&o.engine_BAC)null===(n=this._context)||void 0===n||n.audioProfileManager.updateEngineBAC(o.engine_BAC);if(o&&o.engine_ANM)null===(i=this._context)||void 0===i||i.audioProfileManager.updateEngineANM(o.engine_ANM)}}},{key:"_onStreamFailed",value:(t=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("publish"!==t.type){e.next=11;break}if(u=void 0,(null===(r=this.localStream)||void 0===r?void 0:r.streamId)===t.streamId?u=this.localStream:(null===(n=this.localScreenStream)||void 0===n?void 0:n.streamId)===t.streamId&&(u=this.localScreenStream),u){e.next=5;break}return e.abrupt("return");case 5:return null===(i=u)||void 0===i||i.clean(),e.next=8,null===(a=this._mediaServerClient)||void 0===a?void 0:a.unpublish(u).catch((function(){}));case 8:null===(s=this._mediaServerClient)||void 0===s||s.publish(u).catch((function(){})),e.next=20;break;case 11:if("subscribe"!==t.type){e.next=20;break}if(c=this._remoteStreamStreamIdUserIdMap[t.streamId],!(d=this._findRemoteStream(c,t.streamId))){e.next=20;break}return e.next=17,null===(l=this._mediaServerClient)||void 0===l?void 0:l.unsubscribe(d,L.AUDIO_AND_VIDEO);case 17:return e.next=19,null===(h=this._mediaServerClient)||void 0===h?void 0:h.subscribe(d,d.subMediaType,d.subLayer);case 19:this.safeEmit(nz.RESUBSCRIBE,{stream:d});case 20:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_onStreamControlMessage",value:function(e){var t,r;e.type===QB.PushLimitWarn&&(null!==(t=this._localStream)&&void 0!==t&&t.pubAudio||null!==(r=this._localStream)&&void 0!==r&&r.pubVideo||this.unpublish())}},{key:"_onPublishOnDemand",value:function(e){var t,r,n,i,o;if(!1!==(null===(t=this._serverConfig)||void 0===t||null===(r=t.engine_VPM)||void 0===r||null===(n=r.ondemand)||void 0===n?void 0:n.enable)&&null!==(i=this._localStream)&&void 0!==i&&i.enableSimulcast&&null!==(o=this._localStream)&&void 0!==o&&o.videoTransceiver){var a,s,u=null===(a=this._localStream)||void 0===a?void 0:a.stream.id,c=null===(s=this._localStream)||void 0===s?void 0:s.videoTransceiver.sender,d=c.getParameters();if(Array.isArray(d.encodings)&&Array.isArray(e)){var l,h,f,p,_={};Wz.print("_onPublishOnDemand","usedDescriptions: %o",e),e.forEach((function(e){var t;if(null!=e&&null!==(t=e.StreamIds)&&void 0!==t&&t.includes(u)){var r=null==e?void 0:e.Metadata.SubvideoIndex;_[r]=r}}));var v={};null===(l=this._localStream)||void 0===l||null===(h=l.subVideoDescriptions)||void 0===h||h.forEach((function(e){void 0!==_[e.sub_index]&&(v[e.video_index]=e)}));var m=(null===(f=c.track)||void 0===f||null===(p=f.getSettings())||void 0===p?void 0:p.height)||720,y=[];d.encodings=d.encodings.map((function(e){return e.rid&&(v[e.rid]?(e.active=!0,e.scaleResolutionDownBy=Math.max(m/v[e.rid].height,1),y.push({type:1,rid:e.rid,downBy:e.scaleResolutionDownBy})):(y.push({type:0,rid:e.rid}),e.active=!1)),e})),yB.rtcInvokeStatus(JSON.stringify(y),0,"rscp",u,0)}c.setParameters(d)}}},{key:"_reportNetworkQuality",value:function(e,t){this._subFallbackManager.updateNetworkQuality(e,t),this.emit(nz.ON_NETWORK_QUALITY,e,t)}},{key:"_emitVideoSizeChange",value:function(e,t,r,n){var i;this.emit(nz.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(i=this.roomInfo)||void 0===i?void 0:i.roomId,userId:e,streamIndex:t?U.STREAM_INDEX_SCREEN:U.STREAM_INDEX_MAIN},{width:r,height:n})}},{key:"_emitSubscribeFallback",value:function(e){this.emit(nz.ON_SIMULCAST_SUBSCRIBE_FALLBACK,e)}}]),V}(DU),qz=function(){function e(){c(this,e),h(this,"_all_201_count",void 0),h(this,"_has_4xx",void 0),this._all_201_count=0,this._has_4xx=!1}return l(e,[{key:"shouldReconnect",get:function(){return!(this._all_201_count>=3||this._has_4xx)}},{key:"record",value:function(e){var t=!1,r=!1;if(Array.isArray(e)){var n=0;e.map((function(e){var t,i,o;400<=(null===(t=e.error)||void 0===t?void 0:t.code)&&(null===(i=e.error)||void 0===i?void 0:i.code)<500&&(r=!0),201===(null===(o=e.error)||void 0===o?void 0:o.code)&&n++})),n===e.length&&(t=!0),t&&this._all_201_count++,r&&(this._has_4xx=!0)}}},{key:"clear",value:function(){this._all_201_count=0,this._has_4xx=!1}}]),e}(),Yz=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=document.createElement(e);return t.id&&(r.id=t.id),t.classList&&t.classList.forEach((function(e){r.classList.add(e)})),t.style&&Object.assign(r.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=E(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r},Jz=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return t.id&&(e.id=t.id),t.classList&&t.classList.forEach((function(t){e.classList.add(t)})),t.style&&Object.assign(e.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(t){var r=E(t,2),n=r[0],i=r[1];e.setAttribute(n,i)})),e},Qz=new xU("Player",0),Zz=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],$z={playsinline:"","webkit-playsinline":""},eK={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},tK=new(function(){function e(){c(this,e),h(this,"videoCache",[]),h(this,"audioCache",[])}return l(e,[{key:"getOrCreate",value:function(e,t){var r="audio"===e?$z:eK;if("video"===e&&this.videoCache.length>0){var n=this.videoCache.pop();if(n)return Jz(n,{style:t,attributes:r}),n}else if("audio"===e&&this.audioCache.length>0){var i=this.audioCache.pop();if(i)return Jz(i,{style:t,attributes:r}),i}return Yz(e,{style:t,attributes:r})}},{key:"recycle",value:function(e){for(;e.attributes.length>0;)e.removeAttribute(e.attributes[0].name);e instanceof HTMLVideoElement?this.videoCache.push(e):this.audioCache.push(e)}}]),e}()),rK=function(e){f(n,e);var t,r=g(n);function n(e){var t;c(this,n),h(m(t=r.call(this)),"_containerDom",void 0),h(m(t),"_videoDom",void 0),h(m(t),"__cumulativeTime",void 0),h(m(t),"userId",void 0),h(m(t),"renderMode",void 0),h(m(t),"mirrorType",B.MIRROR_TYPE_NONE),h(m(t),"isScreen",void 0),h(m(t),"played",!1),h(m(t),"_emitPlayFailed",!1),h(m(t),"emitVideoEvent",(function(e){var r,n,i={type:"video",rawEvent:e,readyState:(null===(r=t._videoDom)||void 0===r?void 0:r.readyState)||0,userId:t.userId,eventName:e.type,currentTime:(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime)||0,isScreen:t.isScreen};t.emit("playback_event",i)})),h(m(t),"_internalPlay",(function(){var e;if(null!==(e=t._videoDom)&&void 0!==e&&e.paused){var r=t._videoDom.play();null!=r&&r.then&&r.catch((function(e){var r,n;t._emitPlayFailed||(t._emitPlayFailed=!0,yB.rtcError("video autoplay failed, userId: ".concat(t.userId),-1e3),t.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(r=t._videoDom)||void 0===r?void 0:r.readyState)||0,userId:t.userId,eventName:"autoplay-error",currentTime:(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime)||0}))}))}}));var i=e.renderDom,o=e.userId;t.renderMode=void 0!==e.renderMode?e.renderMode:M.RENDER_MODE_FIT;var a="string"==typeof i?document.getElementById(i):i;if(!a)throw new JN(qN.CANT_FIND_DOM,"can't find dom");return t._containerDom=a,t.userId=o,t.isScreen=!!e.isScreen,t._initVideo(),t}return l(n,[{key:"_initVideo",value:function(){this._videoDom||(this._videoDom=tK.getOrCreate("video",{width:"100%",height:"100%"}),this._videoDom.id="".concat(this.userId,"_").concat(uP()),this.renderMode===M.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===B.MIRROR_TYPE_RENDER)),this._containerDom.appendChild(this._videoDom),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._videoDom&&Zz.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))}},{key:"_removeListeners",value:function(){var e=this;this._videoDom&&(Zz.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)})),this._videoDom.addEventListener("canplay",this._internalPlay),this._videoDom.addEventListener("loadeddata",this._internalPlay))}},{key:"_recordFrame",value:function(e){var t=this;this.on("playback_event",(function(r){var n,i=e.isScreen?1.5:.5;if("timeupdate"===r.eventName){if(e.isScreen,0===(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime))return;if(void 0===t.__cumulativeTime)return void(t.__cumulativeTime=t._videoDom.currentTime);if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t._videoDom.currentTime>t.__cumulativeTime){var o=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),a=t._videoDom.currentTime-t.__cumulativeTime>i;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))}},{key:"playVideo",value:(t=u(o().mark((function e(t,r){var n,i,a,s,u=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=this._videoDom,Qz.print("playVideo","play video track: ".concat(this.userId)),!(a&&a.srcObject instanceof MediaStream&&a.srcObject.getTrackById(null===(n=t.getTrack())||void 0===n?void 0:n.id))){e.next=4;break}return e.abrupt("return");case 4:a||(this._initVideo(),a=this._videoDom),Qz.print("playVideo","play video by dom: ".concat(null===(i=a)||void 0===i?void 0:i.id)),(s=new MediaStream).addTrack(t.getTrack()),a.srcObject=s,a&&!this._containerDom.contains(a)&&this._containerDom.appendChild(a),a.addEventListener("canplay",this._internalPlay),a.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return u._internalPlay()})),r&&this._recordFrame(r),this.played=!0;case 15:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"updateSrcObject",value:function(e){var t=e.getTrack();if(t&&this._videoDom){var r=new MediaStream;r.addTrack(t),this._videoDom.srcObject=r}}},{key:"manuallyPlay",value:function(){if(Qz.print("Invoke VideoPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._videoDom)throw new JN(qN.INVALID_PARAMS,"Player not found");return this._videoDom.play()}},{key:"mirror",value:function(e){Qz.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?B.MIRROR_TYPE_RENDER:B.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")}},{key:"stop",value:function(){var e=this._containerDom;Qz.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,e&&e.contains(this._videoDom)&&e.removeChild(this._videoDom)),this.__cumulativeTime=void 0,this.played=!1}},{key:"destroy",value:function(){Qz.print("destroy","video player: ".concat(this.userId)),this.stop(),b(p(n.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._videoDom&&(tK.recycle(this._videoDom),delete this._videoDom)}},{key:"domElement",get:function(){return this._videoDom}}]),n}(AU.exports.EventEmitter),nK=function(e){f(i,e);var t,r,n=g(i);function i(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{divId:void 0,muted:!1},o=r.divId,a=r.muted;if(c(this,i),h(m(t=n.call(this)),"_containerDom",void 0),h(m(t),"_audioDom",void 0),h(m(t),"_fakeAudioDom",void 0),h(m(t),"userId",void 0),h(m(t),"muted",!1),h(m(t),"_emitPlayFailed",!1),h(m(t),"played",!1),h(m(t),"emitAudioEvent",(function(e){var r,n,i={type:"audio",rawEvent:e,readyState:(null===(r=t._audioDom)||void 0===r?void 0:r.readyState)||0,userId:t.userId,eventName:e.type,currentTime:(null===(n=t._audioDom)||void 0===n?void 0:n.currentTime)||0};t.emit("playback_event",i)})),h(m(t),"_internalPlay",(function(){var e,r;if(RB("_internalPlay",{paused:null===(e=t._audioDom)||void 0===e?void 0:e.paused}),null!==(r=t._audioDom)&&void 0!==r&&r.paused)try{var n=t._audioDom.play();null!=n&&n.then&&n.catch((function(e){t._autoPlayError(e)})).then((function(){RB("_internalPlay successfully",{userId:t.userId})}))}catch(i){t._autoPlayError(i)}})),o){var s=document.getElementById(o);if(!s)throw new JN(qN.CANT_FIND_DOM,"can't find dom");t._containerDom=s}else t._containerDom=document.body;return t.userId=e,t.muted=a,t._initAudio(),t}return l(i,[{key:"_initAudio",value:function(){this._audioDom||(this._audioDom=tK.getOrCreate("audio",{display:"none"}),this._audioDom.volume=this.muted?0:1,this._audioDom.id="".concat(this.userId,"_").concat(uP()),this._containerDom.appendChild(this._audioDom)),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._audioDom&&Zz.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.addEventListener(t,e.emitAudioEvent)}))}},{key:"_removeListeners",value:function(){var e=this;this._audioDom&&(Zz.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.removeEventListener(t,e.emitAudioEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))}},{key:"playAudio",value:(r=u(o().mark((function e(t){var r,n,i,a,s,u=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Qz.print("playAudio","play audio track: ".concat(this.userId)),!((a=this._audioDom)&&a.srcObject instanceof MediaStream&&a.srcObject.getTrackById(null===(r=t.getTrack())||void 0===r?void 0:r.id))){e.next=4;break}return e.abrupt("return");case 4:a||(this._initAudio(),a=this._audioDom),(s=new MediaStream).addTrack(t.getTrack()),a.srcObject=s,null===(n=a)||void 0===n||n.addEventListener("canplay",this._internalPlay),null===(i=a)||void 0===i||i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return u._internalPlay()})),this.played=!0;case 12:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_autoPlayError",value:function(e){var t,r;this._emitPlayFailed||(this._emitPlayFailed=!0,yB.rtcError("audio autoplay failed, userId: ".concat(this.userId,": ").concat(e.message),-1e3),this.emit("playback_event",{type:"audio",rawEvent:e,readyState:(null===(t=this._audioDom)||void 0===t?void 0:t.readyState)||0,userId:this.userId,eventName:"autoplay-error",currentTime:(null===(r=this._audioDom)||void 0===r?void 0:r.currentTime)||0}))}},{key:"manuallyPlay",value:function(){var e;if(Qz.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new JN(qN.INVALID_PARAMS,"Player not found");this._audioDom.volume=1,null===(e=this._fakeAudioDom)||void 0===e||e.play();var t=this._audioDom.play();return null!=t&&t.then?t:Promise.resolve(t)}},{key:"setPlaybackDevice",value:(t=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Qz.print("setPlaybackDevice","setPlaybackDevice: ".concat(t)),e.next=3,pH.enumerateAudioPlaybackDevices();case 3:if(e.sent.map((function(e){return e.deviceId})).includes(t)&&this._audioDom&&this._audioDom.setSinkId){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,this._audioDom.setSinkId(t);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"stop",value:function(){var e=this._containerDom;Qz.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom)),this._fakeAudioDom&&(this._fakeAudioDom.srcObject=null,this._fakeAudioDom=void 0)}},{key:"domElement",get:function(){return this._audioDom}},{key:"destroy",value:function(){Qz.print("destroy","audio player: ".concat(this.userId)),this.stop(),b(p(i.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._audioDom&&(tK.recycle(this._audioDom),delete this._audioDom)}}]),i}(AU.exports.EventEmitter),iK=function(){function e(){c(this,e),h(this,"_timer",void 0),h(this,"userMessage",void 0),h(this,"roomMessage",void 0),this.userMessage={},this.roomMessage={},this._setTimer()}return l(e,[{key:"_setTimer",value:function(){var e=this;!function t(){e._reportAndgReset(),clearTimeout(e._timer),e._timer=setTimeout(t,1e4)}()}},{key:"_reportAndgReset",value:function(){this._report(),this._reset()}},{key:"_report",value:function(){var e=this;yB.rtcMessageStatistics(Object.keys(this.userMessage).map((function(t){return e.userMessage[t]})),Object.keys(this.roomMessage).map((function(t){return e.roomMessage[t]})),"")}},{key:"_reset",value:function(){this.userMessage={},this.roomMessage={}}},{key:"_checkInitUserMessage",value:function(e,t){this.userMessage["".concat(t,"-").concat(e)]||(this.userMessage["".concat(t,"-").concat(e)]={dc_peer_user_id:e,dc_send_total:0,dc_recv_total:0,dc_send_ack:0,dc_send_fail:0,dc_cost_time:0,dc_cost_e2s:0,dc_cost_s2s:0,dc_least_time:1/0,dc_most_time:0,dc_cost_peer_s2e:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_message_type:t,dc_send_binary:0})}},{key:"_sendUserMessage",value:function(e,t,r){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_send_total++,r&&this.userMessage["".concat(t,"-").concat(e)].dc_send_binary++}},{key:"_recvUserMessage",value:function(e,t){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_recv_total++}},{key:"_sendUserFail",value:function(e,t){var r=this.userMessage["".concat(t,"-").concat(e)];r&&r.dc_send_fail++}},{key:"_sendUserAck",value:function(e,t,r,n,i){var o=this.userMessage["".concat(t,"-").concat(e)];o&&(o.dc_send_ack++,o.dc_cost_time+=r,o.dc_cost_s2s+=n||0,o.dc_cost_peer_s2e+=i,o.dc_cost_e2s+=r-(n||0)-i,r<=100?(o.dc_send_ack_100++,o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):r<=200?(o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):r<=400?(o.dc_send_ack_400++,o.dc_send_ack_1s++):r<=1e3&&o.dc_send_ack_1s++,r<o.dc_least_time&&(o.dc_least_time=r),r>o.dc_most_time&&(o.dc_most_time=r))}},{key:"sendRoomMessage",value:function(e,t){this.roomMessage[e]||(this.roomMessage[e]={dc_room_id:e,dc_send_total:0,dc_send_ack:0,dc_cost_time:0,dc_least_time:1/0,dc_most_time:0,dc_send_fail:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_send_binary:0}),this.roomMessage[e].dc_send_total++,t&&this.roomMessage[e].dc_send_binary++}},{key:"sendRoomFail",value:function(e){var t=this.roomMessage[e];t&&t.dc_send_fail++}},{key:"sendRoomAck",value:function(e,t){var r=this.roomMessage[e];r&&(r.dc_send_ack++,r.dc_cost_time+=t,t<r.dc_least_time&&(r.dc_least_time=t),t>r.dc_most_time&&(r.dc_most_time=t),t<=100?(r.dc_send_ack_100++,r.dc_send_ack_200++,r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=200?(r.dc_send_ack_200++,r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=400?(r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=1e3&&r.dc_send_ack_1s++)}},{key:"sendP2PMessage",value:function(e,t){this._sendUserMessage(e,fB.P2P,t)}},{key:"recvP2PMessage",value:function(e){this._recvUserMessage(e,fB.P2P)}},{key:"sendP2PFail",value:function(e){this._sendUserFail(e,fB.P2P)}},{key:"sendP2PAck",value:function(e,t,r,n){this._sendUserAck(e,fB.P2P,t,r,n)}},{key:"sendP2POutRoomMessage",value:function(e,t){this._sendUserMessage(e,fB.P2P_OUTSIDE_ROOM,t)}},{key:"recvP2POutRoomMessage",value:function(e){this._recvUserMessage(e,fB.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomFail",value:function(e){this._sendUserFail(e,fB.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomAck",value:function(e,t,r,n){this._sendUserAck(e,fB.P2P_OUTSIDE_ROOM,t,r,n)}},{key:"sendP2serverMessage",value:function(e){this._sendUserMessage("",fB.P2SERVER,e)}},{key:"sendP2serverFail",value:function(){this._sendUserFail("",fB.P2SERVER)}},{key:"sendP2serveAck",value:function(e){this._sendUserAck("",fB.P2SERVER,e,0,0)}},{key:"countP2PMessage",value:function(e,t,r,n,i){this.sendP2PMessage(t,r),e?this.sendP2PAck(t,Date.now()-n,i.s2s_time,i.s2e_time):this.sendP2PFail(t)}},{key:"countRoomMessage",value:function(e,t,r,n){this.sendRoomMessage(t,r),e?this.sendRoomAck(t,Date.now()-n):this.sendRoomFail(t)}},{key:"countUserMessageOutsideRoom",value:function(e,t,r,n,i){this.sendP2POutRoomMessage(t,r),e?this.sendP2POutRoomAck(t,Date.now()-n,i.s2s_time,i.s2e_time):this.sendP2POutRoomFail(t)}},{key:"countServerMessage",value:function(e,t,r){this.sendP2serverMessage(t),e?this.sendP2serveAck(Date.now()-r):this.sendP2serverFail()}},{key:"destroy",value:function(){this._reset(),clearTimeout(this._timer)}}]),e}(),oK="object"==typeof global&&global&&global.Object===Object&&global,aK="object"==typeof self&&self&&self.Object===Object&&self,sK=oK||aK||Function("return this")(),uK=sK.Symbol,cK=Object.prototype,dK=cK.hasOwnProperty,lK=cK.toString,hK=uK?uK.toStringTag:void 0;var fK=Object.prototype.toString;var pK=uK?uK.toStringTag:void 0;function _K(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":pK&&pK in Object(e)?function(e){var t=dK.call(e,hK),r=e[hK];try{e[hK]=void 0;var n=!0}catch(o){}var i=lK.call(e);return n&&(t?e[hK]=r:delete e[hK]),i}(e):function(e){return fK.call(e)}(e)}function vK(e){return null!=e&&"object"==typeof e}var mK=Array.isArray;function yK(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function gK(e){return e}function SK(e){if(!yK(e))return!1;var t=_K(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var bK=sK["__core-js_shared__"],EK=function(){var e=/[^.]+$/.exec(bK&&bK.keys&&bK.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var kK=Function.prototype.toString;var TK=/^\[object .+?Constructor\]$/,IK=Function.prototype,AK=Object.prototype,RK=IK.toString,wK=AK.hasOwnProperty,CK=RegExp("^"+RK.call(wK).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function OK(e){return!(!yK(e)||(t=e,EK&&EK in t))&&(SK(e)?CK:TK).test(function(e){if(null!=e){try{return kK.call(e)}catch(t){}try{return e+""}catch(t){}}return""}(e));var t}function xK(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var NK=Date.now;var DK,PK,MK,UK=function(){try{var e=function(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return OK(r)?r:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(t){}}(),LK=UK,VK=LK?function(e,t){return LK(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:gK,FK=(DK=VK,PK=0,MK=0,function(){var e=NK(),t=16-(e-MK);if(MK=e,t>0){if(++PK>=800)return arguments[0]}else PK=0;return DK.apply(void 0,arguments)}),BK=FK,jK=/^(?:0|[1-9]\d*)$/;function GK(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&jK.test(e))&&e>-1&&e%1==0&&e<t}function HK(e,t,r){"__proto__"==t&&LK?LK(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function zK(e,t){return e===t||e!=e&&t!=t}var KK=Object.prototype.hasOwnProperty;function WK(e,t,r){var n=e[t];KK.call(e,t)&&zK(n,r)&&(void 0!==r||t in e)||HK(e,t,r)}var XK=Math.max;function qK(e,t){return BK(function(e,t,r){return t=XK(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=XK(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),xK(e,this,s)}}(e,t,gK),e+"")}function YK(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function JK(e){return null!=e&&YK(e.length)&&!SK(e)}var QK=Object.prototype;function ZK(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||QK)}function $K(e){return vK(e)&&"[object Arguments]"==_K(e)}var eW=Object.prototype,tW=eW.hasOwnProperty,rW=eW.propertyIsEnumerable,nW=$K(function(){return arguments}())?$K:function(e){return vK(e)&&tW.call(e,"callee")&&!rW.call(e,"callee")},iW=nW;var oW="object"==typeof exports&&exports&&!exports.nodeType&&exports,aW=oW&&"object"==typeof module&&module&&!module.nodeType&&module,sW=aW&&aW.exports===oW?sK.Buffer:void 0,uW=(sW?sW.isBuffer:void 0)||function(){return!1},cW={};cW["[object Float32Array]"]=cW["[object Float64Array]"]=cW["[object Int8Array]"]=cW["[object Int16Array]"]=cW["[object Int32Array]"]=cW["[object Uint8Array]"]=cW["[object Uint8ClampedArray]"]=cW["[object Uint16Array]"]=cW["[object Uint32Array]"]=!0,cW["[object Arguments]"]=cW["[object Array]"]=cW["[object ArrayBuffer]"]=cW["[object Boolean]"]=cW["[object DataView]"]=cW["[object Date]"]=cW["[object Error]"]=cW["[object Function]"]=cW["[object Map]"]=cW["[object Number]"]=cW["[object Object]"]=cW["[object RegExp]"]=cW["[object Set]"]=cW["[object String]"]=cW["[object WeakMap]"]=!1;var dW="object"==typeof exports&&exports&&!exports.nodeType&&exports,lW=dW&&"object"==typeof module&&module&&!module.nodeType&&module,hW=lW&&lW.exports===dW&&oK.process,fW=function(){try{var e=lW&&lW.require&&lW.require("util").types;return e||hW&&hW.binding&&hW.binding("util")}catch(t){}}(),pW=fW&&fW.isTypedArray,_W=pW?function(e){return function(t){return e(t)}}(pW):function(e){return vK(e)&&YK(e.length)&&!!cW[_K(e)]},vW=_W,mW=Object.prototype.hasOwnProperty;function yW(e,t){var r=mK(e),n=!r&&iW(e),i=!r&&!n&&uW(e),o=!r&&!n&&!i&&vW(e),a=r||n||i||o,s=a?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],u=s.length;for(var c in e)!t&&!mW.call(e,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||GK(c,u))||s.push(c);return s}var gW=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),SW=gW,bW=Object.prototype.hasOwnProperty;function EW(e){return JK(e)?yW(e):function(e){if(!ZK(e))return SW(e);var t=[];for(var r in Object(e))bW.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var kW=Object.prototype.hasOwnProperty;function TW(e){if(!yK(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=ZK(e),r=[];for(var n in e)("constructor"!=n||!t&&kW.call(e,n))&&r.push(n);return r}var IW,AW=(IW=function(e,t){!function(e,t,r,n){var i=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],u=n?n(r[s],e[s],s,r,e):void 0;void 0===u&&(u=e[s]),i?HK(r,s,u):WK(r,s,u)}}(t,function(e){return JK(e)?yW(e,!0):TW(e)}(t),e)},qK((function(e,t){var r=-1,n=t.length,i=n>1?t[n-1]:void 0,o=n>2?t[2]:void 0;for(i=IW.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!yK(r))return!1;var n=typeof t;return!!("number"==n?JK(r)&&GK(t,r.length):"string"==n&&t in r)&&zK(r[t],e)}(t[0],t[1],o)&&(i=n<3?void 0:i,n=1),e=Object(e);++r<n;){var a=t[r];a&&IW(e,a,r,i)}return e}))),RW=AW;function wW(e,t){return function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(t,(function(t){return e[t]}))}function CW(e){return null==e?[]:wW(e,EW(e))}var OW=me,xW=_t("iterator"),NW=!OW((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})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[xW]||"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})),DW=ke,PW=2147483647,MW=/[^\0-\u007E]/,UW=/[.\u3002\uFF0E\uFF61]/g,LW="Overflow: input needs wider integers to process",VW=RangeError,FW=DW(UW.exec),BW=Math.floor,jW=String.fromCharCode,GW=DW("".charCodeAt),HW=DW([].join),zW=DW([].push),KW=DW("".replace),WW=DW("".split),XW=DW("".toLowerCase),qW=function(e){return e+22+75*(e<26)},YW=function(e,t,r){var n=0;for(e=r?BW(e/700):e>>1,e+=BW(e/t);e>455;)e=BW(e/35),n+=36;return BW(n+36*e/(e+38))},JW=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=GW(e,r++);if(i>=55296&&i<=56319&&r<n){var o=GW(e,r++);56320==(64512&o)?zW(t,((1023&i)<<10)+(1023&o)+65536):(zW(t,i),r--)}else zW(t,i)}return t}(e);var r,n,i=e.length,o=128,a=0,s=72;for(r=0;r<e.length;r++)(n=e[r])<128&&zW(t,jW(n));var u=t.length,c=u;for(u&&zW(t,"-");c<i;){var d=PW;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=c+1;if(d-o>BW((PW-a)/l))throw VW(LW);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>PW)throw VW(LW);if(n==o){for(var h=a,f=36;;){var p=f<=s?1:f>=s+26?26:f-s;if(h<p)break;var _=h-p,v=36-p;zW(t,jW(qW(p+_%v))),h=BW(_/v),f+=36}zW(t,jW(qW(h))),s=YW(a,l,c==u),a=0,c++}}a++,o++}return HW(t,"")},QW=la,ZW=ae,$W=Ut,eX=ke,tX=gt,rX=NW,nX=Rn,iX=mh,oX=Ac,aX=Dc,sX=dn,uX=zl,cX=Ge,dX=De,lX=Qn,hX=Vn,fX=Dt,pX=Et,_X=$a,vX=Ma,mX=jr,yX=kl,gX=vl,SX=fv,bX=OI,EX=_t("iterator"),kX="URLSearchParams",TX="URLSearchParamsIterator",IX=sX.set,AX=sX.getterFor(kX),RX=sX.getterFor(TX),wX=Object.getOwnPropertyDescriptor,CX=function(e){if(!tX)return ZW[e];var t=wX(ZW,e);return t&&t.value},OX=CX("fetch"),xX=CX("Request"),NX=CX("Headers"),DX=xX&&xX.prototype,PX=NX&&NX.prototype,MX=ZW.RegExp,UX=ZW.TypeError,LX=ZW.decodeURIComponent,VX=ZW.encodeURIComponent,FX=eX("".charAt),BX=eX([].join),jX=eX([].push),GX=eX("".replace),HX=eX([].shift),zX=eX([].splice),KX=eX("".split),WX=eX("".slice),XX=/\+/g,qX=Array(4),YX=function(e){return qX[e-1]||(qX[e-1]=MX("((?:%[\\da-f]{2}){"+e+"})","gi"))},JX=function(e){try{return LX(e)}catch(RJ){return e}},QX=function(e){var t=GX(e,XX," "),r=4;try{return LX(t)}catch(RJ){for(;r;)t=GX(t,YX(r--),JX);return t}},ZX=/[!'()~]|%20/g,$X={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},eq=function(e){return $X[e]},tq=function(e){return GX(VX(e),ZX,eq)},rq=aX((function(e,t){IX(this,{type:TX,iterator:yX(AX(e).entries),kind:t})}),"Iterator",(function(){var e=RX(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),nq=function(e){this.entries=[],this.url=null,void 0!==e&&(pX(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===FX(e,0)?WX(e,1):e:_X(e)))};nq.prototype={type:kX,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,u=gX(e);if(u)for(r=(t=yX(e,u)).next;!(n=$W(r,t)).done;){if(o=(i=yX(fX(n.value))).next,(a=$W(o,i)).done||(s=$W(o,i)).done||!$W(o,i).done)throw UX("Expected sequence with length 2");jX(this.entries,{key:_X(a.value),value:_X(s.value)})}else for(var c in e)dX(e,c)&&jX(this.entries,{key:c,value:_X(e[c])})},parseQuery:function(e){if(e)for(var t,r,n=KX(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=KX(t,"="),jX(this.entries,{key:QX(HX(r)),value:QX(BX(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],jX(r,tq(e.key)+"="+tq(e.value));return BX(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var iq=function(){uX(this,oq);var e=arguments.length>0?arguments[0]:void 0;IX(this,new nq(e))},oq=iq.prototype;if(iX(oq,{append:function(e,t){SX(arguments.length,2);var r=AX(this);jX(r.entries,{key:_X(e),value:_X(t)}),r.updateURL()},delete:function(e){SX(arguments.length,1);for(var t=AX(this),r=t.entries,n=_X(e),i=0;i<r.length;)r[i].key===n?zX(r,i,1):i++;t.updateURL()},get:function(e){SX(arguments.length,1);for(var t=AX(this).entries,r=_X(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){SX(arguments.length,1);for(var t=AX(this).entries,r=_X(e),n=[],i=0;i<t.length;i++)t[i].key===r&&jX(n,t[i].value);return n},has:function(e){SX(arguments.length,1);for(var t=AX(this).entries,r=_X(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){SX(arguments.length,1);for(var r,n=AX(this),i=n.entries,o=!1,a=_X(e),s=_X(t),u=0;u<i.length;u++)(r=i[u]).key===a&&(o?zX(i,u--,1):(o=!0,r.value=s));o||jX(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=AX(this);bX(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=AX(this).entries,n=lX(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 rq(this,"keys")},values:function(){return new rq(this,"values")},entries:function(){return new rq(this,"entries")}},{enumerable:!0}),nX(oq,EX,oq.entries,{name:"entries"}),nX(oq,"toString",(function(){return AX(this).serialize()}),{enumerable:!0}),oX(iq,kX),QW({global:!0,constructor:!0,forced:!rX},{URLSearchParams:iq}),!rX&&cX(NX)){var aq=eX(PX.has),sq=eX(PX.set),uq=function(e){if(pX(e)){var t,r=e.body;if(hX(r)===kX)return t=e.headers?new NX(e.headers):new NX,aq(t,"content-type")||sq(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),vX(e,{body:mX(0,_X(r)),headers:mX(0,t)})}return e};if(cX(OX)&&QW({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return OX(e,arguments.length>1?uq(arguments[1]):{})}}),cX(xX)){var cq=function(e){return uX(this,DX),new xX(e,arguments.length>1?uq(arguments[1]):{})};DX.constructor=cq,cq.prototype=DX,QW({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:cq})}}var dq,lq=la,hq=gt,fq=NW,pq=ae,_q=Qn,vq=ke,mq=Rn,yq=fg,gq=zl,Sq=De,bq=yp,Eq=MD,kq=Nd,Tq=Eu.codeAt,Iq=function(e){var t,r,n=[],i=WW(KW(XW(e),UW,"."),".");for(t=0;t<i.length;t++)r=i[t],zW(n,FW(MW,r)?"xn--"+JW(r):r);return HW(n,".")},Aq=$a,Rq=Ac,wq=fv,Cq={URLSearchParams:iq,getState:AX},Oq=dn,xq=Oq.set,Nq=Oq.getterFor("URL"),Dq=Cq.URLSearchParams,Pq=Cq.getState,Mq=pq.URL,Uq=pq.TypeError,Lq=pq.parseInt,Vq=Math.floor,Fq=Math.pow,Bq=vq("".charAt),jq=vq(/./.exec),Gq=vq([].join),Hq=vq(1..toString),zq=vq([].pop),Kq=vq([].push),Wq=vq("".replace),Xq=vq([].shift),qq=vq("".split),Yq=vq("".slice),Jq=vq("".toLowerCase),Qq=vq([].unshift),Zq="Invalid scheme",$q="Invalid host",eY="Invalid port",tY=/[a-z]/i,rY=/[\d+-.a-z]/i,nY=/\d/,iY=/^0x/i,oY=/^[0-7]+$/,aY=/^\d+$/,sY=/^[\da-f]+$/i,uY=/[\0\t\n\r #%/:<>?@[\\\]^|]/,cY=/[\0\t\n\r #/:<>?@[\\\]^|]/,dY=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,lY=/[\t\n\r]/g,hY=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)Qq(t,e%256),e=Vq(e/256);return Gq(t,".")}if("object"==typeof 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+=Hq(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},fY={},pY=bq({},fY,{" ":1,'"':1,"<":1,">":1,"`":1}),_Y=bq({},pY,{"#":1,"?":1,"{":1,"}":1}),vY=bq({},_Y,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),mY=function(e,t){var r=Tq(e,0);return r>32&&r<127&&!Sq(t,e)?e:encodeURIComponent(e)},yY={ftp:21,file:null,http:80,https:443,ws:80,wss:443},gY=function(e,t){var r;return 2==e.length&&jq(tY,Bq(e,0))&&(":"==(r=Bq(e,1))||!t&&"|"==r)},SY=function(e){var t;return e.length>1&&gY(Yq(e,0,2))&&(2==e.length||"/"===(t=Bq(e,2))||"\\"===t||"?"===t||"#"===t)},bY=function(e){return"."===e||"%2e"===Jq(e)},EY={},kY={},TY={},IY={},AY={},RY={},wY={},CY={},OY={},xY={},NY={},DY={},PY={},MY={},UY={},LY={},VY={},FY={},BY={},jY={},GY={},HY=function(e,t,r){var n,i,o,a=Aq(e);if(t){if(i=this.parse(a))throw Uq(i);this.searchParams=null}else{if(void 0!==r&&(n=new HY(r,!0)),i=this.parse(a,null,n))throw Uq(i);(o=Pq(new Dq)).bindURL(this),this.searchParams=o}};HY.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,u=this,c=t||EY,d=0,l="",h=!1,f=!1,p=!1;for(e=Aq(e),t||(u.scheme="",u.username="",u.password="",u.host=null,u.port=null,u.path=[],u.query=null,u.fragment=null,u.cannotBeABaseURL=!1,e=Wq(e,dY,"")),e=Wq(e,lY,""),n=Eq(e);d<=n.length;){switch(i=n[d],c){case EY:if(!i||!jq(tY,i)){if(t)return Zq;c=TY;continue}l+=Jq(i),c=kY;break;case kY:if(i&&(jq(rY,i)||"+"==i||"-"==i||"."==i))l+=Jq(i);else{if(":"!=i){if(t)return Zq;l="",c=TY,d=0;continue}if(t&&(u.isSpecial()!=Sq(yY,l)||"file"==l&&(u.includesCredentials()||null!==u.port)||"file"==u.scheme&&!u.host))return;if(u.scheme=l,t)return void(u.isSpecial()&&yY[u.scheme]==u.port&&(u.port=null));l="","file"==u.scheme?c=MY:u.isSpecial()&&r&&r.scheme==u.scheme?c=IY:u.isSpecial()?c=CY:"/"==n[d+1]?(c=AY,d++):(u.cannotBeABaseURL=!0,Kq(u.path,""),c=BY)}break;case TY:if(!r||r.cannotBeABaseURL&&"#"!=i)return Zq;if(r.cannotBeABaseURL&&"#"==i){u.scheme=r.scheme,u.path=kq(r.path),u.query=r.query,u.fragment="",u.cannotBeABaseURL=!0,c=GY;break}c="file"==r.scheme?MY:RY;continue;case IY:if("/"!=i||"/"!=n[d+1]){c=RY;continue}c=OY,d++;break;case AY:if("/"==i){c=xY;break}c=FY;continue;case RY:if(u.scheme=r.scheme,i==dq)u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=kq(r.path),u.query=r.query;else if("/"==i||"\\"==i&&u.isSpecial())c=wY;else if("?"==i)u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=kq(r.path),u.query="",c=jY;else{if("#"!=i){u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=kq(r.path),u.path.length--,c=FY;continue}u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,u.path=kq(r.path),u.query=r.query,u.fragment="",c=GY}break;case wY:if(!u.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){u.username=r.username,u.password=r.password,u.host=r.host,u.port=r.port,c=FY;continue}c=xY}else c=OY;break;case CY:if(c=OY,"/"!=i||"/"!=Bq(l,d+1))continue;d++;break;case OY:if("/"!=i&&"\\"!=i){c=xY;continue}break;case xY:if("@"==i){h&&(l="%40"+l),h=!0,o=Eq(l);for(var _=0;_<o.length;_++){var v=o[_];if(":"!=v||p){var m=mY(v,vY);p?u.password+=m:u.username+=m}else p=!0}l=""}else if(i==dq||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()){if(h&&""==l)return"Invalid authority";d-=Eq(l).length+1,l="",c=NY}else l+=i;break;case NY:case DY:if(t&&"file"==u.scheme){c=LY;continue}if(":"!=i||f){if(i==dq||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()){if(u.isSpecial()&&""==l)return $q;if(t&&""==l&&(u.includesCredentials()||null!==u.port))return;if(a=u.parseHost(l))return a;if(l="",c=VY,t)return;continue}"["==i?f=!0:"]"==i&&(f=!1),l+=i}else{if(""==l)return $q;if(a=u.parseHost(l))return a;if(l="",c=PY,t==DY)return}break;case PY:if(!jq(nY,i)){if(i==dq||"/"==i||"?"==i||"#"==i||"\\"==i&&u.isSpecial()||t){if(""!=l){var y=Lq(l,10);if(y>65535)return eY;u.port=u.isSpecial()&&y===yY[u.scheme]?null:y,l=""}if(t)return;c=VY;continue}return eY}l+=i;break;case MY:if(u.scheme="file","/"==i||"\\"==i)c=UY;else{if(!r||"file"!=r.scheme){c=FY;continue}if(i==dq)u.host=r.host,u.path=kq(r.path),u.query=r.query;else if("?"==i)u.host=r.host,u.path=kq(r.path),u.query="",c=jY;else{if("#"!=i){SY(Gq(kq(n,d),""))||(u.host=r.host,u.path=kq(r.path),u.shortenPath()),c=FY;continue}u.host=r.host,u.path=kq(r.path),u.query=r.query,u.fragment="",c=GY}}break;case UY:if("/"==i||"\\"==i){c=LY;break}r&&"file"==r.scheme&&!SY(Gq(kq(n,d),""))&&(gY(r.path[0],!0)?Kq(u.path,r.path[0]):u.host=r.host),c=FY;continue;case LY:if(i==dq||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&gY(l))c=FY;else if(""==l){if(u.host="",t)return;c=VY}else{if(a=u.parseHost(l))return a;if("localhost"==u.host&&(u.host=""),t)return;l="",c=VY}continue}l+=i;break;case VY:if(u.isSpecial()){if(c=FY,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=dq&&(c=FY,"/"!=i))continue}else u.fragment="",c=GY;else u.query="",c=jY;break;case FY:if(i==dq||"/"==i||"\\"==i&&u.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=Jq(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(u.shortenPath(),"/"==i||"\\"==i&&u.isSpecial()||Kq(u.path,"")):bY(l)?"/"==i||"\\"==i&&u.isSpecial()||Kq(u.path,""):("file"==u.scheme&&!u.path.length&&gY(l)&&(u.host&&(u.host=""),l=Bq(l,0)+":"),Kq(u.path,l)),l="","file"==u.scheme&&(i==dq||"?"==i||"#"==i))for(;u.path.length>1&&""===u.path[0];)Xq(u.path);"?"==i?(u.query="",c=jY):"#"==i&&(u.fragment="",c=GY)}else l+=mY(i,_Y);break;case BY:"?"==i?(u.query="",c=jY):"#"==i?(u.fragment="",c=GY):i!=dq&&(u.path[0]+=mY(i,fY));break;case jY:t||"#"!=i?i!=dq&&("'"==i&&u.isSpecial()?u.query+="%27":u.query+="#"==i?"%23":mY(i,fY)):(u.fragment="",c=GY);break;case GY:i!=dq&&(u.fragment+=mY(i,pY))}d++}},parseHost:function(e){var t,r,n;if("["==Bq(e,0)){if("]"!=Bq(e,e.length-1))return $q;if(t=function(e){var t,r,n,i,o,a,s,u=[0,0,0,0,0,0,0,0],c=0,d=null,l=0,h=function(){return Bq(e,l)};if(":"==h()){if(":"!=Bq(e,1))return;l+=2,d=++c}for(;h();){if(8==c)return;if(":"!=h()){for(t=r=0;r<4&&jq(sY,h());)t=16*t+Lq(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,c>6)return;for(n=0;h();){if(i=null,n>0){if(!("."==h()&&n<4))return;l++}if(!jq(nY,h()))return;for(;jq(nY,h());){if(o=Lq(h(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;l++}u[c]=256*u[c]+i,2!=++n&&4!=n||c++}if(4!=n)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;u[c++]=t}else{if(null!==d)return;l++,d=++c}}if(null!==d)for(a=c-d,c=7;0!=c&&a>0;)s=u[c],u[c--]=u[d+a-1],u[d+--a]=s;else if(8!=c)return;return u}(Yq(e,1,-1)),!t)return $q;this.host=t}else if(this.isSpecial()){if(e=Iq(e),jq(uY,e))return $q;if(t=function(e){var t,r,n,i,o,a,s,u=qq(e,".");if(u.length&&""==u[u.length-1]&&u.length--,(t=u.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=u[n]))return e;if(o=10,i.length>1&&"0"==Bq(i,0)&&(o=jq(iY,i)?16:8,i=Yq(i,8==o?1:2)),""===i)a=0;else{if(!jq(10==o?aY:8==o?oY:sY,i))return e;a=Lq(i,o)}Kq(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=Fq(256,5-t))return null}else if(a>255)return null;for(s=zq(r),n=0;n<r.length;n++)s+=r[n]*Fq(256,3-n);return s}(e),null===t)return $q;this.host=t}else{if(jq(cY,e))return $q;for(t="",r=Eq(e),n=0;n<r.length;n++)t+=mY(r[n],fY);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return Sq(yY,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&gY(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,u=e.fragment,c=t+":";return null!==i?(c+="//",e.includesCredentials()&&(c+=r+(n?":"+n:"")+"@"),c+=hY(i),null!==o&&(c+=":"+o)):"file"==t&&(c+="//"),c+=e.cannotBeABaseURL?a[0]:a.length?"/"+Gq(a,"/"):"",null!==s&&(c+="?"+s),null!==u&&(c+="#"+u),c},setHref:function(e){var t=this.parse(e);if(t)throw Uq(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new zY(e.path[0]).origin}catch(RJ){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+hY(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(Aq(e)+":",EY)},getUsername:function(){return this.username},setUsername:function(e){var t=Eq(Aq(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=mY(t[r],vY)}},getPassword:function(){return this.password},setPassword:function(e){var t=Eq(Aq(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=mY(t[r],vY)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?hY(e):hY(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,NY)},getHostname:function(){var e=this.host;return null===e?"":hY(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,DY)},getPort:function(){var e=this.port;return null===e?"":Aq(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=Aq(e))?this.port=null:this.parse(e,PY))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+Gq(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,VY))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=Aq(e))?this.query=null:("?"==Bq(e,0)&&(e=Yq(e,1)),this.query="",this.parse(e,jY)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=Aq(e))?("#"==Bq(e,0)&&(e=Yq(e,1)),this.fragment="",this.parse(e,GY)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var zY=function(e){var t=gq(this,KY),r=wq(arguments.length,1)>1?arguments[1]:void 0,n=xq(t,new HY(e,!1,r));hq||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},KY=zY.prototype,WY=function(e,t){return{get:function(){return Nq(this)[e]()},set:t&&function(e){return Nq(this)[t](e)},configurable:!0,enumerable:!0}};if(hq&&(yq(KY,"href",WY("serialize","setHref")),yq(KY,"origin",WY("getOrigin")),yq(KY,"protocol",WY("getProtocol","setProtocol")),yq(KY,"username",WY("getUsername","setUsername")),yq(KY,"password",WY("getPassword","setPassword")),yq(KY,"host",WY("getHost","setHost")),yq(KY,"hostname",WY("getHostname","setHostname")),yq(KY,"port",WY("getPort","setPort")),yq(KY,"pathname",WY("getPathname","setPathname")),yq(KY,"search",WY("getSearch","setSearch")),yq(KY,"searchParams",WY("getSearchParams")),yq(KY,"hash",WY("getHash","setHash"))),mq(KY,"toJSON",(function(){return Nq(this).serialize()}),{enumerable:!0}),mq(KY,"toString",(function(){return Nq(this).serialize()}),{enumerable:!0}),Mq){var XY=Mq.createObjectURL,qY=Mq.revokeObjectURL;XY&&mq(zY,"createObjectURL",_q(XY,Mq)),qY&&mq(zY,"revokeObjectURL",_q(qY,Mq))}Rq(zY,"URL"),lq({global:!0,constructor:!0,forced:!fq,sham:!hq},{URL:zY});var YY=function(){var e=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Audio(URL.createObjectURL(new Blob([t],r))),e.prev=1,n.muted=!0,e.next=5,n.play();case 5:return n.pause(),e.abrupt("return",!0);case 9:return e.prev=9,e.t0=e.catch(1),e.abrupt("return",!1);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t,r){return e.apply(this,arguments)}}(),JY=Object.defineProperty,QY=Object.getOwnPropertyDescriptor,ZY=function(e,t,r,n){for(var i,o=n>1?void 0:n?QY(t,r):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&JY(t,r,o),o},$Y=function(){function e(t){c(this,e),h(this,"_sharedAudioContext",new AudioContext),h(this,"_audioDestination",this._sharedAudioContext.createMediaStreamDestination()),h(this,"_localGainNode",this._sharedAudioContext.createGain()),h(this,"_bufferGainNode",this._sharedAudioContext.createGain()),h(this,"_audioBufferSource",void 0),h(this,"_localSource",void 0),h(this,"_context",void 0),h(this,"_failedAudioList",[]),h(this,"mixingMap",new Map),h(this,"resourcesCache",new Map),h(this,"volumeConfig",new Map),h(this,"cachedBuffer",[]),this._context=t,this._localGainNode.gain.value=1}var t,r,n;return l(e,[{key:"mixMediaStream",value:function(e){this._localSource&&this._localSource.disconnect(this._localGainNode),this._localSource=this._sharedAudioContext.createMediaStreamSource(e),this._localSource.connect(this._localGainNode).connect(this._audioDestination)}},{key:"startAudioMixing",value:(n=u(o().mark((function e(t,r,n){var i,a,s,u,c,d,l,h,f,p,_,v,m,y=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=n.playCount,NP(a=n.type,"mixingType",CW(ee)),s=this._context.getLocalAudioTrack()){e.next=5;break}return e.abrupt("return");case 5:if(s.gainAudioTrack?(u=new MediaStream).addTrack(s.gainAudioTrack):u=bH(s.getTrack()),u&&this.mixMediaStream(u),(c=this.mixingMap.get(t))&&c.audioNode){c.audioNode.pause(),this._context.emitMessage({mixId:t,state:te.AUDIO_MIXING_STATE_STOPPED,error:YN.AUDIO_MIXING_ERROR_OK});try{c.gainNode.disconnect(this._audioDestination),c.audioSource.disconnect(c.gainNode)}catch(o){}}if(!(l=this.resourcesCache.get(t))||l.filePath!==r){e.next=14;break}d=l.getAudioNode(),e.next=28;break;case 14:return e.next=16,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw y._context.emitMessage({mixId:t,state:te.AUDIO_MIXING_STATE_FAILED,error:YN.AUDIO_MIXING_ERROR_START_FAILED}),new JN(qN.LOAD_RESOURCES_FAILED,e.statusText)}));case 16:return h=e.sent,r.endsWith("mp3")?f={type:"audio/mpeg"}:r.endsWith("aac")&&(f={type:"audio/aac"}),e.next=20,YY(h,f);case 20:if(e.sent){e.next=25;break}throw this._context.emitMessage({mixId:t,state:te.AUDIO_MIXING_STATE_FAILED,error:YN.AUDIO_MIXING_ERROR_START_FAILED}),new JN(qN.LOAD_RESOURCES_FAILED,"invalid audio resource");case 25:(d=new Audio).crossOrigin="anonymous",d.src=URL.createObjectURL(new Blob([h],f));case 28:return i<=0?d.loop=!0:i>0&&(p=i,d.onended=function(){--p>0?d.play():(y.mixingMap.delete(t),y._context.emitMessage({mixId:t,state:te.AUDIO_MIXING_STATE_FINISHED,error:YN.AUDIO_MIXING_ERROR_OK}))}),e.prev=29,e.next=32,d.play();case 32:e.next=39;break;case 34:e.prev=34,e.t0=e.catch(29),console.error(e.t0),this._failedAudioList.push(d),this._context.onAutoPlayFailed();case 39:if(_=this._sharedAudioContext.createMediaElementSource(d),v=this._sharedAudioContext.createGain(),m=this.volumeConfig.get(t),v.gain.value=m?m/100:1,_.connect(v).connect(this._audioDestination),this.mixingMap.set(t,{audioSource:_,audioNode:d,gainNode:v,type:"file"}),a===ee.PUBLISH)try{v.disconnect(this._sharedAudioContext.destination)}catch(o){}else v.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],n.type),this._context.emitMessage({mixId:t,state:te.AUDIO_MIXING_STATE_PLAYING,error:YN.AUDIO_MIXING_ERROR_OK});case 48:case"end":return e.stop()}}),e,this,[[29,34]])}))),function(e,t,r){return n.apply(this,arguments)})},{key:"stopAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&"file"===t.type&&(this.mixingMap.delete(e),t.audioNode.pause(),t.audioSource.disconnect(t.gainNode),t.gainNode.disconnect(this._audioDestination),this._context.emitMessage({mixId:e,state:te.AUDIO_MIXING_STATE_STOPPED,error:YN.AUDIO_MIXING_ERROR_OK}))}},{key:"pauseAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:te.AUDIO_MIXING_STATE_PAUSED,error:YN.AUDIO_MIXING_ERROR_OK}),t.audioNode.pause())}},{key:"resumeAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:te.AUDIO_MIXING_STATE_PLAYING,error:YN.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())}},{key:"preloadAudioMixing",value:(r=u(o().mark((function e(t,r){var n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.stopAudioMixing(t),e.next=3,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw i._context.emitMessage({mixId:t,state:te.AUDIO_MIXING_STATE_FAILED,error:YN.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new JN(qN.LOAD_RESOURCES_FAILED,e.statusText)})).catch((function(e){throw i._context.emitMessage({mixId:t,state:te.AUDIO_MIXING_STATE_FAILED,error:YN.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new JN(qN.LOAD_RESOURCES_FAILED,"Load resources failed",e)}));case 3:return n=e.sent,e.next=6,YY(n);case 6:if(e.sent){e.next=10;break}throw this._context.emitMessage({mixId:t,state:te.AUDIO_MIXING_STATE_FAILED,error:YN.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new JN(qN.LOAD_RESOURCES_FAILED,"Load resources failed");case 10:this._context.emitMessage({mixId:t,state:te.AUDIO_MIXING_STATE_PRELOADED,error:YN.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(t,{getAudioNode:function(){return new Audio(URL.createObjectURL(new Blob([n])))},filePath:r});case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"unloadAudioMixing",value:function(e){this.resourcesCache.has(e)&&this.resourcesCache.delete(e)}},{key:"getAudioMixingVolume",value:function(e){var t=this.mixingMap.get(e);return t?100*t.gainNode.gain.value:0}},{key:"setAudioMixingVolume",value:function(e,t){t<0?t=0:t>400&&(t=400),this.volumeConfig.set(e,t);var r=this.mixingMap.get(e);r&&(r.gainNode.gain.value=Number(t)/100)}},{key:"getAudioMixingDuration",value:function(e){var t=this.mixingMap.get(e),r=this.mixingMap.get(e);return t||r?t?1e3*t.audioNode.duration:r?1e3*r.audioNode.duration:0:0}},{key:"getAudioMixingCurrentPosition",value:function(e){var t=this.mixingMap.get(e);return t?1e3*t.audioNode.currentTime:0}},{key:"setAudioMixingPosition",value:function(e,t){var r=this.mixingMap.get(e);r&&(r.audioNode.currentTime=t/1e3,r.audioNode.play())}},{key:"enableAudioMixingBuffer",value:function(e){NP(e,"type",CW(ee));var t=this._context.getLocalAudioTrack();if(t){var r=bH(t.getTrack());if(r&&this.mixMediaStream(r),e===ee.PUBLISH)try{this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(n){}else this._bufferGainNode.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],e),this._bufferGainNode.connect(this._audioDestination),this._context.emitMessage({mixId:-1,state:te.AUDIO_MIXING_STATE_PCM_ENABLED,error:YN.AUDIO_MIXING_ERROR_OK})}}},{key:"disableAudioMixingBuffer",value:function(){if(this.cachedBuffer=[],this._audioBufferSource){try{this._audioBufferSource.disconnect(this._bufferGainNode),this._bufferGainNode.disconnect(this._audioDestination),this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}finally{this._audioBufferSource=void 0}this._context.updateLocalAudioTrack(),this._context.emitMessage({mixId:-1,state:te.AUDIO_MIXING_STATE_PCM_DISABLED,error:YN.AUDIO_MIXING_ERROR_OK})}}},{key:"pushAudioMixingBuffer",value:function(e){var t=this;if(!(this._audioBufferSource&&(this.cachedBuffer.push(e),this.cachedBuffer.length>0))){this._audioBufferSource=this._sharedAudioContext.createBufferSource(),this._audioBufferSource.buffer=e,this._audioBufferSource.connect(this._bufferGainNode);try{this._audioBufferSource.start()}catch(r){this._failedAudioList.push(this._audioBufferSource)}this._audioBufferSource.onended=function(){var e;if(null===(e=t._audioBufferSource)||void 0===e||e.disconnect(t._bufferGainNode),t._audioBufferSource=void 0,t.cachedBuffer.length){var r=t.cachedBuffer.shift();r&&t.pushAudioMixingBuffer(r)}}}}},{key:"stopAll",value:function(){var e=this;if(this._localSource)try{this._localSource.disconnect(this._localGainNode),delete this._localSource}catch(t){}this.mixingMap.forEach((function(t,r){e.stopAudioMixing(r)}))}},{key:"mixTrack",get:function(){return this._audioDestination.stream.getAudioTracks()[0]}},{key:"sharedAudioContext",get:function(){return this._sharedAudioContext}},{key:"resumeLocalPlay",value:(t=u(o().mark((function e(){var t,r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],r=A(this._failedAudioList),e.prev=2,r.s();case 4:if((n=r.n()).done){e.next=24;break}if(i=n.value,e.prev=6,!(i instanceof HTMLAudioElement)){e.next=13;break}return i.muted=!1,e.next=11,i.play();case 11:e.next=14;break;case 13:i.start();case 14:e.next=22;break;case 16:return e.prev=16,e.t0=e.catch(6),t.push(i),console.error(e.t0),this._context.onAutoPlayFailed(),e.abrupt("break",24);case 22:e.next=4;break;case 24:e.next=29;break;case 26:e.prev=26,e.t1=e.catch(2),r.e(e.t1);case 29:return e.prev=29,r.f(),e.finish(29);case 32:this._failedAudioList=t;case 33:case"end":return e.stop()}}),e,this,[[2,26,29,32],[6,16]])}))),function(){return t.apply(this,arguments)})},{key:"destroy",value:function(){var e=this._sharedAudioContext;"closed"!==e.state&&"function"==typeof e.close&&e.close(),this.cachedBuffer=[],this.mixingMap.clear(),this.resourcesCache.clear(),this.volumeConfig.clear()}}]),e}();ZY([IB("default","id","filePath","options")],$Y.prototype,"startAudioMixing",1),ZY([IB("default","id")],$Y.prototype,"stopAudioMixing",1),ZY([IB("default","id")],$Y.prototype,"pauseAudioMixing",1),ZY([IB("default","id")],$Y.prototype,"resumeAudioMixing",1),ZY([IB("default","id")],$Y.prototype,"preloadAudioMixing",1),ZY([IB("default","id")],$Y.prototype,"unloadAudioMixing",1),ZY([IB("default","id")],$Y.prototype,"getAudioMixingVolume",1),ZY([IB("default","id","volume")],$Y.prototype,"setAudioMixingVolume",1),ZY([IB("default","id")],$Y.prototype,"getAudioMixingDuration",1),ZY([IB("default","id")],$Y.prototype,"getAudioMixingCurrentPosition",1),ZY([IB("default","id","position")],$Y.prototype,"setAudioMixingPosition",1),ZY([IB("default","type")],$Y.prototype,"enableAudioMixingBuffer",1),ZY([IB()],$Y.prototype,"disableAudioMixingBuffer",1),ZY([IB("default","buffer")],$Y.prototype,"pushAudioMixingBuffer",1);var eJ=function(e){return e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser",e}(eJ||{}),tJ=new xU("RTMClient",1),rJ=function(e){f(v,e);var t,r,n,i,a,s,d,_=g(v);function v(e){var t;return c(this,v),h(m(t=_.call(this)),"_dataChannelSignal",null),h(m(t),"_handler",null),h(m(t),"_dataChannelSignalState",Nz.DISCONNECTED),h(m(t),"_loginSessionId",null),h(m(t),"_userId",null),h(m(t),"_token",null),h(m(t),"_isReconnecting",!1),h(m(t),"_reconnectTimer",null),h(m(t),"_loginResolveCallback",null),h(m(t),"_loginRejectCallback",null),h(m(t),"_iceConfigNode",null),h(m(t),"_wait_login_token",!1),h(m(t),"_serverParamsCache",void 0),t._appId=e,t}return l(v,[{key:"login",value:function(e,t){var r=this;return new Promise((function(n,i){if(tJ.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new JN(qN.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new JN(qN.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,EB.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(tJ.print("login","init dataChannelSingling"),r._dataChannelSignalState=Nz.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))}},{key:"logout",value:(d=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new JN(qN.NOT_LOGIN,"login first");case 2:return e.next=4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:cj.C2RTM}).catch((function(){}));case 4:this._closeDataChannelSignaling(),this._clearState();case 6:case"end":return e.stop()}}),e,this)}))),function(){return d.apply(this,arguments)})},{key:"updateLoginToken",value:(s=u(o().mark((function e(t){var r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._token=t,e.abrupt("return",new Promise((function(e,t){r._wait_login_token?(r._loginResolveCallback=e,r._loginRejectCallback=t,r._login()):e()})));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(a=u(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new JN(qN.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.next=5,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:t},{functionType:cj.C2RTM});case 5:return r=e.sent,e.abrupt("return",null==r?void 0:r.status);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(i=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new JN(qN.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:t,room:"",msg:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"setServerParams",value:(n=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,xP(t,"signature"),xP(r,"url"),this._loginSessionId&&this._userId){e.next=5;break}throw new JN(qN.NOT_LOGIN,"login first");case 5:return this._checkDataChannelSignal(),e.next=8,this._dataChannelSignal.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,signature:t,url:r},{functionType:cj.C2RTM}).catch((function(e){throw new JN(qN.UNEXPECTED_ERROR,e.msg)}));case 8:this._serverParamsCache={signature:t,url:r},this.emit("onServerParamsSetResult"),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(0),this.emit("onServerParamsSetResult",e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[0,12]])}))),function(e,t){return n.apply(this,arguments)})},{key:"sendServerMessage",value:(r=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new JN(qN.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:ij.BUSINESS_SERVER,msg:t}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"destroy",value:function(){this._clearState(),this._closeDataChannelSignaling(),b(p(v.prototype),"removeAllListeners",this).call(this),delete this._serverParamsCache}},{key:"_login",value:function(){var e=this;if(this._userId){var t=uP();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:hP.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:jB.VERSION,deviceId:UB.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:cj.C2RTM}).then((function(){e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1,e._serverParamsCache&&e.setServerParams(e._serverParamsCache.signature,e._serverParamsCache.url)})).catch((function(t){var r,n,i=t||{},o=i.code,a=i.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(r=qN.INVALID_PARAMS,n="Invalid userId"):(r=qN.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=qN.LOGIN_FAILED,n="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new JN(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}}},{key:"_createDataChannelSignaling",value:(t=u(o().mark((function e(t){var r,n,i,a,s,u,c,d=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=new pj,i=this._iceConfigNode){e.next=16;break}return e.prev=3,e.next=6,null==n?void 0:n.getAccessNode(this._appId,"",t,UB.getDeviceId(),"");case 6:if(a=e.sent,i=a[0]){e.next=10;break}throw new Error;case 10:e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(3),RB("rtm.login.getNodeFailed","",0,!0),new JN(qN.ICE_SERVER_WRONG,"get ICE config failed");case 16:return RB("rtm.login.getNodeSuccess",i,0,!0),tJ.print("_createDataChannelSignaling()","get node success",i),this._handler=Ez(gB),null===(r=this._handler)||void 0===r||r.once("disconnect",(function(){tJ.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),d._onDisconnect()})),e.prev=20,e.next=23,null===(u=this._handler)||void 0===u?void 0:u.connect(i);case 23:s=e.sent,tJ.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=Nz.CONNECTED,e.next=33;break;case 28:throw e.prev=28,e.t1=e.catch(20),this._iceConfigNode=null,this._dataChannelSignalState=Nz.DISCONNECTED,new JN(qN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t1);case 33:return c=new lj(s),tJ.print("_createDataChannelSignaling()","send ping"),c.sendPingSignaling(),c.once("close",(function(){tJ.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),d._onDisconnect()})),c.on(ZB.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){d.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(ZB.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){d.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(ZB.USER_DISCONNECTION,(function(){d.emit("onUserDisconnection"),d._clearState()})),c.on(ZB.NODE_CHANGE,(function(e){RB("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(d._iceConfigNode=e.nodes[0]),d._loginResolveCallback&&d._loginRejectCallback?d._login():d._reconnect()})),e.abrupt("return",c);case 42:case"end":return e.stop()}}),e,this,[[3,12],[20,28]])}))),function(e){return t.apply(this,arguments)})},{key:"_closeDataChannelSignaling",value:function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._dataChannelSignal=null,null===(t=this._handler)||void 0===t||t.destroy(),this._handler=null}},{key:"_checkDataChannelSignal",value:function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==Nz.CONNECTED)throw new JN(qN.NOT_CONNECTED_YET,"datachannel not connect")}},{key:"_onDisconnect",value:function(){this._dataChannelSignalState=Nz.DISCONNECTED,this._closeDataChannelSignaling(),navigator.onLine?this._reconnect():this._reconnectTimer=self.setTimeout(this._reconnect.bind(this),3e3)}},{key:"_reconnect",value:function(){var e=this;!this._isReconnecting&&this._userId&&(tJ.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){tJ.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){tJ.print("_reconnect()","Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=self.setTimeout(e._reconnect.bind(e),3e3)})).finally((function(){e._isReconnecting=!1})))}},{key:"_clearState",value:function(){this._userId=null,this._token=null,this._loginSessionId=null,null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)}}]),v}(AU.exports.EventEmitter),nJ=function(e){f(a,e);var t,r,n,i=g(a);function a(e){var t;return c(this,a),h(m(t=i.call(this)),"_mediaServerClient",void 0),h(m(t),"_appId",void 0),h(m(t),"_reconnectTimer",void 0),h(m(t),"remoteStreams",void 0),t._appId=e,t.remoteStreams=new Map,t}return l(a,[{key:"connect",value:(n=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._mediaServerClient=new Pz,this._bindEvents(),e.next=4,this._mediaServerClient.connect(this._appId);case 4:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"startPlayPublicStream",value:(r=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.remoteStreams.get(t)){e.next=2;break}throw new JN(qN.REPEAT_PLAY,"repeat play public media stream");case 2:return(r=new dz(t,t,!1,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]})).on("onSEIMessage",(function(e){if(e instanceof Uint8Array)for(var t=wP(e),i=0;i<t.seiCount;i++)n.emit(nz.ON_SEI_MESSAGED_RECEIVED,{sei:t.seis[i],publicStreamId:r.streamId})})),e.next=6,this._mediaServerClient.subscribePublicStream(r);case 6:return this.remoteStreams.set(t,r),e.abrupt("return",r);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"stopPlayPublicStream",value:function(e){var t=this.remoteStreams.get(e);if(t)return this.remoteStreams.delete(e),this._mediaServerClient.unsubscribePublicStream(t)}},{key:"destroy",value:function(){this.remoteStreams=new Map,this._mediaServerClient&&this._mediaServerClient.destroy()}},{key:"_handleReconnected",value:(t=u(o().mark((function e(){var t,r,n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:clearTimeout(this._reconnectTimer),t=A(this.remoteStreams);try{for(n=function(){var e=E(r.value,1)[0];i.remoteStreams.delete(e),i.startPlayPublicStream(e).then((function(){var t=i.remoteStreams.get(e);i.safeEmit(nz.RESUBSCRIBE,{stream:t})}))},t.s();!(r=t.n()).done;)n()}catch(lV){t.e(lV)}finally{t.f()}case 3:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_reconnect",value:function(){var e=this;this._mediaServerClient.removeAllListeners(),this._mediaServerClient.destroy(),navigator.onLine?this.connect().then(this._handleReconnected.bind(this)):this._reconnectTimer=setTimeout((function(){return e.connect().then(e._handleReconnected.bind(e))}),3e3)}},{key:"_bindEvents",value:function(){var e,t,r=this;null===(e=this._mediaServerClient)||void 0===e||e.on(ej.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))}}]),a}(DU),iJ=new xU("AudioDeviceManager",1),oJ=function(e){f(a,e);var t,r,n,i=g(a);function a(){var e;c(this,a);for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];return h(m(e=i.call.apply(i,[this].concat(r))),"_audioLevelFetcher",void 0),h(m(e),"_playbackDeviceTestTimer",void 0),h(m(e),"_audioElement",void 0),h(m(e),"_audioTrack",void 0),h(m(e),"_mediaRecorder",void 0),h(m(e),"_recoderTimer",void 0),h(m(e),"_isAudioPlaybackDeviceTesting",!1),h(m(e),"_isAudioDeviceRecordTesting",!1),h(m(e),"_audioCaptureAndRecoderResolve",void 0),e}return l(a,[{key:"startAudioPlaybackDeviceTest",value:(n=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioPlaybackDeviceTesting&&!this._isAudioDeviceRecordTesting){e.next=2;break}throw new JN(qN.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioPlaybackDeviceTesting=!0,iJ.print("startAudioPlaybackDeviceTest()","Invoke"),e.prev=4,e.next=7,this._playAudioFile(t,{loop:!0});case 7:e.next=13;break;case 9:throw e.prev=9,e.t0=e.catch(4),this.stopAudioPlaybackDeviceTest(),e.t0;case 13:this._startEmitAudioPlaybackDeviceTestVolume(r);case 14:case"end":return e.stop()}}),e,this,[[4,9]])}))),function(e,t){return n.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){this._isAudioPlaybackDeviceTesting&&(iJ.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"startAudioDeviceRecordTest",value:(r=u(o().mark((function e(t){var r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioDeviceRecordTesting){e.next=2;break}throw new JN(qN.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioDeviceRecordTesting=!0,iJ.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){iJ.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),r._stopAudioCaptureAndRecoder()}),3e4),e.next=7,this._startAudioCaptureAndRecoder(t);case 7:delete this._audioCaptureAndRecoderResolve;case 8:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){iJ.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()}},{key:"stopAudioDevicePlayTest",value:function(){this._isAudioDeviceRecordTesting&&(iJ.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"getRecordTrack",value:function(){return this._audioTrack}},{key:"destroy",value:function(){iJ.print("destroy()","Invoke"),b(p(a.prototype),"removeAllListeners",this).call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()}},{key:"_playAudioFile",value:function(e,t){var r=this;return new Promise((function(n,i){r._audioElement=Yz("audio",{attributes:{src:e,crossOrigin:"",autoplay:"true"}}),r._audioElement.loop=t.loop,iJ.print("_playAudioFile()","url=".concat(e,";loop=").concat(t.loop)),r._audioElement.oncanplay=function(){iJ.print("_playAudioFile()","oncanplay"),n()},r._audioElement.onerror=function(e){var t,n;i(new JN(qN.LOAD_RESOURCES_FAILED,"audio error: ".concat(e.message||(null===(t=r._audioElement)||void 0===t||null===(n=t.error)||void 0===n?void 0:n.message))))}}))}},{key:"_destroyAudioElement",value:function(){this._audioElement&&(iJ.print("_destroyAudioElement()","Invoke"),this._audioElement.src="",delete this._audioElement,this._audioCaptureAndRecoderResolve&&this._audioCaptureAndRecoderResolve())}},{key:"_startEmitAudioPlaybackDeviceTestVolume",value:function(e){var t=this;e=Math.max(e,100),this._audioElement&&(iJ.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._audioLevelFetcher=new vH(this._audioElement),this._playbackDeviceTestTimer=self.setInterval((function(){t._audioLevelFetcher&&t.emit("onAudioPlaybackDeviceTestVolume",t._audioLevelFetcher.getAudioLevel())}),e))}},{key:"_stopEmitAudioPlaybackDeviceTestVolume",value:function(){var e;void 0!==this._playbackDeviceTestTimer&&(iJ.print("_stopEmitAudioPlaybackDeviceTestVolume()","stop timer"),self.clearInterval(this._playbackDeviceTestTimer),delete this._playbackDeviceTestTimer),null===(e=this._audioLevelFetcher)||void 0===e||e.destroy(),delete this._audioLevelFetcher}},{key:"_startAudioCaptureAndRecoder",value:(t=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,LH({});case 2:return this._audioTrack=e.sent,r=bH(this._audioTrack.getTrack()),iJ.print("startAudioDeviceRecordTest()","create microphone track success!"),e.abrupt("return",new Promise((function(e,i){n._mediaRecorder=new MediaRecorder(r),n._mediaRecorder.ondataavailable=function(){var r=u(o().mark((function r(a){var s,u;return o().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!n._isAudioDeviceRecordTesting){r.next=16;break}return iJ.print("startAudioDeviceRecordTest()","get recorded file."),u=new Blob([a.data]),r.prev=3,r.next=6,n._playAudioFile(URL.createObjectURL(u),{loop:!1});case 6:r.next=11;break;case 8:return r.prev=8,r.t0=r.catch(3),r.abrupt("return",i(r.t0));case 11:n._startEmitAudioPlaybackDeviceTestVolume(t),null===(s=n._audioElement)||void 0===s||s.addEventListener("ended",(function(){n.stopAudioDevicePlayTest(),e()})),n._audioCaptureAndRecoderResolve=e,r.next=17;break;case 16:e();case 17:case"end":return r.stop()}}),r,null,[[3,8]])})));return function(e){return r.apply(this,arguments)}}(),n._mediaRecorder.onerror=function(e){i(new JN(qN.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},n._mediaRecorder.start()})));case 6:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_stopAudioCaptureAndRecoder",value:function(){var e;this._mediaRecorder&&("recording"===this._mediaRecorder.state&&this._mediaRecorder.stop(),delete this._mediaRecorder),null===(e=this._audioTrack)||void 0===e||e.close(),delete this._audioTrack}}]),a}(AU.exports.EventEmitter),aJ=function(){function e(){c(this,e),h(this,"engineBAC",{adm:{},agc:{},ans:{}}),h(this,"engineANM",{}),h(this,"bitrate",void 0),h(this,"sampleRate",void 0),h(this,"channel",void 0),h(this,"aec",void 0),h(this,"agc",void 0),h(this,"ans",void 0),this._init()}var t;return l(e,[{key:"_init",value:(t=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=new _j,e.next=3,t.getAudioProfile();case 3:this.engineBAC=e.sent;case 4:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"updateEngineBAC",value:function(e){e&&(this.engineBAC={codec:this.engineBAC.codec,adm:i(i({},this.engineBAC.adm),e.adm)},this.setAEC(!!e.aec),this.setAGC(!!e.agc))}},{key:"updateEngineANM",value:function(e){e&&(this.engineANM=e)}},{key:"setAudioProfile",value:function(e){var t,r,n;switch(e){case J.fluent:r=16e3,t=24e3;break;case J.standard:r=48e3,t=48e3;break;case J.hd:r=48e3,t=128e3,n=2;break;case J.standardStereo:r=48e3,t=8e4,n=2;break;case J.hdMono:r=48e3,t=128e3}t&&(this.bitrate=t),n&&(this.channel=n),r&&(this.sampleRate=r)}},{key:"setBitrate",value:function(e){e>128e3&&(e=128e3),this.bitrate=e}},{key:"setAEC",value:function(e){this.aec=e}},{key:"setAGC",value:function(e){this.agc=e}},{key:"setANS",value:function(e){this.ans=e}},{key:"getOpusConfigStr",value:function(){var e=";",t=this.config;return t.bitrate&&(e+="maxaveragebitrate=".concat(t.bitrate,";")),t.sampleRate&&(e+="sprop-maxcapturerate=".concat(t.sampleRate,";")),t.playbackRate&&(e+="maxplaybackrate=".concat(t.playbackRate,";")),t.channel&&t.channel>1&&(e+="sprop-stereo=1;"),t.playChannel&&t.playChannel>1&&(e+="stereo=1;"),e.slice(0,-1)}},{key:"config",get:function(){var e,t,r,n,i,o,a,s,u,c,d,l,h;return{bitrate:this.bitrate||(null===(e=this.engineANM.enc_param)||void 0===e?void 0:e.bitrate)||0,playChannel:(null===(t=this.engineBAC.adm)||void 0===t||null===(r=t.play)||void 0===r?void 0:r.chn)||1,channel:this.channel||(null===(n=this.engineBAC.adm)||void 0===n||null===(i=n.record)||void 0===i?void 0:i.chn)||(null===(o=this.engineANM)||void 0===o||null===(a=o.enc_param)||void 0===a?void 0:a.chn),aec:this.aec,agc:this.agc,ans:this.ans,sampleRate:this.sampleRate||(null===(s=this.engineBAC.adm)||void 0===s||null===(u=s.record)||void 0===u?void 0:u.sr)||(null===(c=this.engineBAC.codec)||void 0===c?void 0:c.enc_fs)||(null===(d=this.engineANM.enc_param)||void 0===d?void 0:d.sr),playbackRate:null===(l=this.engineBAC.adm)||void 0===l||null===(h=l.play)||void 0===h?void 0:h.sr}}}]),e}(),sJ=new xU("VideoSnapshot",1),uJ=function(e){var t=null==e?void 0:e.domElement;if(t&&!t.paused&&4===t.readyState)return t},cJ=function(){var e=u(o().mark((function e(t,r,n){var i,a,s,u,c,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=document.createElement("canvas"),a=i.getContext("2d")){e.next=4;break}throw new Error("canvas.getContext error");case 4:if(s=function(e,t,n){return t=t||e.width,n=n||e.height,i.width=t,i.height=n,r?a.setTransform(-1,0,0,1,t,0):a.setTransform(1,0,0,1,0,0),a.drawImage(e,0,0,t,n),a.getImageData(0,0,t,n)},u=Date.now(),!(c=uJ(n))){e.next=16;break}return sJ.print("takeSnapshot","VideoPlayer already set."),e.next=11,s(c,c.videoWidth,c.videoHeight);case 11:return d=e.sent,sJ.print("takeSnapshot","success, cost ".concat(Date.now()-u,"ms")),e.abrupt("return",d);case 16:if(!window.ImageCapture){e.next=29;break}if("live"!==(l=new window.ImageCapture(t)).track.readyState||!l.track.enabled||l.track.muted){e.next=29;break}return sJ.print("takeSnapshot","use ImageCapture"),e.t0=s,e.next=23,l.grabFrame();case 23:return e.t1=e.sent,e.next=26,(0,e.t0)(e.t1);case 26:return h=e.sent,sJ.print("takeSnapshot","success, cost ".concat(Date.now()-u,"ms")),e.abrupt("return",h);case 29:return sJ.print("takeSnapshot","use temp video"),e.abrupt("return",new Promise((function(e,r){var n=new MediaStream([t]),i=document.createElement("video");i.setAttribute("playsinline",""),i.muted=!0,document.body.appendChild(i),i.onplaying=function(){var r=s(i,i.videoWidth,i.videoHeight);sJ.print("takeSnapshot","success, cost ".concat(Date.now()-u,"ms")),e(r),n.removeTrack(t),i.srcObject=null,i.load()},i.onerror=r,i.srcObject=n,i.play()})));case 31:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),dJ=Object.defineProperty,lJ=Object.getOwnPropertyDescriptor,hJ=function(e,t,r,n){for(var i,o=n>1?void 0:n?lJ(t,r):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&dJ(t,r,o),o},fJ=new xU("Engine",0),pJ=function(e){f(Le,e);var t,r,n,a,s,d,_,v,y,S,E,k,T,I,A,C,O,x,P,M,j,G,H,z,X,q,J,Z,$,te,re,ie,oe,ae,se,ue,ce,de,le,he,fe,pe,_e,ve,me,ye,ge,Se,be,Ee,ke,Te,Ie,Ae,Re,we,Ce,Oe,xe,Ne,De,Pe,Me,Ue=g(Le);function Le(e,t){var r;return c(this,Le),h(m(r=Ue.call(this)),"_room",void 0),h(m(r),"_outsideRoom",void 0),h(m(r),"_appId",void 0),h(m(r),"_businessId",void 0),h(m(r),"_visibility",!0),h(m(r),"_localVideoTrack",void 0),h(m(r),"_localAudioTrack",void 0),h(m(r),"_localImgVideoTrack",void 0),h(m(r),"_localImgScreenTrack",void 0),h(m(r),"_localScreenVideoTrack",void 0),h(m(r),"_localScreenAudioTrack",void 0),h(m(r),"_tempMixingAudioTrack",void 0),h(m(r),"_localAudioTrackVolume",void 0),h(m(r),"_localScreenAudioTrackVolume",void 0),h(m(r),"_remoteAudioTrackVolumeMap",new Map),h(m(r),"_remoteScreenAudioTrackVolumeMap",new Map),h(m(r),"_remotePublicAudioTrackVolumeMap",new Map),h(m(r),"_audioPlaybackDeviceId",void 0),h(m(r),"_videoPlayer",void 0),h(m(r),"_screenPlayer",void 0),h(m(r),"_remoteVideoPlayer",new Map),h(m(r),"_remoteScreenPlayer",new Map),h(m(r),"_remoteAudioPlayer",new Map),h(m(r),"_publicStreamAudioPlayer",new Map),h(m(r),"_publicStreamVideoPlayer",new Map),h(m(r),"_publicStreamIds",new Map),h(m(r),"_roomConfig",void 0),h(m(r),"_videoStreamConstraints",{}),h(m(r),"_audioStreamConstraints",{}),h(m(r),"_enableSimulcast",!1),h(m(r),"_videoStreamEncodeConfig",[qB]),h(m(r),"_screenStreamEncodeConfig",[YB]),h(m(r),"_trackSourceType",void 0),h(m(r),"_liveTranscodeConfig",void 0),h(m(r),"_useCloudProxy",void 0),h(m(r),"_startCloudProxyTimestamp",void 0),h(m(r),"_localVideoDeviceId",void 0),h(m(r),"_localAudioDeviceId",void 0),h(m(r),"_pauseAllSubscribeState",{audio:!1,video:!1}),h(m(r),"_audioVolumeIndicationTimer",void 0),h(m(r),"_dummyTimer",void 0),h(m(r),"_audioPropertiesReportTimer",null),h(m(r),"_mirrorType",B.MIRROR_TYPE_RENDER),h(m(r),"_audioMixingManager",void 0),h(m(r),"_pubLock",void 0),h(m(r),"_rtmClient",void 0),h(m(r),"_messageStatisticsObserver",void 0),h(m(r),"_tempRoomConfig",void 0),h(m(r),"_originIceConfigRequestUrls",void 0),h(m(r),"_originConfigServerUrls",void 0),h(m(r),"_originLogServerUrl",void 0),h(m(r),"_audioDeviceManager",new oJ),h(m(r),"_audioProfileManager",new aJ),h(m(r),"_remoteVideoConfig",new Map),h(m(r),"_userPriorityMap",new Map),h(m(r),"_subscribeFallbackOption",K.DISABLE),h(m(r),"_cameraCapturing",!1),h(m(r),"_interruptCameraCapture",!1),h(m(r),"_micCapturing",!1),h(m(r),"_interruptMicCapture",!1),h(m(r),"_config",void 0),h(m(r),"_updateMixAudioTrack",function(){var e=u(o().mark((function e(t){var n,i,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=a.length>1&&void 0!==a[1]?a[1]:ee.PLAYOUT_AND_PUBLISH,fJ.print("_updateMixAudioTrack()"),r._localAudioTrack){e.next=5;break}return t&&(r._tempMixingAudioTrack={track:t,type:i}),e.abrupt("return");case 5:if(t?(r._localAudioTrack.mixType=i,r._localAudioTrack.mixedAudioTrack=t):(delete r._localAudioTrack.mixType,delete r._localAudioTrack.mixedAudioTrack),null===(n=r._room)||void 0===n||!n.hasPublished){e.next=9;break}return e.next=9,r._updatePublish();case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),h(m(r),"_onAudioMixingMessage",(function(e){r.safeEmit(ne.onAudioMixingStateChanged,e)})),h(m(r),"_onAudioMixingAutoplayFailed",(function(){r.safeEmit(ne.onAutoplayFailed,{})})),r._appId=e,r._pubLock=new Iz("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new $Y({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage,onAutoPlayFailed:r._onAudioMixingAutoplayFailed}),window.__rtc_engine__=m(r),window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=m(r),r._trackSourceType={video:R.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:R.VIDEO_SOURCE_TYPE_INTERNAL,audio:w.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:w.AUDIO_SOURCE_TYPE_INTERNAL},r._config=t,r._rtmClient=new rJ(e),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new iK,r}return l(Le,[{key:"appId",get:function(){return this._appId},set:function(e){this._appId=e}},{key:"updateToken",value:(Me=u(o().mark((function e(t){var r,n,i,a,s,u,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("updateToken()","token: %s",t),xP(t,"token"),!(this.waitForNewToken&&null!==(r=this._room)&&void 0!==r&&r._roomInfo&&this._tempRoomConfig)){e.next=9;break}return a=null===(i=this._room)||void 0===i?void 0:i._roomInfo,s=a.roomId,u=a.userInfo,c=this._tempRoomConfig,delete this._tempRoomConfig,e.next=8,this.joinRoom(t,s,u,c);case 8:return e.abrupt("return",e.sent);case 9:if(this._room){e.next=11;break}throw new JN(qN.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");case 11:return e.next=13,null===(n=this._room)||void 0===n?void 0:n.updateToken(t);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return Me.apply(this,arguments)})},{key:"setVideoCaptureDevice",value:(Pe=u(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("setVideoCaptureDevice()","deviceId: %s",t),xP(t,"deviceId"),this._localVideoDeviceId=t,this._localVideoTrack){e.next=5;break}return e.abrupt("return");case 5:return r=this._videoStreamConstraints,"user"===t||"environment"===t||"left"===t||"right"===t?(delete r.deviceId,r.facingMode=t):r.deviceId={exact:t},this._videoStreamConstraints=r,e.next=10,MH(r);case 10:if(n=e.sent,this._initLocalTrackEvents(n),this._localVideoTrack.close(),this._localVideoTrack=n,this._videoPlayer&&this._videoPlayer.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(n),this._videoPlayer.mirror(!!this._mirrorType)),this._room){e.next=17;break}return e.abrupt("return");case 17:if(!this._room.hasPublished){e.next=20;break}return e.next=20,this._updatePublish();case 20:case"end":return e.stop()}}),e,this)}))),function(e){return Pe.apply(this,arguments)})},{key:"setAudioCaptureDevice",value:(De=u(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("setAudioCaptureDevice()","deviceId: %s",t),xP(t,"deviceId"),this._localAudioDeviceId=t,this._localAudioTrack){e.next=5;break}return e.abrupt("return");case 5:return(r=this._audioStreamConstraints).deviceId={exact:t},this._audioStreamConstraints=r,this._localAudioTrack.close(),e.next=11,LH(r,this._audioProfileManager);case 11:if(n=e.sent,void 0!==this._localAudioTrackVolume&&n.setCaptureVolume(this._localAudioTrackVolume),this._initLocalTrackEvents(n),this._localAudioTrack=n,this._room){e.next=17;break}return e.abrupt("return");case 17:if(!this._room.hasPublished){e.next=20;break}return e.next=20,this._updatePublish();case 20:case"end":return e.stop()}}),e,this)}))),function(e){return De.apply(this,arguments)})},{key:"_addDeviceEventHandler",value:function(){pH.on(ne.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),pH.on(ne.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,u,c,d,l,h,f,p,_,v,m,y,g,S,b,E,k,T,I,A,R,w,C,O=this;null===(e=this._room)||void 0===e||e.on(ZB.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(ZB.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(ZB.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(nz.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(nz.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(nz.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(ZB.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(ZB.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(ZB.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(ZB.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(ZB.POST_PROCESSING_MESSAGE,(function(e){"2.0"===e.protocol?O._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message}):"publicStreamCallback"===e.type?O._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&O._onLiveTranscodingResult(e)})),null===(l=this._room)||void 0===l||l.on(ej.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(nz.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(f=this._room)||void 0===f||f.on(nz.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(p=this._room)||void 0===p||p.on(nz.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(_=this._room)||void 0===_||_.on(nz.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(v=this._room)||void 0===v||v.on(nz.ON_PUBLISH_RESULT,(function(e){var t;null!==(t=O._room)&&void 0!==t&&t._roomConfig.isAutoPublish&&O.safeEmit(ne.onAutoPublishResult,e)})),null===(m=this._room)||void 0===m||m.on(nz.ON_REMOTE_STREAM_STATS,(function(e){O.safeEmit(ne.onRemoteStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(nz.ON_LOCAL_STREAM_STATS,(function(e){O.safeEmit(ne.onLocalStreamStats,e)})),null===(g=this._room)||void 0===g||g.on(nz.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(S=this._room)||void 0===S||S.on(nz.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(ne.onUserStartAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(nz.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(ne.onUserStopAudioCapture,{userId:t})})),null===(E=this._room)||void 0===E||E.on(nz.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(ne.onUserStartVideoCapture,{userId:t})})),null===(k=this._room)||void 0===k||k.on(nz.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(ne.onUserStopVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(nz.ON_SEI_MESSAGED_RECEIVED,(function(e){O.safeEmit(ne.onSEIMessageReceived,e)})),null===(I=this._room)||void 0===I||I.on(nz.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){O.safeEmit(ne.onRemoteVideoSizeChanged,e,t)})),null===(A=this._room)||void 0===A||A.on(nz.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return O.safeEmit(ne.onSimulcastSubscribeFallback,e)})),null===(R=this._room)||void 0===R||R.on(nz.RECONNECT_FAILED,(function(){O.safeEmit(ne.onError,{errorCode:qN.RECONNECT_FAILED})})),null===(w=this._room)||void 0===w||w.on(nz.ON_VIDEO_STREAM_BANNED,(function(e){O.safeEmit(ne.onVideoStreamBanned,{uid:e.uid,banned:e.banned})})),null===(C=this._room)||void 0===C||C.on(nz.ON_AUDIO_STREAM_BANNED,(function(e){O.safeEmit(ne.onAudioStreamBanned,{uid:e.uid,banned:e.banned})}))}},{key:"safeEmit",value:function(e){for(var t,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];return KP(e)&&AB(e,bP(n)),(t=b(p(Le.prototype),"safeEmit",this)).call.apply(t,[this,e].concat(n))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()}},{key:"joinRoom",value:(Ne=u(o().mark((function e(t,r,n,a){var s,u,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",t,r,n,a),LP(t)||xP(t,"token"),VP(r),jP(n),s={isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:Y.communication},RW(s,a),GP(s),!this._room||this._room.connectionState===Nz.DISCONNECTED){e.next=11;break}throw new JN(qN.REPEAT_JOIN,"Already joined");case 11:return this._room=new Xz(a,{audioProfileManager:this._audioProfileManager}),this._room.userPriorityMap=this._userPriorityMap,this._room.subscribeFallbackOption=this._subscribeFallbackOption,this._addHandlerEventHandler(),u=this._liveTranscodeConfig&&zB("started",this._liveTranscodeConfig),e.prev=16,this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),e.next=20,this._room.join(this._appId,r,t,i(i({},n),{},{businessId:this._businessId,role:this._visibility?eJ.NORMAL_USER:eJ.SILENT_USER}),u,this._useCloudProxy);case 20:return c=e.sent,this._roomConfig=a,this._tempRoomConfig&&delete this._tempRoomConfig,null!=a&&a.isAutoPublish&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:L.AUDIO_AND_VIDEO}):this.safeEmit(ne.onAutoPublishResult,{isScreen:!1,state:D.PUBLISH_FAIL})),e.abrupt("return",c);case 27:throw e.prev=27,e.t0=e.catch(16),e.t0.code===qN.INVALID_TOKEN&&(this._tempRoomConfig=a),e.t0;case 31:case"end":return e.stop()}}),e,this,[[16,27]])}))),function(e,t,r,n){return Ne.apply(this,arguments)})},{key:"leaveRoom",value:(xe=u(o().mark((function e(){var t,r,n,i=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]&&i[0],fJ.print("leaveRoom()"),!t){e.next=7;break}return e.next=5,null===(r=this._room)||void 0===r?void 0:r.leave(t);case 5:e.next=8;break;case 7:null===(n=this._room)||void 0===n||n.leave(t).catch();case 8:this._removeHandlerEventHandler(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0,this._publicStreamIds=new Map;case 19:case"end":return e.stop()}}),e,this)}))),function(){return xe.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r,n,i,o;fJ.print("destroy()"),this.removeAllListeners(),this._removeHandlerEventHandler(),null===(e=this._room)||void 0===e||e.destroy(),this._room=void 0,null===(t=this._videoPlayer)||void 0===t||t.destroy(),this._videoPlayer=void 0,this._screenPlayer=void 0,this._videoStreamConstraints={},this._audioStreamConstraints={},this._videoStreamEncodeConfig=[qB],this._screenStreamEncodeConfig=[YB],this._pauseAllSubscribeState={audio:!1,video:!1},this._messageStatisticsObserver.destroy(),clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyTimer),this._audioVolumeIndicationTimer=void 0,this._stopAudioPropertiesReport(),this._localAudioTrack&&(this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._localScreenVideoTrack.close(),this._localScreenVideoTrack=void 0),this._localImgVideoTrack&&(this._localImgVideoTrack.stop(),this._localImgVideoTrack=void 0),this._localImgScreenTrack&&(this._localImgScreenTrack.stop(),this._localImgScreenTrack=void 0),this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new Map,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(r=this._outsideRoom)||void 0===r||r.destroy(),this._publicStreamIds=new Map,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new Map,this._userPriorityMap.clear(),this._localAudioTrackVolume=100,this._localScreenAudioTrackVolume=100,null===(n=this._remoteAudioTrackVolumeMap)||void 0===n||n.clear(),null===(i=this._remoteScreenAudioTrackVolumeMap)||void 0===i||i.clear(),null===(o=this._remotePublicAudioTrackVolumeMap)||void 0===o||o.clear(),this._cameraCapturing=!1,this._micCapturing=!1,this._interruptCameraCapture=!1,this._interruptMicCapture=!1}},{key:"publishStream",value:(Oe=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("publishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),AP(t)&&!this._localVideoTrack&&this._localImgVideoTrack&&(this._localVideoTrack=(r=this._localImgVideoTrack,new OH(r,uP())),this._localVideoTrack.dummy=!0),e.next=6,this._updatePublish({mediaType:t});case 6:case"end":return e.stop()}var r}),e,this)}))),function(e){return Oe.apply(this,arguments)})},{key:"unpublishStream",value:(Ce=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("unpublishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!r){e.next=5;break}return e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.unpublish());case 5:return e.next=7,this._updatePublish({mediaType:t,pubState:oz.UNPUB});case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ce.apply(this,arguments)})},{key:"publishScreen",value:(we=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("publishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.prev=3,AP(t)&&!this._localScreenVideoTrack&&this._localImgScreenTrack&&(this._localScreenVideoTrack=(r=this._localImgScreenTrack,new xH(r,uP())),this._localScreenVideoTrack.dummy=!0),e.next=7,this._updateScreenPublish({mediaType:t,pubState:oz.PUB});case 7:e.next=16;break;case 9:if(e.prev=9,e.t0=e.catch(3),!(e.t0 instanceof JN)){e.next=15;break}throw e.t0;case 15:throw new JN(qN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 16:case"end":return e.stop()}var r}),e,this,[[3,9]])}))),function(e){return we.apply(this,arguments)})},{key:"unpublishScreen",value:(Re=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("unpublishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.next=5,this._updateScreenPublish({mediaType:t,pubState:oz.UNPUB});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return Re.apply(this,arguments)})},{key:"subscribeStream",value:(Ae=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("subscribeStream()","userId: %o, mediaType: %o",t,r),e.abrupt("return",this._subscribe(!1,t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ae.apply(this,arguments)})},{key:"_subscribe",value:(Ie=u(o().mark((function e(t,r,n){var i,a,s,u,c,d,l,h,f,p;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._checkMediaType(n),this._assertNotInRoom(),u=this._room.remoteStreams.get(r),c=null==u?void 0:u.find((function(e){return e.isScreen===t}))){e.next=6;break}throw new JN(qN.STREAM_NOT_EXIST,"stream not exist");case 6:return this._pauseAllSubscribeState.audio&&(n-=n&L.AUDIO),this._pauseAllSubscribeState.video&&(n-=n&L.VIDEO),fJ.print("subscribeStream()","due to pauseAll mediaType: %o",n),d=c.hasSubscribed,l=this._remoteVideoConfig.get(r)||(null===(i=this._roomConfig)||void 0===i?void 0:i.remoteVideoConfig),c.originalMediaType=n,e.next=14,this._room.subscribe(c,n,l);case 14:IP(n)&&this._updateAudioPlayerState(c),AP(n)&&this._updateVideoPlayerState(c),!t&&(null!==(a=this._roomConfig)&&void 0!==a&&a.isAutoSubscribeAudio||null!==(s=this._roomConfig)&&void 0!==s&&s.isAutoSubscribeVideo)&&(c.audioTrack||c.videoTrack)&&(h={userId:r,isScreen:!1,state:N.SUBSCRIBE_SUCC},this.safeEmit(ne.onAutoSubscribeResult,h)),!d&&IP(n)&&c.hasAudio&&(null===(f=c.observer)||void 0===f||f.setSubscribeAudio(!0)),!d&&AP(n)&&c.hasVideo&&(null===(p=c.observer)||void 0===p||p.setSubscribeVideo(!0));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return Ie.apply(this,arguments)})},{key:"unsubscribeStream",value:(Te=u(o().mark((function e(t,r){var n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("unsubscribeStream()","userId: %o, mediaType: %o",t,r),this._checkMediaType(r),this._assertNotInRoom(),n=this._room.remoteStreams.get(t),null!=(i=null==n?void 0:n.find((function(e){return!e.isScreen})))&&i.hasSubscribed){e.next=7;break}throw new JN(qN.STREAM_NOT_EXIST,"stream not exist");case 7:this._room.unsubscribe(i,r);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return Te.apply(this,arguments)})},{key:"subscribeScreen",value:(ke=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("subscribeScreen() userId: %o, mediaType: %o",t,r),e.abrupt("return",this._subscribe(!0,t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return ke.apply(this,arguments)})},{key:"unsubscribeScreen",value:(Ee=u(o().mark((function e(t,r){var n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("unsubscribeScreen() userId: %o, mediaType: %o",t,r),this._checkMediaType(r),this._assertNotInRoom(),n=this._room.remoteStreams.get(t),null!=(i=null==n?void 0:n.find((function(e){return e.isScreen})))&&i.hasSubscribed){e.next=7;break}throw new JN(qN.STREAM_NOT_EXIST,"stream not exist");case 7:this._room.unsubscribe(i,r);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ee.apply(this,arguments)})},{key:"setRemoteVideoConfig",value:(be=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",t,r),FP(t),WP(r),this._remoteVideoConfig.set(t,r),e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.updateSubVideoConfig(t,r).then((function(){})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return be.apply(this,arguments)})},{key:"startVideoCapture",value:(Se=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l,h=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("startVideoCapture()","deviceId: %s",t),LP(t)||xP(t,"deviceId"),t=t||this._localVideoDeviceId,this._localVideoDeviceId=t,!(this._cameraCapturing||this._localVideoTrack&&!this._localVideoTrack.dummy)){e.next=6;break}throw new JN(qN.REPEAT_CAPTURE,"Has already capture");case 6:return i=this._videoStreamConstraints,t&&("user"===t||"environment"===t||"left"===t||"right"===t?i.facingMode=t:i.deviceId={exact:t},this._videoStreamConstraints=i),a={},e.prev=9,this._cameraCapturing=!0,e.next=13,MH(i);case 13:if(u=e.sent,!this._interruptCameraCapture){e.next=18;break}throw this._interruptCameraCapture=!1,u.close(),new JN(qN.INTERRUPT,"interrupt by stopVideoCapture");case 18:this._initLocalTrackEvents(u),this._localVideoTrack=u,null===(s=this._videoPlayer)||void 0===s||s.playVideo(u),(c=null==u?void 0:u.getTrack())&&(a=c.getSettings(),d={width:a.width,height:a.height},this._localVideoTrack.resolution=d,setTimeout((function(){return h.safeEmit(ne.onLocalVideoSizeChanged,{streamIndex:U.STREAM_INDEX_MAIN,info:d})})));case 23:return e.prev=23,this._cameraCapturing=!1,e.finish(23);case 26:if(this._room){e.next=28;break}return e.abrupt("return",a);case 28:return l=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||l)&&(this._visibility?this._updatePublish():this.safeEmit(ne.onAutoPublishResult,{isScreen:!1,state:D.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableVideo(!0),e.abrupt("return",a);case 32:case"end":return e.stop()}}),e,this,[[9,,23,26]])}))),function(e){return Se.apply(this,arguments)})},{key:"stopVideoCapture",value:(ge=u(o().mark((function e(){var t,r,n,i,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("stopVideoCapture()"),!this._cameraCapturing){e.next=5;break}return this._interruptCameraCapture=!0,fJ.print("stopVideoCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.video!==R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new JN(qN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 7:if(null===(t=this._videoPlayer)||void 0===t||t.stop(),null===(r=this._localVideoTrack)||void 0===r||r.close(),this._localImgVideoTrack&&this._localVideoTrack?(null===(a=this._localVideoTrack)||void 0===a||a.setTrack(this._localImgVideoTrack),this._localVideoTrack.dummy=!0):this._localVideoTrack=void 0,this._room){e.next=12;break}return e.abrupt("return");case 12:if(!this._room.hasPublished){e.next=15;break}return e.next=15,this._updatePublish();case 15:null===(n=this._room.localStream)||void 0===n||null===(i=n.observer)||void 0===i||i.setEnableVideo(!1);case 16:case"end":return e.stop()}}),e,this)}))),function(){return ge.apply(this,arguments)})},{key:"startAudioCapture",value:(ye=u(o().mark((function e(t){var r,n,i,a,s;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("startAudioCapture()","deviceId: $o",t),LP(t)||xP(t,"deviceId"),t=t||this._localAudioDeviceId,this._localAudioDeviceId=t,!this._micCapturing&&!this._localAudioTrack){e.next=6;break}throw new JN(qN.REPEAT_CAPTURE,"Has already capture");case 6:return i=this._audioStreamConstraints,t&&(i.deviceId={exact:t},this._audioStreamConstraints=i),e.prev=8,this._micCapturing=!0,e.next=12,LH(i,this._audioProfileManager);case 12:if(a=e.sent,!this._interruptMicCapture){e.next=17;break}throw this._interruptMicCapture=!1,a.close(),new JN(qN.INTERRUPT,"interrupt by stopAudioCapture");case 17:this._initLocalTrackEvents(a),this._localAudioTrack=a,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),void 0!==this._localAudioTrackVolume&&this._localAudioTrack.setCaptureVolume(this._localAudioTrackVolume);case 21:return e.prev=21,this._micCapturing=!1,e.finish(21);case 24:if(this._room){e.next=26;break}return e.abrupt("return");case 26:s=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||s)&&(this._visibility?this._updatePublish():this.safeEmit(ne.onAutoPublishResult,{isScreen:!1,state:D.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableAudio(!0);case 29:case"end":return e.stop()}}),e,this,[[8,,21,24]])}))),function(e){return ye.apply(this,arguments)})},{key:"stopAudioCapture",value:(me=u(o().mark((function e(){var t,r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("stopAudioCapture()"),!this._micCapturing){e.next=5;break}return this._interruptMicCapture=!0,fJ.print("stopAudioCapture()","capturing"),e.abrupt("return");case 5:if(null===(t=this._localAudioTrack)||void 0===t||t.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio!==w.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=10;break}throw new JN(qN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 10:if(this._room){e.next=12;break}return e.abrupt("return");case 12:if(!this._room.hasPublished){e.next=15;break}return e.next=15,this._updatePublish();case 15:null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableAudio(!1);case 16:case"end":return e.stop()}}),e,this)}))),function(){return me.apply(this,arguments)})},{key:"getAudioMixingManager",value:function(){return fJ.print("getAudioMixingManager()"),this._audioMixingManager}},{key:"startScreenCapture",value:(ve=u(o().mark((function e(){var t,r,n,i,a,s,u,c,d,l,h,f,p,_,v,m,y,g=this,S=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(c=S.length>0&&void 0!==S[0]?S[0]:{},fJ.print("startScreenCapture()","config: %o",c),!this._localScreenVideoTrack||null!==(t=this._localScreenVideoTrack)&&void 0!==t&&t.dummy||(d=this._localScreenVideoTrack),l=c.enableAudio,h=void 0!==l&&l,this._trackSourceType.screenVideo!==R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new JN(qN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 6:if(this._trackSourceType.screenAudio!==w.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=8;break}throw new JN(qN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 8:return e.next=10,FH(h,this._screenStreamEncodeConfig[0]);case 10:if(f=e.sent,this._localScreenVideoTrack=new xH(f.getVideoTracks()[0],uP()),null===(r=d)||void 0===r||r.close(),null===(n=this.localScreenAudioTrack)||void 0===n||n.close(),this._localScreenAudioTrack=void 0,null!==(i=this._screenStreamEncodeConfig[0])&&void 0!==i&&i.contentHint&&this._localScreenVideoTrack.setContentHint(null===(p=this._screenStreamEncodeConfig[0])||void 0===p?void 0:p.contentHint),(_=null===(a=this._localScreenVideoTrack)||void 0===a?void 0:a.getTrack())&&(v=_.getSettings(),m={width:v.width,height:v.height},this._localScreenVideoTrack.resolution=m,setTimeout((function(){return g.safeEmit(ne.onLocalVideoSizeChanged,{streamIndex:U.STREAM_INDEX_SCREEN,info:{width:v.width,height:v.height}})}))),(y=f.getAudioTracks()).length&&(this._localScreenAudioTrack=new NH(y[0],uP()),this._initLocalTrackEvents(this._localScreenAudioTrack),void 0!==this._localScreenAudioTrackVolume&&this._localScreenAudioTrack.setCaptureVolume(this._localScreenAudioTrackVolume)),null===(s=this._screenPlayer)||void 0===s||s.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(u=this._room)||void 0===u||!u.hasScreenPublished){e.next=25;break}return e.next=25,this._updateScreenPublish();case 25:case"end":return e.stop()}}),e,this)}))),function(){return ve.apply(this,arguments)})},{key:"stopScreenCapture",value:(_e=u(o().mark((function e(){var t,r,n,i;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("stopScreenCapture()"),null===(t=this._screenPlayer)||void 0===t||t.stop(),null===(r=this._localScreenVideoTrack)||void 0===r||r.close(),this._localImgScreenTrack&&this._localScreenVideoTrack?(this._localScreenVideoTrack.setTrack(this._localImgScreenTrack),this._localScreenVideoTrack.dummy=!0):this._localScreenVideoTrack=void 0,null===(n=this._localScreenAudioTrack)||void 0===n||n.close(),this._localScreenAudioTrack=void 0,null===(i=this._room)||void 0===i||!i.hasScreenPublished){e.next=9;break}return e.next=9,this._updateScreenPublish();case 9:case"end":return e.stop()}}),e,this)}))),function(){return _e.apply(this,arguments)})},{key:"setLocalVideoPlayer",value:function(e,t){if(fJ.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),NP(e,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),t&&t.renderDom){var r,n,o=i({userId:this._getUserId()},t);if(HP(o),e===U.STREAM_INDEX_MAIN&&!this._videoPlayer)return this._videoPlayer=new rK(o),this._initPlayerEvents(this._videoPlayer),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&(null===(r=this._config)||void 0===r?void 0:r.autoPlayPolicy)!==Q.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement;if(e===U.STREAM_INDEX_SCREEN&&!this._screenPlayer)return this._screenPlayer=new rK(i(i({},o),{},{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Q.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement}else{var a,s;e===U.STREAM_INDEX_MAIN?(null===(a=this._videoPlayer)||void 0===a||a.destroy(),delete this._videoPlayer):(null===(s=this._screenPlayer)||void 0===s||s.destroy(),delete this._screenPlayer)}}},{key:"startLiveTranscoding",value:(pe=u(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("startLiveTranscoding()","transcode: %o",t),xP(t.url,"liveTranscode.url"),this._liveTranscodeConfig=t,e.prev=3,this.safeEmit(ne.onStreamMixingEvent,{event:iz.START,error:0,message:""}),e.next=7,null===(r=this._room)||void 0===r?void 0:r.liveControlMessage(zB("started",this._liveTranscodeConfig));case 7:e.next=16;break;case 9:if(e.prev=9,e.t0=e.catch(3),!(e.t0 instanceof JN)){e.next=15;break}throw e.t0;case 15:throw new JN(qN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 16:case"end":return e.stop()}}),e,this,[[3,9]])}))),function(e){return pe.apply(this,arguments)})},{key:"updateLiveTranscoding",value:(fe=u(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("updateLiveTranscoding()","transcode: %o",t),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return this._liveTranscodeConfig=RW(this._liveTranscodeConfig,t),e.prev=4,this.safeEmit(ne.onStreamMixingEvent,{event:iz.UPDATE,error:0,message:""}),e.next=8,null===(r=this._room)||void 0===r?void 0:r.liveControlMessage(zB("layoutChanged",this._liveTranscodeConfig));case 8:e.next=17;break;case 10:if(e.prev=10,e.t0=e.catch(4),!(e.t0 instanceof JN)){e.next=16;break}throw e.t0;case 16:throw new JN(qN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(e){return fe.apply(this,arguments)})},{key:"stopLiveTranscoding",value:(he=u(o().mark((function e(){var t;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("stopLiveTranscoding()"),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete this._liveTranscodeConfig,e.prev=4,this.safeEmit(ne.onStreamMixingEvent,{event:iz.STOP,error:0,message:""}),e.next=8,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage({action:"stopped",type:"transcode"});case 8:e.next=17;break;case 10:if(e.prev=10,e.t0=e.catch(4),!(e.t0 instanceof JN)){e.next=16;break}throw e.t0;case 16:throw new JN(qN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return he.apply(this,arguments)})},{key:"setBusinessId",value:function(e){return fJ.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(bB.setStats({rtc_business_id:e}),this._businessId=e,!0)}},{key:"setUserVisibility",value:(le=u(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("setUserVisibility()","enable: %o",t),t=!!t,this._visibility!==t){e.next=4;break}return e.abrupt("return");case 4:if(this._room){e.next=7;break}return this._visibility=t,e.abrupt("return");case 7:if(this._room.connectionState===Nz.CONNECTED){e.next=9;break}throw new JN(qN.NOT_CONNECTED_YET,"server not connected");case 9:if(this._room.localStream&&(null===(n=this._room.localStream.observer)||void 0===n||n.setPublisher(t)),e.t0=!t,!e.t0){e.next=14;break}return e.next=14,this._room.unpublish();case 14:return e.next=16,this._room.updateUserAttributes({role:t?eJ.NORMAL_USER:eJ.SILENT_USER});case 16:this._visibility=t,t&&null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoPublish&&this._updatePublish({mediaType:L.AUDIO_AND_VIDEO});case 18:case"end":return e.stop()}}),e,this)}))),function(e){return le.apply(this,arguments)})},{key:"_initPlayerEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.on("playback_event",(function(n){switch(n.eventName){case"timeupdate":return;case"loadeddata":if("audio"===n.type)r?t.safeEmit(ne.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:e.userId}):t.safeEmit(ne.onAudioFirstFrameDecoded,{userId:e.userId}),yB.firstRemoteAudioRender("",n.userId||"");else{var i,o,a={userId:e.userId,height:(null===(i=e.domElement)||void 0===i?void 0:i.videoHeight)||0,width:(null===(o=e.domElement)||void 0===o?void 0:o.videoWidth)||0};r?(a.publicStreamId=a.userId,delete a.userId,t.safeEmit(ne.onFirstPublicStreamVideoFrameDecoded,a),t.safeEmit(ne.onFirstPublicStreamVideoFrameRendered,a)):(t.safeEmit(ne.onVideoFirstFrameDecoded,a),t.safeEmit(ne.onVideoFirstFrameRendered,a)),yB.firstRemoteVideoRender("",n.userId||"")}break;case"autoplay-error":return r&&(n.publicStreamId=n.userId),void t.safeEmit(ne.onAutoplayFailed,{userId:n.userId||n.publicStreamId,kind:e instanceof rK?"video":"audio"})}t.safeEmit(ne.onPlayerEvent,n)}))}},{key:"_initLocalTrackEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.on("track-ended",(function(e){var r=!1;e!==t._localScreenAudioTrack&&e!==t._localScreenVideoTrack||(r=!0),t.safeEmit(ne.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})})),e.on("resolution-change",(function(e){t.safeEmit(ne.onLocalVideoSizeChanged,{streamIndex:r?U.STREAM_INDEX_SCREEN:U.STREAM_INDEX_MAIN,info:e})}))}},{key:"setRemoteVideoPlayer",value:function(e,t){fJ.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),NP(e,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),HP(t);var r,n,o,a=t.userId;if(e===U.STREAM_INDEX_MAIN){var s,u,c;if(null===(s=this._remoteVideoPlayer.get(a))||void 0===s||s.destroy(),!t.renderDom)return;var d=new rK(t);this._initPlayerEvents(d),this._remoteVideoPlayer.set(a,d);var l=null===(u=this._room)||void 0===u||null===(c=u.remoteStreams.get(a))||void 0===c?void 0:c.find((function(e){return!e.isScreen}));return l&&this._updateVideoPlayerState(l),d.domElement}if(null===(r=this._remoteScreenPlayer.get(a))||void 0===r||r.destroy(),t.renderDom){var h=new rK(i(i({},t),{},{isScreen:!0}));this._remoteScreenPlayer.set(a,h),this._initPlayerEvents(h);var f=null===(n=this._room)||void 0===n||null===(o=n.remoteStreams.get(a))||void 0===o?void 0:o.find((function(e){return e.isScreen}));return f&&this._updateVideoPlayerState(f),h.domElement}}},{key:"setLocalVideoMirrorType",value:function(e){fJ.print("setLocalVideoMirrorType()","mirrorType: %o",e),NP(e,"mirrorType",[B.MIRROR_TYPE_NONE,B.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)}},{key:"setAudioPlaybackDevice",value:(de=u(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("setAudioPlaybackDevice()","deviceId: %s",t),xP(t,"deviceId"),void 0!==HTMLAudioElement.prototype.setSinkId){e.next=5;break}return fJ.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),e.abrupt("return");case 5:return e.next=7,pH.enumerateAudioPlaybackDevices();case 7:if(r=e.sent,n=r.find((function(e){return e.deviceId===t}))){e.next=11;break}throw new JN(qN.INVALID_DEVICE_ID,"audio playback device id ".concat(t," is invalid"));case 11:this._remoteAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this._audioPlaybackDeviceId=t,n&&this.safeEmit(ne.onAudioPlaybackDeviceChanged,n),yB.rtcAudioDevice(oB.PLAYOUT_DEVICE_SWITCH,t,0);case 15:case"end":return e.stop()}}),e,this)}))),function(e){return de.apply(this,arguments)})},{key:"play",value:(ce=u(o().mark((function e(t){var r,n,i,a,s,u,c,d,l;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("play()","userId | publicStreamId: %s",t),s=null===(r=this._room)||void 0===r||null===(n=r.remoteStreams.get(t||""))||void 0===n?void 0:n.find((function(e){return!e.isScreen})),i=this._remoteAudioPlayer.get(t||""),a=this._remoteVideoPlayer.get(t||""),i||(i=this._publicStreamAudioPlayer.get(t||"")),a||(a=this._publicStreamVideoPlayer.get(t||"")),!t&&this._videoPlayer&&(a=this._videoPlayer),a&&(a.played?a.manuallyPlay():s&&s.videoTrack?a.playVideo(s.videoTrack,s):!t&&this._localVideoTrack&&(a.mirror(!!this._mirrorType),a.playVideo(this._localVideoTrack))),i&&(i.played?i.manuallyPlay():null!=s&&s.audioTrack&&(i.playAudio(s.audioTrack),(c=null==s||null===(u=s.audioTrack._audioLevelFetcher)||void 0===u?void 0:u._ctx)&&c.resume())),null!=s&&s.audioTrack&&(l=null==s||null===(d=s.audioTrack._audioLevelFetcher)||void 0===d?void 0:d._ctx)&&"suspended"===l.state&&l.resume(),t||!this._audioMixingManager){e.next=13;break}return e.next=13,this._audioMixingManager.resumeLocalPlay();case 13:case"end":return e.stop()}}),e,this)}))),function(e){return ce.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(ue=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("pauseAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),!this._pauseAllSubscribeState.audio||!this._pauseAllSubscribeState.video){e.next=4;break}return e.abrupt("return",Promise.resolve());case 4:if(r=function(){IP(t)&&(n._pauseAllSubscribeState.audio=!0),AP(t)&&(n._pauseAllSubscribeState.video=!0)},this._room){e.next=8;break}return r(),e.abrupt("return",Promise.resolve());case 8:return e.abrupt("return",this._room.pauseAllSubscribedStream(t).then((function(){r()})));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return ue.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(se=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("resumeAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),this._pauseAllSubscribeState.audio||this._pauseAllSubscribeState.video){e.next=4;break}return e.abrupt("return",Promise.resolve());case 4:if(r=function(){IP(t)&&(n._pauseAllSubscribeState.audio=!1),AP(t)&&(n._pauseAllSubscribeState.video=!1)},this._room){e.next=8;break}return r(),e.abrupt("return",Promise.resolve());case 8:return e.abrupt("return",this._room.resumeAllSubscribedStream(t).then((function(){var e,t;r(),null===(e=n._room)||void 0===e||null===(t=e.remoteStreams)||void 0===t||t.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){n._updateAudioPlayerState(e),n._updateVideoPlayerState(e)}))}))})));case 9:case"end":return e.stop()}}),e,this)}))),function(e){return se.apply(this,arguments)})},{key:"sendUserMessage",value:(ae=u(o().mark((function e(t,r){var n,i,a=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(FP(t),zP(r),this._room&&this._room.connectionState===Nz.CONNECTED){e.next=4;break}throw new JN(qN.IM_BEFORE_JOIN,"join first");case 4:return i=Date.now(),e.abrupt("return",null===(n=this._room.sendUserMessage(t,r))||void 0===n?void 0:n.then((function(e){return a._messageStatisticsObserver.countP2PMessage(!0,t,!1,i,e),e.id})).catch((function(e){throw a._messageStatisticsObserver.countP2PMessage(!1,t,!1,i),e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return ae.apply(this,arguments)})},{key:"sendUserBinaryMessage",value:(oe=u(o().mark((function e(t,r){var n,i,a=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(FP(t),PP(r,"message"),zP(r),this._room&&this._room.connectionState===Nz.CONNECTED){e.next=5;break}throw new JN(qN.IM_BEFORE_JOIN,"join first");case 5:return i=Date.now(),e.abrupt("return",null===(n=this._room.sendUserMessage(t,r))||void 0===n?void 0:n.then((function(e){return a._messageStatisticsObserver.countP2PMessage(!0,t,!0,i,e),e.id})).catch((function(e){throw a._messageStatisticsObserver.countP2PMessage(!1,t,!0,i),e})));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return oe.apply(this,arguments)})},{key:"sendRoomMessage",value:(ie=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(zP(t),this._room&&this._room.connectionState===Nz.CONNECTED){e.next=3;break}throw new JN(qN.IM_BEFORE_JOIN,"join first");case 3:return r=Date.now(),e.abrupt("return",this._room.sendRoomMessage(t).then((function(e){var t,i;return n._messageStatisticsObserver.countRoomMessage(!0,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!1,r),e})).catch((function(e){var t,i;throw n._messageStatisticsObserver.countRoomMessage(!1,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!1,r),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return ie.apply(this,arguments)})},{key:"sendRoomBinaryMessage",value:(re=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(zP(t),this._room&&this._room.connectionState===Nz.CONNECTED){e.next=3;break}throw new JN(qN.IM_BEFORE_JOIN,"join first");case 3:return r=Date.now(),e.abrupt("return",this._room.sendRoomMessage(t,!0).then((function(e){var t,i;return n._messageStatisticsObserver.countRoomMessage(!0,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!0,r),e})).catch((function(e){var t,i;throw n._messageStatisticsObserver.countRoomMessage(!1,null===(t=n._room)||void 0===t||null===(i=t.roomInfo)||void 0===i?void 0:i.roomId,!0,r),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return re.apply(this,arguments)})},{key:"setAudioCaptureConfig",value:(te=u(o().mark((function e(){var t,r,n,i=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},fJ.print("setAudioCaptureConfig()","config: %o",t),delete t.deviceId,MP(t),r=this._audioStreamConstraints.deviceId,this._audioStreamConstraints=t,r&&(this._audioStreamConstraints.deviceId=r),!this._localAudioTrack){e.next=11;break}return this._localAudioTrack.audioCaptureConfig=this._audioStreamConstraints,e.next=11,null===(n=this._localAudioTrack)||void 0===n?void 0:n.updateAudioCaptureConfig();case 11:case"end":return e.stop()}}),e,this)}))),function(){return te.apply(this,arguments)})},{key:"setVideoCaptureConfig",value:($=u(o().mark((function e(){var t,r,n,i=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},fJ.print("setVideoCaptureConfig()","config: %o",t),delete t.deviceId,MP(t),r=this._videoStreamConstraints.deviceId,this._videoStreamConstraints=t,r&&(this._videoStreamConstraints.deviceId=r),!this._localVideoTrack){e.next=12;break}return this._localVideoTrack.videoCaptureConfig=this._videoStreamConstraints,e.next=11,null===(n=this._localVideoTrack)||void 0===n?void 0:n.updateVideoCaptureConfig();case 11:this._updatePublish();case 12:case"end":return e.stop()}}),e,this)}))),function(){return $.apply(this,arguments)})},{key:"enableSimulcastMode",value:function(e){return fJ.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0}},{key:"setVideoEncoderConfig",value:(Z=u(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:fJ.print("setVideoEncoderConfig()"," descriptions: %o",t),Array.isArray(t)||(t=[t]),t.length>3&&(t=t.slice(0,3)),t.sort((function(e,t){return t.maxKbps-e.maxKbps})),this._videoStreamEncodeConfig=t,null!==(r=this._room)&&void 0!==r&&r.hasPublished&&this._updatePublish();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return Z.apply(this,arguments)})},{key:"setScreenEncoderConfig",value:(J=u(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:fJ.print("setScreenEncoderConfig()","description: %o",t),this._screenStreamEncodeConfig=[t],this._localScreenVideoTrack&&(this._localScreenVideoTrack.videoCaptureConfig=t,this._localScreenVideoTrack.updateVideoCaptureConfig(),t.contentHint&&this._localScreenVideoTrack.setContentHint(t.contentHint)),null!==(r=this._room)&&void 0!==r&&r.hasScreenPublished&&this._updateScreenPublish();case 4:case"end":return e.stop()}}),e,this)}))),function(e){return J.apply(this,arguments)})},{key:"sendSEIMessage",value:function(e,t,r){fJ.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),NP(e,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),OP(r,"repeatCount",0,30);var n="string"==typeof t?new Uint8Array(hP.str2ab(t)):t;if(t.length){var i;if(e===U.STREAM_INDEX_MAIN){var o,a,s;if(null===(o=this._room)||void 0===o||null===(a=o.localStream)||void 0===a||!a.hasPublished)return;i=null===(s=this._room)||void 0===s?void 0:s.localStream}else{var u,c,d;if(null===(u=this._room)||void 0===u||null===(c=u.localScreenStream)||void 0===c||!c.hasPublished)return;i=null===(d=this._room)||void 0===d?void 0:d.localScreenStream}if(n.byteLength>4096)fJ.print("sei size must not bigger than 4KB");else{var l=uP();i.seiList.push({content:n,uuid:l,repeatCount:r}),setTimeout((function(){if(i){var e=i.seiList.findIndex((function(e){return e.uuid===l}));e&&i.seiList.splice(e,1)}}),2e3)}}else fJ.print("sei message must not be empty")}},{key:"setAudioVolumeIndicationInterval",value:function(e){var t=this;fJ.print("setAudioVolumeIndicationInterval()","interval %o: ",e),("number"!=typeof e||e<200)&&(e=200);var r=[];this._audioVolumeIndicationTimer&&clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=setInterval((function(){var e,n;r=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var n;if(0!==e.length){var i=e.find((function(e){return!1===e.isScreen})),o=null==i||null===(n=i.audioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:t,volume:o||0})}}));var i=null===(n=t._localAudioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:t._getUserId(),volume:i||0}),t.safeEmit(ne.onAudioVolumeIndication,{speakers:r})}),e)}},{key:"_sendActiveSpeaker",value:function(e,t){if(this._room&&this._room.remoteUsers.size>=1){var r,n=e[0],i=t.reduce((function(e,t){return e&&e.audioPropertiesInfo.nonlinearVolume>t.audioPropertiesInfo.nonlinearVolume?e:t}),void 0);if((r=n?i?n.audioPropertiesInfo.nonlinearVolume>i.audioPropertiesInfo.nonlinearVolume?n:i:n:i)&&r.audioPropertiesInfo.nonlinearVolume>-60){var o,a;if(r.streamKey)o=this._room.remoteUsers.get(r.streamKey.userId);else o=null===(a=this._room._roomInfo)||void 0===a?void 0:a.userInfo;o&&this.safeEmit(ne.onActiveSpeaker,{userId:o.userId,extraInfo:o.extraInfo})}}}},{key:"enableAudioPropertiesReport",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};fJ.print("enableAudioPropertiesReport()","config %o: ",t);var r=t.enableInBackground,n=void 0===r||r,i=t.interval,o=void 0===i?100:i;this._stopAudioPropertiesReport(),o<=0||(o=Math.max(100,o),this._audioPropertiesReportTimer=self.setInterval((function(){if(n||"hidden"!==document.visibilityState){var t=[],r=e._audioDeviceManager.getRecordTrack()||e._localAudioTrack;if(r){var i=r.getAudioLevel();t.push({streamIndex:U.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:TP(i)}})}if(e._localScreenAudioTrack){var o=e._localScreenAudioTrack.getAudioLevel();t.push({streamIndex:U.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:o,nonlinearVolume:TP(o)}})}if(e.safeEmit(ne.onLocalAudioPropertiesReport,t),e._room){var a=[];e._room.remoteStreams.forEach((function(t,r){t.forEach((function(t){if(t.audioTrack){var n,i,o=t.audioTrack.getAudioLevel();a.push({streamKey:{userId:r,streamIndex:t.isScreen?U.STREAM_INDEX_SCREEN:U.STREAM_INDEX_MAIN,roomId:null===(n=e._room)||void 0===n||null===(i=n.roomInfo)||void 0===i?void 0:i.roomId},audioPropertiesInfo:{linearVolume:o,nonlinearVolume:TP(o)}})}}))})),e._sendActiveSpeaker(t,a.filter((function(e){return e.streamKey.streamIndex!==U.STREAM_INDEX_SCREEN}))),e.safeEmit(ne.onRemoteAudioPropertiesReport,a)}}}),o))}},{key:"setVideoSourceType",value:(q=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p,_,v,m,y,g,S,b,E,k,T;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("setVideoSourceType()","index: %o, videoSourceType: %o",t,r),NP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),NP(r,"VideoSourceType",[R.VIDEO_SOURCE_TYPE_EXTERNAL,R.VIDEO_SOURCE_TYPE_INTERNAL]),n=t===U.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[n]===r){e.next=26;break}if(this._trackSourceType[n]=r,fJ.print("setVideoSourceType","set ".concat(n," source type to ").concat(r)),!this._localVideoTrack||t!==U.STREAM_INDEX_MAIN){e.next=17;break}if(u=!1,r===R.VIDEO_SOURCE_TYPE_EXTERNAL&&(u=!0,this._localVideoTrack.close()),null===(i=this._videoPlayer)||void 0===i||i.stop(),this._localVideoTrack=void 0,c=null===(a=this._room)||void 0===a?void 0:a._roomConfig.isAutoPublish,u?null===(d=this._room)||void 0===d||null===(l=d.localStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setEnableVideo(!1):null===(f=this._room)||void 0===f||null===(p=f.localStream)||void 0===p||null===(_=p.observer)||void 0===_||_.setPushVideo(!1),!(null!==(s=this._room)&&void 0!==s&&s.hasPublished||c)){e.next=17;break}return e.next=17,this._updatePublish();case 17:if(!this._localScreenVideoTrack||t!==U.STREAM_INDEX_SCREEN){e.next=26;break}if(y=!1,r===R.VIDEO_SOURCE_TYPE_EXTERNAL&&(y=!0,this._localScreenVideoTrack.close()),null===(v=this._screenPlayer)||void 0===v||v.stop(),this._localScreenVideoTrack=void 0,y?null===(g=this._room)||void 0===g||null===(S=g.localScreenStream)||void 0===S||null===(b=S.observer)||void 0===b||b.setEnableVideo(!1):null===(E=this._room)||void 0===E||null===(k=E.localScreenStream)||void 0===k||null===(T=k.observer)||void 0===T||T.setPushVideo(!1),null===(m=this._room)||void 0===m||!m.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return q.apply(this,arguments)})},{key:"setExternalVideoTrack",value:(X=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("setExternalVideoTrack()","index: %o, track: %o",t,r),NP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),t!==U.STREAM_INDEX_MAIN){e.next=12;break}if(this._trackSourceType.video===R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new JN(qN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 5:if(this._localVideoTrack=new DH(r,uP()),this._initLocalTrackEvents(this._localVideoTrack),null===(n=this._videoPlayer)||void 0===n||n.playVideo(this._localVideoTrack),s=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,!(null!==(a=this._room)&&void 0!==a&&a.hasPublished||s)){e.next=12;break}return e.next=12,this._updatePublish();case 12:if(t!==U.STREAM_INDEX_SCREEN){e.next=22;break}if(this._trackSourceType.screenVideo===R.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=15;break}throw new JN(qN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 15:if(this._localScreenVideoTrack=new DH(r,uP()),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(u=this._screenPlayer)||void 0===u||u.playVideo(this._localScreenVideoTrack),null===(c=this._room)||void 0===c||null===(d=c.localScreenStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setPushVideo(!0),null===(h=this._room)||void 0===h||!h.hasScreenPublished){e.next=22;break}return e.next=22,this._updateScreenPublish();case 22:case"end":return e.stop()}}),e,this)}))),function(e,t){return X.apply(this,arguments)})},{key:"setAudioSourceType",value:(z=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f,p,_,v,m,y,g,S,b,E;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("setAudioSourceType()","index: %o, audioSourceType: %o",t,r),NP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),NP(r,"audioSourceType",[w.AUDIO_SOURCE_TYPE_EXTERNAL,w.AUDIO_SOURCE_TYPE_INTERNAL]),n=t===U.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[n]===r){e.next=24;break}if(this._trackSourceType[n]=r,fJ.print("setVideoSourceType","set ".concat(n," source type to ").concat(r)),!this._localAudioTrack||t!==U.STREAM_INDEX_MAIN){e.next=16;break}if(s=!1,this._trackSourceType.audio===w.AUDIO_SOURCE_TYPE_EXTERNAL&&(s=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,u=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,s?null===(c=this._room)||void 0===c||null===(d=c.localStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setEnableAudio(!1):null===(h=this._room)||void 0===h||null===(f=h.localStream)||void 0===f||null===(p=f.observer)||void 0===p||p.setPushAudio(!1),!(null!==(a=this._room)&&void 0!==a&&a.hasPublished||u)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(!this._localScreenAudioTrack||t!==U.STREAM_INDEX_SCREEN){e.next=24;break}if(v=!1,this._trackSourceType.audio===w.AUDIO_SOURCE_TYPE_EXTERNAL&&(v=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,v?null===(m=this._room)||void 0===m||null===(y=m.localScreenStream)||void 0===y||null===(g=y.observer)||void 0===g||g.setEnableAudio(!1):null===(S=this._room)||void 0===S||null===(b=S.localScreenStream)||void 0===b||null===(E=b.observer)||void 0===E||E.setPushAudio(!1),null===(_=this._room)||void 0===_||!_.hasScreenPublished){e.next=24;break}return e.next=24,this._updateScreenPublish();case 24:case"end":return e.stop()}}),e,this)}))),function(e,t){return z.apply(this,arguments)})},{key:"setExternalAudioTrack",value:(H=u(o().mark((function e(t,r){var n,i,a,s,u,c,d,l,h,f;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("setExternalAudioTrack()","index: %o, track: %o",t,r),NP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),t!==U.STREAM_INDEX_MAIN){e.next=12;break}if(this._trackSourceType.audio===w.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new JN(qN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 5:if(this._localAudioTrack=new PH(r,uP()),this._initLocalTrackEvents(this._localAudioTrack),c=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,null===(i=this._room)||void 0===i||null===(a=i.localStream)||void 0===a||null===(s=a.observer)||void 0===s||s.setPushAudio(!0),!(null!==(u=this._room)&&void 0!==u&&u.hasPublished||c)){e.next=12;break}return e.next=12,this._updatePublish();case 12:if(t!==U.STREAM_INDEX_SCREEN){e.next=21;break}if(this._trackSourceType.screenAudio===w.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=15;break}throw new JN(qN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 15:if(this._localScreenAudioTrack=new PH(r,uP()),this._initLocalTrackEvents(this._localScreenAudioTrack),null===(d=this._room)||void 0===d||null===(l=d.localScreenStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setPushAudio(!0),null===(f=this._room)||void 0===f||!f.hasScreenPublished){e.next=21;break}return e.next=21,this._updateScreenPublish();case 21:case"end":return e.stop()}}),e,this)}))),function(e,t){return H.apply(this,arguments)})},{key:"login",value:(G=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("login()","token: %o, userInfo: %o",t,r),LP(t)||xP(t,"token"),FP(r),e.abrupt("return",this._rtmClient.login(t,r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return G.apply(this,arguments)})},{key:"logout",value:(j=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("logout()"),e.abrupt("return",this._rtmClient.logout());case 2:case"end":return e.stop()}}),e,this)}))),function(){return j.apply(this,arguments)})},{key:"updateLoginToken",value:(M=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("updateLoginToken()","token: %o",t),LP(t)||xP(t,"token"),e.abrupt("return",this._rtmClient.updateLoginToken(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return M.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(P=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("getPeerOnlineStatus()","userId: %o",t),FP(t),e.abrupt("return",this._rtmClient.getPeerOnlineStatus(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return P.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(x=u(o().mark((function e(t,r){var n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return FP(t),zP(r),n=Date.now(),e.prev=3,e.abrupt("return",this._rtmClient.sendUserMessageOutsideRoom(t,r).then((function(e){return i._messageStatisticsObserver.countUserMessageOutsideRoom(!0,t,!1,n,e),e.id})).catch((function(e){throw i._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!1,n),e})));case 7:throw e.prev=7,e.t0=e.catch(3),this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!1,n),e.t0;case 11:case"end":return e.stop()}}),e,this,[[3,7]])}))),function(e,t){return x.apply(this,arguments)})},{key:"sendUserBinaryMessageOutsideRoom",value:(O=u(o().mark((function e(t,r){var n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return FP(t),PP(r,"message"),zP(r),n=Date.now(),e.prev=4,e.abrupt("return",this._rtmClient.sendUserMessageOutsideRoom(t,r).then((function(e){return i._messageStatisticsObserver.countUserMessageOutsideRoom(!0,t,!0,n,e),e.id})).catch((function(e){throw i._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!0,n),e})));case 8:throw e.prev=8,e.t0=e.catch(4),this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!0,n),e.t0;case 12:case"end":return e.stop()}}),e,this,[[4,8]])}))),function(e,t){return O.apply(this,arguments)})},{key:"setServerParams",value:(C=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("setServerParams()","signature: %o, url: %0",t,r),e.abrupt("return",this._rtmClient.setServerParams(t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return C.apply(this,arguments)})},{key:"sendServerMessage",value:(A=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return xP(t,"message"),zP(t),r=Date.now(),e.prev=3,e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(){n._messageStatisticsObserver.countServerMessage(!0,!1,r)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!1,r),e})));case 7:throw e.prev=7,e.t0=e.catch(3),this._messageStatisticsObserver.countServerMessage(!1,!1,r),e.t0;case 11:case"end":return e.stop()}}),e,this,[[3,7]])}))),function(e){return A.apply(this,arguments)})},{key:"sendServerBinaryMessage",value:(I=u(o().mark((function e(t){var r,n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return PP(t,"message"),zP(t),r=Date.now(),e.prev=3,e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(){n._messageStatisticsObserver.countServerMessage(!0,!0,r)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!0,r),e})));case 7:throw e.prev=7,e.t0=e.catch(3),this._messageStatisticsObserver.countServerMessage(!1,!0,r),e.t0;case 11:case"end":return e.stop()}}),e,this,[[3,7]])}))),function(e){return I.apply(this,arguments)})},{key:"startCloudProxy",value:function(e){if(this._room)throw new JN(qN.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");fJ.print("startCloudProxy()",e),xP(e.logProxy,"logProxy"),xP(e.accessProxy,"accessProxy"),xP(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=HB("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=HB("LOG_SERVER_URL"),this._originConfigServerUrls=HB("CONFIG_REQUEST_DOMAINS"),GB("ICE_CONFIG_REQUEST_URLS",e.accessProxy),GB("LOG_SERVER_URL",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^https?:\/\/.+/.test(e)||(e="https://"+e),"".concat(e,"/video/v1/webrtc_log/")}(e.logProxy)),GB("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0}},{key:"stopCloudProxy",value:function(){if(this._room)throw new JN(qN.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");fJ.print("stopCloudProxy()"),GB("ICE_CONFIG_REQUEST_URLS",[]),GB("LOG_SERVER_URL",this._originLogServerUrl),GB("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0}},{key:"startPushPublicStream",value:(T=u(o().mark((function e(t,r){var n,i=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),BP(t),this._room&&this._room.connectionState===Nz.CONNECTED){e.next=4;break}throw new JN(qN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");case 4:if(!this._publicStreamIds.get(t)){e.next=6;break}throw new JN(qN.REPEAT_PUSH,"repeat push public media stream");case 6:return n=KB(t,"started",r),e.abrupt("return",this._room.publicStreamControlMessage(n).then((function(){i._publicStreamIds.set(t,t)})));case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return T.apply(this,arguments)})},{key:"updatePublicStreamParam",value:(k=u(o().mark((function e(t,r){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),BP(t),this._room&&this._room.connectionState===Nz.CONNECTED){e.next=4;break}throw new JN(qN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");case 4:return n=KB(t,"layoutChanged",r),e.abrupt("return",this._room.publicStreamControlMessage(n));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return k.apply(this,arguments)})},{key:"stopPushPublicStream",value:(E=u(o().mark((function e(t){var r=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("startPushPublicStream()","publicStreamId: %o",t),BP(t),this._room&&this._room.connectionState===Nz.CONNECTED){e.next=4;break}throw new JN(qN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");case 4:return e.abrupt("return",this._room.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:t}).then((function(){r._publicStreamIds.delete(t)})));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return E.apply(this,arguments)})},{key:"startPlayPublicStream",value:(S=u(o().mark((function e(t){var r,n,i,a,s,u,c=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(BP(t),this._outsideRoom){e.next=8;break}return this._outsideRoom=new nJ(this._appId),this._outsideRoom.on(nz.RESUBSCRIBE,(function(e){var t=e.stream;if(t){var r,n=c._publicStreamAudioPlayer.get(t.streamId);n&&t.audioTrack&&(n.stop(),n.playAudio(null===(r=e.stream)||void 0===r?void 0:r.audioTrack));var i,o=c._publicStreamVideoPlayer.get(t.streamId);o&&t.videoTrack&&o.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(r=this._outsideRoom)||void 0===r||r.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,c.safeEmit(ne.onPublicStreamStats,e)})),null===(n=this._outsideRoom)||void 0===n||n.on(nz.ON_SEI_MESSAGED_RECEIVED,(function(e){c.safeEmit(ne.onPublicStreamSEIMessageReceived,e)})),e.next=8,this._outsideRoom.connect();case 8:return e.next=10,this._outsideRoom.startPlayPublicStream(t);case 10:i=e.sent,(a=this._publicStreamVideoPlayer.get(t))&&null!=i&&i.videoTrack&&a.playVideo(i.videoTrack,i),!(s=this._publicStreamAudioPlayer.get(t))&&null!=i&&i.audioTrack&&(s=new nK(t,{muted:(null===(u=this._config)||void 0===u?void 0:u.autoPlayPolicy)===Q.VIDEO_ONLY}),this._initPlayerEvents(s,!0),s.playAudio(i.audioTrack),this._publicStreamAudioPlayer.set(t,s));case 15:case"end":return e.stop()}}),e,this)}))),function(e){return S.apply(this,arguments)})},{key:"stopPlayPublicStream",value:(y=u(o().mark((function e(t){var r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._outsideRoom){e.next=2;break}return e.abrupt("return");case 2:this._outsideRoom.stopPlayPublicStream(t),(r=this._publicStreamAudioPlayer.get(t))&&(r.destroy(),this._publicStreamAudioPlayer.delete(t));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"setAudioProfile",value:(v=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._audioProfileManager.setAudioProfile(t);case 1:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"setPublicStreamVideoPlayer",value:function(e,t){var r,n,o,a;fJ.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var s=this._publicStreamVideoPlayer.get(e);if(null===(r=s)||void 0===r||r.destroy(),null!=t&&t.renderDom){s=new rK(i(i({},t),{},{userId:e})),this._initPlayerEvents(s,!0),this._publicStreamVideoPlayer.set(e,s);var u=null===(n=this._outsideRoom)||void 0===n||null===(o=n.remoteStreams)||void 0===o?void 0:o.get(e);null!=u&&u.videoTrack&&(null===(a=this._config)||void 0===a?void 0:a.autoPlayPolicy)!==Q.PLAY_MANUALLY&&s.playVideo(u.videoTrack,u)}else this._publicStreamVideoPlayer.delete(e)}},{key:"setDummyCaptureImagePath",value:(_=u(o().mark((function e(t,r){var n=this;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,i){xP(r,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=r,o.onload=function(){try{var r=document.createElement("canvas"),a=r.getContext("2d");if(!a)return i(new JN(qN.UNEXPECTED_ERROR,"Not support canvas"));r.width=o.width,r.height=o.height,a.drawImage(o,0,0,o.width,o.height),clearInterval(n._dummyTimer),n._dummyTimer=window.setInterval((function(){a.drawImage(o,0,0,o.width,o.height)}),200);var s=r.captureStream(5).getVideoTracks()[0];t===U.STREAM_INDEX_MAIN?n._localImgVideoTrack=s:n._localImgScreenTrack=s,e()}catch(u){i(new JN(qN.UNEXPECTED_ERROR,u.message))}},o.onerror=function(){i(new JN(qN.UNEXPECTED_ERROR,"Load image error"))}})));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return _.apply(this,arguments)})},{key:"defaultTranscoding",value:function(){return JSON.parse(JSON.stringify(XB))}},{key:"_updatePublish",value:(d=u(o().mark((function e(){var t,r,n,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:{},fJ.print("_updatePublish()","config: %o",t),r={mediaType:void 0,invokeByJoinRoom:!1,pubState:oz.PUB},t=i(i({},r),t),this._visibility){e.next=6;break}throw new JN(qN.NO_PUBLISH_PERMISSION,"no publish permission");case 6:return e.next=8,this._pubLock.lock();case 8:if(n=e.sent,this._room&&this._room.connectionState===Nz.CONNECTED){e.next=12;break}return n(),e.abrupt("return");case 12:return e.prev=12,e.next=15,this._room.publish(this._videoStreamEncodeConfig,this._enableSimulcast,this._localVideoTrack,this._localAudioTrack,t.mediaType,t.pubState,t.invokeByJoinRoom);case 15:e.next=24;break;case 17:if(e.prev=17,e.t0=e.catch(12),!(e.t0 instanceof JN)){e.next=23;break}throw e.t0;case 23:throw new JN(qN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 24:return e.prev=24,n(),e.finish(24);case 27:case"end":return e.stop()}}),e,this,[[12,17,24,27]])}))),function(){return d.apply(this,arguments)})},{key:"startAudioPlaybackDeviceTest",value:(s=u(o().mark((function e(t,r){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",t,r),xP(t,"filePath"),OP(r,"indicationInterval"),e.next=5,this._audioDeviceManager.startAudioPlaybackDeviceTest(t,r);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){fJ.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()}},{key:"startAudioDeviceRecordTest",value:(a=u(o().mark((function e(t){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fJ.print("startAudioDeviceRecordTest()","indicationInterval: %o",t),OP(t,"indicationInterval"),e.next=4,this._audioDeviceManager.startAudioDeviceRecordTest(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){fJ.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()}},{key:"stopAudioDevicePlayTest",value:function(){fJ.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()}},{key:"setRemoteUserPriority",value:function(e,t){var r;fJ.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{FP(e),NP(t,"priority",[W.HIGH,W.MEDIUM,W.LOW])}catch(n){return console.warn(n),!1}return this._userPriorityMap.set(e,t),null===(r=this._room)||void 0===r||r.setRemoteUserPriority(e,t),!0}},{key:"takeLocalSnapshot",value:(n=u(o().mark((function e(t){var r,n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("takeLocalSnapshot()","streamIndex: %o",t),NP(t,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),r=t===U.STREAM_INDEX_MAIN?this.localVideoTrack:this.localScreenVideoTrack){e.next=5;break}throw new JN(qN.INVOKED_BEFORE_CAPTURE,"capture first");case 5:return n=t===U.STREAM_INDEX_MAIN?this._videoPlayer:this._screenPlayer,e.abrupt("return",cJ(r.getTrack(),(null==n?void 0:n.mirrorType)===B.MIRROR_TYPE_RENDER,n));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"takeRemoteSnapshot",value:(r=u(o().mark((function e(t,r){var n,i,a,s,u,c;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(fJ.print("takeRemoteSnapshot()","id: %o, streamIndex: %o",t,r),xP(t,"id"),NP(r,"streamIndex",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),c=(null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(t))||void 0===i||null===(a=i.find((function(e){return e.isScreen===(r===U.STREAM_INDEX_SCREEN)})))||void 0===a?void 0:a.videoTrack)||(null===(s=this._outsideRoom)||void 0===s||null===(u=s.remoteStreams.get(t))||void 0===u?void 0:u.videoTrack)){e.next=6;break}throw new JN(qN.STREAM_NOT_EXIST,"stream not exist");case 6:return e.abrupt("return",cJ(c.getTrack(),!1,r===U.STREAM_INDEX_MAIN?this._remoteVideoPlayer.get(t):this._remoteScreenPlayer.get(t)));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setSubscribeFallbackOption",value:function(e){fJ.print("setSubscribeFallbackOption()","option: %o",e);try{NP(e,"option",[K.DISABLE,K.VIDEO_STREAM_LOW,K.AUDIO_ONLY])}catch(t){return console.warn(t),!1}return!this._room&&(this._subscribeFallbackOption=e,!0)}},{key:"_updateScreenPublish",value:(t=u(o().mark((function e(){var t,r,n,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=a.length>0&&void 0!==a[0]?a[0]:{},fJ.print("_updateScreenPublish()"),r={mediaType:void 0,pubState:oz.PUB},t=i(i({},r),t),e.next=6,this._pubLock.lock();case 6:if(n=e.sent,this._room&&this._room.connectionState===Nz.CONNECTED){e.next=10;break}return n(),e.abrupt("return");case 10:return e.prev=10,e.next=13,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack,t.mediaType,t.pubState);case 13:e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(10),!(e.t0 instanceof JN)){e.next=21;break}throw e.t0;case 21:throw new JN(qN.UNEXPECTED_ERROR,"unexpected error",e.t0);case 22:return e.prev=22,n(),e.finish(22);case 25:case"end":return e.stop()}}),e,this,[[10,15,22,25]])}))),function(){return t.apply(this,arguments)})},{key:"_setCaptureVolume",value:function(e,t){var r;0===t&&fJ.print("setCaptureVolume: ",t),NP(e,"streamType",[U.STREAM_INDEX_MAIN,U.STREAM_INDEX_SCREEN]),OP(t,"volume",0,400);var n=!1;e===U.STREAM_INDEX_MAIN?(this._localAudioTrack&&(n=!!this._localAudioTrack.gainAudioTrack,this._localAudioTrack.setCaptureVolume(t)),this._localAudioTrackVolume=t):e===U.STREAM_INDEX_SCREEN&&(this._localScreenAudioTrack&&(n=!!this._localScreenAudioTrack.gainAudioTrack,this._localScreenAudioTrack.setCaptureVolume(t)),this._localScreenAudioTrackVolume=t),null!==(r=this._room)&&void 0!==r&&r.hasPublished&&!n&&this._updatePublish()}},{key:"_updateAudioPlayerState",value:function(e){fJ.print("_updateAudioPlayerState()");var t,r=e.userId,n=e.isScreen;if(t=n?this._remoteAudioPlayer.get("".concat(r,"_screen")):this._remoteAudioPlayer.get(r),e.audioTrack&&(e.attributes.audiostream&&e.subAudio||this.multiChatMode)){var i;if(!t){var o,a=n?"".concat(r,"_screen"):r;t=new nK(a,{muted:(null===(o=this._config)||void 0===o?void 0:o.autoPlayPolicy)===Q.VIDEO_ONLY}),this._initPlayerEvents(t),this._remoteAudioPlayer.set(a,t),this._audioPlaybackDeviceId&&t.setPlaybackDevice(this._audioPlaybackDeviceId)}(null===(i=this._config)||void 0===i?void 0:i.autoPlayPolicy)!==Q.PLAY_MANUALLY&&t.playAudio(e.audioTrack)}else{var s;null===(s=t)||void 0===s||s.stop()}}},{key:"_updateVideoPlayerState",value:function(e){var t;fJ.print("_updateVideoPlayerState()");var r,n,i=e.userId;if(r=e.isScreen?this._remoteScreenPlayer.get(i):this._remoteVideoPlayer.get(i),e.videoTrack)r&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Q.PLAY_MANUALLY&&r.playVideo(e.videoTrack,e);else if(null!==(t=r)&&void 0!==t&&t.played){var o;null===(o=r)||void 0===o||o.stop()}}},{key:"_onAddStream",value:function(e){var t=e.stream,r=null==t?void 0:t.attributes,n=r.localaudio,i=r.audiostream,o=r.localvideo,a=r.videostream,s=jH.NONE;if(i&&(s|=L.AUDIO),a&&(s|=L.VIDEO),s){var u;if(null!=t&&t.isScreen)this.safeEmit(ne.onUserPublishScreen,{userId:t.userId,mediaType:s});else this.safeEmit(ne.onUserPublishStream,{userId:t.userId,mediaType:s,videoStreamDescriptions:null==t||null===(u=t.attributes)||void 0===u?void 0:u.videoDescriptions}),this._handleAutoSubscribe(t,!0);this.safeEmit("onAddStream",{userId:t.userId,mediaType:s,isScreen:!(null==t||!t.isScreen)}),null!=t&&t.isScreen||(n&&this.safeEmit(ne.onUserStartAudioCapture,{userId:t.userId}),o&&this.safeEmit(ne.onUserStartVideoCapture,{userId:t.userId}))}}},{key:"_handleAutoSubscribe",value:function(e,t){var r,n,i=jH.NONE;if(null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoSubscribeAudio&&(i|=L.AUDIO),null!==(n=this._roomConfig)&&void 0!==n&&n.isAutoSubscribeVideo&&(i|=L.VIDEO),fJ.print("_onAddStream","autoSubType: ".concat(i)),i){var o,a;if(t&&IP(i))null===(o=e.observer)||void 0===o||o.setAutoSubscribeAudio(!0);if(t&&AP(i))null===(a=e.observer)||void 0===a||a.setAutoSubscribeVideo(!0);this._subscribe(!1,e.userId,i)}}},{key:"_onRemoveStream",value:function(e){var t,r=this,n=e.stream,i=null!==(t=_J[e.reason])&&void 0!==t?t:V.STREAM_REMOVE_REASON_OTHER,o=n.isScreen?ne.onUserUnpublishScreen:ne.onUserUnpublishStream,a=jH.NONE;n.attributes.audiostream&&(a|=L.AUDIO),n.attributes.videostream&&(a|=L.VIDEO),null!=n&&n._workaround_1_&&(a=L.VIDEO),a!==jH.NONE&&(this.safeEmit(o,{userId:n.userId,mediaType:a,reason:i}),this.safeEmit("onRemoveStream",{userId:n.userId,isScreen:n.isScreen})),this._getRemotePlayer(n.userId,n.isScreen).forEach((function(e){if(null==n||!n._workaround_1_){var t=n.isScreen?"".concat(n.userId,"_screen"):n.userId;r._remoteAudioPlayer.delete(t),n.isScreen?r._remoteScreenPlayer.delete(n.userId):r._remoteVideoPlayer.delete(n.userId),null==e||e.destroy()}}))}},{key:"_onUserConnection",value:function(e){this.safeEmit(ne.onUserJoined,e)}},{key:"_onUserLeave",value:function(e){this.safeEmit(ne.onUserLeave,e)}},{key:"_onRoomError",value:function(e){var t;this.safeEmit(ne.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0}},{key:"_onNetworkQuality",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.safeEmit.apply(this,[ne.onNetworkQuality].concat(t))}},{key:"_onConnectionStateChange",value:function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===F.CONNECTION_STATE_CONNECTED&&this.safeEmit(ne.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(ne.onConnectionStateChanged,e)}},{key:"_getRemotePlayer",value:function(e,t){return[this._remoteAudioPlayer.get(t?"".concat(e,"_screen"):e),(t?this._remoteScreenPlayer:this._remoteVideoPlayer).get(e)]}},{key:"_stopAudioPropertiesReport",value:function(){null!==this._audioPropertiesReportTimer&&(clearInterval(this._audioPropertiesReportTimer),this._audioPropertiesReportTimer=null)}},{key:"_onResubscribe",value:function(e){e.stream&&(this._getRemotePlayer(e.stream.userId,e.stream.isScreen).forEach((function(e){return null==e?void 0:e.stop()})),this._updateAudioPlayerState(e.stream),this._updateVideoPlayerState(e.stream))}},{key:"_onSubscribePushTrack",value:function(e){e.stream&&this._updateAudioPlayerState(e.stream)}},{key:"_onRemovePushTrack",value:function(e){e.stream&&this._updateAudioPlayerState(e.stream)}},{key:"_onVideoFirstFrameDecoded",value:function(e){this.safeEmit(ne.onVideoFirstFrameDecoded,e)}},{key:"_onVideoDeviceStateChange",value:function(e){this.safeEmit(ne.onVideoDeviceStateChanged,e)}},{key:"_onAudioDeviceStateChange",value:function(e){this.safeEmit(ne.onAudioDeviceStateChanged,e)}},{key:"_onUserPublishStateChange",value:function(e){var t,r=e.userId,n=e.isScreen,o=e.mediaType,a=e.pubState,s=e.remoteStream,u={userId:r,mediaType:o};n?a===oz.PUB?this.safeEmit(ne.onUserPublishScreen,u):this.safeEmit(ne.onUserUnpublishScreen,i(i({},u),{},{reason:V.STREAM_REMOVE_REASON_UNPUBLISH})):a===oz.PUB?(u.videoStreamDescriptions=null==s||null===(t=s.attributes)||void 0===t?void 0:t.videoDescriptions,this.safeEmit(ne.onUserPublishStream,u),this._handleAutoSubscribe(s,!0)):this.safeEmit(ne.onUserUnpublishStream,i(i({},u),{},{reason:V.STREAM_REMOVE_REASON_UNPUBLISH}))}},{key:"_onCustomMessage",value:function(e){var t=e.message;e.binary?this.safeEmit(ne.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(ne.onRoomMessageReceived,{userId:e.clientId,message:t})}},{key:"_onUserMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(ne.onUserMessageReceived,e)}},{key:"_onUserBinaryMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(ne.onUserBinaryMessageReceived,e)}},{key:"_onLiveTranscodingResult",value:function(e){this.safeEmit(ne.onLiveTranscodingResult,e)}},{key:"_onStreamMixingEvent",value:function(e){this.safeEmit(ne.onStreamMixingEvent,e)}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(ne.onTokenWillExpire)}},{key:"_onPushPublicStreamResult",value:function(e){this.safeEmit(ne.onPushPublicStreamResult,e)}},{key:"_handleRTMClient",value:function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(ne.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(ne.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(ne.onError,{errorCode:qN.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(ne.onError,{errorCode:qN.RTM_TOKEN_ERROR})})),e.on("onServerParamsSetResult",(function(e){t.safeEmit(ne.onServerParamsSetResult,null==e?void 0:e.code)}))}},{key:"waitForNewToken",get:function(){return!!this._tempRoomConfig}},{key:"localAudioTrack",get:function(){return this._localAudioTrack}},{key:"localVideoTrack",get:function(){return this._localVideoTrack}},{key:"localScreenAudioTrack",get:function(){return this._localScreenAudioTrack}},{key:"localScreenVideoTrack",get:function(){return this._localScreenVideoTrack}},{key:"remoteStreams",get:function(){var e,t,r=[];null!==(e=this._room)&&void 0!==e&&e.remoteStreams&&(null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){r.push({userId:e.userId,isScreen:e.isScreen,hasVideo:e.hasVideo,hasAudio:e.hasAudio,videoStreamDescriptions:e.attributes.videoDescriptions})}))})));return r}},{key:"remoteUsers",get:function(){var e,t,r=[];null!==(e=this._room)&&void 0!==e&&e.remoteUsers&&(null===(t=this._room)||void 0===t||t.remoteUsers.forEach((function(e){r.push({userId:e.userId})})));return r}},{key:"multiChatMode",get:function(){var e,t;return!(null===(e=this._room)||void 0===e||null===(t=e._mediaServerClient)||void 0===t||!t.roomAttributes.multiChatMode)}},{key:"_handleAudioDeviceManager",value:function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(ne.onAudioPlaybackDeviceTestVolume,t)}))}},{key:"_assertNotInRoom",value:function(){if(!this._room||this._room.connectionState!==Nz.CONNECTED)throw new JN(qN.INVOKED_BEFORE_JOIN_ROOM,"join first")}},{key:"_checkMediaType",value:function(e){NP(e,"mediaType",[L.AUDIO,L.VIDEO,L.AUDIO_AND_VIDEO])}},{key:"_getUserId",value:function(){var e,t;return(null===(e=this._room)||void 0===e||null===(t=e.roomInfo)||void 0===t?void 0:t.userInfo.userId)||"local_user"}}]),Le}(DU);hJ([IB()],pJ.prototype,"updateToken",1),hJ([IB()],pJ.prototype,"setVideoCaptureDevice",1),hJ([IB()],pJ.prototype,"setAudioCaptureDevice",1),hJ([IB()],pJ.prototype,"joinRoom",1),hJ([IB()],pJ.prototype,"leaveRoom",1),hJ([IB()],pJ.prototype,"destroy",1),hJ([IB()],pJ.prototype,"publishStream",1),hJ([IB()],pJ.prototype,"unpublishStream",1),hJ([IB()],pJ.prototype,"publishScreen",1),hJ([IB()],pJ.prototype,"unpublishScreen",1),hJ([IB()],pJ.prototype,"subscribeStream",1),hJ([IB()],pJ.prototype,"unsubscribeStream",1),hJ([IB()],pJ.prototype,"subscribeScreen",1),hJ([IB()],pJ.prototype,"unsubscribeScreen",1),hJ([IB()],pJ.prototype,"setRemoteVideoConfig",1),hJ([IB()],pJ.prototype,"startVideoCapture",1),hJ([IB()],pJ.prototype,"stopVideoCapture",1),hJ([IB()],pJ.prototype,"startAudioCapture",1),hJ([IB()],pJ.prototype,"stopAudioCapture",1),hJ([IB()],pJ.prototype,"getAudioMixingManager",1),hJ([IB()],pJ.prototype,"startScreenCapture",1),hJ([IB()],pJ.prototype,"stopScreenCapture",1),hJ([IB()],pJ.prototype,"setLocalVideoPlayer",1),hJ([IB()],pJ.prototype,"startLiveTranscoding",1),hJ([IB()],pJ.prototype,"updateLiveTranscoding",1),hJ([IB()],pJ.prototype,"stopLiveTranscoding",1),hJ([IB()],pJ.prototype,"setBusinessId",1),hJ([IB()],pJ.prototype,"setUserVisibility",1),hJ([IB()],pJ.prototype,"setRemoteVideoPlayer",1),hJ([IB()],pJ.prototype,"setLocalVideoMirrorType",1),hJ([IB()],pJ.prototype,"setAudioPlaybackDevice",1),hJ([IB()],pJ.prototype,"play",1),hJ([IB()],pJ.prototype,"pauseAllSubscribedStream",1),hJ([IB()],pJ.prototype,"resumeAllSubscribedStream",1),hJ([IB()],pJ.prototype,"sendUserMessage",1),hJ([IB()],pJ.prototype,"sendUserBinaryMessage",1),hJ([IB()],pJ.prototype,"sendRoomMessage",1),hJ([IB()],pJ.prototype,"sendRoomBinaryMessage",1),hJ([IB()],pJ.prototype,"setAudioCaptureConfig",1),hJ([IB()],pJ.prototype,"setVideoCaptureConfig",1),hJ([IB()],pJ.prototype,"enableSimulcastMode",1),hJ([IB()],pJ.prototype,"setVideoEncoderConfig",1),hJ([IB()],pJ.prototype,"setScreenEncoderConfig",1),hJ([IB()],pJ.prototype,"sendSEIMessage",1),hJ([IB()],pJ.prototype,"setAudioVolumeIndicationInterval",1),hJ([IB()],pJ.prototype,"enableAudioPropertiesReport",1),hJ([IB()],pJ.prototype,"setVideoSourceType",1),hJ([IB()],pJ.prototype,"setExternalVideoTrack",1),hJ([IB()],pJ.prototype,"setAudioSourceType",1),hJ([IB()],pJ.prototype,"setExternalAudioTrack",1),hJ([IB("rtm")],pJ.prototype,"login",1),hJ([IB("rtm")],pJ.prototype,"logout",1),hJ([IB("rtm")],pJ.prototype,"updateLoginToken",1),hJ([IB("rtm")],pJ.prototype,"getPeerOnlineStatus",1),hJ([IB("rtm")],pJ.prototype,"sendUserMessageOutsideRoom",1),hJ([IB("rtm")],pJ.prototype,"sendUserBinaryMessageOutsideRoom",1),hJ([IB("rtm")],pJ.prototype,"setServerParams",1),hJ([IB("rtm")],pJ.prototype,"sendServerMessage",1),hJ([IB("rtm")],pJ.prototype,"sendServerBinaryMessage",1),hJ([IB()],pJ.prototype,"startCloudProxy",1),hJ([IB()],pJ.prototype,"stopCloudProxy",1),hJ([IB()],pJ.prototype,"startPushPublicStream",1),hJ([IB()],pJ.prototype,"updatePublicStreamParam",1),hJ([IB()],pJ.prototype,"stopPushPublicStream",1),hJ([IB("outsideRoom")],pJ.prototype,"startPlayPublicStream",1),hJ([IB("outsideRoom")],pJ.prototype,"stopPlayPublicStream",1),hJ([IB()],pJ.prototype,"setAudioProfile",1),hJ([IB("outsideRoom")],pJ.prototype,"setPublicStreamVideoPlayer",1),hJ([IB()],pJ.prototype,"setDummyCaptureImagePath",1),hJ([IB()],pJ.prototype,"startAudioPlaybackDeviceTest",1),hJ([IB()],pJ.prototype,"stopAudioPlaybackDeviceTest",1),hJ([IB()],pJ.prototype,"startAudioDeviceRecordTest",1),hJ([IB()],pJ.prototype,"stopAudioDeviceRecordAndPlayTest",1),hJ([IB()],pJ.prototype,"stopAudioDevicePlayTest",1),hJ([IB()],pJ.prototype,"setRemoteUserPriority",1),hJ([IB()],pJ.prototype,"takeLocalSnapshot",1),hJ([IB()],pJ.prototype,"takeRemoteSnapshot",1),hJ([IB()],pJ.prototype,"setSubscribeFallbackOption",1),hJ([IB()],pJ.prototype,"_setCaptureVolume",1);var _J={"client unpublished":V.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":V.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":V.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":V.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":V.STREAM_REMOVE_REASON_REPUBLISH},vJ=new xU("VERTC",0);[bB,EB,kB].forEach((function(e){var t;return e.setStats({rtc_sdk_version:jB.VERSION,product_line:UF.RTC,report_version:LF.W_5,os:VF.WEB,device_id:UB.getDeviceId(),user_agent:lP()?"":null===(t=navigator)||void 0===t?void 0:t.userAgent})}));var mJ=function(e,t){return vJ.print("createEngine","Invoke VERTC.createEngine"),xP(e,"appId"),[bB,EB,kB].forEach((function(r){return r.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),yB.sdkInitEngine(Date.now(),dB.BEGIN),new pJ(e,t)},yJ=function(e){if(vJ.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof pJ))throw new JN(qN.INVALID_ENGINE,"Invalid engine object");e.destroy(),yB.sdkInitEngine(Date.now(),dB.END)},gJ=function(){var e=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",pH.enumerateDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),SJ=function(){var e=u(o().mark((function e(){var t,r,n,i,a=arguments;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:{video:!0,audio:!0},r=t.video,n=t.audio,i={video:!1,audio:!1},!r){e.next=12;break}return e.prev=4,e.next=7,pH.getVideoPermission();case 7:i.video=e.sent,e.next=12;break;case 10:e.prev=10,e.t0=e.catch(4);case 12:if(!n){e.next=21;break}return e.prev=13,e.next=16,pH.getAudioPermission();case 16:i.audio=e.sent,e.next=21;break;case 19:e.prev=19,e.t1=e.catch(13);case 21:return e.abrupt("return",i);case 22:case"end":return e.stop()}}),e,null,[[4,10],[13,19]])})));return function(){return e.apply(this,arguments)}}(),bJ=function(){var e=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",pH.enumerateAudioCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),EJ=function(){var e=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",pH.enumerateVideoCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),kJ=function(){var e=u(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",pH.enumerateAudioPlaybackDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),TJ=function(){return jB.VERSION},IJ=function(){return yB.rtcSdkApiCall("isSupported",0,""),wj()},AJ=function(){return yB.rtcSdkApiCall("getSupportedCodecs",0,""),Oj()};return!lP()&&location.search.includes("_rtc_autotest_"),i(i(i(i({},new(l((function e(){c(this,e),h(this,"getSdkVersion",TJ),h(this,"createEngine",mJ),h(this,"destroyEngine",yJ),h(this,"enumerateDevices",gJ),h(this,"enableDevices",SJ),h(this,"enumerateAudioCaptureDevices",bJ),h(this,"enumerateVideoCaptureDevices",EJ),h(this,"enumerateAudioPlaybackDevices",kJ),h(this,"getParameter",HB),h(this,"setParameter",GB),h(this,"isSupported",IJ),h(this,"getSupportedCodecs",AJ),h(this,"events",ne),h(this,"ErrorCode",qN),h(this,"platform","".concat({}.PRODUCT_PLATFORM)),h(this,"_monitor",yB)})))),Z),re),{},{events:ne})}));
|