@agora-js/media 4.23.3 → 4.23.4-2

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * AgoraWebSDK_N-v4.23.3-0-g83bb9b5a-dirty Copyright AgoraInc.
2
+ * AgoraWebSDK_N-v4.23.4-2-0-gd7188994-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 m(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 E(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 v(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 v(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 R(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:v,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:m,shimMediaStream:E,shimOnTrack:_,shimPeerConnection:R,shimSenderReceiverGetStats:S});function O(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 I(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 k(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function P(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 L(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:P,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:L,shimGetUserMedia:O,shimOnTrack:I,shimPeerConnection:C,shimRTCDataChannel:k,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||!R||!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),m(e,i),E(e),R(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),O(e,i),C(e,i),I(e),D(e),w(e),N(e),k(e),P(e),L(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",m="console",E="mobile",_="tablet",T="smarttv",g="wearable",S="embedded",v="Amazon",y="Apple",R="ASUS",A="BlackBerry",b="Browser",O="Chrome",I="Firefox",C="Google",w="Huawei",N="LG",D="Microsoft",k="Motorola",P="Opera",L="Samsung",M="Sharp",U="Sony",x="Xiaomi",V="Zebra",F="Facebook",B="Chromium OS",j="Mac OS",G=" Browser",W=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},H=function(e,t){return typeof e===a&&-1!==K(t).indexOf(K(e))},K=function(e){return e.toLowerCase()},Y=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof t===o?e:e.substring(0,500)},z=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}},X=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(H(t[r][n],e))return"?"===r?i:r}else if(H(t[r],e))return"?"===r?i:r;return t.hasOwnProperty("*")?t["*"]:e},Z={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"},J={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,P+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[p,[u,P+" GX"]],[/\bopr\/([\w\.]+)/i],[p,[u,P]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[p,[u,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[p,[u,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[u,p],[/quark(?:pc)?\/([-\w\.]+)/i],[p,[u,"Quark"]],[/\bddg\/([\w\.]+)/i],[p,[u,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[u,"UC"+b]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[p,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[u,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[p,[u,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[p,[u,"Smart Lenovo "+b]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+b],p],[/\bfocus\/([\w\.]+)/i],[p,[u,I+" Focus"]],[/\bopt\/([\w\.]+)/i],[p,[u,P+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[u,P+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[u,"MIUI"+G]],[/fxios\/([\w\.-]+)/i],[p,[u,I]],[/\bqihoobrowser\/?([\w\.]*)/i],[p,[u,"360"]],[/\b(qq)\/([\w\.]+)/i],[[u,/(.+)/,"$1Browser"],p],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1"+G],p],[/samsungbrowser\/([\w\.]+)/i],[p,[u,L+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[p,[u,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[u,"Sogou Mobile"],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[u,p],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[u],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[p,u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,F],p],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[u,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[u,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[p,[u,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[u,O+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,O+" 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,X,{"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],[/(wolvic|librewolf)\/([\w\.]+)/i],[u,p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[u,I+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\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|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[u,[p,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[u,[p,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,K]],[/((?: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/,"",K]],[/(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,K]]],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,L],[l,_]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[d,[h,L],[l,E]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[d,[h,y],[l,E]],[/\((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,E]],[/(?:honor)([-\w ]+)[;\)]/i],[d,[h,"Honor"],[l,E]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[d,[h,w],[l,_]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[d,[h,w],[l,E]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[d,/_/g," "],[h,x],[l,E]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\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,E]],[/\b(opd2\d{3}a?) bui/i],[d,[h,"OPPO"],[l,_]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[d,[h,"Vivo"],[l,E]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[d,[h,"Realme"],[l,E]],[/\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,k],[l,E]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[d,[h,k],[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,E]],[/(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,E]],[/(pixel c)\b/i],[d,[h,C],[l,_]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[d,[h,C],[l,E]],[/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,E]],[/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,E]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[d,[h,v],[l,_]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[d,/(.+)/g,"Fire Phone $1"],[h,v],[l,E]],[/(playbook);[-\w\),; ]+(rim)/i],[d,h,[l,_]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[d,[h,A],[l,E]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[d,[h,R],[l,_]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[d,[h,R],[l,E]],[/(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,E]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[d,[h,"TCL"],[l,_]],[/(itel) ((\w+))/i],[[h,K],d,[l,X,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/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,E]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[d,[h,"Ulefone"],[l,E]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[d,[h,"Energizer"],[l,E]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[d,[h,"Cat"],[l,E]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[d,[h,"Smartfren"],[l,E]],[/droid.+; (a(?:015|06[35]|142p?))/i],[d,[h,"Nothing"],[l,E]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[h,d,[l,E]],[/(imo) (tab \w+)/i,/(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,E]],[/(u304aa)/i],[d,[h,"AT&T"],[l,E]],[/\bsie-(\w*)/i],[d,[h,"Siemens"],[l,E]],[/\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,E]],[/\b(gen\d{3}) b.+49h/i],[d,[h,"Swiss"],[l,E]],[/\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,E]],[/\b(lvtel\-)?(v1[12]) b/i],[[h,"LvTel"],d,[l,E]],[/\b(ph-1) /i],[d,[h,"Essential"],[l,E]],[/\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,E]],[/(kin\.[onetw]{3})/i],[[d,/\./g," "],[h,D],[l,E]],[/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,E]],[/smart-tv.+(samsung)/i],[h,[l,T]],[/hbbtv.+maple;(\d+)/i],[[d,/^/,"SmartTV"],[h,L],[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,O+"cast"],[h,C],[l,T]],[/droid.+aft(\w+)( bui|\))/i],[d,[h,v],[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,Y],[d,Y],[l,T]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,T]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[h,d,[l,m]],[/droid.+; (shield) bui/i],[d,[h,"Nvidia"],[l,m]],[/(playstation [345portablevi]+)/i],[d,[h,U],[l,m]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[d,[h,D],[l,m]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[d,[h,L],[l,g]],[/((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]],[/droid.+; (glass) \d/i],[d,[h,C],[l,g]],[/(pico) (4|neo3(?: link|pro)?)/i],[h,d,[l,g]],[/; (quest( \d| pro)?)/i],[d,[h,F],[l,g]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[h,[l,S]],[/(aeobc)\b/i],[d,[h,v],[l,S]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[d,[l,E]],[/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,E]],[/(android[-\w\. ]{0,9});.+buil/i],[d,[h,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[u,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[u,p],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[u,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,p],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[u,[p,X,Z]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[p,X,Z],[u,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/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|openharmony)[-\/ ]?([\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,I+" 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,O+"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|serenityos)/i,/(unix) ?([\w\.]*)/i],[u,p]]},Q=function(e,t){if(typeof e===s&&(t=e,e=i),!(this instanceof Q))return new Q(e,t).getResult();var m=typeof r!==o&&r.navigator?r.navigator:i,T=e||(m&&m.userAgent?m.userAgent:""),g=m&&m.userAgentData?m.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}(J,t):J,v=m&&m.userAgent==T;return this.getBrowser=function(){var e={};return e[u]=i,e[p]=i,z.call(e,T,S.browser),e[c]=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:i}(e[p]),v&&m&&m.brave&&typeof m.brave.isBrave==n&&(e[u]="Brave"),e},this.getCPU=function(){var e={};return e[f]=i,z.call(e,T,S.cpu),e},this.getDevice=function(){var e={};return e[h]=i,e[d]=i,e[l]=i,z.call(e,T,S.device),v&&!e[l]&&g&&g.mobile&&(e[l]=E),v&&"Macintosh"==e[d]&&m&&typeof m.standalone!==o&&m.maxTouchPoints&&m.maxTouchPoints>2&&(e[d]="iPad",e[l]=_),e},this.getEngine=function(){var e={};return e[u]=i,e[p]=i,z.call(e,T,S.engine),e},this.getOS=function(){var e={};return e[u]=i,e[p]=i,z.call(e,T,S.os),v&&!e[u]&&g&&g.platform&&"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>500?Y(e,500):e,this},this.setUA(T),this};Q.VERSION="0.7.40",Q.BROWSER=W([u,p,c]),Q.CPU=W([f]),Q.DEVICE=W([d,h,l,m,E,T,_,g,S]),Q.ENGINE=Q.OS=W([u,p]),e.exports&&(t=e.exports=Q),t.UAParser=Q;var q=typeof r!==o&&(r.jQuery||r.Zepto);if(q&&!q.ua){var $=new Q;q.ua=$.getResult(),q.ua.get=function(){return $.getUA()},q.ua.set=function(e){$.setUA(e);var t=$.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:me}=Symbol,Ee=(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=>Ee(t)===e),Te=e=>t=>typeof t===e,{isArray:ge}=Array,Se=Te("undefined");const ve=_e("ArrayBuffer");const ye=Te("string"),Re=Te("function"),Ae=Te("number"),be=e=>null!==e&&"object"==typeof e,Oe=e=>{if("object"!==Ee(e))return!1;const t=pe(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||me in e||fe in e)},Ie=_e("Date"),Ce=_e("File"),we=_e("Blob"),Ne=_e("FileList"),De=_e("URLSearchParams"),[ke,Pe,Le,Me]=["ReadableStream","Request","Response","Headers"].map(_e);function Ue(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{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 xe(e,t){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 Ve="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Fe=e=>!Se(e)&&e!==Ve;const Be=(je="undefined"!=typeof Uint8Array&&pe(Uint8Array),e=>je&&e instanceof je);var je;const Ge=_e("HTMLFormElement"),We=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),He=_e("RegExp"),Ke=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),i={};Ue(r,((r,n)=>{let o;!1!==(o=t(r,n,e))&&(i[n]=o||r)})),Object.defineProperties(e,i)};const Ye=_e("AsyncFunction"),ze=(Xe="function"==typeof setImmediate,Ze=Re(Ve.postMessage),Xe?setImmediate:Ze?(Je=`axios@${Math.random()}`,Qe=[],Ve.addEventListener("message",(({source:e,data:t})=>{e===Ve&&t===Je&&Qe.length&&Qe.shift()()}),!1),e=>{Qe.push(e),Ve.postMessage(Je,"*")}):e=>setTimeout(e));var Xe,Ze,Je,Qe;const qe="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Ve):"undefined"!=typeof process&&process.nextTick||ze;var $e={isArray:ge,isArrayBuffer:ve,isBuffer:function(e){return null!==e&&!Se(e)&&null!==e.constructor&&!Se(e.constructor)&&Re(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Re(e.append)&&("formdata"===(t=Ee(e))||"object"===t&&Re(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&ve(e.buffer),t},isString:ye,isNumber:Ae,isBoolean:e=>!0===e||!1===e,isObject:be,isPlainObject:Oe,isReadableStream:ke,isRequest:Pe,isResponse:Le,isHeaders:Me,isUndefined:Se,isDate:Ie,isFile:Ce,isBlob:we,isRegExp:He,isFunction:Re,isStream:e=>be(e)&&Re(e.pipe),isURLSearchParams:De,isTypedArray:Be,isFileList:Ne,forEach:Ue,merge:function e(){const{caseless:t}=Fe(this)&&this||{},r={},i=(i,n)=>{const o=t&&xe(r,n)||n;Oe(r[o])&&Oe(i)?r[o]=e(r[o],i):Oe(i)?r[o]=e({},i):ge(i)?r[o]=i.slice():r[o]=i};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Ue(arguments[e],i);return r},extend:(e,t,r,{allOwnKeys:i}={})=>(Ue(t,((t,i)=>{r&&Re(t)?e[i]=le(t,r):e[i]=t}),{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),e.prototype.constructor=e,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:Ee,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(!Ae(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:Ge,hasOwnProperty:We,hasOwnProp:We,reduceDescriptors:Ke,freezeMethods:e=>{Ke(e,((t,r)=>{if(Re(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const i=e[r];Re(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:xe,global:Ve,isContextDefined:Fe,isSpecCompliantForm:function(e){return!!(e&&Re(e.append)&&"FormData"===e[me]&&e[fe])},toJSONObject:e=>{const t=new Array(10),r=(e,i)=>{if(be(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[i]=e;const n=ge(e)?[]:{};return Ue(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:Ye,isThenable:e=>e&&(be(e)||Re(e))&&Re(e.then)&&Re(e.catch),setImmediate:ze,asap:qe,isIterable:e=>null!=e&&Re(e[fe])};function et(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}$e.inherits(et,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:$e.toJSONObject(this.config),code:this.code,status:this.status}}});const tt=et.prototype,rt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{rt[e]={value:e}})),Object.defineProperties(et,rt),Object.defineProperty(tt,"isAxiosError",{value:!0}),et.from=(e,t,r,i,n,o)=>{const s=Object.create(tt);return $e.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),et.call(s,e.message,t,r,i,n),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};function it(e){return $e.isPlainObject(e)||$e.isArray(e)}function nt(e){return $e.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=$e.toFlatObject($e,{},null,(function(e){return/^is[A-Z]/.test(e)}));function at(e,t,r){if(!$e.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const i=(r=$e.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!$e.isUndefined(t[e])}))).metaTokens,n=r.visitor||d,o=r.dots,s=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&$e.isSpecCompliantForm(t);if(!$e.isFunction(n))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if($e.isDate(e))return e.toISOString();if(!a&&$e.isBlob(e))throw new et("Blob is not supported. Use a Buffer instead.");return $e.isArrayBuffer(e)||$e.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($e.endsWith(r,"{}"))r=i?r:r.slice(0,-2),e=JSON.stringify(e);else if($e.isArray(e)&&function(e){return $e.isArray(e)&&!e.some(it)}(e)||($e.isFileList(e)||$e.endsWith(r,"[]"))&&(a=$e.toArray(e)))return r=nt(r),a.forEach((function(e,i){!$e.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(!$e.isObject(e))throw new TypeError("data must be an object");return function e(r,i){if(!$e.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+i.join("."));u.push(r),$e.forEach(r,(function(r,o){!0===(!($e.isUndefined(r)||null===r)&&n.call(t,r,$e.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,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ht(e,t,r){if(!t)return e;const i=r&&r.encode||lt;$e.isFunction(r)&&(r={serialize:r});const n=r&&r.serialize;let o;if(o=n?n(t,r):$e.isURLSearchParams(t)?t.toString():new dt(t,r).toString(i),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}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){$e.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},ft={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},mt={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 Et="undefined"!=typeof window&&"undefined"!=typeof document,_t="object"==typeof navigator&&navigator||void 0,Tt=Et&&(!_t||["ReactNative","NativeScript","NS"].indexOf(_t.product)<0),gt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,St=Et&&window.location.href||"http://localhost";var vt={...Object.freeze({__proto__:null,hasBrowserEnv:Et,hasStandardBrowserEnv:Tt,hasStandardBrowserWebWorkerEnv:gt,navigator:_t,origin:St}),...mt};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&&$e.isArray(i)?i.length:o,a)return $e.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!s;i[o]&&$e.isObject(i[o])||(i[o]=[]);return t(e,r,i[o],n)&&$e.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($e.isFormData(e)&&$e.isFunction(e.entries)){const r={};return $e.forEachEntry(e,((e,i)=>{t(function(e){return $e.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),i,r,0)})),r}return null}const Rt={transitional:ft,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,n=$e.isObject(e);n&&$e.isHTMLForm(e)&&(e=new FormData(e));if($e.isFormData(e))return i?JSON.stringify(yt(e)):e;if($e.isArrayBuffer(e)||$e.isBuffer(e)||$e.isStream(e)||$e.isFile(e)||$e.isBlob(e)||$e.isReadableStream(e))return e;if($e.isArrayBufferView(e))return e.buffer;if($e.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 vt.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,i){return vt.isNode&&$e.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((o=$e.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($e.isString(e))try{return(t||JSON.parse)(e),$e.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Rt.transitional,r=t&&t.forcedJSONParsing,i="json"===this.responseType;if($e.isResponse(e)||$e.isReadableStream(e))return e;if(e&&$e.isString(e)&&(r&&!this.responseType||i)){const r=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw et.from(e,et.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}}};$e.forEach(["delete","get","head","post","put","patch"],(e=>{Rt.headers[e]={}}));var At=Rt;const bt=$e.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 Ot=Symbol("internals");function It(e){return e&&String(e).trim().toLowerCase()}function Ct(e){return!1===e||null==e?e:$e.isArray(e)?e.map(Ct):String(e)}function wt(e,t,r,i,n){return $e.isFunction(i)?i.call(this,t,r):(n&&(t=r),$e.isString(t)?$e.isString(i)?-1!==t.indexOf(i):$e.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=It(t);if(!n)throw new Error("header name must be a non-empty string");const o=$e.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)=>$e.forEach(e,((e,r)=>n(e,r,t)));if($e.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if($e.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($e.isObject(e)&&$e.isIterable(e)){let r,i,n={};for(const t of e){if(!$e.isArray(t))throw TypeError("Object iterator must return a key-value pair");n[i=t[0]]=(r=n[i])?$e.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=It(e)){const r=$e.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($e.isFunction(t))return t.call(this,e,r);if($e.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=It(e)){const r=$e.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=It(e)){const n=$e.findKey(r,e);!n||t&&!wt(0,r[n],n,t)||(delete r[n],i=!0)}}return $e.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 $e.forEach(this,((i,n)=>{const o=$e.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 $e.forEach(this,((r,i)=>{null!=r&&!1!==r&&(t[i]=e&&$e.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[Ot]=this[Ot]={accessors:{}}).accessors,r=this.prototype;function i(e){const i=It(e);t[i]||(!function(e,t){const r=$e.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 $e.isArray(e)?e.forEach(i):i(e),this}}Nt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),$e.reduceDescriptors(Nt.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),$e.freezeMethods(Nt);var Dt=Nt;function kt(e,t){const r=this||At,i=t||r,n=Dt.from(i.headers);let o=i.data;return $e.forEach(e,(function(e){o=e.call(r,o,n.normalize(),t?t.status:void 0)})),n.normalize(),o}function Pt(e){return!(!e||!e.__CANCEL__)}function Lt(e,t,r){et.call(this,null==e?"canceled":e,et.ERR_CANCELED,t,r),this.name="CanceledError"}function Mt(e,t,r){const i=r.config.validateStatus;r.status&&i&&!i(r.status)?t(new et("Request failed with status code "+r.status,[et.ERR_BAD_REQUEST,et.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}$e.inherits(Lt,et,{__CANCEL__:!0});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.apply(null,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)=>$e.asap((()=>e(...t)));var Ft=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,Bt=vt.hasStandardBrowserEnv?{write(e,t,r,i,n,o){const s=[e+"="+encodeURIComponent(t)];$e.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),$e.isString(i)&&s.push("path="+i),$e.isString(n)&&s.push("domain="+n),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):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 $e.isPlainObject(e)&&$e.isPlainObject(t)?$e.merge.call({caseless:i},e,t):$e.isPlainObject(t)?$e.merge({},t):$e.isArray(t)?t.slice():t}function n(e,t,r,n){return $e.isUndefined(t)?$e.isUndefined(e)?void 0:i(void 0,e,0,n):i(e,t,0,n)}function o(e,t){if(!$e.isUndefined(t))return i(void 0,t)}function s(e,t){return $e.isUndefined(t)?$e.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 $e.forEach(Object.keys(Object.assign({},e,t)),(function(i){const o=c[i]||n,s=o(e[i],t[i],i);$e.isUndefined(s)&&o!==a||(r[i]=s)})),r}var Ht=e=>{const t=Wt({},e);let r,{data:i,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:s,headers:a,auth:c}=t;if(t.headers=a=Dt.from(a),t.url=ht(jt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),$e.isFormData(i))if(vt.hasStandardBrowserEnv||vt.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(r=a.getContentType())){const[e,...t]=r?r.split(";").map((e=>e.trim())).filter(Boolean):[];a.setContentType([e||"multipart/form-data",...t].join("; "))}if(vt.hasStandardBrowserEnv&&(n&&$e.isFunction(n)&&(n=n(t)),n||!1!==n&&Ft(t.url))){const e=o&&s&&Bt.read(s);e&&a.set(o,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 m=new XMLHttpRequest;function E(){if(!m)return;const i=Dt.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Mt((function(e){t(e),f()}),(function(e){r(e),f()}),{data:l&&"text"!==l&&"json"!==l?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:i,config:e,request:m}),m=null}m.open(i.method.toUpperCase(),i.url,!0),m.timeout=i.timeout,"onloadend"in m?m.onloadend=E:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(E)},m.onabort=function(){m&&(r(new et("Request aborted",et.ECONNABORTED,e,m)),m=null)},m.onerror=function(){r(new et("Network Error",et.ERR_NETWORK,e,m)),m=null},m.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 et(t,n.clarifyTimeoutError?et.ETIMEDOUT:et.ECONNABORTED,e,m)),m=null},void 0===n&&o.setContentType(null),"setRequestHeader"in m&&$e.forEach(o.toJSON(),(function(e,t){m.setRequestHeader(t,e)})),$e.isUndefined(i.withCredentials)||(m.withCredentials=!!i.withCredentials),l&&"json"!==l&&(m.responseType=i.responseType),p&&([c,u]=Ut(p,!0),m.addEventListener("progress",c)),h&&m.upload&&([a,d]=Ut(h),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",d)),(i.cancelToken||i.signal)&&(s=t=>{m&&(r(!t||t.type?new Lt(null,e,m):t),m.abort(),m=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 et("Unsupported protocol "+_+":",et.ERR_BAD_REQUEST,e)):m.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 et?t:new Lt(t instanceof Error?t.message:t))}};let o=t&&setTimeout((()=>{o=null,n(new et(`timeout ${t} of ms exceeded`,et.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=()=>$e.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})},Jt="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Qt=Jt&&"function"==typeof ReadableStream,qt=Jt&&("function"==typeof TextEncoder?($t=new TextEncoder,e=>$t.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var $t;const er=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},tr=Qt&&er((()=>{let e=!1;const t=new Request(vt.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),rr=Qt&&er((()=>$e.isReadableStream(new Response("").body))),ir={stream:rr&&(e=>e.body)};var nr;Jt&&(nr=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!ir[e]&&(ir[e]=$e.isFunction(nr[e])?t=>t[e]():(t,r)=>{throw new et(`Response type '${e}' is not supported`,et.ERR_NOT_SUPPORT,r)})})));const or=async(e,t)=>{const r=$e.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if($e.isBlob(e))return e.size;if($e.isSpecCompliantForm(e)){const t=new Request(vt.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return $e.isArrayBufferView(e)||$e.isArrayBuffer(e)?e.byteLength:($e.isURLSearchParams(e)&&(e+=""),$e.isString(e)?(await qt(e)).byteLength:void 0)})(t):r};var sr=Jt&&(async e=>{let{url:t,method:r,data:i,signal:n,cancelToken:o,timeout:s,onDownloadProgress:a,onUploadProgress:c,responseType:d,headers:u,withCredentials:l="same-origin",fetchOptions:h}=Ht(e);d=d?(d+"").toLowerCase():"text";let p,f=Yt([n,o&&o.toAbortSignal()],s);const m=f&&f.unsubscribe&&(()=>{f.unsubscribe()});let E;try{if(c&&tr&&"get"!==r&&"head"!==r&&0!==(E=await or(u,i))){let e,r=new Request(t,{method:"POST",body:i,duplex:"half"});if($e.isFormData(i)&&(e=r.headers.get("content-type"))&&u.setContentType(e),r.body){const[e,t]=xt(E,Ut(Vt(c)));i=Zt(r.body,65536,e,t)}}$e.isString(l)||(l=l?"include":"omit");const n="credentials"in Request.prototype;p=new Request(t,{...h,signal:f,method:r.toUpperCase(),headers:u.normalize().toJSON(),body:i,duplex:"half",credentials:n?l:void 0});let o=await fetch(p);const s=rr&&("stream"===d||"response"===d);if(rr&&(a||s&&m)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=o[t]}));const t=$e.toFiniteNumber(o.headers.get("content-length")),[r,i]=a&&xt(t,Ut(Vt(a),!0))||[];o=new Response(Zt(o.body,65536,r,(()=>{i&&i(),m&&m()})),e)}d=d||"text";let _=await ir[$e.findKey(ir,d)||"text"](o,e);return!s&&m&&m(),await new Promise(((t,r)=>{Mt(t,r,{data:_,headers:Dt.from(o.headers),status:o.status,statusText:o.statusText,config:e,request:p})}))}catch(t){if(m&&m(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new et("Network Error",et.ERR_NETWORK,e,p),{cause:t.cause||t});throw et.from(t,t&&t.code,e,p)}});const ar={http:null,xhr:Kt,fetch:sr};$e.forEach(ar,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const cr=e=>`- ${e}`,dr=e=>$e.isFunction(e)||null===e||!1===e;var ur={getAdapter:e=>{e=$e.isArray(e)?e:[e];const{length:t}=e;let r,i;const n={};for(let o=0;o<t;o++){let t;if(r=e[o],i=r,!dr(r)&&(i=ar[(t=String(r)).toLowerCase()],void 0===i))throw new et(`Unknown adapter '${t}'`);if(i)break;n[t||"#"+o]=i}if(!i){const e=Object.entries(n).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new et("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(cr).join("\n"):" "+cr(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return i},adapters:ar};function lr(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Lt(null,e)}function hr(e){lr(e),e.headers=Dt.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 ur.getAdapter(e.adapter||At.adapter)(e).then((function(t){return lr(e),t.data=kt.call(e,e.transformResponse,t),t.headers=Dt.from(t.headers),t}),(function(t){return Pt(t)||(lr(e),t&&t.response&&(t.response.data=kt.call(e,e.transformResponse,t.response),t.response.headers=Dt.from(t.response.headers))),Promise.reject(t)}))}const pr="1.9.0",fr={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{fr[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const mr={};fr.transitional=function(e,t,r){function i(e,t){return"[Axios v"+pr+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,n,o)=>{if(!1===e)throw new et(i(n," has been removed"+(t?" in "+t:"")),et.ERR_DEPRECATED);return t&&!mr[n]&&(mr[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)}},fr.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 et("options must be an object",et.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 et("option "+o+" must be "+r,et.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new et("Unknown option "+o,et.ERR_BAD_OPTION)}},validators:fr};const _r=Er.validators;let Tr=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&&Er.assertOptions(r,{silentJSONParsing:_r.transitional(_r.boolean),forcedJSONParsing:_r.transitional(_r.boolean),clarifyTimeoutError:_r.transitional(_r.boolean)},!1),null!=i&&($e.isFunction(i)?t.paramsSerializer={serialize:i}:Er.assertOptions(i,{encode:_r.function,serialize:_r.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Er.assertOptions(t,{baseUrl:_r.spelling("baseURL"),withXsrfToken:_r.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=n&&$e.merge(n.common,n[t.method]);n&&$e.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=[hr.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,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=0;l<u;){const e=s[l++],t=s[l++];try{h=e(h)}catch(e){t.call(this,e);break}}try{d=hr.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)}};$e.forEach(["delete","get","head","options"],(function(e){Tr.prototype[e]=function(t,r){return this.request(Wt(r||{},{method:e,url:t,data:(r||{}).data}))}})),$e.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}))}}Tr.prototype[e]=t(),Tr.prototype[e+"Form"]=t(!0)}));var gr=Tr;class Sr{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 Lt(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 Sr((function(t){e=t})),cancel:e}}}var vr=Sr;const yr={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};Object.entries(yr).forEach((([e,t])=>{yr[t]=e}));var Rr=yr;const Ar=function e(t){const r=new gr(t),i=le(gr.prototype.request,r);return $e.extend(i,gr.prototype,r,{allOwnKeys:!0}),$e.extend(i,r,null,{allOwnKeys:!0}),i.create=function(r){return e(Wt(t,r))},i}(At);Ar.Axios=gr,Ar.CanceledError=Lt,Ar.CancelToken=vr,Ar.isCancel=Pt,Ar.VERSION=pr,Ar.toFormData=at,Ar.AxiosError=et,Ar.Cancel=Ar.CanceledError,Ar.all=function(e){return Promise.all(e)},Ar.spread=function(e){return function(t){return e.apply(null,t)}},Ar.isAxiosError=function(e){return $e.isObject(e)&&!0===e.isAxiosError},Ar.mergeConfig=Wt,Ar.AxiosHeaders=Dt,Ar.formToJSON=e=>yt($e.isHTMLForm(e)?new FormData(e):e),Ar.getAdapter=ur.getAdapter,Ar.HttpStatusCode=Rr,Ar.default=Ar;var br=Ar;let Or=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 Cr=new ue;let wr=Cr.getResult(),Nr=null;function Dr(e){if(!Nr){e&&Cr.setUA(e),wr=Cr.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||""}}(wr),r=kr(wr),i=function(e){return"Windows"===e.os.name?e.os.version?e.os.name+" "+e.os.version:e.os.name:e.os.name||""}(wr),n=wr.os.version,o=kr(wr,!1),s=wr.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 kr(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 Dr().os}function Lr(){const e=Dr();return"".concat(e.os," ").concat(e.osVersion)}function Mr(){const e=Dr();return!!("WebKit"===wr.engine.name&&e.os===Or.MAC_OS&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0&&e.name!==Ir.SAFARI||Br()&&e.name!==Ir.SAFARI)}function Ur(){return Dr().name===Ir.CHROME}function xr(){return Dr().name===Ir.SAFARI}function Vr(){return Dr().name===Ir.EDGE}function Fr(){return Dr().name===Ir.FIREFOX}function Br(){return Dr().os===Or.IOS}function jr(e){const t=Dr();return!(t.name!==Ir.CHROME||!t.osVersion)&&Number(t.version)>=e}function Gr(e,t,r){const i=Dr();return!(i.name!==e||!i.osVersion)&&(r?Number(i.version)>=t&&Number(i.version)<=r:Number(i.version)===t)}function Wr(e){const t=Dr();return!(t.name!==Ir.EDGE||!t.osVersion)&&Number(t.version)>=e}function Hr(e){const t=Dr();return!(t.name!==Ir.OPERA||!t.osVersion)&&Number(t.version)>=e}function Kr(){const e=Dr();if(e.os!==Or.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])}function Yr(){const e=Dr();if(e.os!==Or.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 16===Number(t[0])}function zr(){const e=Dr();if(e.os!==Or.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=1}function Xr(){return xr()&&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}=Dr();return"mobile"===e||"tablet"===e}()||e===Or.ANDROID||e===Or.IOS||e===Or.HARMONY_OS}function Qr(){const e=Dr();return e.name!==Ir.EDGE&&e.name!==Ir.SAFARI&&!!navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]./i)}function qr(){return Pr()===Or.ANDROID}function $r(){const e=Dr();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.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 mi(){return!!_i()}let Ei=null;function _i(){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 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}({}),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"}({}),function(e){e.PEERCONNECTION_STATE_CHANGE="peerconnection-state-change",e.AUDIO_METADATA="audio-metadata",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"}({}),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}({}),vi=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 Ri(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(vi.NETWORK_STATE_CHANGE,e,this._networkState),e===Si.ONLINE?this.emit(vi.ONLINE):e===Si.OFFLINE&&(this.onlineWaiter=new Promise((e=>{this.once(vi.ONLINE,(()=>{this.onlineWaiter=void 0,e(Si.ONLINE)}))})),this.emit(vi.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}))}};function Oi(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}function Ii(e){"undefined"!=typeof Promise?Promise.resolve().then(e):setTimeout(e,0)}function Ci(e){return JSON.parse(JSON.stringify(e))}function wi(e){try{return Ci(e)}catch(t){return e}}const Ni={};function Di(e,t){Ni[t]||(Ni[t]=!0,e())}function ki(e){return window.TextEncoder?(new TextEncoder).encode(e).length:e.length}function Pi(e){return new Promise((t=>{window.setTimeout(t,e)}))}function Li(){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)+Li(e-r.length,"")}const Mi=()=>{},Ui=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})}}},xi=Ui.throttleByKey.bind(Ui);function Vi(e){return"object"==typeof e&&null!==e&&!(e instanceof RegExp)}function Fi(e,t){if(!Vi(e)||!Vi(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]=Fi(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]=Fi(e[i],t[i]):r[i]=t[i]);return r}}function Bi(e){return"number"==typeof e?e:e.exact||e.ideal||e.max||e.min||0}function ji(e){return e.reduce(((e,t)=>e+t),0)}let Gi=1,Wi=console;class Hi{static setLogger(e){Wi=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=Gi++,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:"");Wi.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 Ki(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 Yi={timeout:500,timeoutFactor:1.5,maxRetryCount:1/0,maxRetryTimeout:1e4};function zi(e,t,r,i){const n=Object.assign({},Yi,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 Xi=0,Zi=0;function Ji(e,t,r,i){return new Promise(((n,o)=>{t.responseType=t.responseType||"json",t.data&&!r?(t.data=JSON.stringify(t.data),Xi+=ki(t.data)):r&&(t.data.size?Xi+=t.data.size:t.data instanceof FormData?Xi+=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?ki(e):e.size})),t+138}(t.data):Xi+=ki(JSON.stringify(t.data))),t.headers=t.headers||{},t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json",t.method="POST",t.url=e,br.request(t).then((e=>{"string"==typeof e.data?Zi+=ki(e.data):e.data instanceof ArrayBuffer||e.data instanceof Uint8Array?Zi+=e.data.byteLength:Zi+=ki(JSON.stringify(e.data)),i&&n({data:e.data,headers:e.headers}),n(e.data)})).catch((e=>{br.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 Qi(e,t){const r=new Blob([t.data],{type:"buffer"});return await Ji(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 qi=function(e){return e[e.kNone=1]="kNone",e[e.kMillisecondsFromSeconds=1e3]="kMillisecondsFromSeconds",e[e.kBytesToBits=8]="kBytesToBits",e}(qi||{});const $i="websdk_ng_install_id";function en(){try{if(an("INSTALL_ID"))return an("INSTALL_ID");let e=window.localStorage.getItem($i);return e||(e=Li(32,"").toUpperCase(),window.localStorage.setItem($i,e)),sn("INSTALL_ID",e),e}catch(e){return}}const tn=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.23.3"),rn=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 nn=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=nn;const on=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:!1,ICE_RESTART_INTERVAL:1e4,RESTART_SEQUENCE:["udp_tcp_relay","relay"],FIRST_TCP_CANDIDATE:!1,FIRST_TCP_CANDIDATE_INTERVAL:1e3,TURN_DOMAIN:"edge.agora.io",USE_TURN_IP:!1,NEW_TURN_MODE:void 0,NEW_FORCE_TURN:!1,USE_NEW_RENDER_FREEZE_TIME:!1}),{},{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,PRELOAD_MEDIA_COUNT:0,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_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_METADATA:!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_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,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:[],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:!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:2,ENABLE_AUT_FEEDBACK:!1,SVC_EXTENDED:["VP9"]}),{},{USE_CANDIDATE_FROM_AP_DETAIL:!1,AP_REQUEST_DETAIL:void 0,ENABLE_ROLE_SELECT_EDGE:!1,CLIENT_ROLE_OPTIONS: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},{INSTALL_ID:""}),{},{K_MIN_RENDER_DELAY:66,USE_STANDARD_BITRATE_DEFAULT:!1,VIDEO_NEW_BITRATE_RATIO:void 0,VIDEO_STANDARD_BITRATE_VERSION:void 0,BASELINE_MORE_H264_BITRATE_RATIO:1.1});function sn(e,t,r){var i;Object.keys(on).includes(e)&&(!r&&Object.keys(cn).includes(e)||(on[e]=t,"ENABLE_VIDEO_SEI"!==e&&"ENABLE_AUDIO_TOPN"!==e&&"ENABLE_AUDIO_METADATA"!==e&&"ENABLE_AUDIO_PTS_METADATA"!==e||!0!==t||(on.ENABLE_ENCODED_TRANSFORM=!0,"ENABLE_AUDIO_PTS_METADATA"===e&&(on.ENABLE_AUDIO_METADATA=!0)),"USE_NEW_NETWORK_CONFIG"===e&&t&&(i=!!t,on.USE_NEW_NETWORK_CONFIG=i,i&&(on.WEBCS_DOMAIN=["webrtc2-2.ap.sd-rtn.com"],on.WEBCS_DOMAIN_BACKUP_LIST=["webrtc2-4.ap.sd-rtn.com"],on.CDS_AP=["cds-web-2.ap.sd-rtn.com","cds-web-4.ap.sd-rtn.com"],on.ACCOUNT_REGISTER=["sua-web-2.ap.sd-rtn.com","sua-web-4.ap.sd-rtn.com"],on.EVENT_REPORT_DOMAIN="web-2.statscollector.sd-rtn.com",on.EVENT_REPORT_BACKUP_DOMAIN="statscollector-1.agora.io",on.GATEWAY_DOMAINS=["edge.sd-rtn.com"])),"ENABLE_PRE_SUB"===e&&t&&(on.ENABLE_INSTANT_VIDEO=!0,on.ENABLE_PREALLOC_PC=!0),"ENABLE_SVC"===e&&t&&(on.ENABLE_AUT_CC=!0),"NEW_FORCE_TURN"===e&&t&&(on.NEW_TURN_MODE||(on.NEW_TURN_MODE=4))))}function an(e){return on[e]}rn||(on.WEBCS_DOMAIN=["ap-web-1-oversea.agora.io","ap-web-1-north-america.agora.io"],on.WEBCS_DOMAIN_BACKUP_LIST=["ap-web-2-oversea.agora.io","ap-web-2-north-america.agora.io"],on.PROXY_CS=["proxy-ap-web-oversea.agora.io","proxy-ap-web-america.agora.io"],on.CDS_AP=["cds-ap-web-oversea.agora.io","cds-ap-web-america.agora.io","cds-ap-web-america2.agora.io"],on.ACCOUNT_REGISTER=["sua-ap-web-oversea.agora.io","sua-ap-web-america.agora.io","sua-ap-web-america2.agora.io"],on.UAP_AP=["uap-ap-web-oversea.agora.io","uap-ap-web-america.agora.io","uap-ap-web-america2.agora.io"],on.LOG_UPLOAD_SERVER="logservice-oversea.agora.io",on.EVENT_REPORT_DOMAIN="statscollector-1-oversea.agora.io",on.EVENT_REPORT_BACKUP_DOMAIN="statscollector-2-oversea.agora.io",on.PROXY_SERVER_TYPE3="webrtc-cloud-proxy.agora.io",on.AREAS=["NORTH_AMERICA","OVERSEA"]),function(e){e[e.REALTIME=1]="REALTIME"}({});const cn={};var dn=function(e){return e.SET_SESSION_ID="SET_SESSION_ID",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_JOIN_END="KEY_METRIC_JOIN_END",e.KEY_METRIC_REQUEST_AP_START="KEY_METRIC_REQUEST_AP_START",e.KEY_METRIC_REQUEST_AP_END="KEY_METRIC_REQUEST_AP_END",e.KEY_METRIC_JOIN_GATEWAY_START="KEY_METRIC_JOIN_GATEWAY_START",e.KEY_METRIC_JOIN_GATEWAY_END="KEY_METRIC_JOIN_GATEWAY_END",e.KEY_METRIC_PEER_CONNECTION_START="KEY_METRIC_PEER_CONNECTION_START",e.KEY_METRIC_PEER_CONNECTION_END="KEY_METRIC_PEER_CONNECTION_END",e.KEY_METRIC_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.SET_USE_P2P="SET_USE_P2P",e.SET_TRANSPORT_TYPE="SET_TRANSPORT_TYPE",e}(dn||{});function un(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 ln(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 hn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ln(Object(r),!0).forEach((function(t){un(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ln(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}!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:()=>I,parse:()=>D,print:()=>k});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 m(e){return h(e)||a(e)||"+"===e||"/"===e}function E(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 v{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 v{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 R extends v{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,m,[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,m,[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,m));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 R{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,E)}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 R{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,m,[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 O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class I{constructor(){O(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){O(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 k(e,t){return(new I).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 pn=new class extends fi{constructor(){super(...arguments),un(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 fn{constructor(e){un(this,"logger",void 0),un(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 mn(){const e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}function En(){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 _n={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4},Tn=Date.now(),gn=e=>{for(const t in _n)if(Object.prototype.hasOwnProperty.call(_n,t)&&_n[t]===e)return t;return"DEFAULT"};const Sn=new class{constructor(){un(this,"proxyServerURL",void 0),un(this,"logLevel",_n.DEBUG),un(this,"uploadState","collecting"),un(this,"uploadLogWaitingList",[]),un(this,"uploadLogUploadingList",[]),un(this,"uploadErrorCount",0),un(this,"currentLogID",0),un(this,"url",void 0),un(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=[_n.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=[_n.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=[_n.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=[_n.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=[_n.DEBUG].concat(t);this.uploadLog.apply(this,i)}setLogLevel(e){e=Math.min(Math.max(0,e),4),this.logLevel=e}enableLogUpload(){sn("UPLOAD_LOG",!0)}disableLogUpload(){sn("UPLOAD_LOG",!1),this.uploadLogUploadingList=[],this.uploadLogWaitingList=[]}setProxyServer(e){this.proxyServerURL=e}prefix(e){return new fn(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()-Tn<100)return void setTimeout((()=>{this.log(...t)}),Date.now()-Tn);const i=Math.max(0,Math.min(4,t[0]));if(t[0]=mn()+" Agora-SDK [".concat(gn(i),"]:"),this.appendLogToWaitingList(i,...t),i<this.logLevel)return;const n=mn()+" %cAgora-SDK [".concat(gn(i),"]:");let o=[];if(!an("USE_NEW_LOG"))switch(i){case _n.DEBUG:o=[n,"color: #64B5F6;"].concat(t.slice(1)),console.log.apply(console,o);break;case _n.INFO:o=[n,"color: #1E88E5; font-weight: bold;"].concat(t.slice(1)),console.log.apply(console,o);break;case _n.WARNING:o=[n,"color: #FB8C00; font-weight: bold;"].concat(t.slice(1)),console.warn.apply(console,o);break;case _n.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()-Tn<100)return void setTimeout((()=>{this.uploadLog(...t)}),Date.now()-Tn);const i=Math.max(0,Math.min(4,t[0]));t[0]=mn()+" Agora-SDK [".concat(gn(i),"]:"),this.appendLogToWaitingList(i,...t)}appendLogToWaitingList(e){if(!an("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]=En()+" Agora-SDK [".concat(gn(e),"]:"):r[0]=En()+" Agora-SDK [".concat(gn(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:tn,process_id:an("PROCESS_ID"),payload:JSON.stringify(e)};return zi((async()=>{const e=await br.post(this.url||(this.proxyServerURL?"https://".concat(this.proxyServerURL,"/ls/?h=").concat(an("LOG_UPLOAD_SERVER"),"&p=443&d=upload/v1"):"https://".concat(an("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),pn.reportLogUploadError(r),!0}),{timeout:an("UPLOAD_LOG_REQUEST_RETRY_INTERVAL"),maxRetryTimeout:an("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,an("UPLOAD_LOG_LENGTH_EACH_TIME"))),this.uploadLogs().then((()=>{this.uploadErrorCount=0,this.uploadLogWaitingList.length>0&&window.setTimeout((()=>this.uploadLogInterval()),an("UPLOAD_LOG_INTERVAL"))})).catch((e=>{this.uploadErrorCount+=1,this.uploadErrorCount<2?window.setTimeout((()=>this.uploadLogInterval()),an("UPLOAD_LOG_TWICE_RETRY_INTERVAL_V1")):window.setTimeout((()=>this.uploadLogInterval()),an("UPLOAD_LOG_RETRY_INTERVAL_V1"))})))}};var vn;(vn={}).FREE="free",vn.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 yn={sid:"",lts:0,success:null,cname:null,uid:null,peer:null,cid:null,elapse:null,extend:null,vid:0};let Rn=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.REQ_USER_ACCOUNT="req_user_account",e.JOIN_GATEWAY="join_gateway",e.REJOIN_GATEWAY="rejoin_gateway",e.STREAM_SWITCH="stream_switch",e.REQUEST_PROXY_WORKER_MANAGER="request_proxy_worker_manager",e.REQUEST_PROXY_APPCENTER="request_proxy_appcenter",e.FIRST_VIDEO_RECEIVED="first_video_received",e.FIRST_AUDIO_RECEIVED="first_audio_received",e.FIRST_VIDEO_DECODE="first_video_decode",e.FIRST_AUDIO_DECODE="first_audio_decode",e.ON_ADD_AUDIO_STREAM="on_add_audio_stream",e.ON_ADD_VIDEO_STREAM="on_add_video_stream",e.ON_UPDATE_STREAM="on_update_stream",e.ON_REMOVE_STREAM="on_remove_stream",e.USER_ANALYTICS="req_user_analytics",e.PC_STATS="pc_stats",e.UPDATE_REMOTE_RTPCAPABILITIES="update_remote_rtpCapabilities",e.AB_TEST="ab_test",e}({}),An=function(e){return e.SESSION="io.agora.pb.Wrtc.Session",e.JOIN_CHOOSE_SERVER="io.agora.pb.Wrtc.JoinChooseServer",e.REQ_USER_ACCOUNT="io.agora.pb.Wrtc.ReqUserAccount",e.JOIN_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.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 bn=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 On(){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){Sn.warning(e),c=[]}try{JSON.stringify(c)}catch(e){Sn.warning("arguments for method ".concat(o,".").concat(String(r)," not serializable for apiInvoke.")),c=[]}const d=(e.report||In).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 In=new class{constructor(){un(this,"baseInfoMap",new Map),un(this,"proxyServer",void 0),un(this,"eventUploadTimer",void 0),un(this,"setSessionIdTimer",void 0),un(this,"url",void 0),un(this,"sids",new Set),un(this,"backupUrl",void 0),un(this,"_appId",void 0),un(this,"_aid",0),un(this,"keyEventUploadPendingItems",[]),un(this,"normalEventUploadPendingItems",[]),un(this,"apiInvokeUploadPendingItems",[]),un(this,"apiInvokeCount",0),un(this,"apiInvokeLoggedCount",0),un(this,"ltsList",[]),un(this,"lastSendNormalEventTime",Date.now()),un(this,"customReportCounterTimer",void 0),un(this,"customReportCount",0),un(this,"extApiInvoke",(async e=>{for(const t of e){const e=hn(hn({},t),{},{sid:null,invokeId:++this.apiInvokeCount,tag:gi.TRACER});this.sendApiInvoke(e)}})),this.eventUploadTimer=window.setInterval(this.doSend.bind(this),an("EVENT_REPORT_SEND_INTERVAL")),this.setSessionIdTimer=window.setInterval(this.appendSessionId.bind(this),an("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=!!an("SHOW_REPORT_INVOKER_LOG"),s=!!an("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 Sn.info("".concat(i," ").concat(e));Sn.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;Pi(t.timeout).then((()=>{l||(this.sendApiInvoke(hn(hn({},u()),{},{error:ii.API_INVOKE_TIMEOUT,success:!1})),d("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(hn(hn({},u()),{},{success:!0},t.reportResult&&{result:e})),d("onSuccess"),e};return r?xi(i,t.name+"Success",r,(()=>l=!0)):i()},onError:e=>{const i=()=>{if(l)throw e;l=!0,this.sendApiInvoke(hn(hn({},u()),{},{success:!1,error:e})),d("onFailure",e.toString())};return r?xi(i,t.name+"Error",r,(()=>l=!0)):i()}}}sessionInit(e,t){if(this.baseInfoMap.has(e))return;const r=Date.now(),i=this.createBaseInfo(e,r);i.cname=t.cname;const n=Object.assign({},{willUploadConsoleLog:an("UPLOAD_LOG"),maxTouchPoints:navigator.maxTouchPoints,areaVersion:rn?"global":"oversea",areas:an("AREAS")&&an("AREAS").join(",")},t.extend),{stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:d,clientRole:u}=t,l=Date.now(),h=hn(hn({},i),{},{eventType:Rn.SESSION_INIT,appid:t.appid,browser:navigator.userAgent,buildFormat:t.buildFormat,build:"v4.23.3-0-g83bb9b5a-dirty(4/29/2025, 5:16:52 PM)",lts:l,elapse:l-r,extend:JSON.stringify(n),mode:t.mode,process:an("PROCESS_ID"),appType:an("APP_TYPE"),success:!0,version:tn,stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:d,clientType:window.navigator.userAgent.includes("AgoraWebView")?42:20,clientRole:u,serviceId:an("PROCESS_ID"),extensionID:an("PLUGIN_INFO").join(",")||""});this.send({type:An.SESSION,data:h},!0)}joinChooseServer(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=hn(hn({},i),{},{role:t.role,eventType:Rn.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});this.send({type:An.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=hn(hn({},i),{},{eventType:Rn.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:An.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=hn(hn({},i),{},{eventType:Rn.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:en(),isABTestSuccess:t.isABTestSuccess?1:0}),u=d.success?1:0;if(t.succ&&(r.lastJoinSuccessTime=n),o)this.send({type:An.JOIN_GATEWAY,data:d},!0);else{let e;if(s)if(a){const t=s.match(/h=(\d{1,3}-){3}\d{1,3}/g),r=s.match(/p=[0-9]{1,6}/g);e={isSuccess:u,gatewayIp:t&&t.length?t[0].split("=")[1].replace(/-/g,"."):"",port:r&&r.length?r[0].split("=")[1]:"",isProxy:a?1:0}}else{const t=s.match(/wss:\/\/(\d{1,3}-){3}\d{1,3}/g),r=s.match(/(:|p=)[0-9]{1,6}/g);e={isSuccess:u,gatewayIp:t&&t.length?t[0].split("//")[1].replace(/-/g,"."):"",port:r&&r.length?r[0].split(/:|p=/g)[1]:"",isProxy:a?1:0}}else e={isSuccess:u,gatewayIp:"",port:"",isProxy:a?1:0};delete d.success,delete d.eventType,delete d.firstSuccess,d.vid=Number(d.vid);const t=Object.assign({},d,e,{eventType:Rn.REJOIN_GATEWAY});this.send({type:An.RE_JOIN_GATEWAY,data:t},!0)}}joinChannelTimeout(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=Date.now(),n=hn(hn({},r.info),{},{lts:i,timeout:t,elapse:i-r.startTime});this.send({type:An.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=hn(hn({},i),{},{eventType:Rn.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:An.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=hn(hn({},n),{},{eventType:Rn.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:An.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=hn(hn({},n),{},{eventType:Rn.WS_COMPRESSOR_INIT,lts:o,eventElapse:e.eventElapse,elapse:o-i.startTime,status:e.status?1:2});this.send({type:An.WS_COMPRESSOR_INIT,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=hn(hn(hn({},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=hn(hn(hn({},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=hn(hn(hn({},i),t),{},{vid:void 0===i.vid?0:Number(i.vid),elapse:n-r.startTime,eventType:Rn.AB_TEST,lts:n});this.send({type:An.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=hn(hn(hn({},i),t),{},{vid:void 0===i.vid?0:Number(i.vid),elapse:n-r.startTime,eventType:Rn.PC_STATS,lts:n,preallocation:t.preallocation?1:0});this.send({type:An.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=hn(hn(hn({},i),t),{},{vid:void 0===i.vid?0:Number(i.vid),eventType:Rn.UPDATE_REMOTE_RTPCAPABILITIES,lts:n});this.send({type:An.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=hn(hn(hn({},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=hn(hn({},i),{},{eventType:Rn.STREAM_SWITCH,lts:n,isDual:t.isdual,elapse:n-r.startTime,success:t.succ});this.send({type:An.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=hn(hn({},i),{},{eventType:Rn.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:An.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=hn(hn({},i),{},{eventType:Rn.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:An.REQUEST_PROXY_WORKER_MANAGER,data:o},!0)}setProxyServer(e){this.proxyServer=e,e?Sn.debug("reportProxyServerurl: ".concat(e)):Sn.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=hn(hn({},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:An.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=ki(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})(hn(hn(hn({},i),t),{},{elapse:n-r.startTime,lts:n,productType:"WebRTC"}),"payload",1300).forEach((e=>this.send({type:An.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=hn(hn(hn({},i),t),{},{elapse:n-r.startTime,lts:n});this.send({type:An.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=hn(hn(hn({},i),t),{},{elapse:n-r.startTime,lts:n,extend:t.extend||void 0});this.send({type:An.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=hn(hn(hn({},i),t),{},{elapse:n-r.startTime,lts:n});this.send({type:An.WEBSOCKET_QUIT,data:o},!0)}async sendCustomReportMessage(e,t){if(this.customReportCount+=t.length,this.customReportCount>an("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:An.USER_ANALYTICS,data:hn(hn({sid:e},t),{},{lts:r})})));try{an("NEW_REPORT_SERVER")?await this.postDataToStatsCollector2(i):await this.postDataToStatsCollector(i)}catch(e){throw Sn.error("send custom report message failed",e.toString()),new ni(ii.CUSTOM_REPORT_SEND_FAILED,e.message)}}sendApiInvoke(e){const t=an("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:An.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>an("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()),an("ENABLE_EVENT_REPORT")?(r.length&&(an("NEW_REPORT_SERVER")?this.postDataToStatsCollector2(r):this.postDataToStatsCollector(r)).catch((e=>r=>{an("EVENT_REPORT_RETRY")&&(t?this.keyEventUploadPendingItems=this.keyEventUploadPendingItems.concat(e):(this.normalEventUploadPendingItems=this.normalEventUploadPendingItems.concat(e),this.normalEventUploadPendingItems.length>an("NORMAL_EVENT_QUEUE_CAPACITY")&&(this.normalEventUploadPendingItems.splice(0,this.normalEventUploadPendingItems.length-an("NORMAL_EVENT_QUEUE_CAPACITY")),Sn.warning("report: drop normal events"))))})(r)),e):e}async postDataToStatsCollector2(e){bi.networkState===Si.OFFLINE&&await Promise.race([bi.onlineWaiter,Pi(2*Yi.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(An).forEach((r=>{let[i,n]=r;n===e.type&&(t=bn[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(an("NEW_REPORT_SERVER_DOMAINS")[0],"&p=443&d=").concat(r):"https://".concat(an("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(an("NEW_REPORT_SERVER_DOMAINS")[1],"&p=443&d=").concat(r):"https://".concat(an("NEW_REPORT_SERVER_DOMAINS")[1],"/").concat(r));try{await Ji(i,{timeout:1e4,data:t(e),headers:hn(hn({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,Pi(2*Yi.maxRetryTimeout)]);const o=t?"/events/proto-raws":"/events/messages";let s=this.url||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(an("EVENT_REPORT_DOMAIN"),"&p=").concat(an("STATS_COLLECTOR_PORT"),"&d=").concat(o):"https://".concat(an("EVENT_REPORT_DOMAIN"),":").concat(an("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(an("EVENT_REPORT_BACKUP_DOMAIN"),"&p=").concat(an("STATS_COLLECTOR_PORT"),"&d=").concat(o):"https://".concat(an("EVENT_REPORT_BACKUP_DOMAIN"),":").concat(an("STATS_COLLECTOR_PORT")).concat(o)));try{t?await Qi(s,{timeout:1e4,data:n}):await Ji(s,{timeout:1e4,data:n})}catch(t){if(1===e)throw t;continue}return}}createBaseInfo(e,t){const r=Object.assign({},yn);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()}};pn.on("REPORT_LOG_UPLOAD",(e=>{e.networkState=bi.networkState,In.reportApiInvoke(null,{name:"logUploadError",options:e,tag:gi.TRACER}).onSuccess("logUploadError")}));const Cn={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};function wn(){const e=Dr();Cn.getDisplayMedia=function(e){if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return!0;return!1}(),Cn.getStreamFromExtension=e.name===Ir.CHROME&&Number(e.version)>34,Cn.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}(),Cn.supportMinBitrate=e.name===Ir.CHROME||e.name===Ir.EDGE,Cn.supportSetRtpSenderParameters=function(){const e=Dr();if(!window.RTCRtpSender||!window.RTCRtpSender.prototype.setParameters||!window.RTCRtpSender.prototype.getParameters)return!1;return!!Qr()||(!(!xr()&&!Mr())||e.name===Ir.FIREFOX&&Number(e.version)>=64)}(),e.name===Ir.SAFARI&&(Number(e.version)>=14?Cn.supportDualStream=!0:Cn.supportDualStream=!1),Cn.webAudioMediaStreamDest=function(){const e=Dr();if(e.name===Ir.SAFARI&&Number(e.version)<12)return!1;return!0}(),Cn.supportReplaceTrack=function(){if(!window.RTCRtpSender)return!1;if("function"==typeof RTCRtpSender.prototype.replaceTrack)return!0;return!1}(),Cn.supportWebGL="undefined"!=typeof WebGLRenderingContext,Cn.supportRequestFrame=!!window.CanvasCaptureMediaStreamTrack,Qr()||(Cn.webAudioWithAEC=!0),Cn.supportShareAudio=function(){const e=Dr();if((e.os===Or.WIN_10||e.os===Or.WIN_81||e.os===Or.WIN_7||e.os===Or.LINUX||e.os===Or.MAC_OS||e.os===Or.CHROMIUM_OS)&&e.name===Ir.CHROME&&Number(e.version)>=74)return!0;return!1}(),Cn.supportDataChannel=function(){if(jr(76)||function(e){const t=Dr();return!(t.name!==Ir.FIREFOX||!t.osVersion)&&Number(t.version)>=e}(68)||function(e){const t=Dr();return!(t.name!==Ir.SAFARI||!t.osVersion)&&Number(t.version)>=e}(14))return!0;return!1}(),Cn.supportPCSetConfiguration=function(){const e=window.RTCPeerConnection;return!Fr()&&!!e&&e.prototype.setConfiguration instanceof Function}(),Cn.supportWebRTCEncodedTransform=function(){const e=Dr();return"Chrome"===e.name&&Number(e.version)>=87||"Safari"===e.name&&Number(e.version)>=15}(),Cn.supportWebRTCInsertableStream=function(){const e=Dr();return(e.name===Ir.CHROME||e.name===Ir.EDGE)&&Number(e.version)>=94&&"MediaStreamTrackGenerator"in window&&"MediaStreamTrackProcessor"in window}(),Cn.supportRequestVideoFrameCallback=function(){if("requestVideoFrameCallback"in HTMLVideoElement.prototype)return!0;return!1}(),Cn.supportWebCrypto="undefined"!=typeof window&&void 0!==window.crypto&&void 0!==window.crypto.subtle,Ii((()=>{Cn.supportDualStreamEncoding=function(){const e=Dr();if(an("DISABLE_WEBAUDIO"))return!0;return"Safari"===e.name&&Number(e.version)>=14||!!("Chrome"===e.name&&/Windows/i.test(e.os||"")&&Number(e.version)>=100&&an("CHROME_DUAL_STREAM_USE_ENCODING"))}(),Sn.debug("browser ua: ",navigator.userAgent),Sn.info("browser info: ",e),Sn.info("browser compatibility: ",Cn)}))}function Nn(){return Cn}function Dn(){return"setSinkId"in HTMLAudioElement.prototype&&(!an("RESTRICTION_SET_PLAYBACK_DEVICE")||(Ur()||Vr())&&!Jr())}let kn=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 Pn=function(e){try{return!!e()}catch(e){return!0}},Ln=!Pn((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Mn=Ln,Un=Function.prototype,xn=Un.call,Vn=Mn&&Un.bind.bind(xn,xn),Fn=Mn?Vn:function(e){return function(){return xn.apply(e,arguments)}},Bn=Fn({}.isPrototypeOf),jn=function(e){return e&&e.Math===Math&&e},Gn=jn("object"==typeof globalThis&&globalThis)||jn("object"==typeof window&&window)||jn("object"==typeof self&&self)||jn("object"==typeof X&&X)||jn("object"==typeof X&&X)||function(){return this}()||Function("return this")(),Wn=Ln,Hn=Function.prototype,Kn=Hn.apply,Yn=Hn.call,zn="object"==typeof Reflect&&Reflect.apply||(Wn?Yn.bind(Kn):function(){return Yn.apply(Kn,arguments)}),Xn=Fn,Zn=Xn({}.toString),Jn=Xn("".slice),Qn=function(e){return Jn(Zn(e),8,-1)},qn=Qn,$n=Fn,eo=function(e){if("Function"===qn(e))return $n(e)},to="object"==typeof document&&document.all,ro=void 0===to&&void 0!==to?function(e){return"function"==typeof e||e===to}:function(e){return"function"==typeof e},io={},no=!Pn((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),oo=Ln,so=Function.prototype.call,ao=oo?so.bind(so):function(){return so.apply(so,arguments)},co={},uo={}.propertyIsEnumerable,lo=Object.getOwnPropertyDescriptor,ho=lo&&!uo.call({1:2},1);co.f=ho?function(e){var t=lo(this,e);return!!t&&t.enumerable}:uo;var po,fo,mo=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Eo=Pn,_o=Qn,To=Object,go=Fn("".split),So=Eo((function(){return!To("z").propertyIsEnumerable(0)}))?function(e){return"String"===_o(e)?go(e,""):To(e)}:To,vo=function(e){return null==e},yo=vo,Ro=TypeError,Ao=function(e){if(yo(e))throw new Ro("Can't call method on "+e);return e},bo=So,Oo=Ao,Io=function(e){return bo(Oo(e))},Co=ro,wo=function(e){return"object"==typeof e?null!==e:Co(e)},No={},Do=No,ko=Gn,Po=ro,Lo=function(e){return Po(e)?e:void 0},Mo=function(e,t){return arguments.length<2?Lo(Do[e])||Lo(ko[e]):Do[e]&&Do[e][t]||ko[e]&&ko[e][t]},Uo=Gn.navigator,xo=Uo&&Uo.userAgent,Vo=xo?String(xo):"",Fo=Gn,Bo=Vo,jo=Fo.process,Go=Fo.Deno,Wo=jo&&jo.versions||Go&&Go.version,Ho=Wo&&Wo.v8;Ho&&(fo=(po=Ho.split("."))[0]>0&&po[0]<4?1:+(po[0]+po[1])),!fo&&Bo&&(!(po=Bo.match(/Edge\/(\d+)/))||po[1]>=74)&&(po=Bo.match(/Chrome\/(\d+)/))&&(fo=+po[1]);var Ko=fo,Yo=Ko,zo=Pn,Xo=Gn.String,Zo=!!Object.getOwnPropertySymbols&&!zo((function(){var e=Symbol("symbol detection");return!Xo(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Yo&&Yo<41})),Jo=Zo&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Qo=Mo,qo=ro,$o=Bn,es=Object,ts=Jo?function(e){return"symbol"==typeof e}:function(e){var t=Qo("Symbol");return qo(t)&&$o(t.prototype,es(e))},rs=String,is=function(e){try{return rs(e)}catch(e){return"Object"}},ns=ro,os=is,ss=TypeError,as=function(e){if(ns(e))return e;throw new ss(os(e)+" is not a function")},cs=as,ds=vo,us=function(e,t){var r=e[t];return ds(r)?void 0:cs(r)},ls=ao,hs=ro,ps=wo,fs=TypeError,ms={exports:{}},Es=Gn,_s=Object.defineProperty,Ts=Gn,gs=function(e,t){try{_s(Es,e,{value:t,configurable:!0,writable:!0})}catch(r){Es[e]=t}return t},Ss="__core-js_shared__",vs=ms.exports=Ts[Ss]||gs(Ss,{});(vs.versions||(vs.versions=[])).push({version:"3.41.0",mode:"pure",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.41.0/LICENSE",source:"https://github.com/zloirock/core-js"});var ys=ms.exports,Rs=ys,As=function(e,t){return Rs[e]||(Rs[e]=t||{})},bs=Ao,Os=Object,Is=function(e){return Os(bs(e))},Cs=Is,ws=Fn({}.hasOwnProperty),Ns=Object.hasOwn||function(e,t){return ws(Cs(e),t)},Ds=Fn,ks=0,Ps=Math.random(),Ls=Ds(1..toString),Ms=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ls(++ks+Ps,36)},Us=As,xs=Ns,Vs=Ms,Fs=Zo,Bs=Jo,js=Gn.Symbol,Gs=Us("wks"),Ws=Bs?js.for||js:js&&js.withoutSetter||Vs,Hs=function(e){return xs(Gs,e)||(Gs[e]=Fs&&xs(js,e)?js[e]:Ws("Symbol."+e)),Gs[e]},Ks=ao,Ys=wo,zs=ts,Xs=us,Zs=function(e,t){var r,i;if("string"===t&&hs(r=e.toString)&&!ps(i=ls(r,e)))return i;if(hs(r=e.valueOf)&&!ps(i=ls(r,e)))return i;if("string"!==t&&hs(r=e.toString)&&!ps(i=ls(r,e)))return i;throw new fs("Can't convert object to primitive value")},Js=TypeError,Qs=Hs("toPrimitive"),qs=function(e,t){if(!Ys(e)||zs(e))return e;var r,i=Xs(e,Qs);if(i){if(void 0===t&&(t="default"),r=Ks(i,e,t),!Ys(r)||zs(r))return r;throw new Js("Can't convert object to primitive value")}return void 0===t&&(t="number"),Zs(e,t)},$s=ts,ea=function(e){var t=qs(e,"string");return $s(t)?t:t+""},ta=wo,ra=Gn.document,ia=ta(ra)&&ta(ra.createElement),na=function(e){return ia?ra.createElement(e):{}},oa=na,sa=!no&&!Pn((function(){return 7!==Object.defineProperty(oa("div"),"a",{get:function(){return 7}}).a})),aa=no,ca=ao,da=co,ua=mo,la=Io,ha=ea,pa=Ns,fa=sa,ma=Object.getOwnPropertyDescriptor;io.f=aa?ma:function(e,t){if(e=la(e),t=ha(t),fa)try{return ma(e,t)}catch(e){}if(pa(e,t))return ua(!ca(da.f,e,t),e[t])};var Ea=Pn,_a=ro,Ta=/#|\.prototype\./,ga=function(e,t){var r=va[Sa(e)];return r===Ra||r!==ya&&(_a(t)?Ea(t):!!t)},Sa=ga.normalize=function(e){return String(e).replace(Ta,".").toLowerCase()},va=ga.data={},ya=ga.NATIVE="N",Ra=ga.POLYFILL="P",Aa=ga,ba=as,Oa=Ln,Ia=eo(eo.bind),Ca=function(e,t){return ba(e),void 0===t?e:Oa?Ia(e,t):function(){return e.apply(t,arguments)}},wa={},Na=no&&Pn((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Da=wo,ka=String,Pa=TypeError,La=function(e){if(Da(e))return e;throw new Pa(ka(e)+" is not an object")},Ma=no,Ua=sa,xa=Na,Va=La,Fa=ea,Ba=TypeError,ja=Object.defineProperty,Ga=Object.getOwnPropertyDescriptor,Wa="enumerable",Ha="configurable",Ka="writable";wa.f=Ma?xa?function(e,t,r){if(Va(e),t=Fa(t),Va(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Ka in r&&!r[Ka]){var i=Ga(e,t);i&&i[Ka]&&(e[t]=r.value,r={configurable:Ha in r?r[Ha]:i[Ha],enumerable:Wa in r?r[Wa]:i[Wa],writable:!1})}return ja(e,t,r)}:ja:function(e,t,r){if(Va(e),t=Fa(t),Va(r),Ua)try{return ja(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new Ba("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Ya=wa,za=mo,Xa=no?function(e,t,r){return Ya.f(e,t,za(1,r))}:function(e,t,r){return e[t]=r,e},Za=Gn,Ja=zn,Qa=eo,qa=ro,$a=io.f,ec=Aa,tc=No,rc=Ca,ic=Xa,nc=Ns,oc=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 Ja(e,this,arguments)};return t.prototype=e.prototype,t},sc=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,m=h?Za:p?Za[l]:Za[l]&&Za[l].prototype,E=h?tc:tc[l]||ic(tc,l,{})[l],_=E.prototype;for(o in t)i=!(r=ec(h?o:l+(p?".":"#")+o,e.forced))&&m&&nc(m,o),a=E[o],i&&(c=e.dontCallGetSet?(u=$a(m,o))&&u.value:m[o]),s=i&&c?c:t[o],(r||f||typeof a!=typeof s)&&(d=e.bind&&i?rc(s,Za):e.wrap&&i?oc(s):f&&qa(s)?Qa(s):s,(e.sham||s&&s.sham||a&&a.sham)&&ic(d,"sham",!0),ic(E,o,d),f&&(nc(tc,n=l+"Prototype")||ic(tc,n,{}),ic(tc[n],o,s),e.real&&_&&(r||!_[o])&&ic(_,o,s)))},ac=Math.ceil,cc=Math.floor,dc=Math.trunc||function(e){var t=+e;return(t>0?cc:ac)(t)},uc=dc,lc=function(e){var t=+e;return t!=t||0===t?0:uc(t)},hc=lc,pc=Math.max,fc=Math.min,mc=function(e,t){var r=hc(e);return r<0?pc(r+t,0):fc(r,t)},Ec=lc,_c=Math.min,Tc=function(e){var t=Ec(e);return t>0?_c(t,9007199254740991):0},gc=function(e){return Tc(e.length)},Sc=Io,vc=mc,yc=gc,Rc=function(e){return function(t,r,i){var n=Sc(t),o=yc(n);if(0===o)return!e&&-1;var s,a=vc(i,o);if(e&&r!=r){for(;o>a;)if((s=n[a++])!=s)return!0}else for(;o>a;a++)if((e||a in n)&&n[a]===r)return e||a||0;return!e&&-1}},Ac={includes:Rc(!0),indexOf:Rc(!1)},bc=Ac.includes;sc({target:"Array",proto:!0,forced:Pn((function(){return!Array(1).includes()}))},{includes:function(e){return bc(this,e,arguments.length>1?arguments[1]:void 0)}});var Oc=Gn,Ic=No,Cc=function(e,t){var r=Ic[e+"Prototype"],i=r&&r[t];if(i)return i;var n=Oc[e],o=n&&n.prototype;return o&&o[t]},wc=Cc("Array","includes"),Nc=wo,Dc=Qn,kc=Hs("match"),Pc=function(e){var t;return Nc(e)&&(void 0!==(t=e[kc])?!!t:"RegExp"===Dc(e))},Lc=TypeError,Mc={};Mc[Hs("toStringTag")]="z";var Uc="[object z]"===String(Mc),xc=Uc,Vc=ro,Fc=Qn,Bc=Hs("toStringTag"),jc=Object,Gc="Arguments"===Fc(function(){return arguments}()),Wc=xc?Fc: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),Bc))?r:Gc?Fc(t):"Object"===(i=Fc(t))&&Vc(t.callee)?"Arguments":i},Hc=Wc,Kc=String,Yc=function(e){if("Symbol"===Hc(e))throw new TypeError("Cannot convert a Symbol value to a string");return Kc(e)},zc=Hs("match"),Xc=sc,Zc=function(e){if(Pc(e))throw new Lc("The method doesn't accept regular expressions");return e},Jc=Ao,Qc=Yc,qc=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[zc]=!1,"/./"[e](t)}catch(e){}}return!1},$c=Fn("".indexOf);Xc({target:"String",proto:!0,forced:!qc("includes")},{includes:function(e){return!!~$c(Qc(Jc(this)),Qc(Zc(e)),arguments.length>1?arguments[1]:void 0)}});var ed=Cc("String","includes"),td=Bn,rd=wc,id=ed,nd=Array.prototype,od=String.prototype,sd=Z((function(e){var t=e.includes;return e===nd||td(nd,e)&&t===nd.includes?rd:"string"==typeof e||e===od||td(od,e)&&t===od.includes?id:t}));function ad(e,t,r){return{sampleRate:e,stereo:t,bitrate:r}}function cd(e,t,r,i,n){return{width:e,height:t,frameRate:r,bitrateMin:i,bitrateMax:n}}function dd(e,t,r,i,n){return{width:{max:e},height:{max:t},frameRate:r,bitrateMin:i,bitrateMax:n}}function ud(e,t){return{numSpatialLayers:e,numTemporalLayers:t}}const ld={"90p":cd(160,90),"90p_1":cd(160,90),"120p":cd(160,120,15,30,65),"120p_1":cd(160,120,15,30,65),"120p_3":cd(120,120,15,30,50),"120p_4":cd(212,120),"180p":cd(320,180,15,30,140),"180p_1":cd(320,180,15,30,140),"180p_3":cd(180,180,15,30,100),"180p_4":cd(240,180,15,30,120),"240p":cd(320,240,15,40,200),"240p_1":cd(320,240,15,40,200),"240p_3":cd(240,240,15,40,140),"240p_4":cd(424,240,15,40,220),"360p":cd(640,360,15,80,400),"360p_1":cd(640,360,15,80,400),"360p_3":cd(360,360,15,80,260),"360p_4":cd(640,360,30,80,600),"360p_6":cd(360,360,30,80,400),"360p_7":cd(480,360,15,80,320),"360p_8":cd(480,360,30,80,490),"360p_9":cd(640,360,15,80,800),"360p_10":cd(640,360,24,80,800),"360p_11":cd(640,360,24,80,1e3),"480p":cd(640,480,15,100,500),"480p_1":cd(640,480,15,100,500),"480p_2":cd(640,480,30,100,1e3),"480p_3":cd(480,480,15,100,400),"480p_4":cd(640,480,30,100,750),"480p_6":cd(480,480,30,100,600),"480p_8":cd(848,480,15,100,610),"480p_9":cd(848,480,30,100,930),"480p_10":cd(640,480,10,100,400),"720p":cd(1280,720,15,120,1130),"720p_auto":cd(1280,720,30,900,3e3),"720p_1":cd(1280,720,15,120,1130),"720p_2":cd(1280,720,30,120,2e3),"720p_3":cd(1280,720,30,120,1710),"720p_5":cd(960,720,15,120,910),"720p_6":cd(960,720,30,120,1380),"1080p":cd(1920,1080,15,120,2080),"1080p_1":cd(1920,1080,15,120,2080),"1080p_2":cd(1920,1080,30,120,3e3),"1080p_3":cd(1920,1080,30,120,3150),"1080p_5":cd(1920,1080,60,120,4780),"1440p":cd(2560,1440,30,120,4850),"1440p_1":cd(2560,1440,30,120,4850),"1440p_2":cd(2560,1440,60,120,7350),"4k":cd(3840,2160,30,120,8910),"4k_1":cd(3840,2160,30,120,8910),"4k_3":cd(3840,2160,60,120,13500)},hd={"480p":dd(640,480,5),"480p_1":dd(640,480,5),"480p_2":dd(640,480,30),"480p_3":dd(640,480,15),"720p":dd(1280,720,5),"720p_auto":cd(1280,720,30,900,3e3),"720p_1":dd(1280,720,5),"720p_2":dd(1280,720,30),"720p_3":dd(1280,720,15),"1080p":dd(1920,1080,5),"1080p_1":dd(1920,1080,5),"1080p_2":dd(1920,1080,30),"1080p_3":dd(1920,1080,15)},pd={"1SL1TL":ud(1,1),"3SL3TL":ud(3,3),"2SL3TL":ud(2,3)};function fd(e){return e||(e="480p_1"),"string"==typeof e?Object.assign({},ld[e]):e}function md(e){return"string"==typeof e?Object.assign({},hd[e]):e}function Ed(e){return"string"==typeof e?Object.assign({},pd[e]):e}const _d={speech_low_quality:ad(16e3,!1),speech_standard:ad(32e3,!1,18),music_standard:ad(48e3,!1),standard_stereo:ad(48e3,!0,56),high_quality:ad(48e3,!1,128),high_quality_stereo:ad(48e3,!0,192)};function Td(e){return"string"==typeof e?Object.assign({},_d[e]):e}const gd=[];function Sd(e){sd(gd).call(gd,e)||gd.push(e)}function vd(e){const t=gd.indexOf(e);-1!==t&&gd.splice(t,1)}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 Rd(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 Ad(e){return si(e,"mediaSource",["screen","window","application"]),!0}let bd=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}({}),Od=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 Id=function(e){return e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM",e}({}),Cd=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}({}),wd=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}({}),Nd=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}({}),Dd=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}({}),kd=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}({}),Pd=function(e){return e.AUDIO="audio",e.VIDEO="video",e.DATA="data",e}({}),Ld=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}({}),Md=function(e){return e.UPDATE_TRACK_SOURCE="update-track-source",e}({});const Ud={sendVolumeLevel:0,sendBitrate:0,sendBytes:0,sendPackets:0,sendPacketsLost:0,sendJitterMs:0,sendRttMs:0,currentPacketLossRate:0},xd={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},Vd={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},Fd={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 Bd=function(e){return e.ON_TRACK="on_track",e.ON_NODE="on_node",e}({}),jd=function(e){return e.REQUEST_UPDATE_CONSTRAINTS="request_update_constraints",e.REQUEST_CONSTRAINTS="request_constraints",e}({}),Gd=function(e){return e.IDLE="IDLE",e.INITING="INITING",e.INITEND="INITEND",e}({}),Wd=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 Hd=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}({}),Kd=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 Yd=function(e){return e.OPEN="open",e.MESSAGE="message",e.CLOSE="close",e.CLOSING="closing",e.ERROR="error",e}({});var zd={exports:{}},Xd=sc,Zd=no,Jd=wa.f;Xd({target:"Object",stat:!0,forced:Object.defineProperty!==Jd,sham:!Zd},{defineProperty:Jd});var Qd=No.Object,qd=zd.exports=function(e,t,r){return Qd.defineProperty(e,t,r)};Qd.defineProperty.sham&&(qd.sham=!0);var $d=Z(zd.exports),eu=Qn,tu=Array.isArray||function(e){return"Array"===eu(e)},ru=TypeError,iu=no,nu=wa,ou=mo,su=function(e,t,r){iu?nu.f(e,t,ou(0,r)):e[t]=r},au=ro,cu=ys,du=Fn(Function.toString);au(cu.inspectSource)||(cu.inspectSource=function(e){return du(e)});var uu=cu.inspectSource,lu=Fn,hu=Pn,pu=ro,fu=Wc,mu=uu,Eu=function(){},_u=Mo("Reflect","construct"),Tu=/^\s*(?:class|function)\b/,gu=lu(Tu.exec),Su=!Tu.test(Eu),vu=function(e){if(!pu(e))return!1;try{return _u(Eu,[],e),!0}catch(e){return!1}},yu=function(e){if(!pu(e))return!1;switch(fu(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Su||!!gu(Tu,mu(e))}catch(e){return!0}};yu.sham=!0;var Ru=!_u||hu((function(){var e;return vu(vu.call)||!vu(Object)||!vu((function(){e=!0}))||e}))?yu:vu,Au=tu,bu=Ru,Ou=wo,Iu=Hs("species"),Cu=Array,wu=function(e){var t;return Au(e)&&(t=e.constructor,(bu(t)&&(t===Cu||Au(t.prototype))||Ou(t)&&null===(t=t[Iu]))&&(t=void 0)),void 0===t?Cu:t},Nu=function(e,t){return new(wu(e))(0===t?0:t)},Du=Pn,ku=Ko,Pu=Hs("species"),Lu=function(e){return ku>=51||!Du((function(){var t=[];return(t.constructor={})[Pu]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Mu=sc,Uu=Pn,xu=tu,Vu=wo,Fu=Is,Bu=gc,ju=function(e){if(e>9007199254740991)throw ru("Maximum allowed index exceeded");return e},Gu=su,Wu=Nu,Hu=Lu,Ku=Ko,Yu=Hs("isConcatSpreadable"),zu=Ku>=51||!Uu((function(){var e=[];return e[Yu]=!1,e.concat()[0]!==e})),Xu=function(e){if(!Vu(e))return!1;var t=e[Yu];return void 0!==t?!!t:xu(e)};Mu({target:"Array",proto:!0,arity:1,forced:!zu||!Hu("concat")},{concat:function(e){var t,r,i,n,o,s=Fu(this),a=Wu(s,0),c=0;for(t=-1,i=arguments.length;t<i;t++)if(Xu(o=-1===t?s:arguments[t]))for(n=Bu(o),ju(c+n),r=0;r<n;r++,c++)r in o&&Gu(a,c,o[r]);else ju(c+1),Gu(a,c++,o);return a.length=c,a}});var Zu={},Ju={},Qu=Ns,qu=Io,$u=Ac.indexOf,el=Ju,tl=Fn([].push),rl=function(e,t){var r,i=qu(e),n=0,o=[];for(r in i)!Qu(el,r)&&Qu(i,r)&&tl(o,r);for(;t.length>n;)Qu(i,r=t[n++])&&(~$u(o,r)||tl(o,r));return o},il=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],nl=rl,ol=il,sl=Object.keys||function(e){return nl(e,ol)},al=no,cl=Na,dl=wa,ul=La,ll=Io,hl=sl;Zu.f=al&&!cl?Object.defineProperties:function(e,t){ul(e);for(var r,i=ll(t),n=hl(t),o=n.length,s=0;o>s;)dl.f(e,r=n[s++],i[r]);return e};var pl,fl=Mo("document","documentElement"),ml=Ms,El=As("keys"),_l=function(e){return El[e]||(El[e]=ml(e))},Tl=La,gl=Zu,Sl=il,vl=Ju,yl=fl,Rl=na,Al="prototype",bl="script",Ol=_l("IE_PROTO"),Il=function(){},Cl=function(e){return"<"+bl+">"+e+"</"+bl+">"},wl=function(e){e.write(Cl("")),e.close();var t=e.parentWindow.Object;return e=null,t},Nl=function(){try{pl=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;Nl="undefined"!=typeof document?document.domain&&pl?wl(pl):(t=Rl("iframe"),r="java"+bl+":",t.style.display="none",yl.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(Cl("document.F=Object")),e.close(),e.F):wl(pl);for(var i=Sl.length;i--;)delete Nl[Al][Sl[i]];return Nl()};vl[Ol]=!0;var Dl=Object.create||function(e,t){var r;return null!==e?(Il[Al]=Tl(e),r=new Il,Il[Al]=null,r[Ol]=e):r=Nl(),void 0===t?r:gl.f(r,t)},kl={},Pl=rl,Ll=il.concat("length","prototype");kl.f=Object.getOwnPropertyNames||function(e){return Pl(e,Ll)};var Ml={},Ul=Fn([].slice),xl=Qn,Vl=Io,Fl=kl.f,Bl=Ul,jl="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Ml.f=function(e){return jl&&"Window"===xl(e)?function(e){try{return Fl(e)}catch(e){return Bl(jl)}}(e):Fl(Vl(e))};var Gl={};Gl.f=Object.getOwnPropertySymbols;var Wl=Xa,Hl=function(e,t,r,i){return i&&i.enumerable?e[t]=r:Wl(e,t,r),e},Kl=wa,Yl=function(e,t,r){return Kl.f(e,t,r)},zl={},Xl=Hs;zl.f=Xl;var Zl,Jl,Ql,ql=No,$l=Ns,eh=zl,th=wa.f,rh=function(e){var t=ql.Symbol||(ql.Symbol={});$l(t,e)||th(t,e,{value:eh.f(e)})},ih=ao,nh=Mo,oh=Hs,sh=Hl,ah=function(){var e=nh("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,i=oh("toPrimitive");t&&!t[i]&&sh(t,i,(function(e){return ih(r,this)}),{arity:1})},ch=Wc,dh=Uc?{}.toString:function(){return"[object "+ch(this)+"]"},uh=Uc,lh=wa.f,hh=Xa,ph=Ns,fh=dh,mh=Hs("toStringTag"),Eh=function(e,t,r,i){var n=r?e:e&&e.prototype;n&&(ph(n,mh)||lh(n,mh,{configurable:!0,value:t}),i&&!uh&&hh(n,"toString",fh))},_h=ro,Th=Gn.WeakMap,gh=_h(Th)&&/native code/.test(String(Th)),Sh=Gn,vh=wo,yh=Xa,Rh=Ns,Ah=ys,bh=_l,Oh=Ju,Ih="Object already initialized",Ch=Sh.TypeError,wh=Sh.WeakMap;if(gh||Ah.state){var Nh=Ah.state||(Ah.state=new wh);Nh.get=Nh.get,Nh.has=Nh.has,Nh.set=Nh.set,Zl=function(e,t){if(Nh.has(e))throw new Ch(Ih);return t.facade=e,Nh.set(e,t),t},Jl=function(e){return Nh.get(e)||{}},Ql=function(e){return Nh.has(e)}}else{var Dh=bh("state");Oh[Dh]=!0,Zl=function(e,t){if(Rh(e,Dh))throw new Ch(Ih);return t.facade=e,yh(e,Dh,t),t},Jl=function(e){return Rh(e,Dh)?e[Dh]:{}},Ql=function(e){return Rh(e,Dh)}}var kh={set:Zl,get:Jl,has:Ql,enforce:function(e){return Ql(e)?Jl(e):Zl(e,{})},getterFor:function(e){return function(t){var r;if(!vh(t)||(r=Jl(t)).type!==e)throw new Ch("Incompatible receiver, "+e+" required");return r}}},Ph=Ca,Lh=So,Mh=Is,Uh=gc,xh=Nu,Vh=Fn([].push),Fh=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=Mh(c),m=Lh(f),E=Uh(m),_=Ph(d,u),T=0,g=l||xh,S=t?g(c,E):r||s?g(c,0):void 0;E>T;T++)if((a||T in m)&&(p=_(h=m[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:Vh(S,h)}else switch(e){case 4:return!1;case 7:Vh(S,h)}return o?-1:i||n?n:S}},Bh={forEach:Fh(0),map:Fh(1),filter:Fh(2),some:Fh(3),every:Fh(4),find:Fh(5),findIndex:Fh(6),filterReject:Fh(7)},jh=sc,Gh=Gn,Wh=ao,Hh=Fn,Kh=no,Yh=Zo,zh=Pn,Xh=Ns,Zh=Bn,Jh=La,Qh=Io,qh=ea,$h=Yc,ep=mo,tp=Dl,rp=sl,ip=kl,np=Ml,op=Gl,sp=io,ap=wa,cp=Zu,dp=co,up=Hl,lp=Yl,hp=As,pp=Ju,fp=Ms,mp=Hs,Ep=zl,_p=rh,Tp=ah,gp=Eh,Sp=kh,vp=Bh.forEach,yp=_l("hidden"),Rp="Symbol",Ap="prototype",bp=Sp.set,Op=Sp.getterFor(Rp),Ip=Object[Ap],Cp=Gh.Symbol,wp=Cp&&Cp[Ap],Np=Gh.RangeError,Dp=Gh.TypeError,kp=Gh.QObject,Pp=sp.f,Lp=ap.f,Mp=np.f,Up=dp.f,xp=Hh([].push),Vp=hp("symbols"),Fp=hp("op-symbols"),Bp=hp("wks"),jp=!kp||!kp[Ap]||!kp[Ap].findChild,Gp=function(e,t,r){var i=Pp(Ip,t);i&&delete Ip[t],Lp(e,t,r),i&&e!==Ip&&Lp(Ip,t,i)},Wp=Kh&&zh((function(){return 7!==tp(Lp({},"a",{get:function(){return Lp(this,"a",{value:7}).a}})).a}))?Gp:Lp,Hp=function(e,t){var r=Vp[e]=tp(wp);return bp(r,{type:Rp,tag:e,description:t}),Kh||(r.description=t),r},Kp=function(e,t,r){e===Ip&&Kp(Fp,t,r),Jh(e);var i=qh(t);return Jh(r),Xh(Vp,i)?(r.enumerable?(Xh(e,yp)&&e[yp][i]&&(e[yp][i]=!1),r=tp(r,{enumerable:ep(0,!1)})):(Xh(e,yp)||Lp(e,yp,ep(1,tp(null))),e[yp][i]=!0),Wp(e,i,r)):Lp(e,i,r)},Yp=function(e,t){Jh(e);var r=Qh(t),i=rp(r).concat(Jp(r));return vp(i,(function(t){Kh&&!Wh(zp,r,t)||Kp(e,t,r[t])})),e},zp=function(e){var t=qh(e),r=Wh(Up,this,t);return!(this===Ip&&Xh(Vp,t)&&!Xh(Fp,t))&&(!(r||!Xh(this,t)||!Xh(Vp,t)||Xh(this,yp)&&this[yp][t])||r)},Xp=function(e,t){var r=Qh(e),i=qh(t);if(r!==Ip||!Xh(Vp,i)||Xh(Fp,i)){var n=Pp(r,i);return!n||!Xh(Vp,i)||Xh(r,yp)&&r[yp][i]||(n.enumerable=!0),n}},Zp=function(e){var t=Mp(Qh(e)),r=[];return vp(t,(function(e){Xh(Vp,e)||Xh(pp,e)||xp(r,e)})),r},Jp=function(e){var t=e===Ip,r=Mp(t?Fp:Qh(e)),i=[];return vp(r,(function(e){!Xh(Vp,e)||t&&!Xh(Ip,e)||xp(i,Vp[e])})),i};Yh||(Cp=function(){if(Zh(wp,this))throw new Dp("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?$h(arguments[0]):void 0,t=fp(e),r=function(e){var i=void 0===this?Gh:this;i===Ip&&Wh(r,Fp,e),Xh(i,yp)&&Xh(i[yp],t)&&(i[yp][t]=!1);var n=ep(1,e);try{Wp(i,t,n)}catch(e){if(!(e instanceof Np))throw e;Gp(i,t,n)}};return Kh&&jp&&Wp(Ip,t,{configurable:!0,set:r}),Hp(t,e)},up(wp=Cp[Ap],"toString",(function(){return Op(this).tag})),up(Cp,"withoutSetter",(function(e){return Hp(fp(e),e)})),dp.f=zp,ap.f=Kp,cp.f=Yp,sp.f=Xp,ip.f=np.f=Zp,op.f=Jp,Ep.f=function(e){return Hp(mp(e),e)},Kh&&lp(wp,"description",{configurable:!0,get:function(){return Op(this).description}})),jh({global:!0,constructor:!0,wrap:!0,forced:!Yh,sham:!Yh},{Symbol:Cp}),vp(rp(Bp),(function(e){_p(e)})),jh({target:Rp,stat:!0,forced:!Yh},{useSetter:function(){jp=!0},useSimple:function(){jp=!1}}),jh({target:"Object",stat:!0,forced:!Yh,sham:!Kh},{create:function(e,t){return void 0===t?tp(e):Yp(tp(e),t)},defineProperty:Kp,defineProperties:Yp,getOwnPropertyDescriptor:Xp}),jh({target:"Object",stat:!0,forced:!Yh},{getOwnPropertyNames:Zp}),Tp(),gp(Cp,Rp),pp[yp]=!0;var Qp=Zo&&!!Symbol.for&&!!Symbol.keyFor,qp=sc,$p=Mo,ef=Ns,tf=Yc,rf=As,nf=Qp,of=rf("string-to-symbol-registry"),sf=rf("symbol-to-string-registry");qp({target:"Symbol",stat:!0,forced:!nf},{for:function(e){var t=tf(e);if(ef(of,t))return of[t];var r=$p("Symbol")(t);return of[t]=r,sf[r]=t,r}});var af=sc,cf=Ns,df=ts,uf=is,lf=Qp,hf=As("symbol-to-string-registry");af({target:"Symbol",stat:!0,forced:!lf},{keyFor:function(e){if(!df(e))throw new TypeError(uf(e)+" is not a symbol");if(cf(hf,e))return hf[e]}});var pf=tu,ff=ro,mf=Qn,Ef=Yc,_f=Fn([].push),Tf=sc,gf=Mo,Sf=zn,vf=ao,yf=Fn,Rf=Pn,Af=ro,bf=ts,Of=Ul,If=function(e){if(ff(e))return e;if(pf(e)){for(var t=e.length,r=[],i=0;i<t;i++){var n=e[i];"string"==typeof n?_f(r,n):"number"!=typeof n&&"Number"!==mf(n)&&"String"!==mf(n)||_f(r,Ef(n))}var o=r.length,s=!0;return function(e,t){if(s)return s=!1,t;if(pf(this))return t;for(var i=0;i<o;i++)if(r[i]===e)return t}}},Cf=Zo,wf=String,Nf=gf("JSON","stringify"),Df=yf(/./.exec),kf=yf("".charAt),Pf=yf("".charCodeAt),Lf=yf("".replace),Mf=yf(1..toString),Uf=/[\uD800-\uDFFF]/g,xf=/^[\uD800-\uDBFF]$/,Vf=/^[\uDC00-\uDFFF]$/,Ff=!Cf||Rf((function(){var e=gf("Symbol")("stringify detection");return"[null]"!==Nf([e])||"{}"!==Nf({a:e})||"{}"!==Nf(Object(e))})),Bf=Rf((function(){return'"\\udf06\\ud834"'!==Nf("\udf06\ud834")||'"\\udead"'!==Nf("\udead")})),jf=function(e,t){var r=Of(arguments),i=If(t);if(Af(i)||void 0!==e&&!bf(e))return r[1]=function(e,t){if(Af(i)&&(t=vf(i,this,wf(e),t)),!bf(t))return t},Sf(Nf,null,r)},Gf=function(e,t,r){var i=kf(r,t-1),n=kf(r,t+1);return Df(xf,e)&&!Df(Vf,n)||Df(Vf,e)&&!Df(xf,i)?"\\u"+Mf(Pf(e,0),16):e};Nf&&Tf({target:"JSON",stat:!0,arity:3,forced:Ff||Bf},{stringify:function(e,t,r){var i=Of(arguments),n=Sf(Ff?jf:Nf,null,i);return Bf&&"string"==typeof n?Lf(n,Uf,Gf):n}});var Wf=Gl,Hf=Is;sc({target:"Object",stat:!0,forced:!Zo||Pn((function(){Wf.f(1)}))},{getOwnPropertySymbols:function(e){var t=Wf.f;return t?t(Hf(e)):[]}}),rh("asyncIterator"),rh("hasInstance"),rh("isConcatSpreadable"),rh("iterator"),rh("match"),rh("matchAll"),rh("replace"),rh("search"),rh("species"),rh("split");var Kf=ah;rh("toPrimitive"),Kf();var Yf=Mo,zf=Eh;rh("toStringTag"),zf(Yf("Symbol"),"Symbol"),rh("unscopables"),Eh(Gn.JSON,"JSON",!0);var Xf,Zf,Jf,Qf=No.Symbol,qf={},$f=no,em=Ns,tm=Function.prototype,rm=$f&&Object.getOwnPropertyDescriptor,im=em(tm,"name"),nm={EXISTS:im,PROPER:im&&"something"===function(){}.name,CONFIGURABLE:im&&(!$f||$f&&rm(tm,"name").configurable)},om=!Pn((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),sm=Ns,am=ro,cm=Is,dm=om,um=_l("IE_PROTO"),lm=Object,hm=lm.prototype,pm=dm?lm.getPrototypeOf:function(e){var t=cm(e);if(sm(t,um))return t[um];var r=t.constructor;return am(r)&&t instanceof r?r.prototype:t instanceof lm?hm:null},fm=Pn,mm=ro,Em=wo,_m=Dl,Tm=pm,gm=Hl,Sm=Hs("iterator"),vm=!1;[].keys&&("next"in(Jf=[].keys())?(Zf=Tm(Tm(Jf)))!==Object.prototype&&(Xf=Zf):vm=!0);var ym=!Em(Xf)||fm((function(){var e={};return Xf[Sm].call(e)!==e}));mm((Xf=ym?{}:_m(Xf))[Sm])||gm(Xf,Sm,(function(){return this}));var Rm={IteratorPrototype:Xf,BUGGY_SAFARI_ITERATORS:vm},Am=Rm.IteratorPrototype,bm=Dl,Om=mo,Im=Eh,Cm=qf,wm=function(){return this},Nm=function(e,t,r,i){var n=t+" Iterator";return e.prototype=bm(Am,{next:Om(+!i,r)}),Im(e,n,!1,!0),Cm[n]=wm,e},Dm=Fn,km=as,Pm=wo,Lm=function(e){return Pm(e)||null===e},Mm=String,Um=TypeError,xm=function(e,t,r){try{return Dm(km(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},Vm=wo,Fm=Ao,Bm=function(e){if(Lm(e))return e;throw new Um("Can't set "+Mm(e)+" as a prototype")},jm=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=xm(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return Fm(r),Bm(i),Vm(r)?(t?e(r,i):r.__proto__=i,r):r}}():void 0),Gm=sc,Wm=ao,Hm=nm,Km=Nm,Ym=pm,zm=Eh,Xm=Hl,Zm=qf,Jm=Rm,Qm=Hm.PROPER,qm=Jm.BUGGY_SAFARI_ITERATORS,$m=Hs("iterator"),eE="keys",tE="values",rE="entries",iE=function(){return this},nE=function(e,t,r,i,n,o,s){Km(r,t,i);var a,c,d,u=function(e){if(e===n&&m)return m;if(!qm&&e&&e in p)return p[e];switch(e){case eE:case tE:case rE:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[$m]||p["@@iterator"]||n&&p[n],m=!qm&&f||u(n),E="Array"===t&&p.entries||f;if(E&&(a=Ym(E.call(new e)))!==Object.prototype&&a.next&&(zm(a,l,!0,!0),Zm[l]=iE),Qm&&n===tE&&f&&f.name!==tE&&(h=!0,m=function(){return Wm(f,this)}),n)if(c={values:u(tE),keys:o?m:u(eE),entries:u(rE)},s)for(d in c)(qm||h||!(d in p))&&Xm(p,d,c[d]);else Gm({target:t,proto:!0,forced:qm||h},c);return s&&p[$m]!==m&&Xm(p,$m,m,{name:n}),Zm[t]=m,c},oE=function(e,t){return{value:e,done:t}},sE=Io,aE=qf,cE=kh;wa.f;var dE=nE,uE=oE,lE="Array Iterator",hE=cE.set,pE=cE.getterFor(lE);dE(Array,"Array",(function(e,t){hE(this,{type:lE,target:sE(e),index:0,kind:t})}),(function(){var e=pE(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,uE(void 0,!0);switch(e.kind){case"keys":return uE(r,!1);case"values":return uE(t[r],!1)}return uE([r,t[r]],!1)}),"values"),aE.Arguments=aE.Array;var fE={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},mE=Gn,EE=Eh,_E=qf;for(var TE in fE)EE(mE[TE],TE),_E[TE]=_E.Array;var gE=Qf,SE=Hs,vE=wa.f,yE=SE("metadata"),RE=Function.prototype;void 0===RE[yE]&&vE(RE,yE,{value:null}),rh("asyncDispose"),rh("dispose"),rh("metadata");var AE=gE,bE=Fn,OE=Mo("Symbol"),IE=OE.keyFor,CE=bE(OE.prototype.valueOf),wE=OE.isRegisteredSymbol||function(e){try{return void 0!==IE(CE(e))}catch(e){return!1}};sc({target:"Symbol",stat:!0},{isRegisteredSymbol:wE});for(var NE=As,DE=Mo,kE=Fn,PE=ts,LE=Hs,ME=DE("Symbol"),UE=ME.isWellKnownSymbol,xE=DE("Object","getOwnPropertyNames"),VE=kE(ME.prototype.valueOf),FE=NE("wks"),BE=0,jE=xE(ME),GE=jE.length;BE<GE;BE++)try{var WE=jE[BE];PE(ME[WE])&&LE(WE)}catch(e){}var HE=function(e){if(UE&&UE(e))return!0;try{for(var t=VE(e),r=0,i=xE(FE),n=i.length;r<n;r++)if(FE[i[r]]==t)return!0}catch(e){}return!1};sc({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:HE}),rh("customMatcher"),rh("observable"),sc({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:wE}),sc({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:HE}),rh("matcher"),rh("metadataKey"),rh("patternMatch"),rh("replaceAll");var KE=Z(AE),YE=Fn,zE=lc,XE=Yc,ZE=Ao,JE=YE("".charAt),QE=YE("".charCodeAt),qE=YE("".slice),$E=function(e){return function(t,r){var i,n,o=XE(ZE(t)),s=zE(r),a=o.length;return s<0||s>=a?e?"":void 0:(i=QE(o,s))<55296||i>56319||s+1===a||(n=QE(o,s+1))<56320||n>57343?e?JE(o,s):i:e?qE(o,s,s+2):n-56320+(i-55296<<10)+65536}},e_={codeAt:$E(!1),charAt:$E(!0)},t_=e_.charAt,r_=Yc,i_=kh,n_=nE,o_=oE,s_="String Iterator",a_=i_.set,c_=i_.getterFor(s_);n_(String,"String",(function(e){a_(this,{type:s_,string:r_(e),index:0})}),(function(){var e,t=c_(this),r=t.string,i=t.index;return i>=r.length?o_(void 0,!0):(e=t_(r,i),t.index+=e.length,o_(e,!1))}));var d_=Z(zl.f("iterator"));function u_(e){return u_="function"==typeof KE&&"symbol"==typeof d_?function(e){return typeof e}:function(e){return e&&"function"==typeof KE&&e.constructor===KE&&e!==KE.prototype?"symbol":typeof e},u_(e)}var l_=Z(zl.f("toPrimitive"));function h_(e){var t=function(e,t){if("object"!=u_(e)||!e)return e;var r=e[l_];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=u_(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u_(t)?t:t+""}function p_(e,t,r){return(t=h_(t))in e?$d(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var f_=Pn,m_=function(e,t){var r=[][e];return!!r&&f_((function(){r.call(null,t||function(){return 1},1)}))},E_=Bh.forEach,__=m_("forEach")?[].forEach:function(e){return E_(this,e,arguments.length>1?arguments[1]:void 0)};sc({target:"Array",proto:!0,forced:[].forEach!==__},{forEach:__});var T_=Cc("Array","forEach"),g_=Wc,S_=Ns,v_=Bn,y_=T_,R_=Array.prototype,A_={DOMTokenList:!0,NodeList:!0},b_=Z((function(e){var t=e.forEach;return e===R_||v_(R_,e)&&t===R_.forEach||S_(A_,g_(e))?y_:t})),O_=Is,I_=sl;sc({target:"Object",stat:!0,forced:Pn((function(){I_(1)}))},{keys:function(e){return I_(O_(e))}});var C_=Z(No.Object.keys),w_=as,N_=Is,D_=So,k_=gc,P_=TypeError,L_="Reduce of empty array with no initial value",M_=function(e){return function(t,r,i,n){var o=N_(t),s=D_(o),a=k_(o);if(w_(r),0===a&&i<2)throw new P_(L_);var 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 new P_(L_)}for(;e?c>=0:a>c;c+=d)c in s&&(n=r(n,s[c],c,o));return n}},U_={left:M_(!1),right:M_(!0)},x_=Gn,V_=Vo,F_=Qn,B_=function(e){return V_.slice(0,e.length)===e},j_=B_("Bun/")?"BUN":B_("Cloudflare-Workers")?"CLOUDFLARE":B_("Deno/")?"DENO":B_("Node.js/")?"NODE":x_.Bun&&"string"==typeof Bun.version?"BUN":x_.Deno&&"object"==typeof Deno.version?"DENO":"process"===F_(x_.process)?"NODE":x_.window&&x_.document?"BROWSER":"REST",G_="NODE"===j_,W_=U_.left;sc({target:"Array",proto:!0,forced:!G_&&Ko>79&&Ko<83||!m_("reduce")},{reduce:function(e){var t=arguments.length;return W_(this,e,t,t>1?arguments[1]:void 0)}});var H_=Cc("Array","reduce"),K_=Bn,Y_=H_,z_=Array.prototype,X_=function(e){var t=e.reduce;return e===z_||K_(z_,e)&&t===z_.reduce?Y_:t},Z_=Z(X_),J_=sc,Q_=tu,q_=Fn([].reverse),$_=[1,2];J_({target:"Array",proto:!0,forced:String($_)===String($_.reverse())},{reverse:function(){return Q_(this)&&(this.length=this.length),q_(this)}});var eT=Cc("Array","reverse"),tT=Bn,rT=eT,iT=Array.prototype,nT=function(e){var t=e.reverse;return e===iT||tT(iT,e)&&t===iT.reverse?rT:t},oT=Z(nT),sT=sc,aT=tu,cT=Ru,dT=wo,uT=mc,lT=gc,hT=Io,pT=su,fT=Hs,mT=Ul,ET=Lu("slice"),_T=fT("species"),TT=Array,gT=Math.max;sT({target:"Array",proto:!0,forced:!ET},{slice:function(e,t){var r,i,n,o=hT(this),s=lT(o),a=uT(e,s),c=uT(void 0===t?s:t,s);if(aT(o)&&(r=o.constructor,(cT(r)&&(r===TT||aT(r.prototype))||dT(r)&&null===(r=r[_T]))&&(r=void 0),r===TT||void 0===r))return mT(o,a,c);for(i=new(void 0===r?TT:r)(gT(c-a,0)),n=0;a<c;a++,n++)a in o&&pT(i,n,o[a]);return i.length=n,i}});var ST=Cc("Array","slice"),vT=Bn,yT=ST,RT=Array.prototype,AT=Z((function(e){var t=e.slice;return e===RT||vT(RT,e)&&t===RT.slice?yT:t}));function bT(e,t,r,i,n){var o,s,a,c={};return b_(o=C_(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=Z_(s=oT(a=AT(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?($d(e,t,c),null):c}var OT=Mo,IT=kl,CT=Gl,wT=La,NT=Fn([].concat),DT=OT("Reflect","ownKeys")||function(e){var t=IT.f(wT(e)),r=CT.f;return r?NT(t,r(e)):t},kT=Ns,PT=DT,LT=io,MT=wa,UT=wo,xT=Xa,VT=Error,FT=Fn("".replace),BT=String(new VT("zxcasd").stack),jT=/\n\s*at [^:]*:[^\n]*/,GT=jT.test(BT),WT=mo,HT=!Pn((function(){var e=new Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",WT(1,7)),7!==e.stack)})),KT=Xa,YT=function(e,t){if(GT&&"string"==typeof e&&!VT.prepareStackTrace)for(;t--;)e=FT(e,jT,"");return e},zT=HT,XT=Error.captureStackTrace,ZT=qf,JT=Hs("iterator"),QT=Array.prototype,qT=function(e){return void 0!==e&&(ZT.Array===e||QT[JT]===e)},$T=Wc,eg=us,tg=vo,rg=qf,ig=Hs("iterator"),ng=function(e){if(!tg(e))return eg(e,ig)||eg(e,"@@iterator")||rg[$T(e)]},og=ao,sg=as,ag=La,cg=is,dg=ng,ug=TypeError,lg=function(e,t){var r=arguments.length<2?dg(e):t;if(sg(r))return ag(og(r,e));throw new ug(cg(e)+" is not iterable")},hg=ao,pg=La,fg=us,mg=function(e,t,r){var i,n;pg(e);try{if(!(i=fg(e,"return"))){if("throw"===t)throw r;return r}i=hg(i,e)}catch(e){n=!0,i=e}if("throw"===t)throw r;if(n)throw i;return pg(i),r},Eg=Ca,_g=ao,Tg=La,gg=is,Sg=qT,vg=gc,yg=Bn,Rg=lg,Ag=ng,bg=mg,Og=TypeError,Ig=function(e,t){this.stopped=e,this.result=t},Cg=Ig.prototype,wg=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),m=Eg(t,u),E=function(e){return i&&bg(i,"normal",e),new Ig(!0,e)},_=function(e){return l?(Tg(e),f?m(e[0],e[1],E):m(e[0],e[1])):f?m(e,E):m(e)};if(h)i=e.iterator;else if(p)i=e;else{if(!(n=Ag(e)))throw new Og(gg(e)+" is not iterable");if(Sg(n)){for(o=0,s=vg(e);s>o;o++)if((a=_(e[o]))&&yg(Cg,a))return a;return new Ig(!1)}i=Rg(e,n)}for(c=h?e.next:i.next;!(d=_g(c,i)).done;){try{a=_(d.value)}catch(e){bg(i,"throw",e)}if("object"==typeof a&&a&&yg(Cg,a))return a}return new Ig(!1)},Ng=Yc,Dg=sc,kg=Bn,Pg=pm,Lg=jm,Mg=function(e,t,r){for(var i=PT(t),n=MT.f,o=LT.f,s=0;s<i.length;s++){var a=i[s];kT(e,a)||r&&kT(r,a)||n(e,a,o(t,a))}},Ug=Dl,xg=Xa,Vg=mo,Fg=function(e,t){UT(t)&&"cause"in t&&xT(e,"cause",t.cause)},Bg=function(e,t,r,i){zT&&(XT?XT(e,t):KT(e,"stack",YT(r,i)))},jg=wg,Gg=function(e,t){return void 0===e?arguments.length<2?"":t:Ng(e)},Wg=Hs("toStringTag"),Hg=Error,Kg=[].push,Yg=function(e,t){var r,i=kg(zg,this);Lg?r=Lg(new Hg,i?Pg(this):zg):(r=i?this:Ug(zg),xg(r,Wg,"Error")),void 0!==t&&xg(r,"message",Gg(t)),Bg(r,Yg,r.stack,1),arguments.length>2&&Fg(r,arguments[2]);var n=[];return jg(e,Kg,{that:n}),xg(r,"errors",n),r};Lg?Lg(Yg,Hg):Mg(Yg,Hg,{name:!0});var zg=Yg.prototype=Ug(Hg.prototype,{constructor:Vg(1,Yg),message:Vg(1,""),name:Vg(1,"AggregateError")});Dg({global:!0,constructor:!0,arity:2},{AggregateError:Yg});var Xg,Zg,Jg,Qg,qg=Mo,$g=Yl,eS=no,tS=Hs("species"),rS=Bn,iS=TypeError,nS=function(e,t){if(rS(t,e))return e;throw new iS("Incorrect invocation")},oS=Ru,sS=is,aS=TypeError,cS=La,dS=function(e){if(oS(e))return e;throw new aS(sS(e)+" is not a constructor")},uS=vo,lS=Hs("species"),hS=function(e,t){var r,i=cS(e).constructor;return void 0===i||uS(r=cS(i)[lS])?t:dS(r)},pS=TypeError,fS=function(e,t){if(e<t)throw new pS("Not enough arguments");return e},mS=/(?:ipad|iphone|ipod).*applewebkit/i.test(Vo),ES=Gn,_S=zn,TS=Ca,gS=ro,SS=Ns,vS=Pn,yS=fl,RS=Ul,AS=na,bS=fS,OS=mS,IS=G_,CS=ES.setImmediate,wS=ES.clearImmediate,NS=ES.process,DS=ES.Dispatch,kS=ES.Function,PS=ES.MessageChannel,LS=ES.String,MS=0,US={},xS="onreadystatechange";vS((function(){Xg=ES.location}));var VS=function(e){if(SS(US,e)){var t=US[e];delete US[e],t()}},FS=function(e){return function(){VS(e)}},BS=function(e){VS(e.data)},jS=function(e){ES.postMessage(LS(e),Xg.protocol+"//"+Xg.host)};CS&&wS||(CS=function(e){bS(arguments.length,1);var t=gS(e)?e:kS(e),r=RS(arguments,1);return US[++MS]=function(){_S(t,void 0,r)},Zg(MS),MS},wS=function(e){delete US[e]},IS?Zg=function(e){NS.nextTick(FS(e))}:DS&&DS.now?Zg=function(e){DS.now(FS(e))}:PS&&!OS?(Qg=(Jg=new PS).port2,Jg.port1.onmessage=BS,Zg=TS(Qg.postMessage,Qg)):ES.addEventListener&&gS(ES.postMessage)&&!ES.importScripts&&Xg&&"file:"!==Xg.protocol&&!vS(jS)?(Zg=jS,ES.addEventListener("message",BS,!1)):Zg=xS in AS("script")?function(e){yS.appendChild(AS("script"))[xS]=function(){yS.removeChild(this),VS(e)}}:function(e){setTimeout(FS(e),0)});var GS={set:CS,clear:wS},WS=Gn,HS=no,KS=Object.getOwnPropertyDescriptor,YS=function(e){if(!HS)return WS[e];var t=KS(WS,e);return t&&t.value},zS=function(){this.head=null,this.tail=null};zS.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 XS,ZS,JS,QS,qS,$S=zS,ev=/ipad|iphone|ipod/i.test(Vo)&&"undefined"!=typeof Pebble,tv=/web0s(?!.*chrome)/i.test(Vo),rv=Gn,iv=YS,nv=Ca,ov=GS.set,sv=$S,av=mS,cv=ev,dv=tv,uv=G_,lv=rv.MutationObserver||rv.WebKitMutationObserver,hv=rv.document,pv=rv.process,fv=rv.Promise,mv=iv("queueMicrotask");if(!mv){var Ev=new sv,_v=function(){var e,t;for(uv&&(e=pv.domain)&&e.exit();t=Ev.get();)try{t()}catch(e){throw Ev.head&&XS(),e}e&&e.enter()};av||uv||dv||!lv||!hv?!cv&&fv&&fv.resolve?((QS=fv.resolve(void 0)).constructor=fv,qS=nv(QS.then,QS),XS=function(){qS(_v)}):uv?XS=function(){pv.nextTick(_v)}:(ov=nv(ov,rv),XS=function(){ov(_v)}):(ZS=!0,JS=hv.createTextNode(""),new lv(_v).observe(JS,{characterData:!0}),XS=function(){JS.data=ZS=!ZS}),mv=function(e){Ev.head||XS(),Ev.add(e)}}var Tv=mv,gv=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Sv=Gn.Promise,vv=Gn,yv=Sv,Rv=ro,Av=Aa,bv=uu,Ov=Hs,Iv=j_,Cv=Ko,wv=yv&&yv.prototype,Nv=Ov("species"),Dv=!1,kv=Rv(vv.PromiseRejectionEvent),Pv=Av("Promise",(function(){var e=bv(yv),t=e!==String(yv);if(!t&&66===Cv)return!0;if(!wv.catch||!wv.finally)return!0;if(!Cv||Cv<51||!/native code/.test(e)){var r=new yv((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};if((r.constructor={})[Nv]=i,!(Dv=r.then((function(){}))instanceof i))return!0}return!(t||"BROWSER"!==Iv&&"DENO"!==Iv||kv)})),Lv={CONSTRUCTOR:Pv,REJECTION_EVENT:kv,SUBCLASSING:Dv},Mv={},Uv=as,xv=TypeError,Vv=function(e){var t,r;this.promise=new e((function(e,i){if(void 0!==t||void 0!==r)throw new xv("Bad Promise constructor");t=e,r=i})),this.resolve=Uv(t),this.reject=Uv(r)};Mv.f=function(e){return new Vv(e)};var Fv,Bv,jv=sc,Gv=G_,Wv=Gn,Hv=ao,Kv=Hl,Yv=Eh,zv=function(e){var t=qg(e);eS&&t&&!t[tS]&&$g(t,tS,{configurable:!0,get:function(){return this}})},Xv=as,Zv=ro,Jv=wo,Qv=nS,qv=hS,$v=GS.set,ey=Tv,ty=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}},ry=gv,iy=$S,ny=kh,oy=Sv,sy=Lv,ay=Mv,cy="Promise",dy=sy.CONSTRUCTOR,uy=sy.REJECTION_EVENT,ly=ny.getterFor(cy),hy=ny.set,py=oy&&oy.prototype,fy=oy,my=py,Ey=Wv.TypeError,_y=Wv.document,Ty=Wv.process,gy=ay.f,Sy=gy,vy=!!(_y&&_y.createEvent&&Wv.dispatchEvent),yy="unhandledrejection",Ry=function(e){var t;return!(!Jv(e)||!Zv(t=e.then))&&t},Ay=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&&wy(t),t.rejection=1),!0===a?r=o:(u&&u.enter(),r=a(o),u&&(u.exit(),n=!0)),r===e.promise?d(new Ey("Promise-chain cycle")):(i=Ry(r))?Hv(i,r,c,d):c(r)):d(o)}catch(e){u&&!n&&u.exit(),d(e)}},by=function(e,t){e.notified||(e.notified=!0,ey((function(){for(var r,i=e.reactions;r=i.get();)Ay(r,e);e.notified=!1,t&&!e.rejection&&Iy(e)})))},Oy=function(e,t,r){var i,n;vy?((i=_y.createEvent("Event")).promise=t,i.reason=r,i.initEvent(e,!1,!0),Wv.dispatchEvent(i)):i={promise:t,reason:r},!uy&&(n=Wv["on"+e])?n(i):e===yy&&ty("Unhandled promise rejection",r)},Iy=function(e){Hv($v,Wv,(function(){var t,r=e.facade,i=e.value;if(Cy(e)&&(t=ry((function(){Gv?Ty.emit("unhandledRejection",i,r):Oy(yy,r,i)})),e.rejection=Gv||Cy(e)?2:1,t.error))throw t.value}))},Cy=function(e){return 1!==e.rejection&&!e.parent},wy=function(e){Hv($v,Wv,(function(){var t=e.facade;Gv?Ty.emit("rejectionHandled",t):Oy("rejectionhandled",t,e.value)}))},Ny=function(e,t,r){return function(i){e(t,i,r)}},Dy=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,by(e,!0))},ky=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw new Ey("Promise can't be resolved itself");var i=Ry(t);i?ey((function(){var r={done:!1};try{Hv(i,t,Ny(ky,r,e),Ny(Dy,r,e))}catch(t){Dy(r,t,e)}})):(e.value=t,e.state=1,by(e,!1))}catch(t){Dy({done:!1},t,e)}}};dy&&(my=(fy=function(e){Qv(this,my),Xv(e),Hv(Fv,this);var t=ly(this);try{e(Ny(ky,t),Ny(Dy,t))}catch(e){Dy(t,e)}}).prototype,(Fv=function(e){hy(this,{type:cy,done:!1,notified:!1,parent:!1,reactions:new iy,rejection:!1,state:0,value:null})}).prototype=Kv(my,"then",(function(e,t){var r=ly(this),i=gy(qv(this,fy));return r.parent=!0,i.ok=!Zv(e)||e,i.fail=Zv(t)&&t,i.domain=Gv?Ty.domain:void 0,0===r.state?r.reactions.add(i):ey((function(){Ay(i,r)})),i.promise})),Bv=function(){var e=new Fv,t=ly(e);this.promise=e,this.resolve=Ny(ky,t),this.reject=Ny(Dy,t)},ay.f=gy=function(e){return e===fy||undefined===e?new Bv(e):Sy(e)}),jv({global:!0,constructor:!0,wrap:!0,forced:dy},{Promise:fy}),Yv(fy,cy,!1,!0),zv(cy);var Py=Hs("iterator"),Ly=!1;try{var My=0,Uy={next:function(){return{done:!!My++}},return:function(){Ly=!0}};Uy[Py]=function(){return this},Array.from(Uy,(function(){throw 2}))}catch(e){}var xy=Sv,Vy=function(e,t){try{if(!t&&!Ly)return!1}catch(e){return!1}var r=!1;try{var i={};i[Py]=function(){return{next:function(){return{done:r=!0}}}},e(i)}catch(e){}return r},Fy=Lv.CONSTRUCTOR||!Vy((function(e){xy.all(e).then(void 0,(function(){}))})),By=ao,jy=as,Gy=Mv,Wy=gv,Hy=wg;sc({target:"Promise",stat:!0,forced:Fy},{all:function(e){var t=this,r=Gy.f(t),i=r.resolve,n=r.reject,o=Wy((function(){var r=jy(t.resolve),o=[],s=0,a=1;Hy(e,(function(e){var c=s++,d=!1;a++,By(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 Ky=sc,Yy=Lv.CONSTRUCTOR;Sv&&Sv.prototype,Ky({target:"Promise",proto:!0,forced:Yy,real:!0},{catch:function(e){return this.then(void 0,e)}});var zy=ao,Xy=as,Zy=Mv,Jy=gv,Qy=wg;sc({target:"Promise",stat:!0,forced:Fy},{race:function(e){var t=this,r=Zy.f(t),i=r.reject,n=Jy((function(){var n=Xy(t.resolve);Qy(e,(function(e){zy(n,t,e).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}});var qy=Mv;sc({target:"Promise",stat:!0,forced:Lv.CONSTRUCTOR},{reject:function(e){var t=qy.f(this);return(0,t.reject)(e),t.promise}});var $y=La,eR=wo,tR=Mv,rR=function(e,t){if($y(e),eR(t)&&t.constructor===e)return t;var r=tR.f(e);return(0,r.resolve)(t),r.promise},iR=sc,nR=Sv,oR=Lv.CONSTRUCTOR,sR=rR,aR=Mo("Promise"),cR=!oR;iR({target:"Promise",stat:!0,forced:true},{resolve:function(e){return sR(cR&&this===aR?nR:this,e)}});var dR=ao,uR=as,lR=Mv,hR=gv,pR=wg;sc({target:"Promise",stat:!0,forced:Fy},{allSettled:function(e){var t=this,r=lR.f(t),i=r.resolve,n=r.reject,o=hR((function(){var r=uR(t.resolve),n=[],o=0,s=1;pR(e,(function(e){var a=o++,c=!1;s++,dR(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 fR=ao,mR=as,ER=Mo,_R=Mv,TR=gv,gR=wg,SR="No one promise resolved";sc({target:"Promise",stat:!0,forced:Fy},{any:function(e){var t=this,r=ER("AggregateError"),i=_R.f(t),n=i.resolve,o=i.reject,s=TR((function(){var i=mR(t.resolve),s=[],a=0,c=1,d=!1;gR(e,(function(e){var u=a++,l=!1;c++,fR(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,SR)))}))})),--c||o(new r(s,SR))}));return s.error&&o(s.value),i.promise}});var vR=sc,yR=zn,RR=Ul,AR=Mv,bR=as,OR=gv,IR=Gn.Promise,CR=!1;vR({target:"Promise",stat:!0,forced:!IR||!IR.try||OR((function(){IR.try((function(e){CR=8===e}),8)})).error||!CR},{try:function(e){var t=arguments.length>1?RR(arguments,1):[],r=AR.f(this),i=OR((function(){return yR(bR(e),void 0,t)}));return(i.error?r.reject:r.resolve)(i.value),r.promise}});var wR=Mv;sc({target:"Promise",stat:!0},{withResolvers:function(){var e=wR.f(this);return{promise:e.promise,resolve:e.resolve,reject:e.reject}}});var NR=sc,DR=Sv,kR=Pn,PR=Mo,LR=ro,MR=hS,UR=rR,xR=DR&&DR.prototype;NR({target:"Promise",proto:!0,real:!0,forced:!!DR&&kR((function(){xR.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=MR(this,PR("Promise")),r=LR(e);return this.then(r?function(r){return UR(t,e()).then((function(){return r}))}:e,r?function(r){return UR(t,e()).then((function(){throw r}))}:e)}});var VR=Z(No.Promise);class FR extends fi{set _mediaStreamTrack(e){e!==this.mediaStreamTrack&&(this.safeEmit(Nd.TRACK_UPDATED,e),this.mediaStreamTrack=e)}get _mediaStreamTrack(){return this.mediaStreamTrack}constructor(e,t){super(),p_(this,"trackMediaType",void 0),p_(this,"_ID",void 0),p_(this,"_rtpTransceiver",void 0),p_(this,"_lowRtpTransceiver",void 0),p_(this,"_hints",[]),p_(this,"_isClosed",!1),p_(this,"_originMediaStreamTrack",void 0),p_(this,"mediaStreamTrack",void 0),p_(this,"_external",{}),this._ID=t||Li(8,"track-"),this._originMediaStreamTrack=e,this.mediaStreamTrack=e,Sd(this)}toString(){return this._ID}getTrackId(){return this._ID}getMediaStreamTrack(e){return e||Di((()=>{var e;In.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===Id.LOW_STREAM?this._lowRtpTransceiver:this._rtpTransceiver}getMediaStreamTrackSettings(){return this.getMediaStreamTrack(!0).getSettings()}close(){this._isClosed=!0,this._lowRtpTransceiver=void 0,this._rtpTransceiver=void 0,vd(this),this.emit(Dd.CLOSED),this.removeAllListeners(Nd.SEI_RECEIVED)}_updateRtpTransceiver(e,t){if(t===Id.LOW_STREAM){if(this._lowRtpTransceiver===e)return;this._lowRtpTransceiver=e}else{if(this._rtpTransceiver===e)return;this._rtpTransceiver=e}this.emit(Nd.TRANSCEIVER_UPDATED,e,t)}}class BR extends FR{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),p_(this,"_enabled",!0),p_(this,"_muted",!1),p_(this,"_isExternalTrack",!1),p_(this,"_isClosed",!1),p_(this,"_enabledMutex",void 0),p_(this,"processor",void 0),p_(this,"_processorContext",void 0),p_(this,"_handleTrackEnded",(()=>{this.onTrackEnded()})),this._enabledMutex=new Hi("".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,Sn.debug("[".concat(this.getTrackId(),"] close")),this.emit(bd.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 Ri(this,bd.NEED_REPLACE_TRACK,this),this.processor&&this._processorContext&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this._processorContext}))}_getDefaultPlayerConfig(){return{}}onTrackEnded(){Sn.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(Dd.TRACK_ENDED)}stateCheck(e,t){if(Sn.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",Sn);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",Sn)}getProcessorStats(){return this._processorContext&&this._processorContext.gatherStats()||[]}getProcessorUsage(){return this._processorContext?this._processorContext.gatherUsage():VR.resolve([])}}function jR(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 GR=window.AudioContext||window.webkitAudioContext;let WR=null;const HR=new class extends fi{constructor(){super(...arguments),p_(this,"prevState",void 0),p_(this,"curState",void 0),p_(this,"currentTime",void 0),p_(this,"currentTimeStuckAt",void 0),p_(this,"interruptDetectorTrack",void 0),p_(this,"onLocalAudioTrackMute",(()=>{Sn.info("ios15-interruption-start"),this.emit(kn.IOS_15_16_INTERRUPTION_START)})),p_(this,"onLocalAudioTrackUnmute",(async()=>{Sn.info("ios15-interruption-end"),"running"!==this.curState||this.duringInterruption?Sn.info("ios15-interruption-end-canceled"):(WR&&await WR.suspend(),this.emit(kn.IOS_15_16_INTERRUPTION_END))}))}get duringInterruption(){return"running"===this.prevState&&"interrupted"===this.curState}bindInterruptDetectorTrack(e){Sn.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){Sn.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 KR(){if(!GR)return void Sn.error("your browser is not support web audio");Sn.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?jR(Object(r),!0).forEach((function(t){p_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jR(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},an("WEBAUDIO_INIT_OPTIONS"));Sn.debug("audio context init option:",JSON.stringify(e)),WR=new GR(e),HR.curState=WR.state,WR.onstatechange=()=>{HR.prevState=HR.curState,HR.curState=WR?WR.state:void 0;const{prevState:e,curState:t}=HR,r="running"===t,i="interrupted"===t,n="running"===e,o="suspended"===e,s="interrupted"===e,a=Dr().osVersion;(Br()||Xr())&&n&&i&&(Sn.info("ios".concat(a,"-interruption-start")),HR.emit(kn.IOS_INTERRUPTION_START)),(Br()||Xr())&&(o||s)&&r&&(Sn.info("ios".concat(a,"-interruption-end")),HR.emit(kn.IOS_INTERRUPTION_END)),e!==t&&HR.emit(kn.STATE_CHANGE,t,e)},setInterval((()=>{var e;const t=null===(e=WR)||void 0===e?void 0:e.currentTime;if(HR.currentTime!==t)HR.currentTimeStuckAt&&(Sn.debug("AudioContext current time resume at ".concat(t)),HR.currentTimeStuckAt=void 0),HR.currentTime=t;else{if(t!==HR.currentTimeStuckAt){In.reportApiInvoke(null,{name:"WEB_AUDIO_CURRENT_TIME_STUCK",options:{currentTime:t},tag:gi.TRACER}).onSuccess(),Sn.warning("AudioContext current time stuck at ".concat(t))}HR.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):Br()||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(e){if(!o)if(r.paused)if(e){let e;h(!1),o=!0;try{e=r.play(),e?e.then(p,p):(r.addEventListener("playing",p),r.addEventListener("abort",p),r.addEventListener("error",p))}catch(e){p()}}else h(!0);else h(!1)}function h(e){if(n!==e){n=e;for(let r=0,i=t;r<i.length;r++){const t=i[r];e?window.addEventListener(t,f,{capture:!0,passive:!0}):window.removeEventListener(t,f,{capture:!0,passive:!0})}}}function p(){r.removeEventListener("playing",p),r.removeEventListener("abort",p),r.removeEventListener("error",p),o=!1,l(!1)}function f(){l(!0)}if(Br()){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,l(!0)}HR.on(kn.STATE_CHANGE,c),s(!1)}(WR)}function YR(){if(!WR){if(KR(),!WR)throw new ni(ii.NOT_SUPPORTED,"can not create audio context");return WR}return WR}function zR(){return!!WR}function XR(e){if(function(){if(null!==JR)return JR;const e=YR(),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(),JR=n,n}())return;const t=e.connect,r=e.disconnect;e.connect=(r,i,n)=>{var o;return e._inputNodes||(e._inputNodes=[]),sd(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?Oi(e._inputNodes,i):e._inputNodes=[];for(const r of e._inputNodes)t.call(e,r)}}function ZR(e){const t=YR();return new VR(((r,i)=>{t.decodeAudioData(e,(e=>{r(e)}),(e=>{i(new ni(ii.DECODE_AUDIO_FILE_FAILED,e.toString()))}))}))}let JR=null;let QR=null;function qR(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 $R=Z(X_);class eA{constructor(){p_(this,"context",void 0),p_(this,"analyserNode",void 0),p_(this,"sourceNode",void 0),this.context=YR(),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||Br()||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=$R(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){Sn.warning("rebuild analyser node failed.")}}destroy(){this.updateSource(void 0)}}class tA 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(),p_(this,"outputNode",void 0),p_(this,"outputTrack",void 0),p_(this,"isPlayed",!1),p_(this,"sourceNode",void 0),p_(this,"context",void 0),p_(this,"audioBufferNode",void 0),p_(this,"destNode",void 0),p_(this,"audioOutputLevel",0),p_(this,"volumeLevelAnalyser",void 0),p_(this,"_processedNode",void 0),p_(this,"playNode",void 0),p_(this,"isDestroyed",!1),p_(this,"onNoAudioInput",void 0),p_(this,"isNoAudioInput",!1),p_(this,"_noAudioInputCount",0),this.context=YR(),this.playNode=this.context.destination,this.outputNode=this.context.createGain(),XR(this.outputNode),this.volumeLevelAnalyser=new eA}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(Ld.ON_AUDIO_BUFFER,qR(e))})}stopGetAudioBuffer(){this.audioBufferNode&&(this.audioBufferNode.onaudioprocess=null,this.outputNode.disconnect(this.audioBufferNode),this.audioBufferNode=void 0)}createOutputTrack(){if(!Nn().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&&Ii((()=>{HR.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;Br()||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 Pi(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 rA extends tA{get isFreeze(){return!1}constructor(e,t,r){var i;if(super(),p_(this,"sourceNode",void 0),p_(this,"track",void 0),p_(this,"clonedTrack",void 0),p_(this,"audioElement",void 0),p_(this,"isCurrentTrackCloned",!1),p_(this,"isRemoteTrack",!1),p_(this,"originVolumeLevelAnalyser",void 0),p_(this,"rebuildWebAudio",(async()=>{if(Sn.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 Sn.debug("rebuild web audio success, current volume status",this.getAccurateVolumeLevel());this.context.resume().then((()=>Sn.info("resume success"))),Sn.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),XR(this.sourceNode),this.volumeLevelAnalyser.rebuildAnalyser();const r=this.outputNode.gain.value;this.outputNode=this.context.createGain(),this.outputNode.gain.setValueAtTime(r,this.context.currentTime),XR(this.outputNode),this.emit(Ld.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),XR(this.sourceNode),r){const e=r.clone();e.enabled=!0,this.clonedTrack=e,Sn.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]));XR(t),this.originVolumeLevelAnalyser=new eA,this.originVolumeLevelAnalyser.updateSource(t)}this.connect(),this.audioElement=document.createElement("audio"),this.audioElement.srcObject=n;const o=Dr();t&&o.os===Or.IOS&&Number(null===(i=o.osVersion)||void 0===i?void 0:i.split(".")[0])<15&&(HR.on(kn.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),XR(this.sourceNode),this.processedNode||this.sourceNode.connect(this.outputNode),this.emit(Ld.UPDATE_SOURCE),this.audioElement.srcObject=t}destroy(){var e;this.audioElement.srcObject=null,this.audioElement.remove(),HR.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),Sn.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]));XR(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 nA(e,t){const r=await oA(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 oA(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 VR(((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 sA(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 aA=new Hi("safari");async function cA(e,t){let r=0,i=null;for(;r<2;)try{i=await dA(e,t,r>0);break}catch(e){if(e instanceof ni)throw Sn.error("[".concat(t,"] ").concat(e.toString())),e;const i=uA(e.name||e.code||e,e.message);if(i.code===ii.MEDIA_OPTION_INVALID){Sn.debug("[".concat(t,"] detect media option invalid, retry")),r+=1,await Pi(500);continue}throw Sn.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 dA(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=Nn(),o=new MediaStream;if(t.audioSource&&o.addTrack(t.audioSource),t.videoSource&&o.addTrack(t.videoSource),!t.audio&&!t.video&&!t.screen)return Sn.debug("Using Video Source/ Audio Source"),o;if(t.screen)if(mi())if(t.screen.sourceId){lA(o,await iA(t.screen.sourceId,t.screen,!!t.screenAudio))}else{lA(o,await nA(t.screen,!!t.screenAudio))}else if(Ur()&&t.screen.extensionId&&t.screen.mandatory){if(!n.getStreamFromExtension)throw new ni(ii.NOT_SUPPORTED,"This browser does not support screen sharing");Sn.debug("[".concat(r,'] Screen access on chrome stable, looking for extension"'));const e=await(a=t.screen.extensionId,c=r,new VR(((e,t)=>{try{chrome.runtime.sendMessage(a,{getStream:!0},(r=>{if(!r||!r.streamId)return Sn.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){Sn.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;lA(o,await navigator.mediaDevices.getUserMedia({video:{mandatory:t.screen.mandatory}}))}else if(n.getDisplayMedia){var s;t.screen.mediaSource&&Ad(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}=t.screen,d={selfBrowserSurface:i,surfaceSwitching:n,systemAudio:a,preferCurrentTab:c};!i&&delete d.selfBrowserSurface,!n&&delete d.surfaceSwitching,!a&&delete d.systemAudio,!c&&delete d.preferCurrentTab,Sn.debug("[".concat(r,"] getDisplayMedia:"),JSON.stringify({video:e,audio:t.screenAudio,controls:d}));const u=await navigator.mediaDevices.getDisplayMedia(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?sA(Object(r),!0).forEach((function(t){p_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({video:e,audio:t.screenAudio},d));lA(o,u)}else{if(!Fr())throw Sn.error("[".concat(r,"] This browser does not support screenSharing")),new ni(ii.NOT_SUPPORTED,"This browser does not support screen sharing");{t.screen.mediaSource&&Ad(t.screen.mediaSource);const e={video:{mediaSource:t.screen.mediaSource,width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate}};Sn.debug("[".concat(r,"] getUserMedia: ").concat(JSON.stringify(e)));lA(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=an("MEDIA_DEVICE_CONSTRAINTS");if(u)try{"string"==typeof u&&(u=JSON.parse(u)),d=Fi(d,u)}catch(e){}Sn.debug("[".concat(r,"] GetUserMedia"),JSON.stringify(d)),Dr();let l,h=null;(xr()||Br()||Mr())&&(h=await aA.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),lA(o,l),h&&h(),o}function uA(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 Sn.error("getUserMedia unexpected error",e),new ni(ii.UNEXPECTED_ERROR,"".concat(e,": ").concat(t))}}function lA(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 hA extends fi{get state(){return this._state}set state(e){e!==this._state&&(this.emit(Wd.STATE_CHANGE,e),this._state=e)}constructor(){super(),p_(this,"_state",Gd.IDLE),p_(this,"isAccessMicrophonePermission",!1),p_(this,"isAccessCameraPermission",!1),p_(this,"lastAccessMicrophonePermission",!1),p_(this,"lastAccessCameraPermission",!1),p_(this,"checkdeviceMatched",!1),p_(this,"deviceInfoMap",new Map),this.init().then((()=>{navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",this.updateDevicesInfo.bind(this)),window.setInterval((()=>{(an("ENUMERATE_DEVICES_INTERVAL")||(qr()||Pr()===Or.HARMONY_OS)&&Qr())&&this.updateDevicesInfo()}),an("ENUMERATE_DEVICES_INTERVAL_TIME"))})).catch((e=>Sn.error(e.toString())))}async enumerateDevices(t,r){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices){return new ni(ii.NOT_SUPPORTED,"enumerateDevices() not supported.").throw()}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(aA.isLocked){Sn.debug("[device manager] wait GUM lock");(await aA.lock())(),Sn.debug("[device manager] GUM unlock")}if(e.HAS_GUM_AUDIO&&(s=!1,this.isAccessMicrophonePermission=!0),e.HAS_GUM_VIDEO&&(a=!1,this.isAccessCameraPermission=!0),Sn.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=uA(e.name||e.code||e,e.message);if(t.code===ii.PERMISSION_DENIED)throw t;Sn.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=uA(e.name||e.code||e,e.message);if(t.code===ii.PERMISSION_DENIED)throw t;Sn.warning("getUserMedia failed in getDevices",t)}this.isAccessMicrophonePermission=!0}else if(a){try{d=await navigator.mediaDevices.getUserMedia({video:r})}catch(e){const t=uA(e.name||e.code||e,e.message);if(t.code===ii.PERMISSION_DENIED)throw t;Sn.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0}Sn.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=Gd.INITING;try{await this.updateDevicesInfo(),this.state=Gd.INITEND}catch(e){if(Sn.warning("Device Detection functionality cannot start properly.",e.toString()),this.state=Gd.IDLE,!("boolean"==typeof isSecureContext?isSecureContext:"https:"===location.protocol||"file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname||"::1"===location.hostname)){new ni(ii.WEB_SECURITY_RESTRICT,"Your context is limited by web security, please try using https protocol or localhost.").throw()}throw 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?Sn.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is the same group")):Sn.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is not the same group")):Sn.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!==Gd.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(Wd.RECORDING_DEVICE_CHANGED,e);break;case"videoinput":this.lastAccessCameraPermission&&this.isAccessCameraPermission&&this.emit(Wd.CAMERA_DEVICE_CHANGED,e);break;case"audiooutput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(Wd.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 pA=new hA;let fA=!1;const mA=new class extends fi{constructor(){super(...arguments),p_(this,"onAutoplayFailed",void 0),p_(this,"onAudioAutoplayFailed",void 0)}};function EA(){if(Dr(),!fA){const e=t=>{t.preventDefault(),fA=!1,$r()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};fA=!0,$r()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),Sn.info("detect media autoplay failed, document: https://docs.agora.io/cn/Voice/autoplay_policy_web_ng?platform=Web"),mA.onAutoplayFailed?mA.onAutoplayFailed():mA.onAudioAutoplayFailed?Sn.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 ."):Sn.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 ."),mA.emit("autoplay-failed")}}function _A(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 TA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_A(Object(r),!0).forEach((function(t){p_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_A(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=In.getBaseInfoBySessionId(e);if(!n)return;const o=n.info,s=Date.now(),a=TA(TA({},o),{},{vid:void 0===o.vid?0:Number(o.vid),lts:s,elapse:s-n.startTime,cbRegistered:mA.onAutoplayFailed||mA.onAudioAutoplayFailed?1:-1,errorMsg:r,mediaType:t,trackId:i,extend:void 0});In.send({type:An.AUTOPLAY_FAILED,data:a},!0)}const SA=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","error"],vA=new class{constructor(){p_(this,"onAutoplayFailed",void 0),p_(this,"elementMap",new Map),p_(this,"elementStateMap",new Map),p_(this,"elementsNeedToResume",[]),p_(this,"sinkIdMap",new Map),p_(this,"autoResumeAfterInterruption",(e=>{Array.from(this.elementMap.entries()).forEach((t=>{let[r,i]=t;const n=this.elementStateMap.get(r),o=i.srcObject.getAudioTracks()[0],s=o&&o.readyState;if(Sn.debug("resume after interrupted, ele: ".concat(n," audio: ").concat(s," ").concat(e)),"live"===s){if(e)return i.pause(),void i.play();if("running"===HR.curState)return Kr()?(i.pause(),void i.play()):void(n&&"paused"===n&&i.play())}}))})),p_(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{Array.from(this.elementMap.entries()).forEach((e=>{let[t,r]=e;const i=r.srcObject.getAudioTracks()[0];i&&"live"===i.readyState&&(Sn.debug("auto resume after interruption inside autoResumeAfterInterruptionOnIOS15"),r.pause(),r.play())}))})),this.autoResumeAudioElement(),HR.on(kn.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),HR.on(kn.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),HR.on(kn.STATE_CHANGE,(()=>{Br()&&"suspended"===HR.prevState&&"running"===HR.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,Hd.INIT),this.setVolume(t,r);const o=this.sinkIdMap.get(t);if(o)try{n.setSinkId(o).catch((e=>{Sn.warning("[".concat(t,"] set sink id failed"),e.toString())}))}catch(e){Sn.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),Sn.warning("audio element play warning",e.toString()),this.elementMap.has(t)&&"NotAllowedError"===e.name&&(Sn.warning("detected audio element autoplay failed"),this.elementsNeedToResume.push(n),Ii((()=>{this.onAutoplayFailed&&this.onAutoplayFailed(),EA()})))}))}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)}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){SA.forEach((r=>{t.addEventListener(r,(r=>{const i=this.elementStateMap.get(e),n="pause"===r.type?"paused":r.type;if(Sn.debug("[".concat(e,"] audio-element-status change ").concat(i," => ").concat(n)),"error"===r.type){const r=null==t?void 0:t.error;r&&Sn.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=>{Sn.debug("Auto resume audio element success")})).catch((e=>{Sn.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 yA(){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",Sn);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 VR?new VR(((e,t)=>{n.then(e).catch(t)})):n}),r}}var RA=Cc("Array","values"),AA=Wc,bA=Ns,OA=Bn,IA=RA,CA=Array.prototype,wA={DOMTokenList:!0,NodeList:!0},NA=Z((function(e){var t=e.values;return e===CA||OA(CA,e)&&t===CA.values||bA(wA,AA(e))?IA:t}));function DA(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 kA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?DA(Object(r),!0).forEach((function(t){p_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):DA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class PA extends fi{constructor(e){super(),p_(this,"name","VideoProcessorDestination"),p_(this,"ID","0"),p_(this,"_source",void 0),p_(this,"videoContext",void 0),p_(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(Bd.ON_TRACK,e.track))}reset(){this.inputTrack=void 0,this.videoContext.chained=!1,this.emit(Bd.ON_TRACK,void 0)}}class LA extends fi{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t){super(),p_(this,"constraintsMap",new Map),p_(this,"statsRegistry",[]),p_(this,"usageRegistry",[]),p_(this,"trackId",void 0),p_(this,"direction",void 0),p_(this,"_chained",!1),this.trackId=e,this.direction=t}async getConstraints(){return await yi(this,jd.REQUEST_CONSTRAINTS)}async requestApplyConstraints(e,t){var r;return Sn.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),Ri(this,jd.REQUEST_UPDATE_CONSTRAINTS,Array.from(NA(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return Sn.info("processor ".concat(e.name," requestRevertConstraints for ").concat(this.trackId)),this.constraintsMap.delete(e),Ri(this,jd.REQUEST_UPDATE_CONSTRAINTS,Array.from(NA(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){Sn.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 VR&&(r=await r),e.push(kA(kA({},r),{},{direction:this.direction}))}catch(e){Sn.error("gather extension usage error",e)}return e}getDirection(){return this.direction}}class MA extends fi{constructor(e){super(),p_(this,"name","AudioProcessorDestination"),p_(this,"ID","0"),p_(this,"inputTrack",void 0),p_(this,"inputNode",void 0),p_(this,"audioProcessorContext",void 0),p_(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(Bd.ON_TRACK,void 0),this.emit(Bd.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(Bd.ON_TRACK,this.inputTrack)),e.node&&this.inputNode!==e.node&&(this.audioProcessorContext.chained=!0,this.inputNode=e.node,this.emit(Bd.ON_NODE,this.inputNode))}}class UA extends fi{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t,r){super(),p_(this,"constraintsMap",new Map),p_(this,"statsRegistry",[]),p_(this,"audioContext",void 0),p_(this,"trackId",void 0),p_(this,"direction",void 0),p_(this,"usageRegistry",[]),p_(this,"_chained",!1),this.audioContext=e,this.trackId=t,this.direction=r}async getConstraints(){return yi(this,jd.REQUEST_CONSTRAINTS)}getAudioContext(){return this.audioContext}async requestApplyConstraints(e,t){var r;return Sn.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),Ri(this,jd.REQUEST_UPDATE_CONSTRAINTS,Array.from(NA(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return this.constraintsMap.delete(e),Ri(this,jd.REQUEST_UPDATE_CONSTRAINTS,Array.from(NA(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){Sn.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 VR&&(r=await r),e.push(kA(kA({},r),{},{direction:this.direction}))}catch(e){Sn.error("gather extension usage error",e)}return e}getDirection(){return this.direction}}class xA extends fi{get isPlayed(){return!0}get isFreeze(){return!1}constructor(){super(),p_(this,"context",void 0),p_(this,"processSourceNode",void 0),p_(this,"outputTrack",void 0),p_(this,"processedNode",void 0),p_(this,"clonedTrack",void 0),p_(this,"outputNode",void 0),this.outputNode=new VA}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 VA{disconnect(){}connect(){}}function FA(e){return new VR(((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=Br()?"canplay":"playing";n.addEventListener(o,(()=>{const e=n.videoWidth,r=n.videoHeight;!e&&Fr()||(i=!0,n.srcObject=null,n.remove(),t([e,r]))})),n.srcObject=new MediaStream([e]),n.play().catch(Mi),setTimeout((()=>{i||(n.srcObject=null,n.remove(),t([n.videoWidth,n.videoHeight]))}),4e3)}))}function BA(e){const t={};e.facingMode&&(t.facingMode=e.facingMode),e.cameraId&&(t.deviceId={exact:e.cameraId});const r=fd(e.encoderConfig);return null!=r.width&&(t.width=r.width),null!=r.height&&(t.height=r.height),!Zr()&&r.frameRate&&(t.frameRate=r.frameRate),Vr()&&"object"==typeof t.frameRate&&(t.frameRate.max=60),Fr()&&(t.frameRate={ideal:30,max:30}),t}function jA(e){const t={};e.screenSourceType&&(t.mediaSource=e.screenSourceType),e.extensionId&&Ur()&&(t.extensionId=e.extensionId);const{displaySurface:r,selfBrowserSurface:i,surfaceSwitching:n,systemAudio:o,preferCurrentTab:s}=e;(jr(107)||Wr(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)),(jr(105)||Wr(105)||Hr(91))&&o&&(si(o,"systemAudio",["exclude","include"]),t.systemAudio=o),(jr(94)||Wr(94)||Hr(80))&&s&&(t.preferCurrentTab=!0),e.electronScreenSourceId&&(t.sourceId=e.electronScreenSourceId);const a=e.encoderConfig?md(e.encoderConfig):null;return t.mandatory={chromeMediaSource:"desktop",maxWidth:a?a.width:void 0,maxHeight:a?a.height:void 0},a&&(a.frameRate&&("number"==typeof a.frameRate?(t.mandatory.maxFrameRate=a.frameRate,t.mandatory.minFrameRate=a.frameRate):(t.mandatory.maxFrameRate=a.frameRate.max||a.frameRate.ideal||a.frameRate.exact||void 0,t.mandatory.minFrameRate=a.frameRate.min||a.frameRate.ideal||a.frameRate.exact||void 0),t.frameRate=a.frameRate),a.width&&(t.width=a.width),a.height&&(t.height=a.height)),t}function GA(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,Ur()&&e.ANS&&(t.googHighpassFilter=e.ANS))),t}function WA(e){return GA(e)}function HA(e){const t=GA(e);if(e.encoderConfig){const r=Td(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 KA=is,YA=TypeError,zA=Ul,XA=Math.floor,ZA=function(e,t){var r=e.length;if(r<8)for(var i,n,o=1;o<r;){for(n=o,i=e[o];n&&t(e[n-1],i)>0;)e[n]=e[--n];n!==o++&&(e[n]=i)}else for(var s=XA(r/2),a=ZA(zA(e,0,s),t),c=ZA(zA(e,s),t),d=a.length,u=c.length,l=0,h=0;l<d||h<u;)e[l+h]=l<d&&h<u?t(a[l],c[h])<=0?a[l++]:c[h++]:l<d?a[l++]:c[h++];return e},JA=ZA,QA=Vo.match(/firefox\/(\d+)/i),qA=!!QA&&+QA[1],$A=/MSIE|Trident/.test(Vo),eb=Vo.match(/AppleWebKit\/(\d+)\./),tb=!!eb&&+eb[1],rb=sc,ib=Fn,nb=as,ob=Is,sb=gc,ab=function(e,t){if(!delete e[t])throw new YA("Cannot delete property "+KA(t)+" of "+KA(e))},cb=Yc,db=Pn,ub=JA,lb=m_,hb=qA,pb=$A,fb=Ko,mb=tb,Eb=[],_b=ib(Eb.sort),Tb=ib(Eb.push),gb=db((function(){Eb.sort(void 0)})),Sb=db((function(){Eb.sort(null)})),vb=lb("sort"),yb=!db((function(){if(fb)return fb<70;if(!(hb&&hb>3)){if(pb)return!0;if(mb)return mb<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++)Eb.push({k:t+i,v:r})}for(Eb.sort((function(e,t){return t.v-e.v})),i=0;i<Eb.length;i++)t=Eb[i].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return"DGBEFHACIJK"!==n}}));rb({target:"Array",proto:!0,forced:gb||!Sb||!vb||!yb},{sort:function(e){void 0!==e&&nb(e);var t=ob(this);if(yb)return void 0===e?_b(t):_b(t,e);var r,i,n=[],o=sb(t);for(i=0;i<o;i++)i in t&&Tb(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:cb(t)>cb(r)?1:-1}}(e)),r=sb(n),i=0;i<r;)t[i]=n[i++];for(;i<o;)ab(t,i++);return t}});var Rb=Cc("Array","sort"),Ab=Bn,bb=Rb,Ob=Array.prototype,Ib=Z((function(e){var t=e.sort;return e===Ob||Ab(Ob,e)&&t===Ob.sort?bb:t}));function Cb(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=NA(o).call(o).next().value,c=1;if(o.has(n))a=o.get(n);else{var d;const e=Ib(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=Ib(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=an("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 m=an("VIDEO_STANDARD_BITRATE_VERSION");return m&&m>0&&(1===m?f=i:2===m?f=h:3===m&&(f=p)),[Math.floor(f/1e3),c]}function wb(e,t,r,i,n){const o=an("BITRATE_ADAPTER_TYPE");if("DEFAULT_BITRATE"===o)return{min:i,max:n};if(void 0===n){const s=Math.floor(200*Math.pow(r/15,.6)*Math.pow(e*t/640/360,.75));n="STANDARD_BITRATE"===o?4*s:2*s,i=null!=i?i:s}else i=null!=i?i:Math.floor(n/10);return{min:i,max:n}}function Nb(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 Db=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,m=1732584193,E=-271733879,_=-1732584194,T=271733878;for(u=0;u<d.length;u+=16)l=m,h=E,p=_,f=T,m=o(m,E,_,T,d[u+0],7,-680876936),T=o(T,m,E,_,d[u+1],12,-389564586),_=o(_,T,m,E,d[u+2],17,606105819),E=o(E,_,T,m,d[u+3],22,-1044525330),m=o(m,E,_,T,d[u+4],7,-176418897),T=o(T,m,E,_,d[u+5],12,1200080426),_=o(_,T,m,E,d[u+6],17,-1473231341),E=o(E,_,T,m,d[u+7],22,-45705983),m=o(m,E,_,T,d[u+8],7,1770035416),T=o(T,m,E,_,d[u+9],12,-1958414417),_=o(_,T,m,E,d[u+10],17,-42063),E=o(E,_,T,m,d[u+11],22,-1990404162),m=o(m,E,_,T,d[u+12],7,1804603682),T=o(T,m,E,_,d[u+13],12,-40341101),_=o(_,T,m,E,d[u+14],17,-1502002290),E=o(E,_,T,m,d[u+15],22,1236535329),m=s(m,E,_,T,d[u+1],5,-165796510),T=s(T,m,E,_,d[u+6],9,-1069501632),_=s(_,T,m,E,d[u+11],14,643717713),E=s(E,_,T,m,d[u+0],20,-373897302),m=s(m,E,_,T,d[u+5],5,-701558691),T=s(T,m,E,_,d[u+10],9,38016083),_=s(_,T,m,E,d[u+15],14,-660478335),E=s(E,_,T,m,d[u+4],20,-405537848),m=s(m,E,_,T,d[u+9],5,568446438),T=s(T,m,E,_,d[u+14],9,-1019803690),_=s(_,T,m,E,d[u+3],14,-187363961),E=s(E,_,T,m,d[u+8],20,1163531501),m=s(m,E,_,T,d[u+13],5,-1444681467),T=s(T,m,E,_,d[u+2],9,-51403784),_=s(_,T,m,E,d[u+7],14,1735328473),E=s(E,_,T,m,d[u+12],20,-1926607734),m=a(m,E,_,T,d[u+5],4,-378558),T=a(T,m,E,_,d[u+8],11,-2022574463),_=a(_,T,m,E,d[u+11],16,1839030562),E=a(E,_,T,m,d[u+14],23,-35309556),m=a(m,E,_,T,d[u+1],4,-1530992060),T=a(T,m,E,_,d[u+4],11,1272893353),_=a(_,T,m,E,d[u+7],16,-155497632),E=a(E,_,T,m,d[u+10],23,-1094730640),m=a(m,E,_,T,d[u+13],4,681279174),T=a(T,m,E,_,d[u+0],11,-358537222),_=a(_,T,m,E,d[u+3],16,-722521979),E=a(E,_,T,m,d[u+6],23,76029189),m=a(m,E,_,T,d[u+9],4,-640364487),T=a(T,m,E,_,d[u+12],11,-421815835),_=a(_,T,m,E,d[u+15],16,530742520),E=a(E,_,T,m,d[u+2],23,-995338651),m=c(m,E,_,T,d[u+0],6,-198630844),T=c(T,m,E,_,d[u+7],10,1126891415),_=c(_,T,m,E,d[u+14],15,-1416354905),E=c(E,_,T,m,d[u+5],21,-57434055),m=c(m,E,_,T,d[u+12],6,1700485571),T=c(T,m,E,_,d[u+3],10,-1894986606),_=c(_,T,m,E,d[u+10],15,-1051523),E=c(E,_,T,m,d[u+1],21,-2054922799),m=c(m,E,_,T,d[u+8],6,1873313359),T=c(T,m,E,_,d[u+15],10,-30611744),_=c(_,T,m,E,d[u+6],15,-1560198380),E=c(E,_,T,m,d[u+13],21,1309151649),m=c(m,E,_,T,d[u+4],6,-145523070),T=c(T,m,E,_,d[u+11],10,-1120210379),_=c(_,T,m,E,d[u+2],15,718787259),E=c(E,_,T,m,d[u+9],21,-343485551),m=i(m,l),E=i(E,h),_=i(_,p),T=i(T,f);return r(m)+r(E)+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))},kb=e=>{const t=document.createElement("canvas");return t.width=2,t.height=2,new VR(((r,i)=>{t.toBlob((async e=>{if(t.remove(),e){const i=await Pb(e);r({buffer:i,width:t.width,height:t.height})}else i(new ni(ii.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,1)}))},Pb=async e=>{const t=await e.arrayBuffer();return new Uint8Array(t)};function Lb(e,t){if("VideoFrame"in window&&"TransformStream"in window&&Nn().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 Mb,Ub,xb,Vb,Fb,Bb,jb,Gb,Wb,Hb,Kb,Yb,zb,Xb,Zb,Jb,Qb,qb,$b,eO,tO,rO,iO,nO,oO,sO,aO,cO,dO,uO,lO,hO,pO,fO,mO,EO,_O,TO,gO,SO;function vO(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 yO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vO(Object(r),!0).forEach((function(t){p_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let RO=(Mb=On({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),Ub=On({argsMap:(e,t)=>[e.getTrackId(),t]}),xb=yA(),Vb=Ki("LocalAudioTrack","_enabledMutex"),Fb=On({argsMap:(e,t)=>[e.getTrackId(),t]}),Bb=yA(),jb=Ki("LocalAudioTrack","_enabledMutex"),Gb=On({argsMap:(e,t)=>[e.getTrackId(),t]}),Wb=yA(),Hb=yA(),Kb=yA(),Yb=On({argsMap:e=>[e.getTrackId()]}),zb=yA(),Xb=On({argsMap:e=>[e.getTrackId()]}),Zb=yA(),Jb=On({argsMap:e=>[e.getTrackId()]}),Qb=On({argsMap:(e,t)=>[e.getTrackId(),t.name]}),qb=On({argsMap:e=>[e.getTrackId()]}),$b=class extends BR{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?vA.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"LocalAudioTrack"}constructor(e,t,r,i){super(e,r),p_(this,"trackMediaType",Pd.AUDIO),p_(this,"_encoderConfig",void 0),p_(this,"_trackSource",void 0),p_(this,"metadata",[]),p_(this,"_enabled",!0),p_(this,"_volume",100),p_(this,"_useAudioElement",!0),p_(this,"_bypassWebAudio",!1),p_(this,"processor",void 0),p_(this,"_processorContext",void 0),p_(this,"_processorDestination",void 0),p_(this,"_getOriginVolumeLevel",void 0),this._encoderConfig=t,this._getOriginVolumeLevel=!!i,this._trackSource=new xA,an("DISABLE_WEBAUDIO")&&(this._bypassWebAudio=!0),an("LOCAL_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1);xr()&&!zR()?setTimeout((()=>this.initWebAudio())):this.initWebAudio()}setVolume(e){ai(e,"volume",0,1e3),this._volume=e,this._source.setVolume(e/100),this._useAudioElement&&vA.setVolume(this.getTrackId(),e);try{if(this._bypassWebAudio)return void Sn.debug("[".concat(this.getTrackId(),"] setVolume returned because no pass through WebAudio."));const e=this._source.createOutputTrack();this._mediaStreamTrack!==e&&(this._mediaStreamTrack=e,Ri(this,bd.NEED_REPLACE_TRACK,this).then((()=>{Sn.debug("[".concat(this.getTrackId(),"] replace web audio track success"))})).catch((e=>{Sn.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||!Dn())throw new ni(ii.NOT_SUPPORTED,"your browser does not support setting the audio output device");await vA.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(Sn.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){this._originMediaStreamTrack.enabled=!0;try{r||(this._enabled=!0),await Ri(this,bd.NEED_ENABLE_TRACK,this),Sn.info("[".concat(this.getTrackId(),"] setEnabled to ").concat(e," success"))}catch(e){throw r||(this._enabled=!1),Sn.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}}else{this._originMediaStreamTrack.enabled=!1,r||(this._enabled=!1);try{await Ri(this,bd.NEED_DISABLE_TRACK,this)}catch(e){throw r||(this._enabled=!0),Sn.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,Sn.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await Ri(this,bd.NEED_MUTE_TRACK,this):await Ri(this,bd.NEED_UNMUTE_TRACK,this))}getStats(){Di((()=>{Sn.warning("[deprecated] LocalAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalAudioStats instead")}),"localAudioTrackGetStatsWarning");const e=Ai(this,bd.GET_STATS);return e||yO({},Ud)}setAudioFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners(Ld.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(Ld.ON_AUDIO_BUFFER),this._source.on(Ld.ON_AUDIO_BUFFER,(t=>e(t)))}play(){Sn.debug("[".concat(this.getTrackId(),"] start audio playback")),this._useAudioElement?(Sn.debug("[".concat(this.getTrackId(),"] start audio playback in element")),vA.play(this._mediaStreamTrack,this.getTrackId(),this._volume)):this._source.play()}stop(){Sn.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._useAudioElement?vA.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];Sn.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&vA.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 Ri(this,bd.NEED_REPLACE_TRACK,this)):this._source.updateTrack(this._originMediaStreamTrack),this._getOriginVolumeLevel&&this._source.updateOriginTrack(e))}renewMediaStreamTrack(e){return VR.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(Bd.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(!1),this._source.processedNode=this._source.createMediaStreamSourceNode(e),await Ri(this,bd.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await Ri(this,bd.NEED_REPLACE_TRACK,this))})),e.on(Bd.ON_NODE,(e=>{this._source.processedNode=e}))}unbindProcessorDestinationEvents(e){e.removeAllListeners(Bd.ON_TRACK),e.removeAllListeners(Bd.ON_NODE)}bindProcessorContextEvents(e){e.on(jd.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}unbindProcessorContextEvents(e){e.removeAllListeners(jd.REQUEST_CONSTRAINTS)}initWebAudio(){return this._trackSource instanceof xA&&(this._trackSource=new rA(this._mediaStreamTrack,!1,this._getOriginVolumeLevel?this._mediaStreamTrack:void 0)),this._trackSource}initProcessor(){const e=new UA(this._source.context,this.getTrackId(),"local"),t=new MA(e);return this._processorContext=e,this._processorDestination=t,this.bindProcessorContextEvents(e),this.bindProcessorDestinationEvents(t),this._source.on(Ld.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:e})})),this._useAudioElement&&(this._useAudioElement=!1,this.isPlaying&&(vA.stop(this.getTrackId()),this._source.play()),Ri(this,bd.NEED_REPLACE_MIXING_TRACK,this).then((()=>{Sn.debug("[".concat(this.getTrackId(),"] replace from origin track to web audio track success"))})).catch((e=>{Sn.warning("[".concat(this.getTrackId(),"] replace from origin track to web audio track failed"),e)}))),{processorContext:e,processorDestination:t}}},bT($b.prototype,"setVolume",[Mb],Object.getOwnPropertyDescriptor($b.prototype,"setVolume"),$b.prototype),bT($b.prototype,"setPlaybackDevice",[Ub,xb],Object.getOwnPropertyDescriptor($b.prototype,"setPlaybackDevice"),$b.prototype),bT($b.prototype,"setEnabled",[Vb,Fb,Bb],Object.getOwnPropertyDescriptor($b.prototype,"setEnabled"),$b.prototype),bT($b.prototype,"setMuted",[jb,Gb,Wb],Object.getOwnPropertyDescriptor($b.prototype,"setMuted"),$b.prototype),bT($b.prototype,"getStats",[Hb],Object.getOwnPropertyDescriptor($b.prototype,"getStats"),$b.prototype),bT($b.prototype,"setAudioFrameCallback",[Kb],Object.getOwnPropertyDescriptor($b.prototype,"setAudioFrameCallback"),$b.prototype),bT($b.prototype,"play",[Yb,zb],Object.getOwnPropertyDescriptor($b.prototype,"play"),$b.prototype),bT($b.prototype,"stop",[Xb,Zb],Object.getOwnPropertyDescriptor($b.prototype,"stop"),$b.prototype),bT($b.prototype,"close",[Jb],Object.getOwnPropertyDescriptor($b.prototype,"close"),$b.prototype),bT($b.prototype,"pipe",[Qb],Object.getOwnPropertyDescriptor($b.prototype,"pipe"),$b.prototype),bT($b.prototype,"unpipe",[qb],Object.getOwnPropertyDescriptor($b.prototype,"unpipe"),$b.prototype),$b),AO=(eO=On({argsMap:(e,t)=>[e.getTrackId(),t]}),tO=yA(),rO=Ki("MicrophoneAudioTrack","_enabledMutex"),iO=On({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),nO=yA(),oO=On({argsMap:e=>[e.getTrackId()]}),sO=class extends RO{get __className__(){return"MicrophoneAudioTrack"}constructor(e,t,r,i){super(e,t.encoderConfig?Td(t.encoderConfig):{},i,an("GET_VOLUME_OF_MUTED_AUDIO_TRACK")),p_(this,"_config",void 0),p_(this,"_deviceName","default"),p_(this,"_constraints",void 0),p_(this,"_originalConstraints",void 0),p_(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())&&HR.bindInterruptDetectorTrack(this)}async setDevice(e){if(Sn.info("[".concat(this.getTrackId(),"] start set device to ").concat(e)),this._enabled)try{const t=await pA.getDeviceById(e),r={};r.audio=yO({},this._constraints),r.audio.deviceId={exact:e},this._originMediaStreamTrack.stop();let i=null;try{i=await cA(r,this.getTrackId())}catch(e){throw Sn.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),i=await cA({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 Sn.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await pA.getDeviceById(e);this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(e){throw Sn.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}Sn.info("[".concat(this.getTrackId(),"] set device to ").concat(e," success"))}async setEnabled(e,t,r){if(t)return Sn.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(Sn.info("[".concat(this.getTrackId(),"] start setEnabled"),e),an("AUTO_RESET_AUDIO_ROUTE")&&(Br()||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 Ri(this,bd.NEED_DISABLE_TRACK,this)}catch(e){throw Sn.error("[".concat(this.getTrackId(),"] setEnabled false failed"),e.toString()),e}return}const n=yO({},this._constraints),o=pA.searchDeviceIdByName(this._deviceName);o&&!n.deviceId&&(n.deviceId=o);try{r||(this._enabled=!0);const e=await cA({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!1),await Ri(this,bd.NEED_ENABLE_TRACK,this)}catch(e){throw r||(this._enabled=!1),Sn.error("[".concat(this.getTrackId(),"] setEnabled true failed"),e.toString()),e}Sn.info("[".concat(this.getTrackId(),"] setEnabled success"))}close(){super.close(),(Kr()||Yr())&&HR.unbindInterruptDetectorTrack(this)}onTrackEnded(){if((Br()||Xr())&&this._enabled&&!this._isClosed&&HR.duringInterruption){const e=async()=>{HR.off(kn.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(Sn.debug("[".concat(this.getTrackId(),"] try capture microphone media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};HR.on(kn.IOS_INTERRUPTION_END,e)}else Sn.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(Dd.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=pA.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId=r),this._constraints=t,this._enabled){this._originMediaStreamTrack.stop();const e=await cA({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!0)}}bindProcessorContextEvents(e){super.bindProcessorContextEvents(e),e.on(jd.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(jd.REQUEST_UPDATE_CONSTRAINTS)}},bT(sO.prototype,"setDevice",[eO,tO],Object.getOwnPropertyDescriptor(sO.prototype,"setDevice"),sO.prototype),bT(sO.prototype,"setEnabled",[rO,iO,nO],Object.getOwnPropertyDescriptor(sO.prototype,"setEnabled"),sO.prototype),bT(sO.prototype,"close",[oO],Object.getOwnPropertyDescriptor(sO.prototype,"close"),sO.prototype),sO),bO=(aO=On({argsMap:(e,t)=>[e.getTrackId(),t,e.duration]}),cO=yA(),dO=On({argsMap:e=>[e.getTrackId()]}),uO=yA(),lO=On({argsMap:e=>[e.getTrackId()]}),hO=yA(),pO=On({argsMap:e=>[e.getTrackId()]}),fO=yA(),mO=On({argsMap:e=>[e.getTrackId()]}),EO=yA(),_O=On({argsMap:e=>[e.getTrackId()]}),TO=On({argsMap:e=>[e.getTrackId()]}),gO=yA(),bT((SO=class extends RO{get __className__(){return"BufferSourceAudioTrack"}constructor(e,t,r,i){super(t.createOutputTrack(),r,i),p_(this,"source",void 0),p_(this,"_bufferSource",void 0),this._useAudioElement=!1,this.source=e,this._bufferSource=t,this._bufferSource.on(Ld.AUDIO_SOURCE_STATE_CHANGE,(e=>{this.safeEmit(Dd.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",[aO,cO],Object.getOwnPropertyDescriptor(SO.prototype,"startProcessAudioBuffer"),SO.prototype),bT(SO.prototype,"pauseProcessAudioBuffer",[dO,uO],Object.getOwnPropertyDescriptor(SO.prototype,"pauseProcessAudioBuffer"),SO.prototype),bT(SO.prototype,"seekAudioBuffer",[lO,hO],Object.getOwnPropertyDescriptor(SO.prototype,"seekAudioBuffer"),SO.prototype),bT(SO.prototype,"resumeProcessAudioBuffer",[pO,fO],Object.getOwnPropertyDescriptor(SO.prototype,"resumeProcessAudioBuffer"),SO.prototype),bT(SO.prototype,"stopProcessAudioBuffer",[mO,EO],Object.getOwnPropertyDescriptor(SO.prototype,"stopProcessAudioBuffer"),SO.prototype),bT(SO.prototype,"close",[_O],Object.getOwnPropertyDescriptor(SO.prototype,"close"),SO.prototype),bT(SO.prototype,"setAudioBufferPlaybackSpeed",[TO,gO],Object.getOwnPropertyDescriptor(SO.prototype,"setAudioBufferPlaybackSpeed"),SO.prototype),SO);class OO extends RO{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=YR().createMediaStreamDestination();super(e.stream.getAudioTracks()[0],void 0,Li(8,"track-mix-")),p_(this,"trackList",void 0),p_(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)?(Sn.debug("add ".concat(e.getTrackId()," to mixing track")),e._source.outputNode.connect(this.destNode),this.trackList.push(e),this.updateEncoderConfig()):Sn.debug("track ".concat(e.getTrackId()," is already added"))}removeAudioTrack(e){if(-1!==this.trackList.indexOf(e)){Sn.debug("remove ".concat(e.getTrackId()," from mixing track"));try{e._source.outputNode.disconnect(this.destNode)}catch(e){}Oi(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 OO?t.emit(Nd.TRANSCEIVER_UPDATED,e):t._updateRtpTransceiver(e)})))}}class IO extends tA{set currentState(e){e!==this._currentState&&(this._currentState=e,this.safeEmit(Ld.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(),p_(this,"audioBuffer",void 0),p_(this,"sourceNode",void 0),p_(this,"startPlayTime",0),p_(this,"startPlayOffset",0),p_(this,"pausePlayTime",0),p_(this,"options",void 0),p_(this,"currentLoopCount",0),p_(this,"currentPlaybackSpeed",100),p_(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):Sn.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 CO=new Map;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){p_(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}function DO(e,t){if(0===e.length||0===t.length)return 1/0;const r=ji(e),i=ji(t);return Math.floor(i/r)}class kO{get rendFrameRate(){const e=Math.max(1,DO(this._render_interframe_delays_sizes,this._render_interframe_delays));return Math.floor(1e3/e)}get videoElementStatus(){return this._videoElementStatus}set videoElementStatus(e){e!==this._videoElementStatus&&(Sn.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){p_(this,"trackId",void 0),p_(this,"config",void 0),p_(this,"onFirstVideoFrameDecoded",void 0),p_(this,"onVideoStateChanged",void 0),p_(this,"freezeTimeCounterList",[]),p_(this,"renderFreezeAccTime",0),p_(this,"renderFreezeAccTime2",0),p_(this,"isKeepLastFrame",!1),p_(this,"timeUpdatedCount",0),p_(this,"freezeTime",0),p_(this,"playbackTime",0),p_(this,"lastTimeUpdatedTime",0),p_(this,"autoplayFailed",!1),p_(this,"videoTrack",void 0),p_(this,"videoElement",void 0),p_(this,"cacheVideoElement",void 0),p_(this,"_render_interframe_delays",[]),p_(this,"_render_interframe_delays_sizes",[]),p_(this,"_videoState",Kd.VideoStateStopped),p_(this,"videoElementCheckInterval",void 0),p_(this,"videoElementFreezeTimeout",void 0),p_(this,"_videoElementStatus",Hd.NONE),p_(this,"isGettingVideoDimensions",!1),p_(this,"startGetVideoDimensions",(()=>{const e=()=>{if(this.isGettingVideoDimensions=!0,this.videoElement.videoWidth*this.videoElement.videoHeight>4)return Sn.debug("[".concat(this.trackId,"] current video dimensions:"),this.videoElement.videoWidth,this.videoElement.videoHeight),void(this.isGettingVideoDimensions=!1);setTimeout(e,500)};!this.isGettingVideoDimensions&&e()})),p_(this,"autoResumeAfterInterruption",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&"running"===HR.curState&&(Sn.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()))})),p_(this,"handleVideoEvents",(e=>{switch(e.type){case"play":case"playing":this.startGetVideoDimensions(),this.videoElementStatus=Hd.PLAYING;break;case"loadeddata":if(this.videoState=Kd.VideoStateStarting,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=Hd.CANPLAY;break;case"stalled":this.videoElementStatus=Hd.STALLED;break;case"suspend":this.videoElementStatus=Hd.SUSPEND;break;case"pause":this.videoElementStatus=Hd.PAUSED,Br()||Xr()||xr()&&this.autoplayFailed||!this.videoTrack||"live"!==this.videoTrack.readyState||(Sn.debug("[track-".concat(this.trackId,"] video element paused, auto resume")),this.videoElement.play());break;case"waiting":this.videoElementStatus=Hd.WAITING;break;case"abort":this.videoElementStatus=Hd.ABORT;break;case"ended":this.videoElementStatus=Hd.ENDED;break;case"emptied":this.videoElementStatus=Hd.EMPTIED;break;case"error":{const e=this.videoElement.error;e&&(this.videoElementStatus=Hd.ERROR,Sn.error("[".concat(this.trackId,"] media error: ").concat(e.message," (").concat(e.code,")")));break}case"timeupdate":{const e=performance.now();if(this.timeUpdatedCount+=1,this.timeUpdatedCount<10)return void(this.lastTimeUpdatedTime=e);const t=e-this.lastTimeUpdatedTime,r=this.lastTimeUpdatedTime;if(this.lastTimeUpdatedTime=e,jI.lastVisibleTime<jI.lastHiddenTime||r<jI.lastHiddenTime||r<jI.lastVisibleTime)return;for(t>an("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}}})),p_(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&(Sn.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"),HR.on(kn.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),HR.on(kn.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?(Sn.warning("detected video element autoplay failed",t),this.autoplayFailed=!0,this.handleAutoPlayFailed()):Sn.warning("[".concat(this.trackId,"] play warning: "),t)}));const r=Dr();if(("Safari"===r.name&&15===Number(r.version)||Kr())&&t&&t.then){const e=()=>{this.config.mirror&&(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 Sn.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 VR(((i,n)=>{r.toBlob((async e=>{if(r.remove(),e){const t=await Pb(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 kb(e)}destroy(){HR.off(kn.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),HR.off(kn.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),this.videoElement.srcObject=null,this.resetVideoElement(),this.freezeTimeCounterList=[],this.videoState=Kd.VideoStateStopped}initVideoElement(){if(this.videoElementStatus=Hd.INIT,!this.videoElementCheckInterval&&(PO.forEach((e=>{this.videoElement.addEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval=window.setInterval((()=>{(function(e){return e!==document.body&&document.body.contains(e)})(this.videoElement)||(this.videoElementStatus=Hd.DESTROYED)}),1e3),an("ENABLE_VIDEO_FRAME_CALLBACK"))){var e,t;let r;const i=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",i),this.videoElementFreezeTimeout=window.setTimeout(n,an("VIDEO_FREEZE_DURATION")))},n=()=>{this.videoElementFreezeTimeout=void 0,this.videoState===Kd.VideoStateDecoding&&("visible"===document.visibilityState?this.videoState=Kd.VideoStateFrozen:document.addEventListener("visibilitychange",i))},o=(e,t)=>{if(this.videoElementStatus===Hd.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=ji(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===Kd.VideoStateStarting&&(this.videoState=Kd.VideoStateDecoding),this.videoState===Kd.VideoStateDecoding&&this.onVideoStateChanged&&(this.videoElementFreezeTimeout&&window.clearTimeout(this.videoElementFreezeTimeout),this.videoElementFreezeTimeout=window.setTimeout(n,an("VIDEO_FREEZE_DURATION"))),e<an("VIDEO_FREEZE_DURATION")&&this.videoState===Kd.VideoStateFrozen&&(this.videoState=Kd.VideoStateDecoding),e>an("VIDEO_FREEZE_DURATION")&&jI.lastVisibleTime>=jI.lastHiddenTime&&r.timestamp>jI.lastVisibleTime&&r.timestamp>jI.lastHiddenTime){const t=Math.min(66,DO(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=NO(NO({},t),{},{timestamp:e})}var i,s;an("ENABLE_VIDEO_FRAME_CALLBACK")&&(null===(i=(s=this.videoElement).requestVideoFrameCallback)||void 0===i||i.call(s,o))};null===(e=(t=this.videoElement).requestVideoFrameCallback)||void 0===e||e.call(t,o)}this.videoElement.controls=!1,this.videoElement.setAttribute("playsinline",""),qr()&&!an("HIDE_NO_POSTER")&&(this.videoElement.poster="noposter");const r=Dr();if("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,Fr()&&this.videoElement.load())}else this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,Fr()&&this.videoElement.load();const i=this.videoElement.play();void 0!==i&&i.catch((e=>{Sn.debug("[".concat(this.trackId,"] playback interrupted"),e.toString())}))}resetVideoElement(){PO.forEach((e=>{this.videoElement&&this.videoElement.removeEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval&&(window.clearInterval(this.videoElementCheckInterval),this.videoElementCheckInterval=void 0),this.videoElementStatus=Hd.NONE}handleAutoPlayFailed(){const e=t=>{t.preventDefault(),this.videoElement.play().then((()=>{Sn.debug("[".concat(this.trackId,"] Video element for trackId:").concat(this.trackId," autoplay resumed."))})).catch((e=>{Sn.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)),EA()}}const PO=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","timeupdate","error"];class LO extends kO{constructor(e){super(e),p_(this,"container",void 0),p_(this,"slot",void 0),this.slot=e.element,this.updateConfig(e)}updateConfig(e){this.config=e,this.trackId=e.trackId;const t=e.element;t!==this.slot&&(this.destroy(),this.slot=t),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 kb(e)}destroy(){if(super.destroy(),this.videoElement.remove(),this.videoElement=document.createElement("video"),this.container){try{this.container.remove(),this.slot.removeChild(this.container)}catch(e){}this.container=void 0}}createElements(){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",an("KEEP_LAST_FRAME")&&this.isKeepLastFrame&&this.videoElement.paused&&this.resetVideoElement(),this.mountedVideoElement()):this.unmountedVideoElement(),this.slot.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 MO,UO,xO,VO,FO,BO,jO,GO,WO,HO,KO,YO,zO,XO,ZO,JO,QO,qO,$O,eI,tI,rI,iI,nI,oI,sI,aI,cI,dI,uI,lI,hI,pI,fI,mI,EI;function _I(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 TI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_I(Object(r),!0).forEach((function(t){p_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_I(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let gI=(MO=On({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),UO=yA(),xO=On({argsMap:e=>[e.getTrackId()]}),VO=Ki("LocalVideoTrack","_enabledMutex"),FO=On({argsMap:(e,t)=>[e.getTrackId(),t]}),BO=yA(),jO=Ki("LocalVideoTrack","_enabledMutex"),GO=On({argsMap:(e,t)=>[e.getTrackId(),t]}),WO=yA(),HO=On({argsMap:(e,t)=>[e.getTrackId(),t,e._saveEncodeBitrateRatio]}),KO=yA(),YO=On({argsMap:(e,t)=>[e.getTrackId(),t]}),zO=yA(),XO=yA(),ZO=On({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),JO=yA(),QO=yA(),qO=yA(),$O=yA(),eI=yA(),tI=yA(),rI=yA(),iI=On({argsMap:(e,t)=>[e.getTrackId(),t.name]}),nI=On({argsMap:e=>[e.getTrackId()]}),oI=On({argsMap:e=>[e.getTrackId()]}),sI=On({argsMap:(e,t,r)=>[e.getTrackId(),t.label,r]}),aI=class e extends BR{get videoHeight(){if(xr()){const{height:e}=this._mediaStreamTrack.getSettings();return this._videoHeight=e,this._videoHeight}return this._videoHeight}get videoWidth(){if(xr()){const{width:e}=this._mediaStreamTrack.getSettings();return this._videoWidth=e,this._videoWidth}return this._videoWidth}get isPlaying(){return!(!this._player||this._player.videoElementStatus!==Hd.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),p_(this,"trackMediaType",Pd.VIDEO),p_(this,"_player",void 0),p_(this,"isUseScaleResolutionDownBy",!1),p_(this,"_videoVisibleTimer",null),p_(this,"_previousVideoVisibleStatus",void 0),p_(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),p_(this,"_encoderConfig",void 0),p_(this,"_scalabilityMode",{numSpatialLayers:1,numTemporalLayers:1}),p_(this,"_optimizationMode",void 0),p_(this,"_saveEncodeBitrateRatio",1),p_(this,"_videoHeight",void 0),p_(this,"_videoWidth",void 0),p_(this,"_forceBitrateLimit",void 0),p_(this,"_enabled",!0),p_(this,"_processorDestination",void 0),p_(this,"_processorContext",void 0),xr()){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(Od.CUSTOM_TRACK)?this._encoderConfig=Ci(t):this._encoderConfig=t,-1===this._hints.indexOf(Od.SCREEN_TRACK))this.updateBitrateFromProfile();else if(Gr(Ir.CHROME,115)&&-1!==Pr().indexOf("Windows")){const t=Lb(e);t&&(Sn.info("local screen video track begin to inject frame"),this._mediaStreamTrack=t)}t&&-1!==this._hints.indexOf(Od.CUSTOM_TRACK)&&this.setEncoderConfiguration(t),this._processorContext=new LA(this.getTrackId(),"local"),this._processorDestination=new PA(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:(Sn.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}Sn.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=TI(TI(TI({},this._getDefaultPlayerConfig()),t),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(r):(e instanceof HTMLVideoElement?this._player=new kO(r):this._player=new LO(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(Dd.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),an("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,Sn.debug("[".concat(this.getTrackId(),"] stop video playback")))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(Sn.info("[".concat(this.getTrackId(),"] start setEnabled"),e),!e){this._originMediaStreamTrack.enabled=!1;try{await Ri(this,bd.NEED_DISABLE_TRACK,this)}catch(e){throw Sn.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}return t||(this._enabled=!1),void Sn.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}this._originMediaStreamTrack.enabled=!0;try{await Ri(this,bd.NEED_ENABLE_TRACK,this)}catch(e){throw Sn.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}Sn.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,Sn.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await Ri(this,bd.NEED_MUTE_TRACK,this):await Ri(this,bd.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),Sn.debug("[".concat(this.getTrackId(),"] set save encode bitrate ratio, ").concat(e)),this._saveEncodeBitrateRatio=1;try{await Ri(this,bd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Sn)}}}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=fd(e),an("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=BA({encoderConfig:e});(xr()||Br()||Xr())&&(t.deviceId=void 0),Sn.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 Sn.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}}this._encoderConfig=e,-1===this._hints.indexOf(Od.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await Ri(this,bd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Sn)}}getStats(){Di((()=>{Sn.warning("[deprecated] LocalVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalVideoStats instead")}),"localVideoTrackGetStatsWarning");const e=Ai(this,bd.GET_STATS);return e||TI({},xd)}async setBeautyEffect(e){Sn.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 kb(e)}async setBitrateLimit(e){Sn.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 Sn.error(ii.INVALID_PARAMS,"optimization mode must be motion, detail or balanced");const t=this._optimizationMode;try{this._optimizationMode=e,await Ri(this,bd.NEED_UPDATE_VIDEO_SEND_PARAMETERS,this)}catch(e){throw this._optimizationMode=t,Sn.error("[".concat(this.getTrackId(),"] set optimization mode failed"),e.toString()),e}Sn.info("[".concat(this.getTrackId(),"] set optimization mode success (").concat(e,")"))}setScalabiltyMode(e){if(1===e.numSpatialLayers&&1!==e.numTemporalLayers)return Sn.error(ii.INVALID_PARAMS,"scalability mode currently not supported, no SVC."),void(this._scalabilityMode={numSpatialLayers:1,numTemporalLayers:1});this._scalabilityMode=e,Sn.info("[".concat(this.getTrackId(),"] set scalability mode success (").concat(e,")"))}updateMediaStreamTrackResolution(){FA(this._originMediaStreamTrack).then((e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t})).catch(Mi)}_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");Sn.debug("[".concat(this.getTrackId(),"] setSenderConfiguration applyConstraints"),JSON.stringify(e)),e=fd(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(Od.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await Ri(this,bd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Sn)}}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}=wb(e,t,r,n,i);if(this._encoderConfig.bitrateMin=s,this._encoderConfig.bitrateMax=o,an("VIDEO_STANDARD_BITRATE_VERSION")&&null==n&&null==i){const[i,n]=Cb(e,t,r);this._encoderConfig.bitrateMax=i,this._encoderConfig.bitrateMin=s?Math.min(s,i):i,this._saveEncodeBitrateRatio=n,Sn.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 Sn.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=In.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=TI(TI({},i),fd(t))),i=wi(i);const n=Li(8,"track-video-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,i,wi(this._scalabilityMode),this._optimizationMode,n,wi(this._hints));return t&&i&&o.setEncoderConfiguration(i),Sn.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(Di((()=>{In.reportApiInvoke(null,{name:Ti.LOCAL_VIDEO_SEND_SEI_DATA,options:[],tag:gi.TRACER}).onSuccess("")}),this._mediaStreamTrack.id||this.getTrackId()),!an("ENABLE_VIDEO_SEI")||!an("ENABLE_ENCODED_TRANSFORM"))return void Sn.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 Sn.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?this.safeEmit("sei-to-send",e):Sn.warning("SEI is not supported by ".concat(i))}bindProcessorDestinationEvents(){this.processorDestination.on(Bd.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(),await Ri(this,bd.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await Ri(this,bd.NEED_REPLACE_TRACK,this))}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(Bd.ON_TRACK)}unbindProcessorContextEvents(){this.processorContext.removeAllListeners(jd.REQUEST_UPDATE_CONSTRAINTS),this.processorContext.removeAllListeners(jd.REQUEST_CONSTRAINTS)}},bT(aI.prototype,"play",[MO,UO],Object.getOwnPropertyDescriptor(aI.prototype,"play"),aI.prototype),bT(aI.prototype,"stop",[xO],Object.getOwnPropertyDescriptor(aI.prototype,"stop"),aI.prototype),bT(aI.prototype,"setEnabled",[VO,FO,BO],Object.getOwnPropertyDescriptor(aI.prototype,"setEnabled"),aI.prototype),bT(aI.prototype,"setMuted",[jO,GO,WO],Object.getOwnPropertyDescriptor(aI.prototype,"setMuted"),aI.prototype),bT(aI.prototype,"setSaveEncodeBitrateRatio",[HO,KO],Object.getOwnPropertyDescriptor(aI.prototype,"setSaveEncodeBitrateRatio"),aI.prototype),bT(aI.prototype,"setEncoderConfiguration",[YO,zO],Object.getOwnPropertyDescriptor(aI.prototype,"setEncoderConfiguration"),aI.prototype),bT(aI.prototype,"getStats",[XO],Object.getOwnPropertyDescriptor(aI.prototype,"getStats"),aI.prototype),bT(aI.prototype,"setBeautyEffect",[ZO,JO],Object.getOwnPropertyDescriptor(aI.prototype,"setBeautyEffect"),aI.prototype),bT(aI.prototype,"getCurrentFrameData",[QO],Object.getOwnPropertyDescriptor(aI.prototype,"getCurrentFrameData"),aI.prototype),bT(aI.prototype,"getCurrentFrameImage",[qO],Object.getOwnPropertyDescriptor(aI.prototype,"getCurrentFrameImage"),aI.prototype),bT(aI.prototype,"setBitrateLimit",[$O],Object.getOwnPropertyDescriptor(aI.prototype,"setBitrateLimit"),aI.prototype),bT(aI.prototype,"setOptimizationMode",[eI],Object.getOwnPropertyDescriptor(aI.prototype,"setOptimizationMode"),aI.prototype),bT(aI.prototype,"setScalabiltyMode",[tI],Object.getOwnPropertyDescriptor(aI.prototype,"setScalabiltyMode"),aI.prototype),bT(aI.prototype,"updateMediaStreamTrackResolution",[rI],Object.getOwnPropertyDescriptor(aI.prototype,"updateMediaStreamTrackResolution"),aI.prototype),bT(aI.prototype,"pipe",[iI],Object.getOwnPropertyDescriptor(aI.prototype,"pipe"),aI.prototype),bT(aI.prototype,"unpipe",[nI],Object.getOwnPropertyDescriptor(aI.prototype,"unpipe"),aI.prototype),bT(aI.prototype,"close",[oI],Object.getOwnPropertyDescriptor(aI.prototype,"close"),aI.prototype),bT(aI.prototype,"replaceTrack",[sI],Object.getOwnPropertyDescriptor(aI.prototype,"replaceTrack"),aI.prototype),aI),SI=(cI=On({argsMap:(e,t)=>[e.getTrackId(),t]}),dI=yA(),uI=Ki("CameraVideoTrack","_enabledMutex"),lI=On({argsMap:(e,t)=>[e.getTrackId(),t]}),hI=yA(),pI=On({argsMap:(e,t)=>[e.getTrackId(),t]}),fI=yA(),mI=On({argsMap:e=>[e.getTrackId()]}),EI=class e extends gI{get __className__(){return"CameraVideoTrack"}constructor(e,t,r,i,n,o){super(e,fd(t.encoderConfig),i,n,o),p_(this,"_config",void 0),p_(this,"_originalConstraints",void 0),p_(this,"_constraints",void 0),p_(this,"_enabled",!0),p_(this,"_deviceName","default"),p_(this,"tryResumeVideoForIOS15_16WeChat",(async()=>{!Kr()&&!Yr()||function(){const e=Dr();if(e.os!==Or.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=2}()||Dr().name!==Ir.WECHAT||!this._enabled||this._isClosed||(Sn.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=fd(this._config.encoderConfig),HR.on(kn.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),HR.on(kn.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(Sn.info("[".concat(this.getTrackId(),"] set device to ").concat(e)),this._enabled)try{const t=await pA.getDeviceById(e),r={};r.video=TI({},this._constraints),r.video.deviceId={exact:e},r.video.facingMode=void 0,this._originMediaStreamTrack.stop();let i=null;try{i=await cA(r,this.getTrackId())}catch(e){throw Sn.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),i=await cA({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 Sn.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await pA.getDeviceById(e);this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(e){throw Sn.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}Sn.info("[".concat(this.getTrackId(),"] setDevice success"))}async _setDeviceByFacingModel(e){Sn.info("[".concat(this.getTrackId(),"] set facingMode ").concat(e));const t={video:TI(TI({},this._constraints),{},{deviceId:void 0,facingMode:{exact:e}})};if(this._enabled){this._originMediaStreamTrack.stop();let e=null;try{e=await cA(t,this.getTrackId())}catch(t){throw Sn.error("[".concat(this.getTrackId(),"] setDeviceByFacingModel failed"),t.toString()),e=await cA({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=TI({},t.video),Sn.info("[".concat(this.getTrackId(),"] setDeviceByFacingModel success"))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(Sn.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){try{if(this.isExternalTrack)this._originMediaStreamTrack.enabled=!0;else{const e=await cA({video:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1)}await Ri(this,bd.NEED_ENABLE_TRACK,this)}catch(e){throw Sn.error("[".concat(this.getTrackId(),"] setEnabled true error"),e.toString()),e}this.updateMediaStreamTrackResolution(),Sn.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 Ri(this,bd.NEED_DISABLE_TRACK,this)}catch(e){throw Sn.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}Sn.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=fd(e),an("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=Ci(this._config);r.encoderConfig=e;const i=BA(r);(xr()||Br()||Xr())&&(i.deviceId=void 0),Sn.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 Sn.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(Od.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await Ri(this,bd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Sn)}}_getDefaultPlayerConfig(){return{mirror:!0,fit:"cover"}}onTrackEnded(){if((Br()||Xr())&&this._enabled&&!this._isClosed&&HR.duringInterruption){const e=async()=>{HR.off(kn.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(Sn.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};HR.on(kn.IOS_INTERRUPTION_END,e)}else Sn.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(Dd.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=pA.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId={exact:r}),this._enabled){const e=await cA({video:t},this.getTrackId());this._constraints=t,await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!0),this.updateMediaStreamTrackResolution()}}close(){super.close(),HR.off(kn.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),HR.off(kn.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat)}clone(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this._encoderConfig;t&&(i=TI(TI({},i),fd(t))),i=wi(i);const n=Li(8,"track-cam-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,wi(TI(TI({},this._config),{},{encoderConfig:i})),wi(this._constraints),wi(this._scalabilityMode),this._optimizationMode,n);return t&&i&&o.setEncoderConfiguration(i),Sn.debug("clone track from ".concat(this.getTrackId()," to ").concat(n,", clone ").concat(r)),o}bindProcessorContextEvents(){this.processorContext.on(jd.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(jd.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}},bT(EI.prototype,"setDevice",[cI,dI],Object.getOwnPropertyDescriptor(EI.prototype,"setDevice"),EI.prototype),bT(EI.prototype,"setEnabled",[uI,lI,hI],Object.getOwnPropertyDescriptor(EI.prototype,"setEnabled"),EI.prototype),bT(EI.prototype,"setEncoderConfiguration",[pI,fI],Object.getOwnPropertyDescriptor(EI.prototype,"setEncoderConfiguration"),EI.prototype),bT(EI.prototype,"close",[mI],Object.getOwnPropertyDescriptor(EI.prototype,"close"),EI.prototype),EI);function vI(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 yI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vI(Object(r),!0).forEach((function(t){p_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function RI(e,t,r,i){r.optimizationMode&&(i&&i.width&&i.height?(r.encoderConfig=yI(yI({},i),{},{bitrateMin:i.bitrateMin,bitrateMax:i.bitrateMax}),"motion"!==r.optimizationMode&&"detail"!==r.optimizationMode||(t.contentHint=r.optimizationMode,t.contentHint===r.optimizationMode?Sn.debug("[".concat(e,"] set content hint to"),r.optimizationMode):Sn.debug("[".concat(e,"] set content hint failed")))):Sn.warning("[".concat(e,"] can not apply optimization mode bitrate config, no encoderConfig")))}var AI,bI,OI,II,CI,wI,NI,DI,kI,PI,LI,MI;function UI(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 xI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?UI(Object(r),!0).forEach((function(t){p_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):UI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class VI extends FR{getUserId(){return this._userId}constructor(e,t,r,i){super(e,"track-".concat(e.kind,"-").concat(t,"-").concat(i.clientId,"_").concat(Li(5,""))),p_(this,"_userId",void 0),p_(this,"_uintId",void 0),p_(this,"_isDestroyed",!1),p_(this,"store",void 0),p_(this,"processor",void 0),p_(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,Sn.info("[".concat(this.getTrackId(),"] is destroyed")),this.stop(),super.close()}getProcessorStats(){return this.processorContext.gatherStats()}getProcessorUsage(){return this.processorContext.gatherUsage()}}let FI=(AI=On({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),bI=On({argsMap:e=>[e.getTrackId()]}),OI=On({argsMap:(e,t)=>[e.getTrackId(),t.name]}),II=On({argsMap:e=>[e.getTrackId()]}),CI=class extends VI{get isPlaying(){return!(!this._player||this._player.videoElementStatus!==Hd.PLAYING)}get __className__(){return"RemoteVideoTrack"}constructor(e,t,r,i){super(e,t,r,i),p_(this,"_videoVisibleTimer",null),p_(this,"_previousVideoVisibleStatus",void 0),p_(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),p_(this,"trackMediaType",Pd.VIDEO),p_(this,"_videoWidth",void 0),p_(this,"_videoHeight",void 0),p_(this,"_player",void 0),p_(this,"processorDestination",void 0),p_(this,"processorContext",void 0),this.updateMediaStreamTrackResolution(),this.processorContext=new LA(this.getTrackId(),"remote"),this.processorDestination=new PA(this.processorContext),this.bindProcessorDestinationEvents()}getStats(){Di((()=>{Sn.warning("[deprecated] RemoteVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteVideoStats instead")}),"remoteVideoTrackGetStatsWarning");return Ai(this,bd.GET_STATS)||xI({},Fd)}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:(Sn.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}Sn.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=xI(xI({fit:"cover"},t),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(r):(e instanceof HTMLVideoElement?this._player=new kO(r):this._player=new LO(r),this._player.updateVideoTrack(this._mediaStreamTrack),this._player.onFirstVideoFrameDecoded=()=>{this.store.subscribe(this.getUserId(),"video",void 0,void 0,Date.now()),this.safeEmit(kd.FIRST_FRAME_DECODED)},this._player.onVideoStateChanged=e=>{this.safeEmit(kd.VIDEO_STATE_CHANGED,e)}),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(kd.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),an("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,Sn.debug("[".concat(this.getTrackId(),"] stop video playback")))}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}updateMediaStreamTrackResolution(){FA(this._originMediaStreamTrack).then((e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t})).catch(Mi)}_updatePlayerSource(){Sn.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=In.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(Bd.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(Bd.ON_TRACK)}_destroy(){super._destroy(),this.unbindProcessorDestinationEvents()}_onSei(e){this.emit(Nd.SEI_RECEIVED,e)}},bT(CI.prototype,"play",[AI],Object.getOwnPropertyDescriptor(CI.prototype,"play"),CI.prototype),bT(CI.prototype,"stop",[bI],Object.getOwnPropertyDescriptor(CI.prototype,"stop"),CI.prototype),bT(CI.prototype,"pipe",[OI],Object.getOwnPropertyDescriptor(CI.prototype,"pipe"),CI.prototype),bT(CI.prototype,"unpipe",[II],Object.getOwnPropertyDescriptor(CI.prototype,"unpipe"),CI.prototype),CI),BI=(wI=On({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),NI=On({argsMap:(e,t)=>[e.getTrackId(),t]}),DI=On({argsMap:e=>[e.getTrackId()]}),kI=On({argsMap:e=>[e.getTrackId()]}),PI=On({argsMap:(e,t)=>[e.getTrackId(),t.name]}),LI=On({argsMap:e=>[e.getTrackId()]}),MI=class extends VI{get isPlaying(){return this._useAudioElement?vA.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"RemoteAudioTrack"}constructor(e,t,r,i){super(e,t,r,i),p_(this,"trackMediaType",Pd.AUDIO),p_(this,"_source",void 0),p_(this,"_useAudioElement",!0),p_(this,"_volume",100),p_(this,"processorContext",void 0),p_(this,"processorDestination",void 0),p_(this,"_played",!1),p_(this,"_bypassWebAudio",!1),an("DISABLE_WEBAUDIO")?(this._source=new xA,this._bypassWebAudio=!0,this._useAudioElement=!0):(this._source=new rA(e,!0),an("REMOTE_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1)),this._source.once(Ld.RECEIVE_TRACK_BUFFER,(()=>{this.safeEmit(kd.FIRST_FRAME_DECODED)})),this.processorContext=new UA(this._source.context,this.getTrackId(),"remote"),this.processorDestination=new MA(this.processorContext),this.bindProcessorDestinationEvents(),this._source.on(Ld.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(Ld.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(Ld.ON_AUDIO_BUFFER),this._source.on(Ld.ON_AUDIO_BUFFER,(t=>e(t)))}setVolume(e){this._volume=e,this._useAudioElement?vA.setVolume(this.getTrackId(),e):this._source.setVolume(e/100)}async setPlaybackDevice(e){if(!this._useAudioElement||!Dn())throw new ni(ii.NOT_SUPPORTED,"your browser does not support setting the audio output device");await vA.setSinkID(this.getTrackId(),e)}getVolumeLevel(){return this._source.getAccurateVolumeLevel()}getStats(){Di((()=>{Sn.warning("[deprecated] RemoteAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteAudioStats instead")}),"remoteAudioTrackGetStatsWarning");return Ai(this,bd.GET_STATS)||xI({},Vd)}play(){Sn.debug("[".concat(this.getTrackId(),"] start audio playback")),this._played=!0,this._useAudioElement?(Sn.debug("[".concat(this.getTrackId(),"] use audio element to play")),vA.play(this._mediaStreamTrack,this.getTrackId(),this._volume,this.store.sessionId||void 0)):this._source.play()}stop(){Sn.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._played=!1,this._useAudioElement?vA.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];Sn.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&vA.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(Bd.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(Bd.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(Bd.ON_TRACK),this.processorDestination.removeAllListeners(Bd.ON_NODE)}},bT(MI.prototype,"setVolume",[wI],Object.getOwnPropertyDescriptor(MI.prototype,"setVolume"),MI.prototype),bT(MI.prototype,"setPlaybackDevice",[NI],Object.getOwnPropertyDescriptor(MI.prototype,"setPlaybackDevice"),MI.prototype),bT(MI.prototype,"play",[DI],Object.getOwnPropertyDescriptor(MI.prototype,"play"),MI.prototype),bT(MI.prototype,"stop",[kI],Object.getOwnPropertyDescriptor(MI.prototype,"stop"),MI.prototype),bT(MI.prototype,"pipe",[PI],Object.getOwnPropertyDescriptor(MI.prototype,"pipe"),MI.prototype),bT(MI.prototype,"unpipe",[LI],Object.getOwnPropertyDescriptor(MI.prototype,"unpipe"),MI.prototype),MI);const jI=new class extends fi{get visibility(){return document.visibilityState}get lastHiddenTime(){return this._lastHiddenTime}get lastVisibleTime(){return this._lastVisibleTime}constructor(){super(),p_(this,"_lastHiddenTime",0),p_(this,"_lastVisibleTime",0),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState?this._lastHiddenTime=performance.now():this._lastVisibleTime=performance.now(),Sn.debug("current web page is ".concat(document.visibilityState)),this.emit("VISIBILITY_CHANGE",document.visibilityState)}))}};class GI extends fi{constructor(e,t){super(),p_(this,"trackMediaType",Pd.DATA),p_(this,"_version",1),p_(this,"_type",3),p_(this,"_config",void 0),p_(this,"_originDataChannel",void 0),p_(this,"_dataStreamPacketHeader",new ArrayBuffer(4)),p_(this,"_dataStreamPacketHandler",{serialize:e=>e,deserialize:e=>e}),p_(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 an("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 VR(((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),[Yd.OPEN,Yd.CLOSE,Yd.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 WI=sc,HI=Fn,KI=mc,YI=RangeError,zI=String.fromCharCode,XI=String.fromCodePoint,ZI=HI([].join);WI({target:"String",stat:!0,arity:1,forced:!!XI&&1!==XI.length},{fromCodePoint:function(e){for(var t,r=[],i=arguments.length,n=0;i>n;){if(t=+arguments[n++],KI(t,1114111)!==t)throw new YI(t+" is not a valid code point");r[n]=t<65536?zI(t):zI(55296+((t-=65536)>>10),t%1024+56320)}return ZI(r,"")}});var JI=Pn,QI=Hs("iterator"),qI=!JI((function(){var e=new URL("b?a=1&b=2&c=3","https://a"),t=e.searchParams,r=new URLSearchParams("a=1&a=2&b=3"),i="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),i+=r+e})),r.delete("a",2),r.delete("b",void 0),!e.toJSON||!r.has("a",1)||r.has("a",2)||!r.has("a",void 0)||r.has("b")||!t.size&&true||!t.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[QI]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==i||"x"!==new URL("https://x",void 0).host})),$I=Hl,eC=sc,tC=Gn,rC=YS,iC=Mo,nC=ao,oC=Fn,sC=no,aC=qI,cC=Hl,dC=Yl,uC=function(e,t,r){for(var i in t)r&&r.unsafe&&e[i]?e[i]=t[i]:$I(e,i,t[i],r);return e},lC=Eh,hC=Nm,pC=kh,fC=nS,mC=ro,EC=Ns,_C=Ca,TC=Wc,gC=La,SC=wo,vC=Yc,yC=Dl,RC=mo,AC=lg,bC=ng,OC=oE,IC=fS,CC=JA,wC=Hs("iterator"),NC="URLSearchParams",DC=NC+"Iterator",kC=pC.set,PC=pC.getterFor(NC),LC=pC.getterFor(DC),MC=rC("fetch"),UC=rC("Request"),xC=rC("Headers"),VC=UC&&UC.prototype,FC=xC&&xC.prototype,BC=tC.TypeError,jC=tC.encodeURIComponent,GC=String.fromCharCode,WC=iC("String","fromCodePoint"),HC=parseInt,KC=oC("".charAt),YC=oC([].join),zC=oC([].push),XC=oC("".replace),ZC=oC([].shift),JC=oC([].splice),QC=oC("".split),qC=oC("".slice),$C=oC(/./.exec),ew=/\+/g,tw=/^[0-9a-f]+$/i,rw=function(e,t){var r=qC(e,t,t+2);return $C(tw,r)?HC(r,16):NaN},iw=function(e){for(var t=0,r=128;r>0&&0!=(e&r);r>>=1)t++;return t},nw=function(e){var t=null;switch(e.length){case 1:t=e[0];break;case 2:t=(31&e[0])<<6|63&e[1];break;case 3:t=(15&e[0])<<12|(63&e[1])<<6|63&e[2];break;case 4:t=(7&e[0])<<18|(63&e[1])<<12|(63&e[2])<<6|63&e[3]}return t>1114111?null:t},ow=function(e){for(var t=(e=XC(e,ew," ")).length,r="",i=0;i<t;){var n=KC(e,i);if("%"===n){if("%"===KC(e,i+1)||i+3>t){r+="%",i++;continue}var o=rw(e,i+1);if(o!=o){r+=n,i++;continue}i+=2;var s=iw(o);if(0===s)n=GC(o);else{if(1===s||s>4){r+="�",i++;continue}for(var a=[o],c=1;c<s&&!(++i+3>t||"%"!==KC(e,i));){var d=rw(e,i+1);if(d!=d){i+=3;break}if(d>191||d<128)break;zC(a,d),i+=2,c++}if(a.length!==s){r+="�";continue}var u=nw(a);null===u?r+="�":n=WC(u)}}r+=n,i++}return r},sw=/[!'()~]|%20/g,aw={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},cw=function(e){return aw[e]},dw=function(e){return XC(jC(e),sw,cw)},uw=hC((function(e,t){kC(this,{type:DC,target:PC(e).entries,index:0,kind:t})}),NC,(function(){var e=LC(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,OC(void 0,!0);var i=t[r];switch(e.kind){case"keys":return OC(i.key,!1);case"values":return OC(i.value,!1)}return OC([i.key,i.value],!1)}),!0),lw=function(e){this.entries=[],this.url=null,void 0!==e&&(SC(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===KC(e,0)?qC(e,1):e:vC(e)))};lw.prototype={type:NC,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,i,n,o,s,a,c=this.entries,d=bC(e);if(d)for(r=(t=AC(e,d)).next;!(i=nC(r,t)).done;){if(o=(n=AC(gC(i.value))).next,(s=nC(o,n)).done||(a=nC(o,n)).done||!nC(o,n).done)throw new BC("Expected sequence with length 2");zC(c,{key:vC(s.value),value:vC(a.value)})}else for(var u in e)EC(e,u)&&zC(c,{key:u,value:vC(e[u])})},parseQuery:function(e){if(e)for(var t,r,i=this.entries,n=QC(e,"&"),o=0;o<n.length;)(t=n[o++]).length&&(r=QC(t,"="),zC(i,{key:ow(ZC(r)),value:ow(YC(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],i=0;i<t.length;)e=t[i++],zC(r,dw(e.key)+"="+dw(e.value));return YC(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var hw=function(){fC(this,pw);var e=kC(this,new lw(arguments.length>0?arguments[0]:void 0));sC||(this.size=e.entries.length)},pw=hw.prototype;if(uC(pw,{append:function(e,t){var r=PC(this);IC(arguments.length,2),zC(r.entries,{key:vC(e),value:vC(t)}),sC||this.length++,r.updateURL()},delete:function(e){for(var t=PC(this),r=IC(arguments.length,1),i=t.entries,n=vC(e),o=r<2?void 0:arguments[1],s=void 0===o?o:vC(o),a=0;a<i.length;){var c=i[a];if(c.key!==n||void 0!==s&&c.value!==s)a++;else if(JC(i,a,1),void 0!==s)break}sC||(this.size=i.length),t.updateURL()},get:function(e){var t=PC(this).entries;IC(arguments.length,1);for(var r=vC(e),i=0;i<t.length;i++)if(t[i].key===r)return t[i].value;return null},getAll:function(e){var t=PC(this).entries;IC(arguments.length,1);for(var r=vC(e),i=[],n=0;n<t.length;n++)t[n].key===r&&zC(i,t[n].value);return i},has:function(e){for(var t=PC(this).entries,r=IC(arguments.length,1),i=vC(e),n=r<2?void 0:arguments[1],o=void 0===n?n:vC(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=PC(this);IC(arguments.length,1);for(var i,n=r.entries,o=!1,s=vC(e),a=vC(t),c=0;c<n.length;c++)(i=n[c]).key===s&&(o?JC(n,c--,1):(o=!0,i.value=a));o||zC(n,{key:s,value:a}),sC||(this.size=n.length),r.updateURL()},sort:function(){var e=PC(this);CC(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=PC(this).entries,i=_C(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 uw(this,"keys")},values:function(){return new uw(this,"values")},entries:function(){return new uw(this,"entries")}},{enumerable:!0}),cC(pw,wC,pw.entries,{name:"entries"}),cC(pw,"toString",(function(){return PC(this).serialize()}),{enumerable:!0}),sC&&dC(pw,"size",{get:function(){return PC(this).entries.length},configurable:!0,enumerable:!0}),lC(hw,NC),eC({global:!0,constructor:!0,forced:!aC},{URLSearchParams:hw}),!aC&&mC(xC)){var fw=oC(FC.has),mw=oC(FC.set),Ew=function(e){if(SC(e)){var t,r=e.body;if(TC(r)===NC)return t=e.headers?new xC(e.headers):new xC,fw(t,"content-type")||mw(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),yC(e,{body:RC(0,vC(r)),headers:RC(0,t)})}return e};if(mC(MC)&&eC({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return MC(e,arguments.length>1?Ew(arguments[1]):{})}}),mC(UC)){var _w=function(e){return fC(this,VC),new UC(e,arguments.length>1?Ew(arguments[1]):{})};VC.constructor=_w,_w.prototype=VC,eC({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:_w})}}var Tw,gw={URLSearchParams:hw,getState:PC},Sw=no,vw=Fn,yw=ao,Rw=Pn,Aw=sl,bw=Gl,Ow=co,Iw=Is,Cw=So,ww=Object.assign,Nw=Object.defineProperty,Dw=vw([].concat),kw=!ww||Rw((function(){if(Sw&&1!==ww({b:1},ww(Nw({},"a",{enumerable:!0,get:function(){Nw(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol("assign detection"),i="abcdefghijklmnopqrst";return e[r]=7,i.split("").forEach((function(e){t[e]=e})),7!==ww({},e)[r]||Aw(ww({},t)).join("")!==i}))?function(e,t){for(var r=Iw(e),i=arguments.length,n=1,o=bw.f,s=Ow.f;i>n;)for(var a,c=Cw(arguments[n++]),d=o?Dw(Aw(c),o(c)):Aw(c),u=d.length,l=0;u>l;)a=d[l++],Sw&&!yw(s,c,a)||(r[a]=c[a]);return r}:ww,Pw=La,Lw=mg,Mw=Ca,Uw=ao,xw=Is,Vw=function(e,t,r,i){try{return i?t(Pw(r)[0],r[1]):t(r)}catch(t){Lw(e,"throw",t)}},Fw=qT,Bw=Ru,jw=gc,Gw=su,Ww=lg,Hw=ng,Kw=Array,Yw=Fn,zw=2147483647,Xw=/[^\0-\u007E]/,Zw=/[.\u3002\uFF0E\uFF61]/g,Jw="Overflow: input needs wider integers to process",Qw=RangeError,qw=Yw(Zw.exec),$w=Math.floor,eN=String.fromCharCode,tN=Yw("".charCodeAt),rN=Yw([].join),iN=Yw([].push),nN=Yw("".replace),oN=Yw("".split),sN=Yw("".toLowerCase),aN=function(e){return e+22+75*(e<26)},cN=function(e,t,r){var i=0;for(e=r?$w(e/700):e>>1,e+=$w(e/t);e>455;)e=$w(e/35),i+=36;return $w(i+36*e/(e+38))},dN=function(e){var t=[];e=function(e){for(var t=[],r=0,i=e.length;r<i;){var n=tN(e,r++);if(n>=55296&&n<=56319&&r<i){var o=tN(e,r++);56320==(64512&o)?iN(t,((1023&n)<<10)+(1023&o)+65536):(iN(t,n),r--)}else iN(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&&iN(t,eN(i));var c=t.length,d=c;for(c&&iN(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>$w((zw-s)/l))throw new Qw(Jw);for(s+=(u-o)*l,o=u,r=0;r<e.length;r++){if((i=e[r])<o&&++s>zw)throw new Qw(Jw);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 m=h-f,E=36-f;iN(t,eN(aN(f+m%E))),h=$w(m/E),p+=36}iN(t,eN(aN(h))),a=cN(s,l,d===c),s=0,d++}}s++,o++}return rN(t,"")},uN=sc,lN=no,hN=qI,pN=Gn,fN=Ca,mN=Fn,EN=Hl,_N=Yl,TN=nS,gN=Ns,SN=kw,vN=function(e){var t=xw(e),r=Bw(this),i=arguments.length,n=i>1?arguments[1]:void 0,o=void 0!==n;o&&(n=Mw(n,i>2?arguments[2]:void 0));var s,a,c,d,u,l,h=Hw(t),p=0;if(!h||this===Kw&&Fw(h))for(s=jw(t),a=r?new this(s):Kw(s);s>p;p++)l=o?n(t[p],p):t[p],Gw(a,p,l);else for(a=r?new this:[],u=(d=Ww(t,h)).next;!(c=Uw(u,d)).done;p++)l=o?Vw(d,n,[c.value,p],!0):c.value,Gw(a,p,l);return a.length=p,a},yN=Ul,RN=e_.codeAt,AN=function(e){var t,r,i=[],n=oN(nN(sN(e),Zw,"."),".");for(t=0;t<n.length;t++)r=n[t],iN(i,qw(Xw,r)?"xn--"+dN(r):r);return rN(i,".")},bN=Yc,ON=Eh,IN=fS,CN=gw,wN=kh,NN=wN.set,DN=wN.getterFor("URL"),kN=CN.URLSearchParams,PN=CN.getState,LN=pN.URL,MN=pN.TypeError,UN=pN.parseInt,xN=Math.floor,VN=Math.pow,FN=mN("".charAt),BN=mN(/./.exec),jN=mN([].join),GN=mN(1..toString),WN=mN([].pop),HN=mN([].push),KN=mN("".replace),YN=mN([].shift),zN=mN("".split),XN=mN("".slice),ZN=mN("".toLowerCase),JN=mN([].unshift),QN="Invalid scheme",qN="Invalid host",$N="Invalid port",eD=/[a-z]/i,tD=/[\d+-.a-z]/i,rD=/\d/,iD=/^0x/i,nD=/^[0-7]+$/,oD=/^\d+$/,sD=/^[\da-f]+$/i,aD=/[\0\t\n\r #%/:<>?@[\\\]^|]/,cD=/[\0\t\n\r #/:<>?@[\\\]^|]/,dD=/^[\u0000-\u0020]+/,uD=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,lD=/[\t\n\r]/g,hD=function(e){var t,r,i,n;if("number"==typeof e){for(t=[],r=0;r<4;r++)JN(t,e%256),e=xN(e/256);return jN(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?i:t}(e),r=0;r<8;r++)n&&0===e[r]||(n&&(n=!1),i===r?(t+=r?":":"::",n=!0):(t+=GN(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},pD={},fD=SN({},pD,{" ":1,'"':1,"<":1,">":1,"`":1}),mD=SN({},fD,{"#":1,"?":1,"{":1,"}":1}),ED=SN({},mD,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),_D=function(e,t){var r=RN(e,0);return r>32&&r<127&&!gN(t,e)?e:encodeURIComponent(e)},TD={ftp:21,file:null,http:80,https:443,ws:80,wss:443},gD=function(e,t){var r;return 2===e.length&&BN(eD,FN(e,0))&&(":"===(r=FN(e,1))||!t&&"|"===r)},SD=function(e){var t;return e.length>1&&gD(XN(e,0,2))&&(2===e.length||"/"===(t=FN(e,2))||"\\"===t||"?"===t||"#"===t)},vD=function(e){return"."===e||"%2e"===ZN(e)},yD={},RD={},AD={},bD={},OD={},ID={},CD={},wD={},ND={},DD={},kD={},PD={},LD={},MD={},UD={},xD={},VD={},FD={},BD={},jD={},GD={},WD=function(e,t,r){var i,n,o,s=bN(e);if(t){if(n=this.parse(s))throw new MN(n);this.searchParams=null}else{if(void 0!==r&&(i=new WD(r,!0)),n=this.parse(s,null,i))throw new MN(n);(o=PN(new kN)).bindURL(this),this.searchParams=o}};WD.prototype={type:"URL",parse:function(e,t,r){var i,n,o,s,a,c=this,d=t||yD,u=0,l="",h=!1,p=!1,f=!1;for(e=bN(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=KN(e,dD,""),e=KN(e,uD,"$1")),e=KN(e,lD,""),i=vN(e);u<=i.length;){switch(n=i[u],d){case yD:if(!n||!BN(eD,n)){if(t)return QN;d=AD;continue}l+=ZN(n),d=RD;break;case RD:if(n&&(BN(tD,n)||"+"===n||"-"===n||"."===n))l+=ZN(n);else{if(":"!==n){if(t)return QN;l="",d=AD,u=0;continue}if(t&&(c.isSpecial()!==gN(TD,l)||"file"===l&&(c.includesCredentials()||null!==c.port)||"file"===c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&TD[c.scheme]===c.port&&(c.port=null));l="","file"===c.scheme?d=MD:c.isSpecial()&&r&&r.scheme===c.scheme?d=bD:c.isSpecial()?d=wD:"/"===i[u+1]?(d=OD,u++):(c.cannotBeABaseURL=!0,HN(c.path,""),d=BD)}break;case AD:if(!r||r.cannotBeABaseURL&&"#"!==n)return QN;if(r.cannotBeABaseURL&&"#"===n){c.scheme=r.scheme,c.path=yN(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,d=GD;break}d="file"===r.scheme?MD:ID;continue;case bD:if("/"!==n||"/"!==i[u+1]){d=ID;continue}d=ND,u++;break;case OD:if("/"===n){d=DD;break}d=FD;continue;case ID:if(c.scheme=r.scheme,n===Tw)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=yN(r.path),c.query=r.query;else if("/"===n||"\\"===n&&c.isSpecial())d=CD;else if("?"===n)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=yN(r.path),c.query="",d=jD;else{if("#"!==n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=yN(r.path),c.path.length--,d=FD;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=yN(r.path),c.query=r.query,c.fragment="",d=GD}break;case CD:if(!c.isSpecial()||"/"!==n&&"\\"!==n){if("/"!==n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,d=FD;continue}d=DD}else d=ND;break;case wD:if(d=ND,"/"!==n||"/"!==FN(l,u+1))continue;u++;break;case ND:if("/"!==n&&"\\"!==n){d=DD;continue}break;case DD:if("@"===n){h&&(l="%40"+l),h=!0,o=vN(l);for(var m=0;m<o.length;m++){var E=o[m];if(":"!==E||f){var _=_D(E,ED);f?c.password+=_:c.username+=_}else f=!0}l=""}else if(n===Tw||"/"===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 PD:if(t&&"file"===c.scheme){d=xD;continue}if(":"!==n||p){if(n===Tw||"/"===n||"?"===n||"#"===n||"\\"===n&&c.isSpecial()){if(c.isSpecial()&&""===l)return qN;if(t&&""===l&&(c.includesCredentials()||null!==c.port))return;if(s=c.parseHost(l))return s;if(l="",d=VD,t)return;continue}"["===n?p=!0:"]"===n&&(p=!1),l+=n}else{if(""===l)return qN;if(s=c.parseHost(l))return s;if(l="",d=LD,t===PD)return}break;case LD:if(!BN(rD,n)){if(n===Tw||"/"===n||"?"===n||"#"===n||"\\"===n&&c.isSpecial()||t){if(""!==l){var T=UN(l,10);if(T>65535)return $N;c.port=c.isSpecial()&&T===TD[c.scheme]?null:T,l=""}if(t)return;d=VD;continue}return $N}l+=n;break;case MD:if(c.scheme="file","/"===n||"\\"===n)d=UD;else{if(!r||"file"!==r.scheme){d=FD;continue}switch(n){case Tw:c.host=r.host,c.path=yN(r.path),c.query=r.query;break;case"?":c.host=r.host,c.path=yN(r.path),c.query="",d=jD;break;case"#":c.host=r.host,c.path=yN(r.path),c.query=r.query,c.fragment="",d=GD;break;default:SD(jN(yN(i,u),""))||(c.host=r.host,c.path=yN(r.path),c.shortenPath()),d=FD;continue}}break;case UD:if("/"===n||"\\"===n){d=xD;break}r&&"file"===r.scheme&&!SD(jN(yN(i,u),""))&&(gD(r.path[0],!0)?HN(c.path,r.path[0]):c.host=r.host),d=FD;continue;case xD:if(n===Tw||"/"===n||"\\"===n||"?"===n||"#"===n){if(!t&&gD(l))d=FD;else if(""===l){if(c.host="",t)return;d=VD}else{if(s=c.parseHost(l))return s;if("localhost"===c.host&&(c.host=""),t)return;l="",d=VD}continue}l+=n;break;case VD:if(c.isSpecial()){if(d=FD,"/"!==n&&"\\"!==n)continue}else if(t||"?"!==n)if(t||"#"!==n){if(n!==Tw&&(d=FD,"/"!==n))continue}else c.fragment="",d=GD;else c.query="",d=jD;break;case FD:if(n===Tw||"/"===n||"\\"===n&&c.isSpecial()||!t&&("?"===n||"#"===n)){if(".."===(a=ZN(a=l))||"%2e."===a||".%2e"===a||"%2e%2e"===a?(c.shortenPath(),"/"===n||"\\"===n&&c.isSpecial()||HN(c.path,"")):vD(l)?"/"===n||"\\"===n&&c.isSpecial()||HN(c.path,""):("file"===c.scheme&&!c.path.length&&gD(l)&&(c.host&&(c.host=""),l=FN(l,0)+":"),HN(c.path,l)),l="","file"===c.scheme&&(n===Tw||"?"===n||"#"===n))for(;c.path.length>1&&""===c.path[0];)YN(c.path);"?"===n?(c.query="",d=jD):"#"===n&&(c.fragment="",d=GD)}else l+=_D(n,mD);break;case BD:"?"===n?(c.query="",d=jD):"#"===n?(c.fragment="",d=GD):n!==Tw&&(c.path[0]+=_D(n,pD));break;case jD:t||"#"!==n?n!==Tw&&("'"===n&&c.isSpecial()?c.query+="%27":c.query+="#"===n?"%23":_D(n,pD)):(c.fragment="",d=GD);break;case GD:n!==Tw&&(c.fragment+=_D(n,fD))}u++}},parseHost:function(e){var t,r,i;if("["===FN(e,0)){if("]"!==FN(e,e.length-1))return qN;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 FN(e,l)};if(":"===h()){if(":"!==FN(e,1))return;l+=2,u=++d}for(;h();){if(8===d)return;if(":"!==h()){for(t=r=0;r<4&&BN(sD,h());)t=16*t+UN(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(!BN(rD,h()))return;for(;BN(rD,h());){if(o=UN(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}(XN(e,1,-1)),!t)return qN;this.host=t}else if(this.isSpecial()){if(e=AN(e),BN(aD,e))return qN;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"===FN(n,0)&&(o=BN(iD,n)?16:8,n=XN(n,8===o?1:2)),""===n)s=0;else{if(!BN(10===o?oD:8===o?nD:sD,n))return e;s=UN(n,o)}HN(r,s)}for(i=0;i<t;i++)if(s=r[i],i===t-1){if(s>=VN(256,5-t))return null}else if(s>255)return null;for(a=WN(r),i=0;i<r.length;i++)a+=r[i]*VN(256,3-i);return a}(e),null===t)return qN;this.host=t}else{if(BN(cD,e))return qN;for(t="",r=vN(e),i=0;i<r.length;i++)t+=_D(r[i],pD);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return gN(TD,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"===this.scheme&&1===t&&gD(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+=hD(n),null!==o&&(d+=":"+o)):"file"===t&&(d+="//"),d+=e.cannotBeABaseURL?s[0]:s.length?"/"+jN(s,"/"):"",null!==a&&(d+="?"+a),null!==c&&(d+="#"+c),d},setHref:function(e){var t=this.parse(e);if(t)throw new MN(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new HD(e.path[0]).origin}catch(e){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+hD(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(bN(e)+":",yD)},getUsername:function(){return this.username},setUsername:function(e){var t=vN(bN(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=_D(t[r],ED)}},getPassword:function(){return this.password},setPassword:function(e){var t=vN(bN(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=_D(t[r],ED)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?hD(e):hD(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,kD)},getHostname:function(){var e=this.host;return null===e?"":hD(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,PD)},getPort:function(){var e=this.port;return null===e?"":bN(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=bN(e))?this.port=null:this.parse(e,LD))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+jN(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,VD))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=bN(e))?this.query=null:("?"===FN(e,0)&&(e=XN(e,1)),this.query="",this.parse(e,jD)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=bN(e))?("#"===FN(e,0)&&(e=XN(e,1)),this.fragment="",this.parse(e,GD)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var HD=function(e){var t=TN(this,KD),r=IN(arguments.length,1)>1?arguments[1]:void 0,i=NN(t,new WD(e,!1,r));lN||(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())},KD=HD.prototype,YD=function(e,t){return{get:function(){return DN(this)[e]()},set:t&&function(e){return DN(this)[t](e)},configurable:!0,enumerable:!0}};if(lN&&(_N(KD,"href",YD("serialize","setHref")),_N(KD,"origin",YD("getOrigin")),_N(KD,"protocol",YD("getProtocol","setProtocol")),_N(KD,"username",YD("getUsername","setUsername")),_N(KD,"password",YD("getPassword","setPassword")),_N(KD,"host",YD("getHost","setHost")),_N(KD,"hostname",YD("getHostname","setHostname")),_N(KD,"port",YD("getPort","setPort")),_N(KD,"pathname",YD("getPathname","setPathname")),_N(KD,"search",YD("getSearch","setSearch")),_N(KD,"searchParams",YD("getSearchParams")),_N(KD,"hash",YD("getHash","setHash"))),EN(KD,"toJSON",(function(){return DN(this).serialize()}),{enumerable:!0}),EN(KD,"toString",(function(){return DN(this).serialize()}),{enumerable:!0}),LN){var zD=LN.createObjectURL,XD=LN.revokeObjectURL;zD&&EN(HD,"createObjectURL",fN(zD,LN)),XD&&EN(HD,"revokeObjectURL",fN(XD,LN))}ON(HD,"URL"),uN({global:!0,constructor:!0,forced:!hN,sham:!lN},{URL:HD});var ZD=sc,JD=Pn,QD=fS,qD=Yc,$D=qI,ek=Mo("URL"),tk=$D&&JD((function(){ek.canParse()})),rk=JD((function(){return 1!==ek.canParse.length}));ZD({target:"URL",stat:!0,forced:!tk||rk},{canParse:function(e){var t=QD(arguments.length,1),r=qD(e),i=t<2||void 0===arguments[1]?void 0:qD(arguments[1]);try{return!!new ek(r,i)}catch(e){return!1}}});var ik=sc,nk=fS,ok=Yc,sk=qI,ak=Mo("URL");ik({target:"URL",stat:!0,forced:!sk},{parse:function(e){var t=nk(arguments.length,1),r=ok(e),i=t<2||void 0===arguments[1]?void 0:ok(arguments[1]);try{return new ak(r,i)}catch(e){return null}}});var ck=Z(No.URL);function dk(){const e=new Blob([atob("ZnVuY3Rpb24gdCh0LGUsbil7bGV0IGE9bmV3IFVpbnQ4QXJyYXkodCxlLG4pLG89W10scj0wO2Zvcig7by5sZW5ndGg8bjspciszPG4mJjA9PT1hW3JdJiYwPT09YVtyKzFdJiYzPT09YVtyKzJdJiYoMD09PWFbciszXXx8MT09PWFbciszXXx8Mj09PWFbciszXXx8Mz09PWFbciszXSk/KG8ucHVzaChhW3JdLGFbcisxXSxhW3IrM10pLHIrPTQpOihvLnB1c2goYVtyXSkscisrKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkobyl9ZnVuY3Rpb24gZSh0LGUpe2NvbnN0IG49ZnVuY3Rpb24odCl7Y29uc3QgZT10Lmxlbmd0aDtsZXQgbj1bXSxhPTA7Zm9yKDthPGU7KWErMjxlJiYwPT09dFthXSYmMD09PXRbYSsxXSYmKDA9PT10W2ErMl18fDE9PT10W2ErMl18fDI9PT10W2ErMl18fDM9PT10W2ErMl0pPyhuLnB1c2godFthXSx0W2ErMV0sMyx0W2ErMl0pLGErPTMpOihuLnB1c2godFthXSksYSsrKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkobil9KGUpLGE9bi5sZW5ndGgsbz1NYXRoLmZsb29yKGEvMjU1KSxyPWElMjU1LHM9bmV3IFVpbnQ4QXJyYXkoNitvKzErYSt0LmJ5dGVMZW5ndGgpO3NbMF09MCxzWzFdPTAsc1syXT0wLHNbM109MSxzWzRdPTYsc1s1XT0xMDE7bGV0IGk9MDtmb3IoO2k8bzspc1s2K2ldPTI1NSxpKys7cmV0dXJuIHNbNitpXT1yLGkrKyxzLnNldChuLDYraSkscy5zZXQobmV3IFVpbnQ4QXJyYXkodCksNitpK2EpLHMuYnVmZmVyfWNvbnN0IG49NzEsYT0xLG89MixyPTEscz0yO3ZhciBpOyFmdW5jdGlvbih0KXt0W3QuQVVESU9fTEVWRUw9MV09IkFVRElPX0xFVkVMIix0W3QuTUVUQURBVEE9Ml09Ik1FVEFEQVRBIix0W3QuQVVESU9fNjRfQklUX1BUUz0zXT0iQVVESU9fNjRfQklUX1BUUyJ9KGl8fChpPXt9KSk7bmF2aWdhdG9yLnVzZXJBZ2VudC5pbmRleE9mKCJTYWZhcmkiKT4tMSYmLTE9PT1uYXZpZ2F0b3IudXNlckFnZW50LmluZGV4T2YoIkNocm9tZSIpJiYoc2VsZi5vbnJ0Y3RyYW5zZm9ybT1mPT57Y29uc3QgdT1mLnRyYW5zZm9ybWVyO2xldCBkPVtdLGw9W107dS5vcHRpb25zLnBvcnQub25tZXNzYWdlPXQ9Pnt0LmRhdGEuc2VpJiZkLnB1c2godC5kYXRhLnNlaSksdC5kYXRhLm1ldGFkYXRhJiZsLnB1c2godC5kYXRhLm1ldGFkYXRhKX0sc2VsZi5wb3N0TWVzc2FnZSgic3RhcnRlZCIpO2NvbnN0IGc9dS5yZWFkYWJsZS5nZXRSZWFkZXIoKSxjPXUud3JpdGFibGUuZ2V0V3JpdGVyKCk7InNlaS1yeCI9PT11Lm9wdGlvbnMubmFtZT9mdW5jdGlvbiBlKG4pe2cucmVhZCgpLnRoZW4oKGE9PntpZighYS5kb25lKXtpZihhLnZhbHVlIGluc3RhbmNlb2YgUlRDRW5jb2RlZFZpZGVvRnJhbWUpe2NvbnN0IGU9ZnVuY3Rpb24oZSl7Y29uc3Qgbj1uZXcgRGF0YVZpZXcoZS5kYXRhKTtsZXQgYT0wO2Zvcig7YSs0PGUuZGF0YS5ieXRlTGVuZ3RoOyl7aWYoMD09PW4uZ2V0VWludDgoYSswKSYmMD09PW4uZ2V0VWludDgoYSsxKSYmMD09PW4uZ2V0VWludDgoYSsyKSYmMT09PW4uZ2V0VWludDgoYSszKSYmNj09PW4uZ2V0VWludDgoYSs0KSl7bGV0IG89YSs2LHI9MCxzPTA7Zm9yKDsyNTU9PT0ocz1uLmdldFVpbnQ4KG8rKykpOylyKz0yNTU7cis9cztjb25zdCBpPXQoZS5kYXRhLG8scik7cmV0dXJuIG5ldyBVaW50OEFycmF5KGkpfWErK31yZXR1cm4gbnVsbH0oYS52YWx1ZSk7ZSYmbi5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe3NlaTplfSl9Yy53cml0ZShhLnZhbHVlKSxuLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7dHJhbnNmb3JtZWQ6ITB9KSxlKG4pfX0pKX0odSk6InNlaS10eCI9PT11Lm9wdGlvbnMubmFtZT9mdW5jdGlvbiB0KG4pe2cucmVhZCgpLnRoZW4oKGE9PntpZighYS5kb25lKXtpZihhLnZhbHVlIGluc3RhbmNlb2YgUlRDRW5jb2RlZFZpZGVvRnJhbWUpe2NvbnN0IHQ9ZC5zaGlmdCgpO3QmJihhLnZhbHVlLmRhdGE9ZShhLnZhbHVlLmRhdGEsdCkpfWMud3JpdGUoYS52YWx1ZSksbi5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe3RyYW5zZm9ybWVkOiEwfSksdChuKX19KSl9KHUpOiJhdWRpby1tZXRhZGF0YS1yeCI9PT11Lm9wdGlvbnMubmFtZT9mdW5jdGlvbiB0KGUpe2cucmVhZCgpLnRoZW4oKGY9PntpZighZi5kb25lKXtpZihmLnZhbHVlIGluc3RhbmNlb2YgUlRDRW5jb2RlZEF1ZGlvRnJhbWUpe2NvbnN0IHQ9ZnVuY3Rpb24odCxlPSExKXtjb25zdCBmPXQuZ2V0VWludDgoMCk7aWYoZiE9PW4pcmV0dXJuO2NvbnN0IHU9dC5nZXRVaW50MTYoMSksZD1hK28rdSxsPW5ldyBVaW50OEFycmF5KHQuYnl0ZUxlbmd0aC1kKTtsLnNldChuZXcgVWludDhBcnJheSh0LmJ1ZmZlcixkLHQuYnl0ZUxlbmd0aC1kKSk7Y29uc3QgZz17bTpmLHRsdkxlbjp1LHRsdjpbXSxmcmFtZTpsfTtsZXQgYz1hK287Zm9yKDtjPGQ7KXtjb25zdCBuPXQuZ2V0VWludDgoYyksYT10LmdldFVpbnQxNihjK3IpLG89citzO2lmKG49PT1pLkFVRElPX0xFVkVMKXtsZXQgcj10LmdldFVpbnQ4KGMrbyk7Zm9yKGxldCBlPTE7ZTxhO2UrKylyPXI8PDh8dC5nZXRVaW50OChjK28rZSk7Zy50bHYucHVzaCh7dGFnOm4sbGVuZ3RoOmEsdmFsdWU6ZT8xMjdecj4+MToxMjcmcn0pfWVsc2UgaWYobj09PWkuTUVUQURBVEF8fG49PT1pLkFVRElPXzY0X0JJVF9QVFMpe2NvbnN0IGU9bmV3IFVpbnQ4QXJyYXkoYSk7Zm9yKGxldCBuPTA7bjxhO24rKyllW25dPXQuZ2V0VWludDgoYytvK24pO2cudGx2LnB1c2goe3RhZzpuLGxlbmd0aDphLHZhbHVlOmV9KX1jKz1vK2F9cmV0dXJuIGd9KG5ldyBEYXRhVmlldyhmLnZhbHVlLmRhdGEpKTtpZih0KXtjb25zdCBuPXQudGx2LmZpbmQoKHQ9PnQudGFnPT09aS5NRVRBREFUQXx8dC50YWc9PT1pLkFVRElPXzY0X0JJVF9QVFMpKTtuJiZuLnZhbHVlIGluc3RhbmNlb2YgVWludDhBcnJheSYmZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe21ldGFkYXRhOm4udmFsdWV9KSxmLnZhbHVlLmRhdGE9dC5mcmFtZS5idWZmZXJ9fWMud3JpdGUoZi52YWx1ZSksZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe3RyYW5zZm9ybWVkOiEwfSksdChlKX19KSl9KHUpOiJhdWRpby1tZXRhZGF0YS10eCI9PT11Lm9wdGlvbnMubmFtZSYmZnVuY3Rpb24gdChlKXtnLnJlYWQoKS50aGVuKChmPT57aWYoIWYuZG9uZSl7aWYoZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe2dldE1ldGFkYXRhOiEwfSksZi52YWx1ZSBpbnN0YW5jZW9mIFJUQ0VuY29kZWRBdWRpb0ZyYW1lKXtjb25zdCB0PWwuc2hpZnQoKTt0JiYoZi52YWx1ZS5kYXRhPWZ1bmN0aW9uKHQsZSxpKXtjb25zdCBmPWkuYnl0ZUxlbmd0aCx1PWYrcitzLGQ9YStvK3UsbD1uZXcgQXJyYXlCdWZmZXIodC5ieXRlTGVuZ3RoK2QpLGc9bmV3IERhdGFWaWV3KGwpO2cuc2V0VWludDgoMCxuKSxnLnNldFVpbnQxNigxLHUpLGcuc2V0VWludDgoMyxlKSxnLnNldFVpbnQxNig0LGYpO2ZvcihsZXQgdD0wO3Q8Zjt0KyspZy5zZXRVaW50OCg2K3QsaVt0XSk7Y29uc3QgYz1uZXcgVWludDhBcnJheShnLmJ1ZmZlcik7cmV0dXJuIGMuc2V0KG5ldyBVaW50OEFycmF5KHQpLGQpLGMuYnVmZmVyfShmLnZhbHVlLmRhdGEsaS5BVURJT182NF9CSVRfUFRTLHQpKX1jLndyaXRlKGYudmFsdWUpLGUub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHt0cmFuc2Zvcm1lZDohMH0pLHQoZSl9fSkpfSh1KX0sc2VsZi5wb3N0TWVzc2FnZSgicmVnaXN0ZXJlZCIpKTsK")],{type:"text/javascript"});return setTimeout((()=>ck.revokeObjectURL(e)),0),new Worker(ck.createObjectURL(e))}const uk=71,lk=1,hk=2,pk=1,fk=2;var mk=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}(mk||{});function Ek(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=e.getUint8(0);if(r!==uk)return;const i=e.getUint16(1),n=lk+hk+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=lk+hk;for(;a<n;){const r=e.getUint8(a),i=e.getUint16(a+pk),n=pk+fk;if(r===mk.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===mk.METADATA||r===mk.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 _k=new Map;function Tk(e,t){const{chunk:r,controller:i}=t,n=an("ENABLE_AUDIO_PTS_METADATA")?mk.AUDIO_64_BIT_PTS:mk.METADATA;r.data=function(e,t,r){const i=r.byteLength,n=i+pk+fk,o=lk+hk+n,s=new ArrayBuffer(e.byteLength+o),a=new DataView(s);a.setUint8(0,uk),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 gk=Z(nT);const Sk=127,vk=1e-10,yk=139/13;const Rk=new Map;function Ak(e,t,r){const i="".concat(e,"-").concat(t,"-").concat(r);let n=0;if(Rk.has(i))n=Rk.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,Rk.set(i,n)}return n<vk&&(n=vk),n}function bk(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=Rk;let Ok=0;class Ik{constructor(e){p_(this,"id",void 0),p_(this,"immediates",[]),p_(this,"lastNonSilence",-1),p_(this,"immediateSpeechActivityScore",vk),p_(this,"lastLevelChangedTime",Date.now()),p_(this,"levels",[]),p_(this,"longs",[]),p_(this,"longSpeechActivityScore",vk),p_(this,"mediums",[]),p_(this,"mediumSpeechActivityScore",vk),p_(this,"minLevel",0),p_(this,"nextMinLevel",0),p_(this,"nextMinLevelWindowLength",0),p_(this,"energyScore",0),this.id=e||"".concat(Ok++),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+yk;let i=!1;for(let n=0;n<e.length;++n){let o=t[n];o<r&&(o=0);const s=Math.floor(o/yk);e[n]!==s&&(e[n]=s,i=!0)}return i}computeLongs(){return bk(this.mediums,this.longs,4)}computeMediums(){return bk(this.immediates,this.mediums,7)}evaluateImmediateSpeechActivityScore(){this.immediateSpeechActivityScore=Ak(this.immediates[0],13,.78)}evaluateLongSpeechActivityScore(e){this.longSpeechActivityScore=Ak(this.longs[0],10,47),this.longSpeechActivityScore>vk&&(this.lastNonSilence=e)}evaluateMediumSpeechActivityScore(){this.mediumSpeechActivityScore=Ak(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(gk(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>Sk&&(r=Sk),this.levels.unshift(r),this.levels.length>this.immediates.length&&this.levels.pop(),this.updateMinLevel(r),r>=this.minLevel+yk?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>Sk&&(e=Sk),this.minLevel=e,this.nextMinLevel=0,this.nextMinLevelWindowLength=0}}}}class Ck{constructor(e){p_(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 wk{constructor(e,t,r){p_(this,"isDominant",void 0),p_(this,"energyRanking",void 0),p_(this,"energyScore",void 0),this.isDominant=e,this.energyRanking=t,this.energyScore=r}}class Nk extends fi{constructor(e){super(),p_(this,"dominantId",null),p_(this,"lastDecisionTime",0),p_(this,"lastLevelChangedTime",0),p_(this,"lastLevelIdleTime",0),p_(this,"relativeSpeechActivities",[]),p_(this,"speakers",new Map),p_(this,"enableSilence",!1),p_(this,"timeoutToSilenceInterval",0),p_(this,"decisionMaker",null),p_(this,"loudest",[]),p_(this,"numLoudestToTrack",3),p_(this,"energyExpireTimeMs",250),p_(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 Ik(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 wk(i,t,e.energyScore)}if(e.energyScore=Math.floor((this.energyAlphaPct*t+(100-this.energyAlphaPct)*e.energyScore+50)/100),0===this.numLoudestToTrack)return new wk(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 wk(i,s,e.energyScore)}maybeStartDecisionMaker(){!this.decisionMaker&&this.speakers.size>0&&(this.decisionMaker=new Ck(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=NA(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?vk: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 NA(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 Dk=new Map;let kk=null,Pk=null;const Lk=3;let Mk=[];function Uk(e,t){let r=Dk.get(e);if(r||(r=function(e){const t=new Ik;return Dk.set(e,t),kk||(kk=new Nk(an("TOPN_SILENCE_THRESHOLD")||500),kk.on("ActiveSpeakerChanged",(e=>{null!=e&&(Pk=e)}))),kk.addSpeakers([t]),t}(e)),Dk.size<=Lk)return{selected:!0,speaker:r};if(!kk)throw new Error("no active speaker detector");kk.levelChanged(r.id,t),Mk=kk.loudest.map((e=>e.id)),Pk&&!sd(Mk).call(Mk,Pk)&&Mk.length>=Lk&&Mk.pop();return{selected:sd(Mk).call(Mk,r.id)||r.id===Pk,speaker:r}}const xk=1e3,Vk=40,Fk=new Map,Bk=new Map;class jk{get samples(){return this.actives+this.inactives}get activeRate(){return this.actives/this.samples}constructor(e,t){p_(this,"id",void 0),p_(this,"track",void 0),p_(this,"score",0),p_(this,"active",!0),p_(this,"muted",!1),p_(this,"timer",0),p_(this,"actives",0),p_(this,"inactives",0),this.id=e,this.track=t,this.setActive(Fk.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(NA(Fk).call(Fk)).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>Vk&&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(NA(Fk).call(Fk)).forEach((r=>{!r.active||r.id===e||r.samples<Vk||(!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(NA(Fk).call(Fk)).forEach((r=>{r.active||r.id===e||r.samples<Vk||(!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()}),xk)}clearTimer(){this.timer&&(clearTimeout(this.timer),this.timer=0)}}let Gk;function Wk(e,t,r){const i=Fk.get(e)||new jk(e,t);return i.score=r,Fk.set(e,i),function(e){if(Bk.set(e,!0),!Gk)return void(Gk=Date.now());const t=Date.now();t-Gk>1e3&&(Bk.get(e)?Bk.set(e,!1):(Hk(e),Bk.delete(e)),Gk=t)}(e),i}function Hk(e){const t=Fk.get(e);t&&(Fk.delete(e),t.clearTimer())}const Kk=new Map,Yk=new Map;function zk(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 Xk(e,t){const r=function(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)}(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}const Zk=new Map;const Jk=new Map;wn(),e.AUDIO_CONTEXT_EVENT=kn,e.AUDIO_ENCODER_CONFIG_SETTINGS=_d,e.AUDIO_TRACK_EVENT=Md,e.AudioProcessorContext=UA,e.AudioProcessorDestination=MA,e.AudioSourceEvents=Ld,e.BufferSourceAudioTrack=bO,e.CameraVideoTrack=SI,e.DEFAULT_LOCAL_AUDIO_TRACK_STATS=Ud,e.DEFAULT_LOCAL_VIDEO_TRACK_STATS=xd,e.DEFAULT_NETWORK_QUALITY_STATS={uplinkNetworkQuality:0,downlinkNetworkQuality:0},e.DEFAULT_REMOTE_AUDIO_TRACK_STATS=Vd,e.DEFAULT_REMOTE_VIDEO_TRACK_STATS=Fd,e.DataChannel=GI,e.DataChannelEvents=Yd,e.DeviceManager=hA,e.DeviceManagerEvent=Wd,e.DeviceManagerState=Gd,e.LocalAudioTrack=RO,e.LocalDataChannel=class extends GI{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=BR,e.LocalTrackEvents=Dd,e.LocalVideoTrack=gI,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=Hd,e.MicrophoneAudioTrack=AO,e.MixingAudioTrack=OO,e.PROCESSOR_CONTEXT_EVENTS=jd,e.PROCESSOR_DESTINATION_EVENTS=Bd,e.RemoteAudioTrack=BI,e.RemoteDataChannel=class extends GI{constructor(e){super(e),p_(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(an("SHOW_DATASTREAM2_LOG")&&Sn.debug("invalid datachannel id: ".concat(r," !== ").concat(this.id)));let i=e.data.slice(this._dataStreamPacketHeader.byteLength);i=this._dataStreamPacketHandler.deserialize(i),this.emit(Yd.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=wd,e.RemoteStreamType=Cd,e.RemoteTrack=VI,e.RemoteTrackEvents=kd,e.RemoteVideoTrack=FI,e.SAFARI_GLOBAL_GUM_LOCK=aA,e.SUPPORT_SCREEN_ENCODER_CONFIG_LIST=hd,e.SUPPORT_SVC_CONFIG_LIST=pd,e.SUPPORT_VIDEO_ENCODER_CONFIG_LIST=ld,e.StreamType=Id,e.Track=FR,e.TrackEvents=Nd,e.TrackHint=Od,e.TrackInternalEvent=bd,e.TrackMediaType=Pd,e.VideoProcessorContext=LA,e.VideoProcessorDestination=PA,e.VideoState=Kd,e.__TRACK_LIST__=gd,e.addTrack=Sd,e.audioContextState=HR,e.audioElementPlayCenter=vA,e.audioTimerLoop=function(e,t){let r=!1;const i=1/t;if(an("DISABLE_WEBAUDIO")){const t=window.setInterval((()=>{r?window.clearInterval(t):e(performance.now()/1e3)}),1e3*i)}else{const t=YR();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=mA,e.blob2Uint8Array=Pb,e.checkMediaStreamTrackResolution=FA,e.checkTrackState=yA,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=Li(8,"track-buf-"),a=In.reportApiInvoke(null,{id:s,tag:gi.TRACER,name:Ti.CREATE_BUFFER_AUDIO_TRACK,options:[o]});if(an("DISABLE_WEBAUDIO"))throw new ni(ii.NOT_SUPPORTED,"can not create BufferSourceAudioTrack when WebAudio disabled");Sn.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=CO.get(e);if(t)return Sn.debug("use cached audio resource: ",e),t;try{r=(await zi((()=>br.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 VR(((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 ZR(r);return"string"==typeof e&&t&&CO.set(e,i),i}(n,r)}catch(e){return a.onError(e),e.throw(Sn)}const d=new IO(n),u=new bO(c,d,i?Td(i):{},s);return Sn.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=an("CAMERA_CAPTURE_CONFIG"),r=Li(8,"track-cam-"),i=In.reportApiInvoke(null,{id:r,tag:gi.TRACER,name:Ti.CREATE_CAM_VIDEO_TRACK,options:[yI({},e),t]});t&&(e.encoderConfig=t);const n=BA(e);let o=null;Sn.info("start create camera video track with config",JSON.stringify(e),"trackId",r);try{o=(await cA({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(Sn)}if(e.optimizationMode&&RI(r,o,e,fd(e.encoderConfig)),an("USE_STANDARD_BITRATE_DEFAULT")){const t=fd(e.encoderConfig);e.encoderConfig=t,delete t.bitrateMax,delete t.bitrateMin}const s=new SI(o,e,n,e.scalabiltyMode?Ed(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,r);return i.onSuccess(s.getTrackId()),Sn.info("create camera video success, trackId:",r),s},e.createCustomAudioTrack=function(e){const t=Li(8,"track-cus-"),r=In.reportApiInvoke(null,{id:t,tag:gi.TRACER,name:Ti.CREATE_CUSTOM_AUDIO_TRACK,options:[e]}),i=new RO(e.mediaStreamTrack,e.encoderConfig?Td(e.encoderConfig):{},t,!1);return Sn.info("create custom audio track success with config",e,"trackId",i.getTrackId()),r.onSuccess(i.getTrackId()),i},e.createCustomVideoTrack=function(e){const t=Li(8,"track-cus-"),r=In.reportApiInvoke(null,{id:t,tag:gi.TRACER,name:Ti.CREATE_CUSTOM_VIDEO_TRACK,options:[e]});an("USE_STANDARD_BITRATE_DEFAULT")&&(delete e.bitrateMax,delete e.bitrateMin);const i=new gI(e.mediaStreamTrack,{width:e.width,height:e.height,frameRate:e.frameRate,bitrateMax:e.bitrateMax,bitrateMin:e.bitrateMin},e.scalabiltyMode?Ed(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,t,[Od.CUSTOM_TRACK]);return r.onSuccess(i.getTrackId()),Sn.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=an("CAMERA_CAPTURE_CONFIG"),i=Li(8,"track-mic-"),n=Li(8,"track-cam-"),o=In.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=BA(t),a=HA(e);let c=null,d=null;Sn.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 cA({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(Sn)}if(t.optimizationMode&&RI(n,d,t,fd(t.encoderConfig)),an("USE_STANDARD_BITRATE_DEFAULT")){const e=fd(t.encoderConfig);t.encoderConfig=e,delete e.bitrateMax,delete e.bitrateMin}const u=new AO(c,e,a,i),l=new SI(d,t,s,t.scalabiltyMode?Ed(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,n);return o.onSuccess([u.getTrackId(),l.getTrackId()]),Sn.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=Li(8,"track-mic-"),r=In.reportApiInvoke(null,{id:t,tag:gi.TRACER,name:Ti.CREATE_MIC_AUDIO_TRACK,options:[e]}),i=HA(e);let n=null;Sn.info("start create microphone audio track with config",JSON.stringify(e),"trackId",t);try{n=(await cA({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(Sn)}const o=new AO(n,e,i,t);return r.onSuccess(o.getTrackId()),Sn.info("create microphone audio track success, trackId:",t),o},e.createMixingAudioTrack=function(e){const t=new OO;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?WA(t):void 0;r&&(t="auto");const i=Li(8,"track-scr-v-"),n=In.reportApiInvoke(null,{id:i,tag:gi.TRACER,name:Ti.CREATE_SCREEN_VIDEO_TRACK,options:[yI({},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=jA(e);let s=null,a=null;const c=Nn();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(Sn)}Sn.info("start create screen video track with config",e,"withAudio",t,"trackId",i);const d=c.supportShareAudio&&"disable"!==t;try{const e=await cA({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(Sn)}if(!a&&"enable"===t){s&&s.stop();const e=new ni(ii.SHARE_AUDIO_NOT_ALLOWED);return n.onError(e),e.throw(Sn)}if(e.optimizationMode||(e.optimizationMode="detail"),e.optimizationMode){RI(i,s,e,e.encoderConfig&&md(e.encoderConfig)||void 0),e.encoderConfig&&"string"!=typeof e.encoderConfig&&(e.encoderConfig.bitrateMin=e.encoderConfig.bitrateMax)}const u=new gI(s,e.encoderConfig?md(e.encoderConfig):{},e.scalabiltyMode?Ed(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,i,[Od.SCREEN_TRACK]);if(!a)return n.onSuccess(u.getTrackId()),Sn.info("create screen video track success","video:",u.getTrackId()),u;const l=new RO(a,void 0,Li(8,"track-scr-a-"),!1);return n.onSuccess([u.getTrackId(),l.getTrackId()]),Sn.info("create screen video track success","video:",u.getTrackId(),"audio:",l.getTrackId()),[u,l]},e.decodeAudioData=ZR,e.detectSupportAudioElementSetSinkId=Dn,e.deviceManager=pA,e.emptyImage2TypedArray=kb,e.frameData2CryptoBuffer=async(e,t,r)=>await Db(e.buffer,t,r),e.getAudioContext=YR,e.getAudioEncoderConfiguration=Td,e.getBitrateConstrainRange=wb,e.getBitrateFromResAndFps=Nb,e.getCompatibility=Nn,e.getConstraintsFromAudioConfig=GA,e.getConstraintsFromCameraConfig=BA,e.getConstraintsFromMicrophoneConfig=HA,e.getConstraintsFromScreenAudioConfig=WA,e.getConstraintsFromScreenConfig=jA,e.getElectronScreenSources=oA,e.getElectronScreenStream=iA,e.getElectronScreenStreamByUserSelect=nA,e.getLocalStream=cA,e.getNewVideoBitrate=Cb,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=Bi(s),a=Bi(a),o=Bi(o);const{max:c,min:d}=Nb(s,a,o),{bitrateMax:u,bitrateMin:l}=t||{};u||Sn.debug("calculate bitrate: [w: ".concat(s,", h: ").concat(a,", fps: ").concat(o,"] => [brMax: ").concat(u,", brMin: ").concat(l,"]"));const{maxFramerate:h}=an("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=Ed,e.getScreenEncoderConfiguration=md,e.getSilenceAudioTrack=function(){if(QR)return QR;const e=YR();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),QR=i.stream.getAudioTracks()[0],QR},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=Lb,e.getVideoEncoderConfiguration=fd,e.handleGetUserMediaError=uA,e.hasAudioContext=zR,e.interceptLocalAudioFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Nn().supportWebRTCEncodedTransform)return void Sn.warning("browser not support audio encoded transform");if(_k.has(e))return;if(!e.track)return;const r={track:e.track};if(Ur()){if(!e.createEncodedStreams)return void Sn.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void Sn.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&&(Sn.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?Tk(s,{sender:e,chunk:n,controller:o}):o.enqueue(n)}});n.readable.pipeThrough(o).pipeTo(n.writable)}else if(xr()){if("undefined"==typeof RTCRtpScriptTransform)return void Sn.warning("browser not support RTCRtpScriptTransform");const n=dk(),o=new MessageChannel;await new VR((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 VR((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)Sn.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=_k.get(e);if(t){_k.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){Sn.warning(e&&e.message)}}}_k.set(e,r),e.track.addEventListener("ended",i)},e.interceptLocalVideoFrame=async function(e,t){if(!Nn().supportWebRTCEncodedTransform)return void Sn.warning("browser not support video encoded transform");if(Zk.has(e))return;if(!e.track)return;const r={track:e.track};if(Ur()){if(!e.createEncodedStreams)return void Sn.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void Sn.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&&(Sn.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=o.shift();s&&(t.data=Xk(t.data,s)),n.enqueue(t)}});n.readable.pipeThrough(s).pipeTo(n.writable)}else{if(!xr())return;{if("undefined"==typeof RTCRtpScriptTransform)return void Sn.warning("browser not support RTCRtpScriptTransform");const n=dk(),o=new MessageChannel;await new VR((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 VR((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&&(Sn.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=Zk.get(e);if(t){Zk.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){Sn.warning(e&&e.message)}}}Zk.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(!Nn().supportWebRTCEncodedTransform)return void Sn.warning("browser not support audio encoded transform");if(Kk.has(e))return;const r={track:e.track,onMetadata:t.onMetadata};if(Ur()){if(!e.createEncodedStreams)return void Sn.warning("browser not support createEncodedStreams() API");Gr(Ir.CHROME,87,116)||(t.enableTopn=!1);let n=null;try{n=e.createEncodedStreams()}catch(e){return void Sn.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&&(Sn.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=Ek(new DataView(t.data));if(!n)return r.enqueue(t);const o=e.track.id;Yk.set(o,e.track);const s=null===(i=n.tlv.find((e=>e.tag===mk.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}=Uk(e,c),l=Wk(o,e.track,u.energyScore);l.addSample(d),l.active&&(t.data=n.frame.buffer,r.enqueue(t))}(e,n,o):t.enableMetadata?function(e,t,r){const i=Ek(new DataView(e.data));if(!i)return t.enqueue(e);const n=i.tlv.find((e=>e.tag===mk.METADATA||e.tag===mk.AUDIO_64_BIT_PTS));n&&r&&n.value instanceof Uint8Array&&r(n.value),e.data=i.frame.buffer,t.enqueue(e)}(n,o,t.onMetadata):o.enqueue(n)}});n.readable.pipeThrough(o).pipeTo(n.writable)}else if(xr()){if("undefined"==typeof RTCRtpScriptTransform)return void Sn.warning("browser not support RTCRtpScriptTransform");const t=dk(),n=new MessageChannel;await new VR((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 VR((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?(Sn.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)},r.worker=t}function i(){e.track.removeEventListener("ended",i),function(e){const t=Kk.get(e);if(t){!function(e){const t=Dk.get(e);t&&(Dk.delete(e),kk&&(kk.removeSpeakers([t]),0===Dk.size&&(kk.destroy(),kk=null)))}(e),Hk(e.track.id),Kk.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){Sn.warning(e&&e.message)}}}(e)}Kk.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(!Nn().supportWebRTCEncodedTransform)return void Sn.warning("browser not support video encoded transform");if(!e.track)return;if(Jk.has(e)){const r=Jk.get(e);return void(r&&(r.onSei=t.onSei))}const r={track:e.track,onSei:t.onSei};if(Ur()){if(!e.createEncodedStreams)return void Sn.warning("browser not support createEncodedStreams() API");let t=null;try{t=e.createEncodedStreams()}catch(e){return void Sn.error("create video-encoded-streams error",e&&e.message)}const n=new TransformStream({transform(t,n){r.controller||(r.controller=n),e.track&&e.track.id!==r.track.id&&(Sn.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 o=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=zk(e.data,i,n);return new Uint8Array(s)}r++}return null}(t);o&&r.onSei&&r.onSei(o),n.enqueue(t)}});t.readable.pipeThrough(n).pipeTo(t.writable)}else if(xr()){if("undefined"==typeof RTCRtpScriptTransform)return void Sn.warning("browser not support RTCRtpScriptTransform");const t=dk(),n=new MessageChannel;await new VR((e=>t.onmessage=t=>{"registered"===t.data&&e(void 0)}));const o=new RTCRtpScriptTransform(t,{name:"sei-rx",port:n.port2},[n.port2]);e.transform=o,await new VR((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?(Sn.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)):t.data.sei&&r.onSei&&r.onSei(t.data.sei)},r.worker=t}function i(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",i)}!function(e){const t=Jk.get(e);if(t){Jk.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){Sn.warning(e&&e.message)}}}(e)}Jk.set(e,r),e.track.addEventListener("ended",i)},e.isAudioEncoderConfiguration=Rd,e.isAudioEncoderConfigurationOrPreset=function(e){return"string"==typeof e?si(e,"profile",Object.keys(_d)):Rd(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=mi,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=function(){return!Cn.supportUnifiedPlan||an("CHROME_FORCE_PLAN_B")&&Qr()},e.isScreenSourceType=Ad,e.isVideoEncoderConfiguration=yd,e.isVideoEncoderConfigurationOrPreset=function(e){return"string"==typeof e?si(e,"profile",Object.keys(ld)):yd(e),!0},e.polyfillAudioNode=XR,e.removeTrack=vd,e.requestAutoplayGesture=EA,e.silenceScriptProcessHandler=qR,e.updateAgoraRTCCompatibility=wn,e.visibilityWatcher=jI}));
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 m(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 E(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 v(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 R(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return v(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 y(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:R,shimAddTrackRemoveTrackWithNative:v,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:m,shimMediaStream:E,shimOnTrack:_,shimPeerConnection:y,shimSenderReceiverGetStats:S});function O(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 I(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 k(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 L(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:k,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:L,shimGetUserMedia:O,shimOnTrack:I,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 J(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Z={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}(Z);var Q=Z.exports,q=J(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||!y||!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),m(e,i),E(e),y(e,i),_(e),R(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),O(e,i),C(e,i),I(e),D(e),w(e),N(e),P(e),k(e),L(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",m="console",E="mobile",_="tablet",T="smarttv",g="wearable",S="embedded",v="Amazon",R="Apple",y="ASUS",A="BlackBerry",b="Browser",O="Chrome",I="Firefox",C="Google",w="Huawei",N="LG",D="Microsoft",P="Motorola",k="Opera",L="Samsung",M="Sharp",U="Sony",x="Xiaomi",V="Zebra",F="Facebook",B="Chromium OS",j="Mac OS",G=" Browser",W=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},H=function(e,t){return typeof e===a&&-1!==K(t).indexOf(K(e))},K=function(e){return e.toLowerCase()},Y=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof t===o?e:e.substring(0,500)},z=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}},X=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(H(t[r][n],e))return"?"===r?i:r}else if(H(t[r],e))return"?"===r?i:r;return t.hasOwnProperty("*")?t["*"]:e},J={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,k+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[p,[u,k+" GX"]],[/\bopr\/([\w\.]+)/i],[p,[u,k]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[p,[u,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[p,[u,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[u,p],[/quark(?:pc)?\/([-\w\.]+)/i],[p,[u,"Quark"]],[/\bddg\/([\w\.]+)/i],[p,[u,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[u,"UC"+b]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[p,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[u,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[p,[u,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[p,[u,"Smart Lenovo "+b]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+b],p],[/\bfocus\/([\w\.]+)/i],[p,[u,I+" Focus"]],[/\bopt\/([\w\.]+)/i],[p,[u,k+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[u,k+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[u,"MIUI"+G]],[/fxios\/([\w\.-]+)/i],[p,[u,I]],[/\bqihoobrowser\/?([\w\.]*)/i],[p,[u,"360"]],[/\b(qq)\/([\w\.]+)/i],[[u,/(.+)/,"$1Browser"],p],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1"+G],p],[/samsungbrowser\/([\w\.]+)/i],[p,[u,L+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[p,[u,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[u,"Sogou Mobile"],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[u,p],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[u],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[p,u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,F],p],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[u,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[u,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[p,[u,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[u,O+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,O+" 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,X,{"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],[/(wolvic|librewolf)\/([\w\.]+)/i],[u,p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[u,I+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\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|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[u,[p,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[u,[p,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,K]],[/((?: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/,"",K]],[/(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,K]]],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,L],[l,_]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[d,[h,L],[l,E]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[d,[h,R],[l,E]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[d,[h,R],[l,_]],[/(macintosh);/i],[d,[h,R]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[d,[h,M],[l,E]],[/(?:honor)([-\w ]+)[;\)]/i],[d,[h,"Honor"],[l,E]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[d,[h,w],[l,_]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[d,[h,w],[l,E]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[d,/_/g," "],[h,x],[l,E]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\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,E]],[/\b(opd2\d{3}a?) bui/i],[d,[h,"OPPO"],[l,_]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[d,[h,"Vivo"],[l,E]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[d,[h,"Realme"],[l,E]],[/\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,E]],[/\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,E]],[/(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,E]],[/(pixel c)\b/i],[d,[h,C],[l,_]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[d,[h,C],[l,E]],[/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,E]],[/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,E]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[d,[h,v],[l,_]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[d,/(.+)/g,"Fire Phone $1"],[h,v],[l,E]],[/(playbook);[-\w\),; ]+(rim)/i],[d,h,[l,_]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[d,[h,A],[l,E]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[d,[h,y],[l,_]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[d,[h,y],[l,E]],[/(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,E]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[d,[h,"TCL"],[l,_]],[/(itel) ((\w+))/i],[[h,K],d,[l,X,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/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,E]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[d,[h,"Ulefone"],[l,E]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[d,[h,"Energizer"],[l,E]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[d,[h,"Cat"],[l,E]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[d,[h,"Smartfren"],[l,E]],[/droid.+; (a(?:015|06[35]|142p?))/i],[d,[h,"Nothing"],[l,E]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[h,d,[l,E]],[/(imo) (tab \w+)/i,/(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,E]],[/(u304aa)/i],[d,[h,"AT&T"],[l,E]],[/\bsie-(\w*)/i],[d,[h,"Siemens"],[l,E]],[/\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,E]],[/\b(gen\d{3}) b.+49h/i],[d,[h,"Swiss"],[l,E]],[/\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,E]],[/\b(lvtel\-)?(v1[12]) b/i],[[h,"LvTel"],d,[l,E]],[/\b(ph-1) /i],[d,[h,"Essential"],[l,E]],[/\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,E]],[/(kin\.[onetw]{3})/i],[[d,/\./g," "],[h,D],[l,E]],[/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,E]],[/smart-tv.+(samsung)/i],[h,[l,T]],[/hbbtv.+maple;(\d+)/i],[[d,/^/,"SmartTV"],[h,L],[l,T]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[h,N],[l,T]],[/(apple) ?tv/i],[h,[d,R+" TV"],[l,T]],[/crkey/i],[[d,O+"cast"],[h,C],[l,T]],[/droid.+aft(\w+)( bui|\))/i],[d,[h,v],[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,Y],[d,Y],[l,T]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,T]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[h,d,[l,m]],[/droid.+; (shield) bui/i],[d,[h,"Nvidia"],[l,m]],[/(playstation [345portablevi]+)/i],[d,[h,U],[l,m]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[d,[h,D],[l,m]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[d,[h,L],[l,g]],[/((pebble))app/i],[h,d,[l,g]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[d,[h,R],[l,g]],[/droid.+; (glass) \d/i],[d,[h,C],[l,g]],[/droid.+; (wt63?0{2,3})\)/i],[d,[h,V],[l,g]],[/droid.+; (glass) \d/i],[d,[h,C],[l,g]],[/(pico) (4|neo3(?: link|pro)?)/i],[h,d,[l,g]],[/; (quest( \d| pro)?)/i],[d,[h,F],[l,g]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[h,[l,S]],[/(aeobc)\b/i],[d,[h,v],[l,S]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[d,[l,E]],[/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,E]],[/(android[-\w\. ]{0,9});.+buil/i],[d,[h,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[u,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[u,p],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[u,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,p],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[u,[p,X,J]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[p,X,J],[u,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/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|openharmony)[-\/ ]?([\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,I+" 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,O+"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|serenityos)/i,/(unix) ?([\w\.]*)/i],[u,p]]},Q=function(e,t){if(typeof e===s&&(t=e,e=i),!(this instanceof Q))return new Q(e,t).getResult();var m=typeof r!==o&&r.navigator?r.navigator:i,T=e||(m&&m.userAgent?m.userAgent:""),g=m&&m.userAgentData?m.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,v=m&&m.userAgent==T;return this.getBrowser=function(){var e={};return e[u]=i,e[p]=i,z.call(e,T,S.browser),e[c]=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:i}(e[p]),v&&m&&m.brave&&typeof m.brave.isBrave==n&&(e[u]="Brave"),e},this.getCPU=function(){var e={};return e[f]=i,z.call(e,T,S.cpu),e},this.getDevice=function(){var e={};return e[h]=i,e[d]=i,e[l]=i,z.call(e,T,S.device),v&&!e[l]&&g&&g.mobile&&(e[l]=E),v&&"Macintosh"==e[d]&&m&&typeof m.standalone!==o&&m.maxTouchPoints&&m.maxTouchPoints>2&&(e[d]="iPad",e[l]=_),e},this.getEngine=function(){var e={};return e[u]=i,e[p]=i,z.call(e,T,S.engine),e},this.getOS=function(){var e={};return e[u]=i,e[p]=i,z.call(e,T,S.os),v&&!e[u]&&g&&g.platform&&"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>500?Y(e,500):e,this},this.setUA(T),this};Q.VERSION="0.7.40",Q.BROWSER=W([u,p,c]),Q.CPU=W([f]),Q.DEVICE=W([d,h,l,m,E,T,_,g,S]),Q.ENGINE=Q.OS=W([u,p]),e.exports&&(t=e.exports=Q),t.UAParser=Q;var q=typeof r!==o&&(r.jQuery||r.Zepto);if(q&&!q.ua){var $=new Q;q.ua=$.getResult(),q.ua.get=function(){return $.getUA()},q.ua.set=function(e){$.setUA(e);var t=$.getResult();for(var r in t)q.ua[r]=t[r]}}}("object"==typeof window?window:X)}(de,de.exports);var ue=J(de.exports);function le(e,t){return function(){return e.apply(t,arguments)}}const{toString:he}=Object.prototype,{getPrototypeOf:pe}=Object,{iterator:fe,toStringTag:me}=Symbol,Ee=(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=>Ee(t)===e),Te=e=>t=>typeof t===e,{isArray:ge}=Array,Se=Te("undefined");const ve=_e("ArrayBuffer");const Re=Te("string"),ye=Te("function"),Ae=Te("number"),be=e=>null!==e&&"object"==typeof e,Oe=e=>{if("object"!==Ee(e))return!1;const t=pe(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||me in e||fe in e)},Ie=_e("Date"),Ce=_e("File"),we=_e("Blob"),Ne=_e("FileList"),De=_e("URLSearchParams"),[Pe,ke,Le,Me]=["ReadableStream","Request","Response","Headers"].map(_e);function Ue(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{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 xe(e,t){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 Ve="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Fe=e=>!Se(e)&&e!==Ve;const Be=(je="undefined"!=typeof Uint8Array&&pe(Uint8Array),e=>je&&e instanceof je);var je;const Ge=_e("HTMLFormElement"),We=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),He=_e("RegExp"),Ke=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),i={};Ue(r,((r,n)=>{let o;!1!==(o=t(r,n,e))&&(i[n]=o||r)})),Object.defineProperties(e,i)};const Ye=_e("AsyncFunction"),ze=(Xe="function"==typeof setImmediate,Je=ye(Ve.postMessage),Xe?setImmediate:Je?(Ze=`axios@${Math.random()}`,Qe=[],Ve.addEventListener("message",(({source:e,data:t})=>{e===Ve&&t===Ze&&Qe.length&&Qe.shift()()}),!1),e=>{Qe.push(e),Ve.postMessage(Ze,"*")}):e=>setTimeout(e));var Xe,Je,Ze,Qe;const qe="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Ve):"undefined"!=typeof process&&process.nextTick||ze;var $e={isArray:ge,isArrayBuffer:ve,isBuffer:function(e){return null!==e&&!Se(e)&&null!==e.constructor&&!Se(e.constructor)&&ye(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||ye(e.append)&&("formdata"===(t=Ee(e))||"object"===t&&ye(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&ve(e.buffer),t},isString:Re,isNumber:Ae,isBoolean:e=>!0===e||!1===e,isObject:be,isPlainObject:Oe,isReadableStream:Pe,isRequest:ke,isResponse:Le,isHeaders:Me,isUndefined:Se,isDate:Ie,isFile:Ce,isBlob:we,isRegExp:He,isFunction:ye,isStream:e=>be(e)&&ye(e.pipe),isURLSearchParams:De,isTypedArray:Be,isFileList:Ne,forEach:Ue,merge:function e(){const{caseless:t}=Fe(this)&&this||{},r={},i=(i,n)=>{const o=t&&xe(r,n)||n;Oe(r[o])&&Oe(i)?r[o]=e(r[o],i):Oe(i)?r[o]=e({},i):ge(i)?r[o]=i.slice():r[o]=i};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Ue(arguments[e],i);return r},extend:(e,t,r,{allOwnKeys:i}={})=>(Ue(t,((t,i)=>{r&&ye(t)?e[i]=le(t,r):e[i]=t}),{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),e.prototype.constructor=e,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:Ee,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(!Ae(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:Ge,hasOwnProperty:We,hasOwnProp:We,reduceDescriptors:Ke,freezeMethods:e=>{Ke(e,((t,r)=>{if(ye(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const i=e[r];ye(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:xe,global:Ve,isContextDefined:Fe,isSpecCompliantForm:function(e){return!!(e&&ye(e.append)&&"FormData"===e[me]&&e[fe])},toJSONObject:e=>{const t=new Array(10),r=(e,i)=>{if(be(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[i]=e;const n=ge(e)?[]:{};return Ue(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:Ye,isThenable:e=>e&&(be(e)||ye(e))&&ye(e.then)&&ye(e.catch),setImmediate:ze,asap:qe,isIterable:e=>null!=e&&ye(e[fe])};function et(e,t,r,i,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n,this.status=n.status?n.status:null)}$e.inherits(et,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:$e.toJSONObject(this.config),code:this.code,status:this.status}}});const tt=et.prototype,rt={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{rt[e]={value:e}})),Object.defineProperties(et,rt),Object.defineProperty(tt,"isAxiosError",{value:!0}),et.from=(e,t,r,i,n,o)=>{const s=Object.create(tt);return $e.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),et.call(s,e.message,t,r,i,n),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};function it(e){return $e.isPlainObject(e)||$e.isArray(e)}function nt(e){return $e.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=$e.toFlatObject($e,{},null,(function(e){return/^is[A-Z]/.test(e)}));function at(e,t,r){if(!$e.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const i=(r=$e.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!$e.isUndefined(t[e])}))).metaTokens,n=r.visitor||d,o=r.dots,s=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&$e.isSpecCompliantForm(t);if(!$e.isFunction(n))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if($e.isDate(e))return e.toISOString();if(!a&&$e.isBlob(e))throw new et("Blob is not supported. Use a Buffer instead.");return $e.isArrayBuffer(e)||$e.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($e.endsWith(r,"{}"))r=i?r:r.slice(0,-2),e=JSON.stringify(e);else if($e.isArray(e)&&function(e){return $e.isArray(e)&&!e.some(it)}(e)||($e.isFileList(e)||$e.endsWith(r,"[]"))&&(a=$e.toArray(e)))return r=nt(r),a.forEach((function(e,i){!$e.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(!$e.isObject(e))throw new TypeError("data must be an object");return function e(r,i){if(!$e.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+i.join("."));u.push(r),$e.forEach(r,(function(r,o){!0===(!($e.isUndefined(r)||null===r)&&n.call(t,r,$e.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,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ht(e,t,r){if(!t)return e;const i=r&&r.encode||lt;$e.isFunction(r)&&(r={serialize:r});const n=r&&r.serialize;let o;if(o=n?n(t,r):$e.isURLSearchParams(t)?t.toString():new dt(t,r).toString(i),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}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){$e.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},ft={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},mt={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 Et="undefined"!=typeof window&&"undefined"!=typeof document,_t="object"==typeof navigator&&navigator||void 0,Tt=Et&&(!_t||["ReactNative","NativeScript","NS"].indexOf(_t.product)<0),gt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,St=Et&&window.location.href||"http://localhost";var vt={...Object.freeze({__proto__:null,hasBrowserEnv:Et,hasStandardBrowserEnv:Tt,hasStandardBrowserWebWorkerEnv:gt,navigator:_t,origin:St}),...mt};function Rt(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&&$e.isArray(i)?i.length:o,a)return $e.hasOwnProp(i,o)?i[o]=[i[o],r]:i[o]=r,!s;i[o]&&$e.isObject(i[o])||(i[o]=[]);return t(e,r,i[o],n)&&$e.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($e.isFormData(e)&&$e.isFunction(e.entries)){const r={};return $e.forEachEntry(e,((e,i)=>{t(function(e){return $e.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),i,r,0)})),r}return null}const yt={transitional:ft,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",i=r.indexOf("application/json")>-1,n=$e.isObject(e);n&&$e.isHTMLForm(e)&&(e=new FormData(e));if($e.isFormData(e))return i?JSON.stringify(Rt(e)):e;if($e.isArrayBuffer(e)||$e.isBuffer(e)||$e.isStream(e)||$e.isFile(e)||$e.isBlob(e)||$e.isReadableStream(e))return e;if($e.isArrayBufferView(e))return e.buffer;if($e.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 vt.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,i){return vt.isNode&&$e.isBuffer(e)?(this.append(t,e.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((o=$e.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($e.isString(e))try{return(t||JSON.parse)(e),$e.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||yt.transitional,r=t&&t.forcedJSONParsing,i="json"===this.responseType;if($e.isResponse(e)||$e.isReadableStream(e))return e;if(e&&$e.isString(e)&&(r&&!this.responseType||i)){const r=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw et.from(e,et.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}}};$e.forEach(["delete","get","head","post","put","patch"],(e=>{yt.headers[e]={}}));var At=yt;const bt=$e.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 Ot=Symbol("internals");function It(e){return e&&String(e).trim().toLowerCase()}function Ct(e){return!1===e||null==e?e:$e.isArray(e)?e.map(Ct):String(e)}function wt(e,t,r,i,n){return $e.isFunction(i)?i.call(this,t,r):(n&&(t=r),$e.isString(t)?$e.isString(i)?-1!==t.indexOf(i):$e.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=It(t);if(!n)throw new Error("header name must be a non-empty string");const o=$e.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)=>$e.forEach(e,((e,r)=>n(e,r,t)));if($e.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if($e.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($e.isObject(e)&&$e.isIterable(e)){let r,i,n={};for(const t of e){if(!$e.isArray(t))throw TypeError("Object iterator must return a key-value pair");n[i=t[0]]=(r=n[i])?$e.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=It(e)){const r=$e.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($e.isFunction(t))return t.call(this,e,r);if($e.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=It(e)){const r=$e.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=It(e)){const n=$e.findKey(r,e);!n||t&&!wt(0,r[n],n,t)||(delete r[n],i=!0)}}return $e.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 $e.forEach(this,((i,n)=>{const o=$e.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 $e.forEach(this,((r,i)=>{null!=r&&!1!==r&&(t[i]=e&&$e.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[Ot]=this[Ot]={accessors:{}}).accessors,r=this.prototype;function i(e){const i=It(e);t[i]||(!function(e,t){const r=$e.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 $e.isArray(e)?e.forEach(i):i(e),this}}Nt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),$e.reduceDescriptors(Nt.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),$e.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 $e.forEach(e,(function(e){o=e.call(r,o,n.normalize(),t?t.status:void 0)})),n.normalize(),o}function kt(e){return!(!e||!e.__CANCEL__)}function Lt(e,t,r){et.call(this,null==e?"canceled":e,et.ERR_CANCELED,t,r),this.name="CanceledError"}function Mt(e,t,r){const i=r.config.validateStatus;r.status&&i&&!i(r.status)?t(new et("Request failed with status code "+r.status,[et.ERR_BAD_REQUEST,et.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}$e.inherits(Lt,et,{__CANCEL__:!0});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.apply(null,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)=>$e.asap((()=>e(...t)));var Ft=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,Bt=vt.hasStandardBrowserEnv?{write(e,t,r,i,n,o){const s=[e+"="+encodeURIComponent(t)];$e.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),$e.isString(i)&&s.push("path="+i),$e.isString(n)&&s.push("domain="+n),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):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 $e.isPlainObject(e)&&$e.isPlainObject(t)?$e.merge.call({caseless:i},e,t):$e.isPlainObject(t)?$e.merge({},t):$e.isArray(t)?t.slice():t}function n(e,t,r,n){return $e.isUndefined(t)?$e.isUndefined(e)?void 0:i(void 0,e,0,n):i(e,t,0,n)}function o(e,t){if(!$e.isUndefined(t))return i(void 0,t)}function s(e,t){return $e.isUndefined(t)?$e.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 $e.forEach(Object.keys(Object.assign({},e,t)),(function(i){const o=c[i]||n,s=o(e[i],t[i],i);$e.isUndefined(s)&&o!==a||(r[i]=s)})),r}var Ht=e=>{const t=Wt({},e);let r,{data:i,withXSRFToken:n,xsrfHeaderName:o,xsrfCookieName:s,headers:a,auth:c}=t;if(t.headers=a=Dt.from(a),t.url=ht(jt(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),$e.isFormData(i))if(vt.hasStandardBrowserEnv||vt.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(r=a.getContentType())){const[e,...t]=r?r.split(";").map((e=>e.trim())).filter(Boolean):[];a.setContentType([e||"multipart/form-data",...t].join("; "))}if(vt.hasStandardBrowserEnv&&(n&&$e.isFunction(n)&&(n=n(t)),n||!1!==n&&Ft(t.url))){const e=o&&s&&Bt.read(s);e&&a.set(o,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 m=new XMLHttpRequest;function E(){if(!m)return;const i=Dt.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());Mt((function(e){t(e),f()}),(function(e){r(e),f()}),{data:l&&"text"!==l&&"json"!==l?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:i,config:e,request:m}),m=null}m.open(i.method.toUpperCase(),i.url,!0),m.timeout=i.timeout,"onloadend"in m?m.onloadend=E:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&0===m.responseURL.indexOf("file:"))&&setTimeout(E)},m.onabort=function(){m&&(r(new et("Request aborted",et.ECONNABORTED,e,m)),m=null)},m.onerror=function(){r(new et("Network Error",et.ERR_NETWORK,e,m)),m=null},m.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 et(t,n.clarifyTimeoutError?et.ETIMEDOUT:et.ECONNABORTED,e,m)),m=null},void 0===n&&o.setContentType(null),"setRequestHeader"in m&&$e.forEach(o.toJSON(),(function(e,t){m.setRequestHeader(t,e)})),$e.isUndefined(i.withCredentials)||(m.withCredentials=!!i.withCredentials),l&&"json"!==l&&(m.responseType=i.responseType),p&&([c,u]=Ut(p,!0),m.addEventListener("progress",c)),h&&m.upload&&([a,d]=Ut(h),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",d)),(i.cancelToken||i.signal)&&(s=t=>{m&&(r(!t||t.type?new Lt(null,e,m):t),m.abort(),m=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 et("Unsupported protocol "+_+":",et.ERR_BAD_REQUEST,e)):m.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 et?t:new Lt(t instanceof Error?t.message:t))}};let o=t&&setTimeout((()=>{o=null,n(new et(`timeout ${t} of ms exceeded`,et.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=()=>$e.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()}},Jt=(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})},Zt="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,Qt=Zt&&"function"==typeof ReadableStream,qt=Zt&&("function"==typeof TextEncoder?($t=new TextEncoder,e=>$t.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var $t;const er=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},tr=Qt&&er((()=>{let e=!1;const t=new Request(vt.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),rr=Qt&&er((()=>$e.isReadableStream(new Response("").body))),ir={stream:rr&&(e=>e.body)};var nr;Zt&&(nr=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!ir[e]&&(ir[e]=$e.isFunction(nr[e])?t=>t[e]():(t,r)=>{throw new et(`Response type '${e}' is not supported`,et.ERR_NOT_SUPPORT,r)})})));const or=async(e,t)=>{const r=$e.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if($e.isBlob(e))return e.size;if($e.isSpecCompliantForm(e)){const t=new Request(vt.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return $e.isArrayBufferView(e)||$e.isArrayBuffer(e)?e.byteLength:($e.isURLSearchParams(e)&&(e+=""),$e.isString(e)?(await qt(e)).byteLength:void 0)})(t):r};var sr=Zt&&(async e=>{let{url:t,method:r,data:i,signal:n,cancelToken:o,timeout:s,onDownloadProgress:a,onUploadProgress:c,responseType:d,headers:u,withCredentials:l="same-origin",fetchOptions:h}=Ht(e);d=d?(d+"").toLowerCase():"text";let p,f=Yt([n,o&&o.toAbortSignal()],s);const m=f&&f.unsubscribe&&(()=>{f.unsubscribe()});let E;try{if(c&&tr&&"get"!==r&&"head"!==r&&0!==(E=await or(u,i))){let e,r=new Request(t,{method:"POST",body:i,duplex:"half"});if($e.isFormData(i)&&(e=r.headers.get("content-type"))&&u.setContentType(e),r.body){const[e,t]=xt(E,Ut(Vt(c)));i=Jt(r.body,65536,e,t)}}$e.isString(l)||(l=l?"include":"omit");const n="credentials"in Request.prototype;p=new Request(t,{...h,signal:f,method:r.toUpperCase(),headers:u.normalize().toJSON(),body:i,duplex:"half",credentials:n?l:void 0});let o=await fetch(p);const s=rr&&("stream"===d||"response"===d);if(rr&&(a||s&&m)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=o[t]}));const t=$e.toFiniteNumber(o.headers.get("content-length")),[r,i]=a&&xt(t,Ut(Vt(a),!0))||[];o=new Response(Jt(o.body,65536,r,(()=>{i&&i(),m&&m()})),e)}d=d||"text";let _=await ir[$e.findKey(ir,d)||"text"](o,e);return!s&&m&&m(),await new Promise(((t,r)=>{Mt(t,r,{data:_,headers:Dt.from(o.headers),status:o.status,statusText:o.statusText,config:e,request:p})}))}catch(t){if(m&&m(),t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message))throw Object.assign(new et("Network Error",et.ERR_NETWORK,e,p),{cause:t.cause||t});throw et.from(t,t&&t.code,e,p)}});const ar={http:null,xhr:Kt,fetch:sr};$e.forEach(ar,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const cr=e=>`- ${e}`,dr=e=>$e.isFunction(e)||null===e||!1===e;var ur={getAdapter:e=>{e=$e.isArray(e)?e:[e];const{length:t}=e;let r,i;const n={};for(let o=0;o<t;o++){let t;if(r=e[o],i=r,!dr(r)&&(i=ar[(t=String(r)).toLowerCase()],void 0===i))throw new et(`Unknown adapter '${t}'`);if(i)break;n[t||"#"+o]=i}if(!i){const e=Object.entries(n).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new et("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(cr).join("\n"):" "+cr(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return i},adapters:ar};function lr(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Lt(null,e)}function hr(e){lr(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 ur.getAdapter(e.adapter||At.adapter)(e).then((function(t){return lr(e),t.data=Pt.call(e,e.transformResponse,t),t.headers=Dt.from(t.headers),t}),(function(t){return kt(t)||(lr(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 pr="1.9.0",fr={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{fr[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const mr={};fr.transitional=function(e,t,r){function i(e,t){return"[Axios v"+pr+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,n,o)=>{if(!1===e)throw new et(i(n," has been removed"+(t?" in "+t:"")),et.ERR_DEPRECATED);return t&&!mr[n]&&(mr[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)}},fr.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 et("options must be an object",et.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 et("option "+o+" must be "+r,et.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new et("Unknown option "+o,et.ERR_BAD_OPTION)}},validators:fr};const _r=Er.validators;let Tr=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&&Er.assertOptions(r,{silentJSONParsing:_r.transitional(_r.boolean),forcedJSONParsing:_r.transitional(_r.boolean),clarifyTimeoutError:_r.transitional(_r.boolean)},!1),null!=i&&($e.isFunction(i)?t.paramsSerializer={serialize:i}:Er.assertOptions(i,{encode:_r.function,serialize:_r.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Er.assertOptions(t,{baseUrl:_r.spelling("baseURL"),withXsrfToken:_r.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=n&&$e.merge(n.common,n[t.method]);n&&$e.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=[hr.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,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=0;l<u;){const e=s[l++],t=s[l++];try{h=e(h)}catch(e){t.call(this,e);break}}try{d=hr.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)}};$e.forEach(["delete","get","head","options"],(function(e){Tr.prototype[e]=function(t,r){return this.request(Wt(r||{},{method:e,url:t,data:(r||{}).data}))}})),$e.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}))}}Tr.prototype[e]=t(),Tr.prototype[e+"Form"]=t(!0)}));var gr=Tr;class Sr{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 Lt(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 Sr((function(t){e=t})),cancel:e}}}var vr=Sr;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};Object.entries(Rr).forEach((([e,t])=>{Rr[t]=e}));var yr=Rr;const Ar=function e(t){const r=new gr(t),i=le(gr.prototype.request,r);return $e.extend(i,gr.prototype,r,{allOwnKeys:!0}),$e.extend(i,r,null,{allOwnKeys:!0}),i.create=function(r){return e(Wt(t,r))},i}(At);Ar.Axios=gr,Ar.CanceledError=Lt,Ar.CancelToken=vr,Ar.isCancel=kt,Ar.VERSION=pr,Ar.toFormData=at,Ar.AxiosError=et,Ar.Cancel=Ar.CanceledError,Ar.all=function(e){return Promise.all(e)},Ar.spread=function(e){return function(t){return e.apply(null,t)}},Ar.isAxiosError=function(e){return $e.isObject(e)&&!0===e.isAxiosError},Ar.mergeConfig=Wt,Ar.AxiosHeaders=Dt,Ar.formToJSON=e=>Rt($e.isHTMLForm(e)?new FormData(e):e),Ar.getAdapter=ur.getAdapter,Ar.HttpStatusCode=yr,Ar.default=Ar;var br=Ar;let Or=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 Cr=new ue;let wr=Cr.getResult(),Nr=null;function Dr(e){if(!Nr){e&&Cr.setUA(e),wr=Cr.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||""}}(wr),r=Pr(wr),i=function(e){return"Windows"===e.os.name?e.os.version?e.os.name+" "+e.os.version:e.os.name:e.os.name||""}(wr),n=wr.os.version,o=Pr(wr,!1),s=wr.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 Pr(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 kr(){return Dr().os}function Lr(){const e=Dr();return"".concat(e.os," ").concat(e.osVersion)}function Mr(){const e=Dr();return!!("WebKit"===wr.engine.name&&e.os===Or.MAC_OS&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0&&e.name!==Ir.SAFARI||Br()&&e.name!==Ir.SAFARI)}function Ur(){return Dr().name===Ir.CHROME}function xr(){return Dr().name===Ir.SAFARI}function Vr(){return Dr().name===Ir.EDGE}function Fr(){return Dr().name===Ir.FIREFOX}function Br(){return Dr().os===Or.IOS}function jr(e){const t=Dr();return!(t.name!==Ir.CHROME||!t.osVersion)&&Number(t.version)>=e}function Gr(e,t,r){const i=Dr();return!(i.name!==e||!i.osVersion)&&(r?Number(i.version)>=t&&Number(i.version)<=r:Number(i.version)===t)}function Wr(e){const t=Dr();return!(t.name!==Ir.EDGE||!t.osVersion)&&Number(t.version)>=e}function Hr(e){const t=Dr();return!(t.name!==Ir.OPERA||!t.osVersion)&&Number(t.version)>=e}function Kr(){const e=Dr();if(e.os!==Or.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])}function Yr(){const e=Dr();if(e.os!==Or.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 16===Number(t[0])}function zr(){const e=Dr();if(e.os!==Or.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=1}function Xr(){return xr()&&navigator.maxTouchPoints>0}function Jr(){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=kr();return function(){const{deviceType:e}=Dr();return"mobile"===e||"tablet"===e}()||e===Or.ANDROID||e===Or.IOS||e===Or.HARMONY_OS}function Qr(){const e=Dr();return e.name!==Ir.EDGE&&e.name!==Ir.SAFARI&&!!navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]./i)}function qr(){return kr()===Or.ANDROID}function $r(){const e=Dr();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.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 mi(){return!!_i()}let Ei=null;function _i(){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 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}({}),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"}({}),function(e){e.PEERCONNECTION_STATE_CHANGE="peerconnection-state-change",e.AUDIO_METADATA="audio-metadata",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"}({}),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}({}),vi=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 ni(ii.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 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(vi.NETWORK_STATE_CHANGE,e,this._networkState),e===Si.ONLINE?this.emit(vi.ONLINE):e===Si.OFFLINE&&(this.onlineWaiter=new Promise((e=>{this.once(vi.ONLINE,(()=>{this.onlineWaiter=void 0,e(Si.ONLINE)}))})),this.emit(vi.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}))}};function Oi(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}function Ii(e){"undefined"!=typeof Promise?Promise.resolve().then(e):setTimeout(e,0)}function Ci(e){return JSON.parse(JSON.stringify(e))}function wi(e){try{return Ci(e)}catch(t){return e}}const Ni={};function Di(e,t){Ni[t]||(Ni[t]=!0,e())}function Pi(e){return window.TextEncoder?(new TextEncoder).encode(e).length:e.length}function ki(e){return new Promise((t=>{window.setTimeout(t,e)}))}function Li(){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)+Li(e-r.length,"")}const Mi=()=>{},Ui=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})}}},xi=Ui.throttleByKey.bind(Ui);function Vi(e){return"object"==typeof e&&null!==e&&!(e instanceof RegExp)}function Fi(e,t){if(!Vi(e)||!Vi(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]=Fi(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]=Fi(e[i],t[i]):r[i]=t[i]);return r}}function Bi(e){return"number"==typeof e?e:e.exact||e.ideal||e.max||e.min||0}function ji(e){return e.reduce(((e,t)=>e+t),0)}let Gi=1,Wi=console;class Hi{static setLogger(e){Wi=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=Gi++,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:"");Wi.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 Ki(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 Yi={timeout:500,timeoutFactor:1.5,maxRetryCount:1/0,maxRetryTimeout:1e4};function zi(e,t,r,i){const n=Object.assign({},Yi,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 Xi=0,Ji=0;function Zi(e,t,r,i){return new Promise(((n,o)=>{t.responseType=t.responseType||"json",t.data&&!r?(t.data=JSON.stringify(t.data),Xi+=Pi(t.data)):r&&(t.data.size?Xi+=t.data.size:t.data instanceof FormData?Xi+=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?Pi(e):e.size})),t+138}(t.data):Xi+=Pi(JSON.stringify(t.data))),t.headers=t.headers||{},t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json",t.method="POST",t.url=e,br.request(t).then((e=>{"string"==typeof e.data?Ji+=Pi(e.data):e.data instanceof ArrayBuffer||e.data instanceof Uint8Array?Ji+=e.data.byteLength:Ji+=Pi(JSON.stringify(e.data)),i&&n({data:e.data,headers:e.headers}),n(e.data)})).catch((e=>{br.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 Qi(e,t){const r=new Blob([t.data],{type:"buffer"});return await Zi(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 qi=function(e){return e[e.kNone=1]="kNone",e[e.kMillisecondsFromSeconds=1e3]="kMillisecondsFromSeconds",e[e.kBytesToBits=8]="kBytesToBits",e}(qi||{});const $i="websdk_ng_install_id";function en(){try{if(an("INSTALL_ID"))return an("INSTALL_ID");let e=window.localStorage.getItem($i);return e||(e=Li(32,"").toUpperCase(),window.localStorage.setItem($i,e)),sn("INSTALL_ID",e),e}catch(e){return}}const tn=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.23.4-2"),rn=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 nn=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=nn;const on=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:!1,ICE_RESTART_INTERVAL:1e4,RESTART_SEQUENCE:["udp_tcp_relay","relay"],FIRST_TCP_CANDIDATE:!1,FIRST_TCP_CANDIDATE_INTERVAL:1e3,TURN_DOMAIN:"edge.agora.io",USE_TURN_IP:!1,NEW_TURN_MODE:void 0,NEW_FORCE_TURN:!1,USE_NEW_RENDER_FREEZE_TIME:!1,NOT_REPORT_KEY_EVENT:[],REPORT_PUBLISH_LIST_NUM_THRESHOLD:3,REPORT_PUBLISH_LIST_AGGREGATE_MAX_NUM:50,AGGREGATE_KEY_EVENT_INTERVAL:1e3,UPLOAD_LOG_LEVEL:0,LIMIT_UPLOAD_LOG_WAITING_NUM:500,MAX_UPLOAD_LOG_WAITING_NUML:3e3,MAX_UPLOAD_LOG_VERSION:1}),{},{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,PRELOAD_MEDIA_COUNT:0,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_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_METADATA:!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_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,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:[],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:!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:2,ENABLE_AUT_FEEDBACK:!1,SVC_EXTENDED:["VP9"]}),{},{USE_CANDIDATE_FROM_AP_DETAIL:!1,AP_REQUEST_DETAIL:void 0,ENABLE_ROLE_SELECT_EDGE:!1,CLIENT_ROLE_OPTIONS: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},{INSTALL_ID:""}),{},{K_MIN_RENDER_DELAY:66,USE_STANDARD_BITRATE_DEFAULT:!1,VIDEO_NEW_BITRATE_RATIO:void 0,VIDEO_STANDARD_BITRATE_VERSION:void 0,BASELINE_MORE_H264_BITRATE_RATIO:1.1});function sn(e,t,r){var i;Object.keys(on).includes(e)&&(!r&&Object.keys(cn).includes(e)||(on[e]=t,"ENABLE_VIDEO_SEI"!==e&&"ENABLE_AUDIO_TOPN"!==e&&"ENABLE_AUDIO_METADATA"!==e&&"ENABLE_AUDIO_PTS_METADATA"!==e||!0!==t||(on.ENABLE_ENCODED_TRANSFORM=!0,"ENABLE_AUDIO_PTS_METADATA"===e&&(on.ENABLE_AUDIO_METADATA=!0)),"USE_NEW_NETWORK_CONFIG"===e&&t&&(i=!!t,on.USE_NEW_NETWORK_CONFIG=i,i&&(on.WEBCS_DOMAIN=["webrtc2-2.ap.sd-rtn.com"],on.WEBCS_DOMAIN_BACKUP_LIST=["webrtc2-4.ap.sd-rtn.com"],on.CDS_AP=["cds-web-2.ap.sd-rtn.com","cds-web-4.ap.sd-rtn.com"],on.ACCOUNT_REGISTER=["sua-web-2.ap.sd-rtn.com","sua-web-4.ap.sd-rtn.com"],on.EVENT_REPORT_DOMAIN="web-2.statscollector.sd-rtn.com",on.EVENT_REPORT_BACKUP_DOMAIN="statscollector-1.agora.io",on.GATEWAY_DOMAINS=["edge.sd-rtn.com"])),"ENABLE_PRE_SUB"===e&&t&&(on.ENABLE_INSTANT_VIDEO=!0,on.ENABLE_PREALLOC_PC=!0),"ENABLE_SVC"===e&&t&&(on.ENABLE_AUT_CC=!0),"NEW_FORCE_TURN"===e&&t&&(on.NEW_TURN_MODE||(on.NEW_TURN_MODE=4))))}function an(e){return on[e]}rn||(on.WEBCS_DOMAIN=["ap-web-1-oversea.agora.io","ap-web-1-north-america.agora.io"],on.WEBCS_DOMAIN_BACKUP_LIST=["ap-web-2-oversea.agora.io","ap-web-2-north-america.agora.io"],on.PROXY_CS=["proxy-ap-web-oversea.agora.io","proxy-ap-web-america.agora.io"],on.CDS_AP=["cds-ap-web-oversea.agora.io","cds-ap-web-america.agora.io","cds-ap-web-america2.agora.io"],on.ACCOUNT_REGISTER=["sua-ap-web-oversea.agora.io","sua-ap-web-america.agora.io","sua-ap-web-america2.agora.io"],on.UAP_AP=["uap-ap-web-oversea.agora.io","uap-ap-web-america.agora.io","uap-ap-web-america2.agora.io"],on.LOG_UPLOAD_SERVER="logservice-oversea.agora.io",on.EVENT_REPORT_DOMAIN="statscollector-1-oversea.agora.io",on.EVENT_REPORT_BACKUP_DOMAIN="statscollector-2-oversea.agora.io",on.PROXY_SERVER_TYPE3="webrtc-cloud-proxy.agora.io",on.AREAS=["NORTH_AMERICA","OVERSEA"]),function(e){e[e.REALTIME=1]="REALTIME"}({});const cn={};var dn=function(e){return e.SET_SESSION_ID="SET_SESSION_ID",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_JOIN_END="KEY_METRIC_JOIN_END",e.KEY_METRIC_REQUEST_AP_START="KEY_METRIC_REQUEST_AP_START",e.KEY_METRIC_REQUEST_AP_END="KEY_METRIC_REQUEST_AP_END",e.KEY_METRIC_JOIN_GATEWAY_START="KEY_METRIC_JOIN_GATEWAY_START",e.KEY_METRIC_JOIN_GATEWAY_END="KEY_METRIC_JOIN_GATEWAY_END",e.KEY_METRIC_PEER_CONNECTION_START="KEY_METRIC_PEER_CONNECTION_START",e.KEY_METRIC_PEER_CONNECTION_END="KEY_METRIC_PEER_CONNECTION_END",e.KEY_METRIC_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.SET_USE_P2P="SET_USE_P2P",e.SET_TRANSPORT_TYPE="SET_TRANSPORT_TYPE",e}(dn||{});function un(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 ln(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 hn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ln(Object(r),!0).forEach((function(t){un(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ln(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}!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:()=>R,Printer:()=>I,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 m(e){return h(e)||a(e)||"+"===e||"/"===e}function E(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 v{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 R extends v{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 y extends v{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,m,[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,m,[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,m));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 y{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,E)}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 y{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,m,[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 O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class I{constructor(){O(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){O(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 R).parse(e)}function P(e,t){return(new I).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 pn=new class extends fi{constructor(){super(...arguments),un(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 fn{constructor(e){un(this,"logger",void 0),un(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 mn(){const e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}function En(){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 _n={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4},Tn=Date.now(),gn=e=>{for(const t in _n)if(Object.prototype.hasOwnProperty.call(_n,t)&&_n[t]===e)return t;return"DEFAULT"};const Sn=new class{constructor(){un(this,"proxyServerURL",void 0),un(this,"logLevel",_n.DEBUG),un(this,"uploadState","collecting"),un(this,"uploadLogWaitingList",[]),un(this,"uploadLogUploadingList",[]),un(this,"uploadErrorCount",0),un(this,"currentLogID",0),un(this,"url",void 0),un(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=[_n.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=[_n.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=[_n.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=[_n.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=[_n.DEBUG].concat(t);this.uploadLog.apply(this,i)}setLogLevel(e){e=Math.min(Math.max(0,e),4),this.logLevel=e}enableLogUpload(){sn("UPLOAD_LOG",!0)}disableLogUpload(){sn("UPLOAD_LOG",!1),this.uploadLogUploadingList=[],this.uploadLogWaitingList=[]}setProxyServer(e){this.proxyServerURL=e}prefix(e){return new fn(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()-Tn<100)return void setTimeout((()=>{this.log(...t)}),Date.now()-Tn);const i=Math.max(0,Math.min(4,t[0]));if(t[0]=mn()+" Agora-SDK [".concat(gn(i),"]:"),i>=an("UPLOAD_LOG_LEVEL")&&this.appendLogToWaitingList(i,...t),i<this.logLevel)return;const n=mn()+" %cAgora-SDK [".concat(gn(i),"]:");let o=[];if(!an("USE_NEW_LOG"))switch(i){case _n.DEBUG:o=[n,"color: #64B5F6;"].concat(t.slice(1)),console.log.apply(console,o);break;case _n.INFO:o=[n,"color: #1E88E5; font-weight: bold;"].concat(t.slice(1)),console.log.apply(console,o);break;case _n.WARNING:o=[n,"color: #FB8C00; font-weight: bold;"].concat(t.slice(1)),console.warn.apply(console,o);break;case _n.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()-Tn<100)return void setTimeout((()=>{this.uploadLog(...t)}),Date.now()-Tn);const i=Math.max(0,Math.min(4,t[0]));t[0]=mn()+" Agora-SDK [".concat(gn(i),"]:"),this.appendLogToWaitingList(i,...t)}appendLogToWaitingList(e){if(!an("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]=En()+" Agora-SDK [".concat(gn(e),"]:"):r[0]=En()+" Agora-SDK [".concat(gn(e),"]:");let n="";r.forEach((e=>{"object"==typeof e&&(e=JSON.stringify(e)),n+="".concat(e," ")})),this.uploadLogWaitingList.length>=an("LIMIT_UPLOAD_LOG_WAITING_NUM")&&e<an("MAX_UPLOAD_LOG_VERSION")||this.uploadLogWaitingList.length>=an("MAX_UPLOAD_LOG_WAITING_NUML")?this.currentLogID++:(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:tn,process_id:an("PROCESS_ID"),payload:JSON.stringify(e)};return zi((async()=>{const e=await br.post(this.url||(this.proxyServerURL?"https://".concat(this.proxyServerURL,"/ls/?h=").concat(an("LOG_UPLOAD_SERVER"),"&p=443&d=upload/v1"):"https://".concat(an("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),pn.reportLogUploadError(r),!0}),{timeout:an("UPLOAD_LOG_REQUEST_RETRY_INTERVAL"),maxRetryTimeout:an("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,an("UPLOAD_LOG_LENGTH_EACH_TIME"))),this.uploadLogs().then((()=>{this.uploadErrorCount=0,this.uploadLogWaitingList.length>0&&window.setTimeout((()=>this.uploadLogInterval()),an("UPLOAD_LOG_INTERVAL"))})).catch((e=>{this.uploadErrorCount+=1,this.uploadErrorCount<2?window.setTimeout((()=>this.uploadLogInterval()),an("UPLOAD_LOG_TWICE_RETRY_INTERVAL_V1")):window.setTimeout((()=>this.uploadLogInterval()),an("UPLOAD_LOG_RETRY_INTERVAL_V1"))})))}};!function(e){e.FREE="free",e.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 vn=function(e){return e.USER_OFFLINE="user offline",e.TIMEOUT_AUTO_DISPATCH="auto dispatch remove stream because of timeout",e.NONE="none",e}({});const Rn={sid:"",lts:0,success:null,cname:null,uid:null,peer:null,cid:null,elapse:null,extend:null,vid:0};let yn=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.REQ_USER_ACCOUNT="req_user_account",e.JOIN_GATEWAY="join_gateway",e.REJOIN_GATEWAY="rejoin_gateway",e.STREAM_SWITCH="stream_switch",e.REQUEST_PROXY_WORKER_MANAGER="request_proxy_worker_manager",e.REQUEST_PROXY_APPCENTER="request_proxy_appcenter",e.FIRST_VIDEO_RECEIVED="first_video_received",e.FIRST_AUDIO_RECEIVED="first_audio_received",e.FIRST_VIDEO_DECODE="first_video_decode",e.FIRST_AUDIO_DECODE="first_audio_decode",e.ON_ADD_AUDIO_STREAM="on_add_audio_stream",e.ON_ADD_VIDEO_STREAM="on_add_video_stream",e.ON_UPDATE_STREAM="on_update_stream",e.ON_REMOVE_STREAM="on_remove_stream",e.USER_ANALYTICS="req_user_analytics",e.PC_STATS="pc_stats",e.UPDATE_REMOTE_RTPCAPABILITIES="update_remote_rtpCapabilities",e.AB_TEST="ab_test",e}({}),An=function(e){return e.SESSION="io.agora.pb.Wrtc.Session",e.JOIN_CHOOSE_SERVER="io.agora.pb.Wrtc.JoinChooseServer",e.REQ_USER_ACCOUNT="io.agora.pb.Wrtc.ReqUserAccount",e.JOIN_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.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.PEER_PUBLISH_LIST_STATUS="io.agora.pb.Wrtc.PeerPublishListStatus",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 bn=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 On(){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){Sn.warning(e),c=[]}try{JSON.stringify(c)}catch(e){Sn.warning("arguments for method ".concat(o,".").concat(String(r)," not serializable for apiInvoke.")),c=[]}const d=(e.report||In).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 In=new class{constructor(){un(this,"baseInfoMap",new Map),un(this,"proxyServer",void 0),un(this,"eventUploadTimer",void 0),un(this,"setSessionIdTimer",void 0),un(this,"url",void 0),un(this,"sids",new Set),un(this,"backupUrl",void 0),un(this,"_appId",void 0),un(this,"_aid",0),un(this,"keyEventUploadPendingItems",[]),un(this,"normalEventUploadPendingItems",[]),un(this,"apiInvokeUploadPendingItems",[]),un(this,"apiInvokeCount",0),un(this,"apiInvokeLoggedCount",0),un(this,"ltsList",[]),un(this,"lastSendNormalEventTime",Date.now()),un(this,"customReportCounterTimer",void 0),un(this,"customReportCount",0),un(this,"lastOnRemoveStreamMap",new Map),un(this,"extApiInvoke",(async e=>{for(const t of e){const e=hn(hn({},t),{},{sid:null,invokeId:++this.apiInvokeCount,tag:gi.TRACER});this.sendApiInvoke(e)}})),this.eventUploadTimer=window.setInterval(this.doSend.bind(this),an("EVENT_REPORT_SEND_INTERVAL")),this.setSessionIdTimer=window.setInterval(this.appendSessionId.bind(this),an("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=!!an("SHOW_REPORT_INVOKER_LOG"),s=!!an("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 Sn.info("".concat(i," ").concat(e));Sn.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;ki(t.timeout).then((()=>{l||(this.sendApiInvoke(hn(hn({},u()),{},{error:ii.API_INVOKE_TIMEOUT,success:!1})),d("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(hn(hn({},u()),{},{success:!0},t.reportResult&&{result:e})),d("onSuccess"),e};return r?xi(i,t.name+"Success",r,(()=>l=!0)):i()},onError:e=>{const i=()=>{if(l)throw e;l=!0,this.sendApiInvoke(hn(hn({},u()),{},{success:!1,error:e})),d("onFailure",e.toString())};return r?xi(i,t.name+"Error",r,(()=>l=!0)):i()}}}sessionInit(e,t){if(this.baseInfoMap.has(e))return;const r=Date.now(),i=this.createBaseInfo(e,r);i.cname=t.cname;const n=Object.assign({},{willUploadConsoleLog:an("UPLOAD_LOG"),maxTouchPoints:navigator.maxTouchPoints,areaVersion:rn?"global":"oversea",areas:an("AREAS")&&an("AREAS").join(",")},t.extend),{stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:d,clientRole:u}=t,l=Date.now(),h=hn(hn({},i),{},{eventType:yn.SESSION_INIT,appid:t.appid,browser:navigator.userAgent,buildFormat:t.buildFormat,build:"v4.23.4-2-0-gd7188994-dirty(7/23/2025, 7:18:22 PM)",lts:l,elapse:l-r,extend:JSON.stringify(n),mode:t.mode,process:an("PROCESS_ID"),appType:an("APP_TYPE"),success:!0,version:tn,stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:d,clientType:window.navigator.userAgent.includes("AgoraWebView")?42:20,clientRole:u,serviceId:an("PROCESS_ID"),extensionID:an("PLUGIN_INFO").join(",")||""});this.send({type:An.SESSION,data:h},!0)}joinChooseServer(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=hn(hn({},i),{},{role:t.role,eventType:yn.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});this.send({type:An.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=hn(hn({},i),{},{eventType:yn.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:An.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=hn(hn({},i),{},{eventType:yn.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:en(),isABTestSuccess:t.isABTestSuccess?1:0}),u=d.success?1:0;if(t.succ&&(r.lastJoinSuccessTime=n),o)this.send({type:An.JOIN_GATEWAY,data:d},!0);else{let e;if(s)if(a){const t=s.match(/h=(\d{1,3}-){3}\d{1,3}/g),r=s.match(/p=[0-9]{1,6}/g);e={isSuccess:u,gatewayIp:t&&t.length?t[0].split("=")[1].replace(/-/g,"."):"",port:r&&r.length?r[0].split("=")[1]:"",isProxy:a?1:0}}else{const t=s.match(/wss:\/\/(\d{1,3}-){3}\d{1,3}/g),r=s.match(/(:|p=)[0-9]{1,6}/g);e={isSuccess:u,gatewayIp:t&&t.length?t[0].split("//")[1].replace(/-/g,"."):"",port:r&&r.length?r[0].split(/:|p=/g)[1]:"",isProxy:a?1:0}}else e={isSuccess:u,gatewayIp:"",port:"",isProxy:a?1:0};delete d.success,delete d.eventType,delete d.firstSuccess,d.vid=Number(d.vid);const t=Object.assign({},d,e,{eventType:yn.REJOIN_GATEWAY});this.send({type:An.RE_JOIN_GATEWAY,data:t},!0)}}joinChannelTimeout(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=Date.now(),n=hn(hn({},r.info),{},{lts:i,timeout:t,elapse:i-r.startTime});this.send({type:An.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=hn(hn({},i),{},{eventType:yn.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:An.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=hn(hn({},n),{},{eventType:yn.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:An.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=hn(hn({},n),{},{eventType:yn.WS_COMPRESSOR_INIT,lts:o,eventElapse:e.eventElapse,elapse:o-i.startTime,status:e.status?1:2});this.send({type:An.WS_COMPRESSOR_INIT,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=hn(hn(hn({},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=hn(hn(hn({},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=hn(hn(hn({},i),t),{},{vid:void 0===i.vid?0:Number(i.vid),elapse:n-r.startTime,eventType:yn.AB_TEST,lts:n});this.send({type:An.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=hn(hn(hn({},i),t),{},{vid:void 0===i.vid?0:Number(i.vid),elapse:n-r.startTime,eventType:yn.PC_STATS,lts:n,preallocation:t.preallocation?1:0});this.send({type:An.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=hn(hn(hn({},i),t),{},{vid:void 0===i.vid?0:Number(i.vid),eventType:yn.UPDATE_REMOTE_RTPCAPABILITIES,lts:n});this.send({type:An.UPDATE_REMOTE_RTPCAPABILITIES,data:o},!0)}}_pendingOnRemoveStream(e,t,r,i){return window.setTimeout((()=>{const i=this.baseInfoMap.get(e);if(!i)return;const n=i.info;0!==this.lastOnRemoveStreamMap.size&&(Array.from(this.lastOnRemoveStreamMap.entries()).forEach((e=>{let[i,o]=e;const{peer:s,reason:a,peers:c}=o.event,d=hn(hn({},n),{},{peer:s,peers:c.join(","),reason:a,eventType:t,lts:Date.now()});this.lastOnRemoveStreamMap.delete(i),this.send({type:r,data:d},!0)})),this.lastOnRemoveStreamMap.clear())}),i)}onGatewayStream(e,t,r,i){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const o=this.baseInfoMap.get(e);if(!o)return;const s=o.info,a=Date.now();if(t===yn.ON_REMOVE_STREAM&&n){const n=an("AGGREGATE_KEY_EVENT_INTERVAL")||1e3,o=i.reason||vn.NONE,s=this.lastOnRemoveStreamMap.get(o);if(s){const{event:e}=s;i.peer&&e.peers.push(i.peer),i.peers&&e.peers.push(...i.peers)}else{const s=this._pendingOnRemoveStream(e,t,r,n),c={time:a,event:{peer:i.peer,reason:i.reason||"",peers:i.peers?i.peers:[i.peer||0]},timer:s};this.lastOnRemoveStreamMap.set(o,c)}return}const c=hn(hn(hn({},s),i),{},{peers:i.peers?i.peers.join(","):void 0,eventType:t,lts:a});this.send({type:r,data:c},!0)}streamSwitch(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=hn(hn({},i),{},{eventType:yn.STREAM_SWITCH,lts:n,isDual:t.isdual,elapse:n-r.startTime,success:t.succ});this.send({type:An.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=hn(hn({},i),{},{eventType:yn.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:An.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=hn(hn({},i),{},{eventType:yn.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:An.REQUEST_PROXY_WORKER_MANAGER,data:o},!0)}setProxyServer(e){this.proxyServer=e,e?Sn.debug("reportProxyServerurl: ".concat(e)):Sn.debug("disable reportProxyServerurl: ".concat(e))}peerPublishListStatus(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=t.list.map((e=>hn({peer:e.peers},e.audioDuration?{subscribeElapse:e.subscribeElapse,peerPublishDuration:Math.max(e.audioDuration,e.videoDuration),audiotag:e.audioDuration>0?1:-1,videotag:e.videoDuration>0?1:-1,peerPublishDurationVideo:e.videoDuration,peerPublishDurationAudio:e.audioDuration,joinChannelSuccessElapse:o-(r.lastJoinSuccessTime||o)}:{}))),o=Date.now(),s=hn(hn({},i),{},{peerPublishStatusList:JSON.stringify(n),lts:o,elapse:o-r.startTime});this.send({type:An.PEER_PUBLISH_LIST_STATUS,data:s},!0)}peerPublishStatus(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=hn(hn({},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:An.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=Pi(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})(hn(hn(hn({},i),t),{},{elapse:n-r.startTime,lts:n,productType:"WebRTC"}),"payload",1300).forEach((e=>this.send({type:An.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=hn(hn(hn({},i),t),{},{elapse:n-r.startTime,lts:n});this.send({type:An.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=hn(hn(hn({},i),t),{},{elapse:n-r.startTime,lts:n,extend:t.extend||void 0});this.send({type:An.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=hn(hn(hn({},i),t),{},{elapse:n-r.startTime,lts:n});this.send({type:An.WEBSOCKET_QUIT,data:o},!0)}async sendCustomReportMessage(e,t){if(this.customReportCount+=t.length,this.customReportCount>an("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:An.USER_ANALYTICS,data:hn(hn({sid:e},t),{},{lts:r})})));try{an("NEW_REPORT_SERVER")?await this.postDataToStatsCollector2(i):await this.postDataToStatsCollector(i)}catch(e){throw Sn.error("send custom report message failed",e.toString()),new ni(ii.CUSTOM_REPORT_SEND_FAILED,e.message)}}sendApiInvoke(e){const t=an("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:An.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){const t=an("NOT_REPORT_KEY_EVENT");if(t.includes&&t.includes(e.type))return;return this.keyEventUploadPendingItems.push(e),void this.sendItems(this.keyEventUploadPendingItems,!0)}this.normalEventUploadPendingItems.push(e),this.normalEventUploadPendingItems.length>an("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()),an("ENABLE_EVENT_REPORT")?(r.length&&(an("NEW_REPORT_SERVER")?this.postDataToStatsCollector2(r):this.postDataToStatsCollector(r)).catch((e=>r=>{an("EVENT_REPORT_RETRY")&&(t?this.keyEventUploadPendingItems=this.keyEventUploadPendingItems.concat(e):(this.normalEventUploadPendingItems=this.normalEventUploadPendingItems.concat(e),this.normalEventUploadPendingItems.length>an("NORMAL_EVENT_QUEUE_CAPACITY")&&(this.normalEventUploadPendingItems.splice(0,this.normalEventUploadPendingItems.length-an("NORMAL_EVENT_QUEUE_CAPACITY")),Sn.warning("report: drop normal events"))))})(r)),e):e}async postDataToStatsCollector2(e){bi.networkState===Si.OFFLINE&&await Promise.race([bi.onlineWaiter,ki(2*Yi.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(An).forEach((r=>{let[i,n]=r;n===e.type&&(t=bn[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(an("NEW_REPORT_SERVER_DOMAINS")[0],"&p=443&d=").concat(r):"https://".concat(an("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(an("NEW_REPORT_SERVER_DOMAINS")[1],"&p=443&d=").concat(r):"https://".concat(an("NEW_REPORT_SERVER_DOMAINS")[1],"/").concat(r));try{await Zi(i,{timeout:1e4,data:t(e),headers:hn(hn({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,ki(2*Yi.maxRetryTimeout)]);const o=t?"/events/proto-raws":"/events/messages";let s=this.url||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(an("EVENT_REPORT_DOMAIN"),"&p=").concat(an("STATS_COLLECTOR_PORT"),"&d=").concat(o):"https://".concat(an("EVENT_REPORT_DOMAIN"),":").concat(an("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(an("EVENT_REPORT_BACKUP_DOMAIN"),"&p=").concat(an("STATS_COLLECTOR_PORT"),"&d=").concat(o):"https://".concat(an("EVENT_REPORT_BACKUP_DOMAIN"),":").concat(an("STATS_COLLECTOR_PORT")).concat(o)));try{t?await Qi(s,{timeout:1e4,data:n}):await Zi(s,{timeout:1e4,data:n})}catch(t){if(1===e)throw t;continue}return}}createBaseInfo(e,t){const r=Object.assign({},Rn);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()}};pn.on("REPORT_LOG_UPLOAD",(e=>{e.networkState=bi.networkState,In.reportApiInvoke(null,{name:"logUploadError",options:e,tag:gi.TRACER}).onSuccess("logUploadError")}));const Cn={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};function wn(){const e=Dr();Cn.getDisplayMedia=function(e){if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return!0;return!1}(),Cn.getStreamFromExtension=e.name===Ir.CHROME&&Number(e.version)>34,Cn.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}(),Cn.supportMinBitrate=e.name===Ir.CHROME||e.name===Ir.EDGE,Cn.supportSetRtpSenderParameters=function(){const e=Dr();if(!window.RTCRtpSender||!window.RTCRtpSender.prototype.setParameters||!window.RTCRtpSender.prototype.getParameters)return!1;return!!Qr()||(!(!xr()&&!Mr())||e.name===Ir.FIREFOX&&Number(e.version)>=64)}(),e.name===Ir.SAFARI&&(Number(e.version)>=14?Cn.supportDualStream=!0:Cn.supportDualStream=!1),Cn.webAudioMediaStreamDest=function(){const e=Dr();if(e.name===Ir.SAFARI&&Number(e.version)<12)return!1;return!0}(),Cn.supportReplaceTrack=function(){if(!window.RTCRtpSender)return!1;if("function"==typeof RTCRtpSender.prototype.replaceTrack)return!0;return!1}(),Cn.supportWebGL="undefined"!=typeof WebGLRenderingContext,Cn.supportRequestFrame=!!window.CanvasCaptureMediaStreamTrack,Qr()||(Cn.webAudioWithAEC=!0),Cn.supportShareAudio=function(){const e=Dr();if((e.os===Or.WIN_10||e.os===Or.WIN_81||e.os===Or.WIN_7||e.os===Or.LINUX||e.os===Or.MAC_OS||e.os===Or.CHROMIUM_OS)&&e.name===Ir.CHROME&&Number(e.version)>=74)return!0;return!1}(),Cn.supportDataChannel=function(){if(jr(76)||function(e){const t=Dr();return!(t.name!==Ir.FIREFOX||!t.osVersion)&&Number(t.version)>=e}(68)||function(e){const t=Dr();return!(t.name!==Ir.SAFARI||!t.osVersion)&&Number(t.version)>=e}(14))return!0;return!1}(),Cn.supportPCSetConfiguration=function(){const e=window.RTCPeerConnection;return!Fr()&&!!e&&e.prototype.setConfiguration instanceof Function}(),Cn.supportWebRTCEncodedTransform=function(){const e=Dr();return"Chrome"===e.name&&Number(e.version)>=87||"Safari"===e.name&&Number(e.version)>=15}(),Cn.supportWebRTCInsertableStream=function(){const e=Dr();return(e.name===Ir.CHROME||e.name===Ir.EDGE)&&Number(e.version)>=94&&"MediaStreamTrackGenerator"in window&&"MediaStreamTrackProcessor"in window}(),Cn.supportRequestVideoFrameCallback=function(){if("requestVideoFrameCallback"in HTMLVideoElement.prototype)return!0;return!1}(),Cn.supportWebCrypto="undefined"!=typeof window&&void 0!==window.crypto&&void 0!==window.crypto.subtle,Ii((()=>{Cn.supportDualStreamEncoding=function(){const e=Dr();if(an("DISABLE_WEBAUDIO"))return!0;return"Safari"===e.name&&Number(e.version)>=14||!!("Chrome"===e.name&&/Windows/i.test(e.os||"")&&Number(e.version)>=100&&an("CHROME_DUAL_STREAM_USE_ENCODING"))}(),Sn.debug("browser ua: ",navigator.userAgent),Sn.info("browser info: ",e),Sn.info("browser compatibility: ",Cn)}))}function Nn(){return Cn}function Dn(){return"setSinkId"in HTMLAudioElement.prototype&&(!an("RESTRICTION_SET_PLAYBACK_DEVICE")||(Ur()||Vr())&&!Zr())}let Pn=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 kn=function(e){try{return!!e()}catch(e){return!0}},Ln=!kn((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Mn=Ln,Un=Function.prototype,xn=Un.call,Vn=Mn&&Un.bind.bind(xn,xn),Fn=Mn?Vn:function(e){return function(){return xn.apply(e,arguments)}},Bn=Fn({}.isPrototypeOf),jn=function(e){return e&&e.Math===Math&&e},Gn=jn("object"==typeof globalThis&&globalThis)||jn("object"==typeof window&&window)||jn("object"==typeof self&&self)||jn("object"==typeof X&&X)||jn("object"==typeof X&&X)||function(){return this}()||Function("return this")(),Wn=Ln,Hn=Function.prototype,Kn=Hn.apply,Yn=Hn.call,zn="object"==typeof Reflect&&Reflect.apply||(Wn?Yn.bind(Kn):function(){return Yn.apply(Kn,arguments)}),Xn=Fn,Jn=Xn({}.toString),Zn=Xn("".slice),Qn=function(e){return Zn(Jn(e),8,-1)},qn=Qn,$n=Fn,eo=function(e){if("Function"===qn(e))return $n(e)},to="object"==typeof document&&document.all,ro=void 0===to&&void 0!==to?function(e){return"function"==typeof e||e===to}:function(e){return"function"==typeof e},io={},no=!kn((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),oo=Ln,so=Function.prototype.call,ao=oo?so.bind(so):function(){return so.apply(so,arguments)},co={},uo={}.propertyIsEnumerable,lo=Object.getOwnPropertyDescriptor,ho=lo&&!uo.call({1:2},1);co.f=ho?function(e){var t=lo(this,e);return!!t&&t.enumerable}:uo;var po,fo,mo=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Eo=kn,_o=Qn,To=Object,go=Fn("".split),So=Eo((function(){return!To("z").propertyIsEnumerable(0)}))?function(e){return"String"===_o(e)?go(e,""):To(e)}:To,vo=function(e){return null==e},Ro=vo,yo=TypeError,Ao=function(e){if(Ro(e))throw new yo("Can't call method on "+e);return e},bo=So,Oo=Ao,Io=function(e){return bo(Oo(e))},Co=ro,wo=function(e){return"object"==typeof e?null!==e:Co(e)},No={},Do=No,Po=Gn,ko=ro,Lo=function(e){return ko(e)?e:void 0},Mo=function(e,t){return arguments.length<2?Lo(Do[e])||Lo(Po[e]):Do[e]&&Do[e][t]||Po[e]&&Po[e][t]},Uo=Gn.navigator,xo=Uo&&Uo.userAgent,Vo=xo?String(xo):"",Fo=Gn,Bo=Vo,jo=Fo.process,Go=Fo.Deno,Wo=jo&&jo.versions||Go&&Go.version,Ho=Wo&&Wo.v8;Ho&&(fo=(po=Ho.split("."))[0]>0&&po[0]<4?1:+(po[0]+po[1])),!fo&&Bo&&(!(po=Bo.match(/Edge\/(\d+)/))||po[1]>=74)&&(po=Bo.match(/Chrome\/(\d+)/))&&(fo=+po[1]);var Ko=fo,Yo=Ko,zo=kn,Xo=Gn.String,Jo=!!Object.getOwnPropertySymbols&&!zo((function(){var e=Symbol("symbol detection");return!Xo(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Yo&&Yo<41})),Zo=Jo&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Qo=Mo,qo=ro,$o=Bn,es=Object,ts=Zo?function(e){return"symbol"==typeof e}:function(e){var t=Qo("Symbol");return qo(t)&&$o(t.prototype,es(e))},rs=String,is=function(e){try{return rs(e)}catch(e){return"Object"}},ns=ro,os=is,ss=TypeError,as=function(e){if(ns(e))return e;throw new ss(os(e)+" is not a function")},cs=as,ds=vo,us=function(e,t){var r=e[t];return ds(r)?void 0:cs(r)},ls=ao,hs=ro,ps=wo,fs=TypeError,ms={exports:{}},Es=Gn,_s=Object.defineProperty,Ts=Gn,gs=function(e,t){try{_s(Es,e,{value:t,configurable:!0,writable:!0})}catch(r){Es[e]=t}return t},Ss="__core-js_shared__",vs=ms.exports=Ts[Ss]||gs(Ss,{});(vs.versions||(vs.versions=[])).push({version:"3.42.0",mode:"pure",copyright:"© 2014-2025 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.42.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Rs=ms.exports,ys=Rs,As=function(e,t){return ys[e]||(ys[e]=t||{})},bs=Ao,Os=Object,Is=function(e){return Os(bs(e))},Cs=Is,ws=Fn({}.hasOwnProperty),Ns=Object.hasOwn||function(e,t){return ws(Cs(e),t)},Ds=Fn,Ps=0,ks=Math.random(),Ls=Ds(1..toString),Ms=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ls(++Ps+ks,36)},Us=As,xs=Ns,Vs=Ms,Fs=Jo,Bs=Zo,js=Gn.Symbol,Gs=Us("wks"),Ws=Bs?js.for||js:js&&js.withoutSetter||Vs,Hs=function(e){return xs(Gs,e)||(Gs[e]=Fs&&xs(js,e)?js[e]:Ws("Symbol."+e)),Gs[e]},Ks=ao,Ys=wo,zs=ts,Xs=us,Js=function(e,t){var r,i;if("string"===t&&hs(r=e.toString)&&!ps(i=ls(r,e)))return i;if(hs(r=e.valueOf)&&!ps(i=ls(r,e)))return i;if("string"!==t&&hs(r=e.toString)&&!ps(i=ls(r,e)))return i;throw new fs("Can't convert object to primitive value")},Zs=TypeError,Qs=Hs("toPrimitive"),qs=function(e,t){if(!Ys(e)||zs(e))return e;var r,i=Xs(e,Qs);if(i){if(void 0===t&&(t="default"),r=Ks(i,e,t),!Ys(r)||zs(r))return r;throw new Zs("Can't convert object to primitive value")}return void 0===t&&(t="number"),Js(e,t)},$s=ts,ea=function(e){var t=qs(e,"string");return $s(t)?t:t+""},ta=wo,ra=Gn.document,ia=ta(ra)&&ta(ra.createElement),na=function(e){return ia?ra.createElement(e):{}},oa=na,sa=!no&&!kn((function(){return 7!==Object.defineProperty(oa("div"),"a",{get:function(){return 7}}).a})),aa=no,ca=ao,da=co,ua=mo,la=Io,ha=ea,pa=Ns,fa=sa,ma=Object.getOwnPropertyDescriptor;io.f=aa?ma:function(e,t){if(e=la(e),t=ha(t),fa)try{return ma(e,t)}catch(e){}if(pa(e,t))return ua(!ca(da.f,e,t),e[t])};var Ea=kn,_a=ro,Ta=/#|\.prototype\./,ga=function(e,t){var r=va[Sa(e)];return r===ya||r!==Ra&&(_a(t)?Ea(t):!!t)},Sa=ga.normalize=function(e){return String(e).replace(Ta,".").toLowerCase()},va=ga.data={},Ra=ga.NATIVE="N",ya=ga.POLYFILL="P",Aa=ga,ba=as,Oa=Ln,Ia=eo(eo.bind),Ca=function(e,t){return ba(e),void 0===t?e:Oa?Ia(e,t):function(){return e.apply(t,arguments)}},wa={},Na=no&&kn((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Da=wo,Pa=String,ka=TypeError,La=function(e){if(Da(e))return e;throw new ka(Pa(e)+" is not an object")},Ma=no,Ua=sa,xa=Na,Va=La,Fa=ea,Ba=TypeError,ja=Object.defineProperty,Ga=Object.getOwnPropertyDescriptor,Wa="enumerable",Ha="configurable",Ka="writable";wa.f=Ma?xa?function(e,t,r){if(Va(e),t=Fa(t),Va(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Ka in r&&!r[Ka]){var i=Ga(e,t);i&&i[Ka]&&(e[t]=r.value,r={configurable:Ha in r?r[Ha]:i[Ha],enumerable:Wa in r?r[Wa]:i[Wa],writable:!1})}return ja(e,t,r)}:ja:function(e,t,r){if(Va(e),t=Fa(t),Va(r),Ua)try{return ja(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new Ba("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Ya=wa,za=mo,Xa=no?function(e,t,r){return Ya.f(e,t,za(1,r))}:function(e,t,r){return e[t]=r,e},Ja=Gn,Za=zn,Qa=eo,qa=ro,$a=io.f,ec=Aa,tc=No,rc=Ca,ic=Xa,nc=Ns,oc=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 Za(e,this,arguments)};return t.prototype=e.prototype,t},sc=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,m=h?Ja:p?Ja[l]:Ja[l]&&Ja[l].prototype,E=h?tc:tc[l]||ic(tc,l,{})[l],_=E.prototype;for(o in t)i=!(r=ec(h?o:l+(p?".":"#")+o,e.forced))&&m&&nc(m,o),a=E[o],i&&(c=e.dontCallGetSet?(u=$a(m,o))&&u.value:m[o]),s=i&&c?c:t[o],(r||f||typeof a!=typeof s)&&(d=e.bind&&i?rc(s,Ja):e.wrap&&i?oc(s):f&&qa(s)?Qa(s):s,(e.sham||s&&s.sham||a&&a.sham)&&ic(d,"sham",!0),ic(E,o,d),f&&(nc(tc,n=l+"Prototype")||ic(tc,n,{}),ic(tc[n],o,s),e.real&&_&&(r||!_[o])&&ic(_,o,s)))},ac=Math.ceil,cc=Math.floor,dc=Math.trunc||function(e){var t=+e;return(t>0?cc:ac)(t)},uc=dc,lc=function(e){var t=+e;return t!=t||0===t?0:uc(t)},hc=lc,pc=Math.max,fc=Math.min,mc=function(e,t){var r=hc(e);return r<0?pc(r+t,0):fc(r,t)},Ec=lc,_c=Math.min,Tc=function(e){var t=Ec(e);return t>0?_c(t,9007199254740991):0},gc=function(e){return Tc(e.length)},Sc=Io,vc=mc,Rc=gc,yc=function(e){return function(t,r,i){var n=Sc(t),o=Rc(n);if(0===o)return!e&&-1;var s,a=vc(i,o);if(e&&r!=r){for(;o>a;)if((s=n[a++])!=s)return!0}else for(;o>a;a++)if((e||a in n)&&n[a]===r)return e||a||0;return!e&&-1}},Ac={includes:yc(!0),indexOf:yc(!1)},bc=Ac.includes;sc({target:"Array",proto:!0,forced:kn((function(){return!Array(1).includes()}))},{includes:function(e){return bc(this,e,arguments.length>1?arguments[1]:void 0)}});var Oc=Gn,Ic=No,Cc=function(e,t){var r=Ic[e+"Prototype"],i=r&&r[t];if(i)return i;var n=Oc[e],o=n&&n.prototype;return o&&o[t]},wc=Cc("Array","includes"),Nc=wo,Dc=Qn,Pc=Hs("match"),kc=function(e){var t;return Nc(e)&&(void 0!==(t=e[Pc])?!!t:"RegExp"===Dc(e))},Lc=TypeError,Mc={};Mc[Hs("toStringTag")]="z";var Uc="[object z]"===String(Mc),xc=Uc,Vc=ro,Fc=Qn,Bc=Hs("toStringTag"),jc=Object,Gc="Arguments"===Fc(function(){return arguments}()),Wc=xc?Fc: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),Bc))?r:Gc?Fc(t):"Object"===(i=Fc(t))&&Vc(t.callee)?"Arguments":i},Hc=Wc,Kc=String,Yc=function(e){if("Symbol"===Hc(e))throw new TypeError("Cannot convert a Symbol value to a string");return Kc(e)},zc=Hs("match"),Xc=sc,Jc=function(e){if(kc(e))throw new Lc("The method doesn't accept regular expressions");return e},Zc=Ao,Qc=Yc,qc=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[zc]=!1,"/./"[e](t)}catch(e){}}return!1},$c=Fn("".indexOf);Xc({target:"String",proto:!0,forced:!qc("includes")},{includes:function(e){return!!~$c(Qc(Zc(this)),Qc(Jc(e)),arguments.length>1?arguments[1]:void 0)}});var ed=Cc("String","includes"),td=Bn,rd=wc,id=ed,nd=Array.prototype,od=String.prototype,sd=J((function(e){var t=e.includes;return e===nd||td(nd,e)&&t===nd.includes?rd:"string"==typeof e||e===od||td(od,e)&&t===od.includes?id:t}));function ad(e,t,r){return{sampleRate:e,stereo:t,bitrate:r}}function cd(e,t,r,i,n){return{width:e,height:t,frameRate:r,bitrateMin:i,bitrateMax:n}}function dd(e,t,r,i,n){return{width:{max:e},height:{max:t},frameRate:r,bitrateMin:i,bitrateMax:n}}function ud(e,t){return{numSpatialLayers:e,numTemporalLayers:t}}const ld={"90p":cd(160,90),"90p_1":cd(160,90),"120p":cd(160,120,15,30,65),"120p_1":cd(160,120,15,30,65),"120p_3":cd(120,120,15,30,50),"120p_4":cd(212,120),"180p":cd(320,180,15,30,140),"180p_1":cd(320,180,15,30,140),"180p_3":cd(180,180,15,30,100),"180p_4":cd(240,180,15,30,120),"240p":cd(320,240,15,40,200),"240p_1":cd(320,240,15,40,200),"240p_3":cd(240,240,15,40,140),"240p_4":cd(424,240,15,40,220),"360p":cd(640,360,15,80,400),"360p_1":cd(640,360,15,80,400),"360p_3":cd(360,360,15,80,260),"360p_4":cd(640,360,30,80,600),"360p_6":cd(360,360,30,80,400),"360p_7":cd(480,360,15,80,320),"360p_8":cd(480,360,30,80,490),"360p_9":cd(640,360,15,80,800),"360p_10":cd(640,360,24,80,800),"360p_11":cd(640,360,24,80,1e3),"480p":cd(640,480,15,100,500),"480p_1":cd(640,480,15,100,500),"480p_2":cd(640,480,30,100,1e3),"480p_3":cd(480,480,15,100,400),"480p_4":cd(640,480,30,100,750),"480p_6":cd(480,480,30,100,600),"480p_8":cd(848,480,15,100,610),"480p_9":cd(848,480,30,100,930),"480p_10":cd(640,480,10,100,400),"720p":cd(1280,720,15,120,1130),"720p_auto":cd(1280,720,30,900,3e3),"720p_1":cd(1280,720,15,120,1130),"720p_2":cd(1280,720,30,120,2e3),"720p_3":cd(1280,720,30,120,1710),"720p_5":cd(960,720,15,120,910),"720p_6":cd(960,720,30,120,1380),"1080p":cd(1920,1080,15,120,2080),"1080p_1":cd(1920,1080,15,120,2080),"1080p_2":cd(1920,1080,30,120,3e3),"1080p_3":cd(1920,1080,30,120,3150),"1080p_5":cd(1920,1080,60,120,4780),"1440p":cd(2560,1440,30,120,4850),"1440p_1":cd(2560,1440,30,120,4850),"1440p_2":cd(2560,1440,60,120,7350),"4k":cd(3840,2160,30,120,8910),"4k_1":cd(3840,2160,30,120,8910),"4k_3":cd(3840,2160,60,120,13500)},hd={"480p":dd(640,480,5),"480p_1":dd(640,480,5),"480p_2":dd(640,480,30),"480p_3":dd(640,480,15),"720p":dd(1280,720,5),"720p_auto":cd(1280,720,30,900,3e3),"720p_1":dd(1280,720,5),"720p_2":dd(1280,720,30),"720p_3":dd(1280,720,15),"1080p":dd(1920,1080,5),"1080p_1":dd(1920,1080,5),"1080p_2":dd(1920,1080,30),"1080p_3":dd(1920,1080,15)},pd={"1SL1TL":ud(1,1),"3SL3TL":ud(3,3),"2SL3TL":ud(2,3)};function fd(e){return e||(e="480p_1"),"string"==typeof e?Object.assign({},ld[e]):e}function md(e){return"string"==typeof e?Object.assign({},hd[e]):e}function Ed(e){return"string"==typeof e?Object.assign({},pd[e]):e}const _d={speech_low_quality:ad(16e3,!1),speech_standard:ad(32e3,!1,18),music_standard:ad(48e3,!1),standard_stereo:ad(48e3,!0,56),high_quality:ad(48e3,!1,128),high_quality_stereo:ad(48e3,!0,192)};function Td(e){return"string"==typeof e?Object.assign({},_d[e]):e}const gd=[];function Sd(e){sd(gd).call(gd,e)||gd.push(e)}function vd(e){const t=gd.indexOf(e);-1!==t&&gd.splice(t,1)}function Rd(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 yd(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 Ad(e){return si(e,"mediaSource",["screen","window","application"]),!0}let bd=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}({}),Od=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 Id=function(e){return e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM",e}({}),Cd=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}({}),wd=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}({}),Nd=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}({}),Dd=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}({}),Pd=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}({}),kd=function(e){return e.AUDIO="audio",e.VIDEO="video",e.DATA="data",e}({}),Ld=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}({}),Md=function(e){return e.UPDATE_TRACK_SOURCE="update-track-source",e}({});const Ud={sendVolumeLevel:0,sendBitrate:0,sendBytes:0,sendPackets:0,sendPacketsLost:0,sendJitterMs:0,sendRttMs:0,currentPacketLossRate:0},xd={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},Vd={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},Fd={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 Bd=function(e){return e.ON_TRACK="on_track",e.ON_NODE="on_node",e}({}),jd=function(e){return e.REQUEST_UPDATE_CONSTRAINTS="request_update_constraints",e.REQUEST_CONSTRAINTS="request_constraints",e}({}),Gd=function(e){return e.IDLE="IDLE",e.INITING="INITING",e.INITEND="INITEND",e}({}),Wd=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 Hd=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}({}),Kd=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 Yd=function(e){return e.OPEN="open",e.MESSAGE="message",e.CLOSE="close",e.CLOSING="closing",e.ERROR="error",e}({});var zd={exports:{}},Xd=sc,Jd=no,Zd=wa.f;Xd({target:"Object",stat:!0,forced:Object.defineProperty!==Zd,sham:!Jd},{defineProperty:Zd});var Qd=No.Object,qd=zd.exports=function(e,t,r){return Qd.defineProperty(e,t,r)};Qd.defineProperty.sham&&(qd.sham=!0);var $d=J(zd.exports),eu=Qn,tu=Array.isArray||function(e){return"Array"===eu(e)},ru=TypeError,iu=no,nu=wa,ou=mo,su=function(e,t,r){iu?nu.f(e,t,ou(0,r)):e[t]=r},au=ro,cu=Rs,du=Fn(Function.toString);au(cu.inspectSource)||(cu.inspectSource=function(e){return du(e)});var uu=cu.inspectSource,lu=Fn,hu=kn,pu=ro,fu=Wc,mu=uu,Eu=function(){},_u=Mo("Reflect","construct"),Tu=/^\s*(?:class|function)\b/,gu=lu(Tu.exec),Su=!Tu.test(Eu),vu=function(e){if(!pu(e))return!1;try{return _u(Eu,[],e),!0}catch(e){return!1}},Ru=function(e){if(!pu(e))return!1;switch(fu(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Su||!!gu(Tu,mu(e))}catch(e){return!0}};Ru.sham=!0;var yu=!_u||hu((function(){var e;return vu(vu.call)||!vu(Object)||!vu((function(){e=!0}))||e}))?Ru:vu,Au=tu,bu=yu,Ou=wo,Iu=Hs("species"),Cu=Array,wu=function(e){var t;return Au(e)&&(t=e.constructor,(bu(t)&&(t===Cu||Au(t.prototype))||Ou(t)&&null===(t=t[Iu]))&&(t=void 0)),void 0===t?Cu:t},Nu=function(e,t){return new(wu(e))(0===t?0:t)},Du=kn,Pu=Ko,ku=Hs("species"),Lu=function(e){return Pu>=51||!Du((function(){var t=[];return(t.constructor={})[ku]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Mu=sc,Uu=kn,xu=tu,Vu=wo,Fu=Is,Bu=gc,ju=function(e){if(e>9007199254740991)throw ru("Maximum allowed index exceeded");return e},Gu=su,Wu=Nu,Hu=Lu,Ku=Ko,Yu=Hs("isConcatSpreadable"),zu=Ku>=51||!Uu((function(){var e=[];return e[Yu]=!1,e.concat()[0]!==e})),Xu=function(e){if(!Vu(e))return!1;var t=e[Yu];return void 0!==t?!!t:xu(e)};Mu({target:"Array",proto:!0,arity:1,forced:!zu||!Hu("concat")},{concat:function(e){var t,r,i,n,o,s=Fu(this),a=Wu(s,0),c=0;for(t=-1,i=arguments.length;t<i;t++)if(Xu(o=-1===t?s:arguments[t]))for(n=Bu(o),ju(c+n),r=0;r<n;r++,c++)r in o&&Gu(a,c,o[r]);else ju(c+1),Gu(a,c++,o);return a.length=c,a}});var Ju={},Zu={},Qu=Ns,qu=Io,$u=Ac.indexOf,el=Zu,tl=Fn([].push),rl=function(e,t){var r,i=qu(e),n=0,o=[];for(r in i)!Qu(el,r)&&Qu(i,r)&&tl(o,r);for(;t.length>n;)Qu(i,r=t[n++])&&(~$u(o,r)||tl(o,r));return o},il=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],nl=rl,ol=il,sl=Object.keys||function(e){return nl(e,ol)},al=no,cl=Na,dl=wa,ul=La,ll=Io,hl=sl;Ju.f=al&&!cl?Object.defineProperties:function(e,t){ul(e);for(var r,i=ll(t),n=hl(t),o=n.length,s=0;o>s;)dl.f(e,r=n[s++],i[r]);return e};var pl,fl=Mo("document","documentElement"),ml=Ms,El=As("keys"),_l=function(e){return El[e]||(El[e]=ml(e))},Tl=La,gl=Ju,Sl=il,vl=Zu,Rl=fl,yl=na,Al="prototype",bl="script",Ol=_l("IE_PROTO"),Il=function(){},Cl=function(e){return"<"+bl+">"+e+"</"+bl+">"},wl=function(e){e.write(Cl("")),e.close();var t=e.parentWindow.Object;return e=null,t},Nl=function(){try{pl=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;Nl="undefined"!=typeof document?document.domain&&pl?wl(pl):(t=yl("iframe"),r="java"+bl+":",t.style.display="none",Rl.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(Cl("document.F=Object")),e.close(),e.F):wl(pl);for(var i=Sl.length;i--;)delete Nl[Al][Sl[i]];return Nl()};vl[Ol]=!0;var Dl=Object.create||function(e,t){var r;return null!==e?(Il[Al]=Tl(e),r=new Il,Il[Al]=null,r[Ol]=e):r=Nl(),void 0===t?r:gl.f(r,t)},Pl={},kl=rl,Ll=il.concat("length","prototype");Pl.f=Object.getOwnPropertyNames||function(e){return kl(e,Ll)};var Ml={},Ul=Fn([].slice),xl=Qn,Vl=Io,Fl=Pl.f,Bl=Ul,jl="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Ml.f=function(e){return jl&&"Window"===xl(e)?function(e){try{return Fl(e)}catch(e){return Bl(jl)}}(e):Fl(Vl(e))};var Gl={};Gl.f=Object.getOwnPropertySymbols;var Wl=Xa,Hl=function(e,t,r,i){return i&&i.enumerable?e[t]=r:Wl(e,t,r),e},Kl=wa,Yl=function(e,t,r){return Kl.f(e,t,r)},zl={},Xl=Hs;zl.f=Xl;var Jl,Zl,Ql,ql=No,$l=Ns,eh=zl,th=wa.f,rh=function(e){var t=ql.Symbol||(ql.Symbol={});$l(t,e)||th(t,e,{value:eh.f(e)})},ih=ao,nh=Mo,oh=Hs,sh=Hl,ah=function(){var e=nh("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,i=oh("toPrimitive");t&&!t[i]&&sh(t,i,(function(e){return ih(r,this)}),{arity:1})},ch=Wc,dh=Uc?{}.toString:function(){return"[object "+ch(this)+"]"},uh=Uc,lh=wa.f,hh=Xa,ph=Ns,fh=dh,mh=Hs("toStringTag"),Eh=function(e,t,r,i){var n=r?e:e&&e.prototype;n&&(ph(n,mh)||lh(n,mh,{configurable:!0,value:t}),i&&!uh&&hh(n,"toString",fh))},_h=ro,Th=Gn.WeakMap,gh=_h(Th)&&/native code/.test(String(Th)),Sh=Gn,vh=wo,Rh=Xa,yh=Ns,Ah=Rs,bh=_l,Oh=Zu,Ih="Object already initialized",Ch=Sh.TypeError,wh=Sh.WeakMap;if(gh||Ah.state){var Nh=Ah.state||(Ah.state=new wh);Nh.get=Nh.get,Nh.has=Nh.has,Nh.set=Nh.set,Jl=function(e,t){if(Nh.has(e))throw new Ch(Ih);return t.facade=e,Nh.set(e,t),t},Zl=function(e){return Nh.get(e)||{}},Ql=function(e){return Nh.has(e)}}else{var Dh=bh("state");Oh[Dh]=!0,Jl=function(e,t){if(yh(e,Dh))throw new Ch(Ih);return t.facade=e,Rh(e,Dh,t),t},Zl=function(e){return yh(e,Dh)?e[Dh]:{}},Ql=function(e){return yh(e,Dh)}}var Ph={set:Jl,get:Zl,has:Ql,enforce:function(e){return Ql(e)?Zl(e):Jl(e,{})},getterFor:function(e){return function(t){var r;if(!vh(t)||(r=Zl(t)).type!==e)throw new Ch("Incompatible receiver, "+e+" required");return r}}},kh=Ca,Lh=So,Mh=Is,Uh=gc,xh=Nu,Vh=Fn([].push),Fh=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=Mh(c),m=Lh(f),E=Uh(m),_=kh(d,u),T=0,g=l||xh,S=t?g(c,E):r||s?g(c,0):void 0;E>T;T++)if((a||T in m)&&(p=_(h=m[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:Vh(S,h)}else switch(e){case 4:return!1;case 7:Vh(S,h)}return o?-1:i||n?n:S}},Bh={forEach:Fh(0),map:Fh(1),filter:Fh(2),some:Fh(3),every:Fh(4),find:Fh(5),findIndex:Fh(6),filterReject:Fh(7)},jh=sc,Gh=Gn,Wh=ao,Hh=Fn,Kh=no,Yh=Jo,zh=kn,Xh=Ns,Jh=Bn,Zh=La,Qh=Io,qh=ea,$h=Yc,ep=mo,tp=Dl,rp=sl,ip=Pl,np=Ml,op=Gl,sp=io,ap=wa,cp=Ju,dp=co,up=Hl,lp=Yl,hp=As,pp=Zu,fp=Ms,mp=Hs,Ep=zl,_p=rh,Tp=ah,gp=Eh,Sp=Ph,vp=Bh.forEach,Rp=_l("hidden"),yp="Symbol",Ap="prototype",bp=Sp.set,Op=Sp.getterFor(yp),Ip=Object[Ap],Cp=Gh.Symbol,wp=Cp&&Cp[Ap],Np=Gh.RangeError,Dp=Gh.TypeError,Pp=Gh.QObject,kp=sp.f,Lp=ap.f,Mp=np.f,Up=dp.f,xp=Hh([].push),Vp=hp("symbols"),Fp=hp("op-symbols"),Bp=hp("wks"),jp=!Pp||!Pp[Ap]||!Pp[Ap].findChild,Gp=function(e,t,r){var i=kp(Ip,t);i&&delete Ip[t],Lp(e,t,r),i&&e!==Ip&&Lp(Ip,t,i)},Wp=Kh&&zh((function(){return 7!==tp(Lp({},"a",{get:function(){return Lp(this,"a",{value:7}).a}})).a}))?Gp:Lp,Hp=function(e,t){var r=Vp[e]=tp(wp);return bp(r,{type:yp,tag:e,description:t}),Kh||(r.description=t),r},Kp=function(e,t,r){e===Ip&&Kp(Fp,t,r),Zh(e);var i=qh(t);return Zh(r),Xh(Vp,i)?(r.enumerable?(Xh(e,Rp)&&e[Rp][i]&&(e[Rp][i]=!1),r=tp(r,{enumerable:ep(0,!1)})):(Xh(e,Rp)||Lp(e,Rp,ep(1,tp(null))),e[Rp][i]=!0),Wp(e,i,r)):Lp(e,i,r)},Yp=function(e,t){Zh(e);var r=Qh(t),i=rp(r).concat(Zp(r));return vp(i,(function(t){Kh&&!Wh(zp,r,t)||Kp(e,t,r[t])})),e},zp=function(e){var t=qh(e),r=Wh(Up,this,t);return!(this===Ip&&Xh(Vp,t)&&!Xh(Fp,t))&&(!(r||!Xh(this,t)||!Xh(Vp,t)||Xh(this,Rp)&&this[Rp][t])||r)},Xp=function(e,t){var r=Qh(e),i=qh(t);if(r!==Ip||!Xh(Vp,i)||Xh(Fp,i)){var n=kp(r,i);return!n||!Xh(Vp,i)||Xh(r,Rp)&&r[Rp][i]||(n.enumerable=!0),n}},Jp=function(e){var t=Mp(Qh(e)),r=[];return vp(t,(function(e){Xh(Vp,e)||Xh(pp,e)||xp(r,e)})),r},Zp=function(e){var t=e===Ip,r=Mp(t?Fp:Qh(e)),i=[];return vp(r,(function(e){!Xh(Vp,e)||t&&!Xh(Ip,e)||xp(i,Vp[e])})),i};Yh||(Cp=function(){if(Jh(wp,this))throw new Dp("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?$h(arguments[0]):void 0,t=fp(e),r=function(e){var i=void 0===this?Gh:this;i===Ip&&Wh(r,Fp,e),Xh(i,Rp)&&Xh(i[Rp],t)&&(i[Rp][t]=!1);var n=ep(1,e);try{Wp(i,t,n)}catch(e){if(!(e instanceof Np))throw e;Gp(i,t,n)}};return Kh&&jp&&Wp(Ip,t,{configurable:!0,set:r}),Hp(t,e)},up(wp=Cp[Ap],"toString",(function(){return Op(this).tag})),up(Cp,"withoutSetter",(function(e){return Hp(fp(e),e)})),dp.f=zp,ap.f=Kp,cp.f=Yp,sp.f=Xp,ip.f=np.f=Jp,op.f=Zp,Ep.f=function(e){return Hp(mp(e),e)},Kh&&lp(wp,"description",{configurable:!0,get:function(){return Op(this).description}})),jh({global:!0,constructor:!0,wrap:!0,forced:!Yh,sham:!Yh},{Symbol:Cp}),vp(rp(Bp),(function(e){_p(e)})),jh({target:yp,stat:!0,forced:!Yh},{useSetter:function(){jp=!0},useSimple:function(){jp=!1}}),jh({target:"Object",stat:!0,forced:!Yh,sham:!Kh},{create:function(e,t){return void 0===t?tp(e):Yp(tp(e),t)},defineProperty:Kp,defineProperties:Yp,getOwnPropertyDescriptor:Xp}),jh({target:"Object",stat:!0,forced:!Yh},{getOwnPropertyNames:Jp}),Tp(),gp(Cp,yp),pp[Rp]=!0;var Qp=Jo&&!!Symbol.for&&!!Symbol.keyFor,qp=sc,$p=Mo,ef=Ns,tf=Yc,rf=As,nf=Qp,of=rf("string-to-symbol-registry"),sf=rf("symbol-to-string-registry");qp({target:"Symbol",stat:!0,forced:!nf},{for:function(e){var t=tf(e);if(ef(of,t))return of[t];var r=$p("Symbol")(t);return of[t]=r,sf[r]=t,r}});var af=sc,cf=Ns,df=ts,uf=is,lf=Qp,hf=As("symbol-to-string-registry");af({target:"Symbol",stat:!0,forced:!lf},{keyFor:function(e){if(!df(e))throw new TypeError(uf(e)+" is not a symbol");if(cf(hf,e))return hf[e]}});var pf=tu,ff=ro,mf=Qn,Ef=Yc,_f=Fn([].push),Tf=sc,gf=Mo,Sf=zn,vf=ao,Rf=Fn,yf=kn,Af=ro,bf=ts,Of=Ul,If=function(e){if(ff(e))return e;if(pf(e)){for(var t=e.length,r=[],i=0;i<t;i++){var n=e[i];"string"==typeof n?_f(r,n):"number"!=typeof n&&"Number"!==mf(n)&&"String"!==mf(n)||_f(r,Ef(n))}var o=r.length,s=!0;return function(e,t){if(s)return s=!1,t;if(pf(this))return t;for(var i=0;i<o;i++)if(r[i]===e)return t}}},Cf=Jo,wf=String,Nf=gf("JSON","stringify"),Df=Rf(/./.exec),Pf=Rf("".charAt),kf=Rf("".charCodeAt),Lf=Rf("".replace),Mf=Rf(1..toString),Uf=/[\uD800-\uDFFF]/g,xf=/^[\uD800-\uDBFF]$/,Vf=/^[\uDC00-\uDFFF]$/,Ff=!Cf||yf((function(){var e=gf("Symbol")("stringify detection");return"[null]"!==Nf([e])||"{}"!==Nf({a:e})||"{}"!==Nf(Object(e))})),Bf=yf((function(){return'"\\udf06\\ud834"'!==Nf("\udf06\ud834")||'"\\udead"'!==Nf("\udead")})),jf=function(e,t){var r=Of(arguments),i=If(t);if(Af(i)||void 0!==e&&!bf(e))return r[1]=function(e,t){if(Af(i)&&(t=vf(i,this,wf(e),t)),!bf(t))return t},Sf(Nf,null,r)},Gf=function(e,t,r){var i=Pf(r,t-1),n=Pf(r,t+1);return Df(xf,e)&&!Df(Vf,n)||Df(Vf,e)&&!Df(xf,i)?"\\u"+Mf(kf(e,0),16):e};Nf&&Tf({target:"JSON",stat:!0,arity:3,forced:Ff||Bf},{stringify:function(e,t,r){var i=Of(arguments),n=Sf(Ff?jf:Nf,null,i);return Bf&&"string"==typeof n?Lf(n,Uf,Gf):n}});var Wf=Gl,Hf=Is;sc({target:"Object",stat:!0,forced:!Jo||kn((function(){Wf.f(1)}))},{getOwnPropertySymbols:function(e){var t=Wf.f;return t?t(Hf(e)):[]}}),rh("asyncIterator"),rh("hasInstance"),rh("isConcatSpreadable"),rh("iterator"),rh("match"),rh("matchAll"),rh("replace"),rh("search"),rh("species"),rh("split");var Kf=ah;rh("toPrimitive"),Kf();var Yf=Mo,zf=Eh;rh("toStringTag"),zf(Yf("Symbol"),"Symbol"),rh("unscopables"),Eh(Gn.JSON,"JSON",!0);var Xf,Jf,Zf,Qf=No.Symbol,qf={},$f=no,em=Ns,tm=Function.prototype,rm=$f&&Object.getOwnPropertyDescriptor,im=em(tm,"name"),nm={EXISTS:im,PROPER:im&&"something"===function(){}.name,CONFIGURABLE:im&&(!$f||$f&&rm(tm,"name").configurable)},om=!kn((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),sm=Ns,am=ro,cm=Is,dm=om,um=_l("IE_PROTO"),lm=Object,hm=lm.prototype,pm=dm?lm.getPrototypeOf:function(e){var t=cm(e);if(sm(t,um))return t[um];var r=t.constructor;return am(r)&&t instanceof r?r.prototype:t instanceof lm?hm:null},fm=kn,mm=ro,Em=wo,_m=Dl,Tm=pm,gm=Hl,Sm=Hs("iterator"),vm=!1;[].keys&&("next"in(Zf=[].keys())?(Jf=Tm(Tm(Zf)))!==Object.prototype&&(Xf=Jf):vm=!0);var Rm=!Em(Xf)||fm((function(){var e={};return Xf[Sm].call(e)!==e}));mm((Xf=Rm?{}:_m(Xf))[Sm])||gm(Xf,Sm,(function(){return this}));var ym={IteratorPrototype:Xf,BUGGY_SAFARI_ITERATORS:vm},Am=ym.IteratorPrototype,bm=Dl,Om=mo,Im=Eh,Cm=qf,wm=function(){return this},Nm=function(e,t,r,i){var n=t+" Iterator";return e.prototype=bm(Am,{next:Om(+!i,r)}),Im(e,n,!1,!0),Cm[n]=wm,e},Dm=Fn,Pm=as,km=wo,Lm=function(e){return km(e)||null===e},Mm=String,Um=TypeError,xm=function(e,t,r){try{return Dm(Pm(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},Vm=wo,Fm=Ao,Bm=function(e){if(Lm(e))return e;throw new Um("Can't set "+Mm(e)+" as a prototype")},jm=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=xm(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return Fm(r),Bm(i),Vm(r)?(t?e(r,i):r.__proto__=i,r):r}}():void 0),Gm=sc,Wm=ao,Hm=nm,Km=Nm,Ym=pm,zm=Eh,Xm=Hl,Jm=qf,Zm=ym,Qm=Hm.PROPER,qm=Zm.BUGGY_SAFARI_ITERATORS,$m=Hs("iterator"),eE="keys",tE="values",rE="entries",iE=function(){return this},nE=function(e,t,r,i,n,o,s){Km(r,t,i);var a,c,d,u=function(e){if(e===n&&m)return m;if(!qm&&e&&e in p)return p[e];switch(e){case eE:case tE:case rE:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[$m]||p["@@iterator"]||n&&p[n],m=!qm&&f||u(n),E="Array"===t&&p.entries||f;if(E&&(a=Ym(E.call(new e)))!==Object.prototype&&a.next&&(zm(a,l,!0,!0),Jm[l]=iE),Qm&&n===tE&&f&&f.name!==tE&&(h=!0,m=function(){return Wm(f,this)}),n)if(c={values:u(tE),keys:o?m:u(eE),entries:u(rE)},s)for(d in c)(qm||h||!(d in p))&&Xm(p,d,c[d]);else Gm({target:t,proto:!0,forced:qm||h},c);return s&&p[$m]!==m&&Xm(p,$m,m,{name:n}),Jm[t]=m,c},oE=function(e,t){return{value:e,done:t}},sE=Io,aE=qf,cE=Ph;wa.f;var dE=nE,uE=oE,lE="Array Iterator",hE=cE.set,pE=cE.getterFor(lE);dE(Array,"Array",(function(e,t){hE(this,{type:lE,target:sE(e),index:0,kind:t})}),(function(){var e=pE(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,uE(void 0,!0);switch(e.kind){case"keys":return uE(r,!1);case"values":return uE(t[r],!1)}return uE([r,t[r]],!1)}),"values"),aE.Arguments=aE.Array;var fE={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},mE=Gn,EE=Eh,_E=qf;for(var TE in fE)EE(mE[TE],TE),_E[TE]=_E.Array;var gE=Qf,SE=Hs,vE=wa.f,RE=SE("metadata"),yE=Function.prototype;void 0===yE[RE]&&vE(yE,RE,{value:null}),rh("asyncDispose"),rh("dispose"),rh("metadata");var AE=gE,bE=Fn,OE=Mo("Symbol"),IE=OE.keyFor,CE=bE(OE.prototype.valueOf),wE=OE.isRegisteredSymbol||function(e){try{return void 0!==IE(CE(e))}catch(e){return!1}};sc({target:"Symbol",stat:!0},{isRegisteredSymbol:wE});for(var NE=As,DE=Mo,PE=Fn,kE=ts,LE=Hs,ME=DE("Symbol"),UE=ME.isWellKnownSymbol,xE=DE("Object","getOwnPropertyNames"),VE=PE(ME.prototype.valueOf),FE=NE("wks"),BE=0,jE=xE(ME),GE=jE.length;BE<GE;BE++)try{var WE=jE[BE];kE(ME[WE])&&LE(WE)}catch(e){}var HE=function(e){if(UE&&UE(e))return!0;try{for(var t=VE(e),r=0,i=xE(FE),n=i.length;r<n;r++)if(FE[i[r]]==t)return!0}catch(e){}return!1};sc({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:HE}),rh("customMatcher"),rh("observable"),sc({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:wE}),sc({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:HE}),rh("matcher"),rh("metadataKey"),rh("patternMatch"),rh("replaceAll");var KE=J(AE),YE=Fn,zE=lc,XE=Yc,JE=Ao,ZE=YE("".charAt),QE=YE("".charCodeAt),qE=YE("".slice),$E=function(e){return function(t,r){var i,n,o=XE(JE(t)),s=zE(r),a=o.length;return s<0||s>=a?e?"":void 0:(i=QE(o,s))<55296||i>56319||s+1===a||(n=QE(o,s+1))<56320||n>57343?e?ZE(o,s):i:e?qE(o,s,s+2):n-56320+(i-55296<<10)+65536}},e_={codeAt:$E(!1),charAt:$E(!0)},t_=e_.charAt,r_=Yc,i_=Ph,n_=nE,o_=oE,s_="String Iterator",a_=i_.set,c_=i_.getterFor(s_);n_(String,"String",(function(e){a_(this,{type:s_,string:r_(e),index:0})}),(function(){var e,t=c_(this),r=t.string,i=t.index;return i>=r.length?o_(void 0,!0):(e=t_(r,i),t.index+=e.length,o_(e,!1))}));var d_=J(zl.f("iterator"));function u_(e){return u_="function"==typeof KE&&"symbol"==typeof d_?function(e){return typeof e}:function(e){return e&&"function"==typeof KE&&e.constructor===KE&&e!==KE.prototype?"symbol":typeof e},u_(e)}var l_=J(zl.f("toPrimitive"));function h_(e){var t=function(e,t){if("object"!=u_(e)||!e)return e;var r=e[l_];if(void 0!==r){var i=r.call(e,t||"default");if("object"!=u_(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==u_(t)?t:t+""}function p_(e,t,r){return(t=h_(t))in e?$d(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var f_=kn,m_=function(e,t){var r=[][e];return!!r&&f_((function(){r.call(null,t||function(){return 1},1)}))},E_=Bh.forEach,__=m_("forEach")?[].forEach:function(e){return E_(this,e,arguments.length>1?arguments[1]:void 0)};sc({target:"Array",proto:!0,forced:[].forEach!==__},{forEach:__});var T_=Cc("Array","forEach"),g_=Wc,S_=Ns,v_=Bn,R_=T_,y_=Array.prototype,A_={DOMTokenList:!0,NodeList:!0},b_=J((function(e){var t=e.forEach;return e===y_||v_(y_,e)&&t===y_.forEach||S_(A_,g_(e))?R_:t})),O_=Is,I_=sl;sc({target:"Object",stat:!0,forced:kn((function(){I_(1)}))},{keys:function(e){return I_(O_(e))}});var C_=J(No.Object.keys),w_=as,N_=Is,D_=So,P_=gc,k_=TypeError,L_="Reduce of empty array with no initial value",M_=function(e){return function(t,r,i,n){var o=N_(t),s=D_(o),a=P_(o);if(w_(r),0===a&&i<2)throw new k_(L_);var 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 new k_(L_)}for(;e?c>=0:a>c;c+=d)c in s&&(n=r(n,s[c],c,o));return n}},U_={left:M_(!1),right:M_(!0)},x_=Gn,V_=Vo,F_=Qn,B_=function(e){return V_.slice(0,e.length)===e},j_=B_("Bun/")?"BUN":B_("Cloudflare-Workers")?"CLOUDFLARE":B_("Deno/")?"DENO":B_("Node.js/")?"NODE":x_.Bun&&"string"==typeof Bun.version?"BUN":x_.Deno&&"object"==typeof Deno.version?"DENO":"process"===F_(x_.process)?"NODE":x_.window&&x_.document?"BROWSER":"REST",G_="NODE"===j_,W_=U_.left;sc({target:"Array",proto:!0,forced:!G_&&Ko>79&&Ko<83||!m_("reduce")},{reduce:function(e){var t=arguments.length;return W_(this,e,t,t>1?arguments[1]:void 0)}});var H_=Cc("Array","reduce"),K_=Bn,Y_=H_,z_=Array.prototype,X_=function(e){var t=e.reduce;return e===z_||K_(z_,e)&&t===z_.reduce?Y_:t},J_=J(X_),Z_=sc,Q_=tu,q_=Fn([].reverse),$_=[1,2];Z_({target:"Array",proto:!0,forced:String($_)===String($_.reverse())},{reverse:function(){return Q_(this)&&(this.length=this.length),q_(this)}});var eT=Cc("Array","reverse"),tT=Bn,rT=eT,iT=Array.prototype,nT=function(e){var t=e.reverse;return e===iT||tT(iT,e)&&t===iT.reverse?rT:t},oT=J(nT),sT=sc,aT=tu,cT=yu,dT=wo,uT=mc,lT=gc,hT=Io,pT=su,fT=Hs,mT=Ul,ET=Lu("slice"),_T=fT("species"),TT=Array,gT=Math.max;sT({target:"Array",proto:!0,forced:!ET},{slice:function(e,t){var r,i,n,o=hT(this),s=lT(o),a=uT(e,s),c=uT(void 0===t?s:t,s);if(aT(o)&&(r=o.constructor,(cT(r)&&(r===TT||aT(r.prototype))||dT(r)&&null===(r=r[_T]))&&(r=void 0),r===TT||void 0===r))return mT(o,a,c);for(i=new(void 0===r?TT:r)(gT(c-a,0)),n=0;a<c;a++,n++)a in o&&pT(i,n,o[a]);return i.length=n,i}});var ST=Cc("Array","slice"),vT=Bn,RT=ST,yT=Array.prototype,AT=J((function(e){var t=e.slice;return e===yT||vT(yT,e)&&t===yT.slice?RT:t}));function bT(e,t,r,i,n){var o,s,a,c={};return b_(o=C_(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=J_(s=oT(a=AT(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?($d(e,t,c),null):c}var OT=Mo,IT=Pl,CT=Gl,wT=La,NT=Fn([].concat),DT=OT("Reflect","ownKeys")||function(e){var t=IT.f(wT(e)),r=CT.f;return r?NT(t,r(e)):t},PT=Ns,kT=DT,LT=io,MT=wa,UT=wo,xT=Xa,VT=Error,FT=Fn("".replace),BT=String(new VT("zxcasd").stack),jT=/\n\s*at [^:]*:[^\n]*/,GT=jT.test(BT),WT=mo,HT=!kn((function(){var e=new Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",WT(1,7)),7!==e.stack)})),KT=Xa,YT=function(e,t){if(GT&&"string"==typeof e&&!VT.prepareStackTrace)for(;t--;)e=FT(e,jT,"");return e},zT=HT,XT=Error.captureStackTrace,JT=qf,ZT=Hs("iterator"),QT=Array.prototype,qT=function(e){return void 0!==e&&(JT.Array===e||QT[ZT]===e)},$T=Wc,eg=us,tg=vo,rg=qf,ig=Hs("iterator"),ng=function(e){if(!tg(e))return eg(e,ig)||eg(e,"@@iterator")||rg[$T(e)]},og=ao,sg=as,ag=La,cg=is,dg=ng,ug=TypeError,lg=function(e,t){var r=arguments.length<2?dg(e):t;if(sg(r))return ag(og(r,e));throw new ug(cg(e)+" is not iterable")},hg=ao,pg=La,fg=us,mg=function(e,t,r){var i,n;pg(e);try{if(!(i=fg(e,"return"))){if("throw"===t)throw r;return r}i=hg(i,e)}catch(e){n=!0,i=e}if("throw"===t)throw r;if(n)throw i;return pg(i),r},Eg=Ca,_g=ao,Tg=La,gg=is,Sg=qT,vg=gc,Rg=Bn,yg=lg,Ag=ng,bg=mg,Og=TypeError,Ig=function(e,t){this.stopped=e,this.result=t},Cg=Ig.prototype,wg=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),m=Eg(t,u),E=function(e){return i&&bg(i,"normal",e),new Ig(!0,e)},_=function(e){return l?(Tg(e),f?m(e[0],e[1],E):m(e[0],e[1])):f?m(e,E):m(e)};if(h)i=e.iterator;else if(p)i=e;else{if(!(n=Ag(e)))throw new Og(gg(e)+" is not iterable");if(Sg(n)){for(o=0,s=vg(e);s>o;o++)if((a=_(e[o]))&&Rg(Cg,a))return a;return new Ig(!1)}i=yg(e,n)}for(c=h?e.next:i.next;!(d=_g(c,i)).done;){try{a=_(d.value)}catch(e){bg(i,"throw",e)}if("object"==typeof a&&a&&Rg(Cg,a))return a}return new Ig(!1)},Ng=Yc,Dg=sc,Pg=Bn,kg=pm,Lg=jm,Mg=function(e,t,r){for(var i=kT(t),n=MT.f,o=LT.f,s=0;s<i.length;s++){var a=i[s];PT(e,a)||r&&PT(r,a)||n(e,a,o(t,a))}},Ug=Dl,xg=Xa,Vg=mo,Fg=function(e,t){UT(t)&&"cause"in t&&xT(e,"cause",t.cause)},Bg=function(e,t,r,i){zT&&(XT?XT(e,t):KT(e,"stack",YT(r,i)))},jg=wg,Gg=function(e,t){return void 0===e?arguments.length<2?"":t:Ng(e)},Wg=Hs("toStringTag"),Hg=Error,Kg=[].push,Yg=function(e,t){var r,i=Pg(zg,this);Lg?r=Lg(new Hg,i?kg(this):zg):(r=i?this:Ug(zg),xg(r,Wg,"Error")),void 0!==t&&xg(r,"message",Gg(t)),Bg(r,Yg,r.stack,1),arguments.length>2&&Fg(r,arguments[2]);var n=[];return jg(e,Kg,{that:n}),xg(r,"errors",n),r};Lg?Lg(Yg,Hg):Mg(Yg,Hg,{name:!0});var zg=Yg.prototype=Ug(Hg.prototype,{constructor:Vg(1,Yg),message:Vg(1,""),name:Vg(1,"AggregateError")});Dg({global:!0,constructor:!0,arity:2},{AggregateError:Yg});var Xg,Jg,Zg,Qg,qg=Mo,$g=Yl,eS=no,tS=Hs("species"),rS=Bn,iS=TypeError,nS=function(e,t){if(rS(t,e))return e;throw new iS("Incorrect invocation")},oS=yu,sS=is,aS=TypeError,cS=La,dS=function(e){if(oS(e))return e;throw new aS(sS(e)+" is not a constructor")},uS=vo,lS=Hs("species"),hS=function(e,t){var r,i=cS(e).constructor;return void 0===i||uS(r=cS(i)[lS])?t:dS(r)},pS=TypeError,fS=function(e,t){if(e<t)throw new pS("Not enough arguments");return e},mS=/(?:ipad|iphone|ipod).*applewebkit/i.test(Vo),ES=Gn,_S=zn,TS=Ca,gS=ro,SS=Ns,vS=kn,RS=fl,yS=Ul,AS=na,bS=fS,OS=mS,IS=G_,CS=ES.setImmediate,wS=ES.clearImmediate,NS=ES.process,DS=ES.Dispatch,PS=ES.Function,kS=ES.MessageChannel,LS=ES.String,MS=0,US={},xS="onreadystatechange";vS((function(){Xg=ES.location}));var VS=function(e){if(SS(US,e)){var t=US[e];delete US[e],t()}},FS=function(e){return function(){VS(e)}},BS=function(e){VS(e.data)},jS=function(e){ES.postMessage(LS(e),Xg.protocol+"//"+Xg.host)};CS&&wS||(CS=function(e){bS(arguments.length,1);var t=gS(e)?e:PS(e),r=yS(arguments,1);return US[++MS]=function(){_S(t,void 0,r)},Jg(MS),MS},wS=function(e){delete US[e]},IS?Jg=function(e){NS.nextTick(FS(e))}:DS&&DS.now?Jg=function(e){DS.now(FS(e))}:kS&&!OS?(Qg=(Zg=new kS).port2,Zg.port1.onmessage=BS,Jg=TS(Qg.postMessage,Qg)):ES.addEventListener&&gS(ES.postMessage)&&!ES.importScripts&&Xg&&"file:"!==Xg.protocol&&!vS(jS)?(Jg=jS,ES.addEventListener("message",BS,!1)):Jg=xS in AS("script")?function(e){RS.appendChild(AS("script"))[xS]=function(){RS.removeChild(this),VS(e)}}:function(e){setTimeout(FS(e),0)});var GS={set:CS,clear:wS},WS=Gn,HS=no,KS=Object.getOwnPropertyDescriptor,YS=function(e){if(!HS)return WS[e];var t=KS(WS,e);return t&&t.value},zS=function(){this.head=null,this.tail=null};zS.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 XS,JS,ZS,QS,qS,$S=zS,ev=/ipad|iphone|ipod/i.test(Vo)&&"undefined"!=typeof Pebble,tv=/web0s(?!.*chrome)/i.test(Vo),rv=Gn,iv=YS,nv=Ca,ov=GS.set,sv=$S,av=mS,cv=ev,dv=tv,uv=G_,lv=rv.MutationObserver||rv.WebKitMutationObserver,hv=rv.document,pv=rv.process,fv=rv.Promise,mv=iv("queueMicrotask");if(!mv){var Ev=new sv,_v=function(){var e,t;for(uv&&(e=pv.domain)&&e.exit();t=Ev.get();)try{t()}catch(e){throw Ev.head&&XS(),e}e&&e.enter()};av||uv||dv||!lv||!hv?!cv&&fv&&fv.resolve?((QS=fv.resolve(void 0)).constructor=fv,qS=nv(QS.then,QS),XS=function(){qS(_v)}):uv?XS=function(){pv.nextTick(_v)}:(ov=nv(ov,rv),XS=function(){ov(_v)}):(JS=!0,ZS=hv.createTextNode(""),new lv(_v).observe(ZS,{characterData:!0}),XS=function(){ZS.data=JS=!JS}),mv=function(e){Ev.head||XS(),Ev.add(e)}}var Tv=mv,gv=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Sv=Gn.Promise,vv=Gn,Rv=Sv,yv=ro,Av=Aa,bv=uu,Ov=Hs,Iv=j_,Cv=Ko,wv=Rv&&Rv.prototype,Nv=Ov("species"),Dv=!1,Pv=yv(vv.PromiseRejectionEvent),kv=Av("Promise",(function(){var e=bv(Rv),t=e!==String(Rv);if(!t&&66===Cv)return!0;if(!wv.catch||!wv.finally)return!0;if(!Cv||Cv<51||!/native code/.test(e)){var r=new Rv((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};if((r.constructor={})[Nv]=i,!(Dv=r.then((function(){}))instanceof i))return!0}return!(t||"BROWSER"!==Iv&&"DENO"!==Iv||Pv)})),Lv={CONSTRUCTOR:kv,REJECTION_EVENT:Pv,SUBCLASSING:Dv},Mv={},Uv=as,xv=TypeError,Vv=function(e){var t,r;this.promise=new e((function(e,i){if(void 0!==t||void 0!==r)throw new xv("Bad Promise constructor");t=e,r=i})),this.resolve=Uv(t),this.reject=Uv(r)};Mv.f=function(e){return new Vv(e)};var Fv,Bv,jv=sc,Gv=G_,Wv=Gn,Hv=ao,Kv=Hl,Yv=Eh,zv=function(e){var t=qg(e);eS&&t&&!t[tS]&&$g(t,tS,{configurable:!0,get:function(){return this}})},Xv=as,Jv=ro,Zv=wo,Qv=nS,qv=hS,$v=GS.set,eR=Tv,tR=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}},rR=gv,iR=$S,nR=Ph,oR=Sv,sR=Lv,aR=Mv,cR="Promise",dR=sR.CONSTRUCTOR,uR=sR.REJECTION_EVENT,lR=nR.getterFor(cR),hR=nR.set,pR=oR&&oR.prototype,fR=oR,mR=pR,ER=Wv.TypeError,_R=Wv.document,TR=Wv.process,gR=aR.f,SR=gR,vR=!!(_R&&_R.createEvent&&Wv.dispatchEvent),RR="unhandledrejection",yR=function(e){var t;return!(!Zv(e)||!Jv(t=e.then))&&t},AR=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&&wR(t),t.rejection=1),!0===a?r=o:(u&&u.enter(),r=a(o),u&&(u.exit(),n=!0)),r===e.promise?d(new ER("Promise-chain cycle")):(i=yR(r))?Hv(i,r,c,d):c(r)):d(o)}catch(e){u&&!n&&u.exit(),d(e)}},bR=function(e,t){e.notified||(e.notified=!0,eR((function(){for(var r,i=e.reactions;r=i.get();)AR(r,e);e.notified=!1,t&&!e.rejection&&IR(e)})))},OR=function(e,t,r){var i,n;vR?((i=_R.createEvent("Event")).promise=t,i.reason=r,i.initEvent(e,!1,!0),Wv.dispatchEvent(i)):i={promise:t,reason:r},!uR&&(n=Wv["on"+e])?n(i):e===RR&&tR("Unhandled promise rejection",r)},IR=function(e){Hv($v,Wv,(function(){var t,r=e.facade,i=e.value;if(CR(e)&&(t=rR((function(){Gv?TR.emit("unhandledRejection",i,r):OR(RR,r,i)})),e.rejection=Gv||CR(e)?2:1,t.error))throw t.value}))},CR=function(e){return 1!==e.rejection&&!e.parent},wR=function(e){Hv($v,Wv,(function(){var t=e.facade;Gv?TR.emit("rejectionHandled",t):OR("rejectionhandled",t,e.value)}))},NR=function(e,t,r){return function(i){e(t,i,r)}},DR=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,bR(e,!0))},PR=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw new ER("Promise can't be resolved itself");var i=yR(t);i?eR((function(){var r={done:!1};try{Hv(i,t,NR(PR,r,e),NR(DR,r,e))}catch(t){DR(r,t,e)}})):(e.value=t,e.state=1,bR(e,!1))}catch(t){DR({done:!1},t,e)}}};dR&&(mR=(fR=function(e){Qv(this,mR),Xv(e),Hv(Fv,this);var t=lR(this);try{e(NR(PR,t),NR(DR,t))}catch(e){DR(t,e)}}).prototype,(Fv=function(e){hR(this,{type:cR,done:!1,notified:!1,parent:!1,reactions:new iR,rejection:!1,state:0,value:null})}).prototype=Kv(mR,"then",(function(e,t){var r=lR(this),i=gR(qv(this,fR));return r.parent=!0,i.ok=!Jv(e)||e,i.fail=Jv(t)&&t,i.domain=Gv?TR.domain:void 0,0===r.state?r.reactions.add(i):eR((function(){AR(i,r)})),i.promise})),Bv=function(){var e=new Fv,t=lR(e);this.promise=e,this.resolve=NR(PR,t),this.reject=NR(DR,t)},aR.f=gR=function(e){return e===fR||undefined===e?new Bv(e):SR(e)}),jv({global:!0,constructor:!0,wrap:!0,forced:dR},{Promise:fR}),Yv(fR,cR,!1,!0),zv(cR);var kR=Hs("iterator"),LR=!1;try{var MR=0,UR={next:function(){return{done:!!MR++}},return:function(){LR=!0}};UR[kR]=function(){return this},Array.from(UR,(function(){throw 2}))}catch(e){}var xR=Sv,VR=function(e,t){try{if(!t&&!LR)return!1}catch(e){return!1}var r=!1;try{var i={};i[kR]=function(){return{next:function(){return{done:r=!0}}}},e(i)}catch(e){}return r},FR=Lv.CONSTRUCTOR||!VR((function(e){xR.all(e).then(void 0,(function(){}))})),BR=ao,jR=as,GR=Mv,WR=gv,HR=wg;sc({target:"Promise",stat:!0,forced:FR},{all:function(e){var t=this,r=GR.f(t),i=r.resolve,n=r.reject,o=WR((function(){var r=jR(t.resolve),o=[],s=0,a=1;HR(e,(function(e){var c=s++,d=!1;a++,BR(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 KR=sc,YR=Lv.CONSTRUCTOR;Sv&&Sv.prototype,KR({target:"Promise",proto:!0,forced:YR,real:!0},{catch:function(e){return this.then(void 0,e)}});var zR=ao,XR=as,JR=Mv,ZR=gv,QR=wg;sc({target:"Promise",stat:!0,forced:FR},{race:function(e){var t=this,r=JR.f(t),i=r.reject,n=ZR((function(){var n=XR(t.resolve);QR(e,(function(e){zR(n,t,e).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}});var qR=Mv;sc({target:"Promise",stat:!0,forced:Lv.CONSTRUCTOR},{reject:function(e){var t=qR.f(this);return(0,t.reject)(e),t.promise}});var $R=La,ey=wo,ty=Mv,ry=function(e,t){if($R(e),ey(t)&&t.constructor===e)return t;var r=ty.f(e);return(0,r.resolve)(t),r.promise},iy=sc,ny=Sv,oy=Lv.CONSTRUCTOR,sy=ry,ay=Mo("Promise"),cy=!oy;iy({target:"Promise",stat:!0,forced:true},{resolve:function(e){return sy(cy&&this===ay?ny:this,e)}});var dy=ao,uy=as,ly=Mv,hy=gv,py=wg;sc({target:"Promise",stat:!0,forced:FR},{allSettled:function(e){var t=this,r=ly.f(t),i=r.resolve,n=r.reject,o=hy((function(){var r=uy(t.resolve),n=[],o=0,s=1;py(e,(function(e){var a=o++,c=!1;s++,dy(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 fy=ao,my=as,Ey=Mo,_y=Mv,Ty=gv,gy=wg,Sy="No one promise resolved";sc({target:"Promise",stat:!0,forced:FR},{any:function(e){var t=this,r=Ey("AggregateError"),i=_y.f(t),n=i.resolve,o=i.reject,s=Ty((function(){var i=my(t.resolve),s=[],a=0,c=1,d=!1;gy(e,(function(e){var u=a++,l=!1;c++,fy(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,Sy)))}))})),--c||o(new r(s,Sy))}));return s.error&&o(s.value),i.promise}});var vy=sc,Ry=zn,yy=Ul,Ay=Mv,by=as,Oy=gv,Iy=Gn.Promise,Cy=!1;vy({target:"Promise",stat:!0,forced:!Iy||!Iy.try||Oy((function(){Iy.try((function(e){Cy=8===e}),8)})).error||!Cy},{try:function(e){var t=arguments.length>1?yy(arguments,1):[],r=Ay.f(this),i=Oy((function(){return Ry(by(e),void 0,t)}));return(i.error?r.reject:r.resolve)(i.value),r.promise}});var wy=Mv;sc({target:"Promise",stat:!0},{withResolvers:function(){var e=wy.f(this);return{promise:e.promise,resolve:e.resolve,reject:e.reject}}});var Ny=sc,Dy=Sv,Py=kn,ky=Mo,Ly=ro,My=hS,Uy=ry,xy=Dy&&Dy.prototype;Ny({target:"Promise",proto:!0,real:!0,forced:!!Dy&&Py((function(){xy.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=My(this,ky("Promise")),r=Ly(e);return this.then(r?function(r){return Uy(t,e()).then((function(){return r}))}:e,r?function(r){return Uy(t,e()).then((function(){throw r}))}:e)}});var Vy=J(No.Promise);class Fy extends fi{set _mediaStreamTrack(e){e!==this.mediaStreamTrack&&(this.safeEmit(Nd.TRACK_UPDATED,e),this.mediaStreamTrack=e)}get _mediaStreamTrack(){return this.mediaStreamTrack}constructor(e,t){super(),p_(this,"trackMediaType",void 0),p_(this,"_ID",void 0),p_(this,"_rtpTransceiver",void 0),p_(this,"_lowRtpTransceiver",void 0),p_(this,"_hints",[]),p_(this,"_isClosed",!1),p_(this,"_originMediaStreamTrack",void 0),p_(this,"mediaStreamTrack",void 0),p_(this,"_external",{}),this._ID=t||Li(8,"track-"),this._originMediaStreamTrack=e,this.mediaStreamTrack=e,Sd(this)}toString(){return this._ID}getTrackId(){return this._ID}getMediaStreamTrack(e){return e||Di((()=>{var e;In.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===Id.LOW_STREAM?this._lowRtpTransceiver:this._rtpTransceiver}getMediaStreamTrackSettings(){return this.getMediaStreamTrack(!0).getSettings()}close(){this._isClosed=!0,this._lowRtpTransceiver=void 0,this._rtpTransceiver=void 0,vd(this),this.emit(Dd.CLOSED),this.removeAllListeners(Nd.SEI_RECEIVED)}_updateRtpTransceiver(e,t){if(t===Id.LOW_STREAM){if(this._lowRtpTransceiver===e)return;this._lowRtpTransceiver=e}else{if(this._rtpTransceiver===e)return;this._rtpTransceiver=e}this.emit(Nd.TRANSCEIVER_UPDATED,e,t)}}class By extends Fy{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),p_(this,"_enabled",!0),p_(this,"_muted",!1),p_(this,"_isExternalTrack",!1),p_(this,"_isClosed",!1),p_(this,"_enabledMutex",void 0),p_(this,"processor",void 0),p_(this,"_processorContext",void 0),p_(this,"_handleTrackEnded",(()=>{this.onTrackEnded()})),this._enabledMutex=new Hi("".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,Sn.debug("[".concat(this.getTrackId(),"] close")),this.emit(bd.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,bd.NEED_REPLACE_TRACK,this),this.processor&&this._processorContext&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this._processorContext}))}_getDefaultPlayerConfig(){return{}}onTrackEnded(){Sn.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(Dd.TRACK_ENDED)}stateCheck(e,t){if(Sn.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",Sn);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",Sn)}getProcessorStats(){return this._processorContext&&this._processorContext.gatherStats()||[]}getProcessorUsage(){return this._processorContext?this._processorContext.gatherUsage():Vy.resolve([])}}function jy(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 Gy=window.AudioContext||window.webkitAudioContext;let Wy=null;const Hy=new class extends fi{constructor(){super(...arguments),p_(this,"prevState",void 0),p_(this,"curState",void 0),p_(this,"currentTime",void 0),p_(this,"currentTimeStuckAt",void 0),p_(this,"interruptDetectorTrack",void 0),p_(this,"onLocalAudioTrackMute",(()=>{Sn.info("ios15-interruption-start"),this.emit(Pn.IOS_15_16_INTERRUPTION_START)})),p_(this,"onLocalAudioTrackUnmute",(async()=>{Sn.info("ios15-interruption-end"),"running"!==this.curState||this.duringInterruption?Sn.info("ios15-interruption-end-canceled"):(Wy&&await Wy.suspend(),this.emit(Pn.IOS_15_16_INTERRUPTION_END))}))}get duringInterruption(){return"running"===this.prevState&&"interrupted"===this.curState}bindInterruptDetectorTrack(e){Sn.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){Sn.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 Ky(){if(!Gy)return void Sn.error("your browser is not support web audio");Sn.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?jy(Object(r),!0).forEach((function(t){p_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jy(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},an("WEBAUDIO_INIT_OPTIONS"));Sn.debug("audio context init option:",JSON.stringify(e)),Wy=new Gy(e),Hy.curState=Wy.state,Wy.onstatechange=()=>{Hy.prevState=Hy.curState,Hy.curState=Wy?Wy.state:void 0;const{prevState:e,curState:t}=Hy,r="running"===t,i="interrupted"===t,n="running"===e,o="suspended"===e,s="interrupted"===e,a=Dr().osVersion;(Br()||Xr())&&n&&i&&(Sn.info("ios".concat(a,"-interruption-start")),Hy.emit(Pn.IOS_INTERRUPTION_START)),(Br()||Xr())&&(o||s)&&r&&(Sn.info("ios".concat(a,"-interruption-end")),Hy.emit(Pn.IOS_INTERRUPTION_END)),e!==t&&Hy.emit(Pn.STATE_CHANGE,t,e)},setInterval((()=>{var e;const t=null===(e=Wy)||void 0===e?void 0:e.currentTime;if(Hy.currentTime!==t)Hy.currentTimeStuckAt&&(Sn.debug("AudioContext current time resume at ".concat(t)),Hy.currentTimeStuckAt=void 0),Hy.currentTime=t;else{if(t!==Hy.currentTimeStuckAt){In.reportApiInvoke(null,{name:"WEB_AUDIO_CURRENT_TIME_STUCK",options:{currentTime:t},tag:gi.TRACER}).onSuccess(),Sn.warning("AudioContext current time stuck at ".concat(t))}Hy.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):Br()||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(e){if(!o)if(r.paused)if(e){let e;h(!1),o=!0;try{e=r.play(),e?e.then(p,p):(r.addEventListener("playing",p),r.addEventListener("abort",p),r.addEventListener("error",p))}catch(e){p()}}else h(!0);else h(!1)}function h(e){if(n!==e){n=e;for(let r=0,i=t;r<i.length;r++){const t=i[r];e?window.addEventListener(t,f,{capture:!0,passive:!0}):window.removeEventListener(t,f,{capture:!0,passive:!0})}}}function p(){r.removeEventListener("playing",p),r.removeEventListener("abort",p),r.removeEventListener("error",p),o=!1,l(!1)}function f(){l(!0)}if(Br()){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,l(!0)}Hy.on(Pn.STATE_CHANGE,c),s(!1)}(Wy)}function Yy(){if(!Wy){if(Ky(),!Wy)throw new ni(ii.NOT_SUPPORTED,"can not create audio context");return Wy}return Wy}function zy(){return!!Wy}function Xy(e){if(function(){if(null!==Zy)return Zy;const e=Yy(),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(),Zy=n,n}())return;const t=e.connect,r=e.disconnect;e.connect=(r,i,n)=>{var o;return e._inputNodes||(e._inputNodes=[]),sd(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?Oi(e._inputNodes,i):e._inputNodes=[];for(const r of e._inputNodes)t.call(e,r)}}function Jy(e){const t=Yy();return new Vy(((r,i)=>{t.decodeAudioData(e,(e=>{r(e)}),(e=>{i(new ni(ii.DECODE_AUDIO_FILE_FAILED,e.toString()))}))}))}let Zy=null;let Qy=null;function qy(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 $y=J(X_);class eA{constructor(){p_(this,"context",void 0),p_(this,"analyserNode",void 0),p_(this,"sourceNode",void 0),this.context=Yy(),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||Br()||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=$y(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){Sn.warning("rebuild analyser node failed.")}}destroy(){this.updateSource(void 0)}}class tA 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(),p_(this,"outputNode",void 0),p_(this,"outputTrack",void 0),p_(this,"isPlayed",!1),p_(this,"sourceNode",void 0),p_(this,"context",void 0),p_(this,"audioBufferNode",void 0),p_(this,"destNode",void 0),p_(this,"audioOutputLevel",0),p_(this,"volumeLevelAnalyser",void 0),p_(this,"_processedNode",void 0),p_(this,"playNode",void 0),p_(this,"isDestroyed",!1),p_(this,"onNoAudioInput",void 0),p_(this,"isNoAudioInput",!1),p_(this,"_noAudioInputCount",0),this.context=Yy(),this.playNode=this.context.destination,this.outputNode=this.context.createGain(),Xy(this.outputNode),this.volumeLevelAnalyser=new eA}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(Ld.ON_AUDIO_BUFFER,qy(e))})}stopGetAudioBuffer(){this.audioBufferNode&&(this.audioBufferNode.onaudioprocess=null,this.outputNode.disconnect(this.audioBufferNode),this.audioBufferNode=void 0)}createOutputTrack(){if(!Nn().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&&Ii((()=>{Hy.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;Br()||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 ki(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 rA extends tA{get isFreeze(){return!1}constructor(e,t,r){var i;if(super(),p_(this,"sourceNode",void 0),p_(this,"track",void 0),p_(this,"clonedTrack",void 0),p_(this,"audioElement",void 0),p_(this,"isCurrentTrackCloned",!1),p_(this,"isRemoteTrack",!1),p_(this,"originVolumeLevelAnalyser",void 0),p_(this,"rebuildWebAudio",(async()=>{if(Sn.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 Sn.debug("rebuild web audio success, current volume status",this.getAccurateVolumeLevel());this.context.resume().then((()=>Sn.info("resume success"))),Sn.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),Xy(this.sourceNode),this.volumeLevelAnalyser.rebuildAnalyser();const r=this.outputNode.gain.value;this.outputNode=this.context.createGain(),this.outputNode.gain.setValueAtTime(r,this.context.currentTime),Xy(this.outputNode),this.emit(Ld.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),Xy(this.sourceNode),r){const e=r.clone();e.enabled=!0,this.clonedTrack=e,Sn.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]));Xy(t),this.originVolumeLevelAnalyser=new eA,this.originVolumeLevelAnalyser.updateSource(t)}this.connect(),this.audioElement=document.createElement("audio"),this.audioElement.srcObject=n;const o=Dr();t&&o.os===Or.IOS&&Number(null===(i=o.osVersion)||void 0===i?void 0:i.split(".")[0])<15&&(Hy.on(Pn.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),Xy(this.sourceNode),this.processedNode||this.sourceNode.connect(this.outputNode),this.emit(Ld.UPDATE_SOURCE),this.audioElement.srcObject=t}destroy(){var e;this.audioElement.srcObject=null,this.audioElement.remove(),Hy.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),Sn.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]));Xy(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 nA(e,t){const r=await oA(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 oA(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 Vy(((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 sA(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 aA=new Hi("safari");async function cA(e,t){let r=0,i=null;for(;r<2;)try{i=await dA(e,t,r>0);break}catch(e){if(e instanceof ni)throw Sn.error("[".concat(t,"] ").concat(e.toString())),e;const i=uA(e.name||e.code||e,e.message);if(i.code===ii.MEDIA_OPTION_INVALID){Sn.debug("[".concat(t,"] detect media option invalid, retry")),r+=1,await ki(500);continue}throw Sn.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 dA(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=Nn(),o=new MediaStream;if(t.audioSource&&o.addTrack(t.audioSource),t.videoSource&&o.addTrack(t.videoSource),!t.audio&&!t.video&&!t.screen)return Sn.debug("Using Video Source/ Audio Source"),o;if(t.screen)if(mi())if(t.screen.sourceId){lA(o,await iA(t.screen.sourceId,t.screen,!!t.screenAudio))}else{lA(o,await nA(t.screen,!!t.screenAudio))}else if(Ur()&&t.screen.extensionId&&t.screen.mandatory){if(!n.getStreamFromExtension)throw new ni(ii.NOT_SUPPORTED,"This browser does not support screen sharing");Sn.debug("[".concat(r,'] Screen access on chrome stable, looking for extension"'));const e=await(a=t.screen.extensionId,c=r,new Vy(((e,t)=>{try{chrome.runtime.sendMessage(a,{getStream:!0},(r=>{if(!r||!r.streamId)return Sn.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){Sn.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;lA(o,await navigator.mediaDevices.getUserMedia({video:{mandatory:t.screen.mandatory}}))}else if(n.getDisplayMedia){var s;t.screen.mediaSource&&Ad(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}=t.screen,d={selfBrowserSurface:i,surfaceSwitching:n,systemAudio:a,preferCurrentTab:c};!i&&delete d.selfBrowserSurface,!n&&delete d.surfaceSwitching,!a&&delete d.systemAudio,!c&&delete d.preferCurrentTab,Sn.debug("[".concat(r,"] getDisplayMedia:"),JSON.stringify({video:e,audio:t.screenAudio,controls:d}));const u=await navigator.mediaDevices.getDisplayMedia(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?sA(Object(r),!0).forEach((function(t){p_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({video:e,audio:t.screenAudio},d));lA(o,u)}else{if(!Fr())throw Sn.error("[".concat(r,"] This browser does not support screenSharing")),new ni(ii.NOT_SUPPORTED,"This browser does not support screen sharing");{t.screen.mediaSource&&Ad(t.screen.mediaSource);const e={video:{mediaSource:t.screen.mediaSource,width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate}};Sn.debug("[".concat(r,"] getUserMedia: ").concat(JSON.stringify(e)));lA(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=an("MEDIA_DEVICE_CONSTRAINTS");if(u)try{"string"==typeof u&&(u=JSON.parse(u)),d=Fi(d,u)}catch(e){}Sn.debug("[".concat(r,"] GetUserMedia"),JSON.stringify(d)),Dr();let l,h=null;(xr()||Br()||Mr())&&(h=await aA.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),lA(o,l),h&&h(),o}function uA(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 Sn.error("getUserMedia unexpected error",e),new ni(ii.UNEXPECTED_ERROR,"".concat(e,": ").concat(t))}}function lA(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 hA extends fi{get state(){return this._state}set state(e){e!==this._state&&(this.emit(Wd.STATE_CHANGE,e),this._state=e)}constructor(){super(),p_(this,"_state",Gd.IDLE),p_(this,"isAccessMicrophonePermission",!1),p_(this,"isAccessCameraPermission",!1),p_(this,"lastAccessMicrophonePermission",!1),p_(this,"lastAccessCameraPermission",!1),p_(this,"checkdeviceMatched",!1),p_(this,"deviceInfoMap",new Map),this.init().then((()=>{navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",this.updateDevicesInfo.bind(this)),window.setInterval((()=>{(an("ENUMERATE_DEVICES_INTERVAL")||(qr()||kr()===Or.HARMONY_OS)&&Qr())&&this.updateDevicesInfo()}),an("ENUMERATE_DEVICES_INTERVAL_TIME"))})).catch((e=>Sn.error(e.toString())))}async enumerateDevices(t,r){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices){return new ni(ii.NOT_SUPPORTED,"enumerateDevices() not supported.").throw()}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(aA.isLocked){Sn.debug("[device manager] wait GUM lock");(await aA.lock())(),Sn.debug("[device manager] GUM unlock")}if(e.HAS_GUM_AUDIO&&(s=!1,this.isAccessMicrophonePermission=!0),e.HAS_GUM_VIDEO&&(a=!1,this.isAccessCameraPermission=!0),Sn.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=uA(e.name||e.code||e,e.message);if(t.code===ii.PERMISSION_DENIED)throw t;Sn.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=uA(e.name||e.code||e,e.message);if(t.code===ii.PERMISSION_DENIED)throw t;Sn.warning("getUserMedia failed in getDevices",t)}this.isAccessMicrophonePermission=!0}else if(a){try{d=await navigator.mediaDevices.getUserMedia({video:r})}catch(e){const t=uA(e.name||e.code||e,e.message);if(t.code===ii.PERMISSION_DENIED)throw t;Sn.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0}Sn.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=Gd.INITING;try{await this.updateDevicesInfo(),this.state=Gd.INITEND}catch(e){if(Sn.warning("Device Detection functionality cannot start properly.",e.toString()),this.state=Gd.IDLE,!("boolean"==typeof isSecureContext?isSecureContext:"https:"===location.protocol||"file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname||"::1"===location.hostname)){new ni(ii.WEB_SECURITY_RESTRICT,"Your context is limited by web security, please try using https protocol or localhost.").throw()}throw 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?Sn.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is the same group")):Sn.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is not the same group")):Sn.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!==Gd.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(Wd.RECORDING_DEVICE_CHANGED,e);break;case"videoinput":this.lastAccessCameraPermission&&this.isAccessCameraPermission&&this.emit(Wd.CAMERA_DEVICE_CHANGED,e);break;case"audiooutput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(Wd.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 pA=new hA;let fA=!1;const mA=new class extends fi{constructor(){super(...arguments),p_(this,"onAutoplayFailed",void 0),p_(this,"onAudioAutoplayFailed",void 0)}};function EA(){if(Dr(),!fA){const e=t=>{t.preventDefault(),fA=!1,$r()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};fA=!0,$r()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),Sn.info("detect media autoplay failed, document: https://docs.agora.io/cn/Voice/autoplay_policy_web_ng?platform=Web"),mA.onAutoplayFailed?mA.onAutoplayFailed():mA.onAudioAutoplayFailed?Sn.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 ."):Sn.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 ."),mA.emit("autoplay-failed")}}function _A(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 TA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_A(Object(r),!0).forEach((function(t){p_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_A(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=In.getBaseInfoBySessionId(e);if(!n)return;const o=n.info,s=Date.now(),a=TA(TA({},o),{},{vid:void 0===o.vid?0:Number(o.vid),lts:s,elapse:s-n.startTime,cbRegistered:mA.onAutoplayFailed||mA.onAudioAutoplayFailed?1:-1,errorMsg:r,mediaType:t,trackId:i,extend:void 0});In.send({type:An.AUTOPLAY_FAILED,data:a},!0)}const SA=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","error"],vA=new class{constructor(){p_(this,"onAutoplayFailed",void 0),p_(this,"elementMap",new Map),p_(this,"elementStateMap",new Map),p_(this,"elementsNeedToResume",[]),p_(this,"sinkIdMap",new Map),p_(this,"autoResumeAfterInterruption",(e=>{Array.from(this.elementMap.entries()).forEach((t=>{let[r,i]=t;const n=this.elementStateMap.get(r),o=i.srcObject.getAudioTracks()[0],s=o&&o.readyState;if(Sn.debug("resume after interrupted, ele: ".concat(n," audio: ").concat(s," ").concat(e)),"live"===s){if(e)return i.pause(),void i.play();if("running"===Hy.curState)return Kr()?(i.pause(),void i.play()):void(n&&"paused"===n&&i.play())}}))})),p_(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{Array.from(this.elementMap.entries()).forEach((e=>{let[t,r]=e;const i=r.srcObject.getAudioTracks()[0];i&&"live"===i.readyState&&(Sn.debug("auto resume after interruption inside autoResumeAfterInterruptionOnIOS15"),r.pause(),r.play())}))})),this.autoResumeAudioElement(),Hy.on(Pn.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),Hy.on(Pn.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),Hy.on(Pn.STATE_CHANGE,(()=>{Br()&&"suspended"===Hy.prevState&&"running"===Hy.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,Hd.INIT),this.setVolume(t,r);const o=this.sinkIdMap.get(t);if(o)try{n.setSinkId(o).catch((e=>{Sn.warning("[".concat(t,"] set sink id failed"),e.toString())}))}catch(e){Sn.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),Sn.warning("audio element play warning",e.toString()),this.elementMap.has(t)&&"NotAllowedError"===e.name&&(Sn.warning("detected audio element autoplay failed"),this.elementsNeedToResume.push(n),Ii((()=>{this.onAutoplayFailed&&this.onAutoplayFailed(),EA()})))}))}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)}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){SA.forEach((r=>{t.addEventListener(r,(r=>{const i=this.elementStateMap.get(e),n="pause"===r.type?"paused":r.type;if(Sn.debug("[".concat(e,"] audio-element-status change ").concat(i," => ").concat(n)),"error"===r.type){const r=null==t?void 0:t.error;r&&Sn.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=>{Sn.debug("Auto resume audio element success")})).catch((e=>{Sn.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 RA(){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",Sn);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 Vy?new Vy(((e,t)=>{n.then(e).catch(t)})):n}),r}}var yA=Cc("Array","values"),AA=Wc,bA=Ns,OA=Bn,IA=yA,CA=Array.prototype,wA={DOMTokenList:!0,NodeList:!0},NA=J((function(e){var t=e.values;return e===CA||OA(CA,e)&&t===CA.values||bA(wA,AA(e))?IA:t}));function DA(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 PA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?DA(Object(r),!0).forEach((function(t){p_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):DA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class kA extends fi{constructor(e){super(),p_(this,"name","VideoProcessorDestination"),p_(this,"ID","0"),p_(this,"_source",void 0),p_(this,"videoContext",void 0),p_(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(Bd.ON_TRACK,e.track))}reset(){this.inputTrack=void 0,this.videoContext.chained=!1,this.emit(Bd.ON_TRACK,void 0)}}class LA extends fi{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t){super(),p_(this,"constraintsMap",new Map),p_(this,"statsRegistry",[]),p_(this,"usageRegistry",[]),p_(this,"trackId",void 0),p_(this,"direction",void 0),p_(this,"_chained",!1),this.trackId=e,this.direction=t}async getConstraints(){return await Ri(this,jd.REQUEST_CONSTRAINTS)}async requestApplyConstraints(e,t){var r;return Sn.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),yi(this,jd.REQUEST_UPDATE_CONSTRAINTS,Array.from(NA(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return Sn.info("processor ".concat(e.name," requestRevertConstraints for ").concat(this.trackId)),this.constraintsMap.delete(e),yi(this,jd.REQUEST_UPDATE_CONSTRAINTS,Array.from(NA(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){Sn.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 Vy&&(r=await r),e.push(PA(PA({},r),{},{direction:this.direction}))}catch(e){Sn.error("gather extension usage error",e)}return e}getDirection(){return this.direction}}class MA extends fi{constructor(e){super(),p_(this,"name","AudioProcessorDestination"),p_(this,"ID","0"),p_(this,"inputTrack",void 0),p_(this,"inputNode",void 0),p_(this,"audioProcessorContext",void 0),p_(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(Bd.ON_TRACK,void 0),this.emit(Bd.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(Bd.ON_TRACK,this.inputTrack)),e.node&&this.inputNode!==e.node&&(this.audioProcessorContext.chained=!0,this.inputNode=e.node,this.emit(Bd.ON_NODE,this.inputNode))}}class UA extends fi{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t,r){super(),p_(this,"constraintsMap",new Map),p_(this,"statsRegistry",[]),p_(this,"audioContext",void 0),p_(this,"trackId",void 0),p_(this,"direction",void 0),p_(this,"usageRegistry",[]),p_(this,"_chained",!1),this.audioContext=e,this.trackId=t,this.direction=r}async getConstraints(){return Ri(this,jd.REQUEST_CONSTRAINTS)}getAudioContext(){return this.audioContext}async requestApplyConstraints(e,t){var r;return Sn.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),yi(this,jd.REQUEST_UPDATE_CONSTRAINTS,Array.from(NA(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return this.constraintsMap.delete(e),yi(this,jd.REQUEST_UPDATE_CONSTRAINTS,Array.from(NA(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){Sn.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 Vy&&(r=await r),e.push(PA(PA({},r),{},{direction:this.direction}))}catch(e){Sn.error("gather extension usage error",e)}return e}getDirection(){return this.direction}}class xA extends fi{get isPlayed(){return!0}get isFreeze(){return!1}constructor(){super(),p_(this,"context",void 0),p_(this,"processSourceNode",void 0),p_(this,"outputTrack",void 0),p_(this,"processedNode",void 0),p_(this,"clonedTrack",void 0),p_(this,"outputNode",void 0),this.outputNode=new VA}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 VA{disconnect(){}connect(){}}function FA(e){return new Vy(((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=Br()?"canplay":"playing";n.addEventListener(o,(()=>{const e=n.videoWidth,r=n.videoHeight;!e&&Fr()||(i=!0,n.srcObject=null,n.remove(),t([e,r]))})),n.srcObject=new MediaStream([e]),n.play().catch(Mi),setTimeout((()=>{i||(n.srcObject=null,n.remove(),t([n.videoWidth,n.videoHeight]))}),4e3)}))}function BA(e){const t={};e.facingMode&&(t.facingMode=e.facingMode),e.cameraId&&(t.deviceId={exact:e.cameraId});const r=fd(e.encoderConfig);return null!=r.width&&(t.width=r.width),null!=r.height&&(t.height=r.height),!Jr()&&r.frameRate&&(t.frameRate=r.frameRate),Vr()&&"object"==typeof t.frameRate&&(t.frameRate.max=60),Fr()&&(t.frameRate={ideal:30,max:30}),t}function jA(e){const t={};e.screenSourceType&&(t.mediaSource=e.screenSourceType),e.extensionId&&Ur()&&(t.extensionId=e.extensionId);const{displaySurface:r,selfBrowserSurface:i,surfaceSwitching:n,systemAudio:o,preferCurrentTab:s}=e;(jr(107)||Wr(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)),(jr(105)||Wr(105)||Hr(91))&&o&&(si(o,"systemAudio",["exclude","include"]),t.systemAudio=o),(jr(94)||Wr(94)||Hr(80))&&s&&(t.preferCurrentTab=!0),e.electronScreenSourceId&&(t.sourceId=e.electronScreenSourceId);const a=e.encoderConfig?md(e.encoderConfig):null;return t.mandatory={chromeMediaSource:"desktop",maxWidth:a?a.width:void 0,maxHeight:a?a.height:void 0},a&&(a.frameRate&&("number"==typeof a.frameRate?(t.mandatory.maxFrameRate=a.frameRate,t.mandatory.minFrameRate=a.frameRate):(t.mandatory.maxFrameRate=a.frameRate.max||a.frameRate.ideal||a.frameRate.exact||void 0,t.mandatory.minFrameRate=a.frameRate.min||a.frameRate.ideal||a.frameRate.exact||void 0),t.frameRate=a.frameRate),a.width&&(t.width=a.width),a.height&&(t.height=a.height)),t}function GA(e){const t={};return Jr()||(void 0!==e.AGC&&(t.autoGainControl=e.AGC),void 0!==e.AEC&&(t.echoCancellation=e.AEC),void 0!==e.ANS&&(t.noiseSuppression=e.ANS,Ur()&&e.ANS&&(t.googHighpassFilter=e.ANS))),t}function WA(e){return GA(e)}function HA(e){const t=GA(e);if(e.encoderConfig){const r=Td(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 KA=is,YA=TypeError,zA=Ul,XA=Math.floor,JA=function(e,t){var r=e.length;if(r<8)for(var i,n,o=1;o<r;){for(n=o,i=e[o];n&&t(e[n-1],i)>0;)e[n]=e[--n];n!==o++&&(e[n]=i)}else for(var s=XA(r/2),a=JA(zA(e,0,s),t),c=JA(zA(e,s),t),d=a.length,u=c.length,l=0,h=0;l<d||h<u;)e[l+h]=l<d&&h<u?t(a[l],c[h])<=0?a[l++]:c[h++]:l<d?a[l++]:c[h++];return e},ZA=JA,QA=Vo.match(/firefox\/(\d+)/i),qA=!!QA&&+QA[1],$A=/MSIE|Trident/.test(Vo),eb=Vo.match(/AppleWebKit\/(\d+)\./),tb=!!eb&&+eb[1],rb=sc,ib=Fn,nb=as,ob=Is,sb=gc,ab=function(e,t){if(!delete e[t])throw new YA("Cannot delete property "+KA(t)+" of "+KA(e))},cb=Yc,db=kn,ub=ZA,lb=m_,hb=qA,pb=$A,fb=Ko,mb=tb,Eb=[],_b=ib(Eb.sort),Tb=ib(Eb.push),gb=db((function(){Eb.sort(void 0)})),Sb=db((function(){Eb.sort(null)})),vb=lb("sort"),Rb=!db((function(){if(fb)return fb<70;if(!(hb&&hb>3)){if(pb)return!0;if(mb)return mb<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++)Eb.push({k:t+i,v:r})}for(Eb.sort((function(e,t){return t.v-e.v})),i=0;i<Eb.length;i++)t=Eb[i].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return"DGBEFHACIJK"!==n}}));rb({target:"Array",proto:!0,forced:gb||!Sb||!vb||!Rb},{sort:function(e){void 0!==e&&nb(e);var t=ob(this);if(Rb)return void 0===e?_b(t):_b(t,e);var r,i,n=[],o=sb(t);for(i=0;i<o;i++)i in t&&Tb(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:cb(t)>cb(r)?1:-1}}(e)),r=sb(n),i=0;i<r;)t[i]=n[i++];for(;i<o;)ab(t,i++);return t}});var yb=Cc("Array","sort"),Ab=Bn,bb=yb,Ob=Array.prototype,Ib=J((function(e){var t=e.sort;return e===Ob||Ab(Ob,e)&&t===Ob.sort?bb:t}));function Cb(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=NA(o).call(o).next().value,c=1;if(o.has(n))a=o.get(n);else{var d;const e=Ib(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=Ib(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=an("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 m=an("VIDEO_STANDARD_BITRATE_VERSION");return m&&m>0&&(1===m?f=i:2===m?f=h:3===m&&(f=p)),[Math.floor(f/1e3),c]}function wb(e,t,r,i,n){const o=an("BITRATE_ADAPTER_TYPE");if("DEFAULT_BITRATE"===o)return{min:i,max:n};if(void 0===n){const s=Math.floor(200*Math.pow(r/15,.6)*Math.pow(e*t/640/360,.75));n="STANDARD_BITRATE"===o?4*s:2*s,i=null!=i?i:s}else i=null!=i?i:Math.floor(n/10);return{min:i,max:n}}function Nb(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 Db=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,m=1732584193,E=-271733879,_=-1732584194,T=271733878;for(u=0;u<d.length;u+=16)l=m,h=E,p=_,f=T,m=o(m,E,_,T,d[u+0],7,-680876936),T=o(T,m,E,_,d[u+1],12,-389564586),_=o(_,T,m,E,d[u+2],17,606105819),E=o(E,_,T,m,d[u+3],22,-1044525330),m=o(m,E,_,T,d[u+4],7,-176418897),T=o(T,m,E,_,d[u+5],12,1200080426),_=o(_,T,m,E,d[u+6],17,-1473231341),E=o(E,_,T,m,d[u+7],22,-45705983),m=o(m,E,_,T,d[u+8],7,1770035416),T=o(T,m,E,_,d[u+9],12,-1958414417),_=o(_,T,m,E,d[u+10],17,-42063),E=o(E,_,T,m,d[u+11],22,-1990404162),m=o(m,E,_,T,d[u+12],7,1804603682),T=o(T,m,E,_,d[u+13],12,-40341101),_=o(_,T,m,E,d[u+14],17,-1502002290),E=o(E,_,T,m,d[u+15],22,1236535329),m=s(m,E,_,T,d[u+1],5,-165796510),T=s(T,m,E,_,d[u+6],9,-1069501632),_=s(_,T,m,E,d[u+11],14,643717713),E=s(E,_,T,m,d[u+0],20,-373897302),m=s(m,E,_,T,d[u+5],5,-701558691),T=s(T,m,E,_,d[u+10],9,38016083),_=s(_,T,m,E,d[u+15],14,-660478335),E=s(E,_,T,m,d[u+4],20,-405537848),m=s(m,E,_,T,d[u+9],5,568446438),T=s(T,m,E,_,d[u+14],9,-1019803690),_=s(_,T,m,E,d[u+3],14,-187363961),E=s(E,_,T,m,d[u+8],20,1163531501),m=s(m,E,_,T,d[u+13],5,-1444681467),T=s(T,m,E,_,d[u+2],9,-51403784),_=s(_,T,m,E,d[u+7],14,1735328473),E=s(E,_,T,m,d[u+12],20,-1926607734),m=a(m,E,_,T,d[u+5],4,-378558),T=a(T,m,E,_,d[u+8],11,-2022574463),_=a(_,T,m,E,d[u+11],16,1839030562),E=a(E,_,T,m,d[u+14],23,-35309556),m=a(m,E,_,T,d[u+1],4,-1530992060),T=a(T,m,E,_,d[u+4],11,1272893353),_=a(_,T,m,E,d[u+7],16,-155497632),E=a(E,_,T,m,d[u+10],23,-1094730640),m=a(m,E,_,T,d[u+13],4,681279174),T=a(T,m,E,_,d[u+0],11,-358537222),_=a(_,T,m,E,d[u+3],16,-722521979),E=a(E,_,T,m,d[u+6],23,76029189),m=a(m,E,_,T,d[u+9],4,-640364487),T=a(T,m,E,_,d[u+12],11,-421815835),_=a(_,T,m,E,d[u+15],16,530742520),E=a(E,_,T,m,d[u+2],23,-995338651),m=c(m,E,_,T,d[u+0],6,-198630844),T=c(T,m,E,_,d[u+7],10,1126891415),_=c(_,T,m,E,d[u+14],15,-1416354905),E=c(E,_,T,m,d[u+5],21,-57434055),m=c(m,E,_,T,d[u+12],6,1700485571),T=c(T,m,E,_,d[u+3],10,-1894986606),_=c(_,T,m,E,d[u+10],15,-1051523),E=c(E,_,T,m,d[u+1],21,-2054922799),m=c(m,E,_,T,d[u+8],6,1873313359),T=c(T,m,E,_,d[u+15],10,-30611744),_=c(_,T,m,E,d[u+6],15,-1560198380),E=c(E,_,T,m,d[u+13],21,1309151649),m=c(m,E,_,T,d[u+4],6,-145523070),T=c(T,m,E,_,d[u+11],10,-1120210379),_=c(_,T,m,E,d[u+2],15,718787259),E=c(E,_,T,m,d[u+9],21,-343485551),m=i(m,l),E=i(E,h),_=i(_,p),T=i(T,f);return r(m)+r(E)+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))},Pb=e=>{const t=document.createElement("canvas");return t.width=2,t.height=2,new Vy(((r,i)=>{t.toBlob((async e=>{if(t.remove(),e){const i=await kb(e);r({buffer:i,width:t.width,height:t.height})}else i(new ni(ii.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,1)}))},kb=async e=>{const t=await e.arrayBuffer();return new Uint8Array(t)};function Lb(e,t){if("VideoFrame"in window&&"TransformStream"in window&&Nn().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 Mb,Ub,xb,Vb,Fb,Bb,jb,Gb,Wb,Hb,Kb,Yb,zb,Xb,Jb,Zb,Qb,qb,$b,eO,tO,rO,iO,nO,oO,sO,aO,cO,dO,uO,lO,hO,pO,fO,mO,EO,_O,TO,gO,SO;function vO(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 RO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vO(Object(r),!0).forEach((function(t){p_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let yO=(Mb=On({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),Ub=On({argsMap:(e,t)=>[e.getTrackId(),t]}),xb=RA(),Vb=Ki("LocalAudioTrack","_enabledMutex"),Fb=On({argsMap:(e,t)=>[e.getTrackId(),t]}),Bb=RA(),jb=Ki("LocalAudioTrack","_enabledMutex"),Gb=On({argsMap:(e,t)=>[e.getTrackId(),t]}),Wb=RA(),Hb=RA(),Kb=RA(),Yb=On({argsMap:e=>[e.getTrackId()]}),zb=RA(),Xb=On({argsMap:e=>[e.getTrackId()]}),Jb=RA(),Zb=On({argsMap:e=>[e.getTrackId()]}),Qb=On({argsMap:(e,t)=>[e.getTrackId(),t.name]}),qb=On({argsMap:e=>[e.getTrackId()]}),$b=class extends By{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?vA.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"LocalAudioTrack"}constructor(e,t,r,i){super(e,r),p_(this,"trackMediaType",kd.AUDIO),p_(this,"_encoderConfig",void 0),p_(this,"_trackSource",void 0),p_(this,"metadata",[]),p_(this,"_enabled",!0),p_(this,"_volume",100),p_(this,"_useAudioElement",!0),p_(this,"_bypassWebAudio",!1),p_(this,"processor",void 0),p_(this,"_processorContext",void 0),p_(this,"_processorDestination",void 0),p_(this,"_getOriginVolumeLevel",void 0),this._encoderConfig=t,this._getOriginVolumeLevel=!!i,this._trackSource=new xA,an("DISABLE_WEBAUDIO")&&(this._bypassWebAudio=!0),an("LOCAL_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1);xr()&&!zy()?setTimeout((()=>this.initWebAudio())):this.initWebAudio()}setVolume(e){ai(e,"volume",0,1e3),this._volume=e,this._source.setVolume(e/100),this._useAudioElement&&vA.setVolume(this.getTrackId(),e);try{if(this._bypassWebAudio)return void Sn.debug("[".concat(this.getTrackId(),"] setVolume returned because no pass through WebAudio."));const e=this._source.createOutputTrack();this._mediaStreamTrack!==e&&(this._mediaStreamTrack=e,yi(this,bd.NEED_REPLACE_TRACK,this).then((()=>{Sn.debug("[".concat(this.getTrackId(),"] replace web audio track success"))})).catch((e=>{Sn.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||!Dn())throw new ni(ii.NOT_SUPPORTED,"your browser does not support setting the audio output device");await vA.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(Sn.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){this._originMediaStreamTrack.enabled=!0;try{r||(this._enabled=!0),await yi(this,bd.NEED_ENABLE_TRACK,this),Sn.info("[".concat(this.getTrackId(),"] setEnabled to ").concat(e," success"))}catch(e){throw r||(this._enabled=!1),Sn.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}}else{this._originMediaStreamTrack.enabled=!1,r||(this._enabled=!1);try{await yi(this,bd.NEED_DISABLE_TRACK,this)}catch(e){throw r||(this._enabled=!0),Sn.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,Sn.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await yi(this,bd.NEED_MUTE_TRACK,this):await yi(this,bd.NEED_UNMUTE_TRACK,this))}getStats(){Di((()=>{Sn.warning("[deprecated] LocalAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalAudioStats instead")}),"localAudioTrackGetStatsWarning");const e=Ai(this,bd.GET_STATS);return e||RO({},Ud)}setAudioFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners(Ld.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(Ld.ON_AUDIO_BUFFER),this._source.on(Ld.ON_AUDIO_BUFFER,(t=>e(t)))}play(){Sn.debug("[".concat(this.getTrackId(),"] start audio playback")),this._useAudioElement?(Sn.debug("[".concat(this.getTrackId(),"] start audio playback in element")),vA.play(this._mediaStreamTrack,this.getTrackId(),this._volume)):this._source.play()}stop(){Sn.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._useAudioElement?vA.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];Sn.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&vA.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,bd.NEED_REPLACE_TRACK,this)):this._source.updateTrack(this._originMediaStreamTrack),this._getOriginVolumeLevel&&this._source.updateOriginTrack(e))}renewMediaStreamTrack(e){return Vy.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(Bd.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(!1),this._source.processedNode=this._source.createMediaStreamSourceNode(e),await yi(this,bd.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await yi(this,bd.NEED_REPLACE_TRACK,this))})),e.on(Bd.ON_NODE,(e=>{this._source.processedNode=e}))}unbindProcessorDestinationEvents(e){e.removeAllListeners(Bd.ON_TRACK),e.removeAllListeners(Bd.ON_NODE)}bindProcessorContextEvents(e){e.on(jd.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}unbindProcessorContextEvents(e){e.removeAllListeners(jd.REQUEST_CONSTRAINTS)}initWebAudio(){return this._trackSource instanceof xA&&(this._trackSource=new rA(this._mediaStreamTrack,!1,this._getOriginVolumeLevel?this._mediaStreamTrack:void 0)),this._trackSource}initProcessor(){const e=new UA(this._source.context,this.getTrackId(),"local"),t=new MA(e);return this._processorContext=e,this._processorDestination=t,this.bindProcessorContextEvents(e),this.bindProcessorDestinationEvents(t),this._source.on(Ld.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:e})})),this._useAudioElement&&(this._useAudioElement=!1,this.isPlaying&&(vA.stop(this.getTrackId()),this._source.play()),yi(this,bd.NEED_REPLACE_MIXING_TRACK,this).then((()=>{Sn.debug("[".concat(this.getTrackId(),"] replace from origin track to web audio track success"))})).catch((e=>{Sn.warning("[".concat(this.getTrackId(),"] replace from origin track to web audio track failed"),e)}))),{processorContext:e,processorDestination:t}}},bT($b.prototype,"setVolume",[Mb],Object.getOwnPropertyDescriptor($b.prototype,"setVolume"),$b.prototype),bT($b.prototype,"setPlaybackDevice",[Ub,xb],Object.getOwnPropertyDescriptor($b.prototype,"setPlaybackDevice"),$b.prototype),bT($b.prototype,"setEnabled",[Vb,Fb,Bb],Object.getOwnPropertyDescriptor($b.prototype,"setEnabled"),$b.prototype),bT($b.prototype,"setMuted",[jb,Gb,Wb],Object.getOwnPropertyDescriptor($b.prototype,"setMuted"),$b.prototype),bT($b.prototype,"getStats",[Hb],Object.getOwnPropertyDescriptor($b.prototype,"getStats"),$b.prototype),bT($b.prototype,"setAudioFrameCallback",[Kb],Object.getOwnPropertyDescriptor($b.prototype,"setAudioFrameCallback"),$b.prototype),bT($b.prototype,"play",[Yb,zb],Object.getOwnPropertyDescriptor($b.prototype,"play"),$b.prototype),bT($b.prototype,"stop",[Xb,Jb],Object.getOwnPropertyDescriptor($b.prototype,"stop"),$b.prototype),bT($b.prototype,"close",[Zb],Object.getOwnPropertyDescriptor($b.prototype,"close"),$b.prototype),bT($b.prototype,"pipe",[Qb],Object.getOwnPropertyDescriptor($b.prototype,"pipe"),$b.prototype),bT($b.prototype,"unpipe",[qb],Object.getOwnPropertyDescriptor($b.prototype,"unpipe"),$b.prototype),$b),AO=(eO=On({argsMap:(e,t)=>[e.getTrackId(),t]}),tO=RA(),rO=Ki("MicrophoneAudioTrack","_enabledMutex"),iO=On({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),nO=RA(),oO=On({argsMap:e=>[e.getTrackId()]}),sO=class extends yO{get __className__(){return"MicrophoneAudioTrack"}constructor(e,t,r,i){super(e,t.encoderConfig?Td(t.encoderConfig):{},i,an("GET_VOLUME_OF_MUTED_AUDIO_TRACK")),p_(this,"_config",void 0),p_(this,"_deviceName","default"),p_(this,"_constraints",void 0),p_(this,"_originalConstraints",void 0),p_(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())&&Hy.bindInterruptDetectorTrack(this)}async setDevice(e){if(Sn.info("[".concat(this.getTrackId(),"] start set device to ").concat(e)),this._enabled)try{const t=await pA.getDeviceById(e),r={};r.audio=RO({},this._constraints),r.audio.deviceId={exact:e},this._originMediaStreamTrack.stop();let i=null;try{i=await cA(r,this.getTrackId())}catch(e){throw Sn.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),i=await cA({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 Sn.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await pA.getDeviceById(e);this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(e){throw Sn.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}Sn.info("[".concat(this.getTrackId(),"] set device to ").concat(e," success"))}async setEnabled(e,t,r){if(t)return Sn.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(Sn.info("[".concat(this.getTrackId(),"] start setEnabled"),e),an("AUTO_RESET_AUDIO_ROUTE")&&(Br()||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 yi(this,bd.NEED_DISABLE_TRACK,this)}catch(e){throw Sn.error("[".concat(this.getTrackId(),"] setEnabled false failed"),e.toString()),e}return}const n=RO({},this._constraints),o=pA.searchDeviceIdByName(this._deviceName);o&&!n.deviceId&&(n.deviceId=o);try{r||(this._enabled=!0);const e=await cA({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!1),await yi(this,bd.NEED_ENABLE_TRACK,this)}catch(e){throw r||(this._enabled=!1),Sn.error("[".concat(this.getTrackId(),"] setEnabled true failed"),e.toString()),e}Sn.info("[".concat(this.getTrackId(),"] setEnabled success"))}close(){super.close(),(Kr()||Yr())&&Hy.unbindInterruptDetectorTrack(this)}onTrackEnded(){if((Br()||Xr())&&this._enabled&&!this._isClosed&&Hy.duringInterruption){const e=async()=>{Hy.off(Pn.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(Sn.debug("[".concat(this.getTrackId(),"] try capture microphone media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};Hy.on(Pn.IOS_INTERRUPTION_END,e)}else Sn.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(Dd.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=pA.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId=r),this._constraints=t,this._enabled){this._originMediaStreamTrack.stop();const e=await cA({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!0)}}bindProcessorContextEvents(e){super.bindProcessorContextEvents(e),e.on(jd.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(jd.REQUEST_UPDATE_CONSTRAINTS)}},bT(sO.prototype,"setDevice",[eO,tO],Object.getOwnPropertyDescriptor(sO.prototype,"setDevice"),sO.prototype),bT(sO.prototype,"setEnabled",[rO,iO,nO],Object.getOwnPropertyDescriptor(sO.prototype,"setEnabled"),sO.prototype),bT(sO.prototype,"close",[oO],Object.getOwnPropertyDescriptor(sO.prototype,"close"),sO.prototype),sO),bO=(aO=On({argsMap:(e,t)=>[e.getTrackId(),t,e.duration]}),cO=RA(),dO=On({argsMap:e=>[e.getTrackId()]}),uO=RA(),lO=On({argsMap:e=>[e.getTrackId()]}),hO=RA(),pO=On({argsMap:e=>[e.getTrackId()]}),fO=RA(),mO=On({argsMap:e=>[e.getTrackId()]}),EO=RA(),_O=On({argsMap:e=>[e.getTrackId()]}),TO=On({argsMap:e=>[e.getTrackId()]}),gO=RA(),bT((SO=class extends yO{get __className__(){return"BufferSourceAudioTrack"}constructor(e,t,r,i){super(t.createOutputTrack(),r,i),p_(this,"source",void 0),p_(this,"_bufferSource",void 0),this._useAudioElement=!1,this.source=e,this._bufferSource=t,this._bufferSource.on(Ld.AUDIO_SOURCE_STATE_CHANGE,(e=>{this.safeEmit(Dd.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",[aO,cO],Object.getOwnPropertyDescriptor(SO.prototype,"startProcessAudioBuffer"),SO.prototype),bT(SO.prototype,"pauseProcessAudioBuffer",[dO,uO],Object.getOwnPropertyDescriptor(SO.prototype,"pauseProcessAudioBuffer"),SO.prototype),bT(SO.prototype,"seekAudioBuffer",[lO,hO],Object.getOwnPropertyDescriptor(SO.prototype,"seekAudioBuffer"),SO.prototype),bT(SO.prototype,"resumeProcessAudioBuffer",[pO,fO],Object.getOwnPropertyDescriptor(SO.prototype,"resumeProcessAudioBuffer"),SO.prototype),bT(SO.prototype,"stopProcessAudioBuffer",[mO,EO],Object.getOwnPropertyDescriptor(SO.prototype,"stopProcessAudioBuffer"),SO.prototype),bT(SO.prototype,"close",[_O],Object.getOwnPropertyDescriptor(SO.prototype,"close"),SO.prototype),bT(SO.prototype,"setAudioBufferPlaybackSpeed",[TO,gO],Object.getOwnPropertyDescriptor(SO.prototype,"setAudioBufferPlaybackSpeed"),SO.prototype),SO);class OO extends yO{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=Yy().createMediaStreamDestination();super(e.stream.getAudioTracks()[0],void 0,Li(8,"track-mix-")),p_(this,"trackList",void 0),p_(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)?(Sn.debug("add ".concat(e.getTrackId()," to mixing track")),e._source.outputNode.connect(this.destNode),this.trackList.push(e),this.updateEncoderConfig()):Sn.debug("track ".concat(e.getTrackId()," is already added"))}removeAudioTrack(e){if(-1!==this.trackList.indexOf(e)){Sn.debug("remove ".concat(e.getTrackId()," from mixing track"));try{e._source.outputNode.disconnect(this.destNode)}catch(e){}Oi(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 OO?t.emit(Nd.TRANSCEIVER_UPDATED,e):t._updateRtpTransceiver(e)})))}}class IO extends tA{set currentState(e){e!==this._currentState&&(this._currentState=e,this.safeEmit(Ld.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(),p_(this,"audioBuffer",void 0),p_(this,"sourceNode",void 0),p_(this,"startPlayTime",0),p_(this,"startPlayOffset",0),p_(this,"pausePlayTime",0),p_(this,"options",void 0),p_(this,"currentLoopCount",0),p_(this,"currentPlaybackSpeed",100),p_(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):Sn.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 CO=new Map;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){p_(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}function DO(e,t){if(0===e.length||0===t.length)return 1/0;const r=ji(e),i=ji(t);return Math.floor(i/r)}class PO{get rendFrameRate(){const e=Math.max(1,DO(this._render_interframe_delays_sizes,this._render_interframe_delays));return Math.floor(1e3/e)}get videoElementStatus(){return this._videoElementStatus}set videoElementStatus(e){e!==this._videoElementStatus&&(Sn.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){p_(this,"trackId",void 0),p_(this,"config",void 0),p_(this,"onFirstVideoFrameDecoded",void 0),p_(this,"onVideoStateChanged",void 0),p_(this,"freezeTimeCounterList",[]),p_(this,"renderFreezeAccTime",0),p_(this,"renderFreezeAccTime2",0),p_(this,"isKeepLastFrame",!1),p_(this,"timeUpdatedCount",0),p_(this,"freezeTime",0),p_(this,"playbackTime",0),p_(this,"lastTimeUpdatedTime",0),p_(this,"autoplayFailed",!1),p_(this,"videoTrack",void 0),p_(this,"videoElement",void 0),p_(this,"cacheVideoElement",void 0),p_(this,"_render_interframe_delays",[]),p_(this,"_render_interframe_delays_sizes",[]),p_(this,"_videoState",Kd.VideoStateStopped),p_(this,"videoElementCheckInterval",void 0),p_(this,"videoElementFreezeTimeout",void 0),p_(this,"_videoElementStatus",Hd.NONE),p_(this,"isGettingVideoDimensions",!1),p_(this,"startGetVideoDimensions",(()=>{const e=()=>{if(this.isGettingVideoDimensions=!0,this.videoElement.videoWidth*this.videoElement.videoHeight>4)return Sn.debug("[".concat(this.trackId,"] current video dimensions:"),this.videoElement.videoWidth,this.videoElement.videoHeight),void(this.isGettingVideoDimensions=!1);setTimeout(e,500)};!this.isGettingVideoDimensions&&e()})),p_(this,"autoResumeAfterInterruption",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&"running"===Hy.curState&&(Sn.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()))})),p_(this,"handleVideoEvents",(e=>{switch(e.type){case"play":case"playing":this.startGetVideoDimensions(),this.videoElementStatus=Hd.PLAYING;break;case"loadeddata":if(this.videoState=Kd.VideoStateStarting,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=Hd.CANPLAY;break;case"stalled":this.videoElementStatus=Hd.STALLED;break;case"suspend":this.videoElementStatus=Hd.SUSPEND;break;case"pause":this.videoElementStatus=Hd.PAUSED,Br()||Xr()||xr()&&this.autoplayFailed||!this.videoTrack||"live"!==this.videoTrack.readyState||(Sn.debug("[track-".concat(this.trackId,"] video element paused, auto resume")),this.videoElement.play());break;case"waiting":this.videoElementStatus=Hd.WAITING;break;case"abort":this.videoElementStatus=Hd.ABORT;break;case"ended":this.videoElementStatus=Hd.ENDED;break;case"emptied":this.videoElementStatus=Hd.EMPTIED;break;case"error":{const e=this.videoElement.error;e&&(this.videoElementStatus=Hd.ERROR,Sn.error("[".concat(this.trackId,"] media error: ").concat(e.message," (").concat(e.code,")")));break}case"timeupdate":{const e=performance.now();if(this.timeUpdatedCount+=1,this.timeUpdatedCount<10)return void(this.lastTimeUpdatedTime=e);const t=e-this.lastTimeUpdatedTime,r=this.lastTimeUpdatedTime;if(this.lastTimeUpdatedTime=e,jI.lastVisibleTime<jI.lastHiddenTime||r<jI.lastHiddenTime||r<jI.lastVisibleTime)return;for(t>an("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}}})),p_(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&(Sn.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"),Hy.on(Pn.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),Hy.on(Pn.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?(Sn.warning("detected video element autoplay failed",t),this.autoplayFailed=!0,this.handleAutoPlayFailed()):Sn.warning("[".concat(this.trackId,"] play warning: "),t)}));const r=Dr();if(("Safari"===r.name&&15===Number(r.version)||Kr())&&t&&t.then){const e=()=>{this.config.mirror&&(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 Sn.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 Vy(((i,n)=>{r.toBlob((async e=>{if(r.remove(),e){const t=await kb(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 Pb(e)}destroy(){Hy.off(Pn.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),Hy.off(Pn.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),this.videoElement.srcObject=null,this.resetVideoElement(),this.freezeTimeCounterList=[],this.videoState=Kd.VideoStateStopped}initVideoElement(){if(this.videoElementStatus=Hd.INIT,!this.videoElementCheckInterval&&(kO.forEach((e=>{this.videoElement.addEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval=window.setInterval((()=>{(function(e){return e!==document.body&&document.body.contains(e)})(this.videoElement)||(this.videoElementStatus=Hd.DESTROYED)}),1e3),an("ENABLE_VIDEO_FRAME_CALLBACK"))){var e,t;let r;const i=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",i),this.videoElementFreezeTimeout=window.setTimeout(n,an("VIDEO_FREEZE_DURATION")))},n=()=>{this.videoElementFreezeTimeout=void 0,this.videoState===Kd.VideoStateDecoding&&("visible"===document.visibilityState?this.videoState=Kd.VideoStateFrozen:document.addEventListener("visibilitychange",i))},o=(e,t)=>{if(this.videoElementStatus===Hd.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=ji(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===Kd.VideoStateStarting&&(this.videoState=Kd.VideoStateDecoding),this.videoState===Kd.VideoStateDecoding&&this.onVideoStateChanged&&(this.videoElementFreezeTimeout&&window.clearTimeout(this.videoElementFreezeTimeout),this.videoElementFreezeTimeout=window.setTimeout(n,an("VIDEO_FREEZE_DURATION"))),e<an("VIDEO_FREEZE_DURATION")&&this.videoState===Kd.VideoStateFrozen&&(this.videoState=Kd.VideoStateDecoding),e>an("VIDEO_FREEZE_DURATION")&&jI.lastVisibleTime>=jI.lastHiddenTime&&r.timestamp>jI.lastVisibleTime&&r.timestamp>jI.lastHiddenTime){const t=Math.min(66,DO(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=NO(NO({},t),{},{timestamp:e})}var i,s;an("ENABLE_VIDEO_FRAME_CALLBACK")&&(null===(i=(s=this.videoElement).requestVideoFrameCallback)||void 0===i||i.call(s,o))};null===(e=(t=this.videoElement).requestVideoFrameCallback)||void 0===e||e.call(t,o)}this.videoElement.controls=!1,this.videoElement.setAttribute("playsinline",""),qr()&&!an("HIDE_NO_POSTER")&&(this.videoElement.poster="noposter");const r=Dr();if("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,Fr()&&this.videoElement.load())}else this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,Fr()&&this.videoElement.load();const i=this.videoElement.play();void 0!==i&&i.catch((e=>{Sn.debug("[".concat(this.trackId,"] playback interrupted"),e.toString())}))}resetVideoElement(){kO.forEach((e=>{this.videoElement&&this.videoElement.removeEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval&&(window.clearInterval(this.videoElementCheckInterval),this.videoElementCheckInterval=void 0),this.videoElementStatus=Hd.NONE}handleAutoPlayFailed(){const e=t=>{t.preventDefault(),this.videoElement.play().then((()=>{Sn.debug("[".concat(this.trackId,"] Video element for trackId:").concat(this.trackId," autoplay resumed."))})).catch((e=>{Sn.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)),EA()}}const kO=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","timeupdate","error"];class LO extends PO{constructor(e){super(e),p_(this,"container",void 0),p_(this,"slot",void 0),this.slot=e.element,this.updateConfig(e)}updateConfig(e){this.config=e,this.trackId=e.trackId;const t=e.element;t!==this.slot&&(this.destroy(),this.slot=t),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 Pb(e)}destroy(){if(super.destroy(),this.videoElement.remove(),this.videoElement=document.createElement("video"),this.container){try{this.container.remove(),this.slot.removeChild(this.container)}catch(e){}this.container=void 0}}createElements(){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",an("KEEP_LAST_FRAME")&&this.isKeepLastFrame&&this.videoElement.paused&&this.resetVideoElement(),this.mountedVideoElement()):this.unmountedVideoElement(),this.slot.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 MO,UO,xO,VO,FO,BO,jO,GO,WO,HO,KO,YO,zO,XO,JO,ZO,QO,qO,$O,eI,tI,rI,iI,nI,oI,sI,aI,cI,dI,uI,lI,hI,pI,fI,mI,EI;function _I(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 TI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_I(Object(r),!0).forEach((function(t){p_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_I(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let gI=(MO=On({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),UO=RA(),xO=On({argsMap:e=>[e.getTrackId()]}),VO=Ki("LocalVideoTrack","_enabledMutex"),FO=On({argsMap:(e,t)=>[e.getTrackId(),t]}),BO=RA(),jO=Ki("LocalVideoTrack","_enabledMutex"),GO=On({argsMap:(e,t)=>[e.getTrackId(),t]}),WO=RA(),HO=On({argsMap:(e,t)=>[e.getTrackId(),t,e._saveEncodeBitrateRatio]}),KO=RA(),YO=On({argsMap:(e,t)=>[e.getTrackId(),t]}),zO=RA(),XO=RA(),JO=On({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),ZO=RA(),QO=RA(),qO=RA(),$O=RA(),eI=RA(),tI=RA(),rI=RA(),iI=On({argsMap:(e,t)=>[e.getTrackId(),t.name]}),nI=On({argsMap:e=>[e.getTrackId()]}),oI=On({argsMap:e=>[e.getTrackId()]}),sI=On({argsMap:(e,t,r)=>[e.getTrackId(),t.label,r]}),aI=class e extends By{get videoHeight(){if(xr()){const{height:e}=this._mediaStreamTrack.getSettings();return this._videoHeight=e,this._videoHeight}return this._videoHeight}get videoWidth(){if(xr()){const{width:e}=this._mediaStreamTrack.getSettings();return this._videoWidth=e,this._videoWidth}return this._videoWidth}get isPlaying(){return!(!this._player||this._player.videoElementStatus!==Hd.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),p_(this,"trackMediaType",kd.VIDEO),p_(this,"_player",void 0),p_(this,"isUseScaleResolutionDownBy",!1),p_(this,"_videoVisibleTimer",null),p_(this,"_previousVideoVisibleStatus",void 0),p_(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),p_(this,"_encoderConfig",void 0),p_(this,"_scalabilityMode",{numSpatialLayers:1,numTemporalLayers:1}),p_(this,"_optimizationMode",void 0),p_(this,"_saveEncodeBitrateRatio",1),p_(this,"_videoHeight",void 0),p_(this,"_videoWidth",void 0),p_(this,"_forceBitrateLimit",void 0),p_(this,"_enabled",!0),p_(this,"_processorDestination",void 0),p_(this,"_processorContext",void 0),xr()){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(Od.CUSTOM_TRACK)?this._encoderConfig=Ci(t):this._encoderConfig=t,-1===this._hints.indexOf(Od.SCREEN_TRACK))this.updateBitrateFromProfile();else if(Gr(Ir.CHROME,115)&&-1!==kr().indexOf("Windows")){const t=Lb(e);t&&(Sn.info("local screen video track begin to inject frame"),this._mediaStreamTrack=t)}t&&-1!==this._hints.indexOf(Od.CUSTOM_TRACK)&&this.setEncoderConfiguration(t),this._processorContext=new LA(this.getTrackId(),"local"),this._processorDestination=new kA(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:(Sn.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}Sn.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=TI(TI(TI({},this._getDefaultPlayerConfig()),t),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(r):(e instanceof HTMLVideoElement?this._player=new PO(r):this._player=new LO(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(Dd.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),an("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,Sn.debug("[".concat(this.getTrackId(),"] stop video playback")))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(Sn.info("[".concat(this.getTrackId(),"] start setEnabled"),e),!e){this._originMediaStreamTrack.enabled=!1;try{await yi(this,bd.NEED_DISABLE_TRACK,this)}catch(e){throw Sn.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}return t||(this._enabled=!1),void Sn.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}this._originMediaStreamTrack.enabled=!0;try{await yi(this,bd.NEED_ENABLE_TRACK,this)}catch(e){throw Sn.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}Sn.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,Sn.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await yi(this,bd.NEED_MUTE_TRACK,this):await yi(this,bd.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),Sn.debug("[".concat(this.getTrackId(),"] set save encode bitrate ratio, ").concat(e)),this._saveEncodeBitrateRatio=1;try{await yi(this,bd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Sn)}}}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=fd(e),an("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=BA({encoderConfig:e});(xr()||Br()||Xr())&&(t.deviceId=void 0),Sn.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 Sn.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}}this._encoderConfig=e,-1===this._hints.indexOf(Od.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await yi(this,bd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Sn)}}getStats(){Di((()=>{Sn.warning("[deprecated] LocalVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalVideoStats instead")}),"localVideoTrackGetStatsWarning");const e=Ai(this,bd.GET_STATS);return e||TI({},xd)}async setBeautyEffect(e){Sn.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 Pb(e)}async setBitrateLimit(e){Sn.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 Sn.error(ii.INVALID_PARAMS,"optimization mode must be motion, detail or balanced");const t=this._optimizationMode;try{this._optimizationMode=e,await yi(this,bd.NEED_UPDATE_VIDEO_SEND_PARAMETERS,this)}catch(e){throw this._optimizationMode=t,Sn.error("[".concat(this.getTrackId(),"] set optimization mode failed"),e.toString()),e}Sn.info("[".concat(this.getTrackId(),"] set optimization mode success (").concat(e,")"))}setScalabiltyMode(e){if(1===e.numSpatialLayers&&1!==e.numTemporalLayers)return Sn.error(ii.INVALID_PARAMS,"scalability mode currently not supported, no SVC."),void(this._scalabilityMode={numSpatialLayers:1,numTemporalLayers:1});this._scalabilityMode=e,Sn.info("[".concat(this.getTrackId(),"] set scalability mode success (").concat(e,")"))}updateMediaStreamTrackResolution(){FA(this._originMediaStreamTrack).then((e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t})).catch(Mi)}_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");Sn.debug("[".concat(this.getTrackId(),"] setSenderConfiguration applyConstraints"),JSON.stringify(e)),e=fd(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(Od.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await yi(this,bd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Sn)}}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}=wb(e,t,r,n,i);if(this._encoderConfig.bitrateMin=s,this._encoderConfig.bitrateMax=o,an("VIDEO_STANDARD_BITRATE_VERSION")&&null==n&&null==i){const[i,n]=Cb(e,t,r);this._encoderConfig.bitrateMax=i,this._encoderConfig.bitrateMin=s?Math.min(s,i):i,this._saveEncodeBitrateRatio=n,Sn.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 Sn.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=In.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=TI(TI({},i),fd(t))),i=wi(i);const n=Li(8,"track-video-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,i,wi(this._scalabilityMode),this._optimizationMode,n,wi(this._hints));return t&&i&&o.setEncoderConfiguration(i),Sn.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(Di((()=>{In.reportApiInvoke(null,{name:Ti.LOCAL_VIDEO_SEND_SEI_DATA,options:[],tag:gi.TRACER}).onSuccess("")}),this._mediaStreamTrack.id||this.getTrackId()),!an("ENABLE_VIDEO_SEI")||!an("ENABLE_ENCODED_TRANSFORM"))return void Sn.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 Sn.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?this.safeEmit("sei-to-send",e):Sn.warning("SEI is not supported by ".concat(i))}bindProcessorDestinationEvents(){this.processorDestination.on(Bd.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(),await yi(this,bd.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await yi(this,bd.NEED_REPLACE_TRACK,this))}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(Bd.ON_TRACK)}unbindProcessorContextEvents(){this.processorContext.removeAllListeners(jd.REQUEST_UPDATE_CONSTRAINTS),this.processorContext.removeAllListeners(jd.REQUEST_CONSTRAINTS)}},bT(aI.prototype,"play",[MO,UO],Object.getOwnPropertyDescriptor(aI.prototype,"play"),aI.prototype),bT(aI.prototype,"stop",[xO],Object.getOwnPropertyDescriptor(aI.prototype,"stop"),aI.prototype),bT(aI.prototype,"setEnabled",[VO,FO,BO],Object.getOwnPropertyDescriptor(aI.prototype,"setEnabled"),aI.prototype),bT(aI.prototype,"setMuted",[jO,GO,WO],Object.getOwnPropertyDescriptor(aI.prototype,"setMuted"),aI.prototype),bT(aI.prototype,"setSaveEncodeBitrateRatio",[HO,KO],Object.getOwnPropertyDescriptor(aI.prototype,"setSaveEncodeBitrateRatio"),aI.prototype),bT(aI.prototype,"setEncoderConfiguration",[YO,zO],Object.getOwnPropertyDescriptor(aI.prototype,"setEncoderConfiguration"),aI.prototype),bT(aI.prototype,"getStats",[XO],Object.getOwnPropertyDescriptor(aI.prototype,"getStats"),aI.prototype),bT(aI.prototype,"setBeautyEffect",[JO,ZO],Object.getOwnPropertyDescriptor(aI.prototype,"setBeautyEffect"),aI.prototype),bT(aI.prototype,"getCurrentFrameData",[QO],Object.getOwnPropertyDescriptor(aI.prototype,"getCurrentFrameData"),aI.prototype),bT(aI.prototype,"getCurrentFrameImage",[qO],Object.getOwnPropertyDescriptor(aI.prototype,"getCurrentFrameImage"),aI.prototype),bT(aI.prototype,"setBitrateLimit",[$O],Object.getOwnPropertyDescriptor(aI.prototype,"setBitrateLimit"),aI.prototype),bT(aI.prototype,"setOptimizationMode",[eI],Object.getOwnPropertyDescriptor(aI.prototype,"setOptimizationMode"),aI.prototype),bT(aI.prototype,"setScalabiltyMode",[tI],Object.getOwnPropertyDescriptor(aI.prototype,"setScalabiltyMode"),aI.prototype),bT(aI.prototype,"updateMediaStreamTrackResolution",[rI],Object.getOwnPropertyDescriptor(aI.prototype,"updateMediaStreamTrackResolution"),aI.prototype),bT(aI.prototype,"pipe",[iI],Object.getOwnPropertyDescriptor(aI.prototype,"pipe"),aI.prototype),bT(aI.prototype,"unpipe",[nI],Object.getOwnPropertyDescriptor(aI.prototype,"unpipe"),aI.prototype),bT(aI.prototype,"close",[oI],Object.getOwnPropertyDescriptor(aI.prototype,"close"),aI.prototype),bT(aI.prototype,"replaceTrack",[sI],Object.getOwnPropertyDescriptor(aI.prototype,"replaceTrack"),aI.prototype),aI),SI=(cI=On({argsMap:(e,t)=>[e.getTrackId(),t]}),dI=RA(),uI=Ki("CameraVideoTrack","_enabledMutex"),lI=On({argsMap:(e,t)=>[e.getTrackId(),t]}),hI=RA(),pI=On({argsMap:(e,t)=>[e.getTrackId(),t]}),fI=RA(),mI=On({argsMap:e=>[e.getTrackId()]}),EI=class e extends gI{get __className__(){return"CameraVideoTrack"}constructor(e,t,r,i,n,o){super(e,fd(t.encoderConfig),i,n,o),p_(this,"_config",void 0),p_(this,"_originalConstraints",void 0),p_(this,"_constraints",void 0),p_(this,"_enabled",!0),p_(this,"_deviceName","default"),p_(this,"tryResumeVideoForIOS15_16WeChat",(async()=>{!Kr()&&!Yr()||function(){const e=Dr();if(e.os!==Or.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=2}()||Dr().name!==Ir.WECHAT||!this._enabled||this._isClosed||(Sn.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=fd(this._config.encoderConfig),Hy.on(Pn.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),Hy.on(Pn.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(Sn.info("[".concat(this.getTrackId(),"] set device to ").concat(e)),this._enabled)try{const t=await pA.getDeviceById(e),r={};r.video=TI({},this._constraints),r.video.deviceId={exact:e},r.video.facingMode=void 0,this._originMediaStreamTrack.stop();let i=null;try{i=await cA(r,this.getTrackId())}catch(e){throw Sn.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),i=await cA({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 Sn.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await pA.getDeviceById(e);this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(e){throw Sn.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}Sn.info("[".concat(this.getTrackId(),"] setDevice success"))}async _setDeviceByFacingModel(e){Sn.info("[".concat(this.getTrackId(),"] set facingMode ").concat(e));const t={video:TI(TI({},this._constraints),{},{deviceId:void 0,facingMode:{exact:e}})};if(this._enabled){this._originMediaStreamTrack.stop();let e=null;try{e=await cA(t,this.getTrackId())}catch(t){throw Sn.error("[".concat(this.getTrackId(),"] setDeviceByFacingModel failed"),t.toString()),e=await cA({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=TI({},t.video),Sn.info("[".concat(this.getTrackId(),"] setDeviceByFacingModel success"))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(Sn.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){try{if(this.isExternalTrack)this._originMediaStreamTrack.enabled=!0;else{const e=await cA({video:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1)}await yi(this,bd.NEED_ENABLE_TRACK,this)}catch(e){throw Sn.error("[".concat(this.getTrackId(),"] setEnabled true error"),e.toString()),e}this.updateMediaStreamTrackResolution(),Sn.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,bd.NEED_DISABLE_TRACK,this)}catch(e){throw Sn.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}Sn.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=fd(e),an("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=Ci(this._config);r.encoderConfig=e;const i=BA(r);(xr()||Br()||Xr())&&(i.deviceId=void 0),Sn.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 Sn.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(Od.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await yi(this,bd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Sn)}}_getDefaultPlayerConfig(){return{mirror:!0,fit:"cover"}}onTrackEnded(){if((Br()||Xr())&&this._enabled&&!this._isClosed&&Hy.duringInterruption){const e=async()=>{Hy.off(Pn.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(Sn.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};Hy.on(Pn.IOS_INTERRUPTION_END,e)}else Sn.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(Dd.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=pA.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId={exact:r}),this._enabled){const e=await cA({video:t},this.getTrackId());this._constraints=t,await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!0),this.updateMediaStreamTrackResolution()}}close(){super.close(),Hy.off(Pn.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),Hy.off(Pn.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat)}clone(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=this._encoderConfig;t&&(i=TI(TI({},i),fd(t))),i=wi(i);const n=Li(8,"track-cam-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,wi(TI(TI({},this._config),{},{encoderConfig:i})),wi(this._constraints),wi(this._scalabilityMode),this._optimizationMode,n);return t&&i&&o.setEncoderConfiguration(i),Sn.debug("clone track from ".concat(this.getTrackId()," to ").concat(n,", clone ").concat(r)),o}bindProcessorContextEvents(){this.processorContext.on(jd.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(jd.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}},bT(EI.prototype,"setDevice",[cI,dI],Object.getOwnPropertyDescriptor(EI.prototype,"setDevice"),EI.prototype),bT(EI.prototype,"setEnabled",[uI,lI,hI],Object.getOwnPropertyDescriptor(EI.prototype,"setEnabled"),EI.prototype),bT(EI.prototype,"setEncoderConfiguration",[pI,fI],Object.getOwnPropertyDescriptor(EI.prototype,"setEncoderConfiguration"),EI.prototype),bT(EI.prototype,"close",[mI],Object.getOwnPropertyDescriptor(EI.prototype,"close"),EI.prototype),EI);function vI(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?vI(Object(r),!0).forEach((function(t){p_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function yI(e,t,r,i){r.optimizationMode&&(i&&i.width&&i.height?(r.encoderConfig=RI(RI({},i),{},{bitrateMin:i.bitrateMin,bitrateMax:i.bitrateMax}),"motion"!==r.optimizationMode&&"detail"!==r.optimizationMode||(t.contentHint=r.optimizationMode,t.contentHint===r.optimizationMode?Sn.debug("[".concat(e,"] set content hint to"),r.optimizationMode):Sn.debug("[".concat(e,"] set content hint failed")))):Sn.warning("[".concat(e,"] can not apply optimization mode bitrate config, no encoderConfig")))}var AI,bI,OI,II,CI,wI,NI,DI,PI,kI,LI,MI;function UI(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 xI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?UI(Object(r),!0).forEach((function(t){p_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):UI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class VI extends Fy{getUserId(){return this._userId}constructor(e,t,r,i){super(e,"track-".concat(e.kind,"-").concat(t,"-").concat(i.clientId,"_").concat(Li(5,""))),p_(this,"_userId",void 0),p_(this,"_uintId",void 0),p_(this,"_isDestroyed",!1),p_(this,"store",void 0),p_(this,"processor",void 0),p_(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,Sn.info("[".concat(this.getTrackId(),"] is destroyed")),this.stop(),super.close()}getProcessorStats(){return this.processorContext.gatherStats()}getProcessorUsage(){return this.processorContext.gatherUsage()}}let FI=(AI=On({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),bI=On({argsMap:e=>[e.getTrackId()]}),OI=On({argsMap:(e,t)=>[e.getTrackId(),t.name]}),II=On({argsMap:e=>[e.getTrackId()]}),CI=class extends VI{get isPlaying(){return!(!this._player||this._player.videoElementStatus!==Hd.PLAYING)}get __className__(){return"RemoteVideoTrack"}constructor(e,t,r,i){super(e,t,r,i),p_(this,"_videoVisibleTimer",null),p_(this,"_previousVideoVisibleStatus",void 0),p_(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),p_(this,"trackMediaType",kd.VIDEO),p_(this,"_videoWidth",void 0),p_(this,"_videoHeight",void 0),p_(this,"_player",void 0),p_(this,"processorDestination",void 0),p_(this,"processorContext",void 0),this.updateMediaStreamTrackResolution(),this.processorContext=new LA(this.getTrackId(),"remote"),this.processorDestination=new kA(this.processorContext),this.bindProcessorDestinationEvents()}getStats(){Di((()=>{Sn.warning("[deprecated] RemoteVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteVideoStats instead")}),"remoteVideoTrackGetStatsWarning");return Ai(this,bd.GET_STATS)||xI({},Fd)}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:(Sn.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}Sn.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=xI(xI({fit:"cover"},t),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(r):(e instanceof HTMLVideoElement?this._player=new PO(r):this._player=new LO(r),this._player.updateVideoTrack(this._mediaStreamTrack),this._player.onFirstVideoFrameDecoded=()=>{this.store.subscribe(this.getUserId(),"video",void 0,void 0,Date.now()),this.safeEmit(Pd.FIRST_FRAME_DECODED)},this._player.onVideoStateChanged=e=>{this.safeEmit(Pd.VIDEO_STATE_CHANGED,e)}),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(Pd.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),an("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,Sn.debug("[".concat(this.getTrackId(),"] stop video playback")))}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}updateMediaStreamTrackResolution(){FA(this._originMediaStreamTrack).then((e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t})).catch(Mi)}_updatePlayerSource(){Sn.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=In.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(Bd.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(Bd.ON_TRACK)}_destroy(){super._destroy(),this.unbindProcessorDestinationEvents()}_onSei(e){this.emit(Nd.SEI_RECEIVED,e)}},bT(CI.prototype,"play",[AI],Object.getOwnPropertyDescriptor(CI.prototype,"play"),CI.prototype),bT(CI.prototype,"stop",[bI],Object.getOwnPropertyDescriptor(CI.prototype,"stop"),CI.prototype),bT(CI.prototype,"pipe",[OI],Object.getOwnPropertyDescriptor(CI.prototype,"pipe"),CI.prototype),bT(CI.prototype,"unpipe",[II],Object.getOwnPropertyDescriptor(CI.prototype,"unpipe"),CI.prototype),CI),BI=(wI=On({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),NI=On({argsMap:(e,t)=>[e.getTrackId(),t]}),DI=On({argsMap:e=>[e.getTrackId()]}),PI=On({argsMap:e=>[e.getTrackId()]}),kI=On({argsMap:(e,t)=>[e.getTrackId(),t.name]}),LI=On({argsMap:e=>[e.getTrackId()]}),MI=class extends VI{get isPlaying(){return this._useAudioElement?vA.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"RemoteAudioTrack"}constructor(e,t,r,i){super(e,t,r,i),p_(this,"trackMediaType",kd.AUDIO),p_(this,"_source",void 0),p_(this,"_useAudioElement",!0),p_(this,"_volume",100),p_(this,"processorContext",void 0),p_(this,"processorDestination",void 0),p_(this,"_played",!1),p_(this,"_bypassWebAudio",!1),an("DISABLE_WEBAUDIO")?(this._source=new xA,this._bypassWebAudio=!0,this._useAudioElement=!0):(this._source=new rA(e,!0),an("REMOTE_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1)),this._source.once(Ld.RECEIVE_TRACK_BUFFER,(()=>{this.safeEmit(Pd.FIRST_FRAME_DECODED)})),this.processorContext=new UA(this._source.context,this.getTrackId(),"remote"),this.processorDestination=new MA(this.processorContext),this.bindProcessorDestinationEvents(),this._source.on(Ld.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(Ld.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(Ld.ON_AUDIO_BUFFER),this._source.on(Ld.ON_AUDIO_BUFFER,(t=>e(t)))}setVolume(e){this._volume=e,this._useAudioElement?vA.setVolume(this.getTrackId(),e):this._source.setVolume(e/100)}async setPlaybackDevice(e){if(!this._useAudioElement||!Dn())throw new ni(ii.NOT_SUPPORTED,"your browser does not support setting the audio output device");await vA.setSinkID(this.getTrackId(),e)}getVolumeLevel(){return this._source.getAccurateVolumeLevel()}getStats(){Di((()=>{Sn.warning("[deprecated] RemoteAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteAudioStats instead")}),"remoteAudioTrackGetStatsWarning");return Ai(this,bd.GET_STATS)||xI({},Vd)}play(){Sn.debug("[".concat(this.getTrackId(),"] start audio playback")),this._played=!0,this._useAudioElement?(Sn.debug("[".concat(this.getTrackId(),"] use audio element to play")),vA.play(this._mediaStreamTrack,this.getTrackId(),this._volume,this.store.sessionId||void 0)):this._source.play()}stop(){Sn.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._played=!1,this._useAudioElement?vA.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];Sn.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&vA.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(Bd.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(Bd.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(Bd.ON_TRACK),this.processorDestination.removeAllListeners(Bd.ON_NODE)}},bT(MI.prototype,"setVolume",[wI],Object.getOwnPropertyDescriptor(MI.prototype,"setVolume"),MI.prototype),bT(MI.prototype,"setPlaybackDevice",[NI],Object.getOwnPropertyDescriptor(MI.prototype,"setPlaybackDevice"),MI.prototype),bT(MI.prototype,"play",[DI],Object.getOwnPropertyDescriptor(MI.prototype,"play"),MI.prototype),bT(MI.prototype,"stop",[PI],Object.getOwnPropertyDescriptor(MI.prototype,"stop"),MI.prototype),bT(MI.prototype,"pipe",[kI],Object.getOwnPropertyDescriptor(MI.prototype,"pipe"),MI.prototype),bT(MI.prototype,"unpipe",[LI],Object.getOwnPropertyDescriptor(MI.prototype,"unpipe"),MI.prototype),MI);const jI=new class extends fi{get visibility(){return document.visibilityState}get lastHiddenTime(){return this._lastHiddenTime}get lastVisibleTime(){return this._lastVisibleTime}constructor(){super(),p_(this,"_lastHiddenTime",0),p_(this,"_lastVisibleTime",0),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState?this._lastHiddenTime=performance.now():this._lastVisibleTime=performance.now(),Sn.debug("current web page is ".concat(document.visibilityState)),this.emit("VISIBILITY_CHANGE",document.visibilityState)}))}};class GI extends fi{constructor(e,t){super(),p_(this,"trackMediaType",kd.DATA),p_(this,"_version",1),p_(this,"_type",3),p_(this,"_config",void 0),p_(this,"_originDataChannel",void 0),p_(this,"_dataStreamPacketHeader",new ArrayBuffer(4)),p_(this,"_dataStreamPacketHandler",{serialize:e=>e,deserialize:e=>e}),p_(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 an("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 Vy(((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),[Yd.OPEN,Yd.CLOSE,Yd.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 WI=sc,HI=Fn,KI=mc,YI=RangeError,zI=String.fromCharCode,XI=String.fromCodePoint,JI=HI([].join);WI({target:"String",stat:!0,arity:1,forced:!!XI&&1!==XI.length},{fromCodePoint:function(e){for(var t,r=[],i=arguments.length,n=0;i>n;){if(t=+arguments[n++],KI(t,1114111)!==t)throw new YI(t+" is not a valid code point");r[n]=t<65536?zI(t):zI(55296+((t-=65536)>>10),t%1024+56320)}return JI(r,"")}});var ZI=kn,QI=Hs("iterator"),qI=!ZI((function(){var e=new URL("b?a=1&b=2&c=3","https://a"),t=e.searchParams,r=new URLSearchParams("a=1&a=2&b=3"),i="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),i+=r+e})),r.delete("a",2),r.delete("b",void 0),!e.toJSON||!r.has("a",1)||r.has("a",2)||!r.has("a",void 0)||r.has("b")||!t.size&&true||!t.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[QI]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==i||"x"!==new URL("https://x",void 0).host})),$I=Hl,eC=sc,tC=Gn,rC=YS,iC=Mo,nC=ao,oC=Fn,sC=no,aC=qI,cC=Hl,dC=Yl,uC=function(e,t,r){for(var i in t)r&&r.unsafe&&e[i]?e[i]=t[i]:$I(e,i,t[i],r);return e},lC=Eh,hC=Nm,pC=Ph,fC=nS,mC=ro,EC=Ns,_C=Ca,TC=Wc,gC=La,SC=wo,vC=Yc,RC=Dl,yC=mo,AC=lg,bC=ng,OC=oE,IC=fS,CC=ZA,wC=Hs("iterator"),NC="URLSearchParams",DC=NC+"Iterator",PC=pC.set,kC=pC.getterFor(NC),LC=pC.getterFor(DC),MC=rC("fetch"),UC=rC("Request"),xC=rC("Headers"),VC=UC&&UC.prototype,FC=xC&&xC.prototype,BC=tC.TypeError,jC=tC.encodeURIComponent,GC=String.fromCharCode,WC=iC("String","fromCodePoint"),HC=parseInt,KC=oC("".charAt),YC=oC([].join),zC=oC([].push),XC=oC("".replace),JC=oC([].shift),ZC=oC([].splice),QC=oC("".split),qC=oC("".slice),$C=oC(/./.exec),ew=/\+/g,tw=/^[0-9a-f]+$/i,rw=function(e,t){var r=qC(e,t,t+2);return $C(tw,r)?HC(r,16):NaN},iw=function(e){for(var t=0,r=128;r>0&&0!=(e&r);r>>=1)t++;return t},nw=function(e){var t=null;switch(e.length){case 1:t=e[0];break;case 2:t=(31&e[0])<<6|63&e[1];break;case 3:t=(15&e[0])<<12|(63&e[1])<<6|63&e[2];break;case 4:t=(7&e[0])<<18|(63&e[1])<<12|(63&e[2])<<6|63&e[3]}return t>1114111?null:t},ow=function(e){for(var t=(e=XC(e,ew," ")).length,r="",i=0;i<t;){var n=KC(e,i);if("%"===n){if("%"===KC(e,i+1)||i+3>t){r+="%",i++;continue}var o=rw(e,i+1);if(o!=o){r+=n,i++;continue}i+=2;var s=iw(o);if(0===s)n=GC(o);else{if(1===s||s>4){r+="�",i++;continue}for(var a=[o],c=1;c<s&&!(++i+3>t||"%"!==KC(e,i));){var d=rw(e,i+1);if(d!=d){i+=3;break}if(d>191||d<128)break;zC(a,d),i+=2,c++}if(a.length!==s){r+="�";continue}var u=nw(a);null===u?r+="�":n=WC(u)}}r+=n,i++}return r},sw=/[!'()~]|%20/g,aw={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},cw=function(e){return aw[e]},dw=function(e){return XC(jC(e),sw,cw)},uw=hC((function(e,t){PC(this,{type:DC,target:kC(e).entries,index:0,kind:t})}),NC,(function(){var e=LC(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,OC(void 0,!0);var i=t[r];switch(e.kind){case"keys":return OC(i.key,!1);case"values":return OC(i.value,!1)}return OC([i.key,i.value],!1)}),!0),lw=function(e){this.entries=[],this.url=null,void 0!==e&&(SC(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===KC(e,0)?qC(e,1):e:vC(e)))};lw.prototype={type:NC,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,i,n,o,s,a,c=this.entries,d=bC(e);if(d)for(r=(t=AC(e,d)).next;!(i=nC(r,t)).done;){if(o=(n=AC(gC(i.value))).next,(s=nC(o,n)).done||(a=nC(o,n)).done||!nC(o,n).done)throw new BC("Expected sequence with length 2");zC(c,{key:vC(s.value),value:vC(a.value)})}else for(var u in e)EC(e,u)&&zC(c,{key:u,value:vC(e[u])})},parseQuery:function(e){if(e)for(var t,r,i=this.entries,n=QC(e,"&"),o=0;o<n.length;)(t=n[o++]).length&&(r=QC(t,"="),zC(i,{key:ow(JC(r)),value:ow(YC(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],i=0;i<t.length;)e=t[i++],zC(r,dw(e.key)+"="+dw(e.value));return YC(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var hw=function(){fC(this,pw);var e=PC(this,new lw(arguments.length>0?arguments[0]:void 0));sC||(this.size=e.entries.length)},pw=hw.prototype;if(uC(pw,{append:function(e,t){var r=kC(this);IC(arguments.length,2),zC(r.entries,{key:vC(e),value:vC(t)}),sC||this.length++,r.updateURL()},delete:function(e){for(var t=kC(this),r=IC(arguments.length,1),i=t.entries,n=vC(e),o=r<2?void 0:arguments[1],s=void 0===o?o:vC(o),a=0;a<i.length;){var c=i[a];if(c.key!==n||void 0!==s&&c.value!==s)a++;else if(ZC(i,a,1),void 0!==s)break}sC||(this.size=i.length),t.updateURL()},get:function(e){var t=kC(this).entries;IC(arguments.length,1);for(var r=vC(e),i=0;i<t.length;i++)if(t[i].key===r)return t[i].value;return null},getAll:function(e){var t=kC(this).entries;IC(arguments.length,1);for(var r=vC(e),i=[],n=0;n<t.length;n++)t[n].key===r&&zC(i,t[n].value);return i},has:function(e){for(var t=kC(this).entries,r=IC(arguments.length,1),i=vC(e),n=r<2?void 0:arguments[1],o=void 0===n?n:vC(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=kC(this);IC(arguments.length,1);for(var i,n=r.entries,o=!1,s=vC(e),a=vC(t),c=0;c<n.length;c++)(i=n[c]).key===s&&(o?ZC(n,c--,1):(o=!0,i.value=a));o||zC(n,{key:s,value:a}),sC||(this.size=n.length),r.updateURL()},sort:function(){var e=kC(this);CC(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=kC(this).entries,i=_C(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 uw(this,"keys")},values:function(){return new uw(this,"values")},entries:function(){return new uw(this,"entries")}},{enumerable:!0}),cC(pw,wC,pw.entries,{name:"entries"}),cC(pw,"toString",(function(){return kC(this).serialize()}),{enumerable:!0}),sC&&dC(pw,"size",{get:function(){return kC(this).entries.length},configurable:!0,enumerable:!0}),lC(hw,NC),eC({global:!0,constructor:!0,forced:!aC},{URLSearchParams:hw}),!aC&&mC(xC)){var fw=oC(FC.has),mw=oC(FC.set),Ew=function(e){if(SC(e)){var t,r=e.body;if(TC(r)===NC)return t=e.headers?new xC(e.headers):new xC,fw(t,"content-type")||mw(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),RC(e,{body:yC(0,vC(r)),headers:yC(0,t)})}return e};if(mC(MC)&&eC({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return MC(e,arguments.length>1?Ew(arguments[1]):{})}}),mC(UC)){var _w=function(e){return fC(this,VC),new UC(e,arguments.length>1?Ew(arguments[1]):{})};VC.constructor=_w,_w.prototype=VC,eC({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:_w})}}var Tw,gw={URLSearchParams:hw,getState:kC},Sw=no,vw=Fn,Rw=ao,yw=kn,Aw=sl,bw=Gl,Ow=co,Iw=Is,Cw=So,ww=Object.assign,Nw=Object.defineProperty,Dw=vw([].concat),Pw=!ww||yw((function(){if(Sw&&1!==ww({b:1},ww(Nw({},"a",{enumerable:!0,get:function(){Nw(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol("assign detection"),i="abcdefghijklmnopqrst";return e[r]=7,i.split("").forEach((function(e){t[e]=e})),7!==ww({},e)[r]||Aw(ww({},t)).join("")!==i}))?function(e,t){for(var r=Iw(e),i=arguments.length,n=1,o=bw.f,s=Ow.f;i>n;)for(var a,c=Cw(arguments[n++]),d=o?Dw(Aw(c),o(c)):Aw(c),u=d.length,l=0;u>l;)a=d[l++],Sw&&!Rw(s,c,a)||(r[a]=c[a]);return r}:ww,kw=La,Lw=mg,Mw=Ca,Uw=ao,xw=Is,Vw=function(e,t,r,i){try{return i?t(kw(r)[0],r[1]):t(r)}catch(t){Lw(e,"throw",t)}},Fw=qT,Bw=yu,jw=gc,Gw=su,Ww=lg,Hw=ng,Kw=Array,Yw=Fn,zw=2147483647,Xw=/[^\0-\u007E]/,Jw=/[.\u3002\uFF0E\uFF61]/g,Zw="Overflow: input needs wider integers to process",Qw=RangeError,qw=Yw(Jw.exec),$w=Math.floor,eN=String.fromCharCode,tN=Yw("".charCodeAt),rN=Yw([].join),iN=Yw([].push),nN=Yw("".replace),oN=Yw("".split),sN=Yw("".toLowerCase),aN=function(e){return e+22+75*(e<26)},cN=function(e,t,r){var i=0;for(e=r?$w(e/700):e>>1,e+=$w(e/t);e>455;)e=$w(e/35),i+=36;return $w(i+36*e/(e+38))},dN=function(e){var t=[];e=function(e){for(var t=[],r=0,i=e.length;r<i;){var n=tN(e,r++);if(n>=55296&&n<=56319&&r<i){var o=tN(e,r++);56320==(64512&o)?iN(t,((1023&n)<<10)+(1023&o)+65536):(iN(t,n),r--)}else iN(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&&iN(t,eN(i));var c=t.length,d=c;for(c&&iN(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>$w((zw-s)/l))throw new Qw(Zw);for(s+=(u-o)*l,o=u,r=0;r<e.length;r++){if((i=e[r])<o&&++s>zw)throw new Qw(Zw);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 m=h-f,E=36-f;iN(t,eN(aN(f+m%E))),h=$w(m/E),p+=36}iN(t,eN(aN(h))),a=cN(s,l,d===c),s=0,d++}}s++,o++}return rN(t,"")},uN=sc,lN=no,hN=qI,pN=Gn,fN=Ca,mN=Fn,EN=Hl,_N=Yl,TN=nS,gN=Ns,SN=Pw,vN=function(e){var t=xw(e),r=Bw(this),i=arguments.length,n=i>1?arguments[1]:void 0,o=void 0!==n;o&&(n=Mw(n,i>2?arguments[2]:void 0));var s,a,c,d,u,l,h=Hw(t),p=0;if(!h||this===Kw&&Fw(h))for(s=jw(t),a=r?new this(s):Kw(s);s>p;p++)l=o?n(t[p],p):t[p],Gw(a,p,l);else for(a=r?new this:[],u=(d=Ww(t,h)).next;!(c=Uw(u,d)).done;p++)l=o?Vw(d,n,[c.value,p],!0):c.value,Gw(a,p,l);return a.length=p,a},RN=Ul,yN=e_.codeAt,AN=function(e){var t,r,i=[],n=oN(nN(sN(e),Jw,"."),".");for(t=0;t<n.length;t++)r=n[t],iN(i,qw(Xw,r)?"xn--"+dN(r):r);return rN(i,".")},bN=Yc,ON=Eh,IN=fS,CN=gw,wN=Ph,NN=wN.set,DN=wN.getterFor("URL"),PN=CN.URLSearchParams,kN=CN.getState,LN=pN.URL,MN=pN.TypeError,UN=pN.parseInt,xN=Math.floor,VN=Math.pow,FN=mN("".charAt),BN=mN(/./.exec),jN=mN([].join),GN=mN(1..toString),WN=mN([].pop),HN=mN([].push),KN=mN("".replace),YN=mN([].shift),zN=mN("".split),XN=mN("".slice),JN=mN("".toLowerCase),ZN=mN([].unshift),QN="Invalid scheme",qN="Invalid host",$N="Invalid port",eD=/[a-z]/i,tD=/[\d+-.a-z]/i,rD=/\d/,iD=/^0x/i,nD=/^[0-7]+$/,oD=/^\d+$/,sD=/^[\da-f]+$/i,aD=/[\0\t\n\r #%/:<>?@[\\\]^|]/,cD=/[\0\t\n\r #/:<>?@[\\\]^|]/,dD=/^[\u0000-\u0020]+/,uD=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,lD=/[\t\n\r]/g,hD=function(e){var t,r,i,n;if("number"==typeof e){for(t=[],r=0;r<4;r++)ZN(t,e%256),e=xN(e/256);return jN(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?i:t}(e),r=0;r<8;r++)n&&0===e[r]||(n&&(n=!1),i===r?(t+=r?":":"::",n=!0):(t+=GN(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},pD={},fD=SN({},pD,{" ":1,'"':1,"<":1,">":1,"`":1}),mD=SN({},fD,{"#":1,"?":1,"{":1,"}":1}),ED=SN({},mD,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),_D=function(e,t){var r=yN(e,0);return r>32&&r<127&&!gN(t,e)?e:encodeURIComponent(e)},TD={ftp:21,file:null,http:80,https:443,ws:80,wss:443},gD=function(e,t){var r;return 2===e.length&&BN(eD,FN(e,0))&&(":"===(r=FN(e,1))||!t&&"|"===r)},SD=function(e){var t;return e.length>1&&gD(XN(e,0,2))&&(2===e.length||"/"===(t=FN(e,2))||"\\"===t||"?"===t||"#"===t)},vD=function(e){return"."===e||"%2e"===JN(e)},RD={},yD={},AD={},bD={},OD={},ID={},CD={},wD={},ND={},DD={},PD={},kD={},LD={},MD={},UD={},xD={},VD={},FD={},BD={},jD={},GD={},WD=function(e,t,r){var i,n,o,s=bN(e);if(t){if(n=this.parse(s))throw new MN(n);this.searchParams=null}else{if(void 0!==r&&(i=new WD(r,!0)),n=this.parse(s,null,i))throw new MN(n);(o=kN(new PN)).bindURL(this),this.searchParams=o}};WD.prototype={type:"URL",parse:function(e,t,r){var i,n,o,s,a,c=this,d=t||RD,u=0,l="",h=!1,p=!1,f=!1;for(e=bN(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=KN(e,dD,""),e=KN(e,uD,"$1")),e=KN(e,lD,""),i=vN(e);u<=i.length;){switch(n=i[u],d){case RD:if(!n||!BN(eD,n)){if(t)return QN;d=AD;continue}l+=JN(n),d=yD;break;case yD:if(n&&(BN(tD,n)||"+"===n||"-"===n||"."===n))l+=JN(n);else{if(":"!==n){if(t)return QN;l="",d=AD,u=0;continue}if(t&&(c.isSpecial()!==gN(TD,l)||"file"===l&&(c.includesCredentials()||null!==c.port)||"file"===c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&TD[c.scheme]===c.port&&(c.port=null));l="","file"===c.scheme?d=MD:c.isSpecial()&&r&&r.scheme===c.scheme?d=bD:c.isSpecial()?d=wD:"/"===i[u+1]?(d=OD,u++):(c.cannotBeABaseURL=!0,HN(c.path,""),d=BD)}break;case AD:if(!r||r.cannotBeABaseURL&&"#"!==n)return QN;if(r.cannotBeABaseURL&&"#"===n){c.scheme=r.scheme,c.path=RN(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,d=GD;break}d="file"===r.scheme?MD:ID;continue;case bD:if("/"!==n||"/"!==i[u+1]){d=ID;continue}d=ND,u++;break;case OD:if("/"===n){d=DD;break}d=FD;continue;case ID:if(c.scheme=r.scheme,n===Tw)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=RN(r.path),c.query=r.query;else if("/"===n||"\\"===n&&c.isSpecial())d=CD;else if("?"===n)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=RN(r.path),c.query="",d=jD;else{if("#"!==n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=RN(r.path),c.path.length--,d=FD;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=RN(r.path),c.query=r.query,c.fragment="",d=GD}break;case CD:if(!c.isSpecial()||"/"!==n&&"\\"!==n){if("/"!==n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,d=FD;continue}d=DD}else d=ND;break;case wD:if(d=ND,"/"!==n||"/"!==FN(l,u+1))continue;u++;break;case ND:if("/"!==n&&"\\"!==n){d=DD;continue}break;case DD:if("@"===n){h&&(l="%40"+l),h=!0,o=vN(l);for(var m=0;m<o.length;m++){var E=o[m];if(":"!==E||f){var _=_D(E,ED);f?c.password+=_:c.username+=_}else f=!0}l=""}else if(n===Tw||"/"===n||"?"===n||"#"===n||"\\"===n&&c.isSpecial()){if(h&&""===l)return"Invalid authority";u-=vN(l).length+1,l="",d=PD}else l+=n;break;case PD:case kD:if(t&&"file"===c.scheme){d=xD;continue}if(":"!==n||p){if(n===Tw||"/"===n||"?"===n||"#"===n||"\\"===n&&c.isSpecial()){if(c.isSpecial()&&""===l)return qN;if(t&&""===l&&(c.includesCredentials()||null!==c.port))return;if(s=c.parseHost(l))return s;if(l="",d=VD,t)return;continue}"["===n?p=!0:"]"===n&&(p=!1),l+=n}else{if(""===l)return qN;if(s=c.parseHost(l))return s;if(l="",d=LD,t===kD)return}break;case LD:if(!BN(rD,n)){if(n===Tw||"/"===n||"?"===n||"#"===n||"\\"===n&&c.isSpecial()||t){if(""!==l){var T=UN(l,10);if(T>65535)return $N;c.port=c.isSpecial()&&T===TD[c.scheme]?null:T,l=""}if(t)return;d=VD;continue}return $N}l+=n;break;case MD:if(c.scheme="file","/"===n||"\\"===n)d=UD;else{if(!r||"file"!==r.scheme){d=FD;continue}switch(n){case Tw:c.host=r.host,c.path=RN(r.path),c.query=r.query;break;case"?":c.host=r.host,c.path=RN(r.path),c.query="",d=jD;break;case"#":c.host=r.host,c.path=RN(r.path),c.query=r.query,c.fragment="",d=GD;break;default:SD(jN(RN(i,u),""))||(c.host=r.host,c.path=RN(r.path),c.shortenPath()),d=FD;continue}}break;case UD:if("/"===n||"\\"===n){d=xD;break}r&&"file"===r.scheme&&!SD(jN(RN(i,u),""))&&(gD(r.path[0],!0)?HN(c.path,r.path[0]):c.host=r.host),d=FD;continue;case xD:if(n===Tw||"/"===n||"\\"===n||"?"===n||"#"===n){if(!t&&gD(l))d=FD;else if(""===l){if(c.host="",t)return;d=VD}else{if(s=c.parseHost(l))return s;if("localhost"===c.host&&(c.host=""),t)return;l="",d=VD}continue}l+=n;break;case VD:if(c.isSpecial()){if(d=FD,"/"!==n&&"\\"!==n)continue}else if(t||"?"!==n)if(t||"#"!==n){if(n!==Tw&&(d=FD,"/"!==n))continue}else c.fragment="",d=GD;else c.query="",d=jD;break;case FD:if(n===Tw||"/"===n||"\\"===n&&c.isSpecial()||!t&&("?"===n||"#"===n)){if(".."===(a=JN(a=l))||"%2e."===a||".%2e"===a||"%2e%2e"===a?(c.shortenPath(),"/"===n||"\\"===n&&c.isSpecial()||HN(c.path,"")):vD(l)?"/"===n||"\\"===n&&c.isSpecial()||HN(c.path,""):("file"===c.scheme&&!c.path.length&&gD(l)&&(c.host&&(c.host=""),l=FN(l,0)+":"),HN(c.path,l)),l="","file"===c.scheme&&(n===Tw||"?"===n||"#"===n))for(;c.path.length>1&&""===c.path[0];)YN(c.path);"?"===n?(c.query="",d=jD):"#"===n&&(c.fragment="",d=GD)}else l+=_D(n,mD);break;case BD:"?"===n?(c.query="",d=jD):"#"===n?(c.fragment="",d=GD):n!==Tw&&(c.path[0]+=_D(n,pD));break;case jD:t||"#"!==n?n!==Tw&&("'"===n&&c.isSpecial()?c.query+="%27":c.query+="#"===n?"%23":_D(n,pD)):(c.fragment="",d=GD);break;case GD:n!==Tw&&(c.fragment+=_D(n,fD))}u++}},parseHost:function(e){var t,r,i;if("["===FN(e,0)){if("]"!==FN(e,e.length-1))return qN;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 FN(e,l)};if(":"===h()){if(":"!==FN(e,1))return;l+=2,u=++d}for(;h();){if(8===d)return;if(":"!==h()){for(t=r=0;r<4&&BN(sD,h());)t=16*t+UN(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(!BN(rD,h()))return;for(;BN(rD,h());){if(o=UN(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}(XN(e,1,-1)),!t)return qN;this.host=t}else if(this.isSpecial()){if(e=AN(e),BN(aD,e))return qN;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"===FN(n,0)&&(o=BN(iD,n)?16:8,n=XN(n,8===o?1:2)),""===n)s=0;else{if(!BN(10===o?oD:8===o?nD:sD,n))return e;s=UN(n,o)}HN(r,s)}for(i=0;i<t;i++)if(s=r[i],i===t-1){if(s>=VN(256,5-t))return null}else if(s>255)return null;for(a=WN(r),i=0;i<r.length;i++)a+=r[i]*VN(256,3-i);return a}(e),null===t)return qN;this.host=t}else{if(BN(cD,e))return qN;for(t="",r=vN(e),i=0;i<r.length;i++)t+=_D(r[i],pD);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return gN(TD,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"===this.scheme&&1===t&&gD(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+=hD(n),null!==o&&(d+=":"+o)):"file"===t&&(d+="//"),d+=e.cannotBeABaseURL?s[0]:s.length?"/"+jN(s,"/"):"",null!==a&&(d+="?"+a),null!==c&&(d+="#"+c),d},setHref:function(e){var t=this.parse(e);if(t)throw new MN(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new HD(e.path[0]).origin}catch(e){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+hD(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(bN(e)+":",RD)},getUsername:function(){return this.username},setUsername:function(e){var t=vN(bN(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=_D(t[r],ED)}},getPassword:function(){return this.password},setPassword:function(e){var t=vN(bN(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=_D(t[r],ED)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?hD(e):hD(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,PD)},getHostname:function(){var e=this.host;return null===e?"":hD(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,kD)},getPort:function(){var e=this.port;return null===e?"":bN(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=bN(e))?this.port=null:this.parse(e,LD))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+jN(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,VD))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=bN(e))?this.query=null:("?"===FN(e,0)&&(e=XN(e,1)),this.query="",this.parse(e,jD)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=bN(e))?("#"===FN(e,0)&&(e=XN(e,1)),this.fragment="",this.parse(e,GD)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var HD=function(e){var t=TN(this,KD),r=IN(arguments.length,1)>1?arguments[1]:void 0,i=NN(t,new WD(e,!1,r));lN||(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())},KD=HD.prototype,YD=function(e,t){return{get:function(){return DN(this)[e]()},set:t&&function(e){return DN(this)[t](e)},configurable:!0,enumerable:!0}};if(lN&&(_N(KD,"href",YD("serialize","setHref")),_N(KD,"origin",YD("getOrigin")),_N(KD,"protocol",YD("getProtocol","setProtocol")),_N(KD,"username",YD("getUsername","setUsername")),_N(KD,"password",YD("getPassword","setPassword")),_N(KD,"host",YD("getHost","setHost")),_N(KD,"hostname",YD("getHostname","setHostname")),_N(KD,"port",YD("getPort","setPort")),_N(KD,"pathname",YD("getPathname","setPathname")),_N(KD,"search",YD("getSearch","setSearch")),_N(KD,"searchParams",YD("getSearchParams")),_N(KD,"hash",YD("getHash","setHash"))),EN(KD,"toJSON",(function(){return DN(this).serialize()}),{enumerable:!0}),EN(KD,"toString",(function(){return DN(this).serialize()}),{enumerable:!0}),LN){var zD=LN.createObjectURL,XD=LN.revokeObjectURL;zD&&EN(HD,"createObjectURL",fN(zD,LN)),XD&&EN(HD,"revokeObjectURL",fN(XD,LN))}ON(HD,"URL"),uN({global:!0,constructor:!0,forced:!hN,sham:!lN},{URL:HD});var JD=sc,ZD=kn,QD=fS,qD=Yc,$D=qI,eP=Mo("URL"),tP=$D&&ZD((function(){eP.canParse()})),rP=ZD((function(){return 1!==eP.canParse.length}));JD({target:"URL",stat:!0,forced:!tP||rP},{canParse:function(e){var t=QD(arguments.length,1),r=qD(e),i=t<2||void 0===arguments[1]?void 0:qD(arguments[1]);try{return!!new eP(r,i)}catch(e){return!1}}});var iP=sc,nP=fS,oP=Yc,sP=qI,aP=Mo("URL");iP({target:"URL",stat:!0,forced:!sP},{parse:function(e){var t=nP(arguments.length,1),r=oP(e),i=t<2||void 0===arguments[1]?void 0:oP(arguments[1]);try{return new aP(r,i)}catch(e){return null}}});var cP=J(No.URL);function dP(){const e=new Blob([atob("ZnVuY3Rpb24gdCh0LGUsbil7bGV0IGE9bmV3IFVpbnQ4QXJyYXkodCxlLG4pLG89W10scj0wO2Zvcig7by5sZW5ndGg8bjspciszPG4mJjA9PT1hW3JdJiYwPT09YVtyKzFdJiYzPT09YVtyKzJdJiYoMD09PWFbciszXXx8MT09PWFbciszXXx8Mj09PWFbciszXXx8Mz09PWFbciszXSk/KG8ucHVzaChhW3JdLGFbcisxXSxhW3IrM10pLHIrPTQpOihvLnB1c2goYVtyXSkscisrKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkobyl9ZnVuY3Rpb24gZSh0LGUpe2NvbnN0IG49ZnVuY3Rpb24odCl7Y29uc3QgZT10Lmxlbmd0aDtsZXQgbj1bXSxhPTA7Zm9yKDthPGU7KWErMjxlJiYwPT09dFthXSYmMD09PXRbYSsxXSYmKDA9PT10W2ErMl18fDE9PT10W2ErMl18fDI9PT10W2ErMl18fDM9PT10W2ErMl0pPyhuLnB1c2godFthXSx0W2ErMV0sMyx0W2ErMl0pLGErPTMpOihuLnB1c2godFthXSksYSsrKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkobil9KGUpLGE9bi5sZW5ndGgsbz1NYXRoLmZsb29yKGEvMjU1KSxyPWElMjU1LHM9bmV3IFVpbnQ4QXJyYXkoNitvKzErYSt0LmJ5dGVMZW5ndGgpO3NbMF09MCxzWzFdPTAsc1syXT0wLHNbM109MSxzWzRdPTYsc1s1XT0xMDE7bGV0IGk9MDtmb3IoO2k8bzspc1s2K2ldPTI1NSxpKys7cmV0dXJuIHNbNitpXT1yLGkrKyxzLnNldChuLDYraSkscy5zZXQobmV3IFVpbnQ4QXJyYXkodCksNitpK2EpLHMuYnVmZmVyfWNvbnN0IG49NzEsYT0xLG89MixyPTEscz0yO3ZhciBpOyFmdW5jdGlvbih0KXt0W3QuQVVESU9fTEVWRUw9MV09IkFVRElPX0xFVkVMIix0W3QuTUVUQURBVEE9Ml09Ik1FVEFEQVRBIix0W3QuQVVESU9fNjRfQklUX1BUUz0zXT0iQVVESU9fNjRfQklUX1BUUyJ9KGl8fChpPXt9KSk7bmF2aWdhdG9yLnVzZXJBZ2VudC5pbmRleE9mKCJTYWZhcmkiKT4tMSYmLTE9PT1uYXZpZ2F0b3IudXNlckFnZW50LmluZGV4T2YoIkNocm9tZSIpJiYoc2VsZi5vbnJ0Y3RyYW5zZm9ybT1mPT57Y29uc3QgdT1mLnRyYW5zZm9ybWVyO2xldCBkPVtdLGw9W107dS5vcHRpb25zLnBvcnQub25tZXNzYWdlPXQ9Pnt0LmRhdGEuc2VpJiZkLnB1c2godC5kYXRhLnNlaSksdC5kYXRhLm1ldGFkYXRhJiZsLnB1c2godC5kYXRhLm1ldGFkYXRhKX0sc2VsZi5wb3N0TWVzc2FnZSgic3RhcnRlZCIpO2NvbnN0IGc9dS5yZWFkYWJsZS5nZXRSZWFkZXIoKSxjPXUud3JpdGFibGUuZ2V0V3JpdGVyKCk7InNlaS1yeCI9PT11Lm9wdGlvbnMubmFtZT9mdW5jdGlvbiBlKG4pe2cucmVhZCgpLnRoZW4oKGE9PntpZighYS5kb25lKXtpZihhLnZhbHVlIGluc3RhbmNlb2YgUlRDRW5jb2RlZFZpZGVvRnJhbWUpe2NvbnN0IGU9ZnVuY3Rpb24oZSl7Y29uc3Qgbj1uZXcgRGF0YVZpZXcoZS5kYXRhKTtsZXQgYT0wO2Zvcig7YSs0PGUuZGF0YS5ieXRlTGVuZ3RoOyl7aWYoMD09PW4uZ2V0VWludDgoYSswKSYmMD09PW4uZ2V0VWludDgoYSsxKSYmMD09PW4uZ2V0VWludDgoYSsyKSYmMT09PW4uZ2V0VWludDgoYSszKSYmNj09PW4uZ2V0VWludDgoYSs0KSl7bGV0IG89YSs2LHI9MCxzPTA7Zm9yKDsyNTU9PT0ocz1uLmdldFVpbnQ4KG8rKykpOylyKz0yNTU7cis9cztjb25zdCBpPXQoZS5kYXRhLG8scik7cmV0dXJuIG5ldyBVaW50OEFycmF5KGkpfWErK31yZXR1cm4gbnVsbH0oYS52YWx1ZSk7ZSYmbi5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe3NlaTplfSl9Yy53cml0ZShhLnZhbHVlKSxuLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7dHJhbnNmb3JtZWQ6ITB9KSxlKG4pfX0pKX0odSk6InNlaS10eCI9PT11Lm9wdGlvbnMubmFtZT9mdW5jdGlvbiB0KG4pe2cucmVhZCgpLnRoZW4oKGE9PntpZighYS5kb25lKXtpZihhLnZhbHVlIGluc3RhbmNlb2YgUlRDRW5jb2RlZFZpZGVvRnJhbWUpe2NvbnN0IHQ9ZC5zaGlmdCgpO3QmJihhLnZhbHVlLmRhdGE9ZShhLnZhbHVlLmRhdGEsdCkpfWMud3JpdGUoYS52YWx1ZSksbi5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe3RyYW5zZm9ybWVkOiEwfSksdChuKX19KSl9KHUpOiJhdWRpby1tZXRhZGF0YS1yeCI9PT11Lm9wdGlvbnMubmFtZT9mdW5jdGlvbiB0KGUpe2cucmVhZCgpLnRoZW4oKGY9PntpZighZi5kb25lKXtpZihmLnZhbHVlIGluc3RhbmNlb2YgUlRDRW5jb2RlZEF1ZGlvRnJhbWUpe2NvbnN0IHQ9ZnVuY3Rpb24odCxlPSExKXtjb25zdCBmPXQuZ2V0VWludDgoMCk7aWYoZiE9PW4pcmV0dXJuO2NvbnN0IHU9dC5nZXRVaW50MTYoMSksZD1hK28rdSxsPW5ldyBVaW50OEFycmF5KHQuYnl0ZUxlbmd0aC1kKTtsLnNldChuZXcgVWludDhBcnJheSh0LmJ1ZmZlcixkLHQuYnl0ZUxlbmd0aC1kKSk7Y29uc3QgZz17bTpmLHRsdkxlbjp1LHRsdjpbXSxmcmFtZTpsfTtsZXQgYz1hK287Zm9yKDtjPGQ7KXtjb25zdCBuPXQuZ2V0VWludDgoYyksYT10LmdldFVpbnQxNihjK3IpLG89citzO2lmKG49PT1pLkFVRElPX0xFVkVMKXtsZXQgcj10LmdldFVpbnQ4KGMrbyk7Zm9yKGxldCBlPTE7ZTxhO2UrKylyPXI8PDh8dC5nZXRVaW50OChjK28rZSk7Zy50bHYucHVzaCh7dGFnOm4sbGVuZ3RoOmEsdmFsdWU6ZT8xMjdecj4+MToxMjcmcn0pfWVsc2UgaWYobj09PWkuTUVUQURBVEF8fG49PT1pLkFVRElPXzY0X0JJVF9QVFMpe2NvbnN0IGU9bmV3IFVpbnQ4QXJyYXkoYSk7Zm9yKGxldCBuPTA7bjxhO24rKyllW25dPXQuZ2V0VWludDgoYytvK24pO2cudGx2LnB1c2goe3RhZzpuLGxlbmd0aDphLHZhbHVlOmV9KX1jKz1vK2F9cmV0dXJuIGd9KG5ldyBEYXRhVmlldyhmLnZhbHVlLmRhdGEpKTtpZih0KXtjb25zdCBuPXQudGx2LmZpbmQoKHQ9PnQudGFnPT09aS5NRVRBREFUQXx8dC50YWc9PT1pLkFVRElPXzY0X0JJVF9QVFMpKTtuJiZuLnZhbHVlIGluc3RhbmNlb2YgVWludDhBcnJheSYmZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe21ldGFkYXRhOm4udmFsdWV9KSxmLnZhbHVlLmRhdGE9dC5mcmFtZS5idWZmZXJ9fWMud3JpdGUoZi52YWx1ZSksZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe3RyYW5zZm9ybWVkOiEwfSksdChlKX19KSl9KHUpOiJhdWRpby1tZXRhZGF0YS10eCI9PT11Lm9wdGlvbnMubmFtZSYmZnVuY3Rpb24gdChlKXtnLnJlYWQoKS50aGVuKChmPT57aWYoIWYuZG9uZSl7aWYoZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe2dldE1ldGFkYXRhOiEwfSksZi52YWx1ZSBpbnN0YW5jZW9mIFJUQ0VuY29kZWRBdWRpb0ZyYW1lKXtjb25zdCB0PWwuc2hpZnQoKTt0JiYoZi52YWx1ZS5kYXRhPWZ1bmN0aW9uKHQsZSxpKXtjb25zdCBmPWkuYnl0ZUxlbmd0aCx1PWYrcitzLGQ9YStvK3UsbD1uZXcgQXJyYXlCdWZmZXIodC5ieXRlTGVuZ3RoK2QpLGc9bmV3IERhdGFWaWV3KGwpO2cuc2V0VWludDgoMCxuKSxnLnNldFVpbnQxNigxLHUpLGcuc2V0VWludDgoMyxlKSxnLnNldFVpbnQxNig0LGYpO2ZvcihsZXQgdD0wO3Q8Zjt0KyspZy5zZXRVaW50OCg2K3QsaVt0XSk7Y29uc3QgYz1uZXcgVWludDhBcnJheShnLmJ1ZmZlcik7cmV0dXJuIGMuc2V0KG5ldyBVaW50OEFycmF5KHQpLGQpLGMuYnVmZmVyfShmLnZhbHVlLmRhdGEsaS5BVURJT182NF9CSVRfUFRTLHQpKX1jLndyaXRlKGYudmFsdWUpLGUub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHt0cmFuc2Zvcm1lZDohMH0pLHQoZSl9fSkpfSh1KX0sc2VsZi5wb3N0TWVzc2FnZSgicmVnaXN0ZXJlZCIpKTsK")],{type:"text/javascript"});return setTimeout((()=>cP.revokeObjectURL(e)),0),new Worker(cP.createObjectURL(e))}const uP=71,lP=1,hP=2,pP=1,fP=2;var mP=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}(mP||{});function EP(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=e.getUint8(0);if(r!==uP)return;const i=e.getUint16(1),n=lP+hP+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=lP+hP;for(;a<n;){const r=e.getUint8(a),i=e.getUint16(a+pP),n=pP+fP;if(r===mP.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===mP.METADATA||r===mP.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 _P=new Map;function TP(e,t){const{chunk:r,controller:i}=t,n=an("ENABLE_AUDIO_PTS_METADATA")?mP.AUDIO_64_BIT_PTS:mP.METADATA;r.data=function(e,t,r){const i=r.byteLength,n=i+pP+fP,o=lP+hP+n,s=new ArrayBuffer(e.byteLength+o),a=new DataView(s);a.setUint8(0,uP),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 gP=J(nT);const SP=127,vP=1e-10,RP=139/13;const yP=new Map;function AP(e,t,r){const i="".concat(e,"-").concat(t,"-").concat(r);let n=0;if(yP.has(i))n=yP.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,yP.set(i,n)}return n<vP&&(n=vP),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=yP;let OP=0;class IP{constructor(e){p_(this,"id",void 0),p_(this,"immediates",[]),p_(this,"lastNonSilence",-1),p_(this,"immediateSpeechActivityScore",vP),p_(this,"lastLevelChangedTime",Date.now()),p_(this,"levels",[]),p_(this,"longs",[]),p_(this,"longSpeechActivityScore",vP),p_(this,"mediums",[]),p_(this,"mediumSpeechActivityScore",vP),p_(this,"minLevel",0),p_(this,"nextMinLevel",0),p_(this,"nextMinLevelWindowLength",0),p_(this,"energyScore",0),this.id=e||"".concat(OP++),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+RP;let i=!1;for(let n=0;n<e.length;++n){let o=t[n];o<r&&(o=0);const s=Math.floor(o/RP);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=AP(this.immediates[0],13,.78)}evaluateLongSpeechActivityScore(e){this.longSpeechActivityScore=AP(this.longs[0],10,47),this.longSpeechActivityScore>vP&&(this.lastNonSilence=e)}evaluateMediumSpeechActivityScore(){this.mediumSpeechActivityScore=AP(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(gP(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>SP&&(r=SP),this.levels.unshift(r),this.levels.length>this.immediates.length&&this.levels.pop(),this.updateMinLevel(r),r>=this.minLevel+RP?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>SP&&(e=SP),this.minLevel=e,this.nextMinLevel=0,this.nextMinLevelWindowLength=0}}}}class CP{constructor(e){p_(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 wP{constructor(e,t,r){p_(this,"isDominant",void 0),p_(this,"energyRanking",void 0),p_(this,"energyScore",void 0),this.isDominant=e,this.energyRanking=t,this.energyScore=r}}class NP extends fi{constructor(e){super(),p_(this,"dominantId",null),p_(this,"lastDecisionTime",0),p_(this,"lastLevelChangedTime",0),p_(this,"lastLevelIdleTime",0),p_(this,"relativeSpeechActivities",[]),p_(this,"speakers",new Map),p_(this,"enableSilence",!1),p_(this,"timeoutToSilenceInterval",0),p_(this,"decisionMaker",null),p_(this,"loudest",[]),p_(this,"numLoudestToTrack",3),p_(this,"energyExpireTimeMs",250),p_(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 IP(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 wP(i,t,e.energyScore)}if(e.energyScore=Math.floor((this.energyAlphaPct*t+(100-this.energyAlphaPct)*e.energyScore+50)/100),0===this.numLoudestToTrack)return new wP(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 wP(i,s,e.energyScore)}maybeStartDecisionMaker(){!this.decisionMaker&&this.speakers.size>0&&(this.decisionMaker=new CP(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=NA(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?vP: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 NA(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 DP=new Map;let PP=null,kP=null;const LP=3;let MP=[];function UP(e,t){let r=DP.get(e);if(r||(r=function(e){const t=new IP;return DP.set(e,t),PP||(PP=new NP(an("TOPN_SILENCE_THRESHOLD")||500),PP.on("ActiveSpeakerChanged",(e=>{null!=e&&(kP=e)}))),PP.addSpeakers([t]),t}(e)),DP.size<=LP)return{selected:!0,speaker:r};if(!PP)throw new Error("no active speaker detector");PP.levelChanged(r.id,t),MP=PP.loudest.map((e=>e.id)),kP&&!sd(MP).call(MP,kP)&&MP.length>=LP&&MP.pop();return{selected:sd(MP).call(MP,r.id)||r.id===kP,speaker:r}}const xP=1e3,VP=40,FP=new Map,BP=new Map;class jP{get samples(){return this.actives+this.inactives}get activeRate(){return this.actives/this.samples}constructor(e,t){p_(this,"id",void 0),p_(this,"track",void 0),p_(this,"score",0),p_(this,"active",!0),p_(this,"muted",!1),p_(this,"timer",0),p_(this,"actives",0),p_(this,"inactives",0),this.id=e,this.track=t,this.setActive(FP.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(NA(FP).call(FP)).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>VP&&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(NA(FP).call(FP)).forEach((r=>{!r.active||r.id===e||r.samples<VP||(!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(NA(FP).call(FP)).forEach((r=>{r.active||r.id===e||r.samples<VP||(!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()}),xP)}clearTimer(){this.timer&&(clearTimeout(this.timer),this.timer=0)}}let GP;function WP(e,t,r){const i=FP.get(e)||new jP(e,t);return i.score=r,FP.set(e,i),function(e){if(BP.set(e,!0),!GP)return void(GP=Date.now());const t=Date.now();t-GP>1e3&&(BP.get(e)?BP.set(e,!1):(HP(e),BP.delete(e)),GP=t)}(e),i}function HP(e){const t=FP.get(e);t&&(FP.delete(e),t.clearTimer())}const KP=new Map,YP=new Map;function zP(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 XP(e,t){const r=function(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)}(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}const JP=new Map;const ZP=new Map;wn(),e.AUDIO_CONTEXT_EVENT=Pn,e.AUDIO_ENCODER_CONFIG_SETTINGS=_d,e.AUDIO_TRACK_EVENT=Md,e.AudioProcessorContext=UA,e.AudioProcessorDestination=MA,e.AudioSourceEvents=Ld,e.BufferSourceAudioTrack=bO,e.CameraVideoTrack=SI,e.DEFAULT_LOCAL_AUDIO_TRACK_STATS=Ud,e.DEFAULT_LOCAL_VIDEO_TRACK_STATS=xd,e.DEFAULT_NETWORK_QUALITY_STATS={uplinkNetworkQuality:0,downlinkNetworkQuality:0},e.DEFAULT_REMOTE_AUDIO_TRACK_STATS=Vd,e.DEFAULT_REMOTE_VIDEO_TRACK_STATS=Fd,e.DataChannel=GI,e.DataChannelEvents=Yd,e.DeviceManager=hA,e.DeviceManagerEvent=Wd,e.DeviceManagerState=Gd,e.LocalAudioTrack=yO,e.LocalDataChannel=class extends GI{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=By,e.LocalTrackEvents=Dd,e.LocalVideoTrack=gI,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=Hd,e.MicrophoneAudioTrack=AO,e.MixingAudioTrack=OO,e.PROCESSOR_CONTEXT_EVENTS=jd,e.PROCESSOR_DESTINATION_EVENTS=Bd,e.RemoteAudioTrack=BI,e.RemoteDataChannel=class extends GI{constructor(e){super(e),p_(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(an("SHOW_DATASTREAM2_LOG")&&Sn.debug("invalid datachannel id: ".concat(r," !== ").concat(this.id)));let i=e.data.slice(this._dataStreamPacketHeader.byteLength);i=this._dataStreamPacketHandler.deserialize(i),this.emit(Yd.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=wd,e.RemoteStreamType=Cd,e.RemoteTrack=VI,e.RemoteTrackEvents=Pd,e.RemoteVideoTrack=FI,e.SAFARI_GLOBAL_GUM_LOCK=aA,e.SUPPORT_SCREEN_ENCODER_CONFIG_LIST=hd,e.SUPPORT_SVC_CONFIG_LIST=pd,e.SUPPORT_VIDEO_ENCODER_CONFIG_LIST=ld,e.StreamType=Id,e.Track=Fy,e.TrackEvents=Nd,e.TrackHint=Od,e.TrackInternalEvent=bd,e.TrackMediaType=kd,e.VideoProcessorContext=LA,e.VideoProcessorDestination=kA,e.VideoState=Kd,e.__TRACK_LIST__=gd,e.addTrack=Sd,e.audioContextState=Hy,e.audioElementPlayCenter=vA,e.audioTimerLoop=function(e,t){let r=!1;const i=1/t;if(an("DISABLE_WEBAUDIO")){const t=window.setInterval((()=>{r?window.clearInterval(t):e(performance.now()/1e3)}),1e3*i)}else{const t=Yy();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=mA,e.blob2Uint8Array=kb,e.checkMediaStreamTrackResolution=FA,e.checkTrackState=RA,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=Li(8,"track-buf-"),a=In.reportApiInvoke(null,{id:s,tag:gi.TRACER,name:Ti.CREATE_BUFFER_AUDIO_TRACK,options:[o]});if(an("DISABLE_WEBAUDIO"))throw new ni(ii.NOT_SUPPORTED,"can not create BufferSourceAudioTrack when WebAudio disabled");Sn.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=CO.get(e);if(t)return Sn.debug("use cached audio resource: ",e),t;try{r=(await zi((()=>br.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 Vy(((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 Jy(r);return"string"==typeof e&&t&&CO.set(e,i),i}(n,r)}catch(e){return a.onError(e),e.throw(Sn)}const d=new IO(n),u=new bO(c,d,i?Td(i):{},s);return Sn.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=an("CAMERA_CAPTURE_CONFIG"),r=Li(8,"track-cam-"),i=In.reportApiInvoke(null,{id:r,tag:gi.TRACER,name:Ti.CREATE_CAM_VIDEO_TRACK,options:[RI({},e),t]});t&&(e.encoderConfig=t);const n=BA(e);let o=null;Sn.info("start create camera video track with config",JSON.stringify(e),"trackId",r);try{o=(await cA({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(Sn)}if(e.optimizationMode&&yI(r,o,e,fd(e.encoderConfig)),an("USE_STANDARD_BITRATE_DEFAULT")){const t=fd(e.encoderConfig);e.encoderConfig=t,delete t.bitrateMax,delete t.bitrateMin}const s=new SI(o,e,n,e.scalabiltyMode?Ed(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,r);return i.onSuccess(s.getTrackId()),Sn.info("create camera video success, trackId:",r),s},e.createCustomAudioTrack=function(e){const t=Li(8,"track-cus-"),r=In.reportApiInvoke(null,{id:t,tag:gi.TRACER,name:Ti.CREATE_CUSTOM_AUDIO_TRACK,options:[e]}),i=new yO(e.mediaStreamTrack,e.encoderConfig?Td(e.encoderConfig):{},t,!1);return Sn.info("create custom audio track success with config",e,"trackId",i.getTrackId()),r.onSuccess(i.getTrackId()),i},e.createCustomVideoTrack=function(e){const t=Li(8,"track-cus-"),r=In.reportApiInvoke(null,{id:t,tag:gi.TRACER,name:Ti.CREATE_CUSTOM_VIDEO_TRACK,options:[e]});an("USE_STANDARD_BITRATE_DEFAULT")&&(delete e.bitrateMax,delete e.bitrateMin);const i=new gI(e.mediaStreamTrack,{width:e.width,height:e.height,frameRate:e.frameRate,bitrateMax:e.bitrateMax,bitrateMin:e.bitrateMin},e.scalabiltyMode?Ed(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,t,[Od.CUSTOM_TRACK]);return r.onSuccess(i.getTrackId()),Sn.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=an("CAMERA_CAPTURE_CONFIG"),i=Li(8,"track-mic-"),n=Li(8,"track-cam-"),o=In.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=BA(t),a=HA(e);let c=null,d=null;Sn.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 cA({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(Sn)}if(t.optimizationMode&&yI(n,d,t,fd(t.encoderConfig)),an("USE_STANDARD_BITRATE_DEFAULT")){const e=fd(t.encoderConfig);t.encoderConfig=e,delete e.bitrateMax,delete e.bitrateMin}const u=new AO(c,e,a,i),l=new SI(d,t,s,t.scalabiltyMode?Ed(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,n);return o.onSuccess([u.getTrackId(),l.getTrackId()]),Sn.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=Li(8,"track-mic-"),r=In.reportApiInvoke(null,{id:t,tag:gi.TRACER,name:Ti.CREATE_MIC_AUDIO_TRACK,options:[e]}),i=HA(e);let n=null;Sn.info("start create microphone audio track with config",JSON.stringify(e),"trackId",t);try{n=(await cA({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(Sn)}const o=new AO(n,e,i,t);return r.onSuccess(o.getTrackId()),Sn.info("create microphone audio track success, trackId:",t),o},e.createMixingAudioTrack=function(e){const t=new OO;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?WA(t):void 0;r&&(t="auto");const i=Li(8,"track-scr-v-"),n=In.reportApiInvoke(null,{id:i,tag:gi.TRACER,name:Ti.CREATE_SCREEN_VIDEO_TRACK,options:[RI({},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=jA(e);let s=null,a=null;const c=Nn();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(Sn)}Sn.info("start create screen video track with config",e,"withAudio",t,"trackId",i);const d=c.supportShareAudio&&"disable"!==t;try{const e=await cA({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(Sn)}if(!a&&"enable"===t){s&&s.stop();const e=new ni(ii.SHARE_AUDIO_NOT_ALLOWED);return n.onError(e),e.throw(Sn)}if(e.optimizationMode||(e.optimizationMode="detail"),e.optimizationMode){yI(i,s,e,e.encoderConfig&&md(e.encoderConfig)||void 0),e.encoderConfig&&"string"!=typeof e.encoderConfig&&(e.encoderConfig.bitrateMin=e.encoderConfig.bitrateMax)}const u=new gI(s,e.encoderConfig?md(e.encoderConfig):{},e.scalabiltyMode?Ed(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,i,[Od.SCREEN_TRACK]);if(!a)return n.onSuccess(u.getTrackId()),Sn.info("create screen video track success","video:",u.getTrackId()),u;const l=new yO(a,void 0,Li(8,"track-scr-a-"),!1);return n.onSuccess([u.getTrackId(),l.getTrackId()]),Sn.info("create screen video track success","video:",u.getTrackId(),"audio:",l.getTrackId()),[u,l]},e.decodeAudioData=Jy,e.detectSupportAudioElementSetSinkId=Dn,e.deviceManager=pA,e.emptyImage2TypedArray=Pb,e.frameData2CryptoBuffer=async(e,t,r)=>await Db(e.buffer,t,r),e.getAudioContext=Yy,e.getAudioEncoderConfiguration=Td,e.getBitrateConstrainRange=wb,e.getBitrateFromResAndFps=Nb,e.getCompatibility=Nn,e.getConstraintsFromAudioConfig=GA,e.getConstraintsFromCameraConfig=BA,e.getConstraintsFromMicrophoneConfig=HA,e.getConstraintsFromScreenAudioConfig=WA,e.getConstraintsFromScreenConfig=jA,e.getElectronScreenSources=oA,e.getElectronScreenStream=iA,e.getElectronScreenStreamByUserSelect=nA,e.getLocalStream=cA,e.getNewVideoBitrate=Cb,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=Bi(s),a=Bi(a),o=Bi(o);const{max:c,min:d}=Nb(s,a,o),{bitrateMax:u,bitrateMin:l}=t||{};u||Sn.debug("calculate bitrate: [w: ".concat(s,", h: ").concat(a,", fps: ").concat(o,"] => [brMax: ").concat(u,", brMin: ").concat(l,"]"));const{maxFramerate:h}=an("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=Ed,e.getScreenEncoderConfiguration=md,e.getSilenceAudioTrack=function(){if(Qy)return Qy;const e=Yy();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),Qy=i.stream.getAudioTracks()[0],Qy},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=Lb,e.getVideoEncoderConfiguration=fd,e.handleGetUserMediaError=uA,e.hasAudioContext=zy,e.interceptLocalAudioFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Nn().supportWebRTCEncodedTransform)return void Sn.warning("browser not support audio encoded transform");if(_P.has(e))return;if(!e.track)return;const r={track:e.track};if(Ur()){if(!e.createEncodedStreams)return void Sn.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void Sn.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&&(Sn.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?TP(s,{sender:e,chunk:n,controller:o}):o.enqueue(n)}});n.readable.pipeThrough(o).pipeTo(n.writable)}else if(xr()){if("undefined"==typeof RTCRtpScriptTransform)return void Sn.warning("browser not support RTCRtpScriptTransform");const n=dP(),o=new MessageChannel;await new Vy((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 Vy((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)Sn.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=_P.get(e);if(t){_P.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){Sn.warning(e&&e.message)}}}_P.set(e,r),e.track.addEventListener("ended",i)},e.interceptLocalVideoFrame=async function(e,t){if(!Nn().supportWebRTCEncodedTransform)return void Sn.warning("browser not support video encoded transform");if(JP.has(e))return;if(!e.track)return;const r={track:e.track};if(Ur()){if(!e.createEncodedStreams)return void Sn.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void Sn.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&&(Sn.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=o.shift();s&&(t.data=XP(t.data,s)),n.enqueue(t)}});n.readable.pipeThrough(s).pipeTo(n.writable)}else{if(!xr())return;{if("undefined"==typeof RTCRtpScriptTransform)return void Sn.warning("browser not support RTCRtpScriptTransform");const n=dP(),o=new MessageChannel;await new Vy((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 Vy((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&&(Sn.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=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){Sn.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(!Nn().supportWebRTCEncodedTransform)return void Sn.warning("browser not support audio encoded transform");if(KP.has(e))return;const r={track:e.track,onMetadata:t.onMetadata};if(Ur()){if(!e.createEncodedStreams)return void Sn.warning("browser not support createEncodedStreams() API");Gr(Ir.CHROME,87,116)||(t.enableTopn=!1);let n=null;try{n=e.createEncodedStreams()}catch(e){return void Sn.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&&(Sn.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=EP(new DataView(t.data));if(!n)return r.enqueue(t);const o=e.track.id;YP.set(o,e.track);const s=null===(i=n.tlv.find((e=>e.tag===mP.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}=UP(e,c),l=WP(o,e.track,u.energyScore);l.addSample(d),l.active&&(t.data=n.frame.buffer,r.enqueue(t))}(e,n,o):t.enableMetadata?function(e,t,r){const i=EP(new DataView(e.data));if(!i)return t.enqueue(e);const n=i.tlv.find((e=>e.tag===mP.METADATA||e.tag===mP.AUDIO_64_BIT_PTS));n&&r&&n.value instanceof Uint8Array&&r(n.value),e.data=i.frame.buffer,t.enqueue(e)}(n,o,t.onMetadata):o.enqueue(n)}});n.readable.pipeThrough(o).pipeTo(n.writable)}else if(xr()){if("undefined"==typeof RTCRtpScriptTransform)return void Sn.warning("browser not support RTCRtpScriptTransform");const t=dP(),n=new MessageChannel;await new Vy((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 Vy((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?(Sn.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)},r.worker=t}function i(){e.track.removeEventListener("ended",i),function(e){const t=KP.get(e);if(t){!function(e){const t=DP.get(e);t&&(DP.delete(e),PP&&(PP.removeSpeakers([t]),0===DP.size&&(PP.destroy(),PP=null)))}(e),HP(e.track.id),KP.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){Sn.warning(e&&e.message)}}}(e)}KP.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(!Nn().supportWebRTCEncodedTransform)return void Sn.warning("browser not support video encoded transform");if(!e.track)return;if(ZP.has(e)){const r=ZP.get(e);return void(r&&(r.onSei=t.onSei))}const r={track:e.track,onSei:t.onSei};if(Ur()){if(!e.createEncodedStreams)return void Sn.warning("browser not support createEncodedStreams() API");let t=null;try{t=e.createEncodedStreams()}catch(e){return void Sn.error("create video-encoded-streams error",e&&e.message)}const n=new TransformStream({transform(t,n){r.controller||(r.controller=n),e.track&&e.track.id!==r.track.id&&(Sn.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 o=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=zP(e.data,i,n);return new Uint8Array(s)}r++}return null}(t);o&&r.onSei&&r.onSei(o),n.enqueue(t)}});t.readable.pipeThrough(n).pipeTo(t.writable)}else if(xr()){if("undefined"==typeof RTCRtpScriptTransform)return void Sn.warning("browser not support RTCRtpScriptTransform");const t=dP(),n=new MessageChannel;await new Vy((e=>t.onmessage=t=>{"registered"===t.data&&e(void 0)}));const o=new RTCRtpScriptTransform(t,{name:"sei-rx",port:n.port2},[n.port2]);e.transform=o,await new Vy((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?(Sn.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)):t.data.sei&&r.onSei&&r.onSei(t.data.sei)},r.worker=t}function i(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",i)}!function(e){const t=ZP.get(e);if(t){ZP.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){Sn.warning(e&&e.message)}}}(e)}ZP.set(e,r),e.track.addEventListener("ended",i)},e.isAudioEncoderConfiguration=yd,e.isAudioEncoderConfigurationOrPreset=function(e){return"string"==typeof e?si(e,"profile",Object.keys(_d)):yd(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=mi,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=function(){return!Cn.supportUnifiedPlan||an("CHROME_FORCE_PLAN_B")&&Qr()},e.isScreenSourceType=Ad,e.isVideoEncoderConfiguration=Rd,e.isVideoEncoderConfigurationOrPreset=function(e){return"string"==typeof e?si(e,"profile",Object.keys(ld)):Rd(e),!0},e.polyfillAudioNode=Xy,e.removeTrack=vd,e.requestAutoplayGesture=EA,e.silenceScriptProcessHandler=qy,e.updateAgoraRTCCompatibility=wn,e.visibilityWatcher=jI}));