@agora-js/media 4.24.2-200 → 4.24.3
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/AgoraRTC_N-media.esm.mjs +2 -2
- package/AgoraRTC_N-media.js +2 -2
- package/media.d.ts +10 -7
- package/package.json +4 -4
- package/rtc-sdk-media_en.d.ts +10 -7
package/AgoraRTC_N-media.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AgoraWebSDK_N-v4.24.
|
|
2
|
+
* AgoraWebSDK_N-v4.24.3-0-g6cc16b0bb-dirty Copyright AgoraInc.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).AgoraRTCMedia={})}(this,(function(e){"use strict";function t(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 i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(e)}let r=!0,i=!0;function n(e,t,r){const i=e.match(t);return i&&i.length>=r&&parseInt(i[r],10)}function o(e,t,r){if(!e.RTCPeerConnection)return;const i=e.RTCPeerConnection.prototype,n=i.addEventListener;i.addEventListener=function(e,i){if(e!==t)return n.apply(this,arguments);const o=e=>{const t=r(e);t&&(i.handleEvent?i.handleEvent(t):i(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(i,o),n.apply(this,[e,o])};const o=i.removeEventListener;i.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);const i=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,i])},Object.defineProperty(i,"on"+t,{get(){return this["_on"+t]},set(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 s(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(r=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function a(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(i=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function c(){if("object"==typeof window){if(r)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function d(e,t){i&&console.warn(e+" is deprecated, please use "+t+" instead.")}function u(e){return"[object Object]"===Object.prototype.toString.call(e)}function l(e){return u(e)?Object.keys(e).reduce((function(t,r){const i=u(e[r]),n=i?l(e[r]):e[r],o=i&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,{[r]:n})}),{}):e}function h(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((i=>{i.endsWith("Id")?h(e,e.get(t[i]),r):i.endsWith("Ids")&&t[i].forEach((t=>{h(e,e.get(t),r)}))})))}function p(e,t,r){const i=r?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;const o=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((t=>{e.forEach((r=>{r.type===i&&r.trackId===t.id&&h(e,r,n)}))})),n}const f=c;function E(e,t){const r=e&&e.navigator;if(!r.mediaDevices)return;const i=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach((r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;const i="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);const n=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==i.ideal){t.optional=t.optional||[];let e={};"number"==typeof i.ideal?(e[n("min",r)]=i.ideal,t.optional.push(e),e={},e[n("max",r)]=i.ideal,t.optional.push(e)):(e[n("",r)]=i.ideal,t.optional.push(e))}void 0!==i.exact&&"number"!=typeof i.exact?(t.mandatory=t.mandatory||{},t.mandatory[n("",r)]=i.exact):["min","max"].forEach((e=>{void 0!==i[e]&&(t.mandatory=t.mandatory||{},t.mandatory[n(e,r)]=i[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},n=function(e,n){if(t.version>=61)return n(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=i(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const s=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||s)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(t=["front"]),t)return r.mediaDevices.enumerateDevices().then((r=>{let s=(r=r.filter((e=>"videoinput"===e.kind))).find((e=>t.some((t=>e.label.toLowerCase().includes(t)))));return!s&&r.length&&t.includes("back")&&(s=r[r.length-1]),s&&(e.video.deviceId=o.exact?{exact:s.deviceId}:{ideal:s.deviceId}),e.video=i(e.video),f("chrome: "+JSON.stringify(e)),n(e)}))}e.video=i(e.video)}return f("chrome: "+JSON.stringify(e)),n(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(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,i){n(e,(e=>{r.webkitGetUserMedia(e,t,(e=>{i&&i(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){const e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(t){return n(t,(t=>e(t).then((e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return e}),(e=>Promise.reject(o(e))))))}}}function m(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function _(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.track.id)):{track:r.track};const n=new Event("track");n.track=r.track,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)})),t.stream.getTracks().forEach((r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.id)):{track:r};const n=new Event("track");n.track=r,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else o(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function T(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const 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()};const r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){let n=r.apply(this,arguments);return n||(n=t(this,e),this._senders.push(n)),n};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){i.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach((e=>{const t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function g(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,r,i]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const n=function(e){const t={};return e.result().forEach((e=>{const r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{r[t]=e.stat(t)})),t[r.id]=r})),t},o=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){const i=function(e){r(o(n(e)))};return t.apply(this,[i,e])}return new Promise(((e,r)=>{t.apply(this,[function(t){e(o(n(t)))},r])})).then(r,i)}}function S(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>p(t,e.track,!0)))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),o(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>p(t,e.track,!1)))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,r,i;return this.getSenders().forEach((r=>{r.track===e&&(t?i=!0:t=r)})),this.getReceivers().forEach((t=>(t.track===e&&(r?i=!0:r=t),t.track===e))),i||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 t.apply(this,arguments)}}function R(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const i=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();r.apply(this,arguments);const i=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(i)};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],i.apply(this,arguments)};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{const r=this._shimmedLocalStreams[t].indexOf(e);-1!==r&&this._shimmedLocalStreams[t].splice(r,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),n.apply(this,arguments)}}function y(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return R(e);const r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};const i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){const r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}i.apply(this,[t])};const n=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.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){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const n=this._streams[r.id];if(n)n.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const i=new e.MediaStream([t]);this._streams[r.id]=i,this._reverseStreams[i.id]=r,this.addStream(i)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[t=>{const r=o(this,t);e[0].apply(null,[r])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):r.apply(this,arguments).then((e=>o(this,e)))}};e.RTCPeerConnection.prototype[t]=i[t]}));const s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=a.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){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");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach((r=>{this._streams[r].getTracks().find((t=>e.track===t))&&(t=this._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function v(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]}))}function A(e,t){o(e,"negotiationneeded",(e=>{const r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var b=Object.freeze({__proto__:null,fixNegotiationNeeded:A,shimAddTrackRemoveTrack:y,shimAddTrackRemoveTrackWithNative:R,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((t=>{const i=r.video&&r.video.width,n=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},i&&(r.video.mandatory.maxWidth=i),n&&(r.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))},shimGetSendersWithDtmf:T,shimGetStats:g,shimGetUserMedia:E,shimMediaStream:m,shimOnTrack:_,shimPeerConnection:v,shimSenderReceiverGetStats:S});function I(e,t){const r=e&&e.navigator,i=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,i){d("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,i)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const e=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},t=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(r=JSON.parse(JSON.stringify(r)),e(r.audio,"autoGainControl","mozAutoGainControl"),e(r.audio,"noiseSuppression","mozNoiseSuppression")),t(r)},i&&i.prototype.getSettings){const t=i.prototype.getSettings;i.prototype.getSettings=function(){const r=t.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(i&&i.prototype.applyConstraints){const t=i.prototype.applyConstraints;i.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(r=JSON.parse(JSON.stringify(r)),e(r,"autoGainControl","mozAutoGainControl"),e(r,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[r])}}}}function O(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function C(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]}));const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,o]=arguments;return i.apply(this,[e||null]).then((e=>{if(t.version<53&&!n)try{e.forEach((e=>{e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,i)=>{e.set(i,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(n,o)}}function w(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const 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 N(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),o(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function D(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){d("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function P(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function L(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]),e=[...e];const r=e.length>0;r&&e.forEach((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")}));const i=t.apply(this,arguments);if(r){const{sender:t}=i,r=t.getParameters();(!("encodings"in r)||1===r.encodings.length&&0===Object.keys(r.encodings[0]).length)&&(r.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(r).then((()=>{delete t.sendEncodings})).catch((()=>{delete t.sendEncodings}))))}return i})}function k(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function M(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function U(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}var x=Object.freeze({__proto__:null,shimAddTransceiver:L,shimCreateAnswer:U,shimCreateOffer:M,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){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})},shimGetParameters:k,shimGetUserMedia:I,shimOnTrack:O,shimPeerConnection:C,shimRTCDataChannel:P,shimReceiverGetStats:N,shimRemoveStream:D,shimSenderGetStats:w});function V(e){if("object"==typeof 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)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((r=>t.call(this,r,e))),e.getVideoTracks().forEach((r=>t.call(this,r,e)))},e.RTCPeerConnection.prototype.addTrack=function(e,...r){return r&&r.forEach((e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const r=e.getTracks();this.getSenders().forEach((e=>{r.includes(e.track)&&this.removeTrack(e)}))})}}function F(e){if("object"==typeof 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(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach((e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)}))})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}))}),t.apply(e,arguments)}}}function B(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,r=t.createOffer,i=t.createAnswer,n=t.setLocalDescription,o=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){const i=arguments.length>=2?arguments[2]:arguments[0],n=r.apply(this,[i]);return t?(n.then(e,t),Promise.resolve()):n},t.createAnswer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],n=i.apply(this,[r]);return t?(n.then(e,t),Promise.resolve()):n};let a=function(e,t,r){const i=n.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i};t.setLocalDescription=a,a=function(e,t,r){const i=o.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},t.setRemoteDescription=a,a=function(e,t,r){const i=s.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},t.addIceCandidate=a}function j(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,r=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>r(G(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,i){t.mediaDevices.getUserMedia(e).then(r,i)}.bind(t))}function G(e){return e&&void 0!==e.video?Object.assign({},e,{video:l(e.video)}):e}function W(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){const t=[];for(let r=0;r<e.iceServers.length;r++){let i=e.iceServers[r];!i.hasOwnProperty("urls")&&i.hasOwnProperty("url")?(d("RTCIceServer.url","RTCIceServer.urls"),i=JSON.parse(JSON.stringify(i)),i.urls=i.url,delete i.url,t.push(i)):t.push(e.iceServers[r])}e.iceServers=t}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function H(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function K(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find((e=>"audio"===e.receiver.track.kind));!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const r=this.getTransceivers().find((e=>"video"===e.receiver.track.kind));!1===e.offerToReceiveVideo&&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.offerToReceiveVideo||r||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Y(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var z=Object.freeze({__proto__:null,shimAudioContext:Y,shimCallbacksAPI:B,shimConstraints:G,shimCreateOfferLegacy:K,shimGetUserMedia:j,shimLocalStreamsAPI:V,shimRTCIceServerUrls:W,shimRemoteStreamsAPI:F,shimTrackEventTransceiver:H}),X="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Z(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var J={exports:{}};!function(e){const t={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((e=>e.trim()))},t.splitSections=function(e){return e.split("\nm=").map(((e,t)=>(t>0?"m="+e:e).trim()+"\r\n"))},t.getDescription=function(e){const r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){const r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((e=>0===e.indexOf(r)))},t.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const r={foundation:t[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]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":r.relatedAddress=t[e+1];break;case"rport":r.relatedPort=parseInt(t[e+1],10);break;case"tcptype":r.tcpType=t[e+1];break;case"ufrag":r.ufrag=t[e+1],r.usernameFragment=t[e+1];break;default:void 0===r[t[e]]&&(r[t[e]]=t[e+1])}return r},t.writeCandidate=function(e){const t=[];t.push(e.foundation);const 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);const i=e.type;return t.push("typ"),t.push(i),"host"!==i&&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.substring(14).split(" ")},t.parseRtpMap=function(e){let t=e.substring(9).split(" ");const 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){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){const t=e.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},t.parseFmtp=function(e){const t={};let r;const i=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e<i.length;e++)r=i[e].trim().split("="),t[r[0].trim()]=r[1];return t},t.writeFmtp=function(e){let t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const i=[];Object.keys(e.parameters).forEach((t=>{void 0!==e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)})),t+="a=fmtp:"+r+" "+i.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){const t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){let t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((e=>{t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){const t=e.indexOf(" "),r={ssrc:parseInt(e.substring(7,t),10)},i=e.indexOf(":",t);return i>-1?(r.attribute=e.substring(t+1,i),r.value=e.substring(i+1)):r.attribute=e.substring(t+1),r},t.parseSsrcGroup=function(e){const t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((e=>parseInt(e,10)))}},t.getMid=function(e){const r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substring(6)},t.parseFingerprint=function(e){const t=e.substring(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){let r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((e=>{r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){const t=e.substring(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"==typeof 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;const t=e.substring(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){const i=t.matchPrefix(e+r,"a=ice-ufrag:")[0],n=t.matchPrefix(e+r,"a=ice-pwd:")[0];return i&&n?{usernameFragment:i.substring(12),password:n.substring(10)}:null},t.writeIceParameters=function(e){let 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){const r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=t.splitLines(e)[0].split(" ");r.profile=i[2];for(let n=3;n<i.length;n++){const o=i[n],s=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(s){const i=t.parseRtpMap(s),n=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(i.parameters=n.length?t.parseFmtp(n[0]):{},i.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(i),i.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(i.name.toUpperCase())}}}t.matchPrefix(e,"a=extmap:").forEach((e=>{r.headerExtensions.push(t.parseExtmap(e))}));const n=t.matchPrefix(e,"a=rtcp-fb:* ").map(t.parseRtcpFb);return r.codecs.forEach((e=>{n.forEach((t=>{e.rtcpFeedback.find((e=>e.type===t.type&&e.parameter===t.parameter))||e.rtcpFeedback.push(t)}))})),r},t.writeRtpDescription=function(e,r){let i="";i+="m="+e+" ",i+=r.codecs.length>0?"9":"0",i+=" "+(r.profile||"UDP/TLS/RTP/SAVPF")+" ",i+=r.codecs.map((e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType)).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((e=>{i+=t.writeRtpMap(e),i+=t.writeFmtp(e),i+=t.writeRtcpFb(e)}));let n=0;return r.codecs.forEach((e=>{e.maxptime>n&&(n=e.maxptime)})),n>0&&(i+="a=maxptime:"+n+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach((e=>{i+=t.writeExtmap(e)})),i},t.parseRtpEncodingParameters=function(e){const r=[],i=t.parseRtpParameters(e),n=-1!==i.fecMechanisms.indexOf("RED"),o=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute)),a=s.length>0&&s[0].ssrc;let c;const d=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substring(17).split(" ").map((e=>parseInt(e,10)))));d.length>0&&d[0].length>1&&d[0][0]===a&&(c=d[0][1]),i.codecs.forEach((e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:a,codecPayloadType:parseInt(e.parameters.apt,10)};a&&c&&(t.rtx={ssrc:c}),r.push(t),n&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:a,mechanism:o?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&a&&r.push({ssrc:a});let u=t.matchPrefix(e,"b=");return u.length&&(u=0===u[0].indexOf("b=TIAS:")?parseInt(u[0].substring(7),10):0===u[0].indexOf("b=AS:")?1e3*parseInt(u[0].substring(5),10)*.95-16e3:void 0,r.forEach((e=>{e.maxBitrate=u}))),r},t.parseRtcpParameters=function(e){const r={},i=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute))[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);const n=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=n.length>0,r.compound=0===n.length;const o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.writeRtcpParameters=function(e){let 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){let r;const i=t.matchPrefix(e,"a=msid:");if(1===i.length)return r=i[0].substring(7).split(" "),{stream:r[0],track:r[1]};const n=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"msid"===e.attribute));return n.length>0?(r=n[0].value.split(" "),{stream:r[0],track:r[1]}):void 0},t.parseSctpDescription=function(e){const r=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");let n;i.length>0&&(n=parseInt(i[0].substring(19),10)),isNaN(n)&&(n=65536);const o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substring(12),10),protocol:r.fmt,maxMessageSize:n};const s=t.matchPrefix(e,"a=sctpmap:");if(s.length>0){const e=s[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:n}}},t.writeSctpDescription=function(e,t){let 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,22)},t.writeSessionBoilerplate=function(e,r,i){let n;const o=void 0!==r?r:2;n=e||t.generateSessionId();return"v=0\r\no="+(i||"thisisadapterortc")+" "+n+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,r){const i=t.splitLines(e);for(let e=0;e<i.length;e++)switch(i[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[e].substring(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substring(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){const r=t.splitLines(e)[0].substring(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){const r=t.matchPrefix(e,"o=")[0].substring(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;const r=t.splitLines(e);for(let e=0;e<r.length;e++)if(r[e].length<2||"="!==r[e].charAt(1))return!1;return!0},e.exports=t}(J);var Q=J.exports,q=Z(Q),$=t({__proto__:null,default:q},[Q]);function ee(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const r=new t(e),i=q.parseCandidate(e.candidate),n=Object.assign(r,i);return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,o(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function te(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||o(e,"icecandidate",(e=>{if(e.candidate){const t=q.parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function re(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const r=function(e){if(!e||!e.sdp)return!1;const t=q.splitSections(e.sdp);return t.shift(),t.some((e=>{const t=q.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},i=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const r=parseInt(t[1],10);return r!=r?-1:r},n=function(e){let 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){let i=65536;"firefox"===t.browser&&57===t.version&&(i=65535);const n=q.matchPrefix(e.sdp,"a=max-message-size:");return n.length>0?i=parseInt(n[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(i=2147483637),i},s=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){const e=i(arguments[0]),t=n(e),r=o(arguments[0],e);let s;s=0===t&&0===r?Number.POSITIVE_INFINITY:0===t||0===r?Math.max(t,r):Math.min(t,r);const a={};Object.defineProperty(a,"maxMessageSize",{get:()=>s}),this._sctp=a}return s.apply(this,arguments)}}function ie(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const r=e.send;e.send=function(){const i=arguments[0],n=i.length||i.size||i.byteLength;if("open"===e.readyState&&t.sctp&&n>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}const r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=r.apply(this,arguments);return t(e,this),e},o(e,"datachannel",(e=>(t(e.channel,e.target),e)))}function ne(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(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((e=>{const r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}function oe(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const r=t.sdp.split("\n").filter((e=>"a=extmap-allow-mixed"!==e.trim())).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return r.apply(this,arguments)}}function se(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const 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 ae(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return r.apply(this,arguments);if(e={type:e.type,sdp:e.sdp},!e.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}if(e.sdp||"offer"!==e.type&&"answer"!==e.type)return r.apply(this,[e]);return("offer"===e.type?this.createOffer:this.createAnswer).apply(this).then((e=>r.apply(this,[e])))})}var ce=Object.freeze({__proto__:null,removeExtmapAllowMixed:oe,shimAddIceCandidateNullOrEmpty:se,shimConnectionState:ne,shimMaxMessageSize:re,shimParameterlessSetLocalDescription:ae,shimRTCIceCandidate:ee,shimRTCIceCandidateRelayProtocol:te,shimSendThrowTypeError:ie});!function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const r=c,i=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:r}=e;if(r.mozGetUserMedia)t.browser="firefox",t.version=n(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=n(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=n(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),o={browserDetails:i,commonShim:ce,extractVersion:n,disableLog:s,disableWarnings:a,sdp:$};switch(i.browser){case"chrome":if(!b||!v||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),o;if(null===i.version)return r("Chrome shim can not determine version, not shimming."),o;r("adapter.js shimming chrome."),o.browserShim=b,se(e,i),ae(e),E(e,i),m(e),v(e,i),_(e),y(e,i),T(e),g(e),S(e),A(e,i),ee(e),te(e),ne(e),re(e,i),ie(e),oe(e,i);break;case"firefox":if(!x||!C||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),o;r("adapter.js shimming firefox."),o.browserShim=x,se(e,i),ae(e),I(e,i),C(e,i),O(e),D(e),w(e),N(e),P(e),L(e),k(e),M(e),U(e),ee(e),ne(e),re(e,i),ie(e);break;case"safari":if(!z||!t.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=z,se(e,i),ae(e),W(e),K(e),B(e),V(e),F(e),H(e),j(e),Y(e),ee(e),te(e),re(e,i),ie(e),oe(e,i);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var de={exports:{}};!function(e,t){!function(r,i){var n="function",o="undefined",s="object",a="string",c="major",d="model",u="name",l="type",h="vendor",p="version",f="architecture",E="console",m="mobile",_="tablet",T="smarttv",g="wearable",S="embedded",R="Amazon",y="Apple",v="ASUS",A="BlackBerry",b="Browser",I="Chrome",O="Firefox",C="Google",w="Huawei",N="LG",D="Microsoft",P="Motorola",L="Opera",k="Samsung",M="Sharp",U="Sony",x="Xiaomi",V="Zebra",F="Facebook",B="Chromium OS",j="Mac OS",G=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},W=function(e,t){return typeof e===a&&-1!==H(t).indexOf(H(e))},H=function(e){return e.toLowerCase()},K=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof t===o?e:e.substring(0,350)},Y=function(e,t){for(var r,o,a,c,d,u,l=0;l<t.length&&!d;){var h=t[l],p=t[l+1];for(r=o=0;r<h.length&&!d&&h[r];)if(d=h[r++].exec(e))for(a=0;a<p.length;a++)u=d[++o],typeof(c=p[a])===s&&c.length>0?2===c.length?typeof c[1]==n?this[c[0]]=c[1].call(this,u):this[c[0]]=c[1]:3===c.length?typeof c[1]!==n||c[1].exec&&c[1].test?this[c[0]]=u?u.replace(c[1],c[2]):i:this[c[0]]=u?c[1].call(this,u,c[2]):i:4===c.length&&(this[c[0]]=u?c[3].call(this,u.replace(c[1],c[2])):i):this[c]=u||i;l+=2}},z=function(e,t){for(var r in t)if(typeof t[r]===s&&t[r].length>0){for(var n=0;n<t[r].length;n++)if(W(t[r][n],e))return"?"===r?i:r}else if(W(t[r],e))return"?"===r?i:r;return e},X={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Z={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,p],[/opios[\/ ]+([\w\.]+)/i],[p,[u,L+" Mini"]],[/\bopr\/([\w\.]+)/i],[p,[u,L]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[u,p],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[u,"UC"+b]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[p,[u,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[p,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[u,"IE"]],[/yabrowser\/([\w\.]+)/i],[p,[u,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+b],p],[/\bfocus\/([\w\.]+)/i],[p,[u,O+" Focus"]],[/\bopt\/([\w\.]+)/i],[p,[u,L+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[u,L+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[u,"MIUI "+b]],[/fxios\/([-\w\.]+)/i],[p,[u,O]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 "+b]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 "+b],p],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[u,p],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,F],p],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[u,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[u,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[u,I+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,I+" WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[u,"Android "+b]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,p],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[p,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[p,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[p,z,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[u,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[u,O+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[u,p],[/(cobalt)\/([\w\.]+)/i],[u,[p,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,H]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",H]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,H]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[d,[h,k],[l,_]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[d,[h,k],[l,m]],[/\((ip(?:hone|od)[\w ]*);/i],[d,[h,y],[l,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[d,[h,y],[l,_]],[/(macintosh);/i],[d,[h,y]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[d,[h,M],[l,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[d,[h,w],[l,_]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[d,[h,w],[l,m]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[d,/_/g," "],[h,x],[l,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[d,/_/g," "],[h,x],[l,_]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[d,[h,"OPPO"],[l,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[d,[h,"Vivo"],[l,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[d,[h,"Realme"],[l,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[d,[h,P],[l,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[d,[h,P],[l,_]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[h,N],[l,_]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[d,[h,N],[l,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[d,[h,"Lenovo"],[l,_]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[d,/_/g," "],[h,"Nokia"],[l,m]],[/(pixel c)\b/i],[d,[h,C],[l,_]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[d,[h,C],[l,m]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[d,[h,U],[l,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[d,"Xperia Tablet"],[h,U],[l,_]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[d,[h,"OnePlus"],[l,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[d,[h,R],[l,_]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[d,/(.+)/g,"Fire Phone $1"],[h,R],[l,m]],[/(playbook);[-\w\),; ]+(rim)/i],[d,h,[l,_]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[d,[h,A],[l,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[d,[h,v],[l,_]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[d,[h,v],[l,m]],[/(nexus 9)/i],[d,[h,"HTC"],[l,_]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[h,[d,/_/g," "],[l,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[d,[h,"Acer"],[l,_]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[d,[h,"Meizu"],[l,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[h,d,[l,m]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[h,d,[l,_]],[/(surface duo)/i],[d,[h,D],[l,_]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[d,[h,"Fairphone"],[l,m]],[/(u304aa)/i],[d,[h,"AT&T"],[l,m]],[/\bsie-(\w*)/i],[d,[h,"Siemens"],[l,m]],[/\b(rct\w+) b/i],[d,[h,"RCA"],[l,_]],[/\b(venue[\d ]{2,7}) b/i],[d,[h,"Dell"],[l,_]],[/\b(q(?:mv|ta)\w+) b/i],[d,[h,"Verizon"],[l,_]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[d,[h,"Barnes & Noble"],[l,_]],[/\b(tm\d{3}\w+) b/i],[d,[h,"NuVision"],[l,_]],[/\b(k88) b/i],[d,[h,"ZTE"],[l,_]],[/\b(nx\d{3}j) b/i],[d,[h,"ZTE"],[l,m]],[/\b(gen\d{3}) b.+49h/i],[d,[h,"Swiss"],[l,m]],[/\b(zur\d{3}) b/i],[d,[h,"Swiss"],[l,_]],[/\b((zeki)?tb.*\b) b/i],[d,[h,"Zeki"],[l,_]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[h,"Dragon Touch"],d,[l,_]],[/\b(ns-?\w{0,9}) b/i],[d,[h,"Insignia"],[l,_]],[/\b((nxa|next)-?\w{0,9}) b/i],[d,[h,"NextBook"],[l,_]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[h,"Voice"],d,[l,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[h,"LvTel"],d,[l,m]],[/\b(ph-1) /i],[d,[h,"Essential"],[l,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[d,[h,"Envizen"],[l,_]],[/\b(trio[-\w\. ]+) b/i],[d,[h,"MachSpeed"],[l,_]],[/\btu_(1491) b/i],[d,[h,"Rotor"],[l,_]],[/(shield[\w ]+) b/i],[d,[h,"Nvidia"],[l,_]],[/(sprint) (\w+)/i],[h,d,[l,m]],[/(kin\.[onetw]{3})/i],[[d,/\./g," "],[h,D],[l,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[d,[h,V],[l,_]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[d,[h,V],[l,m]],[/smart-tv.+(samsung)/i],[h,[l,T]],[/hbbtv.+maple;(\d+)/i],[[d,/^/,"SmartTV"],[h,k],[l,T]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[h,N],[l,T]],[/(apple) ?tv/i],[h,[d,y+" TV"],[l,T]],[/crkey/i],[[d,I+"cast"],[h,C],[l,T]],[/droid.+aft(\w)( bui|\))/i],[d,[h,R],[l,T]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[d,[h,M],[l,T]],[/(bravia[\w ]+)( bui|\))/i],[d,[h,U],[l,T]],[/(mitv-\w{5}) bui/i],[d,[h,x],[l,T]],[/Hbbtv.*(technisat) (.*);/i],[h,d,[l,T]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[h,K],[d,K],[l,T]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,T]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[h,d,[l,E]],[/droid.+; (shield) bui/i],[d,[h,"Nvidia"],[l,E]],[/(playstation [345portablevi]+)/i],[d,[h,U],[l,E]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[d,[h,D],[l,E]],[/((pebble))app/i],[h,d,[l,g]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[d,[h,y],[l,g]],[/droid.+; (glass) \d/i],[d,[h,C],[l,g]],[/droid.+; (wt63?0{2,3})\)/i],[d,[h,V],[l,g]],[/(quest( 2| pro)?)/i],[d,[h,F],[l,g]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[h,[l,S]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[d,[l,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[d,[l,_]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,_]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,m]],[/(android[-\w\. ]{0,9});.+buil/i],[d,[h,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[u,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,p],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[u,[p,z,X]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,"Windows"],[p,z,X]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,j],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[p,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,p],[/\(bb(10);/i],[p,[u,A]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[u,O+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[u,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[p,[u,"watchOS"]],[/crkey\/([\d\.]+)/i],[p,[u,I+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[u,B],p],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,p],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[u,p]]},J=function(e,t){if(typeof e===s&&(t=e,e=i),!(this instanceof J))return new J(e,t).getResult();var E=typeof r!==o&&r.navigator?r.navigator:i,T=e||(E&&E.userAgent?E.userAgent:""),g=E&&E.userAgentData?E.userAgentData:i,S=t?function(e,t){var r={};for(var i in e)t[i]&&t[i].length%2==0?r[i]=t[i].concat(e[i]):r[i]=e[i];return r}(Z,t):Z;return this.getBrowser=function(){var e={};return e[u]=i,e[p]=i,Y.call(e,T,S.browser),e[c]=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:i}(e[p]),E&&E.brave&&typeof E.brave.isBrave==n&&(e[u]="Brave"),e},this.getCPU=function(){var e={};return e[f]=i,Y.call(e,T,S.cpu),e},this.getDevice=function(){var e={};return e[h]=i,e[d]=i,e[l]=i,Y.call(e,T,S.device),!e[l]&&g&&g.mobile&&(e[l]=m),"Macintosh"==e[d]&&E&&typeof E.standalone!==o&&E.maxTouchPoints&&E.maxTouchPoints>2&&(e[d]="iPad",e[l]=_),e},this.getEngine=function(){var e={};return e[u]=i,e[p]=i,Y.call(e,T,S.engine),e},this.getOS=function(){var e={};return e[u]=i,e[p]=i,Y.call(e,T,S.os),!e[u]&&g&&"Unknown"!=g.platform&&(e[u]=g.platform.replace(/chrome os/i,B).replace(/macos/i,j)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return T},this.setUA=function(e){return T=typeof e===a&&e.length>350?K(e,350):e,this},this.setUA(T),this};J.VERSION="0.7.34",J.BROWSER=G([u,p,c]),J.CPU=G([f]),J.DEVICE=G([d,h,l,E,m,T,_,g,S]),J.ENGINE=J.OS=G([u,p]),e.exports&&(t=e.exports=J),t.UAParser=J;var Q=typeof r!==o&&(r.jQuery||r.Zepto);if(Q&&!Q.ua){var q=new J;Q.ua=q.getResult(),Q.ua.get=function(){return q.getUA()},Q.ua.set=function(e){q.setUA(e);var t=q.getResult();for(var r in t)Q.ua[r]=t[r]}}}("object"==typeof window?window:X)}(de,de.exports);var ue=Z(de.exports);function le(e,t){return function(){return e.apply(t,arguments)}}const{toString:he}=Object.prototype,{getPrototypeOf:pe}=Object,{iterator:fe,toStringTag:Ee}=Symbol,me=(e=>t=>{const r=he.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),_e=e=>(e=e.toLowerCase(),t=>me(t)===e),Te=e=>t=>typeof t===e,{isArray:ge}=Array,Se=Te("undefined");function Re(e){return null!==e&&!Se(e)&&null!==e.constructor&&!Se(e.constructor)&&Ae(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ye=_e("ArrayBuffer");const ve=Te("string"),Ae=Te("function"),be=Te("number"),Ie=e=>null!==e&&"object"==typeof e,Oe=e=>{if("object"!==me(e))return!1;const t=pe(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Ee in e||fe in e)},Ce=_e("Date"),we=_e("File"),Ne=_e("Blob"),De=_e("FileList"),Pe=_e("URLSearchParams"),[Le,ke,Me,Ue]=["ReadableStream","Request","Response","Headers"].map(_e);function xe(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let i,n;if("object"!=typeof e&&(e=[e]),ge(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{if(Re(e))return;const n=r?Object.getOwnPropertyNames(e):Object.keys(e),o=n.length;let s;for(i=0;i<o;i++)s=n[i],t.call(null,e[s],s,e)}}function Ve(e,t){if(Re(e))return null;t=t.toLowerCase();const r=Object.keys(e);let i,n=r.length;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}const Fe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Be=e=>!Se(e)&&e!==Fe;const je=(Ge="undefined"!=typeof Uint8Array&&pe(Uint8Array),e=>Ge&&e instanceof Ge);var Ge;const We=_e("HTMLFormElement"),He=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),Ke=_e("RegExp"),Ye=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),i={};xe(r,((r,n)=>{let o;!1!==(o=t(r,n,e))&&(i[n]=o||r)})),Object.defineProperties(e,i)};const ze=_e("AsyncFunction"),Xe=(Ze="function"==typeof setImmediate,Je=Ae(Fe.postMessage),Ze?setImmediate:Je?(Qe=`axios@${Math.random()}`,qe=[],Fe.addEventListener("message",(({source:e,data:t})=>{e===Fe&&t===Qe&&qe.length&&qe.shift()()}),!1),e=>{qe.push(e),Fe.postMessage(Qe,"*")}):e=>setTimeout(e));var Ze,Je,Qe,qe;const $e="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Fe):"undefined"!=typeof process&&process.nextTick||Xe;var et={isArray:ge,isArrayBuffer:ye,isBuffer:Re,isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Ae(e.append)&&("formdata"===(t=me(e))||"object"===t&&Ae(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&ye(e.buffer),t},isString:ve,isNumber:be,isBoolean:e=>!0===e||!1===e,isObject:Ie,isPlainObject:Oe,isEmptyObject:e=>{if(!Ie(e)||Re(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Le,isRequest:ke,isResponse:Me,isHeaders:Ue,isUndefined:Se,isDate:Ce,isFile:we,isBlob:Ne,isRegExp:Ke,isFunction:Ae,isStream:e=>Ie(e)&&Ae(e.pipe),isURLSearchParams:Pe,isTypedArray:je,isFileList:De,forEach:xe,merge:function e(){const{caseless:t,skipUndefined:r}=Be(this)&&this||{},i={},n=(n,o)=>{const s=t&&Ve(i,o)||o;Oe(i[s])&&Oe(n)?i[s]=e(i[s],n):Oe(n)?i[s]=e({},n):ge(n)?i[s]=n.slice():r&&Se(n)||(i[s]=n)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&xe(arguments[e],n);return i},extend:(e,t,r,{allOwnKeys:i}={})=>(xe(t,((t,i)=>{r&&Ae(t)?Object.defineProperty(e,i,{value:le(t,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{value:t,writable:!0,enumerable:!0,configurable:!0})}),{allOwnKeys:i}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,i)=>{let n,o,s;const a={};if(t=t||{},null==e)return t;do{for(n=Object.getOwnPropertyNames(e),o=n.length;o-- >0;)s=n[o],i&&!i(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==r&&pe(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:me,kindOfTest:_e,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const i=e.indexOf(t,r);return-1!==i&&i===r},toArray:e=>{if(!e)return null;if(ge(e))return e;let t=e.length;if(!be(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[fe]).call(e);let i;for(;(i=r.next())&&!i.done;){const r=i.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const i=[];for(;null!==(r=e.exec(t));)i.push(r);return i},isHTMLForm:We,hasOwnProperty:He,hasOwnProp:He,reduceDescriptors:Ye,freezeMethods:e=>{Ye(e,((t,r)=>{if(Ae(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const i=e[r];Ae(i)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},i=e=>{e.forEach((e=>{r[e]=!0}))};return ge(e)?i(e):i(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Ve,global:Fe,isContextDefined:Be,isSpecCompliantForm:function(e){return!!(e&&Ae(e.append)&&"FormData"===e[Ee]&&e[fe])},toJSONObject:e=>{const t=new Array(10),r=(e,i)=>{if(Ie(e)){if(t.indexOf(e)>=0)return;if(Re(e))return e;if(!("toJSON"in e)){t[i]=e;const n=ge(e)?[]:{};return xe(e,((e,t)=>{const o=r(e,i+1);!Se(o)&&(n[t]=o)})),t[i]=void 0,n}}return e};return r(e,0)},isAsyncFn:ze,isThenable:e=>e&&(Ie(e)||Ae(e))&&Ae(e.then)&&Ae(e.catch),setImmediate:Xe,asap:$e,isIterable:e=>null!=e&&Ae(e[fe])};class tt extends Error{static from(e,t,r,i,n,o){const s=new tt(e.message,t||e.code,r,i,n);return s.cause=e,s.name=e.name,o&&Object.assign(s,o),s}constructor(e,t,r,i,n){super(e),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:et.toJSONObject(this.config),code:this.code,status:this.status}}}tt.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",tt.ERR_BAD_OPTION="ERR_BAD_OPTION",tt.ECONNABORTED="ECONNABORTED",tt.ETIMEDOUT="ETIMEDOUT",tt.ERR_NETWORK="ERR_NETWORK",tt.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",tt.ERR_DEPRECATED="ERR_DEPRECATED",tt.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",tt.ERR_BAD_REQUEST="ERR_BAD_REQUEST",tt.ERR_CANCELED="ERR_CANCELED",tt.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",tt.ERR_INVALID_URL="ERR_INVALID_URL";var rt=tt;function it(e){return et.isPlainObject(e)||et.isArray(e)}function nt(e){return et.endsWith(e,"[]")?e.slice(0,-2):e}function ot(e,t,r){return e?e.concat(t).map((function(e,t){return e=nt(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const st=et.toFlatObject(et,{},null,(function(e){return/^is[A-Z]/.test(e)}));function at(e,t,r){if(!et.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const i=(r=et.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!et.isUndefined(t[e])}))).metaTokens,n=r.visitor||d,o=r.dots,s=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&et.isSpecCompliantForm(t);if(!et.isFunction(n))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(et.isDate(e))return e.toISOString();if(et.isBoolean(e))return e.toString();if(!a&&et.isBlob(e))throw new rt("Blob is not supported. Use a Buffer instead.");return et.isArrayBuffer(e)||et.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,r,n){let a=e;if(e&&!n&&"object"==typeof e)if(et.endsWith(r,"{}"))r=i?r:r.slice(0,-2),e=JSON.stringify(e);else if(et.isArray(e)&&function(e){return et.isArray(e)&&!e.some(it)}(e)||(et.isFileList(e)||et.endsWith(r,"[]"))&&(a=et.toArray(e)))return r=nt(r),a.forEach((function(e,i){!et.isUndefined(e)&&null!==e&&t.append(!0===s?ot([r],i,o):null===s?r:r+"[]",c(e))})),!1;return!!it(e)||(t.append(ot(n,r,o),c(e)),!1)}const u=[],l=Object.assign(st,{defaultVisitor:d,convertValue:c,isVisitable:it});if(!et.isObject(e))throw new TypeError("data must be an object");return function e(r,i){if(!et.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+i.join("."));u.push(r),et.forEach(r,(function(r,o){!0===(!(et.isUndefined(r)||null===r)&&n.call(t,r,et.isString(o)?o.trim():o,i,l))&&e(r,i?i.concat(o):[o])})),u.pop()}}(e),t}function ct(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function dt(e,t){this._pairs=[],e&&at(e,this,t)}const ut=dt.prototype;function lt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ht(e,t,r){if(!t)return e;const i=r&&r.encode||lt,n=et.isFunction(r)?{serialize:r}:r,o=n&&n.serialize;let s;if(s=o?o(t,n):et.isURLSearchParams(t)?t.toString():new dt(t,n).toString(i),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}ut.append=function(e,t){this._pairs.push([e,t])},ut.toString=function(e){const t=e?function(t){return e.call(this,t,ct)}:ct;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var pt=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){et.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},ft={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Et={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:dt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const mt="undefined"!=typeof window&&"undefined"!=typeof document,_t="object"==typeof navigator&&navigator||void 0,Tt=mt&&(!_t||["ReactNative","NativeScript","NS"].indexOf(_t.product)<0),gt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,St=mt&&window.location.href||"http://localhost";var Rt={...Object.freeze({__proto__:null,hasBrowserEnv:mt,hasStandardBrowserEnv:Tt,hasStandardBrowserWebWorkerEnv:gt,navigator:_t,origin:St}),...Et};function yt(e){function t(e,r,i,n){let o=e[n++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=n>=e.length;if(o=!o&&et.isArray(i)?i.length:o,a)return et.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!s;i[o]&&et.isObject(i[o])||(i[o]=[]);return t(e,r,i[o],n)&&et.isArray(i[o])&&(i[o]=function(e){const t={},r=Object.keys(e);let i;const n=r.length;let o;for(i=0;i<n;i++)o=r[i],t[o]=e[o];return t}(i[o])),!s}if(et.isFormData(e)&&et.isFunction(e.entries)){const r={};return et.forEachEntry(e,((e,i)=>{t(function(e){return et.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),i,r,0)})),r}return null}const vt={transitional:ft,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,n=et.isObject(e);n&&et.isHTMLForm(e)&&(e=new FormData(e));if(et.isFormData(e))return i?JSON.stringify(yt(e)):e;if(et.isArrayBuffer(e)||et.isBuffer(e)||et.isStream(e)||et.isFile(e)||et.isBlob(e)||et.isReadableStream(e))return e;if(et.isArrayBufferView(e))return e.buffer;if(et.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(n){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return at(e,new Rt.classes.URLSearchParams,{visitor:function(e,t,r,i){return Rt.isNode&&et.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=et.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return at(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return n||i?(t.setContentType("application/json",!1),function(e,t,r){if(et.isString(e))try{return(t||JSON.parse)(e),et.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||vt.transitional,r=t&&t.forcedJSONParsing,i="json"===this.responseType;if(et.isResponse(e)||et.isReadableStream(e))return e;if(e&&et.isString(e)&&(r&&!this.responseType||i)){const r=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(e){if(r){if("SyntaxError"===e.name)throw rt.from(e,rt.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Rt.classes.FormData,Blob:Rt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};et.forEach(["delete","get","head","post","put","patch"],(e=>{vt.headers[e]={}}));var At=vt;const bt=et.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const It=Symbol("internals");function Ot(e){return e&&String(e).trim().toLowerCase()}function Ct(e){return!1===e||null==e?e:et.isArray(e)?e.map(Ct):String(e)}function wt(e,t,r,i,n){return et.isFunction(i)?i.call(this,t,r):(n&&(t=r),et.isString(t)?et.isString(i)?-1!==t.indexOf(i):et.isRegExp(i)?i.test(t):void 0:void 0)}class Nt{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function n(e,t,r){const n=Ot(t);if(!n)throw new Error("header name must be a non-empty string");const o=et.findKey(i,n);(!o||void 0===i[o]||!0===r||void 0===r&&!1!==i[o])&&(i[o||t]=Ct(e))}const o=(e,t)=>et.forEach(e,((e,r)=>n(e,r,t)));if(et.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(et.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let r,i,n;return e&&e.split("\n").forEach((function(e){n=e.indexOf(":"),r=e.substring(0,n).trim().toLowerCase(),i=e.substring(n+1).trim(),!r||t[r]&&bt[r]||("set-cookie"===r?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)})),t})(e),t);else if(et.isObject(e)&&et.isIterable(e)){let r,i,n={};for(const t of e){if(!et.isArray(t))throw TypeError("Object iterator must return a key-value pair");n[i=t[0]]=(r=n[i])?et.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}o(n,t)}else null!=e&&n(t,e,r);return this}get(e,t){if(e=Ot(e)){const r=et.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=r.exec(e);)t[i[1]]=i[2];return t}(e);if(et.isFunction(t))return t.call(this,e,r);if(et.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Ot(e)){const r=et.findKey(this,e);return!(!r||void 0===this[r]||t&&!wt(0,this[r],r,t))}return!1}delete(e,t){const r=this;let i=!1;function n(e){if(e=Ot(e)){const n=et.findKey(r,e);!n||t&&!wt(0,r[n],n,t)||(delete r[n],i=!0)}}return et.isArray(e)?e.forEach(n):n(e),i}clear(e){const t=Object.keys(this);let r=t.length,i=!1;for(;r--;){const n=t[r];e&&!wt(0,this[n],n,e,!0)||(delete this[n],i=!0)}return i}normalize(e){const t=this,r={};return et.forEach(this,((i,n)=>{const o=et.findKey(r,n);if(o)return t[o]=Ct(i),void delete t[n];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(n):String(n).trim();s!==n&&delete t[n],t[s]=Ct(i),r[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return et.forEach(this,((r,i)=>{null!=r&&!1!==r&&(t[i]=e&&et.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[It]=this[It]={accessors:{}}).accessors,r=this.prototype;function i(e){const i=Ot(e);t[i]||(!function(e,t){const r=et.toCamelCase(" "+t);["get","set","has"].forEach((i=>{Object.defineProperty(e,i+r,{value:function(e,r,n){return this[i].call(this,t,e,r,n)},configurable:!0})}))}(r,e),t[i]=!0)}return et.isArray(e)?e.forEach(i):i(e),this}}Nt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),et.reduceDescriptors(Nt.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),et.freezeMethods(Nt);var Dt=Nt;function Pt(e,t){const r=this||At,i=t||r,n=Dt.from(i.headers);let o=i.data;return et.forEach(e,(function(e){o=e.call(r,o,n.normalize(),t?t.status:void 0)})),n.normalize(),o}function Lt(e){return!(!e||!e.__CANCEL__)}var kt=class extends rt{constructor(e,t,r){super(null==e?"canceled":e,rt.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}};function Mt(e,t,r){const i=r.config.validateStatus;r.status&&i&&!i(r.status)?t(new rt("Request failed with status code "+r.status,[rt.ERR_BAD_REQUEST,rt.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}const Ut=(e,t,r=3)=>{let i=0;const n=function(e,t){e=e||10;const r=new Array(e),i=new Array(e);let n,o=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),d=i[s];n||(n=c),r[o]=a,i[o]=c;let u=s,l=0;for(;u!==o;)l+=r[u++],u%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),c-n<t)return;const h=d&&c-d;return h?Math.round(1e3*l/h):void 0}}(50,250);return function(e,t){let r,i,n=0,o=1e3/t;const s=(t,o=Date.now())=>{n=o,r=null,i&&(clearTimeout(i),i=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-n;a>=o?s(e,t):(r=e,i||(i=setTimeout((()=>{i=null,s(r)}),o-a)))},()=>r&&s(r)]}((r=>{const o=r.loaded,s=r.lengthComputable?r.total:void 0,a=o-i,c=n(a);i=o;e({loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&o<=s?(s-o)/c:void 0,event:r,lengthComputable:null!=s,[t?"download":"upload"]:!0})}),r)},xt=(e,t)=>{const r=null!=e;return[i=>t[0]({lengthComputable:r,total:e,loaded:i}),t[1]]},Vt=e=>(...t)=>et.asap((()=>e(...t)));var Ft=Rt.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Rt.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Rt.origin),Rt.navigator&&/(msie|trident)/i.test(Rt.navigator.userAgent)):()=>!0,Bt=Rt.hasStandardBrowserEnv?{write(e,t,r,i,n,o,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];et.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),et.isString(i)&&a.push(`path=${i}`),et.isString(n)&&a.push(`domain=${n}`),!0===o&&a.push("secure"),et.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function jt(e,t,r){let i=!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t);return e&&(i||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Gt=e=>e instanceof Dt?{...e}:e;function Wt(e,t){t=t||{};const r={};function i(e,t,r,i){return et.isPlainObject(e)&&et.isPlainObject(t)?et.merge.call({caseless:i},e,t):et.isPlainObject(t)?et.merge({},t):et.isArray(t)?t.slice():t}function n(e,t,r,n){return et.isUndefined(t)?et.isUndefined(e)?void 0:i(void 0,e,0,n):i(e,t,0,n)}function o(e,t){if(!et.isUndefined(t))return i(void 0,t)}function s(e,t){return et.isUndefined(t)?et.isUndefined(e)?void 0:i(void 0,e):i(void 0,t)}function a(r,n,o){return o in t?i(r,n):o in e?i(void 0,r):void 0}const c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t,r)=>n(Gt(e),Gt(t),0,!0)};return et.forEach(Object.keys({...e,...t}),(function(i){const o=c[i]||n,s=o(e[i],t[i],i);et.isUndefined(s)&&o!==a||(r[i]=s)})),r}var Ht=e=>{const t=Wt({},e);let{data:r,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:o,headers:s,auth:a}=t;if(t.headers=s=Dt.from(s),t.url=ht(jt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),et.isFormData(r))if(Rt.hasStandardBrowserEnv||Rt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(et.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach((([e,r])=>{t.includes(e.toLowerCase())&&s.set(e,r)}))}if(Rt.hasStandardBrowserEnv&&(i&&et.isFunction(i)&&(i=i(t)),i||!1!==i&&Ft(t.url))){const e=n&&o&&Bt.read(o);e&&s.set(n,e)}return t};var Kt="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){const i=Ht(e);let n=i.data;const o=Dt.from(i.headers).normalize();let s,a,c,d,u,{responseType:l,onUploadProgress:h,onDownloadProgress:p}=i;function f(){d&&d(),u&&u(),i.cancelToken&&i.cancelToken.unsubscribe(s),i.signal&&i.signal.removeEventListener("abort",s)}let E=new XMLHttpRequest;function m(){if(!E)return;const i=Dt.from("getAllResponseHeaders"in E&&E.getAllResponseHeaders());Mt((function(e){t(e),f()}),(function(e){r(e),f()}),{data:l&&"text"!==l&&"json"!==l?E.response:E.responseText,status:E.status,statusText:E.statusText,headers:i,config:e,request:E}),E=null}E.open(i.method.toUpperCase(),i.url,!0),E.timeout=i.timeout,"onloadend"in E?E.onloadend=m:E.onreadystatechange=function(){E&&4===E.readyState&&(0!==E.status||E.responseURL&&0===E.responseURL.indexOf("file:"))&&setTimeout(m)},E.onabort=function(){E&&(r(new rt("Request aborted",rt.ECONNABORTED,e,E)),E=null)},E.onerror=function(t){const i=t&&t.message?t.message:"Network Error",n=new rt(i,rt.ERR_NETWORK,e,E);n.event=t||null,r(n),E=null},E.ontimeout=function(){let t=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const n=i.transitional||ft;i.timeoutErrorMessage&&(t=i.timeoutErrorMessage),r(new rt(t,n.clarifyTimeoutError?rt.ETIMEDOUT:rt.ECONNABORTED,e,E)),E=null},void 0===n&&o.setContentType(null),"setRequestHeader"in E&&et.forEach(o.toJSON(),(function(e,t){E.setRequestHeader(t,e)})),et.isUndefined(i.withCredentials)||(E.withCredentials=!!i.withCredentials),l&&"json"!==l&&(E.responseType=i.responseType),p&&([c,u]=Ut(p,!0),E.addEventListener("progress",c)),h&&E.upload&&([a,d]=Ut(h),E.upload.addEventListener("progress",a),E.upload.addEventListener("loadend",d)),(i.cancelToken||i.signal)&&(s=t=>{E&&(r(!t||t.type?new kt(null,e,E):t),E.abort(),E=null)},i.cancelToken&&i.cancelToken.subscribe(s),i.signal&&(i.signal.aborted?s():i.signal.addEventListener("abort",s)));const _=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(i.url);_&&-1===Rt.protocols.indexOf(_)?r(new rt("Unsupported protocol "+_+":",rt.ERR_BAD_REQUEST,e)):E.send(n||null)}))};var Yt=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,i=new AbortController;const n=function(e){if(!r){r=!0,s();const t=e instanceof Error?e:this.reason;i.abort(t instanceof rt?t:new kt(t instanceof Error?t.message:t))}};let o=t&&setTimeout((()=>{o=null,n(new rt(`timeout of ${t}ms exceeded`,rt.ETIMEDOUT))}),t);const s=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(n):e.removeEventListener("abort",n)})),e=null)};e.forEach((e=>e.addEventListener("abort",n)));const{signal:a}=i;return a.unsubscribe=()=>et.asap(s),a}};const zt=function*(e,t){let r=e.byteLength;if(!t||r<t)return void(yield e);let i,n=0;for(;n<r;)i=n+t,yield e.slice(n,i),n=i},Xt=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},Zt=(e,t,r,i)=>{const n=async function*(e,t){for await(const r of Xt(e))yield*zt(r,t)}(e,t);let o,s=0,a=e=>{o||(o=!0,i&&i(e))};return new ReadableStream({async pull(e){try{const{done:t,value:i}=await n.next();if(t)return a(),void e.close();let o=i.byteLength;if(r){let e=s+=o;r(e)}e.enqueue(new Uint8Array(i))}catch(e){throw a(e),e}},cancel:e=>(a(e),n.return())},{highWaterMark:2})},{isFunction:Jt}=et,Qt=(({Request:e,Response:t})=>({Request:e,Response:t}))(et.global),{ReadableStream:qt,TextEncoder:$t}=et.global,er=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},tr=e=>{e=et.merge.call({skipUndefined:!0},Qt,e);const{fetch:t,Request:r,Response:i}=e,n=t?Jt(t):"function"==typeof fetch,o=Jt(r),s=Jt(i);if(!n)return!1;const a=n&&Jt(qt),c=n&&("function"==typeof $t?(d=new $t,e=>d.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var d;const u=o&&a&&er((()=>{let e=!1;const t=new r(Rt.origin,{body:new qt,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),l=s&&a&&er((()=>et.isReadableStream(new i("").body))),h={stream:l&&(e=>e.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!h[e]&&(h[e]=(t,r)=>{let i=t&&t[e];if(i)return i.call(t);throw new rt(`Response type '${e}' is not supported`,rt.ERR_NOT_SUPPORT,r)})}));const p=async(e,t)=>{const i=et.toFiniteNumber(e.getContentLength());return null==i?(async e=>{if(null==e)return 0;if(et.isBlob(e))return e.size;if(et.isSpecCompliantForm(e)){const t=new r(Rt.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return et.isArrayBufferView(e)||et.isArrayBuffer(e)?e.byteLength:(et.isURLSearchParams(e)&&(e+=""),et.isString(e)?(await c(e)).byteLength:void 0)})(t):i};return async e=>{let{url:n,method:s,data:a,signal:c,cancelToken:d,timeout:f,onDownloadProgress:E,onUploadProgress:m,responseType:_,headers:T,withCredentials:g="same-origin",fetchOptions:S}=Ht(e),R=t||fetch;_=_?(_+"").toLowerCase():"text";let y=Yt([c,d&&d.toAbortSignal()],f),v=null;const A=y&&y.unsubscribe&&(()=>{y.unsubscribe()});let b;try{if(m&&u&&"get"!==s&&"head"!==s&&0!==(b=await p(T,a))){let e,t=new r(n,{method:"POST",body:a,duplex:"half"});if(et.isFormData(a)&&(e=t.headers.get("content-type"))&&T.setContentType(e),t.body){const[e,r]=xt(b,Ut(Vt(m)));a=Zt(t.body,65536,e,r)}}et.isString(g)||(g=g?"include":"omit");const t=o&&"credentials"in r.prototype,c={...S,signal:y,method:s.toUpperCase(),headers:T.normalize().toJSON(),body:a,duplex:"half",credentials:t?g:void 0};v=o&&new r(n,c);let d=await(o?R(v,S):R(n,c));const f=l&&("stream"===_||"response"===_);if(l&&(E||f&&A)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=d[t]}));const t=et.toFiniteNumber(d.headers.get("content-length")),[r,n]=E&&xt(t,Ut(Vt(E),!0))||[];d=new i(Zt(d.body,65536,r,(()=>{n&&n(),A&&A()})),e)}_=_||"text";let I=await h[et.findKey(h,_)||"text"](d,e);return!f&&A&&A(),await new Promise(((t,r)=>{Mt(t,r,{data:I,headers:Dt.from(d.headers),status:d.status,statusText:d.statusText,config:e,request:v})}))}catch(t){if(A&&A(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new rt("Network Error",rt.ERR_NETWORK,e,v),{cause:t.cause||t});throw rt.from(t,t&&t.code,e,v)}}},rr=new Map,ir=e=>{let t=e&&e.env||{};const{fetch:r,Request:i,Response:n}=t,o=[i,n,r];let s,a,c=o.length,d=rr;for(;c--;)s=o[c],a=d.get(s),void 0===a&&d.set(s,a=c?new Map:tr(t)),d=a;return a};ir();const nr={http:null,xhr:Kt,fetch:{get:ir}};et.forEach(nr,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const or=e=>`- ${e}`,sr=e=>et.isFunction(e)||null===e||!1===e;var ar={getAdapter:function(e,t){e=et.isArray(e)?e:[e];const{length:r}=e;let i,n;const o={};for(let s=0;s<r;s++){let r;if(i=e[s],n=i,!sr(i)&&(n=nr[(r=String(i)).toLowerCase()],void 0===n))throw new rt(`Unknown adapter '${r}'`);if(n&&(et.isFunction(n)||(n=n.get(t))))break;o[r||"#"+s]=n}if(!n){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));let t=r?e.length>1?"since :\n"+e.map(or).join("\n"):" "+or(e[0]):"as no adapter specified";throw new rt("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return n},adapters:nr};function cr(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new kt(null,e)}function dr(e){cr(e),e.headers=Dt.from(e.headers),e.data=Pt.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return ar.getAdapter(e.adapter||At.adapter,e)(e).then((function(t){return cr(e),t.data=Pt.call(e,e.transformResponse,t),t.headers=Dt.from(t.headers),t}),(function(t){return Lt(t)||(cr(e),t&&t.response&&(t.response.data=Pt.call(e,e.transformResponse,t.response),t.response.headers=Dt.from(t.response.headers))),Promise.reject(t)}))}const ur="1.13.4",lr={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{lr[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const hr={};lr.transitional=function(e,t,r){function i(e,t){return"[Axios v"+ur+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,n,o)=>{if(!1===e)throw new rt(i(n," has been removed"+(t?" in "+t:"")),rt.ERR_DEPRECATED);return t&&!hr[n]&&(hr[n]=!0,console.warn(i(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,o)}},lr.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var pr={assertOptions:function(e,t,r){if("object"!=typeof e)throw new rt("options must be an object",rt.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let n=i.length;for(;n-- >0;){const o=i[n],s=t[o];if(s){const t=e[o],r=void 0===t||s(t,o,e);if(!0!==r)throw new rt("option "+o+" must be "+r,rt.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new rt("Unknown option "+o,rt.ERR_BAD_OPTION)}},validators:lr};const fr=pr.validators;let Er=class{constructor(e){this.defaults=e||{},this.interceptors={request:new pt,response:new pt}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Wt(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:n}=t;void 0!==r&&pr.assertOptions(r,{silentJSONParsing:fr.transitional(fr.boolean),forcedJSONParsing:fr.transitional(fr.boolean),clarifyTimeoutError:fr.transitional(fr.boolean)},!1),null!=i&&(et.isFunction(i)?t.paramsSerializer={serialize:i}:pr.assertOptions(i,{encode:fr.function,serialize:fr.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),pr.assertOptions(t,{baseUrl:fr.spelling("baseURL"),withXsrfToken:fr.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=n&&et.merge(n.common,n[t.method]);n&&et.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete n[e]})),t.headers=Dt.concat(o,n);const s=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));const c=[];let d;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let u,l=0;if(!a){const e=[dr.bind(this),void 0];for(e.unshift(...s),e.push(...c),u=e.length,d=Promise.resolve(t);l<u;)d=d.then(e[l++],e[l++]);return d}u=s.length;let h=t;for(;l<u;){const e=s[l++],t=s[l++];try{h=e(h)}catch(e){t.call(this,e);break}}try{d=dr.call(this,h)}catch(e){return Promise.reject(e)}for(l=0,u=c.length;l<u;)d=d.then(c[l++],c[l++]);return d}getUri(e){return ht(jt((e=Wt(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};et.forEach(["delete","get","head","options"],(function(e){Er.prototype[e]=function(t,r){return this.request(Wt(r||{},{method:e,url:t,data:(r||{}).data}))}})),et.forEach(["post","put","patch"],(function(e){function t(t){return function(r,i,n){return this.request(Wt(n||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}Er.prototype[e]=t(),Er.prototype[e+"Form"]=t(!0)}));var mr=Er;class _r{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const i=new Promise((e=>{r.subscribe(e),t=e})).then(e);return i.cancel=function(){r.unsubscribe(t)},i},e((function(e,i,n){r.reason||(r.reason=new kt(e,i,n),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new _r((function(t){e=t})),cancel:e}}}var Tr=_r;const gr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(gr).forEach((([e,t])=>{gr[t]=e}));var Sr=gr;const Rr=function e(t){const r=new mr(t),i=le(mr.prototype.request,r);return et.extend(i,mr.prototype,r,{allOwnKeys:!0}),et.extend(i,r,null,{allOwnKeys:!0}),i.create=function(r){return e(Wt(t,r))},i}(At);Rr.Axios=mr,Rr.CanceledError=kt,Rr.CancelToken=Tr,Rr.isCancel=Lt,Rr.VERSION=ur,Rr.toFormData=at,Rr.AxiosError=rt,Rr.Cancel=Rr.CanceledError,Rr.all=function(e){return Promise.all(e)},Rr.spread=function(e){return function(t){return e.apply(null,t)}},Rr.isAxiosError=function(e){return et.isObject(e)&&!0===e.isAxiosError},Rr.mergeConfig=Wt,Rr.AxiosHeaders=Dt,Rr.formToJSON=e=>yt(et.isHTMLForm(e)?new FormData(e):e),Rr.getAdapter=ar.getAdapter,Rr.HttpStatusCode=Sr,Rr.default=Rr;var yr=Rr;let vr=function(e){return e.WIN_10="Windows 10",e.WIN_81="Windows 8.1",e.WIN_8="Windows 8",e.WIN_7="Windows 7",e.WIN_VISTA="Windows Vista",e.WIN_SERVER_2003="Windows Server 2003",e.WIN_XP="Windows XP",e.WIN_2000="Windows 2000",e.ANDROID="Android",e.HARMONY_OS="HarmonyOS",e.OPEN_BSD="Open BSD",e.SUN_OS="Sun OS",e.LINUX="Linux",e.IOS="iOS",e.MAC_OS="Mac OS",e.CHROMIUM_OS="Chromium OS",e.QNX="QNX",e.UNIX="UNIX",e.BEOS="BeOS",e.OS_2="OS/2",e.SEARCH_BOT="Search Bot",e}({}),Ar=function(e){return e.CHROME="Chrome",e.SAFARI="Safari",e.EDGE="Edge",e.FIREFOX="Firefox",e.OPERA="OPR",e.QQ="QQBrowser",e.WECHAT="MicroMessenger",e}({});const br=new ue;let Ir=br.getResult(),Or=null;function Cr(e){if(!Or){e&&br.setUA(e),Ir=br.getResult();const t=function(e){if("Blink"===e.engine.name&&"WeChat"!==e.browser.name)return Ar.CHROME;switch(e.browser.name){case"Chrome Headless":case"Chrome":case"Chromium":return Ar.CHROME;case"Safari":case"Mobile Safari":return Ar.SAFARI;case"Edge":return Ar.EDGE;case"Firefox":return Ar.FIREFOX;case"QQ":case"QQBrowser":return Ar.QQ;case"Opera":return Ar.OPERA;case"WeChat":return Ar.WECHAT;default:return e.browser.name||""}}(Ir),r=wr(Ir),i=function(e){return"Windows"===e.os.name?e.os.version?e.os.name+" "+e.os.version:e.os.name:e.os.name||""}(Ir),n=Ir.os.version,o=wr(Ir,!1),s=Ir.device.type;if(!(t&&r&&i&&n))return{name:t,version:r,os:i,osVersion:n,browserVersion:o,deviceType:s};Or={name:t,version:r,os:i,osVersion:n,browserVersion:o,deviceType:s}}return Or}function wr(e){let t,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t="Blink"===e.engine.name?e.engine.version||"":e.browser.version||"",r?t.split(".")[0]:t}function Nr(){return Cr().os}function Dr(){const e=Cr();return"".concat(e.os," ").concat(e.osVersion)}function Pr(){const e=Cr();return!!("WebKit"===Ir.engine.name&&e.os===vr.MAC_OS&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0&&e.name!==Ar.SAFARI||xr()&&e.name!==Ar.SAFARI)}function Lr(){return Cr().name===Ar.CHROME}function kr(){return Cr().name===Ar.SAFARI}function Mr(){return Cr().name===Ar.EDGE}function Ur(){return Cr().name===Ar.FIREFOX}function xr(){return Cr().os===vr.IOS}function Vr(e){const t=Cr();return!(t.name!==Ar.CHROME||!t.osVersion)&&Number(t.version)>=e}function Fr(e,t,r){const i=Cr();return!(i.name!==e||!i.osVersion)&&(r?Number(i.version)>=t&&Number(i.version)<=r:Number(i.version)===t)}function Br(e){const t=Cr();return!(t.name!==Ar.EDGE||!t.osVersion)&&Number(t.version)>=e}function jr(e){const t=Cr();return!(t.name!==Ar.FIREFOX||!t.osVersion)&&Number(t.version)>=e}function Gr(e){const t=Cr();return!(t.name!==Ar.OPERA||!t.osVersion)&&Number(t.version)>=e}function Wr(){const e=Cr();if(e.os!==vr.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])}function Hr(){const e=Cr();if(e.os!==vr.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 16===Number(t[0])}function Kr(){const e=Cr();if(e.os!==vr.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=1}function Yr(){return kr()&&navigator.maxTouchPoints>0}function zr(){return Cr().name===Ar.WECHAT}function Xr(){return window.navigator.appVersion&&null!==window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)&&window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)[1]<=35}function Zr(){const e=Nr();return function(){const{deviceType:e}=Cr();return"mobile"===e||"tablet"===e}()||e===vr.ANDROID||e===vr.IOS||e===vr.HARMONY_OS}function Jr(){const e=Cr();return e.name!==Ar.EDGE&&e.name!==Ar.SAFARI&&!!navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]./i)}function Qr(){return Nr()===vr.ANDROID}function qr(){const e=Cr();return Qr()&&(e.name===Ar.CHROME||e.name===Ar.WECHAT||/chrome|chromium/i.test(navigator.userAgent))}function $r(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function ei(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$r(Object(r),!0).forEach((function(t){ti(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$r(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function ti(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}let ri=function(e){return e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.UNEXPECTED_RESPONSE="UNEXPECTED_RESPONSE",e.TIMEOUT="TIMEOUT",e.INVALID_PARAMS="INVALID_PARAMS",e.NOT_READABLE="NOT_READABLE",e.NOT_SUPPORTED="NOT_SUPPORTED",e.INVALID_OPERATION="INVALID_OPERATION",e.OPERATION_ABORTED="OPERATION_ABORTED",e.WEB_SECURITY_RESTRICT="WEB_SECURITY_RESTRICT",e.EXCHANGE_SDP_FAILED="EXCHANGE_SDP_FAILED",e.ADD_CANDIDATE_FAILED="ADD_CANDIDATE_FAILED",e.DATACHANNEL_FAILED="DATACHANNEL_FAILED",e.NETWORK_ERROR="NETWORK_ERROR",e.NETWORK_TIMEOUT="NETWORK_TIMEOUT",e.NETWORK_RESPONSE_ERROR="NETWORK_RESPONSE_ERROR",e.API_INVOKE_TIMEOUT="API_INVOKE_TIMEOUT",e.ENUMERATE_DEVICES_FAILED="ENUMERATE_DEVICES_FAILED",e.DEVICE_NOT_FOUND="DEVICE_NOT_FOUND",e.ELECTRON_IS_NULL="ELECTRON_IS_NULL",e.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR="ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR",e.CHROME_PLUGIN_NO_RESPONSE="CHROME_PLUGIN_NO_RESPONSE",e.CHROME_PLUGIN_NOT_INSTALL="CHROME_PLUGIN_NOT_INSTALL",e.MEDIA_OPTION_INVALID="MEDIA_OPTION_INVALID",e.PERMISSION_DENIED="PERMISSION_DENIED",e.CONSTRAINT_NOT_SATISFIED="CONSTRAINT_NOT_SATISFIED",e.TRACK_IS_DISABLED="TRACK_IS_DISABLED",e.GET_VIDEO_ELEMENT_VISIBLE_ERROR="GET_VIDEO_ELEMENT_VISIBLE_ERROR",e.SHARE_AUDIO_NOT_ALLOWED="SHARE_AUDIO_NOT_ALLOWED",e.LOW_STREAM_ENCODING_ERROR="LOW_STREAM_ENCODING_ERROR",e.SET_ENCODING_PARAMETER_ERROR="SET_ENCODING_PARAMETER_ERROR",e.TRACK_STATE_UNREACHABLE="TRACK_STATE_UNREACHABLE",e.INVALID_UINT_UID_FROM_STRING_UID="INVALID_UINT_UID_FROM_STRING_UID",e.CAN_NOT_GET_PROXY_SERVER="CAN_NOT_GET_PROXY_SERVER",e.CAN_NOT_GET_GATEWAY_SERVER="CAN_NOT_GET_GATEWAY_SERVER",e.VOID_GATEWAY_ADDRESS="VOID_GATEWAY_ADDRESS",e.UID_CONFLICT="UID_CONFLICT",e.MULTI_UNILBS_RESPONSE_ERROR="MULTI_UNILBS_RESPONSE_ERROR",e.UPDATE_TICKET_FAILED="UPDATE_TICKET_FAILED",e.TOKEN_EXPIRE="TOKEN_EXPIRE",e.INVALID_LOCAL_TRACK="INVALID_LOCAL_TRACK",e.INVALID_TRACK="INVALID_TRACK",e.SENDER_NOT_FOUND="SENDER_NOT_FOUND",e.CREATE_OFFER_FAILED="CREATE_OFFER_FAILED",e.SET_ANSWER_FAILED="SET_ANSWER_FAILED",e.ICE_FAILED="ICE_FAILED",e.PC_CLOSED="PC_CLOSED",e.SENDER_REPLACE_FAILED="SENDER_REPLACE_FAILED",e.GET_LOCAL_CAPABILITIES_FAILED="GET_LOCAL_CAPABILITIES_FAILED",e.GET_LOCAL_CONNECTION_PARAMS_FAILED="GET_LOCAL_CONNECTION_PARAMS_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.GATEWAY_P2P_LOST="GATEWAY_P2P_LOST",e.NO_ICE_CANDIDATE="NO_ICE_CANDIDATE",e.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS="CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS",e.EXIST_DISABLED_VIDEO_TRACK="EXIST_DISABLED_VIDEO_TRACK",e.INVALID_REMOTE_USER="INVALID_REMOTE_USER",e.REMOTE_USER_IS_NOT_PUBLISHED="REMOTE_USER_IS_NOT_PUBLISHED",e.CUSTOM_REPORT_SEND_FAILED="CUSTOM_REPORT_SEND_FAILED",e.CUSTOM_REPORT_FREQUENCY_TOO_HIGH="CUSTOM_REPORT_FREQUENCY_TOO_HIGH",e.FETCH_AUDIO_FILE_FAILED="FETCH_AUDIO_FILE_FAILED",e.READ_LOCAL_AUDIO_FILE_ERROR="READ_LOCAL_AUDIO_FILE_ERROR",e.DECODE_AUDIO_FILE_FAILED="DECODE_AUDIO_FILE_FAILED",e.WS_ABORT="WS_ABORT",e.WS_DISCONNECT="WS_DISCONNECT",e.WS_ERR="WS_ERR",e.EXTERNAL_SIGNAL_ABORT="EXTERNAL_SIGNAL_ABORT",e.LIVE_STREAMING_TASK_CONFLICT="LIVE_STREAMING_TASK_CONFLICT",e.LIVE_STREAMING_INVALID_ARGUMENT="LIVE_STREAMING_INVALID_ARGUMENT",e.LIVE_STREAMING_INTERNAL_SERVER_ERROR="LIVE_STREAMING_INTERNAL_SERVER_ERROR",e.LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED="LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED",e.LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED="LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED",e.LIVE_STREAMING_CDN_ERROR="LIVE_STREAMING_CDN_ERROR",e.LIVE_STREAMING_INVALID_RAW_STREAM="LIVE_STREAMING_INVALID_RAW_STREAM",e.LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT="LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT",e.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE="LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE",e.LIVE_STREAMING_WARN_FREQUENT_REQUEST="LIVE_STREAMING_WARN_FREQUENT_REQUEST",e.WEBGL_INTERNAL_ERROR="WEBGL_INTERNAL_ERROR",e.BEAUTY_PROCESSOR_INTERNAL_ERROR="BEAUTY_PROCESSOR_INTERNAL_ERROR",e.CROSS_CHANNEL_WAIT_STATUS_ERROR="CROSS_CHANNEL_WAIT_STATUS_ERROR",e.CROSS_CHANNEL_FAILED_JOIN_SRC="CROSS_CHANNEL_FAILED_JOIN_SEC",e.CROSS_CHANNEL_FAILED_JOIN_DEST="CROSS_CHANNEL_FAILED_JOIN_DEST",e.CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST="CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST",e.CROSS_CHANNEL_SERVER_ERROR_RESPONSE="CROSS_CHANNEL_SERVER_ERROR_RESPONSE",e.METADATA_OUT_OF_RANGE="METADATA_OUT_OF_RANGE",e.LOCAL_AEC_ERROR="LOCAL_AEC_ERROR",e.INVALID_PLUGIN="INVALID_PLUGIN",e.DISCONNECT_P2P="DISCONNECT_P2P",e.CONVERTING_IMAGEDATA_TO_BLOB_FAILED="CONVERTING_IMAGEDATA_TO_BLOB_FAILED",e.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED="CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED",e.INIT_DATACHANNEL_TIMEOUT="INIT_DATACHANNEL_TIMEOUT",e.CREATE_DATACHANNEL_ERROR="CREATE_DATACHANNEL_ERROR",e.DATACHANNEL_CONNECTION_TIMEOUT="DATACHANNEL_CONNECTION_TIMEOUT",e.PROHIBITED_OPERATION="PROHIBITED_OPERATION",e.IMAGE_MODERATION_UPLOAD_FAILED="IMAGE_MODERATION_UPLOAD_FAILED",e.P2P_MESSAGE_FAILED="P2P_MESSAGE_FAILED",e}({});class ii extends Error{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;super(t),ti(this,"code",void 0),ti(this,"message",void 0),ti(this,"data",void 0),ti(this,"name","AgoraRTCException"),this.code=e,this.message="AgoraRTCError ".concat(this.code,": ").concat(t),this.data=r}toString(){return this.data?"".concat(this.message,"\ndata: ").concat(JSON.stringify(this.data)):this.message}print(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"error",t=arguments.length>1?arguments[1]:void 0;return"error"===e&&(t||console).error(this.toString()),"warning"===e&&(t||console).warn(this.toString()),this}throw(e){throw this.print("error",e),this}}function ni(e,t){if("boolean"!=typeof e)throw new ii(ri.INVALID_PARAMS,"Invalid ".concat(t,": The value is of the boolean type."))}function oi(e,t,r){if(!r.includes(e))throw new ii(ri.INVALID_PARAMS,"".concat(t," can only be set as ").concat(JSON.stringify(r)))}function si(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e4;if(e<r||e>i||(!(arguments.length>4&&void 0!==arguments[4])||arguments[4])&&!function(e){return"number"==typeof e&&e%1==0}(e))throw new ii(ri.INVALID_PARAMS,"invalid ".concat(t,": the value range is [").concat(r,", ").concat(i,"]. integer only"))}function ai(e,t){if("number"!=typeof e){if(!(e.min||e.max||e.ideal||e.exact))throw new ii(ri.INVALID_PARAMS,"".concat(t," is not a valid ConstrainLong"));void 0!==e.min&&si(e.min,"".concat(t,".min"),0,1/0),void 0!==e.max&&si(e.max,"".concat(t,".max"),1,1/0),void 0!==e.exact&&si(e.exact,"".concat(t,".exact"),1,1/0),void 0!==e.ideal&&si(e.ideal,"".concat(t,".ideal"),1,1/0)}else si(e,t,1,1/0)}function ci(e){return null==e}var di=function(e){return e.COVERED="COVERED",e.POSITION="POSITION",e.SIZE="SIZE",e.STYLE="STYLE",e}(di||{}),ui=function(e){return e.UNMOUNTED="UNMOUNTED",e.INVALID_HTML_ELEMENT="INVALID_HTML_ELEMENT",e}(ui||{});const li=new class{constructor(){ti(this,"_clientSize",null),ti(this,"getClientWidth",(()=>document.documentElement?document.documentElement.clientWidth:document.body.clientWidth)),ti(this,"getClientHeight",(()=>document.documentElement?document.documentElement.clientHeight:document.body.clientHeight)),ti(this,"getStyle",(e=>window.getComputedStyle(e,null))),ti(this,"checkCssVisibleProperty",(e=>{let t=!0;const r=this.getStyle(e),{display:i,visibility:n,opacity:o,filter:s}=r;return("none"===i||["hidden","collapse"].includes(n)||Number(o)<.1)&&(t=!1),!!t&&(s&&s.split(" ").filter((e=>{const t=e.split("(")[0];return["brightness","blur","opacity"].includes(t)})).map((e=>{const[t,r]=e.split(/\(|\)/);return[t,Number(r.match(/^[0-9\.]+/))]})).forEach((e=>{const[r,i]=e;switch(r){case"brightness":(i<.1||i>3)&&(t=!1);break;case"blur":i>3&&(t=!1);break;case"opacity":i<.1&&(t=!1)}})),t)})),ti(this,"checkPropertyUpToAllParentNodes",((e,t)=>{let r=!0,i=!0;const n=e=>t(e);let o=e;for(;o&&i;)n(o)||(r=!1,i=!1),o=o.parentElement,o||(i=!1);return r})),ti(this,"checkActualCssVisibleIncludeInherit",(e=>this.checkPropertyUpToAllParentNodes(e,this.checkCssVisibleProperty))),ti(this,"getSizeAboutClient",(e=>{const{width:t,height:r,left:i,right:n,top:o,bottom:s}=e.getBoundingClientRect(),a=this.getClientWidth(),c=this.getClientHeight();return{width:t,height:r,left:i,right:n,top:o,bottom:s,clientWidth:a,clientHeight:c,clientMin:Math.min(a,c)}})),ti(this,"checkActualSize",(()=>{const{width:e,height:t,clientMin:r}=this._clientSize;return this.checkSizeIsVisible(e,t,r)})),ti(this,"elementFromPoint",((e,t)=>document.elementFromPoint?document.elementFromPoint(e,t):null)),ti(this,"checkCoverForAPoint",((e,t,r)=>{const i=this.elementFromPoint(e,t);return null!==i&&i!==r})),ti(this,"getPointPositionList",(()=>{const{width:e,height:t,left:r,top:i}=this._clientSize,n=e/6,o=t/6,s=[],a=10**6;for(let e=0;e<5;e++)for(let t=0;t<5;t++){const c=(r*a+(0===e?.1:4===e?(n*e*a-1e5)/a:n*e)*a)/a,d=(i*a+(0===t?.1:4===t?(o*t*a-1e5)/a:o*t)*a)/a;s.push({x:c,y:d})}return[...s]})),ti(this,"checkElementCover",(e=>this.getPointPositionList().map((t=>this.checkCoverForAPoint(t.x,t.y,e))).filter((e=>!!e)).length>6)),ti(this,"checkSizeIsVisible",((e,t,r)=>(e>50||r/e<=10)&&(t>50||r/t<=10))),ti(this,"checkSizeOfPartInClient",(()=>{const{left:e,right:t,top:r,bottom:i,clientHeight:n,clientWidth:o,clientMin:s}=this._clientSize;let a,c,d,u;if(e<0)a=0;else{if(!(e<o))return!1;a=e}if(t<0)return!1;if(c=t<o?t:o,r<0)d=0;else{if(!(r<n))return!1;d=r}if(i<0)return!1;u=i<n?i:n;const l=c-a,h=u-d;return this.checkSizeIsVisible(l,h,s)})),ti(this,"returnHiddenResult",(e=>(this._clientSize=null,{visible:!1,reason:e}))),ti(this,"checkOneElementVisible",(e=>{if(e instanceof HTMLElement){if(this.checkElementIsMountedOnDom(e)){if(this.checkActualCssVisibleIncludeInherit(e)){if(this._clientSize=this.getSizeAboutClient(e),this.checkElementCover(e))return this.returnHiddenResult(di.COVERED);{const e=this.checkActualSize(),t=this.checkSizeOfPartInClient();return e&&!t?this.returnHiddenResult(di.POSITION):e?(this._clientSize=null,{visible:!0}):this.returnHiddenResult(di.SIZE)}}return this.returnHiddenResult(di.STYLE)}return this.returnHiddenResult(ui.UNMOUNTED)}return this.returnHiddenResult(ui.INVALID_HTML_ELEMENT)})),ti(this,"checkElementIsMountedOnDom",(e=>this.checkPropertyUpToAllParentNodes(e,(e=>"HTML"!==e.nodeName.toUpperCase()?null!==e.parentElement:!!document.documentElement))))}};const hi=function(e,t){const r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r};class pi{constructor(){ti(this,"_events",{}),ti(this,"addListener",this.on)}getListeners(e){return this._events[e]?this._events[e].map((e=>e.listener)):[]}on(e,t){this._events[e]||(this._events[e]=[]);const r=this._events[e];-1===this._indexOfListener(r,t)&&r.push({listener:t,once:!1})}once(e,t){this._events[e]||(this._events[e]=[]);const r=this._events[e];-1===this._indexOfListener(r,t)&&r.push({listener:t,once:!0})}off(e,t){if(!this._events[e])return;const r=this._events[e],i=this._indexOfListener(r,t);-1!==i&&r.splice(i,1),0===this._events[e].length&&delete this._events[e]}removeAllListeners(e){e?delete this._events[e]:this._events={}}emit(e){this._events[e]||(this._events[e]=[]);const t=this._events[e].map((e=>e));for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];for(let r=0;r<t.length;r+=1){const n=t[r];n.once&&this.off(e,n.listener),n.listener.apply(this,i||[])}}safeEmit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];[...this._events[e]||[]].forEach((t=>{t.once&&this.off(e,t.listener);try{t.listener.apply(this,r)}catch(t){console.error("safeEmit event:".concat(e," error ").concat(null==t?void 0:t.toString()))}}))}_indexOfListener(e,t){let r=e.length;for(;r--;)if(e[r].listener===t)return r;return-1}}function fi(){return!!mi()}let Ei=null;function mi(){if(Ei)return Ei;if(window.electron)return Ei=window.electron;if(!window.require)return null;try{return Ei=window.require("electron"),Ei}catch(e){return null}}let _i=function(e){return e.CREATE_CLIENT="createClient",e.CHECK_SYSTEM_REQUIREMENTS="checkSystemRequirements",e.SET_AREA="setArea",e.PRELOAD="PRELOAD",e.CHECK_VIDEO_TRACK_IS_ACTIVE="checkVideoTrackIsActive",e.CHECK_AUDIO_TRACK_IS_ACTIVE="checkAudioTrackIsActive",e.CREATE_MIC_AUDIO_TRACK="createMicrophoneAudioTrack",e.CREATE_CUSTOM_AUDIO_TRACK="createCustomAudioTrack",e.CREATE_BUFFER_AUDIO_TRACK="createBufferSourceAudioTrack",e.CREATE_CAM_VIDEO_TRACK="createCameraVideoTrack",e.CREATE_CUSTOM_VIDEO_TRACK="createCustomVideoTrack",e.CREATE_MIC_AND_CAM_TRACKS="createMicrophoneAndCameraTracks",e.CREATE_SCREEN_VIDEO_TRACK="createScreenVideoTrack",e.SET_ENCRYPTION_CONFIG="Client.setEncryptionConfig",e.START_PROXY_SERVER="Client.startProxyServer",e.STOP_PROXY_SERVER="Client.stopProxyServer",e.SET_PROXY_SERVER="Client.setProxyServer",e.SET_TURN_SERVER="Client.setTurnServer",e.SET_CLIENT_ROLE="Client.setClientRole",e.SET_LOW_STREAM_PARAMETER="Client.setLowStreamParameter",e.ENABLE_DUAL_STREAM="Client.enableDualStream",e.DISABLE_DUAL_STREAM="Client.disableDualStream",e.JOIN="Client.join",e.LEAVE="Client.leave",e.PUBLISH="Client.publish",e.UNPUBLISH="Client.unpublish",e.SUBSCRIBE="Client.subscribe",e.MASS_SUBSCRIBE="Client.massSubscribe",e.MASS_UNSUBSCRIBE="Client.massUnsubscribe",e.UNSUBSCRIBE="Client.unsubscribe",e.RENEW_TOKEN="Client.renewToken",e.SET_REMOTE_VIDEO_STREAM_TYPE="Client.setRemoteVideoStreamType",e.SET_STREAM_FALLBACK_OPTION="Client.setStreamFallbackOption",e.ENABLE_AUDIO_VOLUME_INDICATOR="Client.enableAudioVolumeIndicator",e.SEND_CUSTOM_REPORT_MESSAGE="Client.sendCustomReportMessage",e.INSPECT_VIDEO_CONTENT="Client.inspectVideoContent",e.STOP_INSPECT_VIDEO_CONTENT="Client.stopInspectVideoContent",e.JOIN_FALLBACK_TO_PROXY="Client._joinFallbackToProxy",e.ON_LIVE_STREAM_WARNING="Client.onLiveStreamWarning",e.ON_LIVE_STREAM_ERROR="Client.onLiveStreamingError",e.START_LIVE_STREAMING="Client.startLiveStreaming",e.SET_LIVE_TRANSCODING="Client.setLiveTranscoding",e.STOP_LIVE_STREAMING="Client.stopLiveStreaming",e.START_CHANNEL_MEDIA_RELAY="Client.startChannelMediaRelay",e.UPDATE_CHANNEL_MEDIA_RELAY="Client.updateChannelMediaRelay",e.STOP_CHANNEL_MEDIA_RELAY="Client.stopChannelMediaRelay",e.REQUEST_CONFIG_DISTRIBUTE="_config-distribute-request",e.SET_CONFIG_DISTRIBUTE="_configDistribute",e.LOCAL_TRACK_SET_MUTED="LocalTrack.setMute",e.LOCAL_AUDIO_TRACK_PLAY="LocalAudioTrack.play",e.LOCAL_AUDIO_TRACK_PLAY_IN_ELEMENT="LocalAudioTrack.playInElement",e.LOCAL_AUDIO_TRACK_STOP="LocalAudioTrack.stop",e.LOCAL_AUDIO_TRACK_SET_VOLUME="LocalAudioTrack.setVolume",e.MIC_AUDIO_TRACK_SET_DEVICE="MicrophoneAudioTrack.setDevice",e.BUFFER_AUDIO_TRACK_START="BufferSourceAudioTrack.startProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_STOP="BufferSourceAudioTrack.stopProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_PAUSE="BufferSourceAudioTrack.pauseProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_RESUME="BufferSourceAudioTrack.resumeProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_SEEK="BufferSourceAudioTrack.seekAudioBuffer",e.LOCAL_VIDEO_TRACK_PLAY="LocalVideoTrack.play",e.LOCAL_VIDEO_TRACK_STOP="LocalVideoTrack.stop",e.LOCAL_VIDEO_TRACK_GET_VIDEO_VISIBLE="LocalVideoTrack.getVideoElementVisibleStatus",e.LOCAL_VIDEO_TRACK_BEAUTY="LocalVideoTrack.setBeautyEffect",e.LOCAL_VIDEO_SEND_SEI_DATA="LocalVideoTrack.sendSeiData",e.CAM_VIDEO_TRACK_SET_DEVICE="CameraVideoTrack.setDevice",e.CAM_VIDEO_TRACK_SET_ENCODER_CONFIG="CameraVideoTrack.setEncoderConfiguration",e.REMOTE_VIDEO_TRACK_PLAY="RemoteVideoTrack.play",e.REMOTE_VIDEO_TRACK_STOP="RemoteVideoTrack.stop",e.REMOTE_VIDEO_TRACK_GET_VIDEO_VISIBLE="RemoteVideoTrack.getVideoElementVisibleStatus",e.REMOTE_AUDIO_TRACK_PLAY="RemoteAudioTrack.play",e.REMOTE_AUDIO_TRACK_STOP="RemoteAudioTrack.stop",e.REMOTE_AUDIO_SET_VOLUME="RemoteAudioTrack.setVolume",e.REMOTE_AUDIO_SET_OUTPUT_DEVICE="RemoteAudioTrack.setOutputDevice",e.GET_MEDIA_STREAM_TRACK="Track.getMediaStreamTrack",e.STREAM_TYPE_CHANGE="streamTypeChange",e.CONNECTION_STATE_CHANGE="connectionStateChange",e.LOAD_CONFIG_FROM_LOCALSTORAGE="loadConfigFromLocalStorage",e.IMAGE_MODERATION_UPLOAD="imageModerationUpload",e.REPUB_AFTER_PC_CONNECTED="repubAfterPCConnected",e.PRELOAD_MEDIA_FAILED="preloadMediaFailed",e.MISMATCH_DTLS_PARAMETERS="mismatchDtlsParameters",e.VOS_FALLBACK_CN="vosFallbackCN",e.DATACHANNEL_FAILBACK="datachannelFailback",e}({}),Ti=function(e){return e.TRACER="tracer",e}({});!function(e){e[e.AUDIENCE_LEVEL_LOW_LATENCY=1]="AUDIENCE_LEVEL_LOW_LATENCY",e[e.AUDIENCE_LEVEL_ULTRA_LOW_LATENCY=2]="AUDIENCE_LEVEL_ULTRA_LOW_LATENCY",e[e.AUDIENCE_LEVEL_SYNC_LATENCY=3]="AUDIENCE_LEVEL_SYNC_LATENCY"}({}),function(e){e.LEAVE="LEAVE",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.UID_BANNED="UID_BANNED",e.FALLBACK="FALLBACK",e.IP_BANNED="IP_BANNED",e.CHANNEL_BANNED="CHANNEL_BANNED",e.LICENSE_MISSING="LICENSE_MISSING",e.LICENSE_EXPIRED="LICENSE_EXPIRED",e.LICENSE_MINUTES_EXCEEDED="LICENSE_MINUTES_EXCEEDED",e.LICENSE_PERIOD_INVALID="LICENSE_PERIOD_INVALID",e.LICENSE_MULTIPLE_SDK_SERVICE="LICENSE_MULTIPLE_SDK_SERVICE",e.LICENSE_ILLEGAL="LICENSE_ILLEGAL",e.TOKEN_EXPIRE="TOKEN_EXPIRE",e.FALLBACK_TO_HLS="FALLBACK_TO_HLS",e.UID_CONFLICT="UID_CONFLICT"}({}),function(e){e[e.AUTO_SIMULCAST_STREAM=-1]="AUTO_SIMULCAST_STREAM",e[e.DISABLE_SIMULCAST_STREM=0]="DISABLE_SIMULCAST_STREM",e[e.ENABLE_SIMULCAST_STREAM=1]="ENABLE_SIMULCAST_STREAM"}({}),function(e){e.PEERCONNECTION_STATE_CHANGE="peerconnection-state-change",e.AUDIO_METADATA="audio-metadata",e.AUDIO_PTS="audio-pts",e.CONNECTION_STATE_CHANGE="connection-state-change",e.MEDIA_RECONNECT_START="media-reconnect-start",e.MEDIA_RECONNECT_END="media-reconnect-end",e.IS_USING_CLOUD_PROXY="is-using-cloud-proxy",e.USER_JOINED="user-joined",e.USER_LEAVED="user-left",e.USER_PUBLISHED="user-published",e.USER_UNPUBLISHED="user-unpublished",e.USER_INFO_UPDATED="user-info-updated",e.CLIENT_BANNED="client-banned",e.CHANNEL_MEDIA_RELAY_STATE="channel-media-relay-state",e.CHANNEL_MEDIA_RELAY_EVENT="channel-media-relay-event",e.VOLUME_INDICATOR="volume-indicator",e.CRYPT_ERROR="crypt-error",e.ON_TOKEN_PRIVILEGE_WILL_EXPIRE="token-privilege-will-expire",e.ON_TOKEN_PRIVILEGE_DID_EXPIRE="token-privilege-did-expire",e.NETWORK_QUALITY="network-quality",e.STREAM_TYPE_CHANGED="stream-type-changed",e.STREAM_FALLBACK="stream-fallback",e.RECEIVE_METADATA="receive-metadata",e.STREAM_MESSAGE="stream-message",e.LIVE_STREAMING_ERROR="live-streaming-error",e.LIVE_STREAMING_WARNING="live-streaming-warning",e.EXCEPTION="exception",e.ERROR="error",e.P2P_LOST="p2p_lost",e.JOIN_FALLBACK_TO_PROXY="join-fallback-to-proxy",e.CHANNEL_FALLBACK_TO_WEBSOCKET="channel-fallback-to-websocket",e.MEDIA_CONNECTION_TYPE_CHANGE="media-connection-type-change",e.PUBLISHED_USER_LIST="published-user-list",e.CONTENT_INSPECT_CONNECTION_STATE_CHANGE="content-inspect-connection-state-change",e.CONTENT_INSPECT_ERROR="content-inspect-error",e.CONTENT_INSPECT_RESULT="content-inspect-result",e.IMAGE_MODERATION_CONNECTION_STATE_CHANGE="image-moderation-connection-state-change",e.FALLBACK_TO_HLS="fallback-to-hls",e.FIRST_VIDEO_BUFFER_READY="first-video-buffer-ready",e.FIRST_VIDEO_PRE_RENDER="first-video-pre-render",e.AV1_DECODABLE_RESULT="av1-decodable-result"}({}),function(e){e.CONFIG="config",e.VOSERROR="vos_error",e.AP_ERROR="ap_error"}({}),function(e){e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.MULTI_IP="MULTI_IP",e.TIMEOUT="TIMEOUT",e.OFFLINE="OFFLINE",e.LEAVE="LEAVE",e.P2P_FAILED="P2P_FAILED",e.FALLBACK="FALLBACK",e.REGIONAL_DISTRIBUTION="REGIONAL_DISTRIBUTION"}({});let gi=function(e){return e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e}({}),Si=function(e){return e.NETWORK_STATE_CHANGE="NETWORK_STATE_CHANGE",e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e}({});function Ri(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n<r;n++)i[n-2]=arguments[n];return 0===e.getListeners(t).length?Promise.reject(new ii(ri.UNEXPECTED_ERROR,"can not emit promise")):new Promise(((r,n)=>{e.emit(t,...i,r,n)}))}function yi(e,t){if(0===e.getListeners(t).length)return Promise.resolve();for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n<r;n++)i[n-2]=arguments[n];return Ri(e,t,...i)}function vi(e,t){if(0===e.getListeners(t).length)return null;for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n<r;n++)i[n-2]=arguments[n];return function(e,t){let r=null,i=null;for(var n=arguments.length,o=new Array(n>2?n-2:0),s=2;s<n;s++)o[s-2]=arguments[s];if(e.emit(t,...o,(e=>{r=e}),(e=>{i=e})),null!==i)throw i;if(null===r)throw new ii(ri.UNEXPECTED_ERROR,"handler is not sync");return r}(e,t,...i)}const Ai=new class extends pi{set networkState(e){this.emit(Si.NETWORK_STATE_CHANGE,e,this._networkState),e===gi.ONLINE?this.emit(Si.ONLINE):e===gi.OFFLINE&&(this.onlineWaiter=new Promise((e=>{this.once(Si.ONLINE,(()=>{this.onlineWaiter=void 0,e(gi.ONLINE)}))})),this.emit(Si.OFFLINE)),this._networkState=e}get networkState(){return this._networkState}get isOnline(){return this._networkState===gi.ONLINE}constructor(){super(),ti(this,"_moduleName","network-indicator"),ti(this,"_networkState",gi.ONLINE),ti(this,"onlineWaiter",void 0),window.addEventListener("online",(()=>{this.networkState=gi.ONLINE})),window.addEventListener("offline",(()=>{this.networkState=gi.OFFLINE}))}},bi=[];for(let e=0;e<256;++e)bi.push((e+256).toString(16).slice(1));const Ii="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);let Oi;const Ci=new Uint8Array(16);function wi(){return Ii?Ii():function(e,t,r){var i,n,o,s;const a=null!==(i=null!==(n=(e=e||{}).random)&&void 0!==n?n:null===(o=(s=e).rng)||void 0===o?void 0:o.call(s))&&void 0!==i?i:function(){if(!Oi){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Oi=crypto.getRandomValues.bind(crypto)}return Oi(Ci)}();if(a.length<16)throw new Error("Random bytes length must be >= 16");if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){if((r=r||0)<0||r+16>t.length)throw new RangeError("UUID byte range ".concat(r,":").concat(r+15," is out of buffer bounds"));for(let e=0;e<16;++e)t[r+e]=a[e];return t}return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(bi[e[t+0]]+bi[e[t+1]]+bi[e[t+2]]+bi[e[t+3]]+"-"+bi[e[t+4]]+bi[e[t+5]]+"-"+bi[e[t+6]]+bi[e[t+7]]+"-"+bi[e[t+8]]+bi[e[t+9]]+"-"+bi[e[t+10]]+bi[e[t+11]]+bi[e[t+12]]+bi[e[t+13]]+bi[e[t+14]]+bi[e[t+15]]).toLowerCase()}(a)}(e,t,undefined);var e,t}function Ni(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}function Di(e){"undefined"!=typeof Promise?Promise.resolve().then(e):setTimeout(e,0)}function Pi(e){return JSON.parse(JSON.stringify(e))}function Li(e){try{return Pi(e)}catch(t){return e}}const ki={};function Mi(e,t){ki[t]||(ki[t]=!0,e())}function Ui(e){return window.TextEncoder?(new TextEncoder).encode(e).length:e.length}function xi(e){return new Promise((t=>{window.setTimeout(t,e)}))}function Vi(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7,t=arguments.length>1?arguments[1]:void 0;const r=Math.random().toString(16).substr(2,e).toLowerCase();return r.length===e?"".concat(t).concat(r):"".concat(t).concat(r)+Vi(e-r.length,"")}const Fi=()=>{},Bi=new class{constructor(){ti(this,"fnMap",new Map)}throttleByKey(e,t,r,i){for(var n=arguments.length,o=new Array(n>4?n-4:0),s=4;s<n;s++)o[s-4]=arguments[s];if(this.fnMap.has(t)){const n=this.fnMap.get(t);if(n.threshold!==r){n.fn(...n.args),clearTimeout(n.timer);const s=window.setTimeout((()=>{const e=this.fnMap.get(t);e&&e.fn(...e.args),this.fnMap.delete(t)}),r);this.fnMap.set(t,{fn:e,threshold:r,timer:s,args:o,skipFn:i})}else n.skipFn&&n.skipFn(...n.args),this.fnMap.set(t,ei(ei({},n),{},{fn:e,args:o,skipFn:i}))}else{const n=window.setTimeout((()=>{const e=this.fnMap.get(t);e&&e.fn(...e.args),this.fnMap.delete(t)}),r);this.fnMap.set(t,{fn:e,threshold:r,timer:n,args:o,skipFn:i})}}},ji=Bi.throttleByKey.bind(Bi);function Gi(e){return"object"==typeof e&&null!==e&&!(e instanceof RegExp)}function Wi(e,t){if(!Gi(e)||!Gi(t))return t;if(Array.isArray(e)&&!Array.isArray(t)||!Array.isArray(e)&&Array.isArray(t))return t;if(Array.isArray(t)&&Array.isArray(e)){const r=[...e];for(let i=0;i<t.length;i++)r[i]=Wi(e[i],t[i]);return r}{const r=ei({},e);for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)?r[i]=Wi(e[i],t[i]):r[i]=t[i]);return r}}function Hi(e){return"number"==typeof e?e:e.exact||e.ideal||e.max||e.min||0}function Ki(e){return e.reduce(((e,t)=>e+t),0)}let Yi=1,zi=console;class Xi{static setLogger(e){zi=e}constructor(e,t){ti(this,"id",void 0),ti(this,"lockingPromise",Promise.resolve()),ti(this,"locks",0),ti(this,"name",""),ti(this,"lockId",void 0),this.lockId=Yi++,e&&(this.name=e),t&&(this.id=t),this.logger("created")}logger(e,t){const r=(this.id?"[".concat(this.id,"]"):"")+"[lock-".concat(this.name,"-").concat(this.lockId,"]"),i="created"===e?"is ".concat(e,"."):"is ".concat(e,", current queue ").concat(this.locks,". ").concat(null!=t?t:"");zi.debug("".concat(r," ").concat(i))}setId(e){this.id=e}get isLocked(){return this.locks>0}lock(e){let t;this.locks+=1,this.logger("locked",e);const r=new Promise((r=>{t=()=>{this.locks-=1,this.logger("unlocked",e),r()}})),i=this.lockingPromise.then((()=>t));return this.lockingPromise=this.lockingPromise.then((()=>r)),i}}function Zi(e,t){return function(r,i,n){const o=n.value;if("function"!=typeof o)throw new Error("Cannot use mutex on object property.");return n.value=async function(){const r=this[t];if(!r)throw new Error("mutex property key ".concat(t," doesn't exist on ").concat(e));const n=await r.lock("From ".concat(e,".").concat(i));try{for(var s=arguments.length,a=new Array(s),c=0;c<s;c++)a[c]=arguments[c];return await o.apply(this,a)}finally{n()}},n}}const Ji={timeout:500,timeoutFactor:1.5,maxRetryCount:1/0,maxRetryTimeout:1e4};function Qi(e,t,r,i){const n=Object.assign({},Ji,i);let o=n.timeout;const s=async()=>{await function(e){return new Promise((t=>{window.setTimeout(t,e)}))}(o),o*=n.timeoutFactor,o=Math.min(n.maxRetryTimeout,o)};let a=!1;const c=new Promise((async(i,o)=>{t=t||(()=>!1),r=r||(()=>!0);for(let c=0;c<n.maxRetryCount;c+=1){if(a)return o(new ii(ri.OPERATION_ABORTED));try{const r=await e();if(!t(r,c))return i(r);if(c+1===n.maxRetryCount)return i(r);await s()}catch(e){if(!r(e,c))return o(e);if(c+1===n.maxRetryCount)return o(e);await s()}}}));return c.cancel=()=>a=!0,c}let qi=0,$i=0;function en(e,t,r,i){return new Promise(((n,o)=>{t.responseType=t.responseType||"json",t.data&&!r?(t.data=JSON.stringify(t.data),qi+=Ui(t.data)):r&&(t.data.size?qi+=t.data.size:t.data instanceof FormData?qi+=function(e){let t=0;return(/DingTalk/i.test(navigator.userAgent)||/AliApp/i.test(navigator.userAgent))&&e.realFormData&&(e=e.realFormData),e.forEach((e=>{t+="string"==typeof e?Ui(e):e.size})),t+138}(t.data):qi+=Ui(JSON.stringify(t.data))),t.headers=t.headers||{},t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json",t.method="POST",t.url=e,yr.request(t).then((e=>{"string"==typeof e.data?$i+=Ui(e.data):e.data instanceof ArrayBuffer||e.data instanceof Uint8Array?$i+=e.data.byteLength:$i+=Ui(JSON.stringify(e.data)),i&&n({data:e.data,headers:e.headers}),n(e.data)})).catch((e=>{yr.isCancel(e)?o(new ii(ri.OPERATION_ABORTED,"cancel token canceled")):"ECONNABORTED"===e.code?o(new ii(ri.NETWORK_TIMEOUT,e.message)):e.response?o(new ii(ri.NETWORK_RESPONSE_ERROR,e.response.status)):o(new ii(ri.NETWORK_ERROR,e.message))}))}))}async function tn(e,t){const r=new Blob([t.data],{type:"buffer"});return await en(e,ei(ei({},t),{},{data:r,headers:{"Content-Type":"application/octet-stream"}}),!0)}!function(e){e.BANDWIDTH="bandwidth",e.CPU="cpu",e.NONE="none",e.OTHER="other"}({}),function(e){e.L1T1="L1T1",e.L1T2="L1T2",e.L1T3="L1T3",e.L1T3_KEY="L1T3_KEY",e.L2T1_KEY="L2T1_KEY",e.L2T2_KEY="L2T2_KEY",e.L2T3_KEY="L2T3_KEY",e.L3T1_KEY="L3T1_KEY",e.L3T2_KEY="L3T2_KEY",e.L3T3_KEY="L3T3_KEY"}({}),function(e){e[e.new=0]="new",e[e.connecting=1]="connecting",e[e.connected=2]="connected",e[e.disconnected=3]="disconnected",e[e.failed=4]="failed",e[e.closed=5]="closed"}({}),function(e){e.CERTIFICATE="certificate",e.CODEC="codec",e.CANDIDATE_PAIR="candidate-pair",e.LOCAL_CANDIDATE="local-candidate",e.REMOTE_CANDIDATE="remote-candidate",e.INBOUND="inbound-rtp",e.TRACK="track",e.OUTBOUND="outbound-rtp",e.PC="peer-connection",e.REMOTE_INBOUND="remote-inbound-rtp",e.REMOTE_OUTBOUND="remote-outbound-rtp",e.TRANSPORT="transport",e.CSRC="csrc",e.DATA_CHANNEL="data-channel",e.STREAM="stream",e.SENDER="sender",e.RECEIVER="receiver"}({});var rn=function(e){return e[e.kNone=1]="kNone",e[e.kMillisecondsFromSeconds=1e3]="kMillisecondsFromSeconds",e[e.kBytesToBits=8]="kBytesToBits",e}(rn||{});const nn="websdk_ng_install_id";function on(){try{if(ln("INSTALL_ID"))return ln("INSTALL_ID");let e=window.localStorage.getItem(nn);return e||(e=function(){let e,t=!1;try{e=wi().replaceAll("-","")}catch(e){t=!0}return!t&&e&&32===e.length||(e=Vi(32,"")),e.toUpperCase()}(),window.localStorage.setItem(nn,e)),un("INSTALL_ID",e),e}catch(e){return}}const sn=function(e){if(e.match(/[0-9]+\.[0-9]+\.[0-9]+$/))return e;const t=e.match(/([0-9]+\.[0-9]+\.[0-9]+)\-([0-9]+)/);if(t&&t[1]&&t[2]){const e=t[1],r=t[2];return"".concat(e,".").concat(r)}return"4.0.0.999"}("4.24.2-200"),an=function(){try{return!0===JSON.parse("true")}catch(e){return!0}}();!function(e){e.Default="default",e.Auto="auto",e.Relay="relay",e.SdRtn="sd-rtn"}({});const cn=function(){const e="us".concat("erna","me"),t="pa".concat("sswo","rd"),r=["t","s","t"];r.splice(1,0,"e");const i=r.join(""),n=[];for(let e=0;e<6;e++)n.push("1");const o=n.join(""),s={};return s[e]=i,s[t]=o,Object.assign(s,{turnServerURL:"",tcpport:3433,udpport:3478,forceturn:!1})}();window.DEFAULT_TURN_CONFIG=cn;const dn=ei(ei(ei(ei({},{ENABLE_EVENT_REPORT:!0,UPLOAD_LOG:!1,ENABLE_AG_ADAPTATION:!0,FORCE_AG_HIGH_FRAMERATE:!1,FORCE_SUPPORT_AG_ADAPTATION:!1,ENCODER_CONFIG_LIMIT:{},CAMERA_CAPTURE_CONFIG:void 0,ENABLE_PRELOAD:!0,NEW_ICE_RESTART:!0,ICE_RESTART_INTERVAL:1e4,RESTART_SEQUENCE:["udp_tcp_relay","relay"],FIRST_TCP_CANDIDATE:!1,FIRST_TCP_CANDIDATE_INTERVAL:1e3,TURN_DOMAIN:"edge.agora.io",TURN_DOMAINS:["edge.agora.io"],USE_TURN_IP:!0,NEW_TURN_MODE:4,NEW_FORCE_TURN:!1,USE_NEW_RENDER_FREEZE_TIME:!1,FLS_FALLBACK_TIMEOUT:3e4,RTE_DETAIL_REPORT_INTERVAL:6e4,ENCODE_EXCEPTION_TIMES:5,ENABLE_ENCODE_EXCEPTION:!0,ENCODE_EXCEPTION_VALIDATE_CODEC:["h264"],VIDEO_ENCODER_CONFIG_LIST:[{width:240,height:180},{width:320,height:240},{width:400,height:300},{width:480,height:360},{width:560,height:420},{width:640,height:480}],DELETE_NEQ_AFTER_USER_LEAVE:!0,UPDATE_RTP_CAP_IN_HOST:!1,IOS_BG_TAG:!0,IOS_AUTO_RESTART_BG_TAG:!0,IGNORE_UID_CHECK:!1,ENABLE_UP_SPS_PPS:!1,ENABLE_DOWN_SPS_PPS:!1,NO_EDGES_RETRY:!0,BUFFER_READY_FRAMES:3,FLS_SYNC_AV_PLAY_LIMIT:0,FLS_BUFFER_WAIT_TIME:1500,VOS_CONFIGURE:void 0,ENABLE_QUALITY_FALLBACK:!1,QUALITY_FALLBACK_REHEARSAL:!0,ENABLE_FLS_AV1_FIRST:!1,ENABLE_AP_MULTI_IP:!0,FLS_ENABLE_AV1_DETECT:!0,FLS_ENABLE_AV1_DECODE_DETECT:!0}),{},{PROCESS_ID:"",ENCRYPT_AES:!0,AREAS:["CHINA","GLOBAL"],WEBCS_DOMAIN:["webrtc2-ap-web-1.agora.io","webrtc2-2.ap.sd-rtn.com"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-ap-web-3.agora.io","webrtc2-4.ap.sd-rtn.com"],PROXY_CS:["ap-proxy-1.agora.io","ap-proxy-2.agora.io"],CDS_AP:["cds-ap-web-1.agora.io","cds-web-2.ap.sd-rtn.com","cds-ap-web-3.agora.io","cds-web-4.ap.sd-rtn.com"],ACCOUNT_REGISTER:["sua-ap-web-1.agora.io","sua-web-2.ap.sd-rtn.com","sua-ap-web-3.agora.io","sua-web-4.ap.sd-rtn.com"],UAP_AP:["uap-ap-web-1.agora.io","uap-web-2.ap.sd-rtn.com","uap-ap-web-3.agora.io","uap-web-4.ap.sd-rtn.com"],LOG_UPLOAD_SERVER:"logservice.agora.io",EVENT_REPORT_DOMAIN:"statscollector-1.agora.io",EVENT_REPORT_BACKUP_DOMAIN:"web-2.statscollector.sd-rtn.com",GATEWAY_ADDRESS:[],GATEWAY_WSS_ADDRESS:"",LIVE_STREAMING_ADDRESS:"",HTTP_CONNECT_TIMEOUT:5e3,SIGNAL_REQUEST_TIMEOUT:1e4,REPORT_STATS:!0,NOT_REPORT_EVENT:[],PING_PONG_TIME_OUT:10,WEBSOCKET_TIMEOUT_MIN:1e4,EVENT_REPORT_SEND_INTERVAL:3e3,CONFIG_DISTRIBUTE_INTERVAL:3e5,ENABLE_CONFIG_DISTRIBUTE:!0,CANDIDATE_TIMEOUT:5e3,SHOW_REPORT_INVOKER_LOG:!1,SHOW_REPORT_USER_INVOKER_LOG:!0,JOIN_EXTEND:"",PUB_EXTEND:"",SUB_EXTEND:"",FORCE_TURN:!1,TURN_ENABLE_TCP:!0,TURN_ENABLE_UDP:!0,MAX_UPLOAD_CACHE:50,UPLOAD_CACHE_INTERVAL:2e3,AJAX_REQUEST_CONCURRENT:3,REPORT_APP_SCENARIO:void 0,GATEWAY_DOMAINS:["edge.agora.io","edge.sd-rtn.com"],CONNECT_GATEWAY_WITHOUT_DOMAIN:!1,WORKER_DOMAIN:"edge.agora.io",EVENT_REPORT_RETRY:!0,CHROME_FORCE_PLAN_B:!1,AUDIO_SOURCE_VOLUME_UPDATE_INTERVAL:400,AUDIO_SOURCE_AVG_VOLUME_DURATION:3e3,AUDIO_VOLUME_INDICATION_INTERVAL:2e3,VOLUME_VOICE_WEIGHT:10,GET_VOLUME_OF_MUTED_AUDIO_TRACK:!1,STATS_UPDATE_INTERVAL:250,NORMAL_EVENT_QUEUE_CAPACITY:100,CUSTOM_REPORT:!0,CUSTOM_REPORT_LIMIT:20,PROXY_SERVER_TYPE2:"webnginx-proxy.agora.io",PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.sd-rtn.com","webrtc-cloud-proxy.agora.io"],CUSTOM_PUB_ANSWER_MODIFIER:null,CUSTOM_SUB_ANSWER_MODIFIER:null,CUSTOM_PUB_OFFER_MODIFIER:null,CUSTOM_SUB_OFFER_MODIFIER:null,DSCP_TYPE:"high",REMOVE_NEW_CODECS:!0,FRAGEMENT_LENGTH:3,WEBSOCKET_COMPRESS:!1,SIMULCAST:!1,CHECK_VIDEO_VISIBLE_INTERVAL:3e4,CHECK_LOCAL_STATS_INTERVAL:250,PROFILE_SWITCH_INTERVAL:2e3,UNSUPPORTED_VIDEO_CODEC:[],ENUMERATE_DEVICES_INTERVAL:!1,ENUMERATE_DEVICES_INTERVAL_TIME:1e4,USE_NEW_TOKEN:!1,CLOSE_AFB_FOR_LOCAL_AP:!0,JOIN_MAX_CONCURRENCY:6,JOIN_WITH_FALLBACK_SIGNAL_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY_FORCE:!1,JOIN_GATEWAY_TRY_443PORT_DURATION:2e3,JOIN_GATEWAY_USE_443PORT_ONLY:!1,JOIN_GATEWAY_USE_DUAL_DOMAIN:!0,JOIN_GATEWAY_FALLBACK_PORT:443,USE_TURN_SERVER_OF_GATEWAY:!1,H264_PROFILE_LEVEL_ID:"",USE_NEW_LOG:!1,LOG_VERSION:3,MEDIA_DEVICE_CONSTRAINTS:null,ENCRYPT_PROXY_USERNAME_AND_PSW:!0,SDP_LOGGING:!1,CSP_DETECTED_HOSTNAME_LIST:["agora.io","sd-rtn.com"],REMOTE_AUDIO_TRACK_USES_WEB_AUDIO:!1,LOCAL_AUDIO_TRACK_USES_WEB_AUDIO:!1,BITRATE_ADAPTER_TYPE:"STANDARD_BITRATE",AI_DENOISER_PARAMETERS:{excludedLinks:[]},ADJUST_3A_FROM_PLUGINS:!0,RAISE_H264_BASELINE_PRIORITY:!0,FILTER_SEND_H264_BASELINE:!1,FIRST_H264_PROFILE_LEVEL_ID:"42001f",FIRST_PACKETIZATION_MODE:"",X_GOOGLE_START_BITRATE:void 0,NEW_REPORT_SERVER:!1,NEW_REPORT_SERVER_DOMAINS:["data-reporting.agora.io","data-reporting.agora.io"],VIDEO_INSPECT_WORKER_MESSAGE_LENGTH_LIMIT:3e5,VIDEO_INSPECT_INTERVAL_MINIMUM:1e3,VIDEO_INSPECT_QUALITY_RATIO:.9,VIDEO_INSPECT_WORKER_MANAGER_HOST:"edge.agora.io",VIDEO_INSPECT_WORKER_MANAGER_PORT:"",VIDEO_INSPECT_WORKER_MANAGER_WSS:"",VIDEO_INSPECT_WORKER_PORT:"",SHOW_VIDEO_INSPECT_WORKER_MESSAGE:!1,STATS_COLLECTOR_PORT:443,FORCE_TURN_TCP:!1,WEBAUDIO_INIT_OPTIONS:void 0,FILTER_VIDEO_FEC:!0,FILTER_AUDIO_FEC:!1,CHROME_DUAL_STREAM_USE_ENCODING:!0,DISABLE_DUAL_STREAM_USE_ENCODING:!1,EXTENSION_USAGE_UPLOAD_INTERVAL:1e4,ICE_RESTART:!0,FINGERPRINT:null,ENABLE_VIDEO_FRAME_CALLBACK:!0,VIDEO_FREEZE_DURATION:500,SPATIALIZER_PARAMETERS:{},UPLOAD_LOG_INTERVAL:3e3,UPLOAD_LOG_REQUEST_RETRY_INTERVAL:2e3,UPLOAD_LOG_REQUEST_MAX_RETRY_INTERVAL:2e4,UPLOAD_LOG_TRY_INTERVAL_WHILE_OFF:5e3,UPLOAD_LOG_RETRY_INTERVAL_V1:1e4,UPLOAD_LOG_TWICE_RETRY_INTERVAL_V1:200,UPLOAD_LOG_LENGTH_EACH_TIME:10,APP_TYPE:0,DISABLE_WEBAUDIO:!1,CHANNEL_MEDIA_RELAY_SERVERS:void 0,KEEP_LAST_FRAME:!0,FORWARD_P2P_CREATION:!0,SYNC_GROUP:!0,BLOCK_LOCAL_CLIENT:!1,ENABLE_AUDIO_TOPN:!1,ENABLE_AUDIO_METADATA:!1,ENABLE_AUDIO_PTS:!1,TOPN_SMOOTH_LEVEL:void 0,TOPN_NEW_SPEAKER_DELAY:void 0,TOPN_SWITCH_HOLD_MS:void 0,TOPN_AUDIO_GAIN:void 0,TOPN_SILENCE_THRESHOLD:250,AP_AREA:!0,ENABLE_ENCODED_TRANSFORM:!1,ENABLE_VIDEO_SEI:!1,IMAGE_MODERATION_WORKER_HOST:"edge.agora.io",IMAGE_MODERATION_WORKER_WSS:"",IMAGE_MODERATION_WORKER_MESSAGE_LENGTH_LIMIT:3e5,IMAGE_MODERATION_INTERVAL_MINIMUM:1e3,SHOW_IMAGE_MODERATION_WORKER_MESSAGE:!1,IMAGE_MODERATION_QUALITY_RATIO:.9,IMAGE_MODERATION_UPLOAD_REPORT_INTERVAL:5e3,SHOW_GLOBAL_CLIENT_LIST:!1,DATASTREAM_MAX_RETRANSMITS:10,TCP_CANDIDATE_ONLY:!1,EXTERNAL_SIGNAL_REQUEST_TIMEOUT:3e3,SHOW_P2P_LOG:!1,MAX_P2P_TIMEOUT:3e4,P2P_TOKEN_INTERVAL:1e3,SHOW_DATASTREAM2_LOG:!1,RESTRICTION_SET_PLAYBACK_DEVICE:!0,USE_PURE_ENCRYPTION_MASTER_KEY:!1,ENABLE_AUDIO_RED:!1,OPUS_PTIME:void 0,AUDIO_DUPLICATE_NUM:void 0,ENABLE_ABSSENDTIME_AS_SENTTS:!0,ACCOUNT_REGISTER_RETRY_TIMEOUT:1,ACCOUNT_REGISTER_RETRY_RATIO:2,ACCOUNT_REGISTER_RETRY_TIMEOUT_MAX:6e4,ACCOUNT_REGISTER_RETRY_COUNT_MAX:1e5,AUDIO_CONTEXT:null,WEBCS_BACKUP_CONNECT_TIMEOUT:6e3,PLAYER_STATE_DEFER:2e3,SIGNAL_REQUEST_WATCH_INTERVAL:1e3,FILEPATH_LENMAX:255,DUALSTREAM_OPERATION_CHECK:!0,MEDIA_ELEMENT_EXISTS_DEPTH:3,SHIM_CANDIDATE:!1,LEAVE_MSG_TIMEOUT:2e3,STATS_FILTER:{transportId:!0,googTrackId:!0},FILTER_VIDEO_CODEC:[],SIGNAL_CHANNEL:0,TRANSMITTER_INITIAL_RTT:30,TRANSMITTER_INITIAL_RTO:30,TRANSMITTER_MAX_BATCH_ACK_COUNT:2,TRANSMITTER_MAX_RTO:500,DATACHANNEL_COMPRESS:!1,DC_JOIN_WITH_FAILBACK:4e3,DC_CONNECTION_TIMEOUT:2e3,DC_PINGPONG_INTERVAL:2e3,DC_DEBUG_LOG:!1,UNSUPPORTED_VIDEO_UPLINK_CODEC:[],UNSUPPORTED_VIDEO_DOWNLINK_CODEC:[],USE_NEW_NETWORK_CONFIG:!1,AUTO_RESET_AUDIO_ROUTE:!1,PLUGIN_INFO:[],OVERUSE_DETECTOR_PARAMS:{MIN_FRAME_RATE:1,MAX_FRAME_RATE:30,MAX_THRESHOLD_FRAMERATE:30,BITRATE_MIN_THRESHOLD:100,BITRATE_MAX_THRESHOLD:100,MAX_SCALE:5,BWE_SCALE_UP_THRESHOLD:.6,BWE_SCALE_DOWN_THRESHOLD:.6,PERF_SCALE_UP_THRESHOLD:.7,PERF_SCALE_DOWN_THRESHOLD:.6,MOTION_RESOLUTION_FACTOR:.8,MOTION_BITRATE_FACTOR:.6,DETAIL_FRAMERATE_FACTOR:.8,DETAIL_BITRATE_FACTOR:.6,BALANCE_RESOLUTION_FACTOR:.9,BALANCE_FRAMERATE_FACTOR:.9,BALANCE_BITRATE_FACTOR:.6,OVERUSE_TIMES_THRESHOLD:10,UNDERUSE_TIMES_THRESHOLD:40},CUSTOM_ADAPTATION_DEFAULT_MODE:"",HIDE_NO_POSTER:!1,AP_CACHE_NUM:10,AP_UPDATE_INTERVAL:12e4,AP_CACHE_LIFETIME:12e4,MAX_PRELOAD_ASYNC_LENGTH:3,DISABLE_SCREEN_SHARE_REMB:!1},{ENABLE_PUBLISHED_USER_LIST:!0,MAX_SUBSCRIPTION:50,SUBSCRIBE_AUDIO_FILTER_TOPN:void 0,ENABLE_PUBLISH_AUDIO_FILTER:void 0,ENABLE_USER_LICENSE_CHECK:!0,DISABLE_FEC:void 0,ENABLE_NTP_REPORT:!1,ENABLE_INSTANT_VIDEO:!1,ENABLE_USER_AUTO_REBALANCE_CHECK:!0,ENABLE_LOSSBASED_BWE:!0,ENABLE_AUT_CC:!0,FORCE_ENABLE_AUT_CC:!1,ENABLE_CC_FALLBACK:void 0,SUBSCRIBE_TWCC:!0,PUBLISH_TWCC:!1,ENABLE_SVC_DEFAULT_CODECS:["H264","VP8","VP9","AV1"],SVC:[],ENABLE_FULL_LINK_AV_SYNC:!1,SVC_MODE:null,PRE_SUB_NUM:1,ENABLE_AUT_FEEDBACK:!0,SVC_EXTENDED:["VP9"]}),{},{USE_CANDIDATE_FROM_AP_DETAIL:!1,AP_REQUEST_DETAIL:void 0,ENABLE_ROLE_SELECT_EDGE:!1,CLIENT_ROLE_OPTIONS:void 0,REMOTE_VIDEO_STREAM_TYPE:void 0,COMPATIBLE_SDP_EXTENSION:["gdpr_forbidden"],LIMIT_BITRATE:void 0,EXPERIMENTS:{},USE_PUB_RTX:!0,USE_SUB_RTX:!0,ENABLE_DATASTREAM_2:!1,USE_XR:!0,ENABLE_PREALLOC_PC:!1,ENABLE_PRE_SUB:!1,ENABLE_SVC:!1,ENABLE_FORCE_HLS:!1,MAX_WEBAUDIO_VOLUME:300,ENABLE_VOS_FALLBACK:!1,ENABLE_FALLBACK_TO_HLS:!1,ENABLE_PRE_RENDER:!1,FORCE_DISABLE_AUTO_SUB:!1,ENABLE_PRE_SUB_WITH_PRE_PC:!0,PRE_USE_LOCAL_CODECS:!0},{INSTALL_ID:""}),{},{K_MIN_RENDER_DELAY:66,USE_STANDARD_BITRATE_DEFAULT:!1,VIDEO_NEW_BITRATE_RATIO:void 0,VIDEO_STANDARD_BITRATE_VERSION:2,BASELINE_MORE_H264_BITRATE_RATIO:1.1,IGNORE_RTC_DEVICE_CHECK:!1,FLS_AUTOPLAY_EMITS:!1,ENABLE_DUAL_STREAM_FLAG:!1,FORBID_MODIFY_LOCAL_OFFER_SDP:!1,RESERVE_MID_1_MLINE:!1});function un(e,t,r){var i;Object.keys(dn).includes(e)&&(!r&&Object.keys(hn).includes(e)||(dn[e]=t,"ENABLE_VIDEO_SEI"!==e&&"ENABLE_AUDIO_TOPN"!==e&&"ENABLE_AUDIO_METADATA"!==e&&"ENABLE_AUDIO_PTS"!==e||!0!==t||(dn.ENABLE_ENCODED_TRANSFORM=!0),"USE_NEW_NETWORK_CONFIG"===e&&t&&(i=!!t,dn.USE_NEW_NETWORK_CONFIG=i,i&&(dn.WEBCS_DOMAIN=["webrtc2-2.ap.sd-rtn.com"],dn.WEBCS_DOMAIN_BACKUP_LIST=["webrtc2-4.ap.sd-rtn.com"],dn.CDS_AP=["cds-web-2.ap.sd-rtn.com","cds-web-4.ap.sd-rtn.com"],dn.ACCOUNT_REGISTER=["sua-web-2.ap.sd-rtn.com","sua-web-4.ap.sd-rtn.com"],dn.EVENT_REPORT_DOMAIN="web-2.statscollector.sd-rtn.com",dn.EVENT_REPORT_BACKUP_DOMAIN="statscollector-1.agora.io",dn.GATEWAY_DOMAINS=["edge.sd-rtn.com"])),"ENABLE_PRE_SUB"===e&&t&&(dn.ENABLE_INSTANT_VIDEO=!0,dn.ENABLE_PREALLOC_PC=!0),"ENABLE_SVC"===e&&t&&(dn.ENABLE_AUT_CC=!0),"NEW_FORCE_TURN"===e&&t&&(dn.NEW_TURN_MODE||(dn.NEW_TURN_MODE=4))))}function ln(e){if("TURN_DOMAINS"===e){const e=dn.TURN_DOMAINS;return e.includes(ln("TURN_DOMAIN"))?e:[ln("TURN_DOMAIN")].concat(e)}return dn[e]}an||(dn.WEBCS_DOMAIN=["ap-web-1-oversea.agora.io","ap-web-1-north-america.agora.io"],dn.WEBCS_DOMAIN_BACKUP_LIST=["ap-web-2-oversea.agora.io","ap-web-2-north-america.agora.io"],dn.PROXY_CS=["proxy-ap-web-oversea.agora.io","proxy-ap-web-america.agora.io"],dn.CDS_AP=["cds-ap-web-oversea.agora.io","cds-ap-web-america.agora.io","cds-ap-web-america2.agora.io"],dn.ACCOUNT_REGISTER=["sua-ap-web-oversea.agora.io","sua-ap-web-america.agora.io","sua-ap-web-america2.agora.io"],dn.UAP_AP=["uap-ap-web-oversea.agora.io","uap-ap-web-america.agora.io","uap-ap-web-america2.agora.io"],dn.LOG_UPLOAD_SERVER="logservice-oversea.agora.io",dn.EVENT_REPORT_DOMAIN="statscollector-1-oversea.agora.io",dn.EVENT_REPORT_BACKUP_DOMAIN="statscollector-2-oversea.agora.io",dn.PROXY_SERVER_TYPE3="webrtc-cloud-proxy.agora.io",dn.AREAS=["NORTH_AMERICA","OVERSEA"]),function(e){e[e.REALTIME=1]="REALTIME"}({});const hn={};var pn=function(e){return e.SET_SESSION_ID="SET_SESSION_ID",e.SET_RTE_URL="SET_RTE_URL",e.SET_RTE_SID="SET_RTE_SID",e.SET_P2P_ID="SET_P2P_id",e.SET_DC_ID="SET_DC_id",e.SET_UID="SET_UID",e.SET_INT_UID="SET_INT_UID",e.SET_PUB_ID="SET_PUB_ID",e.SET_CLOUD_PROXY_SERVER_MODE="SET_CLOUD_PROXY_SERVER_MODE",e.KEY_METRIC_CLIENT_CREATED="KEY_METRIC_CLIENT_CREATED",e.KEY_METRIC_JOIN_START="KEY_METRIC_JOIN_START",e.KEY_METRIC_PRELOAD_START="KEY_METRIC_PRELOAD_START",e.KEY_METRIC_PRELOAD_END="KEY_METRIC_PRELOAD_END",e.KEY_METRIC_JOIN_END="KEY_METRIC_JOIN_END",e.KEY_METRIC_REQUEST_AP_START="KEY_METRIC_REQUEST_AP_START",e.KEY_METRIC_REQUEST_AP_END="KEY_METRIC_REQUEST_AP_END",e.KEY_METRIC_REQUEST_SUA_END="KEY_METRIC_REQUEST_SUA_END",e.KEY_METRIC_BEFORE_CONNECT="KEY_METRIC_BEFORE_CONNECT",e.KEY_METRIC_PEER_RECEIVER="KEY_METRIC_PEER_RECEIVER",e.KEY_METRIC_SIGNAL_CONNECTED="KEY_METRIC_SIGNAL_CONNECTED",e.KEY_METRIC_JOIN_REQ="KEY_METRIC_JOIN_REQ",e.KEY_METRIC_JOIN_REP="KEY_METRIC_JOIN_REP",e.KEY_METRIC_JOIN_GATEWAY_START="KEY_METRIC_JOIN_GATEWAY_START",e.KEY_METRIC_JOIN_GATEWAY_END="KEY_METRIC_JOIN_GATEWAY_END",e.KEY_METRIC_PEER_CONNECTION_START="KEY_METRIC_PEER_CONNECTION_START",e.KEY_METRIC_PEER_CONNECTION_END="KEY_METRIC_PEER_CONNECTION_END",e.KEY_METRIC_FIRST_VIDEO_FRAME_DECODED="KEY_METRIC_FIRST_VIDEO_FRAME_DECODED",e.KEY_METRIC_DESCRIPTION_START="KEY_METRIC_DESCRIPTION_START",e.KEY_METRIC_ICE_CONNECTION_END="KEY_METRIC_ICE_CONNECTION_END",e.KEY_METRIC_SIGNAL_CHANNEL_OPEN="KEY_METRIC_SIGNAL_CHANNEL_OPEN",e.KEY_METRIC_PUBLISH="KEY_METRIC_PUBLISH",e.KEY_METRIC_SUBSCRIBE="KEY_METRIC_SUBSCRIBE",e.RECORD_JOIN_CHANNEL_SERVICE="RECORD_JOIN_CHANNEL_SERVICE",e.RESET_JOIN_CHANNEL_SERVICE_RECORDS="RESET_JOIN_CHANNEL_SERVICE_RECORDS",e.RESET_KEY_METRICS="RESET_KEY_METRICS",e.RESET_FIRST_VIDEO_FRAME_DECODED="RESET_FIRST_VIDEO_FRAME_DECODED",e.SET_USE_P2P="SET_USE_P2P",e.SET_TRANSPORT_TYPE="SET_TRANSPORT_TYPE",e}(pn||{});function fn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function En(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fn(Object(r),!0).forEach((function(t){_n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function mn(){mn=function(e,t){return new r(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function r(e,i,n){var o=new RegExp(e,i);return t.set(o,n||t.get(e)),Tn(o,r.prototype)}function i(e,r){var i=t.get(r);return Object.keys(i).reduce((function(t,r){var n=i[r];if("number"==typeof n)t[r]=e[n];else{for(var o=0;void 0===e[n[o]]&&o+1<n.length;)o++;t[r]=e[n[o]]}return t}),Object.create(null))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Tn(e,t)}(r,RegExp),r.prototype.exec=function(t){var r=e.exec.call(this,t);if(r){r.groups=i(r,this);var n=r.indices;n&&(n.groups=i(n,this))}return r},r.prototype[Symbol.replace]=function(r,n){if("string"==typeof n){var o=t.get(this);return e[Symbol.replace].call(this,r,n.replace(/\$<([^>]+)>/g,(function(e,t){var r=o[t];return"$"+(Array.isArray(r)?r.join("$"):r)})))}if("function"==typeof n){var s=this;return e[Symbol.replace].call(this,r,(function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(i(e,s)),n.apply(this,e)}))}return e[Symbol.replace].call(this,r,n)},mn.apply(this,arguments)}function _n(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Tn(e,t){return Tn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Tn(e,t)}!function(e){e.h264="h264",e.h265="h265",e.vp8="vp8",e.vp9="vp9",e.av1="av1"}({}),function(e){e.opus="opus",e.pcma="pcma",e.pcmu="pcmu",e.g722="g722"}({}),(()=>{var e={8:(e,t,r)=>{r.r(t),r.d(t,{Parser:()=>y,Printer:()=>O,parse:()=>D,print:()=>P});const i="\n",n="".concat("\r").concat(i),o=" ";let s;function a(e){return e>="0"&&e<="9"}function c(e){return e>="!"&&e<="~"}function d(e){return c(e)||e>=""&&e<="ÿ"}function u(e){return"!"===e||e>="#"&&e<="'"||e>="*"&&e<="+"||e>="-"&&e<="."||e>="0"&&e<="9"||e>="A"&&e<="Z"||e>="^"&&e<="~"}function l(e){return e>="1"&&e<="9"}function h(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function p(e){return"d"===e||"h"===e||"m"===e||"s"===e}function f(e){return e>""&&e<"\t"||e>"\v"&&e<"\f"||e>""&&e<"ÿ"}function E(e){return h(e)||a(e)||"+"===e||"/"===e}function m(e){return a(e)||h(e)||"+"===e||"/"===e||"-"===e||"_"===e}function _(e){return h(e)||a(e)||"+"===e||"/"===e}function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach((function(t){S(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function S(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(e){e.VERSION="v",e.ORIGIN="o",e.SESSION_NAME="s",e.INFORMATION="i",e.URI="u",e.EMAIL="e",e.PHONE="p",e.CONNECTION="c",e.BANDWIDTH="b",e.TIME="t",e.REPEAT="r",e.ZONE_ADJUSTMENTS="z",e.KEY="k",e.ATTRIBUTE="a",e.MEDIA="m"}(s||(s={}));class R{consumeText(e,t){let r=t;for(;r<e.length;){const t=e[r];if("\0"===t||"\r"===t||t===i)break;r+=1}if(r-t==0)throw new Error("Invalid text, at ".concat(e));return r}consumeUnicastAddress(e,t,r){return this.consumeTill(e,t,o)}consumeOneOrMore(e,t,r){let i=t;for(;r(e[i]);)i++;if(i-t==0)throw new Error("Invalid rule at ".concat(t,"."));return i}consumeSpace(e,t){if(e[t]===o)return t+1;throw new Error("Invalid space at ".concat(t,"."))}consumeIP4Address(e,t){let r=t;for(let t=0;t<4;t++)if(r=this.consumeDecimalUChar(e,r),3!==t){if("."!==e[r])throw new Error("Invalid IP4 address.");r++}return r}consumeDecimalUChar(e,t){let r=t;for(let t=0;t<3&&a(e[r]);t++,r++);if(r-t==0)throw new Error("Invalid decimal uchar.");const i=parseInt(e.slice(t,r));if(i>=0&&i<=255)return r;throw new Error("Invalid decimal uchar")}consumeIP6Address(e,t){let r=this.consumeHexpart(e,t);return":"===e[r]?(r+=1,r=this.consumeIP4Address(e,r),r):r}consumeHexpart(e,t){let r=t;if(":"===e[r]&&":"===e[r+1]){r+=2;try{r=this.consumeHexseq(e,r)}catch(e){}return r}if(r=this.consumeHexseq(e,r),":"===e[r]&&":"===e[r+1]){r+=2;try{r=this.consumeHexseq(e,r)}catch(e){}return r}return r}consumeHexseq(e,t){let r=t;for(;r=this.consumeHex4(e,r),":"===e[r]&&":"!==e[r+1];)r+=1;return r}consumeHex4(e,t){let r=0;for(;r<4;r++)if(!((i=e[t+r])>="0"&&i<="9"||i>="a"&&i<="f"||i>="A"&&i<="F")){if(0===r)throw new Error("Invalid hex 4");break}var i;return t+r}consumeFQDN(e,t){let r=t;for(;a(e[r])||h(e[r])||"-"===e[r]||"."===e[r];)r+=1;if(r-t<4)throw new Error("Invalid FQDN");return r}consumeExtnAddr(e,t){return this.consumeOneOrMore(e,t,d)}consumeMulticastAddress(e,t,r){switch(r){case"IP4":case"ip4":return this.consumeIP4MulticastAddress(e,t);case"IP6":case"ip6":return this.consumeIP6MulticastAddress(e,t);default:try{return this.consumeFQDN(e,t)}catch(r){return this.consumeExtnAddr(e,t)}}}consumeIP6MulticastAddress(e,t){const r=this.consumeHexpart(e,t);return"/"===e[r]?this.consumeInteger(e,r+1):r}consumeIP4MulticastAddress(e,t){let r=t+3;const i=e.slice(t,r),n=parseInt(i);if(n<224||n>239)throw new Error("Invalid IP4 multicast address, IPv4 multicast addresses may be in the range 224.0.0.0 to 239.255.255.255.");for(let t=0;t<3;t++){if("."!==e[r])throw new Error("Invalid IP4 multicast address.");r+=1,r=this.consumeDecimalUChar(e,r)}return"/"===e[r]&&(r+=1),r=this.consumeTTL(e,r),"/"===e[r]&&(r=this.consumeInteger(e,r)),r}consumeInteger(e,t){if(!l(e[t]))throw new Error("Invalid integer.");for(t+=1;a(e[t]);)t+=1;return t}consumeTTL(e,t){if("0"===e[t])return t+1;if(!l(e[t]))throw new Error("Invalid TTL.");t+=1;for(let r=0;r<2&&a(e[t]);r++)t+=1;return t}consumeToken(e,t){return this.consumeOneOrMore(e,t,u)}consumeTime(e,t){let r=t;if("0"===e[r])return r+1;for(l(e[r])&&(r+=1);a(e[r]);)r++;if(r-t<10)throw new Error("Invalid time");return r}consumeAddress(e,t){return this.consumeTill(e,t,o)}consumeTypedTime(e,t){let r=t;return r=this.consumeOneOrMore(e,r,a),p(e[r])?r+1:r}consumeRepeatInterval(e,t){if(!l(e[t]))throw new Error("Invalid repeat interval");for(t+=1;a(e[t]);)t+=1;return p(e[t])&&(t+=1),t}consumePort(e,t){return this.consumeOneOrMore(e,t,a)}consume(e,t,r){for(let i=0;i<r.length;i++){if(t+i>=e.length)throw new Error("consume exceeding value length");if(e[t+i]!==r[i])throw new Error("consume ".concat(r," failed at ").concat(i))}return t+r.length}consumeTill(e,t,r){let i=t;for(;i<e.length&&("string"!=typeof r||e[i]!==r)&&("function"!=typeof r||!r(e[i]));)i++;return i}}class y extends R{constructor(){super(),S(this,"records",[]),S(this,"currentLine",0)}parse(e){const t=this.probeEOL(e);this.records=e.split(t).filter((e=>!!e.trim())).map(this.parseLine),this.currentLine=0;const r=this.parseVersion(),i=this.parseOrigin(),n=this.parseSessionName(),o=this.parseInformation(),s=this.parseUri(),a=this.parseEmail(),c=this.parsePhone(),d=this.parseConnection(),u=this.parseBandWidth(),l=this.parseTimeFields(),h=this.parseKey(),p=this.parseSessionAttribute(),f=this.parseMediaDescription();if(this.currentLine!==this.records.length)throw new Error("parsing failed, non exhaustive sdp lines.");return{version:r,origin:i,sessionName:n,information:o,uri:s,emails:a,phones:c,connection:d,bandwidths:u,timeFields:l,key:h,attributes:p,mediaDescriptions:f}}getCurrentRecord(){const e=this.records[this.currentLine];if(!e)throw new Error("Record doesn't exit.");return e}probeEOL(e){for(let t=0;t<e.length;t++)if(e[t]===i)return"\r"===e[t-1]?n:i;throw new Error("Invalid newline character.")}parseLine(e,t){if(e.length<2)throw new Error("Invalid sdp line, sdp line should be of form <type>=<value>.");const r=e[0];if("="!==e[1])throw new Error('Invalid sdp line, <type> should be a single character followed by an "=" sign.');return{type:r,value:e.slice(2),line:t,cur:0}}parseSessionAttribute(){const e=new A;for(;this.currentLine<this.records.length;){const t=this.getCurrentRecord();if(t.type!==s.ATTRIBUTE)break;const r={attField:this.extractOneOrMore(t,(e=>u(e)&&":"!==e)),_cur:0};":"===t.value[t.cur]&&(t.cur+=1,r.attValue=this.extractOneOrMore(t,f)),e.parse(r),this.currentLine++}return e.digest()}parseMediaAttributes(e){const t=new b(e);for(;this.currentLine<this.records.length;){const e=this.getCurrentRecord();if(e.type!==s.ATTRIBUTE)break;const r={attField:this.extractOneOrMore(e,(e=>u(e)&&":"!==e)),_cur:0};":"===e.value[e.cur]&&(e.cur+=1,r.attValue=this.extractOneOrMore(e,f)),t.parse(r),this.currentLine++}return t.digest()}parseKey(){const e=this.getCurrentRecord();if(e.type===s.KEY){if("prompt"===e.value||"clear:"===e.value||"base64:"===e.value||"uri:"===e.value)return e.value;throw this.currentLine++,new Error("Invalid key.")}}parseZone(){const e=this.getCurrentRecord();if(e.type===s.ZONE_ADJUSTMENTS){const t=[];for(;;)try{const r=this.extract(e,this.consumeTime);this.consumeSpaceForRecord(e);let i=!1;"-"===e.value[e.cur]&&(i=!0,e.cur+=1);const n=this.extract(e,this.consumeTypedTime);t.push({time:r,typedTime:n,back:i})}catch(e){break}if(0===t.length)throw new Error("Invalid zone adjustments");return this.currentLine++,t}return[]}parseRepeat(){const e=[];for(;;){const t=this.getCurrentRecord();if(t.type!==s.REPEAT)break;{const r=this.extract(t,this.consumeRepeatInterval),i=this.parseTypedTime(t);e.push({repeatInterval:r,typedTimes:i}),this.currentLine++}}return e}parseTypedTime(e){const t=[];for(;;)try{this.consumeSpaceForRecord(e),t.push(this.extract(e,this.consumeTypedTime))}catch(e){break}if(0===t.length)throw new Error("Invalid typed time.");return t}parseTime(){const e=this.getCurrentRecord(),t=this.extract(e,this.consumeTime);this.consumeSpaceForRecord(e);const r=this.extract(e,this.consumeTime);return this.currentLine++,{startTime:t,stopTime:r}}parseBandWidth(){const e=[];for(;this.currentLine<this.records.length;){const t=this.getCurrentRecord();if(t.type!==s.BANDWIDTH)break;{const r=this.extractOneOrMore(t,u);if(":"!==t.value[t.cur])throw new Error("Invalid bandwidth field.");t.cur++;const i=this.extractOneOrMore(t,a);e.push({bwtype:r,bandwidth:i}),this.currentLine++}}return e}parseVersion(){const e=this.getCurrentRecord();if(e.type!==s.VERSION)throw new Error("first sdp record must be version");const t=e.value.slice(0,this.consumeOneOrMore(e.value,0,a));if(t.length!==e.value.length)throw new Error('invalid proto version, "v='.concat(e.value,'"'));return this.currentLine++,t}parseOrigin(){const e=this.getCurrentRecord();if(e.type!==s.ORIGIN)throw new Error("second line of sdp must be origin");const t=this.extractOneOrMore(e,d);this.consumeSpaceForRecord(e);const r=this.extractOneOrMore(e,a);this.consumeSpaceForRecord(e);const i=this.extractOneOrMore(e,a);this.consumeSpaceForRecord(e);const n=this.extractOneOrMore(e,u);this.consumeSpaceForRecord(e);const o=this.extractOneOrMore(e,u);this.consumeSpaceForRecord(e);const c=this.extract(e,this.consumeUnicastAddress);return this.currentLine++,{username:t,sessId:r,sessVersion:i,nettype:n,addrtype:o,unicastAddress:c}}parseSessionName(){const e=this.getCurrentRecord();if(e.type===s.SESSION_NAME){const t=this.extract(e,this.consumeText);return this.currentLine++,t}}parseInformation(){const e=this.getCurrentRecord();if(e.type!==s.INFORMATION)return;const t=this.extract(e,this.consumeText);return this.currentLine++,t}parseUri(){const e=this.getCurrentRecord();if(e.type===s.URI)return this.currentLine++,e.value}parseEmail(){const e=[];for(;;){const t=this.getCurrentRecord();if(t.type!==s.EMAIL)break;e.push(t.value),this.currentLine++}return e}parsePhone(){const e=[];for(;;){const t=this.getCurrentRecord();if(t.type!==s.PHONE)break;e.push(t.value),this.currentLine++}return e}parseConnection(){const e=this.getCurrentRecord();if(e.type===s.CONNECTION){const t=this.extractOneOrMore(e,u);this.consumeSpaceForRecord(e);const r=this.extractOneOrMore(e,u);this.consumeSpaceForRecord(e);const i=this.extract(e,this.consumeAddress);return this.currentLine++,{nettype:t,addrtype:r,address:i}}}parseMedia(){const e=this.getCurrentRecord(),t=this.extract(e,this.consumeToken);this.consumeSpaceForRecord(e);let r=this.extract(e,this.consumePort);"/"===e.value[e.cur]&&(e.cur+=1,r+=this.extract(e,this.consumeInteger)),this.consumeSpaceForRecord(e);const i=[];for(i.push(this.extract(e,this.consumeToken));"/"===e.value[e.cur];)e.cur+=1,i.push(this.extract(e,this.consumeToken));if(0===i.length)throw new Error("Invalid proto");const n=this.parseFmt(e);return this.currentLine++,{mediaType:t,port:r,protos:i,fmts:n}}parseTimeFields(){const e=[];for(;this.getCurrentRecord().type===s.TIME;){const t=this.parseTime(),r=this.parseRepeat(),i=this.parseZone();e.push({time:t,repeats:r,zones:i})}return e}parseMediaDescription(){const e=[];for(;this.currentLine<this.records.length&&this.getCurrentRecord().type===s.MEDIA;){const t=this.parseMedia(),r=this.parseInformation(),i=this.parseConnections(),n=this.parseBandWidth(),o=this.parseKey(),s=this.parseMediaAttributes(t);e.push({media:t,information:r,connections:i,bandwidths:n,key:o,attributes:s})}return e}parseConnections(){const e=[];for(;this.currentLine<this.records.length&&this.getCurrentRecord().type===s.CONNECTION;)e.push(this.parseConnection());return e}parseFmt(e){const t=[];for(;;)try{this.consumeSpaceForRecord(e),t.push(this.extract(e,this.consumeToken))}catch(e){break}if(0===t.length)throw new Error("Invalid fmts");return t}extract(e,t,...r){const i=t.call(this,e.value,e.cur,...r),n=e.value.slice(e.cur,i);return e.cur=i,n}extractOneOrMore(e,t){const r=this.consumeOneOrMore(e.value,e.cur,t),i=e.value.slice(e.cur,r);return e.cur=r,i}consumeSpaceForRecord(e){if(e.value[e.cur]!==o)throw new Error("Invalid space at ".concat(e.cur,"."));e.cur+=1}}class v extends R{constructor(...e){super(...e),S(this,"attributes",void 0),S(this,"digested",!1)}extractOneOrMore(e,t,r){const i=this.consumeOneOrMore(e.attValue,e._cur,t),n=e.attValue.slice(e._cur,i),[o,s]=r||[];if("number"==typeof o&&n.length<o)throw new Error("error in length, should be more or equal than ".concat(o," characters."));if("number"==typeof s&&n.length>s)throw new Error("error in length, should be less or equal than ".concat(s," characters."));return e._cur=i,n}consumeAttributeSpace(e){if(e.attValue[e._cur]!==o)throw new Error("Invalid space at ".concat(e._cur,"."));e._cur+=1}extract(e,t,...r){if(!e.attValue)throw new Error("Nothing to extract from attValue.");const i=t.call(this,e.attValue,e._cur,...r),n=e.attValue.slice(e._cur,i);return e._cur=i,n}atEnd(e){if(!e.attValue)throw new Error;return e._cur>=e.attValue.length}peekChar(e){if(!e.attValue)throw new Error;return e.attValue[e._cur]}peek(e,t){if(!e.attValue)throw new Error;for(let r=0;r<t.length;r++)if(t[r]!==e.attValue[e._cur+r])return!1;return!0}parseIceUfrag(e){if(this.attributes.iceUfrag)throw new Error("Invalid ice-ufrag, should be only a single line if 'a=ice-ufrag'");this.attributes.iceUfrag=this.extractOneOrMore(e,E,[4,256])}parseIcePwd(e){if(this.attributes.icePwd)throw new Error("Invalid ice-pwd, should be only a single line if 'a=ice-pwd'");this.attributes.icePwd=this.extractOneOrMore(e,E,[22,256])}parseIceOptions(e){if(this.attributes.iceOptions)throw new Error("Invalid ice-options, should be only one 'ice-options' line");const t=[];for(;!this.atEnd(e);){t.push(this.extractOneOrMore(e,E));try{this.consumeAttributeSpace(e)}catch(t){if(this.atEnd(e))break;throw t}}this.attributes.iceOptions=t}parseFingerprint(e){const t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill);this.attributes.fingerprints.push({hashFunction:t,fingerprint:r})}parseExtmap(e){const t=this.extractOneOrMore(e,a);let r;"/"===this.peekChar(e)&&(this.extract(e,this.consume,"/"),r=this.extract(e,this.consumeToken)),this.consumeAttributeSpace(e);const i=this.extract(e,this.consumeTill,o),n=g(g({entry:parseInt(t,10)},r&&{direction:r}),{},{extensionName:i});this.peekChar(e)===o&&(this.consumeAttributeSpace(e),n.extensionAttributes=this.extract(e,this.consumeTill)),this.attributes.extmaps.push(n)}parseSetup(e){if(this.attributes.setup)throw new Error("must only be one single 'a=setup' line.");const t=this.extract(e,this.consumeTill);if("active"!==t&&"passive"!==t&&"actpass"!==t&&"holdconn"!==t)throw new Error("role must be one of 'active', 'passive', 'actpass', 'holdconn'.");this.attributes.setup=t}}class A extends v{constructor(...e){super(...e),S(this,"attributes",{unrecognized:[],groups:[],extmaps:[],fingerprints:[],identities:[]})}parse(e){if(this.digested)throw new Error("already digested");try{switch(e.attField){case"group":this.parseGroup(e);break;case"ice-lite":this.parseIceLite();break;case"ice-ufrag":this.parseIceUfrag(e);break;case"ice-pwd":this.parseIcePwd(e);break;case"ice-options":this.parseIceOptions(e);break;case"fingerprint":this.parseFingerprint(e);break;case"setup":this.parseSetup(e);break;case"tls-id":this.parseTlsId(e);break;case"identity":this.parseIdentity(e);break;case"extmap":this.parseExtmap(e);break;case"msid-semantic":this.parseMsidSemantic(e);break;default:e.ignored=!0,this.attributes.unrecognized.push(e)}}catch(t){throw console.error("parsing session attribute ".concat(e.attField,' error, "a=').concat(e.attField,":").concat(e.attValue,'"')),t}if(!e.ignored&&e.attValue&&!this.atEnd(e))throw new Error("attribute parsing error")}digest(){return this.digested=!0,this.attributes}parseGroup(e){const t=this.extract(e,this.consumeToken),r=[];for(;!this.atEnd(e)&&this.peekChar(e)===o;)this.consumeAttributeSpace(e),r.push(this.extract(e,this.consumeToken));this.attributes.groups.push({semantic:t,identificationTag:r})}parseIceLite(){if(this.attributes.iceLite)throw new Error("Invalid ice-lite, should be only a single line of 'a=ice-lite'");this.attributes.iceLite=!0}parseTlsId(e){if(this.attributes.tlsId)throw new Error("must be only one tld-id line");this.attributes.tlsId=this.extractOneOrMore(e,m)}parseIdentity(e){const t=this.extractOneOrMore(e,_),r=[];for(;!this.atEnd(e)&&this.peekChar(e)===o;){this.consumeAttributeSpace(e);const t=this.extract(e,this.consumeToken);this.extract(e,this.consume,"=");const i=this.extractOneOrMore(e,(e=>e!==o&&f(e)));r.push({name:t,value:i})}this.attributes.identities.push({assertionValue:t,extensions:r})}parseMsidSemantic(e){this.peekChar(e)===o&&this.consumeAttributeSpace(e);const t={semantic:this.extract(e,this.consumeToken),identifierList:[]};for(;;){try{this.consumeAttributeSpace(e)}catch(e){break}if("*"===this.peekChar(e)){this.extract(e,this.consume,"*"),t.applyForAll=!0;break}{const r=this.extract(e,this.consumeTill,o);t.identifierList.push(r)}}this.attributes.msidSemantic=t}}class b extends v{constructor(e){super(),S(this,"attributes",void 0),-1!==e.protos.indexOf("RTP")||e.protos.indexOf("rtp"),this.attributes={unrecognized:[],candidates:[],extmaps:[],fingerprints:[],imageattr:[],msids:[],remoteCandidatesList:[],rids:[],ssrcs:[],ssrcGroups:[],rtcpFeedbackWildcards:[],payloads:[]}}parse(e){if(this.digested)throw new Error("already digested");try{switch(e.attField){case"extmap":this.parseExtmap(e);break;case"setup":this.parseSetup(e);break;case"ice-ufrag":this.parseIceUfrag(e);break;case"ice-pwd":this.parseIcePwd(e);break;case"ice-options":this.parseIceOptions(e);break;case"candidate":this.parseCandidate(e);break;case"remote-candidate":this.parseRemoteCandidate(e);break;case"end-of-candidates":this.parseEndOfCandidates();break;case"fingerprint":this.parseFingerprint(e);break;case"rtpmap":this.parseRtpmap(e);break;case"ptime":this.parsePtime(e);break;case"maxptime":this.parseMaxPtime(e);break;case"sendrecv":case"recvonly":case"sendonly":case"inactive":this.parseDirection(e);break;case"ssrc":this.parseSSRC(e);break;case"fmtp":this.parseFmtp(e);break;case"rtcp-fb":this.parseRtcpFb(e);break;case"rtcp-mux":this.parseRTCPMux();break;case"rtcp-mux-only":this.parseRTCPMuxOnly();break;case"rtcp-rsize":this.parseRTCPRsize();break;case"rtcp":this.parseRTCP(e);break;case"mid":this.parseMid(e);break;case"msid":this.parseMsid(e);break;case"imageattr":this.parseImageAttr(e);break;case"rid":this.parseRid(e);break;case"simulcast":this.parseSimulcast(e);break;case"sctp-port":this.parseSctpPort(e);break;case"max-message-size":this.parseMaxMessageSize(e);break;case"ssrc-group":this.parseSSRCGroup(e);break;default:e.ignored=!0,this.attributes.unrecognized.push(e)}}catch(t){throw console.error("parsing media attribute ".concat(e.attField,' error, "a=').concat(e.attField,":").concat(e.attValue,'"')),t}if(!e.ignored&&e.attValue&&!this.atEnd(e))throw new Error("attribute parsing error")}parseCandidate(e){const t=this.extractOneOrMore(e,E,[1,32]);this.consumeAttributeSpace(e);const r=this.extractOneOrMore(e,a,[1,5]);this.consumeAttributeSpace(e);const i=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);const n=this.extractOneOrMore(e,a,[1,10]);this.consumeAttributeSpace(e);const s=this.extract(e,this.consumeAddress);this.consumeAttributeSpace(e);const d=this.extract(e,this.consumePort);this.consumeAttributeSpace(e),this.extract(e,this.consume,"typ"),this.consumeAttributeSpace(e);const u={foundation:t,componentId:r,transport:i,priority:n,connectionAddress:s,port:d,type:this.extract(e,this.consumeToken),extension:{}};for(this.peek(e," raddr")&&(this.extract(e,this.consume," raddr"),this.consumeAttributeSpace(e),u.relAddr=this.extract(e,this.consumeAddress)),this.peek(e," rport")&&(this.extract(e,this.consume," rport"),this.consumeAttributeSpace(e),u.relPort=this.extract(e,this.consumePort));this.peekChar(e)===o;){this.consumeAttributeSpace(e);const t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e),u.extension[t]=this.extractOneOrMore(e,c)}this.attributes.candidates.push(u)}parseRemoteCandidate(e){const t=[];for(;;){const r=this.extractOneOrMore(e,a,[1,5]);this.consumeAttributeSpace(e);const i=this.extract(e,this.consumeAddress);this.consumeAttributeSpace(e);const n=this.extract(e,this.consumePort);t.push({componentId:r,connectionAddress:i,port:n});try{this.consumeAttributeSpace(e)}catch(e){break}}this.attributes.remoteCandidatesList.push(t)}parseEndOfCandidates(){if(this.attributes.endOfCandidates)throw new Error("must be only one line of end-of-candidates");this.attributes.endOfCandidates=!0}parseRtpmap(e){const t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill,"/");this.extract(e,this.consume,"/");const i={encodingName:r,clockRate:this.extractOneOrMore(e,a)};this.atEnd(e)||"/"!==this.peekChar(e)||(this.extract(e,this.consume,"/"),i.encodingParameters=parseInt(this.extract(e,this.consumeTill),10));const n=this.attributes.payloads.find((e=>e.payloadType===parseInt(t,10)));n?n.rtpMap=i:this.attributes.payloads.push({payloadType:parseInt(t,10),rtpMap:i,rtcpFeedbacks:[]})}parsePtime(e){if(this.attributes.ptime)throw new Error("must be only one line of ptime");this.attributes.ptime=this.extract(e,this.consumeTill)}parseMaxPtime(e){if(this.attributes.maxPtime)throw new Error("must be only one line of ptime");this.attributes.maxPtime=this.extract(e,this.consumeTill)}parseDirection(e){if(this.attributes.direction)throw new Error("must be only one line of direction info");this.attributes.direction=e.attField}parseSSRC(e){const t=this.extractOneOrMore(e,a);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill,":");let i;":"===this.peekChar(e)&&(this.extract(e,this.consume,":"),i=this.extract(e,this.consumeTill));const n=this.attributes.ssrcs.find((e=>e.ssrcId===parseInt(t,10)));n?n.attributes[r]=i:this.attributes.ssrcs.push({ssrcId:parseInt(t,10),attributes:{[r]:i}})}parseFmtp(e){const t=this.extract(e,this.consumeTill,o);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill),i={};r.split(";").forEach((e=>{let[t,r]=e.split("=");t=t.trim();const n="string"==typeof r?r.trim():null;"string"==typeof t&&t.length>0&&(i[t]=n)}));const n=this.attributes.payloads.find((e=>e.payloadType===parseInt(t,10)));n?n.fmtp={parameters:i}:this.attributes.payloads.push({payloadType:parseInt(t,10),rtcpFeedbacks:[],fmtp:{parameters:i}})}parseFmtParameters(e){const t={},r=this.extract(e,this.consumeTill,"=");e._cur++;const i=this.extract(e,this.consumeTill,";");for(t[r]=i;";"===e.attValue[e._cur];){const r=this.extract(e,this.consumeTill,"=");e._cur++;const i=this.extract(e,this.consumeTill,";");t[r]=i}return t}parseRtcpFb(e){let t="";t="*"===this.peekChar(e)?this.extract(e,this.consume,"*"):this.extract(e,this.consumeTill,o),this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill,o);let i;if("trr-int"===r)i={type:r,interval:this.extract(e,this.consumeTill)};else{const t={type:r};this.peekChar(e)===o&&(this.consumeAttributeSpace(e),t.parameter=this.extract(e,this.consumeToken),this.peekChar(e)===o&&(t.additional=this.extract(e,this.consumeTill))),i=t}if("*"===t)this.attributes.rtcpFeedbackWildcards.push(i);else{const e=this.attributes.payloads.find((e=>e.payloadType===parseInt(t,10)));e?e.rtcpFeedbacks.push(i):this.attributes.payloads.push({payloadType:parseInt(t,10),rtcpFeedbacks:[i]})}}parseRTCPMux(){if(this.attributes.rtcpMux)throw new Error("must be single line of rtcp-mux");this.attributes.rtcpMux=!0}parseRTCPMuxOnly(){if(this.attributes.rtcpMuxOnly)throw new Error("must be single line of rtcp-only");this.attributes.rtcpMuxOnly=!0}parseRTCPRsize(){if(this.attributes.rtcpRsize)throw new Error("must be single line of rtcp-rsize");this.attributes.rtcpRsize=!0}parseRTCP(e){if(this.attributes.rtcp)throw new Error("must be single line of rtcp");const t={port:this.extract(e,this.consumePort)};this.peekChar(e)===o&&(this.consumeAttributeSpace(e),t.netType=this.extractOneOrMore(e,u),this.consumeAttributeSpace(e),t.addressType=this.extractOneOrMore(e,u),this.consumeAttributeSpace(e),t.address=this.extract(e,this.consumeAddress)),this.attributes.rtcp=t}parseMsid(e){const t={id:this.extractOneOrMore(e,u,[1,64])};this.peekChar(e)===o&&(this.consumeAttributeSpace(e),t.appdata=this.extractOneOrMore(e,u,[1,64])),this.attributes.msids.push(t)}parseImageAttr(e){this.attributes.imageattr.push(e.attValue)}parseRid(e){const t=this.extractOneOrMore(e,(e=>h(e)||a(e)||"_"===e||"-"===e));this.consumeAttributeSpace(e);const r={id:t,direction:this.extract(e,this.consumeToken),params:[]};if(this.peekChar(e)===o){if(this.consumeAttributeSpace(e),this.peek(e,"pt=")){this.extract(e,this.consume,"pt=");const t=[];for(;;){const r=this.extract(e,this.consumeToken);t.push(r);try{this.extract(e,this.consume,",")}catch(e){break}}r.payloads=t,this.peekChar(e)===o&&this.extract(e,this.consume,o)}for(;;){const t=this.extract(e,this.consumeToken);switch(t){case"depend":{const i={type:t,rids:this.extract(e,this.consume,"=").split(",")};r.params.push(i);break}default:{const i={type:t};"="===this.peekChar(e)&&(this.extract(e,this.consume,"="),i.val=this.extract(e,this.consumeTill,";")),r.params.push(i)}}try{this.extract(e,this.consume,";")}catch(e){break}}}this.attributes.rids.push(r)}parseSimulcast(e){if(this.attributes.simulcast)throw new Error("must be single line of simulcast");this.attributes.simulcast=e.attValue,this.extract(e,this.consumeTill)}parseSctpPort(e){this.attributes.sctpPort=this.extractOneOrMore(e,a,[1,5])}parseMaxMessageSize(e){this.attributes.maxMessageSize=this.extractOneOrMore(e,a,[1,void 0])}digest(){return this.digested=!0,this.attributes}parseMid(e){this.attributes.mid=this.extract(e,this.consumeToken)}parseSSRCGroup(e){const t=this.extract(e,this.consumeToken),r=[];for(;;)try{this.consumeAttributeSpace(e);const t=this.extract(e,this.consumeInteger);r.push(parseInt(t,10))}catch(e){break}this.attributes.ssrcGroups.push({semantic:t,ssrcIds:r})}}function I(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class O{constructor(){I(this,"eol",n)}print(e,t){let r="";return t&&(this.eol=t),r+=this.printVersion(e.version),r+=this.printOrigin(e.origin),r+=this.printSessionName(e.sessionName),r+=this.printInformation(e.information),r+=this.printUri(e.uri),r+=this.printEmail(e.emails),r+=this.printPhone(e.phones),r+=this.printConnection(e.connection),r+=this.printBandwidth(e.bandwidths),r+=this.printTimeFields(e.timeFields),r+=this.printKey(e.key),r+=this.printSessionAttributes(e.attributes),r+=this.printMediaDescription(e.mediaDescriptions),r}printVersion(e){return"v=".concat(e).concat(this.eol)}printOrigin(e){return"o=".concat(e.username," ").concat(e.sessId," ").concat(e.sessVersion," ").concat(e.nettype," ").concat(e.addrtype," ").concat(e.unicastAddress).concat(this.eol)}printSessionName(e){return e?"s=".concat(e).concat(this.eol):""}printInformation(e){return e?"i=".concat(e).concat(this.eol):""}printUri(e){return e?"u=".concat(e).concat(this.eol):""}printEmail(e){let t="";for(const r of e)t+="e=".concat(r).concat(this.eol);return t}printPhone(e){let t="";for(const r of e)t+="e=".concat(r).concat(this.eol);return t}printConnection(e){return e?"c=".concat(e.nettype," ").concat(e.addrtype," ").concat(e.address).concat(this.eol):""}printBandwidth(e){let t="";for(const r of e)t+="b=".concat(r.bwtype,":").concat(r.bandwidth).concat(this.eol);return t}printTimeFields(e){let t="";for(const r of e){t+="t=".concat(r.time.startTime," ").concat(r.time.startTime).concat(this.eol);for(const e of r.repeats)t+="r=".concat(e.repeatInterval," ").concat(e.typedTimes.join(" ")).concat(this.eol);r.zoneAdjustments&&(t+="z=",t+="z=".concat(r.zoneAdjustments.map((e=>"".concat(e.time," ").concat(e.back?"-":""," ").concat(e.typedTime))).join(" ")).concat(this.eol),t+=this.eol)}return t}printKey(e){return e?"k=".concat(e).concat(this.eol):""}printAttributes(e){let t="";for(const r of e)t+="a=".concat(r.attField).concat(r.attValue?":".concat(r.attValue):"").concat(this.eol);return t}printMediaDescription(e){let t="";for(const r of e)t+=this.printMedia(r.media),t+=this.printInformation(r.information),t+=this.printConnections(r.connections),t+=this.printBandwidth(r.bandwidths),t+=this.printKey(r.key),t+=this.printMediaAttributes(r);return t}printConnections(e){let t="";for(const r of e)t+=this.printConnection(r);return t}printMedia(e){return"m=".concat(e.mediaType," ").concat(e.port," ").concat(e.protos.join("/")," ").concat(e.fmts.join(" ")).concat(this.eol)}printSessionAttributes(e){return new w(this.eol).print(e)}printMediaAttributes(e){return new N(this.eol).print(e)}}class C{constructor(e){I(this,"eol",void 0),this.eol=e}printIceUfrag(e){return void 0===e?"":"a=ice-ufrag:".concat(e).concat(this.eol)}printIcePwd(e){return void 0===e?"":"a=ice-pwd:".concat(e).concat(this.eol)}printIceOptions(e){return void 0===e?"":"a=ice-options:".concat(e.join(o)).concat(this.eol)}printFingerprints(e){return e.length>0?e.map((e=>"a=fingerprint:".concat(e.hashFunction).concat(o).concat(e.fingerprint))).join(this.eol)+this.eol:""}printExtmap(e){return e.map((e=>"a=extmap:".concat(e.entry).concat(e.direction?"/".concat(e.direction):"").concat(o).concat(e.extensionName).concat(e.extensionAttributes?"".concat(o).concat(e.extensionAttributes):"").concat(this.eol))).join("")}printSetup(e){return void 0===e?"":"a=setup:".concat(e).concat(this.eol)}printUnrecognized(e){return e.map((e=>"a=".concat(e.attField).concat(e.attValue?":".concat(e.attValue):"").concat(this.eol))).join("")}}class w extends C{print(e){let t="";return t+=this.printGroups(e.groups),t+=this.printMsidSemantic(e.msidSemantic),t+=this.printIceLite(e.iceLite),t+=this.printIceUfrag(e.iceUfrag),t+=this.printIcePwd(e.icePwd),t+=this.printIceOptions(e.iceOptions),t+=this.printFingerprints(e.fingerprints),t+=this.printSetup(e.setup),t+=this.printTlsId(e.tlsId),t+=this.printIdentity(e.identities),t+=this.printExtmap(e.extmaps),t+=this.printUnrecognized(e.unrecognized),t}printGroups(e){let t="";return e.length>0&&(t+=e.map((e=>"a=group:".concat(e.semantic).concat(e.identificationTag.map((e=>"".concat(o).concat(e))).join("")).concat(this.eol))).join("")),t}printIceLite(e){return void 0===e?"":"a=ice-lite"+this.eol}printTlsId(e){return e?"a=tls-id:".concat(e).concat(this.eol):""}printIdentity(e){return 0===e.length?"":e.map((e=>"a=identity:".concat(e.assertionValue).concat(e.extensions.map((e=>"".concat(o).concat(e.name).concat(e.value?"=".concat(e.value):"")))))).join(this.eol)+this.eol}printMsidSemantic(e){if(!e)return"";let t="a=msid-semantic:".concat(e.semantic);return e.applyForAll?t+="".concat(o,"*"):e.identifierList.length>0&&(t+=e.identifierList.map((e=>"".concat(o).concat(e)))),t+this.eol}}class N extends C{print(e){const t=e.attributes;let r="";return r+=this.printRTCP(t.rtcp),r+=this.printIceUfrag(t.iceUfrag),r+=this.printIcePwd(t.icePwd),r+=this.printIceOptions(t.iceOptions),r+=this.printCandidates(t.candidates),r+=this.printRemoteCandidatesList(t.remoteCandidatesList),r+=this.printEndOfCandidates(t.endOfCandidates),r+=this.printFingerprints(t.fingerprints),r+=this.printSetup(t.setup),r+=this.printMid(t.mid),r+=this.printExtmap(t.extmaps),r+=this.printRTPRelated(t),r+=this.printPtime(t.ptime),r+=this.printMaxPtime(t.maxPtime),r+=this.printDirection(t.direction),r+=this.printSSRCGroups(t.ssrcGroups),r+=this.printSSRC(t.ssrcs),r+=this.printRTCPMux(t.rtcpMux),r+=this.printRTCPMuxOnly(t.rtcpMuxOnly),r+=this.printRTCPRsize(t.rtcpRsize),r+=this.printMSId(t.msids),r+=this.printImageattr(t.imageattr),r+=this.printRid(t.rids),r+=this.printSimulcast(t.simulcast),r+=this.printSCTPPort(t.sctpPort),r+=this.printMaxMessageSize(t.maxMessageSize),r+=this.printUnrecognized(t.unrecognized),r}printCandidates(e){return e.map((e=>"a=candidate:".concat(e.foundation).concat(o).concat(e.componentId).concat(o).concat(e.transport).concat(o).concat(e.priority).concat(o).concat(e.connectionAddress).concat(o).concat(e.port).concat(o,"typ").concat(o).concat(e.type).concat(e.relAddr?"".concat(o,"raddr").concat(o).concat(e.relAddr):"").concat(e.relPort?"".concat(o,"rport").concat(o).concat(e.relPort):"").concat(Object.keys(e.extension).map((t=>"".concat(o).concat(t).concat(o).concat(e.extension[t]))).join("")).concat(this.eol))).join("")}printRemoteCandidatesList(e){return e.map((e=>"a=remote-candidates:".concat(e.join(o)).concat(this.eol))).join("")}printEndOfCandidates(e){return void 0===e?"":"a=end-of-candidates"+this.eol}printRTPRelated(e){if(!e.payloads)return"";const t=e.payloads;let r="";r+=e.rtcpFeedbackWildcards.map((e=>this.printRTCPFeedback("*",e))).join("");for(const e of t)r+=this.printRtpMap(e.payloadType,e.rtpMap),r+=this.printFmtp(e.payloadType,e.fmtp),r+=e.rtcpFeedbacks.map((t=>this.printRTCPFeedback(e.payloadType,t))).join("");return r}printFmtp(e,t){if(!t)return"";const r=Object.keys(t.parameters);return 1===r.length&&null===t.parameters[r[0]]?"a=fmtp:".concat(e).concat(o).concat(r[0]).concat(this.eol):"a=fmtp:".concat(e).concat(o).concat(Object.keys(t.parameters).map((e=>"".concat(e,"=").concat(t.parameters[e]))).join(";")).concat(this.eol)}printRtpMap(e,t){return t?"a=rtpmap:".concat(e).concat(o).concat(t.encodingName,"/").concat(t.clockRate).concat(t.encodingParameters?"/".concat(t.encodingParameters):"").concat(this.eol):""}printRTCPFeedback(e,t){let r="a=rtcp-fb:".concat(e).concat(o),i=t;return"trr-int"===i.type?r+="ttr-int".concat(o).concat(i.interval):(r+="".concat(i.type),i.parameter&&(r+="".concat(o).concat(i.parameter),i.additional&&(r+="".concat(o).concat(i.additional)))),r+this.eol}printPtime(e){return void 0===e?"":"a=ptime:".concat(e).concat(this.eol)}printMaxPtime(e){return void 0===e?"":"a=maxptime:".concat(e).concat(this.eol)}printDirection(e){return void 0===e?"":"a=".concat(e).concat(this.eol)}printSSRC(e){return e.map((e=>Object.keys(e.attributes).map((t=>"a=ssrc:".concat(e.ssrcId.toString(10)).concat(o).concat(t).concat(e.attributes[t]?":".concat(e.attributes[t]):"").concat(this.eol))).join(""))).join("")}printRTCPMux(e){return void 0===e?"":"a=rtcp-mux".concat(this.eol)}printRTCPMuxOnly(e){return void 0===e?"":"a=rtcp-mux-only".concat(this.eol)}printRTCPRsize(e){return void 0===e?"":"a=rtcp-rsize".concat(this.eol)}printRTCP(e){if(void 0===e)return"";let t="a=rtcp:".concat(e.port);return e.netType&&(t+="".concat(o).concat(e.netType)),e.addressType&&(t+="".concat(o).concat(e.addressType)),e.address&&(t+="".concat(o).concat(e.address)),t+this.eol}printMSId(e){return e.map((e=>"a=msid:".concat(e.id).concat(e.appdata?"".concat(o).concat(e.appdata):"").concat(this.eol))).join("")}printImageattr(e){return e.map((e=>"a=imageattr:".concat(e).concat(this.eol))).join("")}printRid(e){return e.map((e=>{let t="a=rid:".concat(e.id).concat(o).concat(e.direction);return e.payloads&&(t+="".concat(o,"pt=").concat(e.payloads.join(","))),e.params.length>0&&(t+="".concat(o).concat(e.params.map((e=>"depend"===e.type?"depend=".concat(e.rids.join(",")):"".concat(e.type,"=").concat(e.val))).join(";"))),t+this.eol})).join("")}printSimulcast(e){return void 0===e?"":"a=simulcast:".concat(e).concat(this.eol)}printSCTPPort(e){return void 0===e?"":"a=sctp-port:".concat(e).concat(this.eol)}printMaxMessageSize(e){return void 0===e?"":"a=max-message-size:".concat(e).concat(this.eol)}printMid(e){return void 0===e?"":"a=mid:".concat(e).concat(this.eol)}printSSRCGroups(e){return e.map((e=>"a=ssrc-group:".concat(e.semantic).concat(e.ssrcIds.map((e=>"".concat(o).concat(e.toString(10)))).join("")).concat(this.eol))).join("")}}function D(e){return(new y).parse(e)}function P(e,t){return(new O).print(e,t)}}},t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={exports:{}};return e[i](n,n.exports,r),n.exports}r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(8)})();const gn=new class extends pi{constructor(){super(...arguments),_n(this,"currentUploadLogID",0)}reportLogUploadError(e){const{errorRange:t}=e;t[t.length-1]&&t[t.length-1]>this.currentUploadLogID&&(this.currentUploadLogID=t[t.length-1],this.emit("REPORT_LOG_UPLOAD",e))}};class Sn{constructor(e){_n(this,"logger",void 0),_n(this,"prefixLists",[]),this.logger=e}debug(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.debug(...this.prefixLists,...t)}info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.info(...this.prefixLists,...t)}warning(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.warning(...this.prefixLists,...t)}error(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.error(...this.prefixLists,...t)}prefix(e){return this.prefixLists.push(e),this}popPrefix(){return this.prefixLists.pop(),this}}function Rn(){const e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}function yn(){const e=new Date,t=/((\d+:){2}\d+)/.exec((new Date).toUTCString());return t?(null==t?void 0:t[0])+":"+e.getUTCMilliseconds():e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}const vn={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4},An=Date.now(),bn=e=>{for(const t in vn)if(Object.prototype.hasOwnProperty.call(vn,t)&&vn[t]===e)return t;return"DEFAULT"};const In=new class{constructor(){_n(this,"proxyServerURL",void 0),_n(this,"logLevel",vn.DEBUG),_n(this,"uploadState","collecting"),_n(this,"uploadLogWaitingList",[]),_n(this,"uploadLogUploadingList",[]),_n(this,"uploadErrorCount",0),_n(this,"currentLogID",0),_n(this,"url",void 0),_n(this,"extLog",((e,t)=>{this.appendLogToWaitingList(e,...t)}))}debug(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=[vn.DEBUG].concat(t);this.log.apply(this,i)}info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=[vn.INFO].concat(t);this.log.apply(this,i)}warning(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=[vn.WARNING].concat(t);this.log.apply(this,i)}warn(){this.warning(...arguments)}error(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=[vn.ERROR].concat(t);this.log.apply(this,i)}upload(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=[vn.DEBUG].concat(t);this.uploadLog.apply(this,i)}setLogLevel(e){e=Math.min(Math.max(0,e),4),this.logLevel=e}enableLogUpload(){un("UPLOAD_LOG",!0)}disableLogUpload(){un("UPLOAD_LOG",!1),this.uploadLogUploadingList=[],this.uploadLogWaitingList=[]}setProxyServer(e){this.proxyServerURL=e}prefix(e){return new Sn(this).prefix(e)}log(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Date.now()-An<100)return void setTimeout((()=>{this.log(...t)}),Date.now()-An);const i=Math.max(0,Math.min(4,t[0]));if(t[0]=Rn()+" Agora-SDK [".concat(bn(i),"]:"),this.appendLogToWaitingList(i,...t),i<this.logLevel)return;const n=Rn()+" %cAgora-SDK [".concat(bn(i),"]:");let o=[];if(!ln("USE_NEW_LOG"))switch(i){case vn.DEBUG:o=[n,"color: #64B5F6;"].concat(t.slice(1)),console.log.apply(console,o);break;case vn.INFO:o=[n,"color: #1E88E5; font-weight: bold;"].concat(t.slice(1)),console.log.apply(console,o);break;case vn.WARNING:o=[n,"color: #FB8C00; font-weight: bold;"].concat(t.slice(1)),console.warn.apply(console,o);break;case vn.ERROR:o=[n,"color: #B00020; font-weight: bold;"].concat(t.slice(1)),console.error.apply(console,o)}}uploadLog(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Date.now()-An<100)return void setTimeout((()=>{this.uploadLog(...t)}),Date.now()-An);const i=Math.max(0,Math.min(4,t[0]));t[0]=Rn()+" Agora-SDK [".concat(bn(i),"]:"),this.appendLogToWaitingList(i,...t)}appendLogToWaitingList(e){if(!ln("UPLOAD_LOG"))return;for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];Array.isArray(r[0])?r[0][0]=yn()+" Agora-SDK [".concat(bn(e),"]:"):r[0]=yn()+" Agora-SDK [".concat(bn(e),"]:");let n="";r.forEach((e=>{"object"==typeof e&&(e=JSON.stringify(e)),n+="".concat(e," ")})),this.uploadLogWaitingList.push({payload_str:n,log_level:e,log_item_id:this.currentLogID++}),"uploading"===this.uploadState&&0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}startUpload(){this.uploadState="uploading",0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}async uploadLogs(){const e=this.uploadLogUploadingList,t={sdk_version:sn,process_id:ln("PROCESS_ID"),payload:JSON.stringify(e)};return Qi((async()=>{const e=await yr.post(this.url||(this.proxyServerURL?"https://".concat(this.proxyServerURL,"/ls/?h=").concat(ln("LOG_UPLOAD_SERVER"),"&p=443&d=upload/v1"):"https://".concat(ln("LOG_UPLOAD_SERVER"),"/upload/v1")),t,{responseType:"text"});if("OK"!==e.data){const t=new Error("unexpected upload log response");throw t.response=e,t}}),(()=>(this.uploadLogUploadingList=[],!1)),(t=>{const r={status:-1,message:t.message,errorRange:e.map((e=>e.log_item_id))};return t.response?(r.status=t.response.status,r.data=t.response.data,r.headers=t.response.headers):t.request&&(r.status=t.request.status),gn.reportLogUploadError(r),!0}),{timeout:ln("UPLOAD_LOG_REQUEST_RETRY_INTERVAL"),maxRetryTimeout:ln("UPLOAD_LOG_REQUEST_MAX_RETRY_INTERVAL")})}uploadLogInterval(){0===this.uploadLogUploadingList.length&&0===this.uploadLogWaitingList.length||(0===this.uploadLogUploadingList.length&&(this.uploadLogUploadingList=this.uploadLogWaitingList.splice(0,ln("UPLOAD_LOG_LENGTH_EACH_TIME"))),this.uploadLogs().then((()=>{this.uploadErrorCount=0,this.uploadLogWaitingList.length>0&&window.setTimeout((()=>this.uploadLogInterval()),ln("UPLOAD_LOG_INTERVAL"))})).catch((e=>{this.uploadErrorCount+=1,this.uploadErrorCount<2?window.setTimeout((()=>this.uploadLogInterval()),ln("UPLOAD_LOG_TWICE_RETRY_INTERVAL_V1")):window.setTimeout((()=>this.uploadLogInterval()),ln("UPLOAD_LOG_RETRY_INTERVAL_V1"))})))}};var On;(On={}).FREE="free",On.UPLOADING="uploading",function(e){e[e.MISC=0]="MISC",e[e.INTERNAL_EVENT=1]="INTERNAL_EVENT",e[e.PUBLIC_EVENT=2]="PUBLIC_EVENT",e[e.WEB_EVENT=3]="WEB_EVENT",e[e.INTERNAL_API=4]="INTERNAL_API",e[e.WEB_API=5]="WEB_API",e[e.PUBLIC_API=6]="PUBLIC_API"}({});const Cn={sid:"",lts:0,success:null,cname:null,uid:null,peer:null,cid:null,elapse:null,extend:null,vid:0};let wn=function(e){return e.PUBLISH="publish",e.SUBSCRIBE="subscribe",e.WS_COMPRESSOR_INIT="ws_compressor_init",e.SESSION_INIT="session_init",e.JOIN_CHOOSE_SERVER="join_choose_server",e.RTE_DETAIL="rte_detail_stats",e.REQ_USER_ACCOUNT="req_user_account",e.JOIN_GATEWAY="join_gateway",e.REJOIN_GATEWAY="rejoin_gateway",e.STREAM_SWITCH="stream_switch",e.REQUEST_PROXY_WORKER_MANAGER="request_proxy_worker_manager",e.REQUEST_PROXY_APPCENTER="request_proxy_appcenter",e.FIRST_VIDEO_RECEIVED="first_video_received",e.FIRST_AUDIO_RECEIVED="first_audio_received",e.FIRST_VIDEO_DECODE="first_video_decode",e.FIRST_AUDIO_DECODE="first_audio_decode",e.XLA_PEER_FIRST_VIDEO_FRAME="xla_peer_first_video_frame",e.ON_ADD_AUDIO_STREAM="on_add_audio_stream",e.ON_ADD_VIDEO_STREAM="on_add_video_stream",e.ON_UPDATE_STREAM="on_update_stream",e.ON_REMOVE_STREAM="on_remove_stream",e.USER_ANALYTICS="req_user_analytics",e.PC_STATS="pc_stats",e.UPDATE_REMOTE_RTPCAPABILITIES="update_remote_rtpCapabilities",e.AB_TEST="ab_test",e}({}),Nn=function(e){return e.SESSION="io.agora.pb.Wrtc.Session",e.JOIN_CHOOSE_SERVER="io.agora.pb.Wrtc.JoinChooseServer",e.RTE_DETAIL="io.agora.pb.Wrtc.RteDetailStats",e.REQ_USER_ACCOUNT="io.agora.pb.Wrtc.ReqUserAccount",e.JOIN_GATEWAY="io.agora.pb.Wrtc.JoinGateway",e.RE_JOIN_GATEWAY="io.agora.pb.Wrtc.ReJoinGateway",e.PUBLISH="io.agora.pb.Wrtc.Publish",e.SUBSCRIBE="io.agora.pb.Wrtc.Subscribe",e.WS_COMPRESSOR_INIT="io.agora.pb.Wrtc.WsCompressorInit",e.STREAM_SWITCH="io.agora.pb.Wrtc.StreamSwitch",e.AUDIO_SENDING_STOPPED="io.agora.pb.Wrtc.AudioSendingStopped",e.VIDEO_SENDING_STOPPED="io.agora.pb.Wrtc.VideoSendingStopped",e.REQUEST_PROXY_APPCENTER="io.agora.pb.Wrtc.RequestProxyAppCenter",e.REQUEST_PROXY_WORKER_MANAGER="io.agora.pb.Wrtc.RequestProxyWorkerManager",e.API_INVOKE="io.agora.pb.Wrtc.ApiInvoke",e.FIRST_VIDEO_RECEIVED="io.agora.pb.Wrtc.FirstVideoReceived",e.FIRST_AUDIO_RECEIVED="io.agora.pb.Wrtc.FirstAudioReceived",e.FIRST_VIDEO_DECODE="io.agora.pb.Wrtc.FirstVideoDecode",e.FIRST_AUDIO_DECODE="io.agora.pb.Wrtc.FirstAudioDecode",e.XLA_PEER_FIRST_VIDEO_FRAME="io.agora.pb.Wrtc.XLAPeerFirstVideoFrame",e.ON_ADD_AUDIO_STREAM="io.agora.pb.Wrtc.OnAddAudioStream",e.ON_ADD_VIDEO_STREAM="io.agora.pb.Wrtc.OnAddVideoStream",e.ON_UPDATE_STREAM="io.agora.pb.Wrtc.OnUpdateStream",e.ON_REMOVE_STREAM="io.agora.pb.Wrtc.OnRemoveStream",e.JOIN_CHANNEL_TIMEOUT="io.agora.pb.Wrtc.JoinChannelTimeout",e.PEER_PUBLISH_STATUS="io.agora.pb.Wrtc.PeerPublishStatus",e.WORKER_EVENT="io.agora.pb.Wrtc.WorkerEvent",e.AP_WORKER_EVENT="io.agora.pb.Wrtc.APWorkerEvent",e.JOIN_WEB_PROXY_AP="io.agora.pb.Wrtc.JoinWebProxyAP",e.WEBSOCKET_QUIT="io.agora.pb.Wrtc.WebSocketQuit",e.USER_ANALYTICS="io.agora.pb.Wrtc.UserAnalytics",e.AUTOPLAY_FAILED="io.agora.pb.Wrtc.AutoplayFailed",e.PC_STATS="io.agora.pb.Wrtc.PCStats",e.UPDATE_REMOTE_RTPCAPABILITIES="io.agora.pb.Wrtc.UpdateRemoteRTPCapabilities",e.AB_TEST="io.agora.pb.Wrtc.ABTest",e}({});!function(e){e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT"}({});let Dn=function(e){return e[e.SESSION=26]="SESSION",e[e.JOIN_CHOOSE_SERVER=27]="JOIN_CHOOSE_SERVER",e[e.REQ_USER_ACCOUNT=196]="REQ_USER_ACCOUNT",e[e.JOIN_GATEWAY=28]="JOIN_GATEWAY",e[e.PUBLISH=30]="PUBLISH",e[e.SUBSCRIBE=29]="SUBSCRIBE",e[e.WS_COMPRESSOR_INIT=9430]="WS_COMPRESSOR_INIT",e[e.STREAM_SWITCH=32]="STREAM_SWITCH",e[e.AUDIO_SENDING_STOPPED=33]="AUDIO_SENDING_STOPPED",e[e.VIDEO_SENDING_STOPPED=34]="VIDEO_SENDING_STOPPED",e[e.REQUEST_PROXY_APPCENTER=35]="REQUEST_PROXY_APPCENTER",e[e.REQUEST_PROXY_WORKER_MANAGER=36]="REQUEST_PROXY_WORKER_MANAGER",e[e.API_INVOKE=41]="API_INVOKE",e[e.FIRST_VIDEO_RECEIVED=348]="FIRST_VIDEO_RECEIVED",e[e.FIRST_AUDIO_RECEIVED=349]="FIRST_AUDIO_RECEIVED",e[e.FIRST_VIDEO_DECODE=350]="FIRST_VIDEO_DECODE",e[e.FIRST_AUDIO_DECODE=351]="FIRST_AUDIO_DECODE",e[e.ON_ADD_AUDIO_STREAM=352]="ON_ADD_AUDIO_STREAM",e[e.ON_ADD_VIDEO_STREAM=353]="ON_ADD_VIDEO_STREAM",e[e.ON_UPDATE_STREAM=356]="ON_UPDATE_STREAM",e[e.ON_REMOVE_STREAM=355]="ON_REMOVE_STREAM",e[e.JOIN_CHANNEL_TIMEOUT=407]="JOIN_CHANNEL_TIMEOUT",e[e.PEER_PUBLISH_STATUS=408]="PEER_PUBLISH_STATUS",e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT",e[e.JOIN_WEB_PROXY_AP=700]="JOIN_WEB_PROXY_AP",e[e.WEBSOCKET_QUIT=671]="WEBSOCKET_QUIT",e[e.USER_ANALYTICS=1e4]="USER_ANALYTICS",e[e.AUTOPLAY_FAILED=9178]="AUTOPLAY_FAILED",e}({});function Pn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,r,i){const n=i.value;if("function"==typeof n){const o=e.className||t.__className__||("AgoraRTCClient"===t.constructor.name?"Client":t.constructor.name);i.value=function(){for(var t,i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];let c=s;if(e.argsMap)try{c=e.argsMap(this,...s)}catch(e){In.warning(e),c=[]}try{JSON.stringify(c)}catch(e){In.warning("arguments for method ".concat(o,".").concat(String(r)," not serializable for apiInvoke.")),c=[]}const d=(e.report||Ln).reportApiInvoke(this._sessionId||null,{id:this._clientId||(null===(t=this.store)||void 0===t?void 0:t.clientId)||this._ID,name:"".concat(o,".").concat(String(r)),options:c,tag:Ti.TRACER,reportResult:e.reportResult},e.throttleTime);try{const t=n.apply(this,s);return t instanceof Promise?t.then((t=>(d.onSuccess(e.reportResult&&t),t))).catch((e=>{throw d.onError(e),e})):(d.onSuccess(e.reportResult&&t),t)}catch(e){throw d.onError(e),e}}}return i}}const Ln=new class{constructor(){_n(this,"baseInfoMap",new Map),_n(this,"proxyServer",void 0),_n(this,"eventUploadTimer",void 0),_n(this,"setSessionIdTimer",void 0),_n(this,"url",void 0),_n(this,"sids",new Set),_n(this,"backupUrl",void 0),_n(this,"_appId",void 0),_n(this,"_aid",0),_n(this,"keyEventUploadPendingItems",[]),_n(this,"normalEventUploadPendingItems",[]),_n(this,"apiInvokeUploadPendingItems",[]),_n(this,"apiInvokeCount",0),_n(this,"apiInvokeLoggedCount",0),_n(this,"ltsList",[]),_n(this,"lastSendNormalEventTime",Date.now()),_n(this,"customReportCounterTimer",void 0),_n(this,"customReportCount",0),_n(this,"extApiInvoke",(async e=>{for(const t of e){const e=En(En({},t),{},{sid:null,invokeId:++this.apiInvokeCount,tag:Ti.TRACER});this.sendApiInvoke(e)}})),this.eventUploadTimer=window.setInterval(this.doSend.bind(this),ln("EVENT_REPORT_SEND_INTERVAL")),this.setSessionIdTimer=window.setInterval(this.appendSessionId.bind(this),ln("EVENT_REPORT_SEND_INTERVAL"))}getBaseInfoBySessionId(e){return this.baseInfoMap.get(e)}setAppId(e){this._appId=e,this._aid=parseInt(e.replace(/[a-fA-F0-9]{8}/g,(e=>{let[t,r]=e;return t+r})),16)||0}reportApiInvoke(e,t,r){t.timeout=t.timeout||6e4,t.reportResult=void 0===t.reportResult||t.reportResult;const i=Date.now();this.apiInvokeCount+=1;const n=this.apiInvokeCount,o=!!ln("SHOW_REPORT_INVOKER_LOG"),s=!!ln("SHOW_REPORT_USER_INVOKER_LOG"),a=o||s&&t.id;a&&(this.apiInvokeLoggedCount+=1);const c=this.apiInvokeLoggedCount;function d(e,r){if(a){let i="[apiInvoke-".concat(c,"]");if(t.id&&(i+="[".concat(t.id,"]")),t.name&&(i+="[".concat(t.name,"]"),t.name===_i.JOIN))return In.info("".concat(i," ").concat(e));In.info("".concat(i," ").concat(e),"start"===e?t.options:r||"")}}const u=()=>({tag:t.tag,invokeId:n,sid:e,name:t.name,apiInvokeTime:i,options:t.options,states:t.states||null});d("start");let l=!1;xi(t.timeout).then((()=>{l||(this.sendApiInvoke(En(En({},u()),{},{error:ri.API_INVOKE_TIMEOUT,success:!1})),d("timeout"))}));const h=new ii(ri.UNEXPECTED_ERROR,"".concat(t.name,": this api invoke is end"));return{onSuccess:e=>{const i=()=>{if(l)throw h;return l=!0,this.sendApiInvoke(En(En({},u()),{},{success:!0},t.reportResult&&{result:e})),d("onSuccess"),e};return r?ji(i,t.name+"Success",r,(()=>l=!0)):i()},onError:e=>{const i=()=>{if(l)throw e;l=!0,this.sendApiInvoke(En(En({},u()),{},{success:!1,error:e})),d("onFailure",e.toString())};return r?ji(i,t.name+"Error",r,(()=>l=!0)):i()}}}_send(e,t,r){this.send({type:e,data:t},r)}_sendApiInvoke(e){return this.sendApiInvoke(e)}sessionInit(e,t){if(this.baseInfoMap.has(e))return;const r=Date.now(),i=this.createBaseInfo(e,r);i.cname=t.cname,i.rteUrl=t.rteUrl;const n=Object.assign({},{willUploadConsoleLog:ln("UPLOAD_LOG"),maxTouchPoints:navigator.maxTouchPoints,areaVersion:an?"global":"oversea",areas:ln("AREAS")&&ln("AREAS").join(",")},t.extend),{stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:d,clientRole:u}=t,l=Date.now(),h=En(En({},i),{},{eventType:wn.SESSION_INIT,appid:t.appid,browser:navigator.userAgent,buildFormat:t.buildFormat,build:"v4.24.2-200-0-g58279341-dirty(2/5/2026, 5:51:13 PM)",lts:l,elapse:l-r,extend:JSON.stringify(n),mode:t.mode,process:ln("PROCESS_ID"),appType:ln("APP_TYPE"),success:!0,version:sn,stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:d,clientType:window.navigator.userAgent.includes("AgoraWebView")?42:20,clientRole:u,serviceId:ln("PROCESS_ID"),extensionID:ln("PLUGIN_INFO").join(",")||"",rteUrl:t.rteUrl,rteSid:t.rteSid});this.send({type:Nn.SESSION,data:h},!0)}reportRteDetail(e){const t=this.baseInfoMap.get(e);if(!t)return;const r=t.info,i=Date.now(),n=En(En({},r),{},{eventType:wn.RTE_DETAIL,lts:i,success:!0,elapse:i-t.startTime,vid:void 0===r.vid?0:Number(r.vid),ua:navigator.userAgent});this.send({type:Nn.RTE_DETAIL,data:n},!0)}joinChooseServer(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info;t.vid&&(i.vid=t.vid);const n=Date.now(),o=En(En({},i),{},{role:t.role,eventType:wn.JOIN_CHOOSE_SERVER,lts:n,eventElapse:t.elapse||n-t.lts,chooseServerAddr:t.csAddr,errorCode:t.ec,elapse:n-r.startTime,success:t.succ,chooseServerAddrList:JSON.stringify(t.serverList),uid:t.uid?parseInt(t.uid):null,cid:t.cid?parseInt(t.cid):null,chooseServerIp:t.csIp||"",opid:t.opid,unilbsServerIds:t.unilbsServerIds,extend:t.extend||void 0,isHttp3:t.isHttp3,corssRegionTagReq:t.corssRegionTagReq||void 0,corssRegionTagRes:t.corssRegionTagRes||void 0,ua:navigator.userAgent,resourceTimingInfo:t.resourceTimingInfo||void 0});this.send({type:Nn.JOIN_CHOOSE_SERVER,data:o},!0)}reqUserAccount(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=En(En({},i),{},{eventType:wn.REQ_USER_ACCOUNT,lts:n,success:t.success,serverAddress:t.serverAddr,stringUid:t.stringUid,uid:t.uid,errorCode:t.errorCode,elapse:t.elapse||n-r.startTime,eventElapse:n-t.lts,extend:JSON.stringify(t.extend)});this.send({type:Nn.REQ_USER_ACCOUNT,data:o},!0)}joinGateway(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info;t.vid&&(i.vid=t.vid),i.uid=t.uid,i.cid=t.cid;const n=Date.now(),{firstSuccess:o,addr:s,isProxy:a}=t,c=n-r.startTime,d=En(En({},i),{},{eventType:wn.JOIN_GATEWAY,lts:n,gatewayAddr:t.addr,success:t.succ,errorCode:t.ec,errorMsg:t.errorMsg||"",elapse:c,eventElapse:n-t.lts,firstSuccess:o,signalChannel:t.signalChannel,preload:t.preload?1:0,installId:on(),isABTestSuccess:t.isABTestSuccess?1:0,gatewayIp:null,gatewayPort:null,isProxy:a?1:0}),u=d.success?1:0;if(t.succ&&(r.lastJoinSuccessTime=n),s)if("1"===d.signalChannel){const e=mn(/(\d+\.\d+\.\d+\.\d+):(\d+)/,{ip:1,port:2}),t=s.match(e);d.gatewayIp=t&&t.groups?t.groups.ip:"",d.gatewayPort=t&&t.groups?t.groups.port:""}else if(a){const e=s.match(/h=(\d{1,3}-){3}\d{1,3}/g),t=s.match(/p=[0-9]{1,6}/g);d.gatewayIp=e&&e.length?e[0].split("=")[1].replace(/-/g,"."):"",d.gatewayPort=t&&t.length?t[0].split("=")[1]:""}else{const e=s.match(/wss:\/\/(\d{1,3}-){3}\d{1,3}/g),t=s.match(/(:|p=)[0-9]{1,6}/g);d.gatewayIp=e&&e.length?e[0].split("//")[1].replace(/-/g,"."):"",d.gatewayPort=t&&t.length?t[0].split(/:|p=/g)[1]:""}if(o)this.send({type:Nn.JOIN_GATEWAY,data:d},!0);else{let e={isSuccess:u,port:d.gatewayPort};delete d.success,delete d.eventType,delete d.firstSuccess,delete d.gatewayPort,d.vid=Number(d.vid);const t=Object.assign({},d,e,{eventType:wn.REJOIN_GATEWAY});this.send({type:Nn.RE_JOIN_GATEWAY,data:t},!0)}}joinChannelTimeout(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=Date.now(),n=En(En({},r.info),{},{lts:i,timeout:t,elapse:i-r.startTime});this.send({type:Nn.JOIN_CHANNEL_TIMEOUT,data:n},!0)}publish(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=En(En({},i),{},{eventType:wn.PUBLISH,lts:n,eventElapse:t.eventElapse,elapse:n-r.startTime,success:t.succ,errorCode:t.ec,videoName:t.videoName,audioName:t.audioName,screenName:t.screenName,screenshare:t.screenshare,audio:t.audio,video:t.video,p2pid:t.p2pid,publishRequestid:t.publishRequestid});this.send({type:Nn.PUBLISH,data:o},!0)}subscribe(e,t,r){const i=this.baseInfoMap.get(e);if(!i)return;const n=i.info,o=Date.now(),s=En(En({},n),{},{eventType:wn.SUBSCRIBE,lts:o,eventElapse:t.eventElapse,elapse:o-i.startTime,success:t.succ,errorCode:t.ec,video:t.video,audio:t.audio,subscribeRequestid:t.subscribeRequestid,p2pid:t.p2pid,preSsrc:t.preSsrc?1:0},r&&{extend:JSON.stringify({isMassSubscribe:!0})});"string"==typeof t.peerid?s.peerSuid=t.peerid:s.peer=t.peerid,this.send({type:Nn.SUBSCRIBE,data:s},!0)}wsCompressorInit(e){const t=[...this.baseInfoMap.keys()],r=t.length?t[0]:"UnableToGetSid",i=this.baseInfoMap.get(r);if(!i)return;const n=i.info,o=Date.now(),s=En(En({},n),{},{eventType:wn.WS_COMPRESSOR_INIT,lts:o,eventElapse:e.eventElapse,elapse:o-i.startTime,status:e.status?1:2});this.send({type:Nn.WS_COMPRESSOR_INIT,data:s},!0)}firstXLAPeerFirstVideoFrame(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=t.peerPubStatusMs-(r.lastJoinSuccessTime||n),s=En(En({},i),{},{elapse:n-r.startTime,eventType:wn.XLA_PEER_FIRST_VIDEO_FRAME,lts:n,peer:t.peer,width:t.width,height:t.height,ssrc:t.ssrc,p2pid:t.p2pid,peerPublishDuration:t.peerPublishDuration,joinChannelSuccessElapse:o,peerPubStatusMs:t.peerPubStatusMs-t.joinChannelStart,availablePublish:t.peerPublishDuration>o?1:0,preloadStart:Math.max(t.preloadStart-t.joinChannelStart,0),preloadEnd:Math.max(t.preloadEnd-t.joinChannelStart,0),encrypt:Math.max(t.apStart-t.joinChannelStart,0),ap:Math.max(t.apEnd-t.joinChannelStart,0),sua:Math.max(t.suaEnd-t.joinChannelStart,0),beforeConnect:Math.max(t.beforeConnect-t.joinChannelStart,0),peerRecevier:Math.max(t.peerReceiver-t.joinChannelStart,0),ice:Math.max(t.ice-t.joinChannelStart,0),pc:Math.max(t.pc-t.joinChannelStart,0),signalConnected:Math.max(t.signalConnected-t.joinChannelStart,0),joinReq:Math.max(t.joinReq-t.joinChannelStart,0),joinRes:Math.max(t.joinRes-t.joinChannelStart,0),userJoinNotify:Math.max(t.userJoinNotify-t.joinChannelStart,0),videoSsrcNotify:Math.max(t.videoAddNotify-t.joinChannelStart,0),subscribeDelayMs:Math.max(t.subscribeStart-t.videoAddNotify,0),subscribeStart:Math.max(t.subscribeStart-t.joinChannelStart,0),subscribeEnd:Math.max(t.subscribeEnd-t.joinChannelStart,0),firstReceived:Math.max(t.firstReceived-t.joinChannelStart,0),firstDecoded:Math.max(t.firstDecoded-t.joinChannelStart,0),firstPreRender:Math.max(t.firstPreRender-t.joinChannelStart,0),firstRender:Math.max(t.firstRender-t.joinChannelStart,0),playDelayMs:Math.max(t.playStart-t.subscribeEnd,0),playStart:Math.max(t.playStart-t.joinChannelStart,0),playEnd:Math.max(t.playEnd-t.joinChannelStart,0),isPreSub:t.isPreSub?1:0,isPrePc:t.isPrePc?1:0,isPreInstantVideo:t.isPreInstantVideo?1:0,firstReceivedEncodedFrame:t.firstReceivedEncodedFrame?Math.max(t.firstReceivedEncodedFrame-t.joinChannelStart,0):void 0,frameType:t.frameType||"",rtpTimestamp:t.rtpTimestamp||0,framePayloadType:t.framePayloadType||0,frameDataLength:t.frameDataLength||0,mimeType:t.mimeType||""});this.send({type:Nn.XLA_PEER_FIRST_VIDEO_FRAME,data:s},!0)}firstRemoteVideoDecode(e,t,r,i){const n=this.baseInfoMap.get(e);if(!n)return;const o=n.info,s=Date.now(),a=En(En(En({},o),i),{},{elapse:s-n.startTime,eventType:t,lts:s,firstDecodeFrame:Math.max((i.firstFrame||s)-n.startTime,0),apEnd:Math.max(i.apEnd-n.startTime,0),apStart:Math.max(i.apStart-n.startTime,0),joinGwEnd:Math.max(i.joinGwEnd-n.startTime,0),joinGwStart:Math.max(i.joinGwStart-n.startTime,0),pcEnd:Math.max(i.pcEnd-n.startTime,0),pcStart:Math.max(i.pcStart-n.startTime,0),subscriberEnd:Math.max(i.subscriberEnd-n.startTime,0),subscriberStart:Math.max(i.subscriberStart-n.startTime,0),videoAddNotify:Math.max(i.videoAddNotify-n.startTime,0)});this.send({type:r,data:a},!0)}firstRemoteFrame(e,t,r,i){const n=this.baseInfoMap.get(e);if(!n)return;const o=n.info,s=Date.now(),a=En(En(En({},o),i),{},{elapse:s-n.startTime,eventType:t,lts:s});this.send({type:r,data:a},!0)}abTest(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=En(En(En({},i),t),{},{vid:void 0===i.vid?0:Number(i.vid),elapse:n-r.startTime,eventType:wn.AB_TEST,lts:n});this.send({type:Nn.AB_TEST,data:o},!0)}pcStats(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=En(En(En({},i),t),{},{vid:void 0===i.vid?0:Number(i.vid),elapse:n-r.startTime,eventType:wn.PC_STATS,lts:n,preallocation:t.preallocation?1:0});this.send({type:Nn.PC_STATS,data:o},!0)}updateRemoteRTPCapabilities(e,t){if(e){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=En(En(En({},i),t),{},{vid:void 0===i.vid?0:Number(i.vid),eventType:wn.UPDATE_REMOTE_RTPCAPABILITIES,lts:n});this.send({type:Nn.UPDATE_REMOTE_RTPCAPABILITIES,data:o},!0)}}onGatewayStream(e,t,r,i){const n=this.baseInfoMap.get(e);if(!n)return;const o=n.info,s=Date.now(),a=En(En(En({},o),i),{},{eventType:t,lts:s});this.send({type:r,data:a},!0)}streamSwitch(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=En(En({},i),{},{eventType:wn.STREAM_SWITCH,lts:n,isDual:t.isdual,elapse:n-r.startTime,success:t.succ});this.send({type:Nn.STREAM_SWITCH,data:o},!0)}requestProxyAppCenter(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=En(En({},i),{},{eventType:wn.REQUEST_PROXY_APPCENTER,lts:n,eventElapse:n-t.lts,elapse:n-r.startTime,APAddr:t.APAddr,workerManagerList:t.workerManagerList,response:t.response,errorCode:t.ec,success:t.succ});this.send({type:Nn.REQUEST_PROXY_APPCENTER,data:o},!0)}requestProxyWorkerManager(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=En(En({},i),{},{eventType:wn.REQUEST_PROXY_WORKER_MANAGER,lts:n,eventElapse:n-t.lts,elapse:n-r.startTime,workerManagerAddr:t.workerManagerAddr,response:t.response,errorCode:t.ec,success:t.succ});this.send({type:Nn.REQUEST_PROXY_WORKER_MANAGER,data:o},!0)}setProxyServer(e){this.proxyServer=e,e?In.debug("reportProxyServerurl: ".concat(e)):In.debug("disable reportProxyServerurl: ".concat(e))}peerPublishStatus(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=En(En({},i),{},{subscribeElapse:t.subscribeElapse,peer:t.peer,peerPublishDuration:Math.max(t.audioPublishDuration,t.videoPublishDuration),audiotag:t.audioPublishDuration>0?1:-1,videotag:t.videoPublishDuration>0?1:-1,lts:n,elapse:n-r.startTime,joinChannelSuccessElapse:n-(r.lastJoinSuccessTime||n),peerPublishDurationVideo:t.videoPublishDuration,peerPublishDurationAudio:t.audioPublishDuration});this.send({type:Nn.PEER_PUBLISH_STATUS,data:o},!0)}workerEvent(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now();(function(e,t,r){const i=e[t];if(!i||"string"!=typeof i)return[e];e[t]="";const n=Ui(JSON.stringify(e));let o=0;const s=[];let a=0;for(let c=0;c<i.length;c++)a+=i.charCodeAt(c)<=127?1:3,a<=r-n||(s[s.length]=ei(ei({},e),{},{[t]:i.substring(o,c)}),o=c,a=i.charCodeAt(c)<=127?1:3);return o!==i.length-1&&(s[s.length]=ei(ei({},e),{},{[t]:i.substring(o)})),s})(En(En(En({},i),t),{},{elapse:n-r.startTime,lts:n,productType:"WebRTC"}),"payload",1300).forEach((e=>this.send({type:Nn.WORKER_EVENT,data:e},!0)))}apworkerEvent(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=En(En(En({},i),t),{},{elapse:n-r.startTime,lts:n});this.send({type:Nn.AP_WORKER_EVENT,data:o},!0)}joinWebProxyAP(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=En(En(En({},i),t),{},{elapse:n-r.startTime,lts:n,extend:t.extend||void 0});this.send({type:Nn.JOIN_WEB_PROXY_AP,data:o},!0)}WebSocketQuit(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=En(En(En({},i),t),{},{elapse:n-r.startTime,lts:n});this.send({type:Nn.WEBSOCKET_QUIT,data:o},!0)}async sendCustomReportMessage(e,t){if(this.customReportCount+=t.length,this.customReportCount>ln("CUSTOM_REPORT_LIMIT"))throw new ii(ri.CUSTOM_REPORT_FREQUENCY_TOO_HIGH);this.customReportCounterTimer||(this.customReportCounterTimer=window.setInterval((()=>{this.customReportCount=0}),5e3));const r=Date.now(),i=t.map((t=>({type:Nn.USER_ANALYTICS,data:En(En({sid:e},t),{},{lts:r})})));try{ln("NEW_REPORT_SERVER")?await this.postDataToStatsCollector2(i):await this.postDataToStatsCollector(i)}catch(e){throw In.error("send custom report message failed",e.toString()),new ii(ri.CUSTOM_REPORT_SEND_FAILED,e.message)}}sendApiInvoke(e){const t=ln("NOT_REPORT_EVENT");if(e.tag&&t.includes&&t.includes(e.tag))return!1;if(null===e.sid)return this.apiInvokeUploadPendingItems.push(e),!1;const r=this.baseInfoMap.get(e.sid);if(!r)return this.apiInvokeUploadPendingItems.push(e),!1;const{cname:i,uid:n,cid:o}=r.info;let s;if(e.lts=e.lts||Date.now(),e.error)if(e.error instanceof ii){const{code:t,message:r}=e.error;s=t||r||e.error.toString()}else s=e.error.toString();const a={invokeId:e.invokeId,sid:e.sid,cname:i,cid:o,uid:n,lts:e.lts,success:e.success,elapse:e.lts-r.startTime,execElapse:e.lts-e.apiInvokeTime,apiName:e.name,options:e.options?JSON.stringify(e.options):void 0,execStates:e.states?JSON.stringify(e.states):void 0,execResult:e.result?JSON.stringify(e.result):void 0,errorCode:e.error?s:void 0,errorMsg:e.error?JSON.stringify(e.error):void 0};return this.send({type:Nn.API_INVOKE,data:a},!1),!0}addSid(e){this.sids.add(e)}removeSid(e){this.sids.delete(e)}appendSessionId(){const e=this.apiInvokeUploadPendingItems;if(0===e.length)return;const t=Array.from(this.sids).find((e=>null!==e));t&&e.forEach((e=>{e&&(e.sid=t,this.sendApiInvoke(Object.assign({},e)))})),e.length=0}send(e,t){if(t)return this.keyEventUploadPendingItems.push(e),void this.sendItems(this.keyEventUploadPendingItems,!0);this.normalEventUploadPendingItems.push(e),this.normalEventUploadPendingItems.length>ln("NORMAL_EVENT_QUEUE_CAPACITY")&&this.normalEventUploadPendingItems.splice(0,1),this.normalEventUploadPendingItems.length>=10&&this.sendItems(this.normalEventUploadPendingItems,!1)}doSend(){this.keyEventUploadPendingItems.length>0&&this.sendItems(this.keyEventUploadPendingItems,!0),this.normalEventUploadPendingItems.length>0&&Date.now()-this.lastSendNormalEventTime>=5e3&&this.sendItems(this.normalEventUploadPendingItems,!1)}sendItems(e,t){const r=[],i=[];for(;e.length;){const t=e.shift();r.length<20?r.push(t):i.push(t)}e.push(...i);for(const e of[...r])-1!==this.ltsList.indexOf(e.data.lts)?(e.data.lts=this.ltsList[this.ltsList.length-1]+1,this.ltsList.push(e.data.lts)):(this.ltsList.push(e.data.lts),this.ltsList.sort(((e,t)=>e-t)));return t||(this.lastSendNormalEventTime=Date.now()),ln("ENABLE_EVENT_REPORT")?(r.length&&(ln("NEW_REPORT_SERVER")?this.postDataToStatsCollector2(r):this.postDataToStatsCollector(r)).catch((e=>r=>{ln("EVENT_REPORT_RETRY")&&(t?this.keyEventUploadPendingItems=this.keyEventUploadPendingItems.concat(e):(this.normalEventUploadPendingItems=this.normalEventUploadPendingItems.concat(e),this.normalEventUploadPendingItems.length>ln("NORMAL_EVENT_QUEUE_CAPACITY")&&(this.normalEventUploadPendingItems.splice(0,this.normalEventUploadPendingItems.length-ln("NORMAL_EVENT_QUEUE_CAPACITY")),In.warning("report: drop normal events"))))})(r)),e):e}async postDataToStatsCollector2(e){Ai.networkState===gi.OFFLINE&&await Promise.race([Ai.onlineWaiter,xi(2*Ji.maxRetryTimeout)]);const t=e=>{let t=new Uint8Array;return e.forEach((e=>{const r=function(e){return(new TextEncoder).encode(e)}(JSON.stringify(e.data)),i=new ArrayBuffer(5),n=(e=>{let t=0;return Object.entries(Nn).forEach((r=>{let[i,n]=r;n===e.type&&(t=Dn[i])})),t})(e),o=new DataView(i);o.setUint16(0,r.byteLength,!0),o.setUint8(2,255&n),o.setUint8(3,n>>>8&255),o.setUint8(4,n>>>16&255),t=hi(t,new Uint8Array(i)),t=hi(t,r)})),t},r="event";let i=this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(ln("NEW_REPORT_SERVER_DOMAINS")[0],"&p=443&d=").concat(r):"https://".concat(ln("NEW_REPORT_SERVER_DOMAINS")[0],"/").concat(r);for(let n=0;n<2;n+=1){1===n&&(i=this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(ln("NEW_REPORT_SERVER_DOMAINS")[1],"&p=443&d=").concat(r):"https://".concat(ln("NEW_REPORT_SERVER_DOMAINS")[1],"/").concat(r));try{await en(i,{timeout:1e4,data:t(e),headers:En(En({biz:"webrtc",sendts:Math.round(Date.now()/1e3),debug:"false"},this._appId&&{appid:this._appId}),{},{"Content-Type":"application/octet-stream"})},!0)}catch(e){if(1===n)throw e;continue}return}}async postDataToStatsCollector(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=(e=>{const t=e&&e.data.sid&&this.baseInfoMap.get(e.data.sid);return t&&t.info.vid&&+t.info.vid||0})(e[0]),i=r?void 0:this._aid,n={msgType:"EventMessages",sentTs:Math.round(Date.now()/1e3),payloads:e.map((e=>JSON.stringify(e))),vid:r,aid:i};Ai.networkState===gi.OFFLINE&&await Promise.race([Ai.onlineWaiter,xi(2*Ji.maxRetryTimeout)]);const o=t?"/events/proto-raws":"/events/messages";let s=this.url||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(ln("EVENT_REPORT_DOMAIN"),"&p=").concat(ln("STATS_COLLECTOR_PORT"),"&d=").concat(o):"https://".concat(ln("EVENT_REPORT_DOMAIN"),":").concat(ln("STATS_COLLECTOR_PORT")).concat(o));for(let e=0;e<2;e+=1){1===e&&(s=this.backupUrl||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(ln("EVENT_REPORT_BACKUP_DOMAIN"),"&p=").concat(ln("STATS_COLLECTOR_PORT"),"&d=").concat(o):"https://".concat(ln("EVENT_REPORT_BACKUP_DOMAIN"),":").concat(ln("STATS_COLLECTOR_PORT")).concat(o)));try{t?await tn(s,{timeout:1e4,data:n}):await en(s,{timeout:1e4,data:n})}catch(t){if(1===e)throw t;continue}return}}createBaseInfo(e,t){const r=Object.assign({},Cn);return r.sid=e,this.baseInfoMap.set(e,{info:r,startTime:t}),r}reportResourceTiming(e,t){const r=performance.getEntriesByName(e),i=r[r.length-1];i&&this.reportApiInvoke(t,{name:"Client.resourceTiming",options:i,tag:Ti.TRACER}).onSuccess()}};gn.on("REPORT_LOG_UPLOAD",(e=>{e.networkState=Ai.networkState,Ln.reportApiInvoke(null,{name:"logUploadError",options:e,tag:Ti.TRACER}).onSuccess("logUploadError")}));const kn={getDisplayMedia:!1,getStreamFromExtension:!1,supportUnifiedPlan:!1,supportMinBitrate:!1,supportSetRtpSenderParameters:!1,supportDualStream:!0,webAudioMediaStreamDest:!1,supportReplaceTrack:!1,supportWebGL:!1,webAudioWithAEC:!1,supportRequestFrame:!1,supportShareAudio:!1,supportDualStreamEncoding:!1,supportDataChannel:!1,supportPCSetConfiguration:!1,supportWebRTCEncodedTransform:!1,supportWebRTCInsertableStream:!1,supportRequestVideoFrameCallback:!1,supportWebCrypto:!1,supportSuppressLocalAudioPlayback:!1,supportRestrictOwnAudio:!1};function Mn(){const e=Cr();kn.getDisplayMedia=function(e){if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return!0;return!1}(),kn.getStreamFromExtension=e.name===Ar.CHROME&&Number(e.version)>34,kn.supportUnifiedPlan=function(){if(!window.RTCRtpTransceiver)return!1;if(!("currentDirection"in RTCRtpTransceiver.prototype))return!1;const e=new RTCPeerConnection;let t=!1;try{e.addTransceiver("audio"),t=!0}catch(e){}return e.close(),t}(),kn.supportMinBitrate=e.name===Ar.CHROME||e.name===Ar.EDGE,kn.supportSetRtpSenderParameters=function(){const e=Cr();if(!window.RTCRtpSender||!window.RTCRtpSender.prototype.setParameters||!window.RTCRtpSender.prototype.getParameters)return!1;return!!Jr()||(!(!kr()&&!Pr())||e.name===Ar.FIREFOX&&Number(e.version)>=64)}(),e.name===Ar.SAFARI&&(Number(e.version)>=14?kn.supportDualStream=!0:kn.supportDualStream=!1),kn.webAudioMediaStreamDest=function(){const e=Cr();if(e.name===Ar.SAFARI&&Number(e.version)<12)return!1;return!0}(),kn.supportReplaceTrack=function(){if(!window.RTCRtpSender)return!1;if("function"==typeof RTCRtpSender.prototype.replaceTrack)return!0;return!1}(),kn.supportWebGL="undefined"!=typeof WebGLRenderingContext,kn.supportRequestFrame=!!window.CanvasCaptureMediaStreamTrack,Jr()||(kn.webAudioWithAEC=!0),kn.supportShareAudio=function(){const e=Cr();if((e.os===vr.WIN_10||e.os===vr.WIN_81||e.os===vr.WIN_7||e.os===vr.LINUX||e.os===vr.MAC_OS||e.os===vr.CHROMIUM_OS)&&e.name===Ar.CHROME&&Number(e.version)>=74)return!0;return!1}(),kn.supportDataChannel=function(){if(Vr(76)||jr(68)||function(e){const t=Cr();return!(t.name!==Ar.SAFARI||!t.osVersion)&&Number(t.version)>=e}(14))return!0;return!1}(),kn.supportPCSetConfiguration=function(){const e=window.RTCPeerConnection;return!Ur()&&!!e&&e.prototype.setConfiguration instanceof Function}(),kn.supportWebRTCEncodedTransform=xn(),kn.supportWebRTCInsertableStream=function(){const e=Cr();return(e.name===Ar.CHROME||e.name===Ar.EDGE)&&Number(e.version)>=94&&"MediaStreamTrackGenerator"in window&&"MediaStreamTrackProcessor"in window}(),kn.supportRequestVideoFrameCallback=function(){if("requestVideoFrameCallback"in HTMLVideoElement.prototype)return!0;return!1}(),kn.supportWebCrypto="undefined"!=typeof window&&void 0!==window.crypto&&void 0!==window.crypto.subtle,kn.supportSuppressLocalAudioPlayback=jn(),kn.supportRestrictOwnAudio=Gn(),Di((()=>{kn.supportDualStreamEncoding=function(){const e=Cr();if(ln("DISABLE_WEBAUDIO"))return!0;return"Safari"===e.name&&Number(e.version)>=14||!!("Chrome"===e.name&&/Windows/i.test(e.os||"")&&Number(e.version)>=100&&ln("CHROME_DUAL_STREAM_USE_ENCODING"))}(),In.debug("browser ua: ",navigator.userAgent),In.info("browser info: ",e),In.info("browser compatibility: ",kn)}))}function Un(){return kn}function xn(){let e=0;const t=function(){const e=navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]*/i);return e&&e[0]?e[0].split("/")[1]:null}();return t&&(e=parseInt(t)),Vr(87)||function(){const e=Cr();if(e.name!==Ar.SAFARI||!e.browserVersion)return!1;const t=e.browserVersion.split(".");return Number(t[0])>15||15===Number(t[0])&&Number(t[1])>=4}()||jr(117)||zr()&&(function(e,t,r){const i=Cr();if(i.os!==vr.IOS||!i.osVersion)return!1;const n=i.osVersion.split(".");return r?t&&Number(n[0])===e&&Number(n[1])>t||Number(n[0])>e:t?Number(n[0])===e&&Number(n[1])>=t||Number(n[0])>e:Number(n[0])>=e}(15,4,!1)||e>87)}function Vn(){return"setSinkId"in HTMLAudioElement.prototype&&(!ln("RESTRICTION_SET_PLAYBACK_DEVICE")||(Lr()||Mr())&&!Zr())}function Fn(){return!kn.supportUnifiedPlan||ln("CHROME_FORCE_PLAN_B")&&Jr()}function Bn(){return navigator.mediaDevices&&"getSupportedConstraints"in navigator.mediaDevices}function jn(){if(Bn()){const e=navigator.mediaDevices.getSupportedConstraints();return!(!("suppressLocalAudioPlayback"in e)||!e.suppressLocalAudioPlayback)}return Vr(141)||Br(141)||Gr(141)}function Gn(){if(Bn()){const e=navigator.mediaDevices.getSupportedConstraints();return!(!("restrictOwnAudio"in e)||!e.restrictOwnAudio)}return Vr(141)||Br(141)||Gr(125)}let Wn=function(e){return e.IOS_15_16_INTERRUPTION_START="ios15_16-interruption-start",e.IOS_15_16_INTERRUPTION_END="ios15_16-interruption-end",e.IOS_INTERRUPTION_START="ios-interruption-start",e.IOS_INTERRUPTION_END="ios-interruption-end",e.STATE_CHANGE="state-change",e}({});var Hn=function(e){try{return!!e()}catch(e){return!0}},Kn=!Hn((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Yn=Kn,zn=Function.prototype,Xn=zn.call,Zn=Yn&&zn.bind.bind(Xn,Xn),Jn=Yn?Zn:function(e){return function(){return Xn.apply(e,arguments)}},Qn=Jn({}.isPrototypeOf),qn=function(e){return e&&e.Math==Math&&e},$n=qn("object"==typeof globalThis&&globalThis)||qn("object"==typeof window&&window)||qn("object"==typeof self&&self)||qn("object"==typeof X&&X)||function(){return this}()||X||Function("return this")(),eo=Kn,to=Function.prototype,ro=to.apply,io=to.call,no="object"==typeof Reflect&&Reflect.apply||(eo?io.bind(ro):function(){return io.apply(ro,arguments)}),oo=Jn,so=oo({}.toString),ao=oo("".slice),co=function(e){return ao(so(e),8,-1)},uo=co,lo=Jn,ho=function(e){if("Function"===uo(e))return lo(e)},po="object"==typeof document&&document.all,fo={all:po,IS_HTMLDDA:void 0===po&&void 0!==po},Eo=fo.all,mo=fo.IS_HTMLDDA?function(e){return"function"==typeof e||e===Eo}:function(e){return"function"==typeof e},_o={},To=!Hn((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),go=Kn,So=Function.prototype.call,Ro=go?So.bind(So):function(){return So.apply(So,arguments)},yo={},vo={}.propertyIsEnumerable,Ao=Object.getOwnPropertyDescriptor,bo=Ao&&!vo.call({1:2},1);yo.f=bo?function(e){var t=Ao(this,e);return!!t&&t.enumerable}:vo;var Io,Oo,Co=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},wo=Hn,No=co,Do=Object,Po=Jn("".split),Lo=wo((function(){return!Do("z").propertyIsEnumerable(0)}))?function(e){return"String"==No(e)?Po(e,""):Do(e)}:Do,ko=function(e){return null==e},Mo=ko,Uo=TypeError,xo=function(e){if(Mo(e))throw Uo("Can't call method on "+e);return e},Vo=Lo,Fo=xo,Bo=function(e){return Vo(Fo(e))},jo=mo,Go=fo.all,Wo=fo.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:jo(e)||e===Go}:function(e){return"object"==typeof e?null!==e:jo(e)},Ho={},Ko=Ho,Yo=$n,zo=mo,Xo=function(e){return zo(e)?e:void 0},Zo=function(e,t){return arguments.length<2?Xo(Ko[e])||Xo(Yo[e]):Ko[e]&&Ko[e][t]||Yo[e]&&Yo[e][t]},Jo="undefined"!=typeof navigator&&String(navigator.userAgent)||"",Qo=$n,qo=Jo,$o=Qo.process,es=Qo.Deno,ts=$o&&$o.versions||es&&es.version,rs=ts&&ts.v8;rs&&(Oo=(Io=rs.split("."))[0]>0&&Io[0]<4?1:+(Io[0]+Io[1])),!Oo&&qo&&(!(Io=qo.match(/Edge\/(\d+)/))||Io[1]>=74)&&(Io=qo.match(/Chrome\/(\d+)/))&&(Oo=+Io[1]);var is=Oo,ns=is,os=Hn,ss=$n.String,as=!!Object.getOwnPropertySymbols&&!os((function(){var e=Symbol();return!ss(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ns&&ns<41})),cs=as&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ds=Zo,us=mo,ls=Qn,hs=Object,ps=cs?function(e){return"symbol"==typeof e}:function(e){var t=ds("Symbol");return us(t)&&ls(t.prototype,hs(e))},fs=String,Es=function(e){try{return fs(e)}catch(e){return"Object"}},ms=mo,_s=Es,Ts=TypeError,gs=function(e){if(ms(e))return e;throw Ts(_s(e)+" is not a function")},Ss=gs,Rs=ko,ys=function(e,t){var r=e[t];return Rs(r)?void 0:Ss(r)},vs=Ro,As=mo,bs=Wo,Is=TypeError,Os={exports:{}},Cs=$n,ws=Object.defineProperty,Ns=function(e,t){try{ws(Cs,e,{value:t,configurable:!0,writable:!0})}catch(r){Cs[e]=t}return t},Ds="__core-js_shared__",Ps=$n[Ds]||Ns(Ds,{}),Ls=Ps;(Os.exports=function(e,t){return Ls[e]||(Ls[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.31.1",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var ks=Os.exports,Ms=xo,Us=Object,xs=function(e){return Us(Ms(e))},Vs=xs,Fs=Jn({}.hasOwnProperty),Bs=Object.hasOwn||function(e,t){return Fs(Vs(e),t)},js=Jn,Gs=0,Ws=Math.random(),Hs=js(1..toString),Ks=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Hs(++Gs+Ws,36)},Ys=ks,zs=Bs,Xs=Ks,Zs=as,Js=cs,Qs=$n.Symbol,qs=Ys("wks"),$s=Js?Qs.for||Qs:Qs&&Qs.withoutSetter||Xs,ea=function(e){return zs(qs,e)||(qs[e]=Zs&&zs(Qs,e)?Qs[e]:$s("Symbol."+e)),qs[e]},ta=Ro,ra=Wo,ia=ps,na=ys,oa=function(e,t){var r,i;if("string"===t&&As(r=e.toString)&&!bs(i=vs(r,e)))return i;if(As(r=e.valueOf)&&!bs(i=vs(r,e)))return i;if("string"!==t&&As(r=e.toString)&&!bs(i=vs(r,e)))return i;throw Is("Can't convert object to primitive value")},sa=TypeError,aa=ea("toPrimitive"),ca=function(e,t){if(!ra(e)||ia(e))return e;var r,i=na(e,aa);if(i){if(void 0===t&&(t="default"),r=ta(i,e,t),!ra(r)||ia(r))return r;throw sa("Can't convert object to primitive value")}return void 0===t&&(t="number"),oa(e,t)},da=ps,ua=function(e){var t=ca(e,"string");return da(t)?t:t+""},la=Wo,ha=$n.document,pa=la(ha)&&la(ha.createElement),fa=function(e){return pa?ha.createElement(e):{}},Ea=fa,ma=!To&&!Hn((function(){return 7!=Object.defineProperty(Ea("div"),"a",{get:function(){return 7}}).a})),_a=To,Ta=Ro,ga=yo,Sa=Co,Ra=Bo,ya=ua,va=Bs,Aa=ma,ba=Object.getOwnPropertyDescriptor;_o.f=_a?ba:function(e,t){if(e=Ra(e),t=ya(t),Aa)try{return ba(e,t)}catch(e){}if(va(e,t))return Sa(!Ta(ga.f,e,t),e[t])};var Ia=Hn,Oa=mo,Ca=/#|\.prototype\./,wa=function(e,t){var r=Da[Na(e)];return r==La||r!=Pa&&(Oa(t)?Ia(t):!!t)},Na=wa.normalize=function(e){return String(e).replace(Ca,".").toLowerCase()},Da=wa.data={},Pa=wa.NATIVE="N",La=wa.POLYFILL="P",ka=wa,Ma=gs,Ua=Kn,xa=ho(ho.bind),Va=function(e,t){return Ma(e),void 0===t?e:Ua?xa(e,t):function(){return e.apply(t,arguments)}},Fa={},Ba=To&&Hn((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ja=Wo,Ga=String,Wa=TypeError,Ha=function(e){if(ja(e))return e;throw Wa(Ga(e)+" is not an object")},Ka=To,Ya=ma,za=Ba,Xa=Ha,Za=ua,Ja=TypeError,Qa=Object.defineProperty,qa=Object.getOwnPropertyDescriptor,$a="enumerable",ec="configurable",tc="writable";Fa.f=Ka?za?function(e,t,r){if(Xa(e),t=Za(t),Xa(r),"function"==typeof e&&"prototype"===t&&"value"in r&&tc in r&&!r[tc]){var i=qa(e,t);i&&i[tc]&&(e[t]=r.value,r={configurable:ec in r?r[ec]:i[ec],enumerable:$a in r?r[$a]:i[$a],writable:!1})}return Qa(e,t,r)}:Qa:function(e,t,r){if(Xa(e),t=Za(t),Xa(r),Ya)try{return Qa(e,t,r)}catch(e){}if("get"in r||"set"in r)throw Ja("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var rc=Fa,ic=Co,nc=To?function(e,t,r){return rc.f(e,t,ic(1,r))}:function(e,t,r){return e[t]=r,e},oc=$n,sc=no,ac=ho,cc=mo,dc=_o.f,uc=ka,lc=Ho,hc=Va,pc=nc,fc=Bs,Ec=function(e){var t=function(r,i,n){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,i)}return new e(r,i,n)}return sc(e,this,arguments)};return t.prototype=e.prototype,t},mc=function(e,t){var r,i,n,o,s,a,c,d,u,l=e.target,h=e.global,p=e.stat,f=e.proto,E=h?oc:p?oc[l]:(oc[l]||{}).prototype,m=h?lc:lc[l]||pc(lc,l,{})[l],_=m.prototype;for(o in t)i=!(r=uc(h?o:l+(p?".":"#")+o,e.forced))&&E&&fc(E,o),a=m[o],i&&(c=e.dontCallGetSet?(u=dc(E,o))&&u.value:E[o]),s=i&&c?c:t[o],i&&typeof a==typeof s||(d=e.bind&&i?hc(s,oc):e.wrap&&i?Ec(s):f&&cc(s)?ac(s):s,(e.sham||s&&s.sham||a&&a.sham)&&pc(d,"sham",!0),pc(m,o,d),f&&(fc(lc,n=l+"Prototype")||pc(lc,n,{}),pc(lc[n],o,s),e.real&&_&&(r||!_[o])&&pc(_,o,s)))},_c=Math.ceil,Tc=Math.floor,gc=Math.trunc||function(e){var t=+e;return(t>0?Tc:_c)(t)},Sc=gc,Rc=function(e){var t=+e;return t!=t||0===t?0:Sc(t)},yc=Rc,vc=Math.max,Ac=Math.min,bc=function(e,t){var r=yc(e);return r<0?vc(r+t,0):Ac(r,t)},Ic=Rc,Oc=Math.min,Cc=function(e){return e>0?Oc(Ic(e),9007199254740991):0},wc=function(e){return Cc(e.length)},Nc=Bo,Dc=bc,Pc=wc,Lc=function(e){return function(t,r,i){var n,o=Nc(t),s=Pc(o),a=Dc(i,s);if(e&&r!=r){for(;s>a;)if((n=o[a++])!=n)return!0}else for(;s>a;a++)if((e||a in o)&&o[a]===r)return e||a||0;return!e&&-1}},kc={includes:Lc(!0),indexOf:Lc(!1)},Mc=kc.includes;mc({target:"Array",proto:!0,forced:Hn((function(){return!Array(1).includes()}))},{includes:function(e){return Mc(this,e,arguments.length>1?arguments[1]:void 0)}});var Uc=Ho,xc=function(e){return Uc[e+"Prototype"]},Vc=xc("Array").includes,Fc=Wo,Bc=co,jc=ea("match"),Gc=function(e){var t;return Fc(e)&&(void 0!==(t=e[jc])?!!t:"RegExp"==Bc(e))},Wc=TypeError,Hc={};Hc[ea("toStringTag")]="z";var Kc="[object z]"===String(Hc),Yc=Kc,zc=mo,Xc=co,Zc=ea("toStringTag"),Jc=Object,Qc="Arguments"==Xc(function(){return arguments}()),qc=Yc?Xc:function(e){var t,r,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=Jc(e),Zc))?r:Qc?Xc(t):"Object"==(i=Xc(t))&&zc(t.callee)?"Arguments":i},$c=qc,ed=String,td=function(e){if("Symbol"===$c(e))throw TypeError("Cannot convert a Symbol value to a string");return ed(e)},rd=ea("match"),id=mc,nd=function(e){if(Gc(e))throw Wc("The method doesn't accept regular expressions");return e},od=xo,sd=td,ad=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[rd]=!1,"/./"[e](t)}catch(e){}}return!1},cd=Jn("".indexOf);id({target:"String",proto:!0,forced:!ad("includes")},{includes:function(e){return!!~cd(sd(od(this)),sd(nd(e)),arguments.length>1?arguments[1]:void 0)}});var dd=xc("String").includes,ud=Qn,ld=Vc,hd=dd,pd=Array.prototype,fd=String.prototype,Ed=Z((function(e){var t=e.includes;return e===pd||ud(pd,e)&&t===pd.includes?ld:"string"==typeof e||e===fd||ud(fd,e)&&t===fd.includes?hd:t}));function md(e,t,r){return{sampleRate:e,stereo:t,bitrate:r}}function _d(e,t,r,i,n){return{width:e,height:t,frameRate:r,bitrateMin:i,bitrateMax:n}}function Td(e,t,r,i,n){return{width:{max:e},height:{max:t},frameRate:r,bitrateMin:i,bitrateMax:n}}function gd(e,t){return{numSpatialLayers:e,numTemporalLayers:t}}const Sd={"90p":_d(160,90),"90p_1":_d(160,90),"120p":_d(160,120,15,30,65),"120p_1":_d(160,120,15,30,65),"120p_3":_d(120,120,15,30,50),"120p_4":_d(212,120),"180p":_d(320,180,15,30,140),"180p_1":_d(320,180,15,30,140),"180p_3":_d(180,180,15,30,100),"180p_4":_d(240,180,15,30,120),"240p":_d(320,240,15,40,200),"240p_1":_d(320,240,15,40,200),"240p_3":_d(240,240,15,40,140),"240p_4":_d(424,240,15,40,220),"360p":_d(640,360,15,80,400),"360p_1":_d(640,360,15,80,400),"360p_3":_d(360,360,15,80,260),"360p_4":_d(640,360,30,80,600),"360p_6":_d(360,360,30,80,400),"360p_7":_d(480,360,15,80,320),"360p_8":_d(480,360,30,80,490),"360p_9":_d(640,360,15,80,800),"360p_10":_d(640,360,24,80,800),"360p_11":_d(640,360,24,80,1e3),"480p":_d(640,480,15,100,500),"480p_1":_d(640,480,15,100,500),"480p_2":_d(640,480,30,100,1e3),"480p_3":_d(480,480,15,100,400),"480p_4":_d(640,480,30,100,750),"480p_6":_d(480,480,30,100,600),"480p_8":_d(848,480,15,100,610),"480p_9":_d(848,480,30,100,930),"480p_10":_d(640,480,10,100,400),"720p":_d(1280,720,15,120,1130),"720p_auto":_d(1280,720,30,900,3e3),"720p_1":_d(1280,720,15,120,1130),"720p_2":_d(1280,720,30,120,2e3),"720p_3":_d(1280,720,30,120,1710),"720p_5":_d(960,720,15,120,910),"720p_6":_d(960,720,30,120,1380),"1080p":_d(1920,1080,15,120,2080),"1080p_1":_d(1920,1080,15,120,2080),"1080p_2":_d(1920,1080,30,120,3e3),"1080p_3":_d(1920,1080,30,120,3150),"1080p_5":_d(1920,1080,60,120,4780),"1440p":_d(2560,1440,30,120,4850),"1440p_1":_d(2560,1440,30,120,4850),"1440p_2":_d(2560,1440,60,120,7350),"4k":_d(3840,2160,30,120,8910),"4k_1":_d(3840,2160,30,120,8910),"4k_3":_d(3840,2160,60,120,13500)},Rd={"480p":Td(640,480,5),"480p_1":Td(640,480,5),"480p_2":Td(640,480,30),"480p_3":Td(640,480,15),"720p":Td(1280,720,5),"720p_auto":_d(1280,720,30,900,3e3),"720p_1":Td(1280,720,5),"720p_2":Td(1280,720,30),"720p_3":Td(1280,720,15),"1080p":Td(1920,1080,5),"1080p_1":Td(1920,1080,5),"1080p_2":Td(1920,1080,30),"1080p_3":Td(1920,1080,15)},yd={"1SL1TL":gd(1,1),"3SL3TL":gd(3,3),"2SL3TL":gd(2,3)};function vd(e){return e||(e="480p_1"),"string"==typeof e?Object.assign({},Sd[e]):e}function Ad(e){return"string"==typeof e?Object.assign({},Rd[e]):e}function bd(e){return"string"==typeof e?Object.assign({},yd[e]):e}const Id={speech_low_quality:md(16e3,!1),speech_standard:md(32e3,!1,18),music_standard:md(48e3,!1),standard_stereo:md(48e3,!0,56),high_quality:md(48e3,!1,128),high_quality_stereo:md(48e3,!0,192)};function Od(e){return"string"==typeof e?Object.assign({},Id[e]):e}const Cd=[];function wd(e){Ed(Cd).call(Cd,e)||Cd.push(e)}function Nd(e){const t=Cd.indexOf(e);-1!==t&&Cd.splice(t,1)}function Dd(){return Cd.some((e=>function(e){return"__className__"in e&&"MicrophoneAudioTrack"===e.__className__}(e)))}function Pd(e){return ai(e.width,"config.width"),ai(e.height,"config.height"),void 0!==e.frameRate&&ai(e.frameRate,"config.frameRate"),void 0!==e.bitrateMax&&si(e.bitrateMax,"config.bitrateMax"),void 0!==e.bitrateMin&&si(e.bitrateMin,"config.bitrateMin"),!0}function Ld(e){return void 0!==e.sampleRate&&si(e.sampleRate,"config.sampleRate",0,96e3,!0),void 0!==e.sampleSize&&si(e.sampleRate,"config.sampleSize",0,128,!0),void 0!==e.stereo&&ni(e.stereo,"config.stereo"),void 0!==e.bitrate&&si(e.bitrate,"config.bitrate",0,1e4,!1),!0}function kd(e){return oi(e,"mediaSource",["screen","window","application"]),!0}let Md=function(e){return e.NEED_RENEGOTIATE="@need_renegotiate",e.NEED_REPLACE_TRACK="@need_replace_track",e.NEED_REPLACE_MIXING_TRACK="@need_replace_mixing_track",e.NEED_CLOSE="@need_close",e.NEED_ENABLE_TRACK="@need_enable_track",e.NEED_DISABLE_TRACK="@need_disable_track",e.NEED_SESSION_ID="@need_sid",e.SET_OPTIMIZATION_MODE="@set_optimization_mode",e.GET_STATS="@get_stats",e.GET_RTC_STATS="@get_rtc_stats",e.GET_LOW_VIDEO_TRACK="@get_low_video_track",e.NEED_RESET_REMOTE_SDP="@need_reset_remote_sdp",e.NEED_UPDATE_VIDEO_ENCODER="@need_update_video_encoder",e.NEED_UPDATE_VIDEO_SEND_PARAMETERS="@need_update_video_send_parameters",e.NEED_MUTE_TRACK="@need_mute_track",e.NEED_UNMUTE_TRACK="@need_unmute_track",e}({}),Ud=function(e){return e.SCREEN_TRACK="screen_track",e.CUSTOM_TRACK="custome_track",e.LOW_STREAM="low_stream",e.SCREEN_LOW_TRACK="screen_low_track",e}({});let xd=function(e){return e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM",e}({}),Vd=function(e){return e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM",e[e.HIGH_STREAM_LAYER1=4]="HIGH_STREAM_LAYER1",e[e.HIGH_STREAM_LAYER2=5]="HIGH_STREAM_LAYER2",e[e.HIGH_STREAM_LAYER3=6]="HIGH_STREAM_LAYER3",e[e.HIGH_STREAM_LAYER4=7]="HIGH_STREAM_LAYER4",e[e.HIGH_STREAM_LAYER5=8]="HIGH_STREAM_LAYER5",e[e.HIGH_STREAM_LAYER6=9]="HIGH_STREAM_LAYER6",e}({}),Fd=function(e){return e[e.DISABLE=0]="DISABLE",e[e.LOW_STREAM=1]="LOW_STREAM",e[e.AUDIO_ONLY=2]="AUDIO_ONLY",e[e.HIGH_STREAM_LAYER1=3]="HIGH_STREAM_LAYER1",e[e.HIGH_STREAM_LAYER2=4]="HIGH_STREAM_LAYER2",e[e.HIGH_STREAM_LAYER3=5]="HIGH_STREAM_LAYER3",e[e.HIGH_STREAM_LAYER4=6]="HIGH_STREAM_LAYER4",e[e.HIGH_STREAM_LAYER5=7]="HIGH_STREAM_LAYER5",e[e.HIGH_STREAM_LAYER6=8]="HIGH_STREAM_LAYER6",e}({}),Bd=function(e){return e.TRANSCEIVER_UPDATED="transceiver-updated",e.SEI_TO_SEND="sei-to-send",e.SEI_RECEIVED="sei-received",e.TRACK_UPDATED="track-updated",e}({}),jd=function(e){return e.SOURCE_STATE_CHANGE="source-state-change",e.TRACK_ENDED="track-ended",e.BEAUTY_EFFECT_OVERLOAD="beauty-effect-overload",e.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",e.CLOSED="closed",e}({}),Gd=function(e){return e.FIRST_FRAME_DECODED="first-frame-decoded",e.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",e.VIDEO_STATE_CHANGED="video-state-changed",e.PLAY_START="play-start",e.PLAY_END="play-end",e.FIRST_FRAME_RENDER="first-frame-render",e}({}),Wd=function(e){return e.AUDIO="audio",e.VIDEO="video",e.DATA="data",e}({}),Hd=function(e){return e.AUDIO_SOURCE_STATE_CHANGE="audio_source_state_change",e.RECEIVE_TRACK_BUFFER="receive_track_buffer",e.ON_AUDIO_BUFFER="on_audio_buffer",e.UPDATE_SOURCE="update_source",e}({}),Kd=function(e){return e.UPDATE_TRACK_SOURCE="update-track-source",e}({});const Yd={sendVolumeLevel:0,sendBitrate:0,sendBytes:0,sendPackets:0,sendPacketsLost:0,sendJitterMs:0,sendRttMs:0,currentPacketLossRate:0},zd={sendBytes:0,sendBitrate:0,sendPackets:0,sendPacketsLost:0,sendJitterMs:0,sendRttMs:0,sendResolutionHeight:0,sendResolutionWidth:0,captureResolutionHeight:0,captureResolutionWidth:0,targetSendBitrate:0,totalDuration:0,totalFreezeTime:0,currentPacketLossRate:0},Xd={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveLevel:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,receivePacketsDiscarded:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1},Zd={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,receiveResolutionHeight:0,receiveResolutionWidth:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1};let Jd=function(e){return e.ON_TRACK="on_track",e.ON_NODE="on_node",e}({}),Qd=function(e){return e.REQUEST_UPDATE_CONSTRAINTS="request_update_constraints",e.REQUEST_CONSTRAINTS="request_constraints",e}({}),qd=function(e){return e.IDLE="IDLE",e.INITING="INITING",e.INITEND="INITEND",e}({}),$d=function(e){return e.STATE_CHANGE="state_change",e.RECORDING_DEVICE_CHANGED="recordingDeviceChanged",e.PLAYOUT_DEVICE_CHANGED="playoutDeviceChanged",e.CAMERA_DEVICE_CHANGED="cameraDeviceChanged",e}({});let eu=function(e){return e.NONE="none",e.INIT="init",e.CANPLAY="canplay",e.PLAYING="playing",e.PAUSED="paused",e.SUSPEND="suspend",e.STALLED="stalled",e.WAITING="waiting",e.ERROR="error",e.DESTROYED="destroyed",e.ABORT="abort",e.ENDED="ended",e.EMPTIED="emptied",e.LOADEDDATA="loadeddata",e}({}),tu=function(e){return e[e.VideoStateStopped=0]="VideoStateStopped",e[e.VideoStateStarting=1]="VideoStateStarting",e[e.VideoStateDecoding=2]="VideoStateDecoding",e[e.VideoStateFrozen=3]="VideoStateFrozen",e}({});let ru=function(e){return e.OPEN="open",e.MESSAGE="message",e.CLOSE="close",e.CLOSING="closing",e.ERROR="error",e}({});var iu={exports:{}},nu=mc,ou=To,su=Fa.f;nu({target:"Object",stat:!0,forced:Object.defineProperty!==su,sham:!ou},{defineProperty:su});var au=Ho.Object,cu=iu.exports=function(e,t,r){return au.defineProperty(e,t,r)};au.defineProperty.sham&&(cu.sham=!0);var du=Z(iu.exports),uu=co,lu=Array.isArray||function(e){return"Array"==uu(e)},hu=TypeError,pu=ua,fu=Fa,Eu=Co,mu=function(e,t,r){var i=pu(t);i in e?fu.f(e,i,Eu(0,r)):e[i]=r},_u=mo,Tu=Ps,gu=Jn(Function.toString);_u(Tu.inspectSource)||(Tu.inspectSource=function(e){return gu(e)});var Su=Tu.inspectSource,Ru=Jn,yu=Hn,vu=mo,Au=qc,bu=Su,Iu=function(){},Ou=[],Cu=Zo("Reflect","construct"),wu=/^\s*(?:class|function)\b/,Nu=Ru(wu.exec),Du=!wu.exec(Iu),Pu=function(e){if(!vu(e))return!1;try{return Cu(Iu,Ou,e),!0}catch(e){return!1}},Lu=function(e){if(!vu(e))return!1;switch(Au(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Du||!!Nu(wu,bu(e))}catch(e){return!0}};Lu.sham=!0;var ku=!Cu||yu((function(){var e;return Pu(Pu.call)||!Pu(Object)||!Pu((function(){e=!0}))||e}))?Lu:Pu,Mu=lu,Uu=ku,xu=Wo,Vu=ea("species"),Fu=Array,Bu=function(e){var t;return Mu(e)&&(t=e.constructor,(Uu(t)&&(t===Fu||Mu(t.prototype))||xu(t)&&null===(t=t[Vu]))&&(t=void 0)),void 0===t?Fu:t},ju=function(e,t){return new(Bu(e))(0===t?0:t)},Gu=Hn,Wu=is,Hu=ea("species"),Ku=function(e){return Wu>=51||!Gu((function(){var t=[];return(t.constructor={})[Hu]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Yu=mc,zu=Hn,Xu=lu,Zu=Wo,Ju=xs,Qu=wc,qu=function(e){if(e>9007199254740991)throw hu("Maximum allowed index exceeded");return e},$u=mu,el=ju,tl=Ku,rl=is,il=ea("isConcatSpreadable"),nl=rl>=51||!zu((function(){var e=[];return e[il]=!1,e.concat()[0]!==e})),ol=function(e){if(!Zu(e))return!1;var t=e[il];return void 0!==t?!!t:Xu(e)};Yu({target:"Array",proto:!0,arity:1,forced:!nl||!tl("concat")},{concat:function(e){var t,r,i,n,o,s=Ju(this),a=el(s,0),c=0;for(t=-1,i=arguments.length;t<i;t++)if(ol(o=-1===t?s:arguments[t]))for(n=Qu(o),qu(c+n),r=0;r<n;r++,c++)r in o&&$u(a,c,o[r]);else qu(c+1),$u(a,c++,o);return a.length=c,a}});var sl={},al={},cl=Bs,dl=Bo,ul=kc.indexOf,ll=al,hl=Jn([].push),pl=function(e,t){var r,i=dl(e),n=0,o=[];for(r in i)!cl(ll,r)&&cl(i,r)&&hl(o,r);for(;t.length>n;)cl(i,r=t[n++])&&(~ul(o,r)||hl(o,r));return o},fl=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],El=pl,ml=fl,_l=Object.keys||function(e){return El(e,ml)},Tl=To,gl=Ba,Sl=Fa,Rl=Ha,yl=Bo,vl=_l;sl.f=Tl&&!gl?Object.defineProperties:function(e,t){Rl(e);for(var r,i=yl(t),n=vl(t),o=n.length,s=0;o>s;)Sl.f(e,r=n[s++],i[r]);return e};var Al,bl=Zo("document","documentElement"),Il=Ks,Ol=ks("keys"),Cl=function(e){return Ol[e]||(Ol[e]=Il(e))},wl=Ha,Nl=sl,Dl=fl,Pl=al,Ll=bl,kl=fa,Ml="prototype",Ul="script",xl=Cl("IE_PROTO"),Vl=function(){},Fl=function(e){return"<"+Ul+">"+e+"</"+Ul+">"},Bl=function(e){e.write(Fl("")),e.close();var t=e.parentWindow.Object;return e=null,t},jl=function(){try{Al=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;jl="undefined"!=typeof document?document.domain&&Al?Bl(Al):(t=kl("iframe"),r="java"+Ul+":",t.style.display="none",Ll.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(Fl("document.F=Object")),e.close(),e.F):Bl(Al);for(var i=Dl.length;i--;)delete jl[Ml][Dl[i]];return jl()};Pl[xl]=!0;var Gl=Object.create||function(e,t){var r;return null!==e?(Vl[Ml]=wl(e),r=new Vl,Vl[Ml]=null,r[xl]=e):r=jl(),void 0===t?r:Nl.f(r,t)},Wl={},Hl=pl,Kl=fl.concat("length","prototype");Wl.f=Object.getOwnPropertyNames||function(e){return Hl(e,Kl)};var Yl={},zl=bc,Xl=wc,Zl=mu,Jl=Array,Ql=Math.max,ql=function(e,t,r){for(var i=Xl(e),n=zl(t,i),o=zl(void 0===r?i:r,i),s=Jl(Ql(o-n,0)),a=0;n<o;n++,a++)Zl(s,a,e[n]);return s.length=a,s},$l=co,eh=Bo,th=Wl.f,rh=ql,ih="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Yl.f=function(e){return ih&&"Window"==$l(e)?function(e){try{return th(e)}catch(e){return rh(ih)}}(e):th(eh(e))};var nh={};nh.f=Object.getOwnPropertySymbols;var oh=nc,sh=function(e,t,r,i){return i&&i.enumerable?e[t]=r:oh(e,t,r),e},ah=Fa,ch=function(e,t,r){return ah.f(e,t,r)},dh={},uh=ea;dh.f=uh;var lh,hh,ph,fh=Ho,Eh=Bs,mh=dh,_h=Fa.f,Th=function(e){var t=fh.Symbol||(fh.Symbol={});Eh(t,e)||_h(t,e,{value:mh.f(e)})},gh=Ro,Sh=Zo,Rh=ea,yh=sh,vh=function(){var e=Sh("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,i=Rh("toPrimitive");t&&!t[i]&&yh(t,i,(function(e){return gh(r,this)}),{arity:1})},Ah=qc,bh=Kc?{}.toString:function(){return"[object "+Ah(this)+"]"},Ih=Kc,Oh=Fa.f,Ch=nc,wh=Bs,Nh=bh,Dh=ea("toStringTag"),Ph=function(e,t,r,i){if(e){var n=r?e:e.prototype;wh(n,Dh)||Oh(n,Dh,{configurable:!0,value:t}),i&&!Ih&&Ch(n,"toString",Nh)}},Lh=mo,kh=$n.WeakMap,Mh=Lh(kh)&&/native code/.test(String(kh)),Uh=$n,xh=Wo,Vh=nc,Fh=Bs,Bh=Ps,jh=Cl,Gh=al,Wh="Object already initialized",Hh=Uh.TypeError,Kh=Uh.WeakMap;if(Mh||Bh.state){var Yh=Bh.state||(Bh.state=new Kh);Yh.get=Yh.get,Yh.has=Yh.has,Yh.set=Yh.set,lh=function(e,t){if(Yh.has(e))throw Hh(Wh);return t.facade=e,Yh.set(e,t),t},hh=function(e){return Yh.get(e)||{}},ph=function(e){return Yh.has(e)}}else{var zh=jh("state");Gh[zh]=!0,lh=function(e,t){if(Fh(e,zh))throw Hh(Wh);return t.facade=e,Vh(e,zh,t),t},hh=function(e){return Fh(e,zh)?e[zh]:{}},ph=function(e){return Fh(e,zh)}}var Xh={set:lh,get:hh,has:ph,enforce:function(e){return ph(e)?hh(e):lh(e,{})},getterFor:function(e){return function(t){var r;if(!xh(t)||(r=hh(t)).type!==e)throw Hh("Incompatible receiver, "+e+" required");return r}}},Zh=Va,Jh=Lo,Qh=xs,qh=wc,$h=ju,ep=Jn([].push),tp=function(e){var t=1==e,r=2==e,i=3==e,n=4==e,o=6==e,s=7==e,a=5==e||o;return function(c,d,u,l){for(var h,p,f=Qh(c),E=Jh(f),m=Zh(d,u),_=qh(E),T=0,g=l||$h,S=t?g(c,_):r||s?g(c,0):void 0;_>T;T++)if((a||T in E)&&(p=m(h=E[T],T,f),e))if(t)S[T]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return T;case 2:ep(S,h)}else switch(e){case 4:return!1;case 7:ep(S,h)}return o?-1:i||n?n:S}},rp={forEach:tp(0),map:tp(1),filter:tp(2),some:tp(3),every:tp(4),find:tp(5),findIndex:tp(6),filterReject:tp(7)},ip=mc,np=$n,op=Ro,sp=Jn,ap=To,cp=as,dp=Hn,up=Bs,lp=Qn,hp=Ha,pp=Bo,fp=ua,Ep=td,mp=Co,_p=Gl,Tp=_l,gp=Wl,Sp=Yl,Rp=nh,yp=_o,vp=Fa,Ap=sl,bp=yo,Ip=sh,Op=ch,Cp=ks,wp=al,Np=Ks,Dp=ea,Pp=dh,Lp=Th,kp=vh,Mp=Ph,Up=Xh,xp=rp.forEach,Vp=Cl("hidden"),Fp="Symbol",Bp="prototype",jp=Up.set,Gp=Up.getterFor(Fp),Wp=Object[Bp],Hp=np.Symbol,Kp=Hp&&Hp[Bp],Yp=np.TypeError,zp=np.QObject,Xp=yp.f,Zp=vp.f,Jp=Sp.f,Qp=bp.f,qp=sp([].push),$p=Cp("symbols"),ef=Cp("op-symbols"),tf=Cp("wks"),rf=!zp||!zp[Bp]||!zp[Bp].findChild,nf=ap&&dp((function(){return 7!=_p(Zp({},"a",{get:function(){return Zp(this,"a",{value:7}).a}})).a}))?function(e,t,r){var i=Xp(Wp,t);i&&delete Wp[t],Zp(e,t,r),i&&e!==Wp&&Zp(Wp,t,i)}:Zp,of=function(e,t){var r=$p[e]=_p(Kp);return jp(r,{type:Fp,tag:e,description:t}),ap||(r.description=t),r},sf=function(e,t,r){e===Wp&&sf(ef,t,r),hp(e);var i=fp(t);return hp(r),up($p,i)?(r.enumerable?(up(e,Vp)&&e[Vp][i]&&(e[Vp][i]=!1),r=_p(r,{enumerable:mp(0,!1)})):(up(e,Vp)||Zp(e,Vp,mp(1,{})),e[Vp][i]=!0),nf(e,i,r)):Zp(e,i,r)},af=function(e,t){hp(e);var r=pp(t),i=Tp(r).concat(lf(r));return xp(i,(function(t){ap&&!op(cf,r,t)||sf(e,t,r[t])})),e},cf=function(e){var t=fp(e),r=op(Qp,this,t);return!(this===Wp&&up($p,t)&&!up(ef,t))&&(!(r||!up(this,t)||!up($p,t)||up(this,Vp)&&this[Vp][t])||r)},df=function(e,t){var r=pp(e),i=fp(t);if(r!==Wp||!up($p,i)||up(ef,i)){var n=Xp(r,i);return!n||!up($p,i)||up(r,Vp)&&r[Vp][i]||(n.enumerable=!0),n}},uf=function(e){var t=Jp(pp(e)),r=[];return xp(t,(function(e){up($p,e)||up(wp,e)||qp(r,e)})),r},lf=function(e){var t=e===Wp,r=Jp(t?ef:pp(e)),i=[];return xp(r,(function(e){!up($p,e)||t&&!up(Wp,e)||qp(i,$p[e])})),i};cp||(Hp=function(){if(lp(Kp,this))throw Yp("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Ep(arguments[0]):void 0,t=Np(e),r=function(e){this===Wp&&op(r,ef,e),up(this,Vp)&&up(this[Vp],t)&&(this[Vp][t]=!1),nf(this,t,mp(1,e))};return ap&&rf&&nf(Wp,t,{configurable:!0,set:r}),of(t,e)},Ip(Kp=Hp[Bp],"toString",(function(){return Gp(this).tag})),Ip(Hp,"withoutSetter",(function(e){return of(Np(e),e)})),bp.f=cf,vp.f=sf,Ap.f=af,yp.f=df,gp.f=Sp.f=uf,Rp.f=lf,Pp.f=function(e){return of(Dp(e),e)},ap&&Op(Kp,"description",{configurable:!0,get:function(){return Gp(this).description}})),ip({global:!0,constructor:!0,wrap:!0,forced:!cp,sham:!cp},{Symbol:Hp}),xp(Tp(tf),(function(e){Lp(e)})),ip({target:Fp,stat:!0,forced:!cp},{useSetter:function(){rf=!0},useSimple:function(){rf=!1}}),ip({target:"Object",stat:!0,forced:!cp,sham:!ap},{create:function(e,t){return void 0===t?_p(e):af(_p(e),t)},defineProperty:sf,defineProperties:af,getOwnPropertyDescriptor:df}),ip({target:"Object",stat:!0,forced:!cp},{getOwnPropertyNames:uf}),kp(),Mp(Hp,Fp),wp[Vp]=!0;var hf=as&&!!Symbol.for&&!!Symbol.keyFor,pf=mc,ff=Zo,Ef=Bs,mf=td,_f=ks,Tf=hf,gf=_f("string-to-symbol-registry"),Sf=_f("symbol-to-string-registry");pf({target:"Symbol",stat:!0,forced:!Tf},{for:function(e){var t=mf(e);if(Ef(gf,t))return gf[t];var r=ff("Symbol")(t);return gf[t]=r,Sf[r]=t,r}});var Rf=mc,yf=Bs,vf=ps,Af=Es,bf=hf,If=ks("symbol-to-string-registry");Rf({target:"Symbol",stat:!0,forced:!bf},{keyFor:function(e){if(!vf(e))throw TypeError(Af(e)+" is not a symbol");if(yf(If,e))return If[e]}});var Of=Jn([].slice),Cf=lu,wf=mo,Nf=co,Df=td,Pf=Jn([].push),Lf=mc,kf=Zo,Mf=no,Uf=Ro,xf=Jn,Vf=Hn,Ff=mo,Bf=ps,jf=Of,Gf=function(e){if(wf(e))return e;if(Cf(e)){for(var t=e.length,r=[],i=0;i<t;i++){var n=e[i];"string"==typeof n?Pf(r,n):"number"!=typeof n&&"Number"!=Nf(n)&&"String"!=Nf(n)||Pf(r,Df(n))}var o=r.length,s=!0;return function(e,t){if(s)return s=!1,t;if(Cf(this))return t;for(var i=0;i<o;i++)if(r[i]===e)return t}}},Wf=as,Hf=String,Kf=kf("JSON","stringify"),Yf=xf(/./.exec),zf=xf("".charAt),Xf=xf("".charCodeAt),Zf=xf("".replace),Jf=xf(1..toString),Qf=/[\uD800-\uDFFF]/g,qf=/^[\uD800-\uDBFF]$/,$f=/^[\uDC00-\uDFFF]$/,eE=!Wf||Vf((function(){var e=kf("Symbol")();return"[null]"!=Kf([e])||"{}"!=Kf({a:e})||"{}"!=Kf(Object(e))})),tE=Vf((function(){return'"\\udf06\\ud834"'!==Kf("\udf06\ud834")||'"\\udead"'!==Kf("\udead")})),rE=function(e,t){var r=jf(arguments),i=Gf(t);if(Ff(i)||void 0!==e&&!Bf(e))return r[1]=function(e,t){if(Ff(i)&&(t=Uf(i,this,Hf(e),t)),!Bf(t))return t},Mf(Kf,null,r)},iE=function(e,t,r){var i=zf(r,t-1),n=zf(r,t+1);return Yf(qf,e)&&!Yf($f,n)||Yf($f,e)&&!Yf(qf,i)?"\\u"+Jf(Xf(e,0),16):e};Kf&&Lf({target:"JSON",stat:!0,arity:3,forced:eE||tE},{stringify:function(e,t,r){var i=jf(arguments),n=Mf(eE?rE:Kf,null,i);return tE&&"string"==typeof n?Zf(n,Qf,iE):n}});var nE=nh,oE=xs;mc({target:"Object",stat:!0,forced:!as||Hn((function(){nE.f(1)}))},{getOwnPropertySymbols:function(e){var t=nE.f;return t?t(oE(e)):[]}}),Th("asyncIterator"),Th("hasInstance"),Th("isConcatSpreadable"),Th("iterator"),Th("match"),Th("matchAll"),Th("replace"),Th("search"),Th("species"),Th("split");var sE=vh;Th("toPrimitive"),sE();var aE=Zo,cE=Ph;Th("toStringTag"),cE(aE("Symbol"),"Symbol"),Th("unscopables"),Ph($n.JSON,"JSON",!0);var dE,uE,lE,hE=Ho.Symbol,pE={},fE=To,EE=Bs,mE=Function.prototype,_E=fE&&Object.getOwnPropertyDescriptor,TE=EE(mE,"name"),gE={EXISTS:TE,PROPER:TE&&"something"===function(){}.name,CONFIGURABLE:TE&&(!fE||fE&&_E(mE,"name").configurable)},SE=!Hn((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),RE=Bs,yE=mo,vE=xs,AE=SE,bE=Cl("IE_PROTO"),IE=Object,OE=IE.prototype,CE=AE?IE.getPrototypeOf:function(e){var t=vE(e);if(RE(t,bE))return t[bE];var r=t.constructor;return yE(r)&&t instanceof r?r.prototype:t instanceof IE?OE:null},wE=Hn,NE=mo,DE=Wo,PE=Gl,LE=CE,kE=sh,ME=ea("iterator"),UE=!1;[].keys&&("next"in(lE=[].keys())?(uE=LE(LE(lE)))!==Object.prototype&&(dE=uE):UE=!0);var xE=!DE(dE)||wE((function(){var e={};return dE[ME].call(e)!==e}));NE((dE=xE?{}:PE(dE))[ME])||kE(dE,ME,(function(){return this}));var VE={IteratorPrototype:dE,BUGGY_SAFARI_ITERATORS:UE},FE=VE.IteratorPrototype,BE=Gl,jE=Co,GE=Ph,WE=pE,HE=function(){return this},KE=function(e,t,r,i){var n=t+" Iterator";return e.prototype=BE(FE,{next:jE(+!i,r)}),GE(e,n,!1,!0),WE[n]=HE,e},YE=Jn,zE=gs,XE=mo,ZE=String,JE=TypeError,QE=function(e,t,r){try{return YE(zE(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},qE=Ha,$E=function(e){if("object"==typeof e||XE(e))return e;throw JE("Can't set "+ZE(e)+" as a prototype")},em=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=QE(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return qE(r),$E(i),t?e(r,i):r.__proto__=i,r}}():void 0),tm=mc,rm=Ro,im=gE,nm=KE,om=CE,sm=Ph,am=sh,cm=pE,dm=VE,um=im.PROPER,lm=dm.BUGGY_SAFARI_ITERATORS,hm=ea("iterator"),pm="keys",fm="values",Em="entries",mm=function(){return this},_m=function(e,t,r,i,n,o,s){nm(r,t,i);var a,c,d,u=function(e){if(e===n&&E)return E;if(!lm&&e in p)return p[e];switch(e){case pm:case fm:case Em:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[hm]||p["@@iterator"]||n&&p[n],E=!lm&&f||u(n),m="Array"==t&&p.entries||f;if(m&&(a=om(m.call(new e)))!==Object.prototype&&a.next&&(sm(a,l,!0,!0),cm[l]=mm),um&&n==fm&&f&&f.name!==fm&&(h=!0,E=function(){return rm(f,this)}),n)if(c={values:u(fm),keys:o?E:u(pm),entries:u(Em)},s)for(d in c)(lm||h||!(d in p))&&am(p,d,c[d]);else tm({target:t,proto:!0,forced:lm||h},c);return s&&p[hm]!==E&&am(p,hm,E,{name:n}),cm[t]=E,c},Tm=function(e,t){return{value:e,done:t}},gm=Bo,Sm=pE,Rm=Xh;Fa.f;var ym=_m,vm=Tm,Am="Array Iterator",bm=Rm.set,Im=Rm.getterFor(Am);ym(Array,"Array",(function(e,t){bm(this,{type:Am,target:gm(e),index:0,kind:t})}),(function(){var e=Im(this),t=e.target,r=e.kind,i=e.index++;return!t||i>=t.length?(e.target=void 0,vm(void 0,!0)):vm("keys"==r?i:"values"==r?t[i]:[i,t[i]],!1)}),"values"),Sm.Arguments=Sm.Array;var Om={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},Cm=$n,wm=qc,Nm=nc,Dm=pE,Pm=ea("toStringTag");for(var Lm in Om){var km=Cm[Lm],Mm=km&&km.prototype;Mm&&wm(Mm)!==Pm&&Nm(Mm,Pm,Lm),Dm[Lm]=Dm.Array}var Um=hE,xm=ea,Vm=Fa.f,Fm=xm("metadata"),Bm=Function.prototype;void 0===Bm[Fm]&&Vm(Bm,Fm,{value:null}),Th("dispose"),Th("metadata");var jm=Um;Th("asyncDispose");var Gm=Jn,Wm=Zo("Symbol"),Hm=Wm.keyFor,Km=Gm(Wm.prototype.valueOf),Ym=Wm.isRegisteredSymbol||function(e){try{return void 0!==Hm(Km(e))}catch(e){return!1}};mc({target:"Symbol",stat:!0},{isRegisteredSymbol:Ym});for(var zm=ks,Xm=Zo,Zm=Jn,Jm=ps,Qm=ea,qm=Xm("Symbol"),$m=qm.isWellKnownSymbol,e_=Xm("Object","getOwnPropertyNames"),t_=Zm(qm.prototype.valueOf),r_=zm("wks"),i_=0,n_=e_(qm),o_=n_.length;i_<o_;i_++)try{var s_=n_[i_];Jm(qm[s_])&&Qm(s_)}catch(e){}var a_=function(e){if($m&&$m(e))return!0;try{for(var t=t_(e),r=0,i=e_(r_),n=i.length;r<n;r++)if(r_[i[r]]==t)return!0}catch(e){}return!1};mc({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:a_}),Th("matcher"),Th("observable"),mc({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:Ym}),mc({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:a_}),Th("metadataKey"),Th("patternMatch"),Th("replaceAll");var c_=Z(jm),d_=Jn,u_=Rc,l_=td,h_=xo,p_=d_("".charAt),f_=d_("".charCodeAt),E_=d_("".slice),m_=function(e){return function(t,r){var i,n,o=l_(h_(t)),s=u_(r),a=o.length;return s<0||s>=a?e?"":void 0:(i=f_(o,s))<55296||i>56319||s+1===a||(n=f_(o,s+1))<56320||n>57343?e?p_(o,s):i:e?E_(o,s,s+2):n-56320+(i-55296<<10)+65536}},__={codeAt:m_(!1),charAt:m_(!0)},T_=__.charAt,g_=td,S_=Xh,R_=_m,y_=Tm,v_="String Iterator",A_=S_.set,b_=S_.getterFor(v_);R_(String,"String",(function(e){A_(this,{type:v_,string:g_(e),index:0})}),(function(){var e,t=b_(this),r=t.string,i=t.index;return i>=r.length?y_(void 0,!0):(e=T_(r,i),t.index+=e.length,y_(e,!1))}));var I_=Z(dh.f("iterator"));function O_(e){return O_="function"==typeof c_&&"symbol"==typeof I_?function(e){return typeof e}:function(e){return e&&"function"==typeof c_&&e.constructor===c_&&e!==c_.prototype?"symbol":typeof e},O_(e)}var C_=Z(dh.f("toPrimitive"));function w_(e){var t=function(e,t){if("object"!==O_(e)||null===e)return e;var r=e[C_];if(void 0!==r){var i=r.call(e,t||"default");if("object"!==O_(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===O_(t)?t:String(t)}function N_(e,t,r){return(t=w_(t))in e?du(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var D_=Hn,P_=function(e,t){var r=[][e];return!!r&&D_((function(){r.call(null,t||function(){return 1},1)}))},L_=rp.forEach,k_=P_("forEach")?[].forEach:function(e){return L_(this,e,arguments.length>1?arguments[1]:void 0)};mc({target:"Array",proto:!0,forced:[].forEach!=k_},{forEach:k_});var M_=xc("Array").forEach,U_=qc,x_=Bs,V_=Qn,F_=M_,B_=Array.prototype,j_={DOMTokenList:!0,NodeList:!0},G_=Z((function(e){var t=e.forEach;return e===B_||V_(B_,e)&&t===B_.forEach||x_(j_,U_(e))?F_:t})),W_=xs,H_=_l;mc({target:"Object",stat:!0,forced:Hn((function(){H_(1)}))},{keys:function(e){return H_(W_(e))}});var K_=Z(Ho.Object.keys),Y_=gs,z_=xs,X_=Lo,Z_=wc,J_=TypeError,Q_=function(e){return function(t,r,i,n){Y_(r);var o=z_(t),s=X_(o),a=Z_(o),c=e?a-1:0,d=e?-1:1;if(i<2)for(;;){if(c in s){n=s[c],c+=d;break}if(c+=d,e?c<0:a<=c)throw J_("Reduce of empty array with no initial value")}for(;e?c>=0:a>c;c+=d)c in s&&(n=r(n,s[c],c,o));return n}},q_={left:Q_(!1),right:Q_(!0)},$_="undefined"!=typeof process&&"process"==co(process),eT=q_.left;mc({target:"Array",proto:!0,forced:!$_&&is>79&&is<83||!P_("reduce")},{reduce:function(e){var t=arguments.length;return eT(this,e,t,t>1?arguments[1]:void 0)}});var tT=xc("Array").reduce,rT=Qn,iT=tT,nT=Array.prototype,oT=function(e){var t=e.reduce;return e===nT||rT(nT,e)&&t===nT.reduce?iT:t},sT=Z(oT),aT=mc,cT=lu,dT=Jn([].reverse),uT=[1,2];aT({target:"Array",proto:!0,forced:String(uT)===String(uT.reverse())},{reverse:function(){return cT(this)&&(this.length=this.length),dT(this)}});var lT=xc("Array").reverse,hT=Qn,pT=lT,fT=Array.prototype,ET=function(e){var t=e.reverse;return e===fT||hT(fT,e)&&t===fT.reverse?pT:t},mT=Z(ET),_T=mc,TT=lu,gT=ku,ST=Wo,RT=bc,yT=wc,vT=Bo,AT=mu,bT=ea,IT=Of,OT=Ku("slice"),CT=bT("species"),wT=Array,NT=Math.max;_T({target:"Array",proto:!0,forced:!OT},{slice:function(e,t){var r,i,n,o=vT(this),s=yT(o),a=RT(e,s),c=RT(void 0===t?s:t,s);if(TT(o)&&(r=o.constructor,(gT(r)&&(r===wT||TT(r.prototype))||ST(r)&&null===(r=r[CT]))&&(r=void 0),r===wT||void 0===r))return IT(o,a,c);for(i=new(void 0===r?wT:r)(NT(c-a,0)),n=0;a<c;a++,n++)a in o&&AT(i,n,o[a]);return i.length=n,i}});var DT=xc("Array").slice,PT=Qn,LT=DT,kT=Array.prototype,MT=Z((function(e){var t=e.slice;return e===kT||PT(kT,e)&&t===kT.slice?LT:t}));function UT(e,t,r,i,n){var o,s,a,c={};return G_(o=K_(i)).call(o,(function(e){c[e]=i[e]})),c.enumerable=!!c.enumerable,c.configurable=!!c.configurable,("value"in c||c.initializer)&&(c.writable=!0),c=sT(s=mT(a=MT(r).call(r)).call(a)).call(s,(function(r,i){return i(e,t,r)||r}),c),n&&void 0!==c.initializer&&(c.value=c.initializer?c.initializer.call(n):void 0,c.initializer=void 0),void 0===c.initializer&&(du(e,t,c),c=null),c}var xT=Zo,VT=Wl,FT=nh,BT=Ha,jT=Jn([].concat),GT=xT("Reflect","ownKeys")||function(e){var t=VT.f(BT(e)),r=FT.f;return r?jT(t,r(e)):t},WT=Bs,HT=GT,KT=_o,YT=Fa,zT=Wo,XT=nc,ZT=Error,JT=Jn("".replace),QT=String(ZT("zxcasd").stack),qT=/\n\s*at [^:]*:[^\n]*/,$T=qT.test(QT),eg=Co,tg=!Hn((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",eg(1,7)),7!==e.stack)})),rg=nc,ig=function(e,t){if($T&&"string"==typeof e&&!ZT.prepareStackTrace)for(;t--;)e=JT(e,qT,"");return e},ng=tg,og=Error.captureStackTrace,sg=pE,ag=ea("iterator"),cg=Array.prototype,dg=function(e){return void 0!==e&&(sg.Array===e||cg[ag]===e)},ug=qc,lg=ys,hg=ko,pg=pE,fg=ea("iterator"),Eg=function(e){if(!hg(e))return lg(e,fg)||lg(e,"@@iterator")||pg[ug(e)]},mg=Ro,_g=gs,Tg=Ha,gg=Es,Sg=Eg,Rg=TypeError,yg=function(e,t){var r=arguments.length<2?Sg(e):t;if(_g(r))return Tg(mg(r,e));throw Rg(gg(e)+" is not iterable")},vg=Ro,Ag=Ha,bg=ys,Ig=function(e,t,r){var i,n;Ag(e);try{if(!(i=bg(e,"return"))){if("throw"===t)throw r;return r}i=vg(i,e)}catch(e){n=!0,i=e}if("throw"===t)throw r;if(n)throw i;return Ag(i),r},Og=Va,Cg=Ro,wg=Ha,Ng=Es,Dg=dg,Pg=wc,Lg=Qn,kg=yg,Mg=Eg,Ug=Ig,xg=TypeError,Vg=function(e,t){this.stopped=e,this.result=t},Fg=Vg.prototype,Bg=function(e,t,r){var i,n,o,s,a,c,d,u=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),E=Og(t,u),m=function(e){return i&&Ug(i,"normal",e),new Vg(!0,e)},_=function(e){return l?(wg(e),f?E(e[0],e[1],m):E(e[0],e[1])):f?E(e,m):E(e)};if(h)i=e.iterator;else if(p)i=e;else{if(!(n=Mg(e)))throw xg(Ng(e)+" is not iterable");if(Dg(n)){for(o=0,s=Pg(e);s>o;o++)if((a=_(e[o]))&&Lg(Fg,a))return a;return new Vg(!1)}i=kg(e,n)}for(c=h?e.next:i.next;!(d=Cg(c,i)).done;){try{a=_(d.value)}catch(e){Ug(i,"throw",e)}if("object"==typeof a&&a&&Lg(Fg,a))return a}return new Vg(!1)},jg=td,Gg=mc,Wg=Qn,Hg=CE,Kg=em,Yg=function(e,t,r){for(var i=HT(t),n=YT.f,o=KT.f,s=0;s<i.length;s++){var a=i[s];WT(e,a)||r&&WT(r,a)||n(e,a,o(t,a))}},zg=Gl,Xg=nc,Zg=Co,Jg=function(e,t){zT(t)&&"cause"in t&&XT(e,"cause",t.cause)},Qg=function(e,t,r,i){ng&&(og?og(e,t):rg(e,"stack",ig(r,i)))},qg=Bg,$g=function(e,t){return void 0===e?arguments.length<2?"":t:jg(e)},eS=ea("toStringTag"),tS=Error,rS=[].push,iS=function(e,t){var r,i=Wg(nS,this);Kg?r=Kg(tS(),i?Hg(this):nS):(r=i?this:zg(nS),Xg(r,eS,"Error")),void 0!==t&&Xg(r,"message",$g(t)),Qg(r,iS,r.stack,1),arguments.length>2&&Jg(r,arguments[2]);var n=[];return qg(e,rS,{that:n}),Xg(r,"errors",n),r};Kg?Kg(iS,tS):Yg(iS,tS,{name:!0});var nS=iS.prototype=zg(tS.prototype,{constructor:Zg(1,iS),message:Zg(1,""),name:Zg(1,"AggregateError")});Gg({global:!0,constructor:!0,arity:2},{AggregateError:iS});var oS,sS,aS,cS,dS=Zo,uS=ch,lS=To,hS=ea("species"),pS=Qn,fS=TypeError,ES=function(e,t){if(pS(t,e))return e;throw fS("Incorrect invocation")},mS=ku,_S=Es,TS=TypeError,gS=Ha,SS=function(e){if(mS(e))return e;throw TS(_S(e)+" is not a constructor")},RS=ko,yS=ea("species"),vS=function(e,t){var r,i=gS(e).constructor;return void 0===i||RS(r=gS(i)[yS])?t:SS(r)},AS=TypeError,bS=function(e,t){if(e<t)throw AS("Not enough arguments");return e},IS=/(?:ipad|iphone|ipod).*applewebkit/i.test(Jo),OS=$n,CS=no,wS=Va,NS=mo,DS=Bs,PS=Hn,LS=bl,kS=Of,MS=fa,US=bS,xS=IS,VS=$_,FS=OS.setImmediate,BS=OS.clearImmediate,jS=OS.process,GS=OS.Dispatch,WS=OS.Function,HS=OS.MessageChannel,KS=OS.String,YS=0,zS={},XS="onreadystatechange";PS((function(){oS=OS.location}));var ZS=function(e){if(DS(zS,e)){var t=zS[e];delete zS[e],t()}},JS=function(e){return function(){ZS(e)}},QS=function(e){ZS(e.data)},qS=function(e){OS.postMessage(KS(e),oS.protocol+"//"+oS.host)};FS&&BS||(FS=function(e){US(arguments.length,1);var t=NS(e)?e:WS(e),r=kS(arguments,1);return zS[++YS]=function(){CS(t,void 0,r)},sS(YS),YS},BS=function(e){delete zS[e]},VS?sS=function(e){jS.nextTick(JS(e))}:GS&&GS.now?sS=function(e){GS.now(JS(e))}:HS&&!xS?(cS=(aS=new HS).port2,aS.port1.onmessage=QS,sS=wS(cS.postMessage,cS)):OS.addEventListener&&NS(OS.postMessage)&&!OS.importScripts&&oS&&"file:"!==oS.protocol&&!PS(qS)?(sS=qS,OS.addEventListener("message",QS,!1)):sS=XS in MS("script")?function(e){LS.appendChild(MS("script"))[XS]=function(){LS.removeChild(this),ZS(e)}}:function(e){setTimeout(JS(e),0)});var $S={set:FS,clear:BS},eR=function(){this.head=null,this.tail=null};eR.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}};var tR,rR,iR,nR,oR,sR=eR,aR=/ipad|iphone|ipod/i.test(Jo)&&"undefined"!=typeof Pebble,cR=/web0s(?!.*chrome)/i.test(Jo),dR=$n,uR=Va,lR=_o.f,hR=$S.set,pR=sR,fR=IS,ER=aR,mR=cR,_R=$_,TR=dR.MutationObserver||dR.WebKitMutationObserver,gR=dR.document,SR=dR.process,RR=dR.Promise,yR=lR(dR,"queueMicrotask"),vR=yR&&yR.value;if(!vR){var AR=new pR,bR=function(){var e,t;for(_R&&(e=SR.domain)&&e.exit();t=AR.get();)try{t()}catch(e){throw AR.head&&tR(),e}e&&e.enter()};fR||_R||mR||!TR||!gR?!ER&&RR&&RR.resolve?((nR=RR.resolve(void 0)).constructor=RR,oR=uR(nR.then,nR),tR=function(){oR(bR)}):_R?tR=function(){SR.nextTick(bR)}:(hR=uR(hR,dR),tR=function(){hR(bR)}):(rR=!0,iR=gR.createTextNode(""),new TR(bR).observe(iR,{characterData:!0}),tR=function(){iR.data=rR=!rR}),vR=function(e){AR.head||tR(),AR.add(e)}}var IR=vR,OR=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},CR=$n.Promise,wR="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,NR=!wR&&!$_&&"object"==typeof window&&"object"==typeof document,DR=$n,PR=CR,LR=mo,kR=ka,MR=Su,UR=ea,xR=NR,VR=wR,FR=is,BR=PR&&PR.prototype,jR=UR("species"),GR=!1,WR=LR(DR.PromiseRejectionEvent),HR=kR("Promise",(function(){var e=MR(PR),t=e!==String(PR);if(!t&&66===FR)return!0;if(!BR.catch||!BR.finally)return!0;if(!FR||FR<51||!/native code/.test(e)){var r=new PR((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};if((r.constructor={})[jR]=i,!(GR=r.then((function(){}))instanceof i))return!0}return!t&&(xR||VR)&&!WR})),KR={CONSTRUCTOR:HR,REJECTION_EVENT:WR,SUBCLASSING:GR},YR={},zR=gs,XR=TypeError,ZR=function(e){var t,r;this.promise=new e((function(e,i){if(void 0!==t||void 0!==r)throw XR("Bad Promise constructor");t=e,r=i})),this.resolve=zR(t),this.reject=zR(r)};YR.f=function(e){return new ZR(e)};var JR,QR,qR=mc,$R=$_,ey=$n,ty=Ro,ry=sh,iy=Ph,ny=function(e){var t=dS(e);lS&&t&&!t[hS]&&uS(t,hS,{configurable:!0,get:function(){return this}})},oy=gs,sy=mo,ay=Wo,cy=ES,dy=vS,uy=$S.set,ly=IR,hy=function(e,t){try{1==arguments.length?console.error(e):console.error(e,t)}catch(e){}},py=OR,fy=sR,Ey=Xh,my=CR,_y=KR,Ty=YR,gy="Promise",Sy=_y.CONSTRUCTOR,Ry=_y.REJECTION_EVENT,yy=Ey.getterFor(gy),vy=Ey.set,Ay=my&&my.prototype,by=my,Iy=Ay,Oy=ey.TypeError,Cy=ey.document,wy=ey.process,Ny=Ty.f,Dy=Ny,Py=!!(Cy&&Cy.createEvent&&ey.dispatchEvent),Ly="unhandledrejection",ky=function(e){var t;return!(!ay(e)||!sy(t=e.then))&&t},My=function(e,t){var r,i,n,o=t.value,s=1==t.state,a=s?e.ok:e.fail,c=e.resolve,d=e.reject,u=e.domain;try{a?(s||(2===t.rejection&&By(t),t.rejection=1),!0===a?r=o:(u&&u.enter(),r=a(o),u&&(u.exit(),n=!0)),r===e.promise?d(Oy("Promise-chain cycle")):(i=ky(r))?ty(i,r,c,d):c(r)):d(o)}catch(e){u&&!n&&u.exit(),d(e)}},Uy=function(e,t){e.notified||(e.notified=!0,ly((function(){for(var r,i=e.reactions;r=i.get();)My(r,e);e.notified=!1,t&&!e.rejection&&Vy(e)})))},xy=function(e,t,r){var i,n;Py?((i=Cy.createEvent("Event")).promise=t,i.reason=r,i.initEvent(e,!1,!0),ey.dispatchEvent(i)):i={promise:t,reason:r},!Ry&&(n=ey["on"+e])?n(i):e===Ly&&hy("Unhandled promise rejection",r)},Vy=function(e){ty(uy,ey,(function(){var t,r=e.facade,i=e.value;if(Fy(e)&&(t=py((function(){$R?wy.emit("unhandledRejection",i,r):xy(Ly,r,i)})),e.rejection=$R||Fy(e)?2:1,t.error))throw t.value}))},Fy=function(e){return 1!==e.rejection&&!e.parent},By=function(e){ty(uy,ey,(function(){var t=e.facade;$R?wy.emit("rejectionHandled",t):xy("rejectionhandled",t,e.value)}))},jy=function(e,t,r){return function(i){e(t,i,r)}},Gy=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,Uy(e,!0))},Wy=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw Oy("Promise can't be resolved itself");var i=ky(t);i?ly((function(){var r={done:!1};try{ty(i,t,jy(Wy,r,e),jy(Gy,r,e))}catch(t){Gy(r,t,e)}})):(e.value=t,e.state=1,Uy(e,!1))}catch(t){Gy({done:!1},t,e)}}};Sy&&(Iy=(by=function(e){cy(this,Iy),oy(e),ty(JR,this);var t=yy(this);try{e(jy(Wy,t),jy(Gy,t))}catch(e){Gy(t,e)}}).prototype,(JR=function(e){vy(this,{type:gy,done:!1,notified:!1,parent:!1,reactions:new fy,rejection:!1,state:0,value:void 0})}).prototype=ry(Iy,"then",(function(e,t){var r=yy(this),i=Ny(dy(this,by));return r.parent=!0,i.ok=!sy(e)||e,i.fail=sy(t)&&t,i.domain=$R?wy.domain:void 0,0==r.state?r.reactions.add(i):ly((function(){My(i,r)})),i.promise})),QR=function(){var e=new JR,t=yy(e);this.promise=e,this.resolve=jy(Wy,t),this.reject=jy(Gy,t)},Ty.f=Ny=function(e){return e===by||undefined===e?new QR(e):Dy(e)}),qR({global:!0,constructor:!0,wrap:!0,forced:Sy},{Promise:by}),iy(by,gy,!1,!0),ny(gy);var Hy=ea("iterator"),Ky=!1;try{var Yy=0,zy={next:function(){return{done:!!Yy++}},return:function(){Ky=!0}};zy[Hy]=function(){return this},Array.from(zy,(function(){throw 2}))}catch(e){}var Xy=CR,Zy=function(e,t){if(!t&&!Ky)return!1;var r=!1;try{var i={};i[Hy]=function(){return{next:function(){return{done:r=!0}}}},e(i)}catch(e){}return r},Jy=KR.CONSTRUCTOR||!Zy((function(e){Xy.all(e).then(void 0,(function(){}))})),Qy=Ro,qy=gs,$y=YR,ev=OR,tv=Bg;mc({target:"Promise",stat:!0,forced:Jy},{all:function(e){var t=this,r=$y.f(t),i=r.resolve,n=r.reject,o=ev((function(){var r=qy(t.resolve),o=[],s=0,a=1;tv(e,(function(e){var c=s++,d=!1;a++,Qy(r,t,e).then((function(e){d||(d=!0,o[c]=e,--a||i(o))}),n)})),--a||i(o)}));return o.error&&n(o.value),r.promise}});var rv=mc,iv=KR.CONSTRUCTOR;CR&&CR.prototype,rv({target:"Promise",proto:!0,forced:iv,real:!0},{catch:function(e){return this.then(void 0,e)}});var nv=Ro,ov=gs,sv=YR,av=OR,cv=Bg;mc({target:"Promise",stat:!0,forced:Jy},{race:function(e){var t=this,r=sv.f(t),i=r.reject,n=av((function(){var n=ov(t.resolve);cv(e,(function(e){nv(n,t,e).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}});var dv=Ro,uv=YR;mc({target:"Promise",stat:!0,forced:KR.CONSTRUCTOR},{reject:function(e){var t=uv.f(this);return dv(t.reject,void 0,e),t.promise}});var lv=Ha,hv=Wo,pv=YR,fv=function(e,t){if(lv(e),hv(t)&&t.constructor===e)return t;var r=pv.f(e);return(0,r.resolve)(t),r.promise},Ev=mc,mv=CR,_v=KR.CONSTRUCTOR,Tv=fv,gv=Zo("Promise"),Sv=!_v;Ev({target:"Promise",stat:!0,forced:true},{resolve:function(e){return Tv(Sv&&this===gv?mv:this,e)}});var Rv=Ro,yv=gs,vv=YR,Av=OR,bv=Bg;mc({target:"Promise",stat:!0,forced:Jy},{allSettled:function(e){var t=this,r=vv.f(t),i=r.resolve,n=r.reject,o=Av((function(){var r=yv(t.resolve),n=[],o=0,s=1;bv(e,(function(e){var a=o++,c=!1;s++,Rv(r,t,e).then((function(e){c||(c=!0,n[a]={status:"fulfilled",value:e},--s||i(n))}),(function(e){c||(c=!0,n[a]={status:"rejected",reason:e},--s||i(n))}))})),--s||i(n)}));return o.error&&n(o.value),r.promise}});var Iv=Ro,Ov=gs,Cv=Zo,wv=YR,Nv=OR,Dv=Bg,Pv="No one promise resolved";mc({target:"Promise",stat:!0,forced:Jy},{any:function(e){var t=this,r=Cv("AggregateError"),i=wv.f(t),n=i.resolve,o=i.reject,s=Nv((function(){var i=Ov(t.resolve),s=[],a=0,c=1,d=!1;Dv(e,(function(e){var u=a++,l=!1;c++,Iv(i,t,e).then((function(e){l||d||(d=!0,n(e))}),(function(e){l||d||(l=!0,s[u]=e,--c||o(new r(s,Pv)))}))})),--c||o(new r(s,Pv))}));return s.error&&o(s.value),i.promise}});var Lv=mc,kv=CR,Mv=Hn,Uv=Zo,xv=mo,Vv=vS,Fv=fv,Bv=kv&&kv.prototype;Lv({target:"Promise",proto:!0,real:!0,forced:!!kv&&Mv((function(){Bv.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=Vv(this,Uv("Promise")),r=xv(e);return this.then(r?function(r){return Fv(t,e()).then((function(){return r}))}:e,r?function(r){return Fv(t,e()).then((function(){throw r}))}:e)}});var jv=Z(Ho.Promise);class Gv extends pi{set _mediaStreamTrack(e){e!==this.mediaStreamTrack&&(this.safeEmit(Bd.TRACK_UPDATED,e),this.mediaStreamTrack=e)}get _mediaStreamTrack(){return this.mediaStreamTrack}constructor(e,t){super(),N_(this,"trackMediaType",void 0),N_(this,"_ID",void 0),N_(this,"_rtpTransceiver",void 0),N_(this,"_lowRtpTransceiver",void 0),N_(this,"_hints",[]),N_(this,"_isClosed",!1),N_(this,"_originMediaStreamTrack",void 0),N_(this,"mediaStreamTrack",void 0),N_(this,"_external",{}),this._ID=t||Vi(8,"track-"),this._originMediaStreamTrack=e,this.mediaStreamTrack=e,wd(this)}toString(){return this._ID}getTrackId(){return this._ID}getMediaStreamTrack(e){return e||Mi((()=>{var e;Ln.reportApiInvoke(null,{name:_i.GET_MEDIA_STREAM_TRACK,options:[],tag:Ti.TRACER}).onSuccess((null===(e=this._mediaStreamTrack)||void 0===e?void 0:e.label)||"")}),this.mediaStreamTrack.id||this.getTrackId()),this._mediaStreamTrack}getRTCRtpTransceiver(e){return e===xd.LOW_STREAM?this._lowRtpTransceiver:this._rtpTransceiver}getMediaStreamTrackSettings(){return this.getMediaStreamTrack(!0).getSettings()}close(){this._isClosed=!0,this._lowRtpTransceiver=void 0,this._rtpTransceiver=void 0,Nd(this),this.emit(jd.CLOSED),this.removeAllListeners(Bd.SEI_RECEIVED)}_updateRtpTransceiver(e,t){if(t===xd.LOW_STREAM){if(this._lowRtpTransceiver===e)return;this._lowRtpTransceiver=e}else{if(this._rtpTransceiver===e)return;this._rtpTransceiver=e}this.emit(Bd.TRANSCEIVER_UPDATED,e,t)}}class Wv extends Gv{get isExternalTrack(){return this._isExternalTrack}get muted(){return this._muted}get enabled(){return this._enabled}get processorContext(){return this._processorContext}constructor(e,t){super(e,t),N_(this,"_enabled",!0),N_(this,"_muted",!1),N_(this,"_isExternalTrack",!1),N_(this,"_isClosed",!1),N_(this,"_enabledMutex",void 0),N_(this,"processor",void 0),N_(this,"_processorContext",void 0),N_(this,"_handleTrackEnded",(()=>{this.onTrackEnded()})),this._enabledMutex=new Xi("".concat(this.getTrackId())),e.addEventListener("ended",this._handleTrackEnded)}getTrackLabel(){var e,t;return null!==(e=null===(t=this._originMediaStreamTrack)||void 0===t?void 0:t.label)&&void 0!==e?e:""}close(){this._isClosed||(this.stop(),this._originMediaStreamTrack.stop(),this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack.stop(),this._mediaStreamTrack=null),this._originMediaStreamTrack=null,this._enabledMutex=null,In.debug("[".concat(this.getTrackId(),"] close")),this.emit(Md.NEED_CLOSE),super.close())}async _updateOriginMediaStreamTrack(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this._isExternalTrack=r,e!==this._originMediaStreamTrack&&(this._originMediaStreamTrack&&(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),t&&this._originMediaStreamTrack.stop()),e.addEventListener("ended",this._handleTrackEnded),this._originMediaStreamTrack=e,this._muted&&(this._originMediaStreamTrack.enabled=!1),this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await yi(this,Md.NEED_REPLACE_TRACK,this),this.processor&&this._processorContext&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this._processorContext}))}_getDefaultPlayerConfig(){return{}}onTrackEnded(){In.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(jd.TRACK_ENDED)}stateCheck(e,t){if(In.debug("check track state, [muted: ".concat(this._muted,", enabled: ").concat(this._enabled,"] to [").concat(e,": ").concat(t,"]")),ni(t,e),this._enabled&&this._muted&&"enabled"===e&&!1===t)throw new ii(ri.TRACK_STATE_UNREACHABLE,"cannot set enabled while the track is muted").print("error",In);if(!this._enabled&&!this._muted&&"muted"===e&&!0===t)throw new ii(ri.TRACK_STATE_UNREACHABLE,"cannot set muted while the track is disabled").print("error",In)}getProcessorStats(){return this._processorContext&&this._processorContext.gatherStats()||[]}getProcessorUsage(){return this._processorContext?this._processorContext.gatherUsage():jv.resolve([])}}function Hv(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}const Kv=window.AudioContext||window.webkitAudioContext;let Yv,zv=null;const Xv=new class extends pi{constructor(){super(...arguments),N_(this,"prevState",void 0),N_(this,"curState",void 0),N_(this,"currentTime",void 0),N_(this,"currentTimeStuckAt",void 0),N_(this,"interruptDetectorTrack",void 0),N_(this,"onLocalAudioTrackMute",(()=>{In.info("ios15-interruption-start"),this.emit(Wn.IOS_15_16_INTERRUPTION_START)})),N_(this,"onLocalAudioTrackUnmute",(async()=>{In.info("ios15-interruption-end"),"running"!==this.curState||this.duringInterruption?In.info("ios15-interruption-end-canceled"):(zv&&await zv.suspend(),this.emit(Wn.IOS_15_16_INTERRUPTION_END))}))}get duringInterruption(){return"running"===this.prevState&&"interrupted"===this.curState}bindInterruptDetectorTrack(e){In.debug("webaudio bindInterruptDetectorTrack ".concat(e.getTrackId())),this.interruptDetectorTrack||(this.interruptDetectorTrack=e,this.interruptDetectorTrack._mediaStreamTrack.onmute=this.onLocalAudioTrackMute,this.interruptDetectorTrack._mediaStreamTrack.onunmute=this.onLocalAudioTrackUnmute)}unbindInterruptDetectorTrack(e){In.debug("webaudio unbindInterruptDetectorTrack ".concat(e.getTrackId())),this.interruptDetectorTrack&&this.interruptDetectorTrack===e&&(this.interruptDetectorTrack._mediaStreamTrack&&(this.interruptDetectorTrack._mediaStreamTrack.onmute=null,this.interruptDetectorTrack._mediaStreamTrack.onunmute=null),this.interruptDetectorTrack=void 0)}};function Zv(){if(!Kv)return void In.error("your browser is not support web audio");In.info("create audio context");const e=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Hv(Object(r),!0).forEach((function(t){N_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Hv(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},ln("WEBAUDIO_INIT_OPTIONS"));In.debug("audio context init option:",JSON.stringify(e)),zv=new Kv(e),Xv.curState=zv.state,zv.onstatechange=()=>{Xv.prevState=Xv.curState,Xv.curState=zv?zv.state:void 0;const{prevState:e,curState:t}=Xv,r="running"===t,i="interrupted"===t,n="running"===e,o="suspended"===e,s="interrupted"===e,a=Cr().osVersion;(xr()||Yr())&&n&&i&&(In.info("ios".concat(a,"-interruption-start")),Xv.emit(Wn.IOS_INTERRUPTION_START)),(xr()||Yr())&&(o||s)&&r&&(In.info("ios".concat(a,"-interruption-end")),Xv.emit(Wn.IOS_INTERRUPTION_END)),e!==t&&Xv.emit(Wn.STATE_CHANGE,t,e)},setInterval((()=>{var e;const t=null===(e=zv)||void 0===e?void 0:e.currentTime;if(Xv.currentTime!==t)Xv.currentTimeStuckAt&&(In.debug("AudioContext current time resume at ".concat(t)),Xv.currentTimeStuckAt=void 0),Xv.currentTime=t;else{if(t!==Xv.currentTimeStuckAt){Ln.reportApiInvoke(null,{name:"WEB_AUDIO_CURRENT_TIME_STUCK",options:{currentTime:t},tag:Ti.TRACER}).onSuccess(),In.warning("AudioContext current time stuck at ".concat(t))}Xv.currentTimeStuckAt=t}}),5e3),async function(e){const t=["click","contextmenu","auxclick","dblclick","mousedown","mouseup","touchend","keydown","keyup"];let r,i=!1,n=!1,o=!1;function s(t){"running"===e.state?a(!1):xr()||Yr()?"suspended"===e.state&&(a(!0),t&&e.resume().then(d,d)):"closed"!==e.state&&(a(!0),t&&e.resume().then(d,d))}function a(e){if(i!==e){i=e;for(let r=0,i=t;r<i.length;r+=1){const t=i[r];e?window.addEventListener(t,u,{capture:!0,passive:!0}):window.removeEventListener(t,u,{capture:!0,passive:!0})}}}function c(){s(!0)}function d(){s(!1)}function u(){s(!0)}function l(){let e;try{e=r.play(),e?e.then(f,f):(r.addEventListener("playing",f),r.addEventListener("abort",f),r.addEventListener("error",f))}catch(e){f()}}function h(e){o||(r.paused?e?(p(!1),o=!0,l()):p(!0):p(!1))}function p(e){if(n!==e){n=e;for(let r=0,i=t;r<i.length;r++){const t=i[r];e?window.addEventListener(t,E,{capture:!0,passive:!0}):window.removeEventListener(t,E,{capture:!0,passive:!0})}}}function f(){r.removeEventListener("playing",f),r.removeEventListener("abort",f),r.removeEventListener("error",f),o=!1,h(!1)}function E(){h(!0)}let m;if(xr()&&ln("IOS_BG_TAG")){const t=e.createMediaStreamDestination(),i=document.createElement("div");i.innerHTML="<audio x-webkit-airplay='deny'></audio>",r=i.children.item(0),r.controls=!1,r.disableRemotePlayback=!0,r.preload="auto",r.srcObject=t.stream,m=()=>{if(ln("IOS_AUTO_RESTART_BG_TAG")&&r&&r.srcObject&&!o&&(!r.paused||!0!==n)){r.paused||r.pause();try{o=!0,l()}catch(e){o=!1}return!0}},h(!0)}return Xv.on(Wn.STATE_CHANGE,c),s(!1),m}(zv).then((e=>{Yv=e}))}function Jv(){if(Yv){if(Yv()){Ln.reportApiInvoke(null,{name:"BG_AUDIO_TAG_RESTART",options:{},tag:Ti.TRACER}).onSuccess(),In.debug("restart background audio tag success")}}}function Qv(){if(!zv){if(Zv(),!zv)throw new ii(ri.NOT_SUPPORTED,"can not create audio context");return zv}return zv}function qv(){return!!zv}function $v(e){if(function(){if(null!==tA)return tA;const e=Qv(),t=e.createBufferSource(),r=e.createGain(),i=e.createGain();t.connect(r),t.connect(i),t.disconnect(r);let n=!1;try{t.disconnect(r)}catch(e){n=!0}return t.disconnect(),tA=n,n}())return;const t=e.connect,r=e.disconnect;e.connect=(r,i,n)=>{var o;return e._inputNodes||(e._inputNodes=[]),Ed(o=e._inputNodes).call(o,r)||(r instanceof AudioNode?(e._inputNodes.push(r),t.call(e,r,i,n)):t.call(e,r,i)),e},e.disconnect=(i,n,o)=>{r.call(e),i?Ni(e._inputNodes,i):e._inputNodes=[];for(const r of e._inputNodes)t.call(e,r)}}function eA(e){const t=Qv();return new jv(((r,i)=>{t.decodeAudioData(e,(e=>{r(e)}),(e=>{i(new ii(ri.DECODE_AUDIO_FILE_FAILED,e.toString()))}))}))}let tA=null;let rA=null;function iA(e){for(let t=0;t<e.outputBuffer.numberOfChannels;t+=1){const r=e.outputBuffer.getChannelData(t);for(let e=0;e<r.length;e+=1)r[e]=0}return e.inputBuffer}var nA=Z(oT);class oA{constructor(){N_(this,"context",void 0),N_(this,"analyserNode",void 0),N_(this,"sourceNode",void 0),this.context=Qv(),this.analyserNode=this.context.createAnalyser(),this.analyserNode.fftSize=2048,this.analyserNode.smoothingTimeConstant=.4}updateSource(e){if(e!==this.sourceNode){if(this.sourceNode)try{this.sourceNode.disconnect(this.analyserNode)}catch(e){}this.sourceNode=e,null==e||e.connect(this.analyserNode)}}getVolumeLevel(){if(!this.sourceNode)return 0;if(!this.context||xr()||Yr()||"running"!==this.context.state&&this.context.resume(),!this.analyserNode)return 0;const e=new Float32Array(this.analyserNode.fftSize);if(this.analyserNode.getFloatTimeDomainData)this.analyserNode.getFloatTimeDomainData(e);else{const t=new Uint8Array(this.analyserNode.fftSize);this.analyserNode.getByteTimeDomainData(t);for(let r=0;r<e.length;++r)e[r]=t[r]/128-1}const t=nA(e).call(e,((e,t)=>e+t*t),0)/e.length;return Math.max(10*Math.log10(t)+100,0)/100}getAnalyserNode(){return this.analyserNode}rebuildAnalyser(){try{var e,t;null===(e=this.sourceNode)||void 0===e||e.disconnect(this.analyserNode),this.analyserNode=this.context.createAnalyser(),this.analyserNode.fftSize=2048,this.analyserNode.smoothingTimeConstant=.4,null===(t=this.sourceNode)||void 0===t||t.connect(this.analyserNode)}catch(e){In.warning("rebuild analyser node failed.")}}destroy(){this.updateSource(void 0)}}class sA extends pi{get processSourceNode(){return this.sourceNode}set processedNode(e){var t;if(!this.isDestroyed&&this._processedNode!==e){try{var r;null===(r=this.sourceNode)||void 0===r||r.disconnect(this.outputNode)}catch(e){}null===(t=this._processedNode)||void 0===t||t.disconnect(),this._processedNode=e,this.connect()}}get processedNode(){return this._processedNode}constructor(){super(),N_(this,"outputNode",void 0),N_(this,"outputTrack",void 0),N_(this,"isPlayed",!1),N_(this,"sourceNode",void 0),N_(this,"context",void 0),N_(this,"audioBufferNode",void 0),N_(this,"destNode",void 0),N_(this,"audioOutputLevel",0),N_(this,"volumeLevelAnalyser",void 0),N_(this,"_processedNode",void 0),N_(this,"playNode",void 0),N_(this,"isDestroyed",!1),N_(this,"onNoAudioInput",void 0),N_(this,"isNoAudioInput",!1),N_(this,"_noAudioInputCount",0),this.context=Qv(),this.playNode=this.context.destination,this.outputNode=this.context.createGain(),$v(this.outputNode),this.volumeLevelAnalyser=new oA}startGetAudioBuffer(e){this.audioBufferNode||(this.audioBufferNode=this.context.createScriptProcessor(e),this.outputNode.connect(this.audioBufferNode),this.audioBufferNode.connect(this.context.destination),this.audioBufferNode.onaudioprocess=e=>{this.emit(Hd.ON_AUDIO_BUFFER,iA(e))})}stopGetAudioBuffer(){this.audioBufferNode&&(this.audioBufferNode.onaudioprocess=null,this.outputNode.disconnect(this.audioBufferNode),this.audioBufferNode=void 0)}createOutputTrack(){if(!Un().webAudioMediaStreamDest)throw new ii(ri.NOT_SUPPORTED,"your browser is not support audio processor");return this.destNode&&this.outputTrack||(this.destNode=this.context.createMediaStreamDestination(),this.outputNode.connect(this.destNode),this.outputTrack=this.destNode.stream.getAudioTracks()[0]),this.outputTrack}play(e){"running"!==this.context.state&&Di((()=>{Xv.emit("autoplay-failed")})),this.isPlayed=!0,this.playNode=e||this.context.destination,this.outputNode.connect(this.playNode)}stop(){if(this.isPlayed)try{this.outputNode.disconnect(this.playNode)}catch(e){}this.isPlayed=!1}getAccurateVolumeLevel(){return this.volumeLevelAnalyser.getVolumeLevel()}async checkHasAudioInput(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(e>5)return this.isNoAudioInput=!0,this.onNoAudioInput&&this.onNoAudioInput(),!1;xr()||Yr()?"suspended"===this.context.state&&this.context.resume():"running"!==this.context.state&&this.context.resume();const t=this.volumeLevelAnalyser.getAnalyserNode();let r;t.getFloatTimeDomainData?(r=new Float32Array(t.fftSize),t.getFloatTimeDomainData(r)):(r=new Uint8Array(t.fftSize),t.getByteTimeDomainData(r));let i=!1;for(let e=0;e<r.length;e++)0!==r[e]&&(i=!0);return i?(this.isNoAudioInput=!1,!0):(await xi(200),await this.checkHasAudioInput(e?e+1:1)&&i)}getAudioVolume(){return this.outputNode.gain.value}setVolume(e){this.outputNode.gain.setValueAtTime(e,this.context.currentTime)}destroy(){this.disconnect(),this.stop(),this.isDestroyed=!0,this.onNoAudioInput=void 0}disconnect(){var e,t;null===(e=this.processedNode)||void 0===e||e.disconnect(),null===(t=this.sourceNode)||void 0===t||t.disconnect(),this.outputNode&&this.outputNode.disconnect()}connect(){var e;this.processedNode?null===(e=this.processedNode)||void 0===e||e.connect(this.outputNode):this.sourceNode&&this.sourceNode.connect(this.outputNode);this.volumeLevelAnalyser.updateSource(this.outputNode)}}class aA extends sA{get isFreeze(){return!1}constructor(e,t,r){var i;if(super(),N_(this,"sourceNode",void 0),N_(this,"track",void 0),N_(this,"clonedTrack",void 0),N_(this,"audioElement",void 0),N_(this,"isCurrentTrackCloned",!1),N_(this,"isRemoteTrack",!1),N_(this,"originVolumeLevelAnalyser",void 0),N_(this,"rebuildWebAudio",(async()=>{if(In.debug("ready to rebuild web audio, state:",this.context.state),this.isNoAudioInput&&await this.checkHasAudioInput(),!this.isNoAudioInput||this.isDestroyed)return document.body.removeEventListener("click",this.rebuildWebAudio,!0),void In.debug("rebuild web audio success, current volume status",this.getAccurateVolumeLevel());this.context.resume().then((()=>In.info("resume success"))),In.debug("rebuild web audio because of ios 12 bugs"),this.disconnect();const e=this.track;this.track=this.track.clone(),this.isCurrentTrackCloned?e.stop():this.isCurrentTrackCloned=!0;const t=new MediaStream([this.track]);this.sourceNode=this.context.createMediaStreamSource(t),$v(this.sourceNode),this.volumeLevelAnalyser.rebuildAnalyser();const r=this.outputNode.gain.value;this.outputNode=this.context.createGain(),this.outputNode.gain.setValueAtTime(r,this.context.currentTime),$v(this.outputNode),this.emit(Hd.UPDATE_SOURCE),this.connect(),this.audioElement.srcObject=t,this.isPlayed&&this.play(this.playNode),this.checkHasAudioInput()})),"audio"!==e.kind)throw new ii(ri.UNEXPECTED_ERROR);this.track=e;const n=new MediaStream([this.track]);if(this.isRemoteTrack=!!t,this.sourceNode=this.context.createMediaStreamSource(n),$v(this.sourceNode),r){const e=r.clone();e.enabled=!0,this.clonedTrack=e,In.debug("create an unmuted track ".concat(e.id," from the original track ").concat(r.id," to get the volume"));const t=this.context.createMediaStreamSource(new MediaStream([e]));$v(t),this.originVolumeLevelAnalyser=new oA,this.originVolumeLevelAnalyser.updateSource(t)}this.connect(),this.audioElement=document.createElement("audio"),this.audioElement.srcObject=n;const o=Cr();t&&o.os===vr.IOS&&Number(null===(i=o.osVersion)||void 0===i?void 0:i.split(".")[0])<15&&(Xv.on(Wn.STATE_CHANGE,(()=>{"suspended"===this.context.state?document.body.addEventListener("click",this.rebuildWebAudio,!0):"running"===this.context.state&&this.rebuildWebAudio()})),this.checkHasAudioInput().then((e=>{e||document.body.addEventListener("click",this.rebuildWebAudio,!0)})))}updateTrack(e){this.sourceNode.disconnect(),this.track=e,this.isCurrentTrackCloned=!1;const t=new MediaStream([e]);this.sourceNode=this.context.createMediaStreamSource(t),$v(this.sourceNode),this.processedNode||this.sourceNode.connect(this.outputNode),this.emit(Hd.UPDATE_SOURCE),this.audioElement.srcObject=t}destroy(){var e;this.audioElement.srcObject=null,this.audioElement.remove(),Xv.off("state-change",this.rebuildWebAudio),null===(e=this.originVolumeLevelAnalyser)||void 0===e||e.destroy(),this.clonedTrack=void 0,super.destroy()}createMediaStreamSourceNode(e){return this.context.createMediaStreamSource(new MediaStream([e]))}updateOriginTrack(e){const t=e.clone();t.enabled=!0,this.clonedTrack&&(this.clonedTrack.stop(),this.clonedTrack=t),In.debug("create an unmuted track ".concat(t.id," from the original track ").concat(e.id," to get the volume"));const r=this.context.createMediaStreamSource(new MediaStream([t]));$v(r),this.originVolumeLevelAnalyser&&this.originVolumeLevelAnalyser.updateSource(r)}getOriginVolumeLevel(){return this.originVolumeLevelAnalyser?this.originVolumeLevelAnalyser.getVolumeLevel():this.getAccurateVolumeLevel()}}async function cA(e,t,r){const i=(e,t)=>e?"number"!=typeof e?e.max||e.exact||e.ideal||e.min||t:e:t,n={audio:!!r&&{mandatory:{chromeMediaSource:"desktop"}},video:{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e,maxHeight:i(t.height,1080),maxWidth:i(t.width,1920)}}};return t.frameRate&&"number"!=typeof t.frameRate?(n.video.mandatory.maxFrameRate=t.frameRate.max,n.video.mandatory.minFrameRate=t.frameRate.min):"number"==typeof t.frameRate&&(n.video.mandatory.maxFrameRate=t.frameRate),await navigator.mediaDevices.getUserMedia(n)}async function dA(e,t){const r=await uA(e.mediaSource),{sourceId:i,audio:n}=await function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise(((r,i)=>{const n=document.createElement("div");n.innerText="share screen",n.setAttribute("style","text-align: center; height: 25px; line-height: 25px; border-radius: 4px 4px 0 0; background: #D4D2D4; border-bottom: solid 1px #B9B8B9;");const o=document.createElement("div");o.setAttribute("style","width: 100%; height: 500px; padding: 15px 25px ; box-sizing: border-box;");const s=document.createElement("div");s.innerText="Agora Web Screensharing wants to share the contents of your screen with webdemo.agorabeckon.com. Choose what you'd like to share.",s.setAttribute("style","height: 12%;");const a=document.createElement("div");a.setAttribute("style","width: 100%; height: 80%; background: #FFF; border: solid 1px #CBCBCB; display: flex; flex-wrap: wrap; justify-content: space-around; overflow-y: scroll; padding: 0 15px; box-sizing: border-box;");const c=document.createElement("div");c.setAttribute("style","display: flex; justify-content: space-between; padding: 16px 0;");const d=document.createElement("button");d.innerHTML="cancel",d.setAttribute("style","width: 85px;"),d.onclick=()=>{document.body.removeChild(h);const e=new Error("NotAllowedError");e.name="NotAllowedError",i(e)};let u=t;const l=document.createElement("div");if(t){const e=document.createElement("input");e.setAttribute("type","checkbox");const t=document.createElement("span");e.setAttribute("style","margin-right: 6px;"),t.innerText="Share audio",e.checked=u,e.onchange=()=>{u=e.checked},l.appendChild(e),l.appendChild(t)}c.appendChild(l),c.appendChild(d),o.appendChild(s),o.appendChild(a),o.appendChild(c);const h=document.createElement("div");h.setAttribute("style","position: fixed; z-index: 99999999; top: 50%; left: 50%; width: 620px; height: 525px; background: #ECECEC; border-radius: 4px; -webkit-transform: translate(-50%,-50%); transform: translate(-50%,-50%);"),h.appendChild(n),h.appendChild(o),document.body.appendChild(h),e.map((e=>{if(e.id){const t=document.createElement("div");t.setAttribute("style","width: 30%; height: 160px; padding: 20px 0; text-align: center;box-sizing: content-box;");let i=e.thumbnail;try{const{width:e}=i.getSize();e>1920&&(i=i.resize({width:1920}))}catch(e){throw e&&e.message.startsWith("Illegal invocation")&&console.error("Operate thumbnail error, please try to set contextIsolation: false. (https://github.com/electron/electron/issues/34953)"),e}t.innerHTML='<div style="height: 120px; display: table-cell; vertical-align: middle;"><img style="width: 100%; background: #333333; box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.2);" src='+i.toDataURL()+' /></div><span style="\theight: 40px; line-height: 40px; display: inline-block; width: 70%; word-break: keep-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">'+e.name.replace(/[\u00A0-\u9999<>\&]/g,(function(e){return"&#"+e.charCodeAt(0)+";"}))+"</span>",t.onclick=()=>{document.body.removeChild(h),r({sourceId:e.id,audio:u})},a.appendChild(t)}}))}))}(r,t);return await cA(i,e,n)}async function uA(e){let t=["window","screen"];"application"!==e&&"window"!==e||(t=["window"]),"screen"===e&&(t=["screen"]);const r=mi();if(!r)throw console.error("failed to fetch electron, please mount it to window"),new ii(ri.ELECTRON_IS_NULL);let i=null;try{var n;i=(null===(n=r.desktopCapturer)||void 0===n?void 0:n.getSources({types:t}))||r.ipcRenderer.invoke("DESKTOP_CAPTURER_GET_SOURCES",{types:t})}catch(e){i=null}i&&i.then||(i=new jv(((e,i)=>{r.desktopCapturer.getSources({types:t},((t,r)=>{t?i(t):e(r)}))})));try{return await i}catch(e){throw new ii(ri.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR,e.toString())}}function lA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}const hA=new Xi("safari");async function pA(e,t){let r=0,i=null;for(;r<2;)try{i=await fA(e,t,r>0);break}catch(e){if(e instanceof ii)throw In.error("[".concat(t,"] ").concat(e.toString())),e;const i=EA(e.name||e.code||e,e.message);if(i.code===ri.MEDIA_OPTION_INVALID){In.debug("[".concat(t,"] detect media option invalid, retry")),r+=1,await xi(500);continue}throw In.error("[".concat(t,"] ").concat(i.toString())),i}if(!i)throw new ii(ri.UNEXPECTED_ERROR,"can not find stream after getUserMedia");return i}async function fA(t,r,i){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new ii(ri.NOT_SUPPORTED,"can not find getUserMedia");i&&(t.video&&(delete t.video.width,delete t.video.height),t.screen&&(delete t.screen.width,delete t.screen.height));const n=Un(),o=new MediaStream;if(t.audioSource&&o.addTrack(t.audioSource),t.videoSource&&o.addTrack(t.videoSource),!t.audio&&!t.video&&!t.screen)return In.debug("Using Video Source/ Audio Source"),o;if(t.screen)if(fi())if(t.screen.sourceId){mA(o,await cA(t.screen.sourceId,t.screen,!!t.screenAudio))}else{mA(o,await dA(t.screen,!!t.screenAudio))}else if(Lr()&&t.screen.extensionId&&t.screen.mandatory){if(!n.getStreamFromExtension)throw new ii(ri.NOT_SUPPORTED,"This browser does not support screen sharing");In.debug("[".concat(r,'] Screen access on chrome stable, looking for extension"'));const e=await(a=t.screen.extensionId,c=r,new jv(((e,t)=>{try{chrome.runtime.sendMessage(a,{getStream:!0},(r=>{if(!r||!r.streamId)return In.error("[".concat(c,"] No response from Chrome Plugin. Plugin not installed properly"),r),void t(new ii(ri.CHROME_PLUGIN_NO_RESPONSE,"No response from Chrome Plugin. Plugin not installed properly"));e(r.streamId)}))}catch(e){In.error("[".concat(c,"] AgoraRTC screensharing plugin is not accessible(").concat(a,")"),e.toString()),t(new ii(ri.CHROME_PLUGIN_NOT_INSTALL))}})));t.screen.mandatory.chromeMediaSourceId=e;mA(o,await navigator.mediaDevices.getUserMedia({video:{mandatory:t.screen.mandatory}}))}else if(n.getDisplayMedia){var s;t.screen.mediaSource&&kd(t.screen.mediaSource);const e={width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate,displaySurface:null!==(s=t.screen.displaySurface)&&void 0!==s?s:"screen"===t.screen.mediaSource?"monitor":t.screen.mediaSource},{selfBrowserSurface:i,surfaceSwitching:n,systemAudio:a,preferCurrentTab:c,windowAudio:d,monitorTypeSurfaces:u}=t.screen,l={selfBrowserSurface:i,surfaceSwitching:n,systemAudio:a,preferCurrentTab:c,windowAudio:d,monitorTypeSurfaces:u};!i&&delete l.selfBrowserSurface,!n&&delete l.surfaceSwitching,!a&&delete l.systemAudio,!c&&delete l.preferCurrentTab,!d&&delete l.windowAudio,!u&&delete l.monitorTypeSurfaces,In.debug("[".concat(r,"] getDisplayMedia:"),JSON.stringify({video:e,audio:t.screenAudio,controls:l}));const h=await navigator.mediaDevices.getDisplayMedia(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?lA(Object(r),!0).forEach((function(t){N_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({video:e,audio:t.screenAudio},l));mA(o,h)}else{if(!Ur())throw In.error("[".concat(r,"] This browser does not support screenSharing")),new ii(ri.NOT_SUPPORTED,"This browser does not support screen sharing");{t.screen.mediaSource&&kd(t.screen.mediaSource);const e={video:{mediaSource:t.screen.mediaSource,width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate}};In.debug("[".concat(r,"] getUserMedia: ").concat(JSON.stringify(e)));mA(o,await navigator.mediaDevices.getUserMedia(e))}}var a,c;if(!t.video&&!t.audio)return o;let d={video:t.video,audio:t.audio},u=ln("MEDIA_DEVICE_CONSTRAINTS");if(u)try{"string"==typeof u&&(u=JSON.parse(u)),d=Wi(d,u)}catch(e){}In.debug("[".concat(r,"] GetUserMedia"),JSON.stringify(d)),Cr();let l,h=null;(kr()||xr()||Pr())&&(h=await hA.lock());try{l=await navigator.mediaDevices.getUserMedia(d)}catch(e){throw h&&h(),e}return d.audio&&(e.HAS_GUM_AUDIO=!0),d.video&&(e.HAS_GUM_VIDEO=!0),mA(o,l),h&&h(),o}function EA(e,t){switch(e){case"Starting video failed":case"OverconstrainedError":case"TrackStartError":return new ii(ri.MEDIA_OPTION_INVALID,"".concat(e,": ").concat(t));case"NotFoundError":case"DevicesNotFoundError":return new ii(ri.DEVICE_NOT_FOUND,"".concat(e,": ").concat(t));case"NotSupportedError":return new ii(ri.NOT_SUPPORTED,"".concat(e,": ").concat(t));case"NotReadableError":return new ii(ri.NOT_READABLE,"".concat(e,": ").concat(t));case"InvalidStateError":case"NotAllowedError":case"PERMISSION_DENIED":case"PermissionDeniedError":return new ii(ri.PERMISSION_DENIED,"".concat(e,": ").concat(t));case"ConstraintNotSatisfiedError":return new ii(ri.CONSTRAINT_NOT_SATISFIED,"".concat(e,": ").concat(t));default:return In.error("getUserMedia unexpected error",e),new ii(ri.UNEXPECTED_ERROR,"".concat(e,": ").concat(t))}}function mA(e,t){const r=e.getVideoTracks()[0],i=e.getAudioTracks()[0],n=t.getVideoTracks()[0],o=t.getAudioTracks()[0];o&&(i&&e.removeTrack(i),e.addTrack(o)),n&&(r&&e.removeTrack(r),e.addTrack(n))}e.HAS_GUM_AUDIO=!1,e.HAS_GUM_VIDEO=!1;class _A extends pi{get state(){return this._state}set state(e){e!==this._state&&(this.emit($d.STATE_CHANGE,e),this._state=e)}constructor(){super(),N_(this,"_state",qd.IDLE),N_(this,"isAccessMicrophonePermission",!1),N_(this,"isAccessCameraPermission",!1),N_(this,"lastAccessMicrophonePermission",!1),N_(this,"lastAccessCameraPermission",!1),N_(this,"checkdeviceMatched",!1),N_(this,"deviceInfoMap",new Map),this.init().then((()=>{navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",this.updateDevicesInfo.bind(this)),window.setInterval((()=>{(ln("ENUMERATE_DEVICES_INTERVAL")||(Qr()||Nr()===vr.HARMONY_OS)&&Jr())&&this.updateDevicesInfo()}),ln("ENUMERATE_DEVICES_INTERVAL_TIME"))})).catch((e=>In.error(e.toString())))}async enumerateDevices(t,r){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)throw new ii(ri.NOT_SUPPORTED,"enumerateDevices() not supported.");const n=await navigator.mediaDevices.enumerateDevices(),o=this.checkMediaDeviceInfoIsOk(n);let s=!this.isAccessMicrophonePermission&&t,a=!this.isAccessCameraPermission&&r;o.audio&&(s=!1),o.video&&(a=!1);let c=null,d=null,u=null;if(!i&&(s||a)){if(hA.isLocked){In.debug("[device manager] wait GUM lock");(await hA.lock())(),In.debug("[device manager] GUM unlock")}if(e.HAS_GUM_AUDIO&&(s=!1,this.isAccessMicrophonePermission=!0),e.HAS_GUM_VIDEO&&(a=!1,this.isAccessCameraPermission=!0),In.debug("[device manager] check media device permissions",t,r,s,a),s&&a){try{u=await navigator.mediaDevices.getUserMedia({audio:!0,video:!0})}catch(e){const t=EA(e.name||e.code||e,e.message);if(t.code===ri.PERMISSION_DENIED)throw t;In.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0,this.isAccessMicrophonePermission=!0}else if(s){try{c=await navigator.mediaDevices.getUserMedia({audio:t})}catch(e){const t=EA(e.name||e.code||e,e.message);if(t.code===ri.PERMISSION_DENIED)throw t;In.warning("getUserMedia failed in getDevices",t)}this.isAccessMicrophonePermission=!0}else if(a){try{d=await navigator.mediaDevices.getUserMedia({video:r})}catch(e){const t=EA(e.name||e.code||e,e.message);if(t.code===ri.PERMISSION_DENIED)throw t;In.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0}In.debug("[device manager] mic permission",t,"cam permission",r)}try{const e=await navigator.mediaDevices.enumerateDevices();return c&&c.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),c=null,d=null,u=null,e}catch(e){c&&c.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),c=null,d=null,u=null;return new ii(ri.ENUMERATE_DEVICES_FAILED,e.toString()).throw()}}async getRecordingDevices(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(await this.enumerateDevices(!0,!1,e)).filter((e=>"audioinput"===e.kind))}async getCamerasDevices(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(await this.enumerateDevices(!1,!0,e)).filter((e=>"videoinput"===e.kind))}async getSpeakers(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(await this.enumerateDevices(!0,!1,e)).filter((e=>"audiooutput"===e.kind))}searchDeviceIdByName(e){let t=null;return this.deviceInfoMap.forEach((r=>{r.device.label===e&&(t=r.device.deviceId)})),t}async getDeviceById(e){const t=(await this.enumerateDevices(!0,!0,!0)).find((t=>t.deviceId===e));if(!t)throw new ii(ri.DEVICE_NOT_FOUND,"deviceId: ".concat(e));return t}async init(){this.state=qd.INITING;try{await this.updateDevicesInfo(),this.state=qd.INITEND}catch(e){if(this.state=qd.IDLE,!("boolean"==typeof isSecureContext?isSecureContext:"https:"===location.protocol||"file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname||"::1"===location.hostname))throw new ii(ri.WEB_SECURITY_RESTRICT,"Your context is limited by web security, please try using https protocol or localhost.");throw In.warning("Device Detection functionality cannot start properly.",e.toString()),e}}async updateDevicesInfo(){const e=await this.enumerateDevices(!0,!0,!0),t=Date.now(),r=[];if(e[0]&&e[0].label&&!1===this.checkdeviceMatched){this.checkdeviceMatched=!0;const t=e.find((e=>"audioinput"===e.kind&&"default"===e.deviceId)),r=e.find((e=>"audiooutput"===e.kind&&"default"===e.deviceId));t&&r?r.groupId===t.groupId?In.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is the same group")):In.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is not the same group")):In.debug("[device-check] default input or output not found")}const i=this.checkMediaDeviceInfoIsOk(e);if(e.forEach((e=>{if(!e.deviceId)return;const i=this.deviceInfoMap.get("".concat(e.kind,"_").concat(e.deviceId));if("ACTIVE"!==(i?i.state:"INACTIVE")){const i={initAt:t,updateAt:t,device:e,state:"ACTIVE"};this.deviceInfoMap.set("".concat(e.kind,"_").concat(e.deviceId),i),r.push(i)}i&&(i.updateAt=t)})),this.deviceInfoMap.forEach(((e,i)=>{"ACTIVE"===e.state&&e.updateAt!==t&&(e.state="INACTIVE",r.push(e))})),this.state!==qd.INITEND)return i.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),void(i.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0));r.forEach((e=>{switch(e.device.kind){case"audioinput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit($d.RECORDING_DEVICE_CHANGED,e);break;case"videoinput":this.lastAccessCameraPermission&&this.isAccessCameraPermission&&this.emit($d.CAMERA_DEVICE_CHANGED,e);break;case"audiooutput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit($d.PLAYOUT_DEVICE_CHANGED,e)}})),i.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),i.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0)}checkMediaDeviceInfoIsOk(e){const t=e.filter((e=>"audioinput"===e.kind)),r=e.filter((e=>"videoinput"===e.kind)),i={audio:!1,video:!1};for(const e of t)if(e.label&&e.deviceId){i.audio=!0;break}for(const e of r)if(e.label&&e.deviceId){i.video=!0;break}return i}}const TA=new _A;let gA=!1;const SA=new class extends pi{constructor(){super(...arguments),N_(this,"onAutoplayFailed",void 0),N_(this,"onAudioAutoplayFailed",void 0)}};function RA(){if(gA)return ln("FLS_AUTOPLAY_EMITS")?(SA.onAutoplayFailed&&SA.onAutoplayFailed(),SA.emit("autoplay-failed")):void 0;{const e=t=>{t.preventDefault(),gA=!1,qr()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};gA=!0,qr()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),In.info("detect media autoplay failed, document: https://docs.agora.io/cn/Voice/autoplay_policy_web_ng?platform=Web"),SA.onAutoplayFailed?SA.onAutoplayFailed():SA.onAudioAutoplayFailed?In.warning("AgoraRTC.onAudioAutoplayFailed has been deprecated in favor of AgoraRTC.onAutoplayFailed.\n\n Please refer to the Agora document to migrate the newer API, https://docs.agora.io/en/Voice/autoplay_policy_web_ng?platform=Web ."):In.warning("We have detected a media autoplay failed event, and found out that you haven't implemented AgoraRTC.onAutoplayFailed callback yet.\n\n It will cause audio/video element not playing automatically on some browsers without user interaction, possibly hurting user experiences.\n\n Please refer to the Agora document to properly handle autoplay failed event, https://docs.agora.io/en/Voice/autoplay_policy_web_ng?platform=Web ."),SA.emit("autoplay-failed")}}function yA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function vA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?yA(Object(r),!0).forEach((function(t){N_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function AA(e,t,r,i){if(!e)return;const n=Ln.getBaseInfoBySessionId(e);if(!n)return;const o=n.info,s=Date.now(),a=vA(vA({},o),{},{vid:void 0===o.vid?0:Number(o.vid),lts:s,elapse:s-n.startTime,cbRegistered:SA.onAutoplayFailed||SA.onAudioAutoplayFailed?1:-1,errorMsg:r,mediaType:t,trackId:i,extend:void 0});Ln.send({type:Nn.AUTOPLAY_FAILED,data:a},!0)}const bA=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","error"],IA=new class{constructor(){N_(this,"onAutoplayFailed",void 0),N_(this,"elementMap",new Map),N_(this,"elementStateMap",new Map),N_(this,"elementsNeedToResume",[]),N_(this,"sinkIdMap",new Map),N_(this,"autoResumeAfterInterruption",(e=>jv.all(Array.from(this.elementMap.entries()).map((async t=>{let[r,i]=t;const n=this.elementStateMap.get(r),o=i.srcObject.getAudioTracks()[0],s=o&&o.readyState;if(In.debug("resume after interrupted, ele: ".concat(n," audio: ").concat(s," ").concat(e)),"live"===s){if(e)return i.pause(),i.play();if("running"===Xv.curState)return Wr()?(i.pause(),i.play()):n&&"paused"===n?i.play():void 0}}))))),N_(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{Array.from(this.elementMap.entries()).forEach((e=>{let[t,r]=e;const i=r.srcObject.getAudioTracks()[0];i&&"live"===i.readyState&&(In.debug("auto resume after interruption inside autoResumeAfterInterruptionOnIOS15"),r.pause(),r.play())}))})),this.autoResumeAudioElement(),Xv.on(Wn.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),Xv.on(Wn.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),Xv.on(Wn.STATE_CHANGE,(()=>{xr()&&"suspended"===Xv.prevState&&"running"===Xv.curState&&this.autoResumeAfterInterruption()}))}async setSinkID(e,t){const r=this.elementMap.get(e);if(this.sinkIdMap.set(e,t),r)try{await r.setSinkId(t)}catch(e){throw new ii(ri.PERMISSION_DENIED,"can not set sink id: "+e.toString())}}play(e,t,r,i){if(this.elementMap.has(t))return;const n=document.createElement("audio");n.autoplay=!0,n.srcObject=new MediaStream([e]),this.bindAudioElementEvents(t,n),this.elementMap.set(t,n),this.elementStateMap.set(t,eu.INIT),this.setVolume(t,r);const o=this.sinkIdMap.get(t);if(o)try{n.setSinkId(o).catch((e=>{In.warning("[".concat(t,"] set sink id failed"),e.toString())}))}catch(e){In.warning("[".concat(t,"] set sink id failed"),e.toString())}const s=n.play();s&&s.then&&s.catch((e=>{i&&AA(i,"audio",e.message,t),In.warning("audio element play warning",e.toString()),this.elementMap.has(t)&&"NotAllowedError"===e.name&&(In.warning("detected audio element autoplay failed"),this.elementsNeedToResume.push(n),Di((()=>{this.onAutoplayFailed&&this.onAutoplayFailed(),RA()})))}))}updateTrack(e,t){const r=this.elementMap.get(e);r&&(r.srcObject=new MediaStream([t]))}isPlaying(e){return this.elementMap.has(e)&&"playing"===this.elementStateMap.get(e)}setVolume(e,t){const r=this.elementMap.get(e);r&&(t=Math.max(0,Math.min(100,t)),r.volume=t/100)}getVolume(e){const t=this.elementMap.get(e);return t?t.volume:0}stop(e){const t=this.elementMap.get(e);if(this.sinkIdMap.delete(e),!t)return;const r=this.elementsNeedToResume.indexOf(t);this.elementsNeedToResume.splice(r,1),t.srcObject=null,t.remove(),this.elementMap.delete(e),this.elementStateMap.delete(e)}bindAudioElementEvents(e,t){bA.forEach((r=>{t.addEventListener(r,(r=>{const i=this.elementStateMap.get(e),n="pause"===r.type?"paused":r.type;if(In.debug("[".concat(e,"] audio-element-status change ").concat(i," => ").concat(n)),"error"===r.type){const r=null==t?void 0:t.error;r&&In.error("[".concat(e,"] media error, code: ").concat(r.code,", message: ").concat(r.message))}this.elementStateMap.set(e,n)}))}))}getPlayerState(e){return this.elementStateMap.get(e)||"uninit"}autoResumeAudioElement(){const e=()=>{this.elementsNeedToResume.forEach((e=>{e.play().then((e=>{In.debug("Auto resume audio element success")})).catch((e=>{In.warning("Auto resume audio element failed!",e)}))})),this.elementsNeedToResume=[]};new Promise((e=>{document.body?e():window.addEventListener("load",(()=>e()))})).then((()=>{qr()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0))}))}};function OA(){return function(e,t,r){const i=r.value;return"function"==typeof i&&(r.value=function(){this._isClosed&&new ii(ri.INVALID_OPERATION,"[".concat(this.getTrackId(),"] cannot operate a closed track")).print("warning",In);for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=i.apply(this,t);return n instanceof jv?new jv(((e,t)=>{n.then(e).catch(t)})):n}),r}}var CA=xc("Array").values,wA=qc,NA=Bs,DA=Qn,PA=CA,LA=Array.prototype,kA={DOMTokenList:!0,NodeList:!0},MA=Z((function(e){var t=e.values;return e===LA||DA(LA,e)&&t===LA.values||NA(kA,wA(e))?PA:t}));function UA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function xA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?UA(Object(r),!0).forEach((function(t){N_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):UA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class VA extends pi{constructor(e){super(),N_(this,"name","VideoProcessorDestination"),N_(this,"ID","0"),N_(this,"_source",void 0),N_(this,"videoContext",void 0),N_(this,"inputTrack",void 0),this.videoContext=e}get kind(){return"video"}get enabled(){return!0}pipe(){throw new ii(ri.NOT_SUPPORTED,"VideoProcessor cannot pipe to any other Processor")}unpipe(){throw new ii(ri.NOT_SUPPORTED,"VideoProcessor cannot unpipe to any other Processor")}enable(){}disable(){}updateInput(e){if(e.context!==this.videoContext)throw new Error("ProcessorContext passed to VideoTrack.processorDestination doesn't match it's belonging VideoTrack's context.\nProbably you are making pipeline like this:\nvideoTrack1.pipe(processor).pipe(videoTrack2.processorDestination).");e.track&&e.track!==this.inputTrack&&(this.videoContext.chained=!0,this.inputTrack=e.track,this.emit(Jd.ON_TRACK,e.track))}reset(){this.inputTrack=void 0,this.videoContext.chained=!1,this.emit(Jd.ON_TRACK,void 0)}}class FA extends pi{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t){super(),N_(this,"constraintsMap",new Map),N_(this,"statsRegistry",[]),N_(this,"usageRegistry",[]),N_(this,"trackId",void 0),N_(this,"direction",void 0),N_(this,"_chained",!1),this.trackId=e,this.direction=t}async getConstraints(){return await Ri(this,Qd.REQUEST_CONSTRAINTS)}async requestApplyConstraints(e,t){var r;return In.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),yi(this,Qd.REQUEST_UPDATE_CONSTRAINTS,Array.from(MA(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return In.info("processor ".concat(e.name," requestRevertConstraints for ").concat(this.trackId)),this.constraintsMap.delete(e),yi(this,Qd.REQUEST_UPDATE_CONSTRAINTS,Array.from(MA(t=this.constraintsMap).call(t)))}registerStats(e,t,r){this.statsRegistry.find((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t))||this.statsRegistry.push({processorName:e.name,processorID:e.ID,type:t,cb:r})}unregisterStats(e,t){const r=this.statsRegistry.findIndex((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t));-1!==r&&this.statsRegistry.splice(r,1)}gatherStats(){const e=[];for(const{processorID:t,processorName:r,type:i,cb:n}of this.statsRegistry)try{const o=n();e.push({processorID:t,processorName:r,type:i,stats:o})}catch(e){In.error(new ii(ri.UNEXPECTED_ERROR,e.message))}return e}registerUsage(e,t){this.usageRegistry.find((t=>t.processorID===e.ID&&t.processorName===e.name))||this.usageRegistry.push({processorID:e.ID,processorName:e.name,cb:t})}unregisterUsage(e){const t=this.usageRegistry.findIndex((t=>t.processorID===e.ID&&t.processorName===e.name));-1!==t&&this.usageRegistry.splice(t,1)}async gatherUsage(){const e=[];if(!this.chained)return[];for(const{cb:t}of this.usageRegistry)try{let r=t();r instanceof jv&&(r=await r),e.push(xA(xA({},r),{},{direction:this.direction}))}catch(e){In.error("gather extension usage error",e)}return e}getDirection(){return this.direction}}class BA extends pi{constructor(e){super(),N_(this,"name","AudioProcessorDestination"),N_(this,"ID","0"),N_(this,"inputTrack",void 0),N_(this,"inputNode",void 0),N_(this,"audioProcessorContext",void 0),N_(this,"_source",void 0),this.audioProcessorContext=e}get kind(){return"audio"}get enabled(){return!0}pipe(){throw new ii(ri.NOT_SUPPORTED,"AudioProcessorDestination cannot pipe to any other Processor")}unpipe(){throw new ii(ri.NOT_SUPPORTED,"AudioProcessor cannot unpipe to any other Processor")}enable(){}disable(){}reset(){this.inputTrack=void 0,this.inputNode=void 0,this.audioProcessorContext.chained=!1,this.emit(Jd.ON_TRACK,void 0),this.emit(Jd.ON_NODE,void 0)}updateInput(e){if(e.context!==this.audioProcessorContext)throw new Error("ProcessorContext passed to AudioTrack.processorDestination doesn't match it's belonging AudioTrack's context.\n Probably you are making pipeline like this: audioTrack1.pipe(processor).pipe(audioTrack2.processorDestination).");e.track&&this.inputTrack!==e.track&&(this.audioProcessorContext.chained=!0,this.inputTrack=e.track,this.emit(Jd.ON_TRACK,this.inputTrack)),e.node&&this.inputNode!==e.node&&(this.audioProcessorContext.chained=!0,this.inputNode=e.node,this.emit(Jd.ON_NODE,this.inputNode))}}class jA extends pi{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t,r){super(),N_(this,"constraintsMap",new Map),N_(this,"statsRegistry",[]),N_(this,"audioContext",void 0),N_(this,"trackId",void 0),N_(this,"direction",void 0),N_(this,"usageRegistry",[]),N_(this,"_chained",!1),this.audioContext=e,this.trackId=t,this.direction=r}async getConstraints(){return Ri(this,Qd.REQUEST_CONSTRAINTS)}getAudioContext(){return this.audioContext}async requestApplyConstraints(e,t){var r;return In.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),yi(this,Qd.REQUEST_UPDATE_CONSTRAINTS,Array.from(MA(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return this.constraintsMap.delete(e),yi(this,Qd.REQUEST_UPDATE_CONSTRAINTS,Array.from(MA(t=this.constraintsMap).call(t)))}registerStats(e,t,r){this.statsRegistry.find((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t))||this.statsRegistry.push({processorName:e.name,processorID:e.ID,type:t,cb:r})}unregisterStats(e,t){const r=this.statsRegistry.findIndex((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t));-1!==r&&this.statsRegistry.splice(r,1)}gatherStats(){const e=[];for(const{processorID:t,processorName:r,type:i,cb:n}of this.statsRegistry)try{const o=n();e.push({processorID:t,processorName:r,type:i,stats:o})}catch(e){In.error(new ii(ri.UNEXPECTED_ERROR,e.message))}return e}registerUsage(e,t){this.usageRegistry.find((t=>t.processorID===e.ID&&t.processorName===e.name))||this.usageRegistry.push({processorID:e.ID,processorName:e.name,cb:t})}unregisterUsage(e){const t=this.usageRegistry.findIndex((t=>t.processorID===e.ID&&t.processorName===e.name));-1!==t&&this.usageRegistry.splice(t,1)}async gatherUsage(){const e=[];if(!this.chained)return[];for(const{cb:t}of this.usageRegistry)try{let r=t();r instanceof jv&&(r=await r),e.push(xA(xA({},r),{},{direction:this.direction}))}catch(e){In.error("gather extension usage error",e)}return e}getDirection(){return this.direction}}class GA extends pi{get isPlayed(){return!0}get isFreeze(){return!1}constructor(){super(),N_(this,"context",void 0),N_(this,"processSourceNode",void 0),N_(this,"outputTrack",void 0),N_(this,"processedNode",void 0),N_(this,"clonedTrack",void 0),N_(this,"outputNode",void 0),this.outputNode=new WA}setVolume(){}createOutputTrack(){throw new ii(ri.NOT_SUPPORTED,"can not create output MediaStreamTrack when WebAudio disabled")}getOriginVolumeLevel(){return 0}getAccurateVolumeLevel(){return 0}stopGetAudioBuffer(){}startGetAudioBuffer(){}play(){}stop(){}destroy(){}updateTrack(){}updateOriginTrack(){}createMediaStreamSourceNode(){}}class WA{disconnect(){}connect(){}}function HA(e){return new jv(((t,r)=>{let i=!1;const n=document.createElement("video");n.setAttribute("autoplay",""),n.setAttribute("muted",""),n.muted=!0,n.autoplay=!0,n.setAttribute("playsinline",""),n.setAttribute("style","position: fixed; top: 0; left: 0; width: 1px; height: 1px"),document.body.appendChild(n);const o=xr()?"canplay":"playing";n.addEventListener(o,(()=>{const e=n.videoWidth,r=n.videoHeight;!e&&Ur()||(i=!0,n.srcObject=null,n.remove(),t([e,r]))})),n.srcObject=new MediaStream([e]),n.play().catch(Fi),setTimeout((()=>{i||(n.srcObject=null,n.remove(),t([n.videoWidth,n.videoHeight]))}),4e3)}))}function KA(e){const t={};e.facingMode&&(t.facingMode=e.facingMode),e.cameraId&&(t.deviceId={exact:e.cameraId});const r=vd(e.encoderConfig);return null!=r.width&&(t.width=r.width),null!=r.height&&(t.height=r.height),!Xr()&&r.frameRate&&(t.frameRate=r.frameRate),Mr()&&"object"==typeof t.frameRate&&(t.frameRate.max=60),Ur()&&(t.frameRate={ideal:30,max:30}),t}function YA(e){const t={};e.screenSourceType&&(t.mediaSource=e.screenSourceType),e.extensionId&&Lr()&&(t.extensionId=e.extensionId);const{displaySurface:r,selfBrowserSurface:i,surfaceSwitching:n,systemAudio:o,preferCurrentTab:s,windowAudio:a,monitorTypeSurfaces:c}=e;(Vr(107)||Br(107)||Gr(93))&&(r&&(oi(r,"displaySurface",["browser","window","monitor"]),t.displaySurface=r),i?(oi(i,"selfBrowserSurface",["exclude","include"]),t.selfBrowserSurface=i):t.selfBrowserSurface="include",n&&(oi(n,"surfaceSwitching",["exclude","include"]),t.surfaceSwitching=n)),(Vr(105)||Br(105)||Gr(91))&&o&&(oi(o,"systemAudio",["exclude","include"]),t.systemAudio=o),(Vr(94)||Br(94)||Gr(80))&&s&&(t.preferCurrentTab=!0),(Vr(141)||Br(141)||Gr(125))&&a&&(oi(a,"windowAudio",["exclude","system"]),t.windowAudio=a),(Vr(119)||Br(119)||Gr(105))&&c&&(oi(c,"monitorTypeSurfaces",["exclude","include"]),t.monitorTypeSurfaces=c),e.electronScreenSourceId&&(t.sourceId=e.electronScreenSourceId);const d=e.encoderConfig?Ad(e.encoderConfig):null;return t.mandatory={chromeMediaSource:"desktop",maxWidth:d?d.width:void 0,maxHeight:d?d.height:void 0},d&&(d.frameRate&&("number"==typeof d.frameRate?(t.mandatory.maxFrameRate=d.frameRate,t.mandatory.minFrameRate=d.frameRate):(t.mandatory.maxFrameRate=d.frameRate.max||d.frameRate.ideal||d.frameRate.exact||void 0,t.mandatory.minFrameRate=d.frameRate.min||d.frameRate.ideal||d.frameRate.exact||void 0),t.frameRate=d.frameRate),d.width&&(t.width=d.width),d.height&&(t.height=d.height)),t}function zA(e){const t={};return Xr()||(void 0!==e.AGC&&(t.autoGainControl=e.AGC),void 0!==e.AEC&&(t.echoCancellation=e.AEC),void 0!==e.ANS&&(t.noiseSuppression=e.ANS,Lr()&&e.ANS&&(t.googHighpassFilter=e.ANS))),t}function XA(e){const t=zA(e);return jn()&&e.suppressLocalAudioPlayback&&(t.suppressLocalAudioPlayback=e.suppressLocalAudioPlayback),Gn()&&e.restrictOwnAudio&&(t.restrictOwnAudio=!0),t}function ZA(e){const t=zA(e);if(e.encoderConfig){const r=Od(e.encoderConfig);t.channelCount=r.stereo?2:1,t.sampleRate=r.sampleRate,t.sampleSize=r.sampleSize}return e.microphoneId&&(t.deviceId={exact:e.microphoneId}),Qr()&&(t.sampleRate=void 0),t}var JA=Es,QA=TypeError,qA=ql,$A=Math.floor,eb=function(e,t){var r=e.length,i=$A(r/2);return r<8?tb(e,t):rb(e,eb(qA(e,0,i),t),eb(qA(e,i),t),t)},tb=function(e,t){for(var r,i,n=e.length,o=1;o<n;){for(i=o,r=e[o];i&&t(e[i-1],r)>0;)e[i]=e[--i];i!==o++&&(e[i]=r)}return e},rb=function(e,t,r,i){for(var n=t.length,o=r.length,s=0,a=0;s<n||a<o;)e[s+a]=s<n&&a<o?i(t[s],r[a])<=0?t[s++]:r[a++]:s<n?t[s++]:r[a++];return e},ib=eb,nb=Jo.match(/firefox\/(\d+)/i),ob=!!nb&&+nb[1],sb=/MSIE|Trident/.test(Jo),ab=Jo.match(/AppleWebKit\/(\d+)\./),cb=!!ab&&+ab[1],db=mc,ub=Jn,lb=gs,hb=xs,pb=wc,fb=function(e,t){if(!delete e[t])throw QA("Cannot delete property "+JA(t)+" of "+JA(e))},Eb=td,mb=Hn,_b=ib,Tb=P_,gb=ob,Sb=sb,Rb=is,yb=cb,vb=[],Ab=ub(vb.sort),bb=ub(vb.push),Ib=mb((function(){vb.sort(void 0)})),Ob=mb((function(){vb.sort(null)})),Cb=Tb("sort"),wb=!mb((function(){if(Rb)return Rb<70;if(!(gb&&gb>3)){if(Sb)return!0;if(yb)return yb<603;var e,t,r,i,n="";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(i=0;i<47;i++)vb.push({k:t+i,v:r})}for(vb.sort((function(e,t){return t.v-e.v})),i=0;i<vb.length;i++)t=vb[i].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return"DGBEFHACIJK"!==n}}));db({target:"Array",proto:!0,forced:Ib||!Ob||!Cb||!wb},{sort:function(e){void 0!==e&&lb(e);var t=hb(this);if(wb)return void 0===e?Ab(t):Ab(t,e);var r,i,n=[],o=pb(t);for(i=0;i<o;i++)i in t&&bb(n,t[i]);for(_b(n,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:Eb(t)>Eb(r)?1:-1}}(e)),r=pb(n),i=0;i<r;)t[i]=n[i++];for(;i<o;)fb(t,i++);return t}});var Nb=xc("Array").sort,Db=Qn,Pb=Nb,Lb=Array.prototype,kb=Z((function(e){var t=e.sort;return e===Lb||Db(Lb,e)&&t===Lb.sort?Pb:t}));function Mb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function Ub(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Mb(Object(r),!0).forEach((function(t){N_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Mb(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function xb(e,t,r){const i=4*Math.floor(2e5*Math.pow(r/15,.6)*Math.pow(e*t/230400,.75)),n=e*t,o=new Map([[19200,.9],[230400,.85],[518400,.75],[921600,.7],[2073600,.6],[3686400,.5]]),s=new Map([[230400,.95],[518400,.9],[921600,.85],[2073600,.8]]);let a=MA(o).call(o).next().value,c=1;if(o.has(n))a=o.get(n);else{var d;const e=kb(d=Array.from(o.entries())).call(d,((e,t)=>{let[r]=e,[i]=t;return r-i})),t=e.find((e=>{let[t]=e;return t>n}));if(t){const r=e.indexOf(t);if(r>0){const i=e[r-1],o=(n-i[0])/(t[0]-i[0]);a=i[1]+o*(t[1]-i[1])}else a=t[1]}else a=e[e.length-1][1]}if(s.has(n))c=s.get(n);else{var u;const e=kb(u=Array.from(s.entries())).call(u,((e,t)=>{let[r]=e,[i]=t;return r-i})),t=e.find((e=>{let[t]=e;return t>n}));if(t){const r=e.indexOf(t);if(r>0){const i=e[r-1],o=(n-i[0])/(t[0]-i[0]);c=i[1]+o*(t[1]-i[1])}else c=t[1]}else c=e[e.length-1][1]}const l=ln("VIDEO_NEW_BITRATE_RATIO");l&&l>0&&(a=l/100);const h=Math.floor(i*a),p=Math.floor(65e4*Math.pow(e*t/230400,.5)*Math.pow(r/15,.69));let f=h;const E=ln("VIDEO_STANDARD_BITRATE_VERSION");return E&&E>0&&(1===E?f=i:2===E?f=h:3===E&&(f=p)),[Math.floor(f/1e3),c]}function Vb(e,t,r){if(!Array.isArray(ln("VIDEO_ENCODER_CONFIG_LIST")))return!1;if(0===ln("VIDEO_ENCODER_CONFIG_LIST").length)return!1;const i=Math.min(e,t);if(i>=480)return!1;return Ub(Ub({},ln("VIDEO_ENCODER_CONFIG_LIST").find((e=>e.height>i))),{},{frameRate:r})}function Fb(e,t,r,i,n){const o=ln("BITRATE_ADAPTER_TYPE");if("DEFAULT_BITRATE"===o)return{min:i,max:n};if(void 0===n){var s;const a=Math.floor(200*Math.pow(r/15,.6)*Math.pow(e*t/640/360,.75));n="STANDARD_BITRATE"===o?4*a:2*a,i=null!==(s=i)&&void 0!==s?s:a}else{var a;i=null!==(a=i)&&void 0!==a?a:Math.floor(n/10)}return{min:i,max:n}}function Bb(e,t,r){const i=200*Math.pow(r/15,.6)*Math.pow(e*t/640/360,.75);return{min:Math.floor(i),max:Math.floor(4*i)}}const jb=async(e,t,r)=>{const i=function(e){const t=[];for(let r=0;r<e.length;r+=2)t.push(parseInt(e.slice(r,r+2),16));return Uint8Array.from(t)}(function(e){const t="0123456789abcdef";function r(e){let r,i="";for(r=0;r<=3;r++)i+=t.charAt(e>>8*r+4&15)+t.charAt(e>>8*r&15);return i}function i(e,t){const r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function n(e,t,r,n,o,s){return i(function(e,t){return e<<t|e>>>32-t}(i(i(t,e),i(n,s)),o),r)}function o(e,t,r,i,o,s,a){return n(t&r|~t&i,e,t,o,s,a)}function s(e,t,r,i,o,s,a){return n(t&i|r&~i,e,t,o,s,a)}function a(e,t,r,i,o,s,a){return n(t^r^i,e,t,o,s,a)}function c(e,t,r,i,o,s,a){return n(r^(t|~i),e,t,o,s,a)}const d=function(e){let t;const r=1+(e.length+8>>6),i=new Array(16*r);for(t=0;t<16*r;t++)i[t]=0;for(t=0;t<e.length;t++)i[t>>2]|=e.charCodeAt(t)<<t%4*8;return i[t>>2]|=128<<t%4*8,i[16*r-2]=8*e.length,i}(e);let u,l,h,p,f,E=1732584193,m=-271733879,_=-1732584194,T=271733878;for(u=0;u<d.length;u+=16)l=E,h=m,p=_,f=T,E=o(E,m,_,T,d[u+0],7,-680876936),T=o(T,E,m,_,d[u+1],12,-389564586),_=o(_,T,E,m,d[u+2],17,606105819),m=o(m,_,T,E,d[u+3],22,-1044525330),E=o(E,m,_,T,d[u+4],7,-176418897),T=o(T,E,m,_,d[u+5],12,1200080426),_=o(_,T,E,m,d[u+6],17,-1473231341),m=o(m,_,T,E,d[u+7],22,-45705983),E=o(E,m,_,T,d[u+8],7,1770035416),T=o(T,E,m,_,d[u+9],12,-1958414417),_=o(_,T,E,m,d[u+10],17,-42063),m=o(m,_,T,E,d[u+11],22,-1990404162),E=o(E,m,_,T,d[u+12],7,1804603682),T=o(T,E,m,_,d[u+13],12,-40341101),_=o(_,T,E,m,d[u+14],17,-1502002290),m=o(m,_,T,E,d[u+15],22,1236535329),E=s(E,m,_,T,d[u+1],5,-165796510),T=s(T,E,m,_,d[u+6],9,-1069501632),_=s(_,T,E,m,d[u+11],14,643717713),m=s(m,_,T,E,d[u+0],20,-373897302),E=s(E,m,_,T,d[u+5],5,-701558691),T=s(T,E,m,_,d[u+10],9,38016083),_=s(_,T,E,m,d[u+15],14,-660478335),m=s(m,_,T,E,d[u+4],20,-405537848),E=s(E,m,_,T,d[u+9],5,568446438),T=s(T,E,m,_,d[u+14],9,-1019803690),_=s(_,T,E,m,d[u+3],14,-187363961),m=s(m,_,T,E,d[u+8],20,1163531501),E=s(E,m,_,T,d[u+13],5,-1444681467),T=s(T,E,m,_,d[u+2],9,-51403784),_=s(_,T,E,m,d[u+7],14,1735328473),m=s(m,_,T,E,d[u+12],20,-1926607734),E=a(E,m,_,T,d[u+5],4,-378558),T=a(T,E,m,_,d[u+8],11,-2022574463),_=a(_,T,E,m,d[u+11],16,1839030562),m=a(m,_,T,E,d[u+14],23,-35309556),E=a(E,m,_,T,d[u+1],4,-1530992060),T=a(T,E,m,_,d[u+4],11,1272893353),_=a(_,T,E,m,d[u+7],16,-155497632),m=a(m,_,T,E,d[u+10],23,-1094730640),E=a(E,m,_,T,d[u+13],4,681279174),T=a(T,E,m,_,d[u+0],11,-358537222),_=a(_,T,E,m,d[u+3],16,-722521979),m=a(m,_,T,E,d[u+6],23,76029189),E=a(E,m,_,T,d[u+9],4,-640364487),T=a(T,E,m,_,d[u+12],11,-421815835),_=a(_,T,E,m,d[u+15],16,530742520),m=a(m,_,T,E,d[u+2],23,-995338651),E=c(E,m,_,T,d[u+0],6,-198630844),T=c(T,E,m,_,d[u+7],10,1126891415),_=c(_,T,E,m,d[u+14],15,-1416354905),m=c(m,_,T,E,d[u+5],21,-57434055),E=c(E,m,_,T,d[u+12],6,1700485571),T=c(T,E,m,_,d[u+3],10,-1894986606),_=c(_,T,E,m,d[u+10],15,-1051523),m=c(m,_,T,E,d[u+1],21,-2054922799),E=c(E,m,_,T,d[u+8],6,1873313359),T=c(T,E,m,_,d[u+15],10,-30611744),_=c(_,T,E,m,d[u+6],15,-1560198380),m=c(m,_,T,E,d[u+13],21,1309151649),E=c(E,m,_,T,d[u+4],6,-145523070),T=c(T,E,m,_,d[u+11],10,-1120210379),_=c(_,T,E,m,d[u+2],15,718787259),m=c(m,_,T,E,d[u+9],21,-343485551),E=i(E,l),m=i(m,h),_=i(_,p),T=i(T,f);return r(E)+r(m)+r(_)+r(T)}(""+t+r)).slice(0,16),n=i.slice(0,12),o=await window.crypto.subtle.importKey("raw",i,"AES-GCM",!0,["encrypt"]);return new Uint8Array(await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},o,e))},Gb=e=>{const t=document.createElement("canvas");return t.width=2,t.height=2,new jv(((r,i)=>{t.toBlob((async e=>{if(t.remove(),e){const i=await Wb(e);r({buffer:i,width:t.width,height:t.height})}else i(new ii(ri.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,1)}))},Wb=async e=>{const t=await e.arrayBuffer();return new Uint8Array(t)};function Hb(e,t){if("VideoFrame"in window&&"TransformStream"in window&&Un().supportWebRTCInsertableStream){const r=new MediaStreamTrackProcessor(e),i=new MediaStreamTrackGenerator({kind:"video"});let n,o,s=Date.now();const a=()=>{c&&(clearInterval(c),c=void 0),n&&(n.close(),n=void 0),e.stop(),o=void 0,i.removeEventListener("ended",a)};let c=window.setInterval((()=>{if(o&&n&&Date.now()-s>(null!=t?t:1e3))try{"live"===i.readyState?o.enqueue(n.clone()):a()}catch(e){a()}}),null!=t?t:1e3);const d=new TransformStream({transform:(e,t)=>{"live"===i.readyState?(o=t,s=Date.now(),void 0===n?(n=e,t.enqueue(e.clone())):(t.enqueue(n),n=e)):e.close()}});return i.addEventListener("ended",a),r.readable.pipeThrough(d).pipeTo(i.writable),i}}var Kb,Yb,zb,Xb,Zb,Jb,Qb,qb,$b,eI,tI,rI,iI,nI,oI,sI,aI,cI,dI,uI,lI,hI,pI,fI,EI,mI,_I,TI,gI,SI,RI,yI,vI,AI,bI,II,OI,CI,wI,NI;function DI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function PI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?DI(Object(r),!0).forEach((function(t){N_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):DI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let LI=(Kb=Pn({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),Yb=Pn({argsMap:(e,t)=>[e.getTrackId(),t]}),zb=OA(),Xb=Zi("LocalAudioTrack","_enabledMutex"),Zb=Pn({argsMap:(e,t)=>[e.getTrackId(),t]}),Jb=OA(),Qb=Zi("LocalAudioTrack","_enabledMutex"),qb=Pn({argsMap:(e,t)=>[e.getTrackId(),t]}),$b=OA(),eI=OA(),tI=OA(),rI=Pn({argsMap:e=>[e.getTrackId()]}),iI=OA(),nI=Pn({argsMap:e=>[e.getTrackId()]}),oI=OA(),sI=Pn({argsMap:e=>[e.getTrackId()]}),aI=Pn({argsMap:(e,t)=>[e.getTrackId(),t.name]}),cI=Pn({argsMap:e=>[e.getTrackId()]}),dI=class extends Wv{get _source(){return this.initWebAudio()}set _source(e){this._trackSource=e}get processorContext(){return this._processorContext||(this._processorContext=this.initProcessor().processorContext),this._processorContext}get processorDestination(){return this._processorDestination||(this._processorDestination=this.initProcessor().processorDestination),this._processorDestination}get isPlaying(){return this._useAudioElement?IA.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"LocalAudioTrack"}constructor(e,t,r,i){super(e,r),N_(this,"trackMediaType",Wd.AUDIO),N_(this,"_encoderConfig",void 0),N_(this,"_trackSource",void 0),N_(this,"metadata",[]),N_(this,"pts",[]),N_(this,"_enabled",!0),N_(this,"_volume",100),N_(this,"_useAudioElement",!0),N_(this,"_bypassWebAudio",!1),N_(this,"processor",void 0),N_(this,"_processorContext",void 0),N_(this,"_processorDestination",void 0),N_(this,"_getOriginVolumeLevel",void 0),this._encoderConfig=t,this._getOriginVolumeLevel=!!i,this._trackSource=new GA,ln("DISABLE_WEBAUDIO")&&(this._bypassWebAudio=!0),ln("LOCAL_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1);kr()&&!qv()?setTimeout((()=>this.initWebAudio())):this.initWebAudio()}setVolume(e){si(e,"volume",0,1e3),this._volume=e,this._source.setVolume(e/100),this._useAudioElement&&IA.setVolume(this.getTrackId(),e);try{if(this._bypassWebAudio)return void In.debug("[".concat(this.getTrackId(),"] setVolume returned because no pass through WebAudio."));const e=this._source.createOutputTrack();this._mediaStreamTrack!==e&&(this._mediaStreamTrack=e,yi(this,Md.NEED_REPLACE_TRACK,this).then((()=>{In.debug("[".concat(this.getTrackId(),"] replace web audio track success"))})).catch((e=>{In.warning("[".concat(this.getTrackId(),"] replace web audio track failed"),e)})))}catch(e){}}getVolumeLevel(){return this._muted&&this.enabled&&this._getOriginVolumeLevel?this._source.getOriginVolumeLevel():this._source.getAccurateVolumeLevel()}async setPlaybackDevice(e){if(!this._useAudioElement||!Vn())throw new ii(ri.NOT_SUPPORTED,"your browser does not support setting the audio output device");await IA.setSinkID(this.getTrackId(),e)}async setEnabled(e,t,r){return this._setEnabled(e,t,r)}async _setEnabled(e,t,r){if(!r){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(In.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){this._originMediaStreamTrack.enabled=!0;try{r||(this._enabled=!0),await yi(this,Md.NEED_ENABLE_TRACK,this),In.info("[".concat(this.getTrackId(),"] setEnabled to ").concat(e," success"))}catch(e){throw r||(this._enabled=!1),In.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}}else{this._originMediaStreamTrack.enabled=!1,r||(this._enabled=!1);try{await yi(this,Md.NEED_DISABLE_TRACK,this)}catch(e){throw r||(this._enabled=!0),In.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}}}async setMuted(e){e!==this._muted&&(this.stateCheck("muted",e),this._muted=e,this._originMediaStreamTrack.enabled=!e,In.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await yi(this,Md.NEED_MUTE_TRACK,this):await yi(this,Md.NEED_UNMUTE_TRACK,this))}getStats(){Mi((()=>{In.warning("[deprecated] LocalAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalAudioStats instead")}),"localAudioTrackGetStatsWarning");const e=vi(this,Md.GET_STATS);return e||PI({},Yd)}setAudioFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners(Hd.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(Hd.ON_AUDIO_BUFFER),this._source.on(Hd.ON_AUDIO_BUFFER,(t=>e(t)))}play(){In.debug("[".concat(this.getTrackId(),"] start audio playback")),this._useAudioElement?(In.debug("[".concat(this.getTrackId(),"] start audio playback in element")),IA.play(this._mediaStreamTrack,this.getTrackId(),this._volume)):this._source.play()}stop(){In.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._useAudioElement?IA.stop(this.getTrackId()):this._source.stop()}close(){super.close(),this._processorDestination&&this.unbindProcessorDestinationEvents(this._processorDestination),this._processorContext&&this.unbindProcessorContextEvents(this._processorContext),this.unpipe(),this._processorDestination&&this._processorDestination._source&&this._processorDestination._source.unpipe(),this._source.destroy()}_updatePlayerSource(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];In.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&IA.updateTrack(this.getTrackId(),this._mediaStreamTrack)}async _updateOriginMediaStreamTrack(e,t){this._originMediaStreamTrack!==e&&(this._originMediaStreamTrack&&(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),t&&this._originMediaStreamTrack.stop()),e.addEventListener("ended",this._handleTrackEnded),this._originMediaStreamTrack=e,this._muted&&(this._originMediaStreamTrack.enabled=!1),this.processor&&this._processorContext&&this.processor.updateInput({track:e,context:this._processorContext}),this._mediaStreamTrack!==this._source.outputTrack?(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await yi(this,Md.NEED_REPLACE_TRACK,this)):this._source.updateTrack(this._originMediaStreamTrack),this._getOriginVolumeLevel&&this._source.updateOriginTrack(e))}renewMediaStreamTrack(e){return jv.resolve(void 0)}pipe(e){if(this._bypassWebAudio)throw new ii(ri.INVALID_OPERATION,"Can not process AudioTrack when bypassWebAudio set to true.");if(this.processor===e)return e;if(e._source)throw new ii(ri.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,node:this._source.processSourceNode,context:this.processorContext}),e}unpipe(){var e;if(!this.processor)return;const t=this.processor;null===(e=this._source.processSourceNode)||void 0===e||e.disconnect(),this.processor._source=!1,this.processor=void 0,t.reset()}bindProcessorDestinationEvents(e){e.on(Jd.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(!1),this._source.processedNode=this._source.createMediaStreamSourceNode(e),await yi(this,Md.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await yi(this,Md.NEED_REPLACE_TRACK,this))})),e.on(Jd.ON_NODE,(e=>{this._source.processedNode=e}))}unbindProcessorDestinationEvents(e){e.removeAllListeners(Jd.ON_TRACK),e.removeAllListeners(Jd.ON_NODE)}bindProcessorContextEvents(e){e.on(Qd.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}unbindProcessorContextEvents(e){e.removeAllListeners(Qd.REQUEST_CONSTRAINTS)}initWebAudio(){return this._trackSource instanceof GA&&(this._trackSource=new aA(this._mediaStreamTrack,!1,this._getOriginVolumeLevel?this._mediaStreamTrack:void 0)),this._trackSource}initProcessor(){const e=new jA(this._source.context,this.getTrackId(),"local"),t=new BA(e);return this._processorContext=e,this._processorDestination=t,this.bindProcessorContextEvents(e),this.bindProcessorDestinationEvents(t),this._source.on(Hd.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:e})})),this._useAudioElement&&(this._useAudioElement=!1,this.isPlaying&&(IA.stop(this.getTrackId()),this._source.play()),yi(this,Md.NEED_REPLACE_MIXING_TRACK,this).then((()=>{In.debug("[".concat(this.getTrackId(),"] replace from origin track to web audio track success"))})).catch((e=>{In.warning("[".concat(this.getTrackId(),"] replace from origin track to web audio track failed"),e)}))),{processorContext:e,processorDestination:t}}},UT(dI.prototype,"setVolume",[Kb],Object.getOwnPropertyDescriptor(dI.prototype,"setVolume"),dI.prototype),UT(dI.prototype,"setPlaybackDevice",[Yb,zb],Object.getOwnPropertyDescriptor(dI.prototype,"setPlaybackDevice"),dI.prototype),UT(dI.prototype,"setEnabled",[Xb,Zb,Jb],Object.getOwnPropertyDescriptor(dI.prototype,"setEnabled"),dI.prototype),UT(dI.prototype,"setMuted",[Qb,qb,$b],Object.getOwnPropertyDescriptor(dI.prototype,"setMuted"),dI.prototype),UT(dI.prototype,"getStats",[eI],Object.getOwnPropertyDescriptor(dI.prototype,"getStats"),dI.prototype),UT(dI.prototype,"setAudioFrameCallback",[tI],Object.getOwnPropertyDescriptor(dI.prototype,"setAudioFrameCallback"),dI.prototype),UT(dI.prototype,"play",[rI,iI],Object.getOwnPropertyDescriptor(dI.prototype,"play"),dI.prototype),UT(dI.prototype,"stop",[nI,oI],Object.getOwnPropertyDescriptor(dI.prototype,"stop"),dI.prototype),UT(dI.prototype,"close",[sI],Object.getOwnPropertyDescriptor(dI.prototype,"close"),dI.prototype),UT(dI.prototype,"pipe",[aI],Object.getOwnPropertyDescriptor(dI.prototype,"pipe"),dI.prototype),UT(dI.prototype,"unpipe",[cI],Object.getOwnPropertyDescriptor(dI.prototype,"unpipe"),dI.prototype),dI),kI=(uI=Pn({argsMap:(e,t)=>[e.getTrackId(),t]}),lI=OA(),hI=Zi("MicrophoneAudioTrack","_enabledMutex"),pI=Pn({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),fI=OA(),EI=Pn({argsMap:e=>[e.getTrackId()]}),mI=class extends LI{get __className__(){return"MicrophoneAudioTrack"}constructor(e,t,r,i){super(e,t.encoderConfig?Od(t.encoderConfig):{},i,ln("GET_VOLUME_OF_MUTED_AUDIO_TRACK")),N_(this,"_config",void 0),N_(this,"_deviceName","default"),N_(this,"_constraints",void 0),N_(this,"_originalConstraints",void 0),N_(this,"_enabled",!0),this._config=t,this._constraints=r,this._originalConstraints=r,this._deviceName=e.label,"boolean"==typeof t.bypassWebAudio&&(this._bypassWebAudio=t.bypassWebAudio),(Wr()||Hr())&&Xv.bindInterruptDetectorTrack(this)}async setDevice(e){if(In.info("[".concat(this.getTrackId(),"] start set device to ").concat(e)),this._enabled)try{const t=await TA.getDeviceById(e),r={};r.audio=PI({},this._constraints),r.audio.deviceId={exact:e},this._originMediaStreamTrack.stop();let i=null;try{i=await pA(r,this.getTrackId())}catch(e){throw In.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),i=await pA({audio:this._constraints},this.getTrackId()),await this._updateOriginMediaStreamTrack(i.getAudioTracks()[0],!1),e}await this._updateOriginMediaStreamTrack(i.getAudioTracks()[0],!1),this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(e){throw In.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await TA.getDeviceById(e);this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(e){throw In.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}In.info("[".concat(this.getTrackId(),"] set device to ").concat(e," success"))}async setEnabled(e,t,r){if(t)return In.debug("[".concat(this.getTrackId(),"] setEnabled false (do not close microphone)")),await super._setEnabled(e);if(!r){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(In.info("[".concat(this.getTrackId(),"] start setEnabled"),e),ln("AUTO_RESET_AUDIO_ROUTE")&&(xr()||Yr())){const t=navigator.audioSession;t&&(e||(t.type="playback"),t.type="auto")}if(!e){var i;this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop(),null===(i=this._source.clonedTrack)||void 0===i||i.stop(),r||(this._enabled=!1);try{await yi(this,Md.NEED_DISABLE_TRACK,this)}catch(e){throw In.error("[".concat(this.getTrackId(),"] setEnabled false failed"),e.toString()),e}return}const n=PI({},this._constraints),o=TA.searchDeviceIdByName(this._deviceName);o&&!n.deviceId&&(n.deviceId=o);try{r||(this._enabled=!0);const e=await pA({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!1),await yi(this,Md.NEED_ENABLE_TRACK,this)}catch(e){throw r||(this._enabled=!1),In.error("[".concat(this.getTrackId(),"] setEnabled true failed"),e.toString()),e}In.info("[".concat(this.getTrackId(),"] setEnabled success"))}close(){super.close(),(Wr()||Hr())&&Xv.unbindInterruptDetectorTrack(this),Dd()||Jv()}onTrackEnded(){if((xr()||Yr())&&this._enabled&&!this._isClosed&&Xv.duringInterruption){const e=async()=>{Xv.off(Wn.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(In.debug("[".concat(this.getTrackId(),"] try capture microphone media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};Xv.on(Wn.IOS_INTERRUPTION_END,e)}else In.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(jd.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=TA.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId=r),this._constraints=t,this._enabled){this._originMediaStreamTrack.stop();const e=await pA({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!0)}}bindProcessorContextEvents(e){super.bindProcessorContextEvents(e),e.on(Qd.REQUEST_UPDATE_CONSTRAINTS,(async(e,t,r)=>{try{const r=Object.assign({},this._originalConstraints,...e);await this.renewMediaStreamTrack(r),t()}catch(e){r(e)}}))}unbindProcessorContextEvents(e){super.unbindProcessorContextEvents(e),e.removeAllListeners(Qd.REQUEST_UPDATE_CONSTRAINTS)}},UT(mI.prototype,"setDevice",[uI,lI],Object.getOwnPropertyDescriptor(mI.prototype,"setDevice"),mI.prototype),UT(mI.prototype,"setEnabled",[hI,pI,fI],Object.getOwnPropertyDescriptor(mI.prototype,"setEnabled"),mI.prototype),UT(mI.prototype,"close",[EI],Object.getOwnPropertyDescriptor(mI.prototype,"close"),mI.prototype),mI),MI=(_I=Pn({argsMap:(e,t)=>[e.getTrackId(),t,e.duration]}),TI=OA(),gI=Pn({argsMap:e=>[e.getTrackId()]}),SI=OA(),RI=Pn({argsMap:e=>[e.getTrackId()]}),yI=OA(),vI=Pn({argsMap:e=>[e.getTrackId()]}),AI=OA(),bI=Pn({argsMap:e=>[e.getTrackId()]}),II=OA(),OI=Pn({argsMap:e=>[e.getTrackId()]}),CI=Pn({argsMap:e=>[e.getTrackId()]}),wI=OA(),UT((NI=class extends LI{get __className__(){return"BufferSourceAudioTrack"}constructor(e,t,r,i){super(t.createOutputTrack(),r,i),N_(this,"source",void 0),N_(this,"_bufferSource",void 0),this._useAudioElement=!1,this.source=e,this._bufferSource=t,this._bufferSource.on(Hd.AUDIO_SOURCE_STATE_CHANGE,(e=>{this.safeEmit(jd.SOURCE_STATE_CHANGE,e)}));try{this._mediaStreamTrack=this._source.createOutputTrack()}catch(e){}}get currentState(){return this._bufferSource.currentState}get duration(){return this._bufferSource.duration}get playbackSpeed(){return this._bufferSource.playbackSpeed}getCurrentTime(){return this._bufferSource.currentTime}startProcessAudioBuffer(e){e&&this._bufferSource.updateOptions(e),this._bufferSource.startProcessAudioBuffer()}pauseProcessAudioBuffer(){this._bufferSource.pauseProcessAudioBuffer()}seekAudioBuffer(e){this._bufferSource.seekAudioBuffer(e)}resumeProcessAudioBuffer(){this._bufferSource.resumeProcessAudioBuffer()}stopProcessAudioBuffer(){this._bufferSource.stopProcessAudioBuffer()}close(){this.source=null,this._bufferSource.destroy(),super.close()}setAudioBufferPlaybackSpeed(e){si(e,"speed",0),this._bufferSource.setAudioBufferPlaybackSpeed(e)}}).prototype,"startProcessAudioBuffer",[_I,TI],Object.getOwnPropertyDescriptor(NI.prototype,"startProcessAudioBuffer"),NI.prototype),UT(NI.prototype,"pauseProcessAudioBuffer",[gI,SI],Object.getOwnPropertyDescriptor(NI.prototype,"pauseProcessAudioBuffer"),NI.prototype),UT(NI.prototype,"seekAudioBuffer",[RI,yI],Object.getOwnPropertyDescriptor(NI.prototype,"seekAudioBuffer"),NI.prototype),UT(NI.prototype,"resumeProcessAudioBuffer",[vI,AI],Object.getOwnPropertyDescriptor(NI.prototype,"resumeProcessAudioBuffer"),NI.prototype),UT(NI.prototype,"stopProcessAudioBuffer",[bI,II],Object.getOwnPropertyDescriptor(NI.prototype,"stopProcessAudioBuffer"),NI.prototype),UT(NI.prototype,"close",[OI],Object.getOwnPropertyDescriptor(NI.prototype,"close"),NI.prototype),UT(NI.prototype,"setAudioBufferPlaybackSpeed",[CI,wI],Object.getOwnPropertyDescriptor(NI.prototype,"setAudioBufferPlaybackSpeed"),NI.prototype),NI);class UI extends LI{get __className__(){return"MixingAudioTrack"}get isActive(){for(const e of this.trackList)if(e._enabled&&!e._isClosed&&!e.muted)return!0;return!1}constructor(){const e=Qv().createMediaStreamDestination();super(e.stream.getAudioTracks()[0],void 0,Vi(8,"track-mix-")),N_(this,"trackList",void 0),N_(this,"destNode",void 0),this._useAudioElement=!1;try{this._mediaStreamTrack=this._source.createOutputTrack()}catch(e){}this.destNode=e,this.trackList=[]}hasAudioTrack(e){return-1!==this.trackList.indexOf(e)}addAudioTrack(e){-1===this.trackList.indexOf(e)?(In.debug("add ".concat(e.getTrackId()," to mixing track")),e._source.outputNode.connect(this.destNode),this.trackList.push(e),this.updateEncoderConfig()):In.debug("track ".concat(e.getTrackId()," is already added"))}removeAudioTrack(e){if(-1!==this.trackList.indexOf(e)){In.debug("remove ".concat(e.getTrackId()," from mixing track"));try{e._source.outputNode.disconnect(this.destNode)}catch(e){}Ni(this.trackList,e),this.updateEncoderConfig()}}updateEncoderConfig(){const e={};this.trackList.forEach((t=>{t._encoderConfig&&((t._encoderConfig.bitrate||0)>(e.bitrate||0)&&(e.bitrate=t._encoderConfig.bitrate),(t._encoderConfig.sampleRate||0)>(e.sampleRate||0)&&(e.sampleRate=t._encoderConfig.sampleRate),(t._encoderConfig.sampleSize||0)>(e.sampleSize||0)&&(e.sampleSize=t._encoderConfig.sampleSize),t._encoderConfig.stereo&&(e.stereo=!0))})),this._encoderConfig=e}_updateRtpTransceiver(e){this._rtpTransceiver!==e&&(this._rtpTransceiver=e,this.trackList.forEach((t=>{t instanceof UI?t.emit(Bd.TRANSCEIVER_UPDATED,e):t._updateRtpTransceiver(e)})))}}class xI extends sA{set currentState(e){e!==this._currentState&&(this._currentState=e,this.safeEmit(Hd.AUDIO_SOURCE_STATE_CHANGE,this._currentState))}get currentState(){return this._currentState}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),N_(this,"audioBuffer",void 0),N_(this,"sourceNode",void 0),N_(this,"startPlayTime",0),N_(this,"startPlayOffset",0),N_(this,"pausePlayTime",0),N_(this,"options",void 0),N_(this,"currentLoopCount",0),N_(this,"currentPlaybackSpeed",100),N_(this,"_currentState","stopped"),this.audioBuffer=e,this.options=t,this.startPlayOffset=this.options.startPlayTime||0}createWebAudioDiagram(){return this.context.createGain()}get duration(){return this.audioBuffer?this.audioBuffer.duration:0}get playbackSpeed(){return this.currentPlaybackSpeed}get currentTime(){return this.audioBuffer?"stopped"===this.currentState?0:"paused"===this.currentState?this.pausePlayTime:((this.context.currentTime-this.startPlayTime)*(this.playbackSpeed/100)+this.startPlayOffset)%this.audioBuffer.duration:0}updateOptions(e){"stopped"===this.currentState?(this.options=e,this.startPlayOffset=this.options.startPlayTime||0):In.warning("can not set audio source options")}startProcessAudioBuffer(){this.sourceNode&&this.stopProcessAudioBuffer(),this.sourceNode=this.createSourceNode(),this.startSourceNode(),this.currentState="playing"}pauseProcessAudioBuffer(){this.sourceNode&&"playing"===this.currentState&&(this.pausePlayTime=this.currentTime,this.sourceNode.onended=null,this.sourceNode.stop(),this.sourceNode.buffer=null,this.sourceNode=this.createSourceNode(),this.currentState="paused")}seekAudioBuffer(e){this.sourceNode&&(this.sourceNode.onended=null,"playing"===this.currentState&&this.sourceNode.stop(),this.sourceNode=this.createSourceNode(),"playing"===this.currentState?(this.startPlayOffset=e,this.startSourceNode()):"paused"===this.currentState&&(this.pausePlayTime=e))}resumeProcessAudioBuffer(){"paused"===this.currentState&&this.sourceNode&&(this.startPlayOffset=this.pausePlayTime,this.pausePlayTime=0,this.startSourceNode(),this.currentState="playing")}stopProcessAudioBuffer(){if(this.sourceNode){this.sourceNode.onended=null;try{this.sourceNode.stop()}catch(e){}this.reset()}}destroy(){this.audioBuffer=null,super.destroy()}setAudioBufferPlaybackSpeed(e){this.sourceNode&&("playing"===this.currentState&&(this.startPlayOffset=this.currentTime,this.startPlayTime=this.context.currentTime),this.sourceNode.playbackRate.value=e/100),this.currentPlaybackSpeed=e}startSourceNode(){this.sourceNode&&this.sourceNode.buffer&&(this.sourceNode.start(0,this.startPlayOffset),this.startPlayTime=this.context.currentTime,this.sourceNode.onended=this.handleSourceNodeEnded.bind(this))}createSourceNode(){const e=this.context.createBufferSource();return e.buffer=this.audioBuffer,e.loop=!!this.options.loop,e.connect(this.outputNode),e.playbackRate.value=this.currentPlaybackSpeed/100,e}handleSourceNodeEnded(){if(this.currentLoopCount+=1,this.options.cycle&&this.options.cycle>this.currentLoopCount)return this.startPlayOffset=0,this.sourceNode=void 0,void this.startProcessAudioBuffer();this.reset()}reset(){this.startPlayOffset=this.options.startPlayTime||0,this.currentState="stopped",this.sourceNode&&(this.sourceNode.disconnect(),this.sourceNode=void 0),this.currentLoopCount=0}}const VI=new Map;function FI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function BI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?FI(Object(r),!0).forEach((function(t){N_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):FI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function jI(e,t){if(0===e.length||0===t.length)return 1/0;const r=Ki(e),i=Ki(t);return Math.floor(i/r)}class GI{get rendFrameRate(){const e=Math.max(1,jI(this._render_interframe_delays_sizes,this._render_interframe_delays));return Math.floor(1e3/e)}get videoElementStatus(){return this._isInPage?this._videoElementStatus:eu.DESTROYED}set videoElementStatus(e){e!==this._videoElementStatus&&(In.debug("[".concat(this.trackId,"] video-element-status change ").concat(this._videoElementStatus," => ").concat(e)),this._videoElementStatus=e)}get videoState(){return this._videoState}set videoState(e){var t;e!==this._videoState&&(this._videoState=e,null===(t=this.onVideoStateChanged)||void 0===t||t.call(this,this.videoState))}constructor(e){N_(this,"trackId",void 0),N_(this,"config",void 0),N_(this,"onFirstVideoFrameDecoded",void 0),N_(this,"onFirstVideoFrameRender",void 0),N_(this,"onVideoBufferReady",void 0),N_(this,"onVideoStateChanged",void 0),N_(this,"freezeTimeCounterList",[]),N_(this,"renderFreezeAccTime",0),N_(this,"renderFreezeAccTime2",0),N_(this,"isKeepLastFrame",!1),N_(this,"isDestroyed",!1),N_(this,"timeUpdatedCount",0),N_(this,"freezeTime",0),N_(this,"playbackTime",0),N_(this,"lastTimeUpdatedTime",0),N_(this,"autoplayFailed",!1),N_(this,"videoTrack",void 0),N_(this,"videoElement",void 0),N_(this,"cacheVideoElement",void 0),N_(this,"cancelRVFId",void 0),N_(this,"internal",!1),N_(this,"_render_interframe_delays",[]),N_(this,"_render_interframe_delays_sizes",[]),N_(this,"_videoState",tu.VideoStateStopped),N_(this,"videoElementCheckInterval",void 0),N_(this,"videoElementFreezeTimeout",void 0),N_(this,"_videoElementStatus",eu.NONE),N_(this,"_isInPage",!0),N_(this,"isGettingVideoDimensions",!1),N_(this,"startGetVideoDimensions",(()=>{const e=()=>{if(this.isGettingVideoDimensions=!0,this.videoElement.videoWidth*this.videoElement.videoHeight>4)return In.debug("[".concat(this.trackId,"] current video dimensions:"),this.videoElement.videoWidth,this.videoElement.videoHeight),void(this.isGettingVideoDimensions=!1);setTimeout(e,500)};!this.isGettingVideoDimensions&&e()})),N_(this,"autoResumeAfterInterruption",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&"running"===Xv.curState&&(In.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(Dr())),Kr()?(this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):(this.videoElement.pause(),this.videoElement.play()))})),N_(this,"handleVideoEvents",(e=>{switch(e.type){case"play":case"playing":"play"===e.type&&In.debug("[".concat(this.trackId,"] video element status: play")),this.startGetVideoDimensions(),this.videoElementStatus=eu.PLAYING;break;case"loadeddata":if(this.videoState=tu.VideoStateStarting,this.onFirstVideoFrameRender&&this.onFirstVideoFrameRender(),this.onFirstVideoFrameDecoded&&this.onFirstVideoFrameDecoded(),this.cacheVideoElement){try{this.cacheVideoElement.srcObject=null,this.cacheVideoElement.remove()}catch(e){}this.cacheVideoElement=void 0}break;case"canplay":this.videoElementStatus=eu.CANPLAY;break;case"stalled":this.videoElementStatus=eu.STALLED;break;case"suspend":this.videoElementStatus=eu.SUSPEND;break;case"pause":this.videoElementStatus=eu.PAUSED,xr()||Yr()||kr()&&this.autoplayFailed||!this.videoTrack||"live"!==this.videoTrack.readyState||(In.debug("[track-".concat(this.trackId,"] video element paused, auto resume")),this.videoElement.play());break;case"waiting":this.videoElementStatus=eu.WAITING;break;case"abort":this.videoElementStatus=eu.ABORT;break;case"ended":this.videoElementStatus=eu.ENDED;break;case"emptied":this.videoElementStatus=eu.EMPTIED;break;case"error":{const e=this.videoElement.error;e&&(this.videoElementStatus=eu.ERROR,In.error("[".concat(this.trackId,"] media error: ").concat(e.message," (").concat(e.code,")")));break}case"timeupdate":{const e=performance.now();if(this.timeUpdatedCount+=1,this.onVideoBufferReady&&this.timeUpdatedCount>ln("BUFFER_READY_FRAMES")&&this.onVideoBufferReady(),this.timeUpdatedCount<10)return void(this.lastTimeUpdatedTime=e);const t=e-this.lastTimeUpdatedTime,r=this.lastTimeUpdatedTime;if(this.lastTimeUpdatedTime=e,eC.lastVisibleTime<eC.lastHiddenTime||r<eC.lastHiddenTime||r<eC.lastVisibleTime)return;if(this.isSkipCalcRenderFreezeTime())return;for(t>ln("VIDEO_FREEZE_DURATION")&&(this.freezeTime+=t),this.playbackTime+=t;this.playbackTime>=6e3;){this.playbackTime-=6e3;const e=Math.min(6e3,this.freezeTime);this.freezeTimeCounterList.push(e),this.freezeTime=Math.max(0,this.freezeTime-6e3)}break}}})),N_(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&(In.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(Dr())),Kr()?(this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):(this.videoElement.pause(),this.videoElement.play()))})),this.trackId=e.trackId,this.config=e,e.element instanceof HTMLVideoElement?this.videoElement=e.element:this.videoElement=document.createElement("video"),Xv.on(Wn.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),Xv.on(Wn.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16)}getVideoElement(){return this.videoElement}getContainerElement(){var e;return null!==(e=this.videoElement.parentElement)&&void 0!==e?e:void 0}updateConfig(e){this.config=e,this.trackId=e.trackId,e.element!==this.videoElement&&(this.destroy(),this.videoElement=e.element),this.videoTrack&&this.initVideoElement()}updateVideoTrack(e){this.videoTrack!==e&&(this.videoTrack=e,this.initVideoElement())}play(e){const t=this.videoElement.play();t&&t.catch&&t.catch((t=>{e&&AA(e,"video",t.message,this.trackId),"NotAllowedError"===t.name?(In.warning("detected video element autoplay failed",t),this.autoplayFailed=!0,this.handleAutoPlayFailed()):In.warning("[".concat(this.trackId,"] play warning: "),t)}));const r=Cr();if(("Safari"===r.name&&15===Number(r.version)||Wr())&&t&&t.then){const e=()=>{this.config.mirror&&!this.config.noStyle&&(this.videoElement.style.transform="rotateY(180deg)")};t.then(e).catch(e)}}getCurrentFrame(){const e=document.createElement("canvas");e.width=this.videoElement.videoWidth,e.height=this.videoElement.videoHeight;const t=e.getContext("2d");if(!t)return In.error("create canvas context failed!"),new ImageData(2,2);t.drawImage(this.videoElement,0,0,e.width,e.height);const r=t.getImageData(0,0,e.width,e.height);return e.remove(),r}async getCurrentFrameToUint8Array(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const r=document.createElement("canvas");r.width=this.videoElement.videoWidth,r.height=this.videoElement.videoHeight;const i=r.getContext("2d");return i?(i.drawImage(this.videoElement,0,0,r.width,r.height),new jv(((i,n)=>{r.toBlob((async e=>{if(r.remove(),e){const t=await Wb(e);i({buffer:t,width:r.width,height:r.height})}else n(new ii(ri.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,t<0?.1:t>1?1:t)}))):await Gb(e)}destroy(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isDestroyed=!0,Xv.off(Wn.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),Xv.off(Wn.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),e?this.videoElement.pause():this.videoElement.srcObject=null,this.resetVideoElement(),this.freezeTimeCounterList=[],this.videoState=tu.VideoStateStopped}initVideoElement(){if(this.videoElementStatus=eu.INIT,!this.videoElementCheckInterval&&(WI.forEach((e=>{this.videoElement.addEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval=window.setInterval((()=>{this._isInPage=function(e){return e!==document.body&&document.body.contains(e)}(this.videoElement)}),1e3),ln("ENABLE_VIDEO_FRAME_CALLBACK"))){var e,t;let r;const i=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",i),this.videoElementFreezeTimeout=window.setTimeout(n,ln("VIDEO_FREEZE_DURATION")))},n=()=>{this.videoElementFreezeTimeout=void 0,this.videoState===tu.VideoStateDecoding&&("visible"===document.visibilityState?this.videoState=tu.VideoStateFrozen:document.addEventListener("visibilitychange",i))},o=(e,t)=>{if(this.videoElementStatus===eu.PLAYING){if(r){const e=t.presentationTime-r.presentationTime,i=t.presentedFrames-r.presentedFrames;this._render_interframe_delays_sizes.push(i),this._render_interframe_delays.push(e);const o=Ki(this._render_interframe_delays_sizes),s=o-this._render_interframe_delays_sizes[0];if(o>30&&s>5&&(this._render_interframe_delays_sizes.shift(),this._render_interframe_delays.shift()),this.videoState===tu.VideoStateStarting&&(this.videoState=tu.VideoStateDecoding),this.videoState===tu.VideoStateDecoding&&this.onVideoStateChanged&&(this.videoElementFreezeTimeout&&window.clearTimeout(this.videoElementFreezeTimeout),this.videoElementFreezeTimeout=window.setTimeout(n,ln("VIDEO_FREEZE_DURATION"))),e<ln("VIDEO_FREEZE_DURATION")&&this.videoState===tu.VideoStateFrozen&&(this.videoState=tu.VideoStateDecoding),e>ln("VIDEO_FREEZE_DURATION")&&eC.lastVisibleTime>=eC.lastHiddenTime&&r.timestamp>eC.lastVisibleTime&&r.timestamp>eC.lastHiddenTime){const t=Math.min(66,jI(this._render_interframe_delays_sizes,this._render_interframe_delays)),r=Math.max(0,e-(i-1)*t);this.renderFreezeAccTime2+=r>t?r:0,this.renderFreezeAccTime+=e}}r=BI(BI({},t),{},{timestamp:e})}else this.isSkipCalcRenderFreezeTime()&&(r=BI(BI({},t),{},{timestamp:e}));var i,s;ln("ENABLE_VIDEO_FRAME_CALLBACK")&&(this.cancelRVFId=null===(i=(s=this.videoElement).requestVideoFrameCallback)||void 0===i?void 0:i.call(s,o))};this.cancelRVFId=null===(e=(t=this.videoElement).requestVideoFrameCallback)||void 0===e?void 0:e.call(t,o)}this.videoElement.controls=!1,this.videoElement.setAttribute("playsinline",""),Qr()&&!ln("HIDE_NO_POSTER")&&(this.videoElement.poster="noposter");const r=Cr();if(this.config.noStyle||("Safari"===r.name&&15===Number(r.version)||Wr()||!this.config.mirror||(this.videoElement.style.transform="rotateY(180deg)"),this.config.fit?this.videoElement.style.objectFit=this.config.fit:this.videoElement.style.objectFit="cover"),this.videoElement.setAttribute("muted",""),this.videoElement.muted=!0,this.videoElement.srcObject&&this.videoElement.srcObject instanceof MediaStream){this.videoElement.srcObject.getVideoTracks()[0]!==this.videoTrack&&(this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,Ur()&&this.videoElement.load())}else this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,Ur()&&this.videoElement.load();const i=this.videoElement.play();void 0!==i&&i.catch((e=>{In.debug("[".concat(this.trackId,"] playback interrupted"),e.toString())}))}resetVideoElement(){var e,t;(WI.forEach((e=>{this.videoElement&&this.videoElement.removeEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval&&(window.clearInterval(this.videoElementCheckInterval),this.videoElementCheckInterval=void 0),this.cancelRVFId&&this.videoElement)&&(null===(e=(t=this.videoElement).cancelVideoFrameCallback)||void 0===e||e.call(t,this.cancelRVFId),this.cancelRVFId=void 0);this.videoElementStatus=eu.NONE}isSkipCalcRenderFreezeTime(){return this.videoElementStatus===eu.DESTROYED||this.internal}handleAutoPlayFailed(){const e=t=>{t.preventDefault(),this.videoElement.play().then((()=>{In.debug("[".concat(this.trackId,"] Video element for trackId:").concat(this.trackId," autoplay resumed."))})).catch((e=>{In.error(e)})),this.autoplayFailed=!1,qr()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};qr()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),RA()}}const WI=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","timeupdate","error"];class HI extends GI{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];super(e),N_(this,"container",void 0),N_(this,"slot",void 0),this.slot=e.element,this.internal=t,this.updateConfig(e)}updateConfig(e){this.config=e,this.trackId=e.trackId;const t=e.element;var r;!this.internal||this.slot?(t!==this.slot&&(this.destroy(),this.slot=t),this.createElements()):(this.slot=t,t&&this.container?(this.internal=!1,this.container.id="agora-video-player-".concat(this.trackId),this.videoElement.id="video_".concat(this.trackId),this.config.fit?this.videoElement.style.objectFit=this.config.fit:this.videoElement.style.objectFit="cover",null===(r=this.slot)||void 0===r||r.appendChild(this.container)):this.createElements())}updateVideoTrack(e){this.videoTrack!==e&&(this.videoTrack=e,this.createElements())}play(e){var t;null!==(t=this.container)&&void 0!==t&&t.contains(this.videoElement)&&super.play(e)}getCurrentFrame(){var e;return null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)?super.getCurrentFrame():new ImageData(2,2)}async getCurrentFrameToUint8Array(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return null!==(t=this.container)&&void 0!==t&&t.contains(this.videoElement)?await super.getCurrentFrameToUint8Array(e,r):await Gb(e)}destroy(){if(super.destroy(),this.videoElement.remove(),this.videoElement=document.createElement("video"),this.container){try{var e;this.container.remove(),null===(e=this.slot)||void 0===e||e.removeChild(this.container)}catch(e){}this.container=void 0}}createElements(){var e;this.container||(this.container=document.createElement("div")),this.container.id="agora-video-player-".concat(this.trackId),this.container.style.width="100%",this.container.style.height="100%",this.container.style.position="relative",this.container.style.overflow="hidden",this.videoTrack?(this.container.style.backgroundColor="black",ln("KEEP_LAST_FRAME")&&this.isKeepLastFrame&&this.videoElement.paused&&this.resetVideoElement(),this.mountedVideoElement()):this.unmountedVideoElement(),null===(e=this.slot)||void 0===e||e.appendChild(this.container)}mountedVideoElement(){var e;!this.container||null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)||this.container.appendChild(this.videoElement),super.initVideoElement(),this.videoElement.id="video_".concat(this.trackId),this.videoElement.className="agora_video_player",this.videoElement.style.width="100%",this.videoElement.style.height="100%",this.videoElement.style.position="absolute",this.videoElement.style.left="0",this.videoElement.style.top="0"}unmountedVideoElement(){var e;if(null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)){super.resetVideoElement();try{this.container&&this.container.removeChild(this.videoElement)}catch(e){}this.videoElement=document.createElement("video")}}resetVideoElement(){var e;null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)&&(super.resetVideoElement(),this.cacheVideoElement=this.videoElement,this.videoElement=document.createElement("video"))}getContainerElement(){return this.container}}var KI,YI,zI,XI,ZI,JI,QI,qI,$I,eO,tO,rO,iO,nO,oO,sO,aO,cO,dO,uO,lO,hO,pO,fO,EO,mO,_O,TO,gO,SO,RO,yO,vO,AO,bO,IO,OO,CO;function wO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function NO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?wO(Object(r),!0).forEach((function(t){N_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):wO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let DO=(KI=Pn({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),YI=OA(),zI=Pn({argsMap:e=>[e.getTrackId()]}),XI=Zi("LocalVideoTrack","_enabledMutex"),ZI=Pn({argsMap:(e,t)=>[e.getTrackId(),t]}),JI=OA(),QI=Zi("LocalVideoTrack","_enabledMutex"),qI=Pn({argsMap:(e,t)=>[e.getTrackId(),t]}),$I=OA(),eO=Pn({argsMap:(e,t)=>[e.getTrackId(),t,e._saveEncodeBitrateRatio]}),tO=OA(),rO=Pn({argsMap:(e,t)=>[e.getTrackId(),t]}),iO=OA(),nO=OA(),oO=Pn({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),sO=OA(),aO=OA(),cO=OA(),dO=Pn({argsMap:e=>[e.getTrackId()]}),uO=OA(),lO=OA(),hO=OA(),pO=OA(),fO=OA(),EO=Pn({argsMap:(e,t)=>[e.getTrackId(),t.name]}),mO=Pn({argsMap:e=>[e.getTrackId()]}),_O=Pn({argsMap:e=>[e.getTrackId()]}),TO=Pn({argsMap:(e,t,r)=>[e.getTrackId(),t.label,r]}),gO=class e extends Wv{get videoHeight(){if(kr()){const{height:e}=this._mediaStreamTrack.getSettings();return this._videoHeight=e,this._videoHeight}return this._videoHeight}get videoWidth(){if(kr()){const{width:e}=this._mediaStreamTrack.getSettings();return this._videoWidth=e,this._videoWidth}return this._videoWidth}get isPlaying(){return!(!this._player||this._player.videoElementStatus!==eu.PLAYING)}get processorDestination(){return this._processorDestination}get processorContext(){return this._processorContext}set processorContext(e){this._processorContext=e}get __className__(){return"LocalVideoTrack"}constructor(e,t,r,i,n,o){if(super(e,n),N_(this,"trackMediaType",Wd.VIDEO),N_(this,"_player",void 0),N_(this,"isUseScaleResolutionDownBy",!1),N_(this,"_videoVisibleTimer",null),N_(this,"_previousVideoVisibleStatus",void 0),N_(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),N_(this,"_encoderConfig",void 0),N_(this,"_scalabilityMode",{numSpatialLayers:1,numTemporalLayers:1}),N_(this,"_optimizationMode",void 0),N_(this,"_saveEncodeBitrateRatio",1),N_(this,"_videoHeight",void 0),N_(this,"_videoWidth",void 0),N_(this,"_forceBitrateLimit",void 0),N_(this,"_enabled",!0),N_(this,"_processorDestination",void 0),N_(this,"_processorContext",void 0),kr()){const{width:t,height:r}=e.getSettings();this._videoWidth=t,this._videoHeight=r}else this.updateMediaStreamTrackResolution();if(this._scalabilityMode=r,this._optimizationMode=i,this._hints=o||[],t&&-1!==this._hints.indexOf(Ud.CUSTOM_TRACK)?this._encoderConfig=Pi(t):this._encoderConfig=t,-1===this._hints.indexOf(Ud.SCREEN_TRACK))this.updateBitrateFromProfile();else if(Fr(Ar.CHROME,115)&&-1!==Nr().indexOf("Windows")){const t=Hb(e);t&&(In.info("local screen video track begin to inject frame"),this._mediaStreamTrack=t)}t&&-1!==this._hints.indexOf(Ud.CUSTOM_TRACK)&&this.setEncoderConfiguration(t),this._processorContext=new FA(this.getTrackId(),"local"),this._processorDestination=new VA(this.processorContext),this.bindProcessorDestinationEvents()}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof e){const t=document.getElementById(e);t?e=t:(In.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}In.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=NO(NO(NO({},this._getDefaultPlayerConfig()),t),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(r):(e instanceof HTMLVideoElement?this._player=new GI(r):this._player=new HI(r),this._player.updateVideoTrack(this._mediaStreamTrack)),this._player.play(),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((()=>{try{const e=this.getVideoElementVisibleStatus();this.safeEmit(jd.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),ln("CHECK_VIDEO_VISIBLE_INTERVAL"))}stop(){this._player&&(this._videoVisibleTimer&&(window.clearInterval(this._videoVisibleTimer),this._videoVisibleTimer=null),this._clearPreviousVideoVisibleStatus(),this._player.destroy(),this._player=void 0,In.debug("[".concat(this.getTrackId(),"] stop video playback")))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(In.info("[".concat(this.getTrackId(),"] start setEnabled"),e),!e){this._originMediaStreamTrack.enabled=!1;try{await yi(this,Md.NEED_DISABLE_TRACK,this)}catch(e){throw In.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}return t||(this._enabled=!1),void In.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}this._originMediaStreamTrack.enabled=!0;try{await yi(this,Md.NEED_ENABLE_TRACK,this)}catch(e){throw In.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}In.info("[".concat(this.getTrackId(),"] setEnabled to true success")),t||(this._enabled=!0)}async setMuted(e){e!==this._muted&&(this.stateCheck("muted",e),this._muted=e,this._originMediaStreamTrack.enabled=!e,In.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await yi(this,Md.NEED_MUTE_TRACK,this):await yi(this,Md.NEED_UNMUTE_TRACK,this))}async setSaveEncodeBitrateRatio(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._saveEncodeBitrateRatio;if(1!==this._saveEncodeBitrateRatio&&this._encoderConfig&&this._encoderConfig.bitrateMax&&this._encoderConfig.bitrateMin){this._encoderConfig.bitrateMin=Math.floor(this._encoderConfig.bitrateMin*e),this._encoderConfig.bitrateMax=Math.floor(this._encoderConfig.bitrateMax*e),In.debug("[".concat(this.getTrackId(),"] set save encode bitrate ratio, ").concat(e)),this._saveEncodeBitrateRatio=1;try{await yi(this,Md.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(In)}}}async setEncoderConfiguration(e,t){if(!this._enabled)throw new ii(ri.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");if(e=vd(e),ln("USE_STANDARD_BITRATE_DEFAULT")&&(delete e.bitrateMax,delete e.bitrateMin),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate?this._forceBitrateLimit.max_bitrate:e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate?this._forceBitrateLimit.min_bitrate:e.bitrateMin),e.width||e.height||e.frameRate){const t=KA({encoderConfig:e});(kr()||xr()||Yr())&&(t.deviceId=void 0),In.debug("[".concat(this.getTrackId(),"] setEncoderConfiguration applyConstraints"),JSON.stringify(e),JSON.stringify(t));try{await this._originMediaStreamTrack.applyConstraints(t),this.updateMediaStreamTrackResolution()}catch(e){const t=new ii(ri.UNEXPECTED_ERROR,e.toString());throw In.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}}this._encoderConfig=e,-1===this._hints.indexOf(Ud.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await yi(this,Md.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(In)}}getStats(){Mi((()=>{In.warning("[deprecated] LocalVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalVideoStats instead")}),"localVideoTrackGetStatsWarning");const e=vi(this,Md.GET_STATS);return e||NO({},zd)}async setBeautyEffect(e){In.error("LocalVideoTrack.setBeautyEffect was deprecated, please migrate to agora-extension-beauty-effect")}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}async getCurrentFrameImage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._player?this._player.getCurrentFrameToUint8Array(e,t):await Gb(e)}async findClosestProfile(){const{width:e,height:t,frameRate:r}=this.getMediaStreamTrackSettings(),{width:i,height:n,frameRate:o}=this._encoderConfig||{},s=Hi(this._videoWidth||e||i||0),a=Hi(this._videoHeight||t||n||0),c=Vb(s,a,Hi(r||o||15));if(c)return In.debug("[".concat(this.getTrackId(),"] find closest profile, ").concat(s,"x").concat(a," => ").concat(JSON.stringify(c))),this.setEncoderConfiguration(c)}async setBitrateLimit(e){In.debug("[".concat(this.getTrackId(),"] set bitrate limit, ").concat(JSON.stringify(e))),e&&(this._forceBitrateLimit=e,this._encoderConfig&&(this._encoderConfig.bitrateMax?this._encoderConfig.bitrateMax=this._encoderConfig.bitrateMax<e.max_bitrate?this._encoderConfig.bitrateMax:e.max_bitrate:this._encoderConfig.bitrateMax=e.max_bitrate,this._encoderConfig.bitrateMin,this._encoderConfig.bitrateMin=e.min_bitrate))}async setOptimizationMode(e){if("motion"!==e&&"detail"!==e&&"balanced"!==e)return void In.error(ri.INVALID_PARAMS,"optimization mode must be motion, detail or balanced");const t=this._optimizationMode;try{this._optimizationMode=e,await yi(this,Md.NEED_UPDATE_VIDEO_SEND_PARAMETERS,this)}catch(e){throw this._optimizationMode=t,In.error("[".concat(this.getTrackId(),"] set optimization mode failed"),e.toString()),e}In.info("[".concat(this.getTrackId(),"] set optimization mode success (").concat(e,")"))}setScalabiltyMode(e){if(1===e.numSpatialLayers&&1!==e.numTemporalLayers)return In.error(ri.INVALID_PARAMS,"scalability mode currently not supported, no SVC."),void(this._scalabilityMode={numSpatialLayers:1,numTemporalLayers:1});this._scalabilityMode=e,In.info("[".concat(this.getTrackId(),"] set scalability mode success (").concat(e,")"))}updateMediaStreamTrackResolution(){HA(this._originMediaStreamTrack).then((e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t})).catch(Fi)}_updatePlayerSource(){this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}_getDefaultPlayerConfig(){return{fit:"contain"}}async setSenderConfiguration(e){if(!this._enabled)throw new ii(ri.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");In.debug("[".concat(this.getTrackId(),"] setSenderConfiguration applyConstraints"),JSON.stringify(e)),e=vd(e),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate?this._forceBitrateLimit.max_bitrate:e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate?this._forceBitrateLimit.min_bitrate:e.bitrateMin),this._encoderConfig=e,-1===this._hints.indexOf(Ud.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await yi(this,Md.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(In)}}updateBitrateFromProfile(){if(!this._encoderConfig)return;const{width:e,height:t,frameRate:r}=this.getMediaStreamTrackSettings();if(!e||!t||!r)return;const{bitrateMax:i,bitrateMin:n}=this._encoderConfig;if(null==n||null==i){const{max:o,min:s}=Fb(e,t,r,n,i);if(this._encoderConfig.bitrateMin=s,this._encoderConfig.bitrateMax=o,ln("VIDEO_STANDARD_BITRATE_VERSION")&&null==n&&null==i){const[i,n]=xb(e,t,r);this._encoderConfig.bitrateMax=i,this._encoderConfig.bitrateMin=s?Math.min(s,i):i,this._saveEncodeBitrateRatio=n,In.debug("[".concat(this.getTrackId(),"] update new bitrate from profile, [w: ").concat(e,", h: ").concat(t,", fps: ").concat(r,"] => [brMax: ").concat(this._encoderConfig.bitrateMax,", brMin: ").concat(this._encoderConfig.bitrateMin,", save_bitrate_ratio: ").concat(this._saveEncodeBitrateRatio,"]"))}else In.debug("[".concat(this.getTrackId(),"] update bitrate from profile, [w: ").concat(e,", h: ").concat(t,", fps: ").concat(r,"] => [brMax: ").concat(o,", brMin: ").concat(s,"]")),this._saveEncodeBitrateRatio=1}}getVideoElementVisibleStatus(){try{var e,t;const r=null==this||null===(e=this._player)||void 0===e?void 0:e.getContainerElement(),i={track:this,element:null==this||null===(t=this._player)||void 0===t?void 0:t.getVideoElement(),slot:null==r?void 0:r.parentElement},{element:n,slot:o}=i;if(this.isPlaying&&n instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=li.checkOneElementVisible(n),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=Ln.reportApiInvoke(null,{tag:Ti.TRACER,name:_i.LOCAL_VIDEO_TRACK_GET_VIDEO_VISIBLE,options:[this.getTrackId()]});t.visible?e.onSuccess("Video is visible"):e.onSuccess("Invisible because of ".concat(t.reason))}return t}return}catch(e){throw new ii(ri.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}async renewMediaStreamTrack(e){}pipe(e){if(this.processor===e)return e;if(e._source)throw new ii(ri.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,context:this.processorContext}),e}unpipe(){if(!this.processor)return;const e=this.processor;this.processor._source=void 0,this.processor=void 0,e.reset()}close(){super.close(),this.unbindProcessorDestinationEvents(),this.unbindProcessorContextEvents(),this.unpipe(),this.processorDestination._source&&this.processorDestination._source.unpipe()}clone(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this._encoderConfig;t&&(i=NO(NO({},i),vd(t))),i=Li(i);const n=Vi(8,"track-video-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,i,Li(this._scalabilityMode),this._optimizationMode,n,Li(this._hints));return t&&i&&o.setEncoderConfiguration(i),In.debug("clone video track from ".concat(this.getTrackId()," to ").concat(n,", clone ").concat(r)),o}async replaceTrack(e,t){if(!(e instanceof MediaStreamTrack))throw new ii(ri.INVALID_PARAMS,"track should be an instance of MediaStreamTrack");if("video"!==e.kind)throw new ii(ri.INVALID_PARAMS,"track should be a video MediaStreamTrack");await this._updateOriginMediaStreamTrack(e,t,!0),this.updateMediaStreamTrackResolution()}sendSeiData(e){if(Mi((()=>{Ln.reportApiInvoke(null,{name:_i.LOCAL_VIDEO_SEND_SEI_DATA,options:[],tag:Ti.TRACER}).onSuccess("")}),this._mediaStreamTrack.id||this.getTrackId()),!ln("ENABLE_VIDEO_SEI")||!ln("ENABLE_ENCODED_TRANSFORM"))return void In.warning('To send/receive SEI, please call AgoraRTC.setParameter("ENABLE_VIDEO_SEI", true) before instantiate IAgoraRtcClient');if(e instanceof Uint8Array==!1)return new ii(ri.INVALID_PARAMS,"Invalid argument type, ILocalVideoTrack.sendSeiData() only accept Uint8Array argument.").throw();const t=this.getRTCRtpTransceiver();if(!t)return void In.warning("Video track is not published, SEI can not be send");const r=t.sender.getParameters();if(0===r.codecs.length)return;const i=r.codecs[0].mimeType.toLocaleLowerCase();"video/h264"===i||"video/h265"===i?this.safeEmit("sei-to-send",e):In.warning("SEI is not supported by ".concat(i))}bindProcessorDestinationEvents(){this.processorDestination.on(Jd.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(),await yi(this,Md.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await yi(this,Md.NEED_REPLACE_TRACK,this))}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(Jd.ON_TRACK)}unbindProcessorContextEvents(){this.processorContext.removeAllListeners(Qd.REQUEST_UPDATE_CONSTRAINTS),this.processorContext.removeAllListeners(Qd.REQUEST_CONSTRAINTS)}},UT(gO.prototype,"play",[KI,YI],Object.getOwnPropertyDescriptor(gO.prototype,"play"),gO.prototype),UT(gO.prototype,"stop",[zI],Object.getOwnPropertyDescriptor(gO.prototype,"stop"),gO.prototype),UT(gO.prototype,"setEnabled",[XI,ZI,JI],Object.getOwnPropertyDescriptor(gO.prototype,"setEnabled"),gO.prototype),UT(gO.prototype,"setMuted",[QI,qI,$I],Object.getOwnPropertyDescriptor(gO.prototype,"setMuted"),gO.prototype),UT(gO.prototype,"setSaveEncodeBitrateRatio",[eO,tO],Object.getOwnPropertyDescriptor(gO.prototype,"setSaveEncodeBitrateRatio"),gO.prototype),UT(gO.prototype,"setEncoderConfiguration",[rO,iO],Object.getOwnPropertyDescriptor(gO.prototype,"setEncoderConfiguration"),gO.prototype),UT(gO.prototype,"getStats",[nO],Object.getOwnPropertyDescriptor(gO.prototype,"getStats"),gO.prototype),UT(gO.prototype,"setBeautyEffect",[oO,sO],Object.getOwnPropertyDescriptor(gO.prototype,"setBeautyEffect"),gO.prototype),UT(gO.prototype,"getCurrentFrameData",[aO],Object.getOwnPropertyDescriptor(gO.prototype,"getCurrentFrameData"),gO.prototype),UT(gO.prototype,"getCurrentFrameImage",[cO],Object.getOwnPropertyDescriptor(gO.prototype,"getCurrentFrameImage"),gO.prototype),UT(gO.prototype,"findClosestProfile",[dO,uO],Object.getOwnPropertyDescriptor(gO.prototype,"findClosestProfile"),gO.prototype),UT(gO.prototype,"setBitrateLimit",[lO],Object.getOwnPropertyDescriptor(gO.prototype,"setBitrateLimit"),gO.prototype),UT(gO.prototype,"setOptimizationMode",[hO],Object.getOwnPropertyDescriptor(gO.prototype,"setOptimizationMode"),gO.prototype),UT(gO.prototype,"setScalabiltyMode",[pO],Object.getOwnPropertyDescriptor(gO.prototype,"setScalabiltyMode"),gO.prototype),UT(gO.prototype,"updateMediaStreamTrackResolution",[fO],Object.getOwnPropertyDescriptor(gO.prototype,"updateMediaStreamTrackResolution"),gO.prototype),UT(gO.prototype,"pipe",[EO],Object.getOwnPropertyDescriptor(gO.prototype,"pipe"),gO.prototype),UT(gO.prototype,"unpipe",[mO],Object.getOwnPropertyDescriptor(gO.prototype,"unpipe"),gO.prototype),UT(gO.prototype,"close",[_O],Object.getOwnPropertyDescriptor(gO.prototype,"close"),gO.prototype),UT(gO.prototype,"replaceTrack",[TO],Object.getOwnPropertyDescriptor(gO.prototype,"replaceTrack"),gO.prototype),gO),PO=(SO=Pn({argsMap:(e,t)=>[e.getTrackId(),t]}),RO=OA(),yO=Zi("CameraVideoTrack","_enabledMutex"),vO=Pn({argsMap:(e,t)=>[e.getTrackId(),t]}),AO=OA(),bO=Pn({argsMap:(e,t)=>[e.getTrackId(),t]}),IO=OA(),OO=Pn({argsMap:e=>[e.getTrackId()]}),CO=class e extends DO{get __className__(){return"CameraVideoTrack"}constructor(e,t,r,i,n,o){super(e,vd(t.encoderConfig),i,n,o),N_(this,"_config",void 0),N_(this,"_originalConstraints",void 0),N_(this,"_constraints",void 0),N_(this,"_enabled",!0),N_(this,"_deviceName","default"),N_(this,"tryResumeVideoForIOS15_16WeChat",(async()=>{(Wr()||Hr())&&!function(){const e=Cr();if(e.os!==vr.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=2}()&&zr()&&this._enabled&&!this._isClosed&&(In.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS 15 device on WeChat.")),await this.renewMediaStreamTrack())})),this._config=t,this._originalConstraints=r,this._constraints=r,this._deviceName=e.label,this._encoderConfig=vd(this._config.encoderConfig),Xv.on(Wn.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),Xv.on(Wn.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),this.bindProcessorContextEvents()}async setDevice(e){return"string"==typeof e?this._setDeviceById(e):e.deviceId?this._setDeviceById(e.deviceId):e.facingMode?this._setDeviceByFacingModel(e.facingMode):void 0}async _setDeviceById(e){if(In.info("[".concat(this.getTrackId(),"] set device to ").concat(e)),this._enabled)try{const t=await TA.getDeviceById(e),r={};r.video=NO({},this._constraints),r.video.deviceId={exact:e},r.video.facingMode=void 0,this._originMediaStreamTrack.stop();let i=null;try{i=await pA(r,this.getTrackId())}catch(e){throw In.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),i=await pA({video:this._constraints},this.getTrackId()),await this._updateOriginMediaStreamTrack(i.getVideoTracks()[0],!1),e}await this._updateOriginMediaStreamTrack(i.getVideoTracks()[0],!1),this.updateMediaStreamTrackResolution(),this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(e){throw In.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await TA.getDeviceById(e);this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(e){throw In.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}In.info("[".concat(this.getTrackId(),"] setDevice success"))}async _setDeviceByFacingModel(e){In.info("[".concat(this.getTrackId(),"] set facingMode ").concat(e));const t={video:NO(NO({},this._constraints),{},{deviceId:void 0,facingMode:{exact:e}})};if(this._enabled){this._originMediaStreamTrack.stop();let e=null;try{e=await pA(t,this.getTrackId())}catch(t){throw In.error("[".concat(this.getTrackId(),"] setDeviceByFacingModel failed"),t.toString()),e=await pA({video:this._constraints},this.getTrackId()),await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1),t}await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1),this.updateMediaStreamTrackResolution()}this._deviceName="",this._config.facingMode=e,this._config.cameraId=void 0,this._constraints=NO({},t.video),In.info("[".concat(this.getTrackId(),"] setDeviceByFacingModel success"))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(In.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){try{if(this.isExternalTrack)this._originMediaStreamTrack.enabled=!0;else{const e=await pA({video:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1)}await yi(this,Md.NEED_ENABLE_TRACK,this)}catch(e){throw In.error("[".concat(this.getTrackId(),"] setEnabled true error"),e.toString()),e}this.updateMediaStreamTrackResolution(),In.info("[".concat(this.getTrackId(),"] setEnabled to true success")),t||(this._enabled=!0)}else{this.isExternalTrack?this._originMediaStreamTrack.enabled=!1:(this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop()),t||(this._enabled=!1);try{await yi(this,Md.NEED_DISABLE_TRACK,this)}catch(e){throw In.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}In.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}}async setEncoderConfiguration(e,t){if(!this._enabled)throw new ii(ri.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");e=vd(e),ln("USE_STANDARD_BITRATE_DEFAULT")&&(delete e.bitrateMax,delete e.bitrateMin),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate||e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate||e.bitrateMin);const r=Pi(this._config);r.encoderConfig=e;const i=KA(r);(kr()||xr()||Yr())&&(i.deviceId=void 0),In.debug("[".concat(this.getTrackId(),"] setEncoderConfiguration applyConstraints"),JSON.stringify(e),JSON.stringify(i));try{await this._originMediaStreamTrack.applyConstraints(i),this.updateMediaStreamTrackResolution()}catch(e){const t=new ii(ri.UNEXPECTED_ERROR,e.toString());throw In.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}this._config=r,this._constraints=i,this._originalConstraints=i,this._encoderConfig=e,-1===this._hints.indexOf(Ud.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await yi(this,Md.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(In)}}_getDefaultPlayerConfig(){return{mirror:!0,fit:"cover"}}onTrackEnded(){if((xr()||Yr())&&this._enabled&&!this._isClosed&&Xv.duringInterruption){const e=async()=>{Xv.off(Wn.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(In.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};Xv.on(Wn.IOS_INTERRUPTION_END,e)}else In.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(jd.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=TA.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId={exact:r}),this._enabled){const e=await pA({video:t},this.getTrackId());this._constraints=t,await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!0),this.updateMediaStreamTrackResolution()}}close(){super.close(),Xv.off(Wn.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),Xv.off(Wn.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat)}clone(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this._encoderConfig;t&&(i=NO(NO({},i),vd(t))),i=Li(i);const n=Vi(8,"track-cam-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,Li(NO(NO({},this._config),{},{encoderConfig:i})),Li(this._constraints),Li(this._scalabilityMode),this._optimizationMode,n);return t&&i&&o.setEncoderConfiguration(i),In.debug("clone track from ".concat(this.getTrackId()," to ").concat(n,", clone ").concat(r)),o}bindProcessorContextEvents(){this.processorContext.on(Qd.REQUEST_UPDATE_CONSTRAINTS,(async(e,t,r)=>{try{const r=Object.assign({},this._originalConstraints,...e);await this.renewMediaStreamTrack(r),t()}catch(e){r(e)}})),this.processorContext.on(Qd.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}},UT(CO.prototype,"setDevice",[SO,RO],Object.getOwnPropertyDescriptor(CO.prototype,"setDevice"),CO.prototype),UT(CO.prototype,"setEnabled",[yO,vO,AO],Object.getOwnPropertyDescriptor(CO.prototype,"setEnabled"),CO.prototype),UT(CO.prototype,"setEncoderConfiguration",[bO,IO],Object.getOwnPropertyDescriptor(CO.prototype,"setEncoderConfiguration"),CO.prototype),UT(CO.prototype,"close",[OO],Object.getOwnPropertyDescriptor(CO.prototype,"close"),CO.prototype),CO);function LO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function kO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?LO(Object(r),!0).forEach((function(t){N_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):LO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function MO(e,t,r,i){r.optimizationMode&&(i&&i.width&&i.height?(r.encoderConfig=kO(kO({},i),{},{bitrateMin:i.bitrateMin,bitrateMax:i.bitrateMax}),"motion"!==r.optimizationMode&&"detail"!==r.optimizationMode||(t.contentHint=r.optimizationMode,t.contentHint===r.optimizationMode?In.debug("[".concat(e,"] set content hint to"),r.optimizationMode):In.debug("[".concat(e,"] set content hint failed")))):In.warning("[".concat(e,"] can not apply optimization mode bitrate config, no encoderConfig")))}var UO,xO,VO,FO,BO,jO,GO,WO,HO,KO,YO,zO,XO;function ZO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function JO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ZO(Object(r),!0).forEach((function(t){N_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ZO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class QO extends Gv{getUserId(){return this._userId}constructor(e,t,r,i){super(e,"track-".concat(e.kind,"-").concat(t,"-").concat(i.clientId,"_").concat(Vi(5,""))),N_(this,"_userId",void 0),N_(this,"_uintId",void 0),N_(this,"_isDestroyed",!1),N_(this,"store",void 0),N_(this,"processor",void 0),N_(this,"processorContext",void 0),this._userId=t,this._uintId=r,this.store=i}_updateOriginMediaStreamTrack(e){this._originMediaStreamTrack=e,this._mediaStreamTrack=e,this._updatePlayerSource(),this.processor&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this.processorContext})}_destroy(){this._isDestroyed=!0,In.info("[".concat(this.getTrackId(),"] is destroyed")),this.stop(),super.close()}getProcessorStats(){return this.processorContext.gatherStats()}getProcessorUsage(){return this.processorContext.gatherUsage()}}let qO=(UO=Pn({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),xO=Pn({argsMap:e=>[e.getTrackId()]}),VO=Pn({argsMap:(e,t)=>[e.getTrackId(),t.name]}),FO=Pn({argsMap:e=>[e.getTrackId()]}),BO=class extends QO{get isPlaying(){return!(!this._player||this._player.videoElementStatus!==eu.PLAYING)}get __className__(){return"RemoteVideoTrack"}constructor(e,t,r,i,n){super(e,t,r,i),N_(this,"_videoVisibleTimer",null),N_(this,"_previousVideoVisibleStatus",void 0),N_(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),N_(this,"trackMediaType",Wd.VIDEO),N_(this,"_videoWidth",void 0),N_(this,"_videoHeight",void 0),N_(this,"_player",void 0),N_(this,"_prePlayer",void 0),N_(this,"processorDestination",void 0),N_(this,"processorContext",void 0),this._prePlayer=n,this.updateMediaStreamTrackResolution(),this.processorContext=new FA(this.getTrackId(),"remote"),this.processorDestination=new VA(this.processorContext),this.bindProcessorDestinationEvents()}getStats(){Mi((()=>{In.warning("[deprecated] RemoteVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteVideoStats instead")}),"remoteVideoTrackGetStatsWarning");return vi(this,Md.GET_STATS)||JO({},Zd)}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.safeEmit(Gd.PLAY_START),"string"==typeof e){const t=document.getElementById(e);t?e=t:(In.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}In.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=JO(JO({fit:"cover"},t),{},{trackId:this.getTrackId(),element:e});if(this._player)this._player.updateConfig(r);else{let t=!1,i=!1;e instanceof HTMLVideoElement?(this._player=new GI(r),this._prePlayer&&(this._prePlayer.destroy(),this._prePlayer=void 0,i=!0)):this._prePlayer&&!this._prePlayer.isDestroyed?(this._player=this._prePlayer,this._prePlayer=void 0,t=this._player.videoState>0,this._player.updateConfig(r)):this._player=new HI(r),this._player.updateVideoTrack(this._mediaStreamTrack),this._player.onFirstVideoFrameDecoded=()=>{this.store.subscribe(this.getUserId(),"video",void 0,void 0,Date.now()),this.safeEmit(Gd.FIRST_FRAME_DECODED),i&&this.safeEmit(Gd.FIRST_FRAME_RENDER)},this._player.onVideoStateChanged=e=>{this.safeEmit(Gd.VIDEO_STATE_CHANGED,e)},t&&(this._player.onFirstVideoFrameDecoded(),this._player.onVideoStateChanged(this._player.videoState))}this._player.play(this.store.sessionId||void 0),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((()=>{try{const e=this.getVideoElementVisibleStatus();this.safeEmit(Gd.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),ln("CHECK_VIDEO_VISIBLE_INTERVAL")),this.safeEmit(Gd.PLAY_END)}stop(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._player&&(this._videoVisibleTimer&&(window.clearInterval(this._videoVisibleTimer),this._videoVisibleTimer=null),this._clearPreviousVideoVisibleStatus(),this._player.destroy(e),this._player=void 0,In.debug("[".concat(this.getTrackId(),"] stop video playback")))}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}updateMediaStreamTrackResolution(){HA(this._originMediaStreamTrack).then((e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t})).catch(Fi)}_updatePlayerSource(){In.debug("[".concat(this.getTrackId(),"] update player source track")),this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}getVideoElementVisibleStatus(){try{var e,t;const r=null==this||null===(e=this._player)||void 0===e?void 0:e.getContainerElement(),i={track:this,element:null==this||null===(t=this._player)||void 0===t?void 0:t.getVideoElement(),slot:null==r?void 0:r.parentElement},{element:n,slot:o}=i;if(this.isPlaying&&n instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=li.checkOneElementVisible(n),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=Ln.reportApiInvoke(null,{tag:Ti.TRACER,name:_i.REMOTE_VIDEO_TRACK_GET_VIDEO_VISIBLE,options:[this.getTrackId()]});t.visible?e.onSuccess("Video is visible"):e.onSuccess("Invisible because of ".concat(t.reason))}return t}return}catch(e){throw new ii(ri.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}pipe(e){if(this.processor===e)return e;if(e._source)throw new ii(ri.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,context:this.processorContext}),e}unpipe(){if(!this.processor)return;const e=this.processor;this.processor._source=void 0,this.processor=void 0,e.reset()}bindProcessorDestinationEvents(){this.processorDestination.on(Jd.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource()):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource())}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(Jd.ON_TRACK)}_destroy(){this._prePlayer&&(this._prePlayer.destroy(),this._prePlayer=void 0),super._destroy(),this.unbindProcessorDestinationEvents()}_onSei(e){this.emit(Bd.SEI_RECEIVED,e)}},UT(BO.prototype,"play",[UO],Object.getOwnPropertyDescriptor(BO.prototype,"play"),BO.prototype),UT(BO.prototype,"stop",[xO],Object.getOwnPropertyDescriptor(BO.prototype,"stop"),BO.prototype),UT(BO.prototype,"pipe",[VO],Object.getOwnPropertyDescriptor(BO.prototype,"pipe"),BO.prototype),UT(BO.prototype,"unpipe",[FO],Object.getOwnPropertyDescriptor(BO.prototype,"unpipe"),BO.prototype),BO),$O=(jO=Pn({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),GO=Pn({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),WO=Pn({argsMap:(e,t)=>[e.getTrackId(),t]}),HO=Pn({argsMap:e=>[e.getTrackId()]}),KO=Pn({argsMap:e=>[e.getTrackId()]}),YO=Pn({argsMap:(e,t)=>[e.getTrackId(),t.name]}),zO=Pn({argsMap:e=>[e.getTrackId()]}),XO=class extends QO{get isPlaying(){return this._useAudioElement?IA.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"RemoteAudioTrack"}constructor(e,t,r,i){super(e,t,r,i),N_(this,"trackMediaType",Wd.AUDIO),N_(this,"_source",void 0),N_(this,"_useAudioElement",!0),N_(this,"_volume",100),N_(this,"processorContext",void 0),N_(this,"processorDestination",void 0),N_(this,"_played",!1),N_(this,"_bypassWebAudio",!1),ln("DISABLE_WEBAUDIO")?(this._source=new GA,this._bypassWebAudio=!0,this._useAudioElement=!0):(this._source=new aA(e,!0),ln("REMOTE_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1)),this._source.once(Hd.RECEIVE_TRACK_BUFFER,(()=>{this.safeEmit(Gd.FIRST_FRAME_DECODED)})),this.processorContext=new jA(this._source.context,this.getTrackId(),"remote"),this.processorDestination=new BA(this.processorContext),this.bindProcessorDestinationEvents(),this._source.on(Hd.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:this.processorContext})}))}setAudioFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners(Hd.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(Hd.ON_AUDIO_BUFFER),this._source.on(Hd.ON_AUDIO_BUFFER,(t=>e(t)))}setVolume(e){this._volume=e,this._useAudioElement?IA.setVolume(this.getTrackId(),e):this._source.setVolume(e/100)}setAmplifiedVolume(e){this._useAudioElement&&this._played&&(IA.stop(this.getTrackId()),this._source.play()),this._useAudioElement=!1,e=Math.min(e,ln("MAX_WEBAUDIO_VOLUME")),this._volume=e,this._source.setVolume(e/100)}async setPlaybackDevice(e){if(!this._useAudioElement||!Vn())throw new ii(ri.NOT_SUPPORTED,"your browser does not support setting the audio output device");await IA.setSinkID(this.getTrackId(),e)}getVolumeLevel(){return this._source.getAccurateVolumeLevel()}getVolume(){return this._useAudioElement?IA.getVolume(this.getTrackId()):this._source instanceof aA?this._source.getAudioVolume():0}getStats(){Mi((()=>{In.warning("[deprecated] RemoteAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteAudioStats instead")}),"remoteAudioTrackGetStatsWarning");return vi(this,Md.GET_STATS)||JO({},Xd)}play(){In.debug("[".concat(this.getTrackId(),"] start audio playback")),this._played=!0,this._useAudioElement?(In.debug("[".concat(this.getTrackId(),"] use audio element to play")),IA.play(this._mediaStreamTrack,this.getTrackId(),this._volume,this.store.sessionId||void 0)):(In.debug("[".concat(this.getTrackId(),"] use audio context to play")),this._source.play())}stop(){In.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._played=!1,this._useAudioElement?IA.stop(this.getTrackId()):this._source.stop()}_destroy(){super._destroy(),this._played=!1,this.unbindProcessorDestinationEvents(),this._source.destroy()}_isFreeze(){return this._source.isFreeze}_updatePlayerSource(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];In.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&IA.updateTrack(this.getTrackId(),this._mediaStreamTrack)}pipe(e){if(this._bypassWebAudio)throw new ii(ri.NOT_SUPPORTED,"can not pipe extension when WebAudio disabled");if(this.processor===e)return e;if(e._source)throw new ii(ri.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,node:this._source.processSourceNode,context:this.processorContext}),e}unpipe(){var e;if(this._bypassWebAudio)throw new ii(ri.NOT_SUPPORTED,"can not unpipe extension when WebAudio disabled");if(!this.processor)return;const t=this.processor;null===(e=this._source.processSourceNode)||void 0===e||e.disconnect(),this.processor._source=!1,this.processor=void 0,t.reset()}bindProcessorDestinationEvents(){this.processorDestination.on(Jd.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(!1),this._source.processedNode=this._source.createMediaStreamSourceNode(e)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource())})),this.processorDestination.on(Jd.ON_NODE,(e=>{this._source.processedNode=e;const t=!e;this._useAudioElement!==t&&(this._played?(this.stop(),this._useAudioElement=t,this.play()):this._useAudioElement=t)}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(Jd.ON_TRACK),this.processorDestination.removeAllListeners(Jd.ON_NODE)}},UT(XO.prototype,"setVolume",[jO],Object.getOwnPropertyDescriptor(XO.prototype,"setVolume"),XO.prototype),UT(XO.prototype,"setAmplifiedVolume",[GO],Object.getOwnPropertyDescriptor(XO.prototype,"setAmplifiedVolume"),XO.prototype),UT(XO.prototype,"setPlaybackDevice",[WO],Object.getOwnPropertyDescriptor(XO.prototype,"setPlaybackDevice"),XO.prototype),UT(XO.prototype,"play",[HO],Object.getOwnPropertyDescriptor(XO.prototype,"play"),XO.prototype),UT(XO.prototype,"stop",[KO],Object.getOwnPropertyDescriptor(XO.prototype,"stop"),XO.prototype),UT(XO.prototype,"pipe",[YO],Object.getOwnPropertyDescriptor(XO.prototype,"pipe"),XO.prototype),UT(XO.prototype,"unpipe",[zO],Object.getOwnPropertyDescriptor(XO.prototype,"unpipe"),XO.prototype),XO);const eC=new class extends pi{get visibility(){return document.visibilityState}get lastHiddenTime(){return this._lastHiddenTime}get lastVisibleTime(){return this._lastVisibleTime}constructor(){super(),N_(this,"_lastHiddenTime",0),N_(this,"_lastVisibleTime",0),N_(this,"needUploadStats",[]),N_(this,"isCollectingStats",!1),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState?this._lastHiddenTime=performance.now():this._lastVisibleTime=performance.now(),this.isCollectingStats&&this.needUploadStats.push("visible"===document.visibilityState?1:0),In.debug("current web page is ".concat(document.visibilityState)),this.emit("VISIBILITY_CHANGE",document.visibilityState)}))}startCollectStats(){this.isCollectingStats=!0,this.needUploadStats.push("visible"===this.visibility?1:0)}stopCollectStats(){this.isCollectingStats=!1,this.needUploadStats.length=0}};class tC extends pi{constructor(e,t){super(),N_(this,"trackMediaType",Wd.DATA),N_(this,"_version",1),N_(this,"_type",3),N_(this,"_config",void 0),N_(this,"_originDataChannel",void 0),N_(this,"_dataStreamPacketHeader",new ArrayBuffer(4)),N_(this,"_dataStreamPacketHandler",{serialize:e=>e,deserialize:e=>e}),N_(this,"_datachannelEventMap",new Map),this._config=e,t&&(this._originDataChannel=t,this._bandDataChannelEvents(t)),this._initPacketHeader()}useDataStream(e){this._dataStreamPacketHandler=e}get id(){return this._config.id}get ordered(){return this._config.ordered}get maxRetransmits(){return ln("DATASTREAM_MAX_RETRANSMITS")}get metadata(){return this._config.metadata}get readyState(){var e,t;return null!==(e=null===(t=this._originDataChannel)||void 0===t?void 0:t.readyState)&&void 0!==e?e:"connecting"}get _originDataChannelId(){var e,t;return null!==(e=null===(t=this._originDataChannel)||void 0===t?void 0:t.id)&&void 0!==e?e:null}getChannelId(){return this.id}getConfig(){return this._config}_close(){this._originDataChannel&&(this._unbindDataChannelEvents(this._originDataChannel),this._originDataChannel=void 0)}async _waitTillOpen(){return new jv(((e,t)=>{if(this._originDataChannel){"open"===this._originDataChannel.readyState&&e();const r=setTimeout((()=>{var e;t(new ii(ri.DATACHANNEL_CONNECTION_TIMEOUT,"Cannot create datachannel, id: ".concat(null===(e=this._originDataChannel)||void 0===e?void 0:e.id)))}),1e4);this._originDataChannel.onopen=()=>{clearTimeout(r),this._originDataChannel&&this._bandDataChannelEvents(this._originDataChannel),e()},this._originDataChannel.onerror=()=>{throw clearTimeout(r),new ii(ri.DATACHANNEL_CONNECTION_TIMEOUT)}}else t(new ii(ri.DATACHANNEL_CONNECTION_TIMEOUT,"cannot find dataChannel"))}))}_updateOriginDataChannel(e){this._originDataChannel=e,this._bandDataChannelEvents(e)}_initPacketHeader(){const e=new DataView(this._dataStreamPacketHeader);e.setUint16(0,this._version),e.setUint8(2,this._type),e.setUint8(3,this._config.id)}_bandDataChannelEvents(e){this._unbindDataChannelEvents(e),[ru.OPEN,ru.CLOSE,ru.ERROR].forEach((t=>{const r=()=>{this.emit(t)};this._datachannelEventMap.set(t,r),e.addEventListener(t,r)}))}_unbindDataChannelEvents(e){Array.from(this._datachannelEventMap.entries()).forEach((t=>{let[r,i]=t;e.removeEventListener(r,i)})),this._datachannelEventMap.clear()}}var rC=Hn,iC=ea("iterator"),nC=!rC((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r=new URLSearchParams("a=1&a=2"),i="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),i+=r+e})),r.delete("a",2),!e.toJSON||!r.has("a",1)||r.has("a",2)||!t.size&&true||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[iC]||"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"!==i||"x"!==new URL("http://x",void 0).host})),oC=sh,sC=mc,aC=$n,cC=Ro,dC=Jn,uC=To,lC=nC,hC=sh,pC=ch,fC=function(e,t,r){for(var i in t)r&&r.unsafe&&e[i]?e[i]=t[i]:oC(e,i,t[i],r);return e},EC=Ph,mC=KE,_C=Xh,TC=ES,gC=mo,SC=Bs,RC=Va,yC=qc,vC=Ha,AC=Wo,bC=td,IC=Gl,OC=Co,CC=yg,wC=Eg,NC=bS,DC=ib,PC=ea("iterator"),LC="URLSearchParams",kC=LC+"Iterator",MC=_C.set,UC=_C.getterFor(LC),xC=_C.getterFor(kC),VC=Object.getOwnPropertyDescriptor,FC=function(e){if(!uC)return aC[e];var t=VC(aC,e);return t&&t.value},BC=FC("fetch"),jC=FC("Request"),GC=FC("Headers"),WC=jC&&jC.prototype,HC=GC&&GC.prototype,KC=aC.RegExp,YC=aC.TypeError,zC=aC.decodeURIComponent,XC=aC.encodeURIComponent,ZC=dC("".charAt),JC=dC([].join),QC=dC([].push),qC=dC("".replace),$C=dC([].shift),ew=dC([].splice),tw=dC("".split),rw=dC("".slice),iw=/\+/g,nw=Array(4),ow=function(e){return nw[e-1]||(nw[e-1]=KC("((?:%[\\da-f]{2}){"+e+"})","gi"))},sw=function(e){try{return zC(e)}catch(t){return e}},aw=function(e){var t=qC(e,iw," "),r=4;try{return zC(t)}catch(e){for(;r;)t=qC(t,ow(r--),sw);return t}},cw=/[!'()~]|%20/g,dw={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},uw=function(e){return dw[e]},lw=function(e){return qC(XC(e),cw,uw)},hw=mC((function(e,t){MC(this,{type:kC,iterator:CC(UC(e).entries),kind:t})}),"Iterator",(function(){var e=xC(this),t=e.kind,r=e.iterator.next(),i=r.value;return r.done||(r.value="keys"===t?i.key:"values"===t?i.value:[i.key,i.value]),r}),!0),pw=function(e){this.entries=[],this.url=null,void 0!==e&&(AC(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===ZC(e,0)?rw(e,1):e:bC(e)))};pw.prototype={type:LC,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,i,n,o,s,a,c=wC(e);if(c)for(r=(t=CC(e,c)).next;!(i=cC(r,t)).done;){if(o=(n=CC(vC(i.value))).next,(s=cC(o,n)).done||(a=cC(o,n)).done||!cC(o,n).done)throw YC("Expected sequence with length 2");QC(this.entries,{key:bC(s.value),value:bC(a.value)})}else for(var d in e)SC(e,d)&&QC(this.entries,{key:d,value:bC(e[d])})},parseQuery:function(e){if(e)for(var t,r,i=tw(e,"&"),n=0;n<i.length;)(t=i[n++]).length&&(r=tw(t,"="),QC(this.entries,{key:aw($C(r)),value:aw(JC(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],i=0;i<t.length;)e=t[i++],QC(r,lw(e.key)+"="+lw(e.value));return JC(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var fw=function(){TC(this,Ew);var e=MC(this,new pw(arguments.length>0?arguments[0]:void 0));uC||(this.size=e.entries.length)},Ew=fw.prototype;if(fC(Ew,{append:function(e,t){var r=UC(this);NC(arguments.length,2),QC(r.entries,{key:bC(e),value:bC(t)}),uC||this.length++,r.updateURL()},delete:function(e){for(var t=UC(this),r=NC(arguments.length,1),i=t.entries,n=bC(e),o=r<2?void 0:arguments[1],s=void 0===o?o:bC(o),a=0;a<i.length;){var c=i[a];if(c.key!==n||void 0!==s&&c.value!==s)a++;else if(ew(i,a,1),void 0!==s)break}uC||(this.size=i.length),t.updateURL()},get:function(e){var t=UC(this).entries;NC(arguments.length,1);for(var r=bC(e),i=0;i<t.length;i++)if(t[i].key===r)return t[i].value;return null},getAll:function(e){var t=UC(this).entries;NC(arguments.length,1);for(var r=bC(e),i=[],n=0;n<t.length;n++)t[n].key===r&&QC(i,t[n].value);return i},has:function(e){for(var t=UC(this).entries,r=NC(arguments.length,1),i=bC(e),n=r<2?void 0:arguments[1],o=void 0===n?n:bC(n),s=0;s<t.length;){var a=t[s++];if(a.key===i&&(void 0===o||a.value===o))return!0}return!1},set:function(e,t){var r=UC(this);NC(arguments.length,1);for(var i,n=r.entries,o=!1,s=bC(e),a=bC(t),c=0;c<n.length;c++)(i=n[c]).key===s&&(o?ew(n,c--,1):(o=!0,i.value=a));o||QC(n,{key:s,value:a}),uC||(this.size=n.length),r.updateURL()},sort:function(){var e=UC(this);DC(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=UC(this).entries,i=RC(e,arguments.length>1?arguments[1]:void 0),n=0;n<r.length;)i((t=r[n++]).value,t.key,this)},keys:function(){return new hw(this,"keys")},values:function(){return new hw(this,"values")},entries:function(){return new hw(this,"entries")}},{enumerable:!0}),hC(Ew,PC,Ew.entries,{name:"entries"}),hC(Ew,"toString",(function(){return UC(this).serialize()}),{enumerable:!0}),uC&&pC(Ew,"size",{get:function(){return UC(this).entries.length},configurable:!0,enumerable:!0}),EC(fw,LC),sC({global:!0,constructor:!0,forced:!lC},{URLSearchParams:fw}),!lC&&gC(GC)){var mw=dC(HC.has),_w=dC(HC.set),Tw=function(e){if(AC(e)){var t,r=e.body;if(yC(r)===LC)return t=e.headers?new GC(e.headers):new GC,mw(t,"content-type")||_w(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),IC(e,{body:OC(0,bC(r)),headers:OC(0,t)})}return e};if(gC(BC)&&sC({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return BC(e,arguments.length>1?Tw(arguments[1]):{})}}),gC(jC)){var gw=function(e){return TC(this,WC),new jC(e,arguments.length>1?Tw(arguments[1]):{})};WC.constructor=gw,gw.prototype=WC,sC({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:gw})}}var Sw,Rw={URLSearchParams:fw,getState:UC},yw=To,vw=Jn,Aw=Ro,bw=Hn,Iw=_l,Ow=nh,Cw=yo,ww=xs,Nw=Lo,Dw=Object.assign,Pw=Object.defineProperty,Lw=vw([].concat),kw=!Dw||bw((function(){if(yw&&1!==Dw({b:1},Dw(Pw({},"a",{enumerable:!0,get:function(){Pw(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),i="abcdefghijklmnopqrst";return e[r]=7,i.split("").forEach((function(e){t[e]=e})),7!=Dw({},e)[r]||Iw(Dw({},t)).join("")!=i}))?function(e,t){for(var r=ww(e),i=arguments.length,n=1,o=Ow.f,s=Cw.f;i>n;)for(var a,c=Nw(arguments[n++]),d=o?Lw(Iw(c),o(c)):Iw(c),u=d.length,l=0;u>l;)a=d[l++],yw&&!Aw(s,c,a)||(r[a]=c[a]);return r}:Dw,Mw=Ha,Uw=Ig,xw=Va,Vw=Ro,Fw=xs,Bw=function(e,t,r,i){try{return i?t(Mw(r)[0],r[1]):t(r)}catch(t){Uw(e,"throw",t)}},jw=dg,Gw=ku,Ww=wc,Hw=mu,Kw=yg,Yw=Eg,zw=Array,Xw=Jn,Zw=2147483647,Jw=/[^\0-\u007E]/,Qw=/[.\u3002\uFF0E\uFF61]/g,qw="Overflow: input needs wider integers to process",$w=RangeError,eN=Xw(Qw.exec),tN=Math.floor,rN=String.fromCharCode,iN=Xw("".charCodeAt),nN=Xw([].join),oN=Xw([].push),sN=Xw("".replace),aN=Xw("".split),cN=Xw("".toLowerCase),dN=function(e){return e+22+75*(e<26)},uN=function(e,t,r){var i=0;for(e=r?tN(e/700):e>>1,e+=tN(e/t);e>455;)e=tN(e/35),i+=36;return tN(i+36*e/(e+38))},lN=function(e){var t=[];e=function(e){for(var t=[],r=0,i=e.length;r<i;){var n=iN(e,r++);if(n>=55296&&n<=56319&&r<i){var o=iN(e,r++);56320==(64512&o)?oN(t,((1023&n)<<10)+(1023&o)+65536):(oN(t,n),r--)}else oN(t,n)}return t}(e);var r,i,n=e.length,o=128,s=0,a=72;for(r=0;r<e.length;r++)(i=e[r])<128&&oN(t,rN(i));var c=t.length,d=c;for(c&&oN(t,"-");d<n;){var u=Zw;for(r=0;r<e.length;r++)(i=e[r])>=o&&i<u&&(u=i);var l=d+1;if(u-o>tN((Zw-s)/l))throw $w(qw);for(s+=(u-o)*l,o=u,r=0;r<e.length;r++){if((i=e[r])<o&&++s>Zw)throw $w(qw);if(i==o){for(var h=s,p=36;;){var f=p<=a?1:p>=a+26?26:p-a;if(h<f)break;var E=h-f,m=36-f;oN(t,rN(dN(f+E%m))),h=tN(E/m),p+=36}oN(t,rN(dN(h))),a=uN(s,l,d==c),s=0,d++}}s++,o++}return nN(t,"")},hN=mc,pN=To,fN=nC,EN=$n,mN=Va,_N=Jn,TN=sh,gN=ch,SN=ES,RN=Bs,yN=kw,vN=function(e){var t=Fw(e),r=Gw(this),i=arguments.length,n=i>1?arguments[1]:void 0,o=void 0!==n;o&&(n=xw(n,i>2?arguments[2]:void 0));var s,a,c,d,u,l,h=Yw(t),p=0;if(!h||this===zw&&jw(h))for(s=Ww(t),a=r?new this(s):zw(s);s>p;p++)l=o?n(t[p],p):t[p],Hw(a,p,l);else for(u=(d=Kw(t,h)).next,a=r?new this:[];!(c=Vw(u,d)).done;p++)l=o?Bw(d,n,[c.value,p],!0):c.value,Hw(a,p,l);return a.length=p,a},AN=ql,bN=__.codeAt,IN=function(e){var t,r,i=[],n=aN(sN(cN(e),Qw,"."),".");for(t=0;t<n.length;t++)r=n[t],oN(i,eN(Jw,r)?"xn--"+lN(r):r);return nN(i,".")},ON=td,CN=Ph,wN=bS,NN=Rw,DN=Xh,PN=DN.set,LN=DN.getterFor("URL"),kN=NN.URLSearchParams,MN=NN.getState,UN=EN.URL,xN=EN.TypeError,VN=EN.parseInt,FN=Math.floor,BN=Math.pow,jN=_N("".charAt),GN=_N(/./.exec),WN=_N([].join),HN=_N(1..toString),KN=_N([].pop),YN=_N([].push),zN=_N("".replace),XN=_N([].shift),ZN=_N("".split),JN=_N("".slice),QN=_N("".toLowerCase),qN=_N([].unshift),$N="Invalid scheme",eD="Invalid host",tD="Invalid port",rD=/[a-z]/i,iD=/[\d+-.a-z]/i,nD=/\d/,oD=/^0x/i,sD=/^[0-7]+$/,aD=/^\d+$/,cD=/^[\da-f]+$/i,dD=/[\0\t\n\r #%/:<>?@[\\\]^|]/,uD=/[\0\t\n\r #/:<>?@[\\\]^|]/,lD=/^[\u0000-\u0020]+/,hD=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,pD=/[\t\n\r]/g,fD=function(e){var t,r,i,n;if("number"==typeof e){for(t=[],r=0;r<4;r++)qN(t,e%256),e=FN(e/256);return WN(t,".")}if("object"==typeof e){for(t="",i=function(e){for(var t=null,r=1,i=null,n=0,o=0;o<8;o++)0!==e[o]?(n>r&&(t=i,r=n),i=null,n=0):(null===i&&(i=o),++n);return n>r&&(t=i,r=n),t}(e),r=0;r<8;r++)n&&0===e[r]||(n&&(n=!1),i===r?(t+=r?":":"::",n=!0):(t+=HN(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},ED={},mD=yN({},ED,{" ":1,'"':1,"<":1,">":1,"`":1}),_D=yN({},mD,{"#":1,"?":1,"{":1,"}":1}),TD=yN({},_D,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),gD=function(e,t){var r=bN(e,0);return r>32&&r<127&&!RN(t,e)?e:encodeURIComponent(e)},SD={ftp:21,file:null,http:80,https:443,ws:80,wss:443},RD=function(e,t){var r;return 2==e.length&&GN(rD,jN(e,0))&&(":"==(r=jN(e,1))||!t&&"|"==r)},yD=function(e){var t;return e.length>1&&RD(JN(e,0,2))&&(2==e.length||"/"===(t=jN(e,2))||"\\"===t||"?"===t||"#"===t)},vD=function(e){return"."===e||"%2e"===QN(e)},AD={},bD={},ID={},OD={},CD={},wD={},ND={},DD={},PD={},LD={},kD={},MD={},UD={},xD={},VD={},FD={},BD={},jD={},GD={},WD={},HD={},KD=function(e,t,r){var i,n,o,s=ON(e);if(t){if(n=this.parse(s))throw xN(n);this.searchParams=null}else{if(void 0!==r&&(i=new KD(r,!0)),n=this.parse(s,null,i))throw xN(n);(o=MN(new kN)).bindURL(this),this.searchParams=o}};KD.prototype={type:"URL",parse:function(e,t,r){var i,n,o,s,a,c=this,d=t||AD,u=0,l="",h=!1,p=!1,f=!1;for(e=ON(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=zN(e,lD,""),e=zN(e,hD,"$1")),e=zN(e,pD,""),i=vN(e);u<=i.length;){switch(n=i[u],d){case AD:if(!n||!GN(rD,n)){if(t)return $N;d=ID;continue}l+=QN(n),d=bD;break;case bD:if(n&&(GN(iD,n)||"+"==n||"-"==n||"."==n))l+=QN(n);else{if(":"!=n){if(t)return $N;l="",d=ID,u=0;continue}if(t&&(c.isSpecial()!=RN(SD,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&SD[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?d=xD:c.isSpecial()&&r&&r.scheme==c.scheme?d=OD:c.isSpecial()?d=DD:"/"==i[u+1]?(d=CD,u++):(c.cannotBeABaseURL=!0,YN(c.path,""),d=GD)}break;case ID:if(!r||r.cannotBeABaseURL&&"#"!=n)return $N;if(r.cannotBeABaseURL&&"#"==n){c.scheme=r.scheme,c.path=AN(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,d=HD;break}d="file"==r.scheme?xD:wD;continue;case OD:if("/"!=n||"/"!=i[u+1]){d=wD;continue}d=PD,u++;break;case CD:if("/"==n){d=LD;break}d=jD;continue;case wD:if(c.scheme=r.scheme,n==Sw)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=AN(r.path),c.query=r.query;else if("/"==n||"\\"==n&&c.isSpecial())d=ND;else if("?"==n)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=AN(r.path),c.query="",d=WD;else{if("#"!=n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=AN(r.path),c.path.length--,d=jD;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=AN(r.path),c.query=r.query,c.fragment="",d=HD}break;case ND:if(!c.isSpecial()||"/"!=n&&"\\"!=n){if("/"!=n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,d=jD;continue}d=LD}else d=PD;break;case DD:if(d=PD,"/"!=n||"/"!=jN(l,u+1))continue;u++;break;case PD:if("/"!=n&&"\\"!=n){d=LD;continue}break;case LD:if("@"==n){h&&(l="%40"+l),h=!0,o=vN(l);for(var E=0;E<o.length;E++){var m=o[E];if(":"!=m||f){var _=gD(m,TD);f?c.password+=_:c.username+=_}else f=!0}l=""}else if(n==Sw||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(h&&""==l)return"Invalid authority";u-=vN(l).length+1,l="",d=kD}else l+=n;break;case kD:case MD:if(t&&"file"==c.scheme){d=FD;continue}if(":"!=n||p){if(n==Sw||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(c.isSpecial()&&""==l)return eD;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(s=c.parseHost(l))return s;if(l="",d=BD,t)return;continue}"["==n?p=!0:"]"==n&&(p=!1),l+=n}else{if(""==l)return eD;if(s=c.parseHost(l))return s;if(l="",d=UD,t==MD)return}break;case UD:if(!GN(nD,n)){if(n==Sw||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()||t){if(""!=l){var T=VN(l,10);if(T>65535)return tD;c.port=c.isSpecial()&&T===SD[c.scheme]?null:T,l=""}if(t)return;d=BD;continue}return tD}l+=n;break;case xD:if(c.scheme="file","/"==n||"\\"==n)d=VD;else{if(!r||"file"!=r.scheme){d=jD;continue}if(n==Sw)c.host=r.host,c.path=AN(r.path),c.query=r.query;else if("?"==n)c.host=r.host,c.path=AN(r.path),c.query="",d=WD;else{if("#"!=n){yD(WN(AN(i,u),""))||(c.host=r.host,c.path=AN(r.path),c.shortenPath()),d=jD;continue}c.host=r.host,c.path=AN(r.path),c.query=r.query,c.fragment="",d=HD}}break;case VD:if("/"==n||"\\"==n){d=FD;break}r&&"file"==r.scheme&&!yD(WN(AN(i,u),""))&&(RD(r.path[0],!0)?YN(c.path,r.path[0]):c.host=r.host),d=jD;continue;case FD:if(n==Sw||"/"==n||"\\"==n||"?"==n||"#"==n){if(!t&&RD(l))d=jD;else if(""==l){if(c.host="",t)return;d=BD}else{if(s=c.parseHost(l))return s;if("localhost"==c.host&&(c.host=""),t)return;l="",d=BD}continue}l+=n;break;case BD:if(c.isSpecial()){if(d=jD,"/"!=n&&"\\"!=n)continue}else if(t||"?"!=n)if(t||"#"!=n){if(n!=Sw&&(d=jD,"/"!=n))continue}else c.fragment="",d=HD;else c.query="",d=WD;break;case jD:if(n==Sw||"/"==n||"\\"==n&&c.isSpecial()||!t&&("?"==n||"#"==n)){if(".."===(a=QN(a=l))||"%2e."===a||".%2e"===a||"%2e%2e"===a?(c.shortenPath(),"/"==n||"\\"==n&&c.isSpecial()||YN(c.path,"")):vD(l)?"/"==n||"\\"==n&&c.isSpecial()||YN(c.path,""):("file"==c.scheme&&!c.path.length&&RD(l)&&(c.host&&(c.host=""),l=jN(l,0)+":"),YN(c.path,l)),l="","file"==c.scheme&&(n==Sw||"?"==n||"#"==n))for(;c.path.length>1&&""===c.path[0];)XN(c.path);"?"==n?(c.query="",d=WD):"#"==n&&(c.fragment="",d=HD)}else l+=gD(n,_D);break;case GD:"?"==n?(c.query="",d=WD):"#"==n?(c.fragment="",d=HD):n!=Sw&&(c.path[0]+=gD(n,ED));break;case WD:t||"#"!=n?n!=Sw&&("'"==n&&c.isSpecial()?c.query+="%27":c.query+="#"==n?"%23":gD(n,ED)):(c.fragment="",d=HD);break;case HD:n!=Sw&&(c.fragment+=gD(n,mD))}u++}},parseHost:function(e){var t,r,i;if("["==jN(e,0)){if("]"!=jN(e,e.length-1))return eD;if(t=function(e){var t,r,i,n,o,s,a,c=[0,0,0,0,0,0,0,0],d=0,u=null,l=0,h=function(){return jN(e,l)};if(":"==h()){if(":"!=jN(e,1))return;l+=2,u=++d}for(;h();){if(8==d)return;if(":"!=h()){for(t=r=0;r<4&&GN(cD,h());)t=16*t+VN(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,d>6)return;for(i=0;h();){if(n=null,i>0){if(!("."==h()&&i<4))return;l++}if(!GN(nD,h()))return;for(;GN(nD,h());){if(o=VN(h(),10),null===n)n=o;else{if(0==n)return;n=10*n+o}if(n>255)return;l++}c[d]=256*c[d]+n,2!=++i&&4!=i||d++}if(4!=i)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[d++]=t}else{if(null!==u)return;l++,u=++d}}if(null!==u)for(s=d-u,d=7;0!=d&&s>0;)a=c[d],c[d--]=c[u+s-1],c[u+--s]=a;else if(8!=d)return;return c}(JN(e,1,-1)),!t)return eD;this.host=t}else if(this.isSpecial()){if(e=IN(e),GN(dD,e))return eD;if(t=function(e){var t,r,i,n,o,s,a,c=ZN(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],i=0;i<t;i++){if(""==(n=c[i]))return e;if(o=10,n.length>1&&"0"==jN(n,0)&&(o=GN(oD,n)?16:8,n=JN(n,8==o?1:2)),""===n)s=0;else{if(!GN(10==o?aD:8==o?sD:cD,n))return e;s=VN(n,o)}YN(r,s)}for(i=0;i<t;i++)if(s=r[i],i==t-1){if(s>=BN(256,5-t))return null}else if(s>255)return null;for(a=KN(r),i=0;i<r.length;i++)a+=r[i]*BN(256,3-i);return a}(e),null===t)return eD;this.host=t}else{if(GN(uD,e))return eD;for(t="",r=vN(e),i=0;i<r.length;i++)t+=gD(r[i],ED);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return RN(SD,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&RD(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,i=e.password,n=e.host,o=e.port,s=e.path,a=e.query,c=e.fragment,d=t+":";return null!==n?(d+="//",e.includesCredentials()&&(d+=r+(i?":"+i:"")+"@"),d+=fD(n),null!==o&&(d+=":"+o)):"file"==t&&(d+="//"),d+=e.cannotBeABaseURL?s[0]:s.length?"/"+WN(s,"/"):"",null!==a&&(d+="?"+a),null!==c&&(d+="#"+c),d},setHref:function(e){var t=this.parse(e);if(t)throw xN(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new YD(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+fD(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(ON(e)+":",AD)},getUsername:function(){return this.username},setUsername:function(e){var t=vN(ON(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=gD(t[r],TD)}},getPassword:function(){return this.password},setPassword:function(e){var t=vN(ON(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=gD(t[r],TD)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?fD(e):fD(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,kD)},getHostname:function(){var e=this.host;return null===e?"":fD(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,MD)},getPort:function(){var e=this.port;return null===e?"":ON(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=ON(e))?this.port=null:this.parse(e,UD))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+WN(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,BD))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=ON(e))?this.query=null:("?"==jN(e,0)&&(e=JN(e,1)),this.query="",this.parse(e,WD)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=ON(e))?("#"==jN(e,0)&&(e=JN(e,1)),this.fragment="",this.parse(e,HD)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var YD=function(e){var t=SN(this,zD),r=wN(arguments.length,1)>1?arguments[1]:void 0,i=PN(t,new KD(e,!1,r));pN||(t.href=i.serialize(),t.origin=i.getOrigin(),t.protocol=i.getProtocol(),t.username=i.getUsername(),t.password=i.getPassword(),t.host=i.getHost(),t.hostname=i.getHostname(),t.port=i.getPort(),t.pathname=i.getPathname(),t.search=i.getSearch(),t.searchParams=i.getSearchParams(),t.hash=i.getHash())},zD=YD.prototype,XD=function(e,t){return{get:function(){return LN(this)[e]()},set:t&&function(e){return LN(this)[t](e)},configurable:!0,enumerable:!0}};if(pN&&(gN(zD,"href",XD("serialize","setHref")),gN(zD,"origin",XD("getOrigin")),gN(zD,"protocol",XD("getProtocol","setProtocol")),gN(zD,"username",XD("getUsername","setUsername")),gN(zD,"password",XD("getPassword","setPassword")),gN(zD,"host",XD("getHost","setHost")),gN(zD,"hostname",XD("getHostname","setHostname")),gN(zD,"port",XD("getPort","setPort")),gN(zD,"pathname",XD("getPathname","setPathname")),gN(zD,"search",XD("getSearch","setSearch")),gN(zD,"searchParams",XD("getSearchParams")),gN(zD,"hash",XD("getHash","setHash"))),TN(zD,"toJSON",(function(){return LN(this).serialize()}),{enumerable:!0}),TN(zD,"toString",(function(){return LN(this).serialize()}),{enumerable:!0}),UN){var ZD=UN.createObjectURL,JD=UN.revokeObjectURL;ZD&&TN(YD,"createObjectURL",mN(ZD,UN)),JD&&TN(YD,"revokeObjectURL",mN(JD,UN))}CN(YD,"URL"),hN({global:!0,constructor:!0,forced:!fN,sham:!pN},{URL:YD});var QD=mc,qD=Hn,$D=bS,eP=td,tP=nC,rP=Zo("URL");QD({target:"URL",stat:!0,forced:!(tP&&qD((function(){rP.canParse()})))},{canParse:function(e){var t=$D(arguments.length,1),r=eP(e),i=t<2||void 0===arguments[1]?void 0:eP(arguments[1]);try{return!!new rP(r,i)}catch(e){return!1}}});var iP=Z(Ho.URL);function nP(){const e=new Blob([atob("Y29uc3QgdD0idmlkZW8vaDI2NCIsZT0idmlkZW8vaDI2NSI7ZnVuY3Rpb24gbih0LGUsbil7bGV0IGE9bmV3IFVpbnQ4QXJyYXkodCxlLG4pLHI9W10saT0wO2Zvcig7ci5sZW5ndGg8bjspaSszPG4mJjA9PT1hW2ldJiYwPT09YVtpKzFdJiYzPT09YVtpKzJdJiYoMD09PWFbaSszXXx8MT09PWFbaSszXXx8Mj09PWFbaSszXXx8Mz09PWFbaSszXSk/KHIucHVzaChhW2ldLGFbaSsxXSxhW2krM10pLGkrPTQpOihyLnB1c2goYVtpXSksaSsrKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkocil9ZnVuY3Rpb24gYShhLHIpe3N3aXRjaChyKXtjYXNlIHQ6cmV0dXJuIGZ1bmN0aW9uKHQpe2NvbnN0IGU9bmV3IERhdGFWaWV3KHQuZGF0YSk7bGV0IGE9MDtmb3IoO2ErNDx0LmRhdGEuYnl0ZUxlbmd0aDspe2lmKDA9PT1lLmdldFVpbnQ4KGErMCkmJjA9PT1lLmdldFVpbnQ4KGErMSkmJjA9PT1lLmdldFVpbnQ4KGErMikmJjE9PT1lLmdldFVpbnQ4KGErMykmJjY9PT1lLmdldFVpbnQ4KGErNCkpe2xldCByPWErNixpPTAsbz0wO2Zvcig7MjU1PT09KG89ZS5nZXRVaW50OChyKyspKTspaSs9MjU1O2krPW87Y29uc3Qgcz1uKHQuZGF0YSxyLGkpO3JldHVybiBuZXcgVWludDhBcnJheShzKX1hKyt9cmV0dXJuIG51bGx9KGEpO2Nhc2UgZTpyZXR1cm4gZnVuY3Rpb24odCl7Y29uc3QgZT1uZXcgRGF0YVZpZXcodC5kYXRhKTtsZXQgYT0wO2Zvcig7YSs1PHQuZGF0YS5ieXRlTGVuZ3RoOyl7aWYoMD09PWUuZ2V0VWludDgoYSswKSYmMD09PWUuZ2V0VWludDgoYSsxKSYmMD09PWUuZ2V0VWludDgoYSsyKSYmMT09PWUuZ2V0VWludDgoYSszKSYmNzg9PT1lLmdldFVpbnQ4KGErNCkmJjE9PT1lLmdldFVpbnQ4KGErNSkmJjEwMT09PWUuZ2V0VWludDgoYSs2KSl7bGV0IHI9YSs3LGk9MCxvPTA7Zm9yKDsyNTU9PT0obz1lLmdldFVpbnQ4KHIrKykpOylpKz0yNTU7aSs9bztjb25zdCBzPW4odC5kYXRhLHIsaSk7cmV0dXJuIG5ldyBVaW50OEFycmF5KHMpfWErK31yZXR1cm4gbnVsbH0oYSk7ZGVmYXVsdDpyZXR1cm4gbnVsbH19ZnVuY3Rpb24gcih0KXtjb25zdCBlPXQubGVuZ3RoO2xldCBuPVtdLGE9MDtmb3IoO2E8ZTspYSsyPGUmJjA9PT10W2FdJiYwPT09dFthKzFdJiYoMD09PXRbYSsyXXx8MT09PXRbYSsyXXx8Mj09PXRbYSsyXXx8Mz09PXRbYSsyXSk/KG4ucHVzaCh0W2FdLHRbYSsxXSwzLHRbYSsyXSksYSs9Myk6KG4ucHVzaCh0W2FdKSxhKyspO3JldHVybiBuZXcgVWludDhBcnJheShuKX1mdW5jdGlvbiBpKG4sYSxpKXtzd2l0Y2goaSl7Y2FzZSB0OnJldHVybiBmdW5jdGlvbih0LGUpe2NvbnN0IG49cihlKSxhPW4ubGVuZ3RoLGk9TWF0aC5mbG9vcihhLzI1NSksbz1hJTI1NSxzPW5ldyBVaW50OEFycmF5KDYraSsxK2ErdC5ieXRlTGVuZ3RoKTtzWzBdPTAsc1sxXT0wLHNbMl09MCxzWzNdPTEsc1s0XT02LHNbNV09MTAxO2xldCBmPTA7Zm9yKDtmPGk7KXNbNitmXT0yNTUsZisrO3JldHVybiBzWzYrZl09byxmKysscy5zZXQobiw2K2YpLHMuc2V0KG5ldyBVaW50OEFycmF5KHQpLDYrZithKSxzLmJ1ZmZlcn0obixhKTtjYXNlIGU6cmV0dXJuIGZ1bmN0aW9uKHQsZSl7Y29uc3Qgbj1yKGUpLGE9bi5sZW5ndGgsaT1NYXRoLmZsb29yKGEvMjU1KSxvPWElMjU1LHM9bmV3IFVpbnQ4QXJyYXkoNytpKzErYSsxK3QuYnl0ZUxlbmd0aCk7c1swXT0wLHNbMV09MCxzWzJdPTAsc1szXT0xLHNbNF09Nzgsc1s1XT0xLHNbNl09MTAxO2xldCBmPTA7Zm9yKDtmPGk7KXNbNytmXT0yNTUsZisrO3JldHVybiBzWzcrZl09byxmKysscy5zZXQobiw3K2YpLGYrPWEsc1s3K2ZdPTEyOCxmKysscy5zZXQobmV3IFVpbnQ4QXJyYXkodCksNytmKSxzLmJ1ZmZlcn0obixhKTtkZWZhdWx0OnJldHVybiBudWxsfX1mdW5jdGlvbiBvKG4pe2lmKG4ubGVuZ3RoPDUpcmV0dXJuIiI7bGV0IGE9LTE7Zm9yKGxldCB0PTA7dDxuLmxlbmd0aC0zO3QrKyl7aWYoMD09PW5bdF0mJjA9PT1uW3QrMV0mJjE9PT1uW3QrMl0pe2E9dDticmVha31pZih0PG4ubGVuZ3RoLTQmJjA9PT1uW3RdJiYwPT09blt0KzFdJiYwPT09blt0KzJdJiYxPT09blt0KzNdKXthPXQ7YnJlYWt9fWlmKC0xPT09YSlyZXR1cm4iIjtjb25zdCByPWErKDA9PT1uW2ErMl0/NDozKTtpZihyPj1uLmxlbmd0aClyZXR1cm4iIjtjb25zdCBpPW5bcl07aWYoMTI4JmkpcmV0dXJuIiI7aWYoKGk+PjEmNjMpPj0zMilyZXR1cm4gZTtpZihyKzE8bi5sZW5ndGgpe2lmKDA9PSgyNDgmbltyKzFdKSlyZXR1cm4gZX1yZXR1cm4oMzEmaSk8PTMxP3Q6IiJ9Y29uc3Qgcz03MSxmPTEsbD0yLHU9MSxnPTI7dmFyIGM7ZnVuY3Rpb24gZCh0LGU9ITEpe2NvbnN0IG49dC5nZXRVaW50OCgwKTtpZihuIT09cylyZXR1cm47Y29uc3QgYT10LmdldFVpbnQxNigxKSxyPWYrbCthLGk9bmV3IFVpbnQ4QXJyYXkodC5ieXRlTGVuZ3RoLXIpO2kuc2V0KG5ldyBVaW50OEFycmF5KHQuYnVmZmVyLHIsdC5ieXRlTGVuZ3RoLXIpKTtjb25zdCBvPXttOm4sdGx2TGVuOmEsdGx2OltdLGZyYW1lOml9O2xldCBkPWYrbDtmb3IoO2Q8cjspe2NvbnN0IG49dC5nZXRVaW50OChkKSxhPXQuZ2V0VWludDE2KGQrdSkscj11K2c7aWYobj09PWMuQVVESU9fTEVWRUwpe2xldCBpPXQuZ2V0VWludDgoZCtyKTtmb3IobGV0IGU9MTtlPGE7ZSsrKWk9aTw8OHx0LmdldFVpbnQ4KGQrcitlKTtvLnRsdi5wdXNoKHt0YWc6bixsZW5ndGg6YSx2YWx1ZTplPzEyN15pPj4xOjEyNyZpfSl9ZWxzZSBpZihuPT09Yy5NRVRBREFUQXx8bj09PWMuQVVESU9fNjRfQklUX1BUUyl7Y29uc3QgZT1uZXcgVWludDhBcnJheShhKTtmb3IobGV0IG49MDtuPGE7bisrKWVbbl09dC5nZXRVaW50OChkK3Irbik7by50bHYucHVzaCh7dGFnOm4sbGVuZ3RoOmEsdmFsdWU6ZX0pfWQrPXIrYX1yZXR1cm4gb30hZnVuY3Rpb24odCl7dFt0LkFVRElPX0xFVkVMPTFdPSJBVURJT19MRVZFTCIsdFt0Lk1FVEFEQVRBPTJdPSJNRVRBREFUQSIsdFt0LkFVRElPXzY0X0JJVF9QVFM9M109IkFVRElPXzY0X0JJVF9QVFMifShjfHwoYz17fSkpLHNlbGYub25ydGN0cmFuc2Zvcm09dD0+e2NvbnN0IGU9dC50cmFuc2Zvcm1lcixuPVtdLHI9W10saD1bXTtsZXQgcCxVPW51bGw7ZS5vcHRpb25zLnBvcnQub25tZXNzYWdlPXQ9Pnt0LmRhdGEuc2VpJiZuLnB1c2godC5kYXRhLnNlaSksdC5kYXRhLm1ldGFkYXRhJiZyLnB1c2godC5kYXRhLm1ldGFkYXRhKSx2b2lkIDAhPT10LmRhdGEucHRzJiZoLnB1c2godC5kYXRhLnB0cyl9LHNlbGYucG9zdE1lc3NhZ2UoInN0YXJ0ZWQiKTtjb25zdCB5PWUucmVhZGFibGUuZ2V0UmVhZGVyKCksQT1lLndyaXRhYmxlLmdldFdyaXRlcigpOyJzZWktcngiPT09ZS5vcHRpb25zLm5hbWU/ZnVuY3Rpb24gdChlKXt5LnJlYWQoKS50aGVuKChuPT57aWYoIW4uZG9uZSl7aWYobi52YWx1ZSBpbnN0YW5jZW9mIFJUQ0VuY29kZWRWaWRlb0ZyYW1lKXtjb25zdCB0PW8obmV3IFVpbnQ4QXJyYXkobi52YWx1ZS5kYXRhKSkscj1hKG4udmFsdWUsdCk7aWYociYmZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe3NlaTpyfSksIVUpe2NvbnN0IHQ9bi52YWx1ZS5nZXRNZXRhZGF0YSgpfHx7fTtVPXt0eXBlOm4udmFsdWUudHlwZSxydHBUaW1lc3RhbXA6bi52YWx1ZS50aW1lc3RhbXAscGF5bG9hZFR5cGU6dC5wYXlsb2FkVHlwZXx8MCxzc3JjOnQuc3luY2hyb25pemF0aW9uU291cmNlfHwwLGxlbmd0aDpuLnZhbHVlLmRhdGEuYnl0ZUxlbmd0aCwuLi4ibWltZVR5cGUiaW4gdD97bWltZVR5cGU6dC5taW1lVHlwZX06e319LGUub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHtmaXJzdEZyYW1lSW5mbzpVfSl9fUEud3JpdGUobi52YWx1ZSksZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe3RyYW5zZm9ybWVkOiEwfSksdChlKX19KSl9KGUpOiJzZWktdHgiPT09ZS5vcHRpb25zLm5hbWU/ZnVuY3Rpb24gdChlKXt5LnJlYWQoKS50aGVuKChhPT57aWYoIWEuZG9uZSl7aWYoYS52YWx1ZSBpbnN0YW5jZW9mIFJUQ0VuY29kZWRWaWRlb0ZyYW1lKXtjb25zdCB0PW8obmV3IFVpbnQ4QXJyYXkoYS52YWx1ZS5kYXRhKSksZT1uLnNoaWZ0KCk7aWYoZSl7Y29uc3Qgbj1pKGEudmFsdWUuZGF0YSxlLHQpO24mJihhLnZhbHVlLmRhdGE9bil9fUEud3JpdGUoYS52YWx1ZSksZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe3RyYW5zZm9ybWVkOiEwfSksdChlKX19KSl9KGUpOiJhdWRpby1tZXRhZGF0YS1yeCI9PT1lLm9wdGlvbnMubmFtZT9mdW5jdGlvbiB0KGUpe3kucmVhZCgpLnRoZW4oKG49PntpZighbi5kb25lKXtpZihuLnZhbHVlIGluc3RhbmNlb2YgUlRDRW5jb2RlZEF1ZGlvRnJhbWUpe2NvbnN0IHQ9bmV3IERhdGFWaWV3KG4udmFsdWUuZGF0YSksYT1uLnZhbHVlLmdldE1ldGFkYXRhKCk7bGV0IHIsaT0hMTtpZihpPWEmJnZvaWQgMCE9PWEubWltZVR5cGU/ImF1ZGlvL3JlZCI9PT1hLm1pbWVUeXBlOmZ1bmN0aW9uKHQsZSl7aWYodm9pZCAwPT09ZSlyZXR1cm4hMTtjb25zdCBuPXQuZ2V0VWludDgoMCk7cmV0dXJuIDcxIT09biYmISEoMTI4Jm4mJigxMjcmbik9PT1lKX0odCxwKSxpKXtjb25zdCBlPWZ1bmN0aW9uKHQpe2lmKHQuYnl0ZUxlbmd0aDw9MClyZXR1cm5bXTtjb25zdCBlPVtdO2xldCBuPTA7Zm9yKDtuPHQuYnl0ZUxlbmd0aDspe2NvbnN0IGE9KDEyOCZ0LmdldFVpbnQ4KG4pKT4+NyxyPTEyNyZ0LmdldFVpbnQ4KG4pO2lmKCEoYSYmbis0PD10LmJ5dGVMZW5ndGgpKXtuKys7YnJlYWt9e2NvbnN0IGE9dC5nZXRVaW50MzIobiwhMSksaT0oMTY3NzYxOTImYSk+PjEwLG89MTAyMyZhO2UucHVzaCh7cHQ6cix0c19vZmZzZXQ6aSxsZW5ndGg6byxkYXRhOm5ldyBVaW50OEFycmF5fSksbis9NH19bGV0IGE9dC5ieXRlTGVuZ3RoLW47Zm9yKGNvbnN0IHIgb2YgZSl7aWYoci5sZW5ndGg+YSlyZXR1cm4gY29uc29sZS53YXJuKCJCcm9rZW4gcmVkIHBheWxvYWQiKSxbXTtyLmxlbmd0aD4wJiYoci5kYXRhPW5ldyBVaW50OEFycmF5KHQuYnVmZmVyLHQuYnl0ZU9mZnNldCtuLHIubGVuZ3RoKSxuKz1yLmxlbmd0aCxhLT1yLmxlbmd0aCl9aWYoYT4wKXtjb25zdCByPXtwdDplLmxlbmd0aD4wP2VbZS5sZW5ndGgtMV0ucHQ6MCx0c19vZmZzZXQ6MCxsZW5ndGg6YSxkYXRhOm5ldyBVaW50OEFycmF5KHQuYnVmZmVyLHQuYnl0ZU9mZnNldCtuLGEpfTtlLnB1c2gocil9cmV0dXJuIGV9KHQpO2lmKGUubGVuZ3RoPjApe2NvbnN0IHQ9ZnVuY3Rpb24odCl7bGV0IGU9MDtmb3IobGV0IG49MDtuPHQubGVuZ3RoO24rKyllKz1uPHQubGVuZ3RoLTE/NDoxLGUrPXRbbl0ubGVuZ3RoO2NvbnN0IG49bmV3IFVpbnQ4QXJyYXkoZSk7bGV0IGE9MDtmb3IobGV0IGU9MDtlPHQubGVuZ3RoO2UrKylpZihlPHQubGVuZ3RoLTEpe2NvbnN0IHI9KDIxNDc0ODM2NDh8KDEyNyZ0W2VdLnB0KTw8MjR8KDI2MjE0MyZ0W2VdLnRzX29mZnNldCk8PDEwfDEwMjMmdFtlXS5sZW5ndGgpPj4+MDtuW2ErK109cj4+MjQmMjU1LG5bYSsrXT1yPj4xNiYyNTUsblthKytdPXI+PjgmMjU1LG5bYSsrXT0yNTUmcn1lbHNlIG5bYSsrXT0xMjcmdFtlXS5wdDtmb3IoY29uc3QgZSBvZiB0KW4uc2V0KGUuZGF0YSxhKSxhKz1lLmxlbmd0aDtyZXR1cm4gbn0oZS5tYXAoKHQ9Pntjb25zdCBlPW5ldyBVaW50OEFycmF5KHQubGVuZ3RoKTtlLnNldCh0LmRhdGEpO2NvbnN0IG49ZChuZXcgRGF0YVZpZXcoZS5idWZmZXIpKTtyZXR1cm4gbj8uZnJhbWUmJih0LmRhdGE9bj8uZnJhbWUpLHI9bix0fSkpKTtuLnZhbHVlLmRhdGE9dC5idWZmZXJ9fWVsc2Ugcj1kKHQpLHImJihuLnZhbHVlLmRhdGE9ci5mcmFtZS5idWZmZXIpO2lmKHIpe2xldCB0PXIudGx2LmZpbmQoKHQ9PnQudGFnPT09Yy5NRVRBREFUQSkpO2lmKHQmJnQudmFsdWUgaW5zdGFuY2VvZiBVaW50OEFycmF5JiZlLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7bWV0YWRhdGE6dC52YWx1ZX0pLHQ9ci50bHYuZmluZCgodD0+dC50YWc9PT1jLkFVRElPXzY0X0JJVF9QVFMpKSx0JiZ0LnZhbHVlIGluc3RhbmNlb2YgVWludDhBcnJheSYmOD09dC52YWx1ZS5sZW5ndGgpe2NvbnN0IG49bmV3IERhdGFWaWV3KHQudmFsdWUuYnVmZmVyKS5nZXRCaWdVaW50NjQoMCwhMCk7dCYmdC52YWx1ZSBpbnN0YW5jZW9mIFVpbnQ4QXJyYXkmJmUub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHtwdHM6bn0pfX19QS53cml0ZShuLnZhbHVlKSxlLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7dHJhbnNmb3JtZWQ6ITB9KSx0KGUpfX0pKX0oZSk6ImF1ZGlvLW1ldGFkYXRhLXR4Ij09PWUub3B0aW9ucy5uYW1lJiZmdW5jdGlvbiB0KGUpe3kucmVhZCgpLnRoZW4oKG49PntpZighbi5kb25lKXtpZihlLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7Z2V0TWV0YWRhdGE6ITB9KSxuLnZhbHVlIGluc3RhbmNlb2YgUlRDRW5jb2RlZEF1ZGlvRnJhbWUpe2NvbnN0IHQ9ci5zaGlmdCgpLGU9aC5zaGlmdCgpO2lmKHR8fHZvaWQgMCE9PWUpe2NvbnN0IGE9ZnVuY3Rpb24odCxlKXtpZih2b2lkIDA9PT10JiZ2b2lkIDA9PT1lKXJldHVybiBudWxsO2xldCBuPTAsYT1udWxsLHI9bnVsbDtpZih0KXtjb25zdCBlPXQubGVuZ3RoLHI9dStnK2U7YT1uZXcgVWludDhBcnJheShyKTtjb25zdCBpPW5ldyBEYXRhVmlldyhhLmJ1ZmZlcik7aS5zZXRVaW50OCgwLGMuTUVUQURBVEEpLGkuc2V0VWludDE2KHUsZSksYS5zZXQodCx1K2cpLG4rPXJ9aWYoZSl7Y29uc3QgdD04LGE9dStnK3Q7cj1uZXcgVWludDhBcnJheShhKTtjb25zdCBpPW5ldyBEYXRhVmlldyhyLmJ1ZmZlcik7aS5zZXRVaW50OCgwLGMuQVVESU9fNjRfQklUX1BUUyksaS5zZXRVaW50MTYodSx0KSxpLnNldEJpZ1VpbnQ2NCh1K2csZS52YWx1ZU9mKCksITApLG4rPWF9Y29uc3QgaT1uZXcgVWludDhBcnJheShmK2wrbiksbz1uZXcgRGF0YVZpZXcoaS5idWZmZXIpO28uc2V0VWludDgoMCxzKSxvLnNldFVpbnQxNihmLG4pO2xldCBkPWYrbDtyZXR1cm4gYSYmKGkuc2V0KGEsZCksZCs9YS5sZW5ndGgpLHImJmkuc2V0KHIsZCksaX0odCxlKTtpZihhKXtjb25zdCB0PW5ldyBVaW50OEFycmF5KGEubGVuZ3RoK24udmFsdWUuZGF0YS5ieXRlTGVuZ3RoKTt0LnNldChhLDApLHQuc2V0KG5ldyBVaW50OEFycmF5KG4udmFsdWUuZGF0YSksYS5ieXRlTGVuZ3RoKSxuLnZhbHVlLmRhdGE9dC5idWZmZXJ9fX1BLndyaXRlKG4udmFsdWUpLGUub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHt0cmFuc2Zvcm1lZDohMH0pLHQoZSl9fSkpfShlKSxwPWUub3B0aW9ucy5wdH0sc2VsZi5wb3N0TWVzc2FnZSgicmVnaXN0ZXJlZCIpOwo=")],{type:"text/javascript"});return setTimeout((()=>iP.revokeObjectURL(e)),0),new Worker(iP.createObjectURL(e))}const oP=71,sP=1,aP=2,cP=1,dP=2;var uP=function(e){return e[e.AUDIO_LEVEL=1]="AUDIO_LEVEL",e[e.METADATA=2]="METADATA",e[e.AUDIO_64_BIT_PTS=3]="AUDIO_64_BIT_PTS",e}(uP||{});function lP(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=e.getUint8(0);if(r!==oP)return;const i=e.getUint16(1),n=sP+aP+i,o=new Uint8Array(e.byteLength-n);o.set(new Uint8Array(e.buffer,n,e.byteLength-n));const s={m:r,tlvLen:i,tlv:[],frame:o};let a=sP+aP;for(;a<n;){const r=e.getUint8(a),i=e.getUint16(a+cP),n=cP+dP;if(r===uP.AUDIO_LEVEL){let o=e.getUint8(a+n);for(let t=1;t<i;t++)o=o<<8|e.getUint8(a+n+t);s.tlv.push({tag:r,length:i,value:t?127^o>>1:127&o})}else if(r===uP.METADATA||r===uP.AUDIO_64_BIT_PTS){const t=new Uint8Array(i);for(let r=0;r<i;r++)t[r]=e.getUint8(a+n+r);s.tlv.push({tag:r,length:i,value:t})}a+=n+i}return s}const hP=new Map;function pP(e,t,r){const{chunk:i,controller:n}=r,o=function(e,t){if(void 0===e&&void 0===t)return null;let r=0,i=null,n=null;if(e){const t=e.length,n=cP+dP+t;i=new Uint8Array(n);const o=new DataView(i.buffer);o.setUint8(0,uP.METADATA),o.setUint16(cP,t),i.set(e,cP+dP),r+=n}if(t){const e=8,i=cP+dP+e;n=new Uint8Array(i);const o=new DataView(n.buffer);o.setUint8(0,uP.AUDIO_64_BIT_PTS),o.setUint16(cP,e),o.setBigUint64(cP+dP,t.valueOf(),!0),r+=i}const o=new Uint8Array(sP+aP+r),s=new DataView(o.buffer);s.setUint8(0,oP),s.setUint16(sP,r);let a=sP+aP;return i&&(o.set(i,a),a+=i.length),n&&o.set(n,a),o}(e,t);if(o){const e=new Uint8Array(o.length+i.data.byteLength);e.set(o,0),e.set(new Uint8Array(i.data),o.byteLength),i.data=e.buffer}n.enqueue(i)}var fP=Z(ET);const EP=127,mP=1e-10,_P=139/13;const TP=new Map;function gP(e,t,r){const i="".concat(e,"-").concat(t,"-").concat(r);let n=0;if(TP.has(i))n=TP.get(i);else{const o=.5;n=Math.log(function(e,t){const r=e-t;t<r&&(t=r);let i=1;for(let r=e,n=1;r>t;r--,n++)i=i*r/n;return i}(t,e))+e*Math.log(o)+(t-e)*Math.log(1-o)-Math.log(r)+r*e,TP.set(i,n)}return n<mP&&(n=mP),n}function SP(e,t,r){const i=t.length,n=e.length/i;let o=!1;for(let s=0,a=0;s<i;s++){let i=0;for(let t=a+n;a<t;a++)e[a]>r&&i++;t[s]!==i&&(t[s]=i,o=!0)}return o}window.cache=TP;let RP=0;class yP{constructor(e){N_(this,"id",void 0),N_(this,"immediates",[]),N_(this,"lastNonSilence",-1),N_(this,"immediateSpeechActivityScore",mP),N_(this,"lastLevelChangedTime",Date.now()),N_(this,"levels",[]),N_(this,"longs",[]),N_(this,"longSpeechActivityScore",mP),N_(this,"mediums",[]),N_(this,"mediumSpeechActivityScore",mP),N_(this,"minLevel",0),N_(this,"nextMinLevel",0),N_(this,"nextMinLevelWindowLength",0),N_(this,"energyScore",0),this.id=e||"".concat(RP++),this.immediates.length=50,this.mediums.length=10,this.longs.length=1,this.levels.length=this.immediates.length}computeImmediates(){const e=this.immediates,t=this.levels,r=this.minLevel+_P;let i=!1;for(let n=0;n<e.length;++n){let o=t[n];o<r&&(o=0);const s=Math.floor(o/_P);e[n]!==s&&(e[n]=s,i=!0)}return i}computeLongs(){return SP(this.mediums,this.longs,4)}computeMediums(){return SP(this.immediates,this.mediums,7)}evaluateImmediateSpeechActivityScore(){this.immediateSpeechActivityScore=gP(this.immediates[0],13,.78)}evaluateLongSpeechActivityScore(e){this.longSpeechActivityScore=gP(this.longs[0],10,47),this.longSpeechActivityScore>mP&&(this.lastNonSilence=e)}evaluateMediumSpeechActivityScore(){this.mediumSpeechActivityScore=gP(this.mediums[0],5,24)}evaluateSpeechActivityScores(e){this.computeImmediates()&&(this.evaluateImmediateSpeechActivityScore(),this.computeMediums()&&(this.evaluateMediumSpeechActivityScore(),this.computeLongs()&&this.evaluateLongSpeechActivityScore(e)))}getLastLevelChangedTime(){return this.lastLevelChangedTime}getLevels(){var e;return"[".concat(fP(e=[...this.levels]).call(e).join(),"]")}getSpeechActivityScore(e){switch(e){case 0:return this.immediateSpeechActivityScore;case 1:return this.mediumSpeechActivityScore;case 2:return this.longSpeechActivityScore;default:throw new Error("interval "+e)}}levelChanged(e,t){if(this.lastLevelChangedTime<=t){this.lastLevelChangedTime=t;let r=e;return e<0&&(r=0),e>EP&&(r=EP),this.levels.unshift(r),this.levels.length>this.immediates.length&&this.levels.pop(),this.updateMinLevel(r),r>=this.minLevel+_P?r:r/2}return-1}levelTimedOut(){this.levelChanged(0,this.lastLevelChangedTime)}updateMinLevel(e){if(0!==e){if(0===this.minLevel||this.minLevel>e)return this.minLevel=e,this.nextMinLevel=0,void(this.nextMinLevelWindowLength=0);if(0===this.nextMinLevel)return this.nextMinLevel=e,void(this.nextMinLevelWindowLength=1);if(this.nextMinLevel>e&&(this.nextMinLevel=e),this.nextMinLevelWindowLength++,this.nextMinLevelWindowLength>=750){let e=Math.sqrt(this.minLevel*this.nextMinLevel);e<0?e=0:e>EP&&(e=EP),this.minLevel=e,this.nextMinLevel=0,this.nextMinLevelWindowLength=0}}}}class vP{constructor(e){N_(this,"algorithm",void 0),this.algorithm=e}execute(){let e=!this.algorithm;if(!e)try{const t=this.algorithm.runInDecisionMaker(this);t<=0?e=!0:setTimeout(this.execute.bind(this),t)}catch(t){e=!0}e&&this.algorithm&&this.algorithm.decisionMakerExited(this)}}class AP{constructor(e,t,r){N_(this,"isDominant",void 0),N_(this,"energyRanking",void 0),N_(this,"energyScore",void 0),this.isDominant=e,this.energyRanking=t,this.energyScore=r}}class bP extends pi{constructor(e){super(),N_(this,"dominantId",null),N_(this,"lastDecisionTime",0),N_(this,"lastLevelChangedTime",0),N_(this,"lastLevelIdleTime",0),N_(this,"relativeSpeechActivities",[]),N_(this,"speakers",new Map),N_(this,"enableSilence",!1),N_(this,"timeoutToSilenceInterval",0),N_(this,"decisionMaker",null),N_(this,"loudest",[]),N_(this,"numLoudestToTrack",3),N_(this,"energyExpireTimeMs",250),N_(this,"energyAlphaPct",50),this.timeoutToSilenceInterval=e,this.enableSilence=e>0,this.relativeSpeechActivities.length=3}setLoudestConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;this.numLoudestToTrack=e,null!=t&&(this.energyExpireTimeMs=t),null!=r&&(this.energyAlphaPct=r),this.loudest.length>e&&this.loudest.splice(e)}getDominantSpeaker(){return this.dominantId}isAmongLoudest(e){return this.loudest.some((t=>t.id===e))}levelChanged(e,t){const r=Date.now(),i=this.getOrCreateSpeaker(e);this.lastLevelChangedTime<r&&(this.lastLevelChangedTime=r,this.maybeStartDecisionMaker());const n=i.levelChanged(t,r);return this.updateLoudestList(i,n,r)}runInDecisionMaker(e){if(this.decisionMaker!==e)return-1;if(this.lastDecisionTime>0){if(this.lastDecisionTime-this.lastLevelChangedTime>=15e3)return-1}return this._runInDecisionMaker()}decisionMakerExited(e){this.decisionMaker===e&&(this.decisionMaker=null)}destroy(){this.decisionMaker=null,this.loudest.length=0,this.speakers.clear(),this.removeAllListeners()}addSpeakers(e){e.forEach((e=>{this.speakers.has(e.id)||this.speakers.set(e.id,e)}))}removeSpeakers(e){e.forEach((e=>{this.speakers.delete(e.id)}))}getOrCreateSpeaker(e){let t=this.speakers.get(e);return t||(t=new yP(e),this.speakers.set(e,t),this.maybeStartDecisionMaker()),t}updateLoudestList(e,t,r){const i=e.id===this.dominantId;if(t<0){let t=0;for(;t<this.loudest.length&&this.loudest[t]!==e;)++t;return new AP(i,t,e.energyScore)}if(e.energyScore=Math.floor((this.energyAlphaPct*t+(100-this.energyAlphaPct)*e.energyScore+50)/100),0===this.numLoudestToTrack)return new AP(i,0,e.energyScore);const n=r-this.energyExpireTimeMs;let o=0;for(;o<this.loudest.length;){const t=this.loudest[o];if(t.getLastLevelChangedTime()<n&&this.loudest.length>=this.numLoudestToTrack)this.loudest.splice(o,1);else if(t.id!==e.id)++o;else if(this.loudest.splice(o,1),this.loudest.length<this.numLoudestToTrack)break}let s=0;for(;s<this.loudest.length;){if(this.loudest[s].energyScore<e.energyScore)break;++s}return s<this.numLoudestToTrack&&(this.loudest.splice(s,0,e),this.loudest.length>this.numLoudestToTrack&&this.loudest.splice(this.numLoudestToTrack,1)),new AP(i,s,e.energyScore)}maybeStartDecisionMaker(){!this.decisionMaker&&this.speakers.size>0&&(this.decisionMaker=new vP(this),this.decisionMaker.execute())}makeDecision(e){let t=null,r=null;const i=this.speakers.size;let n=null;if(0===i)n=null;else if(1===i){var o;const t=MA(o=this.speakers).call(o).next().value;if(this.enableSilence&&t){n=t.id,t.evaluateSpeechActivityScores(e);e-t.lastNonSilence>this.timeoutToSilenceInterval&&(n=null)}}else{let t=null==this.dominantId?null:this.speakers.get(this.dominantId);if(null==t){const e=this.speakers.entries().next();e.value&&(n=e.value[0],t=e.value[1])}else n=t.id;null!=t&&t.evaluateSpeechActivityScores(e);const r=this.relativeSpeechActivities;let i=2;for(const o of this.speakers.entries()){const[s,a]=o;if(a===t)continue;a.evaluateSpeechActivityScores(e);for(let e=0;e<r.length;++e){const i=null==t?mP:t.getSpeechActivityScore(e);r[e]=Math.log(a.getSpeechActivityScore(e)/i)}const c=r[0],d=r[1],u=r[2];c>3&&d>2&&u>0&&d>i&&(i=d,n=s)}if(this.enableSilence&&null!=t&&n===t.id){e-t.lastNonSilence>this.timeoutToSilenceInterval&&(n=null)}}null==n&&!this.enableSilence||n===this.dominantId||(t=this.dominantId,this.dominantId=n,r=this.dominantId),null==r&&!this.enableSilence||r===t||this.emit("ActiveSpeakerChanged",r)}_runInDecisionMaker(){const e=Date.now(),t=300-(e-this.lastLevelIdleTime);let r=0;t<=0?(0!==this.lastLevelIdleTime&&this.timeoutIdleLevels(e),this.lastLevelIdleTime=e):r=t;let i=300-(e-this.lastDecisionTime);return i<=0&&(this.lastDecisionTime=e,this.makeDecision(e),i=300-(Date.now()-e)),i>0&&r>i&&(r=i),r}timeoutIdleLevels(e){const t=[];for(const i of MA(r=this.speakers).call(r)){var r;const n=e-i.getLastLevelChangedTime();36e5<n&&(null==this.dominantId||i.id!==this.dominantId)?t.push(i.id):300<n&&i.levelTimedOut()}t.forEach((e=>this.speakers.delete(e)))}}const IP=new Map;let OP=null,CP=null;const wP=3;let NP=[];function DP(e,t){let r=IP.get(e);if(r||(r=function(e){const t=new yP;return IP.set(e,t),OP||(OP=new bP(ln("TOPN_SILENCE_THRESHOLD")||500),OP.on("ActiveSpeakerChanged",(e=>{null!=e&&(CP=e)}))),OP.addSpeakers([t]),t}(e)),IP.size<=wP)return{selected:!0,speaker:r};if(!OP)throw new Error("no active speaker detector");OP.levelChanged(r.id,t),NP=OP.loudest.map((e=>e.id)),CP&&!Ed(NP).call(NP,CP)&&NP.length>=wP&&NP.pop();return{selected:Ed(NP).call(NP,r.id)||r.id===CP,speaker:r}}const PP=1e3,LP=40,kP=new Map,MP=new Map;class UP{get samples(){return this.actives+this.inactives}get activeRate(){return this.actives/this.samples}constructor(e,t){N_(this,"id",void 0),N_(this,"track",void 0),N_(this,"score",0),N_(this,"active",!0),N_(this,"muted",!1),N_(this,"timer",0),N_(this,"actives",0),N_(this,"inactives",0),this.id=e,this.track=t,this.setActive(kP.size<3)}autoCheckActive(){this.autoSetActive(),this.autoAdjustActive(),this.resetTimer(),this.actives=0,this.inactives=0}autoSetActive(){const e=this.active;this.active=this.activeRate>=.8;const{actives:t,inactives:r}=function(){const e=[],t=[];return Array.from(MA(kP).call(kP)).forEach((r=>{r.active?e.push(r):t.push(r)})),{actives:e,inactives:t}}();if(t.length>3){let e;t.forEach((t=>{(!e||e.score>t.score)&&(e=t)})),e&&e.setActive(!1)}if(t.length<3&&r.length>0){let t;r.forEach((e=>{(!t||t.score<e.score)&&e.id!==this.id&&(t=e)})),t&&e&&!this.active&&(t.samples>LP&&t.activeRate-this.activeRate>.4?t.setActive(!0):this.active=!0)}this.setMuted(!this.active)}setActive(e){this.active=e,this.resetTimer(),this.setMuted(!e)}autoAdjustActive(){this.active?this.autoSwitchToInactive():this.autoSwitchToActive()}autoSwitchToActive(){const e=function(e){let t;return Array.from(MA(kP).call(kP)).forEach((r=>{!r.active||r.id===e||r.samples<LP||(!t||r.score<t.score)&&(t=r)})),t}(this.id);e&&this.activeRate-e.activeRate>.4&&(e.setActive(!1),this.setActive(!0))}autoSwitchToInactive(){const e=function(e){let t;return Array.from(MA(kP).call(kP)).forEach((r=>{r.active||r.id===e||r.samples<LP||(!t||r.score>t.score)&&(t=r)})),t}(this.id);e&&e.activeRate-this.activeRate>.4&&(e.setActive(!0),this.setActive(!1))}addSample(e){e?this.actives+=1:this.inactives+=1,this.samples>66.66666666666667&&this.autoCheckActive()}setMuted(e){this.track&&(this.track.enabled=!e,this.muted=e)}resetTimer(){this.clearTimer(),this.timer=window.setTimeout((()=>{if(0!==this.samples)return this.samples<50?this.resetTimer():void this.autoCheckActive()}),PP)}clearTimer(){this.timer&&(clearTimeout(this.timer),this.timer=0)}}let xP;function VP(e,t,r){const i=kP.get(e)||new UP(e,t);return i.score=r,kP.set(e,i),function(e){if(MP.set(e,!0),!xP)return void(xP=Date.now());const t=Date.now();t-xP>1e3&&(MP.get(e)?MP.set(e,!1):(FP(e),MP.delete(e)),xP=t)}(e),i}function FP(e){const t=kP.get(e);t&&(kP.delete(e),t.clearTimer())}const BP=new Map,jP=new Map;function GP(e,t,r,i,n){const o=new DataView(e.data),s=e.getMetadata();let a,c=!1;if(c=s&&void 0!==s.mimeType?"audio/red"===s.mimeType:function(e,t){if(void 0===t)return!1;const r=e.getUint8(0);return 71!==r&&!!(128&r&&(127&r)===t)}(o,t),c){const t=function(e){if(e.byteLength<=0)return[];const t=[];let r=0;for(;r<e.byteLength;){const i=(128&e.getUint8(r))>>7,n=127&e.getUint8(r);if(!(i&&r+4<=e.byteLength)){r++;break}{const i=e.getUint32(r,!1),o=(16776192&i)>>10,s=1023&i;t.push({pt:n,ts_offset:o,length:s,data:new Uint8Array}),r+=4}}let i=e.byteLength-r;for(const n of t){if(n.length>i)return console.warn("Broken red payload"),[];n.length>0&&(n.data=new Uint8Array(e.buffer,e.byteOffset+r,n.length),r+=n.length,i-=n.length)}if(i>0){const n={pt:t.length>0?t[t.length-1].pt:0,ts_offset:0,length:i,data:new Uint8Array(e.buffer,e.byteOffset+r,i)};t.push(n)}return t}(o);if(t.length>0){const r=function(e){let t=0;for(let r=0;r<e.length;r++)t+=r<e.length-1?4:1,t+=e[r].length;const r=new Uint8Array(t);let i=0;for(let t=0;t<e.length;t++)if(t<e.length-1){const n=(2147483648|(127&e[t].pt)<<24|(262143&e[t].ts_offset)<<10|1023&e[t].length)>>>0;r[i++]=n>>24&255,r[i++]=n>>16&255,r[i++]=n>>8&255,r[i++]=255&n}else r[i++]=127&e[t].pt;for(const t of e)r.set(t.data,i),i+=t.length;return r}(t.map((e=>{const t=new Uint8Array(e.length);t.set(e.data);const r=lP(new DataView(t.buffer));return null!=r&&r.frame&&(e.data=null==r?void 0:r.frame),a=r,e})));e.data=r.buffer}}else a=lP(o),a&&(e.data=a.frame.buffer);if(r.enqueue(e),!a)return;const d=a.tlv.find((e=>e.tag===uP.METADATA));d&&i&&d.value instanceof Uint8Array&&i(d.value);const u=a.tlv.find((e=>e.tag===uP.AUDIO_64_BIT_PTS));if(u&&n&&u.value instanceof Uint8Array&&8==u.value.length){n(new DataView(u.value.buffer).getBigUint64(0,!0))}}const WP="video/h264",HP="video/h265";function KP(e,t,r){let i=new Uint8Array(e,t,r),n=[],o=0;for(;n.length<r;)o+3<r&&0===i[o]&&0===i[o+1]&&3===i[o+2]&&(0===i[o+3]||1===i[o+3]||2===i[o+3]||3===i[o+3])?(n.push(i[o],i[o+1],i[o+3]),o+=4):(n.push(i[o]),o++);return new Uint8Array(n)}function YP(e,t){switch(t){case WP:return function(e){const t=new DataView(e.data);let r=0;for(;r+4<e.data.byteLength;){if(0===t.getUint8(r+0)&&0===t.getUint8(r+1)&&0===t.getUint8(r+2)&&1===t.getUint8(r+3)&&6===t.getUint8(r+4)){let i=r+6,n=0,o=0;for(;255===(o=t.getUint8(i++));)n+=255;n+=o;const s=KP(e.data,i,n);return new Uint8Array(s)}r++}return null}(e);case HP:return function(e){const t=new DataView(e.data);let r=0;for(;r+5<e.data.byteLength;){if(0===t.getUint8(r+0)&&0===t.getUint8(r+1)&&0===t.getUint8(r+2)&&1===t.getUint8(r+3)&&78===t.getUint8(r+4)&&1===t.getUint8(r+5)&&101===t.getUint8(r+6)){let i=r+7,n=0,o=0;for(;255===(o=t.getUint8(i++));)n+=255;n+=o;const s=KP(e.data,i,n);return new Uint8Array(s)}r++}return null}(e);default:return null}}function zP(e){const t=e.length;let r=[],i=0;for(;i<t;)i+2<t&&0===e[i]&&0===e[i+1]&&(0===e[i+2]||1===e[i+2]||2===e[i+2]||3===e[i+2])?(r.push(e[i],e[i+1],3,e[i+2]),i+=3):(r.push(e[i]),i++);return new Uint8Array(r)}function XP(e,t,r){switch(r){case WP:return function(e,t){const r=zP(t),i=r.length,n=Math.floor(i/255),o=i%255,s=new Uint8Array(6+n+1+i+e.byteLength);s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=6,s[5]=101;let a=0;for(;a<n;)s[6+a]=255,a++;return s[6+a]=o,a++,s.set(r,6+a),s.set(new Uint8Array(e),6+a+i),s.buffer}(e,t);case HP:return function(e,t){const r=zP(t),i=r.length,n=Math.floor(i/255),o=i%255,s=new Uint8Array(7+n+1+i+1+e.byteLength);s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=78,s[5]=1,s[6]=101;let a=0;for(;a<n;)s[7+a]=255,a++;return s[7+a]=o,a++,s.set(r,7+a),a+=i,s[7+a]=128,a++,s.set(new Uint8Array(e),7+a),s.buffer}(e,t);default:return null}}function ZP(e){if(e.length<5)return"";let t=-1;for(let r=0;r<e.length-3;r++){if(0===e[r]&&0===e[r+1]&&1===e[r+2]){t=r;break}if(r<e.length-4&&0===e[r]&&0===e[r+1]&&0===e[r+2]&&1===e[r+3]){t=r;break}}if(-1===t)return"";const r=t+(0===e[t+2]?4:3);if(r>=e.length)return"";const i=e[r];if(128&i)return"";if((i>>1&63)>=32)return HP;if(r+1<e.length){if(0==(248&e[r+1]))return HP}return(31&i)<=31?WP:""}const JP=new Map;function QP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}const qP=new Map;Mn(),e.AUDIO_CONTEXT_EVENT=Wn,e.AUDIO_ENCODER_CONFIG_SETTINGS=Id,e.AUDIO_TRACK_EVENT=Kd,e.AgoraRTCPlayer=HI,e.AudioProcessorContext=jA,e.AudioProcessorDestination=BA,e.AudioSourceEvents=Hd,e.BufferSourceAudioTrack=MI,e.CameraVideoTrack=PO,e.DEFAULT_LOCAL_AUDIO_TRACK_STATS=Yd,e.DEFAULT_LOCAL_VIDEO_TRACK_STATS=zd,e.DEFAULT_NETWORK_QUALITY_STATS={uplinkNetworkQuality:0,downlinkNetworkQuality:0},e.DEFAULT_REMOTE_AUDIO_TRACK_STATS=Xd,e.DEFAULT_REMOTE_VIDEO_TRACK_STATS=Zd,e.DataChannel=tC,e.DataChannelEvents=ru,e.DeviceManager=_A,e.DeviceManagerEvent=$d,e.DeviceManagerState=qd,e.LocalAudioTrack=LI,e.LocalDataChannel=class extends tC{send(e){if(this._originDataChannel){let t=e;t=this._dataStreamPacketHandler.serialize(e);const r=new Uint8Array(this._dataStreamPacketHeader.byteLength+t.byteLength);r.set(new Uint8Array(this._dataStreamPacketHeader),0),r.set(new Uint8Array(t),this._dataStreamPacketHeader.byteLength),this._originDataChannel.send(r.buffer)}}},e.LocalTrack=Wv,e.LocalTrackEvents=jd,e.LocalVideoTrack=DO,e.MediaElementNumStatus={uninit:100,none:110,init:120,loadeddata:130,canplay:200,playing:210,paused:220,suspend:300,stalled:310,waiting:320,error:330,destroyed:340,abort:350,ended:360,emptied:370},e.MediaElementStatus=eu,e.MicrophoneAudioTrack=kI,e.MixingAudioTrack=UI,e.PROCESSOR_CONTEXT_EVENTS=Qd,e.PROCESSOR_DESTINATION_EVENTS=Jd,e.RemoteAudioTrack=$O,e.RemoteDataChannel=class extends tC{constructor(e){super(e),N_(this,"_messageListener",void 0),this._messageListener=e=>{if(e.data.byteLength<this._dataStreamPacketHeader.byteLength)throw Error("invalid byteLength: the byte length must exceed "+this._dataStreamPacketHeader.byteLength);const t=e.data.slice(0,this._dataStreamPacketHeader.byteLength),r=new DataView(t).getUint8(3);if(r!==this.id)return void(ln("SHOW_DATASTREAM2_LOG")&&In.debug("invalid datachannel id: ".concat(r," !== ").concat(this.id)));let i=e.data.slice(this._dataStreamPacketHeader.byteLength);i=this._dataStreamPacketHandler.deserialize(i),this.emit(ru.MESSAGE,i)}}_updateOriginDataChannel(e){super._updateOriginDataChannel(e),this._bandRemoteDataChannelEvents()}_close(){this._originDataChannel&&(this._originDataChannel.removeEventListener("message",this._messageListener),super._close())}_bandRemoteDataChannelEvents(){this._originDataChannel&&this._originDataChannel.addEventListener("message",this._messageListener)}},e.RemoteStreamFallbackType=Fd,e.RemoteStreamType=Vd,e.RemoteTrack=QO,e.RemoteTrackEvents=Gd,e.RemoteVideoTrack=qO,e.SAFARI_GLOBAL_GUM_LOCK=hA,e.SUPPORT_SCREEN_ENCODER_CONFIG_LIST=Rd,e.SUPPORT_SVC_CONFIG_LIST=yd,e.SUPPORT_VIDEO_ENCODER_CONFIG_LIST=Sd,e.StreamType=xd,e.Track=Gv,e.TrackEvents=Bd,e.TrackHint=Ud,e.TrackInternalEvent=Md,e.TrackMediaType=Wd,e.VideoProcessorContext=FA,e.VideoProcessorDestination=VA,e.VideoState=tu,e.__TRACK_LIST__=Cd,e.addTrack=wd,e.audioContextState=Xv,e.audioElementPlayCenter=IA,e.audioTimerLoop=function(e,t){let r=!1;const i=1/t;if(ln("DISABLE_WEBAUDIO")){const t=window.setInterval((()=>{r?window.clearInterval(t):e(performance.now()/1e3)}),1e3*i)}else{const t=Qv();let n=t.createGain();n.gain.value=0,n.connect(t.destination);const o=()=>{if(r)return void(n=null);const s=t.createOscillator();s.onended=o,s.connect(n),s.start(0),s.stop(t.currentTime+i),e(t.currentTime)};o()}return()=>{r=!0}},e.autoPlayGestureEventEmitter=SA,e.blob2Uint8Array=Wb,e.checkMediaStreamTrackResolution=HA,e.checkTrackState=OA,e.createBufferSourceAudioTrack=async function(e){var t;const{cacheOnlineFile:r,encoderConfig:i}=e;let{source:n}=e;const o={source:n instanceof AudioBuffer?"AudioBuffer":n instanceof File?null!==(t=File.name)&&void 0!==t?t:"File":n,cacheOnlineFile:r,encoderConfig:i},s=Vi(8,"track-buf-"),a=Ln.reportApiInvoke(null,{id:s,tag:Ti.TRACER,name:_i.CREATE_BUFFER_AUDIO_TRACK,options:[o]});if(ln("DISABLE_WEBAUDIO"))throw new ii(ri.NOT_SUPPORTED,"can not create BufferSourceAudioTrack when WebAudio disabled");In.info("start create buffer source audio track with config",JSON.stringify(o),"trackId",s);const c=n;if(!(n instanceof AudioBuffer))try{n=await async function(e,t){let r=null;if("string"==typeof e){const t=VI.get(e);if(t)return In.debug("use cached audio resource: ",e),t;try{r=(await Qi((()=>yr.get(e,{responseType:"arraybuffer"})),void 0,void 0,{maxRetryCount:3})).data}catch(e){throw new ii(ri.FETCH_AUDIO_FILE_FAILED,e.toString())}}else{const t=new jv(((t,r)=>{const i=new FileReader;i.onload=e=>{e.target?t(e.target.result):r(new ii(ri.READ_LOCAL_AUDIO_FILE_ERROR))},i.onerror=()=>{r(new ii(ri.READ_LOCAL_AUDIO_FILE_ERROR))},i.readAsArrayBuffer(e)}));r=await t}const i=await eA(r);return"string"==typeof e&&t&&VI.set(e,i),i}(n,r)}catch(e){return a.onError(e),e.throw(In)}const d=new xI(n),u=new MI(c,d,i?Od(i):{},s);return In.info("create buffer source audio track success, trackId:",s),a.onSuccess(u.getTrackId()),u},e.createCameraVideoTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=ln("CAMERA_CAPTURE_CONFIG"),r=Vi(8,"track-cam-"),i=Ln.reportApiInvoke(null,{id:r,tag:Ti.TRACER,name:_i.CREATE_CAM_VIDEO_TRACK,options:[kO({},e),t]});t&&(e.encoderConfig=t);const n=KA(e);let o=null;In.info("start create camera video track with config",JSON.stringify(e),"trackId",r);try{o=(await pA({video:n},r)).getVideoTracks()[0]||null}catch(e){throw i.onError(e),e}if(!o){const e=new ii(ri.UNEXPECTED_ERROR,"can not find track in media stream");return i.onError(e),e.throw(In)}if(e.optimizationMode&&MO(r,o,e,vd(e.encoderConfig)),ln("USE_STANDARD_BITRATE_DEFAULT")){const t=vd(e.encoderConfig);e.encoderConfig=t,delete t.bitrateMax,delete t.bitrateMin}const s=new PO(o,e,n,e.scalabiltyMode?bd(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,r);return i.onSuccess(s.getTrackId()),In.info("create camera video success, trackId:",r),s},e.createCustomAudioTrack=function(e){const t=Vi(8,"track-cus-"),r=Ln.reportApiInvoke(null,{id:t,tag:Ti.TRACER,name:_i.CREATE_CUSTOM_AUDIO_TRACK,options:[e]}),i=new LI(e.mediaStreamTrack,e.encoderConfig?Od(e.encoderConfig):{},t,!1);return In.info("create custom audio track success with config",e,"trackId",i.getTrackId()),r.onSuccess(i.getTrackId()),i},e.createCustomVideoTrack=function(e){const t=Vi(8,"track-cus-"),r=Ln.reportApiInvoke(null,{id:t,tag:Ti.TRACER,name:_i.CREATE_CUSTOM_VIDEO_TRACK,options:[e]});ln("USE_STANDARD_BITRATE_DEFAULT")&&(delete e.bitrateMax,delete e.bitrateMin);const i=new DO(e.mediaStreamTrack,{width:e.width,height:e.height,frameRate:e.frameRate,bitrateMax:e.bitrateMax,bitrateMin:e.bitrateMin},e.scalabiltyMode?bd(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,t,[Ud.CUSTOM_TRACK]);return r.onSuccess(i.getTrackId()),In.info("create custom video track success with config",e,"trackId",i.getTrackId()),i},e.createMicrophoneAndCameraTracks=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=ln("CAMERA_CAPTURE_CONFIG"),i=Vi(8,"track-mic-"),n=Vi(8,"track-cam-"),o=Ln.reportApiInvoke(null,{id:"".concat(i,"-").concat(n),tag:Ti.TRACER,name:_i.CREATE_MIC_AND_CAM_TRACKS,options:[e,t,r]});r&&(t.encoderConfig=r);const s=KA(t),a=ZA(e);let c=null,d=null;In.info("start create camera video track(".concat(n,") and microphone audio track(").concat(i,") with config, audio: ").concat(JSON.stringify(e),", video: ").concat(JSON.stringify(t)));try{const e=await pA({audio:a,video:s},"".concat(i,"-").concat(n));c=e.getAudioTracks()[0],d=e.getVideoTracks()[0]}catch(e){throw o.onError(e),e}if(!c||!d){const e=new ii(ri.UNEXPECTED_ERROR,"can not find tracks in media stream");return o.onError(e),e.throw(In)}if(t.optimizationMode&&MO(n,d,t,vd(t.encoderConfig)),ln("USE_STANDARD_BITRATE_DEFAULT")){const e=vd(t.encoderConfig);t.encoderConfig=e,delete e.bitrateMax,delete e.bitrateMin}const u=new kI(c,e,a,i),l=new PO(d,t,s,t.scalabiltyMode?bd(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,n);return o.onSuccess([u.getTrackId(),l.getTrackId()]),In.info("create camera video track(".concat(n,") and microphone audio track(").concat(i,") success")),[u,l]},e.createMicrophoneAudioTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Vi(8,"track-mic-"),r=Ln.reportApiInvoke(null,{id:t,tag:Ti.TRACER,name:_i.CREATE_MIC_AUDIO_TRACK,options:[e]}),i=ZA(e);let n=null;In.info("start create microphone audio track with config",JSON.stringify(e),"trackId",t);try{n=(await pA({audio:i},t)).getAudioTracks()[0]||null}catch(e){throw r.onError(e),e}if(!n){const e=new ii(ri.UNEXPECTED_ERROR,"can not find track in media stream");return r.onError(e),e.throw(In)}const o=new kI(n,e,i,t);return r.onSuccess(o.getTrackId()),In.info("create microphone audio track success, trackId:",t),o},e.createMixingAudioTrack=function(e){const t=new UI;return e.forEach((e=>t.addAudioTrack(e))),t},e.createScreenVideoTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"disable";const r="object"==typeof t?XA(t):void 0;r&&(t="auto");const i=Vi(8,"track-scr-v-"),n=Ln.reportApiInvoke(null,{id:i,tag:Ti.TRACER,name:_i.CREATE_SCREEN_VIDEO_TRACK,options:[kO({},e),t]});e.encoderConfig?"string"==typeof e.encoderConfig||e.encoderConfig.width&&e.encoderConfig.height||(e.encoderConfig.width={max:1920},e.encoderConfig.height={max:1080}):e.encoderConfig="1080p_2";const o=YA(e);let s=null,a=null;const c=Un();if(!c.supportShareAudio&&"enable"===t){const e=new ii(ri.NOT_SUPPORTED,"your browser or platform is not support share-screen with audio");return n.onError(e),e.throw(In)}In.info("start create screen video track with config",e,"withAudio",t,"trackId",i);const d=c.supportShareAudio&&"disable"!==t;try{const e=await pA({screen:o,screenAudio:d?r||!0:void 0},i);s=e.getVideoTracks()[0]||null,a=e.getAudioTracks()[0]||null}catch(e){throw n.onError(e),e}if(!s){const e=new ii(ri.UNEXPECTED_ERROR,"can not find track in media stream");return n.onError(e),e.throw(In)}if(!a&&"enable"===t){s&&s.stop();const e=new ii(ri.SHARE_AUDIO_NOT_ALLOWED);return n.onError(e),e.throw(In)}if(e.optimizationMode||(e.optimizationMode="detail"),e.optimizationMode){MO(i,s,e,e.encoderConfig&&Ad(e.encoderConfig)||void 0),e.encoderConfig&&"string"!=typeof e.encoderConfig&&(e.encoderConfig.bitrateMin=e.encoderConfig.bitrateMax)}const u=new DO(s,e.encoderConfig?Ad(e.encoderConfig):{},e.scalabiltyMode?bd(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,i,[Ud.SCREEN_TRACK]);if(!a)return n.onSuccess(u.getTrackId()),In.info("create screen video track success","video:",u.getTrackId()),u;const l=new LI(a,void 0,Vi(8,"track-scr-a-"),!1);return n.onSuccess([u.getTrackId(),l.getTrackId()]),In.info("create screen video track success","video:",u.getTrackId(),"audio:",l.getTrackId()),[u,l]},e.decodeAudioData=eA,e.detectSupportAudioElementSetSinkId=Vn,e.detectSupportAutCC=function(){return!!ln("FORCE_ENABLE_AUT_CC")||!Fn()&&(!!ln("ENABLE_AUT_CC")||void 0)},e.detectSupportAutCCFeedback=function(){return!!ln("FORCE_ENABLE_AUT_CC")||!Fn()&&(!!ln("ENABLE_AUT_FEEDBACK")||void 0)},e.detectSupportInstantVideo=function(e){return ln("ENABLE_INSTANT_VIDEO")?ln("ENABLE_INSTANT_VIDEO"):!(null==e||!e.autoSubscribe||ln("FORCE_DISABLE_AUTO_SUB"))},e.detectSupportPrePc=function(e){return!Fn()&&!ln("USE_NEW_TOKEN")&&(!!ln("ENABLE_PREALLOC_PC")||!(null==e||!e.autoSubscribe||ln("FORCE_DISABLE_AUTO_SUB")))},e.detectSupportPreSub=function(e){return!(Ur()||function(e){const t=Cr();return!(t.name!==Ar.CHROME||!t.osVersion)&&Number(t.version)<e}(87)||Fn())&&(!!ln("ENABLE_PRE_SUB")||!(null==e||!e.autoSubscribe||ln("FORCE_DISABLE_AUTO_SUB")))},e.detectSupportRestrictOwnAudio=Gn,e.detectSupportSuppressLocalAudioPlayback=jn,e.detectSupportWebRTCEncodedTransform=xn,e.deviceManager=TA,e.emptyImage2TypedArray=Gb,e.frameData2CryptoBuffer=async(e,t,r)=>await jb(e.buffer,t,r),e.getAudioContext=Qv,e.getAudioEncoderConfiguration=Od,e.getBitrateConstrainRange=Fb,e.getBitrateFromResAndFps=Bb,e.getCompatibility=Un,e.getConstraintsFromAudioConfig=zA,e.getConstraintsFromCameraConfig=KA,e.getConstraintsFromMicrophoneConfig=ZA,e.getConstraintsFromScreenAudioConfig=XA,e.getConstraintsFromScreenConfig=YA,e.getElectronScreenSources=uA,e.getElectronScreenStream=cA,e.getElectronScreenStreamByUserSelect=dA,e.getLocalStream=pA,e.getNewNearestVideoProfile=Vb,e.getNewVideoBitrate=xb,e.getOriginSenderConfig=e=>{const t=e._encoderConfig;if(!t)return;const{frameRate:r,width:i,height:n}=e.getMediaStreamTrackSettings();let{frameRate:o=r,width:s=i,height:a=n}=t;if(!o||!s||!a)return;s=Hi(s),a=Hi(a),o=Hi(o);const{max:c,min:d}=Bb(s,a,o),{bitrateMax:u,bitrateMin:l}=t||{};u||In.debug("calculate bitrate: [w: ".concat(s,", h: ").concat(a,", fps: ").concat(o,"] => [brMax: ").concat(u,", brMin: ").concat(l,"]"));const{maxFramerate:h}=ln("ENCODER_CONFIG_LIMIT");return h&&"number"==typeof h&&(o=Math.min(o,h)),{frameRate:o,bitrateMax:u||c,bitrateMin:l||d,scaleResolutionDownBy:1,scale:0}},e.getScalabilityConfiguration=bd,e.getScreenEncoderConfiguration=Ad,e.getSilenceAudioTrack=function(){if(rA)return rA;const e=Qv();if(!e.createMediaStreamDestination)throw new ii(ri.NOT_SUPPORTED,"can not create silence audio track");const t=e.createBufferSource(),r=e.createBuffer(1,44100,44100);t.loop=!0,t.buffer=r;const i=e.createMediaStreamDestination();return t.connect(i),rA=i.stream.getAudioTracks()[0],rA},e.getSilenceSamplesDuration=function(e){const t=e.getChannelData(0);let r=0,i=0;for(let e=0;e<t.length;e+=1)0===t[e]?(r+=1,r>i&&(i=r)):r=0;return i/t.length*e.duration},e.getStaticTrackStream=Hb,e.getVideoEncoderConfiguration=vd,e.handleGetUserMediaError=EA,e.hasAudioContext=qv,e.hasMicrophoneTrack=Dd,e.interceptLocalAudioFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Un().supportWebRTCEncodedTransform)return void In.warning("browser not support audio encoded transform");if(hP.has(e))return;if(!e.track)return;const r={track:e.track};if(!Lr()&&!zr()||xr()){if("undefined"==typeof RTCRtpScriptTransform)return void In.warning("browser not support RTCRtpScriptTransform");const n=nP(),o=new MessageChannel;await new jv((e=>n.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(n,{name:"audio-metadata-tx",port:o.port2},[o.port2]);e.transform=s,await new jv((e=>n.onmessage=t=>{"started"===t.data&&e(void 0)})),o.port1.onmessage=n=>{var s;if(n.data.transformed&&e.track&&(null===(s=e.track)||void 0===s?void 0:s.id)!==r.track.id)In.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i);else if(n.data.getMetadata){const e=t.metadata&&t.metadata(),r=t.pts&&t.pts();(e||void 0!==r)&&o.port1.postMessage({metadata:e,pts:r})}},r.worker=n}else{if(!e.createEncodedStreams)return void In.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void In.error("create audio-encoded-streams error",e&&e.message)}const o=new TransformStream({transform(n,o){r.controller||(r.controller=o),e.track&&e.track.id!==r.track.id&&(In.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i));const s=t.metadata&&t.metadata(),a=t.pts&&t.pts();s||a?pP(s,a,{sender:e,chunk:n,controller:o}):o.enqueue(n)}});n.readable.pipeThrough(o).pipeTo(n.writable)}function i(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",i)}const t=hP.get(e);if(t){hP.delete(e);try{var r,n;null===(r=t.controller)||void 0===r||r.terminate(),null===(n=t.worker)||void 0===n||n.terminate()}catch(e){In.warning(e&&e.message)}}}hP.set(e,r),e.track.addEventListener("ended",i)},e.interceptLocalVideoFrame=async function(e,t){if(!Un().supportWebRTCEncodedTransform)return void In.warning("browser not support video encoded transform");if(JP.has(e))return;if(!e.track)return;const r={track:e.track};if(!Lr()&&!zr()||xr()){if("undefined"==typeof RTCRtpScriptTransform)return void In.warning("browser not support RTCRtpScriptTransform");const n=nP(),o=new MessageChannel;await new jv((e=>n.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(n,{name:"sei-tx",port:o.port2},[o.port2]);e.transform=s,await new jv((e=>n.onmessage=t=>{"started"===t.data&&e(void 0)})),t.on("sei-to-send",(e=>{o.port1.postMessage({sei:e})})),o.port1.onmessage=t=>{var n;t.data.transformed&&e.track&&(null===(n=e.track)||void 0===n?void 0:n.id)!==r.track.id&&(In.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i))},r.worker=n}else{if(!e.createEncodedStreams)return void In.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void In.error("create video-encoded-streams error",e&&e.message)}const o=[];t.on("sei-to-send",(e=>{o.push(e)}));const s=new TransformStream({transform(t,n){r.controller||(r.controller=n),e.track&&e.track.id!==r.track.id&&(In.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i));const s=ZP(new Uint8Array(t.data)),a=o.shift();if(a){const e=XP(t.data,a,s);e&&(t.data=e)}n.enqueue(t)}});n.readable.pipeThrough(s).pipeTo(n.writable)}function i(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",i)}const t=JP.get(e);if(t){JP.delete(e);try{var r,n;null===(r=t.controller)||void 0===r||r.terminate(),null===(n=t.worker)||void 0===n||n.terminate()}catch(e){In.warning(e&&e.message)}}}JP.set(e,r),e.track.addEventListener("ended",i)},e.interceptRemoteAudioFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Un().supportWebRTCEncodedTransform)return void In.warning("browser not support audio encoded transform");if(BP.has(e))return;const r={track:e.track,onMetadata:t.onMetadata,onPts:t.onPts};if(!Lr()&&!zr()||xr()){if("undefined"==typeof RTCRtpScriptTransform)return void In.warning("browser not support RTCRtpScriptTransform");const n=nP(),o=new MessageChannel;await new jv((e=>n.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(n,{name:"audio-metadata-rx",port:o.port2,pt:t.pt},[o.port2]);e.transform=s,await new jv((e=>n.onmessage=t=>{"started"===t.data&&e(void 0)})),o.port1.onmessage=t=>{var n;t.data.transformed&&e.track&&(null===(n=e.track)||void 0===n?void 0:n.id)!==r.track.id?(In.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i)):t.data.metadata&&r.onMetadata?r.onMetadata(t.data.metadata):t.data.pts&&r.onPts&&r.onPts(t.data.pts)},r.worker=n}else{if(!e.createEncodedStreams)return void In.warning("browser not support createEncodedStreams() API");Fr(Ar.CHROME,87,116)||(t.enableTopn=!1);let n=null;try{n=e.createEncodedStreams()}catch(e){return void In.error("create audio-encoded-streams error",e&&e.message)}const o=new TransformStream({transform(n,o){r.controller||(r.controller=o),e.track&&e.track.id!==r.track.id&&(In.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i)),t.enableTopn?function(e,t,r){var i;const n=lP(new DataView(t.data));if(!n)return r.enqueue(t);const o=e.track.id;jP.set(o,e.track);const s=null===(i=n.tlv.find((e=>e.tag===uP.AUDIO_LEVEL)))||void 0===i?void 0:i.value;let a=0;"number"==typeof s&&(a=127-s);const c=Math.round(Math.pow(10,a/60)-1),{selected:d,speaker:u}=DP(e,c),l=VP(o,e.track,u.energyScore);l.addSample(d),l.active&&(t.data=n.frame.buffer,r.enqueue(t))}(e,n,o):t.enableMetadata||t.enablePts?GP(n,t.pt,o,t.onMetadata,t.onPts):o.enqueue(n)}});n.readable.pipeThrough(o).pipeTo(n.writable)}function i(){e.track.removeEventListener("ended",i),function(e){const t=BP.get(e);if(t){!function(e){const t=IP.get(e);t&&(IP.delete(e),OP&&(OP.removeSpeakers([t]),0===IP.size&&(OP.destroy(),OP=null)))}(e),FP(e.track.id),BP.delete(e);try{var r,i;null===(r=t.controller)||void 0===r||r.terminate(),null===(i=t.worker)||void 0===i||i.terminate()}catch(e){In.warning(e&&e.message)}}}(e)}BP.set(e,r),e.track.addEventListener("ended",i)},e.interceptRemoteVideoFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Un().supportWebRTCEncodedTransform)return void In.warning("browser not support video encoded transform");if(!e.track)return;if(qP.has(e)){const r=qP.get(e);return void(r&&(r.onSei=t.onSei))}const r={track:e.track,onSei:t.onSei};if(!Lr()&&!zr()||xr()){if("undefined"==typeof RTCRtpScriptTransform)return void In.warning("browser not support RTCRtpScriptTransform");const n=nP(),o=new MessageChannel;await new jv((e=>n.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(n,{name:"sei-rx",port:o.port2},[o.port2]);e.transform=s,await new jv((e=>n.onmessage=t=>{"started"===t.data&&e(void 0)})),o.port1.onmessage=n=>{var o;if(n.data.transformed&&e.track&&(null===(o=e.track)||void 0===o?void 0:o.id)!==r.track.id)In.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i);else if(n.data.sei&&r.onSei)r.onSei(n.data.sei);else if(n.data.firstFrameInfo&&t.onFirstFrame){var s;null===(s=t.onFirstFrame)||void 0===s||s.call(t,n.data.firstFrameInfo)}},r.worker=n}else{if(!e.createEncodedStreams)return void In.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void In.error("create video-encoded-streams error",e&&e.message)}const o=new TransformStream({transform(n,o){if(r.controller||(r.controller=o),!r.firstFrameInfo){var s;const e=n.getMetadata()||{};r.firstFrameInfo=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?QP(Object(r),!0).forEach((function(t){N_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):QP(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({type:n.type,rtpTimestamp:n.timestamp,payloadType:e.payloadType||0,ssrc:e.synchronizationSource||0,length:n.data.byteLength},"mimeType"in e?{mimeType:e.mimeType}:{}),null===(s=t.onFirstFrame)||void 0===s||s.call(t,r.firstFrameInfo)}e.track&&e.track.id!==r.track.id&&(In.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i));const a=YP(n,ZP(new Uint8Array(n.data)));a&&r.onSei&&r.onSei(a),o.enqueue(n)}});n.readable.pipeThrough(o).pipeTo(n.writable)}function i(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",i)}!function(e){const t=qP.get(e);if(t){qP.delete(e);try{var r,i;null===(r=t.controller)||void 0===r||r.terminate(),null===(i=t.worker)||void 0===i||i.terminate()}catch(e){In.warning(e&&e.message)}}}(e)}qP.set(e,r),e.track.addEventListener("ended",i)},e.isAudioEncoderConfiguration=Ld,e.isAudioEncoderConfigurationOrPreset=function(e){return"string"==typeof e?oi(e,"profile",Object.keys(Id)):Ld(e),!0},e.isBeautyEffectOptions=function(e){return void 0!==e.smoothnessLevel&&si(e.smoothnessLevel,"options.smoothnessLevel",0,1,!1),void 0!==e.lighteningLevel&&si(e.lighteningLevel,"options.lighteningLevel",0,1,!1),void 0!==e.rednessLevel&&si(e.rednessLevel,"options.rednessLevel",0,1,!1),void 0!==e.lighteningContrastLevel&&oi(e.lighteningContrastLevel,"options.lighteningContrastLevel",[0,1,2]),!0},e.isElectron=fi,e.isLowStreamParameter=function(e){if(!e)throw new ii(ri.INVALID_PARAMS);return ci(e.width)||ai(e.width,"streamParameter.width"),ci(e.height)||ai(e.height,"streamParameter.height"),ci(e.framerate)||ai(e.framerate,"streamParameter.framerate"),ci(e.bitrate)||si(e.bitrate,"streamParameter.bitrate"),!0},e.isPlanB=Fn,e.isScreenSourceType=kd,e.isVideoEncoderConfiguration=Pd,e.isVideoEncoderConfigurationOrPreset=function(e){return"string"==typeof e?oi(e,"profile",Object.keys(Sd)):Pd(e),!0},e.polyfillAudioNode=$v,e.removeTrack=Nd,e.requestAutoplayGesture=RA,e.restartBackgroundTag=Jv,e.silenceScriptProcessHandler=iA,e.updateAgoraRTCCompatibility=Mn,e.visibilityWatcher=eC}));
|
|
5
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).AgoraRTCMedia={})}(this,(function(e){"use strict";function t(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 i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(e)}let r=!0,i=!0;function n(e,t,r){const i=e.match(t);return i&&i.length>=r&&parseInt(i[r],10)}function o(e,t,r){if(!e.RTCPeerConnection)return;const i=e.RTCPeerConnection.prototype,n=i.addEventListener;i.addEventListener=function(e,i){if(e!==t)return n.apply(this,arguments);const o=e=>{const t=r(e);t&&(i.handleEvent?i.handleEvent(t):i(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(i,o),n.apply(this,[e,o])};const o=i.removeEventListener;i.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);const i=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,i])},Object.defineProperty(i,"on"+t,{get(){return this["_on"+t]},set(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 s(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(r=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function a(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(i=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function c(){if("object"==typeof window){if(r)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function d(e,t){i&&console.warn(e+" is deprecated, please use "+t+" instead.")}function u(e){return"[object Object]"===Object.prototype.toString.call(e)}function l(e){return u(e)?Object.keys(e).reduce((function(t,r){const i=u(e[r]),n=i?l(e[r]):e[r],o=i&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,{[r]:n})}),{}):e}function h(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((i=>{i.endsWith("Id")?h(e,e.get(t[i]),r):i.endsWith("Ids")&&t[i].forEach((t=>{h(e,e.get(t),r)}))})))}function p(e,t,r){const i=r?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;const o=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((t=>{e.forEach((r=>{r.type===i&&r.trackId===t.id&&h(e,r,n)}))})),n}const f=c;function E(e,t){const r=e&&e.navigator;if(!r.mediaDevices)return;const i=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach((r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;const i="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);const n=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==i.ideal){t.optional=t.optional||[];let e={};"number"==typeof i.ideal?(e[n("min",r)]=i.ideal,t.optional.push(e),e={},e[n("max",r)]=i.ideal,t.optional.push(e)):(e[n("",r)]=i.ideal,t.optional.push(e))}void 0!==i.exact&&"number"!=typeof i.exact?(t.mandatory=t.mandatory||{},t.mandatory[n("",r)]=i.exact):["min","max"].forEach((e=>{void 0!==i[e]&&(t.mandatory=t.mandatory||{},t.mandatory[n(e,r)]=i[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},n=function(e,n){if(t.version>=61)return n(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=i(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const s=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||s)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(t=["front"]),t)return r.mediaDevices.enumerateDevices().then((r=>{let s=(r=r.filter((e=>"videoinput"===e.kind))).find((e=>t.some((t=>e.label.toLowerCase().includes(t)))));return!s&&r.length&&t.includes("back")&&(s=r[r.length-1]),s&&(e.video.deviceId=o.exact?{exact:s.deviceId}:{ideal:s.deviceId}),e.video=i(e.video),f("chrome: "+JSON.stringify(e)),n(e)}))}e.video=i(e.video)}return f("chrome: "+JSON.stringify(e)),n(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(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,i){n(e,(e=>{r.webkitGetUserMedia(e,t,(e=>{i&&i(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){const e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(t){return n(t,(t=>e(t).then((e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return e}),(e=>Promise.reject(o(e))))))}}}function m(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function _(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.track.id)):{track:r.track};const n=new Event("track");n.track=r.track,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)})),t.stream.getTracks().forEach((r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.id)):{track:r};const n=new Event("track");n.track=r,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else o(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function T(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const 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()};const r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){let n=r.apply(this,arguments);return n||(n=t(this,e),this._senders.push(n)),n};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){i.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach((e=>{const t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function g(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,r,i]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const n=function(e){const t={};return e.result().forEach((e=>{const r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{r[t]=e.stat(t)})),t[r.id]=r})),t},o=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){const i=function(e){r(o(n(e)))};return t.apply(this,[i,e])}return new Promise(((e,r)=>{t.apply(this,[function(t){e(o(n(t)))},r])})).then(r,i)}}function S(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>p(t,e.track,!0)))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),o(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>p(t,e.track,!1)))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,r,i;return this.getSenders().forEach((r=>{r.track===e&&(t?i=!0:t=r)})),this.getReceivers().forEach((t=>(t.track===e&&(r?i=!0:r=t),t.track===e))),i||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 t.apply(this,arguments)}}function R(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const i=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();r.apply(this,arguments);const i=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(i)};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],i.apply(this,arguments)};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{const r=this._shimmedLocalStreams[t].indexOf(e);-1!==r&&this._shimmedLocalStreams[t].splice(r,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),n.apply(this,arguments)}}function y(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return R(e);const r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};const i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){const r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}i.apply(this,[t])};const n=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.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){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const n=this._streams[r.id];if(n)n.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const i=new e.MediaStream([t]);this._streams[r.id]=i,this._reverseStreams[i.id]=r,this.addStream(i)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[t=>{const r=o(this,t);e[0].apply(null,[r])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):r.apply(this,arguments).then((e=>o(this,e)))}};e.RTCPeerConnection.prototype[t]=i[t]}));const s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=a.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){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");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach((r=>{this._streams[r].getTracks().find((t=>e.track===t))&&(t=this._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function v(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]}))}function A(e,t){o(e,"negotiationneeded",(e=>{const r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var b=Object.freeze({__proto__:null,fixNegotiationNeeded:A,shimAddTrackRemoveTrack:y,shimAddTrackRemoveTrackWithNative:R,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((t=>{const i=r.video&&r.video.width,n=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},i&&(r.video.mandatory.maxWidth=i),n&&(r.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))},shimGetSendersWithDtmf:T,shimGetStats:g,shimGetUserMedia:E,shimMediaStream:m,shimOnTrack:_,shimPeerConnection:v,shimSenderReceiverGetStats:S});function I(e,t){const r=e&&e.navigator,i=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,i){d("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,i)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const e=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},t=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(r=JSON.parse(JSON.stringify(r)),e(r.audio,"autoGainControl","mozAutoGainControl"),e(r.audio,"noiseSuppression","mozNoiseSuppression")),t(r)},i&&i.prototype.getSettings){const t=i.prototype.getSettings;i.prototype.getSettings=function(){const r=t.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(i&&i.prototype.applyConstraints){const t=i.prototype.applyConstraints;i.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(r=JSON.parse(JSON.stringify(r)),e(r,"autoGainControl","mozAutoGainControl"),e(r,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[r])}}}}function O(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function C(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]}));const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,o]=arguments;return i.apply(this,[e||null]).then((e=>{if(t.version<53&&!n)try{e.forEach((e=>{e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,i)=>{e.set(i,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(n,o)}}function N(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const 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 w(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),o(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function D(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){d("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function P(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function L(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]),e=[...e];const r=e.length>0;r&&e.forEach((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")}));const i=t.apply(this,arguments);if(r){const{sender:t}=i,r=t.getParameters();(!("encodings"in r)||1===r.encodings.length&&0===Object.keys(r.encodings[0]).length)&&(r.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(r).then((()=>{delete t.sendEncodings})).catch((()=>{delete t.sendEncodings}))))}return i})}function k(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function M(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function U(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}var x=Object.freeze({__proto__:null,shimAddTransceiver:L,shimCreateAnswer:U,shimCreateOffer:M,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){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})},shimGetParameters:k,shimGetUserMedia:I,shimOnTrack:O,shimPeerConnection:C,shimRTCDataChannel:P,shimReceiverGetStats:w,shimRemoveStream:D,shimSenderGetStats:N});function V(e){if("object"==typeof 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)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((r=>t.call(this,r,e))),e.getVideoTracks().forEach((r=>t.call(this,r,e)))},e.RTCPeerConnection.prototype.addTrack=function(e,...r){return r&&r.forEach((e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const r=e.getTracks();this.getSenders().forEach((e=>{r.includes(e.track)&&this.removeTrack(e)}))})}}function F(e){if("object"==typeof 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(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach((e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)}))})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}))}),t.apply(e,arguments)}}}function B(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,r=t.createOffer,i=t.createAnswer,n=t.setLocalDescription,o=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){const i=arguments.length>=2?arguments[2]:arguments[0],n=r.apply(this,[i]);return t?(n.then(e,t),Promise.resolve()):n},t.createAnswer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],n=i.apply(this,[r]);return t?(n.then(e,t),Promise.resolve()):n};let a=function(e,t,r){const i=n.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i};t.setLocalDescription=a,a=function(e,t,r){const i=o.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},t.setRemoteDescription=a,a=function(e,t,r){const i=s.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},t.addIceCandidate=a}function j(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,r=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>r(G(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,i){t.mediaDevices.getUserMedia(e).then(r,i)}.bind(t))}function G(e){return e&&void 0!==e.video?Object.assign({},e,{video:l(e.video)}):e}function W(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){const t=[];for(let r=0;r<e.iceServers.length;r++){let i=e.iceServers[r];!i.hasOwnProperty("urls")&&i.hasOwnProperty("url")?(d("RTCIceServer.url","RTCIceServer.urls"),i=JSON.parse(JSON.stringify(i)),i.urls=i.url,delete i.url,t.push(i)):t.push(e.iceServers[r])}e.iceServers=t}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function H(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function K(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find((e=>"audio"===e.receiver.track.kind));!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const r=this.getTransceivers().find((e=>"video"===e.receiver.track.kind));!1===e.offerToReceiveVideo&&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.offerToReceiveVideo||r||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Y(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var z=Object.freeze({__proto__:null,shimAudioContext:Y,shimCallbacksAPI:B,shimConstraints:G,shimCreateOfferLegacy:K,shimGetUserMedia:j,shimLocalStreamsAPI:V,shimRTCIceServerUrls:W,shimRemoteStreamsAPI:F,shimTrackEventTransceiver:H}),X="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Z(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var J={exports:{}};!function(e){const t={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((e=>e.trim()))},t.splitSections=function(e){return e.split("\nm=").map(((e,t)=>(t>0?"m="+e:e).trim()+"\r\n"))},t.getDescription=function(e){const r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){const r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((e=>0===e.indexOf(r)))},t.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const r={foundation:t[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]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":r.relatedAddress=t[e+1];break;case"rport":r.relatedPort=parseInt(t[e+1],10);break;case"tcptype":r.tcpType=t[e+1];break;case"ufrag":r.ufrag=t[e+1],r.usernameFragment=t[e+1];break;default:void 0===r[t[e]]&&(r[t[e]]=t[e+1])}return r},t.writeCandidate=function(e){const t=[];t.push(e.foundation);const 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);const i=e.type;return t.push("typ"),t.push(i),"host"!==i&&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.substring(14).split(" ")},t.parseRtpMap=function(e){let t=e.substring(9).split(" ");const 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){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){const t=e.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},t.parseFmtp=function(e){const t={};let r;const i=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e<i.length;e++)r=i[e].trim().split("="),t[r[0].trim()]=r[1];return t},t.writeFmtp=function(e){let t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const i=[];Object.keys(e.parameters).forEach((t=>{void 0!==e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)})),t+="a=fmtp:"+r+" "+i.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){const t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){let t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((e=>{t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){const t=e.indexOf(" "),r={ssrc:parseInt(e.substring(7,t),10)},i=e.indexOf(":",t);return i>-1?(r.attribute=e.substring(t+1,i),r.value=e.substring(i+1)):r.attribute=e.substring(t+1),r},t.parseSsrcGroup=function(e){const t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((e=>parseInt(e,10)))}},t.getMid=function(e){const r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substring(6)},t.parseFingerprint=function(e){const t=e.substring(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){let r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((e=>{r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){const t=e.substring(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"==typeof 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;const t=e.substring(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){const i=t.matchPrefix(e+r,"a=ice-ufrag:")[0],n=t.matchPrefix(e+r,"a=ice-pwd:")[0];return i&&n?{usernameFragment:i.substring(12),password:n.substring(10)}:null},t.writeIceParameters=function(e){let 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){const r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=t.splitLines(e)[0].split(" ");r.profile=i[2];for(let n=3;n<i.length;n++){const o=i[n],s=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(s){const i=t.parseRtpMap(s),n=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(i.parameters=n.length?t.parseFmtp(n[0]):{},i.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(i),i.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(i.name.toUpperCase())}}}t.matchPrefix(e,"a=extmap:").forEach((e=>{r.headerExtensions.push(t.parseExtmap(e))}));const n=t.matchPrefix(e,"a=rtcp-fb:* ").map(t.parseRtcpFb);return r.codecs.forEach((e=>{n.forEach((t=>{e.rtcpFeedback.find((e=>e.type===t.type&&e.parameter===t.parameter))||e.rtcpFeedback.push(t)}))})),r},t.writeRtpDescription=function(e,r){let i="";i+="m="+e+" ",i+=r.codecs.length>0?"9":"0",i+=" "+(r.profile||"UDP/TLS/RTP/SAVPF")+" ",i+=r.codecs.map((e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType)).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((e=>{i+=t.writeRtpMap(e),i+=t.writeFmtp(e),i+=t.writeRtcpFb(e)}));let n=0;return r.codecs.forEach((e=>{e.maxptime>n&&(n=e.maxptime)})),n>0&&(i+="a=maxptime:"+n+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach((e=>{i+=t.writeExtmap(e)})),i},t.parseRtpEncodingParameters=function(e){const r=[],i=t.parseRtpParameters(e),n=-1!==i.fecMechanisms.indexOf("RED"),o=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute)),a=s.length>0&&s[0].ssrc;let c;const d=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substring(17).split(" ").map((e=>parseInt(e,10)))));d.length>0&&d[0].length>1&&d[0][0]===a&&(c=d[0][1]),i.codecs.forEach((e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:a,codecPayloadType:parseInt(e.parameters.apt,10)};a&&c&&(t.rtx={ssrc:c}),r.push(t),n&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:a,mechanism:o?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&a&&r.push({ssrc:a});let u=t.matchPrefix(e,"b=");return u.length&&(u=0===u[0].indexOf("b=TIAS:")?parseInt(u[0].substring(7),10):0===u[0].indexOf("b=AS:")?1e3*parseInt(u[0].substring(5),10)*.95-16e3:void 0,r.forEach((e=>{e.maxBitrate=u}))),r},t.parseRtcpParameters=function(e){const r={},i=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute))[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);const n=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=n.length>0,r.compound=0===n.length;const o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.writeRtcpParameters=function(e){let 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){let r;const i=t.matchPrefix(e,"a=msid:");if(1===i.length)return r=i[0].substring(7).split(" "),{stream:r[0],track:r[1]};const n=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"msid"===e.attribute));return n.length>0?(r=n[0].value.split(" "),{stream:r[0],track:r[1]}):void 0},t.parseSctpDescription=function(e){const r=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");let n;i.length>0&&(n=parseInt(i[0].substring(19),10)),isNaN(n)&&(n=65536);const o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substring(12),10),protocol:r.fmt,maxMessageSize:n};const s=t.matchPrefix(e,"a=sctpmap:");if(s.length>0){const e=s[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:n}}},t.writeSctpDescription=function(e,t){let 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,22)},t.writeSessionBoilerplate=function(e,r,i){let n;const o=void 0!==r?r:2;n=e||t.generateSessionId();return"v=0\r\no="+(i||"thisisadapterortc")+" "+n+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,r){const i=t.splitLines(e);for(let e=0;e<i.length;e++)switch(i[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[e].substring(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substring(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){const r=t.splitLines(e)[0].substring(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){const r=t.matchPrefix(e,"o=")[0].substring(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;const r=t.splitLines(e);for(let e=0;e<r.length;e++)if(r[e].length<2||"="!==r[e].charAt(1))return!1;return!0},e.exports=t}(J);var Q=J.exports,q=Z(Q),$=t({__proto__:null,default:q},[Q]);function ee(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const r=new t(e),i=q.parseCandidate(e.candidate),n=Object.assign(r,i);return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,o(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function te(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||o(e,"icecandidate",(e=>{if(e.candidate){const t=q.parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function re(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const r=function(e){if(!e||!e.sdp)return!1;const t=q.splitSections(e.sdp);return t.shift(),t.some((e=>{const t=q.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},i=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const r=parseInt(t[1],10);return r!=r?-1:r},n=function(e){let 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){let i=65536;"firefox"===t.browser&&57===t.version&&(i=65535);const n=q.matchPrefix(e.sdp,"a=max-message-size:");return n.length>0?i=parseInt(n[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(i=2147483637),i},s=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){const e=i(arguments[0]),t=n(e),r=o(arguments[0],e);let s;s=0===t&&0===r?Number.POSITIVE_INFINITY:0===t||0===r?Math.max(t,r):Math.min(t,r);const a={};Object.defineProperty(a,"maxMessageSize",{get:()=>s}),this._sctp=a}return s.apply(this,arguments)}}function ie(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const r=e.send;e.send=function(){const i=arguments[0],n=i.length||i.size||i.byteLength;if("open"===e.readyState&&t.sctp&&n>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}const r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=r.apply(this,arguments);return t(e,this),e},o(e,"datachannel",(e=>(t(e.channel,e.target),e)))}function ne(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(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((e=>{const r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}function oe(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const r=t.sdp.split("\n").filter((e=>"a=extmap-allow-mixed"!==e.trim())).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return r.apply(this,arguments)}}function se(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const 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 ae(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return r.apply(this,arguments);if(e={type:e.type,sdp:e.sdp},!e.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}if(e.sdp||"offer"!==e.type&&"answer"!==e.type)return r.apply(this,[e]);return("offer"===e.type?this.createOffer:this.createAnswer).apply(this).then((e=>r.apply(this,[e])))})}var ce=Object.freeze({__proto__:null,removeExtmapAllowMixed:oe,shimAddIceCandidateNullOrEmpty:se,shimConnectionState:ne,shimMaxMessageSize:re,shimParameterlessSetLocalDescription:ae,shimRTCIceCandidate:ee,shimRTCIceCandidateRelayProtocol:te,shimSendThrowTypeError:ie});!function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const r=c,i=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:r}=e;if(r.mozGetUserMedia)t.browser="firefox",t.version=n(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=n(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=n(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),o={browserDetails:i,commonShim:ce,extractVersion:n,disableLog:s,disableWarnings:a,sdp:$};switch(i.browser){case"chrome":if(!b||!v||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),o;if(null===i.version)return r("Chrome shim can not determine version, not shimming."),o;r("adapter.js shimming chrome."),o.browserShim=b,se(e,i),ae(e),E(e,i),m(e),v(e,i),_(e),y(e,i),T(e),g(e),S(e),A(e,i),ee(e),te(e),ne(e),re(e,i),ie(e),oe(e,i);break;case"firefox":if(!x||!C||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),o;r("adapter.js shimming firefox."),o.browserShim=x,se(e,i),ae(e),I(e,i),C(e,i),O(e),D(e),N(e),w(e),P(e),L(e),k(e),M(e),U(e),ee(e),ne(e),re(e,i),ie(e);break;case"safari":if(!z||!t.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=z,se(e,i),ae(e),W(e),K(e),B(e),V(e),F(e),H(e),j(e),Y(e),ee(e),te(e),re(e,i),ie(e),oe(e,i);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var de={exports:{}};!function(e,t){!function(r,i){var n="function",o="undefined",s="object",a="string",c="major",d="model",u="name",l="type",h="vendor",p="version",f="architecture",E="console",m="mobile",_="tablet",T="smarttv",g="wearable",S="embedded",R="Amazon",y="Apple",v="ASUS",A="BlackBerry",b="Browser",I="Chrome",O="Firefox",C="Google",N="Huawei",w="LG",D="Microsoft",P="Motorola",L="Opera",k="Samsung",M="Sharp",U="Sony",x="Xiaomi",V="Zebra",F="Facebook",B="Chromium OS",j="Mac OS",G=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},W=function(e,t){return typeof e===a&&-1!==H(t).indexOf(H(e))},H=function(e){return e.toLowerCase()},K=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof t===o?e:e.substring(0,350)},Y=function(e,t){for(var r,o,a,c,d,u,l=0;l<t.length&&!d;){var h=t[l],p=t[l+1];for(r=o=0;r<h.length&&!d&&h[r];)if(d=h[r++].exec(e))for(a=0;a<p.length;a++)u=d[++o],typeof(c=p[a])===s&&c.length>0?2===c.length?typeof c[1]==n?this[c[0]]=c[1].call(this,u):this[c[0]]=c[1]:3===c.length?typeof c[1]!==n||c[1].exec&&c[1].test?this[c[0]]=u?u.replace(c[1],c[2]):i:this[c[0]]=u?c[1].call(this,u,c[2]):i:4===c.length&&(this[c[0]]=u?c[3].call(this,u.replace(c[1],c[2])):i):this[c]=u||i;l+=2}},z=function(e,t){for(var r in t)if(typeof t[r]===s&&t[r].length>0){for(var n=0;n<t[r].length;n++)if(W(t[r][n],e))return"?"===r?i:r}else if(W(t[r],e))return"?"===r?i:r;return e},X={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},Z={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,p],[/opios[\/ ]+([\w\.]+)/i],[p,[u,L+" Mini"]],[/\bopr\/([\w\.]+)/i],[p,[u,L]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[u,p],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[u,"UC"+b]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[p,[u,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[p,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[u,"IE"]],[/yabrowser\/([\w\.]+)/i],[p,[u,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+b],p],[/\bfocus\/([\w\.]+)/i],[p,[u,O+" Focus"]],[/\bopt\/([\w\.]+)/i],[p,[u,L+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[u,L+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[u,"MIUI "+b]],[/fxios\/([-\w\.]+)/i],[p,[u,O]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 "+b]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 "+b],p],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[u,p],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,F],p],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[u,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[u,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[u,I+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,I+" WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[u,"Android "+b]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,p],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[p,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[p,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[p,z,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[u,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[u,O+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[u,p],[/(cobalt)\/([\w\.]+)/i],[u,[p,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,H]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",H]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,H]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[d,[h,k],[l,_]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[d,[h,k],[l,m]],[/\((ip(?:hone|od)[\w ]*);/i],[d,[h,y],[l,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[d,[h,y],[l,_]],[/(macintosh);/i],[d,[h,y]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[d,[h,M],[l,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[d,[h,N],[l,_]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[d,[h,N],[l,m]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[d,/_/g," "],[h,x],[l,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[d,/_/g," "],[h,x],[l,_]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[d,[h,"OPPO"],[l,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[d,[h,"Vivo"],[l,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[d,[h,"Realme"],[l,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[d,[h,P],[l,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[d,[h,P],[l,_]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[h,w],[l,_]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[d,[h,w],[l,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[d,[h,"Lenovo"],[l,_]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[d,/_/g," "],[h,"Nokia"],[l,m]],[/(pixel c)\b/i],[d,[h,C],[l,_]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[d,[h,C],[l,m]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[d,[h,U],[l,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[d,"Xperia Tablet"],[h,U],[l,_]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[d,[h,"OnePlus"],[l,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[d,[h,R],[l,_]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[d,/(.+)/g,"Fire Phone $1"],[h,R],[l,m]],[/(playbook);[-\w\),; ]+(rim)/i],[d,h,[l,_]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[d,[h,A],[l,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[d,[h,v],[l,_]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[d,[h,v],[l,m]],[/(nexus 9)/i],[d,[h,"HTC"],[l,_]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[h,[d,/_/g," "],[l,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[d,[h,"Acer"],[l,_]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[d,[h,"Meizu"],[l,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[h,d,[l,m]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[h,d,[l,_]],[/(surface duo)/i],[d,[h,D],[l,_]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[d,[h,"Fairphone"],[l,m]],[/(u304aa)/i],[d,[h,"AT&T"],[l,m]],[/\bsie-(\w*)/i],[d,[h,"Siemens"],[l,m]],[/\b(rct\w+) b/i],[d,[h,"RCA"],[l,_]],[/\b(venue[\d ]{2,7}) b/i],[d,[h,"Dell"],[l,_]],[/\b(q(?:mv|ta)\w+) b/i],[d,[h,"Verizon"],[l,_]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[d,[h,"Barnes & Noble"],[l,_]],[/\b(tm\d{3}\w+) b/i],[d,[h,"NuVision"],[l,_]],[/\b(k88) b/i],[d,[h,"ZTE"],[l,_]],[/\b(nx\d{3}j) b/i],[d,[h,"ZTE"],[l,m]],[/\b(gen\d{3}) b.+49h/i],[d,[h,"Swiss"],[l,m]],[/\b(zur\d{3}) b/i],[d,[h,"Swiss"],[l,_]],[/\b((zeki)?tb.*\b) b/i],[d,[h,"Zeki"],[l,_]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[h,"Dragon Touch"],d,[l,_]],[/\b(ns-?\w{0,9}) b/i],[d,[h,"Insignia"],[l,_]],[/\b((nxa|next)-?\w{0,9}) b/i],[d,[h,"NextBook"],[l,_]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[h,"Voice"],d,[l,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[h,"LvTel"],d,[l,m]],[/\b(ph-1) /i],[d,[h,"Essential"],[l,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[d,[h,"Envizen"],[l,_]],[/\b(trio[-\w\. ]+) b/i],[d,[h,"MachSpeed"],[l,_]],[/\btu_(1491) b/i],[d,[h,"Rotor"],[l,_]],[/(shield[\w ]+) b/i],[d,[h,"Nvidia"],[l,_]],[/(sprint) (\w+)/i],[h,d,[l,m]],[/(kin\.[onetw]{3})/i],[[d,/\./g," "],[h,D],[l,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[d,[h,V],[l,_]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[d,[h,V],[l,m]],[/smart-tv.+(samsung)/i],[h,[l,T]],[/hbbtv.+maple;(\d+)/i],[[d,/^/,"SmartTV"],[h,k],[l,T]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[h,w],[l,T]],[/(apple) ?tv/i],[h,[d,y+" TV"],[l,T]],[/crkey/i],[[d,I+"cast"],[h,C],[l,T]],[/droid.+aft(\w)( bui|\))/i],[d,[h,R],[l,T]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[d,[h,M],[l,T]],[/(bravia[\w ]+)( bui|\))/i],[d,[h,U],[l,T]],[/(mitv-\w{5}) bui/i],[d,[h,x],[l,T]],[/Hbbtv.*(technisat) (.*);/i],[h,d,[l,T]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[h,K],[d,K],[l,T]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,T]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[h,d,[l,E]],[/droid.+; (shield) bui/i],[d,[h,"Nvidia"],[l,E]],[/(playstation [345portablevi]+)/i],[d,[h,U],[l,E]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[d,[h,D],[l,E]],[/((pebble))app/i],[h,d,[l,g]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[d,[h,y],[l,g]],[/droid.+; (glass) \d/i],[d,[h,C],[l,g]],[/droid.+; (wt63?0{2,3})\)/i],[d,[h,V],[l,g]],[/(quest( 2| pro)?)/i],[d,[h,F],[l,g]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[h,[l,S]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[d,[l,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[d,[l,_]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,_]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,m]],[/(android[-\w\. ]{0,9});.+buil/i],[d,[h,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[u,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,p],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[u,[p,z,X]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,"Windows"],[p,z,X]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,j],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[p,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,p],[/\(bb(10);/i],[p,[u,A]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[u,O+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[u,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[p,[u,"watchOS"]],[/crkey\/([\d\.]+)/i],[p,[u,I+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[u,B],p],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,p],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[u,p]]},J=function(e,t){if(typeof e===s&&(t=e,e=i),!(this instanceof J))return new J(e,t).getResult();var E=typeof r!==o&&r.navigator?r.navigator:i,T=e||(E&&E.userAgent?E.userAgent:""),g=E&&E.userAgentData?E.userAgentData:i,S=t?function(e,t){var r={};for(var i in e)t[i]&&t[i].length%2==0?r[i]=t[i].concat(e[i]):r[i]=e[i];return r}(Z,t):Z;return this.getBrowser=function(){var e={};return e[u]=i,e[p]=i,Y.call(e,T,S.browser),e[c]=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:i}(e[p]),E&&E.brave&&typeof E.brave.isBrave==n&&(e[u]="Brave"),e},this.getCPU=function(){var e={};return e[f]=i,Y.call(e,T,S.cpu),e},this.getDevice=function(){var e={};return e[h]=i,e[d]=i,e[l]=i,Y.call(e,T,S.device),!e[l]&&g&&g.mobile&&(e[l]=m),"Macintosh"==e[d]&&E&&typeof E.standalone!==o&&E.maxTouchPoints&&E.maxTouchPoints>2&&(e[d]="iPad",e[l]=_),e},this.getEngine=function(){var e={};return e[u]=i,e[p]=i,Y.call(e,T,S.engine),e},this.getOS=function(){var e={};return e[u]=i,e[p]=i,Y.call(e,T,S.os),!e[u]&&g&&"Unknown"!=g.platform&&(e[u]=g.platform.replace(/chrome os/i,B).replace(/macos/i,j)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return T},this.setUA=function(e){return T=typeof e===a&&e.length>350?K(e,350):e,this},this.setUA(T),this};J.VERSION="0.7.34",J.BROWSER=G([u,p,c]),J.CPU=G([f]),J.DEVICE=G([d,h,l,E,m,T,_,g,S]),J.ENGINE=J.OS=G([u,p]),e.exports&&(t=e.exports=J),t.UAParser=J;var Q=typeof r!==o&&(r.jQuery||r.Zepto);if(Q&&!Q.ua){var q=new J;Q.ua=q.getResult(),Q.ua.get=function(){return q.getUA()},Q.ua.set=function(e){q.setUA(e);var t=q.getResult();for(var r in t)Q.ua[r]=t[r]}}}("object"==typeof window?window:X)}(de,de.exports);var ue=Z(de.exports);function le(e,t){return function(){return e.apply(t,arguments)}}const{toString:he}=Object.prototype,{getPrototypeOf:pe}=Object,{iterator:fe,toStringTag:Ee}=Symbol,me=(e=>t=>{const r=he.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),_e=e=>(e=e.toLowerCase(),t=>me(t)===e),Te=e=>t=>typeof t===e,{isArray:ge}=Array,Se=Te("undefined");function Re(e){return null!==e&&!Se(e)&&null!==e.constructor&&!Se(e.constructor)&&Ae(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const ye=_e("ArrayBuffer");const ve=Te("string"),Ae=Te("function"),be=Te("number"),Ie=e=>null!==e&&"object"==typeof e,Oe=e=>{if("object"!==me(e))return!1;const t=pe(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Ee in e||fe in e)},Ce=_e("Date"),Ne=_e("File"),we=_e("Blob"),De=_e("FileList");const Pe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},Le=void 0!==Pe.FormData?Pe.FormData:void 0,ke=_e("URLSearchParams"),[Me,Ue,xe,Ve]=["ReadableStream","Request","Response","Headers"].map(_e);function Fe(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let i,n;if("object"!=typeof e&&(e=[e]),ge(e))for(i=0,n=e.length;i<n;i++)t.call(null,e[i],i,e);else{if(Re(e))return;const n=r?Object.getOwnPropertyNames(e):Object.keys(e),o=n.length;let s;for(i=0;i<o;i++)s=n[i],t.call(null,e[s],s,e)}}function Be(e,t){if(Re(e))return null;t=t.toLowerCase();const r=Object.keys(e);let i,n=r.length;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}const je="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Ge=e=>!Se(e)&&e!==je;const We=(He="undefined"!=typeof Uint8Array&&pe(Uint8Array),e=>He&&e instanceof He);var He;const Ke=_e("HTMLFormElement"),Ye=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),ze=_e("RegExp"),Xe=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),i={};Fe(r,((r,n)=>{let o;!1!==(o=t(r,n,e))&&(i[n]=o||r)})),Object.defineProperties(e,i)};const Ze=_e("AsyncFunction"),Je=(Qe="function"==typeof setImmediate,qe=Ae(je.postMessage),Qe?setImmediate:qe?($e=`axios@${Math.random()}`,et=[],je.addEventListener("message",(({source:e,data:t})=>{e===je&&t===$e&&et.length&&et.shift()()}),!1),e=>{et.push(e),je.postMessage($e,"*")}):e=>setTimeout(e));var Qe,qe,$e,et;const tt="undefined"!=typeof queueMicrotask?queueMicrotask.bind(je):"undefined"!=typeof process&&process.nextTick||Je;var rt={isArray:ge,isArrayBuffer:ye,isBuffer:Re,isFormData:e=>{let t;return e&&(Le&&e instanceof Le||Ae(e.append)&&("formdata"===(t=me(e))||"object"===t&&Ae(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&ye(e.buffer),t},isString:ve,isNumber:be,isBoolean:e=>!0===e||!1===e,isObject:Ie,isPlainObject:Oe,isEmptyObject:e=>{if(!Ie(e)||Re(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Me,isRequest:Ue,isResponse:xe,isHeaders:Ve,isUndefined:Se,isDate:Ce,isFile:Ne,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:we,isRegExp:ze,isFunction:Ae,isStream:e=>Ie(e)&&Ae(e.pipe),isURLSearchParams:ke,isTypedArray:We,isFileList:De,forEach:Fe,merge:function e(){const{caseless:t,skipUndefined:r}=Ge(this)&&this||{},i={},n=(n,o)=>{if("__proto__"===o||"constructor"===o||"prototype"===o)return;const s=t&&Be(i,o)||o;Oe(i[s])&&Oe(n)?i[s]=e(i[s],n):Oe(n)?i[s]=e({},n):ge(n)?i[s]=n.slice():r&&Se(n)||(i[s]=n)};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Fe(arguments[e],n);return i},extend:(e,t,r,{allOwnKeys:i}={})=>(Fe(t,((t,i)=>{r&&Ae(t)?Object.defineProperty(e,i,{value:le(t,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,i,{value:t,writable:!0,enumerable:!0,configurable:!0})}),{allOwnKeys:i}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,i)=>{e.prototype=Object.create(t.prototype,i),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,i)=>{let n,o,s;const a={};if(t=t||{},null==e)return t;do{for(n=Object.getOwnPropertyNames(e),o=n.length;o-- >0;)s=n[o],i&&!i(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==r&&pe(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:me,kindOfTest:_e,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const i=e.indexOf(t,r);return-1!==i&&i===r},toArray:e=>{if(!e)return null;if(ge(e))return e;let t=e.length;if(!be(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[fe]).call(e);let i;for(;(i=r.next())&&!i.done;){const r=i.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const i=[];for(;null!==(r=e.exec(t));)i.push(r);return i},isHTMLForm:Ke,hasOwnProperty:Ye,hasOwnProp:Ye,reduceDescriptors:Xe,freezeMethods:e=>{Xe(e,((t,r)=>{if(Ae(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const i=e[r];Ae(i)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},i=e=>{e.forEach((e=>{r[e]=!0}))};return ge(e)?i(e):i(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Be,global:je,isContextDefined:Ge,isSpecCompliantForm:function(e){return!!(e&&Ae(e.append)&&"FormData"===e[Ee]&&e[fe])},toJSONObject:e=>{const t=new Array(10),r=(e,i)=>{if(Ie(e)){if(t.indexOf(e)>=0)return;if(Re(e))return e;if(!("toJSON"in e)){t[i]=e;const n=ge(e)?[]:{};return Fe(e,((e,t)=>{const o=r(e,i+1);!Se(o)&&(n[t]=o)})),t[i]=void 0,n}}return e};return r(e,0)},isAsyncFn:Ze,isThenable:e=>e&&(Ie(e)||Ae(e))&&Ae(e.then)&&Ae(e.catch),setImmediate:Je,asap:tt,isIterable:e=>null!=e&&Ae(e[fe])};class it extends Error{static from(e,t,r,i,n,o){const s=new it(e.message,t||e.code,r,i,n);return s.cause=e,s.name=e.name,null!=e.status&&null==s.status&&(s.status=e.status),o&&Object.assign(s,o),s}constructor(e,t,r,i,n){super(e),Object.defineProperty(this,"message",{value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status)}toJSON(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:rt.toJSONObject(this.config),code:this.code,status:this.status}}}it.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",it.ERR_BAD_OPTION="ERR_BAD_OPTION",it.ECONNABORTED="ECONNABORTED",it.ETIMEDOUT="ETIMEDOUT",it.ERR_NETWORK="ERR_NETWORK",it.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",it.ERR_DEPRECATED="ERR_DEPRECATED",it.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",it.ERR_BAD_REQUEST="ERR_BAD_REQUEST",it.ERR_CANCELED="ERR_CANCELED",it.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",it.ERR_INVALID_URL="ERR_INVALID_URL";var nt=it;function ot(e){return rt.isPlainObject(e)||rt.isArray(e)}function st(e){return rt.endsWith(e,"[]")?e.slice(0,-2):e}function at(e,t,r){return e?e.concat(t).map((function(e,t){return e=st(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const ct=rt.toFlatObject(rt,{},null,(function(e){return/^is[A-Z]/.test(e)}));function dt(e,t,r){if(!rt.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const i=(r=rt.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!rt.isUndefined(t[e])}))).metaTokens,n=r.visitor||d,o=r.dots,s=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&rt.isSpecCompliantForm(t);if(!rt.isFunction(n))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(rt.isDate(e))return e.toISOString();if(rt.isBoolean(e))return e.toString();if(!a&&rt.isBlob(e))throw new nt("Blob is not supported. Use a Buffer instead.");return rt.isArrayBuffer(e)||rt.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,r,n){let a=e;if(rt.isReactNative(t)&&rt.isReactNativeBlob(e))return t.append(at(n,r,o),c(e)),!1;if(e&&!n&&"object"==typeof e)if(rt.endsWith(r,"{}"))r=i?r:r.slice(0,-2),e=JSON.stringify(e);else if(rt.isArray(e)&&function(e){return rt.isArray(e)&&!e.some(ot)}(e)||(rt.isFileList(e)||rt.endsWith(r,"[]"))&&(a=rt.toArray(e)))return r=st(r),a.forEach((function(e,i){!rt.isUndefined(e)&&null!==e&&t.append(!0===s?at([r],i,o):null===s?r:r+"[]",c(e))})),!1;return!!ot(e)||(t.append(at(n,r,o),c(e)),!1)}const u=[],l=Object.assign(ct,{defaultVisitor:d,convertValue:c,isVisitable:ot});if(!rt.isObject(e))throw new TypeError("data must be an object");return function e(r,i){if(!rt.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+i.join("."));u.push(r),rt.forEach(r,(function(r,o){!0===(!(rt.isUndefined(r)||null===r)&&n.call(t,r,rt.isString(o)?o.trim():o,i,l))&&e(r,i?i.concat(o):[o])})),u.pop()}}(e),t}function ut(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function lt(e,t){this._pairs=[],e&&dt(e,this,t)}const ht=lt.prototype;function pt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function ft(e,t,r){if(!t)return e;const i=r&&r.encode||pt,n=rt.isFunction(r)?{serialize:r}:r,o=n&&n.serialize;let s;if(s=o?o(t,n):rt.isURLSearchParams(t)?t.toString():new lt(t,n).toString(i),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}ht.append=function(e,t){this._pairs.push([e,t])},ht.toString=function(e){const t=e?function(t){return e.call(this,t,ut)}:ut;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var Et=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){rt.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},mt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},_t={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:lt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Tt="undefined"!=typeof window&&"undefined"!=typeof document,gt="object"==typeof navigator&&navigator||void 0,St=Tt&&(!gt||["ReactNative","NativeScript","NS"].indexOf(gt.product)<0),Rt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,yt=Tt&&window.location.href||"http://localhost";var vt={...Object.freeze({__proto__:null,hasBrowserEnv:Tt,hasStandardBrowserEnv:St,hasStandardBrowserWebWorkerEnv:Rt,navigator:gt,origin:yt}),..._t};function At(e){function t(e,r,i,n){let o=e[n++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=n>=e.length;if(o=!o&&rt.isArray(i)?i.length:o,a)return rt.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!s;i[o]&&rt.isObject(i[o])||(i[o]=[]);return t(e,r,i[o],n)&&rt.isArray(i[o])&&(i[o]=function(e){const t={},r=Object.keys(e);let i;const n=r.length;let o;for(i=0;i<n;i++)o=r[i],t[o]=e[o];return t}(i[o])),!s}if(rt.isFormData(e)&&rt.isFunction(e.entries)){const r={};return rt.forEachEntry(e,((e,i)=>{t(function(e){return rt.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),i,r,0)})),r}return null}const bt={transitional:mt,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,n=rt.isObject(e);n&&rt.isHTMLForm(e)&&(e=new FormData(e));if(rt.isFormData(e))return i?JSON.stringify(At(e)):e;if(rt.isArrayBuffer(e)||rt.isBuffer(e)||rt.isStream(e)||rt.isFile(e)||rt.isBlob(e)||rt.isReadableStream(e))return e;if(rt.isArrayBufferView(e))return e.buffer;if(rt.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(n){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return dt(e,new vt.classes.URLSearchParams,{visitor:function(e,t,r,i){return vt.isNode&&rt.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}(e,this.formSerializer).toString();if((o=rt.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return dt(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return n||i?(t.setContentType("application/json",!1),function(e,t,r){if(rt.isString(e))try{return(t||JSON.parse)(e),rt.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||bt.transitional,r=t&&t.forcedJSONParsing,i="json"===this.responseType;if(rt.isResponse(e)||rt.isReadableStream(e))return e;if(e&&rt.isString(e)&&(r&&!this.responseType||i)){const r=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,this.parseReviver)}catch(e){if(r){if("SyntaxError"===e.name)throw nt.from(e,nt.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:vt.classes.FormData,Blob:vt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};rt.forEach(["delete","get","head","post","put","patch"],(e=>{bt.headers[e]={}}));var It=bt;const Ot=rt.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Ct=Symbol("internals");function Nt(e){return e&&String(e).trim().toLowerCase()}function wt(e){return!1===e||null==e?e:rt.isArray(e)?e.map(wt):String(e)}function Dt(e,t,r,i,n){return rt.isFunction(i)?i.call(this,t,r):(n&&(t=r),rt.isString(t)?rt.isString(i)?-1!==t.indexOf(i):rt.isRegExp(i)?i.test(t):void 0:void 0)}class Pt{constructor(e){e&&this.set(e)}set(e,t,r){const i=this;function n(e,t,r){const n=Nt(t);if(!n)throw new Error("header name must be a non-empty string");const o=rt.findKey(i,n);(!o||void 0===i[o]||!0===r||void 0===r&&!1!==i[o])&&(i[o||t]=wt(e))}const o=(e,t)=>rt.forEach(e,((e,r)=>n(e,r,t)));if(rt.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(rt.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let r,i,n;return e&&e.split("\n").forEach((function(e){n=e.indexOf(":"),r=e.substring(0,n).trim().toLowerCase(),i=e.substring(n+1).trim(),!r||t[r]&&Ot[r]||("set-cookie"===r?t[r]?t[r].push(i):t[r]=[i]:t[r]=t[r]?t[r]+", "+i:i)})),t})(e),t);else if(rt.isObject(e)&&rt.isIterable(e)){let r,i,n={};for(const t of e){if(!rt.isArray(t))throw TypeError("Object iterator must return a key-value pair");n[i=t[0]]=(r=n[i])?rt.isArray(r)?[...r,t[1]]:[r,t[1]]:t[1]}o(n,t)}else null!=e&&n(t,e,r);return this}get(e,t){if(e=Nt(e)){const r=rt.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let i;for(;i=r.exec(e);)t[i[1]]=i[2];return t}(e);if(rt.isFunction(t))return t.call(this,e,r);if(rt.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Nt(e)){const r=rt.findKey(this,e);return!(!r||void 0===this[r]||t&&!Dt(0,this[r],r,t))}return!1}delete(e,t){const r=this;let i=!1;function n(e){if(e=Nt(e)){const n=rt.findKey(r,e);!n||t&&!Dt(0,r[n],n,t)||(delete r[n],i=!0)}}return rt.isArray(e)?e.forEach(n):n(e),i}clear(e){const t=Object.keys(this);let r=t.length,i=!1;for(;r--;){const n=t[r];e&&!Dt(0,this[n],n,e,!0)||(delete this[n],i=!0)}return i}normalize(e){const t=this,r={};return rt.forEach(this,((i,n)=>{const o=rt.findKey(r,n);if(o)return t[o]=wt(i),void delete t[n];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(n):String(n).trim();s!==n&&delete t[n],t[s]=wt(i),r[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return rt.forEach(this,((r,i)=>{null!=r&&!1!==r&&(t[i]=e&&rt.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[Ct]=this[Ct]={accessors:{}}).accessors,r=this.prototype;function i(e){const i=Nt(e);t[i]||(!function(e,t){const r=rt.toCamelCase(" "+t);["get","set","has"].forEach((i=>{Object.defineProperty(e,i+r,{value:function(e,r,n){return this[i].call(this,t,e,r,n)},configurable:!0})}))}(r,e),t[i]=!0)}return rt.isArray(e)?e.forEach(i):i(e),this}}Pt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),rt.reduceDescriptors(Pt.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),rt.freezeMethods(Pt);var Lt=Pt;function kt(e,t){const r=this||It,i=t||r,n=Lt.from(i.headers);let o=i.data;return rt.forEach(e,(function(e){o=e.call(r,o,n.normalize(),t?t.status:void 0)})),n.normalize(),o}function Mt(e){return!(!e||!e.__CANCEL__)}var Ut=class extends nt{constructor(e,t,r){super(null==e?"canceled":e,nt.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}};function xt(e,t,r){const i=r.config.validateStatus;r.status&&i&&!i(r.status)?t(new nt("Request failed with status code "+r.status,[nt.ERR_BAD_REQUEST,nt.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}const Vt=(e,t,r=3)=>{let i=0;const n=function(e,t){e=e||10;const r=new Array(e),i=new Array(e);let n,o=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),d=i[s];n||(n=c),r[o]=a,i[o]=c;let u=s,l=0;for(;u!==o;)l+=r[u++],u%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),c-n<t)return;const h=d&&c-d;return h?Math.round(1e3*l/h):void 0}}(50,250);return function(e,t){let r,i,n=0,o=1e3/t;const s=(t,o=Date.now())=>{n=o,r=null,i&&(clearTimeout(i),i=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-n;a>=o?s(e,t):(r=e,i||(i=setTimeout((()=>{i=null,s(r)}),o-a)))},()=>r&&s(r)]}((r=>{const o=r.loaded,s=r.lengthComputable?r.total:void 0,a=o-i,c=n(a);i=o;e({loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&o<=s?(s-o)/c:void 0,event:r,lengthComputable:null!=s,[t?"download":"upload"]:!0})}),r)},Ft=(e,t)=>{const r=null!=e;return[i=>t[0]({lengthComputable:r,total:e,loaded:i}),t[1]]},Bt=e=>(...t)=>rt.asap((()=>e(...t)));var jt=vt.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,vt.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(vt.origin),vt.navigator&&/(msie|trident)/i.test(vt.navigator.userAgent)):()=>!0,Gt=vt.hasStandardBrowserEnv?{write(e,t,r,i,n,o,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];rt.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),rt.isString(i)&&a.push(`path=${i}`),rt.isString(n)&&a.push(`domain=${n}`),!0===o&&a.push("secure"),rt.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};function Wt(e,t,r){let i=!function(e){return"string"==typeof e&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t);return e&&(i||0==r)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}const Ht=e=>e instanceof Lt?{...e}:e;function Kt(e,t){t=t||{};const r={};function i(e,t,r,i){return rt.isPlainObject(e)&&rt.isPlainObject(t)?rt.merge.call({caseless:i},e,t):rt.isPlainObject(t)?rt.merge({},t):rt.isArray(t)?t.slice():t}function n(e,t,r,n){return rt.isUndefined(t)?rt.isUndefined(e)?void 0:i(void 0,e,0,n):i(e,t,0,n)}function o(e,t){if(!rt.isUndefined(t))return i(void 0,t)}function s(e,t){return rt.isUndefined(t)?rt.isUndefined(e)?void 0:i(void 0,e):i(void 0,t)}function a(r,n,o){return o in t?i(r,n):o in e?i(void 0,r):void 0}const c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:a,headers:(e,t,r)=>n(Ht(e),Ht(t),0,!0)};return rt.forEach(Object.keys({...e,...t}),(function(i){if("__proto__"===i||"constructor"===i||"prototype"===i)return;const o=rt.hasOwnProp(c,i)?c[i]:n,s=o(e[i],t[i],i);rt.isUndefined(s)&&o!==a||(r[i]=s)})),r}var Yt=e=>{const t=Kt({},e);let{data:r,withXSRFToken:i,xsrfHeaderName:n,xsrfCookieName:o,headers:s,auth:a}=t;if(t.headers=s=Lt.from(s),t.url=ft(Wt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&s.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),rt.isFormData(r))if(vt.hasStandardBrowserEnv||vt.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(rt.isFunction(r.getHeaders)){const e=r.getHeaders(),t=["content-type","content-length"];Object.entries(e).forEach((([e,r])=>{t.includes(e.toLowerCase())&&s.set(e,r)}))}if(vt.hasStandardBrowserEnv&&(i&&rt.isFunction(i)&&(i=i(t)),i||!1!==i&&jt(t.url))){const e=n&&o&&Gt.read(o);e&&s.set(n,e)}return t};var zt="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){const i=Yt(e);let n=i.data;const o=Lt.from(i.headers).normalize();let s,a,c,d,u,{responseType:l,onUploadProgress:h,onDownloadProgress:p}=i;function f(){d&&d(),u&&u(),i.cancelToken&&i.cancelToken.unsubscribe(s),i.signal&&i.signal.removeEventListener("abort",s)}let E=new XMLHttpRequest;function m(){if(!E)return;const i=Lt.from("getAllResponseHeaders"in E&&E.getAllResponseHeaders());xt((function(e){t(e),f()}),(function(e){r(e),f()}),{data:l&&"text"!==l&&"json"!==l?E.response:E.responseText,status:E.status,statusText:E.statusText,headers:i,config:e,request:E}),E=null}E.open(i.method.toUpperCase(),i.url,!0),E.timeout=i.timeout,"onloadend"in E?E.onloadend=m:E.onreadystatechange=function(){E&&4===E.readyState&&(0!==E.status||E.responseURL&&0===E.responseURL.indexOf("file:"))&&setTimeout(m)},E.onabort=function(){E&&(r(new nt("Request aborted",nt.ECONNABORTED,e,E)),E=null)},E.onerror=function(t){const i=t&&t.message?t.message:"Network Error",n=new nt(i,nt.ERR_NETWORK,e,E);n.event=t||null,r(n),E=null},E.ontimeout=function(){let t=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const n=i.transitional||mt;i.timeoutErrorMessage&&(t=i.timeoutErrorMessage),r(new nt(t,n.clarifyTimeoutError?nt.ETIMEDOUT:nt.ECONNABORTED,e,E)),E=null},void 0===n&&o.setContentType(null),"setRequestHeader"in E&&rt.forEach(o.toJSON(),(function(e,t){E.setRequestHeader(t,e)})),rt.isUndefined(i.withCredentials)||(E.withCredentials=!!i.withCredentials),l&&"json"!==l&&(E.responseType=i.responseType),p&&([c,u]=Vt(p,!0),E.addEventListener("progress",c)),h&&E.upload&&([a,d]=Vt(h),E.upload.addEventListener("progress",a),E.upload.addEventListener("loadend",d)),(i.cancelToken||i.signal)&&(s=t=>{E&&(r(!t||t.type?new Ut(null,e,E):t),E.abort(),E=null)},i.cancelToken&&i.cancelToken.subscribe(s),i.signal&&(i.signal.aborted?s():i.signal.addEventListener("abort",s)));const _=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(i.url);_&&-1===vt.protocols.indexOf(_)?r(new nt("Unsupported protocol "+_+":",nt.ERR_BAD_REQUEST,e)):E.send(n||null)}))};var Xt=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,i=new AbortController;const n=function(e){if(!r){r=!0,s();const t=e instanceof Error?e:this.reason;i.abort(t instanceof nt?t:new Ut(t instanceof Error?t.message:t))}};let o=t&&setTimeout((()=>{o=null,n(new nt(`timeout of ${t}ms exceeded`,nt.ETIMEDOUT))}),t);const s=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(n):e.removeEventListener("abort",n)})),e=null)};e.forEach((e=>e.addEventListener("abort",n)));const{signal:a}=i;return a.unsubscribe=()=>rt.asap(s),a}};const Zt=function*(e,t){let r=e.byteLength;if(!t||r<t)return void(yield e);let i,n=0;for(;n<r;)i=n+t,yield e.slice(n,i),n=i},Jt=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},Qt=(e,t,r,i)=>{const n=async function*(e,t){for await(const r of Jt(e))yield*Zt(r,t)}(e,t);let o,s=0,a=e=>{o||(o=!0,i&&i(e))};return new ReadableStream({async pull(e){try{const{done:t,value:i}=await n.next();if(t)return a(),void e.close();let o=i.byteLength;if(r){let e=s+=o;r(e)}e.enqueue(new Uint8Array(i))}catch(e){throw a(e),e}},cancel:e=>(a(e),n.return())},{highWaterMark:2})},{isFunction:qt}=rt,$t=(({Request:e,Response:t})=>({Request:e,Response:t}))(rt.global),{ReadableStream:er,TextEncoder:tr}=rt.global,rr=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},ir=e=>{e=rt.merge.call({skipUndefined:!0},$t,e);const{fetch:t,Request:r,Response:i}=e,n=t?qt(t):"function"==typeof fetch,o=qt(r),s=qt(i);if(!n)return!1;const a=n&&qt(er),c=n&&("function"==typeof tr?(d=new tr,e=>d.encode(e)):async e=>new Uint8Array(await new r(e).arrayBuffer()));var d;const u=o&&a&&rr((()=>{let e=!1;const t=new r(vt.origin,{body:new er,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),l=s&&a&&rr((()=>rt.isReadableStream(new i("").body))),h={stream:l&&(e=>e.body)};n&&["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!h[e]&&(h[e]=(t,r)=>{let i=t&&t[e];if(i)return i.call(t);throw new nt(`Response type '${e}' is not supported`,nt.ERR_NOT_SUPPORT,r)})}));const p=async(e,t)=>{const i=rt.toFiniteNumber(e.getContentLength());return null==i?(async e=>{if(null==e)return 0;if(rt.isBlob(e))return e.size;if(rt.isSpecCompliantForm(e)){const t=new r(vt.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return rt.isArrayBufferView(e)||rt.isArrayBuffer(e)?e.byteLength:(rt.isURLSearchParams(e)&&(e+=""),rt.isString(e)?(await c(e)).byteLength:void 0)})(t):i};return async e=>{let{url:n,method:s,data:a,signal:c,cancelToken:d,timeout:f,onDownloadProgress:E,onUploadProgress:m,responseType:_,headers:T,withCredentials:g="same-origin",fetchOptions:S}=Yt(e),R=t||fetch;_=_?(_+"").toLowerCase():"text";let y=Xt([c,d&&d.toAbortSignal()],f),v=null;const A=y&&y.unsubscribe&&(()=>{y.unsubscribe()});let b;try{if(m&&u&&"get"!==s&&"head"!==s&&0!==(b=await p(T,a))){let e,t=new r(n,{method:"POST",body:a,duplex:"half"});if(rt.isFormData(a)&&(e=t.headers.get("content-type"))&&T.setContentType(e),t.body){const[e,r]=Ft(b,Vt(Bt(m)));a=Qt(t.body,65536,e,r)}}rt.isString(g)||(g=g?"include":"omit");const t=o&&"credentials"in r.prototype,c={...S,signal:y,method:s.toUpperCase(),headers:T.normalize().toJSON(),body:a,duplex:"half",credentials:t?g:void 0};v=o&&new r(n,c);let d=await(o?R(v,S):R(n,c));const f=l&&("stream"===_||"response"===_);if(l&&(E||f&&A)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=d[t]}));const t=rt.toFiniteNumber(d.headers.get("content-length")),[r,n]=E&&Ft(t,Vt(Bt(E),!0))||[];d=new i(Qt(d.body,65536,r,(()=>{n&&n(),A&&A()})),e)}_=_||"text";let I=await h[rt.findKey(h,_)||"text"](d,e);return!f&&A&&A(),await new Promise(((t,r)=>{xt(t,r,{data:I,headers:Lt.from(d.headers),status:d.status,statusText:d.statusText,config:e,request:v})}))}catch(t){if(A&&A(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new nt("Network Error",nt.ERR_NETWORK,e,v,t&&t.response),{cause:t.cause||t});throw nt.from(t,t&&t.code,e,v,t&&t.response)}}},nr=new Map,or=e=>{let t=e&&e.env||{};const{fetch:r,Request:i,Response:n}=t,o=[i,n,r];let s,a,c=o.length,d=nr;for(;c--;)s=o[c],a=d.get(s),void 0===a&&d.set(s,a=c?new Map:ir(t)),d=a;return a};or();const sr={http:null,xhr:zt,fetch:{get:or}};rt.forEach(sr,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const ar=e=>`- ${e}`,cr=e=>rt.isFunction(e)||null===e||!1===e;var dr={getAdapter:function(e,t){e=rt.isArray(e)?e:[e];const{length:r}=e;let i,n;const o={};for(let s=0;s<r;s++){let r;if(i=e[s],n=i,!cr(i)&&(n=sr[(r=String(i)).toLowerCase()],void 0===n))throw new nt(`Unknown adapter '${r}'`);if(n&&(rt.isFunction(n)||(n=n.get(t))))break;o[r||"#"+s]=n}if(!n){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));let t=r?e.length>1?"since :\n"+e.map(ar).join("\n"):" "+ar(e[0]):"as no adapter specified";throw new nt("There is no suitable adapter to dispatch the request "+t,"ERR_NOT_SUPPORT")}return n},adapters:sr};function ur(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ut(null,e)}function lr(e){ur(e),e.headers=Lt.from(e.headers),e.data=kt.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return dr.getAdapter(e.adapter||It.adapter,e)(e).then((function(t){return ur(e),t.data=kt.call(e,e.transformResponse,t),t.headers=Lt.from(t.headers),t}),(function(t){return Mt(t)||(ur(e),t&&t.response&&(t.response.data=kt.call(e,e.transformResponse,t.response),t.response.headers=Lt.from(t.response.headers))),Promise.reject(t)}))}const hr="1.13.6",pr={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{pr[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const fr={};pr.transitional=function(e,t,r){function i(e,t){return"[Axios v"+hr+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,n,o)=>{if(!1===e)throw new nt(i(n," has been removed"+(t?" in "+t:"")),nt.ERR_DEPRECATED);return t&&!fr[n]&&(fr[n]=!0,console.warn(i(n," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,n,o)}},pr.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var Er={assertOptions:function(e,t,r){if("object"!=typeof e)throw new nt("options must be an object",nt.ERR_BAD_OPTION_VALUE);const i=Object.keys(e);let n=i.length;for(;n-- >0;){const o=i[n],s=t[o];if(s){const t=e[o],r=void 0===t||s(t,o,e);if(!0!==r)throw new nt("option "+o+" must be "+r,nt.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new nt("Unknown option "+o,nt.ERR_BAD_OPTION)}},validators:pr};const mr=Er.validators;let _r=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Et,response:new Et}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const r=t.stack?t.stack.replace(/^.+\n/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Kt(this.defaults,t);const{transitional:r,paramsSerializer:i,headers:n}=t;void 0!==r&&Er.assertOptions(r,{silentJSONParsing:mr.transitional(mr.boolean),forcedJSONParsing:mr.transitional(mr.boolean),clarifyTimeoutError:mr.transitional(mr.boolean),legacyInterceptorReqResOrdering:mr.transitional(mr.boolean)},!1),null!=i&&(rt.isFunction(i)?t.paramsSerializer={serialize:i}:Er.assertOptions(i,{encode:mr.function,serialize:mr.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Er.assertOptions(t,{baseUrl:mr.spelling("baseURL"),withXsrfToken:mr.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=n&&rt.merge(n.common,n[t.method]);n&&rt.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete n[e]})),t.headers=Lt.concat(o,n);const s=[];let a=!0;this.interceptors.request.forEach((function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;a=a&&e.synchronous;const r=t.transitional||mt;r&&r.legacyInterceptorReqResOrdering?s.unshift(e.fulfilled,e.rejected):s.push(e.fulfilled,e.rejected)}));const c=[];let d;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let u,l=0;if(!a){const e=[lr.bind(this),void 0];for(e.unshift(...s),e.push(...c),u=e.length,d=Promise.resolve(t);l<u;)d=d.then(e[l++],e[l++]);return d}u=s.length;let h=t;for(;l<u;){const e=s[l++],t=s[l++];try{h=e(h)}catch(e){t.call(this,e);break}}try{d=lr.call(this,h)}catch(e){return Promise.reject(e)}for(l=0,u=c.length;l<u;)d=d.then(c[l++],c[l++]);return d}getUri(e){return ft(Wt((e=Kt(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};rt.forEach(["delete","get","head","options"],(function(e){_r.prototype[e]=function(t,r){return this.request(Kt(r||{},{method:e,url:t,data:(r||{}).data}))}})),rt.forEach(["post","put","patch"],(function(e){function t(t){return function(r,i,n){return this.request(Kt(n||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}_r.prototype[e]=t(),_r.prototype[e+"Form"]=t(!0)}));var Tr=_r;class gr{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const i=new Promise((e=>{r.subscribe(e),t=e})).then(e);return i.cancel=function(){r.unsubscribe(t)},i},e((function(e,i,n){r.reason||(r.reason=new Ut(e,i,n),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new gr((function(t){e=t})),cancel:e}}}var Sr=gr;const Rr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Rr).forEach((([e,t])=>{Rr[t]=e}));var yr=Rr;const vr=function e(t){const r=new Tr(t),i=le(Tr.prototype.request,r);return rt.extend(i,Tr.prototype,r,{allOwnKeys:!0}),rt.extend(i,r,null,{allOwnKeys:!0}),i.create=function(r){return e(Kt(t,r))},i}(It);vr.Axios=Tr,vr.CanceledError=Ut,vr.CancelToken=Sr,vr.isCancel=Mt,vr.VERSION=hr,vr.toFormData=dt,vr.AxiosError=nt,vr.Cancel=vr.CanceledError,vr.all=function(e){return Promise.all(e)},vr.spread=function(e){return function(t){return e.apply(null,t)}},vr.isAxiosError=function(e){return rt.isObject(e)&&!0===e.isAxiosError},vr.mergeConfig=Kt,vr.AxiosHeaders=Lt,vr.formToJSON=e=>At(rt.isHTMLForm(e)?new FormData(e):e),vr.getAdapter=dr.getAdapter,vr.HttpStatusCode=yr,vr.default=vr;var Ar=vr;let br=function(e){return e.WIN_10="Windows 10",e.WIN_81="Windows 8.1",e.WIN_8="Windows 8",e.WIN_7="Windows 7",e.WIN_VISTA="Windows Vista",e.WIN_SERVER_2003="Windows Server 2003",e.WIN_XP="Windows XP",e.WIN_2000="Windows 2000",e.ANDROID="Android",e.HARMONY_OS="HarmonyOS",e.OPEN_BSD="Open BSD",e.SUN_OS="Sun OS",e.LINUX="Linux",e.IOS="iOS",e.MAC_OS="Mac OS",e.CHROMIUM_OS="Chromium OS",e.QNX="QNX",e.UNIX="UNIX",e.BEOS="BeOS",e.OS_2="OS/2",e.SEARCH_BOT="Search Bot",e}({}),Ir=function(e){return e.CHROME="Chrome",e.SAFARI="Safari",e.EDGE="Edge",e.FIREFOX="Firefox",e.OPERA="OPR",e.QQ="QQBrowser",e.WECHAT="MicroMessenger",e}({});const Or=new ue;let Cr=Or.getResult(),Nr=null;function wr(e){if(!Nr){e&&Or.setUA(e),Cr=Or.getResult();const t=function(e){if("Blink"===e.engine.name&&"WeChat"!==e.browser.name)return Ir.CHROME;switch(e.browser.name){case"Chrome Headless":case"Chrome":case"Chromium":return Ir.CHROME;case"Safari":case"Mobile Safari":return Ir.SAFARI;case"Edge":return Ir.EDGE;case"Firefox":return Ir.FIREFOX;case"QQ":case"QQBrowser":return Ir.QQ;case"Opera":return Ir.OPERA;case"WeChat":return Ir.WECHAT;default:return e.browser.name||""}}(Cr),r=Dr(Cr),i=function(e){return"Windows"===e.os.name?e.os.version?e.os.name+" "+e.os.version:e.os.name:e.os.name||""}(Cr),n=Cr.os.version,o=Dr(Cr,!1),s=Cr.device.type;if(!(t&&r&&i&&n))return{name:t,version:r,os:i,osVersion:n,browserVersion:o,deviceType:s};Nr={name:t,version:r,os:i,osVersion:n,browserVersion:o,deviceType:s}}return Nr}function Dr(e){let t,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t="Blink"===e.engine.name?e.engine.version||"":e.browser.version||"",r?t.split(".")[0]:t}function Pr(){return wr().os}function Lr(){const e=wr();return"".concat(e.os," ").concat(e.osVersion)}function kr(){const e=wr();return!!("WebKit"===Cr.engine.name&&e.os===br.MAC_OS&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0&&e.name!==Ir.SAFARI||Fr()&&e.name!==Ir.SAFARI)}function Mr(){return wr().name===Ir.CHROME}function Ur(){return wr().name===Ir.SAFARI}function xr(){return wr().name===Ir.EDGE}function Vr(){return wr().name===Ir.FIREFOX}function Fr(){return wr().os===br.IOS}function Br(e){const t=wr();return!(t.name!==Ir.CHROME||!t.osVersion)&&Number(t.version)>=e}function jr(e,t,r){const i=wr();return!(i.name!==e||!i.osVersion)&&(r?Number(i.version)>=t&&Number(i.version)<=r:Number(i.version)===t)}function Gr(e){const t=wr();return!(t.name!==Ir.EDGE||!t.osVersion)&&Number(t.version)>=e}function Wr(e){const t=wr();return!(t.name!==Ir.FIREFOX||!t.osVersion)&&Number(t.version)>=e}function Hr(e){const t=wr();return!(t.name!==Ir.OPERA||!t.osVersion)&&Number(t.version)>=e}function Kr(){const e=wr();if(e.os!==br.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])}function Yr(){const e=wr();if(e.os!==br.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 16===Number(t[0])}function zr(){const e=wr();if(e.os!==br.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=1}function Xr(){return Ur()&&navigator.maxTouchPoints>0}function Zr(){return window.navigator.appVersion&&null!==window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)&&window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)[1]<=35}function Jr(){const e=Pr();return function(){const{deviceType:e}=wr();return"mobile"===e||"tablet"===e}()||e===br.ANDROID||e===br.IOS||e===br.HARMONY_OS}function Qr(){const e=wr();return e.name!==Ir.EDGE&&e.name!==Ir.SAFARI&&!!navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]./i)}function qr(){return Pr()===br.ANDROID}function $r(){const e=wr();return qr()&&(e.name===Ir.CHROME||e.name===Ir.WECHAT||/chrome|chromium/i.test(navigator.userAgent))}function ei(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ti(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function ri(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ti(Object(r),!0).forEach((function(t){ei(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ti(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let ii=function(e){return e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.UNEXPECTED_RESPONSE="UNEXPECTED_RESPONSE",e.PB_ERROR="PB_ERROR",e.TIMEOUT="TIMEOUT",e.INVALID_PARAMS="INVALID_PARAMS",e.NOT_READABLE="NOT_READABLE",e.NOT_SUPPORTED="NOT_SUPPORTED",e.INVALID_OPERATION="INVALID_OPERATION",e.OPERATION_ABORTED="OPERATION_ABORTED",e.WEB_SECURITY_RESTRICT="WEB_SECURITY_RESTRICT",e.EXCHANGE_SDP_FAILED="EXCHANGE_SDP_FAILED",e.ADD_CANDIDATE_FAILED="ADD_CANDIDATE_FAILED",e.DATACHANNEL_FAILED="DATACHANNEL_FAILED",e.NETWORK_ERROR="NETWORK_ERROR",e.NETWORK_TIMEOUT="NETWORK_TIMEOUT",e.NETWORK_RESPONSE_ERROR="NETWORK_RESPONSE_ERROR",e.API_INVOKE_TIMEOUT="API_INVOKE_TIMEOUT",e.ENUMERATE_DEVICES_FAILED="ENUMERATE_DEVICES_FAILED",e.DEVICE_NOT_FOUND="DEVICE_NOT_FOUND",e.ELECTRON_IS_NULL="ELECTRON_IS_NULL",e.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR="ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR",e.CHROME_PLUGIN_NO_RESPONSE="CHROME_PLUGIN_NO_RESPONSE",e.CHROME_PLUGIN_NOT_INSTALL="CHROME_PLUGIN_NOT_INSTALL",e.MEDIA_OPTION_INVALID="MEDIA_OPTION_INVALID",e.PERMISSION_DENIED="PERMISSION_DENIED",e.CONSTRAINT_NOT_SATISFIED="CONSTRAINT_NOT_SATISFIED",e.TRACK_IS_DISABLED="TRACK_IS_DISABLED",e.GET_VIDEO_ELEMENT_VISIBLE_ERROR="GET_VIDEO_ELEMENT_VISIBLE_ERROR",e.SHARE_AUDIO_NOT_ALLOWED="SHARE_AUDIO_NOT_ALLOWED",e.LOW_STREAM_ENCODING_ERROR="LOW_STREAM_ENCODING_ERROR",e.SET_ENCODING_PARAMETER_ERROR="SET_ENCODING_PARAMETER_ERROR",e.TRACK_STATE_UNREACHABLE="TRACK_STATE_UNREACHABLE",e.INVALID_UINT_UID_FROM_STRING_UID="INVALID_UINT_UID_FROM_STRING_UID",e.CAN_NOT_GET_PROXY_SERVER="CAN_NOT_GET_PROXY_SERVER",e.CAN_NOT_GET_GATEWAY_SERVER="CAN_NOT_GET_GATEWAY_SERVER",e.VOID_GATEWAY_ADDRESS="VOID_GATEWAY_ADDRESS",e.UID_CONFLICT="UID_CONFLICT",e.MULTI_UNILBS_RESPONSE_ERROR="MULTI_UNILBS_RESPONSE_ERROR",e.UPDATE_TICKET_FAILED="UPDATE_TICKET_FAILED",e.TOKEN_EXPIRE="TOKEN_EXPIRE",e.INVALID_LOCAL_TRACK="INVALID_LOCAL_TRACK",e.INVALID_TRACK="INVALID_TRACK",e.SENDER_NOT_FOUND="SENDER_NOT_FOUND",e.CREATE_OFFER_FAILED="CREATE_OFFER_FAILED",e.SET_ANSWER_FAILED="SET_ANSWER_FAILED",e.ICE_FAILED="ICE_FAILED",e.PC_CLOSED="PC_CLOSED",e.SENDER_REPLACE_FAILED="SENDER_REPLACE_FAILED",e.GET_LOCAL_CAPABILITIES_FAILED="GET_LOCAL_CAPABILITIES_FAILED",e.GET_LOCAL_CONNECTION_PARAMS_FAILED="GET_LOCAL_CONNECTION_PARAMS_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.GATEWAY_P2P_LOST="GATEWAY_P2P_LOST",e.NO_ICE_CANDIDATE="NO_ICE_CANDIDATE",e.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS="CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS",e.EXIST_DISABLED_VIDEO_TRACK="EXIST_DISABLED_VIDEO_TRACK",e.INVALID_REMOTE_USER="INVALID_REMOTE_USER",e.REMOTE_USER_IS_NOT_PUBLISHED="REMOTE_USER_IS_NOT_PUBLISHED",e.CUSTOM_REPORT_SEND_FAILED="CUSTOM_REPORT_SEND_FAILED",e.CUSTOM_REPORT_FREQUENCY_TOO_HIGH="CUSTOM_REPORT_FREQUENCY_TOO_HIGH",e.FETCH_AUDIO_FILE_FAILED="FETCH_AUDIO_FILE_FAILED",e.READ_LOCAL_AUDIO_FILE_ERROR="READ_LOCAL_AUDIO_FILE_ERROR",e.DECODE_AUDIO_FILE_FAILED="DECODE_AUDIO_FILE_FAILED",e.WS_ABORT="WS_ABORT",e.WS_DISCONNECT="WS_DISCONNECT",e.WS_ERR="WS_ERR",e.EXTERNAL_SIGNAL_ABORT="EXTERNAL_SIGNAL_ABORT",e.LIVE_STREAMING_TASK_CONFLICT="LIVE_STREAMING_TASK_CONFLICT",e.LIVE_STREAMING_INVALID_ARGUMENT="LIVE_STREAMING_INVALID_ARGUMENT",e.LIVE_STREAMING_INTERNAL_SERVER_ERROR="LIVE_STREAMING_INTERNAL_SERVER_ERROR",e.LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED="LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED",e.LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED="LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED",e.LIVE_STREAMING_CDN_ERROR="LIVE_STREAMING_CDN_ERROR",e.LIVE_STREAMING_INVALID_RAW_STREAM="LIVE_STREAMING_INVALID_RAW_STREAM",e.LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT="LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT",e.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE="LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE",e.LIVE_STREAMING_WARN_FREQUENT_REQUEST="LIVE_STREAMING_WARN_FREQUENT_REQUEST",e.WEBGL_INTERNAL_ERROR="WEBGL_INTERNAL_ERROR",e.BEAUTY_PROCESSOR_INTERNAL_ERROR="BEAUTY_PROCESSOR_INTERNAL_ERROR",e.CROSS_CHANNEL_WAIT_STATUS_ERROR="CROSS_CHANNEL_WAIT_STATUS_ERROR",e.CROSS_CHANNEL_FAILED_JOIN_SRC="CROSS_CHANNEL_FAILED_JOIN_SEC",e.CROSS_CHANNEL_FAILED_JOIN_DEST="CROSS_CHANNEL_FAILED_JOIN_DEST",e.CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST="CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST",e.CROSS_CHANNEL_SERVER_ERROR_RESPONSE="CROSS_CHANNEL_SERVER_ERROR_RESPONSE",e.METADATA_OUT_OF_RANGE="METADATA_OUT_OF_RANGE",e.LOCAL_AEC_ERROR="LOCAL_AEC_ERROR",e.INVALID_PLUGIN="INVALID_PLUGIN",e.DISCONNECT_P2P="DISCONNECT_P2P",e.CONVERTING_IMAGEDATA_TO_BLOB_FAILED="CONVERTING_IMAGEDATA_TO_BLOB_FAILED",e.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED="CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED",e.INIT_DATACHANNEL_TIMEOUT="INIT_DATACHANNEL_TIMEOUT",e.CREATE_DATACHANNEL_ERROR="CREATE_DATACHANNEL_ERROR",e.DATACHANNEL_CONNECTION_TIMEOUT="DATACHANNEL_CONNECTION_TIMEOUT",e.PROHIBITED_OPERATION="PROHIBITED_OPERATION",e.IMAGE_MODERATION_UPLOAD_FAILED="IMAGE_MODERATION_UPLOAD_FAILED",e.P2P_MESSAGE_FAILED="P2P_MESSAGE_FAILED",e}({});class ni extends Error{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;super(t),ei(this,"code",void 0),ei(this,"message",void 0),ei(this,"data",void 0),ei(this,"name","AgoraRTCException"),this.code=e,this.message="AgoraRTCError ".concat(this.code,": ").concat(t),this.data=r}toString(){return this.data?"".concat(this.message,"\ndata: ").concat(JSON.stringify(this.data)):this.message}print(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"error",t=arguments.length>1?arguments[1]:void 0;return"error"===e&&(t||console).error(this.toString()),"warning"===e&&(t||console).warn(this.toString()),this}throw(e){throw this.print("error",e),this}}function oi(e,t){if("boolean"!=typeof e)throw new ni(ii.INVALID_PARAMS,"Invalid ".concat(t,": The value is of the boolean type."))}function si(e,t,r){if(!r.includes(e))throw new ni(ii.INVALID_PARAMS,"".concat(t," can only be set as ").concat(JSON.stringify(r)))}function ai(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e4;if(e<r||e>i||(!(arguments.length>4&&void 0!==arguments[4])||arguments[4])&&!function(e){return"number"==typeof e&&e%1==0}(e))throw new ni(ii.INVALID_PARAMS,"invalid ".concat(t,": the value range is [").concat(r,", ").concat(i,"]. integer only"))}function ci(e,t){if("number"!=typeof e){if(!(e.min||e.max||e.ideal||e.exact))throw new ni(ii.INVALID_PARAMS,"".concat(t," is not a valid ConstrainLong"));void 0!==e.min&&ai(e.min,"".concat(t,".min"),0,1/0),void 0!==e.max&&ai(e.max,"".concat(t,".max"),1,1/0),void 0!==e.exact&&ai(e.exact,"".concat(t,".exact"),1,1/0),void 0!==e.ideal&&ai(e.ideal,"".concat(t,".ideal"),1,1/0)}else ai(e,t,1,1/0)}function di(e){return null==e}var ui=function(e){return e.COVERED="COVERED",e.POSITION="POSITION",e.SIZE="SIZE",e.STYLE="STYLE",e}(ui||{}),li=function(e){return e.UNMOUNTED="UNMOUNTED",e.INVALID_HTML_ELEMENT="INVALID_HTML_ELEMENT",e}(li||{});const hi=new class{constructor(){ei(this,"_clientSize",null),ei(this,"getClientWidth",(()=>document.documentElement?document.documentElement.clientWidth:document.body.clientWidth)),ei(this,"getClientHeight",(()=>document.documentElement?document.documentElement.clientHeight:document.body.clientHeight)),ei(this,"getStyle",(e=>window.getComputedStyle(e,null))),ei(this,"checkCssVisibleProperty",(e=>{let t=!0;const r=this.getStyle(e),{display:i,visibility:n,opacity:o,filter:s}=r;return("none"===i||["hidden","collapse"].includes(n)||Number(o)<.1)&&(t=!1),!!t&&(s&&s.split(" ").filter((e=>{const t=e.split("(")[0];return["brightness","blur","opacity"].includes(t)})).map((e=>{const[t,r]=e.split(/\(|\)/);return[t,Number(r.match(/^[0-9\.]+/))]})).forEach((e=>{const[r,i]=e;switch(r){case"brightness":(i<.1||i>3)&&(t=!1);break;case"blur":i>3&&(t=!1);break;case"opacity":i<.1&&(t=!1)}})),t)})),ei(this,"checkPropertyUpToAllParentNodes",((e,t)=>{let r=!0,i=!0;const n=e=>t(e);let o=e;for(;o&&i;)n(o)||(r=!1,i=!1),o=o.parentElement,o||(i=!1);return r})),ei(this,"checkActualCssVisibleIncludeInherit",(e=>this.checkPropertyUpToAllParentNodes(e,this.checkCssVisibleProperty))),ei(this,"getSizeAboutClient",(e=>{const{width:t,height:r,left:i,right:n,top:o,bottom:s}=e.getBoundingClientRect(),a=this.getClientWidth(),c=this.getClientHeight();return{width:t,height:r,left:i,right:n,top:o,bottom:s,clientWidth:a,clientHeight:c,clientMin:Math.min(a,c)}})),ei(this,"checkActualSize",(()=>{const{width:e,height:t,clientMin:r}=this._clientSize;return this.checkSizeIsVisible(e,t,r)})),ei(this,"elementFromPoint",((e,t)=>document.elementFromPoint?document.elementFromPoint(e,t):null)),ei(this,"checkCoverForAPoint",((e,t,r)=>{const i=this.elementFromPoint(e,t);return null!==i&&i!==r})),ei(this,"getPointPositionList",(()=>{const{width:e,height:t,left:r,top:i}=this._clientSize,n=e/6,o=t/6,s=[],a=10**6;for(let e=0;e<5;e++)for(let t=0;t<5;t++){const c=(r*a+(0===e?.1:4===e?(n*e*a-1e5)/a:n*e)*a)/a,d=(i*a+(0===t?.1:4===t?(o*t*a-1e5)/a:o*t)*a)/a;s.push({x:c,y:d})}return[...s]})),ei(this,"checkElementCover",(e=>this.getPointPositionList().map((t=>this.checkCoverForAPoint(t.x,t.y,e))).filter((e=>!!e)).length>6)),ei(this,"checkSizeIsVisible",((e,t,r)=>(e>50||r/e<=10)&&(t>50||r/t<=10))),ei(this,"checkSizeOfPartInClient",(()=>{const{left:e,right:t,top:r,bottom:i,clientHeight:n,clientWidth:o,clientMin:s}=this._clientSize;let a,c,d,u;if(e<0)a=0;else{if(!(e<o))return!1;a=e}if(t<0)return!1;if(c=t<o?t:o,r<0)d=0;else{if(!(r<n))return!1;d=r}if(i<0)return!1;u=i<n?i:n;const l=c-a,h=u-d;return this.checkSizeIsVisible(l,h,s)})),ei(this,"returnHiddenResult",(e=>(this._clientSize=null,{visible:!1,reason:e}))),ei(this,"checkOneElementVisible",(e=>{if(e instanceof HTMLElement){if(this.checkElementIsMountedOnDom(e)){if(this.checkActualCssVisibleIncludeInherit(e)){if(this._clientSize=this.getSizeAboutClient(e),this.checkElementCover(e))return this.returnHiddenResult(ui.COVERED);{const e=this.checkActualSize(),t=this.checkSizeOfPartInClient();return e&&!t?this.returnHiddenResult(ui.POSITION):e?(this._clientSize=null,{visible:!0}):this.returnHiddenResult(ui.SIZE)}}return this.returnHiddenResult(ui.STYLE)}return this.returnHiddenResult(li.UNMOUNTED)}return this.returnHiddenResult(li.INVALID_HTML_ELEMENT)})),ei(this,"checkElementIsMountedOnDom",(e=>this.checkPropertyUpToAllParentNodes(e,(e=>"HTML"!==e.nodeName.toUpperCase()?null!==e.parentElement:!!document.documentElement))))}};const pi=function(e,t){const r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r};class fi{constructor(){ei(this,"_events",{}),ei(this,"addListener",this.on)}getListeners(e){return this._events[e]?this._events[e].map((e=>e.listener)):[]}on(e,t){this._events[e]||(this._events[e]=[]);const r=this._events[e];-1===this._indexOfListener(r,t)&&r.push({listener:t,once:!1})}once(e,t){this._events[e]||(this._events[e]=[]);const r=this._events[e];-1===this._indexOfListener(r,t)&&r.push({listener:t,once:!0})}off(e,t){if(!this._events[e])return;const r=this._events[e],i=this._indexOfListener(r,t);-1!==i&&r.splice(i,1),0===this._events[e].length&&delete this._events[e]}removeAllListeners(e){e?delete this._events[e]:this._events={}}emit(e){this._events[e]||(this._events[e]=[]);const t=this._events[e].map((e=>e));for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];for(let r=0;r<t.length;r+=1){const n=t[r];n.once&&this.off(e,n.listener),n.listener.apply(this,i||[])}}safeEmit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];[...this._events[e]||[]].forEach((t=>{t.once&&this.off(e,t.listener);try{t.listener.apply(this,r)}catch(t){console.error("safeEmit event:".concat(e," error ").concat(null==t?void 0:t.toString()))}}))}_indexOfListener(e,t){let r=e.length;for(;r--;)if(e[r].listener===t)return r;return-1}}function Ei(){return!!_i()}let mi=null;function _i(){if(mi)return mi;if(window.electron)return mi=window.electron;if(!window.require)return null;try{return mi=window.require("electron"),mi}catch(e){return null}}let Ti=function(e){return e.CREATE_CLIENT="createClient",e.CHECK_SYSTEM_REQUIREMENTS="checkSystemRequirements",e.SET_AREA="setArea",e.PRELOAD="PRELOAD",e.CHECK_VIDEO_TRACK_IS_ACTIVE="checkVideoTrackIsActive",e.CHECK_AUDIO_TRACK_IS_ACTIVE="checkAudioTrackIsActive",e.CREATE_MIC_AUDIO_TRACK="createMicrophoneAudioTrack",e.CREATE_CUSTOM_AUDIO_TRACK="createCustomAudioTrack",e.CREATE_BUFFER_AUDIO_TRACK="createBufferSourceAudioTrack",e.CREATE_CAM_VIDEO_TRACK="createCameraVideoTrack",e.CREATE_CUSTOM_VIDEO_TRACK="createCustomVideoTrack",e.CREATE_MIC_AND_CAM_TRACKS="createMicrophoneAndCameraTracks",e.CREATE_SCREEN_VIDEO_TRACK="createScreenVideoTrack",e.SET_ENCRYPTION_CONFIG="Client.setEncryptionConfig",e.START_PROXY_SERVER="Client.startProxyServer",e.STOP_PROXY_SERVER="Client.stopProxyServer",e.SET_PROXY_SERVER="Client.setProxyServer",e.SET_TURN_SERVER="Client.setTurnServer",e.SET_CLIENT_ROLE="Client.setClientRole",e.SET_LOW_STREAM_PARAMETER="Client.setLowStreamParameter",e.ENABLE_DUAL_STREAM="Client.enableDualStream",e.DISABLE_DUAL_STREAM="Client.disableDualStream",e.JOIN="Client.join",e.LEAVE="Client.leave",e.PUBLISH="Client.publish",e.UNPUBLISH="Client.unpublish",e.SUBSCRIBE="Client.subscribe",e.MASS_SUBSCRIBE="Client.massSubscribe",e.MASS_UNSUBSCRIBE="Client.massUnsubscribe",e.UNSUBSCRIBE="Client.unsubscribe",e.RENEW_TOKEN="Client.renewToken",e.SET_REMOTE_VIDEO_STREAM_TYPE="Client.setRemoteVideoStreamType",e.SET_STREAM_FALLBACK_OPTION="Client.setStreamFallbackOption",e.ENABLE_AUDIO_VOLUME_INDICATOR="Client.enableAudioVolumeIndicator",e.SEND_CUSTOM_REPORT_MESSAGE="Client.sendCustomReportMessage",e.INSPECT_VIDEO_CONTENT="Client.inspectVideoContent",e.STOP_INSPECT_VIDEO_CONTENT="Client.stopInspectVideoContent",e.JOIN_FALLBACK_TO_PROXY="Client._joinFallbackToProxy",e.ON_LIVE_STREAM_WARNING="Client.onLiveStreamWarning",e.ON_LIVE_STREAM_ERROR="Client.onLiveStreamingError",e.START_LIVE_STREAMING="Client.startLiveStreaming",e.SET_LIVE_TRANSCODING="Client.setLiveTranscoding",e.STOP_LIVE_STREAMING="Client.stopLiveStreaming",e.START_CHANNEL_MEDIA_RELAY="Client.startChannelMediaRelay",e.UPDATE_CHANNEL_MEDIA_RELAY="Client.updateChannelMediaRelay",e.STOP_CHANNEL_MEDIA_RELAY="Client.stopChannelMediaRelay",e.REQUEST_CONFIG_DISTRIBUTE="_config-distribute-request",e.SET_CONFIG_DISTRIBUTE="_configDistribute",e.LOCAL_TRACK_SET_MUTED="LocalTrack.setMute",e.LOCAL_AUDIO_TRACK_PLAY="LocalAudioTrack.play",e.LOCAL_AUDIO_TRACK_PLAY_IN_ELEMENT="LocalAudioTrack.playInElement",e.LOCAL_AUDIO_TRACK_STOP="LocalAudioTrack.stop",e.LOCAL_AUDIO_TRACK_SET_VOLUME="LocalAudioTrack.setVolume",e.MIC_AUDIO_TRACK_SET_DEVICE="MicrophoneAudioTrack.setDevice",e.BUFFER_AUDIO_TRACK_START="BufferSourceAudioTrack.startProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_STOP="BufferSourceAudioTrack.stopProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_PAUSE="BufferSourceAudioTrack.pauseProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_RESUME="BufferSourceAudioTrack.resumeProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_SEEK="BufferSourceAudioTrack.seekAudioBuffer",e.LOCAL_VIDEO_TRACK_PLAY="LocalVideoTrack.play",e.LOCAL_VIDEO_TRACK_STOP="LocalVideoTrack.stop",e.LOCAL_VIDEO_TRACK_GET_VIDEO_VISIBLE="LocalVideoTrack.getVideoElementVisibleStatus",e.LOCAL_VIDEO_TRACK_BEAUTY="LocalVideoTrack.setBeautyEffect",e.LOCAL_VIDEO_SEND_SEI_DATA="LocalVideoTrack.sendSeiData",e.CAM_VIDEO_TRACK_SET_DEVICE="CameraVideoTrack.setDevice",e.CAM_VIDEO_TRACK_SET_ENCODER_CONFIG="CameraVideoTrack.setEncoderConfiguration",e.REMOTE_VIDEO_TRACK_PLAY="RemoteVideoTrack.play",e.REMOTE_VIDEO_TRACK_STOP="RemoteVideoTrack.stop",e.REMOTE_VIDEO_TRACK_GET_VIDEO_VISIBLE="RemoteVideoTrack.getVideoElementVisibleStatus",e.REMOTE_AUDIO_TRACK_PLAY="RemoteAudioTrack.play",e.REMOTE_AUDIO_TRACK_STOP="RemoteAudioTrack.stop",e.REMOTE_AUDIO_SET_VOLUME="RemoteAudioTrack.setVolume",e.REMOTE_AUDIO_SET_OUTPUT_DEVICE="RemoteAudioTrack.setOutputDevice",e.GET_MEDIA_STREAM_TRACK="Track.getMediaStreamTrack",e.STREAM_TYPE_CHANGE="streamTypeChange",e.CONNECTION_STATE_CHANGE="connectionStateChange",e.LOAD_CONFIG_FROM_LOCALSTORAGE="loadConfigFromLocalStorage",e.IMAGE_MODERATION_UPLOAD="imageModerationUpload",e.REPUB_AFTER_PC_CONNECTED="repubAfterPCConnected",e.PRELOAD_MEDIA_FAILED="preloadMediaFailed",e.MISMATCH_DTLS_PARAMETERS="mismatchDtlsParameters",e.MISMATCH_ICE_PARAMETERS="mismatchIceParameters",e.VOS_FALLBACK_CN="vosFallbackCN",e.DATACHANNEL_FAILBACK="datachannelFailback",e}({}),gi=function(e){return e.TRACER="tracer",e}({});!function(e){e[e.AUDIENCE_LEVEL_LOW_LATENCY=1]="AUDIENCE_LEVEL_LOW_LATENCY",e[e.AUDIENCE_LEVEL_ULTRA_LOW_LATENCY=2]="AUDIENCE_LEVEL_ULTRA_LOW_LATENCY",e[e.AUDIENCE_LEVEL_SYNC_LATENCY=3]="AUDIENCE_LEVEL_SYNC_LATENCY"}({}),function(e){e.LEAVE="LEAVE",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.UID_BANNED="UID_BANNED",e.FALLBACK="FALLBACK",e.IP_BANNED="IP_BANNED",e.CHANNEL_BANNED="CHANNEL_BANNED",e.LICENSE_MISSING="LICENSE_MISSING",e.LICENSE_EXPIRED="LICENSE_EXPIRED",e.LICENSE_MINUTES_EXCEEDED="LICENSE_MINUTES_EXCEEDED",e.LICENSE_PERIOD_INVALID="LICENSE_PERIOD_INVALID",e.LICENSE_MULTIPLE_SDK_SERVICE="LICENSE_MULTIPLE_SDK_SERVICE",e.LICENSE_ILLEGAL="LICENSE_ILLEGAL",e.TOKEN_EXPIRE="TOKEN_EXPIRE",e.FALLBACK_TO_HLS="FALLBACK_TO_HLS",e.UID_CONFLICT="UID_CONFLICT"}({}),function(e){e[e.AUTO_SIMULCAST_STREAM=-1]="AUTO_SIMULCAST_STREAM",e[e.DISABLE_SIMULCAST_STREM=0]="DISABLE_SIMULCAST_STREM",e[e.ENABLE_SIMULCAST_STREAM=1]="ENABLE_SIMULCAST_STREAM"}({}),function(e){e.PEERCONNECTION_STATE_CHANGE="peerconnection-state-change",e.AUDIO_METADATA="audio-metadata",e.AUDIO_PTS="audio-pts",e.CONNECTION_STATE_CHANGE="connection-state-change",e.MEDIA_RECONNECT_START="media-reconnect-start",e.MEDIA_RECONNECT_END="media-reconnect-end",e.IS_USING_CLOUD_PROXY="is-using-cloud-proxy",e.USER_JOINED="user-joined",e.USER_LEAVED="user-left",e.USER_PUBLISHED="user-published",e.USER_UNPUBLISHED="user-unpublished",e.USER_INFO_UPDATED="user-info-updated",e.CLIENT_BANNED="client-banned",e.CHANNEL_MEDIA_RELAY_STATE="channel-media-relay-state",e.CHANNEL_MEDIA_RELAY_EVENT="channel-media-relay-event",e.VOLUME_INDICATOR="volume-indicator",e.CRYPT_ERROR="crypt-error",e.ON_TOKEN_PRIVILEGE_WILL_EXPIRE="token-privilege-will-expire",e.ON_TOKEN_PRIVILEGE_DID_EXPIRE="token-privilege-did-expire",e.NETWORK_QUALITY="network-quality",e.STREAM_TYPE_CHANGED="stream-type-changed",e.STREAM_FALLBACK="stream-fallback",e.RECEIVE_METADATA="receive-metadata",e.STREAM_MESSAGE="stream-message",e.LIVE_STREAMING_ERROR="live-streaming-error",e.LIVE_STREAMING_WARNING="live-streaming-warning",e.EXCEPTION="exception",e.ERROR="error",e.P2P_LOST="p2p_lost",e.JOIN_FALLBACK_TO_PROXY="join-fallback-to-proxy",e.CHANNEL_FALLBACK_TO_WEBSOCKET="channel-fallback-to-websocket",e.MEDIA_CONNECTION_TYPE_CHANGE="media-connection-type-change",e.PUBLISHED_USER_LIST="published-user-list",e.USER_LIST="user-list",e.CONTENT_INSPECT_CONNECTION_STATE_CHANGE="content-inspect-connection-state-change",e.CONTENT_INSPECT_ERROR="content-inspect-error",e.CONTENT_INSPECT_RESULT="content-inspect-result",e.IMAGE_MODERATION_CONNECTION_STATE_CHANGE="image-moderation-connection-state-change",e.FALLBACK_TO_HLS="fallback-to-hls",e.FIRST_VIDEO_BUFFER_READY="first-video-buffer-ready",e.FIRST_VIDEO_PRE_RENDER="first-video-pre-render",e.AV1_DECODABLE_RESULT="av1-decodable-result"}({}),function(e){e.CONFIG="config",e.VOSERROR="vos_error",e.AP_ERROR="ap_error"}({}),function(e){e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.MULTI_IP="MULTI_IP",e.TIMEOUT="TIMEOUT",e.OFFLINE="OFFLINE",e.LEAVE="LEAVE",e.P2P_FAILED="P2P_FAILED",e.FALLBACK="FALLBACK",e.REGIONAL_DISTRIBUTION="REGIONAL_DISTRIBUTION"}({});let Si=function(e){return e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e}({}),Ri=function(e){return e.NETWORK_STATE_CHANGE="NETWORK_STATE_CHANGE",e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e}({});function yi(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n<r;n++)i[n-2]=arguments[n];return 0===e.getListeners(t).length?Promise.reject(new ni(ii.UNEXPECTED_ERROR,"can not emit promise")):new Promise(((r,n)=>{e.emit(t,...i,r,n)}))}function vi(e,t){if(0===e.getListeners(t).length)return Promise.resolve();for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n<r;n++)i[n-2]=arguments[n];return yi(e,t,...i)}function Ai(e,t){if(0===e.getListeners(t).length)return null;for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n<r;n++)i[n-2]=arguments[n];return function(e,t){let r=null,i=null;for(var n=arguments.length,o=new Array(n>2?n-2:0),s=2;s<n;s++)o[s-2]=arguments[s];if(e.emit(t,...o,(e=>{r=e}),(e=>{i=e})),null!==i)throw i;if(null===r)throw new ni(ii.UNEXPECTED_ERROR,"handler is not sync");return r}(e,t,...i)}const bi=new class extends fi{set networkState(e){this.emit(Ri.NETWORK_STATE_CHANGE,e,this._networkState),e===Si.ONLINE?this.emit(Ri.ONLINE):e===Si.OFFLINE&&(this.onlineWaiter=new Promise((e=>{this.once(Ri.ONLINE,(()=>{this.onlineWaiter=void 0,e(Si.ONLINE)}))})),this.emit(Ri.OFFLINE)),this._networkState=e}get networkState(){return this._networkState}get isOnline(){return this._networkState===Si.ONLINE}constructor(){super(),ei(this,"_moduleName","network-indicator"),ei(this,"_networkState",Si.ONLINE),ei(this,"onlineWaiter",void 0),window.addEventListener("online",(()=>{this.networkState=Si.ONLINE})),window.addEventListener("offline",(()=>{this.networkState=Si.OFFLINE}))}},Ii=[];for(let e=0;e<256;++e)Ii.push((e+256).toString(16).slice(1));const Oi="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);let Ci;const Ni=new Uint8Array(16);function wi(){return Oi?Oi():function(e,t,r){var i,n,o,s;const a=null!==(i=null!==(n=(e=e||{}).random)&&void 0!==n?n:null===(o=(s=e).rng)||void 0===o?void 0:o.call(s))&&void 0!==i?i:function(){if(!Ci){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ci=crypto.getRandomValues.bind(crypto)}return Ci(Ni)}();if(a.length<16)throw new Error("Random bytes length must be >= 16");if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){if((r=r||0)<0||r+16>t.length)throw new RangeError("UUID byte range ".concat(r,":").concat(r+15," is out of buffer bounds"));for(let e=0;e<16;++e)t[r+e]=a[e];return t}return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(Ii[e[t+0]]+Ii[e[t+1]]+Ii[e[t+2]]+Ii[e[t+3]]+"-"+Ii[e[t+4]]+Ii[e[t+5]]+"-"+Ii[e[t+6]]+Ii[e[t+7]]+"-"+Ii[e[t+8]]+Ii[e[t+9]]+"-"+Ii[e[t+10]]+Ii[e[t+11]]+Ii[e[t+12]]+Ii[e[t+13]]+Ii[e[t+14]]+Ii[e[t+15]]).toLowerCase()}(a)}(e,t,undefined);var e,t}function Di(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}function Pi(e){"undefined"!=typeof Promise?Promise.resolve().then(e):setTimeout(e,0)}function Li(e){return JSON.parse(JSON.stringify(e))}function ki(e){try{return Li(e)}catch(t){return e}}const Mi={};function Ui(e,t){Mi[t]||(Mi[t]=!0,e())}function xi(e){return window.TextEncoder?(new TextEncoder).encode(e).length:e.length}function Vi(e){return new Promise((t=>{window.setTimeout(t,e)}))}function Fi(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7,t=arguments.length>1?arguments[1]:void 0;const r=Math.random().toString(16).substr(2,e).toLowerCase();return r.length===e?"".concat(t).concat(r):"".concat(t).concat(r)+Fi(e-r.length,"")}const Bi=()=>{},ji=new class{constructor(){ei(this,"fnMap",new Map)}throttleByKey(e,t,r,i){for(var n=arguments.length,o=new Array(n>4?n-4:0),s=4;s<n;s++)o[s-4]=arguments[s];if(this.fnMap.has(t)){const n=this.fnMap.get(t);if(n.threshold!==r){n.fn(...n.args),clearTimeout(n.timer);const s=window.setTimeout((()=>{const e=this.fnMap.get(t);e&&e.fn(...e.args),this.fnMap.delete(t)}),r);this.fnMap.set(t,{fn:e,threshold:r,timer:s,args:o,skipFn:i})}else n.skipFn&&n.skipFn(...n.args),this.fnMap.set(t,ri(ri({},n),{},{fn:e,args:o,skipFn:i}))}else{const n=window.setTimeout((()=>{const e=this.fnMap.get(t);e&&e.fn(...e.args),this.fnMap.delete(t)}),r);this.fnMap.set(t,{fn:e,threshold:r,timer:n,args:o,skipFn:i})}}},Gi=ji.throttleByKey.bind(ji);function Wi(e){return"object"==typeof e&&null!==e&&!(e instanceof RegExp)}function Hi(e,t){if(!Wi(e)||!Wi(t))return t;if(Array.isArray(e)&&!Array.isArray(t)||!Array.isArray(e)&&Array.isArray(t))return t;if(Array.isArray(t)&&Array.isArray(e)){const r=[...e];for(let i=0;i<t.length;i++)r[i]=Hi(e[i],t[i]);return r}{const r=ri({},e);for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(Object.prototype.hasOwnProperty.call(e,i)?r[i]=Hi(e[i],t[i]):r[i]=t[i]);return r}}function Ki(e){return"number"==typeof e?e:e.exact||e.ideal||e.max||e.min||0}function Yi(e){return e.reduce(((e,t)=>e+t),0)}let zi=1,Xi=console;class Zi{static setLogger(e){Xi=e}constructor(e,t){ei(this,"id",void 0),ei(this,"lockingPromise",Promise.resolve()),ei(this,"locks",0),ei(this,"name",""),ei(this,"lockId",void 0),this.lockId=zi++,e&&(this.name=e),t&&(this.id=t),this.logger("created")}logger(e,t){const r=(this.id?"[".concat(this.id,"]"):"")+"[lock-".concat(this.name,"-").concat(this.lockId,"]"),i="created"===e?"is ".concat(e,"."):"is ".concat(e,", current queue ").concat(this.locks,". ").concat(null!=t?t:"");Xi.debug("".concat(r," ").concat(i))}setId(e){this.id=e}get isLocked(){return this.locks>0}lock(e){let t;this.locks+=1,this.logger("locked",e);const r=new Promise((r=>{t=()=>{this.locks-=1,this.logger("unlocked",e),r()}})),i=this.lockingPromise.then((()=>t));return this.lockingPromise=this.lockingPromise.then((()=>r)),i}}function Ji(e,t){return function(r,i,n){const o=n.value;if("function"!=typeof o)throw new Error("Cannot use mutex on object property.");return n.value=async function(){const r=this[t];if(!r)throw new Error("mutex property key ".concat(t," doesn't exist on ").concat(e));const n=await r.lock("From ".concat(e,".").concat(i));try{for(var s=arguments.length,a=new Array(s),c=0;c<s;c++)a[c]=arguments[c];return await o.apply(this,a)}finally{n()}},n}}const Qi={timeout:500,timeoutFactor:1.5,maxRetryCount:1/0,maxRetryTimeout:1e4};function qi(e,t,r,i){const n=Object.assign({},Qi,i);let o=n.timeout;const s=async()=>{await function(e){return new Promise((t=>{window.setTimeout(t,e)}))}(o),o*=n.timeoutFactor,o=Math.min(n.maxRetryTimeout,o)};let a=!1;const c=new Promise((async(i,o)=>{t=t||(()=>!1),r=r||(()=>!0);for(let c=0;c<n.maxRetryCount;c+=1){if(a)return o(new ni(ii.OPERATION_ABORTED));try{const r=await e();if(!t(r,c))return i(r);if(c+1===n.maxRetryCount)return i(r);await s()}catch(e){if(!r(e,c))return o(e);if(c+1===n.maxRetryCount)return o(e);await s()}}}));return c.cancel=()=>a=!0,c}let $i=0,en=0;function tn(e,t,r,i){return new Promise(((n,o)=>{t.responseType=t.responseType||"json",t.data&&!r?(t.data=JSON.stringify(t.data),$i+=xi(t.data)):r&&(t.data.size?$i+=t.data.size:t.data instanceof FormData?$i+=function(e){let t=0;return(/DingTalk/i.test(navigator.userAgent)||/AliApp/i.test(navigator.userAgent))&&e.realFormData&&(e=e.realFormData),e.forEach((e=>{t+="string"==typeof e?xi(e):e.size})),t+138}(t.data):$i+=xi(JSON.stringify(t.data))),t.headers=t.headers||{},t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json",t.method="POST",t.url=e,Ar.request(t).then((e=>{"string"==typeof e.data?en+=xi(e.data):e.data instanceof ArrayBuffer||e.data instanceof Uint8Array?en+=e.data.byteLength:en+=xi(JSON.stringify(e.data)),i&&n({data:e.data,headers:e.headers}),n(e.data)})).catch((e=>{Ar.isCancel(e)?o(new ni(ii.OPERATION_ABORTED,"cancel token canceled")):"ECONNABORTED"===e.code?o(new ni(ii.NETWORK_TIMEOUT,e.message)):e.response?o(new ni(ii.NETWORK_RESPONSE_ERROR,e.response.status)):o(new ni(ii.NETWORK_ERROR,e.message))}))}))}async function rn(e,t){const r=new Blob([t.data],{type:"buffer"});return await tn(e,ri(ri({},t),{},{data:r,headers:{"Content-Type":"application/octet-stream"}}),!0)}!function(e){e.BANDWIDTH="bandwidth",e.CPU="cpu",e.NONE="none",e.OTHER="other"}({}),function(e){e.L1T1="L1T1",e.L1T2="L1T2",e.L1T3="L1T3",e.L1T3_KEY="L1T3_KEY",e.L2T1_KEY="L2T1_KEY",e.L2T2_KEY="L2T2_KEY",e.L2T3_KEY="L2T3_KEY",e.L3T1_KEY="L3T1_KEY",e.L3T2_KEY="L3T2_KEY",e.L3T3_KEY="L3T3_KEY"}({}),function(e){e[e.new=0]="new",e[e.connecting=1]="connecting",e[e.connected=2]="connected",e[e.disconnected=3]="disconnected",e[e.failed=4]="failed",e[e.closed=5]="closed"}({}),function(e){e.CERTIFICATE="certificate",e.CODEC="codec",e.CANDIDATE_PAIR="candidate-pair",e.LOCAL_CANDIDATE="local-candidate",e.REMOTE_CANDIDATE="remote-candidate",e.INBOUND="inbound-rtp",e.TRACK="track",e.OUTBOUND="outbound-rtp",e.PC="peer-connection",e.REMOTE_INBOUND="remote-inbound-rtp",e.REMOTE_OUTBOUND="remote-outbound-rtp",e.TRANSPORT="transport",e.CSRC="csrc",e.DATA_CHANNEL="data-channel",e.STREAM="stream",e.SENDER="sender",e.RECEIVER="receiver"}({});var nn=function(e){return e[e.kNone=1]="kNone",e[e.kMillisecondsFromSeconds=1e3]="kMillisecondsFromSeconds",e[e.kBytesToBits=8]="kBytesToBits",e}(nn||{});const on="websdk_ng_install_id";function sn(){try{if(hn("INSTALL_ID"))return hn("INSTALL_ID");let e=window.localStorage.getItem(on);return e||(e=function(){let e,t=!1;try{e=wi().replaceAll("-","")}catch(e){t=!0}return!t&&e&&32===e.length||(e=Fi(32,"")),e.toUpperCase()}(),window.localStorage.setItem(on,e)),ln("INSTALL_ID",e),e}catch(e){return}}const an=function(e){if(e.match(/[0-9]+\.[0-9]+\.[0-9]+$/))return e;const t=e.match(/([0-9]+\.[0-9]+\.[0-9]+)\-([0-9]+)/);if(t&&t[1]&&t[2]){const e=t[1],r=t[2];return"".concat(e,".").concat(r)}return"4.0.0.999"}("4.24.3"),cn=function(){try{return!0===JSON.parse("true")}catch(e){return!0}}();!function(e){e.Default="default",e.Auto="auto",e.Relay="relay",e.SdRtn="sd-rtn"}({});const dn=function(){const e="us".concat("erna","me"),t="pa".concat("sswo","rd"),r=["t","s","t"];r.splice(1,0,"e");const i=r.join(""),n=[];for(let e=0;e<6;e++)n.push("1");const o=n.join(""),s={};return s[e]=i,s[t]=o,Object.assign(s,{turnServerURL:"",tcpport:3433,udpport:3478,forceturn:!1})}();window.DEFAULT_TURN_CONFIG=dn;const un=ri(ri(ri(ri({},{ENABLE_EVENT_REPORT:!0,UPLOAD_LOG:!1,ENABLE_AG_ADAPTATION:!0,FORCE_AG_HIGH_FRAMERATE:!1,FORCE_SUPPORT_AG_ADAPTATION:!1,ENCODER_CONFIG_LIMIT:{},CAMERA_CAPTURE_CONFIG:void 0,ENABLE_PRELOAD:!0,NEW_ICE_RESTART:!0,ICE_RESTART_INTERVAL:1e4,RESTART_SEQUENCE:["udp_tcp_relay","relay"],FIRST_TCP_CANDIDATE:!1,MAX_CONFIG_RETRY:10,ENABLE_CONFIG_RESTORE:!1,CONFIG_RESTORE_ERROR_API:["createClient","Client.join"],CONFIG_ERROR_MONITOR:["INVALID_OPERATION","UNEXPECTED_ERROR"],BLOCKED_CONFIG_MAX_TIME:864e5,FIRST_TCP_CANDIDATE_INTERVAL:1e3,TURN_DOMAIN:"edge.agora.io",TURN_DOMAINS:["edge.agora.io"],USE_TURN_IP:!0,NEW_TURN_MODE:4,NEW_FORCE_TURN:!1,USE_NEW_RENDER_FREEZE_TIME:!0,FLS_FALLBACK_TIMEOUT:3e4,RTE_DETAIL_REPORT_INTERVAL:6e4,ENCODE_EXCEPTION_TIMES:5,ENABLE_ENCODE_EXCEPTION:!0,ENCODE_EXCEPTION_VALIDATE_CODEC:["h264"],VIDEO_ENCODER_CONFIG_LIST:[{width:240,height:180},{width:320,height:240},{width:400,height:300},{width:480,height:360},{width:560,height:420},{width:640,height:480}],DELETE_NEQ_AFTER_USER_LEAVE:!0,UPDATE_RTP_CAP_IN_HOST:!1,IOS_BG_TAG:!0,IOS_AUTO_RESTART_BG_TAG:!0,IGNORE_UID_CHECK:!1,ENABLE_UP_SPS_PPS:!1,ENABLE_DOWN_SPS_PPS:!0,NO_EDGES_RETRY:!0,BUFFER_READY_FRAMES:3,FLS_SYNC_AV_PLAY_LIMIT:0,FLS_BUFFER_WAIT_TIME:1500,VOS_CONFIGURE:void 0,ENABLE_QUALITY_FALLBACK:!1,QUALITY_FALLBACK_REHEARSAL:!0,ENABLE_FLS_AV1_FIRST:!1,ENABLE_AP_MULTI_IP:!0,FLS_ENABLE_AV1_DETECT:!0,FLS_ENABLE_AV1_DECODE_DETECT:!0,ENABLE_SDP_ENDPOINT_LOG:!1,REMOTE_VIDEO_FREEZE_TIME_VERSION:2}),{},{PROCESS_ID:"",ENCRYPT_AES:!0,AREAS:["CHINA","GLOBAL"],WEBCS_DOMAIN:["webrtc2-ap-web-1.agora.io","webrtc2-2.ap.sd-rtn.com"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-ap-web-3.agora.io","webrtc2-4.ap.sd-rtn.com"],SDP_ENDPOINT_DOMAIN:["webrtc2-ap-web-1.agora.io","webrtc2-2.ap.sd-rtn.com"],SDP_ENDPOINT_DOMAIN_BACKUP_LIST:["webrtc2-ap-web-3.agora.io","webrtc2-4.ap.sd-rtn.com"],PROXY_CS:["ap-proxy-1.agora.io","ap-proxy-2.agora.io"],CDS_AP:["cds-ap-web-1.agora.io","cds-web-2.ap.sd-rtn.com","cds-ap-web-3.agora.io","cds-web-4.ap.sd-rtn.com"],ACCOUNT_REGISTER:["sua-ap-web-1.agora.io","sua-web-2.ap.sd-rtn.com","sua-ap-web-3.agora.io","sua-web-4.ap.sd-rtn.com"],UAP_AP:["uap-ap-web-1.agora.io","uap-web-2.ap.sd-rtn.com","uap-ap-web-3.agora.io","uap-web-4.ap.sd-rtn.com"],LOG_UPLOAD_SERVER:"logservice.agora.io",EVENT_REPORT_DOMAIN:"statscollector-1.agora.io",EVENT_REPORT_BACKUP_DOMAIN:"web-2.statscollector.sd-rtn.com",GATEWAY_ADDRESS:[],GATEWAY_WSS_ADDRESS:"",LIVE_STREAMING_ADDRESS:"",HTTP_CONNECT_TIMEOUT:5e3,SIGNAL_REQUEST_TIMEOUT:1e4,REPORT_STATS:!0,NOT_REPORT_EVENT:[],PING_PONG_TIME_OUT:10,WEBSOCKET_TIMEOUT_MIN:1e4,EVENT_REPORT_SEND_INTERVAL:3e3,CONFIG_DISTRIBUTE_INTERVAL:3e5,ENABLE_CONFIG_DISTRIBUTE:!0,CANDIDATE_TIMEOUT:5e3,SHOW_REPORT_INVOKER_LOG:!1,SHOW_REPORT_USER_INVOKER_LOG:!0,JOIN_EXTEND:"",PUB_EXTEND:"",SUB_EXTEND:"",FORCE_TURN:!1,TURN_ENABLE_TCP:!0,TURN_ENABLE_UDP:!0,MAX_UPLOAD_CACHE:50,UPLOAD_CACHE_INTERVAL:2e3,AJAX_REQUEST_CONCURRENT:3,REPORT_APP_SCENARIO:void 0,GATEWAY_DOMAINS:["edge.agora.io","edge.sd-rtn.com"],CONNECT_GATEWAY_WITHOUT_DOMAIN:!1,WORKER_DOMAIN:"edge.agora.io",EVENT_REPORT_RETRY:!0,CHROME_FORCE_PLAN_B:!1,AUDIO_SOURCE_VOLUME_UPDATE_INTERVAL:400,AUDIO_SOURCE_AVG_VOLUME_DURATION:3e3,AUDIO_VOLUME_INDICATION_INTERVAL:2e3,VOLUME_VOICE_WEIGHT:10,GET_VOLUME_OF_MUTED_AUDIO_TRACK:!1,STATS_UPDATE_INTERVAL:250,NORMAL_EVENT_QUEUE_CAPACITY:100,CUSTOM_REPORT:!0,CUSTOM_REPORT_LIMIT:20,PROXY_SERVER_TYPE2:"webnginx-proxy.agora.io",PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.sd-rtn.com","webrtc-cloud-proxy.agora.io"],CUSTOM_PUB_ANSWER_MODIFIER:null,CUSTOM_SUB_ANSWER_MODIFIER:null,CUSTOM_PUB_OFFER_MODIFIER:null,CUSTOM_SUB_OFFER_MODIFIER:null,DSCP_TYPE:"high",REMOVE_NEW_CODECS:!0,FRAGEMENT_LENGTH:3,WEBSOCKET_COMPRESS:!1,SIMULCAST:!1,CHECK_VIDEO_VISIBLE_INTERVAL:3e4,CHECK_LOCAL_STATS_INTERVAL:250,PROFILE_SWITCH_INTERVAL:2e3,UNSUPPORTED_VIDEO_CODEC:[],ENUMERATE_DEVICES_INTERVAL:!1,ENUMERATE_DEVICES_INTERVAL_TIME:1e4,USE_NEW_TOKEN:!1,CLOSE_AFB_FOR_LOCAL_AP:!0,JOIN_MAX_CONCURRENCY:6,JOIN_WITH_FALLBACK_SIGNAL_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY_FORCE:!1,JOIN_GATEWAY_TRY_443PORT_DURATION:2e3,JOIN_GATEWAY_USE_443PORT_ONLY:!1,JOIN_GATEWAY_USE_DUAL_DOMAIN:!0,JOIN_GATEWAY_FALLBACK_PORT:443,USE_TURN_SERVER_OF_GATEWAY:!1,H264_PROFILE_LEVEL_ID:"",USE_NEW_LOG:!1,LOG_VERSION:3,MEDIA_DEVICE_CONSTRAINTS:null,ENCRYPT_PROXY_USERNAME_AND_PSW:!0,SDP_LOGGING:!1,CSP_DETECTED_HOSTNAME_LIST:["agora.io","sd-rtn.com"],REMOTE_AUDIO_TRACK_USES_WEB_AUDIO:!1,LOCAL_AUDIO_TRACK_USES_WEB_AUDIO:!1,BITRATE_ADAPTER_TYPE:"STANDARD_BITRATE",AI_DENOISER_PARAMETERS:{excludedLinks:[]},ADJUST_3A_FROM_PLUGINS:!0,RAISE_H264_BASELINE_PRIORITY:!0,FILTER_SEND_H264_BASELINE:!1,FIRST_H264_PROFILE_LEVEL_ID:"42001f",FIRST_PACKETIZATION_MODE:"",X_GOOGLE_START_BITRATE:void 0,NEW_REPORT_SERVER:!1,NEW_REPORT_SERVER_DOMAINS:["data-reporting.agora.io","data-reporting.agora.io"],VIDEO_INSPECT_WORKER_MESSAGE_LENGTH_LIMIT:3e5,VIDEO_INSPECT_INTERVAL_MINIMUM:1e3,VIDEO_INSPECT_QUALITY_RATIO:.9,VIDEO_INSPECT_WORKER_MANAGER_HOST:"edge.agora.io",VIDEO_INSPECT_WORKER_MANAGER_PORT:"",VIDEO_INSPECT_WORKER_MANAGER_WSS:"",VIDEO_INSPECT_WORKER_PORT:"",SHOW_VIDEO_INSPECT_WORKER_MESSAGE:!1,STATS_COLLECTOR_PORT:443,FORCE_TURN_TCP:!1,WEBAUDIO_INIT_OPTIONS:void 0,FILTER_VIDEO_FEC:!0,FILTER_AUDIO_FEC:!1,CHROME_DUAL_STREAM_USE_ENCODING:!0,DISABLE_DUAL_STREAM_USE_ENCODING:!1,EXTENSION_USAGE_UPLOAD_INTERVAL:1e4,ICE_RESTART:!0,FINGERPRINT:null,ENABLE_VIDEO_FRAME_CALLBACK:!0,VIDEO_FREEZE_DURATION:500,SPATIALIZER_PARAMETERS:{},UPLOAD_LOG_INTERVAL:3e3,UPLOAD_LOG_REQUEST_RETRY_INTERVAL:2e3,UPLOAD_LOG_REQUEST_MAX_RETRY_INTERVAL:2e4,UPLOAD_LOG_TRY_INTERVAL_WHILE_OFF:5e3,UPLOAD_LOG_RETRY_INTERVAL_V1:1e4,UPLOAD_LOG_TWICE_RETRY_INTERVAL_V1:200,UPLOAD_LOG_LENGTH_EACH_TIME:10,APP_TYPE:0,DISABLE_WEBAUDIO:!1,CHANNEL_MEDIA_RELAY_SERVERS:void 0,KEEP_LAST_FRAME:!0,FORWARD_P2P_CREATION:!0,SYNC_GROUP:!0,BLOCK_LOCAL_CLIENT:!1,ENABLE_AUDIO_TOPN:!1,ENABLE_AUDIO_METADATA:!1,ENABLE_AUDIO_PTS:!1,TOPN_SMOOTH_LEVEL:void 0,TOPN_NEW_SPEAKER_DELAY:void 0,TOPN_SWITCH_HOLD_MS:void 0,TOPN_AUDIO_GAIN:void 0,TOPN_SILENCE_THRESHOLD:250,AP_AREA:!0,ENABLE_ENCODED_TRANSFORM:!1,ENABLE_VIDEO_SEI:!1,IMAGE_MODERATION_WORKER_HOST:"edge.agora.io",IMAGE_MODERATION_WORKER_WSS:"",IMAGE_MODERATION_WORKER_MESSAGE_LENGTH_LIMIT:3e5,IMAGE_MODERATION_INTERVAL_MINIMUM:1e3,SHOW_IMAGE_MODERATION_WORKER_MESSAGE:!1,IMAGE_MODERATION_QUALITY_RATIO:.9,IMAGE_MODERATION_UPLOAD_REPORT_INTERVAL:5e3,SHOW_GLOBAL_CLIENT_LIST:!1,DATASTREAM_MAX_RETRANSMITS:10,TCP_CANDIDATE_ONLY:!1,EXTERNAL_SIGNAL_REQUEST_TIMEOUT:3e3,SHOW_P2P_LOG:!1,MAX_P2P_TIMEOUT:3e4,P2P_TOKEN_INTERVAL:1e3,SHOW_DATASTREAM2_LOG:!1,RESTRICTION_SET_PLAYBACK_DEVICE:!0,USE_PURE_ENCRYPTION_MASTER_KEY:!1,ENABLE_AUDIO_RED:!1,OPUS_PTIME:void 0,AUDIO_DUPLICATE_NUM:void 0,ENABLE_ABSSENDTIME_AS_SENTTS:!0,ACCOUNT_REGISTER_RETRY_TIMEOUT:1,ACCOUNT_REGISTER_RETRY_RATIO:2,ACCOUNT_REGISTER_RETRY_TIMEOUT_MAX:6e4,ACCOUNT_REGISTER_RETRY_COUNT_MAX:1e5,AUDIO_CONTEXT:null,WEBCS_BACKUP_CONNECT_TIMEOUT:6e3,PLAYER_STATE_DEFER:2e3,SIGNAL_REQUEST_WATCH_INTERVAL:1e3,FILEPATH_LENMAX:255,DUALSTREAM_OPERATION_CHECK:!0,MEDIA_ELEMENT_EXISTS_DEPTH:3,SHIM_CANDIDATE:!1,LEAVE_MSG_TIMEOUT:2e3,STATS_FILTER:{transportId:!0,googTrackId:!0},FILTER_VIDEO_CODEC:[],SIGNAL_CHANNEL:0,TRANSMITTER_INITIAL_RTT:30,TRANSMITTER_INITIAL_RTO:30,TRANSMITTER_MAX_BATCH_ACK_COUNT:2,TRANSMITTER_MAX_RTO:500,DATACHANNEL_COMPRESS:!1,DC_JOIN_WITH_FAILBACK:4e3,DC_CONNECTION_TIMEOUT:2e3,DC_PINGPONG_INTERVAL:2e3,DC_DEBUG_LOG:!1,UNSUPPORTED_VIDEO_UPLINK_CODEC:[],UNSUPPORTED_VIDEO_DOWNLINK_CODEC:[],USE_NEW_NETWORK_CONFIG:!1,AUTO_RESET_AUDIO_ROUTE:!1,PLUGIN_INFO:[],OVERUSE_DETECTOR_PARAMS:{MIN_FRAME_RATE:1,MAX_FRAME_RATE:30,MAX_THRESHOLD_FRAMERATE:30,BITRATE_MIN_THRESHOLD:100,BITRATE_MAX_THRESHOLD:100,MAX_SCALE:5,BWE_SCALE_UP_THRESHOLD:.6,BWE_SCALE_DOWN_THRESHOLD:.6,PERF_SCALE_UP_THRESHOLD:.7,PERF_SCALE_DOWN_THRESHOLD:.6,MOTION_RESOLUTION_FACTOR:.8,MOTION_BITRATE_FACTOR:.6,DETAIL_FRAMERATE_FACTOR:.8,DETAIL_BITRATE_FACTOR:.6,BALANCE_RESOLUTION_FACTOR:.9,BALANCE_FRAMERATE_FACTOR:.9,BALANCE_BITRATE_FACTOR:.6,OVERUSE_TIMES_THRESHOLD:10,UNDERUSE_TIMES_THRESHOLD:40},CUSTOM_ADAPTATION_DEFAULT_MODE:"",HIDE_NO_POSTER:!1,AP_CACHE_NUM:10,AP_UPDATE_INTERVAL:12e4,AP_CACHE_LIFETIME:12e4,MAX_PRELOAD_ASYNC_LENGTH:3,DISABLE_SCREEN_SHARE_REMB:!1},{ENABLE_PUBLISHED_USER_LIST:!0,ENABLE_USER_LIST:!1,MAX_SUBSCRIPTION:50,SUBSCRIBE_AUDIO_FILTER_TOPN:void 0,ENABLE_PUBLISH_AUDIO_FILTER:void 0,ENABLE_USER_LICENSE_CHECK:!0,DISABLE_FEC:void 0,ENABLE_NTP_REPORT:!1,ENABLE_INSTANT_VIDEO:!1,ENABLE_USER_AUTO_REBALANCE_CHECK:!0,ENABLE_LOSSBASED_BWE:!0,ENABLE_AUT_CC:!0,FORCE_ENABLE_AUT_CC:!1,ENABLE_CC_FALLBACK:void 0,SUBSCRIBE_TWCC:!0,PUBLISH_TWCC:!1,ENABLE_SVC_DEFAULT_CODECS:["H264","VP8","VP9","AV1"],SVC:[],ENABLE_FULL_LINK_AV_SYNC:!1,SVC_MODE:null,ENABLE_AUT_FEEDBACK:!0,SVC_EXTENDED:["VP9"],ENABLE_JOIN_V4:!1,ENABLE_AP_COMPRESS:!0}),{},{USE_CANDIDATE_FROM_AP_DETAIL:!1,AP_REQUEST_DETAIL:void 0,ENABLE_ROLE_SELECT_EDGE:!1,CLIENT_ROLE_OPTIONS:void 0,REMOTE_VIDEO_STREAM_TYPE:void 0,COMPATIBLE_SDP_EXTENSION:["gdpr_forbidden"],LIMIT_BITRATE:void 0,EXPERIMENTS:{},USE_PUB_RTX:!0,USE_SUB_RTX:!0,ENABLE_DATASTREAM_2:!1,USE_XR:!0,ENABLE_PREALLOC_PC:!1,ENABLE_PRE_SUB:!1,ENABLE_SVC:!1,ENABLE_FORCE_HLS:!1,MAX_WEBAUDIO_VOLUME:300,ENABLE_VOS_FALLBACK:!1,ENABLE_FALLBACK_TO_HLS:!1,ENABLE_PRE_RENDER:!1,FORCE_DISABLE_AUTO_SUB:!1,ENABLE_PRE_SUB_WITH_PRE_PC:!0,PRE_USE_LOCAL_CODECS:!0},{INSTALL_ID:""}),{},{K_MIN_RENDER_DELAY:66,USE_STANDARD_BITRATE_DEFAULT:!1,VIDEO_NEW_BITRATE_RATIO:void 0,VIDEO_STANDARD_BITRATE_VERSION:2,BASELINE_MORE_H264_BITRATE_RATIO:1.1,IGNORE_RTC_DEVICE_CHECK:!1,FLS_AUTOPLAY_EMITS:!1,ENABLE_DUAL_STREAM_FLAG:!1,FORBID_MODIFY_LOCAL_OFFER_SDP:!1,RESERVE_MID_1_MLINE:!1,PRE_SUB_NUM:1,DC_IN_ESM:!0,PRE_PLAYOUT_DELAY_HINT:void 0});function ln(e,t,r){var i;Object.keys(un).includes(e)&&(!r&&Object.keys(pn).includes(e)||(un[e]=t,"ENABLE_VIDEO_SEI"!==e&&"ENABLE_AUDIO_TOPN"!==e&&"ENABLE_AUDIO_METADATA"!==e&&"ENABLE_AUDIO_PTS"!==e||!0!==t||(un.ENABLE_ENCODED_TRANSFORM=!0),"USE_NEW_NETWORK_CONFIG"===e&&t&&(i=!!t,un.USE_NEW_NETWORK_CONFIG=i,i&&(un.WEBCS_DOMAIN=["webrtc2-2.ap.sd-rtn.com"],un.WEBCS_DOMAIN_BACKUP_LIST=["webrtc2-4.ap.sd-rtn.com"],un.CDS_AP=["cds-web-2.ap.sd-rtn.com","cds-web-4.ap.sd-rtn.com"],un.ACCOUNT_REGISTER=["sua-web-2.ap.sd-rtn.com","sua-web-4.ap.sd-rtn.com"],un.EVENT_REPORT_DOMAIN="web-2.statscollector.sd-rtn.com",un.EVENT_REPORT_BACKUP_DOMAIN="statscollector-1.agora.io",un.GATEWAY_DOMAINS=["edge.sd-rtn.com"])),"ENABLE_PRE_SUB"===e&&t&&(un.ENABLE_INSTANT_VIDEO=!0,un.ENABLE_PREALLOC_PC=!0),"ENABLE_SVC"===e&&t&&(un.ENABLE_AUT_CC=!0),"NEW_FORCE_TURN"===e&&t&&(un.NEW_TURN_MODE||(un.NEW_TURN_MODE=4))))}function hn(e){if("TURN_DOMAINS"===e){const e=un.TURN_DOMAINS;return e.includes(hn("TURN_DOMAIN"))?e:[hn("TURN_DOMAIN")].concat(e)}return un[e]}cn||(un.WEBCS_DOMAIN=["ap-web-1-oversea.agora.io","ap-web-1-north-america.agora.io"],un.WEBCS_DOMAIN_BACKUP_LIST=["ap-web-2-oversea.agora.io","ap-web-2-north-america.agora.io"],un.PROXY_CS=["proxy-ap-web-oversea.agora.io","proxy-ap-web-america.agora.io"],un.CDS_AP=["cds-ap-web-oversea.agora.io","cds-ap-web-america.agora.io","cds-ap-web-america2.agora.io"],un.ACCOUNT_REGISTER=["sua-ap-web-oversea.agora.io","sua-ap-web-america.agora.io","sua-ap-web-america2.agora.io"],un.UAP_AP=["uap-ap-web-oversea.agora.io","uap-ap-web-america.agora.io","uap-ap-web-america2.agora.io"],un.LOG_UPLOAD_SERVER="logservice-oversea.agora.io",un.EVENT_REPORT_DOMAIN="statscollector-1-oversea.agora.io",un.EVENT_REPORT_BACKUP_DOMAIN="statscollector-2-oversea.agora.io",un.PROXY_SERVER_TYPE3="webrtc-cloud-proxy.agora.io",un.AREAS=["NORTH_AMERICA","OVERSEA"]),function(e){e[e.REALTIME=1]="REALTIME"}({});const pn={};var fn=function(e){return e.SET_SESSION_ID="SET_SESSION_ID",e.SET_RTE_URL="SET_RTE_URL",e.SET_RTE_SID="SET_RTE_SID",e.SET_P2P_ID="SET_P2P_id",e.SET_DC_ID="SET_DC_id",e.SET_UID="SET_UID",e.SET_INT_UID="SET_INT_UID",e.SET_PUB_ID="SET_PUB_ID",e.SET_CLOUD_PROXY_SERVER_MODE="SET_CLOUD_PROXY_SERVER_MODE",e.KEY_METRIC_CLIENT_CREATED="KEY_METRIC_CLIENT_CREATED",e.KEY_METRIC_JOIN_START="KEY_METRIC_JOIN_START",e.KEY_METRIC_PRELOAD_START="KEY_METRIC_PRELOAD_START",e.KEY_METRIC_PRELOAD_END="KEY_METRIC_PRELOAD_END",e.KEY_METRIC_JOIN_END="KEY_METRIC_JOIN_END",e.KEY_METRIC_REQUEST_AP_START="KEY_METRIC_REQUEST_AP_START",e.KEY_METRIC_REQUEST_AP_END="KEY_METRIC_REQUEST_AP_END",e.KEY_METRIC_REQUEST_SUA_END="KEY_METRIC_REQUEST_SUA_END",e.KEY_METRIC_BEFORE_CONNECT="KEY_METRIC_BEFORE_CONNECT",e.KEY_METRIC_PEER_RECEIVER="KEY_METRIC_PEER_RECEIVER",e.KEY_METRIC_SIGNAL_CONNECTED="KEY_METRIC_SIGNAL_CONNECTED",e.KEY_METRIC_JOIN_REQ="KEY_METRIC_JOIN_REQ",e.KEY_METRIC_JOIN_REP="KEY_METRIC_JOIN_REP",e.KEY_METRIC_JOIN_GATEWAY_START="KEY_METRIC_JOIN_GATEWAY_START",e.KEY_METRIC_JOIN_GATEWAY_END="KEY_METRIC_JOIN_GATEWAY_END",e.KEY_METRIC_PEER_CONNECTION_START="KEY_METRIC_PEER_CONNECTION_START",e.KEY_METRIC_PEER_CONNECTION_END="KEY_METRIC_PEER_CONNECTION_END",e.KEY_METRIC_FIRST_VIDEO_FRAME_DECODED="KEY_METRIC_FIRST_VIDEO_FRAME_DECODED",e.KEY_METRIC_DESCRIPTION_START="KEY_METRIC_DESCRIPTION_START",e.KEY_METRIC_ICE_CONNECTION_END="KEY_METRIC_ICE_CONNECTION_END",e.KEY_METRIC_SIGNAL_CHANNEL_OPEN="KEY_METRIC_SIGNAL_CHANNEL_OPEN",e.KEY_METRIC_PUBLISH="KEY_METRIC_PUBLISH",e.KEY_METRIC_SUBSCRIBE="KEY_METRIC_SUBSCRIBE",e.RECORD_JOIN_CHANNEL_SERVICE="RECORD_JOIN_CHANNEL_SERVICE",e.RESET_JOIN_CHANNEL_SERVICE_RECORDS="RESET_JOIN_CHANNEL_SERVICE_RECORDS",e.RESET_KEY_METRICS="RESET_KEY_METRICS",e.RESET_FIRST_VIDEO_FRAME_DECODED="RESET_FIRST_VIDEO_FRAME_DECODED",e.SET_USE_P2P="SET_USE_P2P",e.SET_TRANSPORT_TYPE="SET_TRANSPORT_TYPE",e}(fn||{});function En(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,"string");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function mn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function _n(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?mn(Object(r),!0).forEach((function(t){En(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Tn(e,t){return Tn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Tn(e,t)}function gn(){gn=function(e,t){return new r(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function r(e,i,n){var o=RegExp(e,i);return t.set(o,n||t.get(e)),Tn(o,r.prototype)}function i(e,r){var i=t.get(r);return Object.keys(i).reduce((function(t,r){var n=i[r];if("number"==typeof n)t[r]=e[n];else{for(var o=0;void 0===e[n[o]]&&o+1<n.length;)o++;t[r]=e[n[o]]}return t}),Object.create(null))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Tn(e,t)}(r,RegExp),r.prototype.exec=function(t){var r=e.exec.call(this,t);if(r){r.groups=i(r,this);var n=r.indices;n&&(n.groups=i(n,this))}return r},r.prototype[Symbol.replace]=function(r,n){if("string"==typeof n){var o=t.get(this);return e[Symbol.replace].call(this,r,n.replace(/\$<([^>]+)(>|$)/g,(function(e,t,r){if(""===r)return e;var i=o[t];return Array.isArray(i)?"$"+i.join("$"):"number"==typeof i?"$"+i:""})))}if("function"==typeof n){var s=this;return e[Symbol.replace].call(this,r,(function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(i(e,s)),n.apply(this,e)}))}return e[Symbol.replace].call(this,r,n)},gn.apply(this,arguments)}!function(e){e.h264="h264",e.h265="h265",e.vp8="vp8",e.vp9="vp9",e.av1="av1"}({}),function(e){e.opus="opus",e.pcma="pcma",e.pcmu="pcmu",e.g722="g722"}({}),(()=>{var e={8:(e,t,r)=>{r.r(t),r.d(t,{Parser:()=>y,Printer:()=>O,parse:()=>D,print:()=>P});const i="\n",n="".concat("\r").concat(i),o=" ";let s;function a(e){return e>="0"&&e<="9"}function c(e){return e>="!"&&e<="~"}function d(e){return c(e)||e>=""&&e<="ÿ"}function u(e){return"!"===e||e>="#"&&e<="'"||e>="*"&&e<="+"||e>="-"&&e<="."||e>="0"&&e<="9"||e>="A"&&e<="Z"||e>="^"&&e<="~"}function l(e){return e>="1"&&e<="9"}function h(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function p(e){return"d"===e||"h"===e||"m"===e||"s"===e}function f(e){return e>""&&e<"\t"||e>"\v"&&e<"\f"||e>""&&e<"ÿ"}function E(e){return h(e)||a(e)||"+"===e||"/"===e}function m(e){return a(e)||h(e)||"+"===e||"/"===e||"-"===e||"_"===e}function _(e){return h(e)||a(e)||"+"===e||"/"===e}function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach((function(t){S(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function S(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(e){e.VERSION="v",e.ORIGIN="o",e.SESSION_NAME="s",e.INFORMATION="i",e.URI="u",e.EMAIL="e",e.PHONE="p",e.CONNECTION="c",e.BANDWIDTH="b",e.TIME="t",e.REPEAT="r",e.ZONE_ADJUSTMENTS="z",e.KEY="k",e.ATTRIBUTE="a",e.MEDIA="m"}(s||(s={}));class R{consumeText(e,t){let r=t;for(;r<e.length;){const t=e[r];if("\0"===t||"\r"===t||t===i)break;r+=1}if(r-t==0)throw new Error("Invalid text, at ".concat(e));return r}consumeUnicastAddress(e,t,r){return this.consumeTill(e,t,o)}consumeOneOrMore(e,t,r){let i=t;for(;r(e[i]);)i++;if(i-t==0)throw new Error("Invalid rule at ".concat(t,"."));return i}consumeSpace(e,t){if(e[t]===o)return t+1;throw new Error("Invalid space at ".concat(t,"."))}consumeIP4Address(e,t){let r=t;for(let t=0;t<4;t++)if(r=this.consumeDecimalUChar(e,r),3!==t){if("."!==e[r])throw new Error("Invalid IP4 address.");r++}return r}consumeDecimalUChar(e,t){let r=t;for(let t=0;t<3&&a(e[r]);t++,r++);if(r-t==0)throw new Error("Invalid decimal uchar.");const i=parseInt(e.slice(t,r));if(i>=0&&i<=255)return r;throw new Error("Invalid decimal uchar")}consumeIP6Address(e,t){let r=this.consumeHexpart(e,t);return":"===e[r]?(r+=1,r=this.consumeIP4Address(e,r),r):r}consumeHexpart(e,t){let r=t;if(":"===e[r]&&":"===e[r+1]){r+=2;try{r=this.consumeHexseq(e,r)}catch(e){}return r}if(r=this.consumeHexseq(e,r),":"===e[r]&&":"===e[r+1]){r+=2;try{r=this.consumeHexseq(e,r)}catch(e){}return r}return r}consumeHexseq(e,t){let r=t;for(;r=this.consumeHex4(e,r),":"===e[r]&&":"!==e[r+1];)r+=1;return r}consumeHex4(e,t){let r=0;for(;r<4;r++)if(!((i=e[t+r])>="0"&&i<="9"||i>="a"&&i<="f"||i>="A"&&i<="F")){if(0===r)throw new Error("Invalid hex 4");break}var i;return t+r}consumeFQDN(e,t){let r=t;for(;a(e[r])||h(e[r])||"-"===e[r]||"."===e[r];)r+=1;if(r-t<4)throw new Error("Invalid FQDN");return r}consumeExtnAddr(e,t){return this.consumeOneOrMore(e,t,d)}consumeMulticastAddress(e,t,r){switch(r){case"IP4":case"ip4":return this.consumeIP4MulticastAddress(e,t);case"IP6":case"ip6":return this.consumeIP6MulticastAddress(e,t);default:try{return this.consumeFQDN(e,t)}catch(r){return this.consumeExtnAddr(e,t)}}}consumeIP6MulticastAddress(e,t){const r=this.consumeHexpart(e,t);return"/"===e[r]?this.consumeInteger(e,r+1):r}consumeIP4MulticastAddress(e,t){let r=t+3;const i=e.slice(t,r),n=parseInt(i);if(n<224||n>239)throw new Error("Invalid IP4 multicast address, IPv4 multicast addresses may be in the range 224.0.0.0 to 239.255.255.255.");for(let t=0;t<3;t++){if("."!==e[r])throw new Error("Invalid IP4 multicast address.");r+=1,r=this.consumeDecimalUChar(e,r)}return"/"===e[r]&&(r+=1),r=this.consumeTTL(e,r),"/"===e[r]&&(r=this.consumeInteger(e,r)),r}consumeInteger(e,t){if(!l(e[t]))throw new Error("Invalid integer.");for(t+=1;a(e[t]);)t+=1;return t}consumeTTL(e,t){if("0"===e[t])return t+1;if(!l(e[t]))throw new Error("Invalid TTL.");t+=1;for(let r=0;r<2&&a(e[t]);r++)t+=1;return t}consumeToken(e,t){return this.consumeOneOrMore(e,t,u)}consumeTime(e,t){let r=t;if("0"===e[r])return r+1;for(l(e[r])&&(r+=1);a(e[r]);)r++;if(r-t<10)throw new Error("Invalid time");return r}consumeAddress(e,t){return this.consumeTill(e,t,o)}consumeTypedTime(e,t){let r=t;return r=this.consumeOneOrMore(e,r,a),p(e[r])?r+1:r}consumeRepeatInterval(e,t){if(!l(e[t]))throw new Error("Invalid repeat interval");for(t+=1;a(e[t]);)t+=1;return p(e[t])&&(t+=1),t}consumePort(e,t){return this.consumeOneOrMore(e,t,a)}consume(e,t,r){for(let i=0;i<r.length;i++){if(t+i>=e.length)throw new Error("consume exceeding value length");if(e[t+i]!==r[i])throw new Error("consume ".concat(r," failed at ").concat(i))}return t+r.length}consumeTill(e,t,r){let i=t;for(;i<e.length&&("string"!=typeof r||e[i]!==r)&&("function"!=typeof r||!r(e[i]));)i++;return i}}class y extends R{constructor(){super(),S(this,"records",[]),S(this,"currentLine",0)}parse(e){const t=this.probeEOL(e);this.records=e.split(t).filter((e=>!!e.trim())).map(this.parseLine),this.currentLine=0;const r=this.parseVersion(),i=this.parseOrigin(),n=this.parseSessionName(),o=this.parseInformation(),s=this.parseUri(),a=this.parseEmail(),c=this.parsePhone(),d=this.parseConnection(),u=this.parseBandWidth(),l=this.parseTimeFields(),h=this.parseKey(),p=this.parseSessionAttribute(),f=this.parseMediaDescription();if(this.currentLine!==this.records.length)throw new Error("parsing failed, non exhaustive sdp lines.");return{version:r,origin:i,sessionName:n,information:o,uri:s,emails:a,phones:c,connection:d,bandwidths:u,timeFields:l,key:h,attributes:p,mediaDescriptions:f}}getCurrentRecord(){const e=this.records[this.currentLine];if(!e)throw new Error("Record doesn't exit.");return e}probeEOL(e){for(let t=0;t<e.length;t++)if(e[t]===i)return"\r"===e[t-1]?n:i;throw new Error("Invalid newline character.")}parseLine(e,t){if(e.length<2)throw new Error("Invalid sdp line, sdp line should be of form <type>=<value>.");const r=e[0];if("="!==e[1])throw new Error('Invalid sdp line, <type> should be a single character followed by an "=" sign.');return{type:r,value:e.slice(2),line:t,cur:0}}parseSessionAttribute(){const e=new A;for(;this.currentLine<this.records.length;){const t=this.getCurrentRecord();if(t.type!==s.ATTRIBUTE)break;const r={attField:this.extractOneOrMore(t,(e=>u(e)&&":"!==e)),_cur:0};":"===t.value[t.cur]&&(t.cur+=1,r.attValue=this.extractOneOrMore(t,f)),e.parse(r),this.currentLine++}return e.digest()}parseMediaAttributes(e){const t=new b(e);for(;this.currentLine<this.records.length;){const e=this.getCurrentRecord();if(e.type!==s.ATTRIBUTE)break;const r={attField:this.extractOneOrMore(e,(e=>u(e)&&":"!==e)),_cur:0};":"===e.value[e.cur]&&(e.cur+=1,r.attValue=this.extractOneOrMore(e,f)),t.parse(r),this.currentLine++}return t.digest()}parseKey(){const e=this.getCurrentRecord();if(e.type===s.KEY){if("prompt"===e.value||"clear:"===e.value||"base64:"===e.value||"uri:"===e.value)return e.value;throw this.currentLine++,new Error("Invalid key.")}}parseZone(){const e=this.getCurrentRecord();if(e.type===s.ZONE_ADJUSTMENTS){const t=[];for(;;)try{const r=this.extract(e,this.consumeTime);this.consumeSpaceForRecord(e);let i=!1;"-"===e.value[e.cur]&&(i=!0,e.cur+=1);const n=this.extract(e,this.consumeTypedTime);t.push({time:r,typedTime:n,back:i})}catch(e){break}if(0===t.length)throw new Error("Invalid zone adjustments");return this.currentLine++,t}return[]}parseRepeat(){const e=[];for(;;){const t=this.getCurrentRecord();if(t.type!==s.REPEAT)break;{const r=this.extract(t,this.consumeRepeatInterval),i=this.parseTypedTime(t);e.push({repeatInterval:r,typedTimes:i}),this.currentLine++}}return e}parseTypedTime(e){const t=[];for(;;)try{this.consumeSpaceForRecord(e),t.push(this.extract(e,this.consumeTypedTime))}catch(e){break}if(0===t.length)throw new Error("Invalid typed time.");return t}parseTime(){const e=this.getCurrentRecord(),t=this.extract(e,this.consumeTime);this.consumeSpaceForRecord(e);const r=this.extract(e,this.consumeTime);return this.currentLine++,{startTime:t,stopTime:r}}parseBandWidth(){const e=[];for(;this.currentLine<this.records.length;){const t=this.getCurrentRecord();if(t.type!==s.BANDWIDTH)break;{const r=this.extractOneOrMore(t,u);if(":"!==t.value[t.cur])throw new Error("Invalid bandwidth field.");t.cur++;const i=this.extractOneOrMore(t,a);e.push({bwtype:r,bandwidth:i}),this.currentLine++}}return e}parseVersion(){const e=this.getCurrentRecord();if(e.type!==s.VERSION)throw new Error("first sdp record must be version");const t=e.value.slice(0,this.consumeOneOrMore(e.value,0,a));if(t.length!==e.value.length)throw new Error('invalid proto version, "v='.concat(e.value,'"'));return this.currentLine++,t}parseOrigin(){const e=this.getCurrentRecord();if(e.type!==s.ORIGIN)throw new Error("second line of sdp must be origin");const t=this.extractOneOrMore(e,d);this.consumeSpaceForRecord(e);const r=this.extractOneOrMore(e,a);this.consumeSpaceForRecord(e);const i=this.extractOneOrMore(e,a);this.consumeSpaceForRecord(e);const n=this.extractOneOrMore(e,u);this.consumeSpaceForRecord(e);const o=this.extractOneOrMore(e,u);this.consumeSpaceForRecord(e);const c=this.extract(e,this.consumeUnicastAddress);return this.currentLine++,{username:t,sessId:r,sessVersion:i,nettype:n,addrtype:o,unicastAddress:c}}parseSessionName(){const e=this.getCurrentRecord();if(e.type===s.SESSION_NAME){const t=this.extract(e,this.consumeText);return this.currentLine++,t}}parseInformation(){const e=this.getCurrentRecord();if(e.type!==s.INFORMATION)return;const t=this.extract(e,this.consumeText);return this.currentLine++,t}parseUri(){const e=this.getCurrentRecord();if(e.type===s.URI)return this.currentLine++,e.value}parseEmail(){const e=[];for(;;){const t=this.getCurrentRecord();if(t.type!==s.EMAIL)break;e.push(t.value),this.currentLine++}return e}parsePhone(){const e=[];for(;;){const t=this.getCurrentRecord();if(t.type!==s.PHONE)break;e.push(t.value),this.currentLine++}return e}parseConnection(){const e=this.getCurrentRecord();if(e.type===s.CONNECTION){const t=this.extractOneOrMore(e,u);this.consumeSpaceForRecord(e);const r=this.extractOneOrMore(e,u);this.consumeSpaceForRecord(e);const i=this.extract(e,this.consumeAddress);return this.currentLine++,{nettype:t,addrtype:r,address:i}}}parseMedia(){const e=this.getCurrentRecord(),t=this.extract(e,this.consumeToken);this.consumeSpaceForRecord(e);let r=this.extract(e,this.consumePort);"/"===e.value[e.cur]&&(e.cur+=1,r+=this.extract(e,this.consumeInteger)),this.consumeSpaceForRecord(e);const i=[];for(i.push(this.extract(e,this.consumeToken));"/"===e.value[e.cur];)e.cur+=1,i.push(this.extract(e,this.consumeToken));if(0===i.length)throw new Error("Invalid proto");const n=this.parseFmt(e);return this.currentLine++,{mediaType:t,port:r,protos:i,fmts:n}}parseTimeFields(){const e=[];for(;this.getCurrentRecord().type===s.TIME;){const t=this.parseTime(),r=this.parseRepeat(),i=this.parseZone();e.push({time:t,repeats:r,zones:i})}return e}parseMediaDescription(){const e=[];for(;this.currentLine<this.records.length&&this.getCurrentRecord().type===s.MEDIA;){const t=this.parseMedia(),r=this.parseInformation(),i=this.parseConnections(),n=this.parseBandWidth(),o=this.parseKey(),s=this.parseMediaAttributes(t);e.push({media:t,information:r,connections:i,bandwidths:n,key:o,attributes:s})}return e}parseConnections(){const e=[];for(;this.currentLine<this.records.length&&this.getCurrentRecord().type===s.CONNECTION;)e.push(this.parseConnection());return e}parseFmt(e){const t=[];for(;;)try{this.consumeSpaceForRecord(e),t.push(this.extract(e,this.consumeToken))}catch(e){break}if(0===t.length)throw new Error("Invalid fmts");return t}extract(e,t,...r){const i=t.call(this,e.value,e.cur,...r),n=e.value.slice(e.cur,i);return e.cur=i,n}extractOneOrMore(e,t){const r=this.consumeOneOrMore(e.value,e.cur,t),i=e.value.slice(e.cur,r);return e.cur=r,i}consumeSpaceForRecord(e){if(e.value[e.cur]!==o)throw new Error("Invalid space at ".concat(e.cur,"."));e.cur+=1}}class v extends R{constructor(...e){super(...e),S(this,"attributes",void 0),S(this,"digested",!1)}extractOneOrMore(e,t,r){const i=this.consumeOneOrMore(e.attValue,e._cur,t),n=e.attValue.slice(e._cur,i),[o,s]=r||[];if("number"==typeof o&&n.length<o)throw new Error("error in length, should be more or equal than ".concat(o," characters."));if("number"==typeof s&&n.length>s)throw new Error("error in length, should be less or equal than ".concat(s," characters."));return e._cur=i,n}consumeAttributeSpace(e){if(e.attValue[e._cur]!==o)throw new Error("Invalid space at ".concat(e._cur,"."));e._cur+=1}extract(e,t,...r){if(!e.attValue)throw new Error("Nothing to extract from attValue.");const i=t.call(this,e.attValue,e._cur,...r),n=e.attValue.slice(e._cur,i);return e._cur=i,n}atEnd(e){if(!e.attValue)throw new Error;return e._cur>=e.attValue.length}peekChar(e){if(!e.attValue)throw new Error;return e.attValue[e._cur]}peek(e,t){if(!e.attValue)throw new Error;for(let r=0;r<t.length;r++)if(t[r]!==e.attValue[e._cur+r])return!1;return!0}parseIceUfrag(e){if(this.attributes.iceUfrag)throw new Error("Invalid ice-ufrag, should be only a single line if 'a=ice-ufrag'");this.attributes.iceUfrag=this.extractOneOrMore(e,E,[4,256])}parseIcePwd(e){if(this.attributes.icePwd)throw new Error("Invalid ice-pwd, should be only a single line if 'a=ice-pwd'");this.attributes.icePwd=this.extractOneOrMore(e,E,[22,256])}parseIceOptions(e){if(this.attributes.iceOptions)throw new Error("Invalid ice-options, should be only one 'ice-options' line");const t=[];for(;!this.atEnd(e);){t.push(this.extractOneOrMore(e,E));try{this.consumeAttributeSpace(e)}catch(t){if(this.atEnd(e))break;throw t}}this.attributes.iceOptions=t}parseFingerprint(e){const t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill);this.attributes.fingerprints.push({hashFunction:t,fingerprint:r})}parseExtmap(e){const t=this.extractOneOrMore(e,a);let r;"/"===this.peekChar(e)&&(this.extract(e,this.consume,"/"),r=this.extract(e,this.consumeToken)),this.consumeAttributeSpace(e);const i=this.extract(e,this.consumeTill,o),n=g(g({entry:parseInt(t,10)},r&&{direction:r}),{},{extensionName:i});this.peekChar(e)===o&&(this.consumeAttributeSpace(e),n.extensionAttributes=this.extract(e,this.consumeTill)),this.attributes.extmaps.push(n)}parseSetup(e){if(this.attributes.setup)throw new Error("must only be one single 'a=setup' line.");const t=this.extract(e,this.consumeTill);if("active"!==t&&"passive"!==t&&"actpass"!==t&&"holdconn"!==t)throw new Error("role must be one of 'active', 'passive', 'actpass', 'holdconn'.");this.attributes.setup=t}}class A extends v{constructor(...e){super(...e),S(this,"attributes",{unrecognized:[],groups:[],extmaps:[],fingerprints:[],identities:[]})}parse(e){if(this.digested)throw new Error("already digested");try{switch(e.attField){case"group":this.parseGroup(e);break;case"ice-lite":this.parseIceLite();break;case"ice-ufrag":this.parseIceUfrag(e);break;case"ice-pwd":this.parseIcePwd(e);break;case"ice-options":this.parseIceOptions(e);break;case"fingerprint":this.parseFingerprint(e);break;case"setup":this.parseSetup(e);break;case"tls-id":this.parseTlsId(e);break;case"identity":this.parseIdentity(e);break;case"extmap":this.parseExtmap(e);break;case"msid-semantic":this.parseMsidSemantic(e);break;default:e.ignored=!0,this.attributes.unrecognized.push(e)}}catch(t){throw console.error("parsing session attribute ".concat(e.attField,' error, "a=').concat(e.attField,":").concat(e.attValue,'"')),t}if(!e.ignored&&e.attValue&&!this.atEnd(e))throw new Error("attribute parsing error")}digest(){return this.digested=!0,this.attributes}parseGroup(e){const t=this.extract(e,this.consumeToken),r=[];for(;!this.atEnd(e)&&this.peekChar(e)===o;)this.consumeAttributeSpace(e),r.push(this.extract(e,this.consumeToken));this.attributes.groups.push({semantic:t,identificationTag:r})}parseIceLite(){if(this.attributes.iceLite)throw new Error("Invalid ice-lite, should be only a single line of 'a=ice-lite'");this.attributes.iceLite=!0}parseTlsId(e){if(this.attributes.tlsId)throw new Error("must be only one tld-id line");this.attributes.tlsId=this.extractOneOrMore(e,m)}parseIdentity(e){const t=this.extractOneOrMore(e,_),r=[];for(;!this.atEnd(e)&&this.peekChar(e)===o;){this.consumeAttributeSpace(e);const t=this.extract(e,this.consumeToken);this.extract(e,this.consume,"=");const i=this.extractOneOrMore(e,(e=>e!==o&&f(e)));r.push({name:t,value:i})}this.attributes.identities.push({assertionValue:t,extensions:r})}parseMsidSemantic(e){this.peekChar(e)===o&&this.consumeAttributeSpace(e);const t={semantic:this.extract(e,this.consumeToken),identifierList:[]};for(;;){try{this.consumeAttributeSpace(e)}catch(e){break}if("*"===this.peekChar(e)){this.extract(e,this.consume,"*"),t.applyForAll=!0;break}{const r=this.extract(e,this.consumeTill,o);t.identifierList.push(r)}}this.attributes.msidSemantic=t}}class b extends v{constructor(e){super(),S(this,"attributes",void 0),-1!==e.protos.indexOf("RTP")||e.protos.indexOf("rtp"),this.attributes={unrecognized:[],candidates:[],extmaps:[],fingerprints:[],imageattr:[],msids:[],remoteCandidatesList:[],rids:[],ssrcs:[],ssrcGroups:[],rtcpFeedbackWildcards:[],payloads:[]}}parse(e){if(this.digested)throw new Error("already digested");try{switch(e.attField){case"extmap":this.parseExtmap(e);break;case"setup":this.parseSetup(e);break;case"ice-ufrag":this.parseIceUfrag(e);break;case"ice-pwd":this.parseIcePwd(e);break;case"ice-options":this.parseIceOptions(e);break;case"candidate":this.parseCandidate(e);break;case"remote-candidate":this.parseRemoteCandidate(e);break;case"end-of-candidates":this.parseEndOfCandidates();break;case"fingerprint":this.parseFingerprint(e);break;case"rtpmap":this.parseRtpmap(e);break;case"ptime":this.parsePtime(e);break;case"maxptime":this.parseMaxPtime(e);break;case"sendrecv":case"recvonly":case"sendonly":case"inactive":this.parseDirection(e);break;case"ssrc":this.parseSSRC(e);break;case"fmtp":this.parseFmtp(e);break;case"rtcp-fb":this.parseRtcpFb(e);break;case"rtcp-mux":this.parseRTCPMux();break;case"rtcp-mux-only":this.parseRTCPMuxOnly();break;case"rtcp-rsize":this.parseRTCPRsize();break;case"rtcp":this.parseRTCP(e);break;case"mid":this.parseMid(e);break;case"msid":this.parseMsid(e);break;case"imageattr":this.parseImageAttr(e);break;case"rid":this.parseRid(e);break;case"simulcast":this.parseSimulcast(e);break;case"sctp-port":this.parseSctpPort(e);break;case"max-message-size":this.parseMaxMessageSize(e);break;case"ssrc-group":this.parseSSRCGroup(e);break;default:e.ignored=!0,this.attributes.unrecognized.push(e)}}catch(t){throw console.error("parsing media attribute ".concat(e.attField,' error, "a=').concat(e.attField,":").concat(e.attValue,'"')),t}if(!e.ignored&&e.attValue&&!this.atEnd(e))throw new Error("attribute parsing error")}parseCandidate(e){const t=this.extractOneOrMore(e,E,[1,32]);this.consumeAttributeSpace(e);const r=this.extractOneOrMore(e,a,[1,5]);this.consumeAttributeSpace(e);const i=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);const n=this.extractOneOrMore(e,a,[1,10]);this.consumeAttributeSpace(e);const s=this.extract(e,this.consumeAddress);this.consumeAttributeSpace(e);const d=this.extract(e,this.consumePort);this.consumeAttributeSpace(e),this.extract(e,this.consume,"typ"),this.consumeAttributeSpace(e);const u={foundation:t,componentId:r,transport:i,priority:n,connectionAddress:s,port:d,type:this.extract(e,this.consumeToken),extension:{}};for(this.peek(e," raddr")&&(this.extract(e,this.consume," raddr"),this.consumeAttributeSpace(e),u.relAddr=this.extract(e,this.consumeAddress)),this.peek(e," rport")&&(this.extract(e,this.consume," rport"),this.consumeAttributeSpace(e),u.relPort=this.extract(e,this.consumePort));this.peekChar(e)===o;){this.consumeAttributeSpace(e);const t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e),u.extension[t]=this.extractOneOrMore(e,c)}this.attributes.candidates.push(u)}parseRemoteCandidate(e){const t=[];for(;;){const r=this.extractOneOrMore(e,a,[1,5]);this.consumeAttributeSpace(e);const i=this.extract(e,this.consumeAddress);this.consumeAttributeSpace(e);const n=this.extract(e,this.consumePort);t.push({componentId:r,connectionAddress:i,port:n});try{this.consumeAttributeSpace(e)}catch(e){break}}this.attributes.remoteCandidatesList.push(t)}parseEndOfCandidates(){if(this.attributes.endOfCandidates)throw new Error("must be only one line of end-of-candidates");this.attributes.endOfCandidates=!0}parseRtpmap(e){const t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill,"/");this.extract(e,this.consume,"/");const i={encodingName:r,clockRate:this.extractOneOrMore(e,a)};this.atEnd(e)||"/"!==this.peekChar(e)||(this.extract(e,this.consume,"/"),i.encodingParameters=parseInt(this.extract(e,this.consumeTill),10));const n=this.attributes.payloads.find((e=>e.payloadType===parseInt(t,10)));n?n.rtpMap=i:this.attributes.payloads.push({payloadType:parseInt(t,10),rtpMap:i,rtcpFeedbacks:[]})}parsePtime(e){if(this.attributes.ptime)throw new Error("must be only one line of ptime");this.attributes.ptime=this.extract(e,this.consumeTill)}parseMaxPtime(e){if(this.attributes.maxPtime)throw new Error("must be only one line of ptime");this.attributes.maxPtime=this.extract(e,this.consumeTill)}parseDirection(e){if(this.attributes.direction)throw new Error("must be only one line of direction info");this.attributes.direction=e.attField}parseSSRC(e){const t=this.extractOneOrMore(e,a);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill,":");let i;":"===this.peekChar(e)&&(this.extract(e,this.consume,":"),i=this.extract(e,this.consumeTill));const n=this.attributes.ssrcs.find((e=>e.ssrcId===parseInt(t,10)));n?n.attributes[r]=i:this.attributes.ssrcs.push({ssrcId:parseInt(t,10),attributes:{[r]:i}})}parseFmtp(e){const t=this.extract(e,this.consumeTill,o);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill),i={};r.split(";").forEach((e=>{let[t,r]=e.split("=");t=t.trim();const n="string"==typeof r?r.trim():null;"string"==typeof t&&t.length>0&&(i[t]=n)}));const n=this.attributes.payloads.find((e=>e.payloadType===parseInt(t,10)));n?n.fmtp={parameters:i}:this.attributes.payloads.push({payloadType:parseInt(t,10),rtcpFeedbacks:[],fmtp:{parameters:i}})}parseFmtParameters(e){const t={},r=this.extract(e,this.consumeTill,"=");e._cur++;const i=this.extract(e,this.consumeTill,";");for(t[r]=i;";"===e.attValue[e._cur];){const r=this.extract(e,this.consumeTill,"=");e._cur++;const i=this.extract(e,this.consumeTill,";");t[r]=i}return t}parseRtcpFb(e){let t="";t="*"===this.peekChar(e)?this.extract(e,this.consume,"*"):this.extract(e,this.consumeTill,o),this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill,o);let i;if("trr-int"===r)i={type:r,interval:this.extract(e,this.consumeTill)};else{const t={type:r};this.peekChar(e)===o&&(this.consumeAttributeSpace(e),t.parameter=this.extract(e,this.consumeToken),this.peekChar(e)===o&&(t.additional=this.extract(e,this.consumeTill))),i=t}if("*"===t)this.attributes.rtcpFeedbackWildcards.push(i);else{const e=this.attributes.payloads.find((e=>e.payloadType===parseInt(t,10)));e?e.rtcpFeedbacks.push(i):this.attributes.payloads.push({payloadType:parseInt(t,10),rtcpFeedbacks:[i]})}}parseRTCPMux(){if(this.attributes.rtcpMux)throw new Error("must be single line of rtcp-mux");this.attributes.rtcpMux=!0}parseRTCPMuxOnly(){if(this.attributes.rtcpMuxOnly)throw new Error("must be single line of rtcp-only");this.attributes.rtcpMuxOnly=!0}parseRTCPRsize(){if(this.attributes.rtcpRsize)throw new Error("must be single line of rtcp-rsize");this.attributes.rtcpRsize=!0}parseRTCP(e){if(this.attributes.rtcp)throw new Error("must be single line of rtcp");const t={port:this.extract(e,this.consumePort)};this.peekChar(e)===o&&(this.consumeAttributeSpace(e),t.netType=this.extractOneOrMore(e,u),this.consumeAttributeSpace(e),t.addressType=this.extractOneOrMore(e,u),this.consumeAttributeSpace(e),t.address=this.extract(e,this.consumeAddress)),this.attributes.rtcp=t}parseMsid(e){const t={id:this.extractOneOrMore(e,u,[1,64])};this.peekChar(e)===o&&(this.consumeAttributeSpace(e),t.appdata=this.extractOneOrMore(e,u,[1,64])),this.attributes.msids.push(t)}parseImageAttr(e){this.attributes.imageattr.push(e.attValue)}parseRid(e){const t=this.extractOneOrMore(e,(e=>h(e)||a(e)||"_"===e||"-"===e));this.consumeAttributeSpace(e);const r={id:t,direction:this.extract(e,this.consumeToken),params:[]};if(this.peekChar(e)===o){if(this.consumeAttributeSpace(e),this.peek(e,"pt=")){this.extract(e,this.consume,"pt=");const t=[];for(;;){const r=this.extract(e,this.consumeToken);t.push(r);try{this.extract(e,this.consume,",")}catch(e){break}}r.payloads=t,this.peekChar(e)===o&&this.extract(e,this.consume,o)}for(;;){const t=this.extract(e,this.consumeToken);switch(t){case"depend":{const i={type:t,rids:this.extract(e,this.consume,"=").split(",")};r.params.push(i);break}default:{const i={type:t};"="===this.peekChar(e)&&(this.extract(e,this.consume,"="),i.val=this.extract(e,this.consumeTill,";")),r.params.push(i)}}try{this.extract(e,this.consume,";")}catch(e){break}}}this.attributes.rids.push(r)}parseSimulcast(e){if(this.attributes.simulcast)throw new Error("must be single line of simulcast");this.attributes.simulcast=e.attValue,this.extract(e,this.consumeTill)}parseSctpPort(e){this.attributes.sctpPort=this.extractOneOrMore(e,a,[1,5])}parseMaxMessageSize(e){this.attributes.maxMessageSize=this.extractOneOrMore(e,a,[1,void 0])}digest(){return this.digested=!0,this.attributes}parseMid(e){this.attributes.mid=this.extract(e,this.consumeToken)}parseSSRCGroup(e){const t=this.extract(e,this.consumeToken),r=[];for(;;)try{this.consumeAttributeSpace(e);const t=this.extract(e,this.consumeInteger);r.push(parseInt(t,10))}catch(e){break}this.attributes.ssrcGroups.push({semantic:t,ssrcIds:r})}}function I(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class O{constructor(){I(this,"eol",n)}print(e,t){let r="";return t&&(this.eol=t),r+=this.printVersion(e.version),r+=this.printOrigin(e.origin),r+=this.printSessionName(e.sessionName),r+=this.printInformation(e.information),r+=this.printUri(e.uri),r+=this.printEmail(e.emails),r+=this.printPhone(e.phones),r+=this.printConnection(e.connection),r+=this.printBandwidth(e.bandwidths),r+=this.printTimeFields(e.timeFields),r+=this.printKey(e.key),r+=this.printSessionAttributes(e.attributes),r+=this.printMediaDescription(e.mediaDescriptions),r}printVersion(e){return"v=".concat(e).concat(this.eol)}printOrigin(e){return"o=".concat(e.username," ").concat(e.sessId," ").concat(e.sessVersion," ").concat(e.nettype," ").concat(e.addrtype," ").concat(e.unicastAddress).concat(this.eol)}printSessionName(e){return e?"s=".concat(e).concat(this.eol):""}printInformation(e){return e?"i=".concat(e).concat(this.eol):""}printUri(e){return e?"u=".concat(e).concat(this.eol):""}printEmail(e){let t="";for(const r of e)t+="e=".concat(r).concat(this.eol);return t}printPhone(e){let t="";for(const r of e)t+="e=".concat(r).concat(this.eol);return t}printConnection(e){return e?"c=".concat(e.nettype," ").concat(e.addrtype," ").concat(e.address).concat(this.eol):""}printBandwidth(e){let t="";for(const r of e)t+="b=".concat(r.bwtype,":").concat(r.bandwidth).concat(this.eol);return t}printTimeFields(e){let t="";for(const r of e){t+="t=".concat(r.time.startTime," ").concat(r.time.startTime).concat(this.eol);for(const e of r.repeats)t+="r=".concat(e.repeatInterval," ").concat(e.typedTimes.join(" ")).concat(this.eol);r.zoneAdjustments&&(t+="z=",t+="z=".concat(r.zoneAdjustments.map((e=>"".concat(e.time," ").concat(e.back?"-":""," ").concat(e.typedTime))).join(" ")).concat(this.eol),t+=this.eol)}return t}printKey(e){return e?"k=".concat(e).concat(this.eol):""}printAttributes(e){let t="";for(const r of e)t+="a=".concat(r.attField).concat(r.attValue?":".concat(r.attValue):"").concat(this.eol);return t}printMediaDescription(e){let t="";for(const r of e)t+=this.printMedia(r.media),t+=this.printInformation(r.information),t+=this.printConnections(r.connections),t+=this.printBandwidth(r.bandwidths),t+=this.printKey(r.key),t+=this.printMediaAttributes(r);return t}printConnections(e){let t="";for(const r of e)t+=this.printConnection(r);return t}printMedia(e){return"m=".concat(e.mediaType," ").concat(e.port," ").concat(e.protos.join("/")," ").concat(e.fmts.join(" ")).concat(this.eol)}printSessionAttributes(e){return new N(this.eol).print(e)}printMediaAttributes(e){return new w(this.eol).print(e)}}class C{constructor(e){I(this,"eol",void 0),this.eol=e}printIceUfrag(e){return void 0===e?"":"a=ice-ufrag:".concat(e).concat(this.eol)}printIcePwd(e){return void 0===e?"":"a=ice-pwd:".concat(e).concat(this.eol)}printIceOptions(e){return void 0===e?"":"a=ice-options:".concat(e.join(o)).concat(this.eol)}printFingerprints(e){return e.length>0?e.map((e=>"a=fingerprint:".concat(e.hashFunction).concat(o).concat(e.fingerprint))).join(this.eol)+this.eol:""}printExtmap(e){return e.map((e=>"a=extmap:".concat(e.entry).concat(e.direction?"/".concat(e.direction):"").concat(o).concat(e.extensionName).concat(e.extensionAttributes?"".concat(o).concat(e.extensionAttributes):"").concat(this.eol))).join("")}printSetup(e){return void 0===e?"":"a=setup:".concat(e).concat(this.eol)}printUnrecognized(e){return e.map((e=>"a=".concat(e.attField).concat(e.attValue?":".concat(e.attValue):"").concat(this.eol))).join("")}}class N extends C{print(e){let t="";return t+=this.printGroups(e.groups),t+=this.printMsidSemantic(e.msidSemantic),t+=this.printIceLite(e.iceLite),t+=this.printIceUfrag(e.iceUfrag),t+=this.printIcePwd(e.icePwd),t+=this.printIceOptions(e.iceOptions),t+=this.printFingerprints(e.fingerprints),t+=this.printSetup(e.setup),t+=this.printTlsId(e.tlsId),t+=this.printIdentity(e.identities),t+=this.printExtmap(e.extmaps),t+=this.printUnrecognized(e.unrecognized),t}printGroups(e){let t="";return e.length>0&&(t+=e.map((e=>"a=group:".concat(e.semantic).concat(e.identificationTag.map((e=>"".concat(o).concat(e))).join("")).concat(this.eol))).join("")),t}printIceLite(e){return void 0===e?"":"a=ice-lite"+this.eol}printTlsId(e){return e?"a=tls-id:".concat(e).concat(this.eol):""}printIdentity(e){return 0===e.length?"":e.map((e=>"a=identity:".concat(e.assertionValue).concat(e.extensions.map((e=>"".concat(o).concat(e.name).concat(e.value?"=".concat(e.value):"")))))).join(this.eol)+this.eol}printMsidSemantic(e){if(!e)return"";let t="a=msid-semantic:".concat(e.semantic);return e.applyForAll?t+="".concat(o,"*"):e.identifierList.length>0&&(t+=e.identifierList.map((e=>"".concat(o).concat(e)))),t+this.eol}}class w extends C{print(e){const t=e.attributes;let r="";return r+=this.printRTCP(t.rtcp),r+=this.printIceUfrag(t.iceUfrag),r+=this.printIcePwd(t.icePwd),r+=this.printIceOptions(t.iceOptions),r+=this.printCandidates(t.candidates),r+=this.printRemoteCandidatesList(t.remoteCandidatesList),r+=this.printEndOfCandidates(t.endOfCandidates),r+=this.printFingerprints(t.fingerprints),r+=this.printSetup(t.setup),r+=this.printMid(t.mid),r+=this.printExtmap(t.extmaps),r+=this.printRTPRelated(t),r+=this.printPtime(t.ptime),r+=this.printMaxPtime(t.maxPtime),r+=this.printDirection(t.direction),r+=this.printSSRCGroups(t.ssrcGroups),r+=this.printSSRC(t.ssrcs),r+=this.printRTCPMux(t.rtcpMux),r+=this.printRTCPMuxOnly(t.rtcpMuxOnly),r+=this.printRTCPRsize(t.rtcpRsize),r+=this.printMSId(t.msids),r+=this.printImageattr(t.imageattr),r+=this.printRid(t.rids),r+=this.printSimulcast(t.simulcast),r+=this.printSCTPPort(t.sctpPort),r+=this.printMaxMessageSize(t.maxMessageSize),r+=this.printUnrecognized(t.unrecognized),r}printCandidates(e){return e.map((e=>"a=candidate:".concat(e.foundation).concat(o).concat(e.componentId).concat(o).concat(e.transport).concat(o).concat(e.priority).concat(o).concat(e.connectionAddress).concat(o).concat(e.port).concat(o,"typ").concat(o).concat(e.type).concat(e.relAddr?"".concat(o,"raddr").concat(o).concat(e.relAddr):"").concat(e.relPort?"".concat(o,"rport").concat(o).concat(e.relPort):"").concat(Object.keys(e.extension).map((t=>"".concat(o).concat(t).concat(o).concat(e.extension[t]))).join("")).concat(this.eol))).join("")}printRemoteCandidatesList(e){return e.map((e=>"a=remote-candidates:".concat(e.join(o)).concat(this.eol))).join("")}printEndOfCandidates(e){return void 0===e?"":"a=end-of-candidates"+this.eol}printRTPRelated(e){if(!e.payloads)return"";const t=e.payloads;let r="";r+=e.rtcpFeedbackWildcards.map((e=>this.printRTCPFeedback("*",e))).join("");for(const e of t)r+=this.printRtpMap(e.payloadType,e.rtpMap),r+=this.printFmtp(e.payloadType,e.fmtp),r+=e.rtcpFeedbacks.map((t=>this.printRTCPFeedback(e.payloadType,t))).join("");return r}printFmtp(e,t){if(!t)return"";const r=Object.keys(t.parameters);return 1===r.length&&null===t.parameters[r[0]]?"a=fmtp:".concat(e).concat(o).concat(r[0]).concat(this.eol):"a=fmtp:".concat(e).concat(o).concat(Object.keys(t.parameters).map((e=>"".concat(e,"=").concat(t.parameters[e]))).join(";")).concat(this.eol)}printRtpMap(e,t){return t?"a=rtpmap:".concat(e).concat(o).concat(t.encodingName,"/").concat(t.clockRate).concat(t.encodingParameters?"/".concat(t.encodingParameters):"").concat(this.eol):""}printRTCPFeedback(e,t){let r="a=rtcp-fb:".concat(e).concat(o),i=t;return"trr-int"===i.type?r+="ttr-int".concat(o).concat(i.interval):(r+="".concat(i.type),i.parameter&&(r+="".concat(o).concat(i.parameter),i.additional&&(r+="".concat(o).concat(i.additional)))),r+this.eol}printPtime(e){return void 0===e?"":"a=ptime:".concat(e).concat(this.eol)}printMaxPtime(e){return void 0===e?"":"a=maxptime:".concat(e).concat(this.eol)}printDirection(e){return void 0===e?"":"a=".concat(e).concat(this.eol)}printSSRC(e){return e.map((e=>Object.keys(e.attributes).map((t=>"a=ssrc:".concat(e.ssrcId.toString(10)).concat(o).concat(t).concat(e.attributes[t]?":".concat(e.attributes[t]):"").concat(this.eol))).join(""))).join("")}printRTCPMux(e){return void 0===e?"":"a=rtcp-mux".concat(this.eol)}printRTCPMuxOnly(e){return void 0===e?"":"a=rtcp-mux-only".concat(this.eol)}printRTCPRsize(e){return void 0===e?"":"a=rtcp-rsize".concat(this.eol)}printRTCP(e){if(void 0===e)return"";let t="a=rtcp:".concat(e.port);return e.netType&&(t+="".concat(o).concat(e.netType)),e.addressType&&(t+="".concat(o).concat(e.addressType)),e.address&&(t+="".concat(o).concat(e.address)),t+this.eol}printMSId(e){return e.map((e=>"a=msid:".concat(e.id).concat(e.appdata?"".concat(o).concat(e.appdata):"").concat(this.eol))).join("")}printImageattr(e){return e.map((e=>"a=imageattr:".concat(e).concat(this.eol))).join("")}printRid(e){return e.map((e=>{let t="a=rid:".concat(e.id).concat(o).concat(e.direction);return e.payloads&&(t+="".concat(o,"pt=").concat(e.payloads.join(","))),e.params.length>0&&(t+="".concat(o).concat(e.params.map((e=>"depend"===e.type?"depend=".concat(e.rids.join(",")):"".concat(e.type,"=").concat(e.val))).join(";"))),t+this.eol})).join("")}printSimulcast(e){return void 0===e?"":"a=simulcast:".concat(e).concat(this.eol)}printSCTPPort(e){return void 0===e?"":"a=sctp-port:".concat(e).concat(this.eol)}printMaxMessageSize(e){return void 0===e?"":"a=max-message-size:".concat(e).concat(this.eol)}printMid(e){return void 0===e?"":"a=mid:".concat(e).concat(this.eol)}printSSRCGroups(e){return e.map((e=>"a=ssrc-group:".concat(e.semantic).concat(e.ssrcIds.map((e=>"".concat(o).concat(e.toString(10)))).join("")).concat(this.eol))).join("")}}function D(e){return(new y).parse(e)}function P(e,t){return(new O).print(e,t)}}},t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={exports:{}};return e[i](n,n.exports,r),n.exports}r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(8)})();const Sn=new class extends fi{constructor(){super(...arguments),En(this,"currentUploadLogID",0)}reportLogUploadError(e){const{errorRange:t}=e;t[t.length-1]&&t[t.length-1]>this.currentUploadLogID&&(this.currentUploadLogID=t[t.length-1],this.emit("REPORT_LOG_UPLOAD",e))}};class Rn{constructor(e){En(this,"logger",void 0),En(this,"prefixLists",[]),this.logger=e}debug(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.debug(...this.prefixLists,...t)}info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.info(...this.prefixLists,...t)}warning(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.warning(...this.prefixLists,...t)}error(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.error(...this.prefixLists,...t)}prefix(e){return this.prefixLists.push(e),this}popPrefix(){return this.prefixLists.pop(),this}}function yn(){const e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}function vn(){const e=new Date,t=/((\d+:){2}\d+)/.exec((new Date).toUTCString());return t?(null==t?void 0:t[0])+":"+e.getUTCMilliseconds():e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}const An={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4},bn=Date.now(),In=e=>{for(const t in An)if(Object.prototype.hasOwnProperty.call(An,t)&&An[t]===e)return t;return"DEFAULT"};const On=new class{constructor(){En(this,"proxyServerURL",void 0),En(this,"logLevel",An.DEBUG),En(this,"uploadState","collecting"),En(this,"uploadLogWaitingList",[]),En(this,"uploadLogUploadingList",[]),En(this,"uploadErrorCount",0),En(this,"currentLogID",0),En(this,"url",void 0),En(this,"extLog",((e,t)=>{this.appendLogToWaitingList(e,...t)}))}debug(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=[An.DEBUG].concat(t);this.log.apply(this,i)}info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=[An.INFO].concat(t);this.log.apply(this,i)}warning(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=[An.WARNING].concat(t);this.log.apply(this,i)}warn(){this.warning(...arguments)}error(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=[An.ERROR].concat(t);this.log.apply(this,i)}upload(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=[An.DEBUG].concat(t);this.uploadLog.apply(this,i)}setLogLevel(e){e=Math.min(Math.max(0,e),4),this.logLevel=e}enableLogUpload(){ln("UPLOAD_LOG",!0)}disableLogUpload(){ln("UPLOAD_LOG",!1),this.uploadLogUploadingList=[],this.uploadLogWaitingList=[]}setProxyServer(e){this.proxyServerURL=e}prefix(e){return new Rn(this).prefix(e)}log(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Date.now()-bn<100)return void setTimeout((()=>{this.log(...t)}),Date.now()-bn);const i=Math.max(0,Math.min(4,t[0]));if(t[0]=yn()+" Agora-SDK [".concat(In(i),"]:"),this.appendLogToWaitingList(i,...t),i<this.logLevel)return;const n=yn()+" %cAgora-SDK [".concat(In(i),"]:");let o=[];if(!hn("USE_NEW_LOG"))switch(i){case An.DEBUG:o=[n,"color: #64B5F6;"].concat(t.slice(1)),console.log.apply(console,o);break;case An.INFO:o=[n,"color: #1E88E5; font-weight: bold;"].concat(t.slice(1)),console.log.apply(console,o);break;case An.WARNING:o=[n,"color: #FB8C00; font-weight: bold;"].concat(t.slice(1)),console.warn.apply(console,o);break;case An.ERROR:o=[n,"color: #B00020; font-weight: bold;"].concat(t.slice(1)),console.error.apply(console,o)}}uploadLog(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Date.now()-bn<100)return void setTimeout((()=>{this.uploadLog(...t)}),Date.now()-bn);const i=Math.max(0,Math.min(4,t[0]));t[0]=yn()+" Agora-SDK [".concat(In(i),"]:"),this.appendLogToWaitingList(i,...t)}appendLogToWaitingList(e){if(!hn("UPLOAD_LOG"))return;for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];Array.isArray(r[0])?r[0][0]=vn()+" Agora-SDK [".concat(In(e),"]:"):r[0]=vn()+" Agora-SDK [".concat(In(e),"]:");let n="";r.forEach((e=>{"object"==typeof e&&(e=JSON.stringify(e)),n+="".concat(e," ")})),this.uploadLogWaitingList.push({payload_str:n,log_level:e,log_item_id:this.currentLogID++}),"uploading"===this.uploadState&&0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}startUpload(){this.uploadState="uploading",0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}async uploadLogs(){const e=this.uploadLogUploadingList,t={sdk_version:an,process_id:hn("PROCESS_ID"),payload:JSON.stringify(e)};return qi((async()=>{const e=await Ar.post(this.url||(this.proxyServerURL?"https://".concat(this.proxyServerURL,"/ls/?h=").concat(hn("LOG_UPLOAD_SERVER"),"&p=443&d=upload/v1"):"https://".concat(hn("LOG_UPLOAD_SERVER"),"/upload/v1")),t,{responseType:"text"});if("OK"!==e.data){const t=new Error("unexpected upload log response");throw t.response=e,t}}),(()=>(this.uploadLogUploadingList=[],!1)),(t=>{const r={status:-1,message:t.message,errorRange:e.map((e=>e.log_item_id))};return t.response?(r.status=t.response.status,r.data=t.response.data,r.headers=t.response.headers):t.request&&(r.status=t.request.status),Sn.reportLogUploadError(r),!0}),{timeout:hn("UPLOAD_LOG_REQUEST_RETRY_INTERVAL"),maxRetryTimeout:hn("UPLOAD_LOG_REQUEST_MAX_RETRY_INTERVAL")})}uploadLogInterval(){0===this.uploadLogUploadingList.length&&0===this.uploadLogWaitingList.length||(0===this.uploadLogUploadingList.length&&(this.uploadLogUploadingList=this.uploadLogWaitingList.splice(0,hn("UPLOAD_LOG_LENGTH_EACH_TIME"))),this.uploadLogs().then((()=>{this.uploadErrorCount=0,this.uploadLogWaitingList.length>0&&window.setTimeout((()=>this.uploadLogInterval()),hn("UPLOAD_LOG_INTERVAL"))})).catch((e=>{this.uploadErrorCount+=1,this.uploadErrorCount<2?window.setTimeout((()=>this.uploadLogInterval()),hn("UPLOAD_LOG_TWICE_RETRY_INTERVAL_V1")):window.setTimeout((()=>this.uploadLogInterval()),hn("UPLOAD_LOG_RETRY_INTERVAL_V1"))})))}};var Cn;(Cn={}).FREE="free",Cn.UPLOADING="uploading",function(e){e[e.MISC=0]="MISC",e[e.INTERNAL_EVENT=1]="INTERNAL_EVENT",e[e.PUBLIC_EVENT=2]="PUBLIC_EVENT",e[e.WEB_EVENT=3]="WEB_EVENT",e[e.INTERNAL_API=4]="INTERNAL_API",e[e.WEB_API=5]="WEB_API",e[e.PUBLIC_API=6]="PUBLIC_API"}({});let Nn=function(e){return e[e.RECOVER=0]="RECOVER",e[e.WARNING=1]="WARNING",e[e.ERROR=2]="ERROR",e}({}),wn=function(e){return e.CONFIG_DISTRIBUTE="config-distribute-error",e}({});const Dn={sid:"",lts:0,success:null,cname:null,uid:null,peer:null,cid:null,elapse:null,extend:null,vid:0};let Pn=function(e){return e.PUBLISH="publish",e.SUBSCRIBE="subscribe",e.WS_COMPRESSOR_INIT="ws_compressor_init",e.SESSION_INIT="session_init",e.JOIN_CHOOSE_SERVER="join_choose_server",e.RTE_DETAIL="rte_detail_stats",e.REQ_USER_ACCOUNT="req_user_account",e.JOIN_GATEWAY="join_gateway",e.REJOIN_GATEWAY="rejoin_gateway",e.STREAM_SWITCH="stream_switch",e.REQUEST_PROXY_WORKER_MANAGER="request_proxy_worker_manager",e.REQUEST_PROXY_APPCENTER="request_proxy_appcenter",e.FIRST_VIDEO_RECEIVED="first_video_received",e.FIRST_AUDIO_RECEIVED="first_audio_received",e.FIRST_VIDEO_DECODE="first_video_decode",e.FIRST_AUDIO_DECODE="first_audio_decode",e.XLA_PEER_FIRST_VIDEO_FRAME="xla_peer_first_video_frame",e.ON_ADD_AUDIO_STREAM="on_add_audio_stream",e.ON_ADD_VIDEO_STREAM="on_add_video_stream",e.ON_UPDATE_STREAM="on_update_stream",e.ON_REMOVE_STREAM="on_remove_stream",e.USER_ANALYTICS="req_user_analytics",e.PC_STATS="pc_stats",e.UPDATE_REMOTE_RTPCAPABILITIES="update_remote_rtpCapabilities",e.AB_TEST="ab_test",e.ALARM_STATUS_NOTIFY="alarm_status_notify",e}({}),Ln=function(e){return e.SESSION="io.agora.pb.Wrtc.Session",e.JOIN_CHOOSE_SERVER="io.agora.pb.Wrtc.JoinChooseServer",e.RTE_DETAIL="io.agora.pb.Wrtc.RteDetailStats",e.REQ_USER_ACCOUNT="io.agora.pb.Wrtc.ReqUserAccount",e.JOIN_GATEWAY="io.agora.pb.Wrtc.JoinGateway",e.RE_JOIN_GATEWAY="io.agora.pb.Wrtc.ReJoinGateway",e.PUBLISH="io.agora.pb.Wrtc.Publish",e.SUBSCRIBE="io.agora.pb.Wrtc.Subscribe",e.WS_COMPRESSOR_INIT="io.agora.pb.Wrtc.WsCompressorInit",e.STREAM_SWITCH="io.agora.pb.Wrtc.StreamSwitch",e.AUDIO_SENDING_STOPPED="io.agora.pb.Wrtc.AudioSendingStopped",e.VIDEO_SENDING_STOPPED="io.agora.pb.Wrtc.VideoSendingStopped",e.REQUEST_PROXY_APPCENTER="io.agora.pb.Wrtc.RequestProxyAppCenter",e.REQUEST_PROXY_WORKER_MANAGER="io.agora.pb.Wrtc.RequestProxyWorkerManager",e.API_INVOKE="io.agora.pb.Wrtc.ApiInvoke",e.FIRST_VIDEO_RECEIVED="io.agora.pb.Wrtc.FirstVideoReceived",e.FIRST_AUDIO_RECEIVED="io.agora.pb.Wrtc.FirstAudioReceived",e.FIRST_VIDEO_DECODE="io.agora.pb.Wrtc.FirstVideoDecode",e.FIRST_AUDIO_DECODE="io.agora.pb.Wrtc.FirstAudioDecode",e.XLA_PEER_FIRST_VIDEO_FRAME="io.agora.pb.Wrtc.XLAPeerFirstVideoFrame",e.ON_ADD_AUDIO_STREAM="io.agora.pb.Wrtc.OnAddAudioStream",e.ON_ADD_VIDEO_STREAM="io.agora.pb.Wrtc.OnAddVideoStream",e.ON_UPDATE_STREAM="io.agora.pb.Wrtc.OnUpdateStream",e.ON_REMOVE_STREAM="io.agora.pb.Wrtc.OnRemoveStream",e.JOIN_CHANNEL_TIMEOUT="io.agora.pb.Wrtc.JoinChannelTimeout",e.PEER_PUBLISH_STATUS="io.agora.pb.Wrtc.PeerPublishStatus",e.WORKER_EVENT="io.agora.pb.Wrtc.WorkerEvent",e.AP_WORKER_EVENT="io.agora.pb.Wrtc.APWorkerEvent",e.JOIN_WEB_PROXY_AP="io.agora.pb.Wrtc.JoinWebProxyAP",e.WEBSOCKET_QUIT="io.agora.pb.Wrtc.WebSocketQuit",e.USER_ANALYTICS="io.agora.pb.Wrtc.UserAnalytics",e.AUTOPLAY_FAILED="io.agora.pb.Wrtc.AutoplayFailed",e.PC_STATS="io.agora.pb.Wrtc.PCStats",e.UPDATE_REMOTE_RTPCAPABILITIES="io.agora.pb.Wrtc.UpdateRemoteRTPCapabilities",e.AB_TEST="io.agora.pb.Wrtc.ABTest",e.ALARM_STATUS_NOTIFY="io.agora.pb.Wrtc.AlarmStatusNotify",e}({});!function(e){e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT"}({});let kn=function(e){return e[e.SESSION=26]="SESSION",e[e.JOIN_CHOOSE_SERVER=27]="JOIN_CHOOSE_SERVER",e[e.REQ_USER_ACCOUNT=196]="REQ_USER_ACCOUNT",e[e.JOIN_GATEWAY=28]="JOIN_GATEWAY",e[e.PUBLISH=30]="PUBLISH",e[e.SUBSCRIBE=29]="SUBSCRIBE",e[e.WS_COMPRESSOR_INIT=9430]="WS_COMPRESSOR_INIT",e[e.STREAM_SWITCH=32]="STREAM_SWITCH",e[e.AUDIO_SENDING_STOPPED=33]="AUDIO_SENDING_STOPPED",e[e.VIDEO_SENDING_STOPPED=34]="VIDEO_SENDING_STOPPED",e[e.REQUEST_PROXY_APPCENTER=35]="REQUEST_PROXY_APPCENTER",e[e.REQUEST_PROXY_WORKER_MANAGER=36]="REQUEST_PROXY_WORKER_MANAGER",e[e.API_INVOKE=41]="API_INVOKE",e[e.FIRST_VIDEO_RECEIVED=348]="FIRST_VIDEO_RECEIVED",e[e.FIRST_AUDIO_RECEIVED=349]="FIRST_AUDIO_RECEIVED",e[e.FIRST_VIDEO_DECODE=350]="FIRST_VIDEO_DECODE",e[e.FIRST_AUDIO_DECODE=351]="FIRST_AUDIO_DECODE",e[e.ON_ADD_AUDIO_STREAM=352]="ON_ADD_AUDIO_STREAM",e[e.ON_ADD_VIDEO_STREAM=353]="ON_ADD_VIDEO_STREAM",e[e.ON_UPDATE_STREAM=356]="ON_UPDATE_STREAM",e[e.ON_REMOVE_STREAM=355]="ON_REMOVE_STREAM",e[e.JOIN_CHANNEL_TIMEOUT=407]="JOIN_CHANNEL_TIMEOUT",e[e.PEER_PUBLISH_STATUS=408]="PEER_PUBLISH_STATUS",e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT",e[e.JOIN_WEB_PROXY_AP=700]="JOIN_WEB_PROXY_AP",e[e.WEBSOCKET_QUIT=671]="WEBSOCKET_QUIT",e[e.USER_ANALYTICS=1e4]="USER_ANALYTICS",e[e.AUTOPLAY_FAILED=9178]="AUTOPLAY_FAILED",e}({});const Mn="[config-restore]",Un="websdk_ng_",xn=Un+"blocked_config_hashes",Vn=Un+"api_failure_records",Fn=Un+"global_parameter",Bn=Un+"config_restore_state";function jn(){try{const e=window.localStorage.getItem(Bn);if(e)return JSON.parse(e)}catch(e){}return{currentConfigHash:"",configVerified:!1}}function Gn(){try{const e=window.localStorage.getItem(Vn);return e?JSON.parse(e):[]}catch(e){return On.debug("[error] ".concat(Mn," error getting API failure records:"),e),[]}}function Wn(){return Gn().reduce(((e,t)=>e+t.count),0)}function Hn(){try{const e=Wn(),t=hn("MAX_CONFIG_RETRY");if(e<t)return;const{currentConfigHash:r}=jn();On.debug("[warning] ".concat(Mn," restoring config due to ").concat(e," API failures")),r&&function(e){try{const t=window.localStorage.getItem(xn);let r=[];t&&(r=JSON.parse(t).configHashes);const i=[...new Set([...r,e])];window.localStorage.setItem(xn,JSON.stringify({configHashes:i,timestamp:Date.now()})),On.debug("[warning] ".concat(Mn," blocked config hash: ").concat(e))}catch(e){On.debug("[error] ".concat(Mn," error blocking config hash:"),e)}}(r),window.localStorage.removeItem(Fn);const i=Gn().slice(-5);(function(e,t){zn.reportAlarm(e,t)})(null,{status:Nn.ERROR,type:wn.CONFIG_DISTRIBUTE,message:"Config cache cleared due to API failures",extend:{failureCount:e,maxRetry:t,blockedConfigHash:r,recentFailures:i.map((e=>({api:e.apiName,error:e.errorCode||e.errorMessage,count:e.count,lastTime:e.lastTimestamp})))}}),function(){try{window.localStorage.removeItem(Vn)}catch(e){On.debug("[error] ".concat(Mn," error clearing API failure records:"),e)}}()}catch(e){On.debug("[error] ".concat(Mn," error restoring config:"),e)}}function Kn(e,t){try{if(!hn("ENABLE_CONFIG_RESTORE"))return;if(t&&"AgoraRTCException"===t.name){const e=hn("CONFIG_ERROR_MONITOR");if(!Array.isArray(e)||!e.includes(t.code))return}const r=window.localStorage.getItem(Fn);if(!r||r.length<20)return;const{configVerified:i}=jn();if(i)return;const n=hn("CONFIG_RESTORE_ERROR_API");if(!Array.isArray(n)||!n.includes(e))return;let o,s;t&&(t.code&&(o=t.code),s=t.message?t.message:"string"==typeof t?t:t.toString()),function(e,t,r){try{const i=Gn(),n="".concat(e,":").concat(t||""),o=i.find((e=>"".concat(e.apiName,":").concat(e.errorCode||"")===n)),{currentConfigHash:s}=jn();if(o)o.count++,o.lastTimestamp=Date.now(),r&&(o.errorMessage=r),s&&(o.configHash=s);else{const n=Date.now();i.push({apiName:e,errorCode:t,errorMessage:r,count:1,firstTimestamp:n,lastTimestamp:n,configHash:s||void 0})}const a=i.length>20?i.slice(-20):i;window.localStorage.setItem(Vn,JSON.stringify(a))}catch(e){On.debug("[error] ".concat(Mn," error saving API failure record:"),e)}}(e,o,s);const a=Wn(),c=hn("MAX_CONFIG_RETRY");On.debug("".concat(Mn," API failure count: ").concat(a,"/").concat(c,", API: ").concat(e,", Error: ").concat(o||s)),a>=c&&Hn()}catch(e){}}function Yn(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,r,i){const n=i.value;if("function"==typeof n){const o=e.className||t.__className__||("AgoraRTCClient"===t.constructor.name?"Client":t.constructor.name);i.value=function(){for(var t,i=arguments.length,s=new Array(i),a=0;a<i;a++)s[a]=arguments[a];let c=s;if(e.argsMap)try{c=e.argsMap(this,...s)}catch(e){On.warning(e),c=[]}try{JSON.stringify(c)}catch(e){On.warning("arguments for method ".concat(o,".").concat(String(r)," not serializable for apiInvoke.")),c=[]}const d=(e.report||zn).reportApiInvoke(this._sessionId||null,{id:this._clientId||(null===(t=this.store)||void 0===t?void 0:t.clientId)||this._ID,name:"".concat(o,".").concat(String(r)),options:c,tag:gi.TRACER,reportResult:e.reportResult},e.throttleTime);try{const t=n.apply(this,s);return t instanceof Promise?t.then((t=>(d.onSuccess(e.reportResult&&t),t))).catch((e=>{throw d.onError(e),e})):(d.onSuccess(e.reportResult&&t),t)}catch(e){throw d.onError(e),e}}}return i}}const zn=new class{constructor(){En(this,"baseInfoMap",new Map),En(this,"proxyServer",void 0),En(this,"eventUploadTimer",void 0),En(this,"setSessionIdTimer",void 0),En(this,"url",void 0),En(this,"sids",new Set),En(this,"backupUrl",void 0),En(this,"_appId",void 0),En(this,"_aid",0),En(this,"keyEventUploadPendingItems",[]),En(this,"normalEventUploadPendingItems",[]),En(this,"apiInvokeUploadPendingItems",[]),En(this,"apiInvokeCount",0),En(this,"apiInvokeLoggedCount",0),En(this,"ltsList",[]),En(this,"lastSendNormalEventTime",Date.now()),En(this,"customReportCounterTimer",void 0),En(this,"customReportCount",0),En(this,"extApiInvoke",(async e=>{for(const t of e){const e=_n(_n({},t),{},{sid:null,invokeId:++this.apiInvokeCount,tag:gi.TRACER});this.sendApiInvoke(e)}})),this.eventUploadTimer=window.setInterval(this.doSend.bind(this),hn("EVENT_REPORT_SEND_INTERVAL")),this.setSessionIdTimer=window.setInterval(this.appendSessionId.bind(this),hn("EVENT_REPORT_SEND_INTERVAL"))}getBaseInfoBySessionId(e){return this.baseInfoMap.get(e)}setAppId(e){this._appId=e,this._aid=parseInt(e.replace(/[a-fA-F0-9]{8}/g,(e=>{let[t,r]=e;return t+r})),16)||0}reportApiInvoke(e,t,r){t.timeout=t.timeout||6e4,t.reportResult=void 0===t.reportResult||t.reportResult;const i=Date.now();this.apiInvokeCount+=1;const n=this.apiInvokeCount,o=!!hn("SHOW_REPORT_INVOKER_LOG"),s=!!hn("SHOW_REPORT_USER_INVOKER_LOG"),a=o||s&&t.id;a&&(this.apiInvokeLoggedCount+=1);const c=this.apiInvokeLoggedCount;function d(e,r){if(a){let i="[apiInvoke-".concat(c,"]");if(t.id&&(i+="[".concat(t.id,"]")),t.name&&(i+="[".concat(t.name,"]"),t.name===Ti.JOIN))return On.info("".concat(i," ").concat(e));On.info("".concat(i," ").concat(e),"start"===e?t.options:r||"")}}const u=()=>({tag:t.tag,invokeId:n,sid:e,name:t.name,apiInvokeTime:i,options:t.options,states:t.states||null});d("start");let l=!1;Vi(t.timeout).then((()=>{l||(this.sendApiInvoke(_n(_n({},u()),{},{error:ii.API_INVOKE_TIMEOUT,success:!1})),d("timeout"),Kn(t.name,new ni(ii.API_INVOKE_TIMEOUT)))}));const h=new ni(ii.UNEXPECTED_ERROR,"".concat(t.name,": this api invoke is end"));return{onSuccess:e=>{const i=()=>{if(l)throw h;return l=!0,this.sendApiInvoke(_n(_n({},u()),{},{success:!0},t.reportResult&&{result:e})),d("onSuccess"),e};return r?Gi(i,t.name+"Success",r,(()=>l=!0)):i()},onError:e=>{const i=()=>{if(l)throw e;l=!0,this.sendApiInvoke(_n(_n({},u()),{},{success:!1,error:e})),Kn(t.name,e),d("onFailure",e.toString())};return r?Gi(i,t.name+"Error",r,(()=>l=!0)):i()}}}_send(e,t,r){this.send({type:e,data:t},r)}_sendApiInvoke(e){return this.sendApiInvoke(e)}sessionInit(e,t){if(this.baseInfoMap.has(e))return;const r=Date.now(),i=this.createBaseInfo(e,r);i.cname=t.cname,i.rteUrl=t.rteUrl;const n=Object.assign({},{willUploadConsoleLog:hn("UPLOAD_LOG"),maxTouchPoints:navigator.maxTouchPoints,areaVersion:cn?"global":"oversea",areas:hn("AREAS")&&hn("AREAS").join(",")},t.extend),{stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:d,clientRole:u}=t,l=Date.now(),h=_n(_n({},i),{},{eventType:Pn.SESSION_INIT,appid:t.appid,browser:navigator.userAgent,buildFormat:t.buildFormat,build:"v4.24.3-0-g6cc16b0bb-dirty(3/16/2026, 4:35:55 PM)",lts:l,elapse:l-r,extend:JSON.stringify(n),mode:t.mode,process:hn("PROCESS_ID"),appType:hn("APP_TYPE"),success:!0,version:an,stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:d,clientType:window.navigator.userAgent.includes("AgoraWebView")?42:20,clientRole:u,serviceId:hn("PROCESS_ID"),extensionID:hn("PLUGIN_INFO").join(",")||"",rteUrl:t.rteUrl,rteSid:t.rteSid,installId:sn()});this.send({type:Ln.SESSION,data:h},!0)}reportRteDetail(e){const t=this.baseInfoMap.get(e);if(!t)return;const r=t.info,i=Date.now(),n=_n(_n({},r),{},{eventType:Pn.RTE_DETAIL,lts:i,success:!0,elapse:i-t.startTime,vid:void 0===r.vid?0:Number(r.vid),ua:navigator.userAgent});this.send({type:Ln.RTE_DETAIL,data:n},!0)}joinChooseServer(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info;t.vid&&(i.vid=t.vid);const n=Date.now(),o=_n(_n({},i),{},{role:t.role,eventType:Pn.JOIN_CHOOSE_SERVER,lts:n,eventElapse:t.elapse||n-t.lts,chooseServerAddr:t.csAddr,errorCode:t.ec,elapse:n-r.startTime,success:t.succ,chooseServerAddrList:JSON.stringify(t.serverList),uid:t.uid?parseInt(t.uid):null,cid:t.cid?parseInt(t.cid):null,chooseServerIp:t.csIp||"",opid:t.opid,unilbsServerIds:t.unilbsServerIds,extend:t.extend||void 0,isHttp3:t.isHttp3,corssRegionTagReq:t.corssRegionTagReq||void 0,corssRegionTagRes:t.corssRegionTagRes||void 0,ua:navigator.userAgent,resourceTimingInfo:t.resourceTimingInfo||void 0});this.send({type:Ln.JOIN_CHOOSE_SERVER,data:o},!0)}reqUserAccount(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=_n(_n({},i),{},{eventType:Pn.REQ_USER_ACCOUNT,lts:n,success:t.success,serverAddress:t.serverAddr,stringUid:t.stringUid,uid:t.uid,errorCode:t.errorCode,elapse:t.elapse||n-r.startTime,eventElapse:n-t.lts,extend:JSON.stringify(t.extend)});this.send({type:Ln.REQ_USER_ACCOUNT,data:o},!0)}joinGateway(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info;t.vid&&(i.vid=t.vid),i.uid=t.uid,i.cid=t.cid;const n=Date.now(),{firstSuccess:o,addr:s,isProxy:a}=t,c=n-r.startTime,d=_n(_n({},i),{},{eventType:Pn.JOIN_GATEWAY,lts:n,gatewayAddr:t.addr,success:t.succ,errorCode:t.ec,errorMsg:t.errorMsg||"",elapse:c,eventElapse:n-t.lts,firstSuccess:o,signalChannel:t.signalChannel,preload:t.preload?1:0,installId:sn(),isABTestSuccess:t.isABTestSuccess?1:0,gatewayIp:null,gatewayPort:null,isProxy:a?1:0}),u=d.success?1:0;if(t.succ&&(r.lastJoinSuccessTime=n),s)if("1"===d.signalChannel){const e=gn(/(\d+\.\d+\.\d+\.\d+):(\d+)/,{ip:1,port:2}),t=s.match(e);d.gatewayIp=t&&t.groups?t.groups.ip:"",d.gatewayPort=t&&t.groups?t.groups.port:""}else if(a){const e=s.match(/h=(\d{1,3}-){3}\d{1,3}/g),t=s.match(/p=[0-9]{1,6}/g);d.gatewayIp=e&&e.length?e[0].split("=")[1].replace(/-/g,"."):"",d.gatewayPort=t&&t.length?t[0].split("=")[1]:""}else{const e=s.match(/wss:\/\/(\d{1,3}-){3}\d{1,3}/g),t=s.match(/(:|p=)[0-9]{1,6}/g);d.gatewayIp=e&&e.length?e[0].split("//")[1].replace(/-/g,"."):"",d.gatewayPort=t&&t.length?t[0].split(/:|p=/g)[1]:""}if(o)this.send({type:Ln.JOIN_GATEWAY,data:d},!0);else{const e={isSuccess:u,port:d.gatewayPort};delete d.success,delete d.eventType,delete d.firstSuccess,delete d.gatewayPort,d.vid=Number(d.vid);const t=Object.assign({},d,e,{eventType:Pn.REJOIN_GATEWAY});this.send({type:Ln.RE_JOIN_GATEWAY,data:t},!0)}}joinChannelTimeout(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=Date.now(),n=_n(_n({},r.info),{},{lts:i,timeout:t,elapse:i-r.startTime});this.send({type:Ln.JOIN_CHANNEL_TIMEOUT,data:n},!0)}publish(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=_n(_n({},i),{},{eventType:Pn.PUBLISH,lts:n,eventElapse:t.eventElapse,elapse:n-r.startTime,success:t.succ,errorCode:t.ec,videoName:t.videoName,audioName:t.audioName,screenName:t.screenName,screenshare:t.screenshare,audio:t.audio,video:t.video,p2pid:t.p2pid,publishRequestid:t.publishRequestid});this.send({type:Ln.PUBLISH,data:o},!0)}subscribe(e,t,r){const i=this.baseInfoMap.get(e);if(!i)return;const n=i.info,o=Date.now(),s=_n(_n({},n),{},{eventType:Pn.SUBSCRIBE,lts:o,eventElapse:t.eventElapse,elapse:o-i.startTime,success:t.succ,errorCode:t.ec,video:t.video,audio:t.audio,subscribeRequestid:t.subscribeRequestid,p2pid:t.p2pid,preSsrc:t.preSsrc?1:0},r&&{extend:JSON.stringify({isMassSubscribe:!0})});"string"==typeof t.peerid?s.peerSuid=t.peerid:s.peer=t.peerid,this.send({type:Ln.SUBSCRIBE,data:s},!0)}wsCompressorInit(e){const t=[...this.baseInfoMap.keys()],r=t.length?t[0]:"UnableToGetSid",i=this.baseInfoMap.get(r);if(!i)return;const n=i.info,o=Date.now(),s=_n(_n({},n),{},{eventType:Pn.WS_COMPRESSOR_INIT,lts:o,eventElapse:e.eventElapse,elapse:o-i.startTime,status:e.status?1:2});this.send({type:Ln.WS_COMPRESSOR_INIT,data:s},!0)}firstXLAPeerFirstVideoFrame(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=t.peerPubStatusMs-(r.lastJoinSuccessTime||n),s=_n(_n({},i),{},{elapse:n-r.startTime,eventType:Pn.XLA_PEER_FIRST_VIDEO_FRAME,lts:n,peer:t.peer,width:t.width,height:t.height,ssrc:t.ssrc,p2pid:t.p2pid,peerPublishDuration:t.peerPublishDuration,joinChannelSuccessElapse:o,peerPubStatusMs:t.peerPubStatusMs-t.joinChannelStart,availablePublish:t.peerPublishDuration>o?1:0,preloadStart:Math.max(t.preloadStart-t.joinChannelStart,0),preloadEnd:Math.max(t.preloadEnd-t.joinChannelStart,0),encrypt:Math.max(t.apStart-t.joinChannelStart,0),ap:Math.max(t.apEnd-t.joinChannelStart,0),sua:Math.max(t.suaEnd-t.joinChannelStart,0),beforeConnect:Math.max(t.beforeConnect-t.joinChannelStart,0),peerRecevier:Math.max(t.peerReceiver-t.joinChannelStart,0),ice:Math.max(t.ice-t.joinChannelStart,0),pc:Math.max(t.pc-t.joinChannelStart,0),signalConnected:Math.max(t.signalConnected-t.joinChannelStart,0),joinReq:Math.max(t.joinReq-t.joinChannelStart,0),joinRes:Math.max(t.joinRes-t.joinChannelStart,0),userJoinNotify:Math.max(t.userJoinNotify-t.joinChannelStart,0),videoSsrcNotify:Math.max(t.videoAddNotify-t.joinChannelStart,0),subscribeDelayMs:Math.max(t.subscribeStart-t.videoAddNotify,0),subscribeStart:Math.max(t.subscribeStart-t.joinChannelStart,0),subscribeEnd:Math.max(t.subscribeEnd-t.joinChannelStart,0),firstReceived:Math.max(t.firstReceived-t.joinChannelStart,0),firstDecoded:Math.max(t.firstDecoded-t.joinChannelStart,0),firstPreRender:Math.max(t.firstPreRender-t.joinChannelStart,0),firstRender:Math.max(t.firstRender-t.joinChannelStart,0),playDelayMs:Math.max(t.playStart-t.subscribeEnd,0),playStart:Math.max(t.playStart-t.joinChannelStart,0),playEnd:Math.max(t.playEnd-t.joinChannelStart,0),isPreSub:t.isPreSub?1:0,isPrePc:t.isPrePc?1:0,isPreInstantVideo:t.isPreInstantVideo?1:0,firstReceivedEncodedFrame:t.firstReceivedEncodedFrame?Math.max(t.firstReceivedEncodedFrame-t.joinChannelStart,0):void 0,frameType:t.frameType||"",rtpTimestamp:t.rtpTimestamp||0,framePayloadType:t.framePayloadType||0,frameDataLength:t.frameDataLength||0,mimeType:t.mimeType||"",sdpEndPoint:t.sdpEndPoint?1:0});this.send({type:Ln.XLA_PEER_FIRST_VIDEO_FRAME,data:s},!0)}firstRemoteVideoDecode(e,t,r,i){const n=this.baseInfoMap.get(e);if(!n)return;const o=n.info,s=Date.now(),a=_n(_n(_n({},o),i),{},{elapse:s-n.startTime,eventType:t,lts:s,firstDecodeFrame:Math.max((i.firstFrame||s)-n.startTime,0),apEnd:Math.max(i.apEnd-n.startTime,0),apStart:Math.max(i.apStart-n.startTime,0),joinGwEnd:Math.max(i.joinGwEnd-n.startTime,0),joinGwStart:Math.max(i.joinGwStart-n.startTime,0),pcEnd:Math.max(i.pcEnd-n.startTime,0),pcStart:Math.max(i.pcStart-n.startTime,0),subscriberEnd:Math.max(i.subscriberEnd-n.startTime,0),subscriberStart:Math.max(i.subscriberStart-n.startTime,0),videoAddNotify:Math.max(i.videoAddNotify-n.startTime,0)});this.send({type:r,data:a},!0)}firstRemoteFrame(e,t,r,i){const n=this.baseInfoMap.get(e);if(!n)return;const o=n.info,s=Date.now(),a=_n(_n(_n({},o),i),{},{elapse:s-n.startTime,eventType:t,lts:s});this.send({type:r,data:a},!0)}abTest(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=_n(_n(_n({},i),t),{},{vid:void 0===i.vid?0:Number(i.vid),elapse:n-r.startTime,eventType:Pn.AB_TEST,lts:n});this.send({type:Ln.AB_TEST,data:o},!0)}pcStats(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=_n(_n(_n({},i),t),{},{vid:void 0===i.vid?0:Number(i.vid),elapse:n-r.startTime,eventType:Pn.PC_STATS,lts:n,preallocation:t.preallocation?1:0});this.send({type:Ln.PC_STATS,data:o},!0)}updateRemoteRTPCapabilities(e,t){if(e){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=_n(_n(_n({},i),t),{},{vid:void 0===i.vid?0:Number(i.vid),eventType:Pn.UPDATE_REMOTE_RTPCAPABILITIES,lts:n});this.send({type:Ln.UPDATE_REMOTE_RTPCAPABILITIES,data:o},!0)}}onGatewayStream(e,t,r,i){const n=this.baseInfoMap.get(e);if(!n)return;const o=n.info,s=Date.now(),a=_n(_n(_n({},o),i),{},{eventType:t,lts:s});this.send({type:r,data:a},!0)}streamSwitch(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=_n(_n({},i),{},{eventType:Pn.STREAM_SWITCH,lts:n,isDual:t.isdual,elapse:n-r.startTime,success:t.succ});this.send({type:Ln.STREAM_SWITCH,data:o},!0)}requestProxyAppCenter(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=_n(_n({},i),{},{eventType:Pn.REQUEST_PROXY_APPCENTER,lts:n,eventElapse:n-t.lts,elapse:n-r.startTime,APAddr:t.APAddr,workerManagerList:t.workerManagerList,response:t.response,errorCode:t.ec,success:t.succ});this.send({type:Ln.REQUEST_PROXY_APPCENTER,data:o},!0)}requestProxyWorkerManager(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=_n(_n({},i),{},{eventType:Pn.REQUEST_PROXY_WORKER_MANAGER,lts:n,eventElapse:n-t.lts,elapse:n-r.startTime,workerManagerAddr:t.workerManagerAddr,response:t.response,errorCode:t.ec,success:t.succ});this.send({type:Ln.REQUEST_PROXY_WORKER_MANAGER,data:o},!0)}setProxyServer(e){this.proxyServer=e,e?On.debug("reportProxyServerurl: ".concat(e)):On.debug("disable reportProxyServerurl: ".concat(e))}peerPublishStatus(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=_n(_n({},i),{},{subscribeElapse:t.subscribeElapse,peer:t.peer,peerPublishDuration:Math.max(t.audioPublishDuration,t.videoPublishDuration),audiotag:t.audioPublishDuration>0?1:-1,videotag:t.videoPublishDuration>0?1:-1,lts:n,elapse:n-r.startTime,joinChannelSuccessElapse:n-(r.lastJoinSuccessTime||n),peerPublishDurationVideo:t.videoPublishDuration,peerPublishDurationAudio:t.audioPublishDuration});this.send({type:Ln.PEER_PUBLISH_STATUS,data:o},!0)}workerEvent(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now();(function(e,t,r){const i=e[t];if(!i||"string"!=typeof i)return[e];e[t]="";const n=xi(JSON.stringify(e));let o=0;const s=[];let a=0;for(let c=0;c<i.length;c++)a+=i.charCodeAt(c)<=127?1:3,a<=r-n||(s[s.length]=ri(ri({},e),{},{[t]:i.substring(o,c)}),o=c,a=i.charCodeAt(c)<=127?1:3);return o!==i.length-1&&(s[s.length]=ri(ri({},e),{},{[t]:i.substring(o)})),s})(_n(_n(_n({},i),t),{},{elapse:n-r.startTime,lts:n,productType:"WebRTC"}),"payload",1300).forEach((e=>this.send({type:Ln.WORKER_EVENT,data:e},!0)))}apworkerEvent(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=_n(_n(_n({},i),t),{},{elapse:n-r.startTime,lts:n});this.send({type:Ln.AP_WORKER_EVENT,data:o},!0)}joinWebProxyAP(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=_n(_n(_n({},i),t),{},{elapse:n-r.startTime,lts:n,extend:t.extend||void 0});this.send({type:Ln.JOIN_WEB_PROXY_AP,data:o},!0)}WebSocketQuit(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=_n(_n(_n({},i),t),{},{elapse:n-r.startTime,lts:n});this.send({type:Ln.WEBSOCKET_QUIT,data:o},!0)}async sendCustomReportMessage(e,t){if(this.customReportCount+=t.length,this.customReportCount>hn("CUSTOM_REPORT_LIMIT"))throw new ni(ii.CUSTOM_REPORT_FREQUENCY_TOO_HIGH);this.customReportCounterTimer||(this.customReportCounterTimer=window.setInterval((()=>{this.customReportCount=0}),5e3));const r=Date.now(),i=t.map((t=>({type:Ln.USER_ANALYTICS,data:_n(_n({sid:e},t),{},{lts:r})})));try{hn("NEW_REPORT_SERVER")?await this.postDataToStatsCollector2(i):await this.postDataToStatsCollector(i)}catch(e){throw On.error("send custom report message failed",e.toString()),new ni(ii.CUSTOM_REPORT_SEND_FAILED,e.message)}}reportAlarm(e,t){const r=e?this.baseInfoMap.get(e):void 0,i=null==r?void 0:r.info,n=Date.now(),o=_n(_n(_n({},i),t),{},{vid:void 0===(null==i?void 0:i.vid)?0:Number(i.vid),elapse:r?n-r.startTime:0,eventType:Pn.ALARM_STATUS_NOTIFY,lts:n,installId:sn(),processId:hn("PROCESS_ID")});this.send({type:Ln.ALARM_STATUS_NOTIFY,data:o},!0)}sendApiInvoke(e){const t=hn("NOT_REPORT_EVENT");if(e.tag&&t.includes&&t.includes(e.tag))return!1;if(null===e.sid)return this.apiInvokeUploadPendingItems.push(e),!1;const r=this.baseInfoMap.get(e.sid);if(!r)return this.apiInvokeUploadPendingItems.push(e),!1;const{cname:i,uid:n,cid:o}=r.info;let s;if(e.lts=e.lts||Date.now(),e.error)if(e.error instanceof ni){const{code:t,message:r}=e.error;s=t||r||e.error.toString()}else s=e.error.toString();const a={invokeId:e.invokeId,sid:e.sid,cname:i,cid:o,uid:n,lts:e.lts,success:e.success,elapse:e.lts-r.startTime,execElapse:e.lts-e.apiInvokeTime,apiName:e.name,options:e.options?JSON.stringify(e.options):void 0,execStates:e.states?JSON.stringify(e.states):void 0,execResult:e.result?JSON.stringify(e.result):void 0,errorCode:e.error?s:void 0,errorMsg:e.error?JSON.stringify(e.error):void 0};return this.send({type:Ln.API_INVOKE,data:a},!1),!0}addSid(e){this.sids.add(e)}removeSid(e){this.sids.delete(e)}appendSessionId(){const e=this.apiInvokeUploadPendingItems;if(0===e.length)return;const t=Array.from(this.sids).find((e=>null!==e));t&&e.forEach((e=>{e&&(e.sid=t,this.sendApiInvoke(Object.assign({},e)))})),e.length=0}send(e,t){if(t)return this.keyEventUploadPendingItems.push(e),void this.sendItems(this.keyEventUploadPendingItems,!0);this.normalEventUploadPendingItems.push(e),this.normalEventUploadPendingItems.length>hn("NORMAL_EVENT_QUEUE_CAPACITY")&&this.normalEventUploadPendingItems.splice(0,1),this.normalEventUploadPendingItems.length>=10&&this.sendItems(this.normalEventUploadPendingItems,!1)}doSend(){this.keyEventUploadPendingItems.length>0&&this.sendItems(this.keyEventUploadPendingItems,!0),this.normalEventUploadPendingItems.length>0&&Date.now()-this.lastSendNormalEventTime>=5e3&&this.sendItems(this.normalEventUploadPendingItems,!1)}sendItems(e,t){const r=[],i=[];for(;e.length;){const t=e.shift();r.length<20?r.push(t):i.push(t)}e.push(...i);for(const e of[...r])-1!==this.ltsList.indexOf(e.data.lts)?(e.data.lts=this.ltsList[this.ltsList.length-1]+1,this.ltsList.push(e.data.lts)):(this.ltsList.push(e.data.lts),this.ltsList.sort(((e,t)=>e-t)));return t||(this.lastSendNormalEventTime=Date.now()),hn("ENABLE_EVENT_REPORT")?(r.length&&(hn("NEW_REPORT_SERVER")?this.postDataToStatsCollector2(r):this.postDataToStatsCollector(r)).catch((e=>r=>{hn("EVENT_REPORT_RETRY")&&(t?this.keyEventUploadPendingItems=this.keyEventUploadPendingItems.concat(e):(this.normalEventUploadPendingItems=this.normalEventUploadPendingItems.concat(e),this.normalEventUploadPendingItems.length>hn("NORMAL_EVENT_QUEUE_CAPACITY")&&(this.normalEventUploadPendingItems.splice(0,this.normalEventUploadPendingItems.length-hn("NORMAL_EVENT_QUEUE_CAPACITY")),On.warning("report: drop normal events"))))})(r)),e):e}async postDataToStatsCollector2(e){bi.networkState===Si.OFFLINE&&await Promise.race([bi.onlineWaiter,Vi(2*Qi.maxRetryTimeout)]);const t=e=>{let t=new Uint8Array;return e.forEach((e=>{const r=function(e){return(new TextEncoder).encode(e)}(JSON.stringify(e.data)),i=new ArrayBuffer(5),n=(e=>{let t=0;return Object.entries(Ln).forEach((r=>{let[i,n]=r;n===e.type&&(t=kn[i])})),t})(e),o=new DataView(i);o.setUint16(0,r.byteLength,!0),o.setUint8(2,255&n),o.setUint8(3,n>>>8&255),o.setUint8(4,n>>>16&255),t=pi(t,new Uint8Array(i)),t=pi(t,r)})),t},r="event";let i=this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(hn("NEW_REPORT_SERVER_DOMAINS")[0],"&p=443&d=").concat(r):"https://".concat(hn("NEW_REPORT_SERVER_DOMAINS")[0],"/").concat(r);for(let n=0;n<2;n+=1){1===n&&(i=this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(hn("NEW_REPORT_SERVER_DOMAINS")[1],"&p=443&d=").concat(r):"https://".concat(hn("NEW_REPORT_SERVER_DOMAINS")[1],"/").concat(r));try{await tn(i,{timeout:1e4,data:t(e),headers:_n(_n({biz:"webrtc",sendts:Math.round(Date.now()/1e3),debug:"false"},this._appId&&{appid:this._appId}),{},{"Content-Type":"application/octet-stream"})},!0)}catch(e){if(1===n)throw e;continue}return}}async postDataToStatsCollector(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=(e=>{const t=e&&e.data.sid&&this.baseInfoMap.get(e.data.sid);return t&&t.info.vid&&+t.info.vid||0})(e[0]),i=r?void 0:this._aid,n={msgType:"EventMessages",sentTs:Math.round(Date.now()/1e3),payloads:e.map((e=>JSON.stringify(e))),vid:r,aid:i};bi.networkState===Si.OFFLINE&&await Promise.race([bi.onlineWaiter,Vi(2*Qi.maxRetryTimeout)]);const o=t?"/events/proto-raws":"/events/messages";let s=this.url||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(hn("EVENT_REPORT_DOMAIN"),"&p=").concat(hn("STATS_COLLECTOR_PORT"),"&d=").concat(o):"https://".concat(hn("EVENT_REPORT_DOMAIN"),":").concat(hn("STATS_COLLECTOR_PORT")).concat(o));for(let e=0;e<2;e+=1){1===e&&(s=this.backupUrl||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(hn("EVENT_REPORT_BACKUP_DOMAIN"),"&p=").concat(hn("STATS_COLLECTOR_PORT"),"&d=").concat(o):"https://".concat(hn("EVENT_REPORT_BACKUP_DOMAIN"),":").concat(hn("STATS_COLLECTOR_PORT")).concat(o)));try{t?await rn(s,{timeout:1e4,data:n}):await tn(s,{timeout:1e4,data:n})}catch(t){if(1===e)throw t;continue}return}}createBaseInfo(e,t){const r=Object.assign({},Dn);return r.sid=e,this.baseInfoMap.set(e,{info:r,startTime:t}),r}reportResourceTiming(e,t){const r=performance.getEntriesByName(e),i=r[r.length-1];i&&this.reportApiInvoke(t,{name:"Client.resourceTiming",options:i,tag:gi.TRACER}).onSuccess()}};Sn.on("REPORT_LOG_UPLOAD",(e=>{e.networkState=bi.networkState,zn.reportApiInvoke(null,{name:"logUploadError",options:e,tag:gi.TRACER}).onSuccess("logUploadError")}));const Xn={getDisplayMedia:!1,getStreamFromExtension:!1,supportUnifiedPlan:!1,supportMinBitrate:!1,supportSetRtpSenderParameters:!1,supportDualStream:!0,webAudioMediaStreamDest:!1,supportReplaceTrack:!1,supportWebGL:!1,webAudioWithAEC:!1,supportRequestFrame:!1,supportShareAudio:!1,supportDualStreamEncoding:!1,supportDataChannel:!1,supportPCSetConfiguration:!1,supportWebRTCEncodedTransform:!1,supportWebRTCInsertableStream:!1,supportRequestVideoFrameCallback:!1,supportWebCrypto:!1,supportSuppressLocalAudioPlayback:!1,supportRestrictOwnAudio:!1};function Zn(){const e=wr();Xn.getDisplayMedia=function(e){if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return!0;return!1}(),Xn.getStreamFromExtension=e.name===Ir.CHROME&&Number(e.version)>34,Xn.supportUnifiedPlan=function(){if(!window.RTCRtpTransceiver)return!1;if(!("currentDirection"in RTCRtpTransceiver.prototype))return!1;const e=new RTCPeerConnection;let t=!1;try{e.addTransceiver("audio"),t=!0}catch(e){}return e.close(),t}(),Xn.supportMinBitrate=e.name===Ir.CHROME||e.name===Ir.EDGE,Xn.supportSetRtpSenderParameters=function(){const e=wr();if(!window.RTCRtpSender||!window.RTCRtpSender.prototype.setParameters||!window.RTCRtpSender.prototype.getParameters)return!1;return!!Qr()||(!(!Ur()&&!kr())||e.name===Ir.FIREFOX&&Number(e.version)>=64)}(),e.name===Ir.SAFARI&&(Number(e.version)>=14?Xn.supportDualStream=!0:Xn.supportDualStream=!1),Xn.webAudioMediaStreamDest=function(){const e=wr();if(e.name===Ir.SAFARI&&Number(e.version)<12)return!1;return!0}(),Xn.supportReplaceTrack=function(){if(!window.RTCRtpSender)return!1;if("function"==typeof RTCRtpSender.prototype.replaceTrack)return!0;return!1}(),Xn.supportWebGL="undefined"!=typeof WebGLRenderingContext,Xn.supportRequestFrame=!!window.CanvasCaptureMediaStreamTrack,Qr()||(Xn.webAudioWithAEC=!0),Xn.supportShareAudio=function(){const e=wr();if((e.os===br.WIN_10||e.os===br.WIN_81||e.os===br.WIN_7||e.os===br.LINUX||e.os===br.MAC_OS||e.os===br.CHROMIUM_OS)&&e.name===Ir.CHROME&&Number(e.version)>=74)return!0;return!1}(),Xn.supportDataChannel=function(){if(Br(76)||Wr(68)||function(e){const t=wr();return!(t.name!==Ir.SAFARI||!t.osVersion)&&Number(t.version)>=e}(14))return!0;return!1}(),Xn.supportPCSetConfiguration=function(){const e=window.RTCPeerConnection;return!Vr()&&!!e&&e.prototype.setConfiguration instanceof Function}(),Xn.supportWebRTCEncodedTransform=Br(87)||function(){const e=wr();if(e.name!==Ir.SAFARI||!e.browserVersion)return!1;const t=e.browserVersion.split(".");return Number(t[0])>15||15===Number(t[0])&&Number(t[1])>=4}()||Wr(117),Xn.supportWebRTCInsertableStream=function(){const e=wr();return(e.name===Ir.CHROME||e.name===Ir.EDGE)&&Number(e.version)>=94&&"MediaStreamTrackGenerator"in window&&"MediaStreamTrackProcessor"in window}(),Xn.supportRequestVideoFrameCallback=function(){if("requestVideoFrameCallback"in HTMLVideoElement.prototype)return!0;return!1}(),Xn.supportWebCrypto="undefined"!=typeof window&&void 0!==window.crypto&&void 0!==window.crypto.subtle,Xn.supportSuppressLocalAudioPlayback=eo(),Xn.supportRestrictOwnAudio=to(),Pi((()=>{Xn.supportDualStreamEncoding=function(){const e=wr();if(hn("DISABLE_WEBAUDIO"))return!0;return"Safari"===e.name&&Number(e.version)>=14||!!("Chrome"===e.name&&/Windows/i.test(e.os||"")&&Number(e.version)>=100&&hn("CHROME_DUAL_STREAM_USE_ENCODING"))}(),On.debug("browser ua: ",navigator.userAgent),On.info("browser info: ",e),On.info("browser compatibility: ",Xn)}))}function Jn(){return Xn}function Qn(){return"setSinkId"in HTMLAudioElement.prototype&&(!hn("RESTRICTION_SET_PLAYBACK_DEVICE")||(Mr()||xr())&&!Jr())}function qn(){return!Xn.supportUnifiedPlan||hn("CHROME_FORCE_PLAN_B")&&Qr()}function $n(){return navigator.mediaDevices&&"getSupportedConstraints"in navigator.mediaDevices}function eo(){if($n()){const e=navigator.mediaDevices.getSupportedConstraints();return!(!("suppressLocalAudioPlayback"in e)||!e.suppressLocalAudioPlayback)}return Br(141)||Gr(141)||Hr(141)}function to(){if($n()){const e=navigator.mediaDevices.getSupportedConstraints();return!(!("restrictOwnAudio"in e)||!e.restrictOwnAudio)}return Br(141)||Gr(141)||Hr(125)}let ro=function(e){return e.IOS_15_16_INTERRUPTION_START="ios15_16-interruption-start",e.IOS_15_16_INTERRUPTION_END="ios15_16-interruption-end",e.IOS_INTERRUPTION_START="ios-interruption-start",e.IOS_INTERRUPTION_END="ios-interruption-end",e.STATE_CHANGE="state-change",e}({});var io=function(e){try{return!!e()}catch(e){return!0}},no=!io((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),oo=no,so=Function.prototype,ao=so.call,co=oo&&so.bind.bind(ao,ao),uo=oo?co:function(e){return function(){return ao.apply(e,arguments)}},lo=uo({}.isPrototypeOf),ho=function(e){return e&&e.Math==Math&&e},po=ho("object"==typeof globalThis&&globalThis)||ho("object"==typeof window&&window)||ho("object"==typeof self&&self)||ho("object"==typeof X&&X)||function(){return this}()||X||Function("return this")(),fo=no,Eo=Function.prototype,mo=Eo.apply,_o=Eo.call,To="object"==typeof Reflect&&Reflect.apply||(fo?_o.bind(mo):function(){return _o.apply(mo,arguments)}),go=uo,So=go({}.toString),Ro=go("".slice),yo=function(e){return Ro(So(e),8,-1)},vo=yo,Ao=uo,bo=function(e){if("Function"===vo(e))return Ao(e)},Io="object"==typeof document&&document.all,Oo={all:Io,IS_HTMLDDA:void 0===Io&&void 0!==Io},Co=Oo.all,No=Oo.IS_HTMLDDA?function(e){return"function"==typeof e||e===Co}:function(e){return"function"==typeof e},wo={},Do=!io((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Po=no,Lo=Function.prototype.call,ko=Po?Lo.bind(Lo):function(){return Lo.apply(Lo,arguments)},Mo={},Uo={}.propertyIsEnumerable,xo=Object.getOwnPropertyDescriptor,Vo=xo&&!Uo.call({1:2},1);Mo.f=Vo?function(e){var t=xo(this,e);return!!t&&t.enumerable}:Uo;var Fo,Bo,jo=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Go=io,Wo=yo,Ho=Object,Ko=uo("".split),Yo=Go((function(){return!Ho("z").propertyIsEnumerable(0)}))?function(e){return"String"==Wo(e)?Ko(e,""):Ho(e)}:Ho,zo=function(e){return null==e},Xo=zo,Zo=TypeError,Jo=function(e){if(Xo(e))throw Zo("Can't call method on "+e);return e},Qo=Yo,qo=Jo,$o=function(e){return Qo(qo(e))},es=No,ts=Oo.all,rs=Oo.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:es(e)||e===ts}:function(e){return"object"==typeof e?null!==e:es(e)},is={},ns=is,os=po,ss=No,as=function(e){return ss(e)?e:void 0},cs=function(e,t){return arguments.length<2?as(ns[e])||as(os[e]):ns[e]&&ns[e][t]||os[e]&&os[e][t]},ds="undefined"!=typeof navigator&&String(navigator.userAgent)||"",us=po,ls=ds,hs=us.process,ps=us.Deno,fs=hs&&hs.versions||ps&&ps.version,Es=fs&&fs.v8;Es&&(Bo=(Fo=Es.split("."))[0]>0&&Fo[0]<4?1:+(Fo[0]+Fo[1])),!Bo&&ls&&(!(Fo=ls.match(/Edge\/(\d+)/))||Fo[1]>=74)&&(Fo=ls.match(/Chrome\/(\d+)/))&&(Bo=+Fo[1]);var ms=Bo,_s=ms,Ts=io,gs=po.String,Ss=!!Object.getOwnPropertySymbols&&!Ts((function(){var e=Symbol();return!gs(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&_s&&_s<41})),Rs=Ss&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ys=cs,vs=No,As=lo,bs=Object,Is=Rs?function(e){return"symbol"==typeof e}:function(e){var t=ys("Symbol");return vs(t)&&As(t.prototype,bs(e))},Os=String,Cs=function(e){try{return Os(e)}catch(e){return"Object"}},Ns=No,ws=Cs,Ds=TypeError,Ps=function(e){if(Ns(e))return e;throw Ds(ws(e)+" is not a function")},Ls=Ps,ks=zo,Ms=function(e,t){var r=e[t];return ks(r)?void 0:Ls(r)},Us=ko,xs=No,Vs=rs,Fs=TypeError,Bs={exports:{}},js=po,Gs=Object.defineProperty,Ws=function(e,t){try{Gs(js,e,{value:t,configurable:!0,writable:!0})}catch(r){js[e]=t}return t},Hs="__core-js_shared__",Ks=po[Hs]||Ws(Hs,{}),Ys=Ks;(Bs.exports=function(e,t){return Ys[e]||(Ys[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.31.1",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var zs=Bs.exports,Xs=Jo,Zs=Object,Js=function(e){return Zs(Xs(e))},Qs=Js,qs=uo({}.hasOwnProperty),$s=Object.hasOwn||function(e,t){return qs(Qs(e),t)},ea=uo,ta=0,ra=Math.random(),ia=ea(1..toString),na=function(e){return"Symbol("+(void 0===e?"":e)+")_"+ia(++ta+ra,36)},oa=zs,sa=$s,aa=na,ca=Ss,da=Rs,ua=po.Symbol,la=oa("wks"),ha=da?ua.for||ua:ua&&ua.withoutSetter||aa,pa=function(e){return sa(la,e)||(la[e]=ca&&sa(ua,e)?ua[e]:ha("Symbol."+e)),la[e]},fa=ko,Ea=rs,ma=Is,_a=Ms,Ta=function(e,t){var r,i;if("string"===t&&xs(r=e.toString)&&!Vs(i=Us(r,e)))return i;if(xs(r=e.valueOf)&&!Vs(i=Us(r,e)))return i;if("string"!==t&&xs(r=e.toString)&&!Vs(i=Us(r,e)))return i;throw Fs("Can't convert object to primitive value")},ga=TypeError,Sa=pa("toPrimitive"),Ra=function(e,t){if(!Ea(e)||ma(e))return e;var r,i=_a(e,Sa);if(i){if(void 0===t&&(t="default"),r=fa(i,e,t),!Ea(r)||ma(r))return r;throw ga("Can't convert object to primitive value")}return void 0===t&&(t="number"),Ta(e,t)},ya=Is,va=function(e){var t=Ra(e,"string");return ya(t)?t:t+""},Aa=rs,ba=po.document,Ia=Aa(ba)&&Aa(ba.createElement),Oa=function(e){return Ia?ba.createElement(e):{}},Ca=Oa,Na=!Do&&!io((function(){return 7!=Object.defineProperty(Ca("div"),"a",{get:function(){return 7}}).a})),wa=Do,Da=ko,Pa=Mo,La=jo,ka=$o,Ma=va,Ua=$s,xa=Na,Va=Object.getOwnPropertyDescriptor;wo.f=wa?Va:function(e,t){if(e=ka(e),t=Ma(t),xa)try{return Va(e,t)}catch(e){}if(Ua(e,t))return La(!Da(Pa.f,e,t),e[t])};var Fa=io,Ba=No,ja=/#|\.prototype\./,Ga=function(e,t){var r=Ha[Wa(e)];return r==Ya||r!=Ka&&(Ba(t)?Fa(t):!!t)},Wa=Ga.normalize=function(e){return String(e).replace(ja,".").toLowerCase()},Ha=Ga.data={},Ka=Ga.NATIVE="N",Ya=Ga.POLYFILL="P",za=Ga,Xa=Ps,Za=no,Ja=bo(bo.bind),Qa=function(e,t){return Xa(e),void 0===t?e:Za?Ja(e,t):function(){return e.apply(t,arguments)}},qa={},$a=Do&&io((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ec=rs,tc=String,rc=TypeError,ic=function(e){if(ec(e))return e;throw rc(tc(e)+" is not an object")},nc=Do,oc=Na,sc=$a,ac=ic,cc=va,dc=TypeError,uc=Object.defineProperty,lc=Object.getOwnPropertyDescriptor,hc="enumerable",pc="configurable",fc="writable";qa.f=nc?sc?function(e,t,r){if(ac(e),t=cc(t),ac(r),"function"==typeof e&&"prototype"===t&&"value"in r&&fc in r&&!r[fc]){var i=lc(e,t);i&&i[fc]&&(e[t]=r.value,r={configurable:pc in r?r[pc]:i[pc],enumerable:hc in r?r[hc]:i[hc],writable:!1})}return uc(e,t,r)}:uc:function(e,t,r){if(ac(e),t=cc(t),ac(r),oc)try{return uc(e,t,r)}catch(e){}if("get"in r||"set"in r)throw dc("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Ec=qa,mc=jo,_c=Do?function(e,t,r){return Ec.f(e,t,mc(1,r))}:function(e,t,r){return e[t]=r,e},Tc=po,gc=To,Sc=bo,Rc=No,yc=wo.f,vc=za,Ac=is,bc=Qa,Ic=_c,Oc=$s,Cc=function(e){var t=function(r,i,n){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,i)}return new e(r,i,n)}return gc(e,this,arguments)};return t.prototype=e.prototype,t},Nc=function(e,t){var r,i,n,o,s,a,c,d,u,l=e.target,h=e.global,p=e.stat,f=e.proto,E=h?Tc:p?Tc[l]:(Tc[l]||{}).prototype,m=h?Ac:Ac[l]||Ic(Ac,l,{})[l],_=m.prototype;for(o in t)i=!(r=vc(h?o:l+(p?".":"#")+o,e.forced))&&E&&Oc(E,o),a=m[o],i&&(c=e.dontCallGetSet?(u=yc(E,o))&&u.value:E[o]),s=i&&c?c:t[o],i&&typeof a==typeof s||(d=e.bind&&i?bc(s,Tc):e.wrap&&i?Cc(s):f&&Rc(s)?Sc(s):s,(e.sham||s&&s.sham||a&&a.sham)&&Ic(d,"sham",!0),Ic(m,o,d),f&&(Oc(Ac,n=l+"Prototype")||Ic(Ac,n,{}),Ic(Ac[n],o,s),e.real&&_&&(r||!_[o])&&Ic(_,o,s)))},wc=Math.ceil,Dc=Math.floor,Pc=Math.trunc||function(e){var t=+e;return(t>0?Dc:wc)(t)},Lc=Pc,kc=function(e){var t=+e;return t!=t||0===t?0:Lc(t)},Mc=kc,Uc=Math.max,xc=Math.min,Vc=function(e,t){var r=Mc(e);return r<0?Uc(r+t,0):xc(r,t)},Fc=kc,Bc=Math.min,jc=function(e){return e>0?Bc(Fc(e),9007199254740991):0},Gc=function(e){return jc(e.length)},Wc=$o,Hc=Vc,Kc=Gc,Yc=function(e){return function(t,r,i){var n,o=Wc(t),s=Kc(o),a=Hc(i,s);if(e&&r!=r){for(;s>a;)if((n=o[a++])!=n)return!0}else for(;s>a;a++)if((e||a in o)&&o[a]===r)return e||a||0;return!e&&-1}},zc={includes:Yc(!0),indexOf:Yc(!1)},Xc=zc.includes;Nc({target:"Array",proto:!0,forced:io((function(){return!Array(1).includes()}))},{includes:function(e){return Xc(this,e,arguments.length>1?arguments[1]:void 0)}});var Zc=is,Jc=function(e){return Zc[e+"Prototype"]},Qc=Jc("Array").includes,qc=rs,$c=yo,ed=pa("match"),td=function(e){var t;return qc(e)&&(void 0!==(t=e[ed])?!!t:"RegExp"==$c(e))},rd=TypeError,id={};id[pa("toStringTag")]="z";var nd="[object z]"===String(id),od=nd,sd=No,ad=yo,cd=pa("toStringTag"),dd=Object,ud="Arguments"==ad(function(){return arguments}()),ld=od?ad:function(e){var t,r,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=dd(e),cd))?r:ud?ad(t):"Object"==(i=ad(t))&&sd(t.callee)?"Arguments":i},hd=ld,pd=String,fd=function(e){if("Symbol"===hd(e))throw TypeError("Cannot convert a Symbol value to a string");return pd(e)},Ed=pa("match"),md=Nc,_d=function(e){if(td(e))throw rd("The method doesn't accept regular expressions");return e},Td=Jo,gd=fd,Sd=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[Ed]=!1,"/./"[e](t)}catch(e){}}return!1},Rd=uo("".indexOf);md({target:"String",proto:!0,forced:!Sd("includes")},{includes:function(e){return!!~Rd(gd(Td(this)),gd(_d(e)),arguments.length>1?arguments[1]:void 0)}});var yd=Jc("String").includes,vd=lo,Ad=Qc,bd=yd,Id=Array.prototype,Od=String.prototype,Cd=function(e){var t=e.includes;return e===Id||vd(Id,e)&&t===Id.includes?Ad:"string"==typeof e||e===Od||vd(Od,e)&&t===Od.includes?bd:t},Nd=Z(Cd);function wd(e,t,r){return{sampleRate:e,stereo:t,bitrate:r}}function Dd(e,t,r,i,n){return{width:e,height:t,frameRate:r,bitrateMin:i,bitrateMax:n}}function Pd(e,t,r,i,n){return{width:{max:e},height:{max:t},frameRate:r,bitrateMin:i,bitrateMax:n}}function Ld(e,t){return{numSpatialLayers:e,numTemporalLayers:t}}const kd={"90p":Dd(160,90),"90p_1":Dd(160,90),"120p":Dd(160,120,15,30,65),"120p_1":Dd(160,120,15,30,65),"120p_3":Dd(120,120,15,30,50),"120p_4":Dd(212,120),"180p":Dd(320,180,15,30,140),"180p_1":Dd(320,180,15,30,140),"180p_3":Dd(180,180,15,30,100),"180p_4":Dd(240,180,15,30,120),"240p":Dd(320,240,15,40,200),"240p_1":Dd(320,240,15,40,200),"240p_3":Dd(240,240,15,40,140),"240p_4":Dd(424,240,15,40,220),"360p":Dd(640,360,15,80,400),"360p_1":Dd(640,360,15,80,400),"360p_3":Dd(360,360,15,80,260),"360p_4":Dd(640,360,30,80,600),"360p_6":Dd(360,360,30,80,400),"360p_7":Dd(480,360,15,80,320),"360p_8":Dd(480,360,30,80,490),"360p_9":Dd(640,360,15,80,800),"360p_10":Dd(640,360,24,80,800),"360p_11":Dd(640,360,24,80,1e3),"480p":Dd(640,480,15,100,500),"480p_1":Dd(640,480,15,100,500),"480p_2":Dd(640,480,30,100,1e3),"480p_3":Dd(480,480,15,100,400),"480p_4":Dd(640,480,30,100,750),"480p_6":Dd(480,480,30,100,600),"480p_8":Dd(848,480,15,100,610),"480p_9":Dd(848,480,30,100,930),"480p_10":Dd(640,480,10,100,400),"720p":Dd(1280,720,15,120,1130),"720p_auto":Dd(1280,720,30,900,3e3),"720p_1":Dd(1280,720,15,120,1130),"720p_2":Dd(1280,720,30,120,2e3),"720p_3":Dd(1280,720,30,120,1710),"720p_5":Dd(960,720,15,120,910),"720p_6":Dd(960,720,30,120,1380),"1080p":Dd(1920,1080,15,120,2080),"1080p_1":Dd(1920,1080,15,120,2080),"1080p_2":Dd(1920,1080,30,120,3e3),"1080p_3":Dd(1920,1080,30,120,3150),"1080p_5":Dd(1920,1080,60,120,4780),"1440p":Dd(2560,1440,30,120,4850),"1440p_1":Dd(2560,1440,30,120,4850),"1440p_2":Dd(2560,1440,60,120,7350),"4k":Dd(3840,2160,30,120,8910),"4k_1":Dd(3840,2160,30,120,8910),"4k_3":Dd(3840,2160,60,120,13500)},Md={"480p":Pd(640,480,5),"480p_1":Pd(640,480,5),"480p_2":Pd(640,480,30),"480p_3":Pd(640,480,15),"720p":Pd(1280,720,5),"720p_auto":Dd(1280,720,30,900,3e3),"720p_1":Pd(1280,720,5),"720p_2":Pd(1280,720,30),"720p_3":Pd(1280,720,15),"1080p":Pd(1920,1080,5),"1080p_1":Pd(1920,1080,5),"1080p_2":Pd(1920,1080,30),"1080p_3":Pd(1920,1080,15)},Ud={"1SL1TL":Ld(1,1),"3SL3TL":Ld(3,3),"2SL3TL":Ld(2,3)};function xd(e){return e||(e="480p_1"),"string"==typeof e?Object.assign({},kd[e]):e}function Vd(e){return"string"==typeof e?Object.assign({},Md[e]):e}function Fd(e){return"string"==typeof e?Object.assign({},Ud[e]):e}const Bd={speech_low_quality:wd(16e3,!1),speech_standard:wd(32e3,!1,18),music_standard:wd(48e3,!1),standard_stereo:wd(48e3,!0,56),high_quality:wd(48e3,!1,128),high_quality_stereo:wd(48e3,!0,192)};function jd(e){return"string"==typeof e?Object.assign({},Bd[e]):e}const Gd=[];function Wd(e){Nd(Gd).call(Gd,e)||Gd.push(e)}function Hd(e){const t=Gd.indexOf(e);-1!==t&&Gd.splice(t,1)}function Kd(){return Gd.some((e=>function(e){return"__className__"in e&&"MicrophoneAudioTrack"===e.__className__}(e)))}function Yd(e){return ci(e.width,"config.width"),ci(e.height,"config.height"),void 0!==e.frameRate&&ci(e.frameRate,"config.frameRate"),void 0!==e.bitrateMax&&ai(e.bitrateMax,"config.bitrateMax"),void 0!==e.bitrateMin&&ai(e.bitrateMin,"config.bitrateMin"),!0}function zd(e){return void 0!==e.sampleRate&&ai(e.sampleRate,"config.sampleRate",0,96e3,!0),void 0!==e.sampleSize&&ai(e.sampleRate,"config.sampleSize",0,128,!0),void 0!==e.stereo&&oi(e.stereo,"config.stereo"),void 0!==e.bitrate&&ai(e.bitrate,"config.bitrate",0,1e4,!1),!0}function Xd(e){return si(e,"mediaSource",["screen","window","application"]),!0}let Zd=function(e){return e.NEED_RENEGOTIATE="@need_renegotiate",e.NEED_REPLACE_TRACK="@need_replace_track",e.NEED_REPLACE_MIXING_TRACK="@need_replace_mixing_track",e.NEED_CLOSE="@need_close",e.NEED_ENABLE_TRACK="@need_enable_track",e.NEED_DISABLE_TRACK="@need_disable_track",e.NEED_SESSION_ID="@need_sid",e.SET_OPTIMIZATION_MODE="@set_optimization_mode",e.GET_STATS="@get_stats",e.GET_RTC_STATS="@get_rtc_stats",e.GET_LOW_VIDEO_TRACK="@get_low_video_track",e.NEED_RESET_REMOTE_SDP="@need_reset_remote_sdp",e.NEED_UPDATE_VIDEO_ENCODER="@need_update_video_encoder",e.NEED_UPDATE_VIDEO_SEND_PARAMETERS="@need_update_video_send_parameters",e.NEED_MUTE_TRACK="@need_mute_track",e.NEED_UNMUTE_TRACK="@need_unmute_track",e}({}),Jd=function(e){return e.SCREEN_TRACK="screen_track",e.CUSTOM_TRACK="custome_track",e.LOW_STREAM="low_stream",e.SCREEN_LOW_TRACK="screen_low_track",e}({});let Qd=function(e){return e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM",e}({}),qd=function(e){return e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM",e[e.HIGH_STREAM_LAYER1=4]="HIGH_STREAM_LAYER1",e[e.HIGH_STREAM_LAYER2=5]="HIGH_STREAM_LAYER2",e[e.HIGH_STREAM_LAYER3=6]="HIGH_STREAM_LAYER3",e[e.HIGH_STREAM_LAYER4=7]="HIGH_STREAM_LAYER4",e[e.HIGH_STREAM_LAYER5=8]="HIGH_STREAM_LAYER5",e[e.HIGH_STREAM_LAYER6=9]="HIGH_STREAM_LAYER6",e}({}),$d=function(e){return e[e.DISABLE=0]="DISABLE",e[e.LOW_STREAM=1]="LOW_STREAM",e[e.AUDIO_ONLY=2]="AUDIO_ONLY",e[e.HIGH_STREAM_LAYER1=3]="HIGH_STREAM_LAYER1",e[e.HIGH_STREAM_LAYER2=4]="HIGH_STREAM_LAYER2",e[e.HIGH_STREAM_LAYER3=5]="HIGH_STREAM_LAYER3",e[e.HIGH_STREAM_LAYER4=6]="HIGH_STREAM_LAYER4",e[e.HIGH_STREAM_LAYER5=7]="HIGH_STREAM_LAYER5",e[e.HIGH_STREAM_LAYER6=8]="HIGH_STREAM_LAYER6",e}({}),eu=function(e){return e.TRANSCEIVER_UPDATED="transceiver-updated",e.SEI_TO_SEND="sei-to-send",e.SEI_RECEIVED="sei-received",e.TRACK_UPDATED="track-updated",e}({}),tu=function(e){return e.SOURCE_STATE_CHANGE="source-state-change",e.TRACK_ENDED="track-ended",e.BEAUTY_EFFECT_OVERLOAD="beauty-effect-overload",e.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",e.CLOSED="closed",e}({}),ru=function(e){return e.FIRST_FRAME_DECODED="first-frame-decoded",e.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",e.VIDEO_STATE_CHANGED="video-state-changed",e.PLAY_START="play-start",e.PLAY_END="play-end",e.FIRST_FRAME_RENDER="first-frame-render",e}({}),iu=function(e){return e.AUDIO="audio",e.VIDEO="video",e.DATA="data",e}({}),nu=function(e){return e.AUDIO_SOURCE_STATE_CHANGE="audio_source_state_change",e.RECEIVE_TRACK_BUFFER="receive_track_buffer",e.ON_AUDIO_BUFFER="on_audio_buffer",e.UPDATE_SOURCE="update_source",e}({}),ou=function(e){return e.UPDATE_TRACK_SOURCE="update-track-source",e}({});const su={sendVolumeLevel:0,sendBitrate:0,sendBytes:0,sendPackets:0,sendPacketsLost:0,sendJitterMs:0,sendRttMs:0,currentPacketLossRate:0},au={sendBytes:0,sendBitrate:0,sendPackets:0,sendPacketsLost:0,sendJitterMs:0,sendRttMs:0,sendResolutionHeight:0,sendResolutionWidth:0,captureResolutionHeight:0,captureResolutionWidth:0,targetSendBitrate:0,totalDuration:0,totalFreezeTime:0,currentPacketLossRate:0},cu={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveLevel:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,receivePacketsDiscarded:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1},du={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,receiveResolutionHeight:0,receiveResolutionWidth:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1};let uu=function(e){return e.ON_TRACK="on_track",e.ON_NODE="on_node",e}({}),lu=function(e){return e.REQUEST_UPDATE_CONSTRAINTS="request_update_constraints",e.REQUEST_CONSTRAINTS="request_constraints",e}({}),hu=function(e){return e.IDLE="IDLE",e.INITING="INITING",e.INITEND="INITEND",e}({}),pu=function(e){return e.STATE_CHANGE="state_change",e.RECORDING_DEVICE_CHANGED="recordingDeviceChanged",e.PLAYOUT_DEVICE_CHANGED="playoutDeviceChanged",e.CAMERA_DEVICE_CHANGED="cameraDeviceChanged",e}({});let fu=function(e){return e.NONE="none",e.INIT="init",e.CANPLAY="canplay",e.PLAYING="playing",e.PAUSED="paused",e.SUSPEND="suspend",e.STALLED="stalled",e.WAITING="waiting",e.ERROR="error",e.DESTROYED="destroyed",e.ABORT="abort",e.ENDED="ended",e.EMPTIED="emptied",e.LOADEDDATA="loadeddata",e}({}),Eu=function(e){return e[e.VideoStateStopped=0]="VideoStateStopped",e[e.VideoStateStarting=1]="VideoStateStarting",e[e.VideoStateDecoding=2]="VideoStateDecoding",e[e.VideoStateFrozen=3]="VideoStateFrozen",e}({});let mu=function(e){return e.OPEN="open",e.MESSAGE="message",e.CLOSE="close",e.CLOSING="closing",e.ERROR="error",e}({});var _u={exports:{}},Tu=Nc,gu=Do,Su=qa.f;Tu({target:"Object",stat:!0,forced:Object.defineProperty!==Su,sham:!gu},{defineProperty:Su});var Ru=is.Object,yu=_u.exports=function(e,t,r){return Ru.defineProperty(e,t,r)};Ru.defineProperty.sham&&(yu.sham=!0);var vu=Z(_u.exports),Au=yo,bu=Array.isArray||function(e){return"Array"==Au(e)},Iu=TypeError,Ou=va,Cu=qa,Nu=jo,wu=function(e,t,r){var i=Ou(t);i in e?Cu.f(e,i,Nu(0,r)):e[i]=r},Du=No,Pu=Ks,Lu=uo(Function.toString);Du(Pu.inspectSource)||(Pu.inspectSource=function(e){return Lu(e)});var ku=Pu.inspectSource,Mu=uo,Uu=io,xu=No,Vu=ld,Fu=ku,Bu=function(){},ju=[],Gu=cs("Reflect","construct"),Wu=/^\s*(?:class|function)\b/,Hu=Mu(Wu.exec),Ku=!Wu.exec(Bu),Yu=function(e){if(!xu(e))return!1;try{return Gu(Bu,ju,e),!0}catch(e){return!1}},zu=function(e){if(!xu(e))return!1;switch(Vu(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ku||!!Hu(Wu,Fu(e))}catch(e){return!0}};zu.sham=!0;var Xu=!Gu||Uu((function(){var e;return Yu(Yu.call)||!Yu(Object)||!Yu((function(){e=!0}))||e}))?zu:Yu,Zu=bu,Ju=Xu,Qu=rs,qu=pa("species"),$u=Array,el=function(e){var t;return Zu(e)&&(t=e.constructor,(Ju(t)&&(t===$u||Zu(t.prototype))||Qu(t)&&null===(t=t[qu]))&&(t=void 0)),void 0===t?$u:t},tl=function(e,t){return new(el(e))(0===t?0:t)},rl=io,il=ms,nl=pa("species"),ol=function(e){return il>=51||!rl((function(){var t=[];return(t.constructor={})[nl]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},sl=Nc,al=io,cl=bu,dl=rs,ul=Js,ll=Gc,hl=function(e){if(e>9007199254740991)throw Iu("Maximum allowed index exceeded");return e},pl=wu,fl=tl,El=ol,ml=ms,_l=pa("isConcatSpreadable"),Tl=ml>=51||!al((function(){var e=[];return e[_l]=!1,e.concat()[0]!==e})),gl=function(e){if(!dl(e))return!1;var t=e[_l];return void 0!==t?!!t:cl(e)};sl({target:"Array",proto:!0,arity:1,forced:!Tl||!El("concat")},{concat:function(e){var t,r,i,n,o,s=ul(this),a=fl(s,0),c=0;for(t=-1,i=arguments.length;t<i;t++)if(gl(o=-1===t?s:arguments[t]))for(n=ll(o),hl(c+n),r=0;r<n;r++,c++)r in o&&pl(a,c,o[r]);else hl(c+1),pl(a,c++,o);return a.length=c,a}});var Sl={},Rl={},yl=$s,vl=$o,Al=zc.indexOf,bl=Rl,Il=uo([].push),Ol=function(e,t){var r,i=vl(e),n=0,o=[];for(r in i)!yl(bl,r)&&yl(i,r)&&Il(o,r);for(;t.length>n;)yl(i,r=t[n++])&&(~Al(o,r)||Il(o,r));return o},Cl=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Nl=Ol,wl=Cl,Dl=Object.keys||function(e){return Nl(e,wl)},Pl=Do,Ll=$a,kl=qa,Ml=ic,Ul=$o,xl=Dl;Sl.f=Pl&&!Ll?Object.defineProperties:function(e,t){Ml(e);for(var r,i=Ul(t),n=xl(t),o=n.length,s=0;o>s;)kl.f(e,r=n[s++],i[r]);return e};var Vl,Fl=cs("document","documentElement"),Bl=na,jl=zs("keys"),Gl=function(e){return jl[e]||(jl[e]=Bl(e))},Wl=ic,Hl=Sl,Kl=Cl,Yl=Rl,zl=Fl,Xl=Oa,Zl="prototype",Jl="script",Ql=Gl("IE_PROTO"),ql=function(){},$l=function(e){return"<"+Jl+">"+e+"</"+Jl+">"},eh=function(e){e.write($l("")),e.close();var t=e.parentWindow.Object;return e=null,t},th=function(){try{Vl=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;th="undefined"!=typeof document?document.domain&&Vl?eh(Vl):(t=Xl("iframe"),r="java"+Jl+":",t.style.display="none",zl.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write($l("document.F=Object")),e.close(),e.F):eh(Vl);for(var i=Kl.length;i--;)delete th[Zl][Kl[i]];return th()};Yl[Ql]=!0;var rh=Object.create||function(e,t){var r;return null!==e?(ql[Zl]=Wl(e),r=new ql,ql[Zl]=null,r[Ql]=e):r=th(),void 0===t?r:Hl.f(r,t)},ih={},nh=Ol,oh=Cl.concat("length","prototype");ih.f=Object.getOwnPropertyNames||function(e){return nh(e,oh)};var sh={},ah=Vc,ch=Gc,dh=wu,uh=Array,lh=Math.max,hh=function(e,t,r){for(var i=ch(e),n=ah(t,i),o=ah(void 0===r?i:r,i),s=uh(lh(o-n,0)),a=0;n<o;n++,a++)dh(s,a,e[n]);return s.length=a,s},ph=yo,fh=$o,Eh=ih.f,mh=hh,_h="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];sh.f=function(e){return _h&&"Window"==ph(e)?function(e){try{return Eh(e)}catch(e){return mh(_h)}}(e):Eh(fh(e))};var Th={};Th.f=Object.getOwnPropertySymbols;var gh=_c,Sh=function(e,t,r,i){return i&&i.enumerable?e[t]=r:gh(e,t,r),e},Rh=qa,yh=function(e,t,r){return Rh.f(e,t,r)},vh={},Ah=pa;vh.f=Ah;var bh,Ih,Oh,Ch=is,Nh=$s,wh=vh,Dh=qa.f,Ph=function(e){var t=Ch.Symbol||(Ch.Symbol={});Nh(t,e)||Dh(t,e,{value:wh.f(e)})},Lh=ko,kh=cs,Mh=pa,Uh=Sh,xh=function(){var e=kh("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,i=Mh("toPrimitive");t&&!t[i]&&Uh(t,i,(function(e){return Lh(r,this)}),{arity:1})},Vh=ld,Fh=nd?{}.toString:function(){return"[object "+Vh(this)+"]"},Bh=nd,jh=qa.f,Gh=_c,Wh=$s,Hh=Fh,Kh=pa("toStringTag"),Yh=function(e,t,r,i){if(e){var n=r?e:e.prototype;Wh(n,Kh)||jh(n,Kh,{configurable:!0,value:t}),i&&!Bh&&Gh(n,"toString",Hh)}},zh=No,Xh=po.WeakMap,Zh=zh(Xh)&&/native code/.test(String(Xh)),Jh=po,Qh=rs,qh=_c,$h=$s,ep=Ks,tp=Gl,rp=Rl,ip="Object already initialized",np=Jh.TypeError,op=Jh.WeakMap;if(Zh||ep.state){var sp=ep.state||(ep.state=new op);sp.get=sp.get,sp.has=sp.has,sp.set=sp.set,bh=function(e,t){if(sp.has(e))throw np(ip);return t.facade=e,sp.set(e,t),t},Ih=function(e){return sp.get(e)||{}},Oh=function(e){return sp.has(e)}}else{var ap=tp("state");rp[ap]=!0,bh=function(e,t){if($h(e,ap))throw np(ip);return t.facade=e,qh(e,ap,t),t},Ih=function(e){return $h(e,ap)?e[ap]:{}},Oh=function(e){return $h(e,ap)}}var cp={set:bh,get:Ih,has:Oh,enforce:function(e){return Oh(e)?Ih(e):bh(e,{})},getterFor:function(e){return function(t){var r;if(!Qh(t)||(r=Ih(t)).type!==e)throw np("Incompatible receiver, "+e+" required");return r}}},dp=Qa,up=Yo,lp=Js,hp=Gc,pp=tl,fp=uo([].push),Ep=function(e){var t=1==e,r=2==e,i=3==e,n=4==e,o=6==e,s=7==e,a=5==e||o;return function(c,d,u,l){for(var h,p,f=lp(c),E=up(f),m=dp(d,u),_=hp(E),T=0,g=l||pp,S=t?g(c,_):r||s?g(c,0):void 0;_>T;T++)if((a||T in E)&&(p=m(h=E[T],T,f),e))if(t)S[T]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return T;case 2:fp(S,h)}else switch(e){case 4:return!1;case 7:fp(S,h)}return o?-1:i||n?n:S}},mp={forEach:Ep(0),map:Ep(1),filter:Ep(2),some:Ep(3),every:Ep(4),find:Ep(5),findIndex:Ep(6),filterReject:Ep(7)},_p=Nc,Tp=po,gp=ko,Sp=uo,Rp=Do,yp=Ss,vp=io,Ap=$s,bp=lo,Ip=ic,Op=$o,Cp=va,Np=fd,wp=jo,Dp=rh,Pp=Dl,Lp=ih,kp=sh,Mp=Th,Up=wo,xp=qa,Vp=Sl,Fp=Mo,Bp=Sh,jp=yh,Gp=zs,Wp=Rl,Hp=na,Kp=pa,Yp=vh,zp=Ph,Xp=xh,Zp=Yh,Jp=cp,Qp=mp.forEach,qp=Gl("hidden"),$p="Symbol",ef="prototype",tf=Jp.set,rf=Jp.getterFor($p),nf=Object[ef],of=Tp.Symbol,sf=of&&of[ef],af=Tp.TypeError,cf=Tp.QObject,df=Up.f,uf=xp.f,lf=kp.f,hf=Fp.f,pf=Sp([].push),ff=Gp("symbols"),Ef=Gp("op-symbols"),mf=Gp("wks"),_f=!cf||!cf[ef]||!cf[ef].findChild,Tf=Rp&&vp((function(){return 7!=Dp(uf({},"a",{get:function(){return uf(this,"a",{value:7}).a}})).a}))?function(e,t,r){var i=df(nf,t);i&&delete nf[t],uf(e,t,r),i&&e!==nf&&uf(nf,t,i)}:uf,gf=function(e,t){var r=ff[e]=Dp(sf);return tf(r,{type:$p,tag:e,description:t}),Rp||(r.description=t),r},Sf=function(e,t,r){e===nf&&Sf(Ef,t,r),Ip(e);var i=Cp(t);return Ip(r),Ap(ff,i)?(r.enumerable?(Ap(e,qp)&&e[qp][i]&&(e[qp][i]=!1),r=Dp(r,{enumerable:wp(0,!1)})):(Ap(e,qp)||uf(e,qp,wp(1,{})),e[qp][i]=!0),Tf(e,i,r)):uf(e,i,r)},Rf=function(e,t){Ip(e);var r=Op(t),i=Pp(r).concat(bf(r));return Qp(i,(function(t){Rp&&!gp(yf,r,t)||Sf(e,t,r[t])})),e},yf=function(e){var t=Cp(e),r=gp(hf,this,t);return!(this===nf&&Ap(ff,t)&&!Ap(Ef,t))&&(!(r||!Ap(this,t)||!Ap(ff,t)||Ap(this,qp)&&this[qp][t])||r)},vf=function(e,t){var r=Op(e),i=Cp(t);if(r!==nf||!Ap(ff,i)||Ap(Ef,i)){var n=df(r,i);return!n||!Ap(ff,i)||Ap(r,qp)&&r[qp][i]||(n.enumerable=!0),n}},Af=function(e){var t=lf(Op(e)),r=[];return Qp(t,(function(e){Ap(ff,e)||Ap(Wp,e)||pf(r,e)})),r},bf=function(e){var t=e===nf,r=lf(t?Ef:Op(e)),i=[];return Qp(r,(function(e){!Ap(ff,e)||t&&!Ap(nf,e)||pf(i,ff[e])})),i};yp||(of=function(){if(bp(sf,this))throw af("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Np(arguments[0]):void 0,t=Hp(e),r=function(e){this===nf&&gp(r,Ef,e),Ap(this,qp)&&Ap(this[qp],t)&&(this[qp][t]=!1),Tf(this,t,wp(1,e))};return Rp&&_f&&Tf(nf,t,{configurable:!0,set:r}),gf(t,e)},Bp(sf=of[ef],"toString",(function(){return rf(this).tag})),Bp(of,"withoutSetter",(function(e){return gf(Hp(e),e)})),Fp.f=yf,xp.f=Sf,Vp.f=Rf,Up.f=vf,Lp.f=kp.f=Af,Mp.f=bf,Yp.f=function(e){return gf(Kp(e),e)},Rp&&jp(sf,"description",{configurable:!0,get:function(){return rf(this).description}})),_p({global:!0,constructor:!0,wrap:!0,forced:!yp,sham:!yp},{Symbol:of}),Qp(Pp(mf),(function(e){zp(e)})),_p({target:$p,stat:!0,forced:!yp},{useSetter:function(){_f=!0},useSimple:function(){_f=!1}}),_p({target:"Object",stat:!0,forced:!yp,sham:!Rp},{create:function(e,t){return void 0===t?Dp(e):Rf(Dp(e),t)},defineProperty:Sf,defineProperties:Rf,getOwnPropertyDescriptor:vf}),_p({target:"Object",stat:!0,forced:!yp},{getOwnPropertyNames:Af}),Xp(),Zp(of,$p),Wp[qp]=!0;var If=Ss&&!!Symbol.for&&!!Symbol.keyFor,Of=Nc,Cf=cs,Nf=$s,wf=fd,Df=zs,Pf=If,Lf=Df("string-to-symbol-registry"),kf=Df("symbol-to-string-registry");Of({target:"Symbol",stat:!0,forced:!Pf},{for:function(e){var t=wf(e);if(Nf(Lf,t))return Lf[t];var r=Cf("Symbol")(t);return Lf[t]=r,kf[r]=t,r}});var Mf=Nc,Uf=$s,xf=Is,Vf=Cs,Ff=If,Bf=zs("symbol-to-string-registry");Mf({target:"Symbol",stat:!0,forced:!Ff},{keyFor:function(e){if(!xf(e))throw TypeError(Vf(e)+" is not a symbol");if(Uf(Bf,e))return Bf[e]}});var jf=uo([].slice),Gf=bu,Wf=No,Hf=yo,Kf=fd,Yf=uo([].push),zf=Nc,Xf=cs,Zf=To,Jf=ko,Qf=uo,qf=io,$f=No,eE=Is,tE=jf,rE=function(e){if(Wf(e))return e;if(Gf(e)){for(var t=e.length,r=[],i=0;i<t;i++){var n=e[i];"string"==typeof n?Yf(r,n):"number"!=typeof n&&"Number"!=Hf(n)&&"String"!=Hf(n)||Yf(r,Kf(n))}var o=r.length,s=!0;return function(e,t){if(s)return s=!1,t;if(Gf(this))return t;for(var i=0;i<o;i++)if(r[i]===e)return t}}},iE=Ss,nE=String,oE=Xf("JSON","stringify"),sE=Qf(/./.exec),aE=Qf("".charAt),cE=Qf("".charCodeAt),dE=Qf("".replace),uE=Qf(1..toString),lE=/[\uD800-\uDFFF]/g,hE=/^[\uD800-\uDBFF]$/,pE=/^[\uDC00-\uDFFF]$/,fE=!iE||qf((function(){var e=Xf("Symbol")();return"[null]"!=oE([e])||"{}"!=oE({a:e})||"{}"!=oE(Object(e))})),EE=qf((function(){return'"\\udf06\\ud834"'!==oE("\udf06\ud834")||'"\\udead"'!==oE("\udead")})),mE=function(e,t){var r=tE(arguments),i=rE(t);if($f(i)||void 0!==e&&!eE(e))return r[1]=function(e,t){if($f(i)&&(t=Jf(i,this,nE(e),t)),!eE(t))return t},Zf(oE,null,r)},_E=function(e,t,r){var i=aE(r,t-1),n=aE(r,t+1);return sE(hE,e)&&!sE(pE,n)||sE(pE,e)&&!sE(hE,i)?"\\u"+uE(cE(e,0),16):e};oE&&zf({target:"JSON",stat:!0,arity:3,forced:fE||EE},{stringify:function(e,t,r){var i=tE(arguments),n=Zf(fE?mE:oE,null,i);return EE&&"string"==typeof n?dE(n,lE,_E):n}});var TE=Th,gE=Js;Nc({target:"Object",stat:!0,forced:!Ss||io((function(){TE.f(1)}))},{getOwnPropertySymbols:function(e){var t=TE.f;return t?t(gE(e)):[]}}),Ph("asyncIterator"),Ph("hasInstance"),Ph("isConcatSpreadable"),Ph("iterator"),Ph("match"),Ph("matchAll"),Ph("replace"),Ph("search"),Ph("species"),Ph("split");var SE=xh;Ph("toPrimitive"),SE();var RE=cs,yE=Yh;Ph("toStringTag"),yE(RE("Symbol"),"Symbol"),Ph("unscopables"),Yh(po.JSON,"JSON",!0);var vE,AE,bE,IE=is.Symbol,OE={},CE=Do,NE=$s,wE=Function.prototype,DE=CE&&Object.getOwnPropertyDescriptor,PE=NE(wE,"name"),LE={EXISTS:PE,PROPER:PE&&"something"===function(){}.name,CONFIGURABLE:PE&&(!CE||CE&&DE(wE,"name").configurable)},kE=!io((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),ME=$s,UE=No,xE=Js,VE=kE,FE=Gl("IE_PROTO"),BE=Object,jE=BE.prototype,GE=VE?BE.getPrototypeOf:function(e){var t=xE(e);if(ME(t,FE))return t[FE];var r=t.constructor;return UE(r)&&t instanceof r?r.prototype:t instanceof BE?jE:null},WE=io,HE=No,KE=rs,YE=rh,zE=GE,XE=Sh,ZE=pa("iterator"),JE=!1;[].keys&&("next"in(bE=[].keys())?(AE=zE(zE(bE)))!==Object.prototype&&(vE=AE):JE=!0);var QE=!KE(vE)||WE((function(){var e={};return vE[ZE].call(e)!==e}));HE((vE=QE?{}:YE(vE))[ZE])||XE(vE,ZE,(function(){return this}));var qE={IteratorPrototype:vE,BUGGY_SAFARI_ITERATORS:JE},$E=qE.IteratorPrototype,em=rh,tm=jo,rm=Yh,im=OE,nm=function(){return this},om=function(e,t,r,i){var n=t+" Iterator";return e.prototype=em($E,{next:tm(+!i,r)}),rm(e,n,!1,!0),im[n]=nm,e},sm=uo,am=Ps,cm=No,dm=String,um=TypeError,lm=function(e,t,r){try{return sm(am(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},hm=ic,pm=function(e){if("object"==typeof e||cm(e))return e;throw um("Can't set "+dm(e)+" as a prototype")},fm=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=lm(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return hm(r),pm(i),t?e(r,i):r.__proto__=i,r}}():void 0),Em=Nc,mm=ko,_m=LE,Tm=om,gm=GE,Sm=Yh,Rm=Sh,ym=OE,vm=qE,Am=_m.PROPER,bm=vm.BUGGY_SAFARI_ITERATORS,Im=pa("iterator"),Om="keys",Cm="values",Nm="entries",wm=function(){return this},Dm=function(e,t,r,i,n,o,s){Tm(r,t,i);var a,c,d,u=function(e){if(e===n&&E)return E;if(!bm&&e in p)return p[e];switch(e){case Om:case Cm:case Nm:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[Im]||p["@@iterator"]||n&&p[n],E=!bm&&f||u(n),m="Array"==t&&p.entries||f;if(m&&(a=gm(m.call(new e)))!==Object.prototype&&a.next&&(Sm(a,l,!0,!0),ym[l]=wm),Am&&n==Cm&&f&&f.name!==Cm&&(h=!0,E=function(){return mm(f,this)}),n)if(c={values:u(Cm),keys:o?E:u(Om),entries:u(Nm)},s)for(d in c)(bm||h||!(d in p))&&Rm(p,d,c[d]);else Em({target:t,proto:!0,forced:bm||h},c);return s&&p[Im]!==E&&Rm(p,Im,E,{name:n}),ym[t]=E,c},Pm=function(e,t){return{value:e,done:t}},Lm=$o,km=OE,Mm=cp;qa.f;var Um=Dm,xm=Pm,Vm="Array Iterator",Fm=Mm.set,Bm=Mm.getterFor(Vm);Um(Array,"Array",(function(e,t){Fm(this,{type:Vm,target:Lm(e),index:0,kind:t})}),(function(){var e=Bm(this),t=e.target,r=e.kind,i=e.index++;return!t||i>=t.length?(e.target=void 0,xm(void 0,!0)):xm("keys"==r?i:"values"==r?t[i]:[i,t[i]],!1)}),"values"),km.Arguments=km.Array;var jm={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},Gm=po,Wm=ld,Hm=_c,Km=OE,Ym=pa("toStringTag");for(var zm in jm){var Xm=Gm[zm],Zm=Xm&&Xm.prototype;Zm&&Wm(Zm)!==Ym&&Hm(Zm,Ym,zm),Km[zm]=Km.Array}var Jm=IE,Qm=pa,qm=qa.f,$m=Qm("metadata"),e_=Function.prototype;void 0===e_[$m]&&qm(e_,$m,{value:null}),Ph("dispose"),Ph("metadata");var t_=Jm;Ph("asyncDispose");var r_=uo,i_=cs("Symbol"),n_=i_.keyFor,o_=r_(i_.prototype.valueOf),s_=i_.isRegisteredSymbol||function(e){try{return void 0!==n_(o_(e))}catch(e){return!1}};Nc({target:"Symbol",stat:!0},{isRegisteredSymbol:s_});for(var a_=zs,c_=cs,d_=uo,u_=Is,l_=pa,h_=c_("Symbol"),p_=h_.isWellKnownSymbol,f_=c_("Object","getOwnPropertyNames"),E_=d_(h_.prototype.valueOf),m_=a_("wks"),__=0,T_=f_(h_),g_=T_.length;__<g_;__++)try{var S_=T_[__];u_(h_[S_])&&l_(S_)}catch(e){}var R_=function(e){if(p_&&p_(e))return!0;try{for(var t=E_(e),r=0,i=f_(m_),n=i.length;r<n;r++)if(m_[i[r]]==t)return!0}catch(e){}return!1};Nc({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:R_}),Ph("matcher"),Ph("observable"),Nc({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:s_}),Nc({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:R_}),Ph("metadataKey"),Ph("patternMatch"),Ph("replaceAll");var y_=Z(t_),v_=uo,A_=kc,b_=fd,I_=Jo,O_=v_("".charAt),C_=v_("".charCodeAt),N_=v_("".slice),w_=function(e){return function(t,r){var i,n,o=b_(I_(t)),s=A_(r),a=o.length;return s<0||s>=a?e?"":void 0:(i=C_(o,s))<55296||i>56319||s+1===a||(n=C_(o,s+1))<56320||n>57343?e?O_(o,s):i:e?N_(o,s,s+2):n-56320+(i-55296<<10)+65536}},D_={codeAt:w_(!1),charAt:w_(!0)},P_=D_.charAt,L_=fd,k_=cp,M_=Dm,U_=Pm,x_="String Iterator",V_=k_.set,F_=k_.getterFor(x_);M_(String,"String",(function(e){V_(this,{type:x_,string:L_(e),index:0})}),(function(){var e,t=F_(this),r=t.string,i=t.index;return i>=r.length?U_(void 0,!0):(e=P_(r,i),t.index+=e.length,U_(e,!1))}));var B_=Z(vh.f("iterator"));function j_(e){return j_="function"==typeof y_&&"symbol"==typeof B_?function(e){return typeof e}:function(e){return e&&"function"==typeof y_&&e.constructor===y_&&e!==y_.prototype?"symbol":typeof e},j_(e)}var G_=Z(vh.f("toPrimitive"));function W_(e){var t=function(e,t){if("object"!==j_(e)||null===e)return e;var r=e[G_];if(void 0!==r){var i=r.call(e,t||"default");if("object"!==j_(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===j_(t)?t:String(t)}function H_(e,t,r){return(t=W_(t))in e?vu(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var K_=io,Y_=function(e,t){var r=[][e];return!!r&&K_((function(){r.call(null,t||function(){return 1},1)}))},z_=mp.forEach,X_=Y_("forEach")?[].forEach:function(e){return z_(this,e,arguments.length>1?arguments[1]:void 0)};Nc({target:"Array",proto:!0,forced:[].forEach!=X_},{forEach:X_});var Z_=Jc("Array").forEach,J_=ld,Q_=$s,q_=lo,$_=Z_,eT=Array.prototype,tT={DOMTokenList:!0,NodeList:!0},rT=function(e){var t=e.forEach;return e===eT||q_(eT,e)&&t===eT.forEach||Q_(tT,J_(e))?$_:t},iT=Z(rT),nT=Js,oT=Dl;Nc({target:"Object",stat:!0,forced:io((function(){oT(1)}))},{keys:function(e){return oT(nT(e))}});var sT=Z(is.Object.keys),aT=Ps,cT=Js,dT=Yo,uT=Gc,lT=TypeError,hT=function(e){return function(t,r,i,n){aT(r);var o=cT(t),s=dT(o),a=uT(o),c=e?a-1:0,d=e?-1:1;if(i<2)for(;;){if(c in s){n=s[c],c+=d;break}if(c+=d,e?c<0:a<=c)throw lT("Reduce of empty array with no initial value")}for(;e?c>=0:a>c;c+=d)c in s&&(n=r(n,s[c],c,o));return n}},pT={left:hT(!1),right:hT(!0)},fT="undefined"!=typeof process&&"process"==yo(process),ET=pT.left;Nc({target:"Array",proto:!0,forced:!fT&&ms>79&&ms<83||!Y_("reduce")},{reduce:function(e){var t=arguments.length;return ET(this,e,t,t>1?arguments[1]:void 0)}});var mT=Jc("Array").reduce,_T=lo,TT=mT,gT=Array.prototype,ST=function(e){var t=e.reduce;return e===gT||_T(gT,e)&&t===gT.reduce?TT:t},RT=ST,yT=Z(RT),vT=Nc,AT=bu,bT=uo([].reverse),IT=[1,2];vT({target:"Array",proto:!0,forced:String(IT)===String(IT.reverse())},{reverse:function(){return AT(this)&&(this.length=this.length),bT(this)}});var OT=Jc("Array").reverse,CT=lo,NT=OT,wT=Array.prototype,DT=function(e){var t=e.reverse;return e===wT||CT(wT,e)&&t===wT.reverse?NT:t},PT=DT,LT=Z(PT),kT=Nc,MT=bu,UT=Xu,xT=rs,VT=Vc,FT=Gc,BT=$o,jT=wu,GT=pa,WT=jf,HT=ol("slice"),KT=GT("species"),YT=Array,zT=Math.max;kT({target:"Array",proto:!0,forced:!HT},{slice:function(e,t){var r,i,n,o=BT(this),s=FT(o),a=VT(e,s),c=VT(void 0===t?s:t,s);if(MT(o)&&(r=o.constructor,(UT(r)&&(r===YT||MT(r.prototype))||xT(r)&&null===(r=r[KT]))&&(r=void 0),r===YT||void 0===r))return WT(o,a,c);for(i=new(void 0===r?YT:r)(zT(c-a,0)),n=0;a<c;a++,n++)a in o&&jT(i,n,o[a]);return i.length=n,i}});var XT=Jc("Array").slice,ZT=lo,JT=XT,QT=Array.prototype,qT=function(e){var t=e.slice;return e===QT||ZT(QT,e)&&t===QT.slice?JT:t},$T=Z(qT);function eg(e,t,r,i,n){var o,s,a,c={};return iT(o=sT(i)).call(o,(function(e){c[e]=i[e]})),c.enumerable=!!c.enumerable,c.configurable=!!c.configurable,("value"in c||c.initializer)&&(c.writable=!0),c=yT(s=LT(a=$T(r).call(r)).call(a)).call(s,(function(r,i){return i(e,t,r)||r}),c),n&&void 0!==c.initializer&&(c.value=c.initializer?c.initializer.call(n):void 0,c.initializer=void 0),void 0===c.initializer&&(vu(e,t,c),c=null),c}var tg=cs,rg=ih,ig=Th,ng=ic,og=uo([].concat),sg=tg("Reflect","ownKeys")||function(e){var t=rg.f(ng(e)),r=ig.f;return r?og(t,r(e)):t},ag=$s,cg=sg,dg=wo,ug=qa,lg=rs,hg=_c,pg=Error,fg=uo("".replace),Eg=String(pg("zxcasd").stack),mg=/\n\s*at [^:]*:[^\n]*/,_g=mg.test(Eg),Tg=jo,gg=!io((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Tg(1,7)),7!==e.stack)})),Sg=_c,Rg=function(e,t){if(_g&&"string"==typeof e&&!pg.prepareStackTrace)for(;t--;)e=fg(e,mg,"");return e},yg=gg,vg=Error.captureStackTrace,Ag=OE,bg=pa("iterator"),Ig=Array.prototype,Og=function(e){return void 0!==e&&(Ag.Array===e||Ig[bg]===e)},Cg=ld,Ng=Ms,wg=zo,Dg=OE,Pg=pa("iterator"),Lg=function(e){if(!wg(e))return Ng(e,Pg)||Ng(e,"@@iterator")||Dg[Cg(e)]},kg=ko,Mg=Ps,Ug=ic,xg=Cs,Vg=Lg,Fg=TypeError,Bg=function(e,t){var r=arguments.length<2?Vg(e):t;if(Mg(r))return Ug(kg(r,e));throw Fg(xg(e)+" is not iterable")},jg=ko,Gg=ic,Wg=Ms,Hg=function(e,t,r){var i,n;Gg(e);try{if(!(i=Wg(e,"return"))){if("throw"===t)throw r;return r}i=jg(i,e)}catch(e){n=!0,i=e}if("throw"===t)throw r;if(n)throw i;return Gg(i),r},Kg=Qa,Yg=ko,zg=ic,Xg=Cs,Zg=Og,Jg=Gc,Qg=lo,qg=Bg,$g=Lg,eS=Hg,tS=TypeError,rS=function(e,t){this.stopped=e,this.result=t},iS=rS.prototype,nS=function(e,t,r){var i,n,o,s,a,c,d,u=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),E=Kg(t,u),m=function(e){return i&&eS(i,"normal",e),new rS(!0,e)},_=function(e){return l?(zg(e),f?E(e[0],e[1],m):E(e[0],e[1])):f?E(e,m):E(e)};if(h)i=e.iterator;else if(p)i=e;else{if(!(n=$g(e)))throw tS(Xg(e)+" is not iterable");if(Zg(n)){for(o=0,s=Jg(e);s>o;o++)if((a=_(e[o]))&&Qg(iS,a))return a;return new rS(!1)}i=qg(e,n)}for(c=h?e.next:i.next;!(d=Yg(c,i)).done;){try{a=_(d.value)}catch(e){eS(i,"throw",e)}if("object"==typeof a&&a&&Qg(iS,a))return a}return new rS(!1)},oS=fd,sS=Nc,aS=lo,cS=GE,dS=fm,uS=function(e,t,r){for(var i=cg(t),n=ug.f,o=dg.f,s=0;s<i.length;s++){var a=i[s];ag(e,a)||r&&ag(r,a)||n(e,a,o(t,a))}},lS=rh,hS=_c,pS=jo,fS=function(e,t){lg(t)&&"cause"in t&&hg(e,"cause",t.cause)},ES=function(e,t,r,i){yg&&(vg?vg(e,t):Sg(e,"stack",Rg(r,i)))},mS=nS,_S=function(e,t){return void 0===e?arguments.length<2?"":t:oS(e)},TS=pa("toStringTag"),gS=Error,SS=[].push,RS=function(e,t){var r,i=aS(yS,this);dS?r=dS(gS(),i?cS(this):yS):(r=i?this:lS(yS),hS(r,TS,"Error")),void 0!==t&&hS(r,"message",_S(t)),ES(r,RS,r.stack,1),arguments.length>2&&fS(r,arguments[2]);var n=[];return mS(e,SS,{that:n}),hS(r,"errors",n),r};dS?dS(RS,gS):uS(RS,gS,{name:!0});var yS=RS.prototype=lS(gS.prototype,{constructor:pS(1,RS),message:pS(1,""),name:pS(1,"AggregateError")});sS({global:!0,constructor:!0,arity:2},{AggregateError:RS});var vS,AS,bS,IS,OS=cs,CS=yh,NS=Do,wS=pa("species"),DS=lo,PS=TypeError,LS=function(e,t){if(DS(t,e))return e;throw PS("Incorrect invocation")},kS=Xu,MS=Cs,US=TypeError,xS=ic,VS=function(e){if(kS(e))return e;throw US(MS(e)+" is not a constructor")},FS=zo,BS=pa("species"),jS=function(e,t){var r,i=xS(e).constructor;return void 0===i||FS(r=xS(i)[BS])?t:VS(r)},GS=TypeError,WS=function(e,t){if(e<t)throw GS("Not enough arguments");return e},HS=/(?:ipad|iphone|ipod).*applewebkit/i.test(ds),KS=po,YS=To,zS=Qa,XS=No,ZS=$s,JS=io,QS=Fl,qS=jf,$S=Oa,eR=WS,tR=HS,rR=fT,iR=KS.setImmediate,nR=KS.clearImmediate,oR=KS.process,sR=KS.Dispatch,aR=KS.Function,cR=KS.MessageChannel,dR=KS.String,uR=0,lR={},hR="onreadystatechange";JS((function(){vS=KS.location}));var pR=function(e){if(ZS(lR,e)){var t=lR[e];delete lR[e],t()}},fR=function(e){return function(){pR(e)}},ER=function(e){pR(e.data)},mR=function(e){KS.postMessage(dR(e),vS.protocol+"//"+vS.host)};iR&&nR||(iR=function(e){eR(arguments.length,1);var t=XS(e)?e:aR(e),r=qS(arguments,1);return lR[++uR]=function(){YS(t,void 0,r)},AS(uR),uR},nR=function(e){delete lR[e]},rR?AS=function(e){oR.nextTick(fR(e))}:sR&&sR.now?AS=function(e){sR.now(fR(e))}:cR&&!tR?(IS=(bS=new cR).port2,bS.port1.onmessage=ER,AS=zS(IS.postMessage,IS)):KS.addEventListener&&XS(KS.postMessage)&&!KS.importScripts&&vS&&"file:"!==vS.protocol&&!JS(mR)?(AS=mR,KS.addEventListener("message",ER,!1)):AS=hR in $S("script")?function(e){QS.appendChild($S("script"))[hR]=function(){QS.removeChild(this),pR(e)}}:function(e){setTimeout(fR(e),0)});var _R={set:iR,clear:nR},TR=function(){this.head=null,this.tail=null};TR.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}};var gR,SR,RR,yR,vR,AR=TR,bR=/ipad|iphone|ipod/i.test(ds)&&"undefined"!=typeof Pebble,IR=/web0s(?!.*chrome)/i.test(ds),OR=po,CR=Qa,NR=wo.f,wR=_R.set,DR=AR,PR=HS,LR=bR,kR=IR,MR=fT,UR=OR.MutationObserver||OR.WebKitMutationObserver,xR=OR.document,VR=OR.process,FR=OR.Promise,BR=NR(OR,"queueMicrotask"),jR=BR&&BR.value;if(!jR){var GR=new DR,WR=function(){var e,t;for(MR&&(e=VR.domain)&&e.exit();t=GR.get();)try{t()}catch(e){throw GR.head&&gR(),e}e&&e.enter()};PR||MR||kR||!UR||!xR?!LR&&FR&&FR.resolve?((yR=FR.resolve(void 0)).constructor=FR,vR=CR(yR.then,yR),gR=function(){vR(WR)}):MR?gR=function(){VR.nextTick(WR)}:(wR=CR(wR,OR),gR=function(){wR(WR)}):(SR=!0,RR=xR.createTextNode(""),new UR(WR).observe(RR,{characterData:!0}),gR=function(){RR.data=SR=!SR}),jR=function(e){GR.head||gR(),GR.add(e)}}var HR=jR,KR=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},YR=po.Promise,zR="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,XR=!zR&&!fT&&"object"==typeof window&&"object"==typeof document,ZR=po,JR=YR,QR=No,qR=za,$R=ku,ey=pa,ty=XR,ry=zR,iy=ms,ny=JR&&JR.prototype,oy=ey("species"),sy=!1,ay=QR(ZR.PromiseRejectionEvent),cy=qR("Promise",(function(){var e=$R(JR),t=e!==String(JR);if(!t&&66===iy)return!0;if(!ny.catch||!ny.finally)return!0;if(!iy||iy<51||!/native code/.test(e)){var r=new JR((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};if((r.constructor={})[oy]=i,!(sy=r.then((function(){}))instanceof i))return!0}return!t&&(ty||ry)&&!ay})),dy={CONSTRUCTOR:cy,REJECTION_EVENT:ay,SUBCLASSING:sy},uy={},ly=Ps,hy=TypeError,py=function(e){var t,r;this.promise=new e((function(e,i){if(void 0!==t||void 0!==r)throw hy("Bad Promise constructor");t=e,r=i})),this.resolve=ly(t),this.reject=ly(r)};uy.f=function(e){return new py(e)};var fy,Ey,my=Nc,_y=fT,Ty=po,gy=ko,Sy=Sh,Ry=Yh,yy=function(e){var t=OS(e);NS&&t&&!t[wS]&&CS(t,wS,{configurable:!0,get:function(){return this}})},vy=Ps,Ay=No,by=rs,Iy=LS,Oy=jS,Cy=_R.set,Ny=HR,wy=function(e,t){try{1==arguments.length?console.error(e):console.error(e,t)}catch(e){}},Dy=KR,Py=AR,Ly=cp,ky=YR,My=dy,Uy=uy,xy="Promise",Vy=My.CONSTRUCTOR,Fy=My.REJECTION_EVENT,By=Ly.getterFor(xy),jy=Ly.set,Gy=ky&&ky.prototype,Wy=ky,Hy=Gy,Ky=Ty.TypeError,Yy=Ty.document,zy=Ty.process,Xy=Uy.f,Zy=Xy,Jy=!!(Yy&&Yy.createEvent&&Ty.dispatchEvent),Qy="unhandledrejection",qy=function(e){var t;return!(!by(e)||!Ay(t=e.then))&&t},$y=function(e,t){var r,i,n,o=t.value,s=1==t.state,a=s?e.ok:e.fail,c=e.resolve,d=e.reject,u=e.domain;try{a?(s||(2===t.rejection&&nv(t),t.rejection=1),!0===a?r=o:(u&&u.enter(),r=a(o),u&&(u.exit(),n=!0)),r===e.promise?d(Ky("Promise-chain cycle")):(i=qy(r))?gy(i,r,c,d):c(r)):d(o)}catch(e){u&&!n&&u.exit(),d(e)}},ev=function(e,t){e.notified||(e.notified=!0,Ny((function(){for(var r,i=e.reactions;r=i.get();)$y(r,e);e.notified=!1,t&&!e.rejection&&rv(e)})))},tv=function(e,t,r){var i,n;Jy?((i=Yy.createEvent("Event")).promise=t,i.reason=r,i.initEvent(e,!1,!0),Ty.dispatchEvent(i)):i={promise:t,reason:r},!Fy&&(n=Ty["on"+e])?n(i):e===Qy&&wy("Unhandled promise rejection",r)},rv=function(e){gy(Cy,Ty,(function(){var t,r=e.facade,i=e.value;if(iv(e)&&(t=Dy((function(){_y?zy.emit("unhandledRejection",i,r):tv(Qy,r,i)})),e.rejection=_y||iv(e)?2:1,t.error))throw t.value}))},iv=function(e){return 1!==e.rejection&&!e.parent},nv=function(e){gy(Cy,Ty,(function(){var t=e.facade;_y?zy.emit("rejectionHandled",t):tv("rejectionhandled",t,e.value)}))},ov=function(e,t,r){return function(i){e(t,i,r)}},sv=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,ev(e,!0))},av=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw Ky("Promise can't be resolved itself");var i=qy(t);i?Ny((function(){var r={done:!1};try{gy(i,t,ov(av,r,e),ov(sv,r,e))}catch(t){sv(r,t,e)}})):(e.value=t,e.state=1,ev(e,!1))}catch(t){sv({done:!1},t,e)}}};Vy&&(Hy=(Wy=function(e){Iy(this,Hy),vy(e),gy(fy,this);var t=By(this);try{e(ov(av,t),ov(sv,t))}catch(e){sv(t,e)}}).prototype,(fy=function(e){jy(this,{type:xy,done:!1,notified:!1,parent:!1,reactions:new Py,rejection:!1,state:0,value:void 0})}).prototype=Sy(Hy,"then",(function(e,t){var r=By(this),i=Xy(Oy(this,Wy));return r.parent=!0,i.ok=!Ay(e)||e,i.fail=Ay(t)&&t,i.domain=_y?zy.domain:void 0,0==r.state?r.reactions.add(i):Ny((function(){$y(i,r)})),i.promise})),Ey=function(){var e=new fy,t=By(e);this.promise=e,this.resolve=ov(av,t),this.reject=ov(sv,t)},Uy.f=Xy=function(e){return e===Wy||undefined===e?new Ey(e):Zy(e)}),my({global:!0,constructor:!0,wrap:!0,forced:Vy},{Promise:Wy}),Ry(Wy,xy,!1,!0),yy(xy);var cv=pa("iterator"),dv=!1;try{var uv=0,lv={next:function(){return{done:!!uv++}},return:function(){dv=!0}};lv[cv]=function(){return this},Array.from(lv,(function(){throw 2}))}catch(e){}var hv=YR,pv=function(e,t){if(!t&&!dv)return!1;var r=!1;try{var i={};i[cv]=function(){return{next:function(){return{done:r=!0}}}},e(i)}catch(e){}return r},fv=dy.CONSTRUCTOR||!pv((function(e){hv.all(e).then(void 0,(function(){}))})),Ev=ko,mv=Ps,_v=uy,Tv=KR,gv=nS;Nc({target:"Promise",stat:!0,forced:fv},{all:function(e){var t=this,r=_v.f(t),i=r.resolve,n=r.reject,o=Tv((function(){var r=mv(t.resolve),o=[],s=0,a=1;gv(e,(function(e){var c=s++,d=!1;a++,Ev(r,t,e).then((function(e){d||(d=!0,o[c]=e,--a||i(o))}),n)})),--a||i(o)}));return o.error&&n(o.value),r.promise}});var Sv=Nc,Rv=dy.CONSTRUCTOR;YR&&YR.prototype,Sv({target:"Promise",proto:!0,forced:Rv,real:!0},{catch:function(e){return this.then(void 0,e)}});var yv=ko,vv=Ps,Av=uy,bv=KR,Iv=nS;Nc({target:"Promise",stat:!0,forced:fv},{race:function(e){var t=this,r=Av.f(t),i=r.reject,n=bv((function(){var n=vv(t.resolve);Iv(e,(function(e){yv(n,t,e).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}});var Ov=ko,Cv=uy;Nc({target:"Promise",stat:!0,forced:dy.CONSTRUCTOR},{reject:function(e){var t=Cv.f(this);return Ov(t.reject,void 0,e),t.promise}});var Nv=ic,wv=rs,Dv=uy,Pv=function(e,t){if(Nv(e),wv(t)&&t.constructor===e)return t;var r=Dv.f(e);return(0,r.resolve)(t),r.promise},Lv=Nc,kv=YR,Mv=dy.CONSTRUCTOR,Uv=Pv,xv=cs("Promise"),Vv=!Mv;Lv({target:"Promise",stat:!0,forced:true},{resolve:function(e){return Uv(Vv&&this===xv?kv:this,e)}});var Fv=ko,Bv=Ps,jv=uy,Gv=KR,Wv=nS;Nc({target:"Promise",stat:!0,forced:fv},{allSettled:function(e){var t=this,r=jv.f(t),i=r.resolve,n=r.reject,o=Gv((function(){var r=Bv(t.resolve),n=[],o=0,s=1;Wv(e,(function(e){var a=o++,c=!1;s++,Fv(r,t,e).then((function(e){c||(c=!0,n[a]={status:"fulfilled",value:e},--s||i(n))}),(function(e){c||(c=!0,n[a]={status:"rejected",reason:e},--s||i(n))}))})),--s||i(n)}));return o.error&&n(o.value),r.promise}});var Hv=ko,Kv=Ps,Yv=cs,zv=uy,Xv=KR,Zv=nS,Jv="No one promise resolved";Nc({target:"Promise",stat:!0,forced:fv},{any:function(e){var t=this,r=Yv("AggregateError"),i=zv.f(t),n=i.resolve,o=i.reject,s=Xv((function(){var i=Kv(t.resolve),s=[],a=0,c=1,d=!1;Zv(e,(function(e){var u=a++,l=!1;c++,Hv(i,t,e).then((function(e){l||d||(d=!0,n(e))}),(function(e){l||d||(l=!0,s[u]=e,--c||o(new r(s,Jv)))}))})),--c||o(new r(s,Jv))}));return s.error&&o(s.value),i.promise}});var Qv=Nc,qv=YR,$v=io,eA=cs,tA=No,rA=jS,iA=Pv,nA=qv&&qv.prototype;Qv({target:"Promise",proto:!0,real:!0,forced:!!qv&&$v((function(){nA.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=rA(this,eA("Promise")),r=tA(e);return this.then(r?function(r){return iA(t,e()).then((function(){return r}))}:e,r?function(r){return iA(t,e()).then((function(){throw r}))}:e)}});var oA=Z(is.Promise);class sA extends fi{set _mediaStreamTrack(e){e!==this.mediaStreamTrack&&(this.safeEmit(eu.TRACK_UPDATED,e),this.mediaStreamTrack=e)}get _mediaStreamTrack(){return this.mediaStreamTrack}constructor(e,t){super(),H_(this,"trackMediaType",void 0),H_(this,"_ID",void 0),H_(this,"_rtpTransceiver",void 0),H_(this,"_lowRtpTransceiver",void 0),H_(this,"_hints",[]),H_(this,"_isClosed",!1),H_(this,"_originMediaStreamTrack",void 0),H_(this,"mediaStreamTrack",void 0),H_(this,"_external",{}),this._ID=t||Fi(8,"track-"),this._originMediaStreamTrack=e,this.mediaStreamTrack=e,Wd(this)}toString(){return this._ID}getTrackId(){return this._ID}getMediaStreamTrack(e){return e||Ui((()=>{var e;zn.reportApiInvoke(null,{name:Ti.GET_MEDIA_STREAM_TRACK,options:[],tag:gi.TRACER}).onSuccess((null===(e=this._mediaStreamTrack)||void 0===e?void 0:e.label)||"")}),this.mediaStreamTrack.id||this.getTrackId()),this._mediaStreamTrack}getRTCRtpTransceiver(e){return e===Qd.LOW_STREAM?this._lowRtpTransceiver:this._rtpTransceiver}getMediaStreamTrackSettings(){return this.getMediaStreamTrack(!0).getSettings()}close(){this._isClosed=!0,this._lowRtpTransceiver=void 0,this._rtpTransceiver=void 0,Hd(this),this.emit(tu.CLOSED),this.removeAllListeners(eu.SEI_RECEIVED)}_updateRtpTransceiver(e,t){if(t===Qd.LOW_STREAM){if(this._lowRtpTransceiver===e)return;this._lowRtpTransceiver=e}else{if(this._rtpTransceiver===e)return;this._rtpTransceiver=e}this.emit(eu.TRANSCEIVER_UPDATED,e,t)}}class aA extends sA{get isExternalTrack(){return this._isExternalTrack}get muted(){return this._muted}get enabled(){return this._enabled}get processorContext(){return this._processorContext}constructor(e,t){super(e,t),H_(this,"_enabled",!0),H_(this,"_muted",!1),H_(this,"_isExternalTrack",!1),H_(this,"_isClosed",!1),H_(this,"_enabledMutex",void 0),H_(this,"processor",void 0),H_(this,"_processorContext",void 0),H_(this,"_handleTrackEnded",(()=>{this.onTrackEnded()})),this._enabledMutex=new Zi("".concat(this.getTrackId())),e.addEventListener("ended",this._handleTrackEnded)}getTrackLabel(){var e,t;return null!==(e=null===(t=this._originMediaStreamTrack)||void 0===t?void 0:t.label)&&void 0!==e?e:""}close(){this._isClosed||(this.stop(),this._originMediaStreamTrack.stop(),this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack.stop(),this._mediaStreamTrack=null),this._originMediaStreamTrack=null,this._enabledMutex=null,On.debug("[".concat(this.getTrackId(),"] close")),this.emit(Zd.NEED_CLOSE),super.close())}async _updateOriginMediaStreamTrack(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this._isExternalTrack=r,e!==this._originMediaStreamTrack&&(this._originMediaStreamTrack&&(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),t&&this._originMediaStreamTrack.stop()),e.addEventListener("ended",this._handleTrackEnded),this._originMediaStreamTrack=e,this._muted&&(this._originMediaStreamTrack.enabled=!1),this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await vi(this,Zd.NEED_REPLACE_TRACK,this),this.processor&&this._processorContext&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this._processorContext}))}_getDefaultPlayerConfig(){return{}}onTrackEnded(){On.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(tu.TRACK_ENDED)}stateCheck(e,t){if(On.debug("check track state, [muted: ".concat(this._muted,", enabled: ").concat(this._enabled,"] to [").concat(e,": ").concat(t,"]")),oi(t,e),this._enabled&&this._muted&&"enabled"===e&&!1===t)throw new ni(ii.TRACK_STATE_UNREACHABLE,"cannot set enabled while the track is muted").print("error",On);if(!this._enabled&&!this._muted&&"muted"===e&&!0===t)throw new ni(ii.TRACK_STATE_UNREACHABLE,"cannot set muted while the track is disabled").print("error",On)}getProcessorStats(){return this._processorContext&&this._processorContext.gatherStats()||[]}getProcessorUsage(){return this._processorContext?this._processorContext.gatherUsage():oA.resolve([])}}function cA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}const dA=window.AudioContext||window.webkitAudioContext;let uA,lA=null;const hA=new class extends fi{constructor(){super(...arguments),H_(this,"prevState",void 0),H_(this,"curState",void 0),H_(this,"currentTime",void 0),H_(this,"currentTimeStuckAt",void 0),H_(this,"interruptDetectorTrack",void 0),H_(this,"onLocalAudioTrackMute",(()=>{On.info("ios15-interruption-start"),this.emit(ro.IOS_15_16_INTERRUPTION_START)})),H_(this,"onLocalAudioTrackUnmute",(async()=>{On.info("ios15-interruption-end"),"running"!==this.curState||this.duringInterruption?On.info("ios15-interruption-end-canceled"):(lA&&await lA.suspend(),this.emit(ro.IOS_15_16_INTERRUPTION_END))}))}get duringInterruption(){return"running"===this.prevState&&"interrupted"===this.curState}bindInterruptDetectorTrack(e){On.debug("webaudio bindInterruptDetectorTrack ".concat(e.getTrackId())),this.interruptDetectorTrack||(this.interruptDetectorTrack=e,this.interruptDetectorTrack._mediaStreamTrack.onmute=this.onLocalAudioTrackMute,this.interruptDetectorTrack._mediaStreamTrack.onunmute=this.onLocalAudioTrackUnmute)}unbindInterruptDetectorTrack(e){On.debug("webaudio unbindInterruptDetectorTrack ".concat(e.getTrackId())),this.interruptDetectorTrack&&this.interruptDetectorTrack===e&&(this.interruptDetectorTrack._mediaStreamTrack&&(this.interruptDetectorTrack._mediaStreamTrack.onmute=null,this.interruptDetectorTrack._mediaStreamTrack.onunmute=null),this.interruptDetectorTrack=void 0)}};function pA(){if(!dA)return void On.error("your browser is not support web audio");On.info("create audio context");const e=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?cA(Object(r),!0).forEach((function(t){H_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},hn("WEBAUDIO_INIT_OPTIONS"));On.debug("audio context init option:",JSON.stringify(e)),lA=new dA(e),hA.curState=lA.state,lA.onstatechange=()=>{hA.prevState=hA.curState,hA.curState=lA?lA.state:void 0;const{prevState:e,curState:t}=hA,r="running"===t,i="interrupted"===t,n="running"===e,o="suspended"===e,s="interrupted"===e,a=wr().osVersion;(Fr()||Xr())&&n&&i&&(On.info("ios".concat(a,"-interruption-start")),hA.emit(ro.IOS_INTERRUPTION_START)),(Fr()||Xr())&&(o||s)&&r&&(On.info("ios".concat(a,"-interruption-end")),hA.emit(ro.IOS_INTERRUPTION_END)),e!==t&&hA.emit(ro.STATE_CHANGE,t,e)},setInterval((()=>{var e;const t=null===(e=lA)||void 0===e?void 0:e.currentTime;if(hA.currentTime!==t)hA.currentTimeStuckAt&&(On.debug("AudioContext current time resume at ".concat(t)),hA.currentTimeStuckAt=void 0),hA.currentTime=t;else{if(t!==hA.currentTimeStuckAt){zn.reportApiInvoke(null,{name:"WEB_AUDIO_CURRENT_TIME_STUCK",options:{currentTime:t},tag:gi.TRACER}).onSuccess(),On.warning("AudioContext current time stuck at ".concat(t))}hA.currentTimeStuckAt=t}}),5e3),async function(e){const t=["click","contextmenu","auxclick","dblclick","mousedown","mouseup","touchend","keydown","keyup"];let r,i=!1,n=!1,o=!1;function s(t){"running"===e.state?a(!1):Fr()||Xr()?"suspended"===e.state&&(a(!0),t&&e.resume().then(d,d)):"closed"!==e.state&&(a(!0),t&&e.resume().then(d,d))}function a(e){if(i!==e){i=e;for(let r=0,i=t;r<i.length;r+=1){const t=i[r];e?window.addEventListener(t,u,{capture:!0,passive:!0}):window.removeEventListener(t,u,{capture:!0,passive:!0})}}}function c(){s(!0)}function d(){s(!1)}function u(){s(!0)}function l(){let e;try{e=r.play(),e?e.then(f,f):(r.addEventListener("playing",f),r.addEventListener("abort",f),r.addEventListener("error",f))}catch(e){f()}}function h(e){o||(r.paused?e?(p(!1),o=!0,l()):p(!0):p(!1))}function p(e){if(n!==e){n=e;for(let r=0,i=t;r<i.length;r++){const t=i[r];e?window.addEventListener(t,E,{capture:!0,passive:!0}):window.removeEventListener(t,E,{capture:!0,passive:!0})}}}function f(){r.removeEventListener("playing",f),r.removeEventListener("abort",f),r.removeEventListener("error",f),o=!1,h(!1)}function E(){h(!0)}let m;if(Fr()&&hn("IOS_BG_TAG")){const t=e.createMediaStreamDestination(),i=document.createElement("div");i.innerHTML="<audio x-webkit-airplay='deny'></audio>",r=i.children.item(0),r.controls=!1,r.disableRemotePlayback=!0,r.preload="auto",r.srcObject=t.stream,m=()=>{if(hn("IOS_AUTO_RESTART_BG_TAG")&&r&&r.srcObject&&!o&&(!r.paused||!0!==n)){r.paused||r.pause();try{o=!0,l()}catch(e){o=!1}return!0}},h(!0)}return hA.on(ro.STATE_CHANGE,c),s(!1),m}(lA).then((e=>{uA=e}))}function fA(){if(uA){if(uA()){zn.reportApiInvoke(null,{name:"BG_AUDIO_TAG_RESTART",options:{},tag:gi.TRACER}).onSuccess(),On.debug("restart background audio tag success")}}}function EA(){if(!lA){if(pA(),!lA)throw new ni(ii.NOT_SUPPORTED,"can not create audio context");return lA}return lA}function mA(){return!!lA}function _A(e){if(function(){if(null!==gA)return gA;const e=EA(),t=e.createBufferSource(),r=e.createGain(),i=e.createGain();t.connect(r),t.connect(i),t.disconnect(r);let n=!1;try{t.disconnect(r)}catch(e){n=!0}return t.disconnect(),gA=n,n}())return;const t=e.connect,r=e.disconnect;e.connect=(r,i,n)=>{var o;return e._inputNodes||(e._inputNodes=[]),Nd(o=e._inputNodes).call(o,r)||(r instanceof AudioNode?(e._inputNodes.push(r),t.call(e,r,i,n)):t.call(e,r,i)),e},e.disconnect=(i,n,o)=>{r.call(e),i?Di(e._inputNodes,i):e._inputNodes=[];for(const r of e._inputNodes)t.call(e,r)}}function TA(e){const t=EA();return new oA(((r,i)=>{t.decodeAudioData(e,(e=>{r(e)}),(e=>{i(new ni(ii.DECODE_AUDIO_FILE_FAILED,e.toString()))}))}))}let gA=null;let SA=null;function RA(e){for(let t=0;t<e.outputBuffer.numberOfChannels;t+=1){const r=e.outputBuffer.getChannelData(t);for(let e=0;e<r.length;e+=1)r[e]=0}return e.inputBuffer}var yA=Z(RT);class vA{constructor(){H_(this,"context",void 0),H_(this,"analyserNode",void 0),H_(this,"sourceNode",void 0),this.context=EA(),this.analyserNode=this.context.createAnalyser(),this.analyserNode.fftSize=2048,this.analyserNode.smoothingTimeConstant=.4}updateSource(e){if(e!==this.sourceNode){if(this.sourceNode)try{this.sourceNode.disconnect(this.analyserNode)}catch(e){}this.sourceNode=e,null==e||e.connect(this.analyserNode)}}getVolumeLevel(){if(!this.sourceNode)return 0;if(!this.context||Fr()||Xr()||"running"!==this.context.state&&this.context.resume(),!this.analyserNode)return 0;const e=new Float32Array(this.analyserNode.fftSize);if(this.analyserNode.getFloatTimeDomainData)this.analyserNode.getFloatTimeDomainData(e);else{const t=new Uint8Array(this.analyserNode.fftSize);this.analyserNode.getByteTimeDomainData(t);for(let r=0;r<e.length;++r)e[r]=t[r]/128-1}const t=yA(e).call(e,((e,t)=>e+t*t),0)/e.length;return Math.max(10*Math.log10(t)+100,0)/100}getAnalyserNode(){return this.analyserNode}rebuildAnalyser(){try{var e,t;null===(e=this.sourceNode)||void 0===e||e.disconnect(this.analyserNode),this.analyserNode=this.context.createAnalyser(),this.analyserNode.fftSize=2048,this.analyserNode.smoothingTimeConstant=.4,null===(t=this.sourceNode)||void 0===t||t.connect(this.analyserNode)}catch(e){On.warning("rebuild analyser node failed.")}}destroy(){this.updateSource(void 0)}}class AA extends fi{get processSourceNode(){return this.sourceNode}set processedNode(e){var t;if(!this.isDestroyed&&this._processedNode!==e){try{var r;null===(r=this.sourceNode)||void 0===r||r.disconnect(this.outputNode)}catch(e){}null===(t=this._processedNode)||void 0===t||t.disconnect(),this._processedNode=e,this.connect()}}get processedNode(){return this._processedNode}constructor(){super(),H_(this,"outputNode",void 0),H_(this,"outputTrack",void 0),H_(this,"isPlayed",!1),H_(this,"sourceNode",void 0),H_(this,"context",void 0),H_(this,"audioBufferNode",void 0),H_(this,"destNode",void 0),H_(this,"audioOutputLevel",0),H_(this,"volumeLevelAnalyser",void 0),H_(this,"_processedNode",void 0),H_(this,"playNode",void 0),H_(this,"isDestroyed",!1),H_(this,"onNoAudioInput",void 0),H_(this,"isNoAudioInput",!1),H_(this,"_noAudioInputCount",0),this.context=EA(),this.playNode=this.context.destination,this.outputNode=this.context.createGain(),_A(this.outputNode),this.volumeLevelAnalyser=new vA}startGetAudioBuffer(e){this.audioBufferNode||(this.audioBufferNode=this.context.createScriptProcessor(e),this.outputNode.connect(this.audioBufferNode),this.audioBufferNode.connect(this.context.destination),this.audioBufferNode.onaudioprocess=e=>{this.emit(nu.ON_AUDIO_BUFFER,RA(e))})}stopGetAudioBuffer(){this.audioBufferNode&&(this.audioBufferNode.onaudioprocess=null,this.outputNode.disconnect(this.audioBufferNode),this.audioBufferNode=void 0)}createOutputTrack(){if(!Jn().webAudioMediaStreamDest)throw new ni(ii.NOT_SUPPORTED,"your browser is not support audio processor");return this.destNode&&this.outputTrack||(this.destNode=this.context.createMediaStreamDestination(),this.outputNode.connect(this.destNode),this.outputTrack=this.destNode.stream.getAudioTracks()[0]),this.outputTrack}play(e){"running"!==this.context.state&&Pi((()=>{hA.emit("autoplay-failed")})),this.isPlayed=!0,this.playNode=e||this.context.destination,this.outputNode.connect(this.playNode)}stop(){if(this.isPlayed)try{this.outputNode.disconnect(this.playNode)}catch(e){}this.isPlayed=!1}getAccurateVolumeLevel(){return this.volumeLevelAnalyser.getVolumeLevel()}async checkHasAudioInput(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(e>5)return this.isNoAudioInput=!0,this.onNoAudioInput&&this.onNoAudioInput(),!1;Fr()||Xr()?"suspended"===this.context.state&&this.context.resume():"running"!==this.context.state&&this.context.resume();const t=this.volumeLevelAnalyser.getAnalyserNode();let r;t.getFloatTimeDomainData?(r=new Float32Array(t.fftSize),t.getFloatTimeDomainData(r)):(r=new Uint8Array(t.fftSize),t.getByteTimeDomainData(r));let i=!1;for(let e=0;e<r.length;e++)0!==r[e]&&(i=!0);return i?(this.isNoAudioInput=!1,!0):(await Vi(200),await this.checkHasAudioInput(e?e+1:1)&&i)}getAudioVolume(){return this.outputNode.gain.value}setVolume(e){this.outputNode.gain.setValueAtTime(e,this.context.currentTime)}destroy(){this.disconnect(),this.stop(),this.isDestroyed=!0,this.onNoAudioInput=void 0}disconnect(){var e,t;null===(e=this.processedNode)||void 0===e||e.disconnect(),null===(t=this.sourceNode)||void 0===t||t.disconnect(),this.outputNode&&this.outputNode.disconnect()}connect(){var e;this.processedNode?null===(e=this.processedNode)||void 0===e||e.connect(this.outputNode):this.sourceNode&&this.sourceNode.connect(this.outputNode);this.volumeLevelAnalyser.updateSource(this.outputNode)}}class bA extends AA{get isFreeze(){return!1}constructor(e,t,r){var i;if(super(),H_(this,"sourceNode",void 0),H_(this,"track",void 0),H_(this,"clonedTrack",void 0),H_(this,"audioElement",void 0),H_(this,"isCurrentTrackCloned",!1),H_(this,"isRemoteTrack",!1),H_(this,"originVolumeLevelAnalyser",void 0),H_(this,"rebuildWebAudio",(async()=>{if(On.debug("ready to rebuild web audio, state:",this.context.state),this.isNoAudioInput&&await this.checkHasAudioInput(),!this.isNoAudioInput||this.isDestroyed)return document.body.removeEventListener("click",this.rebuildWebAudio,!0),void On.debug("rebuild web audio success, current volume status",this.getAccurateVolumeLevel());this.context.resume().then((()=>On.info("resume success"))),On.debug("rebuild web audio because of ios 12 bugs"),this.disconnect();const e=this.track;this.track=this.track.clone(),this.isCurrentTrackCloned?e.stop():this.isCurrentTrackCloned=!0;const t=new MediaStream([this.track]);this.sourceNode=this.context.createMediaStreamSource(t),_A(this.sourceNode),this.volumeLevelAnalyser.rebuildAnalyser();const r=this.outputNode.gain.value;this.outputNode=this.context.createGain(),this.outputNode.gain.setValueAtTime(r,this.context.currentTime),_A(this.outputNode),this.emit(nu.UPDATE_SOURCE),this.connect(),this.audioElement.srcObject=t,this.isPlayed&&this.play(this.playNode),this.checkHasAudioInput()})),"audio"!==e.kind)throw new ni(ii.UNEXPECTED_ERROR);this.track=e;const n=new MediaStream([this.track]);if(this.isRemoteTrack=!!t,this.sourceNode=this.context.createMediaStreamSource(n),_A(this.sourceNode),r){const e=r.clone();e.enabled=!0,this.clonedTrack=e,On.debug("create an unmuted track ".concat(e.id," from the original track ").concat(r.id," to get the volume"));const t=this.context.createMediaStreamSource(new MediaStream([e]));_A(t),this.originVolumeLevelAnalyser=new vA,this.originVolumeLevelAnalyser.updateSource(t)}this.connect(),this.audioElement=document.createElement("audio"),this.audioElement.srcObject=n;const o=wr();t&&o.os===br.IOS&&Number(null===(i=o.osVersion)||void 0===i?void 0:i.split(".")[0])<15&&(hA.on(ro.STATE_CHANGE,(()=>{"suspended"===this.context.state?document.body.addEventListener("click",this.rebuildWebAudio,!0):"running"===this.context.state&&this.rebuildWebAudio()})),this.checkHasAudioInput().then((e=>{e||document.body.addEventListener("click",this.rebuildWebAudio,!0)})))}updateTrack(e){this.sourceNode.disconnect(),this.track=e,this.isCurrentTrackCloned=!1;const t=new MediaStream([e]);this.sourceNode=this.context.createMediaStreamSource(t),_A(this.sourceNode),this.processedNode||this.sourceNode.connect(this.outputNode),this.emit(nu.UPDATE_SOURCE),this.audioElement.srcObject=t}destroy(){var e;this.audioElement.srcObject=null,this.audioElement.remove(),hA.off("state-change",this.rebuildWebAudio),null===(e=this.originVolumeLevelAnalyser)||void 0===e||e.destroy(),this.clonedTrack=void 0,super.destroy()}createMediaStreamSourceNode(e){return this.context.createMediaStreamSource(new MediaStream([e]))}updateOriginTrack(e){const t=e.clone();t.enabled=!0,this.clonedTrack&&(this.clonedTrack.stop(),this.clonedTrack=t),On.debug("create an unmuted track ".concat(t.id," from the original track ").concat(e.id," to get the volume"));const r=this.context.createMediaStreamSource(new MediaStream([t]));_A(r),this.originVolumeLevelAnalyser&&this.originVolumeLevelAnalyser.updateSource(r)}getOriginVolumeLevel(){return this.originVolumeLevelAnalyser?this.originVolumeLevelAnalyser.getVolumeLevel():this.getAccurateVolumeLevel()}}async function IA(e,t,r){const i=(e,t)=>e?"number"!=typeof e?e.max||e.exact||e.ideal||e.min||t:e:t,n={audio:!!r&&{mandatory:{chromeMediaSource:"desktop"}},video:{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e,maxHeight:i(t.height,1080),maxWidth:i(t.width,1920)}}};return t.frameRate&&"number"!=typeof t.frameRate?(n.video.mandatory.maxFrameRate=t.frameRate.max,n.video.mandatory.minFrameRate=t.frameRate.min):"number"==typeof t.frameRate&&(n.video.mandatory.maxFrameRate=t.frameRate),await navigator.mediaDevices.getUserMedia(n)}async function OA(e,t){const r=await CA(e.mediaSource),{sourceId:i,audio:n}=await function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise(((r,i)=>{const n=document.createElement("div");n.innerText="share screen",n.setAttribute("style","text-align: center; height: 25px; line-height: 25px; border-radius: 4px 4px 0 0; background: #D4D2D4; border-bottom: solid 1px #B9B8B9;");const o=document.createElement("div");o.setAttribute("style","width: 100%; height: 500px; padding: 15px 25px ; box-sizing: border-box;");const s=document.createElement("div");s.innerText="Agora Web Screensharing wants to share the contents of your screen with webdemo.agorabeckon.com. Choose what you'd like to share.",s.setAttribute("style","height: 12%;");const a=document.createElement("div");a.setAttribute("style","width: 100%; height: 80%; background: #FFF; border: solid 1px #CBCBCB; display: flex; flex-wrap: wrap; justify-content: space-around; overflow-y: scroll; padding: 0 15px; box-sizing: border-box;");const c=document.createElement("div");c.setAttribute("style","display: flex; justify-content: space-between; padding: 16px 0;");const d=document.createElement("button");d.innerHTML="cancel",d.setAttribute("style","width: 85px;"),d.onclick=()=>{document.body.removeChild(h);const e=new Error("NotAllowedError");e.name="NotAllowedError",i(e)};let u=t;const l=document.createElement("div");if(t){const e=document.createElement("input");e.setAttribute("type","checkbox");const t=document.createElement("span");e.setAttribute("style","margin-right: 6px;"),t.innerText="Share audio",e.checked=u,e.onchange=()=>{u=e.checked},l.appendChild(e),l.appendChild(t)}c.appendChild(l),c.appendChild(d),o.appendChild(s),o.appendChild(a),o.appendChild(c);const h=document.createElement("div");h.setAttribute("style","position: fixed; z-index: 99999999; top: 50%; left: 50%; width: 620px; height: 525px; background: #ECECEC; border-radius: 4px; -webkit-transform: translate(-50%,-50%); transform: translate(-50%,-50%);"),h.appendChild(n),h.appendChild(o),document.body.appendChild(h),e.map((e=>{if(e.id){const t=document.createElement("div");t.setAttribute("style","width: 30%; height: 160px; padding: 20px 0; text-align: center;box-sizing: content-box;");let i=e.thumbnail;try{const{width:e}=i.getSize();e>1920&&(i=i.resize({width:1920}))}catch(e){throw e&&e.message.startsWith("Illegal invocation")&&console.error("Operate thumbnail error, please try to set contextIsolation: false. (https://github.com/electron/electron/issues/34953)"),e}t.innerHTML='<div style="height: 120px; display: table-cell; vertical-align: middle;"><img style="width: 100%; background: #333333; box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.2);" src='+i.toDataURL()+' /></div><span style="\theight: 40px; line-height: 40px; display: inline-block; width: 70%; word-break: keep-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">'+e.name.replace(/[\u00A0-\u9999<>\&]/g,(function(e){return"&#"+e.charCodeAt(0)+";"}))+"</span>",t.onclick=()=>{document.body.removeChild(h),r({sourceId:e.id,audio:u})},a.appendChild(t)}}))}))}(r,t);return await IA(i,e,n)}async function CA(e){let t=["window","screen"];"application"!==e&&"window"!==e||(t=["window"]),"screen"===e&&(t=["screen"]);const r=_i();if(!r)throw console.error("failed to fetch electron, please mount it to window"),new ni(ii.ELECTRON_IS_NULL);let i=null;try{var n;i=(null===(n=r.desktopCapturer)||void 0===n?void 0:n.getSources({types:t}))||r.ipcRenderer.invoke("DESKTOP_CAPTURER_GET_SOURCES",{types:t})}catch(e){i=null}i&&i.then||(i=new oA(((e,i)=>{r.desktopCapturer.getSources({types:t},((t,r)=>{t?i(t):e(r)}))})));try{return await i}catch(e){throw new ni(ii.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR,e.toString())}}function NA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}const wA=new Zi("safari");async function DA(e,t){let r=0,i=null;for(;r<2;)try{i=await PA(e,t,r>0);break}catch(e){if(e instanceof ni)throw On.error("[".concat(t,"] ").concat(e.toString())),e;const i=LA(e.name||e.code||e,e.message);if(i.code===ii.MEDIA_OPTION_INVALID){On.debug("[".concat(t,"] detect media option invalid, retry")),r+=1,await Vi(500);continue}throw On.error("[".concat(t,"] ").concat(i.toString())),i}if(!i)throw new ni(ii.UNEXPECTED_ERROR,"can not find stream after getUserMedia");return i}async function PA(t,r,i){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new ni(ii.NOT_SUPPORTED,"can not find getUserMedia");i&&(t.video&&(delete t.video.width,delete t.video.height),t.screen&&(delete t.screen.width,delete t.screen.height));const n=Jn(),o=new MediaStream;if(t.audioSource&&o.addTrack(t.audioSource),t.videoSource&&o.addTrack(t.videoSource),!t.audio&&!t.video&&!t.screen)return On.debug("Using Video Source/ Audio Source"),o;if(t.screen)if(Ei())if(t.screen.sourceId){kA(o,await IA(t.screen.sourceId,t.screen,!!t.screenAudio))}else{kA(o,await OA(t.screen,!!t.screenAudio))}else if(Mr()&&t.screen.extensionId&&t.screen.mandatory){if(!n.getStreamFromExtension)throw new ni(ii.NOT_SUPPORTED,"This browser does not support screen sharing");On.debug("[".concat(r,'] Screen access on chrome stable, looking for extension"'));const e=await(a=t.screen.extensionId,c=r,new oA(((e,t)=>{try{chrome.runtime.sendMessage(a,{getStream:!0},(r=>{if(!r||!r.streamId)return On.error("[".concat(c,"] No response from Chrome Plugin. Plugin not installed properly"),r),void t(new ni(ii.CHROME_PLUGIN_NO_RESPONSE,"No response from Chrome Plugin. Plugin not installed properly"));e(r.streamId)}))}catch(e){On.error("[".concat(c,"] AgoraRTC screensharing plugin is not accessible(").concat(a,")"),e.toString()),t(new ni(ii.CHROME_PLUGIN_NOT_INSTALL))}})));t.screen.mandatory.chromeMediaSourceId=e;kA(o,await navigator.mediaDevices.getUserMedia({video:{mandatory:t.screen.mandatory}}))}else if(n.getDisplayMedia){var s;t.screen.mediaSource&&Xd(t.screen.mediaSource);const e={width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate,displaySurface:null!==(s=t.screen.displaySurface)&&void 0!==s?s:"screen"===t.screen.mediaSource?"monitor":t.screen.mediaSource},{selfBrowserSurface:i,surfaceSwitching:n,systemAudio:a,preferCurrentTab:c,windowAudio:d,monitorTypeSurfaces:u}=t.screen,l={selfBrowserSurface:i,surfaceSwitching:n,systemAudio:a,preferCurrentTab:c,windowAudio:d,monitorTypeSurfaces:u};!i&&delete l.selfBrowserSurface,!n&&delete l.surfaceSwitching,!a&&delete l.systemAudio,!c&&delete l.preferCurrentTab,!d&&delete l.windowAudio,!u&&delete l.monitorTypeSurfaces,On.debug("[".concat(r,"] getDisplayMedia:"),JSON.stringify({video:e,audio:t.screenAudio,controls:l}));const h=await navigator.mediaDevices.getDisplayMedia(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?NA(Object(r),!0).forEach((function(t){H_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):NA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({video:e,audio:t.screenAudio},l));kA(o,h)}else{if(!Vr())throw On.error("[".concat(r,"] This browser does not support screenSharing")),new ni(ii.NOT_SUPPORTED,"This browser does not support screen sharing");{t.screen.mediaSource&&Xd(t.screen.mediaSource);const e={video:{mediaSource:t.screen.mediaSource,width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate}};On.debug("[".concat(r,"] getUserMedia: ").concat(JSON.stringify(e)));kA(o,await navigator.mediaDevices.getUserMedia(e))}}var a,c;if(!t.video&&!t.audio)return o;let d={video:t.video,audio:t.audio},u=hn("MEDIA_DEVICE_CONSTRAINTS");if(u)try{"string"==typeof u&&(u=JSON.parse(u)),d=Hi(d,u)}catch(e){}On.debug("[".concat(r,"] GetUserMedia"),JSON.stringify(d)),wr();let l,h=null;(Ur()||Fr()||kr())&&(h=await wA.lock());try{l=await navigator.mediaDevices.getUserMedia(d)}catch(e){throw h&&h(),e}return d.audio&&(e.HAS_GUM_AUDIO=!0),d.video&&(e.HAS_GUM_VIDEO=!0),kA(o,l),h&&h(),o}function LA(e,t){switch(e){case"Starting video failed":case"OverconstrainedError":case"TrackStartError":return new ni(ii.MEDIA_OPTION_INVALID,"".concat(e,": ").concat(t));case"NotFoundError":case"DevicesNotFoundError":return new ni(ii.DEVICE_NOT_FOUND,"".concat(e,": ").concat(t));case"NotSupportedError":return new ni(ii.NOT_SUPPORTED,"".concat(e,": ").concat(t));case"NotReadableError":return new ni(ii.NOT_READABLE,"".concat(e,": ").concat(t));case"InvalidStateError":case"NotAllowedError":case"PERMISSION_DENIED":case"PermissionDeniedError":return new ni(ii.PERMISSION_DENIED,"".concat(e,": ").concat(t));case"ConstraintNotSatisfiedError":return new ni(ii.CONSTRAINT_NOT_SATISFIED,"".concat(e,": ").concat(t));default:return On.error("getUserMedia unexpected error",e),new ni(ii.UNEXPECTED_ERROR,"".concat(e,": ").concat(t))}}function kA(e,t){const r=e.getVideoTracks()[0],i=e.getAudioTracks()[0],n=t.getVideoTracks()[0],o=t.getAudioTracks()[0];o&&(i&&e.removeTrack(i),e.addTrack(o)),n&&(r&&e.removeTrack(r),e.addTrack(n))}e.HAS_GUM_AUDIO=!1,e.HAS_GUM_VIDEO=!1;class MA extends fi{get state(){return this._state}set state(e){e!==this._state&&(this.emit(pu.STATE_CHANGE,e),this._state=e)}constructor(){super(),H_(this,"_state",hu.IDLE),H_(this,"isAccessMicrophonePermission",!1),H_(this,"isAccessCameraPermission",!1),H_(this,"lastAccessMicrophonePermission",!1),H_(this,"lastAccessCameraPermission",!1),H_(this,"checkdeviceMatched",!1),H_(this,"deviceInfoMap",new Map),this.init().then((()=>{navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",this.updateDevicesInfo.bind(this)),window.setInterval((()=>{(hn("ENUMERATE_DEVICES_INTERVAL")||(qr()||Pr()===br.HARMONY_OS)&&Qr())&&this.updateDevicesInfo()}),hn("ENUMERATE_DEVICES_INTERVAL_TIME"))})).catch((e=>On.error(e.toString())))}async enumerateDevices(t,r){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)throw new ni(ii.NOT_SUPPORTED,"enumerateDevices() not supported.");const n=await navigator.mediaDevices.enumerateDevices(),o=this.checkMediaDeviceInfoIsOk(n);let s=!this.isAccessMicrophonePermission&&t,a=!this.isAccessCameraPermission&&r;o.audio&&(s=!1),o.video&&(a=!1);let c=null,d=null,u=null;if(!i&&(s||a)){if(wA.isLocked){On.debug("[device manager] wait GUM lock");(await wA.lock())(),On.debug("[device manager] GUM unlock")}if(e.HAS_GUM_AUDIO&&(s=!1,this.isAccessMicrophonePermission=!0),e.HAS_GUM_VIDEO&&(a=!1,this.isAccessCameraPermission=!0),On.debug("[device manager] check media device permissions",t,r,s,a),s&&a){try{u=await navigator.mediaDevices.getUserMedia({audio:!0,video:!0})}catch(e){const t=LA(e.name||e.code||e,e.message);if(t.code===ii.PERMISSION_DENIED)throw t;On.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0,this.isAccessMicrophonePermission=!0}else if(s){try{c=await navigator.mediaDevices.getUserMedia({audio:t})}catch(e){const t=LA(e.name||e.code||e,e.message);if(t.code===ii.PERMISSION_DENIED)throw t;On.warning("getUserMedia failed in getDevices",t)}this.isAccessMicrophonePermission=!0}else if(a){try{d=await navigator.mediaDevices.getUserMedia({video:r})}catch(e){const t=LA(e.name||e.code||e,e.message);if(t.code===ii.PERMISSION_DENIED)throw t;On.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0}On.debug("[device manager] mic permission",t,"cam permission",r)}try{const e=await navigator.mediaDevices.enumerateDevices();return c&&c.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),c=null,d=null,u=null,e}catch(e){c&&c.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),c=null,d=null,u=null;return new ni(ii.ENUMERATE_DEVICES_FAILED,e.toString()).throw()}}async getRecordingDevices(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(await this.enumerateDevices(!0,!1,e)).filter((e=>"audioinput"===e.kind))}async getCamerasDevices(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(await this.enumerateDevices(!1,!0,e)).filter((e=>"videoinput"===e.kind))}async getSpeakers(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(await this.enumerateDevices(!0,!1,e)).filter((e=>"audiooutput"===e.kind))}searchDeviceIdByName(e){let t=null;return this.deviceInfoMap.forEach((r=>{r.device.label===e&&(t=r.device.deviceId)})),t}async getDeviceById(e){const t=(await this.enumerateDevices(!0,!0,!0)).find((t=>t.deviceId===e));if(!t)throw new ni(ii.DEVICE_NOT_FOUND,"deviceId: ".concat(e));return t}async init(){this.state=hu.INITING;try{await this.updateDevicesInfo(),this.state=hu.INITEND}catch(e){if(this.state=hu.IDLE,!("boolean"==typeof isSecureContext?isSecureContext:"https:"===location.protocol||"file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname||"::1"===location.hostname))throw new ni(ii.WEB_SECURITY_RESTRICT,"Your context is limited by web security, please try using https protocol or localhost.");throw On.warning("Device Detection functionality cannot start properly.",e.toString()),e}}async updateDevicesInfo(){const e=await this.enumerateDevices(!0,!0,!0),t=Date.now(),r=[];if(e[0]&&e[0].label&&!1===this.checkdeviceMatched){this.checkdeviceMatched=!0;const t=e.find((e=>"audioinput"===e.kind&&"default"===e.deviceId)),r=e.find((e=>"audiooutput"===e.kind&&"default"===e.deviceId));t&&r?r.groupId===t.groupId?On.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is the same group")):On.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is not the same group")):On.debug("[device-check] default input or output not found")}const i=this.checkMediaDeviceInfoIsOk(e);if(e.forEach((e=>{if(!e.deviceId)return;const i=this.deviceInfoMap.get("".concat(e.kind,"_").concat(e.deviceId));if("ACTIVE"!==(i?i.state:"INACTIVE")){const i={initAt:t,updateAt:t,device:e,state:"ACTIVE"};this.deviceInfoMap.set("".concat(e.kind,"_").concat(e.deviceId),i),r.push(i)}i&&(i.updateAt=t)})),this.deviceInfoMap.forEach(((e,i)=>{"ACTIVE"===e.state&&e.updateAt!==t&&(e.state="INACTIVE",r.push(e))})),this.state!==hu.INITEND)return i.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),void(i.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0));r.forEach((e=>{switch(e.device.kind){case"audioinput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(pu.RECORDING_DEVICE_CHANGED,e);break;case"videoinput":this.lastAccessCameraPermission&&this.isAccessCameraPermission&&this.emit(pu.CAMERA_DEVICE_CHANGED,e);break;case"audiooutput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(pu.PLAYOUT_DEVICE_CHANGED,e)}})),i.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),i.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0)}checkMediaDeviceInfoIsOk(e){const t=e.filter((e=>"audioinput"===e.kind)),r=e.filter((e=>"videoinput"===e.kind)),i={audio:!1,video:!1};for(const e of t)if(e.label&&e.deviceId){i.audio=!0;break}for(const e of r)if(e.label&&e.deviceId){i.video=!0;break}return i}}const UA=new MA;let xA=!1;const VA=new class extends fi{constructor(){super(...arguments),H_(this,"onAutoplayFailed",void 0),H_(this,"onAudioAutoplayFailed",void 0)}};function FA(){if(xA)return hn("FLS_AUTOPLAY_EMITS")?(VA.onAutoplayFailed&&VA.onAutoplayFailed(),VA.emit("autoplay-failed")):void 0;{const e=t=>{t.preventDefault(),xA=!1,$r()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};xA=!0,$r()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),On.info("detect media autoplay failed, document: https://docs.agora.io/cn/Voice/autoplay_policy_web_ng?platform=Web"),VA.onAutoplayFailed?VA.onAutoplayFailed():VA.onAudioAutoplayFailed?On.warning("AgoraRTC.onAudioAutoplayFailed has been deprecated in favor of AgoraRTC.onAutoplayFailed.\n\n Please refer to the Agora document to migrate the newer API, https://docs.agora.io/en/Voice/autoplay_policy_web_ng?platform=Web ."):On.warning("We have detected a media autoplay failed event, and found out that you haven't implemented AgoraRTC.onAutoplayFailed callback yet.\n\n It will cause audio/video element not playing automatically on some browsers without user interaction, possibly hurting user experiences.\n\n Please refer to the Agora document to properly handle autoplay failed event, https://docs.agora.io/en/Voice/autoplay_policy_web_ng?platform=Web ."),VA.emit("autoplay-failed")}}function BA(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function jA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?BA(Object(r),!0).forEach((function(t){H_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):BA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function GA(e,t,r,i){if(!e)return;const n=zn.getBaseInfoBySessionId(e);if(!n)return;const o=n.info,s=Date.now(),a=jA(jA({},o),{},{vid:void 0===o.vid?0:Number(o.vid),lts:s,elapse:s-n.startTime,cbRegistered:VA.onAutoplayFailed||VA.onAudioAutoplayFailed?1:-1,errorMsg:r,mediaType:t,trackId:i,extend:void 0});zn.send({type:Ln.AUTOPLAY_FAILED,data:a},!0)}const WA=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","error"],HA=new class{constructor(){H_(this,"onAutoplayFailed",void 0),H_(this,"elementMap",new Map),H_(this,"elementStateMap",new Map),H_(this,"elementsNeedToResume",[]),H_(this,"sinkIdMap",new Map),H_(this,"autoResumeAfterInterruption",(e=>oA.all(Array.from(this.elementMap.entries()).map((async t=>{let[r,i]=t;const n=this.elementStateMap.get(r),o=i.srcObject.getAudioTracks()[0],s=o&&o.readyState;if(On.debug("resume after interrupted, ele: ".concat(n," audio: ").concat(s," ").concat(e)),"live"===s){if(e)return i.pause(),i.play();if("running"===hA.curState)return Kr()?(i.pause(),i.play()):n&&"paused"===n?i.play():void 0}}))))),H_(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{Array.from(this.elementMap.entries()).forEach((e=>{let[t,r]=e;const i=r.srcObject.getAudioTracks()[0];i&&"live"===i.readyState&&(On.debug("auto resume after interruption inside autoResumeAfterInterruptionOnIOS15"),r.pause(),r.play())}))})),this.autoResumeAudioElement(),hA.on(ro.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),hA.on(ro.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),hA.on(ro.STATE_CHANGE,(()=>{Fr()&&"suspended"===hA.prevState&&"running"===hA.curState&&this.autoResumeAfterInterruption()}))}async setSinkID(e,t){const r=this.elementMap.get(e);if(this.sinkIdMap.set(e,t),r)try{await r.setSinkId(t)}catch(e){throw new ni(ii.PERMISSION_DENIED,"can not set sink id: "+e.toString())}}play(e,t,r,i){if(this.elementMap.has(t))return;const n=document.createElement("audio");n.autoplay=!0,n.srcObject=new MediaStream([e]),this.bindAudioElementEvents(t,n),this.elementMap.set(t,n),this.elementStateMap.set(t,fu.INIT),this.setVolume(t,r);const o=this.sinkIdMap.get(t);if(o)try{n.setSinkId(o).catch((e=>{On.warning("[".concat(t,"] set sink id failed"),e.toString())}))}catch(e){On.warning("[".concat(t,"] set sink id failed"),e.toString())}const s=n.play();s&&s.then&&s.catch((e=>{i&&GA(i,"audio",e.message,t),On.warning("audio element play warning",e.toString()),this.elementMap.has(t)&&"NotAllowedError"===e.name&&(On.warning("detected audio element autoplay failed"),this.elementsNeedToResume.push(n),Pi((()=>{this.onAutoplayFailed&&this.onAutoplayFailed(),FA()})))}))}updateTrack(e,t){const r=this.elementMap.get(e);r&&(r.srcObject=new MediaStream([t]))}isPlaying(e){return this.elementMap.has(e)&&"playing"===this.elementStateMap.get(e)}setVolume(e,t){const r=this.elementMap.get(e);r&&(t=Math.max(0,Math.min(100,t)),r.volume=t/100)}getVolume(e){const t=this.elementMap.get(e);return t?t.volume:0}stop(e){const t=this.elementMap.get(e);if(this.sinkIdMap.delete(e),!t)return;const r=this.elementsNeedToResume.indexOf(t);this.elementsNeedToResume.splice(r,1),t.srcObject=null,t.remove(),this.elementMap.delete(e),this.elementStateMap.delete(e)}bindAudioElementEvents(e,t){WA.forEach((r=>{t.addEventListener(r,(r=>{const i=this.elementStateMap.get(e),n="pause"===r.type?"paused":r.type;if(On.debug("[".concat(e,"] audio-element-status change ").concat(i," => ").concat(n)),"error"===r.type){const r=null==t?void 0:t.error;r&&On.error("[".concat(e,"] media error, code: ").concat(r.code,", message: ").concat(r.message))}this.elementStateMap.set(e,n)}))}))}getPlayerState(e){return this.elementStateMap.get(e)||"uninit"}autoResumeAudioElement(){const e=()=>{this.elementsNeedToResume.forEach((e=>{e.play().then((e=>{On.debug("Auto resume audio element success")})).catch((e=>{On.warning("Auto resume audio element failed!",e)}))})),this.elementsNeedToResume=[]};new Promise((e=>{document.body?e():window.addEventListener("load",(()=>e()))})).then((()=>{$r()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0))}))}};function KA(){return function(e,t,r){const i=r.value;return"function"==typeof i&&(r.value=function(){this._isClosed&&new ni(ii.INVALID_OPERATION,"[".concat(this.getTrackId(),"] cannot operate a closed track")).print("warning",On);for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=i.apply(this,t);return n instanceof oA?new oA(((e,t)=>{n.then(e).catch(t)})):n}),r}}var YA=Jc("Array").values,zA=ld,XA=$s,ZA=lo,JA=YA,QA=Array.prototype,qA={DOMTokenList:!0,NodeList:!0},$A=function(e){var t=e.values;return e===QA||ZA(QA,e)&&t===QA.values||XA(qA,zA(e))?JA:t},eb=Z($A);function tb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function rb(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?tb(Object(r),!0).forEach((function(t){H_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tb(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class ib extends fi{constructor(e){super(),H_(this,"name","VideoProcessorDestination"),H_(this,"ID","0"),H_(this,"_source",void 0),H_(this,"videoContext",void 0),H_(this,"inputTrack",void 0),this.videoContext=e}get kind(){return"video"}get enabled(){return!0}pipe(){throw new ni(ii.NOT_SUPPORTED,"VideoProcessor cannot pipe to any other Processor")}unpipe(){throw new ni(ii.NOT_SUPPORTED,"VideoProcessor cannot unpipe to any other Processor")}enable(){}disable(){}updateInput(e){if(e.context!==this.videoContext)throw new Error("ProcessorContext passed to VideoTrack.processorDestination doesn't match it's belonging VideoTrack's context.\nProbably you are making pipeline like this:\nvideoTrack1.pipe(processor).pipe(videoTrack2.processorDestination).");e.track&&e.track!==this.inputTrack&&(this.videoContext.chained=!0,this.inputTrack=e.track,this.emit(uu.ON_TRACK,e.track))}reset(){this.inputTrack=void 0,this.videoContext.chained=!1,this.emit(uu.ON_TRACK,void 0)}}class nb extends fi{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t){super(),H_(this,"constraintsMap",new Map),H_(this,"statsRegistry",[]),H_(this,"usageRegistry",[]),H_(this,"trackId",void 0),H_(this,"direction",void 0),H_(this,"_chained",!1),this.trackId=e,this.direction=t}async getConstraints(){return await yi(this,lu.REQUEST_CONSTRAINTS)}async requestApplyConstraints(e,t){var r;return On.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),vi(this,lu.REQUEST_UPDATE_CONSTRAINTS,Array.from(eb(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return On.info("processor ".concat(e.name," requestRevertConstraints for ").concat(this.trackId)),this.constraintsMap.delete(e),vi(this,lu.REQUEST_UPDATE_CONSTRAINTS,Array.from(eb(t=this.constraintsMap).call(t)))}registerStats(e,t,r){this.statsRegistry.find((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t))||this.statsRegistry.push({processorName:e.name,processorID:e.ID,type:t,cb:r})}unregisterStats(e,t){const r=this.statsRegistry.findIndex((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t));-1!==r&&this.statsRegistry.splice(r,1)}gatherStats(){const e=[];for(const{processorID:t,processorName:r,type:i,cb:n}of this.statsRegistry)try{const o=n();e.push({processorID:t,processorName:r,type:i,stats:o})}catch(e){On.error(new ni(ii.UNEXPECTED_ERROR,e.message))}return e}registerUsage(e,t){this.usageRegistry.find((t=>t.processorID===e.ID&&t.processorName===e.name))||this.usageRegistry.push({processorID:e.ID,processorName:e.name,cb:t})}unregisterUsage(e){const t=this.usageRegistry.findIndex((t=>t.processorID===e.ID&&t.processorName===e.name));-1!==t&&this.usageRegistry.splice(t,1)}async gatherUsage(){const e=[];if(!this.chained)return[];for(const{cb:t}of this.usageRegistry)try{let r=t();r instanceof oA&&(r=await r),e.push(rb(rb({},r),{},{direction:this.direction}))}catch(e){On.error("gather extension usage error",e)}return e}getDirection(){return this.direction}}class ob extends fi{constructor(e){super(),H_(this,"name","AudioProcessorDestination"),H_(this,"ID","0"),H_(this,"inputTrack",void 0),H_(this,"inputNode",void 0),H_(this,"audioProcessorContext",void 0),H_(this,"_source",void 0),this.audioProcessorContext=e}get kind(){return"audio"}get enabled(){return!0}pipe(){throw new ni(ii.NOT_SUPPORTED,"AudioProcessorDestination cannot pipe to any other Processor")}unpipe(){throw new ni(ii.NOT_SUPPORTED,"AudioProcessor cannot unpipe to any other Processor")}enable(){}disable(){}reset(){this.inputTrack=void 0,this.inputNode=void 0,this.audioProcessorContext.chained=!1,this.emit(uu.ON_TRACK,void 0),this.emit(uu.ON_NODE,void 0)}updateInput(e){if(e.context!==this.audioProcessorContext)throw new Error("ProcessorContext passed to AudioTrack.processorDestination doesn't match it's belonging AudioTrack's context.\n Probably you are making pipeline like this: audioTrack1.pipe(processor).pipe(audioTrack2.processorDestination).");e.track&&this.inputTrack!==e.track&&(this.audioProcessorContext.chained=!0,this.inputTrack=e.track,this.emit(uu.ON_TRACK,this.inputTrack)),e.node&&this.inputNode!==e.node&&(this.audioProcessorContext.chained=!0,this.inputNode=e.node,this.emit(uu.ON_NODE,this.inputNode))}}class sb extends fi{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t,r){super(),H_(this,"constraintsMap",new Map),H_(this,"statsRegistry",[]),H_(this,"audioContext",void 0),H_(this,"trackId",void 0),H_(this,"direction",void 0),H_(this,"usageRegistry",[]),H_(this,"_chained",!1),this.audioContext=e,this.trackId=t,this.direction=r}async getConstraints(){return yi(this,lu.REQUEST_CONSTRAINTS)}getAudioContext(){return this.audioContext}async requestApplyConstraints(e,t){var r;return On.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),vi(this,lu.REQUEST_UPDATE_CONSTRAINTS,Array.from(eb(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return this.constraintsMap.delete(e),vi(this,lu.REQUEST_UPDATE_CONSTRAINTS,Array.from(eb(t=this.constraintsMap).call(t)))}registerStats(e,t,r){this.statsRegistry.find((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t))||this.statsRegistry.push({processorName:e.name,processorID:e.ID,type:t,cb:r})}unregisterStats(e,t){const r=this.statsRegistry.findIndex((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t));-1!==r&&this.statsRegistry.splice(r,1)}gatherStats(){const e=[];for(const{processorID:t,processorName:r,type:i,cb:n}of this.statsRegistry)try{const o=n();e.push({processorID:t,processorName:r,type:i,stats:o})}catch(e){On.error(new ni(ii.UNEXPECTED_ERROR,e.message))}return e}registerUsage(e,t){this.usageRegistry.find((t=>t.processorID===e.ID&&t.processorName===e.name))||this.usageRegistry.push({processorID:e.ID,processorName:e.name,cb:t})}unregisterUsage(e){const t=this.usageRegistry.findIndex((t=>t.processorID===e.ID&&t.processorName===e.name));-1!==t&&this.usageRegistry.splice(t,1)}async gatherUsage(){const e=[];if(!this.chained)return[];for(const{cb:t}of this.usageRegistry)try{let r=t();r instanceof oA&&(r=await r),e.push(rb(rb({},r),{},{direction:this.direction}))}catch(e){On.error("gather extension usage error",e)}return e}getDirection(){return this.direction}}class ab extends fi{get isPlayed(){return!0}get isFreeze(){return!1}constructor(){super(),H_(this,"context",void 0),H_(this,"processSourceNode",void 0),H_(this,"outputTrack",void 0),H_(this,"processedNode",void 0),H_(this,"clonedTrack",void 0),H_(this,"outputNode",void 0),this.outputNode=new cb}setVolume(){}createOutputTrack(){throw new ni(ii.NOT_SUPPORTED,"can not create output MediaStreamTrack when WebAudio disabled")}getOriginVolumeLevel(){return 0}getAccurateVolumeLevel(){return 0}stopGetAudioBuffer(){}startGetAudioBuffer(){}play(){}stop(){}destroy(){}updateTrack(){}updateOriginTrack(){}createMediaStreamSourceNode(){}}class cb{disconnect(){}connect(){}}function db(e){return new oA(((t,r)=>{let i=!1;const n=document.createElement("video");n.setAttribute("autoplay",""),n.setAttribute("muted",""),n.muted=!0,n.autoplay=!0,n.setAttribute("playsinline",""),n.setAttribute("style","position: fixed; top: 0; left: 0; width: 1px; height: 1px"),document.body.appendChild(n);const o=Fr()?"canplay":"playing";n.addEventListener(o,(()=>{const e=n.videoWidth,r=n.videoHeight;!e&&Vr()||(i=!0,n.srcObject=null,n.remove(),t([e,r]))})),n.srcObject=new MediaStream([e]),n.play().catch(Bi),setTimeout((()=>{i||(n.srcObject=null,n.remove(),t([n.videoWidth,n.videoHeight]))}),4e3)}))}function ub(e){const t={};e.facingMode&&(t.facingMode=e.facingMode),e.cameraId&&(t.deviceId={exact:e.cameraId});const r=xd(e.encoderConfig);return null!=r.width&&(t.width=r.width),null!=r.height&&(t.height=r.height),!Zr()&&r.frameRate&&(t.frameRate=r.frameRate),xr()&&"object"==typeof t.frameRate&&(t.frameRate.max=60),Vr()&&(t.frameRate={ideal:30,max:30}),t}function lb(e){const t={};e.screenSourceType&&(t.mediaSource=e.screenSourceType),e.extensionId&&Mr()&&(t.extensionId=e.extensionId);const{displaySurface:r,selfBrowserSurface:i,surfaceSwitching:n,systemAudio:o,preferCurrentTab:s,windowAudio:a,monitorTypeSurfaces:c}=e;(Br(107)||Gr(107)||Hr(93))&&(r&&(si(r,"displaySurface",["browser","window","monitor"]),t.displaySurface=r),i?(si(i,"selfBrowserSurface",["exclude","include"]),t.selfBrowserSurface=i):t.selfBrowserSurface="include",n&&(si(n,"surfaceSwitching",["exclude","include"]),t.surfaceSwitching=n)),(Br(105)||Gr(105)||Hr(91))&&o&&(si(o,"systemAudio",["exclude","include"]),t.systemAudio=o),(Br(94)||Gr(94)||Hr(80))&&s&&(t.preferCurrentTab=!0),(Br(141)||Gr(141)||Hr(125))&&a&&(si(a,"windowAudio",["exclude","system"]),t.windowAudio=a),(Br(119)||Gr(119)||Hr(105))&&c&&(si(c,"monitorTypeSurfaces",["exclude","include"]),t.monitorTypeSurfaces=c),e.electronScreenSourceId&&(t.sourceId=e.electronScreenSourceId);const d=e.encoderConfig?Vd(e.encoderConfig):null;return t.mandatory={chromeMediaSource:"desktop",maxWidth:d?d.width:void 0,maxHeight:d?d.height:void 0},d&&(d.frameRate&&("number"==typeof d.frameRate?(t.mandatory.maxFrameRate=d.frameRate,t.mandatory.minFrameRate=d.frameRate):(t.mandatory.maxFrameRate=d.frameRate.max||d.frameRate.ideal||d.frameRate.exact||void 0,t.mandatory.minFrameRate=d.frameRate.min||d.frameRate.ideal||d.frameRate.exact||void 0),t.frameRate=d.frameRate),d.width&&(t.width=d.width),d.height&&(t.height=d.height)),t}function hb(e){const t={};return Zr()||(void 0!==e.AGC&&(t.autoGainControl=e.AGC),void 0!==e.AEC&&(t.echoCancellation=e.AEC),void 0!==e.ANS&&(t.noiseSuppression=e.ANS,Mr()&&e.ANS&&(t.googHighpassFilter=e.ANS))),t}function pb(e){const t=hb(e);return eo()&&e.suppressLocalAudioPlayback&&(t.suppressLocalAudioPlayback=e.suppressLocalAudioPlayback),to()&&e.restrictOwnAudio&&(t.restrictOwnAudio=!0),t}function fb(e){const t=hb(e);if(e.encoderConfig){const r=jd(e.encoderConfig);t.channelCount=r.stereo?2:1,t.sampleRate=r.sampleRate,t.sampleSize=r.sampleSize}return e.microphoneId&&(t.deviceId={exact:e.microphoneId}),qr()&&(t.sampleRate=void 0),t}var Eb=Cs,mb=TypeError,_b=hh,Tb=Math.floor,gb=function(e,t){var r=e.length,i=Tb(r/2);return r<8?Sb(e,t):Rb(e,gb(_b(e,0,i),t),gb(_b(e,i),t),t)},Sb=function(e,t){for(var r,i,n=e.length,o=1;o<n;){for(i=o,r=e[o];i&&t(e[i-1],r)>0;)e[i]=e[--i];i!==o++&&(e[i]=r)}return e},Rb=function(e,t,r,i){for(var n=t.length,o=r.length,s=0,a=0;s<n||a<o;)e[s+a]=s<n&&a<o?i(t[s],r[a])<=0?t[s++]:r[a++]:s<n?t[s++]:r[a++];return e},yb=gb,vb=ds.match(/firefox\/(\d+)/i),Ab=!!vb&&+vb[1],bb=/MSIE|Trident/.test(ds),Ib=ds.match(/AppleWebKit\/(\d+)\./),Ob=!!Ib&&+Ib[1],Cb=Nc,Nb=uo,wb=Ps,Db=Js,Pb=Gc,Lb=function(e,t){if(!delete e[t])throw mb("Cannot delete property "+Eb(t)+" of "+Eb(e))},kb=fd,Mb=io,Ub=yb,xb=Y_,Vb=Ab,Fb=bb,Bb=ms,jb=Ob,Gb=[],Wb=Nb(Gb.sort),Hb=Nb(Gb.push),Kb=Mb((function(){Gb.sort(void 0)})),Yb=Mb((function(){Gb.sort(null)})),zb=xb("sort"),Xb=!Mb((function(){if(Bb)return Bb<70;if(!(Vb&&Vb>3)){if(Fb)return!0;if(jb)return jb<603;var e,t,r,i,n="";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(i=0;i<47;i++)Gb.push({k:t+i,v:r})}for(Gb.sort((function(e,t){return t.v-e.v})),i=0;i<Gb.length;i++)t=Gb[i].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return"DGBEFHACIJK"!==n}}));Cb({target:"Array",proto:!0,forced:Kb||!Yb||!zb||!Xb},{sort:function(e){void 0!==e&&wb(e);var t=Db(this);if(Xb)return void 0===e?Wb(t):Wb(t,e);var r,i,n=[],o=Pb(t);for(i=0;i<o;i++)i in t&&Hb(n,t[i]);for(Ub(n,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:kb(t)>kb(r)?1:-1}}(e)),r=Pb(n),i=0;i<r;)t[i]=n[i++];for(;i<o;)Lb(t,i++);return t}});var Zb=Jc("Array").sort,Jb=lo,Qb=Zb,qb=Array.prototype,$b=function(e){var t=e.sort;return e===qb||Jb(qb,e)&&t===qb.sort?Qb:t},eI=Z($b);function tI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function rI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?tI(Object(r),!0).forEach((function(t){H_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function iI(e,t,r){const i=4*Math.floor(2e5*Math.pow(r/15,.6)*Math.pow(e*t/230400,.75)),n=e*t,o=new Map([[19200,.9],[230400,.85],[518400,.75],[921600,.7],[2073600,.6],[3686400,.5]]),s=new Map([[230400,.95],[518400,.9],[921600,.85],[2073600,.8]]);let a=eb(o).call(o).next().value,c=1;if(o.has(n))a=o.get(n);else{var d;const e=eI(d=Array.from(o.entries())).call(d,((e,t)=>{let[r]=e,[i]=t;return r-i})),t=e.find((e=>{let[t]=e;return t>n}));if(t){const r=e.indexOf(t);if(r>0){const i=e[r-1],o=(n-i[0])/(t[0]-i[0]);a=i[1]+o*(t[1]-i[1])}else a=t[1]}else a=e[e.length-1][1]}if(s.has(n))c=s.get(n);else{var u;const e=eI(u=Array.from(s.entries())).call(u,((e,t)=>{let[r]=e,[i]=t;return r-i})),t=e.find((e=>{let[t]=e;return t>n}));if(t){const r=e.indexOf(t);if(r>0){const i=e[r-1],o=(n-i[0])/(t[0]-i[0]);c=i[1]+o*(t[1]-i[1])}else c=t[1]}else c=e[e.length-1][1]}const l=hn("VIDEO_NEW_BITRATE_RATIO");l&&l>0&&(a=l/100);const h=Math.floor(i*a),p=Math.floor(65e4*Math.pow(e*t/230400,.5)*Math.pow(r/15,.69));let f=h;const E=hn("VIDEO_STANDARD_BITRATE_VERSION");return E&&E>0&&(1===E?f=i:2===E?f=h:3===E&&(f=p)),[Math.floor(f/1e3),c]}function nI(e,t,r){if(!Array.isArray(hn("VIDEO_ENCODER_CONFIG_LIST")))return!1;if(0===hn("VIDEO_ENCODER_CONFIG_LIST").length)return!1;const i=Math.min(e,t);if(i>=480)return!1;return rI(rI({},hn("VIDEO_ENCODER_CONFIG_LIST").find((e=>e.height>i))),{},{frameRate:r})}function oI(e,t,r,i,n){const o=hn("BITRATE_ADAPTER_TYPE");if("DEFAULT_BITRATE"===o)return{min:i,max:n};if(void 0===n){var s;const a=Math.floor(200*Math.pow(r/15,.6)*Math.pow(e*t/640/360,.75));n="STANDARD_BITRATE"===o?4*a:2*a,i=null!==(s=i)&&void 0!==s?s:a}else{var a;i=null!==(a=i)&&void 0!==a?a:Math.floor(n/10)}return{min:i,max:n}}function sI(e,t,r){const i=200*Math.pow(r/15,.6)*Math.pow(e*t/640/360,.75);return{min:Math.floor(i),max:Math.floor(4*i)}}const aI=async(e,t,r)=>{const i=function(e){const t=[];for(let r=0;r<e.length;r+=2)t.push(parseInt(e.slice(r,r+2),16));return Uint8Array.from(t)}(function(e){const t="0123456789abcdef";function r(e){let r,i="";for(r=0;r<=3;r++)i+=t.charAt(e>>8*r+4&15)+t.charAt(e>>8*r&15);return i}function i(e,t){const r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function n(e,t,r,n,o,s){return i(function(e,t){return e<<t|e>>>32-t}(i(i(t,e),i(n,s)),o),r)}function o(e,t,r,i,o,s,a){return n(t&r|~t&i,e,t,o,s,a)}function s(e,t,r,i,o,s,a){return n(t&i|r&~i,e,t,o,s,a)}function a(e,t,r,i,o,s,a){return n(t^r^i,e,t,o,s,a)}function c(e,t,r,i,o,s,a){return n(r^(t|~i),e,t,o,s,a)}const d=function(e){let t;const r=1+(e.length+8>>6),i=new Array(16*r);for(t=0;t<16*r;t++)i[t]=0;for(t=0;t<e.length;t++)i[t>>2]|=e.charCodeAt(t)<<t%4*8;return i[t>>2]|=128<<t%4*8,i[16*r-2]=8*e.length,i}(e);let u,l,h,p,f,E=1732584193,m=-271733879,_=-1732584194,T=271733878;for(u=0;u<d.length;u+=16)l=E,h=m,p=_,f=T,E=o(E,m,_,T,d[u+0],7,-680876936),T=o(T,E,m,_,d[u+1],12,-389564586),_=o(_,T,E,m,d[u+2],17,606105819),m=o(m,_,T,E,d[u+3],22,-1044525330),E=o(E,m,_,T,d[u+4],7,-176418897),T=o(T,E,m,_,d[u+5],12,1200080426),_=o(_,T,E,m,d[u+6],17,-1473231341),m=o(m,_,T,E,d[u+7],22,-45705983),E=o(E,m,_,T,d[u+8],7,1770035416),T=o(T,E,m,_,d[u+9],12,-1958414417),_=o(_,T,E,m,d[u+10],17,-42063),m=o(m,_,T,E,d[u+11],22,-1990404162),E=o(E,m,_,T,d[u+12],7,1804603682),T=o(T,E,m,_,d[u+13],12,-40341101),_=o(_,T,E,m,d[u+14],17,-1502002290),m=o(m,_,T,E,d[u+15],22,1236535329),E=s(E,m,_,T,d[u+1],5,-165796510),T=s(T,E,m,_,d[u+6],9,-1069501632),_=s(_,T,E,m,d[u+11],14,643717713),m=s(m,_,T,E,d[u+0],20,-373897302),E=s(E,m,_,T,d[u+5],5,-701558691),T=s(T,E,m,_,d[u+10],9,38016083),_=s(_,T,E,m,d[u+15],14,-660478335),m=s(m,_,T,E,d[u+4],20,-405537848),E=s(E,m,_,T,d[u+9],5,568446438),T=s(T,E,m,_,d[u+14],9,-1019803690),_=s(_,T,E,m,d[u+3],14,-187363961),m=s(m,_,T,E,d[u+8],20,1163531501),E=s(E,m,_,T,d[u+13],5,-1444681467),T=s(T,E,m,_,d[u+2],9,-51403784),_=s(_,T,E,m,d[u+7],14,1735328473),m=s(m,_,T,E,d[u+12],20,-1926607734),E=a(E,m,_,T,d[u+5],4,-378558),T=a(T,E,m,_,d[u+8],11,-2022574463),_=a(_,T,E,m,d[u+11],16,1839030562),m=a(m,_,T,E,d[u+14],23,-35309556),E=a(E,m,_,T,d[u+1],4,-1530992060),T=a(T,E,m,_,d[u+4],11,1272893353),_=a(_,T,E,m,d[u+7],16,-155497632),m=a(m,_,T,E,d[u+10],23,-1094730640),E=a(E,m,_,T,d[u+13],4,681279174),T=a(T,E,m,_,d[u+0],11,-358537222),_=a(_,T,E,m,d[u+3],16,-722521979),m=a(m,_,T,E,d[u+6],23,76029189),E=a(E,m,_,T,d[u+9],4,-640364487),T=a(T,E,m,_,d[u+12],11,-421815835),_=a(_,T,E,m,d[u+15],16,530742520),m=a(m,_,T,E,d[u+2],23,-995338651),E=c(E,m,_,T,d[u+0],6,-198630844),T=c(T,E,m,_,d[u+7],10,1126891415),_=c(_,T,E,m,d[u+14],15,-1416354905),m=c(m,_,T,E,d[u+5],21,-57434055),E=c(E,m,_,T,d[u+12],6,1700485571),T=c(T,E,m,_,d[u+3],10,-1894986606),_=c(_,T,E,m,d[u+10],15,-1051523),m=c(m,_,T,E,d[u+1],21,-2054922799),E=c(E,m,_,T,d[u+8],6,1873313359),T=c(T,E,m,_,d[u+15],10,-30611744),_=c(_,T,E,m,d[u+6],15,-1560198380),m=c(m,_,T,E,d[u+13],21,1309151649),E=c(E,m,_,T,d[u+4],6,-145523070),T=c(T,E,m,_,d[u+11],10,-1120210379),_=c(_,T,E,m,d[u+2],15,718787259),m=c(m,_,T,E,d[u+9],21,-343485551),E=i(E,l),m=i(m,h),_=i(_,p),T=i(T,f);return r(E)+r(m)+r(_)+r(T)}(""+t+r)).slice(0,16),n=i.slice(0,12),o=await window.crypto.subtle.importKey("raw",i,"AES-GCM",!0,["encrypt"]);return new Uint8Array(await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},o,e))},cI=e=>{const t=document.createElement("canvas");return t.width=2,t.height=2,new oA(((r,i)=>{t.toBlob((async e=>{if(t.remove(),e){const i=await dI(e);r({buffer:i,width:t.width,height:t.height})}else i(new ni(ii.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,1)}))},dI=async e=>{const t=await e.arrayBuffer();return new Uint8Array(t)};function uI(e,t){if("VideoFrame"in window&&"TransformStream"in window&&Jn().supportWebRTCInsertableStream){const r=new MediaStreamTrackProcessor(e),i=new MediaStreamTrackGenerator({kind:"video"});let n,o,s=Date.now();const a=()=>{c&&(clearInterval(c),c=void 0),n&&(n.close(),n=void 0),e.stop(),o=void 0,i.removeEventListener("ended",a)};let c=window.setInterval((()=>{if(o&&n&&Date.now()-s>(null!=t?t:1e3))try{"live"===i.readyState?o.enqueue(n.clone()):a()}catch(e){a()}}),null!=t?t:1e3);const d=new TransformStream({transform:(e,t)=>{"live"===i.readyState?(o=t,s=Date.now(),void 0===n?(n=e,t.enqueue(e.clone())):(t.enqueue(n),n=e)):e.close()}});return i.addEventListener("ended",a),r.readable.pipeThrough(d).pipeTo(i.writable),i}}var lI,hI,pI,fI,EI,mI,_I,TI,gI,SI,RI,yI,vI,AI,bI,II,OI,CI,NI,wI,DI,PI,LI,kI,MI,UI,xI,VI,FI,BI,jI,GI,WI,HI,KI,YI,zI,XI,ZI,JI;function QI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function qI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?QI(Object(r),!0).forEach((function(t){H_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):QI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let $I=(lI=Yn({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),hI=Yn({argsMap:(e,t)=>[e.getTrackId(),t]}),pI=KA(),fI=Ji("LocalAudioTrack","_enabledMutex"),EI=Yn({argsMap:(e,t)=>[e.getTrackId(),t]}),mI=KA(),_I=Ji("LocalAudioTrack","_enabledMutex"),TI=Yn({argsMap:(e,t)=>[e.getTrackId(),t]}),gI=KA(),SI=KA(),RI=KA(),yI=Yn({argsMap:e=>[e.getTrackId()]}),vI=KA(),AI=Yn({argsMap:e=>[e.getTrackId()]}),bI=KA(),II=Yn({argsMap:e=>[e.getTrackId()]}),OI=Yn({argsMap:(e,t)=>[e.getTrackId(),t.name]}),CI=Yn({argsMap:e=>[e.getTrackId()]}),NI=class extends aA{get _source(){return this.initWebAudio()}set _source(e){this._trackSource=e}get processorContext(){return this._processorContext||(this._processorContext=this.initProcessor().processorContext),this._processorContext}get processorDestination(){return this._processorDestination||(this._processorDestination=this.initProcessor().processorDestination),this._processorDestination}get isPlaying(){return this._useAudioElement?HA.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"LocalAudioTrack"}constructor(e,t,r,i){super(e,r),H_(this,"trackMediaType",iu.AUDIO),H_(this,"_encoderConfig",void 0),H_(this,"_trackSource",void 0),H_(this,"metadata",[]),H_(this,"_enabled",!0),H_(this,"_volume",100),H_(this,"_useAudioElement",!0),H_(this,"_bypassWebAudio",!1),H_(this,"processor",void 0),H_(this,"_processorContext",void 0),H_(this,"_processorDestination",void 0),H_(this,"_getOriginVolumeLevel",void 0),this._encoderConfig=t,this._getOriginVolumeLevel=!!i,this._trackSource=new ab,hn("DISABLE_WEBAUDIO")&&(this._bypassWebAudio=!0),hn("LOCAL_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1);Ur()&&!mA()?setTimeout((()=>this.initWebAudio())):this.initWebAudio()}setVolume(e){ai(e,"volume",0,1e3),this._volume=e,this._source.setVolume(e/100),this._useAudioElement&&HA.setVolume(this.getTrackId(),e);try{if(this._bypassWebAudio)return void On.debug("[".concat(this.getTrackId(),"] setVolume returned because no pass through WebAudio."));const e=this._source.createOutputTrack();this._mediaStreamTrack!==e&&(this._mediaStreamTrack=e,vi(this,Zd.NEED_REPLACE_TRACK,this).then((()=>{On.debug("[".concat(this.getTrackId(),"] replace web audio track success"))})).catch((e=>{On.warning("[".concat(this.getTrackId(),"] replace web audio track failed"),e)})))}catch(e){}}getVolumeLevel(){return this._muted&&this.enabled&&this._getOriginVolumeLevel?this._source.getOriginVolumeLevel():this._source.getAccurateVolumeLevel()}async setPlaybackDevice(e){if(!this._useAudioElement||!Qn())throw new ni(ii.NOT_SUPPORTED,"your browser does not support setting the audio output device");await HA.setSinkID(this.getTrackId(),e)}async setEnabled(e,t,r){return this._setEnabled(e,t,r)}async _setEnabled(e,t,r){if(!r){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(On.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){this._originMediaStreamTrack.enabled=!0;try{r||(this._enabled=!0),await vi(this,Zd.NEED_ENABLE_TRACK,this),On.info("[".concat(this.getTrackId(),"] setEnabled to ").concat(e," success"))}catch(e){throw r||(this._enabled=!1),On.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}}else{this._originMediaStreamTrack.enabled=!1,r||(this._enabled=!1);try{await vi(this,Zd.NEED_DISABLE_TRACK,this)}catch(e){throw r||(this._enabled=!0),On.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}}}async setMuted(e){e!==this._muted&&(this.stateCheck("muted",e),this._muted=e,this._originMediaStreamTrack.enabled=!e,On.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await vi(this,Zd.NEED_MUTE_TRACK,this):await vi(this,Zd.NEED_UNMUTE_TRACK,this))}getStats(){Ui((()=>{On.warning("[deprecated] LocalAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalAudioStats instead")}),"localAudioTrackGetStatsWarning");const e=Ai(this,Zd.GET_STATS);return e||qI({},su)}setAudioFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners(nu.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(nu.ON_AUDIO_BUFFER),this._source.on(nu.ON_AUDIO_BUFFER,(t=>e(t)))}play(){On.debug("[".concat(this.getTrackId(),"] start audio playback")),this._useAudioElement?(On.debug("[".concat(this.getTrackId(),"] start audio playback in element")),HA.play(this._mediaStreamTrack,this.getTrackId(),this._volume)):this._source.play()}stop(){On.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._useAudioElement?HA.stop(this.getTrackId()):this._source.stop()}close(){super.close(),this._processorDestination&&this.unbindProcessorDestinationEvents(this._processorDestination),this._processorContext&&this.unbindProcessorContextEvents(this._processorContext),this.unpipe(),this._processorDestination&&this._processorDestination._source&&this._processorDestination._source.unpipe(),this._source.destroy()}_updatePlayerSource(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];On.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&HA.updateTrack(this.getTrackId(),this._mediaStreamTrack)}async _updateOriginMediaStreamTrack(e,t){this._originMediaStreamTrack!==e&&(this._originMediaStreamTrack&&(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),t&&this._originMediaStreamTrack.stop()),e.addEventListener("ended",this._handleTrackEnded),this._originMediaStreamTrack=e,this._muted&&(this._originMediaStreamTrack.enabled=!1),this.processor&&this._processorContext&&this.processor.updateInput({track:e,context:this._processorContext}),this._mediaStreamTrack!==this._source.outputTrack?(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await vi(this,Zd.NEED_REPLACE_TRACK,this)):this._source.updateTrack(this._originMediaStreamTrack),this._getOriginVolumeLevel&&this._source.updateOriginTrack(e))}renewMediaStreamTrack(e){return oA.resolve(void 0)}pipe(e){if(this._bypassWebAudio)throw new ni(ii.INVALID_OPERATION,"Can not process AudioTrack when bypassWebAudio set to true.");if(this.processor===e)return e;if(e._source)throw new ni(ii.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,node:this._source.processSourceNode,context:this.processorContext}),e}unpipe(){var e;if(!this.processor)return;const t=this.processor;null===(e=this._source.processSourceNode)||void 0===e||e.disconnect(),this.processor._source=!1,this.processor=void 0,t.reset()}bindProcessorDestinationEvents(e){e.on(uu.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(!1),this._source.processedNode=this._source.createMediaStreamSourceNode(e),await vi(this,Zd.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await vi(this,Zd.NEED_REPLACE_TRACK,this))})),e.on(uu.ON_NODE,(e=>{this._source.processedNode=e}))}unbindProcessorDestinationEvents(e){e.removeAllListeners(uu.ON_TRACK),e.removeAllListeners(uu.ON_NODE)}bindProcessorContextEvents(e){e.on(lu.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}unbindProcessorContextEvents(e){e.removeAllListeners(lu.REQUEST_CONSTRAINTS)}initWebAudio(){return this._trackSource instanceof ab&&(this._trackSource=new bA(this._mediaStreamTrack,!1,this._getOriginVolumeLevel?this._mediaStreamTrack:void 0)),this._trackSource}initProcessor(){const e=new sb(this._source.context,this.getTrackId(),"local"),t=new ob(e);return this._processorContext=e,this._processorDestination=t,this.bindProcessorContextEvents(e),this.bindProcessorDestinationEvents(t),this._source.on(nu.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:e})})),this._useAudioElement&&(this._useAudioElement=!1,this.isPlaying&&(HA.stop(this.getTrackId()),this._source.play()),vi(this,Zd.NEED_REPLACE_MIXING_TRACK,this).then((()=>{On.debug("[".concat(this.getTrackId(),"] replace from origin track to web audio track success"))})).catch((e=>{On.warning("[".concat(this.getTrackId(),"] replace from origin track to web audio track failed"),e)}))),{processorContext:e,processorDestination:t}}},eg(NI.prototype,"setVolume",[lI],Object.getOwnPropertyDescriptor(NI.prototype,"setVolume"),NI.prototype),eg(NI.prototype,"setPlaybackDevice",[hI,pI],Object.getOwnPropertyDescriptor(NI.prototype,"setPlaybackDevice"),NI.prototype),eg(NI.prototype,"setEnabled",[fI,EI,mI],Object.getOwnPropertyDescriptor(NI.prototype,"setEnabled"),NI.prototype),eg(NI.prototype,"setMuted",[_I,TI,gI],Object.getOwnPropertyDescriptor(NI.prototype,"setMuted"),NI.prototype),eg(NI.prototype,"getStats",[SI],Object.getOwnPropertyDescriptor(NI.prototype,"getStats"),NI.prototype),eg(NI.prototype,"setAudioFrameCallback",[RI],Object.getOwnPropertyDescriptor(NI.prototype,"setAudioFrameCallback"),NI.prototype),eg(NI.prototype,"play",[yI,vI],Object.getOwnPropertyDescriptor(NI.prototype,"play"),NI.prototype),eg(NI.prototype,"stop",[AI,bI],Object.getOwnPropertyDescriptor(NI.prototype,"stop"),NI.prototype),eg(NI.prototype,"close",[II],Object.getOwnPropertyDescriptor(NI.prototype,"close"),NI.prototype),eg(NI.prototype,"pipe",[OI],Object.getOwnPropertyDescriptor(NI.prototype,"pipe"),NI.prototype),eg(NI.prototype,"unpipe",[CI],Object.getOwnPropertyDescriptor(NI.prototype,"unpipe"),NI.prototype),NI),eO=(wI=Yn({argsMap:(e,t)=>[e.getTrackId(),t]}),DI=KA(),PI=Ji("MicrophoneAudioTrack","_enabledMutex"),LI=Yn({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),kI=KA(),MI=Yn({argsMap:e=>[e.getTrackId()]}),UI=class extends $I{get __className__(){return"MicrophoneAudioTrack"}constructor(e,t,r,i){super(e,t.encoderConfig?jd(t.encoderConfig):{},i,hn("GET_VOLUME_OF_MUTED_AUDIO_TRACK")),H_(this,"_config",void 0),H_(this,"_deviceName","default"),H_(this,"_constraints",void 0),H_(this,"_originalConstraints",void 0),H_(this,"_enabled",!0),this._config=t,this._constraints=r,this._originalConstraints=r,this._deviceName=e.label,"boolean"==typeof t.bypassWebAudio&&(this._bypassWebAudio=t.bypassWebAudio),(Kr()||Yr())&&hA.bindInterruptDetectorTrack(this)}async setDevice(e){if(On.info("[".concat(this.getTrackId(),"] start set device to ").concat(e)),this._enabled)try{const t=await UA.getDeviceById(e),r={};r.audio=qI({},this._constraints),r.audio.deviceId={exact:e},this._originMediaStreamTrack.stop();let i=null;try{i=await DA(r,this.getTrackId())}catch(e){throw On.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),i=await DA({audio:this._constraints},this.getTrackId()),await this._updateOriginMediaStreamTrack(i.getAudioTracks()[0],!1),e}await this._updateOriginMediaStreamTrack(i.getAudioTracks()[0],!1),this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(e){throw On.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await UA.getDeviceById(e);this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(e){throw On.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}On.info("[".concat(this.getTrackId(),"] set device to ").concat(e," success"))}async setEnabled(e,t,r){if(t)return On.debug("[".concat(this.getTrackId(),"] setEnabled false (do not close microphone)")),await super._setEnabled(e);if(!r){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(On.info("[".concat(this.getTrackId(),"] start setEnabled"),e),hn("AUTO_RESET_AUDIO_ROUTE")&&(Fr()||Xr())){const t=navigator.audioSession;t&&(e||(t.type="playback"),t.type="auto")}if(!e){var i;this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop(),null===(i=this._source.clonedTrack)||void 0===i||i.stop(),r||(this._enabled=!1);try{await vi(this,Zd.NEED_DISABLE_TRACK,this)}catch(e){throw On.error("[".concat(this.getTrackId(),"] setEnabled false failed"),e.toString()),e}return}const n=qI({},this._constraints),o=UA.searchDeviceIdByName(this._deviceName);o&&!n.deviceId&&(n.deviceId=o);try{r||(this._enabled=!0);const e=await DA({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!1),await vi(this,Zd.NEED_ENABLE_TRACK,this)}catch(e){throw r||(this._enabled=!1),On.error("[".concat(this.getTrackId(),"] setEnabled true failed"),e.toString()),e}On.info("[".concat(this.getTrackId(),"] setEnabled success"))}close(){super.close(),(Kr()||Yr())&&hA.unbindInterruptDetectorTrack(this),Kd()||fA()}onTrackEnded(){if((Fr()||Xr())&&this._enabled&&!this._isClosed&&hA.duringInterruption){const e=async()=>{hA.off(ro.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(On.debug("[".concat(this.getTrackId(),"] try capture microphone media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};hA.on(ro.IOS_INTERRUPTION_END,e)}else On.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(tu.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=UA.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId=r),this._constraints=t,this._enabled){this._originMediaStreamTrack.stop();const e=await DA({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!0)}}bindProcessorContextEvents(e){super.bindProcessorContextEvents(e),e.on(lu.REQUEST_UPDATE_CONSTRAINTS,(async(e,t,r)=>{try{const r=Object.assign({},this._originalConstraints,...e);await this.renewMediaStreamTrack(r),t()}catch(e){r(e)}}))}unbindProcessorContextEvents(e){super.unbindProcessorContextEvents(e),e.removeAllListeners(lu.REQUEST_UPDATE_CONSTRAINTS)}},eg(UI.prototype,"setDevice",[wI,DI],Object.getOwnPropertyDescriptor(UI.prototype,"setDevice"),UI.prototype),eg(UI.prototype,"setEnabled",[PI,LI,kI],Object.getOwnPropertyDescriptor(UI.prototype,"setEnabled"),UI.prototype),eg(UI.prototype,"close",[MI],Object.getOwnPropertyDescriptor(UI.prototype,"close"),UI.prototype),UI),tO=(xI=Yn({argsMap:(e,t)=>[e.getTrackId(),t,e.duration]}),VI=KA(),FI=Yn({argsMap:e=>[e.getTrackId()]}),BI=KA(),jI=Yn({argsMap:e=>[e.getTrackId()]}),GI=KA(),WI=Yn({argsMap:e=>[e.getTrackId()]}),HI=KA(),KI=Yn({argsMap:e=>[e.getTrackId()]}),YI=KA(),zI=Yn({argsMap:e=>[e.getTrackId()]}),XI=Yn({argsMap:e=>[e.getTrackId()]}),ZI=KA(),eg((JI=class extends $I{get __className__(){return"BufferSourceAudioTrack"}constructor(e,t,r,i){super(t.createOutputTrack(),r,i),H_(this,"source",void 0),H_(this,"_bufferSource",void 0),this._useAudioElement=!1,this.source=e,this._bufferSource=t,this._bufferSource.on(nu.AUDIO_SOURCE_STATE_CHANGE,(e=>{this.safeEmit(tu.SOURCE_STATE_CHANGE,e)}));try{this._mediaStreamTrack=this._source.createOutputTrack()}catch(e){}}get currentState(){return this._bufferSource.currentState}get duration(){return this._bufferSource.duration}get playbackSpeed(){return this._bufferSource.playbackSpeed}getCurrentTime(){return this._bufferSource.currentTime}startProcessAudioBuffer(e){e&&this._bufferSource.updateOptions(e),this._bufferSource.startProcessAudioBuffer()}pauseProcessAudioBuffer(){this._bufferSource.pauseProcessAudioBuffer()}seekAudioBuffer(e){this._bufferSource.seekAudioBuffer(e)}resumeProcessAudioBuffer(){this._bufferSource.resumeProcessAudioBuffer()}stopProcessAudioBuffer(){this._bufferSource.stopProcessAudioBuffer()}close(){this.source=null,this._bufferSource.destroy(),super.close()}setAudioBufferPlaybackSpeed(e){ai(e,"speed",0),this._bufferSource.setAudioBufferPlaybackSpeed(e)}}).prototype,"startProcessAudioBuffer",[xI,VI],Object.getOwnPropertyDescriptor(JI.prototype,"startProcessAudioBuffer"),JI.prototype),eg(JI.prototype,"pauseProcessAudioBuffer",[FI,BI],Object.getOwnPropertyDescriptor(JI.prototype,"pauseProcessAudioBuffer"),JI.prototype),eg(JI.prototype,"seekAudioBuffer",[jI,GI],Object.getOwnPropertyDescriptor(JI.prototype,"seekAudioBuffer"),JI.prototype),eg(JI.prototype,"resumeProcessAudioBuffer",[WI,HI],Object.getOwnPropertyDescriptor(JI.prototype,"resumeProcessAudioBuffer"),JI.prototype),eg(JI.prototype,"stopProcessAudioBuffer",[KI,YI],Object.getOwnPropertyDescriptor(JI.prototype,"stopProcessAudioBuffer"),JI.prototype),eg(JI.prototype,"close",[zI],Object.getOwnPropertyDescriptor(JI.prototype,"close"),JI.prototype),eg(JI.prototype,"setAudioBufferPlaybackSpeed",[XI,ZI],Object.getOwnPropertyDescriptor(JI.prototype,"setAudioBufferPlaybackSpeed"),JI.prototype),JI);class rO extends $I{get __className__(){return"MixingAudioTrack"}get isActive(){for(const e of this.trackList)if(e._enabled&&!e._isClosed&&!e.muted)return!0;return!1}constructor(){const e=EA().createMediaStreamDestination();super(e.stream.getAudioTracks()[0],void 0,Fi(8,"track-mix-")),H_(this,"trackList",void 0),H_(this,"destNode",void 0),this._useAudioElement=!1;try{this._mediaStreamTrack=this._source.createOutputTrack()}catch(e){}this.destNode=e,this.trackList=[]}hasAudioTrack(e){return-1!==this.trackList.indexOf(e)}addAudioTrack(e){-1===this.trackList.indexOf(e)?(On.debug("add ".concat(e.getTrackId()," to mixing track")),e._source.outputNode.connect(this.destNode),this.trackList.push(e),this.updateEncoderConfig()):On.debug("track ".concat(e.getTrackId()," is already added"))}removeAudioTrack(e){if(-1!==this.trackList.indexOf(e)){On.debug("remove ".concat(e.getTrackId()," from mixing track"));try{e._source.outputNode.disconnect(this.destNode)}catch(e){}Di(this.trackList,e),this.updateEncoderConfig()}}updateEncoderConfig(){const e={};this.trackList.forEach((t=>{t._encoderConfig&&((t._encoderConfig.bitrate||0)>(e.bitrate||0)&&(e.bitrate=t._encoderConfig.bitrate),(t._encoderConfig.sampleRate||0)>(e.sampleRate||0)&&(e.sampleRate=t._encoderConfig.sampleRate),(t._encoderConfig.sampleSize||0)>(e.sampleSize||0)&&(e.sampleSize=t._encoderConfig.sampleSize),t._encoderConfig.stereo&&(e.stereo=!0))})),this._encoderConfig=e}_updateRtpTransceiver(e){this._rtpTransceiver!==e&&(this._rtpTransceiver=e,this.trackList.forEach((t=>{t instanceof rO?t.emit(eu.TRANSCEIVER_UPDATED,e):t._updateRtpTransceiver(e)})))}}class iO extends AA{set currentState(e){e!==this._currentState&&(this._currentState=e,this.safeEmit(nu.AUDIO_SOURCE_STATE_CHANGE,this._currentState))}get currentState(){return this._currentState}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),H_(this,"audioBuffer",void 0),H_(this,"sourceNode",void 0),H_(this,"startPlayTime",0),H_(this,"startPlayOffset",0),H_(this,"pausePlayTime",0),H_(this,"options",void 0),H_(this,"currentLoopCount",0),H_(this,"currentPlaybackSpeed",100),H_(this,"_currentState","stopped"),this.audioBuffer=e,this.options=t,this.startPlayOffset=this.options.startPlayTime||0}createWebAudioDiagram(){return this.context.createGain()}get duration(){return this.audioBuffer?this.audioBuffer.duration:0}get playbackSpeed(){return this.currentPlaybackSpeed}get currentTime(){return this.audioBuffer?"stopped"===this.currentState?0:"paused"===this.currentState?this.pausePlayTime:((this.context.currentTime-this.startPlayTime)*(this.playbackSpeed/100)+this.startPlayOffset)%this.audioBuffer.duration:0}updateOptions(e){"stopped"===this.currentState?(this.options=e,this.startPlayOffset=this.options.startPlayTime||0):On.warning("can not set audio source options")}startProcessAudioBuffer(){this.sourceNode&&this.stopProcessAudioBuffer(),this.sourceNode=this.createSourceNode(),this.startSourceNode(),this.currentState="playing"}pauseProcessAudioBuffer(){this.sourceNode&&"playing"===this.currentState&&(this.pausePlayTime=this.currentTime,this.sourceNode.onended=null,this.sourceNode.stop(),this.sourceNode.buffer=null,this.sourceNode=this.createSourceNode(),this.currentState="paused")}seekAudioBuffer(e){this.sourceNode&&(this.sourceNode.onended=null,"playing"===this.currentState&&this.sourceNode.stop(),this.sourceNode=this.createSourceNode(),"playing"===this.currentState?(this.startPlayOffset=e,this.startSourceNode()):"paused"===this.currentState&&(this.pausePlayTime=e))}resumeProcessAudioBuffer(){"paused"===this.currentState&&this.sourceNode&&(this.startPlayOffset=this.pausePlayTime,this.pausePlayTime=0,this.startSourceNode(),this.currentState="playing")}stopProcessAudioBuffer(){if(this.sourceNode){this.sourceNode.onended=null;try{this.sourceNode.stop()}catch(e){}this.reset()}}destroy(){this.audioBuffer=null,super.destroy()}setAudioBufferPlaybackSpeed(e){this.sourceNode&&("playing"===this.currentState&&(this.startPlayOffset=this.currentTime,this.startPlayTime=this.context.currentTime),this.sourceNode.playbackRate.value=e/100),this.currentPlaybackSpeed=e}startSourceNode(){this.sourceNode&&this.sourceNode.buffer&&(this.sourceNode.start(0,this.startPlayOffset),this.startPlayTime=this.context.currentTime,this.sourceNode.onended=this.handleSourceNodeEnded.bind(this))}createSourceNode(){const e=this.context.createBufferSource();return e.buffer=this.audioBuffer,e.loop=!!this.options.loop,e.connect(this.outputNode),e.playbackRate.value=this.currentPlaybackSpeed/100,e}handleSourceNodeEnded(){if(this.currentLoopCount+=1,this.options.cycle&&this.options.cycle>this.currentLoopCount)return this.startPlayOffset=0,this.sourceNode=void 0,void this.startProcessAudioBuffer();this.reset()}reset(){this.startPlayOffset=this.options.startPlayTime||0,this.currentState="stopped",this.sourceNode&&(this.sourceNode.disconnect(),this.sourceNode=void 0),this.currentLoopCount=0}}const nO=new Map;function oO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function sO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?oO(Object(r),!0).forEach((function(t){H_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):oO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function aO(e,t){if(0===e.length||0===t.length)return 1/0;const r=Yi(e),i=Yi(t);return Math.floor(i/r)}class cO{get rendFrameRate(){const e=Math.max(1,aO(this._render_interframe_delays_sizes,this._render_interframe_delays));return Math.floor(1e3/e)}get videoElementStatus(){return this._isInPage?this._videoElementStatus:fu.DESTROYED}set videoElementStatus(e){e!==this._videoElementStatus&&(On.debug("[".concat(this.trackId,"] video-element-status change ").concat(this._videoElementStatus," => ").concat(e)),this._videoElementStatus=e)}get videoState(){return this._videoState}set videoState(e){var t;e!==this._videoState&&(this._videoState=e,null===(t=this.onVideoStateChanged)||void 0===t||t.call(this,this.videoState))}constructor(e){H_(this,"trackId",void 0),H_(this,"config",void 0),H_(this,"onFirstVideoFrameDecoded",void 0),H_(this,"onFirstVideoFrameRender",void 0),H_(this,"onVideoBufferReady",void 0),H_(this,"onVideoStateChanged",void 0),H_(this,"freezeTimeCounterList",[]),H_(this,"renderFreezeAccTime",0),H_(this,"renderFreezeAccTime2",0),H_(this,"totalFreezeTime",0),H_(this,"isKeepLastFrame",!1),H_(this,"isDestroyed",!1),H_(this,"timeUpdatedCount",0),H_(this,"freezeTime",0),H_(this,"playbackTime",0),H_(this,"lastTimeUpdatedTime",0),H_(this,"autoplayFailed",!1),H_(this,"videoTrack",void 0),H_(this,"videoElement",void 0),H_(this,"cacheVideoElement",void 0),H_(this,"cancelRVFId",void 0),H_(this,"internal",!1),H_(this,"_render_interframe_delays",[]),H_(this,"_render_interframe_delays_sizes",[]),H_(this,"_videoState",Eu.VideoStateStopped),H_(this,"videoElementCheckInterval",void 0),H_(this,"videoElementFreezeTimeout",void 0),H_(this,"_videoElementStatus",fu.NONE),H_(this,"_isInPage",!0),H_(this,"isGettingVideoDimensions",!1),H_(this,"startGetVideoDimensions",(()=>{const e=()=>{if(this.isGettingVideoDimensions=!0,this.videoElement.videoWidth*this.videoElement.videoHeight>4)return On.debug("[".concat(this.trackId,"] current video dimensions:"),this.videoElement.videoWidth,this.videoElement.videoHeight),void(this.isGettingVideoDimensions=!1);setTimeout(e,500)};!this.isGettingVideoDimensions&&e()})),H_(this,"autoResumeAfterInterruption",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&"running"===hA.curState&&(On.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(Lr())),zr()?(this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):(this.videoElement.pause(),this.videoElement.play()))})),H_(this,"handleVideoEvents",(e=>{switch(e.type){case"play":case"playing":"play"===e.type&&On.debug("[".concat(this.trackId,"] video element status: play")),this.startGetVideoDimensions(),this.videoElementStatus=fu.PLAYING;break;case"loadeddata":if(this.videoState=Eu.VideoStateStarting,this.onFirstVideoFrameRender&&this.onFirstVideoFrameRender(),this.onFirstVideoFrameDecoded&&this.onFirstVideoFrameDecoded(),this.cacheVideoElement){try{this.cacheVideoElement.srcObject=null,this.cacheVideoElement.remove()}catch(e){}this.cacheVideoElement=void 0}break;case"canplay":this.videoElementStatus=fu.CANPLAY;break;case"stalled":this.videoElementStatus=fu.STALLED;break;case"suspend":this.videoElementStatus=fu.SUSPEND;break;case"pause":this.videoElementStatus=fu.PAUSED,Fr()||Xr()||Ur()&&this.autoplayFailed||!this.videoTrack||"live"!==this.videoTrack.readyState||(On.debug("[track-".concat(this.trackId,"] video element paused, auto resume")),this.videoElement.play());break;case"waiting":this.videoElementStatus=fu.WAITING;break;case"abort":this.videoElementStatus=fu.ABORT;break;case"ended":this.videoElementStatus=fu.ENDED;break;case"emptied":this.videoElementStatus=fu.EMPTIED;break;case"error":{const e=this.videoElement.error;e&&(this.videoElementStatus=fu.ERROR,On.error("[".concat(this.trackId,"] media error: ").concat(e.message," (").concat(e.code,")")));break}case"timeupdate":{const e=performance.now();if(this.timeUpdatedCount+=1,this.onVideoBufferReady&&this.timeUpdatedCount>hn("BUFFER_READY_FRAMES")&&this.onVideoBufferReady(),this.timeUpdatedCount<10)return void(this.lastTimeUpdatedTime=e);const t=e-this.lastTimeUpdatedTime,r=this.lastTimeUpdatedTime;if(this.lastTimeUpdatedTime=e,SC.lastVisibleTime<SC.lastHiddenTime||r<SC.lastHiddenTime||r<SC.lastVisibleTime)return;if(this.isSkipCalcRenderFreezeTime())return;for(t>hn("VIDEO_FREEZE_DURATION")&&(this.freezeTime+=t),this.playbackTime+=t;this.playbackTime>=6e3;){this.playbackTime-=6e3;const e=Math.min(6e3,this.freezeTime);this.freezeTimeCounterList.push(e),this.freezeTime=Math.max(0,this.freezeTime-6e3)}break}}})),H_(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&(On.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(Lr())),zr()?(this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):(this.videoElement.pause(),this.videoElement.play()))})),this.trackId=e.trackId,this.config=e,e.element instanceof HTMLVideoElement?this.videoElement=e.element:this.videoElement=document.createElement("video"),hA.on(ro.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),hA.on(ro.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16)}getVideoElement(){return this.videoElement}getContainerElement(){var e;return null!==(e=this.videoElement.parentElement)&&void 0!==e?e:void 0}updateConfig(e){this.config=e,this.trackId=e.trackId,e.element!==this.videoElement&&(this.destroy(),this.videoElement=e.element),this.videoTrack&&this.initVideoElement()}updateVideoTrack(e){this.videoTrack!==e&&(this.videoTrack=e,this.initVideoElement())}play(e){const t=this.videoElement.play();t&&t.catch&&t.catch((t=>{e&&GA(e,"video",t.message,this.trackId),"NotAllowedError"===t.name?(On.warning("detected video element autoplay failed",t),this.autoplayFailed=!0,this.handleAutoPlayFailed()):On.warning("[".concat(this.trackId,"] play warning: "),t)}));const r=wr();if(("Safari"===r.name&&15===Number(r.version)||Kr())&&t&&t.then){const e=()=>{this.config.mirror&&!this.config.noStyle&&(this.videoElement.style.transform="rotateY(180deg)")};t.then(e).catch(e)}}getCurrentFrame(){const e=document.createElement("canvas");e.width=this.videoElement.videoWidth,e.height=this.videoElement.videoHeight;const t=e.getContext("2d");if(!t)return On.error("create canvas context failed!"),new ImageData(2,2);t.drawImage(this.videoElement,0,0,e.width,e.height);const r=t.getImageData(0,0,e.width,e.height);return e.remove(),r}async getCurrentFrameToUint8Array(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const r=document.createElement("canvas");r.width=this.videoElement.videoWidth,r.height=this.videoElement.videoHeight;const i=r.getContext("2d");return i?(i.drawImage(this.videoElement,0,0,r.width,r.height),new oA(((i,n)=>{r.toBlob((async e=>{if(r.remove(),e){const t=await dI(e);i({buffer:t,width:r.width,height:r.height})}else n(new ni(ii.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,t<0?.1:t>1?1:t)}))):await cI(e)}destroy(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isDestroyed=!0,hA.off(ro.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),hA.off(ro.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),e?this.videoElement.pause():this.videoElement.srcObject=null,this.resetVideoElement(),this.freezeTimeCounterList=[],this.videoState=Eu.VideoStateStopped}initVideoElement(){if(this._videoElementStatus!==fu.NONE&&this._videoElementStatus!==fu.DESTROYED||(this.videoElementStatus=fu.INIT),!this.videoElementCheckInterval&&(dO.forEach((e=>{this.videoElement.addEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval=window.setInterval((()=>{this._isInPage=function(e){return e!==document.body&&document.body.contains(e)}(this.videoElement)}),1e3),hn("ENABLE_VIDEO_FRAME_CALLBACK"))){var e,t;let r;const i=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",i),this.videoElementFreezeTimeout=window.setTimeout(n,hn("VIDEO_FREEZE_DURATION")))},n=()=>{this.videoElementFreezeTimeout=void 0,this.videoState===Eu.VideoStateDecoding&&("visible"===document.visibilityState?this.videoState=Eu.VideoStateFrozen:document.addEventListener("visibilitychange",i))},o=(e,t)=>{if(this.videoElementStatus===fu.PLAYING){if(r){const e=t.presentationTime-r.presentationTime,i=t.presentedFrames-r.presentedFrames;this._render_interframe_delays_sizes.push(i),this._render_interframe_delays.push(e);const o=Yi(this._render_interframe_delays_sizes),s=o-this._render_interframe_delays_sizes[0];if(o>30&&s>5&&(this._render_interframe_delays_sizes.shift(),this._render_interframe_delays.shift()),this.videoState===Eu.VideoStateStarting&&(this.videoState=Eu.VideoStateDecoding),this.videoState===Eu.VideoStateDecoding&&this.onVideoStateChanged&&(this.videoElementFreezeTimeout&&window.clearTimeout(this.videoElementFreezeTimeout),this.videoElementFreezeTimeout=window.setTimeout(n,hn("VIDEO_FREEZE_DURATION"))),e<hn("VIDEO_FREEZE_DURATION")&&this.videoState===Eu.VideoStateFrozen&&(this.videoState=Eu.VideoStateDecoding),e>hn("VIDEO_FREEZE_DURATION")&&SC.lastVisibleTime>=SC.lastHiddenTime&&r.timestamp>SC.lastVisibleTime&&r.timestamp>SC.lastHiddenTime){const t=Math.min(66,aO(this._render_interframe_delays_sizes,this._render_interframe_delays)),r=Math.max(0,e-(i-1)*t),n=r>t?r:0;this.renderFreezeAccTime2+=n,this.totalFreezeTime+=n,this.renderFreezeAccTime+=e}}r=sO(sO({},t),{},{timestamp:e})}else this.isSkipCalcRenderFreezeTime()&&(r=sO(sO({},t),{},{timestamp:e}));var i,s;hn("ENABLE_VIDEO_FRAME_CALLBACK")&&(this.cancelRVFId=null===(i=(s=this.videoElement).requestVideoFrameCallback)||void 0===i?void 0:i.call(s,o))};this.cancelRVFId=null===(e=(t=this.videoElement).requestVideoFrameCallback)||void 0===e?void 0:e.call(t,o)}this.videoElement.controls=!1,this.videoElement.setAttribute("playsinline",""),qr()&&!hn("HIDE_NO_POSTER")&&(this.videoElement.poster="noposter");const r=wr();if(this.config.noStyle||("Safari"===r.name&&15===Number(r.version)||Kr()||!this.config.mirror||(this.videoElement.style.transform="rotateY(180deg)"),this.config.fit?this.videoElement.style.objectFit=this.config.fit:this.videoElement.style.objectFit="cover"),this.videoElement.setAttribute("muted",""),this.videoElement.muted=!0,this.videoElement.srcObject&&this.videoElement.srcObject instanceof MediaStream){this.videoElement.srcObject.getVideoTracks()[0]!==this.videoTrack&&(this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,Vr()&&this.videoElement.load())}else this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,Vr()&&this.videoElement.load();const i=this.videoElement.play();void 0!==i&&i.catch((e=>{On.debug("[".concat(this.trackId,"] playback interrupted"),e.toString())}))}resetVideoElement(){var e,t;(dO.forEach((e=>{this.videoElement&&this.videoElement.removeEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval&&(window.clearInterval(this.videoElementCheckInterval),this.videoElementCheckInterval=void 0),this.cancelRVFId&&this.videoElement)&&(null===(e=(t=this.videoElement).cancelVideoFrameCallback)||void 0===e||e.call(t,this.cancelRVFId),this.cancelRVFId=void 0);this.videoElementStatus=fu.NONE}isSkipCalcRenderFreezeTime(){return this.videoElementStatus===fu.DESTROYED||this.internal}handleAutoPlayFailed(){const e=t=>{t.preventDefault(),this.videoElement.play().then((()=>{On.debug("[".concat(this.trackId,"] Video element for trackId:").concat(this.trackId," autoplay resumed."))})).catch((e=>{On.error(e)})),this.autoplayFailed=!1,$r()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};$r()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),FA()}}const dO=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","timeupdate","error"];class uO extends cO{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];super(e),H_(this,"container",void 0),H_(this,"slot",void 0),this.slot=e.element,this.internal=t,this.updateConfig(e)}updateConfig(e){this.config=e,this.trackId=e.trackId;const t=e.element;var r;!this.internal||this.slot?(t!==this.slot&&(this.destroy(),this.slot=t),this.createElements()):(this.slot=t,t&&this.container?(this.internal=!1,this.container.id="agora-video-player-".concat(this.trackId),this.videoElement.id="video_".concat(this.trackId),this.config.fit?this.videoElement.style.objectFit=this.config.fit:this.videoElement.style.objectFit="cover",null===(r=this.slot)||void 0===r||r.appendChild(this.container)):this.createElements())}updateVideoTrack(e){this.videoTrack!==e&&(this.videoTrack=e,this.createElements())}play(e){var t;null!==(t=this.container)&&void 0!==t&&t.contains(this.videoElement)&&super.play(e)}getCurrentFrame(){var e;return null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)?super.getCurrentFrame():new ImageData(2,2)}async getCurrentFrameToUint8Array(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return null!==(t=this.container)&&void 0!==t&&t.contains(this.videoElement)?await super.getCurrentFrameToUint8Array(e,r):await cI(e)}destroy(){if(super.destroy(),this.videoElement.remove(),this.videoElement=document.createElement("video"),this.container){try{var e;this.container.remove(),null===(e=this.slot)||void 0===e||e.removeChild(this.container)}catch(e){}this.container=void 0}}createElements(){var e;this.container||(this.container=document.createElement("div")),this.container.id="agora-video-player-".concat(this.trackId),this.container.style.width="100%",this.container.style.height="100%",this.container.style.position="relative",this.container.style.overflow="hidden",this.videoTrack?(this.container.style.backgroundColor="black",hn("KEEP_LAST_FRAME")&&this.isKeepLastFrame&&this.videoElement.paused&&this.resetVideoElement(),this.mountedVideoElement()):this.unmountedVideoElement(),null===(e=this.slot)||void 0===e||e.appendChild(this.container)}mountedVideoElement(){var e;!this.container||null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)||this.container.appendChild(this.videoElement),super.initVideoElement(),this.videoElement.id="video_".concat(this.trackId),this.videoElement.className="agora_video_player",this.videoElement.style.width="100%",this.videoElement.style.height="100%",this.videoElement.style.position="absolute",this.videoElement.style.left="0",this.videoElement.style.top="0"}unmountedVideoElement(){var e;if(null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)){super.resetVideoElement();try{this.container&&this.container.removeChild(this.videoElement)}catch(e){}this.videoElement=document.createElement("video")}}resetVideoElement(){var e;null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)&&(super.resetVideoElement(),this.cacheVideoElement=this.videoElement,this.videoElement=document.createElement("video"))}getContainerElement(){return this.container}}var lO,hO,pO,fO,EO,mO,_O,TO,gO,SO,RO,yO,vO,AO,bO,IO,OO,CO,NO,wO,DO,PO,LO,kO,MO,UO,xO,VO,FO,BO,jO,GO,WO,HO,KO,YO,zO,XO;function ZO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function JO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ZO(Object(r),!0).forEach((function(t){H_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ZO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let QO=(lO=Yn({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),hO=KA(),pO=Yn({argsMap:e=>[e.getTrackId()]}),fO=Ji("LocalVideoTrack","_enabledMutex"),EO=Yn({argsMap:(e,t)=>[e.getTrackId(),t]}),mO=KA(),_O=Ji("LocalVideoTrack","_enabledMutex"),TO=Yn({argsMap:(e,t)=>[e.getTrackId(),t]}),gO=KA(),SO=Yn({argsMap:(e,t)=>[e.getTrackId(),t,e._saveEncodeBitrateRatio]}),RO=KA(),yO=Yn({argsMap:(e,t)=>[e.getTrackId(),t]}),vO=KA(),AO=KA(),bO=Yn({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),IO=KA(),OO=KA(),CO=KA(),NO=Yn({argsMap:e=>[e.getTrackId()]}),wO=KA(),DO=KA(),PO=KA(),LO=KA(),kO=KA(),MO=Yn({argsMap:(e,t)=>[e.getTrackId(),t.name]}),UO=Yn({argsMap:e=>[e.getTrackId()]}),xO=Yn({argsMap:e=>[e.getTrackId()]}),VO=Yn({argsMap:(e,t,r)=>[e.getTrackId(),t.label,r]}),FO=class e extends aA{get videoHeight(){if(Ur()){const{height:e}=this._mediaStreamTrack.getSettings();return this._videoHeight=e,this._videoHeight}return this._videoHeight}get videoWidth(){if(Ur()){const{width:e}=this._mediaStreamTrack.getSettings();return this._videoWidth=e,this._videoWidth}return this._videoWidth}get isPlaying(){return!(!this._player||this._player.videoElementStatus!==fu.PLAYING)}get processorDestination(){return this._processorDestination}get processorContext(){return this._processorContext}set processorContext(e){this._processorContext=e}get __className__(){return"LocalVideoTrack"}constructor(e,t,r,i,n,o){if(super(e,n),H_(this,"trackMediaType",iu.VIDEO),H_(this,"_player",void 0),H_(this,"isUseScaleResolutionDownBy",!1),H_(this,"_videoVisibleTimer",null),H_(this,"_previousVideoVisibleStatus",void 0),H_(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),H_(this,"_encoderConfig",void 0),H_(this,"_scalabilityMode",{numSpatialLayers:1,numTemporalLayers:1}),H_(this,"_optimizationMode",void 0),H_(this,"_saveEncodeBitrateRatio",1),H_(this,"_videoHeight",void 0),H_(this,"_videoWidth",void 0),H_(this,"_forceBitrateLimit",void 0),H_(this,"_enabled",!0),H_(this,"_processorDestination",void 0),H_(this,"_processorContext",void 0),Ur()){const{width:t,height:r}=e.getSettings();this._videoWidth=t,this._videoHeight=r}else this.updateMediaStreamTrackResolution();if(this._scalabilityMode=r,this._optimizationMode=i,this._hints=o||[],t&&-1!==this._hints.indexOf(Jd.CUSTOM_TRACK)?this._encoderConfig=Li(t):this._encoderConfig=t,-1===this._hints.indexOf(Jd.SCREEN_TRACK))this.updateBitrateFromProfile();else if(jr(Ir.CHROME,115)&&-1!==Pr().indexOf("Windows")){const t=uI(e);t&&(On.info("local screen video track begin to inject frame"),this._mediaStreamTrack=t)}t&&-1!==this._hints.indexOf(Jd.CUSTOM_TRACK)&&this.setEncoderConfiguration(t),this._processorContext=new nb(this.getTrackId(),"local"),this._processorDestination=new ib(this.processorContext),this.bindProcessorDestinationEvents()}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof e){const t=document.getElementById(e);t?e=t:(On.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}On.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=JO(JO(JO({},this._getDefaultPlayerConfig()),t),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(r):(e instanceof HTMLVideoElement?this._player=new cO(r):this._player=new uO(r),this._player.updateVideoTrack(this._mediaStreamTrack)),this._player.play(),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((()=>{try{const e=this.getVideoElementVisibleStatus();this.safeEmit(tu.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),hn("CHECK_VIDEO_VISIBLE_INTERVAL"))}stop(){this._player&&(this._videoVisibleTimer&&(window.clearInterval(this._videoVisibleTimer),this._videoVisibleTimer=null),this._clearPreviousVideoVisibleStatus(),this._player.destroy(),this._player=void 0,On.debug("[".concat(this.getTrackId(),"] stop video playback")))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(On.info("[".concat(this.getTrackId(),"] start setEnabled"),e),!e){this._originMediaStreamTrack.enabled=!1;try{await vi(this,Zd.NEED_DISABLE_TRACK,this)}catch(e){throw On.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}return t||(this._enabled=!1),void On.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}this._originMediaStreamTrack.enabled=!0;try{await vi(this,Zd.NEED_ENABLE_TRACK,this)}catch(e){throw On.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}On.info("[".concat(this.getTrackId(),"] setEnabled to true success")),t||(this._enabled=!0)}async setMuted(e){e!==this._muted&&(this.stateCheck("muted",e),this._muted=e,this._originMediaStreamTrack.enabled=!e,On.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await vi(this,Zd.NEED_MUTE_TRACK,this):await vi(this,Zd.NEED_UNMUTE_TRACK,this))}async setSaveEncodeBitrateRatio(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._saveEncodeBitrateRatio;if(1!==this._saveEncodeBitrateRatio&&this._encoderConfig&&this._encoderConfig.bitrateMax&&this._encoderConfig.bitrateMin){this._encoderConfig.bitrateMin=Math.floor(this._encoderConfig.bitrateMin*e),this._encoderConfig.bitrateMax=Math.floor(this._encoderConfig.bitrateMax*e),On.debug("[".concat(this.getTrackId(),"] set save encode bitrate ratio, ").concat(e)),this._saveEncodeBitrateRatio=1;try{await vi(this,Zd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(On)}}}async setEncoderConfiguration(e,t){if(!this._enabled)throw new ni(ii.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");if(e=xd(e),hn("USE_STANDARD_BITRATE_DEFAULT")&&(delete e.bitrateMax,delete e.bitrateMin),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate?this._forceBitrateLimit.max_bitrate:e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate?this._forceBitrateLimit.min_bitrate:e.bitrateMin),e.width||e.height||e.frameRate){const t=ub({encoderConfig:e});(Ur()||Fr()||Xr())&&(t.deviceId=void 0),On.debug("[".concat(this.getTrackId(),"] setEncoderConfiguration applyConstraints"),JSON.stringify(e),JSON.stringify(t));try{await this._originMediaStreamTrack.applyConstraints(t),this.updateMediaStreamTrackResolution()}catch(e){const t=new ni(ii.UNEXPECTED_ERROR,e.toString());throw On.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}}this._encoderConfig=e,-1===this._hints.indexOf(Jd.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await vi(this,Zd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(On)}}getStats(){Ui((()=>{On.warning("[deprecated] LocalVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalVideoStats instead")}),"localVideoTrackGetStatsWarning");const e=Ai(this,Zd.GET_STATS);return e||JO({},au)}async setBeautyEffect(e){On.error("LocalVideoTrack.setBeautyEffect was deprecated, please migrate to agora-extension-beauty-effect")}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}async getCurrentFrameImage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._player?this._player.getCurrentFrameToUint8Array(e,t):await cI(e)}async findClosestProfile(){const{width:e,height:t,frameRate:r}=this.getMediaStreamTrackSettings(),{width:i,height:n,frameRate:o}=this._encoderConfig||{},s=Ki(this._videoWidth||e||i||0),a=Ki(this._videoHeight||t||n||0),c=nI(s,a,Ki(r||o||15));if(c)return On.debug("[".concat(this.getTrackId(),"] find closest profile, ").concat(s,"x").concat(a," => ").concat(JSON.stringify(c))),this.setEncoderConfiguration(c)}async setBitrateLimit(e){On.debug("[".concat(this.getTrackId(),"] set bitrate limit, ").concat(JSON.stringify(e))),e&&(this._forceBitrateLimit=e,this._encoderConfig&&(this._encoderConfig.bitrateMax?this._encoderConfig.bitrateMax=this._encoderConfig.bitrateMax<e.max_bitrate?this._encoderConfig.bitrateMax:e.max_bitrate:this._encoderConfig.bitrateMax=e.max_bitrate,this._encoderConfig.bitrateMin,this._encoderConfig.bitrateMin=e.min_bitrate))}async setOptimizationMode(e){if("motion"!==e&&"detail"!==e&&"balanced"!==e)return void On.error(ii.INVALID_PARAMS,"optimization mode must be motion, detail or balanced");const t=this._optimizationMode;try{this._optimizationMode=e,await vi(this,Zd.NEED_UPDATE_VIDEO_SEND_PARAMETERS,this)}catch(e){throw this._optimizationMode=t,On.error("[".concat(this.getTrackId(),"] set optimization mode failed"),e.toString()),e}On.info("[".concat(this.getTrackId(),"] set optimization mode success (").concat(e,")"))}setScalabiltyMode(e){if(1===e.numSpatialLayers&&1!==e.numTemporalLayers)return On.error(ii.INVALID_PARAMS,"scalability mode currently not supported, no SVC."),void(this._scalabilityMode={numSpatialLayers:1,numTemporalLayers:1});this._scalabilityMode=e,On.info("[".concat(this.getTrackId(),"] set scalability mode success (").concat(e,")"))}updateMediaStreamTrackResolution(){db(this._originMediaStreamTrack).then((e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t})).catch(Bi)}_updatePlayerSource(){this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}_getDefaultPlayerConfig(){return{fit:"contain"}}async setSenderConfiguration(e){if(!this._enabled)throw new ni(ii.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");On.debug("[".concat(this.getTrackId(),"] setSenderConfiguration applyConstraints"),JSON.stringify(e)),e=xd(e),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate?this._forceBitrateLimit.max_bitrate:e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate?this._forceBitrateLimit.min_bitrate:e.bitrateMin),this._encoderConfig=e,-1===this._hints.indexOf(Jd.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await vi(this,Zd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(On)}}updateBitrateFromProfile(){if(!this._encoderConfig)return;const{width:e,height:t,frameRate:r}=this.getMediaStreamTrackSettings();if(!e||!t||!r)return;const{bitrateMax:i,bitrateMin:n}=this._encoderConfig;if(null==n||null==i){const{max:o,min:s}=oI(e,t,r,n,i);if(this._encoderConfig.bitrateMin=s,this._encoderConfig.bitrateMax=o,hn("VIDEO_STANDARD_BITRATE_VERSION")&&null==n&&null==i){const[i,n]=iI(e,t,r);this._encoderConfig.bitrateMax=i,this._encoderConfig.bitrateMin=s?Math.min(s,i):i,this._saveEncodeBitrateRatio=n,On.debug("[".concat(this.getTrackId(),"] update new bitrate from profile, [w: ").concat(e,", h: ").concat(t,", fps: ").concat(r,"] => [brMax: ").concat(this._encoderConfig.bitrateMax,", brMin: ").concat(this._encoderConfig.bitrateMin,", save_bitrate_ratio: ").concat(this._saveEncodeBitrateRatio,"]"))}else On.debug("[".concat(this.getTrackId(),"] update bitrate from profile, [w: ").concat(e,", h: ").concat(t,", fps: ").concat(r,"] => [brMax: ").concat(o,", brMin: ").concat(s,"]")),this._saveEncodeBitrateRatio=1}}getVideoElementVisibleStatus(){try{var e,t;const r=null==this||null===(e=this._player)||void 0===e?void 0:e.getContainerElement(),i={track:this,element:null==this||null===(t=this._player)||void 0===t?void 0:t.getVideoElement(),slot:null==r?void 0:r.parentElement},{element:n,slot:o}=i;if(this.isPlaying&&n instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=hi.checkOneElementVisible(n),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=zn.reportApiInvoke(null,{tag:gi.TRACER,name:Ti.LOCAL_VIDEO_TRACK_GET_VIDEO_VISIBLE,options:[this.getTrackId()]});t.visible?e.onSuccess("Video is visible"):e.onSuccess("Invisible because of ".concat(t.reason))}return t}return}catch(e){throw new ni(ii.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}async renewMediaStreamTrack(e){}pipe(e){if(this.processor===e)return e;if(e._source)throw new ni(ii.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,context:this.processorContext}),e}unpipe(){if(!this.processor)return;const e=this.processor;this.processor._source=void 0,this.processor=void 0,e.reset()}close(){super.close(),this.unbindProcessorDestinationEvents(),this.unbindProcessorContextEvents(),this.unpipe(),this.processorDestination._source&&this.processorDestination._source.unpipe()}clone(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this._encoderConfig;t&&(i=JO(JO({},i),xd(t))),i=ki(i);const n=Fi(8,"track-video-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,i,ki(this._scalabilityMode),this._optimizationMode,n,ki(this._hints));return t&&i&&o.setEncoderConfiguration(i),On.debug("clone video track from ".concat(this.getTrackId()," to ").concat(n,", clone ").concat(r)),o}async replaceTrack(e,t){if(!(e instanceof MediaStreamTrack))throw new ni(ii.INVALID_PARAMS,"track should be an instance of MediaStreamTrack");if("video"!==e.kind)throw new ni(ii.INVALID_PARAMS,"track should be a video MediaStreamTrack");await this._updateOriginMediaStreamTrack(e,t,!0),this.updateMediaStreamTrackResolution()}sendSeiData(e){if(Ui((()=>{zn.reportApiInvoke(null,{name:Ti.LOCAL_VIDEO_SEND_SEI_DATA,options:[],tag:gi.TRACER}).onSuccess("")}),this._mediaStreamTrack.id||this.getTrackId()),!hn("ENABLE_VIDEO_SEI")||!hn("ENABLE_ENCODED_TRANSFORM"))return void On.warning('To send/receive SEI, please call AgoraRTC.setParameter("ENABLE_VIDEO_SEI", true) before instantiate IAgoraRtcClient');if(e instanceof Uint8Array==!1)return new ni(ii.INVALID_PARAMS,"Invalid argument type, ILocalVideoTrack.sendSeiData() only accept Uint8Array argument.").throw();const t=this.getRTCRtpTransceiver();if(!t)return void On.warning("Video track is not published, SEI can not be send");const r=t.sender.getParameters();if(0===r.codecs.length)return;const i=r.codecs[0].mimeType.toLocaleLowerCase();"video/h264"===i||"video/h265"===i?this.safeEmit("sei-to-send",e):On.warning("SEI is not supported by ".concat(i))}bindProcessorDestinationEvents(){this.processorDestination.on(uu.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(),await vi(this,Zd.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await vi(this,Zd.NEED_REPLACE_TRACK,this))}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(uu.ON_TRACK)}unbindProcessorContextEvents(){this.processorContext.removeAllListeners(lu.REQUEST_UPDATE_CONSTRAINTS),this.processorContext.removeAllListeners(lu.REQUEST_CONSTRAINTS)}},eg(FO.prototype,"play",[lO,hO],Object.getOwnPropertyDescriptor(FO.prototype,"play"),FO.prototype),eg(FO.prototype,"stop",[pO],Object.getOwnPropertyDescriptor(FO.prototype,"stop"),FO.prototype),eg(FO.prototype,"setEnabled",[fO,EO,mO],Object.getOwnPropertyDescriptor(FO.prototype,"setEnabled"),FO.prototype),eg(FO.prototype,"setMuted",[_O,TO,gO],Object.getOwnPropertyDescriptor(FO.prototype,"setMuted"),FO.prototype),eg(FO.prototype,"setSaveEncodeBitrateRatio",[SO,RO],Object.getOwnPropertyDescriptor(FO.prototype,"setSaveEncodeBitrateRatio"),FO.prototype),eg(FO.prototype,"setEncoderConfiguration",[yO,vO],Object.getOwnPropertyDescriptor(FO.prototype,"setEncoderConfiguration"),FO.prototype),eg(FO.prototype,"getStats",[AO],Object.getOwnPropertyDescriptor(FO.prototype,"getStats"),FO.prototype),eg(FO.prototype,"setBeautyEffect",[bO,IO],Object.getOwnPropertyDescriptor(FO.prototype,"setBeautyEffect"),FO.prototype),eg(FO.prototype,"getCurrentFrameData",[OO],Object.getOwnPropertyDescriptor(FO.prototype,"getCurrentFrameData"),FO.prototype),eg(FO.prototype,"getCurrentFrameImage",[CO],Object.getOwnPropertyDescriptor(FO.prototype,"getCurrentFrameImage"),FO.prototype),eg(FO.prototype,"findClosestProfile",[NO,wO],Object.getOwnPropertyDescriptor(FO.prototype,"findClosestProfile"),FO.prototype),eg(FO.prototype,"setBitrateLimit",[DO],Object.getOwnPropertyDescriptor(FO.prototype,"setBitrateLimit"),FO.prototype),eg(FO.prototype,"setOptimizationMode",[PO],Object.getOwnPropertyDescriptor(FO.prototype,"setOptimizationMode"),FO.prototype),eg(FO.prototype,"setScalabiltyMode",[LO],Object.getOwnPropertyDescriptor(FO.prototype,"setScalabiltyMode"),FO.prototype),eg(FO.prototype,"updateMediaStreamTrackResolution",[kO],Object.getOwnPropertyDescriptor(FO.prototype,"updateMediaStreamTrackResolution"),FO.prototype),eg(FO.prototype,"pipe",[MO],Object.getOwnPropertyDescriptor(FO.prototype,"pipe"),FO.prototype),eg(FO.prototype,"unpipe",[UO],Object.getOwnPropertyDescriptor(FO.prototype,"unpipe"),FO.prototype),eg(FO.prototype,"close",[xO],Object.getOwnPropertyDescriptor(FO.prototype,"close"),FO.prototype),eg(FO.prototype,"replaceTrack",[VO],Object.getOwnPropertyDescriptor(FO.prototype,"replaceTrack"),FO.prototype),FO),qO=(BO=Yn({argsMap:(e,t)=>[e.getTrackId(),t]}),jO=KA(),GO=Ji("CameraVideoTrack","_enabledMutex"),WO=Yn({argsMap:(e,t)=>[e.getTrackId(),t]}),HO=KA(),KO=Yn({argsMap:(e,t)=>[e.getTrackId(),t]}),YO=KA(),zO=Yn({argsMap:e=>[e.getTrackId()]}),XO=class e extends QO{get __className__(){return"CameraVideoTrack"}constructor(e,t,r,i,n,o){super(e,xd(t.encoderConfig),i,n,o),H_(this,"_config",void 0),H_(this,"_originalConstraints",void 0),H_(this,"_constraints",void 0),H_(this,"_enabled",!0),H_(this,"_deviceName","default"),H_(this,"tryResumeVideoForIOS15_16WeChat",(async()=>{!Kr()&&!Yr()||function(){const e=wr();if(e.os!==br.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=2}()||wr().name!==Ir.WECHAT||!this._enabled||this._isClosed||(On.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS 15 device on WeChat.")),await this.renewMediaStreamTrack())})),this._config=t,this._originalConstraints=r,this._constraints=r,this._deviceName=e.label,this._encoderConfig=xd(this._config.encoderConfig),hA.on(ro.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),hA.on(ro.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),this.bindProcessorContextEvents()}async setDevice(e){return"string"==typeof e?this._setDeviceById(e):e.deviceId?this._setDeviceById(e.deviceId):e.facingMode?this._setDeviceByFacingModel(e.facingMode):void 0}async _setDeviceById(e){if(On.info("[".concat(this.getTrackId(),"] set device to ").concat(e)),this._enabled)try{const t=await UA.getDeviceById(e),r={};r.video=JO({},this._constraints),r.video.deviceId={exact:e},r.video.facingMode=void 0,this._originMediaStreamTrack.stop();let i=null;try{i=await DA(r,this.getTrackId())}catch(e){throw On.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),i=await DA({video:this._constraints},this.getTrackId()),await this._updateOriginMediaStreamTrack(i.getVideoTracks()[0],!1),e}await this._updateOriginMediaStreamTrack(i.getVideoTracks()[0],!1),this.updateMediaStreamTrackResolution(),this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(e){throw On.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await UA.getDeviceById(e);this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(e){throw On.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}On.info("[".concat(this.getTrackId(),"] setDevice success"))}async _setDeviceByFacingModel(e){On.info("[".concat(this.getTrackId(),"] set facingMode ").concat(e));const t={video:JO(JO({},this._constraints),{},{deviceId:void 0,facingMode:{exact:e}})};if(this._enabled){this._originMediaStreamTrack.stop();let e=null;try{e=await DA(t,this.getTrackId())}catch(t){throw On.error("[".concat(this.getTrackId(),"] setDeviceByFacingModel failed"),t.toString()),e=await DA({video:this._constraints},this.getTrackId()),await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1),t}await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1),this.updateMediaStreamTrackResolution()}this._deviceName="",this._config.facingMode=e,this._config.cameraId=void 0,this._constraints=JO({},t.video),On.info("[".concat(this.getTrackId(),"] setDeviceByFacingModel success"))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(On.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){try{if(this.isExternalTrack)this._originMediaStreamTrack.enabled=!0;else{const e=await DA({video:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1)}await vi(this,Zd.NEED_ENABLE_TRACK,this)}catch(e){throw On.error("[".concat(this.getTrackId(),"] setEnabled true error"),e.toString()),e}this.updateMediaStreamTrackResolution(),On.info("[".concat(this.getTrackId(),"] setEnabled to true success")),t||(this._enabled=!0)}else{this.isExternalTrack?this._originMediaStreamTrack.enabled=!1:(this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop()),t||(this._enabled=!1);try{await vi(this,Zd.NEED_DISABLE_TRACK,this)}catch(e){throw On.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}On.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}}async setEncoderConfiguration(e,t){if(!this._enabled)throw new ni(ii.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");e=xd(e),hn("USE_STANDARD_BITRATE_DEFAULT")&&(delete e.bitrateMax,delete e.bitrateMin),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate||e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate||e.bitrateMin);const r=Li(this._config);r.encoderConfig=e;const i=ub(r);(Ur()||Fr()||Xr())&&(i.deviceId=void 0),On.debug("[".concat(this.getTrackId(),"] setEncoderConfiguration applyConstraints"),JSON.stringify(e),JSON.stringify(i));try{await this._originMediaStreamTrack.applyConstraints(i),this.updateMediaStreamTrackResolution()}catch(e){const t=new ni(ii.UNEXPECTED_ERROR,e.toString());throw On.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}this._config=r,this._constraints=i,this._originalConstraints=i,this._encoderConfig=e,-1===this._hints.indexOf(Jd.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await vi(this,Zd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(On)}}_getDefaultPlayerConfig(){return{mirror:!0,fit:"cover"}}onTrackEnded(){if((Fr()||Xr())&&this._enabled&&!this._isClosed&&hA.duringInterruption){const e=async()=>{hA.off(ro.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(On.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};hA.on(ro.IOS_INTERRUPTION_END,e)}else On.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(tu.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=UA.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId={exact:r}),this._enabled){const e=await DA({video:t},this.getTrackId());this._constraints=t,await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!0),this.updateMediaStreamTrackResolution()}}close(){super.close(),hA.off(ro.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),hA.off(ro.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat)}clone(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this._encoderConfig;t&&(i=JO(JO({},i),xd(t))),i=ki(i);const n=Fi(8,"track-cam-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,ki(JO(JO({},this._config),{},{encoderConfig:i})),ki(this._constraints),ki(this._scalabilityMode),this._optimizationMode,n);return t&&i&&o.setEncoderConfiguration(i),On.debug("clone track from ".concat(this.getTrackId()," to ").concat(n,", clone ").concat(r)),o}bindProcessorContextEvents(){this.processorContext.on(lu.REQUEST_UPDATE_CONSTRAINTS,(async(e,t,r)=>{try{const r=Object.assign({},this._originalConstraints,...e);await this.renewMediaStreamTrack(r),t()}catch(e){r(e)}})),this.processorContext.on(lu.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}},eg(XO.prototype,"setDevice",[BO,jO],Object.getOwnPropertyDescriptor(XO.prototype,"setDevice"),XO.prototype),eg(XO.prototype,"setEnabled",[GO,WO,HO],Object.getOwnPropertyDescriptor(XO.prototype,"setEnabled"),XO.prototype),eg(XO.prototype,"setEncoderConfiguration",[KO,YO],Object.getOwnPropertyDescriptor(XO.prototype,"setEncoderConfiguration"),XO.prototype),eg(XO.prototype,"close",[zO],Object.getOwnPropertyDescriptor(XO.prototype,"close"),XO.prototype),XO);function $O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function eC(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$O(Object(r),!0).forEach((function(t){H_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$O(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function tC(e,t,r,i){r.optimizationMode&&(i&&i.width&&i.height?(r.encoderConfig=eC(eC({},i),{},{bitrateMin:i.bitrateMin,bitrateMax:i.bitrateMax}),"motion"!==r.optimizationMode&&"detail"!==r.optimizationMode||(t.contentHint=r.optimizationMode,t.contentHint===r.optimizationMode?On.debug("[".concat(e,"] set content hint to"),r.optimizationMode):On.debug("[".concat(e,"] set content hint failed")))):On.warning("[".concat(e,"] can not apply optimization mode bitrate config, no encoderConfig")))}var rC,iC,nC,oC,sC,aC,cC,dC,uC,lC,hC,pC,fC;function EC(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function mC(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?EC(Object(r),!0).forEach((function(t){H_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):EC(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class _C extends sA{getUserId(){return this._userId}constructor(e,t,r,i){super(e,"track-".concat(e.kind,"-").concat(t,"-").concat(i.clientId,"_").concat(Fi(5,""))),H_(this,"_userId",void 0),H_(this,"_uintId",void 0),H_(this,"_isDestroyed",!1),H_(this,"store",void 0),H_(this,"processor",void 0),H_(this,"processorContext",void 0),this._userId=t,this._uintId=r,this.store=i}_updateOriginMediaStreamTrack(e){this._originMediaStreamTrack=e,this._mediaStreamTrack=e,this._updatePlayerSource(),this.processor&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this.processorContext})}_destroy(){this._isDestroyed=!0,On.info("[".concat(this.getTrackId(),"] is destroyed")),this.stop(),super.close()}getProcessorStats(){return this.processorContext.gatherStats()}getProcessorUsage(){return this.processorContext.gatherUsage()}}let TC=(rC=Yn({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),iC=Yn({argsMap:e=>[e.getTrackId()]}),nC=Yn({argsMap:(e,t)=>[e.getTrackId(),t.name]}),oC=Yn({argsMap:e=>[e.getTrackId()]}),sC=class extends _C{get isPlaying(){return!(!this._player||this._player.videoElementStatus!==fu.PLAYING)}get __className__(){return"RemoteVideoTrack"}constructor(e,t,r,i,n){super(e,t,r,i),H_(this,"_videoVisibleTimer",null),H_(this,"_previousVideoVisibleStatus",void 0),H_(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),H_(this,"trackMediaType",iu.VIDEO),H_(this,"_videoWidth",void 0),H_(this,"_videoHeight",void 0),H_(this,"_player",void 0),H_(this,"_prePlayer",void 0),H_(this,"processorDestination",void 0),H_(this,"processorContext",void 0),this._prePlayer=n,this.updateMediaStreamTrackResolution(),this.processorContext=new nb(this.getTrackId(),"remote"),this.processorDestination=new ib(this.processorContext),this.bindProcessorDestinationEvents()}getStats(){Ui((()=>{On.warning("[deprecated] RemoteVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteVideoStats instead")}),"remoteVideoTrackGetStatsWarning");return Ai(this,Zd.GET_STATS)||mC({},du)}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.safeEmit(ru.PLAY_START),"string"==typeof e){const t=document.getElementById(e);t?e=t:(On.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}On.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=mC(mC({fit:"cover"},t),{},{trackId:this.getTrackId(),element:e});if(this._player)this._player.updateConfig(r);else{let t=!1,i=!1;const n=this._prePlayer&&!this._prePlayer.isDestroyed&&e===this._prePlayer.config.element;this._prePlayer&&!n&&(this._prePlayer.destroy(),i=!0),n?(this._player=this._prePlayer,t=this._player.videoState>0,this._player.updateConfig(r)):this._player=e instanceof HTMLVideoElement?new cO(r):new uO(r),this._prePlayer=void 0,this._player.updateVideoTrack(this._mediaStreamTrack),this._player.onFirstVideoFrameDecoded=()=>{this.store.subscribe(this.getUserId(),"video",void 0,void 0,Date.now()),this.safeEmit(ru.FIRST_FRAME_DECODED),i&&this.safeEmit(ru.FIRST_FRAME_RENDER)},this._player.onVideoStateChanged=e=>{this.safeEmit(ru.VIDEO_STATE_CHANGED,e)},t&&(this._player.onFirstVideoFrameDecoded(),this._player.onVideoStateChanged(this._player.videoState))}this._player.play(this.store.sessionId||void 0),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((()=>{try{const e=this.getVideoElementVisibleStatus();this.safeEmit(ru.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),hn("CHECK_VIDEO_VISIBLE_INTERVAL")),this.safeEmit(ru.PLAY_END)}stop(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._player&&(this._videoVisibleTimer&&(window.clearInterval(this._videoVisibleTimer),this._videoVisibleTimer=null),this._clearPreviousVideoVisibleStatus(),this._player.destroy(e),this._player=void 0,On.debug("[".concat(this.getTrackId(),"] stop video playback")))}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}updateMediaStreamTrackResolution(){db(this._originMediaStreamTrack).then((e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t})).catch(Bi)}_updatePlayerSource(){On.debug("[".concat(this.getTrackId(),"] update player source track")),this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}getVideoElementVisibleStatus(){try{var e,t;const r=null==this||null===(e=this._player)||void 0===e?void 0:e.getContainerElement(),i={track:this,element:null==this||null===(t=this._player)||void 0===t?void 0:t.getVideoElement(),slot:null==r?void 0:r.parentElement},{element:n,slot:o}=i;if(this.isPlaying&&n instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=hi.checkOneElementVisible(n),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=zn.reportApiInvoke(null,{tag:gi.TRACER,name:Ti.REMOTE_VIDEO_TRACK_GET_VIDEO_VISIBLE,options:[this.getTrackId()]});t.visible?e.onSuccess("Video is visible"):e.onSuccess("Invisible because of ".concat(t.reason))}return t}return}catch(e){throw new ni(ii.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}pipe(e){if(this.processor===e)return e;if(e._source)throw new ni(ii.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,context:this.processorContext}),e}unpipe(){if(!this.processor)return;const e=this.processor;this.processor._source=void 0,this.processor=void 0,e.reset()}bindProcessorDestinationEvents(){this.processorDestination.on(uu.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource()):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource())}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(uu.ON_TRACK)}_destroy(){this._prePlayer&&(this._prePlayer.destroy(),this._prePlayer=void 0),super._destroy(),this.unbindProcessorDestinationEvents()}_onSei(e){this.emit(eu.SEI_RECEIVED,e)}},eg(sC.prototype,"play",[rC],Object.getOwnPropertyDescriptor(sC.prototype,"play"),sC.prototype),eg(sC.prototype,"stop",[iC],Object.getOwnPropertyDescriptor(sC.prototype,"stop"),sC.prototype),eg(sC.prototype,"pipe",[nC],Object.getOwnPropertyDescriptor(sC.prototype,"pipe"),sC.prototype),eg(sC.prototype,"unpipe",[oC],Object.getOwnPropertyDescriptor(sC.prototype,"unpipe"),sC.prototype),sC),gC=(aC=Yn({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),cC=Yn({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),dC=Yn({argsMap:(e,t)=>[e.getTrackId(),t]}),uC=Yn({argsMap:e=>[e.getTrackId()]}),lC=Yn({argsMap:e=>[e.getTrackId()]}),hC=Yn({argsMap:(e,t)=>[e.getTrackId(),t.name]}),pC=Yn({argsMap:e=>[e.getTrackId()]}),fC=class extends _C{get isPlaying(){return this._useAudioElement?HA.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"RemoteAudioTrack"}constructor(e,t,r,i){super(e,t,r,i),H_(this,"trackMediaType",iu.AUDIO),H_(this,"_source",void 0),H_(this,"_useAudioElement",!0),H_(this,"_volume",100),H_(this,"processorContext",void 0),H_(this,"processorDestination",void 0),H_(this,"_played",!1),H_(this,"_bypassWebAudio",!1),hn("DISABLE_WEBAUDIO")?(this._source=new ab,this._bypassWebAudio=!0,this._useAudioElement=!0):(this._source=new bA(e,!0),hn("REMOTE_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1)),this._source.once(nu.RECEIVE_TRACK_BUFFER,(()=>{this.safeEmit(ru.FIRST_FRAME_DECODED)})),this.processorContext=new sb(this._source.context,this.getTrackId(),"remote"),this.processorDestination=new ob(this.processorContext),this.bindProcessorDestinationEvents(),this._source.on(nu.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:this.processorContext})}))}setAudioFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners(nu.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(nu.ON_AUDIO_BUFFER),this._source.on(nu.ON_AUDIO_BUFFER,(t=>e(t)))}setVolume(e){this._volume=e,this._useAudioElement?HA.setVolume(this.getTrackId(),e):this._source.setVolume(e/100)}setAmplifiedVolume(e){this._useAudioElement&&this._played&&(HA.stop(this.getTrackId()),this._source.play()),this._useAudioElement=!1,e=Math.min(e,hn("MAX_WEBAUDIO_VOLUME")),this._volume=e,this._source.setVolume(e/100)}async setPlaybackDevice(e){if(!this._useAudioElement||!Qn())throw new ni(ii.NOT_SUPPORTED,"your browser does not support setting the audio output device");await HA.setSinkID(this.getTrackId(),e)}getVolumeLevel(){return this._source.getAccurateVolumeLevel()}getVolume(){return this._useAudioElement?HA.getVolume(this.getTrackId()):this._source instanceof bA?this._source.getAudioVolume():0}getStats(){Ui((()=>{On.warning("[deprecated] RemoteAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteAudioStats instead")}),"remoteAudioTrackGetStatsWarning");return Ai(this,Zd.GET_STATS)||mC({},cu)}play(){On.debug("[".concat(this.getTrackId(),"] start audio playback")),this._played=!0,this._useAudioElement?(On.debug("[".concat(this.getTrackId(),"] use audio element to play")),HA.play(this._mediaStreamTrack,this.getTrackId(),this._volume,this.store.sessionId||void 0)):(On.debug("[".concat(this.getTrackId(),"] use audio context to play")),this._source.play())}stop(){On.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._played=!1,this._useAudioElement?HA.stop(this.getTrackId()):this._source.stop()}_destroy(){super._destroy(),this._played=!1,this.unbindProcessorDestinationEvents(),this._source.destroy()}_isFreeze(){return this._source.isFreeze}_updatePlayerSource(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];On.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&HA.updateTrack(this.getTrackId(),this._mediaStreamTrack)}pipe(e){if(this._bypassWebAudio)throw new ni(ii.NOT_SUPPORTED,"can not pipe extension when WebAudio disabled");if(this.processor===e)return e;if(e._source)throw new ni(ii.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,node:this._source.processSourceNode,context:this.processorContext}),e}unpipe(){var e;if(this._bypassWebAudio)throw new ni(ii.NOT_SUPPORTED,"can not unpipe extension when WebAudio disabled");if(!this.processor)return;const t=this.processor;null===(e=this._source.processSourceNode)||void 0===e||e.disconnect(),this.processor._source=!1,this.processor=void 0,t.reset()}bindProcessorDestinationEvents(){this.processorDestination.on(uu.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(!1),this._source.processedNode=this._source.createMediaStreamSourceNode(e)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource())})),this.processorDestination.on(uu.ON_NODE,(e=>{this._source.processedNode=e;const t=!e;this._useAudioElement!==t&&(this._played?(this.stop(),this._useAudioElement=t,this.play()):this._useAudioElement=t)}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(uu.ON_TRACK),this.processorDestination.removeAllListeners(uu.ON_NODE)}},eg(fC.prototype,"setVolume",[aC],Object.getOwnPropertyDescriptor(fC.prototype,"setVolume"),fC.prototype),eg(fC.prototype,"setAmplifiedVolume",[cC],Object.getOwnPropertyDescriptor(fC.prototype,"setAmplifiedVolume"),fC.prototype),eg(fC.prototype,"setPlaybackDevice",[dC],Object.getOwnPropertyDescriptor(fC.prototype,"setPlaybackDevice"),fC.prototype),eg(fC.prototype,"play",[uC],Object.getOwnPropertyDescriptor(fC.prototype,"play"),fC.prototype),eg(fC.prototype,"stop",[lC],Object.getOwnPropertyDescriptor(fC.prototype,"stop"),fC.prototype),eg(fC.prototype,"pipe",[hC],Object.getOwnPropertyDescriptor(fC.prototype,"pipe"),fC.prototype),eg(fC.prototype,"unpipe",[pC],Object.getOwnPropertyDescriptor(fC.prototype,"unpipe"),fC.prototype),fC);const SC=new class extends fi{get visibility(){return document.visibilityState}get lastHiddenTime(){return this._lastHiddenTime}get lastVisibleTime(){return this._lastVisibleTime}constructor(){super(),H_(this,"_lastHiddenTime",0),H_(this,"_lastVisibleTime",0),H_(this,"needUploadStats",[]),H_(this,"isCollectingStats",!1),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState?this._lastHiddenTime=performance.now():this._lastVisibleTime=performance.now(),this.isCollectingStats&&this.needUploadStats.push("visible"===document.visibilityState?1:0),On.debug("current web page is ".concat(document.visibilityState)),this.emit("VISIBILITY_CHANGE",document.visibilityState)}))}startCollectStats(){this.isCollectingStats=!0,this.needUploadStats.push("visible"===this.visibility?1:0)}stopCollectStats(){this.isCollectingStats=!1,this.needUploadStats.length=0}};class RC extends fi{constructor(e,t){super(),H_(this,"trackMediaType",iu.DATA),H_(this,"_version",1),H_(this,"_type",3),H_(this,"_config",void 0),H_(this,"_originDataChannel",void 0),H_(this,"_dataStreamPacketHeader",new ArrayBuffer(4)),H_(this,"_dataStreamPacketHandler",{serialize:e=>e,deserialize:e=>e}),H_(this,"_datachannelEventMap",new Map),this._config=e,t&&(this._originDataChannel=t,this._bandDataChannelEvents(t)),this._initPacketHeader()}useDataStream(e){this._dataStreamPacketHandler=e}get id(){return this._config.id}get ordered(){return this._config.ordered}get maxRetransmits(){return hn("DATASTREAM_MAX_RETRANSMITS")}get metadata(){return this._config.metadata}get readyState(){var e,t;return null!==(e=null===(t=this._originDataChannel)||void 0===t?void 0:t.readyState)&&void 0!==e?e:"connecting"}get _originDataChannelId(){var e,t;return null!==(e=null===(t=this._originDataChannel)||void 0===t?void 0:t.id)&&void 0!==e?e:null}getChannelId(){return this.id}getConfig(){return this._config}_close(){this._originDataChannel&&(this._unbindDataChannelEvents(this._originDataChannel),this._originDataChannel=void 0)}async _waitTillOpen(){return new oA(((e,t)=>{if(this._originDataChannel){"open"===this._originDataChannel.readyState&&e();const r=setTimeout((()=>{var e;t(new ni(ii.DATACHANNEL_CONNECTION_TIMEOUT,"Cannot create datachannel, id: ".concat(null===(e=this._originDataChannel)||void 0===e?void 0:e.id)))}),1e4);this._originDataChannel.onopen=()=>{clearTimeout(r),this._originDataChannel&&this._bandDataChannelEvents(this._originDataChannel),e()},this._originDataChannel.onerror=()=>{throw clearTimeout(r),new ni(ii.DATACHANNEL_CONNECTION_TIMEOUT)}}else t(new ni(ii.DATACHANNEL_CONNECTION_TIMEOUT,"cannot find dataChannel"))}))}_updateOriginDataChannel(e){this._originDataChannel=e,this._bandDataChannelEvents(e)}_initPacketHeader(){const e=new DataView(this._dataStreamPacketHeader);e.setUint16(0,this._version),e.setUint8(2,this._type),e.setUint8(3,this._config.id)}_bandDataChannelEvents(e){this._unbindDataChannelEvents(e),[mu.OPEN,mu.CLOSE,mu.ERROR].forEach((t=>{const r=()=>{this.emit(t)};this._datachannelEventMap.set(t,r),e.addEventListener(t,r)}))}_unbindDataChannelEvents(e){Array.from(this._datachannelEventMap.entries()).forEach((t=>{let[r,i]=t;e.removeEventListener(r,i)})),this._datachannelEventMap.clear()}}var yC=io,vC=pa("iterator"),AC=!yC((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r=new URLSearchParams("a=1&a=2"),i="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),i+=r+e})),r.delete("a",2),!e.toJSON||!r.has("a",1)||r.has("a",2)||!t.size&&true||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[vC]||"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"!==i||"x"!==new URL("http://x",void 0).host})),bC=Sh,IC=Nc,OC=po,CC=ko,NC=uo,wC=Do,DC=AC,PC=Sh,LC=yh,kC=function(e,t,r){for(var i in t)r&&r.unsafe&&e[i]?e[i]=t[i]:bC(e,i,t[i],r);return e},MC=Yh,UC=om,xC=cp,VC=LS,FC=No,BC=$s,jC=Qa,GC=ld,WC=ic,HC=rs,KC=fd,YC=rh,zC=jo,XC=Bg,ZC=Lg,JC=WS,QC=yb,qC=pa("iterator"),$C="URLSearchParams",eN=$C+"Iterator",tN=xC.set,rN=xC.getterFor($C),iN=xC.getterFor(eN),nN=Object.getOwnPropertyDescriptor,oN=function(e){if(!wC)return OC[e];var t=nN(OC,e);return t&&t.value},sN=oN("fetch"),aN=oN("Request"),cN=oN("Headers"),dN=aN&&aN.prototype,uN=cN&&cN.prototype,lN=OC.RegExp,hN=OC.TypeError,pN=OC.decodeURIComponent,fN=OC.encodeURIComponent,EN=NC("".charAt),mN=NC([].join),_N=NC([].push),TN=NC("".replace),gN=NC([].shift),SN=NC([].splice),RN=NC("".split),yN=NC("".slice),vN=/\+/g,AN=Array(4),bN=function(e){return AN[e-1]||(AN[e-1]=lN("((?:%[\\da-f]{2}){"+e+"})","gi"))},IN=function(e){try{return pN(e)}catch(t){return e}},ON=function(e){var t=TN(e,vN," "),r=4;try{return pN(t)}catch(e){for(;r;)t=TN(t,bN(r--),IN);return t}},CN=/[!'()~]|%20/g,NN={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},wN=function(e){return NN[e]},DN=function(e){return TN(fN(e),CN,wN)},PN=UC((function(e,t){tN(this,{type:eN,iterator:XC(rN(e).entries),kind:t})}),"Iterator",(function(){var e=iN(this),t=e.kind,r=e.iterator.next(),i=r.value;return r.done||(r.value="keys"===t?i.key:"values"===t?i.value:[i.key,i.value]),r}),!0),LN=function(e){this.entries=[],this.url=null,void 0!==e&&(HC(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===EN(e,0)?yN(e,1):e:KC(e)))};LN.prototype={type:$C,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,i,n,o,s,a,c=ZC(e);if(c)for(r=(t=XC(e,c)).next;!(i=CC(r,t)).done;){if(o=(n=XC(WC(i.value))).next,(s=CC(o,n)).done||(a=CC(o,n)).done||!CC(o,n).done)throw hN("Expected sequence with length 2");_N(this.entries,{key:KC(s.value),value:KC(a.value)})}else for(var d in e)BC(e,d)&&_N(this.entries,{key:d,value:KC(e[d])})},parseQuery:function(e){if(e)for(var t,r,i=RN(e,"&"),n=0;n<i.length;)(t=i[n++]).length&&(r=RN(t,"="),_N(this.entries,{key:ON(gN(r)),value:ON(mN(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],i=0;i<t.length;)e=t[i++],_N(r,DN(e.key)+"="+DN(e.value));return mN(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var kN=function(){VC(this,MN);var e=tN(this,new LN(arguments.length>0?arguments[0]:void 0));wC||(this.size=e.entries.length)},MN=kN.prototype;if(kC(MN,{append:function(e,t){var r=rN(this);JC(arguments.length,2),_N(r.entries,{key:KC(e),value:KC(t)}),wC||this.length++,r.updateURL()},delete:function(e){for(var t=rN(this),r=JC(arguments.length,1),i=t.entries,n=KC(e),o=r<2?void 0:arguments[1],s=void 0===o?o:KC(o),a=0;a<i.length;){var c=i[a];if(c.key!==n||void 0!==s&&c.value!==s)a++;else if(SN(i,a,1),void 0!==s)break}wC||(this.size=i.length),t.updateURL()},get:function(e){var t=rN(this).entries;JC(arguments.length,1);for(var r=KC(e),i=0;i<t.length;i++)if(t[i].key===r)return t[i].value;return null},getAll:function(e){var t=rN(this).entries;JC(arguments.length,1);for(var r=KC(e),i=[],n=0;n<t.length;n++)t[n].key===r&&_N(i,t[n].value);return i},has:function(e){for(var t=rN(this).entries,r=JC(arguments.length,1),i=KC(e),n=r<2?void 0:arguments[1],o=void 0===n?n:KC(n),s=0;s<t.length;){var a=t[s++];if(a.key===i&&(void 0===o||a.value===o))return!0}return!1},set:function(e,t){var r=rN(this);JC(arguments.length,1);for(var i,n=r.entries,o=!1,s=KC(e),a=KC(t),c=0;c<n.length;c++)(i=n[c]).key===s&&(o?SN(n,c--,1):(o=!0,i.value=a));o||_N(n,{key:s,value:a}),wC||(this.size=n.length),r.updateURL()},sort:function(){var e=rN(this);QC(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=rN(this).entries,i=jC(e,arguments.length>1?arguments[1]:void 0),n=0;n<r.length;)i((t=r[n++]).value,t.key,this)},keys:function(){return new PN(this,"keys")},values:function(){return new PN(this,"values")},entries:function(){return new PN(this,"entries")}},{enumerable:!0}),PC(MN,qC,MN.entries,{name:"entries"}),PC(MN,"toString",(function(){return rN(this).serialize()}),{enumerable:!0}),wC&&LC(MN,"size",{get:function(){return rN(this).entries.length},configurable:!0,enumerable:!0}),MC(kN,$C),IC({global:!0,constructor:!0,forced:!DC},{URLSearchParams:kN}),!DC&&FC(cN)){var UN=NC(uN.has),xN=NC(uN.set),VN=function(e){if(HC(e)){var t,r=e.body;if(GC(r)===$C)return t=e.headers?new cN(e.headers):new cN,UN(t,"content-type")||xN(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),YC(e,{body:zC(0,KC(r)),headers:zC(0,t)})}return e};if(FC(sN)&&IC({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return sN(e,arguments.length>1?VN(arguments[1]):{})}}),FC(aN)){var FN=function(e){return VC(this,dN),new aN(e,arguments.length>1?VN(arguments[1]):{})};dN.constructor=FN,FN.prototype=dN,IC({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:FN})}}var BN,jN={URLSearchParams:kN,getState:rN},GN=Do,WN=uo,HN=ko,KN=io,YN=Dl,zN=Th,XN=Mo,ZN=Js,JN=Yo,QN=Object.assign,qN=Object.defineProperty,$N=WN([].concat),ew=!QN||KN((function(){if(GN&&1!==QN({b:1},QN(qN({},"a",{enumerable:!0,get:function(){qN(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),i="abcdefghijklmnopqrst";return e[r]=7,i.split("").forEach((function(e){t[e]=e})),7!=QN({},e)[r]||YN(QN({},t)).join("")!=i}))?function(e,t){for(var r=ZN(e),i=arguments.length,n=1,o=zN.f,s=XN.f;i>n;)for(var a,c=JN(arguments[n++]),d=o?$N(YN(c),o(c)):YN(c),u=d.length,l=0;u>l;)a=d[l++],GN&&!HN(s,c,a)||(r[a]=c[a]);return r}:QN,tw=ic,rw=Hg,iw=Qa,nw=ko,ow=Js,sw=function(e,t,r,i){try{return i?t(tw(r)[0],r[1]):t(r)}catch(t){rw(e,"throw",t)}},aw=Og,cw=Xu,dw=Gc,uw=wu,lw=Bg,hw=Lg,pw=Array,fw=uo,Ew=2147483647,mw=/[^\0-\u007E]/,_w=/[.\u3002\uFF0E\uFF61]/g,Tw="Overflow: input needs wider integers to process",gw=RangeError,Sw=fw(_w.exec),Rw=Math.floor,yw=String.fromCharCode,vw=fw("".charCodeAt),Aw=fw([].join),bw=fw([].push),Iw=fw("".replace),Ow=fw("".split),Cw=fw("".toLowerCase),Nw=function(e){return e+22+75*(e<26)},ww=function(e,t,r){var i=0;for(e=r?Rw(e/700):e>>1,e+=Rw(e/t);e>455;)e=Rw(e/35),i+=36;return Rw(i+36*e/(e+38))},Dw=function(e){var t=[];e=function(e){for(var t=[],r=0,i=e.length;r<i;){var n=vw(e,r++);if(n>=55296&&n<=56319&&r<i){var o=vw(e,r++);56320==(64512&o)?bw(t,((1023&n)<<10)+(1023&o)+65536):(bw(t,n),r--)}else bw(t,n)}return t}(e);var r,i,n=e.length,o=128,s=0,a=72;for(r=0;r<e.length;r++)(i=e[r])<128&&bw(t,yw(i));var c=t.length,d=c;for(c&&bw(t,"-");d<n;){var u=Ew;for(r=0;r<e.length;r++)(i=e[r])>=o&&i<u&&(u=i);var l=d+1;if(u-o>Rw((Ew-s)/l))throw gw(Tw);for(s+=(u-o)*l,o=u,r=0;r<e.length;r++){if((i=e[r])<o&&++s>Ew)throw gw(Tw);if(i==o){for(var h=s,p=36;;){var f=p<=a?1:p>=a+26?26:p-a;if(h<f)break;var E=h-f,m=36-f;bw(t,yw(Nw(f+E%m))),h=Rw(E/m),p+=36}bw(t,yw(Nw(h))),a=ww(s,l,d==c),s=0,d++}}s++,o++}return Aw(t,"")},Pw=Nc,Lw=Do,kw=AC,Mw=po,Uw=Qa,xw=uo,Vw=Sh,Fw=yh,Bw=LS,jw=$s,Gw=ew,Ww=function(e){var t=ow(e),r=cw(this),i=arguments.length,n=i>1?arguments[1]:void 0,o=void 0!==n;o&&(n=iw(n,i>2?arguments[2]:void 0));var s,a,c,d,u,l,h=hw(t),p=0;if(!h||this===pw&&aw(h))for(s=dw(t),a=r?new this(s):pw(s);s>p;p++)l=o?n(t[p],p):t[p],uw(a,p,l);else for(u=(d=lw(t,h)).next,a=r?new this:[];!(c=nw(u,d)).done;p++)l=o?sw(d,n,[c.value,p],!0):c.value,uw(a,p,l);return a.length=p,a},Hw=hh,Kw=D_.codeAt,Yw=function(e){var t,r,i=[],n=Ow(Iw(Cw(e),_w,"."),".");for(t=0;t<n.length;t++)r=n[t],bw(i,Sw(mw,r)?"xn--"+Dw(r):r);return Aw(i,".")},zw=fd,Xw=Yh,Zw=WS,Jw=jN,Qw=cp,qw=Qw.set,$w=Qw.getterFor("URL"),eD=Jw.URLSearchParams,tD=Jw.getState,rD=Mw.URL,iD=Mw.TypeError,nD=Mw.parseInt,oD=Math.floor,sD=Math.pow,aD=xw("".charAt),cD=xw(/./.exec),dD=xw([].join),uD=xw(1..toString),lD=xw([].pop),hD=xw([].push),pD=xw("".replace),fD=xw([].shift),ED=xw("".split),mD=xw("".slice),_D=xw("".toLowerCase),TD=xw([].unshift),gD="Invalid scheme",SD="Invalid host",RD="Invalid port",yD=/[a-z]/i,vD=/[\d+-.a-z]/i,AD=/\d/,bD=/^0x/i,ID=/^[0-7]+$/,OD=/^\d+$/,CD=/^[\da-f]+$/i,ND=/[\0\t\n\r #%/:<>?@[\\\]^|]/,wD=/[\0\t\n\r #/:<>?@[\\\]^|]/,DD=/^[\u0000-\u0020]+/,PD=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,LD=/[\t\n\r]/g,kD=function(e){var t,r,i,n;if("number"==typeof e){for(t=[],r=0;r<4;r++)TD(t,e%256),e=oD(e/256);return dD(t,".")}if("object"==typeof e){for(t="",i=function(e){for(var t=null,r=1,i=null,n=0,o=0;o<8;o++)0!==e[o]?(n>r&&(t=i,r=n),i=null,n=0):(null===i&&(i=o),++n);return n>r&&(t=i,r=n),t}(e),r=0;r<8;r++)n&&0===e[r]||(n&&(n=!1),i===r?(t+=r?":":"::",n=!0):(t+=uD(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},MD={},UD=Gw({},MD,{" ":1,'"':1,"<":1,">":1,"`":1}),xD=Gw({},UD,{"#":1,"?":1,"{":1,"}":1}),VD=Gw({},xD,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),FD=function(e,t){var r=Kw(e,0);return r>32&&r<127&&!jw(t,e)?e:encodeURIComponent(e)},BD={ftp:21,file:null,http:80,https:443,ws:80,wss:443},jD=function(e,t){var r;return 2==e.length&&cD(yD,aD(e,0))&&(":"==(r=aD(e,1))||!t&&"|"==r)},GD=function(e){var t;return e.length>1&&jD(mD(e,0,2))&&(2==e.length||"/"===(t=aD(e,2))||"\\"===t||"?"===t||"#"===t)},WD=function(e){return"."===e||"%2e"===_D(e)},HD={},KD={},YD={},zD={},XD={},ZD={},JD={},QD={},qD={},$D={},eP={},tP={},rP={},iP={},nP={},oP={},sP={},aP={},cP={},dP={},uP={},lP=function(e,t,r){var i,n,o,s=zw(e);if(t){if(n=this.parse(s))throw iD(n);this.searchParams=null}else{if(void 0!==r&&(i=new lP(r,!0)),n=this.parse(s,null,i))throw iD(n);(o=tD(new eD)).bindURL(this),this.searchParams=o}};lP.prototype={type:"URL",parse:function(e,t,r){var i,n,o,s,a,c=this,d=t||HD,u=0,l="",h=!1,p=!1,f=!1;for(e=zw(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=pD(e,DD,""),e=pD(e,PD,"$1")),e=pD(e,LD,""),i=Ww(e);u<=i.length;){switch(n=i[u],d){case HD:if(!n||!cD(yD,n)){if(t)return gD;d=YD;continue}l+=_D(n),d=KD;break;case KD:if(n&&(cD(vD,n)||"+"==n||"-"==n||"."==n))l+=_D(n);else{if(":"!=n){if(t)return gD;l="",d=YD,u=0;continue}if(t&&(c.isSpecial()!=jw(BD,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&BD[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?d=iP:c.isSpecial()&&r&&r.scheme==c.scheme?d=zD:c.isSpecial()?d=QD:"/"==i[u+1]?(d=XD,u++):(c.cannotBeABaseURL=!0,hD(c.path,""),d=cP)}break;case YD:if(!r||r.cannotBeABaseURL&&"#"!=n)return gD;if(r.cannotBeABaseURL&&"#"==n){c.scheme=r.scheme,c.path=Hw(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,d=uP;break}d="file"==r.scheme?iP:ZD;continue;case zD:if("/"!=n||"/"!=i[u+1]){d=ZD;continue}d=qD,u++;break;case XD:if("/"==n){d=$D;break}d=aP;continue;case ZD:if(c.scheme=r.scheme,n==BN)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=Hw(r.path),c.query=r.query;else if("/"==n||"\\"==n&&c.isSpecial())d=JD;else if("?"==n)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=Hw(r.path),c.query="",d=dP;else{if("#"!=n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=Hw(r.path),c.path.length--,d=aP;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=Hw(r.path),c.query=r.query,c.fragment="",d=uP}break;case JD:if(!c.isSpecial()||"/"!=n&&"\\"!=n){if("/"!=n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,d=aP;continue}d=$D}else d=qD;break;case QD:if(d=qD,"/"!=n||"/"!=aD(l,u+1))continue;u++;break;case qD:if("/"!=n&&"\\"!=n){d=$D;continue}break;case $D:if("@"==n){h&&(l="%40"+l),h=!0,o=Ww(l);for(var E=0;E<o.length;E++){var m=o[E];if(":"!=m||f){var _=FD(m,VD);f?c.password+=_:c.username+=_}else f=!0}l=""}else if(n==BN||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(h&&""==l)return"Invalid authority";u-=Ww(l).length+1,l="",d=eP}else l+=n;break;case eP:case tP:if(t&&"file"==c.scheme){d=oP;continue}if(":"!=n||p){if(n==BN||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(c.isSpecial()&&""==l)return SD;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(s=c.parseHost(l))return s;if(l="",d=sP,t)return;continue}"["==n?p=!0:"]"==n&&(p=!1),l+=n}else{if(""==l)return SD;if(s=c.parseHost(l))return s;if(l="",d=rP,t==tP)return}break;case rP:if(!cD(AD,n)){if(n==BN||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()||t){if(""!=l){var T=nD(l,10);if(T>65535)return RD;c.port=c.isSpecial()&&T===BD[c.scheme]?null:T,l=""}if(t)return;d=sP;continue}return RD}l+=n;break;case iP:if(c.scheme="file","/"==n||"\\"==n)d=nP;else{if(!r||"file"!=r.scheme){d=aP;continue}if(n==BN)c.host=r.host,c.path=Hw(r.path),c.query=r.query;else if("?"==n)c.host=r.host,c.path=Hw(r.path),c.query="",d=dP;else{if("#"!=n){GD(dD(Hw(i,u),""))||(c.host=r.host,c.path=Hw(r.path),c.shortenPath()),d=aP;continue}c.host=r.host,c.path=Hw(r.path),c.query=r.query,c.fragment="",d=uP}}break;case nP:if("/"==n||"\\"==n){d=oP;break}r&&"file"==r.scheme&&!GD(dD(Hw(i,u),""))&&(jD(r.path[0],!0)?hD(c.path,r.path[0]):c.host=r.host),d=aP;continue;case oP:if(n==BN||"/"==n||"\\"==n||"?"==n||"#"==n){if(!t&&jD(l))d=aP;else if(""==l){if(c.host="",t)return;d=sP}else{if(s=c.parseHost(l))return s;if("localhost"==c.host&&(c.host=""),t)return;l="",d=sP}continue}l+=n;break;case sP:if(c.isSpecial()){if(d=aP,"/"!=n&&"\\"!=n)continue}else if(t||"?"!=n)if(t||"#"!=n){if(n!=BN&&(d=aP,"/"!=n))continue}else c.fragment="",d=uP;else c.query="",d=dP;break;case aP:if(n==BN||"/"==n||"\\"==n&&c.isSpecial()||!t&&("?"==n||"#"==n)){if(".."===(a=_D(a=l))||"%2e."===a||".%2e"===a||"%2e%2e"===a?(c.shortenPath(),"/"==n||"\\"==n&&c.isSpecial()||hD(c.path,"")):WD(l)?"/"==n||"\\"==n&&c.isSpecial()||hD(c.path,""):("file"==c.scheme&&!c.path.length&&jD(l)&&(c.host&&(c.host=""),l=aD(l,0)+":"),hD(c.path,l)),l="","file"==c.scheme&&(n==BN||"?"==n||"#"==n))for(;c.path.length>1&&""===c.path[0];)fD(c.path);"?"==n?(c.query="",d=dP):"#"==n&&(c.fragment="",d=uP)}else l+=FD(n,xD);break;case cP:"?"==n?(c.query="",d=dP):"#"==n?(c.fragment="",d=uP):n!=BN&&(c.path[0]+=FD(n,MD));break;case dP:t||"#"!=n?n!=BN&&("'"==n&&c.isSpecial()?c.query+="%27":c.query+="#"==n?"%23":FD(n,MD)):(c.fragment="",d=uP);break;case uP:n!=BN&&(c.fragment+=FD(n,UD))}u++}},parseHost:function(e){var t,r,i;if("["==aD(e,0)){if("]"!=aD(e,e.length-1))return SD;if(t=function(e){var t,r,i,n,o,s,a,c=[0,0,0,0,0,0,0,0],d=0,u=null,l=0,h=function(){return aD(e,l)};if(":"==h()){if(":"!=aD(e,1))return;l+=2,u=++d}for(;h();){if(8==d)return;if(":"!=h()){for(t=r=0;r<4&&cD(CD,h());)t=16*t+nD(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,d>6)return;for(i=0;h();){if(n=null,i>0){if(!("."==h()&&i<4))return;l++}if(!cD(AD,h()))return;for(;cD(AD,h());){if(o=nD(h(),10),null===n)n=o;else{if(0==n)return;n=10*n+o}if(n>255)return;l++}c[d]=256*c[d]+n,2!=++i&&4!=i||d++}if(4!=i)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[d++]=t}else{if(null!==u)return;l++,u=++d}}if(null!==u)for(s=d-u,d=7;0!=d&&s>0;)a=c[d],c[d--]=c[u+s-1],c[u+--s]=a;else if(8!=d)return;return c}(mD(e,1,-1)),!t)return SD;this.host=t}else if(this.isSpecial()){if(e=Yw(e),cD(ND,e))return SD;if(t=function(e){var t,r,i,n,o,s,a,c=ED(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],i=0;i<t;i++){if(""==(n=c[i]))return e;if(o=10,n.length>1&&"0"==aD(n,0)&&(o=cD(bD,n)?16:8,n=mD(n,8==o?1:2)),""===n)s=0;else{if(!cD(10==o?OD:8==o?ID:CD,n))return e;s=nD(n,o)}hD(r,s)}for(i=0;i<t;i++)if(s=r[i],i==t-1){if(s>=sD(256,5-t))return null}else if(s>255)return null;for(a=lD(r),i=0;i<r.length;i++)a+=r[i]*sD(256,3-i);return a}(e),null===t)return SD;this.host=t}else{if(cD(wD,e))return SD;for(t="",r=Ww(e),i=0;i<r.length;i++)t+=FD(r[i],MD);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return jw(BD,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&jD(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,i=e.password,n=e.host,o=e.port,s=e.path,a=e.query,c=e.fragment,d=t+":";return null!==n?(d+="//",e.includesCredentials()&&(d+=r+(i?":"+i:"")+"@"),d+=kD(n),null!==o&&(d+=":"+o)):"file"==t&&(d+="//"),d+=e.cannotBeABaseURL?s[0]:s.length?"/"+dD(s,"/"):"",null!==a&&(d+="?"+a),null!==c&&(d+="#"+c),d},setHref:function(e){var t=this.parse(e);if(t)throw iD(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new hP(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+kD(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(zw(e)+":",HD)},getUsername:function(){return this.username},setUsername:function(e){var t=Ww(zw(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=FD(t[r],VD)}},getPassword:function(){return this.password},setPassword:function(e){var t=Ww(zw(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=FD(t[r],VD)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?kD(e):kD(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,eP)},getHostname:function(){var e=this.host;return null===e?"":kD(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,tP)},getPort:function(){var e=this.port;return null===e?"":zw(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=zw(e))?this.port=null:this.parse(e,rP))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+dD(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,sP))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=zw(e))?this.query=null:("?"==aD(e,0)&&(e=mD(e,1)),this.query="",this.parse(e,dP)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=zw(e))?("#"==aD(e,0)&&(e=mD(e,1)),this.fragment="",this.parse(e,uP)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var hP=function(e){var t=Bw(this,pP),r=Zw(arguments.length,1)>1?arguments[1]:void 0,i=qw(t,new lP(e,!1,r));Lw||(t.href=i.serialize(),t.origin=i.getOrigin(),t.protocol=i.getProtocol(),t.username=i.getUsername(),t.password=i.getPassword(),t.host=i.getHost(),t.hostname=i.getHostname(),t.port=i.getPort(),t.pathname=i.getPathname(),t.search=i.getSearch(),t.searchParams=i.getSearchParams(),t.hash=i.getHash())},pP=hP.prototype,fP=function(e,t){return{get:function(){return $w(this)[e]()},set:t&&function(e){return $w(this)[t](e)},configurable:!0,enumerable:!0}};if(Lw&&(Fw(pP,"href",fP("serialize","setHref")),Fw(pP,"origin",fP("getOrigin")),Fw(pP,"protocol",fP("getProtocol","setProtocol")),Fw(pP,"username",fP("getUsername","setUsername")),Fw(pP,"password",fP("getPassword","setPassword")),Fw(pP,"host",fP("getHost","setHost")),Fw(pP,"hostname",fP("getHostname","setHostname")),Fw(pP,"port",fP("getPort","setPort")),Fw(pP,"pathname",fP("getPathname","setPathname")),Fw(pP,"search",fP("getSearch","setSearch")),Fw(pP,"searchParams",fP("getSearchParams")),Fw(pP,"hash",fP("getHash","setHash"))),Vw(pP,"toJSON",(function(){return $w(this).serialize()}),{enumerable:!0}),Vw(pP,"toString",(function(){return $w(this).serialize()}),{enumerable:!0}),rD){var EP=rD.createObjectURL,mP=rD.revokeObjectURL;EP&&Vw(hP,"createObjectURL",Uw(EP,rD)),mP&&Vw(hP,"revokeObjectURL",Uw(mP,rD))}Xw(hP,"URL"),Pw({global:!0,constructor:!0,forced:!kw,sham:!Lw},{URL:hP});var _P=Nc,TP=io,gP=WS,SP=fd,RP=AC,yP=cs("URL");_P({target:"URL",stat:!0,forced:!(RP&&TP((function(){yP.canParse()})))},{canParse:function(e){var t=gP(arguments.length,1),r=SP(e),i=t<2||void 0===arguments[1]?void 0:SP(arguments[1]);try{return!!new yP(r,i)}catch(e){return!1}}});var vP=Z(is.URL);function AP(){const e=new Blob([atob("Y29uc3QgdD0idmlkZW8vaDI2NCIsZT0idmlkZW8vaDI2NSI7ZnVuY3Rpb24gbih0LGUsbil7bGV0IGE9bmV3IFVpbnQ4QXJyYXkodCxlLG4pLHI9W10sbz0wO2Zvcig7ci5sZW5ndGg8bjspbyszPG4mJjA9PT1hW29dJiYwPT09YVtvKzFdJiYzPT09YVtvKzJdJiYoMD09PWFbbyszXXx8MT09PWFbbyszXXx8Mj09PWFbbyszXXx8Mz09PWFbbyszXSk/KHIucHVzaChhW29dLGFbbysxXSxhW28rM10pLG8rPTQpOihyLnB1c2goYVtvXSksbysrKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkocil9ZnVuY3Rpb24gYShhLHIpe3N3aXRjaChyKXtjYXNlIHQ6cmV0dXJuIGZ1bmN0aW9uKHQpe2NvbnN0IGU9bmV3IERhdGFWaWV3KHQuZGF0YSk7bGV0IGE9MDtmb3IoO2ErNDx0LmRhdGEuYnl0ZUxlbmd0aDspe2lmKDA9PT1lLmdldFVpbnQ4KGErMCkmJjA9PT1lLmdldFVpbnQ4KGErMSkmJjA9PT1lLmdldFVpbnQ4KGErMikmJjE9PT1lLmdldFVpbnQ4KGErMykmJjY9PT1lLmdldFVpbnQ4KGErNCkpe2xldCByPWErNixvPTAsaT0wO2Zvcig7MjU1PT09KGk9ZS5nZXRVaW50OChyKyspKTspbys9MjU1O28rPWk7Y29uc3Qgcz1uKHQuZGF0YSxyLG8pO3JldHVybiBuZXcgVWludDhBcnJheShzKX1hKyt9cmV0dXJuIG51bGx9KGEpO2Nhc2UgZTpyZXR1cm4gZnVuY3Rpb24odCl7Y29uc3QgZT1uZXcgRGF0YVZpZXcodC5kYXRhKTtsZXQgYT0wO2Zvcig7YSs1PHQuZGF0YS5ieXRlTGVuZ3RoOyl7aWYoMD09PWUuZ2V0VWludDgoYSswKSYmMD09PWUuZ2V0VWludDgoYSsxKSYmMD09PWUuZ2V0VWludDgoYSsyKSYmMT09PWUuZ2V0VWludDgoYSszKSYmNzg9PT1lLmdldFVpbnQ4KGErNCkmJjE9PT1lLmdldFVpbnQ4KGErNSkmJjEwMT09PWUuZ2V0VWludDgoYSs2KSl7bGV0IHI9YSs3LG89MCxpPTA7Zm9yKDsyNTU9PT0oaT1lLmdldFVpbnQ4KHIrKykpOylvKz0yNTU7bys9aTtjb25zdCBzPW4odC5kYXRhLHIsbyk7cmV0dXJuIG5ldyBVaW50OEFycmF5KHMpfWErK31yZXR1cm4gbnVsbH0oYSk7ZGVmYXVsdDpyZXR1cm4gbnVsbH19ZnVuY3Rpb24gcih0KXtjb25zdCBlPXQubGVuZ3RoO2xldCBuPVtdLGE9MDtmb3IoO2E8ZTspYSsyPGUmJjA9PT10W2FdJiYwPT09dFthKzFdJiYoMD09PXRbYSsyXXx8MT09PXRbYSsyXXx8Mj09PXRbYSsyXXx8Mz09PXRbYSsyXSk/KG4ucHVzaCh0W2FdLHRbYSsxXSwzLHRbYSsyXSksYSs9Myk6KG4ucHVzaCh0W2FdKSxhKyspO3JldHVybiBuZXcgVWludDhBcnJheShuKX1mdW5jdGlvbiBvKG4sYSxvKXtzd2l0Y2gobyl7Y2FzZSB0OnJldHVybiBmdW5jdGlvbih0LGUpe2NvbnN0IG49cihlKSxhPW4ubGVuZ3RoLG89TWF0aC5mbG9vcihhLzI1NSksaT1hJTI1NSxzPW5ldyBVaW50OEFycmF5KDYrbysxK2ErdC5ieXRlTGVuZ3RoKTtzWzBdPTAsc1sxXT0wLHNbMl09MCxzWzNdPTEsc1s0XT02LHNbNV09MTAxO2xldCBmPTA7Zm9yKDtmPG87KXNbNitmXT0yNTUsZisrO3JldHVybiBzWzYrZl09aSxmKysscy5zZXQobiw2K2YpLHMuc2V0KG5ldyBVaW50OEFycmF5KHQpLDYrZithKSxzLmJ1ZmZlcn0obixhKTtjYXNlIGU6cmV0dXJuIGZ1bmN0aW9uKHQsZSl7Y29uc3Qgbj1yKGUpLGE9bi5sZW5ndGgsbz1NYXRoLmZsb29yKGEvMjU1KSxpPWElMjU1LHM9bmV3IFVpbnQ4QXJyYXkoNytvKzErYSsxK3QuYnl0ZUxlbmd0aCk7c1swXT0wLHNbMV09MCxzWzJdPTAsc1szXT0xLHNbNF09Nzgsc1s1XT0xLHNbNl09MTAxO2xldCBmPTA7Zm9yKDtmPG87KXNbNytmXT0yNTUsZisrO3JldHVybiBzWzcrZl09aSxmKysscy5zZXQobiw3K2YpLGYrPWEsc1s3K2ZdPTEyOCxmKysscy5zZXQobmV3IFVpbnQ4QXJyYXkodCksNytmKSxzLmJ1ZmZlcn0obixhKTtkZWZhdWx0OnJldHVybiBudWxsfX1mdW5jdGlvbiBpKG4pe2lmKG4ubGVuZ3RoPDUpcmV0dXJuIiI7bGV0IGE9LTE7Zm9yKGxldCB0PTA7dDxuLmxlbmd0aC0zO3QrKyl7aWYoMD09PW5bdF0mJjA9PT1uW3QrMV0mJjE9PT1uW3QrMl0pe2E9dDticmVha31pZih0PG4ubGVuZ3RoLTQmJjA9PT1uW3RdJiYwPT09blt0KzFdJiYwPT09blt0KzJdJiYxPT09blt0KzNdKXthPXQ7YnJlYWt9fWlmKC0xPT09YSlyZXR1cm4iIjtjb25zdCByPWErKDA9PT1uW2ErMl0/NDozKTtpZihyPj1uLmxlbmd0aClyZXR1cm4iIjtjb25zdCBvPW5bcl07aWYoMTI4Jm8pcmV0dXJuIiI7aWYoKG8+PjEmNjMpPj0zMilyZXR1cm4gZTtpZihyKzE8bi5sZW5ndGgpe2lmKDA9PSgyNDgmbltyKzFdKSlyZXR1cm4gZX1yZXR1cm4oMzEmbyk8PTMxP3Q6IiJ9Y29uc3Qgcz03MSxmPTEsbD0yLHU9MSxnPTI7dmFyIGM7ZnVuY3Rpb24gZCh0LGU9ITEpe2NvbnN0IG49dC5nZXRVaW50OCgwKTtpZihuIT09cylyZXR1cm47Y29uc3QgYT10LmdldFVpbnQxNigxKSxyPWYrbCthLG89bmV3IFVpbnQ4QXJyYXkodC5ieXRlTGVuZ3RoLXIpO28uc2V0KG5ldyBVaW50OEFycmF5KHQuYnVmZmVyLHIsdC5ieXRlTGVuZ3RoLXIpKTtjb25zdCBpPXttOm4sdGx2TGVuOmEsdGx2OltdLGZyYW1lOm99O2xldCBkPWYrbDtmb3IoO2Q8cjspe2NvbnN0IG49dC5nZXRVaW50OChkKSxhPXQuZ2V0VWludDE2KGQrdSkscj11K2c7aWYobj09PWMuQVVESU9fTEVWRUwpe2xldCBvPXQuZ2V0VWludDgoZCtyKTtmb3IobGV0IGU9MTtlPGE7ZSsrKW89bzw8OHx0LmdldFVpbnQ4KGQrcitlKTtpLnRsdi5wdXNoKHt0YWc6bixsZW5ndGg6YSx2YWx1ZTplPzEyN15vPj4xOjEyNyZvfSl9ZWxzZSBpZihuPT09Yy5NRVRBREFUQXx8bj09PWMuQVVESU9fNjRfQklUX1BUUyl7Y29uc3QgZT1uZXcgVWludDhBcnJheShhKTtmb3IobGV0IG49MDtuPGE7bisrKWVbbl09dC5nZXRVaW50OChkK3Irbik7aS50bHYucHVzaCh7dGFnOm4sbGVuZ3RoOmEsdmFsdWU6ZX0pfWQrPXIrYX1yZXR1cm4gaX0hZnVuY3Rpb24odCl7dFt0LkFVRElPX0xFVkVMPTFdPSJBVURJT19MRVZFTCIsdFt0Lk1FVEFEQVRBPTJdPSJNRVRBREFUQSIsdFt0LkFVRElPXzY0X0JJVF9QVFM9M109IkFVRElPXzY0X0JJVF9QVFMifShjfHwoYz17fSkpLHNlbGYub25ydGN0cmFuc2Zvcm09dD0+e2NvbnN0IGU9dC50cmFuc2Zvcm1lcixuPVtdLHI9W107bGV0IGg9bnVsbDtlLm9wdGlvbnMucG9ydC5vbm1lc3NhZ2U9dD0+e3QuZGF0YS5zZWkmJm4ucHVzaCh0LmRhdGEuc2VpKSx0LmRhdGEubWV0YWRhdGEmJnIucHVzaCh0LmRhdGEubWV0YWRhdGEpfSxzZWxmLnBvc3RNZXNzYWdlKCJzdGFydGVkIik7Y29uc3QgcD1lLnJlYWRhYmxlLmdldFJlYWRlcigpLFU9ZS53cml0YWJsZS5nZXRXcml0ZXIoKTsic2VpLXJ4Ij09PWUub3B0aW9ucy5uYW1lP2Z1bmN0aW9uIHQoZSl7cC5yZWFkKCkudGhlbigobj0+e2lmKCFuLmRvbmUpe2lmKG4udmFsdWUgaW5zdGFuY2VvZiBSVENFbmNvZGVkVmlkZW9GcmFtZSl7Y29uc3QgdD1pKG5ldyBVaW50OEFycmF5KG4udmFsdWUuZGF0YSkpLHI9YShuLnZhbHVlLHQpO2lmKHImJmUub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHtzZWk6cn0pLCFoKXtjb25zdCB0PW4udmFsdWUuZ2V0TWV0YWRhdGEoKXx8e307aD17dHlwZTpuLnZhbHVlLnR5cGUscnRwVGltZXN0YW1wOm4udmFsdWUudGltZXN0YW1wLHBheWxvYWRUeXBlOnQucGF5bG9hZFR5cGV8fDAsc3NyYzp0LnN5bmNocm9uaXphdGlvblNvdXJjZXx8MCxsZW5ndGg6bi52YWx1ZS5kYXRhLmJ5dGVMZW5ndGgsLi4uIm1pbWVUeXBlImluIHQ/e21pbWVUeXBlOnQubWltZVR5cGV9Ont9fSxlLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7Zmlyc3RGcmFtZUluZm86aH0pfX1VLndyaXRlKG4udmFsdWUpLGUub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHt0cmFuc2Zvcm1lZDohMH0pLHQoZSl9fSkpfShlKToic2VpLXR4Ij09PWUub3B0aW9ucy5uYW1lP2Z1bmN0aW9uIHQoZSl7cC5yZWFkKCkudGhlbigoYT0+e2lmKCFhLmRvbmUpe2lmKGEudmFsdWUgaW5zdGFuY2VvZiBSVENFbmNvZGVkVmlkZW9GcmFtZSl7Y29uc3QgdD1pKG5ldyBVaW50OEFycmF5KGEudmFsdWUuZGF0YSkpLGU9bi5zaGlmdCgpO2lmKGUpe2NvbnN0IG49byhhLnZhbHVlLmRhdGEsZSx0KTtuJiYoYS52YWx1ZS5kYXRhPW4pfX1VLndyaXRlKGEudmFsdWUpLGUub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHt0cmFuc2Zvcm1lZDohMH0pLHQoZSl9fSkpfShlKToiYXVkaW8tbWV0YWRhdGEtcngiPT09ZS5vcHRpb25zLm5hbWU/ZnVuY3Rpb24gdChlKXtwLnJlYWQoKS50aGVuKChuPT57aWYoIW4uZG9uZSl7aWYobi52YWx1ZSBpbnN0YW5jZW9mIFJUQ0VuY29kZWRBdWRpb0ZyYW1lKXtjb25zdCB0PW5ldyBEYXRhVmlldyhuLnZhbHVlLmRhdGEpLGE9dC5nZXRVaW50OCgwKTtsZXQgcjtpZigwIT0oMTI4JmEpJiY3MSE9PWEpe2NvbnN0IGU9ZnVuY3Rpb24odCl7aWYodC5ieXRlTGVuZ3RoPD0wKXJldHVybltdO2NvbnN0IGU9W107bGV0IG49MDtmb3IoO248dC5ieXRlTGVuZ3RoOyl7Y29uc3QgYT0oMTI4JnQuZ2V0VWludDgobikpPj43LHI9MTI3JnQuZ2V0VWludDgobik7aWYoIShhJiZuKzQ8PXQuYnl0ZUxlbmd0aCkpe24rKzticmVha317Y29uc3QgYT10LmdldFVpbnQzMihuLCExKSxvPSgxNjc3NjE5MiZhKT4+MTAsaT0xMDIzJmE7ZS5wdXNoKHtwdDpyLHRzX29mZnNldDpvLGxlbmd0aDppLGRhdGE6bmV3IFVpbnQ4QXJyYXl9KSxuKz00fX1sZXQgYT10LmJ5dGVMZW5ndGgtbjtmb3IoY29uc3QgciBvZiBlKXtpZihyLmxlbmd0aD5hKXJldHVybiBjb25zb2xlLndhcm4oIkJyb2tlbiByZWQgcGF5bG9hZCIpLFtdO3IubGVuZ3RoPjAmJihyLmRhdGE9bmV3IFVpbnQ4QXJyYXkodC5idWZmZXIsdC5ieXRlT2Zmc2V0K24sci5sZW5ndGgpLG4rPXIubGVuZ3RoLGEtPXIubGVuZ3RoKX1pZihhPjApe2NvbnN0IHI9e3B0OmUubGVuZ3RoPjA/ZVtlLmxlbmd0aC0xXS5wdDowLHRzX29mZnNldDowLGxlbmd0aDphLGRhdGE6bmV3IFVpbnQ4QXJyYXkodC5idWZmZXIsdC5ieXRlT2Zmc2V0K24sYSl9O2UucHVzaChyKX1yZXR1cm4gZX0odCk7aWYoZS5sZW5ndGg+MCl7Y29uc3QgdD1mdW5jdGlvbih0KXtsZXQgZT0wO2ZvcihsZXQgbj0wO248dC5sZW5ndGg7bisrKWUrPW48dC5sZW5ndGgtMT80OjEsZSs9dFtuXS5sZW5ndGg7Y29uc3Qgbj1uZXcgVWludDhBcnJheShlKTtsZXQgYT0wO2ZvcihsZXQgZT0wO2U8dC5sZW5ndGg7ZSsrKWlmKGU8dC5sZW5ndGgtMSl7Y29uc3Qgcj0oMjE0NzQ4MzY0OHwoMTI3JnRbZV0ucHQpPDwyNHwoMjYyMTQzJnRbZV0udHNfb2Zmc2V0KTw8MTB8MTAyMyZ0W2VdLmxlbmd0aCk+Pj4wO25bYSsrXT1yPj4yNCYyNTUsblthKytdPXI+PjE2JjI1NSxuW2ErK109cj4+OCYyNTUsblthKytdPTI1NSZyfWVsc2UgblthKytdPTEyNyZ0W2VdLnB0O2Zvcihjb25zdCBlIG9mIHQpbi5zZXQoZS5kYXRhLGEpLGErPWUubGVuZ3RoO3JldHVybiBufShlLm1hcCgodD0+e2NvbnN0IGU9bmV3IFVpbnQ4QXJyYXkodC5sZW5ndGgpO2Uuc2V0KHQuZGF0YSk7Y29uc3Qgbj1kKG5ldyBEYXRhVmlldyhlLmJ1ZmZlcikpO3JldHVybiBuPy5mcmFtZSYmKHQuZGF0YT1uPy5mcmFtZSkscj1uLHR9KSkpO24udmFsdWUuZGF0YT10LmJ1ZmZlcn19ZWxzZSByPWQodCksciYmKG4udmFsdWUuZGF0YT1yLmZyYW1lLmJ1ZmZlcik7aWYocil7bGV0IHQ9ci50bHYuZmluZCgodD0+dC50YWc9PT1jLk1FVEFEQVRBKSk7aWYodCYmdC52YWx1ZSBpbnN0YW5jZW9mIFVpbnQ4QXJyYXkmJmUub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHttZXRhZGF0YTp0LnZhbHVlfSksdD1yLnRsdi5maW5kKCh0PT50LnRhZz09PWMuQVVESU9fNjRfQklUX1BUUykpLHQmJnQudmFsdWUgaW5zdGFuY2VvZiBVaW50OEFycmF5JiY4PT10LnZhbHVlLmxlbmd0aCl7Y29uc3Qgbj1uZXcgRGF0YVZpZXcodC52YWx1ZS5idWZmZXIpLmdldEJpZ1VpbnQ2NCgwLCEwKTt0JiZ0LnZhbHVlIGluc3RhbmNlb2YgVWludDhBcnJheSYmZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe3B0czpufSl9fX1VLndyaXRlKG4udmFsdWUpLGUub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHt0cmFuc2Zvcm1lZDohMH0pLHQoZSl9fSkpfShlKToiYXVkaW8tbWV0YWRhdGEtdHgiPT09ZS5vcHRpb25zLm5hbWUmJmZ1bmN0aW9uIHQoZSl7cC5yZWFkKCkudGhlbigobj0+e2lmKCFuLmRvbmUpe2lmKGUub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHtnZXRNZXRhZGF0YTohMH0pLG4udmFsdWUgaW5zdGFuY2VvZiBSVENFbmNvZGVkQXVkaW9GcmFtZSl7Y29uc3QgdD1yLnNoaWZ0KCk7dCYmKG4udmFsdWUuZGF0YT1mdW5jdGlvbih0LGUsbil7Y29uc3QgYT1uLmJ5dGVMZW5ndGgscj1hK3UrZyxvPWYrbCtyLGk9bmV3IEFycmF5QnVmZmVyKHQuYnl0ZUxlbmd0aCtvKSxjPW5ldyBEYXRhVmlldyhpKTtjLnNldFVpbnQ4KDAscyksYy5zZXRVaW50MTYoMSxyKSxjLnNldFVpbnQ4KDMsZSksYy5zZXRVaW50MTYoNCxhKTtmb3IobGV0IHQ9MDt0PGE7dCsrKWMuc2V0VWludDgoNit0LG5bdF0pO2NvbnN0IGQ9bmV3IFVpbnQ4QXJyYXkoYy5idWZmZXIpO3JldHVybiBkLnNldChuZXcgVWludDhBcnJheSh0KSxvKSxkLmJ1ZmZlcn0obi52YWx1ZS5kYXRhLGMuQVVESU9fNjRfQklUX1BUUyx0KSl9VS53cml0ZShuLnZhbHVlKSxlLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7dHJhbnNmb3JtZWQ6ITB9KSx0KGUpfX0pKX0oZSl9LHNlbGYucG9zdE1lc3NhZ2UoInJlZ2lzdGVyZWQiKTsK")],{type:"text/javascript"});return setTimeout((()=>vP.revokeObjectURL(e)),0),new Worker(vP.createObjectURL(e))}const bP=71,IP=1,OP=2,CP=1,NP=2;var wP=function(e){return e[e.AUDIO_LEVEL=1]="AUDIO_LEVEL",e[e.METADATA=2]="METADATA",e[e.AUDIO_64_BIT_PTS=3]="AUDIO_64_BIT_PTS",e}(wP||{});function DP(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=e.getUint8(0);if(r!==bP)return;const i=e.getUint16(1),n=IP+OP+i,o=new Uint8Array(e.byteLength-n);o.set(new Uint8Array(e.buffer,n,e.byteLength-n));const s={m:r,tlvLen:i,tlv:[],frame:o};let a=IP+OP;for(;a<n;){const r=e.getUint8(a),i=e.getUint16(a+CP),n=CP+NP;if(r===wP.AUDIO_LEVEL){let o=e.getUint8(a+n);for(let t=1;t<i;t++)o=o<<8|e.getUint8(a+n+t);s.tlv.push({tag:r,length:i,value:t?127^o>>1:127&o})}else if(r===wP.METADATA||r===wP.AUDIO_64_BIT_PTS){const t=new Uint8Array(i);for(let r=0;r<i;r++)t[r]=e.getUint8(a+n+r);s.tlv.push({tag:r,length:i,value:t})}a+=n+i}return s}const PP=new Map;function LP(e,t){const{chunk:r,controller:i}=t,n=wP.METADATA;r.data=function(e,t,r){const i=r.byteLength,n=i+CP+NP,o=IP+OP+n,s=new ArrayBuffer(e.byteLength+o),a=new DataView(s);a.setUint8(0,bP),a.setUint16(1,n),a.setUint8(3,t),a.setUint16(4,i);for(let e=0;e<i;e++)a.setUint8(6+e,r[e]);const c=new Uint8Array(a.buffer);return c.set(new Uint8Array(e),o),c.buffer}(r.data,n,e),i.enqueue(r)}var kP=Z(PT);const MP=127,UP=1e-10,xP=139/13;const VP=new Map;function FP(e,t,r){const i="".concat(e,"-").concat(t,"-").concat(r);let n=0;if(VP.has(i))n=VP.get(i);else{const o=.5;n=Math.log(function(e,t){const r=e-t;t<r&&(t=r);let i=1;for(let r=e,n=1;r>t;r--,n++)i=i*r/n;return i}(t,e))+e*Math.log(o)+(t-e)*Math.log(1-o)-Math.log(r)+r*e,VP.set(i,n)}return n<UP&&(n=UP),n}function BP(e,t,r){const i=t.length,n=e.length/i;let o=!1;for(let s=0,a=0;s<i;s++){let i=0;for(let t=a+n;a<t;a++)e[a]>r&&i++;t[s]!==i&&(t[s]=i,o=!0)}return o}window.cache=VP;let jP=0;class GP{constructor(e){H_(this,"id",void 0),H_(this,"immediates",[]),H_(this,"lastNonSilence",-1),H_(this,"immediateSpeechActivityScore",UP),H_(this,"lastLevelChangedTime",Date.now()),H_(this,"levels",[]),H_(this,"longs",[]),H_(this,"longSpeechActivityScore",UP),H_(this,"mediums",[]),H_(this,"mediumSpeechActivityScore",UP),H_(this,"minLevel",0),H_(this,"nextMinLevel",0),H_(this,"nextMinLevelWindowLength",0),H_(this,"energyScore",0),this.id=e||"".concat(jP++),this.immediates.length=50,this.mediums.length=10,this.longs.length=1,this.levels.length=this.immediates.length}computeImmediates(){const e=this.immediates,t=this.levels,r=this.minLevel+xP;let i=!1;for(let n=0;n<e.length;++n){let o=t[n];o<r&&(o=0);const s=Math.floor(o/xP);e[n]!==s&&(e[n]=s,i=!0)}return i}computeLongs(){return BP(this.mediums,this.longs,4)}computeMediums(){return BP(this.immediates,this.mediums,7)}evaluateImmediateSpeechActivityScore(){this.immediateSpeechActivityScore=FP(this.immediates[0],13,.78)}evaluateLongSpeechActivityScore(e){this.longSpeechActivityScore=FP(this.longs[0],10,47),this.longSpeechActivityScore>UP&&(this.lastNonSilence=e)}evaluateMediumSpeechActivityScore(){this.mediumSpeechActivityScore=FP(this.mediums[0],5,24)}evaluateSpeechActivityScores(e){this.computeImmediates()&&(this.evaluateImmediateSpeechActivityScore(),this.computeMediums()&&(this.evaluateMediumSpeechActivityScore(),this.computeLongs()&&this.evaluateLongSpeechActivityScore(e)))}getLastLevelChangedTime(){return this.lastLevelChangedTime}getLevels(){var e;return"[".concat(kP(e=[...this.levels]).call(e).join(),"]")}getSpeechActivityScore(e){switch(e){case 0:return this.immediateSpeechActivityScore;case 1:return this.mediumSpeechActivityScore;case 2:return this.longSpeechActivityScore;default:throw new Error("interval "+e)}}levelChanged(e,t){if(this.lastLevelChangedTime<=t){this.lastLevelChangedTime=t;let r=e;return e<0&&(r=0),e>MP&&(r=MP),this.levels.unshift(r),this.levels.length>this.immediates.length&&this.levels.pop(),this.updateMinLevel(r),r>=this.minLevel+xP?r:r/2}return-1}levelTimedOut(){this.levelChanged(0,this.lastLevelChangedTime)}updateMinLevel(e){if(0!==e){if(0===this.minLevel||this.minLevel>e)return this.minLevel=e,this.nextMinLevel=0,void(this.nextMinLevelWindowLength=0);if(0===this.nextMinLevel)return this.nextMinLevel=e,void(this.nextMinLevelWindowLength=1);if(this.nextMinLevel>e&&(this.nextMinLevel=e),this.nextMinLevelWindowLength++,this.nextMinLevelWindowLength>=750){let e=Math.sqrt(this.minLevel*this.nextMinLevel);e<0?e=0:e>MP&&(e=MP),this.minLevel=e,this.nextMinLevel=0,this.nextMinLevelWindowLength=0}}}}class WP{constructor(e){H_(this,"algorithm",void 0),this.algorithm=e}execute(){let e=!this.algorithm;if(!e)try{const t=this.algorithm.runInDecisionMaker(this);t<=0?e=!0:setTimeout(this.execute.bind(this),t)}catch(t){e=!0}e&&this.algorithm&&this.algorithm.decisionMakerExited(this)}}class HP{constructor(e,t,r){H_(this,"isDominant",void 0),H_(this,"energyRanking",void 0),H_(this,"energyScore",void 0),this.isDominant=e,this.energyRanking=t,this.energyScore=r}}class KP extends fi{constructor(e){super(),H_(this,"dominantId",null),H_(this,"lastDecisionTime",0),H_(this,"lastLevelChangedTime",0),H_(this,"lastLevelIdleTime",0),H_(this,"relativeSpeechActivities",[]),H_(this,"speakers",new Map),H_(this,"enableSilence",!1),H_(this,"timeoutToSilenceInterval",0),H_(this,"decisionMaker",null),H_(this,"loudest",[]),H_(this,"numLoudestToTrack",3),H_(this,"energyExpireTimeMs",250),H_(this,"energyAlphaPct",50),this.timeoutToSilenceInterval=e,this.enableSilence=e>0,this.relativeSpeechActivities.length=3}setLoudestConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;this.numLoudestToTrack=e,null!=t&&(this.energyExpireTimeMs=t),null!=r&&(this.energyAlphaPct=r),this.loudest.length>e&&this.loudest.splice(e)}getDominantSpeaker(){return this.dominantId}isAmongLoudest(e){return this.loudest.some((t=>t.id===e))}levelChanged(e,t){const r=Date.now(),i=this.getOrCreateSpeaker(e);this.lastLevelChangedTime<r&&(this.lastLevelChangedTime=r,this.maybeStartDecisionMaker());const n=i.levelChanged(t,r);return this.updateLoudestList(i,n,r)}runInDecisionMaker(e){if(this.decisionMaker!==e)return-1;if(this.lastDecisionTime>0){if(this.lastDecisionTime-this.lastLevelChangedTime>=15e3)return-1}return this._runInDecisionMaker()}decisionMakerExited(e){this.decisionMaker===e&&(this.decisionMaker=null)}destroy(){this.decisionMaker=null,this.loudest.length=0,this.speakers.clear(),this.removeAllListeners()}addSpeakers(e){e.forEach((e=>{this.speakers.has(e.id)||this.speakers.set(e.id,e)}))}removeSpeakers(e){e.forEach((e=>{this.speakers.delete(e.id)}))}getOrCreateSpeaker(e){let t=this.speakers.get(e);return t||(t=new GP(e),this.speakers.set(e,t),this.maybeStartDecisionMaker()),t}updateLoudestList(e,t,r){const i=e.id===this.dominantId;if(t<0){let t=0;for(;t<this.loudest.length&&this.loudest[t]!==e;)++t;return new HP(i,t,e.energyScore)}if(e.energyScore=Math.floor((this.energyAlphaPct*t+(100-this.energyAlphaPct)*e.energyScore+50)/100),0===this.numLoudestToTrack)return new HP(i,0,e.energyScore);const n=r-this.energyExpireTimeMs;let o=0;for(;o<this.loudest.length;){const t=this.loudest[o];if(t.getLastLevelChangedTime()<n&&this.loudest.length>=this.numLoudestToTrack)this.loudest.splice(o,1);else if(t.id!==e.id)++o;else if(this.loudest.splice(o,1),this.loudest.length<this.numLoudestToTrack)break}let s=0;for(;s<this.loudest.length;){if(this.loudest[s].energyScore<e.energyScore)break;++s}return s<this.numLoudestToTrack&&(this.loudest.splice(s,0,e),this.loudest.length>this.numLoudestToTrack&&this.loudest.splice(this.numLoudestToTrack,1)),new HP(i,s,e.energyScore)}maybeStartDecisionMaker(){!this.decisionMaker&&this.speakers.size>0&&(this.decisionMaker=new WP(this),this.decisionMaker.execute())}makeDecision(e){let t=null,r=null;const i=this.speakers.size;let n=null;if(0===i)n=null;else if(1===i){var o;const t=eb(o=this.speakers).call(o).next().value;if(this.enableSilence&&t){n=t.id,t.evaluateSpeechActivityScores(e);e-t.lastNonSilence>this.timeoutToSilenceInterval&&(n=null)}}else{let t=null==this.dominantId?null:this.speakers.get(this.dominantId);if(null==t){const e=this.speakers.entries().next();e.value&&(n=e.value[0],t=e.value[1])}else n=t.id;null!=t&&t.evaluateSpeechActivityScores(e);const r=this.relativeSpeechActivities;let i=2;for(const o of this.speakers.entries()){const[s,a]=o;if(a===t)continue;a.evaluateSpeechActivityScores(e);for(let e=0;e<r.length;++e){const i=null==t?UP:t.getSpeechActivityScore(e);r[e]=Math.log(a.getSpeechActivityScore(e)/i)}const c=r[0],d=r[1],u=r[2];c>3&&d>2&&u>0&&d>i&&(i=d,n=s)}if(this.enableSilence&&null!=t&&n===t.id){e-t.lastNonSilence>this.timeoutToSilenceInterval&&(n=null)}}null==n&&!this.enableSilence||n===this.dominantId||(t=this.dominantId,this.dominantId=n,r=this.dominantId),null==r&&!this.enableSilence||r===t||this.emit("ActiveSpeakerChanged",r)}_runInDecisionMaker(){const e=Date.now(),t=300-(e-this.lastLevelIdleTime);let r=0;t<=0?(0!==this.lastLevelIdleTime&&this.timeoutIdleLevels(e),this.lastLevelIdleTime=e):r=t;let i=300-(e-this.lastDecisionTime);return i<=0&&(this.lastDecisionTime=e,this.makeDecision(e),i=300-(Date.now()-e)),i>0&&r>i&&(r=i),r}timeoutIdleLevels(e){const t=[];for(const i of eb(r=this.speakers).call(r)){var r;const n=e-i.getLastLevelChangedTime();36e5<n&&(null==this.dominantId||i.id!==this.dominantId)?t.push(i.id):300<n&&i.levelTimedOut()}t.forEach((e=>this.speakers.delete(e)))}}const YP=new Map;let zP=null,XP=null;const ZP=3;let JP=[];function QP(e,t){let r=YP.get(e);if(r||(r=function(e){const t=new GP;return YP.set(e,t),zP||(zP=new KP(hn("TOPN_SILENCE_THRESHOLD")||500),zP.on("ActiveSpeakerChanged",(e=>{null!=e&&(XP=e)}))),zP.addSpeakers([t]),t}(e)),YP.size<=ZP)return{selected:!0,speaker:r};if(!zP)throw new Error("no active speaker detector");zP.levelChanged(r.id,t),JP=zP.loudest.map((e=>e.id)),XP&&!Nd(JP).call(JP,XP)&&JP.length>=ZP&&JP.pop();return{selected:Nd(JP).call(JP,r.id)||r.id===XP,speaker:r}}const qP=1e3,$P=40,eL=new Map,tL=new Map;class rL{get samples(){return this.actives+this.inactives}get activeRate(){return this.actives/this.samples}constructor(e,t){H_(this,"id",void 0),H_(this,"track",void 0),H_(this,"score",0),H_(this,"active",!0),H_(this,"muted",!1),H_(this,"timer",0),H_(this,"actives",0),H_(this,"inactives",0),this.id=e,this.track=t,this.setActive(eL.size<3)}autoCheckActive(){this.autoSetActive(),this.autoAdjustActive(),this.resetTimer(),this.actives=0,this.inactives=0}autoSetActive(){const e=this.active;this.active=this.activeRate>=.8;const{actives:t,inactives:r}=function(){const e=[],t=[];return Array.from(eb(eL).call(eL)).forEach((r=>{r.active?e.push(r):t.push(r)})),{actives:e,inactives:t}}();if(t.length>3){let e;t.forEach((t=>{(!e||e.score>t.score)&&(e=t)})),e&&e.setActive(!1)}if(t.length<3&&r.length>0){let t;r.forEach((e=>{(!t||t.score<e.score)&&e.id!==this.id&&(t=e)})),t&&e&&!this.active&&(t.samples>$P&&t.activeRate-this.activeRate>.4?t.setActive(!0):this.active=!0)}this.setMuted(!this.active)}setActive(e){this.active=e,this.resetTimer(),this.setMuted(!e)}autoAdjustActive(){this.active?this.autoSwitchToInactive():this.autoSwitchToActive()}autoSwitchToActive(){const e=function(e){let t;return Array.from(eb(eL).call(eL)).forEach((r=>{!r.active||r.id===e||r.samples<$P||(!t||r.score<t.score)&&(t=r)})),t}(this.id);e&&this.activeRate-e.activeRate>.4&&(e.setActive(!1),this.setActive(!0))}autoSwitchToInactive(){const e=function(e){let t;return Array.from(eb(eL).call(eL)).forEach((r=>{r.active||r.id===e||r.samples<$P||(!t||r.score>t.score)&&(t=r)})),t}(this.id);e&&e.activeRate-this.activeRate>.4&&(e.setActive(!0),this.setActive(!1))}addSample(e){e?this.actives+=1:this.inactives+=1,this.samples>66.66666666666667&&this.autoCheckActive()}setMuted(e){this.track&&(this.track.enabled=!e,this.muted=e)}resetTimer(){this.clearTimer(),this.timer=window.setTimeout((()=>{if(0!==this.samples)return this.samples<50?this.resetTimer():void this.autoCheckActive()}),qP)}clearTimer(){this.timer&&(clearTimeout(this.timer),this.timer=0)}}let iL;function nL(e,t,r){const i=eL.get(e)||new rL(e,t);return i.score=r,eL.set(e,i),function(e){if(tL.set(e,!0),!iL)return void(iL=Date.now());const t=Date.now();t-iL>1e3&&(tL.get(e)?tL.set(e,!1):(oL(e),tL.delete(e)),iL=t)}(e),i}function oL(e){const t=eL.get(e);t&&(eL.delete(e),t.clearTimer())}const sL=new Map,aL=new Map;function cL(e,t,r,i){const n=new DataView(e.data),o=n.getUint8(0);let s;if(0!=(128&o)&&71!==o){const t=function(e){if(e.byteLength<=0)return[];const t=[];let r=0;for(;r<e.byteLength;){const i=(128&e.getUint8(r))>>7,n=127&e.getUint8(r);if(!(i&&r+4<=e.byteLength)){r++;break}{const i=e.getUint32(r,!1),o=(16776192&i)>>10,s=1023&i;t.push({pt:n,ts_offset:o,length:s,data:new Uint8Array}),r+=4}}let i=e.byteLength-r;for(const n of t){if(n.length>i)return console.warn("Broken red payload"),[];n.length>0&&(n.data=new Uint8Array(e.buffer,e.byteOffset+r,n.length),r+=n.length,i-=n.length)}if(i>0){const n={pt:t.length>0?t[t.length-1].pt:0,ts_offset:0,length:i,data:new Uint8Array(e.buffer,e.byteOffset+r,i)};t.push(n)}return t}(n);if(t.length>0){const r=function(e){let t=0;for(let r=0;r<e.length;r++)t+=r<e.length-1?4:1,t+=e[r].length;const r=new Uint8Array(t);let i=0;for(let t=0;t<e.length;t++)if(t<e.length-1){const n=(2147483648|(127&e[t].pt)<<24|(262143&e[t].ts_offset)<<10|1023&e[t].length)>>>0;r[i++]=n>>24&255,r[i++]=n>>16&255,r[i++]=n>>8&255,r[i++]=255&n}else r[i++]=127&e[t].pt;for(const t of e)r.set(t.data,i),i+=t.length;return r}(t.map((e=>{const t=new Uint8Array(e.length);t.set(e.data);const r=DP(new DataView(t.buffer));return null!=r&&r.frame&&(e.data=null==r?void 0:r.frame),s=r,e})));e.data=r.buffer}}else s=DP(n),s&&(e.data=s.frame.buffer);if(t.enqueue(e),!s)return;const a=s.tlv.find((e=>e.tag===wP.METADATA));a&&r&&a.value instanceof Uint8Array&&r(a.value);const c=s.tlv.find((e=>e.tag===wP.AUDIO_64_BIT_PTS));if(c&&i&&c.value instanceof Uint8Array&&8==c.value.length){i(new DataView(c.value.buffer).getBigUint64(0,!0))}}const dL="video/h264",uL="video/h265";function lL(e,t,r){let i=new Uint8Array(e,t,r),n=[],o=0;for(;n.length<r;)o+3<r&&0===i[o]&&0===i[o+1]&&3===i[o+2]&&(0===i[o+3]||1===i[o+3]||2===i[o+3]||3===i[o+3])?(n.push(i[o],i[o+1],i[o+3]),o+=4):(n.push(i[o]),o++);return new Uint8Array(n)}function hL(e,t){switch(t){case dL:return function(e){const t=new DataView(e.data);let r=0;for(;r+4<e.data.byteLength;){if(0===t.getUint8(r+0)&&0===t.getUint8(r+1)&&0===t.getUint8(r+2)&&1===t.getUint8(r+3)&&6===t.getUint8(r+4)){let i=r+6,n=0,o=0;for(;255===(o=t.getUint8(i++));)n+=255;n+=o;const s=lL(e.data,i,n);return new Uint8Array(s)}r++}return null}(e);case uL:return function(e){const t=new DataView(e.data);let r=0;for(;r+5<e.data.byteLength;){if(0===t.getUint8(r+0)&&0===t.getUint8(r+1)&&0===t.getUint8(r+2)&&1===t.getUint8(r+3)&&78===t.getUint8(r+4)&&1===t.getUint8(r+5)&&101===t.getUint8(r+6)){let i=r+7,n=0,o=0;for(;255===(o=t.getUint8(i++));)n+=255;n+=o;const s=lL(e.data,i,n);return new Uint8Array(s)}r++}return null}(e);default:return null}}function pL(e){const t=e.length;let r=[],i=0;for(;i<t;)i+2<t&&0===e[i]&&0===e[i+1]&&(0===e[i+2]||1===e[i+2]||2===e[i+2]||3===e[i+2])?(r.push(e[i],e[i+1],3,e[i+2]),i+=3):(r.push(e[i]),i++);return new Uint8Array(r)}function fL(e,t,r){switch(r){case dL:return function(e,t){const r=pL(t),i=r.length,n=Math.floor(i/255),o=i%255,s=new Uint8Array(6+n+1+i+e.byteLength);s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=6,s[5]=101;let a=0;for(;a<n;)s[6+a]=255,a++;return s[6+a]=o,a++,s.set(r,6+a),s.set(new Uint8Array(e),6+a+i),s.buffer}(e,t);case uL:return function(e,t){const r=pL(t),i=r.length,n=Math.floor(i/255),o=i%255,s=new Uint8Array(7+n+1+i+1+e.byteLength);s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=78,s[5]=1,s[6]=101;let a=0;for(;a<n;)s[7+a]=255,a++;return s[7+a]=o,a++,s.set(r,7+a),a+=i,s[7+a]=128,a++,s.set(new Uint8Array(e),7+a),s.buffer}(e,t);default:return null}}function EL(e){if(e.length<5)return"";let t=-1;for(let r=0;r<e.length-3;r++){if(0===e[r]&&0===e[r+1]&&1===e[r+2]){t=r;break}if(r<e.length-4&&0===e[r]&&0===e[r+1]&&0===e[r+2]&&1===e[r+3]){t=r;break}}if(-1===t)return"";const r=t+(0===e[t+2]?4:3);if(r>=e.length)return"";const i=e[r];if(128&i)return"";if((i>>1&63)>=32)return uL;if(r+1<e.length){if(0==(248&e[r+1]))return uL}return(31&i)<=31?dL:""}const mL=new Map;function _L(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}const TL=new Map;Zn(),e.AUDIO_CONTEXT_EVENT=ro,e.AUDIO_ENCODER_CONFIG_SETTINGS=Bd,e.AUDIO_TRACK_EVENT=ou,e.AgoraRTCPlayer=uO,e.AudioProcessorContext=sb,e.AudioProcessorDestination=ob,e.AudioSourceEvents=nu,e.BufferSourceAudioTrack=tO,e.CameraVideoTrack=qO,e.DEFAULT_LOCAL_AUDIO_TRACK_STATS=su,e.DEFAULT_LOCAL_VIDEO_TRACK_STATS=au,e.DEFAULT_NETWORK_QUALITY_STATS={uplinkNetworkQuality:0,downlinkNetworkQuality:0},e.DEFAULT_REMOTE_AUDIO_TRACK_STATS=cu,e.DEFAULT_REMOTE_VIDEO_TRACK_STATS=du,e.DataChannel=RC,e.DataChannelEvents=mu,e.DeviceManager=MA,e.DeviceManagerEvent=pu,e.DeviceManagerState=hu,e.LocalAudioTrack=$I,e.LocalDataChannel=class extends RC{send(e){if(this._originDataChannel){let t=e;t=this._dataStreamPacketHandler.serialize(e);const r=new Uint8Array(this._dataStreamPacketHeader.byteLength+t.byteLength);r.set(new Uint8Array(this._dataStreamPacketHeader),0),r.set(new Uint8Array(t),this._dataStreamPacketHeader.byteLength),this._originDataChannel.send(r.buffer)}}},e.LocalTrack=aA,e.LocalTrackEvents=tu,e.LocalVideoTrack=QO,e.MediaElementNumStatus={uninit:100,none:110,init:120,loadeddata:130,canplay:200,playing:210,paused:220,suspend:300,stalled:310,waiting:320,error:330,destroyed:340,abort:350,ended:360,emptied:370},e.MediaElementStatus=fu,e.MicrophoneAudioTrack=eO,e.MixingAudioTrack=rO,e.PROCESSOR_CONTEXT_EVENTS=lu,e.PROCESSOR_DESTINATION_EVENTS=uu,e.RemoteAudioTrack=gC,e.RemoteDataChannel=class extends RC{constructor(e){super(e),H_(this,"_messageListener",void 0),this._messageListener=e=>{if(e.data.byteLength<this._dataStreamPacketHeader.byteLength)throw Error("invalid byteLength: the byte length must exceed "+this._dataStreamPacketHeader.byteLength);const t=e.data.slice(0,this._dataStreamPacketHeader.byteLength),r=new DataView(t).getUint8(3);if(r!==this.id)return void(hn("SHOW_DATASTREAM2_LOG")&&On.debug("invalid datachannel id: ".concat(r," !== ").concat(this.id)));let i=e.data.slice(this._dataStreamPacketHeader.byteLength);i=this._dataStreamPacketHandler.deserialize(i),this.emit(mu.MESSAGE,i)}}_updateDataChannelConfig(e){this._config=e}_updateOriginDataChannel(e){super._updateOriginDataChannel(e),this._bandRemoteDataChannelEvents()}_close(){this._originDataChannel&&(this._originDataChannel.removeEventListener("message",this._messageListener),super._close())}_bandRemoteDataChannelEvents(){this._originDataChannel&&this._originDataChannel.addEventListener("message",this._messageListener)}},e.RemoteStreamFallbackType=$d,e.RemoteStreamType=qd,e.RemoteTrack=_C,e.RemoteTrackEvents=ru,e.RemoteVideoTrack=TC,e.SAFARI_GLOBAL_GUM_LOCK=wA,e.SUPPORT_SCREEN_ENCODER_CONFIG_LIST=Md,e.SUPPORT_SVC_CONFIG_LIST=Ud,e.SUPPORT_VIDEO_ENCODER_CONFIG_LIST=kd,e.StreamType=Qd,e.Track=sA,e.TrackEvents=eu,e.TrackHint=Jd,e.TrackInternalEvent=Zd,e.TrackMediaType=iu,e.VideoPlayer=cO,e.VideoProcessorContext=nb,e.VideoProcessorDestination=ib,e.VideoState=Eu,e.__TRACK_LIST__=Gd,e.addTrack=Wd,e.audioContextState=hA,e.audioElementPlayCenter=HA,e.audioTimerLoop=function(e,t){let r=!1;const i=1/t;if(hn("DISABLE_WEBAUDIO")){const t=window.setInterval((()=>{r?window.clearInterval(t):e(performance.now()/1e3)}),1e3*i)}else{const t=EA();let n=t.createGain();n.gain.value=0,n.connect(t.destination);const o=()=>{if(r)return void(n=null);const s=t.createOscillator();s.onended=o,s.connect(n),s.start(0),s.stop(t.currentTime+i),e(t.currentTime)};o()}return()=>{r=!0}},e.autoPlayGestureEventEmitter=VA,e.blob2Uint8Array=dI,e.checkMediaStreamTrackResolution=db,e.checkTrackState=KA,e.createBufferSourceAudioTrack=async function(e){var t;const{cacheOnlineFile:r,encoderConfig:i}=e;let{source:n}=e;const o={source:n instanceof AudioBuffer?"AudioBuffer":n instanceof File?null!==(t=File.name)&&void 0!==t?t:"File":n,cacheOnlineFile:r,encoderConfig:i},s=Fi(8,"track-buf-"),a=zn.reportApiInvoke(null,{id:s,tag:gi.TRACER,name:Ti.CREATE_BUFFER_AUDIO_TRACK,options:[o]});if(hn("DISABLE_WEBAUDIO"))throw new ni(ii.NOT_SUPPORTED,"can not create BufferSourceAudioTrack when WebAudio disabled");On.info("start create buffer source audio track with config",JSON.stringify(o),"trackId",s);const c=n;if(!(n instanceof AudioBuffer))try{n=await async function(e,t){let r=null;if("string"==typeof e){const t=nO.get(e);if(t)return On.debug("use cached audio resource: ",e),t;try{r=(await qi((()=>Ar.get(e,{responseType:"arraybuffer"})),void 0,void 0,{maxRetryCount:3})).data}catch(e){throw new ni(ii.FETCH_AUDIO_FILE_FAILED,e.toString())}}else{const t=new oA(((t,r)=>{const i=new FileReader;i.onload=e=>{e.target?t(e.target.result):r(new ni(ii.READ_LOCAL_AUDIO_FILE_ERROR))},i.onerror=()=>{r(new ni(ii.READ_LOCAL_AUDIO_FILE_ERROR))},i.readAsArrayBuffer(e)}));r=await t}const i=await TA(r);return"string"==typeof e&&t&&nO.set(e,i),i}(n,r)}catch(e){return a.onError(e),e.throw(On)}const d=new iO(n),u=new tO(c,d,i?jd(i):{},s);return On.info("create buffer source audio track success, trackId:",s),a.onSuccess(u.getTrackId()),u},e.createCameraVideoTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=hn("CAMERA_CAPTURE_CONFIG"),r=Fi(8,"track-cam-"),i=zn.reportApiInvoke(null,{id:r,tag:gi.TRACER,name:Ti.CREATE_CAM_VIDEO_TRACK,options:[eC({},e),t]});t&&(e.encoderConfig=t);const n=ub(e);let o=null;On.info("start create camera video track with config",JSON.stringify(e),"trackId",r);try{o=(await DA({video:n},r)).getVideoTracks()[0]||null}catch(e){throw i.onError(e),e}if(!o){const e=new ni(ii.UNEXPECTED_ERROR,"can not find track in media stream");return i.onError(e),e.throw(On)}if(e.optimizationMode&&tC(r,o,e,xd(e.encoderConfig)),hn("USE_STANDARD_BITRATE_DEFAULT")){const t=xd(e.encoderConfig);e.encoderConfig=t,delete t.bitrateMax,delete t.bitrateMin}const s=new qO(o,e,n,e.scalabiltyMode?Fd(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,r);return i.onSuccess(s.getTrackId()),On.info("create camera video success, trackId:",r),s},e.createCustomAudioTrack=function(e){const t=Fi(8,"track-cus-"),r=zn.reportApiInvoke(null,{id:t,tag:gi.TRACER,name:Ti.CREATE_CUSTOM_AUDIO_TRACK,options:[e]}),i=new $I(e.mediaStreamTrack,e.encoderConfig?jd(e.encoderConfig):{},t,!1);return On.info("create custom audio track success with config",e,"trackId",i.getTrackId()),r.onSuccess(i.getTrackId()),i},e.createCustomVideoTrack=function(e){const t=Fi(8,"track-cus-"),r=zn.reportApiInvoke(null,{id:t,tag:gi.TRACER,name:Ti.CREATE_CUSTOM_VIDEO_TRACK,options:[e]});hn("USE_STANDARD_BITRATE_DEFAULT")&&(delete e.bitrateMax,delete e.bitrateMin);const i=new QO(e.mediaStreamTrack,{width:e.width,height:e.height,frameRate:e.frameRate,bitrateMax:e.bitrateMax,bitrateMin:e.bitrateMin},e.scalabiltyMode?Fd(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,t,[Jd.CUSTOM_TRACK]);return r.onSuccess(i.getTrackId()),On.info("create custom video track success with config",e,"trackId",i.getTrackId()),i},e.createMicrophoneAndCameraTracks=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=hn("CAMERA_CAPTURE_CONFIG"),i=Fi(8,"track-mic-"),n=Fi(8,"track-cam-"),o=zn.reportApiInvoke(null,{id:"".concat(i,"-").concat(n),tag:gi.TRACER,name:Ti.CREATE_MIC_AND_CAM_TRACKS,options:[e,t,r]});r&&(t.encoderConfig=r);const s=ub(t),a=fb(e);let c=null,d=null;On.info("start create camera video track(".concat(n,") and microphone audio track(").concat(i,") with config, audio: ").concat(JSON.stringify(e),", video: ").concat(JSON.stringify(t)));try{const e=await DA({audio:a,video:s},"".concat(i,"-").concat(n));c=e.getAudioTracks()[0],d=e.getVideoTracks()[0]}catch(e){throw o.onError(e),e}if(!c||!d){const e=new ni(ii.UNEXPECTED_ERROR,"can not find tracks in media stream");return o.onError(e),e.throw(On)}if(t.optimizationMode&&tC(n,d,t,xd(t.encoderConfig)),hn("USE_STANDARD_BITRATE_DEFAULT")){const e=xd(t.encoderConfig);t.encoderConfig=e,delete e.bitrateMax,delete e.bitrateMin}const u=new eO(c,e,a,i),l=new qO(d,t,s,t.scalabiltyMode?Fd(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,n);return o.onSuccess([u.getTrackId(),l.getTrackId()]),On.info("create camera video track(".concat(n,") and microphone audio track(").concat(i,") success")),[u,l]},e.createMicrophoneAudioTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Fi(8,"track-mic-"),r=zn.reportApiInvoke(null,{id:t,tag:gi.TRACER,name:Ti.CREATE_MIC_AUDIO_TRACK,options:[e]}),i=fb(e);let n=null;On.info("start create microphone audio track with config",JSON.stringify(e),"trackId",t);try{n=(await DA({audio:i},t)).getAudioTracks()[0]||null}catch(e){throw r.onError(e),e}if(!n){const e=new ni(ii.UNEXPECTED_ERROR,"can not find track in media stream");return r.onError(e),e.throw(On)}const o=new eO(n,e,i,t);return r.onSuccess(o.getTrackId()),On.info("create microphone audio track success, trackId:",t),o},e.createMixingAudioTrack=function(e){const t=new rO;return e.forEach((e=>t.addAudioTrack(e))),t},e.createScreenVideoTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"disable";const r="object"==typeof t?pb(t):void 0;r&&(t="auto");const i=Fi(8,"track-scr-v-"),n=zn.reportApiInvoke(null,{id:i,tag:gi.TRACER,name:Ti.CREATE_SCREEN_VIDEO_TRACK,options:[eC({},e),t]});e.encoderConfig?"string"==typeof e.encoderConfig||e.encoderConfig.width&&e.encoderConfig.height||(e.encoderConfig.width={max:1920},e.encoderConfig.height={max:1080}):e.encoderConfig="1080p_2";const o=lb(e);let s=null,a=null;const c=Jn();if(!c.supportShareAudio&&"enable"===t){const e=new ni(ii.NOT_SUPPORTED,"your browser or platform is not support share-screen with audio");return n.onError(e),e.throw(On)}On.info("start create screen video track with config",e,"withAudio",t,"trackId",i);const d=c.supportShareAudio&&"disable"!==t;try{const e=await DA({screen:o,screenAudio:d?r||!0:void 0},i);s=e.getVideoTracks()[0]||null,a=e.getAudioTracks()[0]||null}catch(e){throw n.onError(e),e}if(!s){const e=new ni(ii.UNEXPECTED_ERROR,"can not find track in media stream");return n.onError(e),e.throw(On)}if(!a&&"enable"===t){s&&s.stop();const e=new ni(ii.SHARE_AUDIO_NOT_ALLOWED);return n.onError(e),e.throw(On)}if(e.optimizationMode||(e.optimizationMode="detail"),e.optimizationMode){tC(i,s,e,e.encoderConfig&&Vd(e.encoderConfig)||void 0),e.encoderConfig&&"string"!=typeof e.encoderConfig&&(e.encoderConfig.bitrateMin=e.encoderConfig.bitrateMax)}const u=new QO(s,e.encoderConfig?Vd(e.encoderConfig):{},e.scalabiltyMode?Fd(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,i,[Jd.SCREEN_TRACK]);if(!a)return n.onSuccess(u.getTrackId()),On.info("create screen video track success","video:",u.getTrackId()),u;const l=new $I(a,void 0,Fi(8,"track-scr-a-"),!1);return n.onSuccess([u.getTrackId(),l.getTrackId()]),On.info("create screen video track success","video:",u.getTrackId(),"audio:",l.getTrackId()),[u,l]},e.decodeAudioData=TA,e.detectSupportAudioElementSetSinkId=Qn,e.detectSupportAutCC=function(){return!!hn("FORCE_ENABLE_AUT_CC")||!qn()&&(!!hn("ENABLE_AUT_CC")||void 0)},e.detectSupportAutCCFeedback=function(){return!!hn("FORCE_ENABLE_AUT_CC")||!qn()&&(!!hn("ENABLE_AUT_FEEDBACK")||void 0)},e.detectSupportInstantVideo=function(e){return hn("ENABLE_INSTANT_VIDEO")?hn("ENABLE_INSTANT_VIDEO"):!(null==e||!e.autoSubscribe||hn("FORCE_DISABLE_AUTO_SUB"))},e.detectSupportPrePc=function(e){return!qn()&&!hn("USE_NEW_TOKEN")&&(!!hn("ENABLE_PREALLOC_PC")||!(null==e||!e.autoSubscribe||hn("FORCE_DISABLE_AUTO_SUB")))},e.detectSupportPreSub=function(e){return!(Vr()||function(e){const t=wr();return!(t.name!==Ir.CHROME||!t.osVersion)&&Number(t.version)<e}(87)||qn())&&(!!hn("ENABLE_PRE_SUB")||!(null==e||!e.autoSubscribe||hn("FORCE_DISABLE_AUTO_SUB")))},e.detectSupportRestrictOwnAudio=to,e.detectSupportSDPEndpoint=function(){return hn("ENABLE_JOIN_V4")},e.detectSupportSuppressLocalAudioPlayback=eo,e.deviceManager=UA,e.emptyImage2TypedArray=cI,e.frameData2CryptoBuffer=async(e,t,r)=>await aI(e.buffer,t,r),e.getAudioContext=EA,e.getAudioEncoderConfiguration=jd,e.getBitrateConstrainRange=oI,e.getBitrateFromResAndFps=sI,e.getCompatibility=Jn,e.getConstraintsFromAudioConfig=hb,e.getConstraintsFromCameraConfig=ub,e.getConstraintsFromMicrophoneConfig=fb,e.getConstraintsFromScreenAudioConfig=pb,e.getConstraintsFromScreenConfig=lb,e.getElectronScreenSources=CA,e.getElectronScreenStream=IA,e.getElectronScreenStreamByUserSelect=OA,e.getLocalStream=DA,e.getNewNearestVideoProfile=nI,e.getNewVideoBitrate=iI,e.getOriginSenderConfig=e=>{const t=e._encoderConfig;if(!t)return;const{frameRate:r,width:i,height:n}=e.getMediaStreamTrackSettings();let{frameRate:o=r,width:s=i,height:a=n}=t;if(!o||!s||!a)return;s=Ki(s),a=Ki(a),o=Ki(o);const{max:c,min:d}=sI(s,a,o),{bitrateMax:u,bitrateMin:l}=t||{};u||On.debug("calculate bitrate: [w: ".concat(s,", h: ").concat(a,", fps: ").concat(o,"] => [brMax: ").concat(u,", brMin: ").concat(l,"]"));const{maxFramerate:h}=hn("ENCODER_CONFIG_LIMIT");return h&&"number"==typeof h&&(o=Math.min(o,h)),{frameRate:o,bitrateMax:u||c,bitrateMin:l||d,scaleResolutionDownBy:1,scale:0}},e.getScalabilityConfiguration=Fd,e.getScreenEncoderConfiguration=Vd,e.getSilenceAudioTrack=function(){if(SA)return SA;const e=EA();if(!e.createMediaStreamDestination)throw new ni(ii.NOT_SUPPORTED,"can not create silence audio track");const t=e.createBufferSource(),r=e.createBuffer(1,44100,44100);t.loop=!0,t.buffer=r;const i=e.createMediaStreamDestination();return t.connect(i),SA=i.stream.getAudioTracks()[0],SA},e.getSilenceSamplesDuration=function(e){const t=e.getChannelData(0);let r=0,i=0;for(let e=0;e<t.length;e+=1)0===t[e]?(r+=1,r>i&&(i=r)):r=0;return i/t.length*e.duration},e.getStaticTrackStream=uI,e.getVideoEncoderConfiguration=xd,e.handleGetUserMediaError=LA,e.hasAudioContext=mA,e.hasMicrophoneTrack=Kd,e.interceptLocalAudioFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Jn().supportWebRTCEncodedTransform)return void On.warning("browser not support audio encoded transform");if(PP.has(e))return;if(!e.track)return;const r={track:e.track};if(Mr()){if(!e.createEncodedStreams)return void On.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void On.error("create audio-encoded-streams error",e&&e.message)}const o=new TransformStream({transform(n,o){r.controller||(r.controller=o),e.track&&e.track.id!==r.track.id&&(On.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i));const s=t.metadata&&t.metadata();s?LP(s,{sender:e,chunk:n,controller:o}):o.enqueue(n)}});n.readable.pipeThrough(o).pipeTo(n.writable)}else if(Ur()){if("undefined"==typeof RTCRtpScriptTransform)return void On.warning("browser not support RTCRtpScriptTransform");const n=AP(),o=new MessageChannel;await new oA((e=>n.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(n,{name:"audio-metadata-tx",port:o.port2},[o.port2]);e.transform=s,await new oA((e=>n.onmessage=t=>{"started"===t.data&&e(void 0)})),o.port1.onmessage=n=>{var s;if(n.data.transformed&&e.track&&(null===(s=e.track)||void 0===s?void 0:s.id)!==r.track.id)On.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i);else if(n.data.getMetadata){const e=t.metadata&&t.metadata();e&&o.port1.postMessage({metadata:e})}},r.worker=n}function i(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",i)}const t=PP.get(e);if(t){PP.delete(e);try{var r,n;null===(r=t.controller)||void 0===r||r.terminate(),null===(n=t.worker)||void 0===n||n.terminate()}catch(e){On.warning(e&&e.message)}}}PP.set(e,r),e.track.addEventListener("ended",i)},e.interceptLocalVideoFrame=async function(e,t){if(!Jn().supportWebRTCEncodedTransform)return void On.warning("browser not support video encoded transform");if(mL.has(e))return;if(!e.track)return;const r={track:e.track};if(Mr()){if(!e.createEncodedStreams)return void On.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void On.error("create video-encoded-streams error",e&&e.message)}const o=[];t.on("sei-to-send",(e=>{o.push(e)}));const s=new TransformStream({transform(t,n){r.controller||(r.controller=n),e.track&&e.track.id!==r.track.id&&(On.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i));const s=EL(new Uint8Array(t.data)),a=o.shift();if(a){const e=fL(t.data,a,s);e&&(t.data=e)}n.enqueue(t)}});n.readable.pipeThrough(s).pipeTo(n.writable)}else{if(!Ur())return;{if("undefined"==typeof RTCRtpScriptTransform)return void On.warning("browser not support RTCRtpScriptTransform");const n=AP(),o=new MessageChannel;await new oA((e=>n.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(n,{name:"sei-tx",port:o.port2},[o.port2]);e.transform=s,await new oA((e=>n.onmessage=t=>{"started"===t.data&&e(void 0)})),t.on("sei-to-send",(e=>{o.port1.postMessage({sei:e})})),o.port1.onmessage=t=>{var n;t.data.transformed&&e.track&&(null===(n=e.track)||void 0===n?void 0:n.id)!==r.track.id&&(On.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i))},r.worker=n}}function i(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",i)}const t=mL.get(e);if(t){mL.delete(e);try{var r,n;null===(r=t.controller)||void 0===r||r.terminate(),null===(n=t.worker)||void 0===n||n.terminate()}catch(e){On.warning(e&&e.message)}}}mL.set(e,r),e.track.addEventListener("ended",i)},e.interceptRemoteAudioFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Jn().supportWebRTCEncodedTransform)return void On.warning("browser not support audio encoded transform");if(sL.has(e))return;const r={track:e.track,onMetadata:t.onMetadata,onPts:t.onPts};if(Mr()&&!Fr()){if(!e.createEncodedStreams)return void On.warning("browser not support createEncodedStreams() API");jr(Ir.CHROME,87,116)||(t.enableTopn=!1);let n=null;try{n=e.createEncodedStreams()}catch(e){return void On.error("create audio-encoded-streams error",e&&e.message)}const o=new TransformStream({transform(n,o){r.controller||(r.controller=o),e.track&&e.track.id!==r.track.id&&(On.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i)),t.enableTopn?function(e,t,r){var i;const n=DP(new DataView(t.data));if(!n)return r.enqueue(t);const o=e.track.id;aL.set(o,e.track);const s=null===(i=n.tlv.find((e=>e.tag===wP.AUDIO_LEVEL)))||void 0===i?void 0:i.value;let a=0;"number"==typeof s&&(a=127-s);const c=Math.round(Math.pow(10,a/60)-1),{selected:d,speaker:u}=QP(e,c),l=nL(o,e.track,u.energyScore);l.addSample(d),l.active&&(t.data=n.frame.buffer,r.enqueue(t))}(e,n,o):t.enableMetadata||t.enablePts?cL(n,o,t.onMetadata,t.onPts):o.enqueue(n)}});n.readable.pipeThrough(o).pipeTo(n.writable)}else{if("undefined"==typeof RTCRtpScriptTransform)return void On.warning("browser not support RTCRtpScriptTransform");const t=AP(),n=new MessageChannel;await new oA((e=>t.onmessage=t=>{"registered"===t.data&&e(void 0)}));const o=new RTCRtpScriptTransform(t,{name:"audio-metadata-rx",port:n.port2},[n.port2]);e.transform=o,await new oA((e=>t.onmessage=t=>{"started"===t.data&&e(void 0)})),n.port1.onmessage=t=>{var n;t.data.transformed&&e.track&&(null===(n=e.track)||void 0===n?void 0:n.id)!==r.track.id?(On.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i)):t.data.metadata&&r.onMetadata?r.onMetadata(t.data.metadata):t.data.pts&&r.onPts&&r.onPts(t.data.pts)},r.worker=t}function i(){e.track.removeEventListener("ended",i),function(e){const t=sL.get(e);if(t){!function(e){const t=YP.get(e);t&&(YP.delete(e),zP&&(zP.removeSpeakers([t]),0===YP.size&&(zP.destroy(),zP=null)))}(e),oL(e.track.id),sL.delete(e);try{var r,i;null===(r=t.controller)||void 0===r||r.terminate(),null===(i=t.worker)||void 0===i||i.terminate()}catch(e){On.warning(e&&e.message)}}}(e)}sL.set(e,r),e.track.addEventListener("ended",i)},e.interceptRemoteVideoFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Jn().supportWebRTCEncodedTransform)return void On.warning("browser not support video encoded transform");if(!e.track)return;if(TL.has(e)){const r=TL.get(e);return void(r&&(r.onSei=t.onSei))}const r={track:e.track,onSei:t.onSei};if(Mr()){if(!e.createEncodedStreams)return void On.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void On.error("create video-encoded-streams error",e&&e.message)}const o=new TransformStream({transform(n,o){if(r.controller||(r.controller=o),!r.firstFrameInfo){var s;const e=n.getMetadata()||{};r.firstFrameInfo=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_L(Object(r),!0).forEach((function(t){H_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_L(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({type:n.type,rtpTimestamp:n.timestamp,payloadType:e.payloadType||0,ssrc:e.synchronizationSource||0,length:n.data.byteLength},"mimeType"in e?{mimeType:e.mimeType}:{}),null===(s=t.onFirstFrame)||void 0===s||s.call(t,r.firstFrameInfo)}e.track&&e.track.id!==r.track.id&&(On.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i));const a=hL(n,EL(new Uint8Array(n.data)));a&&r.onSei&&r.onSei(a),o.enqueue(n)}});n.readable.pipeThrough(o).pipeTo(n.writable)}else if(Ur()){if("undefined"==typeof RTCRtpScriptTransform)return void On.warning("browser not support RTCRtpScriptTransform");const n=AP(),o=new MessageChannel;await new oA((e=>n.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(n,{name:"sei-rx",port:o.port2},[o.port2]);e.transform=s,await new oA((e=>n.onmessage=t=>{"started"===t.data&&e(void 0)})),o.port1.onmessage=n=>{var o;if(n.data.transformed&&e.track&&(null===(o=e.track)||void 0===o?void 0:o.id)!==r.track.id)On.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",i),r.track=e.track,r.track.addEventListener("ended",i);else if(n.data.sei&&r.onSei)r.onSei(n.data.sei);else if(n.data.firstFrameInfo&&t.onFirstFrame){var s;null===(s=t.onFirstFrame)||void 0===s||s.call(t,n.data.firstFrameInfo)}},r.worker=n}function i(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",i)}!function(e){const t=TL.get(e);if(t){TL.delete(e);try{var r,i;null===(r=t.controller)||void 0===r||r.terminate(),null===(i=t.worker)||void 0===i||i.terminate()}catch(e){On.warning(e&&e.message)}}}(e)}TL.set(e,r),e.track.addEventListener("ended",i)},e.isAudioEncoderConfiguration=zd,e.isAudioEncoderConfigurationOrPreset=function(e){return"string"==typeof e?si(e,"profile",Object.keys(Bd)):zd(e),!0},e.isBeautyEffectOptions=function(e){return void 0!==e.smoothnessLevel&&ai(e.smoothnessLevel,"options.smoothnessLevel",0,1,!1),void 0!==e.lighteningLevel&&ai(e.lighteningLevel,"options.lighteningLevel",0,1,!1),void 0!==e.rednessLevel&&ai(e.rednessLevel,"options.rednessLevel",0,1,!1),void 0!==e.lighteningContrastLevel&&si(e.lighteningContrastLevel,"options.lighteningContrastLevel",[0,1,2]),!0},e.isElectron=Ei,e.isLowStreamParameter=function(e){if(!e)throw new ni(ii.INVALID_PARAMS);return di(e.width)||ci(e.width,"streamParameter.width"),di(e.height)||ci(e.height,"streamParameter.height"),di(e.framerate)||ci(e.framerate,"streamParameter.framerate"),di(e.bitrate)||ai(e.bitrate,"streamParameter.bitrate"),!0},e.isPlanB=qn,e.isScreenSourceType=Xd,e.isVideoEncoderConfiguration=Yd,e.isVideoEncoderConfigurationOrPreset=function(e){return"string"==typeof e?si(e,"profile",Object.keys(kd)):Yd(e),!0},e.polyfillAudioNode=_A,e.removeTrack=Hd,e.requestAutoplayGesture=FA,e.restartBackgroundTag=fA,e.silenceScriptProcessHandler=RA,e.updateAgoraRTCCompatibility=Zn,e.visibilityWatcher=SC}));
|